#include #include #include #include #include #include #include #include #include "pspidstor.h" PSP_MODULE_INFO("IdStorage_Mapper", 0x1000, 1, 1); PSP_MAIN_THREAD_ATTR(0); #define printf pspDebugScreenPrintf int BackupKeyToFile(u16 key, char filepath[50]) { char dumpbuff[512]; memset(dumpbuff, 0, 512); int f = sceIoOpen(filepath, PSP_O_WRONLY | PSP_O_CREAT, 0777); if (f < 0) return -1; sceIdStorageReadLeaf(key, dumpbuff); sceIoWrite(f, dumpbuff, 0x200); sceIoClose(f); return 0; } int mapIDS(void) { char buffer[512]; int x; char y[33]; char z[33]; char a[50]; u16 key; printf("Starting mapIDS.. Please wait while loading...\n"); sceKernelDelayThread(1000 * 1000); sceIoMkdir("ms0:/mapIDS", 0777); int f = sceIoOpen("ms0:/mapIDS/mapIDSSuccess.txt", PSP_O_WRONLY | PSP_O_CREAT, 0777); if (f < 0) return -1; int g = sceIoOpen("ms0:/mapIDS/mapIDSError.txt", PSP_O_WRONLY | PSP_O_CREAT, 0777); if (g < 0) return -1; for(key=0x0001;key<0x9999;key++) { x = sceIdStorageReadLeaf(key, buffer); if (x < 0) { printf("Error: Key 0x%04X does not exist.\n", key); sprintf(y, "Error: Key 0x%04X does not exist.\n", key); sceIoWrite(g, y, 32); } else if (x == 0) { printf("Success: Key 0x%04X exists.\n", key); sprintf(z, "Success: Key 0x%04X DOES exist.\n", key); sprintf(a, "ms0:/mapIDS/0x%04X.bin", key); BackupKeyToFile(key, a); sceIoWrite(f, z, 30); } else printf("Unknown error on key 0x%04X.\n", key); } printf("Task completed.\n"); sceIoClose(f); sceIoClose(g); sceKernelDelayThread(3000 * 3000); return 0; } int main(void) { pspDebugScreenInit(); SceCtrlData psp_pad; printf(" Press O to map idstorage 0x0001 - 0x9999 dumping correct keys.\n"); printf(" 2006 Stapol Contact me at dstapol@hotmail.com for questions \n"); for(;;) { sceCtrlReadBufferPositive(&psp_pad, 1); if(psp_pad.Buttons & PSP_CTRL_CIRCLE) { pspDebugScreenClear(); int x = mapIDS(); if (x < 0) printf("Unknown Error initialising logs..\n"); else sceKernelExitGame(); } } }