Skip to content

Commit ee30cb2

Browse files
committed
screenshot example
1 parent 38b8f5f commit ee30cb2

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
TARGET = screenshot
2+
OBJS = main.o
3+
4+
INCDIR =
5+
CFLAGS = -O2 -Wall
6+
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
7+
ASFLAGS = $(CFLAGS)
8+
9+
LIBDIR =
10+
LDFLAGS =
11+
LIBS=
12+
13+
EXTRA_TARGETS = EBOOT.PBP
14+
PSP_EBOOT_TITLE = Screenshot Test
15+
16+
PSPSDK=$(shell psp-config --pspsdk-path)
17+
include $(PSPSDK)/lib/build.mak
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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

Comments
 (0)