| 1 | #ifndef _STATE_H |
| 2 | #define _STATE_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #include <boolean.h> |
| 7 | #include <retro_inline.h> |
| 8 | |
| 9 | typedef struct |
| 10 | { |
| 11 | uint8_t *data; |
| 12 | uint32_t loc; |
| 13 | uint32_t len; |
| 14 | uint32_t malloced; |
| 15 | uint32_t initial_malloc; /* A setting! */ |
| 16 | } StateMem; |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | int MDFNSS_SaveSM(void *st, int, int, const void*, const void*, const void*); |
| 23 | int MDFNSS_LoadSM(void *st, int, int); |
| 24 | |
| 25 | /* Flag for a single, >= 1 byte native-endian variable */ |
| 26 | #define MDFNSTATE_RLSB 0x80000000 |
| 27 | /* 32-bit native-endian elements */ |
| 28 | #define MDFNSTATE_RLSB32 0x40000000 |
| 29 | /* 16-bit native-endian elements */ |
| 30 | #define MDFNSTATE_RLSB16 0x20000000 |
| 31 | /* 64-bit native-endian elements */ |
| 32 | #define MDFNSTATE_RLSB64 0x10000000 |
| 33 | |
| 34 | #define MDFNSTATE_BOOL 0x08000000 |
| 35 | |
| 36 | typedef struct |
| 37 | { |
| 38 | void *v; /* Pointer to the variable/array */ |
| 39 | uint32_t size; /* Length, in bytes, of the data to be saved EXCEPT: |
| 40 | * In the case of MDFNSTATE_BOOL, it is the number |
| 41 | * of bool elements to save(bool is not always 1-byte). |
| 42 | * |
| 43 | * If 0, the subchunk isn't saved. |
| 44 | */ |
| 45 | uint32_t flags; /* Flags */ |
| 46 | const char *name; /* Name */ |
| 47 | } SFORMAT; |
| 48 | |
| 49 | /* State-Section Descriptor */ |
| 50 | struct SSDescriptor |
| 51 | { |
| 52 | |
| 53 | SFORMAT *sf; |
| 54 | const char *name; |
| 55 | }; |
| 56 | |
| 57 | int MDFNSS_StateAction(void *st, int load, int data_only, SFORMAT *sf, const char *name, bool optional); |
| 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #endif |