1+ /*
2+ * PSP Software Development Kit - https://github.com/pspdev
3+ * -----------------------------------------------------------------------
4+ * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5+ *
6+ * main.c - Basic sample to demonstrate the kprintf handler.
7+ *
8+ * Copyright (c) 2005 Marcus R. Brown <[email protected] > 9+ * Copyright (c) 2005 James Forshaw <[email protected] > 10+ * Copyright (c) 2005 John Kelley <[email protected] > 11+ *
12+ */
13+
14+ #include <stdlib.h>
15+ #include <pspkernel.h>
16+ #include <pspdebug.h>
17+ #include <psptypes.h>
18+ #include <pspdisplay.h>
19+
20+ PSP_MODULE_INFO ("Screenshot Sample" , 0 , 1 , 1 );
21+ PSP_MAIN_THREAD_ATTR (THREAD_ATTR_USER );
22+
23+ /* Exit callback */
24+ int exit_callback (int arg1 , int arg2 , void * common )
25+ {
26+ exit (0 );
27+ return 0 ;
28+ }
29+
30+ /* Callback thread */
31+ int CallbackThread (SceSize args , void * argp )
32+ {
33+ int cbid ;
34+
35+ cbid = sceKernelCreateCallback ("Exit Callback" , exit_callback , NULL );
36+ sceKernelRegisterExitCallback (cbid );
37+
38+ sceKernelSleepThreadCB ();
39+
40+ return 0 ;
41+ }
42+
43+ /* Sets up the callback thread and returns its thread id */
44+ int SetupCallbacks (void )
45+ {
46+ int thid = 0 ;
47+
48+ thid = sceKernelCreateThread ("update_thread" , CallbackThread , 0x11 , 0xFA0 , THREAD_ATTR_USER , 0 );
49+ if (thid >= 0 )
50+ {
51+ sceKernelStartThread (thid , 0 , 0 );
52+ }
53+
54+ return thid ;
55+ }
56+
57+ int main (void )
58+ {
59+ pspDebugScreenInit ();
60+ SetupCallbacks ();
61+
62+ pspDebugScreenSetTextColor (0xFF );
63+ pspDebugScreenPrintf ("\n\n\n\n\n******************** Screenshot Sample *********************\n\n\n\n" );
64+
65+ sceDisplayWaitVblankStart ();
66+ pspScreenshotSave ("screenshot.bmp" );
67+
68+ while (1 );
69+ }
0 commit comments