mirror of https://github.com/mgba-emu/mgba.git
Core: Truncate preloading ROMs that slightly exceed max size (fixes #2093)
This commit is contained in:
parent
39751aac97
commit
e587a12ddf
1
CHANGES
1
CHANGES
|
@ -9,6 +9,7 @@ Other fixes:
|
|||
- GBA e-Reader: Fix bitmap short strip scanning
|
||||
- GBA Video: Fix mode 5 frame 1 caching (fixes mgba.io/i/2075)
|
||||
Misc:
|
||||
- Core: Truncate preloading ROMs that slightly exceed max size (fixes mgba.io/i/2093)
|
||||
- GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks
|
||||
- Qt: Add ROM filename and size to bug reporter
|
||||
|
||||
|
|
|
@ -159,7 +159,13 @@ bool mCorePreloadVFCB(struct mCore* core, struct VFile* vf, void (cb)(size_t, si
|
|||
extern uint32_t* romBuffer;
|
||||
extern size_t romBufferSize;
|
||||
if (size > romBufferSize) {
|
||||
return false;
|
||||
if (size - romBufferSize < romBufferSize / 2) {
|
||||
// Some ROM hacks accidentally overflow the size a bit, but since those are broken
|
||||
// on hardware anyway we can just silently truncate them without issue.
|
||||
size = romBufferSize;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
vfm = VFileFromMemory(romBuffer, size);
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue