mirror of https://github.com/mgba-emu/mgba.git
Qt: GB Override view
This commit is contained in:
parent
1bc8dfe42b
commit
e81ed20a14
43
src/gb/gb.c
43
src/gb/gb.c
|
@ -265,20 +265,35 @@ void GBReset(struct LR35902Core* cpu) {
|
|||
gb->biosVf->seek(gb->biosVf, 0, SEEK_SET);
|
||||
gb->memory.romBase = malloc(GB_SIZE_CART_BANK0);
|
||||
ssize_t size = gb->biosVf->read(gb->biosVf, gb->memory.romBase, GB_SIZE_CART_BANK0);
|
||||
|
||||
memcpy(&gb->memory.romBase[size], &gb->memory.rom[size], GB_SIZE_CART_BANK0 - size);
|
||||
if (size > 0x100) {
|
||||
memcpy(&gb->memory.romBase[0x100], &gb->memory.rom[0x100], sizeof(struct GBCartridge));
|
||||
uint32_t biosCrc = doCrc32(gb->memory.romBase, size);
|
||||
switch (biosCrc) {
|
||||
case 0x59C8598E:
|
||||
break;
|
||||
case 0x41884E46:
|
||||
break;
|
||||
default:
|
||||
gb->biosVf->close(gb->biosVf);
|
||||
gb->biosVf = NULL;
|
||||
free(gb->memory.romBase);
|
||||
gb->memory.romBase = gb->memory.rom;
|
||||
break;
|
||||
}
|
||||
|
||||
cpu->a = 0;
|
||||
cpu->f.packed = 0;
|
||||
cpu->c = 0;
|
||||
cpu->e = 0;
|
||||
cpu->h = 0;
|
||||
cpu->l = 0;
|
||||
cpu->sp = 0;
|
||||
cpu->pc = 0;
|
||||
if (gb->biosVf) {
|
||||
memcpy(&gb->memory.romBase[size], &gb->memory.rom[size], GB_SIZE_CART_BANK0 - size);
|
||||
if (size > 0x100) {
|
||||
memcpy(&gb->memory.romBase[0x100], &gb->memory.rom[0x100], sizeof(struct GBCartridge));
|
||||
}
|
||||
|
||||
cpu->a = 0;
|
||||
cpu->f.packed = 0;
|
||||
cpu->c = 0;
|
||||
cpu->e = 0;
|
||||
cpu->h = 0;
|
||||
cpu->l = 0;
|
||||
cpu->sp = 0;
|
||||
cpu->pc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
cpu->b = 0;
|
||||
|
@ -298,10 +313,10 @@ void GBReset(struct LR35902Core* cpu) {
|
|||
cpu->h = 1;
|
||||
cpu->l = 0x4D;
|
||||
break;
|
||||
case GB_MODEL_CGB:
|
||||
case GB_MODEL_AGB:
|
||||
cpu->b = 1;
|
||||
// Fall through
|
||||
case GB_MODEL_AGB: // Silence warnings
|
||||
case GB_MODEL_CGB:
|
||||
cpu->a = 0x11;
|
||||
cpu->f.packed = 0x80;
|
||||
cpu->c = 0;
|
||||
|
|
|
@ -129,6 +129,12 @@ set(UI_FILES
|
|||
TileView.ui
|
||||
VideoView.ui)
|
||||
|
||||
set(GBA_SRC
|
||||
GBAOverride.cpp)
|
||||
|
||||
set(GB_SRC
|
||||
GBOverride.cpp)
|
||||
|
||||
qt5_wrap_ui(UI_SRC ${UI_FILES})
|
||||
|
||||
set(QT_LIBRARIES)
|
||||
|
@ -139,6 +145,14 @@ if(BUILD_SDL)
|
|||
list(APPEND AUDIO_SRC AudioProcessorSDL.cpp)
|
||||
endif()
|
||||
|
||||
if(M_CORE_GBA)
|
||||
list(APPEND PLATFORM_SRC ${GBA_SRC})
|
||||
endif()
|
||||
|
||||
if(M_CORE_GB)
|
||||
list(APPEND PLATFORM_SRC ${GB_SRC})
|
||||
endif()
|
||||
|
||||
set(QT_DEFINES)
|
||||
if(Qt5Multimedia_FOUND)
|
||||
list(APPEND AUDIO_SRC
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QMenu>
|
||||
|
||||
extern "C" {
|
||||
#include "gba/overrides.h"
|
||||
#include "feature/commandline.h"
|
||||
}
|
||||
|
||||
|
@ -177,8 +176,8 @@ QVariant ConfigController::getQtOption(const QString& key, const QString& group)
|
|||
return value;
|
||||
}
|
||||
|
||||
void ConfigController::saveOverride(const GBACartridgeOverride& override) {
|
||||
GBAOverrideSave(overrides(), &override);
|
||||
void ConfigController::saveOverride(const Override& override) {
|
||||
override.save(overrides());
|
||||
write();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#ifndef QGBA_CONFIG_CONTROLLER
|
||||
#define QGBA_CONFIG_CONTROLLER
|
||||
|
||||
#include "Override.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
|
@ -78,7 +80,7 @@ public:
|
|||
void setMRU(const QList<QString>& mru);
|
||||
|
||||
Configuration* overrides() { return mCoreConfigGetOverrides(&m_config); }
|
||||
void saveOverride(const GBACartridgeOverride&);
|
||||
void saveOverride(const Override&);
|
||||
|
||||
Configuration* input() { return mCoreConfigGetInput(&m_config); }
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "GBAOverride.h"
|
||||
|
||||
extern "C" {
|
||||
#include "core/core.h"
|
||||
}
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
void GBAOverride::apply(struct mCore* core) {
|
||||
if (core->platform(core) != PLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
GBAOverrideApply(static_cast<GBA*>(core->board), &override);
|
||||
}
|
||||
|
||||
void GBAOverride::save(struct Configuration* config) const {
|
||||
GBAOverrideSave(config, &override);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef QGBA_GBA_OVERRIDE
|
||||
#define QGBA_GBA_OVERRIDE
|
||||
|
||||
#include "Override.h"
|
||||
|
||||
extern "C" {
|
||||
#include "gba/overrides.h"
|
||||
}
|
||||
|
||||
namespace QGBA {
|
||||
|
||||
class GBAOverride : public Override {
|
||||
public:
|
||||
void apply(struct mCore*) override;
|
||||
void save(struct Configuration*) const override;
|
||||
|
||||
struct GBACartridgeOverride override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "GBOverride.h"
|
||||
|
||||
extern "C" {
|
||||
#include "core/core.h"
|
||||
}
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
void GBOverride::apply(struct mCore* core) {
|
||||
if (core->platform(core) != PLATFORM_GB) {
|
||||
return;
|
||||
}
|
||||
GBOverrideApply(static_cast<GB*>(core->board), &override);
|
||||
}
|
||||
|
||||
void GBOverride::save(struct Configuration* config) const {
|
||||
GBOverrideSave(config, &override);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef QGBA_GB_OVERRIDE
|
||||
#define QGBA_GB_OVERRIDE
|
||||
|
||||
#include "Override.h"
|
||||
|
||||
extern "C" {
|
||||
#include "gb/overrides.h"
|
||||
}
|
||||
|
||||
namespace QGBA {
|
||||
|
||||
class GBOverride : public Override {
|
||||
public:
|
||||
void apply(struct mCore*) override;
|
||||
void save(struct Configuration*) const override;
|
||||
|
||||
struct GBCartridgeOverride override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -70,6 +70,7 @@ GameController::GameController(QObject* parent)
|
|||
, m_backupSaveState(nullptr)
|
||||
, m_saveStateFlags(SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS)
|
||||
, m_loadStateFlags(SAVESTATE_SCREENSHOT)
|
||||
, m_override(nullptr)
|
||||
{
|
||||
#ifdef M_CORE_GBA
|
||||
m_lux.p = this;
|
||||
|
@ -283,8 +284,9 @@ void GameController::clearMultiplayerController() {
|
|||
m_multiplayer = nullptr;
|
||||
}
|
||||
|
||||
void GameController::setOverride(const GBACartridgeOverride& override) {
|
||||
// TODO: Put back overrides
|
||||
void GameController::clearOverride() {
|
||||
delete m_override;
|
||||
m_override = nullptr;
|
||||
}
|
||||
|
||||
void GameController::setConfig(const mCoreConfig* config) {
|
||||
|
@ -434,6 +436,10 @@ void GameController::openGame(bool biosOnly) {
|
|||
}
|
||||
m_vf = nullptr;
|
||||
|
||||
if (m_override) {
|
||||
m_override->apply(m_threadContext.core);
|
||||
}
|
||||
|
||||
if (!mCoreThreadStart(&m_threadContext)) {
|
||||
emit gameFailed();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace QGBA {
|
|||
class AudioProcessor;
|
||||
class InputController;
|
||||
class MultiplayerController;
|
||||
class Override;
|
||||
|
||||
class GameController : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -71,8 +72,9 @@ public:
|
|||
MultiplayerController* multiplayerController() { return m_multiplayer; }
|
||||
void clearMultiplayerController();
|
||||
|
||||
void setOverride(const GBACartridgeOverride& override);
|
||||
void clearOverride() { /* TODO: Put back overrides */ }
|
||||
void setOverride(Override* override) { m_override = override; }
|
||||
Override* override() { return m_override; }
|
||||
void clearOverride();
|
||||
|
||||
void setConfig(const mCoreConfig*);
|
||||
|
||||
|
@ -191,6 +193,7 @@ private:
|
|||
QString m_bios;
|
||||
bool m_useBios;
|
||||
QString m_patch;
|
||||
Override* m_override;
|
||||
|
||||
QThread* m_audioThread;
|
||||
AudioProcessor* m_audioProcessor;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2015 Jeffrey Pfau
|
||||
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
@ -8,17 +8,52 @@
|
|||
#include "ConfigController.h"
|
||||
#include "GameController.h"
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
#include "GBAOverride.h"
|
||||
extern "C" {
|
||||
#include "gba/gba.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef M_CORE_GB
|
||||
#include "GBOverride.h"
|
||||
extern "C" {
|
||||
#include "gb/gb.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
QList<enum GBModel> OverrideView::s_gbModelList;
|
||||
QList<enum GBMemoryBankControllerType> OverrideView::s_mbcList;
|
||||
|
||||
OverrideView::OverrideView(GameController* controller, ConfigController* config, QWidget* parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
|
||||
, m_controller(controller)
|
||||
, m_config(config)
|
||||
{
|
||||
#ifdef M_CORE_GB
|
||||
if (s_mbcList.isEmpty()) {
|
||||
// NB: Keep in sync with OverrideView.ui
|
||||
s_mbcList.append(GB_MBC_AUTODETECT);
|
||||
s_mbcList.append(GB_MBC_NONE);
|
||||
s_mbcList.append(GB_MBC1);
|
||||
s_mbcList.append(GB_MBC2);
|
||||
s_mbcList.append(GB_MBC3);
|
||||
s_mbcList.append(GB_MBC3_RTC);
|
||||
s_mbcList.append(GB_MBC5);
|
||||
s_mbcList.append(GB_MBC5_RUMBLE);
|
||||
s_mbcList.append(GB_MBC7);
|
||||
s_mbcList.append(GB_HuC3);
|
||||
}
|
||||
if (s_gbModelList.isEmpty()) {
|
||||
// NB: Keep in sync with OverrideView.ui
|
||||
s_gbModelList.append(GB_MODEL_AUTODETECT);
|
||||
s_gbModelList.append(GB_MODEL_DMG);
|
||||
s_gbModelList.append(GB_MODEL_CGB);
|
||||
s_gbModelList.append(GB_MODEL_AGB);
|
||||
}
|
||||
#endif
|
||||
m_ui.setupUi(this);
|
||||
|
||||
connect(controller, SIGNAL(gameStarted(mCoreThread*, const QString&)), this, SLOT(gameStarted(mCoreThread*)));
|
||||
|
@ -41,7 +76,18 @@ OverrideView::OverrideView(GameController* controller, ConfigController* config,
|
|||
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()));
|
||||
connect(m_ui.gbModel, SIGNAL(currentIndexChanged(int)), this, SLOT(updateOverrides()));
|
||||
connect(m_ui.mbc, SIGNAL(currentIndexChanged(int)), this, SLOT(updateOverrides()));
|
||||
|
||||
connect(m_ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateOverrides()));
|
||||
#ifndef M_CORE_GBA
|
||||
m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.tabGBA));
|
||||
#endif
|
||||
#ifndef M_CORE_GB
|
||||
m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.tabGB));
|
||||
#endif
|
||||
|
||||
connect(m_ui.buttonBox, SIGNAL(accepted()), this, SLOT(saveOverride()));
|
||||
|
||||
if (controller->isLoaded()) {
|
||||
gameStarted(controller->thread());
|
||||
|
@ -52,50 +98,67 @@ void OverrideView::saveOverride() {
|
|||
if (!m_config) {
|
||||
return;
|
||||
}
|
||||
m_config->saveOverride(m_override);
|
||||
m_config->saveOverride(*m_controller->override());
|
||||
}
|
||||
|
||||
void OverrideView::updateOverrides() {
|
||||
memset(m_override.id, 0, 4);
|
||||
m_override.savetype = static_cast<SavedataType>(m_ui.savetype->currentIndex() - 1);
|
||||
m_override.hardware = HW_NO_OVERRIDE;
|
||||
m_override.idleLoop = IDLE_LOOP_NONE;
|
||||
m_override.mirroring = false;
|
||||
#ifdef M_CORE_GBA
|
||||
if (m_ui.tabWidget->currentWidget() == m_ui.tabGBA) {
|
||||
GBAOverride* gba = new GBAOverride;
|
||||
memset(gba->override.id, 0, 4);
|
||||
gba->override.savetype = static_cast<SavedataType>(m_ui.savetype->currentIndex() - 1);
|
||||
gba->override.hardware = HW_NO_OVERRIDE;
|
||||
gba->override.idleLoop = IDLE_LOOP_NONE;
|
||||
gba->override.mirroring = false;
|
||||
|
||||
if (!m_ui.hwAutodetect->isChecked()) {
|
||||
m_override.hardware = HW_NONE;
|
||||
if (m_ui.hwRTC->isChecked()) {
|
||||
m_override.hardware |= HW_RTC;
|
||||
if (!m_ui.hwAutodetect->isChecked()) {
|
||||
gba->override.hardware = HW_NONE;
|
||||
if (m_ui.hwRTC->isChecked()) {
|
||||
gba->override.hardware |= HW_RTC;
|
||||
}
|
||||
if (m_ui.hwGyro->isChecked()) {
|
||||
gba->override.hardware |= HW_GYRO;
|
||||
}
|
||||
if (m_ui.hwLight->isChecked()) {
|
||||
gba->override.hardware |= HW_LIGHT_SENSOR;
|
||||
}
|
||||
if (m_ui.hwTilt->isChecked()) {
|
||||
gba->override.hardware |= HW_TILT;
|
||||
}
|
||||
if (m_ui.hwRumble->isChecked()) {
|
||||
gba->override.hardware |= HW_RUMBLE;
|
||||
}
|
||||
}
|
||||
if (m_ui.hwGyro->isChecked()) {
|
||||
m_override.hardware |= HW_GYRO;
|
||||
if (m_ui.hwGBPlayer->isChecked()) {
|
||||
gba->override.hardware |= HW_GB_PLAYER_DETECTION;
|
||||
}
|
||||
if (m_ui.hwLight->isChecked()) {
|
||||
m_override.hardware |= HW_LIGHT_SENSOR;
|
||||
}
|
||||
if (m_ui.hwTilt->isChecked()) {
|
||||
m_override.hardware |= HW_TILT;
|
||||
}
|
||||
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);
|
||||
if (ok) {
|
||||
m_override.idleLoop = parsedIdleLoop;
|
||||
}
|
||||
bool ok;
|
||||
uint32_t parsedIdleLoop = m_ui.idleLoop->text().toInt(&ok, 16);
|
||||
if (ok) {
|
||||
gba->override.idleLoop = parsedIdleLoop;
|
||||
}
|
||||
|
||||
if (m_override.savetype != SAVEDATA_AUTODETECT || m_override.hardware != HW_NO_OVERRIDE ||
|
||||
m_override.idleLoop != IDLE_LOOP_NONE) {
|
||||
m_controller->setOverride(m_override);
|
||||
} else {
|
||||
m_controller->clearOverride();
|
||||
if (gba->override.savetype != SAVEDATA_AUTODETECT || gba->override.hardware != HW_NO_OVERRIDE ||
|
||||
gba->override.idleLoop != IDLE_LOOP_NONE) {
|
||||
m_controller->setOverride(gba);
|
||||
} else {
|
||||
m_controller->clearOverride();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
if (m_ui.tabWidget->currentWidget() == m_ui.tabGB) {
|
||||
GBOverride* gb = new GBOverride;
|
||||
gb->override.mbc = s_mbcList[m_ui.mbc->currentIndex()];
|
||||
gb->override.model = s_gbModelList[m_ui.gbModel->currentIndex()];
|
||||
if (gb->override.mbc != GB_MBC_AUTODETECT || gb->override.model != GB_MODEL_AUTODETECT) {
|
||||
m_controller->setOverride(gb);
|
||||
} else {
|
||||
m_controller->clearOverride();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void OverrideView::gameStarted(mCoreThread* thread) {
|
||||
|
@ -103,66 +166,61 @@ void OverrideView::gameStarted(mCoreThread* thread) {
|
|||
gameStopped();
|
||||
return;
|
||||
}
|
||||
if (thread->core->platform(thread->core) != PLATFORM_GBA) {
|
||||
close();
|
||||
return;
|
||||
|
||||
m_ui.tabWidget->setEnabled(false);
|
||||
|
||||
switch (thread->core->platform(thread->core)) {
|
||||
#ifdef M_CORE_GBA
|
||||
case PLATFORM_GBA: {
|
||||
m_ui.tabWidget->setCurrentWidget(m_ui.tabGBA);
|
||||
GBA* gba = static_cast<GBA*>(thread->core->board);
|
||||
m_ui.savetype->setCurrentIndex(gba->memory.savedata.type + 1);
|
||||
m_ui.hwRTC->setChecked(gba->memory.hw.devices & HW_RTC);
|
||||
m_ui.hwGyro->setChecked(gba->memory.hw.devices & HW_GYRO);
|
||||
m_ui.hwLight->setChecked(gba->memory.hw.devices & HW_LIGHT_SENSOR);
|
||||
m_ui.hwTilt->setChecked(gba->memory.hw.devices & HW_TILT);
|
||||
m_ui.hwRumble->setChecked(gba->memory.hw.devices & HW_RUMBLE);
|
||||
m_ui.hwGBPlayer->setChecked(gba->memory.hw.devices & HW_GB_PLAYER_DETECTION);
|
||||
|
||||
if (gba->idleLoop != IDLE_LOOP_NONE) {
|
||||
m_ui.idleLoop->setText(QString::number(gba->idleLoop, 16));
|
||||
} else {
|
||||
m_ui.idleLoop->clear();
|
||||
}
|
||||
break;
|
||||
}
|
||||
GBA* gba = static_cast<GBA*>(thread->core->board);
|
||||
m_ui.savetype->setCurrentIndex(gba->memory.savedata.type + 1);
|
||||
m_ui.savetype->setEnabled(false);
|
||||
|
||||
m_ui.hwAutodetect->setEnabled(false);
|
||||
m_ui.hwRTC->setEnabled(false);
|
||||
m_ui.hwGyro->setEnabled(false);
|
||||
m_ui.hwLight->setEnabled(false);
|
||||
m_ui.hwTilt->setEnabled(false);
|
||||
m_ui.hwRumble->setEnabled(false);
|
||||
|
||||
m_ui.hwRTC->setChecked(gba->memory.hw.devices & HW_RTC);
|
||||
m_ui.hwGyro->setChecked(gba->memory.hw.devices & HW_GYRO);
|
||||
m_ui.hwLight->setChecked(gba->memory.hw.devices & HW_LIGHT_SENSOR);
|
||||
m_ui.hwTilt->setChecked(gba->memory.hw.devices & HW_TILT);
|
||||
m_ui.hwRumble->setChecked(gba->memory.hw.devices & HW_RUMBLE);
|
||||
m_ui.hwGBPlayer->setChecked(gba->memory.hw.devices & HW_GB_PLAYER_DETECTION);
|
||||
|
||||
if (gba->idleLoop != IDLE_LOOP_NONE) {
|
||||
m_ui.idleLoop->setText(QString::number(gba->idleLoop, 16));
|
||||
} else {
|
||||
m_ui.idleLoop->clear();
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
case PLATFORM_GB: {
|
||||
m_ui.tabWidget->setCurrentWidget(m_ui.tabGB);
|
||||
GB* gb = static_cast<GB*>(thread->core->board);
|
||||
int mbc = s_mbcList.indexOf(gb->memory.mbcType);
|
||||
if (mbc >= 0) {
|
||||
m_ui.mbc->setCurrentIndex(mbc);
|
||||
} else {
|
||||
m_ui.mbc->setCurrentIndex(0);
|
||||
}
|
||||
int model = s_gbModelList.indexOf(gb->model);
|
||||
if (model >= 0) {
|
||||
m_ui.gbModel->setCurrentIndex(model);
|
||||
} else {
|
||||
m_ui.gbModel->setCurrentIndex(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case PLATFORM_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
GBAGetGameCode(gba, m_override.id);
|
||||
m_override.hardware = gba->memory.hw.devices;
|
||||
m_override.savetype = gba->memory.savedata.type;
|
||||
m_override.idleLoop = gba->idleLoop;
|
||||
|
||||
m_ui.idleLoop->setEnabled(false);
|
||||
|
||||
m_ui.save->setEnabled(m_config);
|
||||
}
|
||||
|
||||
void OverrideView::gameStopped() {
|
||||
m_ui.tabWidget->setEnabled(true);
|
||||
m_ui.savetype->setCurrentIndex(0);
|
||||
m_ui.savetype->setEnabled(true);
|
||||
|
||||
m_ui.hwAutodetect->setEnabled(true);
|
||||
m_ui.hwRTC->setEnabled(!m_ui.hwAutodetect->isChecked());
|
||||
m_ui.hwGyro->setEnabled(!m_ui.hwAutodetect->isChecked());
|
||||
m_ui.hwLight->setEnabled(!m_ui.hwAutodetect->isChecked());
|
||||
m_ui.hwTilt->setEnabled(!m_ui.hwAutodetect->isChecked());
|
||||
m_ui.hwRumble->setEnabled(!m_ui.hwAutodetect->isChecked());
|
||||
|
||||
m_ui.hwAutodetect->setChecked(true);
|
||||
m_ui.hwRTC->setChecked(false);
|
||||
m_ui.hwGyro->setChecked(false);
|
||||
m_ui.hwLight->setChecked(false);
|
||||
m_ui.hwTilt->setChecked(false);
|
||||
m_ui.hwRumble->setChecked(false);
|
||||
|
||||
m_ui.idleLoop->setEnabled(true);
|
||||
m_ui.idleLoop->clear();
|
||||
|
||||
m_ui.save->setEnabled(false);
|
||||
m_ui.mbc->setCurrentIndex(0);
|
||||
m_ui.gbModel->setCurrentIndex(0);
|
||||
|
||||
updateOverrides();
|
||||
}
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_OverrideView.h"
|
||||
|
||||
#ifdef M_CORE_GB
|
||||
extern "C" {
|
||||
#include "gba/overrides.h"
|
||||
#include "gb/overrides.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "ui_OverrideView.h"
|
||||
|
||||
struct mCoreThread;
|
||||
|
||||
|
@ -20,6 +22,7 @@ namespace QGBA {
|
|||
|
||||
class ConfigController;
|
||||
class GameController;
|
||||
class Override;
|
||||
|
||||
class OverrideView : public QDialog {
|
||||
Q_OBJECT
|
||||
|
@ -40,7 +43,11 @@ private:
|
|||
|
||||
GameController* m_controller;
|
||||
ConfigController* m_config;
|
||||
GBACartridgeOverride m_override;
|
||||
|
||||
#ifdef M_CORE_GB
|
||||
static QList<enum GBModel> s_gbModelList;
|
||||
static QList<enum GBMemoryBankControllerType> s_mbcList;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>401</width>
|
||||
<height>203</height>
|
||||
<width>443</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -19,232 +19,322 @@
|
|||
<property name="windowTitle">
|
||||
<string>Game Overrides</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<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>
|
||||
<widget class="QPushButton" name="save">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</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">
|
||||
<widget class="QWidget" name="tabGBA">
|
||||
<attribute name="title">
|
||||
<string>Game Boy Advance</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwAutodetect">
|
||||
<property name="text">
|
||||
<string>Autodetect</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwRTC">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Realtime clock</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwGyro">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gyroscope</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwTilt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tilt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwLight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Light sensor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwRumble">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<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_2">
|
||||
<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="1" 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>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabGB">
|
||||
<attribute name="title">
|
||||
<string>Game Boy</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Game Boy model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="gbModel">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Save type</string>
|
||||
<string>Autodetect</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">
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Idle loop</string>
|
||||
<string>Game Boy (DMG)</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">
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Game Boy Player features</string>
|
||||
<string>Game Boy Color (CGB)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Game Boy Advance (AGB)</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Memory bank controller</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="mbc">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Autodetect</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC3 + RTC</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC5 + Rumble</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MBC7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HuC-3</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwAutodetect">
|
||||
<property name="text">
|
||||
<string>Autodetect</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwRTC">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Realtime clock</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwGyro">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gyroscope</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwTilt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tilt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwLight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Light sensor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hwRumble">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -1318,7 +1318,6 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
#ifdef M_CORE_GBA
|
||||
QAction* overrides = new QAction(tr("Game &overrides..."), toolsMenu);
|
||||
connect(overrides, SIGNAL(triggered()), this, SLOT(openOverrideWindow()));
|
||||
m_gbaActions.append(overrides);
|
||||
addControlledAction(toolsMenu, overrides, "overrideWindow");
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue