GB: Add GB/GBC No-Intro databases

This commit is contained in:
Jeffrey Pfau 2016-02-17 19:34:46 -08:00
parent 4e7f70c102
commit d8dc368f36
3 changed files with 18237 additions and 16 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ ROMInfo::ROMInfo(GameController* controller, QWidget* parent)
}
const NoIntroDB* db = GBAApp::app()->gameDB();
uint32_t crc32 = 0;
controller->threadInterrupt();
mCore* core = controller->thread()->core;
@ -50,17 +51,7 @@ ROMInfo::ROMInfo(GameController* controller, QWidget* parent)
case PLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(core->board);
m_ui.size->setText(QString::number(gba->pristineRomSize) + tr(" bytes"));
m_ui.crc->setText(QString::number(gba->romCrc32, 16));
if (db) {
NoIntroGame game;
if (NoIntroDBLookupGameByCRC(db, gba->romCrc32, &game)) {
m_ui.name->setText(game.name);
} else {
m_ui.name->setText(tr("(unknown)"));
}
} else {
m_ui.name->setText(tr("(no database present)"));
}
crc32 = gba->romCrc32;
break;
}
#endif
@ -68,16 +59,29 @@ ROMInfo::ROMInfo(GameController* controller, QWidget* parent)
case PLATFORM_GB: {
GB* gb = static_cast<GB*>(core->board);
m_ui.size->setText(QString::number(gb->pristineRomSize) + tr(" bytes"));
m_ui.crc->setText(QString::number(gb->romCrc32, 16));
m_ui.name->setText(tr("(unknown)"));
crc32 = gb->romCrc32;
break;
}
#endif
default:
m_ui.size->setText(tr("(unknown)"));
break;
}
if (crc32) {
m_ui.crc->setText(QString::number(crc32, 16));
if (db) {
NoIntroGame game;
if (NoIntroDBLookupGameByCRC(db, crc32, &game)) {
m_ui.name->setText(game.name);
} else {
m_ui.name->setText(tr("(unknown)"));
}
} else {
m_ui.name->setText(tr("(no database present)"));
}
} else {
m_ui.crc->setText(tr("(unknown)"));
m_ui.name->setText(tr("(unknown)"));
}
controller->threadContinue();
}

View File

@ -38,6 +38,9 @@
#include "VideoView.h"
extern "C" {
#ifdef M_CORE_GB
#include "gb/gb.h"
#endif
#include "platform/commandline.h"
#include "util/nointro.h"
#include "util/vfs.h"
@ -733,8 +736,29 @@ void Window::updateTitle(float fps) {
if (m_controller->isLoaded()) {
const NoIntroDB* db = GBAApp::app()->gameDB();
NoIntroGame game;
if (m_controller->thread()->core->platform(m_controller->thread()->core) == PLATFORM_GBA && db &&
NoIntroDBLookupGameByCRC(db, static_cast<GBA*>(m_controller->thread()->core->board)->romCrc32, &game)) {
uint32_t crc32 = 0;
switch (m_controller->thread()->core->platform(m_controller->thread()->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(m_controller->thread()->core->board);
crc32 = gba->romCrc32;
break;
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
GB* gb = static_cast<GB*>(m_controller->thread()->core->board);
crc32 = gb->romCrc32;
break;
}
#endif
default:
break;
}
if (db && crc32) {
NoIntroDBLookupGameByCRC(db, crc32, &game);
title = QLatin1String(game.name);
} else {
char gameTitle[17] = { '\0' };