diff --git a/src/samples/debug/screenshot/Makefile.sample b/src/samples/debug/screenshot/Makefile.sample new file mode 100644 index 00000000..1421d31a --- /dev/null +++ b/src/samples/debug/screenshot/Makefile.sample @@ -0,0 +1,17 @@ +TARGET = screenshot +OBJS = main.o + +INCDIR = +CFLAGS = -O2 -Wall +CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti +ASFLAGS = $(CFLAGS) + +LIBDIR = +LDFLAGS = +LIBS= + +EXTRA_TARGETS = EBOOT.PBP +PSP_EBOOT_TITLE = Screenshot Test + +PSPSDK=$(shell psp-config --pspsdk-path) +include $(PSPSDK)/lib/build.mak diff --git a/src/samples/debug/screenshot/main.c b/src/samples/debug/screenshot/main.c new file mode 100644 index 00000000..3d9e0b6f --- /dev/null +++ b/src/samples/debug/screenshot/main.c @@ -0,0 +1,69 @@ +/* + * PSP Software Development Kit - https://github.com/pspdev + * ----------------------------------------------------------------------- + * Licensed under the BSD license, see LICENSE in PSPSDK root for details. + * + * main.c - Basic sample to demonstrate the kprintf handler. + * + * Copyright (c) 2005 Marcus R. Brown + * Copyright (c) 2005 James Forshaw + * Copyright (c) 2005 John Kelley + * + */ + +#include +#include +#include +#include +#include + +PSP_MODULE_INFO("Screenshot Sample", 0, 1, 1); +PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER); + +/* Exit callback */ +int exit_callback(int arg1, int arg2, void *common) +{ + exit(0); + return 0; +} + +/* Callback thread */ +int CallbackThread(SceSize args, void *argp) +{ + int cbid; + + cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); + sceKernelRegisterExitCallback(cbid); + + sceKernelSleepThreadCB(); + + return 0; +} + +/* Sets up the callback thread and returns its thread id */ +int SetupCallbacks(void) +{ + int thid = 0; + + thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0); + if(thid >= 0) + { + sceKernelStartThread(thid, 0, 0); + } + + return thid; +} + +int main(void) +{ + pspDebugScreenInit(); + SetupCallbacks(); + + pspDebugScreenSetTextColor(0xFF); + pspDebugScreenPrintf("\n\n\n\n\n******************** Screenshot Sample *********************\n\n\n\n"); + + sceDisplayWaitVblankStart(); + pspScreenshotSave("screenshot.bmp"); + + while(1); +} \ No newline at end of file