I wanted to update all 3 ports (hexen, heretic, doom) with PSP's system functions, and i discovered bug in SceUtilitySavedataParam, i found correct things in memory of original game, there is fix:
Code: Select all
typedef struct SceUtilitySavedataParam
{
pspUtilityDialogCommon base;
/** mode: 0 to load, 4 to load menu, 1 to save, 5 to save menu*/
// Save/Load menu is that, you can choose from list of saves to save/load
int mode;
int unknown12;
/** unknown13 use 1 */
int unknown13;
/** gameName: name used from the game for saves, equal for all saves */
char gameName[16];
/** saveName: name of the particular save, normally a number */
char saveName[20]; // THIS IS FIX - only 20
char *saveNames; // THIS IS NEW - For save/load menu (see example)
/** fileName: name of the data file of the game for example DATA.BIN */
char fileName[16];
/** pointer to a buffer that will contain data file unencrypted data */
void *dataBuf;
/** size of allocated space to dataBuf */
SceSize dataBufSize;
SceSize dataSize;
PspUtilitySavedataSFOParam sfoParam;
PspUtilitySavedataFileData icon0FileData;
PspUtilitySavedataFileData icon1FileData;
PspUtilitySavedataFileData pic1FileData;
PspUtilitySavedataFileData snd0FileData;
unsigned char unknown17[4];
} SceUtilitySavedataParam;
dont set saveName[20], but set savenames:
Code: Select all
typedef struct // you can use more names, but terminator must exist, and must be full of 0
{
char name1[20];
char name2[20];
char name3[20];
char name4[20];
char name5[20];
char nothing[20]; // Terminator
} savenames_t;
in code:
savenames_t savenames;
memset(&savenames, 0, sizeof(savenames));
sprintf(savenames.name1,"s1");
sprintf(savenames.name2,"s2");
sprintf(savenames.name3,"s3");
sprintf(savenames.name4,"s4");
sprintf(savenames.name5,"s5");
SceUtilitySavedataParam data;
memset(&data, 0, sizeof(data));
data.base.size = sizeof(data);
data.base.language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
data.base.buttonSwap = PSP_UTILITY_ACCEPT_CROSS;
data.base.graphicsThread = 17;
data.base.unknown = 19;
data.base.fontThread = 18;
data.base.soundThread = 16;
data.mode = 5; // now saving menu
data.unknown13 = 1;
sprintf(data.gameName,"SOME-NAME");
data.saveNames = &savenames; // <------- this is new
sprintf(data.fileName,"DATA.BIN");
data.dataBuf = savebuffer;
data.dataBufSize = sizeof(savebuffer);
data.dataSize = sizeof(savebuffer);
sprintf(data.sfoParam.title,"Game Title");
sprintf(data.sfoParam.savedataTitle,"Save Title");
sprintf(data.sfoParam.detail,"Save details");