mirror of https://github.com/mgba-emu/mgba.git
GB: Support SGB boot ROM
This commit is contained in:
parent
6ab7e178be
commit
f61c0ce02f
|
@ -12,10 +12,12 @@ CXX_GUARD_START
|
|||
|
||||
enum GBModel {
|
||||
GB_MODEL_AUTODETECT = 0xFF,
|
||||
GB_MODEL_DMG = 0x00,
|
||||
GB_MODEL_SGB = 0x40,
|
||||
GB_MODEL_CGB = 0x80,
|
||||
GB_MODEL_AGB = 0xC0
|
||||
GB_MODEL_DMG = 0x00,
|
||||
GB_MODEL_SGB = 0x20,
|
||||
GB_MODEL_MGB = 0x40,
|
||||
GB_MODEL_SGB2 = 0x60,
|
||||
GB_MODEL_CGB = 0x80,
|
||||
GB_MODEL_AGB = 0xC0
|
||||
};
|
||||
|
||||
enum GBMemoryBankControllerType {
|
||||
|
|
|
@ -181,6 +181,7 @@ static void _GBCoreLoadConfig(struct mCore* core, const struct mCoreConfig* conf
|
|||
}
|
||||
|
||||
mCoreConfigCopyValue(&core->config, config, "gb.bios");
|
||||
mCoreConfigCopyValue(&core->config, config, "sgb.bios");
|
||||
mCoreConfigCopyValue(&core->config, config, "gbc.bios");
|
||||
|
||||
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||
|
@ -345,9 +346,13 @@ static void _GBCoreReset(struct mCore* core) {
|
|||
|
||||
switch (gb->model) {
|
||||
case GB_MODEL_DMG:
|
||||
case GB_MODEL_SGB: // TODO
|
||||
case GB_MODEL_MGB: // TODO
|
||||
configPath = mCoreConfigGetValue(&core->config, "gb.bios");
|
||||
break;
|
||||
case GB_MODEL_SGB:
|
||||
case GB_MODEL_SGB2: // TODO
|
||||
configPath = mCoreConfigGetValue(&core->config, "sgb.bios");
|
||||
break;
|
||||
case GB_MODEL_CGB:
|
||||
case GB_MODEL_AGB:
|
||||
configPath = mCoreConfigGetValue(&core->config, "gbc.bios");
|
||||
|
@ -370,9 +375,13 @@ static void _GBCoreReset(struct mCore* core) {
|
|||
mCoreConfigDirectory(path, PATH_MAX);
|
||||
switch (gb->model) {
|
||||
case GB_MODEL_DMG:
|
||||
case GB_MODEL_SGB: // TODO
|
||||
case GB_MODEL_MGB: // TODO
|
||||
strncat(path, PATH_SEP "gb_bios.bin", PATH_MAX - strlen(path));
|
||||
break;
|
||||
case GB_MODEL_SGB:
|
||||
case GB_MODEL_SGB2: // TODO
|
||||
strncat(path, PATH_SEP "sgb_bios.bin", PATH_MAX - strlen(path));
|
||||
break;
|
||||
case GB_MODEL_CGB:
|
||||
case GB_MODEL_AGB:
|
||||
strncat(path, PATH_SEP "gbc_bios.bin", PATH_MAX - strlen(path));
|
||||
|
@ -566,7 +575,9 @@ size_t _GBListMemoryBlocks(const struct mCore* core, const struct mCoreMemoryBlo
|
|||
const struct GB* gb = core->board;
|
||||
switch (gb->model) {
|
||||
case GB_MODEL_DMG:
|
||||
case GB_MODEL_MGB:
|
||||
case GB_MODEL_SGB:
|
||||
case GB_MODEL_SGB2:
|
||||
default:
|
||||
*blocks = _GBMemoryBlocks;
|
||||
return sizeof(_GBMemoryBlocks) / sizeof(*_GBMemoryBlocks);
|
||||
|
|
|
@ -57,7 +57,10 @@ bool GBOverrideFind(const struct Configuration* config, struct GBCartridgeOverri
|
|||
override->model = GB_MODEL_SGB;
|
||||
} else if (strcasecmp(model, "MGB") == 0) {
|
||||
found = true;
|
||||
override->model = GB_MODEL_DMG; // TODO
|
||||
override->model = GB_MODEL_MGB;
|
||||
} else if (strcasecmp(model, "SGB2") == 0) {
|
||||
found = true;
|
||||
override->model = GB_MODEL_SGB2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,6 +102,12 @@ void GBOverrideSave(struct Configuration* config, const struct GBCartridgeOverri
|
|||
case GB_MODEL_SGB:
|
||||
model = "SGB";
|
||||
break;
|
||||
case GB_MODEL_MGB:
|
||||
model = "MGB";
|
||||
break;
|
||||
case GB_MODEL_SGB2:
|
||||
model = "SGB2";
|
||||
break;
|
||||
case GB_MODEL_CGB:
|
||||
model = "CGB";
|
||||
break;
|
||||
|
|
|
@ -159,6 +159,9 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
|||
connect(m_ui.gbcBiosBrowse, &QPushButton::clicked, [this]() {
|
||||
selectBios(m_ui.gbcBios);
|
||||
});
|
||||
connect(m_ui.sgbBiosBrowse, &QPushButton::clicked, [this]() {
|
||||
selectBios(m_ui.sgbBios);
|
||||
});
|
||||
|
||||
QList<QColor> defaultColors;
|
||||
defaultColors.append(QColor(0xF8, 0xF8, 0xF8));
|
||||
|
@ -190,6 +193,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
|||
#else
|
||||
m_ui.gbBiosBrowse->hide();
|
||||
m_ui.gbcBiosBrowse->hide();
|
||||
m_ui.sgbBiosBrowse->hide();
|
||||
m_ui.gb->hide();
|
||||
#endif
|
||||
|
||||
|
@ -275,6 +279,7 @@ void SettingsView::updateConfig() {
|
|||
saveSetting("gba.bios", m_ui.gbaBios);
|
||||
saveSetting("gb.bios", m_ui.gbBios);
|
||||
saveSetting("gbc.bios", m_ui.gbcBios);
|
||||
saveSetting("sgb.bios", m_ui.sgbBios);
|
||||
saveSetting("useBios", m_ui.useBios);
|
||||
saveSetting("skipBios", m_ui.skipBios);
|
||||
saveSetting("audioBuffers", m_ui.audioBufferSize);
|
||||
|
@ -377,6 +382,7 @@ void SettingsView::reloadConfig() {
|
|||
loadSetting("gba.bios", m_ui.gbaBios);
|
||||
loadSetting("gb.bios", m_ui.gbBios);
|
||||
loadSetting("gbc.bios", m_ui.gbcBios);
|
||||
loadSetting("sgb.bios", m_ui.sgbBios);
|
||||
loadSetting("useBios", m_ui.useBios);
|
||||
loadSetting("skipBios", m_ui.skipBios);
|
||||
loadSetting("audioBuffers", m_ui.audioBufferSize);
|
||||
|
|
|
@ -748,7 +748,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="useBios">
|
||||
<property name="text">
|
||||
<string>Use BIOS file if found</string>
|
||||
|
@ -758,14 +758,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="skipBios">
|
||||
<property name="text">
|
||||
<string>Skip BIOS intro</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="gbaBios">
|
||||
|
@ -786,21 +786,21 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>GBA BIOS file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>GBC BIOS file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_30">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="gbcBios">
|
||||
|
@ -821,6 +821,34 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>SGB BIOS file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sgbBios">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sgbBiosBrowse">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="paths">
|
||||
|
|
Loading…
Reference in New Issue