all repos — mgba @ 193d2d1f4aa358b2454016d44cccae8316261b7f

mGBA Game Boy Advance Emulator

PSP2: Screenshots are now saved into the Photo Gallery
Jeffrey Pfau jeffrey@endrift.com
Sun, 21 Aug 2016 20:08:41 -0700
commit

193d2d1f4aa358b2454016d44cccae8316261b7f

parent

34db16b483c8d2714e90b45b8f4620d21d972193

4 files changed, 24 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -68,6 +68,7 @@ - Util: Add Vector GetConstPointer

- Util: Add rtrim - GBA Memory: Optimize Load-/StoreMultiple - 3DS: Adjustable filering + - PSP2: Screenshots are now saved into the Photo Gallery 0.4.1: (2016-07-11) Bugfixes:
M src/core/core.csrc/core/core.c

@@ -21,6 +21,10 @@ #include "gba/core.h"

#include "gba/gba.h" #endif +#ifdef PSP2 +#include <psp2/photoexport.h> +#endif + static struct mCoreFilter { bool (*filter)(struct VFile*); struct mCore* (*open)(void);

@@ -154,7 +158,12 @@ size_t stride;

color_t* pixels = 0; unsigned width, height; core->desiredVideoDimensions(core, &width, &height); - struct VFile* vf = VDirFindNextAvailable(core->dirs.screenshot, core->dirs.baseName, "-", ".png", O_CREAT | O_TRUNC | O_WRONLY); + struct VFile* vf; +#ifndef PSP2 + vf = VDirFindNextAvailable(core->dirs.screenshot, core->dirs.baseName, "-", ".png", O_CREAT | O_TRUNC | O_WRONLY); +#else + vf = VFileMemChunk(0, 0); +#endif bool success = false; if (vf) { core->getVideoBuffer(core, &pixels, &stride);

@@ -162,6 +171,17 @@ png_structp png = PNGWriteOpen(vf);

png_infop info = PNGWriteHeader(png, width, height); success = PNGWritePixels(png, width, height, stride, pixels); PNGWriteClose(png, info); +#ifdef PSP2 + void* data = vf->map(vf, 0, 0); + PhotoExportParam param = { + 0, + NULL, + NULL, + NULL, + { 0 } + }; + scePhotoExportFromData(data, vf->size(vf), &param, NULL, NULL, NULL, NULL, 0); +#endif vf->close(vf); } if (success) {
M src/platform/psp2/CMakeLists.txtsrc/platform/psp2/CMakeLists.txt

@@ -15,7 +15,7 @@

list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c) set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE) -set(OS_LIB -lvita2d -lSceCtrl_stub -lScePgf_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceCommonDialog_stub -lSceMotion_stub -lScePower_stub -lSceSysmodule_stub -lSceTouch_stub -l${M_LIBRARY}) +set(OS_LIB -lvita2d -lSceAppMgr_stub -lSceCtrl_stub -lScePgf_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceCommonDialog_stub -lSceMotion_stub -lScePhotoExport_stub -lScePower_stub -lSceSysmodule_stub -lSceTouch_stub -l${M_LIBRARY}) set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm) list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
M src/platform/psp2/main.csrc/platform/psp2/main.c

@@ -153,6 +153,7 @@ };

sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE); + sceSysmoduleLoadModule(SCE_SYSMODULE_PHOTO_EXPORT); mGUIInit(&runner, "psvita");