Core: Migrate extdata to core
Jeffrey Pfau jeffrey@endrift.com
Sat, 28 May 2016 16:25:01 -0700
1 files changed,
8 insertions(+),
3 deletions(-)
jump to
M
src/feature/gui/gui-runner.c
→
src/feature/gui/gui-runner.c
@@ -8,6 +8,7 @@
#include "core/core.h" #include "core/serialize.h" #include "feature/gui/gui-config.h" +#include "gba/gba.h" #include "gba/input.h" #include "gba/interface.h" #include "util/gui/file-select.h"@@ -64,9 +65,11 @@ gbaBackground->p->drawScreenshot(gbaBackground->p, gbaBackground->screenshot, true);
return; } struct VFile* vf = mCoreGetState(gbaBackground->p->core, stateId, false); + unsigned w, h; + gbaBackground->p->core->desiredVideoDimensions(gbaBackground->p->core, &w, &h); uint32_t* pixels = gbaBackground->screenshot; if (!pixels) { - pixels = anonymousMemoryMap(VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4); + pixels = anonymousMemoryMap(w * h * 4); gbaBackground->screenshot = pixels; } bool success = false;@@ -76,7 +79,7 @@ png_infop info = png_create_info_struct(png);
png_infop end = png_create_info_struct(png); if (png && info && end) { success = PNGReadHeader(png, info); - success = success && PNGReadPixels(png, info, pixels, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, VIDEO_HORIZONTAL_PIXELS); + success = success && PNGReadPixels(png, info, pixels, w, h, w); success = success && PNGReadFooter(png, end); } PNGReadClose(png, info, end);@@ -376,7 +379,9 @@ }
runner->core->unloadROM(runner->core); drawState.screenshotId = 0; if (drawState.screenshot) { - mappedMemoryFree(drawState.screenshot, VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4); + unsigned w, h; + runner->core->desiredVideoDimensions(runner->core, &w, &h); + mappedMemoryFree(drawState.screenshot, w * h * 4); } if (runner->core->config.port) {