diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 8f829fa..af67b2d 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,9 +1,10 @@ Version MOD 1.0.1 ----------------- -Added: Support for UTF-8 with intraFont (many thanks to nextos!!!) + Use INTRAFONT_STRING_UTF8 to init intraFont -Fixed: corrupted graphic using intraFont -Fixed: MP3/ATRAC3+ playback under kernel 3.xx (sorry, I didn't test it before) --Fixed: crash in MP3 playback after some seconds +-Fixed: crash in MP3 playback after some seconds (many thanks to Drakon for reporting and testing) -Fixed: message boxes work now. diff --git a/README.TXT b/README.TXT index a8325a1..feae6fd 100644 --- a/README.TXT +++ b/README.TXT @@ -37,4 +37,4 @@ THANKS ------ InsertWittyName for all the sdk's dialog samples Brunni for OSLib -Ben Hur for intraFont +BenHur for intraFont diff --git a/dialog.c b/dialog.c index 4bd810d..66456bc 100644 --- a/dialog.c +++ b/dialog.c @@ -91,6 +91,7 @@ void oslDrawDialog() { if (dialogType == OSL_DIALOG_MESSAGE || dialogType == OSL_DIALOG_ERROR){ switch(sceUtilityMsgDialogGetStatus()) { + case PSP_UTILITY_DIALOG_INIT: case PSP_UTILITY_DIALOG_VISIBLE: sceGuFinish(); sceGuSync(0,0); @@ -107,8 +108,7 @@ void oslDrawDialog() } }else if (dialogType == OSL_DIALOG_NETCONF){ switch(sceUtilityNetconfGetStatus()){ - case PSP_UTILITY_DIALOG_NONE: - break; + case PSP_UTILITY_DIALOG_INIT: case PSP_UTILITY_DIALOG_VISIBLE: sceGuFinish(); sceGuSync(0,0); @@ -118,11 +118,11 @@ void oslDrawDialog() break; case PSP_UTILITY_DIALOG_QUIT: sceUtilityNetconfShutdownStart(); - //dialogType = OSL_DIALOG_NONE; break; + case PSP_UTILITY_DIALOG_NONE: case PSP_UTILITY_DIALOG_FINISHED: break; - } + } } } diff --git a/libosl.a b/libosl.a index a310c97..d2be108 100644 Binary files a/libosl.a and b/libosl.a differ diff --git a/osk.c b/osk.c index e4202b2..b1c81a4 100644 --- a/osk.c +++ b/osk.c @@ -63,8 +63,7 @@ void oslInitOsk(char *descStr, char *initialStr, int textLimit, int linesNumber) void oslDrawOsk() { switch(sceUtilityOskGetStatus()){ - case PSP_UTILITY_DIALOG_INIT : - break; + case PSP_UTILITY_DIALOG_INIT: case PSP_UTILITY_DIALOG_VISIBLE : sceDisplayWaitVblankStart(); sceDisplayWaitVblankStart(); @@ -74,14 +73,12 @@ void oslDrawOsk() sceGuStart(GU_DIRECT, osl_list); oslSetAlpha(OSL_FX_RGBA, 0xff); break; - case PSP_UTILITY_DIALOG_QUIT : + case PSP_UTILITY_DIALOG_QUIT: sceUtilityOskShutdownStart(); break; - case PSP_UTILITY_DIALOG_FINISHED : - break; - case PSP_UTILITY_DIALOG_NONE : - default : - break; + case PSP_UTILITY_DIALOG_FINISHED: + case PSP_UTILITY_DIALOG_NONE: + break; } } diff --git a/release.sh b/release.sh index 8ddaf3d..3ae1a50 100644 --- a/release.sh +++ b/release.sh @@ -5,9 +5,10 @@ echo echo "-------------------" echo "OSLib release maker" echo "-------------------" +echo "Deleting target directory...." rm -rf $TARGET -echo "Creating directories...." +echo "Creating target directories...." mkdir -p $TARGET mkdir -p $TARGET/Install mkdir -p $TARGET/Install/oslib diff --git a/samples/intraFont/main.c b/samples/intraFont/main.c index fea7e7e..4b10139 100644 --- a/samples/intraFont/main.c +++ b/samples/intraFont/main.c @@ -178,7 +178,7 @@ int main(){ oslDrawString(470, y, "right"); oslIntraFontSetStyle(ltn[8], 1.0f,WHITE,BLACK,0); - y += 50; + y += 40; oslIntraFontSetStyle(ltn[4], 1.0f,BLACK,WHITE,INTRAFONT_ALIGN_CENTER); oslSetFont(ltn[4]); oslDrawString(240, y, "Press X to quit"); diff --git a/samples/saveAndLoad/main.c b/samples/saveAndLoad/main.c index d4fa980..082a155 100644 --- a/samples/saveAndLoad/main.c +++ b/samples/saveAndLoad/main.c @@ -100,7 +100,9 @@ int main(){ oslSetFont(font); while(runningFlag && !osl_quit){ - if (!skip){ + type = oslGetSaveLoadType(); + + if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); @@ -109,10 +111,9 @@ int main(){ oslDrawString(30, 150, "Press /\\ to quit."); oslDrawString(30, 200, message); - type = oslGetSaveLoadType(); if (type != OSL_DIALOG_NONE){ oslDrawSaveLoad(); - if (oslGetLoadSaveStatus() == OSL_DIALOG_NONE){ + if (oslGetLoadSaveStatus() == PSP_UTILITY_DIALOG_NONE){ if (oslSaveLoadGetResult() == OSL_SAVELOAD_CANCEL) sprintf(message, "Cancel"); else if (type == OSL_DIALOG_LOAD) diff --git a/saveload.c b/saveload.c index 7fdae4b..eb3962c 100644 --- a/saveload.c +++ b/saveload.c @@ -15,6 +15,8 @@ int saveLoadType = OSL_DIALOG_NONE; void oslInitSaveDialog(struct oslSaveLoad *saveData){ memset(&savedata, 0, sizeof(SceUtilitySavedataParam)); + memset(&newData, 0, sizeof(PspUtilitySavedataListSaveNewData)); + savedata.base.size = sizeof(SceUtilitySavedataParam); sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &savedata.base.language); @@ -28,8 +30,9 @@ void oslInitSaveDialog(struct oslSaveLoad *saveData){ savedata.overwrite = 1; savedata.focus = PSP_UTILITY_SAVEDATA_FOCUS_LATEST; // Set initial focus to the newest file (for loading) - //strncpy(savedata.key, key, 16); - +#if _PSP_FW_VERSION >= 200 + strncpy(savedata.key, key, 16); +#endif strcpy(savedata.gameName, saveData->gameID); // First part of the save name, game identifier name strcpy(savedata.saveName, saveData->saveName); // Second part of the save name, save identifier name @@ -96,8 +99,9 @@ void oslInitLoadDialog(struct oslSaveLoad *loadData){ savedata.overwrite = 1; savedata.focus = PSP_UTILITY_SAVEDATA_FOCUS_LATEST; // Set initial focus to the newest file (for loading) - //strncpy(savedata.key, key, 16); - +#if _PSP_FW_VERSION >= 200 + strncpy(savedata.key, key, 16); +#endif strcpy(savedata.gameName, loadData->gameID); // First part of the save name, game identifier name strcpy(savedata.saveName, loadData->saveName); // Second part of the save name, save identifier name @@ -107,7 +111,6 @@ void oslInitLoadDialog(struct oslSaveLoad *loadData){ strcpy(savedata.fileName, "DATA.BIN"); // name of the data file savedata.dataBuf = loadData->data; - //savedata.dataBuf = malloc(sizeof(*data)); savedata.dataBufSize = loadData->dataSize; savedata.dataSize = loadData->dataSize; @@ -118,7 +121,8 @@ void oslInitLoadDialog(struct oslSaveLoad *loadData){ void oslDrawSaveLoad(){ switch(sceUtilitySavedataGetStatus()) { - case PSP_UTILITY_DIALOG_VISIBLE: + case PSP_UTILITY_DIALOG_INIT: + case PSP_UTILITY_DIALOG_VISIBLE: sceGuFinish(); sceGuSync(0,0); sceUtilitySavedataUpdate(1); @@ -128,10 +132,9 @@ void oslDrawSaveLoad(){ case PSP_UTILITY_DIALOG_QUIT: sceUtilitySavedataShutdownStart(); break; - case PSP_UTILITY_DIALOG_FINISHED: - break; + case PSP_UTILITY_DIALOG_FINISHED: case PSP_UTILITY_DIALOG_NONE: - return; + break; } } diff --git a/text.h b/text.h index 48eedd8..b547c14 100644 --- a/text.h +++ b/text.h @@ -167,25 +167,27 @@ The same options will be applied to all intraFonts INTRAFONT_XXX flags as defined above including flags related to CACHE (ored together) \code -INTRAFONT_ADVANCE_H default: advance horizontaly from one char to the next -INTRAFONT_ADVANCE_V -INTRAFONT_ALIGN_LEFT default: left-align the text -INTRAFONT_ALIGN_CENTER -INTRAFONT_ALIGN_RIGHT -INTRAFONT_WIDTH_VAR default: variable-width -INTRAFONT_WIDTH_FIX set your custom fixed witdh to 24 pixels: INTRAFONT_WIDTH_FIX | 24 - (max is 255, set to 0 to use default fixed width, this width will be scaled by size) -INTRAFONT_ACTIVE assumes the font-texture resides inside sceGuTex already, prevents unecessary reloading -> very small speed-gain -INTRAFONT_STRING_ASCII default: interpret strings as ascii text -INTRAFONT_STRING_SJIS interpret strings as shifted-jis (japanese) -INTRAFONT_CACHE_MED default: 256x256 texture (enough to cache about 100 chars) -INTRAFONT_CACHE_LARGE 512x512 texture(enough to cache all chars of ltn0.pgf or ... or ltn15.pgf or kr0.pgf) -INTRAFONT_CACHE_ASCII try to cache all ASCII chars during fontload (uses less memory and is faster to draw text, but slower to load font) - if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a medium texture - if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory -INTRAFONT_CACHE_ALL try to cache all chars during fontload (uses less memory and is faster to draw text, but slower to load font) - if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a large texture - if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory +#define INTRAFONT_ADVANCE_H 0x00000000 //default: advance horizontaly from one char to the next +#define INTRAFONT_ADVANCE_V 0x00000100 +#define INTRAFONT_ALIGN_LEFT 0x00000000 //default: left-align the text +#define INTRAFONT_ALIGN_CENTER 0x00000200 +#define INTRAFONT_ALIGN_RIGHT 0x00000400 +#define INTRAFONT_WIDTH_VAR 0x00000000 //default: variable-width +#define INTRAFONT_WIDTH_FIX 0x00000800 //set your custom fixed witdh to 24 pixels: INTRAFONT_WIDTH_FIX | 24 + //(max is 255, set to 0 to use default fixed width, this width will be scaled by size) +#define INTRAFONT_ACTIVE 0x00001000 //assumes the font-texture resides inside sceGuTex already, prevents unecessary reloading -> very small speed-gain +#define INTRAFONT_STRING_ASCII 0x00000000 //default: interpret strings as ascii text +#define INTRAFONT_STRING_SJIS 0x00002000 //interpret strings as shifted-jis (japanese) +#define INTRAFONT_STRING_UTF8 0x00010000 //interpret strings as UTF-8 +#define INTRAFONT_CACHE_MED 0x00000000 //default: 256x256 texture (enough to cache about 100 chars) +#define INTRAFONT_CACHE_LARGE 0x00004000 //512x512 texture(enough to cache all chars of ltn0.pgf or ... or ltn15.pgf or kr0.pgf) +#define INTRAFONT_CACHE_ASCII 0x00008000 //try to cache all ASCII chars during fontload (uses less memory and is faster to draw text, but slower to load font) + + //if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a medium texture + //if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory +#define INTRAFONT_CACHE_ALL 0x0000C000 //try to cache all chars during fontload (uses less memory and is faster to draw text, but slower to load font) + //if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a large texture + //if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory \endcode */ extern int oslIntraFontInit(unsigned short options);