mirror of https://github.com/mgba-emu/mgba.git
Merge branch 'master' into qt
This commit is contained in:
commit
7353092b84
|
@ -124,6 +124,7 @@ static void GBAInit(struct ARMCore* cpu, struct ARMComponent* component) {
|
||||||
|
|
||||||
GBAInterruptHandlerInit(&cpu->irqh);
|
GBAInterruptHandlerInit(&cpu->irqh);
|
||||||
GBAMemoryInit(gba);
|
GBAMemoryInit(gba);
|
||||||
|
GBASavedataInit(&gba->memory.savedata, 0);
|
||||||
|
|
||||||
gba->video.p = gba;
|
gba->video.p = gba;
|
||||||
GBAVideoInit(&gba->video);
|
GBAVideoInit(&gba->video);
|
||||||
|
@ -151,6 +152,8 @@ static void GBAInit(struct ARMCore* cpu, struct ARMComponent* component) {
|
||||||
gba->logLevel = GBA_LOG_INFO | GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL;
|
gba->logLevel = GBA_LOG_INFO | GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL;
|
||||||
|
|
||||||
gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
|
gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
|
||||||
|
|
||||||
|
gba->busyLoop = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBADestroy(struct GBA* gba) {
|
void GBADestroy(struct GBA* gba) {
|
||||||
|
@ -403,7 +406,7 @@ void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char
|
||||||
gba->memory.rom = gba->pristineRom;
|
gba->memory.rom = gba->pristineRom;
|
||||||
gba->activeFile = fname;
|
gba->activeFile = fname;
|
||||||
gba->memory.romSize = gba->pristineRomSize;
|
gba->memory.romSize = gba->pristineRomSize;
|
||||||
gba->romCrc32 = crc32(gba->memory.rom, gba->memory.romSize);
|
gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize);
|
||||||
GBASavedataInit(&gba->memory.savedata, sav);
|
GBASavedataInit(&gba->memory.savedata, sav);
|
||||||
GBAGPIOInit(&gba->memory.gpio, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]);
|
GBAGPIOInit(&gba->memory.gpio, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]);
|
||||||
_checkOverrides(gba, ((struct GBACartridge*) gba->memory.rom)->id);
|
_checkOverrides(gba, ((struct GBACartridge*) gba->memory.rom)->id);
|
||||||
|
@ -443,7 +446,7 @@ void GBAApplyPatch(struct GBA* gba, struct Patch* patch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gba->memory.romSize = patchedSize;
|
gba->memory.romSize = patchedSize;
|
||||||
gba->romCrc32 = crc32(gba->memory.rom, gba->memory.romSize);
|
gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBATimerUpdateRegister(struct GBA* gba, int timer) {
|
void GBATimerUpdateRegister(struct GBA* gba, int timer) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ static uint32_t crc32Table[] = {
|
||||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t crc32(const void* buf, size_t size) {
|
uint32_t doCrc32(const void* buf, size_t size) {
|
||||||
return updateCrc32(0, buf, size);
|
return updateCrc32(0, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
struct VFile;
|
struct VFile;
|
||||||
|
|
||||||
uint32_t crc32(const void* buf, size_t size);
|
uint32_t doCrc32(const void* buf, size_t size);
|
||||||
uint32_t updateCrc32(uint32_t crc, const void* buf, size_t size);
|
uint32_t updateCrc32(uint32_t crc, const void* buf, size_t size);
|
||||||
uint32_t fileCrc32(struct VFile* file, size_t endOffset);
|
uint32_t fileCrc32(struct VFile* file, size_t endOffset);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool _UPSApplyPatch(struct Patch* patch, void* out, size_t outSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
patch->vf->seek(patch->vf, 0, SEEK_SET);
|
patch->vf->seek(patch->vf, 0, SEEK_SET);
|
||||||
if (crc32(out, outSize) != goodCrc32) {
|
if (doCrc32(out, outSize) != goodCrc32) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue