| 1 | #ifndef _MDFN_SETTINGS_COMMON_H |
| 2 | #define _MDFN_SETTINGS_COMMON_H |
| 3 | typedef enum |
| 4 | { |
| 5 | // Actual base types |
| 6 | MDFNST_INT = 0, // (signed), int8, int16, int32, int64(saved as) |
| 7 | MDFNST_UINT, // uint8, uint16, uint32, uint64(saved as) |
| 8 | MDFNST_BOOL, // bool. bool. bool! |
| 9 | MDFNST_FLOAT, // float, double(saved as). |
| 10 | MDFNST_STRING, |
| 11 | MDFNST_ENUM, // Handled like a string, but validated against the enumeration list, and MDFN_GetSettingUI() returns the number in the enumeration list. |
| 12 | |
| 13 | MDFNST_ALIAS |
| 14 | } MDFNSettingType; |
| 15 | |
| 16 | |
| 17 | //#define MDFNST_EX_DRIVER = (1 << 16), // If this is not set, the setting is assumed to be internal. This...should probably be set automatically? |
| 18 | |
| 19 | #define MDFNSF_NOFLAGS 0 // Always 0, makes setting definitions prettier...maybe. |
| 20 | |
| 21 | // TODO(cats) |
| 22 | #define MDFNSF_CAT_INPUT (1 << 8) |
| 23 | #define MDFNSF_CAT_SOUND (1 << 9) |
| 24 | #define MDFNSF_CAT_VIDEO (1 << 10) |
| 25 | |
| 26 | #define MDFNSF_EMU_STATE (1 << 17) // If the setting affects emulation from the point of view of the emulated program |
| 27 | #define MDFNSF_UNTRUSTED_SAFE (1 << 18) // If it's safe for an untrusted source to modify it, probably only used in conjunction with |
| 28 | // MDFNST_EX_EMU_STATE and network play |
| 29 | |
| 30 | #define MDFNSF_SUPPRESS_DOC (1 << 19) // Suppress documentation generation for this setting. |
| 31 | #define MDFNSF_COMMON_TEMPLATE (1 << 20) // Auto-generated common template setting(like nes.xscale, pce.xscale, vb.xscale, nes.enable, pce.enable, vb.enable) |
| 32 | // TODO: |
| 33 | // #define MDFNSF_WILL_BREAK_GAMES (1 << ) // If changing the value of the setting from the default value will break games/programs that would otherwise work. |
| 34 | |
| 35 | // TODO(in progress): |
| 36 | #define MDFNSF_REQUIRES_RELOAD (1 << 24) // If a game reload is required for the setting to take effect. |
| 37 | #define MDFNSF_REQUIRES_RESTART (1 << 25) // If Mednafen restart is required for the setting to take effect. |
| 38 | |
| 39 | typedef struct |
| 40 | { |
| 41 | const char *string; |
| 42 | int number; |
| 43 | const char *description; // Short |
| 44 | const char *description_extra; // Extra verbose text appended to the short description. |
| 45 | } MDFNSetting_EnumList; |
| 46 | |
| 47 | typedef struct |
| 48 | { |
| 49 | const char *name; |
| 50 | uint32 flags; |
| 51 | const char *description; // Short |
| 52 | const char *description_extra; |
| 53 | |
| 54 | MDFNSettingType type; |
| 55 | const char *default_value; |
| 56 | const char *minimum; |
| 57 | const char *maximum; |
| 58 | bool (*validate_func)(const char *name, const char *value); |
| 59 | void (*ChangeNotification)(const char *name); |
| 60 | const MDFNSetting_EnumList *enum_list; |
| 61 | } MDFNSetting; |
| 62 | |
| 63 | typedef struct __MDFNCS |
| 64 | { |
| 65 | char *name; |
| 66 | char *value; |
| 67 | char *game_override; // per-game setting override(netplay_override > game_override > value, in precedence) |
| 68 | |
| 69 | const MDFNSetting *desc; |
| 70 | void (*ChangeNotification)(const char *name); |
| 71 | |
| 72 | uint32 name_hash; |
| 73 | } MDFNCS; |
| 74 | |
| 75 | #endif |