first commit

This commit is contained in:
Dan Peori
2010-10-18 12:54:49 -03:00
commit 8a3bef9012
612 changed files with 74685 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
TARGET = main
OBJS = main.o decrypt.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspchnnlsv
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Save Decrypt Sample
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
main.c : decrypt.h
decrypt.c : decrypt.h

View File

@@ -0,0 +1,5 @@
This sample uses the sceChnnlsv module directly to do savegame
decryption. It currently works only in VSH mode (e.g., via the TIFF
exploit). It can handle both old and new format saves (SaveParam
structure sizes 0x5c8, 0x5dc, 0x600). New format saves require a
game-specific encryption key.

View File

@@ -0,0 +1,162 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* decrypt.c - Decryption routines using sceChnnlsv
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: decrypt.c 1562 2005-12-10 20:52:45Z jim $
*/
#include "decrypt.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <pspchnnlsv.h>
unsigned int align16(unsigned int v)
{
return ((v + 0xF) >> 4) << 4;
}
/* Read, decrypt, and write a savedata file. See main.c for example usage. */
int decrypt_file(const char *decrypted_filename,
const char *encrypted_filename,
const unsigned char *gamekey)
{
FILE *in, *out;
int len, aligned_len;
unsigned char *data, *cryptkey;
int retval;
/* Open file and get size */
if ((in = fopen(encrypted_filename, "r")) == NULL) {
retval = -1;
goto out;
}
fseek(in, 0, SEEK_END);
len = ftell(in);
fseek(in, 0, SEEK_SET);
if (len <= 0) {
retval = -2;
goto out1;
}
/* Allocate buffers */
aligned_len = align16(len);
if ((data = (unsigned char *) memalign(0x10, aligned_len)) == NULL) {
retval = -3;
goto out1;
}
if ((cryptkey = (unsigned char *) memalign(0x10, 0x10)) == NULL) {
retval = -4;
goto out2;
}
/* Fill buffers */
if (gamekey != NULL)
memcpy(cryptkey, gamekey, 0x10);
memset(data + len, 0, aligned_len - len);
if (fread(data, 1, len, in) != len) {
retval = -5;
goto out3;
}
/* Do the decryption */
if ((retval = decrypt_data( gamekey ? 3 : 1,
data, &len, &aligned_len,
gamekey ? cryptkey : NULL)) < 0) {
retval -= 100;
goto out3;
}
/* Write the data out. decrypt_data has set len correctly. */
if ((out = fopen(decrypted_filename, "w")) == NULL) {
retval = -6;
goto out3;
}
if (fwrite(data, 1, len, out) != len) {
retval = -7;
goto out4;
}
/* All done. Return file length. */
retval = len;
out4:
fclose(out);
out3:
free(cryptkey);
out2:
free(data);
out1:
fclose(in);
out:
return retval;
}
/* Do the actual hardware decryption.
mode is 3 for saves with a cryptkey, or 1 otherwise
data, dataLen, and cryptkey must be multiples of 0x10.
cryptkey is NULL if mode == 1.
*/
int decrypt_data(unsigned int mode,
unsigned char *data,
int *dataLen,
int *alignedLen,
unsigned char *cryptkey)
{
pspChnnlsvContext1 ctx1;
pspChnnlsvContext2 ctx2;
/* Need a 16-byte IV plus some data */
if (*alignedLen <= 0x10)
return -1;
*dataLen -= 0x10;
*alignedLen -= 0x10;
/* Set up buffers */
memset(&ctx1, 0, sizeof(pspChnnlsvContext1));
memset(&ctx2, 0, sizeof(pspChnnlsvContext2));
/* Perform the magic */
if (sceChnnlsv_E7833020(&ctx1, mode) < 0)
return -2;
if (sceChnnlsv_ABFDFC8B(&ctx2, mode, 2, data, cryptkey) < 0)
return -3;
if (sceChnnlsv_F21A1FCA(&ctx1, data, 0x10) < 0)
return -4;
if (sceChnnlsv_F21A1FCA(&ctx1, data + 0x10, *alignedLen) < 0)
return -5;
if (sceChnnlsv_850A7FA1(&ctx2, data + 0x10, *alignedLen) < 0)
return -6;
/* Verify that it decrypted correctly */
if (sceChnnlsv_21BE78B4(&ctx2) < 0)
return -7;
/* If desired, a new file hash from this PSP can be computed now:
if (sceChnnlsv_C4C494F8(ctx1, newhash, cryptkey) < 0)
return -8;
*/
/* The decrypted data starts at data + 0x10, so shift it back. */
memmove(data, data + 0x10, *dataLen);
/* All done */
return 0;
}

View File

@@ -0,0 +1,30 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* decrypt.h - Declarations for functions in decrypt.c
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: decrypt.h 1562 2005-12-10 20:52:45Z jim $
*/
#include <pspchnnlsv.h>
/* Detect the samegame format and decrypt it. See main.c for an example. */
int decrypt_file(const char *decrypted_filename,
const char *encrypted_filename,
const unsigned char *gamekey);
/* Do the actual hardware decryption.
mode is 3 for saves with a cryptkey, or 1 otherwise.
data, alignedLen, and cryptkey must be multiples of 0x10.
cryptkey is NULL if mode == 1.
*/
int decrypt_data(unsigned int mode,
unsigned char *data,
int *dataLen,
int *alignedLen,
unsigned char *cryptkey);

View File

@@ -0,0 +1,100 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* main.c - Sample to demonstrate savedata decryption using sceChnnlsv
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: main.c 1996 2006-09-05 01:31:55Z jim $
*/
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <psptypes.h>
#include <psputility.h>
#include <stdio.h>
#include <string.h>
#include "decrypt.h"
PSP_MODULE_INFO("SaveDecrypt", 0, 1, 1);
#define printf pspDebugScreenPrintf
#if 0
/* Old format save with no key, supported by 1.0+ firmware */
const char *decrypted = "ms0:/PLAIN.BIN";
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
const unsigned char *gamekey = NULL;
#else
/* New format save with a key, supported by 2.0+ firmware */
const char *decrypted = "ms0:/PLAIN.BIN";
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA222220000/DATA.BIN";
const unsigned char gamekey[] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xFA, 0xCA, 0xDE, 0x00, 0xDE, 0xAD, 0xBE, 0xEF
};
#endif
int waitbutton(int mask) {
SceCtrlData paddata;
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while((paddata.Buttons & mask));
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while(!(paddata.Buttons & mask));
return paddata.Buttons;
}
int main(int argc, char *argv[])
{
int i, ret;
pspDebugScreenInit();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
printf("Save Decrypt Sample\n");
printf("by Jim Paris and psp123\n\n");
printf("Will decrypt: %s\n", encrypted);
printf(" Using key:");
if(gamekey) {
for (i = 0; i < 0x10; i++)
printf(" %02x", gamekey[i]);
} else {
printf(" none");
}
printf("\n\n");
printf(" Output file: %s\n\n", decrypted);
printf("Press X to continue, or O to quit.\n\n");
if (waitbutton(PSP_CTRL_CROSS | PSP_CTRL_CIRCLE) & PSP_CTRL_CIRCLE)
goto out;
printf("Working...\n\n");
ret = decrypt_file(decrypted, encrypted, gamekey);
if(ret < 0) {
printf("Error: decrypt_file() returned %d\n\n", ret);
} else {
printf("Successfully wrote %d bytes to\n", ret);
printf(" %s\n\n", decrypted);
}
printf("Press any button to quit\n");
waitbutton(-1);
out:
sceKernelExitGame();
return 0;
}

View File

@@ -0,0 +1,23 @@
TARGET = main
OBJS = main.o encrypt.o hash.o psf.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspchnnlsv
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Save Encrypt Sample
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
main.c : encrypt.h
encrypt.c : encrypt.h hash.h
hash.c : hash.h psf.h
psf.c : psf.h

View File

@@ -0,0 +1,5 @@
This sample uses the sceChnnlsv module directly to do savegame
encryption. It currently works only in VSH mode (e.g., via the TIFF
exploit). It can handle both old and new format saves (SaveParam
structure sizes 0x5c8, 0x5dc, 0x600). New format saves require a
game-specific encryption key.

View File

@@ -0,0 +1,230 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* encrypt.c - Encryption routines using sceChnnlsv
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: encrypt.c 1560 2005-12-10 01:16:32Z jim $
*/
#include "encrypt.h"
#include "hash.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <pspchnnlsv.h>
static inline int align16(unsigned int v)
{
return ((v + 0xF) >> 4) << 4;
}
int fopen_getsize(const char *filename, FILE **fd, int *size)
{
if ((*fd = fopen(filename, "r")) == NULL)
return -1;
fseek(*fd, 0, SEEK_END);
*size = ftell(*fd);
fseek(*fd, 0, SEEK_SET);
if (*size <= 0) {
fclose(*fd);
return -2;
}
return 0;
}
/* Encrypt the given plaintext file, and update the message
authentication hashes in the param.sfo. The data_filename is
usually the final component of encrypted_filename, e.g. "DATA.BIN".
See main.c for an example of usage. */
int encrypt_file(const char *plaintext_filename,
const char *encrypted_filename,
const char *data_filename,
const char *paramsfo_filename,
const unsigned char *gamekey)
{
FILE *in = NULL, *out = NULL, *sfo = NULL;
unsigned char *data = NULL, *cryptkey = NULL, *hash = NULL;
unsigned char paramsfo[0x1330];
int len, aligned_len, tmp;
int retval;
/* Open plaintext and param.sfo files and get size */
if (fopen_getsize(plaintext_filename, &in, &len) < 0) {
retval = -1;
goto out;
}
if (fopen_getsize(paramsfo_filename, &sfo, &tmp) < 0) {
retval = -2;
goto out;
}
/* Verify size of param.sfo; all known saves use this size */
if (tmp != 0x1330) {
retval = -3;
goto out;
}
/* Allocate buffers. data has 0x10 bytes extra for the IV. */
aligned_len = align16(len);
if ((data =
(unsigned char *) memalign(0x10, aligned_len + 0x10)) == NULL) {
retval = -4;
goto out;
}
if ((cryptkey = (unsigned char *) memalign(0x10, 0x10)) == NULL) {
retval = -5;
goto out;
}
if ((hash = (unsigned char *) memalign(0x10, 0x10)) == NULL) {
retval = -6;
goto out;
}
/* Fill buffers. */
memset(data + len, 0, aligned_len - len);
if (fread(data, 1, len, in) != len) {
retval = -7;
goto out;
}
if (fread(paramsfo, 1, 0x1330, sfo) != 0x1330) {
retval = -8;
goto out;
}
if (gamekey != NULL)
memcpy(cryptkey, gamekey, 0x10);
/* Do the encryption */
if ((retval = encrypt_data( gamekey ? 3 : 1,
data,
&len, &aligned_len,
hash,
gamekey ? cryptkey : NULL)) < 0) {
retval -= 1000;
goto out;
}
/* Update the param.sfo hashes */
if ((retval = update_hashes(paramsfo, 0x1330,
data_filename, hash,
gamekey ? 3 : 1)) < 0) {
retval -= 2000;
goto out;
}
/* Write the data to the file. encrypt_data has already set len. */
if ((out = fopen(encrypted_filename, "w")) == NULL) {
retval = -9;
goto out;
}
if (fwrite(data, 1, len, out) != len) {
retval = -10;
goto out;
}
/* Reopen param.sfo, and write the updated copy out. */
fclose(sfo);
if ((sfo = fopen(paramsfo_filename, "w")) == NULL) {
retval = -11;
goto out;
}
if (fwrite(paramsfo, 1, 0x1330, sfo) != 0x1330) {
retval = -12;
goto out;
}
/* All done. Return file length. */
retval = len;
out:
if(out) fclose(out);
if(hash) free(hash);
if(cryptkey) free(cryptkey);
if(data) free(data);
if(sfo) fclose(sfo);
if(in) fclose(in);
return retval;
}
/* Do the actual hardware encryption.
mode is 3 for saves with a cryptkey, or 1 otherwise
data, dataLen, and cryptkey must be multiples of 0x10.
cryptkey is NULL if mode == 1.
*/
int encrypt_data(unsigned int mode,
unsigned char *data,
int *dataLen,
int *alignedLen,
unsigned char *hash,
unsigned char *cryptkey)
{
pspChnnlsvContext1 ctx1;
pspChnnlsvContext2 ctx2;
/* Make room for the IV in front of the data. */
memmove(data + 0x10, data, *alignedLen);
/* Set up buffers */
memset(&ctx1, 0, sizeof(pspChnnlsvContext1));
memset(&ctx2, 0, sizeof(pspChnnlsvContext2));
memset(hash, 0, 0x10);
memset(data, 0, 0x10);
/* Build the 0x10-byte IV and setup encryption */
if (sceChnnlsv_ABFDFC8B(&ctx2, mode, 1, data, cryptkey) < 0)
return -1;
if (sceChnnlsv_E7833020(&ctx1, mode) < 0)
return -2;
if (sceChnnlsv_F21A1FCA(&ctx1, data, 0x10) < 0)
return -3;
if (sceChnnlsv_850A7FA1(&ctx2, data + 0x10, *alignedLen) < 0)
return -4;
/* Clear any extra bytes left from the previous steps */
memset(data + 0x10 + *dataLen, 0, *alignedLen - *dataLen);
/* Encrypt the data */
if (sceChnnlsv_F21A1FCA(&ctx1, data + 0x10, *alignedLen) < 0)
return -5;
/* Verify encryption */
if (sceChnnlsv_21BE78B4(&ctx2) < 0)
return -6;
/* Build the file hash from this PSP */
if (sceChnnlsv_C4C494F8(&ctx1, hash, cryptkey) < 0)
return -7;
/* Adjust sizes to account for IV */
*alignedLen += 0x10;
*dataLen += 0x10;
/* All done */
return 0;
}

View File

@@ -0,0 +1,36 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* encrypt.h - Declarations for functions in encrypt.c
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: encrypt.h 1559 2005-12-10 01:10:11Z jim $
*/
#include <pspchnnlsv.h>
/* Encrypt the given plaintext file, and update the message
authentication hashes in the param.sfo. The data_filename is
usually the final component of encrypted_filename, e.g. "DATA.BIN".
See main.c for an example of usage. */
int encrypt_file(const char *plaintext_filename,
const char *encrypted_filename,
const char *data_filename,
const char *paramsfo_filename,
const unsigned char *gamekey);
/* Do the actual hardware encryption.
mode is 3 for saves with a cryptkey, or 1 otherwise.
data, alignedLen, cryptkey, and hash must be multiples of 0x10.
cryptkey is NULL if mode == 1.
*/
int encrypt_data(unsigned int mode,
unsigned char *data,
int *dataLen,
int *alignedLen,
unsigned char *hash,
unsigned char *cryptkey);

View File

@@ -0,0 +1,128 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* hash.c - Hashing routines using sceChnnlsv
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: hash.c 1560 2005-12-10 01:16:32Z jim $
*/
#include "hash.h"
#include "psf.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <pspchnnlsv.h>
static inline int align16(unsigned int v)
{
return ((v + 0xF) >> 4) << 4;
}
/* Update the hashes in the param.sfo data, using
the given file hash, and by computing the param.sfo hashes.
filehash must be a multiple of 16 bytes, and is reused to
store other hashes. The filename is e.g. "DATA.BIN". */
int update_hashes(unsigned char *data,
int len,
const char *filename,
unsigned char *filehash,
int encryptmode)
{
int alignedLen = align16(len);
unsigned char *datafile, *savedata_params;
int listLen, paramsLen;
int ret;
/* Locate SAVEDATA_PARAM section in the param.sfo. */
if ((ret = find_psf_section("SAVEDATA_PARAMS", data, 0x1330,
&savedata_params, &paramsLen)) < 0) {
return ret - 100;
}
/* Locate the pointer for this DATA.BIN equivalent */
if ((ret = find_psf_section("SAVEDATA_FILE_LIST", data, 0x1330,
&datafile, &listLen)) < 0) {
return ret - 200;
}
if ((ret = find_psf_datafile(filename, datafile,
listLen, &datafile)) < 0) {
return ret - 300;
}
/* Check minimum sizes based on where we want to write */
if ((listLen < 0x20) || (paramsLen < 0x80)) {
return -1;
}
/* Clear params and insert file hash */
memset(savedata_params, 0, paramsLen);
memcpy(datafile + 0x0D, filehash, 0x10);
/* Compute 11D0 hash over entire file */
if ((ret = build_hash(filehash, data, len, alignedLen,
(encryptmode & 2) ? 4 : 2, NULL)) < 0) {
return ret - 400;
}
/* Copy 11D0 hash to param.sfo and set flag indicating it's there */
memcpy(savedata_params + 0x20, filehash, 0x10);
*savedata_params |= 0x01;
/* If new encryption mode, compute and insert the 1220 hash. */
if (encryptmode & 2) {
/* Enable the hash bit first */
*savedata_params |= 0x20;
if ((ret = build_hash(filehash, data, len, alignedLen,
3, 0)) < 0) {
return ret - 500;
}
memcpy(savedata_params + 0x70, filehash, 0x10);
}
/* Compute and insert the 11C0 hash. */
if ((ret = build_hash(filehash, data, len, alignedLen, 1, 0)) < 0) {
return ret - 600;
}
memcpy(savedata_params + 0x10, filehash, 0x10);
/* All done. */
return 0;
}
/* Build a single hash using the given data and mode.
data and alignedLen must be multiples of 0x10.
cryptkey is NULL for savedata. */
int build_hash(unsigned char *output,
unsigned char *data,
unsigned int len,
unsigned int alignedLen,
int mode,
unsigned char *cryptkey)
{
pspChnnlsvContext1 ctx1;
/* Set up buffers */
memset(&ctx1, 0, sizeof(pspChnnlsvContext1));
memset(output, 0, 0x10);
memset(data + len, 0, alignedLen - len);
/* Perform the magic */
if (sceChnnlsv_E7833020(&ctx1, mode & 0xFF) < 0)
return -1;
if (sceChnnlsv_F21A1FCA(&ctx1, data, alignedLen) < 0)
return -2;
if (sceChnnlsv_C4C494F8(&ctx1, output, cryptkey) < 0)
return -3;
/* All done. */
return 0;
}

View File

@@ -0,0 +1,34 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* hash.h - Declarations for functions in hash.c
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: hash.h 1559 2005-12-10 01:10:11Z jim $
*/
#include <pspchnnlsv.h>
/* Update the hashes in the param.sfo data, using
the given file hash, and by computing the param.sfo hashes.
filehash must be a multiple of 16 bytes, and is reused to
store other hashes. The filename is e.g. "DATA.BIN". */
int update_hashes(unsigned char *data,
int len,
const char *filename,
unsigned char *filehash,
int encryptmode);
/* Build a single hash using the given data and mode.
data, and alignedLen must be multiples of 0x10.
cryptkey is NULL for savedata.*/
int build_hash(unsigned char *output,
unsigned char *data,
unsigned int len,
unsigned int alignedLen,
int mode,
unsigned char *cryptkey);

View File

@@ -0,0 +1,107 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* main.c - Sample to demonstrate savedata encryption using sceChnnlsv
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: main.c 1559 2005-12-10 01:10:11Z jim $
*/
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <psptypes.h>
#include <psputility.h>
#include <stdio.h>
#include <string.h>
#include "encrypt.h"
PSP_MODULE_INFO("SaveEncrypt", 0, 1, 1);
#define printf pspDebugScreenPrintf
#if 0
/* Old format save with no key, supported by 1.0+ firmware */
const char *plaintext = "ms0:/PLAIN.BIN";
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
const char *datafile = "DATA.BIN";
const char *paramsfo = "ms0:/PSP/SAVEDATA/DATA111110000/PARAM.SFO";
const unsigned char *gamekey = NULL;
#else
/* New format save with a key (GTA:LCS) */
const char *plaintext = "ms0:/PLAIN.BIN";
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA222220000/DATA.BIN";
const char *datafile = "DATA.BIN";
const char *paramsfo = "ms0:/PSP/SAVEDATA/DATA222220000/PARAM.SFO";
const unsigned char gamekey[] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xFA, 0xCA, 0xDE, 0x00, 0xDE, 0xAD, 0xBE, 0xEF
};
#endif
int waitbutton(int mask) {
SceCtrlData paddata;
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while((paddata.Buttons & mask));
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while(!(paddata.Buttons & mask));
return paddata.Buttons;
}
int main(int argc, char *argv[])
{
int i, ret;
pspDebugScreenInit();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
printf("Save Encrypt Sample\n");
printf("by Jim Paris and psp123\n\n");
printf(" Will encrypt: %s\n", plaintext);
printf(" Using key:");
if(gamekey) {
for (i = 0; i < 0x10; i++)
printf(" %02x", gamekey[i]);
} else {
printf(" none");
}
printf("\n\n");
printf(" Output file: %s\n", encrypted);
printf("Update hashes: %s\n\n", paramsfo);
printf("Press X to continue, or O to quit.\n\n");
if (waitbutton(PSP_CTRL_CROSS | PSP_CTRL_CIRCLE) & PSP_CTRL_CIRCLE)
goto out;
printf("Working...\n\n");
ret = encrypt_file(plaintext, encrypted, datafile, paramsfo, gamekey);
if(ret < 0) {
printf("Error: encrypt_file() returned %d\n\n", ret);
} else {
printf("Successfully wrote %d bytes to\n", ret);
printf(" %s\n", encrypted);
printf("and updated hashes in\n");
printf(" %s\n\n", paramsfo);
}
printf("Press any button to quit\n");
waitbutton(-1);
out:
sceKernelExitGame();
return 0;
}

View File

@@ -0,0 +1,114 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* psf.c - PSF parsing routines
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: psf.c 1560 2005-12-10 01:16:32Z jim $
*/
#include "psf.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <pspchnnlsv.h>
/* Find to the named section in the PSF file, and return an
absolute pointer to it and the section size. */
int find_psf_section(const char *name,
unsigned char *data,
int dataLen,
unsigned char **location,
int *size)
{
unsigned short int nameLoc;
int i, magicHead, strLoc, headLen, numSects;
int sectCurLen, sectBufLen, sectBufLoc, curPos;
if (dataLen < 0x14)
return -1;
/* Get the basics from the header */
magicHead = *(unsigned int *)&data[0x00];
strLoc = *(unsigned int *)&data[0x08];
headLen = *(unsigned int *)&data[0x0C];
numSects = *(unsigned int *)&data[0x10];
/* Do some error checking */
if (magicHead != 0x46535000)
return -2;
/* Verify strLoc is proper */
if ((strLoc > headLen) || (strLoc >= dataLen))
return -3;
/* Verify headLen is proper */
if (headLen >= dataLen)
return -4;
/* Verify numSects is proper */
if (numSects != ((strLoc - 0x14) / 0x10))
return -5;
/* Process all sections */
for (i = 0; i < numSects; i++)
{
/* Get the curPos */
curPos = 0x14 + (i * 0x10);
/* Verify curPos is proper */
if (curPos >= strLoc)
return -6;
/* Get some basic info about this section */
nameLoc = *(unsigned short *)&data[curPos];
sectCurLen = *(unsigned short *)&data[curPos + 0x04];
sectBufLen = *(unsigned short *)&data[curPos + 0x08];
sectBufLoc = *(unsigned short *)&data[curPos + 0x0C];
/* Do some error checking */
if ((nameLoc < dataLen) && (sectCurLen < dataLen)
&& (sectBufLen < dataLen) && (sectBufLoc < dataLen))
{
/* Check if this is the section we want */
if (!stricmp((char *)&data[strLoc + nameLoc], name))
{
/* Update the location and size */
*location = &data[headLen + sectBufLoc];
*size = sectBufLen;
return 0;
}
}
}
/* Section was not found if it makes it here */
return -7;
}
/* Find the named file inside the FILE_LIST, and return
an absolute pointer to it. */
int find_psf_datafile(const char *name,
unsigned char *filelist,
int size,
unsigned char **location)
{
int i;
/* Process all files */
for (i = 0; (i + 0x0d) <= size; i += 0x20)
{
/* Check if this is the filename we want */
if (!strncasecmp((char *)&filelist[i], name, 0x0d)) {
*location = &filelist[i];
return 0;
}
}
/* File was not found if it makes it here */
return -1;
}

View File

@@ -0,0 +1,29 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* psf.h - Declarations for functions in psf.c
*
* Copyright (c) 2005 Jim Paris <jim@jtan.com>
* Coypright (c) 2005 psp123
*
* $Id: psf.h 1559 2005-12-10 01:10:11Z jim $
*/
#include <pspchnnlsv.h>
/* Find the named section in the PSF file, and return an
absolute pointer to it and the section size. */
int find_psf_section(const char *name,
unsigned char *data,
int dataLen,
unsigned char **location,
int *size);
/* Find the named file inside the FILE_LIST, and return
an absolute pointer to it. */
int find_psf_datafile(const char *name,
unsigned char *filelist,
int size,
unsigned char **location);

View File

@@ -0,0 +1,18 @@
TARGET = savedata
OBJS = main.o
# For custom firmware uncomment the following lines:
#PSP_FW_VERSION = 200
#BUILD_PRX = 1
LIBS = -lpsputility -lpspgum -lpspgu -lm
CFLAGS = -O2 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSPSDK Savedata Sample
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

View File

@@ -0,0 +1,314 @@
#ifndef __data__
#define __data__
unsigned int size_icon0 = 1666;
unsigned char icon0[] __attribute__((aligned(16))) = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x50, 0x08, 0x02, 0x00, 0x00, 0x00, 0x79, 0xcc, 0x6b,
0x5b, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xd6, 0xd8, 0xd4, 0x4f, 0x58,
0x32, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72,
0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61,
0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x06, 0x14, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda,
0xec, 0x5c, 0x2d, 0x6c, 0x1c, 0x47, 0x14, 0x7e, 0xae, 0x1c, 0x10, 0x70, 0x07, 0x02, 0x12, 0x70,
0x91, 0x5c, 0x60, 0x10, 0x9f, 0x64, 0x90, 0x00, 0x3b, 0x0a, 0x09, 0x72, 0x55, 0x95, 0x26, 0x20,
0x85, 0x0d, 0x28, 0x4d, 0x81, 0x4d, 0x0d, 0x52, 0xe8, 0x80, 0x1a, 0xd6, 0x20, 0x86, 0x09, 0x88,
0x61, 0x0b, 0x62, 0xd8, 0xb4, 0xb2, 0x0d, 0x5a, 0x10, 0x29, 0x17, 0x10, 0xa9, 0x89, 0x94, 0x03,
0x31, 0x08, 0xb0, 0x41, 0x40, 0x0d, 0xfa, 0x79, 0x47, 0xfb, 0xf4, 0xee, 0x76, 0x77, 0x76, 0x76,
0xf6, 0x7e, 0xf6, 0x92, 0xef, 0xd3, 0x01, 0xeb, 0x6e, 0x67, 0x76, 0xe6, 0x7d, 0xef, 0x7d, 0xf3,
0xde, 0xcc, 0xc8, 0x73, 0xff, 0xca, 0xb7, 0x42, 0xcc, 0x0e, 0xbe, 0xa2, 0x09, 0x48, 0x18, 0x41,
0xc2, 0x08, 0x12, 0x46, 0xc2, 0x08, 0x12, 0x46, 0x90, 0x30, 0x12, 0x46, 0x90, 0x30, 0x82, 0x84,
0x91, 0x30, 0x82, 0x84, 0x11, 0x24, 0x8c, 0x84, 0x11, 0x24, 0x8c, 0x20, 0x61, 0x24, 0x8c, 0x20,
0x61, 0x04, 0x09, 0x23, 0x61, 0x04, 0x09, 0x23, 0x48, 0xd8, 0x17, 0x85, 0xf9, 0x69, 0xbd, 0xf8,
0x95, 0x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 0xdd, 0xcd, 0xf8, 0xae, 0xf7,
0xdc, 0x36, 0xbb, 0xd4, 0xb9, 0xa3, 0x8a, 0xb6, 0xcc, 0x23, 0x88, 0xc3, 0xdb, 0x8e, 0x7b, 0x6a,
0x07, 0xe7, 0x1b, 0x05, 0x67, 0x2e, 0xf2, 0xea, 0xe7, 0xf1, 0x8d, 0x20, 0x8c, 0x68, 0xba, 0x24,
0x12, 0x24, 0x8c, 0x84, 0x11, 0x24, 0x8c, 0x20, 0x61, 0x24, 0x8c, 0x20, 0x61, 0x04, 0x09, 0x23,
0x48, 0x18, 0x09, 0x23, 0x48, 0x18, 0x41, 0xc2, 0x48, 0x18, 0x41, 0xc2, 0x08, 0x12, 0x46, 0xc2,
0x08, 0x12, 0x46, 0x90, 0x30, 0x12, 0x46, 0x90, 0x30, 0x82, 0x84, 0x91, 0x30, 0x82, 0x84, 0x11,
0x24, 0x8c, 0x84, 0x11, 0x24, 0x8c, 0x20, 0x61, 0x5f, 0x12, 0xfe, 0x17, 0x60, 0x00, 0xed, 0xf6,
0x47, 0x4c, 0x1c, 0x54, 0x4d, 0x28, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
0x60, 0x82,
};
unsigned int size_pic1 = 3150;
unsigned char pic1[] __attribute__((aligned(16))) = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x01, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0xe7, 0x24, 0x30,
0xdb, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xd6, 0xd8, 0xd4, 0x4f, 0x58,
0x32, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72,
0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61,
0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x0b, 0xe0, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda,
0xec, 0xdd, 0x7d, 0x56, 0x5b, 0x65, 0x1e, 0xc0, 0xf1, 0xf2, 0x12, 0x42, 0x43, 0x81, 0x14, 0x8a,
0x65, 0x68, 0x3d, 0xe4, 0x74, 0xf4, 0x1f, 0xff, 0x81, 0x59, 0x41, 0xe9, 0x0a, 0xca, 0x0e, 0xc4,
0x15, 0x48, 0x57, 0x50, 0x5c, 0x81, 0xb8, 0x02, 0x71, 0x05, 0xe2, 0x0a, 0x06, 0x56, 0x30, 0xf4,
0xbf, 0x99, 0xe3, 0x51, 0xe9, 0x54, 0x99, 0x62, 0x0b, 0xe5, 0xa5, 0x8d, 0xbc, 0x33, 0xbf, 0x12,
0x45, 0xac, 0x36, 0xf7, 0x42, 0x21, 0xb9, 0x09, 0x9f, 0xcf, 0xc9, 0xe9, 0xa9, 0x1a, 0x20, 0x3c,
0xc4, 0x6f, 0x9e, 0x3c, 0x3c, 0xf7, 0xde, 0x96, 0xe1, 0xc3, 0x8f, 0xae, 0x00, 0x90, 0x3d, 0xad,
0x86, 0x00, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00,
0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x00,
0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40,
0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x40,
0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10,
0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x10,
0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04,
0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x04,
0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81,
0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x00, 0x81,
0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0,
0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x40, 0xa0,
0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68,
0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x20, 0x8b, 0xda, 0x0d, 0x01,
0xa4, 0xb1, 0x35, 0xf7, 0xea, 0xf8, 0xef, 0x9d, 0x63, 0x5d, 0x06, 0x04, 0x81, 0xe6, 0x14, 0x76,
0x16, 0xb6, 0x0e, 0xd6, 0xf6, 0x4f, 0xfe, 0x9b, 0xbd, 0xc5, 0xdd, 0xb8, 0x9d, 0xc8, 0x4a, 0x41,
0x62, 0xaa, 0xdb, 0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, 0x1d, 0xbf, 0x96, 0x54, 0xd9, 0x7a, 0xd1, 0x5a, 0x6c, 0xad, 0xf4, 0x4e, 0xf8, 0x10,
0x68, 0x80, 0xcb, 0xc8, 0x2f, 0x09, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04,
0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81,
0x06, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81,
0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0,
0x01, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68, 0x00, 0x81, 0x06, 0x40, 0xa0,
0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x40, 0xa0, 0x01, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68,
0x00, 0x04, 0x1a, 0x00, 0x81, 0x06, 0x10, 0x68, 0x00, 0x04, 0x1a, 0x40, 0xa0, 0x01, 0x10, 0x68,
0x00, 0x81, 0x36, 0x04, 0x00, 0x02, 0x0d, 0x80, 0x40, 0x03, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x20,
0xd0, 0x00, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x20, 0xd0, 0x00, 0x08, 0x34, 0x80, 0x40, 0x03, 0x20,
0xd0, 0x00, 0x08, 0x34, 0x80, 0x40, 0x03, 0x20, 0xd0, 0x00, 0x02, 0x0d, 0x80, 0x40, 0x03, 0x08,
0x34, 0x00, 0x02, 0x0d, 0x80, 0x40, 0x03, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x20, 0xd0, 0x00, 0x08,
0x34, 0x00, 0x02, 0x0d, 0x20, 0xd0, 0x00, 0x08, 0x34, 0x80, 0x40, 0x03, 0x20, 0xd0, 0x00, 0x02,
0x0d, 0x80, 0x40, 0x03, 0x20, 0xd0, 0x00, 0x02, 0x0d, 0x80, 0x40, 0x03, 0x08, 0x34, 0x00, 0x02,
0x0d, 0x80, 0x40, 0x03, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x20, 0xd0, 0x00, 0x08, 0x34, 0x80, 0x40,
0x03, 0x20, 0xd0, 0x00, 0x08, 0x34, 0x80, 0x40, 0x03, 0x20, 0xd0, 0x00, 0x02, 0x0d, 0x80, 0x40,
0x03, 0x20, 0xd0, 0x00, 0x02, 0x0d, 0x80, 0x40, 0x03, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x80, 0x40,
0x03, 0x08, 0x34, 0x00, 0x02, 0x0d, 0x20, 0xd0, 0x00, 0x08, 0x34, 0x80, 0x40, 0x03, 0x20, 0xd0,
0x00, 0x08, 0x34, 0x40, 0x23, 0xfa, 0xbf, 0x00, 0x03, 0x00, 0x60, 0x2f, 0x3c, 0xc6, 0xbd, 0xc0,
0x07, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
#endif

View File

@@ -0,0 +1,369 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* main.c - Sample to demonstrate how to use savedata utility
*
* Copyright (c) 2005 weltall (weltall@consoleworld.org)
* (c) 2007 InsertWittyName (tias_dp@hotmail.com)
* Based on work by Shine
*
* $Id: main.c 2364 2008-02-16 22:07:09Z iwn $
*/
#include <pspkernel.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <pspmoduleinfo.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <pspgum.h>
#include <psputility.h>
#include <pspctrl.h>
#include "data.h"
PSP_MODULE_INFO("Savedata Sample", 0, 1, 1);
#if _PSP_FW_VERSION >= 200
PSP_HEAP_SIZE_KB(20480);
#endif
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4) /* change this if you change to another screenmode */
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2) /* zbuffer seems to be 16-bit? */
#define DATABUFFLEN 0x20
static int running = 1;
char string[128];
// Exit callback
int exit_callback(int arg1, int arg2, void *common)
{
running = 0;
return 0;
}
// Callback thread
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
// Sets up the callback thread and returns its thread id
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
return thid;
}
// Graphics stuff, based on cube sample
static unsigned int __attribute__((aligned(16))) list[262144];
struct Vertex
{
float u, v;
unsigned int color;
float x, y, z;
};
struct Vertex __attribute__((aligned(16))) vertices[12*3] =
{
{0, 0, 0xff7f0000,-1,-1, 1}, // 0
{1, 0, 0xff7f0000,-1, 1, 1}, // 4
{1, 1, 0xff7f0000, 1, 1, 1}, // 5
{0, 0, 0xff7f0000,-1,-1, 1}, // 0
{1, 1, 0xff7f0000, 1, 1, 1}, // 5
{0, 1, 0xff7f0000, 1,-1, 1}, // 1
{0, 0, 0xff7f0000,-1,-1,-1}, // 3
{1, 0, 0xff7f0000, 1,-1,-1}, // 2
{1, 1, 0xff7f0000, 1, 1,-1}, // 6
{0, 0, 0xff7f0000,-1,-1,-1}, // 3
{1, 1, 0xff7f0000, 1, 1,-1}, // 6
{0, 1, 0xff7f0000,-1, 1,-1}, // 7
{0, 0, 0xff007f00, 1,-1,-1}, // 0
{1, 0, 0xff007f00, 1,-1, 1}, // 3
{1, 1, 0xff007f00, 1, 1, 1}, // 7
{0, 0, 0xff007f00, 1,-1,-1}, // 0
{1, 1, 0xff007f00, 1, 1, 1}, // 7
{0, 1, 0xff007f00, 1, 1,-1}, // 4
{0, 0, 0xff007f00,-1,-1,-1}, // 0
{1, 0, 0xff007f00,-1, 1,-1}, // 3
{1, 1, 0xff007f00,-1, 1, 1}, // 7
{0, 0, 0xff007f00,-1,-1,-1}, // 0
{1, 1, 0xff007f00,-1, 1, 1}, // 7
{0, 1, 0xff007f00,-1,-1, 1}, // 4
{0, 0, 0xff00007f,-1, 1,-1}, // 0
{1, 0, 0xff00007f, 1, 1,-1}, // 1
{1, 1, 0xff00007f, 1, 1, 1}, // 2
{0, 0, 0xff00007f,-1, 1,-1}, // 0
{1, 1, 0xff00007f, 1, 1, 1}, // 2
{0, 1, 0xff00007f,-1, 1, 1}, // 3
{0, 0, 0xff00007f,-1,-1,-1}, // 4
{1, 0, 0xff00007f,-1,-1, 1}, // 7
{1, 1, 0xff00007f, 1,-1, 1}, // 6
{0, 0, 0xff00007f,-1,-1,-1}, // 4
{1, 1, 0xff00007f, 1,-1, 1}, // 6
{0, 1, 0xff00007f, 1,-1,-1}, // 5
};
static void SetupGu()
{
sceGuInit();
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH);
sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH);
sceGuDepthBuffer((void*)0x110000,BUF_WIDTH);
sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
sceGuDepthRange(0xc350,0x2710);
sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
sceGuEnable(GU_SCISSOR_TEST);
sceGuDepthFunc(GU_GEQUAL);
sceGuEnable(GU_DEPTH_TEST);
sceGuFrontFace(GU_CW);
sceGuShadeModel(GU_SMOOTH);
sceGuEnable(GU_CULL_FACE);
sceGuEnable(GU_CLIP_PLANES);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
}
static void DrawStuff(void)
{
static int val = 0;
sceGuStart(GU_DIRECT,list);
// Clear screen
sceGuClearColor(0xff554433);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
// Setup matrices for cube
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
{
ScePspFVector3 pos = { 0, 0, -2.5f };
ScePspFVector3 rot = { val * 0.79f * (M_PI/180.0f), val * 0.98f * (M_PI/180.0f), val * 1.32f * (M_PI/180.0f) };
sceGumRotateXYZ(&rot);
sceGumTranslate(&pos);
}
// Draw cube
sceGuAmbientColor(0xffffffff);
sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,12*3,0,vertices);
sceGuFinish();
sceGuSync(0,0);
val ++;
}
PspUtilitySavedataListSaveNewData newData;
char *titleShow = "New Save";
char nameMultiple[][20] = // End list with ""
{
"0000",
"0001",
"0002",
"0003",
"0004",
""
};
char key[] = "QTAK319JQKJ952HA"; // Key to encrypt or decrypt savedata
void initSavedata(SceUtilitySavedataParam * savedata, int mode)
{
memset(savedata, 0, sizeof(SceUtilitySavedataParam));
savedata->base.size = sizeof(SceUtilitySavedataParam);
savedata->base.language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
savedata->base.buttonSwap = PSP_UTILITY_ACCEPT_CROSS;
savedata->base.graphicsThread = 0x11;
savedata->base.accessThread = 0x13;
savedata->base.fontThread = 0x12;
savedata->base.soundThread = 0x10;
savedata->mode = mode;
savedata->overwrite = 1;
savedata->focus = PSP_UTILITY_SAVEDATA_FOCUS_LATEST; // Set initial focus to the newest file (for loading)
#if _PSP_FW_VERSION >= 200
strncpy(savedata->key, key, 16);
#endif
strcpy(savedata->gameName, "DEMO11111"); // First part of the save name, game identifier name
strcpy(savedata->saveName, "0000"); // Second part of the save name, save identifier name
// List of multiple names
savedata->saveNameList = nameMultiple;
strcpy(savedata->fileName, "DATA.BIN"); // name of the data file
// Allocate buffers used to store various parts of the save data
savedata->dataBuf = malloc(DATABUFFLEN);
savedata->dataBufSize = DATABUFFLEN;
savedata->dataSize = DATABUFFLEN;
// Set some data
if (mode == PSP_UTILITY_SAVEDATA_LISTSAVE)
{
memset(savedata->dataBuf, 0, DATABUFFLEN);
strcpy(savedata->dataBuf,"score: 10");
strcpy(savedata->sfoParam.title,"Title");
strcpy(savedata->sfoParam.savedataTitle,"Title 2");
strcpy(savedata->sfoParam.detail,"Details");
savedata->sfoParam.parentalLevel = 1;
// No icon1
savedata->icon1FileData.buf = NULL;
savedata->icon1FileData.bufSize = 0;
savedata->icon1FileData.size = 0;
savedata->pic1FileData.buf = pic1;
savedata->pic1FileData.bufSize = size_pic1;
savedata->pic1FileData.size = size_pic1;
savedata->icon0FileData.buf = icon0;
savedata->icon0FileData.bufSize = size_icon0;
savedata->icon0FileData.size = size_icon0;
// No snd0
savedata->snd0FileData.buf = NULL;
savedata->snd0FileData.bufSize = 0;
savedata->snd0FileData.size = 0;
// Set title
newData.title = titleShow;
// Set new data
savedata->newData = &newData;
savedata->focus = PSP_UTILITY_SAVEDATA_FOCUS_FIRSTEMPTY; // If saving, set inital focus to the first empty slot
}
}
static void ShowSaveDialog (int mode)
{
SceUtilitySavedataParam dialog;
initSavedata(&dialog, mode);
sceUtilitySavedataInitStart(&dialog);
while(running) {
DrawStuff();
switch(sceUtilitySavedataGetStatus()) {
case PSP_UTILITY_DIALOG_VISIBLE :
sceUtilitySavedataUpdate(1);
break;
case PSP_UTILITY_DIALOG_QUIT :
sceUtilitySavedataShutdownStart();
break;
case PSP_UTILITY_DIALOG_FINISHED :
if(mode == PSP_UTILITY_SAVEDATA_LISTSAVE)
sprintf(string, "Saved: score = 10");
else
sprintf(string, "Loaded: %s\n", (char*)dialog.dataBuf); // The actual data in the savedata file that was saved previously
case PSP_UTILITY_DIALOG_NONE :
return;
}
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
}
}
int main(int argc, char *argv[])
{
SceCtrlData pad;
SetupCallbacks();
SetupGu();
pspDebugScreenInit();
int mode = 0;
memset(string, 0, sizeof(string));
while(running)
{
pspDebugScreenSetXY(0, 0);
pspDebugScreenPrintf("Press X to Save, O to Load\n");
pspDebugScreenPrintf(string);
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
mode = PSP_UTILITY_SAVEDATA_LISTSAVE;
else if(pad.Buttons & PSP_CTRL_CIRCLE)
mode = PSP_UTILITY_SAVEDATA_LISTLOAD;
if(mode)
{
ShowSaveDialog(mode);
pspDebugScreenInit();
mode = 0;
}
}
sceKernelExitGame();
return 0;
}