OSLib Save data

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
homemister
Posts: 25
Joined: Mon Mar 24, 2008 12:16 pm

OSLib Save data

Post by homemister »

hey all,
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();

    }
could anyone help?
regards
Homemister
Post Reply