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