mirror of https://github.com/mgba-emu/mgba.git
Qt: GB Override view
This commit is contained in:
parent
1bc8dfe42b
commit
e81ed20a14
19
src/gb/gb.c
19
src/gb/gb.c
|
@ -265,7 +265,21 @@ void GBReset(struct LR35902Core* cpu) {
|
||||||
gb->biosVf->seek(gb->biosVf, 0, SEEK_SET);
|
gb->biosVf->seek(gb->biosVf, 0, SEEK_SET);
|
||||||
gb->memory.romBase = malloc(GB_SIZE_CART_BANK0);
|
gb->memory.romBase = malloc(GB_SIZE_CART_BANK0);
|
||||||
ssize_t size = gb->biosVf->read(gb->biosVf, gb->memory.romBase, GB_SIZE_CART_BANK0);
|
ssize_t size = gb->biosVf->read(gb->biosVf, gb->memory.romBase, GB_SIZE_CART_BANK0);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gb->biosVf) {
|
||||||
memcpy(&gb->memory.romBase[size], &gb->memory.rom[size], GB_SIZE_CART_BANK0 - size);
|
memcpy(&gb->memory.romBase[size], &gb->memory.rom[size], GB_SIZE_CART_BANK0 - size);
|
||||||
if (size > 0x100) {
|
if (size > 0x100) {
|
||||||
memcpy(&gb->memory.romBase[0x100], &gb->memory.rom[0x100], sizeof(struct GBCartridge));
|
memcpy(&gb->memory.romBase[0x100], &gb->memory.rom[0x100], sizeof(struct GBCartridge));
|
||||||
|
@ -280,6 +294,7 @@ void GBReset(struct LR35902Core* cpu) {
|
||||||
cpu->sp = 0;
|
cpu->sp = 0;
|
||||||
cpu->pc = 0;
|
cpu->pc = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cpu->b = 0;
|
cpu->b = 0;
|
||||||
cpu->d = 0;
|
cpu->d = 0;
|
||||||
|
@ -298,10 +313,10 @@ void GBReset(struct LR35902Core* cpu) {
|
||||||
cpu->h = 1;
|
cpu->h = 1;
|
||||||
cpu->l = 0x4D;
|
cpu->l = 0x4D;
|
||||||
break;
|
break;
|
||||||
case GB_MODEL_CGB:
|
case GB_MODEL_AGB:
|
||||||
cpu->b = 1;
|
cpu->b = 1;
|
||||||
// Fall through
|
// Fall through
|
||||||
case GB_MODEL_AGB: // Silence warnings
|
case GB_MODEL_CGB:
|
||||||
cpu->a = 0x11;
|
cpu->a = 0x11;
|
||||||
cpu->f.packed = 0x80;
|
cpu->f.packed = 0x80;
|
||||||
cpu->c = 0;
|
cpu->c = 0;
|
||||||
|
|
|
@ -129,6 +129,12 @@ set(UI_FILES
|
||||||
TileView.ui
|
TileView.ui
|
||||||
VideoView.ui)
|
VideoView.ui)
|
||||||
|
|
||||||
|
set(GBA_SRC
|
||||||
|
GBAOverride.cpp)
|
||||||
|
|
||||||
|
set(GB_SRC
|
||||||
|
GBOverride.cpp)
|
||||||
|
|
||||||
qt5_wrap_ui(UI_SRC ${UI_FILES})
|
qt5_wrap_ui(UI_SRC ${UI_FILES})
|
||||||
|
|
||||||
set(QT_LIBRARIES)
|
set(QT_LIBRARIES)
|
||||||
|
@ -139,6 +145,14 @@ if(BUILD_SDL)
|
||||||
list(APPEND AUDIO_SRC AudioProcessorSDL.cpp)
|
list(APPEND AUDIO_SRC AudioProcessorSDL.cpp)
|
||||||
endif()
|
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)
|
set(QT_DEFINES)
|
||||||
if(Qt5Multimedia_FOUND)
|
if(Qt5Multimedia_FOUND)
|
||||||
list(APPEND AUDIO_SRC
|
list(APPEND AUDIO_SRC
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "gba/overrides.h"
|
|
||||||
#include "feature/commandline.h"
|
#include "feature/commandline.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +176,8 @@ QVariant ConfigController::getQtOption(const QString& key, const QString& group)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigController::saveOverride(const GBACartridgeOverride& override) {
|
void ConfigController::saveOverride(const Override& override) {
|
||||||
GBAOverrideSave(overrides(), &override);
|
override.save(overrides());
|
||||||
write();
|
write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#ifndef QGBA_CONFIG_CONTROLLER
|
#ifndef QGBA_CONFIG_CONTROLLER
|
||||||
#define QGBA_CONFIG_CONTROLLER
|
#define QGBA_CONFIG_CONTROLLER
|
||||||
|
|
||||||
|
#include "Override.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
@ -78,7 +80,7 @@ public:
|
||||||
void setMRU(const QList<QString>& mru);
|
void setMRU(const QList<QString>& mru);
|
||||||
|
|
||||||
Configuration* overrides() { return mCoreConfigGetOverrides(&m_config); }
|
Configuration* overrides() { return mCoreConfigGetOverrides(&m_config); }
|
||||||
void saveOverride(const GBACartridgeOverride&);
|
void saveOverride(const Override&);
|
||||||
|
|
||||||
Configuration* input() { return mCoreConfigGetInput(&m_config); }
|
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_backupSaveState(nullptr)
|
||||||
, m_saveStateFlags(SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS)
|
, m_saveStateFlags(SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS)
|
||||||
, m_loadStateFlags(SAVESTATE_SCREENSHOT)
|
, m_loadStateFlags(SAVESTATE_SCREENSHOT)
|
||||||
|
, m_override(nullptr)
|
||||||
{
|
{
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
m_lux.p = this;
|
m_lux.p = this;
|
||||||
|
@ -283,8 +284,9 @@ void GameController::clearMultiplayerController() {
|
||||||
m_multiplayer = nullptr;
|
m_multiplayer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::setOverride(const GBACartridgeOverride& override) {
|
void GameController::clearOverride() {
|
||||||
// TODO: Put back overrides
|
delete m_override;
|
||||||
|
m_override = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::setConfig(const mCoreConfig* config) {
|
void GameController::setConfig(const mCoreConfig* config) {
|
||||||
|
@ -434,6 +436,10 @@ void GameController::openGame(bool biosOnly) {
|
||||||
}
|
}
|
||||||
m_vf = nullptr;
|
m_vf = nullptr;
|
||||||
|
|
||||||
|
if (m_override) {
|
||||||
|
m_override->apply(m_threadContext.core);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mCoreThreadStart(&m_threadContext)) {
|
if (!mCoreThreadStart(&m_threadContext)) {
|
||||||
emit gameFailed();
|
emit gameFailed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace QGBA {
|
||||||
class AudioProcessor;
|
class AudioProcessor;
|
||||||
class InputController;
|
class InputController;
|
||||||
class MultiplayerController;
|
class MultiplayerController;
|
||||||
|
class Override;
|
||||||
|
|
||||||
class GameController : public QObject {
|
class GameController : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -71,8 +72,9 @@ public:
|
||||||
MultiplayerController* multiplayerController() { return m_multiplayer; }
|
MultiplayerController* multiplayerController() { return m_multiplayer; }
|
||||||
void clearMultiplayerController();
|
void clearMultiplayerController();
|
||||||
|
|
||||||
void setOverride(const GBACartridgeOverride& override);
|
void setOverride(Override* override) { m_override = override; }
|
||||||
void clearOverride() { /* TODO: Put back overrides */ }
|
Override* override() { return m_override; }
|
||||||
|
void clearOverride();
|
||||||
|
|
||||||
void setConfig(const mCoreConfig*);
|
void setConfig(const mCoreConfig*);
|
||||||
|
|
||||||
|
@ -191,6 +193,7 @@ private:
|
||||||
QString m_bios;
|
QString m_bios;
|
||||||
bool m_useBios;
|
bool m_useBios;
|
||||||
QString m_patch;
|
QString m_patch;
|
||||||
|
Override* m_override;
|
||||||
|
|
||||||
QThread* m_audioThread;
|
QThread* m_audioThread;
|
||||||
AudioProcessor* m_audioProcessor;
|
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
|
* 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
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
@ -8,17 +8,52 @@
|
||||||
#include "ConfigController.h"
|
#include "ConfigController.h"
|
||||||
#include "GameController.h"
|
#include "GameController.h"
|
||||||
|
|
||||||
|
#ifdef M_CORE_GBA
|
||||||
|
#include "GBAOverride.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "gba/gba.h"
|
#include "gba/gba.h"
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef M_CORE_GB
|
||||||
|
#include "GBOverride.h"
|
||||||
|
extern "C" {
|
||||||
|
#include "gb/gb.h"
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
|
||||||
|
QList<enum GBModel> OverrideView::s_gbModelList;
|
||||||
|
QList<enum GBMemoryBankControllerType> OverrideView::s_mbcList;
|
||||||
|
|
||||||
OverrideView::OverrideView(GameController* controller, ConfigController* config, QWidget* parent)
|
OverrideView::OverrideView(GameController* controller, ConfigController* config, QWidget* parent)
|
||||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
|
||||||
, m_controller(controller)
|
, m_controller(controller)
|
||||||
, m_config(config)
|
, 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);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
connect(controller, SIGNAL(gameStarted(mCoreThread*, const QString&)), this, SLOT(gameStarted(mCoreThread*)));
|
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.hwRumble, SIGNAL(clicked()), this, SLOT(updateOverrides()));
|
||||||
connect(m_ui.hwGBPlayer, 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()) {
|
if (controller->isLoaded()) {
|
||||||
gameStarted(controller->thread());
|
gameStarted(controller->thread());
|
||||||
|
@ -52,50 +98,67 @@ void OverrideView::saveOverride() {
|
||||||
if (!m_config) {
|
if (!m_config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_config->saveOverride(m_override);
|
m_config->saveOverride(*m_controller->override());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverrideView::updateOverrides() {
|
void OverrideView::updateOverrides() {
|
||||||
memset(m_override.id, 0, 4);
|
#ifdef M_CORE_GBA
|
||||||
m_override.savetype = static_cast<SavedataType>(m_ui.savetype->currentIndex() - 1);
|
if (m_ui.tabWidget->currentWidget() == m_ui.tabGBA) {
|
||||||
m_override.hardware = HW_NO_OVERRIDE;
|
GBAOverride* gba = new GBAOverride;
|
||||||
m_override.idleLoop = IDLE_LOOP_NONE;
|
memset(gba->override.id, 0, 4);
|
||||||
m_override.mirroring = false;
|
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()) {
|
if (!m_ui.hwAutodetect->isChecked()) {
|
||||||
m_override.hardware = HW_NONE;
|
gba->override.hardware = HW_NONE;
|
||||||
if (m_ui.hwRTC->isChecked()) {
|
if (m_ui.hwRTC->isChecked()) {
|
||||||
m_override.hardware |= HW_RTC;
|
gba->override.hardware |= HW_RTC;
|
||||||
}
|
}
|
||||||
if (m_ui.hwGyro->isChecked()) {
|
if (m_ui.hwGyro->isChecked()) {
|
||||||
m_override.hardware |= HW_GYRO;
|
gba->override.hardware |= HW_GYRO;
|
||||||
}
|
}
|
||||||
if (m_ui.hwLight->isChecked()) {
|
if (m_ui.hwLight->isChecked()) {
|
||||||
m_override.hardware |= HW_LIGHT_SENSOR;
|
gba->override.hardware |= HW_LIGHT_SENSOR;
|
||||||
}
|
}
|
||||||
if (m_ui.hwTilt->isChecked()) {
|
if (m_ui.hwTilt->isChecked()) {
|
||||||
m_override.hardware |= HW_TILT;
|
gba->override.hardware |= HW_TILT;
|
||||||
}
|
}
|
||||||
if (m_ui.hwRumble->isChecked()) {
|
if (m_ui.hwRumble->isChecked()) {
|
||||||
m_override.hardware |= HW_RUMBLE;
|
gba->override.hardware |= HW_RUMBLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_ui.hwGBPlayer->isChecked()) {
|
if (m_ui.hwGBPlayer->isChecked()) {
|
||||||
m_override.hardware |= HW_GB_PLAYER_DETECTION;
|
gba->override.hardware |= HW_GB_PLAYER_DETECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
uint32_t parsedIdleLoop = m_ui.idleLoop->text().toInt(&ok, 16);
|
uint32_t parsedIdleLoop = m_ui.idleLoop->text().toInt(&ok, 16);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
m_override.idleLoop = parsedIdleLoop;
|
gba->override.idleLoop = parsedIdleLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_override.savetype != SAVEDATA_AUTODETECT || m_override.hardware != HW_NO_OVERRIDE ||
|
if (gba->override.savetype != SAVEDATA_AUTODETECT || gba->override.hardware != HW_NO_OVERRIDE ||
|
||||||
m_override.idleLoop != IDLE_LOOP_NONE) {
|
gba->override.idleLoop != IDLE_LOOP_NONE) {
|
||||||
m_controller->setOverride(m_override);
|
m_controller->setOverride(gba);
|
||||||
} else {
|
} else {
|
||||||
m_controller->clearOverride();
|
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) {
|
void OverrideView::gameStarted(mCoreThread* thread) {
|
||||||
|
@ -103,21 +166,15 @@ void OverrideView::gameStarted(mCoreThread* thread) {
|
||||||
gameStopped();
|
gameStopped();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (thread->core->platform(thread->core) != PLATFORM_GBA) {
|
|
||||||
close();
|
m_ui.tabWidget->setEnabled(false);
|
||||||
return;
|
|
||||||
}
|
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);
|
GBA* gba = static_cast<GBA*>(thread->core->board);
|
||||||
m_ui.savetype->setCurrentIndex(gba->memory.savedata.type + 1);
|
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.hwRTC->setChecked(gba->memory.hw.devices & HW_RTC);
|
||||||
m_ui.hwGyro->setChecked(gba->memory.hw.devices & HW_GYRO);
|
m_ui.hwGyro->setChecked(gba->memory.hw.devices & HW_GYRO);
|
||||||
m_ui.hwLight->setChecked(gba->memory.hw.devices & HW_LIGHT_SENSOR);
|
m_ui.hwLight->setChecked(gba->memory.hw.devices & HW_LIGHT_SENSOR);
|
||||||
|
@ -130,39 +187,40 @@ void OverrideView::gameStarted(mCoreThread* thread) {
|
||||||
} else {
|
} else {
|
||||||
m_ui.idleLoop->clear();
|
m_ui.idleLoop->clear();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
GBAGetGameCode(gba, m_override.id);
|
}
|
||||||
m_override.hardware = gba->memory.hw.devices;
|
#endif
|
||||||
m_override.savetype = gba->memory.savedata.type;
|
#ifdef M_CORE_GB
|
||||||
m_override.idleLoop = gba->idleLoop;
|
case PLATFORM_GB: {
|
||||||
|
m_ui.tabWidget->setCurrentWidget(m_ui.tabGB);
|
||||||
m_ui.idleLoop->setEnabled(false);
|
GB* gb = static_cast<GB*>(thread->core->board);
|
||||||
|
int mbc = s_mbcList.indexOf(gb->memory.mbcType);
|
||||||
m_ui.save->setEnabled(m_config);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverrideView::gameStopped() {
|
void OverrideView::gameStopped() {
|
||||||
|
m_ui.tabWidget->setEnabled(true);
|
||||||
m_ui.savetype->setCurrentIndex(0);
|
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.idleLoop->clear();
|
||||||
|
|
||||||
m_ui.save->setEnabled(false);
|
m_ui.mbc->setCurrentIndex(0);
|
||||||
|
m_ui.gbModel->setCurrentIndex(0);
|
||||||
|
|
||||||
updateOverrides();
|
updateOverrides();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "ui_OverrideView.h"
|
#ifdef M_CORE_GB
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "gba/overrides.h"
|
#include "gb/overrides.h"
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ui_OverrideView.h"
|
||||||
|
|
||||||
struct mCoreThread;
|
struct mCoreThread;
|
||||||
|
|
||||||
|
@ -20,6 +22,7 @@ namespace QGBA {
|
||||||
|
|
||||||
class ConfigController;
|
class ConfigController;
|
||||||
class GameController;
|
class GameController;
|
||||||
|
class Override;
|
||||||
|
|
||||||
class OverrideView : public QDialog {
|
class OverrideView : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -40,7 +43,11 @@ private:
|
||||||
|
|
||||||
GameController* m_controller;
|
GameController* m_controller;
|
||||||
ConfigController* m_config;
|
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>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>401</width>
|
<width>443</width>
|
||||||
<height>203</height>
|
<height>282</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -19,56 +19,92 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Game Overrides</string>
|
<string>Game Overrides</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetFixedSize</enum>
|
|
||||||
</property>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="orientation">
|
<property name="currentIndex">
|
||||||
<enum>Qt::Horizontal</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<widget class="QWidget" name="tabGBA">
|
||||||
<size>
|
<attribute name="title">
|
||||||
<width>0</width>
|
<string>Game Boy Advance</string>
|
||||||
<height>0</height>
|
</attribute>
|
||||||
</size>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
</property>
|
<item row="0" column="0" rowspan="3">
|
||||||
</spacer>
|
<widget class="QGroupBox" name="groupBox">
|
||||||
</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>
|
|
||||||
</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">
|
<property name="title">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<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>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -139,7 +175,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -178,74 +214,128 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" rowspan="3">
|
<item row="1" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<spacer name="verticalSpacer">
|
||||||
<property name="title">
|
<property name="orientation">
|
||||||
<string/>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<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>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwAutodetect">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Autodetect</string>
|
<string>Autodetect</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
</item>
|
||||||
<bool>true</bool>
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Game Boy (DMG)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Game Boy Color (CGB)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Game Boy Advance (AGB)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Memory bank controller</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="mbc">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwRTC">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Realtime clock</string>
|
<string>Autodetect</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwGyro">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gyroscope</string>
|
<string>None</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwTilt">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tilt</string>
|
<string>MBC1</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwLight">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Light sensor</string>
|
<string>MBC2</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="hwRumble">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Rumble</string>
|
<string>MBC3</string>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -1318,7 +1318,6 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
QAction* overrides = new QAction(tr("Game &overrides..."), toolsMenu);
|
QAction* overrides = new QAction(tr("Game &overrides..."), toolsMenu);
|
||||||
connect(overrides, SIGNAL(triggered()), this, SLOT(openOverrideWindow()));
|
connect(overrides, SIGNAL(triggered()), this, SLOT(openOverrideWindow()));
|
||||||
m_gbaActions.append(overrides);
|
|
||||||
addControlledAction(toolsMenu, overrides, "overrideWindow");
|
addControlledAction(toolsMenu, overrides, "overrideWindow");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue