rendered paste body#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pspiofilemgr.h>
#include <pspdisplay.h>
#include "pspidstor.h"
PSP_MODULE_INFO("IdStorage_Mapper", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
PSP_MAIN_THREAD_STACK_SIZE_KB(32);
#define printf pspDebugScreenPrintf
int mapIDS(void)
{
char buffer[512];
int x;
char y[100];
char z[100];
u16 key;
printf("Start mapIDS\n");
int f = sceIoOpen("ms0:/mapIDSResult.txt", PSP_O_WRONLY | PSP_O_CREAT, 0777);
if (f < 0) return -1;
for(key=0x001;key<0x200;key++)
{
x = sceIdStorageReadLeaf(key, buffer);
if (x < 0) {
printf("Error: Key 0x%03X does not exist.\n", key);
sprintf(y, "Error: Key 0x%03X does not exist.\n", key);
sceIoWrite(f, y, 100);
}
else if (x == 0) {
printf("Success: Key 0x%03X exists.\n", key);
sprintf(z, "Error: Key 0x%03X does not exist.\n", key);
sceIoWrite(f, z, 100);
}
else printf("Unknown error on key 0x%03X.\n", key);
}
printf("Task completed.\n");
sceKernelDelayThread(3000 * 3000);
return 0;
}
int main(void)
{
pspDebugScreenInit();
SceCtrlData psp_pad;
printf(" Press O to map idstorage 0x001 - 0x200 \n");
printf(" 2006 Stapol Contact me at dstapol@hotmail.com \n");
for(;;) {
sceCtrlReadBufferPositive(&psp_pad, 1);
if(psp_pad.Buttons & PSP_CTRL_CIRCLE)
{
pspDebugScreenClear();
int x = mapIDS();
if (x < 0) printf("Unknown Error\n");
else sceKernelExitGame();
}
}
}