mirror of https://github.com/mgba-emu/mgba.git
GUI: Fix screenshots and savestates
This commit is contained in:
parent
396d097db4
commit
f59fe8248f
|
@ -57,7 +57,7 @@ static void _drawState(struct GUIBackground* background, void* id) {
|
||||||
gbaBackground->p->drawScreenshot(gbaBackground->p, gbaBackground->screenshot, true);
|
gbaBackground->p->drawScreenshot(gbaBackground->p, gbaBackground->screenshot, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct VFile* vf = GBAGetState(gbaBackground->p->context.gba, 0, stateId, false);
|
struct VFile* vf = GBAGetState(gbaBackground->p->context.gba, gbaBackground->p->context.dirs.state, stateId, false);
|
||||||
uint32_t* pixels = gbaBackground->screenshot;
|
uint32_t* pixels = gbaBackground->screenshot;
|
||||||
if (!pixels) {
|
if (!pixels) {
|
||||||
pixels = anonymousMemoryMap(VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4);
|
pixels = anonymousMemoryMap(VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4);
|
||||||
|
@ -306,21 +306,21 @@ void GBAGUIRun(struct GBAGUIRunner* runner, const char* path) {
|
||||||
GBAContextReset(&runner->context);
|
GBAContextReset(&runner->context);
|
||||||
break;
|
break;
|
||||||
case RUNNER_SAVE_STATE:
|
case RUNNER_SAVE_STATE:
|
||||||
vf = GBAGetState(runner->context.gba, 0, ((int) item->data) >> 16, true);
|
vf = GBAGetState(runner->context.gba, runner->context.dirs.state, ((int) item->data) >> 16, true);
|
||||||
if (vf) {
|
if (vf) {
|
||||||
GBASaveStateNamed(runner->context.gba, vf, SAVESTATE_SCREENSHOT);
|
GBASaveStateNamed(runner->context.gba, vf, SAVESTATE_SCREENSHOT);
|
||||||
vf->close(vf);
|
vf->close(vf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RUNNER_LOAD_STATE:
|
case RUNNER_LOAD_STATE:
|
||||||
vf = GBAGetState(runner->context.gba, 0, ((int) item->data) >> 16, false);
|
vf = GBAGetState(runner->context.gba, runner->context.dirs.state, ((int) item->data) >> 16, false);
|
||||||
if (vf) {
|
if (vf) {
|
||||||
GBALoadStateNamed(runner->context.gba, vf, SAVESTATE_SCREENSHOT);
|
GBALoadStateNamed(runner->context.gba, vf, SAVESTATE_SCREENSHOT);
|
||||||
vf->close(vf);
|
vf->close(vf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RUNNER_SCREENSHOT:
|
case RUNNER_SCREENSHOT:
|
||||||
GBATakeScreenshot(runner->context.gba, 0);
|
GBATakeScreenshot(runner->context.gba, runner->context.dirs.screenshot);
|
||||||
break;
|
break;
|
||||||
case RUNNER_CONFIG:
|
case RUNNER_CONFIG:
|
||||||
GBAGUIShowConfig(runner, runner->configExtra, runner->nConfigExtra);
|
GBAGUIShowConfig(runner, runner->configExtra, runner->nConfigExtra);
|
||||||
|
|
Loading…
Reference in New Issue