| 1 | #ifndef __MDFN_MEDNAFEN_DRIVER_H |
| 2 | #define __MDFN_MEDNAFEN_DRIVER_H |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include <vector> |
| 6 | #include <string> |
| 7 | |
| 8 | #include "settings-common.h" |
| 9 | |
| 10 | extern std::vector<MDFNGI *>MDFNSystems; |
| 11 | |
| 12 | /* Indent stdout newlines +- "indent" amount */ |
| 13 | void MDFN_indent(int indent); |
| 14 | void MDFN_printf(const char *format, ...); |
| 15 | |
| 16 | #define MDFNI_printf MDFN_printf |
| 17 | |
| 18 | /* Displays an error. Can block or not. */ |
| 19 | void MDFND_PrintError(const char *s); |
| 20 | void MDFND_Message(const char *s); |
| 21 | |
| 22 | uint32 MDFND_GetTime(void); |
| 23 | void MDFND_Sleep(uint32 ms); |
| 24 | |
| 25 | #ifdef WANT_THREADING |
| 26 | /* Being threading support. */ |
| 27 | // Mostly based off SDL's prototypes and semantics. |
| 28 | // Driver code should actually define MDFN_Thread and MDFN_Mutex. |
| 29 | |
| 30 | struct MDFN_Thread; |
| 31 | struct MDFN_Mutex; |
| 32 | |
| 33 | MDFN_Thread *MDFND_CreateThread(int (*fn)(void *), void *data); |
| 34 | void MDFND_WaitThread(MDFN_Thread *thread, int *status); |
| 35 | void MDFND_KillThread(MDFN_Thread *thread); |
| 36 | |
| 37 | MDFN_Mutex *MDFND_CreateMutex(void); |
| 38 | void MDFND_DestroyMutex(MDFN_Mutex *mutex); |
| 39 | int MDFND_LockMutex(MDFN_Mutex *mutex); |
| 40 | int MDFND_UnlockMutex(MDFN_Mutex *mutex); |
| 41 | |
| 42 | /* End threading support. */ |
| 43 | #endif |
| 44 | |
| 45 | /* path = path of game/file to load. returns NULL on failure. */ |
| 46 | MDFNGI *MDFNI_LoadGame(const char *force_module, const char *path); |
| 47 | |
| 48 | MDFNGI *MDFNI_LoadCD(const char *sysname, const char *devicename); |
| 49 | |
| 50 | // Call this function as early as possible, even before MDFNI_Initialize() |
| 51 | bool MDFNI_InitializeModule(void); |
| 52 | |
| 53 | /* allocates memory. 0 on failure, 1 on success. */ |
| 54 | /* Also pass it the base directory to load the configuration file. */ |
| 55 | int MDFNI_Initialize(const char *basedir); |
| 56 | |
| 57 | /* Sets the base directory(save states, snapshots, etc. are saved in directories |
| 58 | below this directory. */ |
| 59 | void MDFNI_SetBaseDirectory(const char *dir); |
| 60 | |
| 61 | /* Closes currently loaded game */ |
| 62 | void MDFNI_CloseGame(void); |
| 63 | |
| 64 | void MDFN_DispMessage(const char *format, ...); |
| 65 | #define MDFNI_DispMessage MDFN_DispMessage |
| 66 | |
| 67 | uint32 MDFNI_CRC32(uint32 crc, uint8 *buf, uint32 len); |
| 68 | |
| 69 | // NES hackish function. Should abstract in the future. |
| 70 | int MDFNI_DatachSet(const uint8 *rcode); |
| 71 | |
| 72 | void MDFNI_DumpModulesDef(const char *fn); |
| 73 | |
| 74 | |
| 75 | #endif |