beetle-pce-fast-libretro/mednafen/state.h

59 lines
1.4 KiB
C
Raw Normal View History

2012-06-03 15:48:14 +00:00
#ifndef _STATE_H
#define _STATE_H
2020-07-05 18:48:01 +00:00
#include <stdint.h>
2020-07-05 18:13:04 +00:00
/* Flag for a single, >= 1 byte native-endian variable */
#define MDFNSTATE_RLSB 0x80000000
/* 32-bit native-endian elements */
#define MDFNSTATE_RLSB32 0x40000000
/* 16-bit native-endian elements */
#define MDFNSTATE_RLSB16 0x20000000
/* 64-bit native-endian elements */
#define MDFNSTATE_RLSB64 0x10000000
#define MDFNSTATE_BOOL 0x08000000
2016-08-06 15:12:28 +00:00
2012-06-03 15:48:14 +00:00
typedef struct
{
uint8_t *data;
uint8_t *data_frontend; /* never realloc'd */
uint32_t loc;
uint32_t len;
uint32_t malloced;
2020-07-05 18:13:04 +00:00
uint32_t initial_malloc; /* A setting! */
2012-06-03 15:48:14 +00:00
} StateMem;
2020-07-05 18:13:04 +00:00
typedef struct
{
void *v; /* Pointer to the variable/array */
uint32_t size; /* Length, in bytes, of the data to be saved EXCEPT:
* In the case of MDFNSTATE_BOOL, it is the number of bool elements to save(bool is not always 1-byte).
* If 0, the subchunk isn't saved. */
uint32_t flags; /* Flags */
const char *name; /* Name */
2012-06-03 15:48:14 +00:00
} SFORMAT;
2020-07-05 18:13:04 +00:00
/* State-Section Descriptor */
2017-12-20 05:00:58 +00:00
struct SSDescriptor
2012-06-03 15:48:14 +00:00
{
2017-12-20 05:00:58 +00:00
SFORMAT *sf;
const char *name;
2012-06-03 15:48:14 +00:00
};
2020-07-05 18:13:04 +00:00
#ifdef __cplusplus
extern "C" {
#endif
int MDFNSS_SaveSM(void *st, int a, int b, const void *c, const void *d, const void *e);
int MDFNSS_LoadSM(void *st, int a, int b);
2017-12-20 05:00:58 +00:00
int MDFNSS_StateAction(void *st, int load, int data_only, SFORMAT *sf, const char *name, bool optional);
2012-06-03 15:48:14 +00:00
2020-07-05 18:13:04 +00:00
#ifdef __cplusplus
}
#endif
2012-06-03 15:48:14 +00:00
#endif