mirror of https://github.com/mgba-emu/mgba.git
Merge branch 'master' (early part) into medusa
This commit is contained in:
commit
e8861a6c7a
3
CHANGES
3
CHANGES
|
@ -39,7 +39,7 @@ Features:
|
|||
- WebP and APNG recording
|
||||
- Separate overrides for GBC games that can also run on SGB or regular GB
|
||||
- Game Boy Player features can be enabled by default for all compatible games
|
||||
- Frame viewer support for Game Boy
|
||||
- Frame and I/O viewer support for Game Boy
|
||||
- Bug report tool for gathering information helpful for reporting bugs
|
||||
- Mute option in homebrew ports
|
||||
- Status indicators for fast-forward and mute in homebrew ports
|
||||
|
@ -127,6 +127,7 @@ Misc:
|
|||
- Core: Add savedataUpdated callback
|
||||
- Core: Add shutdown callback
|
||||
- Core: Rework thread state synchronization
|
||||
- Core: Improve support for ROM patch cheats, supporting disabling overlapping patches
|
||||
- GB: Allow pausing event loop while CPU is blocked
|
||||
- GB: Add support for sleep and shutdown callbacks
|
||||
- GB I/O: Implement preliminary support for PCM12/PCM34 (closes mgba.io/i/1468)
|
||||
|
|
|
@ -12,6 +12,7 @@ CXX_GUARD_START
|
|||
|
||||
#include <mgba/core/cpu.h>
|
||||
#include <mgba/core/log.h>
|
||||
#include <mgba-util/table.h>
|
||||
#include <mgba-util/vector.h>
|
||||
|
||||
enum mCheatType {
|
||||
|
@ -44,9 +45,20 @@ struct mCheat {
|
|||
int32_t operandOffset;
|
||||
};
|
||||
|
||||
struct mCheatPatch {
|
||||
uint32_t address;
|
||||
int segment;
|
||||
uint32_t value;
|
||||
int width;
|
||||
bool applied;
|
||||
uint32_t checkValue;
|
||||
bool check;
|
||||
};
|
||||
|
||||
mLOG_DECLARE_CATEGORY(CHEATS);
|
||||
|
||||
DECLARE_VECTOR(mCheatList, struct mCheat);
|
||||
DECLARE_VECTOR(mCheatPatchList, struct mCheatPatch);
|
||||
|
||||
struct mCheatDevice;
|
||||
struct mCheatSet {
|
||||
|
@ -66,6 +78,7 @@ struct mCheatSet {
|
|||
|
||||
char* name;
|
||||
bool enabled;
|
||||
struct mCheatPatchList romPatches;
|
||||
struct StringList lines;
|
||||
};
|
||||
|
||||
|
@ -78,6 +91,7 @@ struct mCheatDevice {
|
|||
struct mCheatSet* (*createSet)(struct mCheatDevice*, const char* name);
|
||||
|
||||
struct mCheatSets cheats;
|
||||
struct Table unpatchedMemory;
|
||||
bool autosave;
|
||||
bool buttonDown;
|
||||
};
|
||||
|
|
|
@ -23,20 +23,14 @@ 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
|
||||
#ifdef M_CORE_DS
|
||||
PLATFORM_DS,
|
||||
#endif
|
||||
mPLATFORM_NONE = -1,
|
||||
mPLATFORM_GBA = 0,
|
||||
mPLATFORM_GB = 1,
|
||||
mPLATFORM_DS = 2,
|
||||
};
|
||||
|
||||
enum mCoreChecksumType {
|
||||
CHECKSUM_CRC32,
|
||||
mCHECKSUM_CRC32,
|
||||
};
|
||||
|
||||
struct mCoreConfig;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
CXX_GUARD_START
|
||||
|
||||
#include <mgba/core/cheats.h>
|
||||
#include <mgba-util/vector.h>
|
||||
|
||||
enum GBCheatType {
|
||||
GB_CHEAT_AUTODETECT,
|
||||
|
@ -20,22 +19,6 @@ enum GBCheatType {
|
|||
GB_CHEAT_VBA
|
||||
};
|
||||
|
||||
struct GBCheatPatch {
|
||||
uint16_t address;
|
||||
int8_t newValue;
|
||||
int8_t oldValue;
|
||||
int segment;
|
||||
bool applied;
|
||||
bool checkByte;
|
||||
};
|
||||
|
||||
DECLARE_VECTOR(GBCheatPatchList, struct GBCheatPatch);
|
||||
|
||||
struct GBCheatSet {
|
||||
struct mCheatSet d;
|
||||
struct GBCheatPatchList romPatches;
|
||||
};
|
||||
|
||||
struct mCheatDevice* GBCheatDeviceCreate(void);
|
||||
|
||||
CXX_GUARD_END
|
||||
|
|
|
@ -134,23 +134,14 @@ struct GBACheatHook {
|
|||
size_t reentries;
|
||||
};
|
||||
|
||||
struct GBACheatPatch {
|
||||
uint32_t address;
|
||||
int16_t newValue;
|
||||
int16_t oldValue;
|
||||
bool applied;
|
||||
};
|
||||
|
||||
DECLARE_VECTOR(GBACheatPatchList, struct GBACheatPatch);
|
||||
|
||||
struct GBACheatSet {
|
||||
struct mCheatSet d;
|
||||
struct GBACheatHook* hook;
|
||||
|
||||
struct GBACheatPatchList romPatches;
|
||||
|
||||
size_t incompleteCheat;
|
||||
struct GBACheatPatch* incompletePatch;
|
||||
struct mCheatPatch* incompletePatch;
|
||||
size_t currentBlock;
|
||||
|
||||
int gsaVersion;
|
||||
|
|
|
@ -18,6 +18,33 @@ mLOG_DEFINE_CATEGORY(CHEATS, "Cheats", "core.cheats");
|
|||
|
||||
DEFINE_VECTOR(mCheatList, struct mCheat);
|
||||
DEFINE_VECTOR(mCheatSets, struct mCheatSet*);
|
||||
DEFINE_VECTOR(mCheatPatchList, struct mCheatPatch);
|
||||
|
||||
struct mCheatPatchedMem {
|
||||
uint32_t originalValue;
|
||||
int refs;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
static uint32_t _patchMakeKey(struct mCheatPatch* patch) {
|
||||
// NB: This assumes patches have only one valid size per platform
|
||||
uint32_t patchKey = patch->address;
|
||||
switch (patch->width) {
|
||||
case 2:
|
||||
patchKey >>= 1;
|
||||
break;
|
||||
case 4:
|
||||
patchKey >>= 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// TODO: More than one segment
|
||||
if (patch->segment > 0) {
|
||||
patchKey |= patch->segment << 16;
|
||||
}
|
||||
return patchKey;
|
||||
}
|
||||
|
||||
static int32_t _readMem(struct mCore* core, uint32_t address, int width) {
|
||||
switch (width) {
|
||||
|
@ -31,6 +58,18 @@ static int32_t _readMem(struct mCore* core, uint32_t address, int width) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t _readMemSegment(struct mCore* core, uint32_t address, int segment, int width) {
|
||||
switch (width) {
|
||||
case 1:
|
||||
return core->rawRead8(core, address, segment);
|
||||
case 2:
|
||||
return core->rawRead16(core, address, segment);
|
||||
case 4:
|
||||
return core->rawRead32(core, address, segment);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _writeMem(struct mCore* core, uint32_t address, int width, int32_t value) {
|
||||
switch (width) {
|
||||
case 1:
|
||||
|
@ -45,6 +84,83 @@ static void _writeMem(struct mCore* core, uint32_t address, int width, int32_t v
|
|||
}
|
||||
}
|
||||
|
||||
static void _patchMem(struct mCore* core, uint32_t address, int segment, int width, int32_t value) {
|
||||
switch (width) {
|
||||
case 1:
|
||||
core->rawWrite8(core, address, segment, value);
|
||||
break;
|
||||
case 2:
|
||||
core->rawWrite16(core, address, segment, value);
|
||||
break;
|
||||
case 4:
|
||||
core->rawWrite32(core, address, segment, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _patchROM(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < mCheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct mCheatPatch* patch = mCheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
int segment = -1;
|
||||
if (patch->check && patch->segment < 0) {
|
||||
int maxSegment = 0;
|
||||
for (segment = 0; segment < maxSegment; ++segment) {
|
||||
uint32_t value = _readMemSegment(device->p, patch->address, segment, patch->width);
|
||||
if (value == patch->checkValue) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (segment == maxSegment) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
patch->segment = segment;
|
||||
|
||||
uint32_t patchKey = _patchMakeKey(patch);
|
||||
struct mCheatPatchedMem* patchData = TableLookup(&device->unpatchedMemory, patchKey);
|
||||
if (!patchData) {
|
||||
patchData = malloc(sizeof(*patchData));
|
||||
patchData->originalValue = _readMemSegment(device->p, patch->address, segment, patch->width);
|
||||
patchData->refs = 1;
|
||||
patchData->dirty = false;
|
||||
TableInsert(&device->unpatchedMemory, patchKey, patchData);
|
||||
} else if (!patch->applied) {
|
||||
++patchData->refs;
|
||||
patchData->dirty = true;
|
||||
} else if (!patchData->dirty) {
|
||||
continue;
|
||||
}
|
||||
_patchMem(device->p, patch->address, segment, patch->width, patch->value);
|
||||
patch->applied = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void _unpatchROM(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < mCheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct mCheatPatch* patch = mCheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
if (!patch->applied) {
|
||||
continue;
|
||||
}
|
||||
uint32_t patchKey = _patchMakeKey(patch);
|
||||
struct mCheatPatchedMem* patchData = TableLookup(&device->unpatchedMemory, patchKey);
|
||||
--patchData->refs;
|
||||
patchData->dirty = true;
|
||||
if (patchData->refs <= 0) {
|
||||
_patchMem(device->p, patch->address, patch->segment, patch->width, patchData->originalValue);
|
||||
TableRemove(&device->unpatchedMemory, patchKey);
|
||||
}
|
||||
patch->applied = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void mCheatDeviceInit(void*, struct mCPUComponent*);
|
||||
static void mCheatDeviceDeinit(struct mCPUComponent*);
|
||||
|
||||
|
@ -55,11 +171,13 @@ void mCheatDeviceCreate(struct mCheatDevice* device) {
|
|||
device->autosave = false;
|
||||
device->buttonDown = false;
|
||||
mCheatSetsInit(&device->cheats, 4);
|
||||
TableInit(&device->unpatchedMemory, 4, free);
|
||||
}
|
||||
|
||||
void mCheatDeviceDestroy(struct mCheatDevice* device) {
|
||||
mCheatDeviceClear(device);
|
||||
mCheatSetsDeinit(&device->cheats);
|
||||
TableDeinit(&device->unpatchedMemory);
|
||||
free(device);
|
||||
}
|
||||
|
||||
|
@ -75,6 +193,7 @@ void mCheatDeviceClear(struct mCheatDevice* device) {
|
|||
void mCheatSetInit(struct mCheatSet* set, const char* name) {
|
||||
mCheatListInit(&set->list, 4);
|
||||
StringListInit(&set->lines, 4);
|
||||
mCheatPatchListInit(&set->romPatches, 4);
|
||||
if (name) {
|
||||
set->name = strdup(name);
|
||||
} else {
|
||||
|
@ -93,7 +212,10 @@ void mCheatSetDeinit(struct mCheatSet* set) {
|
|||
free(set->name);
|
||||
}
|
||||
StringListDeinit(&set->lines);
|
||||
set->deinit(set);
|
||||
mCheatPatchListDeinit(&set->romPatches);
|
||||
if (set->deinit) {
|
||||
set->deinit(set);
|
||||
}
|
||||
free(set);
|
||||
}
|
||||
|
||||
|
@ -117,7 +239,9 @@ bool mCheatAddLine(struct mCheatSet* set, const char* line, int type) {
|
|||
|
||||
void mCheatAddSet(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
||||
*mCheatSetsAppend(&device->cheats) = cheats;
|
||||
cheats->add(cheats, device);
|
||||
if (cheats->add) {
|
||||
cheats->add(cheats, device);
|
||||
}
|
||||
}
|
||||
|
||||
void mCheatRemoveSet(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
||||
|
@ -131,7 +255,9 @@ void mCheatRemoveSet(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
|||
return;
|
||||
}
|
||||
mCheatSetsShift(&device->cheats, i, 1);
|
||||
cheats->remove(cheats, device);
|
||||
if (cheats->remove) {
|
||||
cheats->remove(cheats, device);
|
||||
}
|
||||
}
|
||||
|
||||
bool mCheatParseFile(struct mCheatDevice* device, struct VFile* vf) {
|
||||
|
@ -503,8 +629,14 @@ void mCheatAutosave(struct mCheatDevice* device) {
|
|||
#endif
|
||||
|
||||
void mCheatRefresh(struct mCheatDevice* device, struct mCheatSet* cheats) {
|
||||
cheats->refresh(cheats, device);
|
||||
if (cheats->enabled) {
|
||||
_patchROM(device, cheats);
|
||||
}
|
||||
if (cheats->refresh) {
|
||||
cheats->refresh(cheats, device);
|
||||
}
|
||||
if (!cheats->enabled) {
|
||||
_unpatchROM(device, cheats);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,15 +37,15 @@ static const struct mCoreFilter {
|
|||
enum mPlatform platform;
|
||||
} _filters[] = {
|
||||
#ifdef M_CORE_DS
|
||||
{ DSIsROM, DSCoreCreate, PLATFORM_DS },
|
||||
{ DSIsROM, DSCoreCreate, mPLATFORM_DS },
|
||||
#endif
|
||||
#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) {
|
||||
|
@ -69,7 +69,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) {
|
||||
|
@ -77,7 +77,7 @@ enum mPlatform mCoreIsCompatible(struct VFile* vf) {
|
|||
return filter->platform;
|
||||
}
|
||||
}
|
||||
return PLATFORM_NONE;
|
||||
return mPLATFORM_NONE;
|
||||
}
|
||||
|
||||
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -144,7 +144,7 @@ static void _DSCoreDeinit(struct mCore* core) {
|
|||
|
||||
static enum mPlatform _DSCorePlatform(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return PLATFORM_DS;
|
||||
return mPLATFORM_DS;
|
||||
}
|
||||
|
||||
static bool _DSCoreSupportsFeature(const struct mCore* core, enum mCoreFeature feature) {
|
||||
|
|
|
@ -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...");
|
||||
|
|
|
@ -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) {
|
||||
|
|
129
src/gb/cheats.c
129
src/gb/cheats.c
|
@ -10,58 +10,6 @@
|
|||
#include <mgba/internal/gb/memory.h>
|
||||
#include <mgba-util/string.h>
|
||||
|
||||
DEFINE_VECTOR(GBCheatPatchList, struct GBCheatPatch);
|
||||
|
||||
static void _patchROM(struct mCheatDevice* device, struct GBCheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < GBCheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct GBCheatPatch* patch = GBCheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
if (patch->applied) {
|
||||
continue;
|
||||
}
|
||||
int segment = 0;
|
||||
if (patch->checkByte) {
|
||||
struct GB* gb = device->p->board;
|
||||
int maxSegment = (gb->memory.romSize + GB_SIZE_CART_BANK0 - 1) / GB_SIZE_CART_BANK0;
|
||||
for (; segment < maxSegment; ++segment) {
|
||||
int8_t value = GBView8(device->p->cpu, patch->address, segment);
|
||||
if (value == patch->oldValue) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (segment == maxSegment) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// TODO: More than one segment
|
||||
GBPatch8(device->p->cpu, patch->address, patch->newValue, &patch->oldValue, segment);
|
||||
patch->applied = true;
|
||||
patch->segment = segment;
|
||||
}
|
||||
}
|
||||
|
||||
static void _unpatchROM(struct mCheatDevice* device, struct GBCheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < GBCheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct GBCheatPatch* patch = GBCheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
if (!patch->applied) {
|
||||
continue;
|
||||
}
|
||||
GBPatch8(device->p->cpu, patch->address, patch->oldValue, &patch->newValue, patch->segment);
|
||||
patch->applied = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void GBCheatSetDeinit(struct mCheatSet* set);
|
||||
static void GBCheatAddSet(struct mCheatSet* cheats, struct mCheatDevice* device);
|
||||
static void GBCheatRemoveSet(struct mCheatSet* cheats, struct mCheatDevice* device);
|
||||
static void GBCheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device);
|
||||
static void GBCheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet);
|
||||
static void GBCheatParseDirectives(struct mCheatSet* set, const struct StringList* directives);
|
||||
static void GBCheatDumpDirectives(struct mCheatSet* set, struct StringList* directives);
|
||||
|
@ -69,23 +17,21 @@ static bool GBCheatAddLine(struct mCheatSet*, const char* line, int type);
|
|||
|
||||
static struct mCheatSet* GBCheatSetCreate(struct mCheatDevice* device, const char* name) {
|
||||
UNUSED(device);
|
||||
struct GBCheatSet* set = malloc(sizeof(*set));
|
||||
mCheatSetInit(&set->d, name);
|
||||
struct mCheatSet* set = malloc(sizeof(*set));
|
||||
mCheatSetInit(set, name);
|
||||
|
||||
GBCheatPatchListInit(&set->romPatches, 0);
|
||||
set->deinit = NULL;
|
||||
set->add = NULL;
|
||||
set->remove = NULL;
|
||||
|
||||
set->d.deinit = GBCheatSetDeinit;
|
||||
set->d.add = GBCheatAddSet;
|
||||
set->d.remove = GBCheatRemoveSet;
|
||||
set->addLine = GBCheatAddLine;
|
||||
set->copyProperties = GBCheatSetCopyProperties;
|
||||
|
||||
set->d.addLine = GBCheatAddLine;
|
||||
set->d.copyProperties = GBCheatSetCopyProperties;
|
||||
set->parseDirectives = GBCheatParseDirectives;
|
||||
set->dumpDirectives = GBCheatDumpDirectives;
|
||||
|
||||
set->d.parseDirectives = GBCheatParseDirectives;
|
||||
set->d.dumpDirectives = GBCheatDumpDirectives;
|
||||
|
||||
set->d.refresh = GBCheatRefresh;
|
||||
return &set->d;
|
||||
set->refresh = NULL;
|
||||
return set;
|
||||
}
|
||||
|
||||
struct mCheatDevice* GBCheatDeviceCreate(void) {
|
||||
|
@ -95,23 +41,8 @@ struct mCheatDevice* GBCheatDeviceCreate(void) {
|
|||
return device;
|
||||
}
|
||||
|
||||
static void GBCheatSetDeinit(struct mCheatSet* set) {
|
||||
struct GBCheatSet* gbset = (struct GBCheatSet*) set;
|
||||
GBCheatPatchListDeinit(&gbset->romPatches);
|
||||
}
|
||||
|
||||
static void GBCheatAddSet(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBCheatSet* gbset = (struct GBCheatSet*) cheats;
|
||||
_patchROM(device, gbset);
|
||||
}
|
||||
|
||||
static void GBCheatRemoveSet(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBCheatSet* gbset = (struct GBCheatSet*) cheats;
|
||||
_unpatchROM(device, gbset);
|
||||
}
|
||||
|
||||
static bool GBCheatAddCodebreaker(struct GBCheatSet* cheats, uint16_t address, uint8_t data) {
|
||||
struct mCheat* cheat = mCheatListAppend(&cheats->d.list);
|
||||
static bool GBCheatAddCodebreaker(struct mCheatSet* cheats, uint16_t address, uint8_t data) {
|
||||
struct mCheat* cheat = mCheatListAppend(&cheats->list);
|
||||
cheat->type = CHEAT_ASSIGN;
|
||||
cheat->width = 1;
|
||||
cheat->address = address;
|
||||
|
@ -121,11 +52,11 @@ static bool GBCheatAddCodebreaker(struct GBCheatSet* cheats, uint16_t address, u
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool GBCheatAddGameShark(struct GBCheatSet* cheats, uint32_t op) {
|
||||
static bool GBCheatAddGameShark(struct mCheatSet* cheats, uint32_t op) {
|
||||
return GBCheatAddCodebreaker(cheats, ((op & 0xFF) << 8) | ((op >> 8) & 0xFF), (op >> 16) & 0xFF);
|
||||
}
|
||||
|
||||
static bool GBCheatAddGameSharkLine(struct GBCheatSet* cheats, const char* line) {
|
||||
static bool GBCheatAddGameSharkLine(struct mCheatSet* cheats, const char* line) {
|
||||
uint32_t op;
|
||||
if (!hex32(line, &op)) {
|
||||
return false;
|
||||
|
@ -133,7 +64,7 @@ static bool GBCheatAddGameSharkLine(struct GBCheatSet* cheats, const char* line)
|
|||
return GBCheatAddGameShark(cheats, op);
|
||||
}
|
||||
|
||||
static bool GBCheatAddGameGenieLine(struct GBCheatSet* cheats, const char* line) {
|
||||
static bool GBCheatAddGameGenieLine(struct mCheatSet* cheats, const char* line) {
|
||||
uint16_t op1;
|
||||
uint16_t op2;
|
||||
uint16_t op3 = 0x1000;
|
||||
|
@ -156,24 +87,26 @@ static bool GBCheatAddGameGenieLine(struct GBCheatSet* cheats, const char* line)
|
|||
uint16_t address = (op1 & 0xF) << 8;
|
||||
address |= (op2 >> 4) & 0xFF;
|
||||
address |= ((op2 & 0xF) ^ 0xF) << 12;
|
||||
struct GBCheatPatch* patch = GBCheatPatchListAppend(&cheats->romPatches);
|
||||
struct mCheatPatch* patch = mCheatPatchListAppend(&cheats->romPatches);
|
||||
patch->address = address;
|
||||
patch->newValue = op1 >> 4;
|
||||
patch->value = op1 >> 4;
|
||||
patch->applied = false;
|
||||
patch->width = 1;
|
||||
patch->segment = -1;
|
||||
if (op3 < 0x1000) {
|
||||
uint32_t value = ((op3 & 0xF00) << 20) | (op3 & 0xF);
|
||||
value = ROR(value, 2);
|
||||
value |= value >> 24;
|
||||
value ^= 0xBA;
|
||||
patch->oldValue = value;
|
||||
patch->checkByte = true;
|
||||
patch->checkValue = value;
|
||||
patch->check = true;
|
||||
} else {
|
||||
patch->checkByte = false;
|
||||
patch->check = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool GBCheatAddVBALine(struct GBCheatSet* cheats, const char* line) {
|
||||
static bool GBCheatAddVBALine(struct mCheatSet* cheats, const char* line) {
|
||||
uint16_t address;
|
||||
uint8_t value;
|
||||
const char* lineNext = hex16(line, &address);
|
||||
|
@ -183,7 +116,7 @@ static bool GBCheatAddVBALine(struct GBCheatSet* cheats, const char* line) {
|
|||
if (!hex8(line, &value)) {
|
||||
return false;
|
||||
}
|
||||
struct mCheat* cheat = mCheatListAppend(&cheats->d.list);
|
||||
struct mCheat* cheat = mCheatListAppend(&cheats->list);
|
||||
cheat->type = CHEAT_ASSIGN;
|
||||
cheat->width = 1;
|
||||
cheat->address = address;
|
||||
|
@ -193,8 +126,7 @@ static bool GBCheatAddVBALine(struct GBCheatSet* cheats, const char* line) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GBCheatAddLine(struct mCheatSet* set, const char* line, int type) {
|
||||
struct GBCheatSet* cheats = (struct GBCheatSet*) set;
|
||||
bool GBCheatAddLine(struct mCheatSet* cheats, const char* line, int type) {
|
||||
switch (type) {
|
||||
case GB_CHEAT_AUTODETECT:
|
||||
break;
|
||||
|
@ -242,15 +174,6 @@ bool GBCheatAddLine(struct mCheatSet* set, const char* line, int type) {
|
|||
}
|
||||
}
|
||||
|
||||
static void GBCheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBCheatSet* gbset = (struct GBCheatSet*) cheats;
|
||||
if (cheats->enabled) {
|
||||
_patchROM(device, gbset);
|
||||
} else {
|
||||
_unpatchROM(device, gbset);
|
||||
}
|
||||
}
|
||||
|
||||
static void GBCheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet) {
|
||||
UNUSED(set);
|
||||
UNUSED(oldSet);
|
||||
|
|
|
@ -158,7 +158,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) {
|
||||
|
@ -432,7 +432,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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
#define MAX_LINE_LENGTH 128
|
||||
|
||||
DEFINE_VECTOR(GBACheatPatchList, struct GBACheatPatch);
|
||||
|
||||
static void _addBreakpoint(struct mCheatDevice* device, struct GBACheatSet* cheats) {
|
||||
if (!device->p || !cheats->hook) {
|
||||
return;
|
||||
|
@ -37,36 +35,6 @@ static void _removeBreakpoint(struct mCheatDevice* device, struct GBACheatSet* c
|
|||
GBAClearBreakpoint(device->p->board, cheats->hook->address, cheats->hook->mode, cheats->hook->patchedOpcode);
|
||||
}
|
||||
|
||||
static void _patchROM(struct mCheatDevice* device, struct GBACheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < GBACheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct GBACheatPatch* patch = GBACheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
if (patch->applied) {
|
||||
continue;
|
||||
}
|
||||
GBAPatch16(device->p->cpu, patch->address, patch->newValue, &patch->oldValue);
|
||||
patch->applied = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void _unpatchROM(struct mCheatDevice* device, struct GBACheatSet* cheats) {
|
||||
if (!device->p) {
|
||||
return;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < GBACheatPatchListSize(&cheats->romPatches); ++i) {
|
||||
struct GBACheatPatch* patch = GBACheatPatchListGetPointer(&cheats->romPatches, i);
|
||||
if (!patch->applied) {
|
||||
continue;
|
||||
}
|
||||
GBAPatch16(device->p->cpu, patch->address, patch->oldValue, NULL);
|
||||
patch->applied = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void GBACheatSetDeinit(struct mCheatSet* set);
|
||||
static void GBACheatAddSet(struct mCheatSet* cheats, struct mCheatDevice* device);
|
||||
static void GBACheatRemoveSet(struct mCheatSet* cheats, struct mCheatDevice* device);
|
||||
|
@ -101,7 +69,6 @@ static struct mCheatSet* GBACheatSetCreate(struct mCheatDevice* device, const ch
|
|||
|
||||
set->d.refresh = GBACheatRefresh;
|
||||
|
||||
GBACheatPatchListInit(&set->romPatches, 4);
|
||||
return &set->d;
|
||||
}
|
||||
|
||||
|
@ -120,18 +87,15 @@ static void GBACheatSetDeinit(struct mCheatSet* set) {
|
|||
free(gbaset->hook);
|
||||
}
|
||||
}
|
||||
GBACheatPatchListDeinit(&gbaset->romPatches);
|
||||
}
|
||||
|
||||
static void GBACheatAddSet(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats;
|
||||
_addBreakpoint(device, gbaset);
|
||||
_patchROM(device, gbaset);
|
||||
}
|
||||
|
||||
static void GBACheatRemoveSet(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats;
|
||||
_unpatchROM(device, gbaset);
|
||||
_removeBreakpoint(device, gbaset);
|
||||
}
|
||||
|
||||
|
@ -276,13 +240,8 @@ bool GBACheatAddLine(struct mCheatSet* set, const char* line, int type) {
|
|||
|
||||
static void GBACheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
|
||||
struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats;
|
||||
if (cheats->enabled) {
|
||||
_patchROM(device, gbaset);
|
||||
if (gbaset->hook && !gbaset->hook->reentries) {
|
||||
_addBreakpoint(device, gbaset);
|
||||
}
|
||||
} else {
|
||||
_unpatchROM(device, gbaset);
|
||||
if (cheats->enabled && gbaset->hook && !gbaset->hook->reentries) {
|
||||
_addBreakpoint(device, gbaset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ void GBACheatSetGameSharkVersion(struct GBACheatSet* cheats, enum GBACheatGameSh
|
|||
bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||
enum GBAGameSharkType type = op1 >> 28;
|
||||
struct mCheat* cheat = 0;
|
||||
struct GBACheatPatch* romPatch;
|
||||
struct mCheatPatch* romPatch;
|
||||
|
||||
if (cheats->incompleteCheat != COMPLETE) {
|
||||
struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat);
|
||||
|
@ -149,10 +149,12 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t
|
|||
cheats->incompleteCheat = mCheatListIndex(&cheats->d.list, cheat);
|
||||
break;
|
||||
case GSA_PATCH:
|
||||
romPatch = GBACheatPatchListAppend(&cheats->romPatches);
|
||||
romPatch = mCheatPatchListAppend(&cheats->d.romPatches);
|
||||
romPatch->address = BASE_CART0 | ((op1 & 0xFFFFFF) << 1);
|
||||
romPatch->newValue = op2;
|
||||
romPatch->value = op2;
|
||||
romPatch->applied = false;
|
||||
romPatch->width = 2;
|
||||
romPatch->check = false;
|
||||
return true;
|
||||
case GSA_BUTTON:
|
||||
switch (op1 & 0x00F00000) {
|
||||
|
|
|
@ -230,9 +230,11 @@ static bool _addPAR3Special(struct GBACheatSet* cheats, uint32_t op2) {
|
|||
break;
|
||||
}
|
||||
if (romPatch >= 0) {
|
||||
struct GBACheatPatch* patch = GBACheatPatchListAppend(&cheats->romPatches);
|
||||
struct mCheatPatch* patch = mCheatPatchListAppend(&cheats->d.romPatches);
|
||||
patch->address = BASE_CART0 | ((op2 & 0xFFFFFF) << 1);
|
||||
patch->applied = false;
|
||||
patch->check = false;
|
||||
patch->width = 2;
|
||||
cheats->incompletePatch = patch;
|
||||
}
|
||||
return true;
|
||||
|
@ -240,8 +242,8 @@ static bool _addPAR3Special(struct GBACheatSet* cheats, uint32_t op2) {
|
|||
|
||||
bool GBACheatAddProActionReplayRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||
if (cheats->incompletePatch) {
|
||||
cheats->incompletePatch->newValue = op1;
|
||||
cheats->incompletePatch = 0;
|
||||
cheats->incompletePatch->value = op1;
|
||||
cheats->incompletePatch = NULL;
|
||||
return true;
|
||||
}
|
||||
if (cheats->incompleteCheat != COMPLETE) {
|
||||
|
|
|
@ -249,7 +249,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) {
|
||||
|
@ -560,7 +560,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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -454,7 +454,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;
|
||||
|
@ -535,7 +535,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;
|
||||
|
@ -690,7 +690,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";
|
||||
|
||||
|
@ -698,7 +698,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;
|
||||
|
@ -815,7 +815,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;
|
||||
|
@ -836,7 +836,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;
|
||||
|
@ -882,7 +882,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];
|
||||
|
@ -904,7 +904,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;
|
||||
|
@ -913,7 +913,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:
|
||||
|
@ -923,7 +923,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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
if hasattr(lib, 'PLATFORM_DS'):
|
||||
PLATFORM_GB = lib.PLATFORM_DS
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>{projectName}</string>
|
||||
<string notr="true">{projectName}</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
|
@ -103,7 +103,7 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd.</string>
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>{projectVersion}</string>
|
||||
<string notr="true">{projectVersion}</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
|
@ -152,7 +152,7 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd.</string>
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>{logo}</string>
|
||||
<string notr="true">{logo}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -187,7 +187,7 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd.</string>
|
|||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="patrons">
|
||||
<property name="text">
|
||||
<string>{patrons}</string>
|
||||
<string notr="true">{patrons}</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>AssetTile</string>
|
||||
<string notr="true">AssetTile</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
@ -336,7 +336,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());
|
||||
|
@ -345,7 +345,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());
|
||||
|
@ -709,16 +709,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;
|
||||
}
|
||||
|
@ -774,7 +774,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);
|
||||
|
@ -790,7 +790,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);
|
||||
|
@ -806,7 +806,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);
|
||||
|
@ -838,7 +838,7 @@ void CoreController::attachPrinter() {
|
|||
}
|
||||
|
||||
void CoreController::detachPrinter() {
|
||||
if (platform() != PLATFORM_GB) {
|
||||
if (platform() != mPLATFORM_GB) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
@ -848,7 +848,7 @@ void CoreController::detachPrinter() {
|
|||
}
|
||||
|
||||
void CoreController::endPrint() {
|
||||
if (platform() != PLATFORM_GB) {
|
||||
if (platform() != mPLATFORM_GB) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
@ -858,7 +858,7 @@ void CoreController::endPrint() {
|
|||
|
||||
#ifdef M_CORE_GBA
|
||||
void CoreController::attachBattleChipGate() {
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
if (platform() != mPLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
@ -868,7 +868,7 @@ void CoreController::attachBattleChipGate() {
|
|||
}
|
||||
|
||||
void CoreController::detachBattleChipGate() {
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
if (platform() != mPLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
@ -876,7 +876,7 @@ void CoreController::detachBattleChipGate() {
|
|||
}
|
||||
|
||||
void CoreController::setBattleChipId(uint16_t id) {
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
if (platform() != mPLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
@ -884,7 +884,7 @@ void CoreController::setBattleChipId(uint16_t id) {
|
|||
}
|
||||
|
||||
void CoreController::setBattleChipFlavor(int flavor) {
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
if (platform() != mPLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
Interrupter interrupter(this);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,6 +8,8 @@
|
|||
#include <QDialog>
|
||||
#include <QList>
|
||||
|
||||
#include <mgba/core/core.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ui_IOViewer.h"
|
||||
|
@ -42,7 +44,7 @@ public:
|
|||
|
||||
IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);
|
||||
|
||||
static const QList<RegisterDescription>& registerDescriptions();
|
||||
static const QList<RegisterDescription>& registerDescriptions(mPlatform);
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
@ -58,8 +60,10 @@ private slots:
|
|||
void selectRegister();
|
||||
|
||||
private:
|
||||
static QList<RegisterDescription> s_registers;
|
||||
static QHash<mPlatform, QList<RegisterDescription>> s_registers;
|
||||
Ui::IOViewer m_ui;
|
||||
uint32_t m_base;
|
||||
int m_width;
|
||||
|
||||
int m_register;
|
||||
uint16_t m_value;
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -550,7 +550,7 @@ void SettingsView::updateConfig() {
|
|||
m_input->saveConfiguration();
|
||||
|
||||
emit pathsChanged();
|
||||
emit biosLoaded(PLATFORM_GBA, m_ui.gbaBios->text());
|
||||
emit biosLoaded(mPLATFORM_GBA, m_ui.gbaBios->text());
|
||||
}
|
||||
|
||||
void SettingsView::reloadConfig() {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -82,19 +82,19 @@
|
|||
#include <mgba-util/vfs.h>
|
||||
|
||||
#ifdef M_CORE_GB
|
||||
#define SUPPORT_GB (1 << PLATFORM_GB)
|
||||
#define SUPPORT_GB (1 << mPLATFORM_GB)
|
||||
#else
|
||||
#define SUPPORT_GB 0
|
||||
#endif
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
#define SUPPORT_GBA (1 << PLATFORM_GBA)
|
||||
#define SUPPORT_GBA (1 << mPLATFORM_GBA)
|
||||
#else
|
||||
#define SUPPORT_GBA 0
|
||||
#endif
|
||||
|
||||
#ifdef M_CORE_DS
|
||||
#define SUPPORT_DS (1 << PLATFORM_DS)
|
||||
#define SUPPORT_DS (1 << mPLATFORM_DS)
|
||||
#else
|
||||
#define SUPPORT_DS 0
|
||||
#endif
|
||||
|
@ -181,13 +181,13 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
|
|||
setupMenu(menuBar());
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
m_inputController.addPlatform(PLATFORM_GBA, &GBAInputInfo);
|
||||
m_inputController.addPlatform(mPLATFORM_GBA, &GBAInputInfo);
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
m_inputController.addPlatform(PLATFORM_GB, &GBInputInfo);
|
||||
m_inputController.addPlatform(mPLATFORM_GB, &GBInputInfo);
|
||||
#endif
|
||||
#ifdef M_CORE_DS
|
||||
m_inputController.addPlatform(PLATFORM_DS, &DSInputInfo);
|
||||
m_inputController.addPlatform(mPLATFORM_DS, &DSInputInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -789,7 +789,7 @@ void Window::gameStarted() {
|
|||
action->setEnabled(true);
|
||||
}
|
||||
#ifdef M_CORE_DS
|
||||
if (m_controller->platform() == PLATFORM_DS && (!m_config->getOption("useBios").toInt() || m_config->getOption("ds.bios7").isNull() || m_config->getOption("ds.bios9").isNull() || m_config->getOption("ds.firmware").isNull())) {
|
||||
if (m_controller->platform() == mPLATFORM_DS && (!m_config->getOption("useBios").toInt() || m_config->getOption("ds.bios7").isNull() || m_config->getOption("ds.bios9").isNull() || m_config->getOption("ds.firmware").isNull())) {
|
||||
QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("BIOS required"),
|
||||
tr("DS support requires dumps of the BIOS and firmware."),
|
||||
QMessageBox::Ok, this, Qt::Sheet);
|
||||
|
@ -1093,7 +1093,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()) {
|
||||
|
@ -1190,14 +1190,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");
|
||||
|
@ -1212,29 +1212,29 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
this->openStateWindow(LoadSave::LOAD);
|
||||
}, "file", QKeySequence("F10"));
|
||||
m_nonMpActions.append(loadState);
|
||||
m_platformActions.insert(PLATFORM_GBA, loadState);
|
||||
m_platformActions.insert(PLATFORM_GB, loadState);
|
||||
m_platformActions.insert(mPLATFORM_GBA, loadState);
|
||||
m_platformActions.insert(mPLATFORM_GB, loadState);
|
||||
|
||||
Action* loadStateFile = addGameAction(tr("Load state file..."), "loadStateFile", [this]() {
|
||||
this->selectState(true);
|
||||
}, "file");
|
||||
m_nonMpActions.append(loadStateFile);
|
||||
m_platformActions.insert(PLATFORM_GBA, loadStateFile);
|
||||
m_platformActions.insert(PLATFORM_GB, loadStateFile);
|
||||
m_platformActions.insert(mPLATFORM_GBA, loadStateFile);
|
||||
m_platformActions.insert(mPLATFORM_GB, loadStateFile);
|
||||
|
||||
Action* saveState = addGameAction(tr("&Save state"), "saveState", [this]() {
|
||||
this->openStateWindow(LoadSave::SAVE);
|
||||
}, "file", QKeySequence("Shift+F10"));
|
||||
m_nonMpActions.append(saveState);
|
||||
m_platformActions.insert(PLATFORM_GBA, saveState);
|
||||
m_platformActions.insert(PLATFORM_GB, saveState);
|
||||
m_platformActions.insert(mPLATFORM_GBA, saveState);
|
||||
m_platformActions.insert(mPLATFORM_GB, saveState);
|
||||
|
||||
Action* saveStateFile = addGameAction(tr("Save state file..."), "saveStateFile", [this]() {
|
||||
this->selectState(false);
|
||||
}, "file");
|
||||
m_nonMpActions.append(saveStateFile);
|
||||
m_platformActions.insert(PLATFORM_GBA, saveStateFile);
|
||||
m_platformActions.insert(PLATFORM_GB, saveStateFile);
|
||||
m_platformActions.insert(mPLATFORM_GBA, saveStateFile);
|
||||
m_platformActions.insert(mPLATFORM_GB, saveStateFile);
|
||||
|
||||
m_actions.addMenu(tr("Quick load"), "quickLoad", "file");
|
||||
m_actions.addMenu(tr("Quick save"), "quickSave", "file");
|
||||
|
@ -1243,28 +1243,28 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_controller->loadState();
|
||||
}, "quickLoad");
|
||||
m_nonMpActions.append(quickLoad);
|
||||
m_platformActions.insert(PLATFORM_GBA, quickLoad);
|
||||
m_platformActions.insert(PLATFORM_GB, quickLoad);
|
||||
m_platformActions.insert(mPLATFORM_GBA, quickLoad);
|
||||
m_platformActions.insert(mPLATFORM_GB, quickLoad);
|
||||
|
||||
Action* quickSave = addGameAction(tr("Save recent"), "quickSave", [this] {
|
||||
m_controller->saveState();
|
||||
}, "quickSave");
|
||||
m_nonMpActions.append(quickSave);
|
||||
m_platformActions.insert(PLATFORM_GBA, quickSave);
|
||||
m_platformActions.insert(PLATFORM_GB, quickSave);
|
||||
m_platformActions.insert(mPLATFORM_GBA, quickSave);
|
||||
m_platformActions.insert(mPLATFORM_GB, quickSave);
|
||||
|
||||
m_actions.addSeparator("quickLoad");
|
||||
m_actions.addSeparator("quickSave");
|
||||
|
||||
Action* undoLoadState = addGameAction(tr("Undo load state"), "undoLoadState", &CoreController::loadBackupState, "quickLoad", QKeySequence("F11"));
|
||||
m_nonMpActions.append(undoLoadState);
|
||||
m_platformActions.insert(PLATFORM_GBA, undoLoadState);
|
||||
m_platformActions.insert(PLATFORM_GB, undoLoadState);
|
||||
m_platformActions.insert(mPLATFORM_GBA, undoLoadState);
|
||||
m_platformActions.insert(mPLATFORM_GB, undoLoadState);
|
||||
|
||||
Action* undoSaveState = addGameAction(tr("Undo save state"), "undoSaveState", &CoreController::saveBackupState, "quickSave", QKeySequence("Shift+F11"));
|
||||
m_nonMpActions.append(undoSaveState);
|
||||
m_platformActions.insert(PLATFORM_GBA, undoSaveState);
|
||||
m_platformActions.insert(PLATFORM_GB, undoSaveState);
|
||||
m_platformActions.insert(mPLATFORM_GBA, undoSaveState);
|
||||
m_platformActions.insert(mPLATFORM_GB, undoSaveState);
|
||||
|
||||
m_actions.addSeparator("quickLoad");
|
||||
m_actions.addSeparator("quickSave");
|
||||
|
@ -1274,15 +1274,15 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_controller->loadState(i);
|
||||
}, "quickLoad", QString("F%1").arg(i));
|
||||
m_nonMpActions.append(quickLoad);
|
||||
m_platformActions.insert(PLATFORM_GBA, quickLoad);
|
||||
m_platformActions.insert(PLATFORM_GB, quickLoad);
|
||||
m_platformActions.insert(mPLATFORM_GBA, quickLoad);
|
||||
m_platformActions.insert(mPLATFORM_GB, quickLoad);
|
||||
|
||||
Action* quickSave = addGameAction(tr("State &%1").arg(i), QString("quickSave.%1").arg(i), [this, i]() {
|
||||
m_controller->saveState(i);
|
||||
}, "quickSave", QString("Shift+F%1").arg(i));
|
||||
m_nonMpActions.append(quickSave);
|
||||
m_platformActions.insert(PLATFORM_GBA, quickSave);
|
||||
m_platformActions.insert(PLATFORM_GB, quickSave);
|
||||
m_platformActions.insert(mPLATFORM_GBA, quickSave);
|
||||
m_platformActions.insert(mPLATFORM_GB, quickSave);
|
||||
}
|
||||
|
||||
m_actions.addSeparator("file");
|
||||
|
@ -1291,10 +1291,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");
|
||||
|
@ -1318,8 +1318,8 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
addGameAction(tr("&Reset"), "reset", &CoreController::reset, "emu", QKeySequence("Ctrl+R"));
|
||||
addGameAction(tr("Sh&utdown"), "shutdown", &CoreController::stop, "emu");
|
||||
Action* yank = addGameAction(tr("Yank game pak"), "yank", &CoreController::yankPak, "emu");
|
||||
m_platformActions.insert(PLATFORM_GBA, yank);
|
||||
m_platformActions.insert(PLATFORM_GB, yank);
|
||||
m_platformActions.insert(mPLATFORM_GBA, yank);
|
||||
m_platformActions.insert(mPLATFORM_GB, yank);
|
||||
|
||||
m_actions.addSeparator("emu");
|
||||
|
||||
|
@ -1370,15 +1370,15 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_controller->rewind();
|
||||
}, "emu", QKeySequence("~"));
|
||||
m_nonMpActions.append(rewind);
|
||||
m_platformActions.insert(PLATFORM_GBA, rewind);
|
||||
m_platformActions.insert(PLATFORM_GB, rewind);
|
||||
m_platformActions.insert(mPLATFORM_GBA, rewind);
|
||||
m_platformActions.insert(mPLATFORM_GB, rewind);
|
||||
|
||||
Action* frameRewind = addGameAction(tr("Step backwards"), "frameRewind", [this] () {
|
||||
m_controller->rewind(1);
|
||||
}, "emu", QKeySequence("Ctrl+B"));
|
||||
m_nonMpActions.append(frameRewind);
|
||||
m_platformActions.insert(PLATFORM_GBA, frameRewind);
|
||||
m_platformActions.insert(PLATFORM_GB, frameRewind);
|
||||
m_platformActions.insert(mPLATFORM_GBA, frameRewind);
|
||||
m_platformActions.insert(mPLATFORM_GB, frameRewind);
|
||||
|
||||
ConfigOption* videoSync = m_config->addOption("videoSync");
|
||||
videoSync->addBoolean(tr("Sync to &video"), &m_actions, "emu");
|
||||
|
@ -1419,12 +1419,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");
|
||||
|
@ -1596,7 +1596,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");
|
||||
|
@ -1624,11 +1624,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
|
||||
addGameAction(tr("View memory..."), "memoryView", openControllerTView<MemoryView>(), "tools");
|
||||
addGameAction(tr("Search memory..."), "memorySearch", openControllerTView<MemorySearch>(), "tools");
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
Action* ioViewer = addGameAction(tr("View &I/O registers..."), "ioViewer", openControllerTView<IOViewer>(), "tools");
|
||||
m_platformActions.insert(PLATFORM_GBA, ioViewer);
|
||||
#endif
|
||||
addGameAction(tr("View &I/O registers..."), "ioViewer", openControllerTView<IOViewer>(), "tools");
|
||||
|
||||
m_actions.addSeparator("tools");
|
||||
addGameAction(tr("Record debug video log..."), "recordVL", this, &Window::startVideoLog, "tools");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue