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

Function ReadStateChunk

src/state.cpp:213–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213static bool ReadStateChunk(EMUFILE* is, SFORMAT *sf, int size)
214{
215 SFORMAT *tmp;
216 int temp = is->ftell();
217
218 while(is->ftell()<temp+size)
219 {
220 uint32 tsize;
221 char toa[4];
222 if(is->fread(toa,4)<4)
223 return false;
224
225 read32le(&tsize,is);
226
227 if((tmp=CheckS(sf,tsize,toa)))
228 {
229 if(tmp->s&FCEUSTATE_INDIRECT)
230 is->fread(*(char **)tmp->v,tmp->s&(~FCEUSTATE_FLAGS));
231 else
232 is->fread((char *)tmp->v,tmp->s&(~FCEUSTATE_FLAGS));
233
234#ifdef FCEU_BIG_ENDIAN
235 if(tmp->s&RLSB)
236 FlipByteOrder((uint8*)tmp->v,tmp->s&(~FCEUSTATE_FLAGS));
237#endif
238 }
239 else
240 is->fseek(tsize,SEEK_CUR);
241 } // while(...)
242 return true;
243}
244
245static int read_sfcpuc=0, read_snd=0;
246

Callers 1

ReadStateChunksFunction · 0.85

Calls 6

CheckSFunction · 0.85
freadMethod · 0.80
FlipByteOrderFunction · 0.70
read32leFunction · 0.50
ftellMethod · 0.45
fseekMethod · 0.45

Tested by

no test coverage detected