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

Function ReadStateChunks

src/state.cpp:249–372  ·  view source on GitHub ↗

mbg merge 7/17/06 YUCKY had to add

Source from the content-addressed store, hash-verified

247void FCEUD_BlitScreen(uint8 *XBuf); //mbg merge 7/17/06 YUCKY had to add
248void UpdateFCEUWindow(void); //mbg merge 7/17/06 YUCKY had to add
249static bool ReadStateChunks(EMUFILE* is, int32 totalsize)
250{
251 int t;
252 uint32 size;
253 bool ret=true;
254 bool warned=false;
255
256 read_sfcpuc=0;
257 read_snd=0;
258
259 //mbg 6/16/08 - wtf
260 //// int moo=X.mooPI;
261 // if(!scan_chunks)
262 // X.mooPI=/*X.P*/0xFF;
263
264 while(totalsize > 0)
265 {
266 t=is->fgetc();
267 if(t==EOF) break;
268 if(!read32le(&size,is)) break;
269 totalsize -= size + 5;
270
271 switch(t)
272 {
273 case 1:if(!ReadStateChunk(is,SFCPU,size)) ret=false;break;
274 case 3:if(!ReadStateChunk(is,FCEUPPU_STATEINFO,size)) ret=false;break;
275 case 31:if(!ReadStateChunk(is,FCEU_NEWPPU_STATEINFO,size)) ret=false;break;
276 case 4:if(!ReadStateChunk(is,FCEUCTRL_STATEINFO,size)) ret=false;break;
277 case 7:
278 if(!FCEUMOV_ReadState(is,size)) {
279 //allow this to fail in old-format savestates.
280 if(!FCEU_state_loading_old_format)
281 ret=false;
282 }
283 break;
284 case 0x10:
285 if(!ReadStateChunk(is,SFMDATA,size))
286 ret=false;
287 break;
288
289 // now it gets hackier:
290 case 5:
291 if(!ReadStateChunk(is,FCEUSND_STATEINFO,size))
292 ret=false;
293 else
294 read_snd=1;
295 break;
296 case 6:
297 if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD|MOVIEMODE_FINISHED))
298 {
299 if(!ReadStateChunk(is,FCEUMOV_STATEINFO,size)) ret=false;
300 }
301 else
302 {
303 is->fseek(size,SEEK_CUR);
304 }
305 break;
306 case 8:

Callers 2

FCEUSS_LoadFP_oldFunction · 0.85
FCEUSS_LoadFPFunction · 0.85

Calls 10

ReadStateChunkFunction · 0.85
FCEUMOV_ReadStateFunction · 0.85
FCEUMOV_ModeFunction · 0.85
FCEUD_BlitScreenFunction · 0.85
UpdateFCEUWindowFunction · 0.85
freadMethod · 0.80
read32leFunction · 0.50
FCEUD_PrintErrorFunction · 0.50
fgetcMethod · 0.45
fseekMethod · 0.45

Tested by

no test coverage detected