screenshot example

This commit is contained in:
Francisco Javier Trujillo Mata
2025-05-13 21:00:45 +02:00
parent 38b8f5f2cc
commit ee30cb2668
2 changed files with 86 additions and 0 deletions

View File

@@ -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

View File

@@ -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 <mrbrown@ocgnet.org>
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
* Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
*
*/
#include <stdlib.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <psptypes.h>
#include <pspdisplay.h>
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);
}