Code: Select all
#include <pspkernel.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("MSUpdate", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
static int bufferwidth, pixelformat, unk, fd;
static u32* vram32;
static char cancel, format[512];
void add_log(const char* Text)
{
fd = sceIoOpen("ms0:/msupdate.txt", PSP_O_WRONLY | PSP_O_APPEND, 0777);
sceIoWrite(fd,Text,strlen(Text));
sceIoWrite(fd,"\n",strlen("\n"));
sceIoClose(fd);
}
int loop(SceSize args, void *argp)
{
add_log("Waiting");
sceKernelDelayThread(1000*5000);
add_log("Loop");
while(!cancel)
{
sceDisplayWaitVblankStart();
sceDisplayGetFrameBuf((void*)&vram32, &bufferwidth, &pixelformat, &unk);
if(bufferwidth!=0)
{
int x; int y;
for (x=0;x<20;x++)
{
for (y=0;y<20;y++)
{
vram32[x + y*bufferwidth] = 0xffff00ff;
}
}
} else {
sprintf(format,"Buffer-Width: %i, %i",bufferwidth, pixelformat);
add_log(format);
add_log("Error");
cancel=1;
}
}
add_log("Quit");
return 0;
}
int module_start(int argc, char **argv)
{
fd = sceIoOpen("ms0:/msupdate.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
sceIoClose(fd);
add_log("MSUpdate 0.1");
int thid = sceKernelCreateThread("MSUpdate", loop, 0x20, 0x1000, 0, 0);
sprintf(format,"Thread: %i",thid);
add_log(format);
if(thid >= 0) sceKernelStartThread(thid, 0, 0);
return 0;
}
Code: Select all
TARGET = msupdate
OBJS = main.o
BUILD_PRX=1
PRX_EXPORTS=exports.exp
USE_KERNEL_LIBS = 1
USE_KERNEL_LIBC = 1
LIBS = -lpspkernel
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS = -nostdlib -nodefaultlibs
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
MSUpdate 0.1
Thread: 73806443
Waiting
Loop
Buffer-Width: 0, 0
Error
Quit
GetVideoMode returns 480x272 so there doesnt seem to be a problem with the display calls in general.
The whole thing is running on 3.71 M33 (PSP1000) and 3.71 M33 (PSP2000), both having the same problem. Any ideas?
//Edit: This is supposed to draw a 20x20px box on the screen starting at the upper left corner in the XMB. It is loaded using the Recovery menu -> Plugins from VSH.txt