GBA Hardware: Game Boy Player detection is off by default

This commit is contained in:
Jeffrey Pfau 2015-07-25 12:19:19 -07:00
parent 97b82ae6cd
commit 3c55784c54
6 changed files with 164 additions and 92 deletions

View File

@ -787,7 +787,9 @@ void GBAFrameEnded(struct GBA* gba) {
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) {

View File

@ -44,6 +44,16 @@ static const int RTC_BYTES[8] = {
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 @@ void GBAHardwarePlayerUpdate(struct GBA* gba) {
}
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;

View File

@ -34,7 +34,8 @@ enum GBAHardwareDevice {
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 {

View File

@ -285,6 +285,12 @@ void GBAOverrideApply(struct GBA* gba, const struct GBACartridgeOverride* overri
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) {

View File

@ -39,6 +39,7 @@ OverrideView::OverrideView(GameController* controller, ConfigController* config,
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 @@ void OverrideView::updateOverrides() {
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 @@ void OverrideView::gameStarted(GBAThread* thread) {
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));

View File

@ -6,8 +6,8 @@
<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 @@
<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 @@
</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/>
@ -113,83 +247,6 @@
</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>
<resources/>