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

Function LoadPRG

src/unif.cpp:256–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static int LoadPRG(FCEUFILE *fp) {
257 int z, t;
258 z = uchead.ID[3] - '0';
259
260 if (z < 0 || z > 15)
261 return(0);
262 FCEU_printf(" PRG ROM %d size: %d", z, (int)uchead.info);
263 if (malloced[z])
264 free(malloced[z]);
265 t = FixRomSize(uchead.info, 2048);
266 if (!(malloced[z] = (uint8*)FCEU_malloc(t)))
267 return(0);
268 mallocedsizes[z] = t;
269 memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);
270 if (FCEU_fread(malloced[z], 1, uchead.info, fp) != uchead.info) {
271 FCEU_printf("Read Error!\n");
272 return(0);
273 } else
274 FCEU_printf("\n");
275
276 SetupCartPRGMapping(z, malloced[z], t, 0);
277 return(1);
278}
279
280static int SetBoardName(FCEUFILE *fp) {
281 if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1)))

Callers

nothing calls this directly

Calls 5

FCEU_printfFunction · 0.85
FixRomSizeFunction · 0.85
FCEU_mallocFunction · 0.85
FCEU_freadFunction · 0.85
SetupCartPRGMappingFunction · 0.85

Tested by

no test coverage detected