mirror of https://github.com/mgba-emu/mgba.git
PSP2: Screenshots are now saved into the Photo Gallery
This commit is contained in:
parent
34db16b483
commit
193d2d1f4a
1
CHANGES
1
CHANGES
|
@ -68,6 +68,7 @@ Misc:
|
|||
- 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:
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#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 @@ void mCoreTakeScreenshot(struct mCore* core) {
|
|||
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 @@ void mCoreTakeScreenshot(struct mCore* core) {
|
|||
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), ¶m, NULL, NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
vf->close(vf);
|
||||
}
|
||||
if (success) {
|
||||
|
|
|
@ -15,7 +15,7 @@ source_group("PS Vita-specific code" FILES ${OS_SRC})
|
|||
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)
|
||||
|
|
|
@ -153,6 +153,7 @@ int main() {
|
|||
|
||||
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE);
|
||||
sceSysmoduleLoadModule(SCE_SYSMODULE_PHOTO_EXPORT);
|
||||
|
||||
mGUIInit(&runner, "psvita");
|
||||
|
||||
|
|
Loading…
Reference in New Issue