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 encoding of time base
- 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
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
- 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) {
gba->biosVf = vf;
if (vf->size(vf) != SIZE_BIOS) {
mLOG(GBA, WARN, "Incorrect BIOS size");
return;
@ -453,6 +452,11 @@ void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
mLOG(GBA, WARN, "Couldn't map BIOS");
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.fullBios = 1;
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) {
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) {
// TODO: More sensible category?
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
if (gba->debugger) {
struct mDebuggerEntryInfo info = {

View File

@ -5,6 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#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>
void* anonymousMemoryMap(size_t size) {
@ -14,3 +25,13 @@ void* anonymousMemoryMap(size_t size) {
void mappedMemoryFree(void* memory, size_t 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