All pastes #337606 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-02 22:27 UTC
rendered paste body
/*
 * PSP Software Development Kit - http://www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * main.c - For dump your own Idstorage data .
 *
 * Copyright (c) 2006 Yoshihiro. <yoshihiro@sonyxteam.com>
 *
 * Sample program to dump the contents from idstorage
 * to a ms0:/idstorage.bin and get all hw Info ;=) .
 *
 *Idstorage key 0x041 - PSP USB Hardware Information
 *Idstorage key 0x044 - Your Mac Address 
 *Idstorage key 0x045 - One PSP Unknow region Maybe For the Updater or UMD or GAMES ?
 *Idstorage key 0x050 - Your PSP Serial
 *Idstorage key 0x100 - 106 :  PSP Region Code for the VSH Option and More ^
 *                                                                         | same Key of 512!!
 *Idstorage key 0x120 - 126 :  PSP Region Code for the VSH Option and More v
 * 
 * 
 */
#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();
        }       	
		}
}