mirror of https://github.com/mgba-emu/mgba.git
GBA: Add GBA luminance peripheral
This commit is contained in:
parent
e063e05662
commit
473ae29d82
|
@ -28,6 +28,10 @@ struct GBAVideoRenderer;
|
|||
|
||||
extern const int GBA_LUX_LEVELS[10];
|
||||
|
||||
enum {
|
||||
mPERIPH_GBA_LUMINANCE = 0x1000
|
||||
};
|
||||
|
||||
struct GBALuminanceSource {
|
||||
void (*sample)(struct GBALuminanceSource*);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
|||
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);
|
||||
|
|
|
@ -414,6 +414,9 @@ static void _GBACoreSetPeripheral(struct mCore* core, int type, void* periph) {
|
|||
case mPERIPH_RUMBLE:
|
||||
gba->rumble = periph;
|
||||
break;
|
||||
case mPERIPH_GBA_LUMINANCE:
|
||||
gba->luminanceSource = periph;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -409,8 +409,7 @@ bool retro_load_game(const struct retro_game_info* game) {
|
|||
|
||||
#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)) {
|
||||
|
|
|
@ -99,7 +99,7 @@ GameController::GameController(QObject* parent)
|
|||
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];
|
||||
|
|
Loading…
Reference in New Issue