Qt: Warning dialog if an unimplemented BIOS feature is called (fixes #177)

This commit is contained in:
Jeffrey Pfau 2015-03-23 22:12:57 -07:00
parent 740f733563
commit 3d8cfda57d
5 changed files with 27 additions and 0 deletions

View File

@ -32,6 +32,7 @@ Features:
- 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

View File

@ -118,7 +118,14 @@ GameController::GameController(QObject* parent)
};
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)) {

View File

@ -85,6 +85,7 @@ signals:
void gameCrashed(const QString& errorMessage);
void gameFailed();
void stateLoaded(GBAThread*);
void unimplementedBiosCall(int);
void luminanceValueChanged(int);

View File

@ -97,6 +97,7 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
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 @@ void Window::gameStarted(GBAThread* context) {
}
#endif
m_hitUnimplementedBiosCall = false;
m_fpsTimer.start();
}
@ -442,6 +444,19 @@ void Window::gameFailed() {
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();
}
void Window::recordFrame() {
m_frameList.append(QDateTime::currentDateTime());
while (m_frameList.count() > FRAME_LIST_SIZE) {

View File

@ -101,6 +101,7 @@ private slots:
void gameStopped();
void gameCrashed(const QString&);
void gameFailed();
void unimplementedBiosCall(int);
void recordFrame();
void showFPS();
@ -136,6 +137,8 @@ private:
ShortcutController* m_shortcutController;
int m_playerId;
bool m_hitUnimplementedBiosCall;
#ifdef USE_FFMPEG
VideoView* m_videoView;
#endif