makefile
Code: Select all
TARGET = test
OBJS = main.o pshimg_user.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR =
LDFLAGS =
LIBS = -lpsppower -lpspkubridge -lpspctrl -lpspkernel
PSP_FW_VERSION = 500
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Playstation Image test
BUILD_PRX = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <stdio.h>
#include "pshn-img.h"
#include <pspctrl.h>
#include "kubridge.h"
PSP_MODULE_INFO("pshimg-test", 0, 1, 1);
#define printf pspDebugScreenPrintf
int LoadStartModule(char *module, int partition)
{
SceUID mod = kuKernelLoadModule(module, 0, NULL);
if (mod < 0)
return mod;
return sceKernelStartModule(mod, 0, NULL, NULL, NULL);
}
int onPress(int flag){
while(1)
{
SceCtrlData pad;
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & flag)
{
break;
}
}
return 1;
}
int main(int argc, char argv[])
{
pspDebugScreenInit();
SceUID mod = LoadStartModule("pshimg.prx", 0);
if(mod < 0){
printf("Error: Couldnt Start PRX pshimg.prx (0x%08x)\n", mod);
sceKernelExitGame();
}
printf("Now testing TEST.PSHIMG\n");
SceUID fd = sceIoOpen("test.pshimg", PSP_O_RDONLY, 777);
if(pshnInit(fd, 0) == 1){
printf("TEST.PSHIMG is now verify as a image file\n\n");
printf("Version: 0x%08x\n", header.version);
printf("Image Title: %s\n\n", header.title);
printf("Now Reading Files blocks\n");
pshnLoadSection(fd);
printf("Reading Complete\n");
printf("Filename\tSize\n");
int i, j;
for(i = 0;i<10;i++){
for(j=0;j<10;j++){
printf("%s\t%d\n", section[i].filename[j], section[i].size[j]);
if(section[i].size[j] == 0){
break;
}
}
}
}
printf("Press X to exit\n");
onPress(PSP_CTRL_CROSS);
sceKernelExitGame();
return 0;
}