I am having dome trouble saving an image loaded from oslib to a savedata file.
Code: Select all
int end = 0;
char gameTitle[50] = "LPHMv2";
char gameID[10] = "HM";
char saveName[10] = "HM";
char nameList[][20] = // End list with ""
{
"0000",
"0001",
"0002",
"0003",
"0004",
"0005",
"0006",
"0007",
"0008",
"0009",
"0010",
""
};
char data[256] = "someData: 50";
struct oslSaveLoad saveLoadData;
int type = OSL_DIALOG_NONE;
int skip = 0;
char message[256] = "";
char loadedData[256] = "";
OSL_IMAGE *img = oslLoadImageFilePNG("ms0:/test.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
memset(&saveLoadData, 0, sizeof(saveLoadData));
strcpy(saveLoadData.gameTitle, gameTitle);
strcpy(saveLoadData.gameID, gameID);
strcpy(saveLoadData.saveName, saveName);
saveLoadData.nameList = nameList;
saveLoadData.pic1 = (unsigned char *)img->data;
saveLoadData.size_pic1 = img->totalSize;
saveLoadData.data = data;
saveLoadData.dataSize = 256;
oslInitSaveDialog(&saveLoadData);
memset(message, 0, sizeof(message));
while(end == 0){
type = oslGetSaveLoadType();
if (!skip){
oslStartDrawing();
if (type != OSL_DIALOG_NONE){
oslDrawSaveLoad();
if (oslGetLoadSaveStatus() == PSP_UTILITY_DIALOG_NONE){
if (oslSaveLoadGetResult() == OSL_SAVELOAD_CANCEL)
sprintf(message, "Cancel");
else if (type == OSL_DIALOG_SAVE)
sprintf(message, "%s", (char *)saveLoadData.data);
oslEndSaveLoadDialog();
end = 1;
}
}
oslEndDrawing();
}
oslEndFrame();
skip = oslSyncFrame();
}
regards
Homemister