MCPcopy Create free account
hub / github.com/Stewmath/GameYob / initializeGameboy

Function initializeGameboy

arm9/source/main.cpp:99–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98}
99void initializeGameboy() {
100 enableSleepMode();
101 gameboyFrameCounter = 0;
102 sgbMode = false;
103
104 if (gbsMode) {
105 resultantGBMode = 1; // GBC
106 probingForBorder = false;
107 }
108 else {
109 switch(gbcModeOption) {
110 case 0: // GB
111 initGBMode();
112 break;
113 case 1: // GBC if needed
114 if (romSlot0[0x143] == 0xC0)
115 initGBCMode();
116 else
117 initGBMode();
118 break;
119 case 2: // GBC
120 if (romSlot0[0x143] == 0x80 || romSlot0[0x143] == 0xC0)
121 initGBCMode();
122 else
123 initGBMode();
124 break;
125 }
126
127 bool sgbEnhanced = romSlot0[0x14b] == 0x33 && romSlot0[0x146] == 0x03;
128 if (sgbEnhanced && resultantGBMode != 2 && probingForBorder) {
129 resultantGBMode = 2;
130 }
131 else {
132 probingForBorder = false;
133 }
134 } // !gbsMode
135
136 initMMU();
137 initCPU();
138 initLCD();
139 initGFX();
140 initSND();
141
142 if (!gbsMode && !probingForBorder && suspendStateExists) {
143 loadState(-1);
144 }
145
146 if (gbsMode)
147 gbsInit();
148
149 // We haven't calculated the # of cycles to the next hardware event.
150 cyclesToEvent = 1;
151}
152
153void initializeGameboyFirstTime() {
154 if (sgbBordersEnabled)

Callers 3

gameboyUpdateVBlankFunction · 0.85
resetFuncFunction · 0.85

Calls 10

enableSleepModeFunction · 0.85
initGBModeFunction · 0.85
initGBCModeFunction · 0.85
initMMUFunction · 0.85
initCPUFunction · 0.85
initLCDFunction · 0.85
initGFXFunction · 0.85
initSNDFunction · 0.85
loadStateFunction · 0.85
gbsInitFunction · 0.85

Tested by

no test coverage detected