GBA: Add GBA luminance peripheral

This commit is contained in:
Vicki Pfau 2017-04-09 19:47:19 -07:00
parent e063e05662
commit 473ae29d82
5 changed files with 10 additions and 4 deletions

View File

@ -28,6 +28,10 @@ struct GBAVideoRenderer;
extern const int GBA_LUX_LEVELS[10]; extern const int GBA_LUX_LEVELS[10];
enum {
mPERIPH_GBA_LUMINANCE = 0x1000
};
struct GBALuminanceSource { struct GBALuminanceSource {
void (*sample)(struct GBALuminanceSource*); void (*sample)(struct GBALuminanceSource*);

View File

@ -298,7 +298,7 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
return; return;
} }
if (runner->core->platform(runner->core) == PLATFORM_GBA) { 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..."); mLOG(GUI_RUNNER, DEBUG, "Loading config...");
mCoreLoadForeignConfig(runner->core, &runner->config); mCoreLoadForeignConfig(runner->core, &runner->config);

View File

@ -414,6 +414,9 @@ static void _GBACoreSetPeripheral(struct mCore* core, int type, void* periph) {
case mPERIPH_RUMBLE: case mPERIPH_RUMBLE:
gba->rumble = periph; gba->rumble = periph;
break; break;
case mPERIPH_GBA_LUMINANCE:
gba->luminanceSource = periph;
break;
default: default:
return; return;
} }

View File

@ -409,8 +409,7 @@ bool retro_load_game(const struct retro_game_info* game) {
#ifdef M_CORE_GBA #ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) { if (core->platform(core) == PLATFORM_GBA) {
struct GBA* gba = core->board; core->setPeripheral(core, mPERIPH_GBA_LUMINANCE, &lux);
gba->luminanceSource = &lux;
const char* sysDir = 0; const char* sysDir = 0;
if (core->opts.useBios && environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir)) { if (core->opts.useBios && environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir)) {

View File

@ -99,7 +99,7 @@ GameController::GameController(QObject* parent)
switch (context->core->platform(context->core)) { switch (context->core->platform(context->core)) {
#ifdef M_CORE_GBA #ifdef M_CORE_GBA
case PLATFORM_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[0] = !controller->m_audioChannels[0];
gba->audio.psg.forceDisableCh[1] = !controller->m_audioChannels[1]; gba->audio.psg.forceDisableCh[1] = !controller->m_audioChannels[1];
gba->audio.psg.forceDisableCh[2] = !controller->m_audioChannels[2]; gba->audio.psg.forceDisableCh[2] = !controller->m_audioChannels[2];