MCPcopy Create free account
hub / github.com/dborth/fceugx / GCMemROM

Function GCMemROM

source/fceuload.cpp:34–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32bool romLoaded = false;
33
34int GCMemROM(int size)
35{
36 bool biosError = false;
37
38 ResetGameLoaded();
39
40 CloseGame();
41 GameInfo = new FCEUGI();
42 memset(GameInfo, 0, sizeof(FCEUGI));
43
44 GameInfo->filename = strdup(romFilename);
45 GameInfo->archiveCount = 0;
46
47 /*** Set some default values ***/
48 GameInfo->name=0;
49 GameInfo->type=GIT_CART;
50 GameInfo->vidsys=(EGIV)GetFCEUTiming();
51 UpdateDendy();
52 GameInfo->input[0]=GameInfo->input[1]=SI_UNSET;
53 GameInfo->inputfc=SIFC_UNSET;
54 GameInfo->cspecial=SIS_NONE;
55
56 /*** Set internal sound information ***/
57 SetSampleRate();
58 FCEUI_SetSoundVolume(100); // 0-100
59 FCEUI_SetLowPass(0);
60
61 FCEUFILE * fceufp = new FCEUFILE();
62 fceufp->size = size;
63 fceufp->filename = romFilename;
64 fceufp->mode = FCEUFILE::READ; // read only
65 EMUFILE_MEMFILE *fceumem = new EMUFILE_MEMFILE(nesrom, size);
66 fceufp->stream = fceumem;
67
68 romLoaded = iNESLoad(romFilename, fceufp, 1);
69
70 if(!romLoaded)
71 {
72 romLoaded = UNIFLoad(romFilename, fceufp);
73 }
74
75 if(!romLoaded)
76 {
77 romLoaded = NSFLoad(romFilename, fceufp);
78 }
79
80 if(!romLoaded)
81 {
82 // read FDS BIOS into FDSBIOS - should be 8192 bytes
83 if (FDSBIOS[1] == 0)
84 {
85 size_t biosSize = 0;
86 char filepath[1024];
87
88 AllocSaveBuffer ();
89
90 sprintf (filepath, "%s%s/disksys.rom", pathPrefix[GCSettings.LoadMethod], APPFOLDER);
91 biosSize = LoadFile(filepath, SILENT);

Callers 1

BrowserLoadFileFunction · 0.85

Calls 15

ResetGameLoadedFunction · 0.85
CloseGameFunction · 0.85
GetFCEUTimingFunction · 0.85
UpdateDendyFunction · 0.85
SetSampleRateFunction · 0.85
FCEUI_SetSoundVolumeFunction · 0.85
FCEUI_SetLowPassFunction · 0.85
iNESLoadFunction · 0.85
UNIFLoadFunction · 0.85
NSFLoadFunction · 0.85
AllocSaveBufferFunction · 0.85
LoadFileFunction · 0.85

Tested by

no test coverage detected