MCPcopy Create free account
hub / github.com/WilliamLCobb/iNDS / rom_init_path

Function rom_init_path

desmume/src/NDSSystem.cpp:471–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471static int rom_init_path(const char *filename, const char *logicalFilename)
472{
473 int type = ROM_NDS;
474
475 path.init(logicalFilename);
476
477 if ( path.isdsgba(path.path)) {
478 type = ROM_DSGBA;
479 loadrom(path.path);
480 }
481 else if ( !strcasecmp(path.extension().c_str(), "nds")) {
482 type = ROM_NDS;
483 loadrom(path.path); //n.b. this does nothing if the file can't be found (i.e. if it was an extracted tempfile)...
484 //...but since the data was extracted to gameInfo then it is ok
485 }
486 //ds.gba in archives, it's already been loaded into memory at this point
487 else if (path.isdsgba(std::string(logicalFilename))) {
488 type = ROM_DSGBA;
489 } else {
490 //well, try to load it as an nds rom anyway
491 type = ROM_NDS;
492 loadrom(path.path);
493 }
494
495 if(type == ROM_DSGBA)
496 {
497 std::vector<char> v(gameInfo.romdata + DSGBA_LOADER_SIZE, gameInfo.romdata + gameInfo.romsize);
498 gameInfo.loadData(&v[0],gameInfo.romsize - DSGBA_LOADER_SIZE);
499 }
500
501 //check that size is at least the size of the header
502 if (gameInfo.romsize < 352) {
503 return -1;
504 }
505
506 return 1;
507}
508#else
509static int rom_init_path(const char *filename, const char *logicalFilename)
510{

Callers 1

NDS_LoadROMFunction · 0.85

Calls 13

loadromFunction · 0.85
strcasecmpFunction · 0.85
ROMReaderInitFunction · 0.85
NDS_FreeROMFunction · 0.85
c_strMethod · 0.80
loadDataMethod · 0.80
fillGapMethod · 0.80
initMethod · 0.45
InitMethod · 0.45
SizeMethod · 0.45
SeekMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected