src/gba/core.c (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#include <mgba/gba/core.h>
7
8#include <mgba/core/core.h>
9#include <mgba/core/log.h>
10#include <mgba/internal/arm/debugger/debugger.h>
11#include <mgba/internal/gba/cheats.h>
12#include <mgba/internal/gba/gba.h>
13#include <mgba/internal/gba/extra/cli.h>
14#include <mgba/internal/gba/overrides.h>
15#ifndef DISABLE_THREADING
16#include <mgba/internal/gba/renderers/thread-proxy.h>
17#endif
18#include <mgba/internal/gba/renderers/video-software.h>
19#include <mgba/internal/gba/savedata.h>
20#include <mgba/internal/gba/serialize.h>
21#include <mgba-util/memory.h>
22#include <mgba-util/patch.h>
23#include <mgba-util/vfs.h>
24
25#ifndef MINIMAL_CORE
26#include <mgba/internal/gba/input.h>
27#endif
28
29struct GBACore {
30 struct mCore d;
31 struct GBAVideoSoftwareRenderer renderer;
32#ifndef DISABLE_THREADING
33 struct GBAVideoThreadProxyRenderer threadProxy;
34 int threadedVideo;
35#endif
36 int keys;
37 struct mCPUComponent* components[CPU_COMPONENT_MAX];
38 const struct Configuration* overrides;
39 struct mDebuggerPlatform* debuggerPlatform;
40 struct mCheatDevice* cheatDevice;
41};
42
43static bool _GBACoreInit(struct mCore* core) {
44 struct GBACore* gbacore = (struct GBACore*) core;
45
46 struct ARMCore* cpu = anonymousMemoryMap(sizeof(struct ARMCore));
47 struct GBA* gba = anonymousMemoryMap(sizeof(struct GBA));
48 if (!cpu || !gba) {
49 free(cpu);
50 free(gba);
51 return false;
52 }
53 core->cpu = cpu;
54 core->board = gba;
55 core->debugger = NULL;
56 gbacore->overrides = NULL;
57 gbacore->debuggerPlatform = NULL;
58 gbacore->cheatDevice = NULL;
59
60 GBACreate(gba);
61 // TODO: Restore cheats
62 memset(gbacore->components, 0, sizeof(gbacore->components));
63 ARMSetComponents(cpu, &gba->d, CPU_COMPONENT_MAX, gbacore->components);
64 ARMInit(cpu);
65
66 GBAVideoSoftwareRendererCreate(&gbacore->renderer);
67 gbacore->renderer.outputBuffer = NULL;
68
69#ifndef DISABLE_THREADING
70 gbacore->threadedVideo = false;
71 GBAVideoThreadProxyRendererCreate(&gbacore->threadProxy, &gbacore->renderer.d);
72#endif
73
74 gbacore->keys = 0;
75 gba->keySource = &gbacore->keys;
76
77#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
78 mDirectorySetInit(&core->dirs);
79#endif
80
81#ifndef MINIMAL_CORE
82 core->inputInfo = &GBAInputInfo;
83#endif
84
85 return true;
86}
87
88static void _GBACoreDeinit(struct mCore* core) {
89 ARMDeinit(core->cpu);
90 GBADestroy(core->board);
91 mappedMemoryFree(core->cpu, sizeof(struct ARMCore));
92 mappedMemoryFree(core->board, sizeof(struct GBA));
93#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
94 mDirectorySetDeinit(&core->dirs);
95#endif
96
97 struct GBACore* gbacore = (struct GBACore*) core;
98 free(gbacore->debuggerPlatform);
99 if (gbacore->cheatDevice) {
100 mCheatDeviceDestroy(gbacore->cheatDevice);
101 }
102 free(gbacore->cheatDevice);
103 mCoreConfigFreeOpts(&core->opts);
104 free(core);
105}
106
107static enum mPlatform _GBACorePlatform(const struct mCore* core) {
108 UNUSED(core);
109 return PLATFORM_GBA;
110}
111
112static void _GBACoreSetSync(struct mCore* core, struct mCoreSync* sync) {
113 struct GBA* gba = core->board;
114 gba->sync = sync;
115}
116
117static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* config) {
118 struct GBA* gba = core->board;
119 if (core->opts.mute) {
120 gba->audio.masterVolume = 0;
121 } else {
122 gba->audio.masterVolume = core->opts.volume;
123 }
124 gba->video.frameskip = core->opts.frameskip;
125
126#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
127 struct GBACore* gbacore = (struct GBACore*) core;
128 gbacore->overrides = mCoreConfigGetOverridesConst(config);
129#endif
130
131 const char* idleOptimization = mCoreConfigGetValue(config, "idleOptimization");
132 if (idleOptimization) {
133 if (strcasecmp(idleOptimization, "ignore") == 0) {
134 gba->idleOptimization = IDLE_LOOP_IGNORE;
135 } else if (strcasecmp(idleOptimization, "remove") == 0) {
136 gba->idleOptimization = IDLE_LOOP_REMOVE;
137 } else if (strcasecmp(idleOptimization, "detect") == 0) {
138 if (gba->idleLoop == IDLE_LOOP_NONE) {
139 gba->idleOptimization = IDLE_LOOP_DETECT;
140 } else {
141 gba->idleOptimization = IDLE_LOOP_REMOVE;
142 }
143 }
144 }
145
146 mCoreConfigCopyValue(&core->config, config, "gba.bios");
147
148#ifndef DISABLE_THREADING
149 mCoreConfigGetIntValue(config, "threadedVideo", &gbacore->threadedVideo);
150#endif
151}
152
153static void _GBACoreDesiredVideoDimensions(struct mCore* core, unsigned* width, unsigned* height) {
154 UNUSED(core);
155 *width = VIDEO_HORIZONTAL_PIXELS;
156 *height = VIDEO_VERTICAL_PIXELS;
157}
158
159static void _GBACoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) {
160 struct GBACore* gbacore = (struct GBACore*) core;
161 gbacore->renderer.outputBuffer = buffer;
162 gbacore->renderer.outputBufferStride = stride;
163}
164
165static void _GBACoreGetPixels(struct mCore* core, const void** buffer, size_t* stride) {
166 struct GBACore* gbacore = (struct GBACore*) core;
167 gbacore->renderer.d.getPixels(&gbacore->renderer.d, stride, buffer);
168}
169
170static void _GBACorePutPixels(struct mCore* core, const void* buffer, size_t stride) {
171 struct GBACore* gbacore = (struct GBACore*) core;
172 gbacore->renderer.d.putPixels(&gbacore->renderer.d, stride, buffer);
173}
174
175static struct blip_t* _GBACoreGetAudioChannel(struct mCore* core, int ch) {
176 struct GBA* gba = core->board;
177 switch (ch) {
178 case 0:
179 return gba->audio.psg.left;
180 case 1:
181 return gba->audio.psg.right;
182 default:
183 return NULL;
184 }
185}
186
187static void _GBACoreSetAudioBufferSize(struct mCore* core, size_t samples) {
188 struct GBA* gba = core->board;
189 GBAAudioResizeBuffer(&gba->audio, samples);
190}
191
192static size_t _GBACoreGetAudioBufferSize(struct mCore* core) {
193 struct GBA* gba = core->board;
194 return gba->audio.samples;
195}
196
197static void _GBACoreSetCoreCallbacks(struct mCore* core, struct mCoreCallbacks* coreCallbacks) {
198 struct GBA* gba = core->board;
199 gba->coreCallbacks = coreCallbacks;
200}
201
202static void _GBACoreSetAVStream(struct mCore* core, struct mAVStream* stream) {
203 struct GBA* gba = core->board;
204 gba->stream = stream;
205 if (stream && stream->videoDimensionsChanged) {
206 stream->videoDimensionsChanged(stream, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
207 }
208}
209
210static bool _GBACoreLoadROM(struct mCore* core, struct VFile* vf) {
211 if (GBAIsMB(vf)) {
212 return GBALoadMB(core->board, vf);
213 }
214 return GBALoadROM(core->board, vf);
215}
216
217static bool _GBACoreLoadBIOS(struct mCore* core, struct VFile* vf, int type) {
218 UNUSED(type);
219 if (!GBAIsBIOS(vf)) {
220 return false;
221 }
222 GBALoadBIOS(core->board, vf);
223 return true;
224}
225
226static bool _GBACoreLoadSave(struct mCore* core, struct VFile* vf) {
227 return GBALoadSave(core->board, vf);
228}
229
230static bool _GBACoreLoadTemporarySave(struct mCore* core, struct VFile* vf) {
231 struct GBA* gba = core->board;
232 GBASavedataMask(&gba->memory.savedata, vf, false);
233 return true; // TODO: Return a real value
234}
235
236static bool _GBACoreLoadPatch(struct mCore* core, struct VFile* vf) {
237 if (!vf) {
238 return false;
239 }
240 struct Patch patch;
241 if (!loadPatch(vf, &patch)) {
242 return false;
243 }
244 GBAApplyPatch(core->board, &patch);
245 return true;
246}
247
248static void _GBACoreUnloadROM(struct mCore* core) {
249 struct GBACore* gbacore = (struct GBACore*) core;
250 struct ARMCore* cpu = core->cpu;
251 if (gbacore->cheatDevice) {
252 ARMHotplugDetach(cpu, CPU_COMPONENT_CHEAT_DEVICE);
253 cpu->components[CPU_COMPONENT_CHEAT_DEVICE] = NULL;
254 mCheatDeviceDestroy(gbacore->cheatDevice);
255 gbacore->cheatDevice = NULL;
256 }
257 return GBAUnloadROM(core->board);
258}
259
260static void _GBACoreChecksum(const struct mCore* core, void* data, enum mCoreChecksumType type) {
261 struct GBA* gba = (struct GBA*) core->board;
262 switch (type) {
263 case CHECKSUM_CRC32:
264 memcpy(data, &gba->romCrc32, sizeof(gba->romCrc32));
265 break;
266 }
267 return;
268}
269
270static void _GBACoreReset(struct mCore* core) {
271 struct GBACore* gbacore = (struct GBACore*) core;
272 struct GBA* gba = (struct GBA*) core->board;
273 if (gbacore->renderer.outputBuffer) {
274 struct GBAVideoRenderer* renderer = &gbacore->renderer.d;
275#ifndef DISABLE_THREADING
276 if (gbacore->threadedVideo) {
277 renderer = &gbacore->threadProxy.d;
278 }
279#endif
280 GBAVideoAssociateRenderer(&gba->video, renderer);
281 }
282
283 struct GBACartridgeOverride override;
284 const struct GBACartridge* cart = (const struct GBACartridge*) gba->memory.rom;
285 if (cart) {
286 memcpy(override.id, &cart->id, sizeof(override.id));
287 if (GBAOverrideFind(gbacore->overrides, &override)) {
288 GBAOverrideApply(gba, &override);
289 }
290 }
291
292#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
293 if (!gba->biosVf && core->opts.useBios) {
294 struct VFile* bios = NULL;
295 bool found = false;
296 if (core->opts.bios) {
297 bios = VFileOpen(core->opts.bios, O_RDONLY);
298 if (bios && GBAIsBIOS(bios)) {
299 found = true;
300 } else if (bios) {
301 bios->close(bios);
302 bios = NULL;
303 }
304 }
305 if (!found) {
306 const char* configPath = mCoreConfigGetValue(&core->config, "gba.bios");
307 bios = VFileOpen(configPath, O_RDONLY);
308 if (bios && GBAIsBIOS(bios)) {
309 found = true;
310 } else if (bios) {
311 bios->close(bios);
312 bios = NULL;
313 }
314 }
315 if (!found) {
316 char path[PATH_MAX];
317 mCoreConfigDirectory(path, PATH_MAX);
318 strncat(path, PATH_SEP "gba_bios.bin", PATH_MAX - strlen(path));
319 bios = VFileOpen(path, O_RDONLY);
320 if (bios && GBIsBIOS(bios)) {
321 found = true;
322 } else if (bios) {
323 bios->close(bios);
324 bios = NULL;
325 }
326 }
327 if (bios) {
328 GBALoadBIOS(gba, bios);
329 }
330 }
331#endif
332
333 ARMReset(core->cpu);
334 if (core->opts.skipBios && gba->pristineRom) {
335 GBASkipBIOS(core->board);
336 }
337}
338
339static void _GBACoreRunFrame(struct mCore* core) {
340 struct GBA* gba = core->board;
341 int32_t frameCounter = gba->video.frameCounter;
342 while (gba->video.frameCounter == frameCounter) {
343 ARMv4RunLoop(core->cpu);
344 }
345}
346
347static void _GBACoreRunLoop(struct mCore* core) {
348 ARMv4RunLoop(core->cpu);
349}
350
351static void _GBACoreStep(struct mCore* core) {
352 ARMv4Run(core->cpu);
353}
354
355static size_t _GBACoreStateSize(struct mCore* core) {
356 UNUSED(core);
357 return sizeof(struct GBASerializedState);
358}
359
360static bool _GBACoreLoadState(struct mCore* core, const void* state) {
361 return GBADeserialize(core->board, state);
362}
363
364static bool _GBACoreSaveState(struct mCore* core, void* state) {
365 GBASerialize(core->board, state);
366 return true;
367}
368
369static void _GBACoreSetKeys(struct mCore* core, uint32_t keys) {
370 struct GBACore* gbacore = (struct GBACore*) core;
371 gbacore->keys = keys;
372}
373
374static void _GBACoreAddKeys(struct mCore* core, uint32_t keys) {
375 struct GBACore* gbacore = (struct GBACore*) core;
376 gbacore->keys |= keys;
377}
378
379static void _GBACoreClearKeys(struct mCore* core, uint32_t keys) {
380 struct GBACore* gbacore = (struct GBACore*) core;
381 gbacore->keys &= ~keys;
382}
383
384static void _GBACoreSetCursor(struct mCore* core, int x, int y, bool down) {
385 UNUSED(core);
386 UNUSED(x);
387 UNUSED(y);
388 UNUSED(down);
389}
390
391static int32_t _GBACoreFrameCounter(const struct mCore* core) {
392 const struct GBA* gba = core->board;
393 return gba->video.frameCounter;
394}
395
396static int32_t _GBACoreFrameCycles(const struct mCore* core) {
397 UNUSED(core);
398 return VIDEO_TOTAL_LENGTH;
399}
400
401static int32_t _GBACoreFrequency(const struct mCore* core) {
402 UNUSED(core);
403 return GBA_ARM7TDMI_FREQUENCY;
404}
405
406static void _GBACoreGetGameTitle(const struct mCore* core, char* title) {
407 GBAGetGameTitle(core->board, title);
408}
409
410static void _GBACoreGetGameCode(const struct mCore* core, char* title) {
411 GBAGetGameCode(core->board, title);
412}
413
414static void _GBACoreSetRTC(struct mCore* core, struct mRTCSource* rtc) {
415 struct GBA* gba = core->board;
416 gba->rtcSource = rtc;
417}
418
419static void _GBACoreSetRotation(struct mCore* core, struct mRotationSource* rotation) {
420 struct GBA* gba = core->board;
421 gba->rotationSource = rotation;
422}
423
424static void _GBACoreSetRumble(struct mCore* core, struct mRumble* rumble) {
425 struct GBA* gba = core->board;
426 gba->rumble = rumble;
427}
428
429static uint32_t _GBACoreBusRead8(struct mCore* core, uint32_t address) {
430 struct ARMCore* cpu = core->cpu;
431 return cpu->memory.load8(cpu, address, 0);
432}
433
434static uint32_t _GBACoreBusRead16(struct mCore* core, uint32_t address) {
435 struct ARMCore* cpu = core->cpu;
436 return cpu->memory.load16(cpu, address, 0);
437
438}
439
440static uint32_t _GBACoreBusRead32(struct mCore* core, uint32_t address) {
441 struct ARMCore* cpu = core->cpu;
442 return cpu->memory.load32(cpu, address, 0);
443}
444
445static void _GBACoreBusWrite8(struct mCore* core, uint32_t address, uint8_t value) {
446 struct ARMCore* cpu = core->cpu;
447 cpu->memory.store8(cpu, address, value, 0);
448}
449
450static void _GBACoreBusWrite16(struct mCore* core, uint32_t address, uint16_t value) {
451 struct ARMCore* cpu = core->cpu;
452 cpu->memory.store16(cpu, address, value, 0);
453}
454
455static void _GBACoreBusWrite32(struct mCore* core, uint32_t address, uint32_t value) {
456 struct ARMCore* cpu = core->cpu;
457 cpu->memory.store32(cpu, address, value, 0);
458}
459
460static uint32_t _GBACoreRawRead8(struct mCore* core, uint32_t address, int segment) {
461 UNUSED(segment);
462 struct ARMCore* cpu = core->cpu;
463 return GBAView8(cpu, address);
464}
465
466static uint32_t _GBACoreRawRead16(struct mCore* core, uint32_t address, int segment) {
467 UNUSED(segment);
468 struct ARMCore* cpu = core->cpu;
469 return GBAView16(cpu, address);
470}
471
472static uint32_t _GBACoreRawRead32(struct mCore* core, uint32_t address, int segment) {
473 UNUSED(segment);
474 struct ARMCore* cpu = core->cpu;
475 return GBAView32(cpu, address);
476}
477
478static void _GBACoreRawWrite8(struct mCore* core, uint32_t address, int segment, uint8_t value) {
479 UNUSED(segment);
480 struct ARMCore* cpu = core->cpu;
481 GBAPatch8(cpu, address, value, NULL);
482}
483
484static void _GBACoreRawWrite16(struct mCore* core, uint32_t address, int segment, uint16_t value) {
485 UNUSED(segment);
486 struct ARMCore* cpu = core->cpu;
487 GBAPatch16(cpu, address, value, NULL);
488}
489
490static void _GBACoreRawWrite32(struct mCore* core, uint32_t address, int segment, uint32_t value) {
491 UNUSED(segment);
492 struct ARMCore* cpu = core->cpu;
493 GBAPatch32(cpu, address, value, NULL);
494}
495
496#ifdef USE_DEBUGGERS
497static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
498 UNUSED(core);
499 switch (type) {
500 case DEBUGGER_CLI:
501 return true;
502#ifdef USE_GDB_STUB
503 case DEBUGGER_GDB:
504 return true;
505#endif
506 default:
507 return false;
508 }
509}
510
511static struct mDebuggerPlatform* _GBACoreDebuggerPlatform(struct mCore* core) {
512 struct GBACore* gbacore = (struct GBACore*) core;
513 if (!gbacore->debuggerPlatform) {
514 gbacore->debuggerPlatform = ARMDebuggerPlatformCreate();
515 }
516 return gbacore->debuggerPlatform;
517}
518
519static struct CLIDebuggerSystem* _GBACoreCliDebuggerSystem(struct mCore* core) {
520 return &GBACLIDebuggerCreate(core)->d;
521}
522
523static void _GBACoreAttachDebugger(struct mCore* core, struct mDebugger* debugger) {
524 if (core->debugger) {
525 GBADetachDebugger(core->board);
526 }
527 GBAAttachDebugger(core->board, debugger);
528 core->debugger = debugger;
529}
530
531static void _GBACoreDetachDebugger(struct mCore* core) {
532 GBADetachDebugger(core->board);
533 core->debugger = NULL;
534}
535#endif
536
537static struct mCheatDevice* _GBACoreCheatDevice(struct mCore* core) {
538 struct GBACore* gbacore = (struct GBACore*) core;
539 if (!gbacore->cheatDevice) {
540 gbacore->cheatDevice = GBACheatDeviceCreate();
541 ((struct ARMCore*) core->cpu)->components[CPU_COMPONENT_CHEAT_DEVICE] = &gbacore->cheatDevice->d;
542 ARMHotplugAttach(core->cpu, CPU_COMPONENT_CHEAT_DEVICE);
543 gbacore->cheatDevice->p = core;
544 }
545 return gbacore->cheatDevice;
546}
547
548static size_t _GBACoreSavedataClone(struct mCore* core, void** sram) {
549 struct GBA* gba = core->board;
550 size_t size = GBASavedataSize(&gba->memory.savedata);
551 if (!size) {
552 *sram = NULL;
553 return 0;
554 }
555 *sram = malloc(size);
556 struct VFile* vf = VFileFromMemory(*sram, size);
557 if (!vf) {
558 free(*sram);
559 *sram = NULL;
560 return 0;
561 }
562 bool success = GBASavedataClone(&gba->memory.savedata, vf);
563 vf->close(vf);
564 if (!success) {
565 free(*sram);
566 *sram = NULL;
567 return 0;
568 }
569 return size;
570}
571
572static bool _GBACoreSavedataRestore(struct mCore* core, const void* sram, size_t size, bool writeback) {
573 struct VFile* vf = VFileMemChunk(sram, size);
574 if (!vf) {
575 return false;
576 }
577 struct GBA* gba = core->board;
578 bool success = true;
579 if (writeback) {
580 success = GBASavedataLoad(&gba->memory.savedata, vf);
581 vf->close(vf);
582 } else {
583 GBASavedataMask(&gba->memory.savedata, vf, true);
584 }
585 return success;
586}
587
588struct mCore* GBACoreCreate(void) {
589 struct GBACore* gbacore = malloc(sizeof(*gbacore));
590 struct mCore* core = &gbacore->d;
591 memset(&core->opts, 0, sizeof(core->opts));
592 core->cpu = NULL;
593 core->board = NULL;
594 core->debugger = NULL;
595 core->init = _GBACoreInit;
596 core->deinit = _GBACoreDeinit;
597 core->platform = _GBACorePlatform;
598 core->setSync = _GBACoreSetSync;
599 core->loadConfig = _GBACoreLoadConfig;
600 core->desiredVideoDimensions = _GBACoreDesiredVideoDimensions;
601 core->setVideoBuffer = _GBACoreSetVideoBuffer;
602 core->getPixels = _GBACoreGetPixels;
603 core->putPixels = _GBACorePutPixels;
604 core->getAudioChannel = _GBACoreGetAudioChannel;
605 core->setAudioBufferSize = _GBACoreSetAudioBufferSize;
606 core->getAudioBufferSize = _GBACoreGetAudioBufferSize;
607 core->setCoreCallbacks = _GBACoreSetCoreCallbacks;
608 core->setAVStream = _GBACoreSetAVStream;
609 core->isROM = GBAIsROM;
610 core->loadROM = _GBACoreLoadROM;
611 core->loadBIOS = _GBACoreLoadBIOS;
612 core->loadSave = _GBACoreLoadSave;
613 core->loadTemporarySave = _GBACoreLoadTemporarySave;
614 core->loadPatch = _GBACoreLoadPatch;
615 core->unloadROM = _GBACoreUnloadROM;
616 core->checksum = _GBACoreChecksum;
617 core->reset = _GBACoreReset;
618 core->runFrame = _GBACoreRunFrame;
619 core->runLoop = _GBACoreRunLoop;
620 core->step = _GBACoreStep;
621 core->stateSize = _GBACoreStateSize;
622 core->loadState = _GBACoreLoadState;
623 core->saveState = _GBACoreSaveState;
624 core->setKeys = _GBACoreSetKeys;
625 core->addKeys = _GBACoreAddKeys;
626 core->clearKeys = _GBACoreClearKeys;
627 core->setCursor = _GBACoreSetCursor;
628 core->frameCounter = _GBACoreFrameCounter;
629 core->frameCycles = _GBACoreFrameCycles;
630 core->frequency = _GBACoreFrequency;
631 core->getGameTitle = _GBACoreGetGameTitle;
632 core->getGameCode = _GBACoreGetGameCode;
633 core->setRTC = _GBACoreSetRTC;
634 core->setRotation = _GBACoreSetRotation;
635 core->setRumble = _GBACoreSetRumble;
636 core->busRead8 = _GBACoreBusRead8;
637 core->busRead16 = _GBACoreBusRead16;
638 core->busRead32 = _GBACoreBusRead32;
639 core->busWrite8 = _GBACoreBusWrite8;
640 core->busWrite16 = _GBACoreBusWrite16;
641 core->busWrite32 = _GBACoreBusWrite32;
642 core->rawRead8 = _GBACoreRawRead8;
643 core->rawRead16 = _GBACoreRawRead16;
644 core->rawRead32 = _GBACoreRawRead32;
645 core->rawWrite8 = _GBACoreRawWrite8;
646 core->rawWrite16 = _GBACoreRawWrite16;
647 core->rawWrite32 = _GBACoreRawWrite32;
648#ifdef USE_DEBUGGERS
649 core->supportsDebuggerType = _GBACoreSupportsDebuggerType;
650 core->debuggerPlatform = _GBACoreDebuggerPlatform;
651 core->cliDebuggerSystem = _GBACoreCliDebuggerSystem;
652 core->attachDebugger = _GBACoreAttachDebugger;
653 core->detachDebugger = _GBACoreDetachDebugger;
654#endif
655 core->cheatDevice = _GBACoreCheatDevice;
656 core->savedataClone = _GBACoreSavedataClone;
657 core->savedataRestore = _GBACoreSavedataRestore;
658 return core;
659}