mirror of https://github.com/mgba-emu/mgba.git
Core: Const correctness fixes
This commit is contained in:
parent
3b1d3292dd
commit
5a24012e8a
|
@ -49,7 +49,7 @@ struct mCore {
|
|||
bool (*init)(struct mCore*);
|
||||
void (*deinit)(struct mCore*);
|
||||
|
||||
enum mPlatform (*platform)(struct mCore*);
|
||||
enum mPlatform (*platform)(const struct mCore*);
|
||||
|
||||
void (*setSync)(struct mCore*, struct mCoreSync*);
|
||||
void (*loadConfig)(struct mCore*, const struct mCoreConfig*);
|
||||
|
@ -90,12 +90,12 @@ struct mCore {
|
|||
void (*addKeys)(struct mCore*, uint32_t keys);
|
||||
void (*clearKeys)(struct mCore*, uint32_t keys);
|
||||
|
||||
int32_t (*frameCounter)(struct mCore*);
|
||||
int32_t (*frameCycles)(struct mCore*);
|
||||
int32_t (*frequency)(struct mCore*);
|
||||
int32_t (*frameCounter)(const struct mCore*);
|
||||
int32_t (*frameCycles)(const struct mCore*);
|
||||
int32_t (*frequency)(const struct mCore*);
|
||||
|
||||
void (*getGameTitle)(struct mCore*, char* title);
|
||||
void (*getGameCode)(struct mCore*, char* title);
|
||||
void (*getGameTitle)(const struct mCore*, char* title);
|
||||
void (*getGameCode)(const struct mCore*, char* title);
|
||||
|
||||
void (*setRTC)(struct mCore*, struct mRTCSource*);
|
||||
void (*setRotation)(struct mCore*, struct mRotationSource*);
|
||||
|
@ -106,7 +106,7 @@ struct mCore {
|
|||
uint32_t (*busRead32)(struct mCore*, uint32_t address);
|
||||
|
||||
void (*busWrite8)(struct mCore*, uint32_t address, uint8_t);
|
||||
void (*busWrite16)(struct mCore*, uint32_t address, uint16_t);
|
||||
void (*busWrite16)(struct mCore*, uint32_t address, uint16_t);
|
||||
void (*busWrite32)(struct mCore*, uint32_t address, uint32_t);
|
||||
|
||||
uint32_t (*rawRead8)(struct mCore*, uint32_t address, int segment);
|
||||
|
|
|
@ -82,7 +82,7 @@ static void _GBCoreDeinit(struct mCore* core) {
|
|||
free(core);
|
||||
}
|
||||
|
||||
static enum mPlatform _GBCorePlatform(struct mCore* core) {
|
||||
static enum mPlatform _GBCorePlatform(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return PLATFORM_GB;
|
||||
}
|
||||
|
@ -313,27 +313,27 @@ static void _GBCoreClearKeys(struct mCore* core, uint32_t keys) {
|
|||
gbcore->keys &= ~keys;
|
||||
}
|
||||
|
||||
static int32_t _GBCoreFrameCounter(struct mCore* core) {
|
||||
struct GB* gb = core->board;
|
||||
static int32_t _GBCoreFrameCounter(const struct mCore* core) {
|
||||
const struct GB* gb = core->board;
|
||||
return gb->video.frameCounter;
|
||||
}
|
||||
|
||||
static int32_t _GBCoreFrameCycles(struct mCore* core) {
|
||||
static int32_t _GBCoreFrameCycles(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return GB_VIDEO_TOTAL_LENGTH;
|
||||
}
|
||||
|
||||
static int32_t _GBCoreFrequency(struct mCore* core) {
|
||||
static int32_t _GBCoreFrequency(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
// TODO: GB differences
|
||||
return DMG_LR35902_FREQUENCY;
|
||||
}
|
||||
|
||||
static void _GBCoreGetGameTitle(struct mCore* core, char* title) {
|
||||
static void _GBCoreGetGameTitle(const struct mCore* core, char* title) {
|
||||
GBGetGameTitle(core->board, title);
|
||||
}
|
||||
|
||||
static void _GBCoreGetGameCode(struct mCore* core, char* title) {
|
||||
static void _GBCoreGetGameCode(const struct mCore* core, char* title) {
|
||||
GBGetGameCode(core->board, title);
|
||||
}
|
||||
|
||||
|
|
|
@ -613,7 +613,7 @@ bool GBIsROM(struct VFile* vf) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void GBGetGameTitle(struct GB* gb, char* out) {
|
||||
void GBGetGameTitle(const struct GB* gb, char* out) {
|
||||
const struct GBCartridge* cart = NULL;
|
||||
if (gb->memory.rom) {
|
||||
cart = (const struct GBCartridge*) &gb->memory.rom[0x100];
|
||||
|
@ -631,7 +631,7 @@ void GBGetGameTitle(struct GB* gb, char* out) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBGetGameCode(struct GB* gb, char* out) {
|
||||
void GBGetGameCode(const struct GB* gb, char* out) {
|
||||
memset(out, 0, 8);
|
||||
const struct GBCartridge* cart = NULL;
|
||||
if (gb->memory.rom) {
|
||||
|
|
|
@ -129,8 +129,8 @@ struct Patch;
|
|||
void GBApplyPatch(struct GB* gb, struct Patch* patch);
|
||||
|
||||
bool GBIsROM(struct VFile* vf);
|
||||
void GBGetGameTitle(struct GB* gba, char* out);
|
||||
void GBGetGameCode(struct GB* gba, char* out);
|
||||
void GBGetGameTitle(const struct GB* gba, char* out);
|
||||
void GBGetGameCode(const struct GB* gba, char* out);
|
||||
|
||||
void GBFrameEnded(struct GB* gb);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ static void _GBACoreDeinit(struct mCore* core) {
|
|||
free(core);
|
||||
}
|
||||
|
||||
static enum mPlatform _GBACorePlatform(struct mCore* core) {
|
||||
static enum mPlatform _GBACorePlatform(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return PLATFORM_GBA;
|
||||
}
|
||||
|
@ -329,26 +329,26 @@ static void _GBACoreClearKeys(struct mCore* core, uint32_t keys) {
|
|||
gbacore->keys &= ~keys;
|
||||
}
|
||||
|
||||
static int32_t _GBACoreFrameCounter(struct mCore* core) {
|
||||
struct GBA* gba = core->board;
|
||||
static int32_t _GBACoreFrameCounter(const struct mCore* core) {
|
||||
const struct GBA* gba = core->board;
|
||||
return gba->video.frameCounter;
|
||||
}
|
||||
|
||||
static int32_t _GBACoreFrameCycles(struct mCore* core) {
|
||||
static int32_t _GBACoreFrameCycles(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return VIDEO_TOTAL_LENGTH;
|
||||
}
|
||||
|
||||
static int32_t _GBACoreFrequency(struct mCore* core) {
|
||||
static int32_t _GBACoreFrequency(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return GBA_ARM7TDMI_FREQUENCY;
|
||||
}
|
||||
|
||||
static void _GBACoreGetGameTitle(struct mCore* core, char* title) {
|
||||
static void _GBACoreGetGameTitle(const struct mCore* core, char* title) {
|
||||
GBAGetGameTitle(core->board, title);
|
||||
}
|
||||
|
||||
static void _GBACoreGetGameCode(struct mCore* core, char* title) {
|
||||
static void _GBACoreGetGameCode(const struct mCore* core, char* title) {
|
||||
GBAGetGameCode(core->board, title);
|
||||
}
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@ bool GBAIsBIOS(struct VFile* vf) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void GBAGetGameCode(struct GBA* gba, char* out) {
|
||||
void GBAGetGameCode(const struct GBA* gba, char* out) {
|
||||
memset(out, 0, 8);
|
||||
if (!gba->memory.rom) {
|
||||
return;
|
||||
|
@ -752,7 +752,7 @@ void GBAGetGameCode(struct GBA* gba, char* out) {
|
|||
memcpy(&out[4], &((struct GBACartridge*) gba->memory.rom)->id, 4);
|
||||
}
|
||||
|
||||
void GBAGetGameTitle(struct GBA* gba, char* out) {
|
||||
void GBAGetGameTitle(const struct GBA* gba, char* out) {
|
||||
if (gba->memory.rom) {
|
||||
memcpy(out, &((struct GBACartridge*) gba->memory.rom)->title, 12);
|
||||
return;
|
||||
|
|
|
@ -173,8 +173,8 @@ bool GBALoadMB(struct GBA* gba, struct VFile* vf);
|
|||
bool GBAIsROM(struct VFile* vf);
|
||||
bool GBAIsMB(struct VFile* vf);
|
||||
bool GBAIsBIOS(struct VFile* vf);
|
||||
void GBAGetGameCode(struct GBA* gba, char* out);
|
||||
void GBAGetGameTitle(struct GBA* gba, char* out);
|
||||
void GBAGetGameCode(const struct GBA* gba, char* out);
|
||||
void GBAGetGameTitle(const struct GBA* gba, char* out);
|
||||
|
||||
void GBAFrameStarted(struct GBA* gba);
|
||||
void GBAFrameEnded(struct GBA* gba);
|
||||
|
|
Loading…
Reference in New Issue