GBA Hardware: Game Boy Player detection is off by default
Jeffrey Pfau jeffrey@endrift.com
Sat, 25 Jul 2015 12:19:19 -0700
6 files changed,
164 insertions(+),
92 deletions(-)
M
src/gba/gba.c
→
src/gba/gba.c
@@ -787,7 +787,9 @@ if (gba->stream) {
gba->stream->postVideoFrame(gba->stream, gba->video.renderer); } - GBAHardwarePlayerUpdate(gba); + if (gba->memory.hw.devices & (HW_GB_PLAYER | HW_GB_PLAYER_DETECTION)) { + GBAHardwarePlayerUpdate(gba); + } struct GBAThread* thread = GBAThreadGetContext(); if (!thread) {
M
src/gba/hardware.c
→
src/gba/hardware.c
@@ -44,6 +44,16 @@
void GBAHardwareInit(struct GBACartridgeHardware* hw, uint16_t* base) { hw->gpioBase = base; GBAHardwareClear(hw); + + hw->gbpCallback.d.readKeys = _gbpRead; + hw->gbpCallback.p = hw; + hw->gbpDriver.d.init = 0; + hw->gbpDriver.d.deinit = 0; + hw->gbpDriver.d.load = 0; + hw->gbpDriver.d.unload = 0; + hw->gbpDriver.d.writeRegister = _gbpSioWriteRegister; + hw->gbpDriver.d.processEvents = _gbpSioProcessEvents; + hw->gbpDriver.p = hw; } void GBAHardwareClear(struct GBACartridgeHardware* hw) {@@ -516,15 +526,6 @@ return;
} if (GBAHardwarePlayerCheckScreen(&gba->video)) { gba->memory.hw.devices |= HW_GB_PLAYER; - gba->memory.hw.gbpCallback.d.readKeys = _gbpRead; - gba->memory.hw.gbpCallback.p = &gba->memory.hw; - gba->memory.hw.gbpDriver.d.init = 0; - gba->memory.hw.gbpDriver.d.deinit = 0; - gba->memory.hw.gbpDriver.d.load = 0; - gba->memory.hw.gbpDriver.d.unload = 0; - gba->memory.hw.gbpDriver.d.writeRegister = _gbpSioWriteRegister; - gba->memory.hw.gbpDriver.d.processEvents = _gbpSioProcessEvents; - gba->memory.hw.gbpDriver.p = &gba->memory.hw; gba->memory.hw.gbpInputsPosted = 0; gba->memory.hw.gbpNextEvent = INT_MAX; gba->keyCallback = &gba->memory.hw.gbpCallback.d;
M
src/gba/hardware.h
→
src/gba/hardware.h
@@ -34,7 +34,8 @@ HW_RUMBLE = 2,
HW_LIGHT_SENSOR = 4, HW_GYRO = 8, HW_TILT = 16, - HW_GB_PLAYER = 32 + HW_GB_PLAYER = 32, + HW_GB_PLAYER_DETECTION = 64 }; enum GPIORegister {
M
src/gba/supervisor/overrides.c
→
src/gba/supervisor/overrides.c
@@ -285,6 +285,12 @@
if (override->hardware & HW_TILT) { GBAHardwareInitTilt(&gba->memory.hw); } + + if (override->hardware & HW_GB_PLAYER_DETECTION) { + gba->memory.hw.devices |= HW_GB_PLAYER_DETECTION; + } else { + gba->memory.hw.devices &= ~HW_GB_PLAYER_DETECTION; + } } if (override->idleLoop != IDLE_LOOP_NONE) {
M
src/platform/qt/OverrideView.cpp
→
src/platform/qt/OverrideView.cpp
@@ -39,6 +39,7 @@ connect(m_ui.hwGyro, SIGNAL(clicked()), this, SLOT(updateOverrides()));
connect(m_ui.hwLight, SIGNAL(clicked()), this, SLOT(updateOverrides())); connect(m_ui.hwTilt, SIGNAL(clicked()), this, SLOT(updateOverrides())); connect(m_ui.hwRumble, SIGNAL(clicked()), this, SLOT(updateOverrides())); + connect(m_ui.hwGBPlayer, SIGNAL(clicked()), this, SLOT(updateOverrides())); connect(m_ui.save, SIGNAL(clicked()), this, SLOT(saveOverride()));@@ -80,6 +81,9 @@ if (m_ui.hwRumble->isChecked()) {
m_override.hardware |= HW_RUMBLE; } } + if (m_ui.hwGBPlayer->isChecked()) { + m_override.hardware |= HW_GB_PLAYER_DETECTION; + } bool ok; uint32_t parsedIdleLoop = m_ui.idleLoop->text().toInt(&ok, 16);@@ -115,6 +119,7 @@ m_ui.hwGyro->setChecked(thread->gba->memory.hw.devices & HW_GYRO);
m_ui.hwLight->setChecked(thread->gba->memory.hw.devices & HW_LIGHT_SENSOR); m_ui.hwTilt->setChecked(thread->gba->memory.hw.devices & HW_TILT); m_ui.hwRumble->setChecked(thread->gba->memory.hw.devices & HW_RUMBLE); + m_ui.hwGBPlayer->setChecked(thread->gba->memory.hw.devices & HW_GB_PLAYER_DETECTION); if (thread->gba->idleLoop != IDLE_LOOP_NONE) { m_ui.idleLoop->setText(QString::number(thread->gba->idleLoop, 16));
M
src/platform/qt/OverrideView.ui
→
src/platform/qt/OverrideView.ui
@@ -6,8 +6,8 @@ <property name="geometry">
<rect> <x>0</x> <y>0</y> - <width>409</width> - <height>228</height> + <width>401</width> + <height>203</height> </rect> </property> <property name="sizePolicy">@@ -23,13 +23,19 @@ <layout class="QGridLayout" name="gridLayout_3">
<property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <item row="2" column="1"> + <item row="4" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item>@@ -44,7 +50,135 @@ </widget>
</item> </layout> </item> - <item row="0" column="0" rowspan="3"> + <item row="3" column="1"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Save type</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="savetype"> + <item> + <property name="text"> + <string>Autodetect</string> + </property> + </item> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>SRAM</string> + </property> + </item> + <item> + <property name="text"> + <string>Flash 512kb</string> + </property> + </item> + <item> + <property name="text"> + <string>Flash 1Mb</string> + </property> + </item> + <item> + <property name="text"> + <string>EEPROM</string> + </property> + </item> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Idle loop</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="idleLoop"/> + </item> + <item row="1" column="0" colspan="2"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="hwGBPlayer"> + <property name="text"> + <string>Game Boy Player features</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="2" column="0" rowspan="3"> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string/>@@ -112,83 +246,6 @@ </widget>
</item> </layout> </widget> - </item> - <item row="0" column="1"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string/> - </property> - <layout class="QFormLayout" name="formLayout_5"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Save type</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="savetype"> - <item> - <property name="text"> - <string>Autodetect</string> - </property> - </item> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>SRAM</string> - </property> - </item> - <item> - <property name="text"> - <string>Flash 512kb</string> - </property> - </item> - <item> - <property name="text"> - <string>Flash 1Mb</string> - </property> - </item> - <item> - <property name="text"> - <string>EEPROM</string> - </property> - </item> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Idle loop</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="idleLoop"/> - </item> - <item row="1" column="1"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="1"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </spacer> </item> </layout> </widget>