truelight@0: #ifndef HAL_H truelight@0: #define HAL_H truelight@0: truelight@0: typedef struct { truelight@0: char *(*start)(char **parm); tron@1093: void (*stop)(void); truelight@0: } HalCommonDriver; truelight@0: truelight@0: typedef struct { truelight@0: const char *(*start)(char **parm); tron@1093: void (*stop)(void); truelight@0: void (*make_dirty)(int left, int top, int width, int height); tron@1093: int (*main_loop)(void); truelight@0: bool (*change_resolution)(int w, int h); truelight@0: } HalVideoDriver; truelight@0: truelight@0: enum { truelight@0: ML_QUIT = 0, truelight@0: ML_SWITCHDRIVER = 1, truelight@0: }; truelight@0: truelight@0: typedef struct { truelight@0: char *(*start)(char **parm); tron@1093: void (*stop)(void); truelight@0: } HalSoundDriver; truelight@0: truelight@0: typedef struct { truelight@0: char *(*start)(char **parm); tron@1093: void (*stop)(void); truelight@0: truelight@0: void (*play_song)(const char *filename); tron@1093: void (*stop_song)(void); tron@1093: bool (*is_song_playing)(void); truelight@0: void (*set_volume)(byte vol); truelight@0: } HalMusicDriver; truelight@0: truelight@0: typedef struct { truelight@0: const char *name; truelight@0: const char *longname; truelight@0: const void *drv; darkvater@223: uint32 flags; truelight@0: } DriverDesc; truelight@0: truelight@0: enum { truelight@0: HALERR_OK = 0, truelight@0: HALERR_ERROR = 1, truelight@0: }; truelight@0: truelight@0: extern const HalMusicDriver _null_music_driver; truelight@0: extern const HalVideoDriver _null_video_driver; truelight@0: extern const HalSoundDriver _null_sound_driver; truelight@0: truelight@0: VARDEF HalMusicDriver *_music_driver; truelight@0: VARDEF HalSoundDriver *_sound_driver; truelight@0: VARDEF HalVideoDriver *_video_driver; truelight@0: truelight@0: extern const DriverDesc _video_driver_descs[]; truelight@0: extern const DriverDesc _sound_driver_descs[]; truelight@0: extern const DriverDesc _music_driver_descs[]; truelight@0: truelight@0: #if defined(WITH_SDL) truelight@0: extern const HalSoundDriver _sdl_sound_driver; truelight@0: extern const HalVideoDriver _sdl_video_driver; truelight@0: #endif truelight@0: truelight@0: #if defined(UNIX) truelight@0: extern const HalMusicDriver _extmidi_music_driver; truelight@193: #endif truelight@0: truelight@0: #if defined(__BEOS__) truelight@0: extern const HalMusicDriver _bemidi_music_driver; truelight@0: #endif truelight@0: truelight@810: #if defined(__OS2__) truelight@810: extern const HalMusicDriver _os2_music_driver; truelight@810: #endif truelight@810: truelight@543: extern const HalVideoDriver _dedicated_video_driver; truelight@543: truelight@0: enum DriverType { truelight@0: VIDEO_DRIVER = 0, truelight@0: SOUND_DRIVER = 1, truelight@0: MUSIC_DRIVER = 2, truelight@0: }; truelight@0: tron@1093: extern void GameLoop(void); truelight@0: extern bool _dbg_screen_rect; truelight@0: truelight@0: void LoadDriver(int driver, const char *name); truelight@0: truelight@0: char *GetDriverParam(char **parm, const char *name); truelight@0: bool GetDriverParamBool(char **parm, const char *name); truelight@0: int GetDriverParamInt(char **parm, const char *name, int def); truelight@0: truelight@0: truelight@0: truelight@0: // Deals with finding savegames truelight@0: typedef struct { truelight@0: uint16 id; truelight@0: byte type; truelight@0: uint64 mtime; truelight@0: char title[64]; truelight@0: char name[256-12-64]; truelight@0: int old_extension; truelight@0: } FiosItem; truelight@0: truelight@0: // extensions of old savegames, scenarios truelight@0: static const char* const _old_extensions[] = { truelight@0: // old savegame types truelight@0: "ss1", // Transport Tycoon Deluxe preset game truelight@0: "sv1", // Transport Tycoon Deluxe (Patch) saved game truelight@0: "sv2", // Transport Tycoon Deluxe (Patch) saved 2-player game truelight@0: // old scenario game type truelight@0: "sv0", // Transport Tycoon Deluxe (Patch) scenario truelight@0: "ss0", // Transport Tycoon Deluxe preset scenario truelight@0: }; truelight@0: truelight@0: enum { truelight@0: FIOS_TYPE_DRIVE = 0, truelight@0: FIOS_TYPE_PARENT = 1, truelight@0: FIOS_TYPE_DIR = 2, truelight@0: FIOS_TYPE_FILE = 3, truelight@0: FIOS_TYPE_OLDFILE = 4, truelight@0: FIOS_TYPE_SCENARIO = 5, truelight@0: FIOS_TYPE_OLD_SCENARIO = 6, truelight@0: }; truelight@0: truelight@543: truelight@543: // Variables to display file lists truelight@543: FiosItem *_fios_list; truelight@543: int _fios_num; truelight@543: int _saveload_mode; truelight@543: truelight@0: // get the name of an oldstyle savegame truelight@0: void GetOldSaveGameName(char *title, const char *file); truelight@0: // get the name of an oldstyle scenario truelight@0: void GetOldScenarioGameName(char *title, const char *file); truelight@0: truelight@0: // Get a list of savegames truelight@0: FiosItem *FiosGetSavegameList(int *num, int mode); truelight@0: // Get a list of scenarios truelight@0: FiosItem *FiosGetScenarioList(int *num, int mode); truelight@0: // Free the list of savegames tron@1093: void FiosFreeSavegameList(void); truelight@0: // Browse to. Returns a filename w/path if we reached a file. truelight@0: char *FiosBrowseTo(const FiosItem *item); truelight@0: // Get descriptive texts. truelight@0: // Returns a path as well as a truelight@0: // string describing the path. darkvater@222: StringID FiosGetDescText(const char **path); truelight@0: // Delete a name truelight@0: void FiosDelete(const char *name); truelight@0: // Make a filename from a name truelight@0: void FiosMakeSavegameName(char *buf, const char *name); truelight@0: tron@1093: void CreateConsole(void); truelight@0: truelight@0: #endif /* HAL_H */