Core: Add prefix to platform enum names

This commit is contained in:
Vicki Pfau 2020-12-26 18:53:19 -08:00
parent 18403682f7
commit a760c7bb4a
37 changed files with 141 additions and 145 deletions

View File

@ -23,17 +23,13 @@ CXX_GUARD_START
#endif
enum mPlatform {
PLATFORM_NONE = -1,
#ifdef M_CORE_GBA
PLATFORM_GBA = 0,
#endif
#ifdef M_CORE_GB
PLATFORM_GB = 1,
#endif
mPLATFORM_NONE = -1,
mPLATFORM_GBA = 0,
mPLATFORM_GB = 1,
};
enum mCoreChecksumType {
CHECKSUM_CRC32,
mCHECKSUM_CRC32,
};
struct mCoreConfig;

View File

@ -33,12 +33,12 @@ static const struct mCoreFilter {
enum mPlatform platform;
} _filters[] = {
#ifdef M_CORE_GBA
{ GBAIsROM, GBACoreCreate, PLATFORM_GBA },
{ GBAIsROM, GBACoreCreate, mPLATFORM_GBA },
#endif
#ifdef M_CORE_GB
{ GBIsROM, GBCoreCreate, PLATFORM_GB },
{ GBIsROM, GBCoreCreate, mPLATFORM_GB },
#endif
{ 0, 0, PLATFORM_NONE }
{ 0, 0, mPLATFORM_NONE }
};
struct mCore* mCoreFindVF(struct VFile* vf) {
@ -62,7 +62,7 @@ struct mCore* mCoreFindVF(struct VFile* vf) {
enum mPlatform mCoreIsCompatible(struct VFile* vf) {
if (!vf) {
return PLATFORM_NONE;
return mPLATFORM_NONE;
}
const struct mCoreFilter* filter;
for (filter = &_filters[0]; filter->filter; ++filter) {
@ -70,7 +70,7 @@ enum mPlatform mCoreIsCompatible(struct VFile* vf) {
return filter->platform;
}
}
return PLATFORM_NONE;
return mPLATFORM_NONE;
}
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2

View File

@ -85,7 +85,7 @@ static void _bindConstraints(sqlite3_stmt* statement, const struct mLibraryEntry
sqlite3_bind_text(statement, index, constraints->internalCode, -1, SQLITE_TRANSIENT);
}
if (constraints->platform != PLATFORM_NONE) {
if (constraints->platform != mPLATFORM_NONE) {
useIndex = sqlite3_bind_parameter_index(statement, ":usePlatform");
index = sqlite3_bind_parameter_index(statement, ":platform");
sqlite3_bind_int(statement, useIndex, 1);
@ -274,7 +274,7 @@ void _mLibraryAddEntry(struct mLibrary* library, const char* filename, const cha
core->getGameTitle(core, entry.internalTitle);
core->getGameCode(core, entry.internalCode);
core->checksum(core, &entry.crc32, CHECKSUM_CRC32);
core->checksum(core, &entry.crc32, mCHECKSUM_CRC32);
entry.platform = core->platform(core);
entry.title = NULL;
entry.base = base;

View File

@ -413,7 +413,7 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
GUIShowMessageBox(&runner->params, GUI_MESSAGE_BOX_OK, 240, "Load failed!");
return;
}
if (runner->core->platform(runner->core) == PLATFORM_GBA) {
if (runner->core->platform(runner->core) == mPLATFORM_GBA) {
runner->core->setPeripheral(runner->core, mPERIPH_GBA_LUMINANCE, &runner->luminanceSource.d);
}
mLOG(GUI_RUNNER, DEBUG, "Loading config...");

View File

@ -30,12 +30,12 @@ static const struct mVLDescriptor {
struct mCore* (*open)(void);
} _descriptors[] = {
#ifdef M_CORE_GBA
{ PLATFORM_GBA, GBAVideoLogPlayerCreate },
{ mPLATFORM_GBA, GBAVideoLogPlayerCreate },
#endif
#ifdef M_CORE_GB
{ PLATFORM_GB, GBVideoLogPlayerCreate },
{ mPLATFORM_GB, GBVideoLogPlayerCreate },
#endif
{ PLATFORM_NONE, 0 }
{ mPLATFORM_NONE, 0 }
};
enum mVLBlockType {
@ -1060,12 +1060,12 @@ static const struct mVLDescriptor* _mVideoLogDescriptor(struct VFile* vf) {
LOAD_32LE(platform, 0, &header.platform);
const struct mVLDescriptor* descriptor;
for (descriptor = &_descriptors[0]; descriptor->platform != PLATFORM_NONE; ++descriptor) {
for (descriptor = &_descriptors[0]; descriptor->platform != mPLATFORM_NONE; ++descriptor) {
if (platform == descriptor->platform) {
break;
}
}
if (descriptor->platform == PLATFORM_NONE) {
if (descriptor->platform == mPLATFORM_NONE) {
return NULL;
}
return descriptor;
@ -1076,7 +1076,7 @@ enum mPlatform mVideoLogIsCompatible(struct VFile* vf) {
if (descriptor) {
return descriptor->platform;
}
return PLATFORM_NONE;
return mPLATFORM_NONE;
}
struct mCore* mVideoLogCoreFind(struct VFile* vf) {

View File

@ -149,7 +149,7 @@ static void _GBCoreDeinit(struct mCore* core) {
static enum mPlatform _GBCorePlatform(const struct mCore* core) {
UNUSED(core);
return PLATFORM_GB;
return mPLATFORM_GB;
}
static bool _GBCoreSupportsFeature(const struct mCore* core, enum mCoreFeature feature) {
@ -420,7 +420,7 @@ static void _GBCoreUnloadROM(struct mCore* core) {
static void _GBCoreChecksum(const struct mCore* core, void* data, enum mCoreChecksumType type) {
struct GB* gb = (struct GB*) core->board;
switch (type) {
case CHECKSUM_CRC32:
case mCHECKSUM_CRC32:
memcpy(data, &gb->romCrc32, sizeof(gb->romCrc32));
break;
}

View File

@ -20,7 +20,7 @@ M_TEST_DEFINE(create) {
M_TEST_DEFINE(platform) {
struct mCore* core = GBCoreCreate();
assert_non_null(core);
assert_int_equal(core->platform(core), PLATFORM_GB);
assert_int_equal(core->platform(core), mPLATFORM_GB);
assert_true(core->init(core));
core->deinit(core);
}
@ -52,7 +52,7 @@ M_TEST_DEFINE(isROM) {
assert_true(GBIsROM(vf));
struct mCore* core = mCoreFindVF(vf);
assert_non_null(core);
assert_int_equal(core->platform(core), PLATFORM_GB);
assert_int_equal(core->platform(core), mPLATFORM_GB);
vf->close(vf);
assert_true(core->init(core));

View File

@ -241,7 +241,7 @@ static void _GBACoreDeinit(struct mCore* core) {
static enum mPlatform _GBACorePlatform(const struct mCore* core) {
UNUSED(core);
return PLATFORM_GBA;
return mPLATFORM_GBA;
}
static bool _GBACoreSupportsFeature(const struct mCore* core, enum mCoreFeature feature) {
@ -549,7 +549,7 @@ static void _GBACoreUnloadROM(struct mCore* core) {
static void _GBACoreChecksum(const struct mCore* core, void* data, enum mCoreChecksumType type) {
struct GBA* gba = (struct GBA*) core->board;
switch (type) {
case CHECKSUM_CRC32:
case mCHECKSUM_CRC32:
memcpy(data, &gba->romCrc32, sizeof(gba->romCrc32));
break;
}

View File

@ -18,7 +18,7 @@ M_TEST_DEFINE(create) {
M_TEST_DEFINE(platform) {
struct mCore* core = GBACoreCreate();
assert_non_null(core);
assert_true(core->platform(core) == PLATFORM_GBA);
assert_true(core->platform(core) == mPLATFORM_GBA);
assert_true(core->init(core));
core->deinit(core);
}

View File

@ -328,7 +328,7 @@ static void _gameLoaded(struct mGUIRunner* runner) {
switch (runner->core->platform(runner->core)) {
#ifdef M_CORE_GBA
// TODO: Move these to callbacks
case PLATFORM_GBA:
case mPLATFORM_GBA:
if (((struct GBA*) runner->core->board)->memory.hw.devices & HW_TILT) {
HIDUSER_EnableAccelerometer();
}
@ -338,7 +338,7 @@ static void _gameLoaded(struct mGUIRunner* runner) {
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
if (((struct GB*) runner->core->board)->memory.mbcType == GB_MBC7) {
HIDUSER_EnableAccelerometer();
}
@ -412,7 +412,7 @@ static void _gameUnloaded(struct mGUIRunner* runner) {
switch (runner->core->platform(runner->core)) {
#ifdef M_CORE_GBA
// TODO: Move these to callbacks
case PLATFORM_GBA:
case mPLATFORM_GBA:
if (((struct GBA*) runner->core->board)->memory.hw.devices & HW_TILT) {
HIDUSER_DisableAccelerometer();
}
@ -422,7 +422,7 @@ static void _gameUnloaded(struct mGUIRunner* runner) {
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
if (((struct GB*) runner->core->board)->memory.mbcType == GB_MBC7) {
HIDUSER_DisableAccelerometer();
}

View File

@ -257,7 +257,7 @@ void retro_get_system_av_info(struct retro_system_av_info* info) {
info->geometry.base_width = width;
info->geometry.base_height = height;
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
if (core->platform(core) == mPLATFORM_GB) {
info->geometry.max_width = 256;
info->geometry.max_height = 224;
} else
@ -453,7 +453,7 @@ void retro_run(void) {
static void _setupMaps(struct mCore* core) {
#ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) {
if (core->platform(core) == mPLATFORM_GBA) {
struct GBA* gba = core->board;
struct retro_memory_descriptor descs[11];
struct retro_memory_map mmaps;
@ -534,7 +534,7 @@ static void _setupMaps(struct mCore* core) {
}
#endif
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
if (core->platform(core) == mPLATFORM_GB) {
struct GB* gb = core->board;
struct retro_memory_descriptor descs[11];
struct retro_memory_map mmaps;
@ -689,7 +689,7 @@ bool retro_load_game(const struct retro_game_info* game) {
environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir);
#ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) {
if (core->platform(core) == mPLATFORM_GBA) {
core->setPeripheral(core, mPERIPH_GBA_LUMINANCE, &lux);
biosName = "gba_bios.bin";
@ -697,7 +697,7 @@ bool retro_load_game(const struct retro_game_info* game) {
#endif
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
if (core->platform(core) == mPLATFORM_GB) {
memset(&cam, 0, sizeof(cam));
cam.height = GBCAM_HEIGHT;
cam.width = GBCAM_WIDTH;
@ -814,7 +814,7 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) {
}
// Convert the super wonky unportable libretro format to something normal
#ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) {
if (core->platform(core) == mPLATFORM_GBA) {
char realCode[] = "XXXXXXXX XXXXXXXX";
size_t len = strlen(code) + 1; // Include null terminator
size_t i, pos;
@ -835,7 +835,7 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) {
}
#endif
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
if (core->platform(core) == mPLATFORM_GB) {
char realCode[] = "XXX-XXX-XXX";
size_t len = strlen(code) + 1; // Include null terminator
size_t i, pos;
@ -881,7 +881,7 @@ void* retro_get_memory_data(unsigned id) {
case RETRO_MEMORY_RTC:
switch (core->platform(core)) {
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
switch (((struct GB*) core->board)->memory.mbcType) {
case GB_MBC3_RTC:
return &((uint8_t*) savedata)[((struct GB*) core->board)->sramSize];
@ -903,7 +903,7 @@ size_t retro_get_memory_size(unsigned id) {
case RETRO_MEMORY_SAVE_RAM:
switch (core->platform(core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
switch (((struct GBA*) core->board)->memory.savedata.type) {
case SAVEDATA_AUTODETECT:
return SIZE_CART_FLASH1M;
@ -912,7 +912,7 @@ size_t retro_get_memory_size(unsigned id) {
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
return ((struct GB*) core->board)->sramSize;
#endif
default:
@ -922,7 +922,7 @@ size_t retro_get_memory_size(unsigned id) {
case RETRO_MEMORY_RTC:
switch (core->platform(core)) {
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
switch (((struct GB*) core->board)->memory.mbcType) {
case GB_MBC3_RTC:
return sizeof(struct GBMBCRTCSaveBuffer);

View File

@ -383,14 +383,14 @@ void mPSP2LoadROM(struct mGUIRunner* runner) {
switch (runner->core->platform(runner->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
if (((struct GBA*) runner->core->board)->memory.hw.devices & (HW_TILT | HW_GYRO)) {
sceMotionStartSampling();
}
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
if (((struct GB*) runner->core->board)->memory.mbcType == GB_MBC7) {
sceMotionStartSampling();
}
@ -430,14 +430,14 @@ void mPSP2LoadROM(struct mGUIRunner* runner) {
void mPSP2UnloadROM(struct mGUIRunner* runner) {
switch (runner->core->platform(runner->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
if (((struct GBA*) runner->core->board)->memory.hw.devices & (HW_TILT | HW_GYRO)) {
sceMotionStopSampling();
}
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
if (((struct GB*) runner->core->board)->memory.mbcType == GB_MBC7) {
sceMotionStopSampling();
}
@ -588,12 +588,12 @@ void mPSP2Swap(struct mGUIRunner* runner) {
bool frameAvailable = true;
switch (runner->core->platform(runner->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
frameAvailable = ((struct GBA*) runner->core->board)->video.frameskipCounter <= 0;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
frameAvailable = ((struct GB*) runner->core->board)->video.frameskipCounter <= 0;
break;
#endif

View File

@ -117,11 +117,11 @@ class CoreCallbacks(object):
class Core(object):
if hasattr(lib, 'PLATFORM_GBA'):
PLATFORM_GBA = lib.PLATFORM_GBA
if hasattr(lib, 'mPLATFORM_GBA'):
PLATFORM_GBA = lib.mPLATFORM_GBA
if hasattr(lib, 'PLATFORM_GB'):
PLATFORM_GB = lib.PLATFORM_GB
if hasattr(lib, 'mPLATFORM_GB'):
PLATFORM_GB = lib.mPLATFORM_GB
def __init__(self, native):
self._core = native

View File

@ -49,14 +49,14 @@ void AssetTile::setController(std::shared_ptr<CoreController> controller) {
m_cacheSet = controller->graphicCaches();
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
m_addressWidth = 8;
m_addressBase = BASE_VRAM;
m_boundaryBase = BASE_VRAM | 0x10000;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
m_addressWidth = 4;
m_addressBase = GB_BASE_VRAM;
m_boundaryBase = GB_BASE_VRAM;

View File

@ -43,12 +43,12 @@ void AssetView::updateTiles() {
void AssetView::updateTiles(bool force) {
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
updateTilesGBA(force);
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
updateTilesGB(force);
break;
#endif
@ -156,11 +156,11 @@ QImage AssetView::compositeObj(const ObjInfo& objInfo) {
bool AssetView::lookupObj(int id, struct ObjInfo* info) {
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
return lookupObjGBA(id, info);
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
return lookupObjGB(id, info);
#endif
default:

View File

@ -41,7 +41,7 @@ CheatsView::CheatsView(std::shared_ptr<CoreController> controller, QWidget* pare
QPushButton* add;
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
connect(m_ui.add, &QPushButton::clicked, [this]() {
enterCheat(GBA_CHEAT_AUTODETECT);
});
@ -66,7 +66,7 @@ CheatsView::CheatsView(std::shared_ptr<CoreController> controller, QWidget* pare
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
connect(m_ui.add, &QPushButton::clicked, [this]() {
enterCheat(GB_CHEAT_AUTODETECT);
});

View File

@ -51,7 +51,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
switch (context->core->platform(context->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
context->core->setPeripheral(context->core, mPERIPH_GBA_LUMINANCE, controller->m_inputController->luminance());
break;
#endif
@ -332,7 +332,7 @@ mCacheSet* CoreController::graphicCaches() {
Interrupter interrupter(this);
switch (platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
case mPLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(m_threadContext.core->board);
m_cacheSet = std::make_unique<mCacheSet>();
GBAVideoCacheInit(m_cacheSet.get());
@ -341,7 +341,7 @@ mCacheSet* CoreController::graphicCaches() {
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
case mPLATFORM_GB: {
GB* gb = static_cast<GB*>(m_threadContext.core->board);
m_cacheSet = std::make_unique<mCacheSet>();
GBVideoCacheInit(m_cacheSet.get());
@ -704,16 +704,16 @@ void CoreController::yankPak() {
switch (platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
GBAYankROM(static_cast<GBA*>(m_threadContext.core->board));
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
GBYankROM(static_cast<GB*>(m_threadContext.core->board));
break;
#endif
case PLATFORM_NONE:
case mPLATFORM_NONE:
LOG(QT, ERROR) << tr("Can't yank pack in unexpected platform!");
break;
}
@ -786,7 +786,7 @@ void CoreController::scanCard(const QString& path) {
void CoreController::importSharkport(const QString& path) {
#ifdef M_CORE_GBA
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
VFile* vf = VFileDevice::open(path, O_RDONLY);
@ -802,7 +802,7 @@ void CoreController::importSharkport(const QString& path) {
void CoreController::exportSharkport(const QString& path) {
#ifdef M_CORE_GBA
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
VFile* vf = VFileDevice::open(path, O_WRONLY | O_CREAT | O_TRUNC);
@ -818,7 +818,7 @@ void CoreController::exportSharkport(const QString& path) {
#ifdef M_CORE_GB
void CoreController::attachPrinter() {
if (platform() != PLATFORM_GB) {
if (platform() != mPLATFORM_GB) {
return;
}
GB* gb = static_cast<GB*>(m_threadContext.core->board);
@ -850,7 +850,7 @@ void CoreController::attachPrinter() {
}
void CoreController::detachPrinter() {
if (platform() != PLATFORM_GB) {
if (platform() != mPLATFORM_GB) {
return;
}
Interrupter interrupter(this);
@ -860,7 +860,7 @@ void CoreController::detachPrinter() {
}
void CoreController::endPrint() {
if (platform() != PLATFORM_GB) {
if (platform() != mPLATFORM_GB) {
return;
}
Interrupter interrupter(this);
@ -870,7 +870,7 @@ void CoreController::endPrint() {
#ifdef M_CORE_GBA
void CoreController::attachBattleChipGate() {
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
Interrupter interrupter(this);
@ -880,7 +880,7 @@ void CoreController::attachBattleChipGate() {
}
void CoreController::detachBattleChipGate() {
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
Interrupter interrupter(this);
@ -888,7 +888,7 @@ void CoreController::detachBattleChipGate() {
}
void CoreController::setBattleChipId(uint16_t id) {
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
Interrupter interrupter(this);
@ -896,7 +896,7 @@ void CoreController::setBattleChipId(uint16_t id) {
}
void CoreController::setBattleChipFlavor(int flavor) {
if (platform() != PLATFORM_GBA) {
if (platform() != mPLATFORM_GBA) {
return;
}
Interrupter interrupter(this);

View File

@ -114,7 +114,7 @@ CoreController* CoreManager::loadGame(const QString& path) {
VDir* archive = VDirOpenArchive(path.toUtf8().constData());
if (archive) {
VFile* vfOriginal = VDirFindFirst(archive, [](VFile* vf) {
return mCoreIsCompatible(vf) != PLATFORM_NONE;
return mCoreIsCompatible(vf) != mPLATFORM_NONE;
});
ssize_t size;
if (vfOriginal && (size = vfOriginal->size(vfOriginal)) > 0) {
@ -188,7 +188,7 @@ CoreController* CoreManager::loadBIOS(int platform, const QString& path) {
mCore* core = nullptr;
switch (platform) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
core = GBACoreCreate();
break;
#endif

View File

@ -71,7 +71,7 @@ void gameStarted(std::shared_ptr<CoreController> controller) {
const NoIntroDB* db = GBAApp::app()->gameDB();
NoIntroGame game{};
uint32_t crc32 = 0;
core->checksum(core, &crc32, CHECKSUM_CRC32);
core->checksum(core, &crc32, mCHECKSUM_CRC32);
if (db && crc32 && NoIntroDBLookupGameByCRC(db, crc32, &game)) {
s_title = QLatin1String(game.name);
@ -91,4 +91,4 @@ void gameStopped() {
}
}
}

View File

@ -432,16 +432,16 @@ void FrameView::invalidateQueue(const QSize& dims) {
mVideoLoggerInjectionPoint(logger, LOGGER_INJECTION_FIRST_SCANLINE);
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
injectGBA();
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
injectGB();
break;
#endif
case PLATFORM_NONE:
case mPLATFORM_NONE:
break;
}
if (m_ui.disableScanline->checkState() == Qt::Checked) {
@ -544,7 +544,7 @@ void FrameView::newVl() {
m_currentFrame = nullptr;
mCoreInitConfig(m_vl, nullptr);
#ifdef M_CORE_GB
if (m_controller->platform() == PLATFORM_GB) {
if (m_controller->platform() == mPLATFORM_GB) {
mCoreConfigSetIntValue(&m_vl->config, "sgb.borders", static_cast<GB*>(m_controller->thread()->core->board)->video.sgbBorders);
m_vl->reloadConfigOption(m_vl, "sgb.borders", nullptr);
}

View File

@ -10,14 +10,14 @@
using namespace QGBA;
void GBAOverride::apply(struct mCore* core) {
if (core->platform(core) != PLATFORM_GBA) {
if (core->platform(core) != mPLATFORM_GBA) {
return;
}
GBAOverrideApply(static_cast<GBA*>(core->board), &override);
}
void GBAOverride::identify(const struct mCore* core) {
if (core->platform(core) != PLATFORM_GBA) {
if (core->platform(core) != mPLATFORM_GBA) {
return;
}
char gameId[8];

View File

@ -12,14 +12,14 @@
using namespace QGBA;
void GBOverride::apply(struct mCore* core) {
if (core->platform(core) != PLATFORM_GB) {
if (core->platform(core) != mPLATFORM_GB) {
return;
}
GBOverrideApply(static_cast<GB*>(core->board), &override);
}
void GBOverride::identify(const struct mCore* core) {
if (core->platform(core) != PLATFORM_GB) {
if (core->platform(core) != mPLATFORM_GB) {
return;
}
GB* gb = static_cast<GB*>(core->board);

View File

@ -1025,7 +1025,7 @@ const QList<IOViewer::RegisterDescription>& IOViewer::registerDescriptions(mPlat
regGBA.append({
{ tr("Enable IRQs"), 0 },
});
s_registers[PLATFORM_GBA] = regGBA;
s_registers[mPLATFORM_GBA] = regGBA;
#endif
#ifdef M_CORE_GB
QList<IOViewer::RegisterDescription> regGB;
@ -1555,7 +1555,7 @@ const QList<IOViewer::RegisterDescription>& IOViewer::registerDescriptions(mPlat
{ tr("Serial"), 3 },
{ tr("Joypad"), 4 },
});
s_registers[PLATFORM_GB] = regGB;
s_registers[mPLATFORM_GB] = regGB;
#endif
return s_registers[platform];
}
@ -1569,7 +1569,7 @@ IOViewer::IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent)
unsigned maxRegs;
switch (controller->platform()) {
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
regs = GBIORegisterNames;
maxRegs = GB_REG_MAX;
m_base = GB_BASE_IO;
@ -1577,7 +1577,7 @@ IOViewer::IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent)
break;
#endif
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
regs = GBAIORegisterNames;
maxRegs = REG_MAX >> 1;
m_base = BASE_IO;

View File

@ -40,7 +40,7 @@ MapView::MapView(std::shared_ptr<CoreController> controller, QWidget* parent)
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
m_boundary = 2048;
m_addressBase = BASE_VRAM;
m_addressWidth = 8;
@ -53,7 +53,7 @@ MapView::MapView(std::shared_ptr<CoreController> controller, QWidget* parent)
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
m_boundary = 1024;
m_addressBase = GB_BASE_VRAM;
m_addressWidth = 4;
@ -167,7 +167,7 @@ void MapView::updateTilesGBA(bool) {
QString offset(tr("N/A"));
QString transform(tr("N/A"));
#ifdef M_CORE_GBA
if (m_controller->platform() == PLATFORM_GBA) {
if (m_controller->platform() == mPLATFORM_GBA) {
uint16_t* io = static_cast<GBA*>(m_controller->thread()->core->board)->memory.io;
int mode = GBARegisterDISPCNTGetMode(io[REG_DISPCNT >> 1]);
if (m_map == 2 && mode > 2) {
@ -201,7 +201,7 @@ void MapView::updateTilesGBA(bool) {
}
#endif
#ifdef M_CORE_GB
if (m_controller->platform() == PLATFORM_GB) {
if (m_controller->platform() == mPLATFORM_GB) {
uint8_t* io = static_cast<GB*>(m_controller->thread()->core->board)->memory.io;
int x = io[m_map == 0 ? 0x42 : 0x4A];
int y = io[m_map == 0 ? 0x43 : 0x4B];

View File

@ -76,7 +76,7 @@ MultiplayerController::MultiplayerController() {
for (int i = 1; i < controller->m_players.count(); ++i) {
Player* player = &controller->m_players[i];
#ifdef M_CORE_GBA
if (player->controller->platform() == PLATFORM_GBA && player->gbaNode->d.p->mode != controller->m_players[0].gbaNode->d.p->mode) {
if (player->controller->platform() == mPLATFORM_GBA && player->gbaNode->d.p->mode != controller->m_players[0].gbaNode->d.p->mode) {
player->controller->setSync(true);
continue;
}
@ -86,12 +86,12 @@ MultiplayerController::MultiplayerController() {
if (player->awake < 1) {
switch (player->controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
player->gbaNode->nextEvent += player->cyclesPosted;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
player->gbNode->nextEvent += player->cyclesPosted;
break;
#endif
@ -144,12 +144,12 @@ MultiplayerController::MultiplayerController() {
player->controller->setSync(true);
switch (player->controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
player->cyclesPosted += reinterpret_cast<GBASIOLockstep*>(lockstep)->players[0]->eventDiff;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
player->cyclesPosted += reinterpret_cast<GBSIOLockstep*>(lockstep)->players[0]->eventDiff;
break;
#endif
@ -159,12 +159,12 @@ MultiplayerController::MultiplayerController() {
if (player->awake < 1) {
switch (player->controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
player->gbaNode->nextEvent += player->cyclesPosted;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
player->gbNode->nextEvent += player->cyclesPosted;
break;
#endif
@ -191,12 +191,12 @@ bool MultiplayerController::attachGame(CoreController* controller) {
if (m_lockstep.attached == 0) {
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
GBASIOLockstepInit(&m_gbaLockstep);
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
GBSIOLockstepInit(&m_gbLockstep);
break;
#endif
@ -212,7 +212,7 @@ bool MultiplayerController::attachGame(CoreController* controller) {
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
case mPLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(thread->core->board);
GBASIOLockstepNode* node = new GBASIOLockstepNode;
@ -228,7 +228,7 @@ bool MultiplayerController::attachGame(CoreController* controller) {
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
case mPLATFORM_GB: {
GB* gb = static_cast<GB*>(thread->core->board);
GBSIOLockstepNode* node = new GBSIOLockstepNode;
@ -264,7 +264,7 @@ void MultiplayerController::detachGame(CoreController* controller) {
}
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
case mPLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(thread->core->board);
GBASIOLockstepNode* node = reinterpret_cast<GBASIOLockstepNode*>(gba->sio.drivers.multiplayer);
GBASIOSetDriver(&gba->sio, nullptr, SIO_MULTI);
@ -277,7 +277,7 @@ void MultiplayerController::detachGame(CoreController* controller) {
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
case mPLATFORM_GB: {
GB* gb = static_cast<GB*>(thread->core->board);
GBSIOLockstepNode* node = reinterpret_cast<GBSIOLockstepNode*>(gb->sio.driver);
GBSIOSetDriver(&gb->sio, nullptr);

View File

@ -213,7 +213,7 @@ void OverrideView::gameStarted() {
switch (thread->core->platform(thread->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
case mPLATFORM_GBA: {
m_ui.tabWidget->setCurrentWidget(m_ui.tabGBA);
GBA* gba = static_cast<GBA*>(thread->core->board);
m_ui.savetype->setCurrentIndex(gba->memory.savedata.type + 1);
@ -234,7 +234,7 @@ void OverrideView::gameStarted() {
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
case mPLATFORM_GB: {
m_ui.tabWidget->setCurrentWidget(m_ui.tabGB);
GB* gb = static_cast<GB*>(thread->core->board);
int index = m_ui.mbc->findData(gb->memory.mbcType);
@ -252,7 +252,7 @@ void OverrideView::gameStarted() {
break;
}
#endif
case PLATFORM_NONE:
case mPLATFORM_NONE:
break;
}

View File

@ -35,7 +35,7 @@ PaletteView::PaletteView(std::shared_ptr<CoreController> controller, QWidget* pa
m_ui.objGrid->setDimensions(QSize(16, 16));
int count = 256;
#ifdef M_CORE_GB
if (controller->platform() == PLATFORM_GB) {
if (controller->platform() == mPLATFORM_GB) {
m_ui.bgGrid->setDimensions(QSize(4, 8));
m_ui.objGrid->setDimensions(QSize(4, 8));
m_ui.bgGrid->setSize(24);
@ -72,13 +72,13 @@ void PaletteView::updatePalette() {
size_t count;
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
palette = static_cast<GBA*>(m_controller->thread()->core->board)->video.palette;
count = 256;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
palette = static_cast<GB*>(m_controller->thread()->core->board)->video.palette;
count = 32;
break;
@ -98,12 +98,12 @@ void PaletteView::selectIndex(int index) {
const uint16_t* palette;
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
palette = static_cast<GBA*>(m_controller->thread()->core->board)->video.palette;
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
palette = static_cast<GB*>(m_controller->thread()->core->board)->video.palette;
break;
#endif

View File

@ -44,18 +44,18 @@ ROMInfo::ROMInfo(std::shared_ptr<CoreController> controller, QWidget* parent)
m_ui.id->setText(tr("(unknown)"));
}
core->checksum(core, &crc32, CHECKSUM_CRC32);
core->checksum(core, &crc32, mCHECKSUM_CRC32);
switch (controller->thread()->core->platform(controller->thread()->core)) {
#ifdef M_CORE_GBA
case PLATFORM_GBA: {
case mPLATFORM_GBA: {
GBA* gba = static_cast<GBA*>(core->board);
m_ui.size->setText(QString::number(gba->pristineRomSize) + tr(" bytes"));
break;
}
#endif
#ifdef M_CORE_GB
case PLATFORM_GB: {
case mPLATFORM_GB: {
GB* gb = static_cast<GB*>(core->board);
m_ui.size->setText(QString::number(gb->pristineRomSize) + tr(" bytes"));
break;

View File

@ -29,7 +29,7 @@ RegisterView::RegisterView(std::shared_ptr<CoreController> controller, QWidget*
switch (controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
addRegisters({
"r0",
"r1",
@ -52,7 +52,7 @@ RegisterView::RegisterView(std::shared_ptr<CoreController> controller, QWidget*
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
addRegisters({
"a",
"f",
@ -88,12 +88,12 @@ void RegisterView::addRegisters(const QStringList& names) {
void RegisterView::updateRegisters() {
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
updateRegistersARM();
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
updateRegistersSM83();
break;
#endif

View File

@ -350,7 +350,7 @@ void ReportView::addROMInfo(QStringList& report, CoreController* controller) {
}
uint32_t crc32 = 0;
core->checksum(core, &crc32, CHECKSUM_CRC32);
core->checksum(core, &crc32, mCHECKSUM_CRC32);
report << QString("CRC32: %1").arg(crc32, 8, 16, QChar('0'));
#ifdef USE_SQLITE3

View File

@ -554,7 +554,7 @@ void SettingsView::updateConfig() {
m_controller->write();
emit pathsChanged();
emit biosLoaded(PLATFORM_GBA, m_ui.gbaBios->text());
emit biosLoaded(mPLATFORM_GBA, m_ui.gbaBios->text());
}
void SettingsView::reloadConfig() {

View File

@ -33,12 +33,12 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
m_ui.tile->setBoundary(2048, 0, 2);
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
m_ui.palette256->setEnabled(false);
m_ui.tile->setBoundary(1024, 0, 0);
break;
@ -53,12 +53,12 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
}
switch (m_controller->platform()) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
m_ui.tile->setBoundary(2048 >> selected, selected, selected + 2);
break;
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
return;
#endif
default:

View File

@ -1027,7 +1027,7 @@ void Window::updateTitle(float fps) {
NoIntroGame game{};
uint32_t crc32 = 0;
mCore* core = m_controller->thread()->core;
core->checksum(m_controller->thread()->core, &crc32, CHECKSUM_CRC32);
core->checksum(m_controller->thread()->core, &crc32, mCHECKSUM_CRC32);
QString filePath = windowFilePath();
if (m_config->getOption("showFilename").toInt() && !filePath.isNull()) {
@ -1124,14 +1124,14 @@ void Window::setupMenu(QMenuBar* menubar) {
#ifdef M_CORE_GBA
m_actions.addAction(tr("Boot BIOS"), "bootBIOS", [this]() {
setController(m_manager->loadBIOS(PLATFORM_GBA, m_config->getOption("gba.bios")), QString());
setController(m_manager->loadBIOS(mPLATFORM_GBA, m_config->getOption("gba.bios")), QString());
}, "file");
#endif
addGameAction(tr("Replace ROM..."), "replaceROM", this, &Window::replaceROM, "file");
#ifdef M_CORE_GBA
Action* scanCard = addGameAction(tr("Scan e-Reader dotcodes..."), "scanCard", this, &Window::scanCard, "file");
m_platformActions.insert(PLATFORM_GBA, scanCard);
m_platformActions.insert(mPLATFORM_GBA, scanCard);
#endif
addGameAction(tr("ROM &info..."), "romInfo", openControllerTView<ROMInfo>(), "file");
@ -1205,10 +1205,10 @@ void Window::setupMenu(QMenuBar* menubar) {
#ifdef M_CORE_GBA
m_actions.addSeparator("file");
Action* importShark = addGameAction(tr("Import GameShark Save..."), "importShark", this, &Window::importSharkport, "file");
m_platformActions.insert(PLATFORM_GBA, importShark);
m_platformActions.insert(mPLATFORM_GBA, importShark);
Action* exportShark = addGameAction(tr("Export GameShark Save..."), "exportShark", this, &Window::exportSharkport, "file");
m_platformActions.insert(PLATFORM_GBA, exportShark);
m_platformActions.insert(mPLATFORM_GBA, exportShark);
#endif
m_actions.addSeparator("file");
@ -1326,12 +1326,12 @@ void Window::setupMenu(QMenuBar* menubar) {
openView(view);
m_controller->attachPrinter();
}, "emu");
m_platformActions.insert(PLATFORM_GB, gbPrint);
m_platformActions.insert(mPLATFORM_GB, gbPrint);
#endif
#ifdef M_CORE_GBA
Action* bcGate = addGameAction(tr("BattleChip Gate..."), "bcGate", openControllerTView<BattleChipView>(this), "emu");
m_platformActions.insert(PLATFORM_GBA, bcGate);
m_platformActions.insert(mPLATFORM_GBA, bcGate);
#endif
m_actions.addMenu(tr("Audio/&Video"), "av");
@ -1503,7 +1503,7 @@ void Window::setupMenu(QMenuBar* menubar) {
m_actions.addAction(tr("Open debugger console..."), "debuggerWindow", this, &Window::consoleOpen, "tools");
#ifdef USE_GDB_STUB
Action* gdbWindow = addGameAction(tr("Start &GDB server..."), "gdbWindow", this, &Window::gdbOpen, "tools");
m_platformActions.insert(PLATFORM_GBA, gdbWindow);
m_platformActions.insert(mPLATFORM_GBA, gdbWindow);
#endif
#endif
m_actions.addSeparator("tools");

View File

@ -25,11 +25,11 @@ QString niceSizeFormat(size_t filesize) {
QString nicePlatformFormat(mPlatform platform) {
switch (platform) {
#ifdef M_CORE_GBA
case PLATFORM_GBA:
case mPLATFORM_GBA:
return QObject::tr("GBA");
#endif
#ifdef M_CORE_GB
case PLATFORM_GB:
case mPLATFORM_GB:
return QObject::tr("GB");
#endif
default:

View File

@ -273,7 +273,7 @@ static void _setup(struct mGUIRunner* runner) {
runner->core->setPeripheral(runner->core, mPERIPH_ROTATION, &rotation);
runner->core->setAVStream(runner->core, &stream);
if (runner->core->platform(runner->core) == PLATFORM_GBA && useLightSensor) {
if (runner->core->platform(runner->core) == mPLATFORM_GBA && useLightSensor) {
runner->core->setPeripheral(runner->core, mPERIPH_GBA_LUMINANCE, &lightSensor.d);
}
@ -310,7 +310,7 @@ static void _gameLoaded(struct mGUIRunner* runner) {
if (useLightSensor != fakeBool) {
useLightSensor = fakeBool;
if (runner->core->platform(runner->core) == PLATFORM_GBA) {
if (runner->core->platform(runner->core) == mPLATFORM_GBA) {
if (useLightSensor) {
runner->core->setPeripheral(runner->core, mPERIPH_GBA_LUMINANCE, &lightSensor.d);
} else {

View File

@ -333,7 +333,7 @@ static bool collectTests(struct CInemaTestList* tests, const char* path) {
CIerr(3, "Found potential test %s\n", subpath);
struct VFile* vf = dir->openFile(dir, entry->name(entry), O_RDONLY);
if (vf) {
if (mCoreIsCompatible(vf) != PLATFORM_NONE || mVideoLogIsCompatible(vf) != PLATFORM_NONE) {
if (mCoreIsCompatible(vf) != mPLATFORM_NONE || mVideoLogIsCompatible(vf) != mPLATFORM_NONE) {
struct CInemaTest* test = CInemaTestListAppend(tests);
if (!CInemaTestInit(test, path, entry->name(entry))) {
CIerr(3, "Failed to create test\n");

View File

@ -84,7 +84,7 @@ int main(int argc, char** argv) {
}
#ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) {
if (core->platform(core) == mPLATFORM_GBA) {
((struct GBA*) core->board)->hardCrash = false;
}
#endif