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

Function FCEUI_LoadState

src/state.cpp:967–1027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965 return false;
966}
967void FCEUI_LoadState(const char *fname, bool display_message)
968{
969 if(!FCEU_IsValidUI(FCEUI_LOADSTATE)) return;
970
971 StateShow = 0;
972 loadStateFailed = 0;
973
974 /* For network play, be load the state locally, and then save the state to a temporary file,
975 and send that. This insures that if an older state is loaded that is missing some
976 information expected in newer save states, desynchronization won't occur(at least not
977 from this ;)).
978 */
979 if (backupSavestates)
980 BackupLoadState(); // If allowed, backup the current state before loading a new one
981
982 if (!movie_readonly && autoMovieBackup && freshMovie) //If auto-backup is on, movie has not been altered this session and the movie is in read+write mode
983 {
984 FCEUI_MakeBackupMovie(false); //Backup the movie before the contents get altered, but do not display messages
985 }
986 if (fname != NULL && !file_exists(fname))
987 {
988 loadStateFailed = 1;
989 return; // state doesn't exist; exit cleanly
990 }
991
992 if (FCEUSS_Load(fname, display_message))
993 {
994 //in case we're loading a savestate made with old ppu, we need to make sure ppur's regs used for dividing are ready to go
995 newppu_hacky_emergency_reset();
996
997 //mbg todo netplay
998#if 0
999 if(FCEUnetplay)
1000 {
1001 char *fn = strdup(FCEU_MakeFName(FCEUMKF_NPTEMP, 0, 0).c_str());
1002 FILE *fp;
1003
1004 if((fp = fopen(fn," wb")))
1005 {
1006 if(FCEUSS_SaveFP(fp,0))
1007 {
1008 fclose(fp);
1009 FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn);
1010 }
1011 else
1012 {
1013 fclose(fp);
1014 }
1015
1016 unlink(fn);
1017 }
1018
1019 free(fn);
1020 }
1021#endif
1022 freshMovie = false; //The movie has been altered so it is no longer fresh
1023 } else
1024 {

Callers 15

CommandStateLoadFunction · 0.85
FCEUD_LoadStateFromFunction · 0.85
AppWndProcFunction · 0.85
mainFunction · 0.85
FCEUD_MovieRecordToFunction · 0.85
LoadGameFunction · 0.85
FCEUD_LoadStateFromFunction · 0.85
dropEventMethod · 0.85
loadStateFromMethod · 0.85
quickLoadMethod · 0.85
loadStateMethod · 0.85
recordMovieMethod · 0.85

Calls 8

FCEU_IsValidUIFunction · 0.85
BackupLoadStateFunction · 0.85
FCEUI_MakeBackupMovieFunction · 0.85
file_existsFunction · 0.85
FCEUSS_LoadFunction · 0.85
FCEU_MakeFNameFunction · 0.85
FCEUNET_SendFileFunction · 0.85

Tested by

no test coverage detected