Qt: Warning dialog if an unimplemented BIOS feature is called (fixes #177)
Jeffrey Pfau jeffrey@endrift.com
Mon, 23 Mar 2015 22:12:57 -0700
5 files changed,
27 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -32,6 +32,7 @@ - Ability to lock aspect ratio
- Local link cable support - Ability to switch which game controller is in use per instance - Ability to prevent opposing directional input + - Warning dialog if an unimplemented BIOS feature is called Bugfixes: - ARM7: Extend prefetch by one stage - GBA Audio: Support 16-bit writes to FIFO audio
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -118,7 +118,14 @@ controller->frameAvailable(controller->m_drawContext);
}; m_threadContext.logHandler = [] (GBAThread* context, enum GBALogLevel level, const char* format, va_list args) { + static const char* stubMessage = "Stub software interrupt"; GameController* controller = static_cast<GameController*>(context->userData); + if (level == GBA_LOG_STUB && strncmp(stubMessage, format, strlen(stubMessage)) == 0) { + va_list argc; + va_copy(argc, args); + int immediate = va_arg(argc, int); + controller->unimplementedBiosCall(immediate); + } if (level == GBA_LOG_FATAL) { QMetaObject::invokeMethod(controller, "crashGame", Q_ARG(const QString&, QString().vsprintf(format, args))); } else if (!(controller->m_logLevels & level)) {
M
src/platform/qt/GameController.h
→
src/platform/qt/GameController.h
@@ -85,6 +85,7 @@ void gameUnpaused(GBAThread*);
void gameCrashed(const QString& errorMessage); void gameFailed(); void stateLoaded(GBAThread*); + void unimplementedBiosCall(int); void luminanceValueChanged(int);
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -97,6 +97,7 @@ connect(m_controller, SIGNAL(postLog(int, const QString&)), m_logView, SLOT(postLog(int, const QString&)));
connect(m_controller, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(recordFrame())); connect(m_controller, SIGNAL(gameCrashed(const QString&)), this, SLOT(gameCrashed(const QString&))); connect(m_controller, SIGNAL(gameFailed()), this, SLOT(gameFailed())); + connect(m_controller, SIGNAL(unimplementedBiosCall(int)), this, SLOT(unimplementedBiosCall(int))); connect(m_logView, SIGNAL(levelsSet(int)), m_controller, SLOT(setLogLevel(int))); connect(m_logView, SIGNAL(levelsEnabled(int)), m_controller, SLOT(enableLogLevel(int))); connect(m_logView, SIGNAL(levelsDisabled(int)), m_controller, SLOT(disableLogLevel(int)));@@ -411,6 +412,7 @@ menuBar()->hide();
} #endif + m_hitUnimplementedBiosCall = false; m_fpsTimer.start(); }@@ -437,6 +439,19 @@
void Window::gameFailed() { QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Couldn't Load"), tr("Could not load game. Are you sure it's in the correct format?"), + QMessageBox::Ok, this, Qt::Sheet); + fail->setAttribute(Qt::WA_DeleteOnClose); + fail->show(); +} + +void Window::unimplementedBiosCall(int call) { + if (m_hitUnimplementedBiosCall) { + return; + } + m_hitUnimplementedBiosCall = true; + + QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Unimplemented BIOS call"), + tr("This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience."), QMessageBox::Ok, this, Qt::Sheet); fail->setAttribute(Qt::WA_DeleteOnClose); fail->show();
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -101,6 +101,7 @@ void gameStarted(GBAThread*);
void gameStopped(); void gameCrashed(const QString&); void gameFailed(); + void unimplementedBiosCall(int); void recordFrame(); void showFPS();@@ -135,6 +136,8 @@ QList<QString> m_mruFiles;
QMenu* m_mruMenu; ShortcutController* m_shortcutController; int m_playerId; + + bool m_hitUnimplementedBiosCall; #ifdef USE_FFMPEG VideoView* m_videoView;