forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Savedata Structure on 2.0+ Games

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
shell



Joined: 03 Apr 2007
Posts: 7
Location: NYC

PostPosted: Tue Apr 03, 2007 6:18 am    Post subject: Savedata Structure on 2.0+ Games Reply with quote

Put simply, I want to make a program which can modify various traits and attributes of the Syphon Filter savedata. Before you flame me I have read up at jimparis's thread and plan to borrow some code from that sample (with credit). However, I have also read at some other thread that this code does not function on 3.0+. Is this true? What if the program is run on 3.03 OE-C with the 1.50 kernel option for homebrew? Also, how would I be able to extract the gamekey from the game ISO?

Thanks,
Shell
Back to top
View user's profile Send private message Visit poster's website AIM Address
shell



Joined: 03 Apr 2007
Posts: 7
Location: NYC

PostPosted: Tue Apr 03, 2007 7:06 am    Post subject: Reply with quote

I have made a rough, unchecked, uncompiled draft. First I consolidated encrypt.c, decrypt.c, hash.c and psf.c into one large file called cryptfuncs.h. I know that this does not delete the temporary DEC.BIN in the memory stick root but I want to keep it like that until release so I can do debugging in the meanwhile after I get the things like the gamekey that I need to get this off the ground.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>

#include "cryptfuncs.h"

PSP_MODULE_INFO("SyphonFilter Savegame Tweaker", 0, 1, 1);

#define printf pspDebugScreenPrintf

int exit_callback(int arg1, int arg2, void *common)
{
   sceKernelExitGame();
   return 0;
}

int CallbackThread(SceSize args, void *argp)
{
   int cbid;

   cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
   sceKernelRegiste\rExitCallback(cbid);

   sceKernelSleepThreadCB();

   return 0;
}

int SetupCallbacks(void)
{
   int thid = 0;

   thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
   if(thid >= 0) {
      sceKernelStartThread(thid, 0, 0);
   }

   return thid;
}

const char *temp_bin = "ms0:/DEC.BIN";
const char *prefix = "ms0:/PSP/SAVEDATA/UCUS98641"; // append save number (ex. 0000)
const unsigned char gamekey[] = { 0x00 }; // need to wait on this one.

int main(int argc, char *argv[])
{
   bool satisfied = false;
   int i = 0;
   char *savename = (char *)calloc(strlen(prefix) + 4 + strlen("/DATA.BIN") + 1, sizeof(char));
   char *sfoname = (char *)calloc(strlen(prefix) + 4 + strlen("/PARAM.SFO") + 1, sizeof(char));

   pspDebugScreenInit();
   SetupCallbacks();

   SceCtrlData pad;

   while(satisfied == false)
   {
      printf("SyphonFilter Savegame Tweaker\n\nSavegame #: %d\nPress Triangle to increase and X to decrease\nPress O when ready.\n", num);
      sceCtrlReadBufferPositive(&pad, 1);
      if(pad.Buttons & PSP_CTRL_TRIANGLE)
      {
         if(i < 9999)
         ++i;
      else if(pad.Buttons & PSP_CTRL_CROSS)
      {
         if(i > 0)
            --i;
      }
      else if(pad.Buttons & PSP_CTRL_CIRCLE)
         satisfied = true;
   }

   pspDebugScreenClear();

   sprintf(savename, "%s%.4d/DATA.BIN%c", prefix, i, NULL);
   sprintf(sfoname, "%s%.4d/PARAM.SFO%c", prefix, i, NULL);

   i = decrypt_file(temp_bin, savename, gamekey);
   
   if(i < 0)
   {
      printf("There was an error in decoding, (code %d)\n", i);
      pspDebugScreenClear();
      sceKernelSleepThread();
      return 0;
   }

   // do tweaking/editing of DEC.BIN here

   i = encrypt_file(temp_bin, savename, "DATA.BIN", sfoname, gamekey);

   if(i < 0)
   {
      printf("There was an error in encoding, (code %d)\n", i);
      pspDebugScreenClear();
      sceKernelSleepThread();
      return 0;
   }

   printf("Done.\n"

   pspDebugScreenClear();

   sceKernelSleepThread();

   return 0;
}
Back to top
View user's profile Send private message Visit poster's website AIM Address
shell



Joined: 03 Apr 2007
Posts: 7
Location: NYC

PostPosted: Tue Apr 03, 2007 12:37 pm    Post subject: Reply with quote

Come on people! It's been hours! Does anyone know how to get the gamekey from a ISO to use for decrypting saves?!?!
Back to top
View user's profile Send private message Visit poster's website AIM Address
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Apr 03, 2007 3:45 pm    Post subject: Reply with quote

Decrypting saves it not something we support and surely it is up to you to find the key it isn't very difficult :)
Back to top
View user's profile Send private message
shell



Joined: 03 Apr 2007
Posts: 7
Location: NYC

PostPosted: Wed Apr 04, 2007 2:13 am    Post subject: Reply with quote

I tried this PRX which hooks a savedata function to get the key but the call that it hooks is broken in 3.0+. Could you key it for me?
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group