all repos — mgba @ 473ae29d821bd7b24c78d08e74ea4673eeb64a1b

mGBA Game Boy Advance Emulator

GBA: Add GBA luminance peripheral
Vicki Pfau vi@endrift.com
Sun, 09 Apr 2017 19:47:19 -0700
commit

473ae29d821bd7b24c78d08e74ea4673eeb64a1b

parent

e063e056623dcd1ca1ed516e154a68e306b93595

M include/mgba/gba/interface.hinclude/mgba/gba/interface.h

@@ -28,6 +28,10 @@ struct GBAVideoRenderer;

extern const int GBA_LUX_LEVELS[10]; +enum { + mPERIPH_GBA_LUMINANCE = 0x1000 +}; + struct GBALuminanceSource { void (*sample)(struct GBALuminanceSource*);
M src/feature/gui/gui-runner.csrc/feature/gui/gui-runner.c

@@ -298,7 +298,7 @@ GUIShowMessageBox(&runner->params, GUI_MESSAGE_BOX_OK, 240, "Load failed!");

return; } if (runner->core->platform(runner->core) == PLATFORM_GBA) { - ((struct GBA*) runner->core->board)->luminanceSource = &runner->luminanceSource.d; + runner->core->setPeripheral(runner->core, mPERIPH_GBA_LUMINANCE, &runner->luminanceSource.d); } mLOG(GUI_RUNNER, DEBUG, "Loading config..."); mCoreLoadForeignConfig(runner->core, &runner->config);
M src/gba/core.csrc/gba/core.c

@@ -414,6 +414,9 @@ break;

case mPERIPH_RUMBLE: gba->rumble = periph; break; + case mPERIPH_GBA_LUMINANCE: + gba->luminanceSource = periph; + break; default: return; }
M src/platform/libretro/libretro.csrc/platform/libretro/libretro.c

@@ -409,8 +409,7 @@ core->loadSave(core, save);

#ifdef M_CORE_GBA if (core->platform(core) == PLATFORM_GBA) { - struct GBA* gba = core->board; - gba->luminanceSource = &lux; + core->setPeripheral(core, mPERIPH_GBA_LUMINANCE, &lux); const char* sysDir = 0; if (core->opts.useBios && environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir)) {
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -99,7 +99,7 @@ #endif

switch (context->core->platform(context->core)) { #ifdef M_CORE_GBA case PLATFORM_GBA: - gba->luminanceSource = &controller->m_lux; + context->core->setPeripheral(context->core, mPERIPH_GBA_LUMINANCE, &controller->m_lux); gba->audio.psg.forceDisableCh[0] = !controller->m_audioChannels[0]; gba->audio.psg.forceDisableCh[1] = !controller->m_audioChannels[1]; gba->audio.psg.forceDisableCh[2] = !controller->m_audioChannels[2];