I need help loading PNG files with OsLibMODv2, I recently installed MinPSPW 0.11.2r3 and I compiled the OSLib "hello world" sample located at C:\pspsdk\psp\sdk\samples\oslib_mod. It compiled fine but when executed on a PSP 3000 (on 6.60 PRO-C) & PSP 1000 (on 5.00 m33) a message box is displayed saying that "bkg.png" couldn't be located (I copied it inside the folder containing the eboot), so reading around somebody said that the version of OSLibMod included in MinPSPW had some bugs and had broken PNG file support and that it should be updated.
So I downloaded a copy of the OSLibModv2 headers, samples and the libols.a from here: https://github.com/dogo/oslibmodv2
and then I replaced libosl.a from the git repository to C:\pspsdk\psp\lib, then I deleted the contents of C:\pspsdk\psp\include\oslib and replaced them by the haders and folders of oslibmodv2-master\src, and then the samples from the git repository to C:\pspsdk\psp\sdk\samples\oslib_mod
So after the previous steps I took, I recompiled the sample, copied it to psp's PSP\GAME\OslibHello\ folder along with the bkg.png provided by the OSLibMODv2 samples and I got the same message as before (could not locate "bkg.png") so It didn't fix the problem, then I created my own bkg.png file in Paint.NET saving it with a 24-bit depth, replaced the one I copied before and got the same error message box.
Then I modified the main.c file of the sample and I could confirm that it has a problem loading PNG files:
main.c
Code: Select all
#include <pspkernel.h>
#include <oslib/oslib.h>
PSP_MODULE_INFO("Hello World", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(12*1024);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Init OSLib:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int initOSLib(){
oslInit(0);
oslInitGfx(OSL_PF_4444, 1);
oslInitAudio();
//oslSetQuitOnLoadFailure(1);
oslSetKeyAutorepeatInit(40);
oslSetKeyAutorepeatInterval(10);
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
int skip = 0;
initOSLib();
oslIntraFontInit(INTRAFONT_CACHE_MED);
//Loads image:
OSL_IMAGE *bkg = oslLoadImageFilePNG("bkg.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_4444);
if(bkg == NULL)
oslPrintf_xy(0, 0, "Image: 'bkg.png' - not loaded");
//Load font:
OSL_FONT *pgfFont = oslLoadFontFile("flash0:/font/ltn0.pgf");
oslIntraFontSetStyle(pgfFont, 1.0, RGBA(255,255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_LEFT);
oslSetFont(pgfFont);
while(!osl_quit){
if (!skip){
oslStartDrawing();
if(bkg != NULL)
oslDrawImageXY(bkg, 0, 0);
oslDrawString(180, 150, "Hello world");
oslDrawString(150, 250, "Press X to quit");
oslEndDrawing();
}
oslEndFrame();
skip = oslSyncFrame();
oslReadKeys();
if (osl_keys->released.cross)
oslQuit();
}
//Quit OSL:
oslDeleteImage(bkg);
oslEndGfx();
sceKernelExitGame();
return 0;
}
Makefile:
Code: Select all
TARGET = helloworld
OBJS = main.o
#To build for custom firmware:
BUILD_PRX = 1
PSP_FW_VERSION=371
CFLAGS = -O2 -g -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
MYLIBS=
STDLIBS= -losl -lpng -lz \
-lpsphprm -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspgum -lpspaudiolib -lpspaudio -lpsphttp -lpspssl -lpspwlan \
-lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -ljpeg
LIBS=$(STDLIBS) $(MYLIBS)
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World
#PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
The MinPSPW has another png header in C:\pspsdk\psp\include\libpng14\ which says its version is 1.4.4,
and yet another one in C:\pspsdk\psp\include\ which is also 1.4.4, so at this point I'm wondering if those 3 headers interfere with each other when creating the eboot of the hello world sample and if it is how should I avoid it?
Thanks for reading everything I wrote and please be easy on me, I'm a noob on the PSP scene and also I don't have much experience in general development. (But I'm working on it )
P.S. I choose OSLibMOD since it seems simple and easy to use and I want to port a game I made using Allegro 5 with C... It is a clone of ConSumo (the arcade game from Bully and Bully: Scholarship Edition by Rockstar Games)
Advertising