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

Function WritePNGChunk

src/video.cpp:459–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457
458
459static int WritePNGChunk(FILE *fp, uint32 size, const char *type, uint8 *data)
460{
461 uint32 crc;
462
463 uint8 tempo[4];
464
465 tempo[0]=size>>24;
466 tempo[1]=size>>16;
467 tempo[2]=size>>8;
468 tempo[3]=size;
469
470 if(fwrite(tempo,4,1,fp)!=1)
471 return 0;
472 if(fwrite(type,4,1,fp)!=1)
473 return 0;
474
475 if(size)
476 if(fwrite(data,1,size,fp)!=size)
477 return 0;
478
479 crc=CalcCRC32(0,(uint8 *)type,4);
480 if(size)
481 crc=CalcCRC32(crc,data,size);
482
483 tempo[0]=crc>>24;
484 tempo[1]=crc>>16;
485 tempo[2]=crc>>8;
486 tempo[3]=crc;
487
488 if(fwrite(tempo,4,1,fp)!=1)
489 return 0;
490 return 1;
491}
492
493uint32 GetScreenPixel(int x, int y, bool usebackup) {
494

Callers 1

SaveSnapshotFunction · 0.85

Calls 1

CalcCRC32Function · 0.85

Tested by

no test coverage detected