mirror of https://github.com/mgba-emu/mgba.git
mGUI: Don't attempt to preload files larger than can fit in RAM
This commit is contained in:
parent
2def7289f3
commit
9ae85bdccc
1
CHANGES
1
CHANGES
|
@ -53,6 +53,7 @@ Other fixes:
|
|||
- Debugger: Close trace log when done tracing
|
||||
- FFmpeg: Fix some small memory leaks
|
||||
- FFmpeg: Fix encoding of time base
|
||||
- mGUI: Don't attempt to preload files larger than can fit in RAM
|
||||
- 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 a race condition in the frame inspector
|
||||
|
|
|
@ -146,7 +146,7 @@ bool mCorePreloadVFCB(struct mCore* core, struct VFile* vf, void (cb)(size_t, si
|
|||
extern uint32_t* romBuffer;
|
||||
extern size_t romBufferSize;
|
||||
if (size > romBufferSize) {
|
||||
size = romBufferSize;
|
||||
return false;
|
||||
}
|
||||
vfm = VFileFromMemory(romBuffer, size);
|
||||
#else
|
||||
|
|
|
@ -387,8 +387,19 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
|||
mCoreInitConfig(runner->core, runner->port);
|
||||
mInputMapInit(&runner->core->inputMap, &GBAInputInfo);
|
||||
|
||||
found = mCorePreloadFileCB(runner->core, path, _updateLoading, runner);
|
||||
struct VFile* rom = mDirectorySetOpenPath(&runner->core->dirs, path, runner->core->isROM);
|
||||
found = mCorePreloadVFCB(runner->core, rom, _updateLoading, runner);
|
||||
|
||||
#ifdef FIXED_ROM_BUFFER
|
||||
extern size_t romBufferSize;
|
||||
if (!found && rom && (size_t) rom->size(rom) > romBufferSize) {
|
||||
found = runner->core->loadROM(runner->core, rom);
|
||||
}
|
||||
#endif
|
||||
if (!found) {
|
||||
if (rom) {
|
||||
rom->close(rom);
|
||||
}
|
||||
mLOG(GUI_RUNNER, WARN, "Failed to load %s!", path);
|
||||
mCoreConfigDeinit(&runner->core->config);
|
||||
runner->core->deinit(runner->core);
|
||||
|
|
Loading…
Reference in New Issue