Merge branch 'master' into medusa

This commit is contained in:
Vicki Pfau 2020-07-22 00:21:09 -07:00
commit 8d8f314864
3 changed files with 31 additions and 5 deletions

View File

@ -65,6 +65,7 @@ Other fixes:
- FFmpeg: Fix some small memory leaks - FFmpeg: Fix some small memory leaks
- FFmpeg: Fix encoding of time base - FFmpeg: Fix encoding of time base
- GB Core: Fix extracting SRAM when none is present - GB Core: Fix extracting SRAM when none is present
- GBA: Fix leak if attempting to load BIOS multiple times
- GBA Savedata: Fix extracting save when not yet configured in-game - GBA Savedata: Fix extracting save when not yet configured in-game
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642) - Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769) - Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)

View File

@ -443,7 +443,6 @@ void GBAYankROM(struct GBA* gba) {
} }
void GBALoadBIOS(struct GBA* gba, struct VFile* vf) { void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
gba->biosVf = vf;
if (vf->size(vf) != SIZE_BIOS) { if (vf->size(vf) != SIZE_BIOS) {
mLOG(GBA, WARN, "Incorrect BIOS size"); mLOG(GBA, WARN, "Incorrect BIOS size");
return; return;
@ -453,6 +452,11 @@ void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
mLOG(GBA, WARN, "Couldn't map BIOS"); mLOG(GBA, WARN, "Couldn't map BIOS");
return; return;
} }
if (gba->biosVf) {
gba->biosVf->unmap(gba->biosVf, gba->memory.bios, SIZE_BIOS);
gba->biosVf->close(gba->biosVf);
}
gba->biosVf = vf;
gba->memory.bios = bios; gba->memory.bios = bios;
gba->memory.fullBios = 1; gba->memory.fullBios = 1;
uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS); uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
@ -733,14 +737,14 @@ void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) {
void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) { void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
struct GBA* gba = (struct GBA*) cpu->master; struct GBA* gba = (struct GBA*) cpu->master;
if (cpu->executionMode == MODE_THUMB && (opcode & 0xFFC0) == 0xE800) {
mLOG(GBA, INFO, "Hit Wii U VC opcode: %08x", opcode);
return;
}
if (!gba->yankedRomSize) { if (!gba->yankedRomSize) {
// TODO: More sensible category? // TODO: More sensible category?
mLOG(GBA, WARN, "Illegal opcode: %08x", opcode); mLOG(GBA, WARN, "Illegal opcode: %08x", opcode);
} }
if (cpu->executionMode == MODE_THUMB && (opcode & 0xFFC0) == 0xE800) {
mLOG(GBA, DEBUG, "Hit Wii U VC opcode: %08x", opcode);
return;
}
#ifdef USE_DEBUGGERS #ifdef USE_DEBUGGERS
if (gba->debugger) { if (gba->debugger) {
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {

View File

@ -5,6 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <mgba-util/memory.h> #include <mgba-util/memory.h>
#ifndef DISABLE_ANON_MMAP
#ifdef __SANITIZE_ADDRESS__
#define DISABLE_ANON_MMAP
#elif defined(__has_feature)
#if __has_feature(address_sanitizer)
#define DISABLE_ANON_MMAP
#endif
#endif
#endif
#ifndef DISABLE_ANON_MMAP
#include <sys/mman.h> #include <sys/mman.h>
void* anonymousMemoryMap(size_t size) { void* anonymousMemoryMap(size_t size) {
@ -14,3 +25,13 @@ void* anonymousMemoryMap(size_t size) {
void mappedMemoryFree(void* memory, size_t size) { void mappedMemoryFree(void* memory, size_t size) {
munmap(memory, size); munmap(memory, size);
} }
#else
void* anonymousMemoryMap(size_t size) {
return calloc(1, size);
}
void mappedMemoryFree(void* memory, size_t size) {
UNUSED(size);
free(memory);
}
#endif