all repos — mgba @ ddc913c13adc507bd78098ffd669332f29d13a64

mGBA Game Boy Advance Emulator

src/platform/qt/GameBoy.cpp (view raw)

 1/* Copyright (c) 2013-2020 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "GameBoy.h"
 7
 8#include <QCoreApplication>
 9#include <QMap>
10
11using namespace QGBA;
12
13static const QList<GBModel> s_gbModelList{
14	GB_MODEL_DMG,
15	GB_MODEL_SGB,
16	GB_MODEL_CGB,
17	GB_MODEL_AGB,
18};
19
20static const QList<GBMemoryBankControllerType> s_mbcList{
21	GB_MBC_NONE,
22	GB_MBC1,
23	GB_MBC2,
24	GB_MBC3,
25	GB_MBC3_RTC,
26	GB_MBC5,
27	GB_MBC5_RUMBLE,
28	GB_MBC6,
29	GB_MBC7,
30	GB_MMM01,
31	GB_POCKETCAM,
32	GB_TAMA5,
33	GB_HuC1,
34	GB_HuC3,
35	GB_UNL_WISDOM_TREE,
36	GB_UNL_BBD,
37	GB_UNL_HITEK,
38	GB_UNL_PKJD,
39};
40
41static QMap<GBModel, QString> s_gbModelNames;
42static QMap<GBMemoryBankControllerType, QString> s_mbcNames;
43
44static QString tr(const char* str) {
45	return QCoreApplication::translate("Game Boy", str);
46}
47
48QList<GBModel> GameBoy::modelList() {
49	return s_gbModelList;
50}
51
52QString GameBoy::modelName(GBModel model) {
53	if (s_gbModelNames.isEmpty()) {
54		s_gbModelNames[GB_MODEL_AUTODETECT] = tr("Autodetect");
55		s_gbModelNames[GB_MODEL_DMG] = tr("Game Boy (DMG)");
56		s_gbModelNames[GB_MODEL_MGB] = tr("Game Boy Pocket (MGB)");
57		s_gbModelNames[GB_MODEL_SGB] = tr("Super Game Boy (SGB)");
58		s_gbModelNames[GB_MODEL_SGB2] = tr("Super Game Boy 2 (SGB)");
59		s_gbModelNames[GB_MODEL_CGB] = tr("Game Boy Color (CGB)");
60		s_gbModelNames[GB_MODEL_AGB] = tr("Game Boy Advance (AGB)");
61	}
62
63	return s_gbModelNames[model];
64}
65
66QList<GBMemoryBankControllerType> GameBoy::mbcList() {
67	return s_mbcList;
68}
69
70QString GameBoy::mbcName(GBMemoryBankControllerType mbc) {
71	if (s_mbcNames.isEmpty()) {
72		s_mbcNames[GB_MBC_AUTODETECT] = tr("Autodetect");
73		s_mbcNames[GB_MBC_NONE] = tr("ROM Only");
74		s_mbcNames[GB_MBC1] = tr("MBC1");
75		s_mbcNames[GB_MBC2] = tr("MBC2");
76		s_mbcNames[GB_MBC3] = tr("MBC3");
77		s_mbcNames[GB_MBC3_RTC] = tr("MBC3 + RTC");
78		s_mbcNames[GB_MBC5] = tr("MBC5");
79		s_mbcNames[GB_MBC5_RUMBLE] = tr("MBC5 + Rumble");
80		s_mbcNames[GB_MBC6] = tr("MBC6");
81		s_mbcNames[GB_MBC7] = tr("MBC7 (Tilt)");
82		s_mbcNames[GB_MMM01] = tr("MMM01");
83		s_mbcNames[GB_HuC1] = tr("HuC-1");
84		s_mbcNames[GB_HuC3] = tr("HuC-3");
85		s_mbcNames[GB_POCKETCAM] = tr("Pocket Cam");
86		s_mbcNames[GB_TAMA5] = tr("TAMA5");
87		s_mbcNames[GB_UNL_WISDOM_TREE] = tr("Wisdom Tree");
88		s_mbcNames[GB_UNL_PKJD] = tr("Pokémon Jade/Diamond");
89		s_mbcNames[GB_UNL_BBD] = tr("BBD");
90		s_mbcNames[GB_UNL_HITEK] = tr("Hitek");
91	}
92
93	return s_mbcNames[mbc];
94}