MCPcopy Create free account
hub / github.com/TASEmulators/fceux / AddExState

Function AddExState

src/state.cpp:871–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869}
870
871void AddExState(void *v, uint32 s, int type, const char *desc)
872{
873 //do not accept extra state information if a null pointer was provided for v, so list won't terminate early
874 if (v == 0) return;
875
876 if(s==~0u)
877 {
878 SFORMAT* sf = (SFORMAT*)v;
879 std::map<std::string,bool> names;
880 while(sf->v)
881 {
882 char tmp[5] = {0};
883 memcpy(tmp,sf->desc,4);
884 std::string desc = tmp;
885 if(names.find(desc) != names.end())
886 {
887#ifdef __WIN_DRIVER__
888 MessageBox(NULL,"OH NO!!! YOU HAVE AN INVALID SFORMAT! POST A BUG TICKET ALONG WITH INFO ON THE ROM YOURE USING\n","OOPS",MB_OK);
889#else
890 printf("OH NO!!! YOU HAVE AN INVALID SFORMAT! POST A BUG TICKET ALONG WITH INFO ON THE ROM YOURE USING\n");
891#endif
892 exit(0);
893 }
894 names[desc] = true;
895 sf++;
896 }
897 }
898
899 if(desc)
900 {
901 SFMDATA[SFEXINDEX].desc=(const char *)FCEU_malloc(strlen(desc)+1);
902 strcpy( (char*)SFMDATA[SFEXINDEX].desc,desc);
903 }
904 else
905 SFMDATA[SFEXINDEX].desc=0;
906 SFMDATA[SFEXINDEX].v=v;
907 SFMDATA[SFEXINDEX].s=s;
908 if(type) SFMDATA[SFEXINDEX].s|=RLSB;
909 if(SFEXINDEX<SFMDATA_SIZE-1)
910 SFEXINDEX++;
911 else
912 {
913 static int once=1;
914 if(once)
915 {
916 once=0;
917 FCEU_PrintError("Error in AddExState: SFEXINDEX overflow.\nSomebody made SFMDATA_SIZE too small.");
918 }
919 }
920 SFMDATA[SFEXINDEX].v=0; // End marker.
921}
922
923void FCEUI_SelectStateNext(int n)
924{

Callers 15

FDSSoundStateAddFunction · 0.85
FDSLoadFunction · 0.85
NSF_initFunction · 0.85
MooMirroringFunction · 0.85
InitializeBoardFunction · 0.85
iNES_InitFunction · 0.85
BMCHP898F_InitFunction · 0.85
UNLBMW8544_InitFunction · 0.85
Mapper112_InitFunction · 0.85
Mapper79_InitFunction · 0.85
BMC13in1JY110_InitFunction · 0.85
UNLKS7013B_InitFunction · 0.85

Calls 2

FCEU_mallocFunction · 0.85
FCEU_PrintErrorFunction · 0.85

Tested by

no test coverage detected