| 1 | #cxx . . $ `<file>/mednafen/state.h`/ifndef _STATE_H |
| 2 | #define _STATE_Hcxx . . $ `mednafen/state.h:2:9`! |
| 3 | |
| 4 | #include "mednafen-types.h"cxx . . $ `<file>/mednafen/mednafen-types.h`/ |
| 5 | |
| 6 | typedef structcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0# |
| 7 | { |
| 8 | uint8cxx . . $ uint8# *datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data.; |
| 9 | uint32cxx . . $ uint32# loccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#loc.; |
| 10 | uint32cxx . . $ uint32# lencxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#len.; |
| 11 | uint32cxx . . $ uint32# mallocedcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#malloced.; |
| 12 | uint32cxx . . $ uint32# initial_malloccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#initial_malloc.; // A setting! |
| 13 | } StateMemcxx . . $ StateMem#; |
| 14 | |
| 15 | // Eh, we abuse the smem_* in-memory stream code |
| 16 | // in a few other places. :) |
| 17 | int32cxx . . $ int32# smem_readcxx . . $ smem_read(f3982eecb66031e).(StateMemcxx . . $ StateMem# *st, void *buffer, uint32cxx . . $ uint32# len); |
| 18 | int32cxx . . $ int32# smem_writecxx . . $ smem_write(f3982eecb66031e).(StateMemcxx . . $ StateMem# *st, void *buffer, uint32cxx . . $ uint32# len); |
| 19 | int32cxx . . $ int32# smem_putccxx . . $ smem_putc(453c298c0ba01c96).(StateMemcxx . . $ StateMem# *st, int value); |
| 20 | int32cxx . . $ int32# smem_tellcxx . . $ smem_tell(11cbcd7e5e652dd0).(StateMemcxx . . $ StateMem# *st); |
| 21 | int32cxx . . $ int32# smem_seekcxx . . $ smem_seek(bece8f0ac61bc7de).(StateMemcxx . . $ StateMem# *st, uint32cxx . . $ uint32# offset, int whence); |
| 22 | int smem_write32lecxx . . $ smem_write32le(776f7c4058af06c3).(StateMemcxx . . $ StateMem# *st, uint32cxx . . $ uint32# b); |
| 23 | int smem_read32lecxx . . $ smem_read32le(24a07498b85603a0).(StateMemcxx . . $ StateMem# *st, uint32cxx . . $ uint32# *b); |
| 24 | |
| 25 | int MDFNSS_SaveSMcxx . . $ MDFNSS_SaveSM(d855d810c36bab0b).(void *st, int, int, const void*, const void*, const void*); |
| 26 | int MDFNSS_LoadSMcxx . . $ MDFNSS_LoadSM(4d015e8c0eefb98e).(void *st, int, int); |
| 27 | |
| 28 | // Flag for a single, >= 1 byte native-endian variable |
| 29 | #define MDFNSTATE_RLSBcxx . . $ `mednafen/state.h:29:9`! 0x80000000 |
| 30 | |
| 31 | // 32-bit native-endian elements |
| 32 | #define MDFNSTATE_RLSB32cxx . . $ `mednafen/state.h:32:9`! 0x40000000 |
| 33 | |
| 34 | // 16-bit native-endian elements |
| 35 | #define MDFNSTATE_RLSB16cxx . . $ `mednafen/state.h:35:9`! 0x20000000 |
| 36 | |
| 37 | // 64-bit native-endian elements |
| 38 | #define MDFNSTATE_RLSB64cxx . . $ `mednafen/state.h:38:9`! 0x10000000 |
| 39 | |
| 40 | #define MDFNSTATE_BOOLcxx . . $ `mednafen/state.h:40:9`! 0x08000000 |
| 41 | |
| 42 | typedef structcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_1# { |
| 43 | void *vcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_1#v.; // Pointer to the variable/array |
| 44 | uint32cxx . . $ uint32# sizecxx . . $ $anonymous_type_8d6ca9fa7c8baca5_1#size.; // Length, in bytes, of the data to be saved EXCEPT: |
| 45 | // In the case of MDFNSTATE_BOOL, it is the number of bool elements to save(bool is not always 1-byte). |
| 46 | // If 0, the subchunk isn't saved. |
| 47 | uint32cxx . . $ uint32# flagscxx . . $ $anonymous_type_8d6ca9fa7c8baca5_1#flags.; // Flags |
| 48 | const char *namecxx . . $ $anonymous_type_8d6ca9fa7c8baca5_1#name.; // Name |
| 49 | //uint32 struct_size; // Only used for MDFNSTATE_ARRAYOFS, sizeof(struct) that members of the linked SFORMAT struct are in. |
| 50 | } SFORMATcxx . . $ SFORMAT#; |
| 51 | |
| 52 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! bool SF_IS_BOOLcxx . . $ SF_IS_BOOL(78ac5d2f3d401626).(bool *) { return(1); } |
| 53 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! bool SF_IS_BOOLcxx . . $ SF_IS_BOOL(db00c6a08f501612).(void *) { return(0); } |
| 54 | |
| 55 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_ABcxx . . $ SF_FORCE_AB(6eba86349545ae0f).(bool *) { return(0); } |
| 56 | |
| 57 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A8cxx . . $ SF_FORCE_A8(8e2aba6c81f7523f).(int8cxx . . $ int8# *) { return(0); } |
| 58 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A8cxx . . $ SF_FORCE_A8(df34ef224e8b6259).(uint8cxx . . $ uint8# *) { return(0); } |
| 59 | |
| 60 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A16cxx . . $ SF_FORCE_A16(f7d2637fbc7b9f5a).(int16cxx . . $ int16# *) { return(0); } |
| 61 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A16cxx . . $ SF_FORCE_A16(d7b7cfba645080ba).(uint16cxx . . $ uint16# *) { return(0); } |
| 62 | |
| 63 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A32cxx . . $ SF_FORCE_A32(2cbd27c171ff50a6).(int32cxx . . $ int32# *) { return(0); } |
| 64 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A32cxx . . $ SF_FORCE_A32(c22c494133c14864).(uint32cxx . . $ uint32# *) { return(0); } |
| 65 | |
| 66 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A64cxx . . $ SF_FORCE_A64(8ddaaf15bbcb1).(int64cxx . . $ int64# *) { return(0); } |
| 67 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_A64cxx . . $ SF_FORCE_A64(d2b3013b0b510c55).(uint64cxx . . $ uint64# *) { return(0); } |
| 68 | |
| 69 | INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint32cxx . . $ uint32# SF_FORCE_Dcxx . . $ SF_FORCE_D(a95f4eeda9715752).(double *) { return(0); } |
| 70 | |
| 71 | #define SFVARNcxx . . $ `mednafen/state.h:71:9`!(x, n) { &(x), SF_IS_BOOL(&(x)) ? 1 : (uint32_t)sizeof(x), MDFNSTATE_RLSB | (SF_IS_BOOL(&(x)) ? MDFNSTATE_BOOL : 0), n } |
| 72 | #define SFVARcxx . . $ `mednafen/state.h:72:9`!(x) SFVARN((x), #x) |
| 73 | |
| 74 | #define SFARRAYNcxx . . $ `mednafen/state.h:74:9`!(x, l, n) { (x), (uint32)(l), 0 | SF_FORCE_A8(x), n } |
| 75 | #define SFARRAYcxx . . $ `mednafen/state.h:75:9`!(x, l) SFARRAYN((x), (l), #x) |
| 76 | |
| 77 | #define SFARRAYBNcxx . . $ `mednafen/state.h:77:9`!(x, l, n) { (x), (uint32)(l), MDFNSTATE_BOOL | SF_FORCE_AB(x), n } |
| 78 | #define SFARRAYBcxx . . $ `mednafen/state.h:78:9`!(x, l) SFARRAYBN((x), (l), #x) |
| 79 | |
| 80 | #define SFARRAY16Ncxx . . $ `mednafen/state.h:80:9`!(x, l, n) { (x), (uint32)((l) * sizeof(uint16)), MDFNSTATE_RLSB16 | SF_FORCE_A16(x), n } |
| 81 | #define SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(x, l) SFARRAY16N((x), (l), #x) |
| 82 | |
| 83 | #define SFARRAY32Ncxx . . $ `mednafen/state.h:83:9`!(x, l, n) { (x), (uint32)((l) * sizeof(uint32)), MDFNSTATE_RLSB32 | SF_FORCE_A32(x), n } |
| 84 | #define SFARRAY32cxx . . $ `mednafen/state.h:84:9`!(x, l) SFARRAY32N((x), (l), #x) |
| 85 | |
| 86 | #define SFARRAY64Ncxx . . $ `mednafen/state.h:86:9`!(x, l, n) { (x), (uint32)((l) * sizeof(uint64)), MDFNSTATE_RLSB64 | SF_FORCE_A64(x), n } |
| 87 | #define SFARRAY64cxx . . $ `mednafen/state.h:87:9`!(x, l) SFARRAY64N((x), (l), #x) |
| 88 | |
| 89 | #if SIZEOF_DOUBLEcxx . . $ `<built-in>:484:9`! != 8 |
| 90 | #error "sizeof(double) != 8" |
| 91 | #endif |
| 92 | |
| 93 | #define SFARRAYDNcxx . . $ `mednafen/state.h:93:9`!(x, l, n) { (x), (uint32)((l) * 8), MDFNSTATE_RLSB64 | SF_FORCE_D(x), n } |
| 94 | #define SFARRAYDcxx . . $ `mednafen/state.h:94:9`!(x, l) SFARRAYDN((x), (l), #x) |
| 95 | |
| 96 | #define SFENDcxx . . $ `mednafen/state.h:96:9`! { 0, 0, 0, 0 } |
| 97 | |
| 98 | #include <vector> |
| 99 | |
| 100 | // State-Section Descriptor |
| 101 | class SSDescriptorcxx . . $ SSDescriptor# |
| 102 | { |
| 103 | public: |
| 104 | SSDescriptorcxx . . $ SSDescriptor#SSDescriptor(3e11acb8200f8958).(SFORMATcxx . . $ SFORMAT# *n_sf, const char *n_name, bool n_optional = 0) |
| 105 | { |
| 106 | sfcxx . . $ SSDescriptor#sf. = n_sf; |
| 107 | namecxx . . $ SSDescriptor#name. = n_name; |
| 108 | optionalcxx . . $ SSDescriptor#optional. = n_optional; |
| 109 | } |
| 110 | ~cxx . . $ SSDescriptor#`~SSDescriptor`(ced63f7c635d850d).SSDescriptorcxx . . $ SSDescriptor#(void) |
| 111 | { |
| 112 | |
| 113 | } |
| 114 | |
| 115 | SFORMATcxx . . $ SFORMAT# *sfcxx . . $ SSDescriptor#sf.; |
| 116 | const char *namecxx . . $ SSDescriptor#name.; |
| 117 | bool optionalcxx . . $ SSDescriptor#optional.; |
| 118 | }; |
| 119 | |
| 120 | int MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(eba9425d234c8c23).(void *st, int load, int data_only, stdcxx . . $ std/::vectorcxx . . $ std/vector# <SSDescriptorcxx . . $ SSDescriptor#> §ions); |
| 121 | int MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(void *st, int load, int data_only, SFORMATcxx . . $ SFORMAT# *sf, const char *name, bool optional = 0); |
| 122 | |
| 123 | #endif |