I believe that you use unescaped forward slashes ( / ) in file paths for that function, and to make the path relative, just use like "images/splash_32.png", not "./images/splash_32.png".BigNastyCurve wrote:question about 1.0:
This works:
intro = oslLoadImageFile("splash_32.png", OSL_IN_RAM, OSL_PF_8888);
This doesn't work:
intro = oslLoadImageFile(".\\images\\splash_32.png", OSL_IN_RAM, OSL_PF_8888);
The file is in both locations. I was extremely puzzled at first because I couldn't get an image loaded to save my life. Then I moved it out into the eboot directory, changed my code and it worked. Is there a particular reason that I can't use subdirectories? I'd rather not have my assets all over the main directory if I can help it.
Thanks...
[Interested?] OldSchool Library
The PSP, like every other sensible OS in creation, uses forward slashes for the path, not back slashes. Damn DOS...BigNastyCurve wrote:question about 1.0:
This works:
intro = oslLoadImageFile("splash_32.png", OSL_IN_RAM, OSL_PF_8888);
This doesn't work:
intro = oslLoadImageFile(".\\images\\splash_32.png", OSL_IN_RAM, OSL_PF_8888);
The file is in both locations. I was extremely puzzled at first because I couldn't get an image loaded to save my life. Then I moved it out into the eboot directory, changed my code and it worked. Is there a particular reason that I can't use subdirectories? I'd rather not have my assets all over the main directory if I can help it.
Thanks...
A relative path would be like "data/datafile" while an absolute path would be like "ms0:/data/datafile".
It's fantastic that you continue working on this project Brunni.
Keep up the good work !
edit: I just tested 2.0 alpha
- the install .bat files don't work, you have to copy includes and libs manually, in pspsdk and visual studio for the PC version
- filenames are now case sensitive when you load a file with an OSLib function, I took 1 hour to understand why my 1.0 code wouldn't work ;)
Keep up the good work !
edit: I just tested 2.0 alpha
- the install .bat files don't work, you have to copy includes and libs manually, in pspsdk and visual studio for the PC version
- filenames are now case sensitive when you load a file with an OSLib function, I took 1 hour to understand why my 1.0 code wouldn't work ;)
Last edited by goebish on Sat May 19, 2007 9:51 pm, edited 2 times in total.
-
- Posts: 9
- Joined: Sun May 13, 2007 5:33 am
Interestingly, the graphics.c/.h packages in the "standard" PSP tutorial allow you to use escaped backslashes when passing filenames, which is what confused me. Perhaps he does some translation behind the scenes, though I didn't look.J.F. wrote:The PSP, like every other sensible OS in creation, uses forward slashes for the path, not back slashes. Damn DOS...
A relative path would be like "data/datafile" while an absolute path would be like "ms0:/data/datafile".
Another question, then: I want to adapt some TTF library code based on freetype2 that writes fonts to an image and/or screen as I've not had great success with the built-in font renderer in osl. I'm looking for a function call similar to
putPixelImage(pixel, i, j, image);
or
putPixelScreen(pixel, i, j);
in osl, but I'm not seeing either (obviously) or even a pixel data structure. Is this something I could remedy by rolling my own functions or am I just hosed?
Is it possible to use vectors ?
I've tried this:
vector<OSL_IMAGE> *VEC;
but im just getting errors -.-..
Here's my make file:
I removed the first question , because i managed to fix the problem ;)
I've tried this:
vector<OSL_IMAGE> *VEC;
but im just getting errors -.-..
Here's my make file:
*******EDITED**********TARGET = APP
OBJS = main.o core.o
INCDIR =
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lmad
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = APP
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
I removed the first question , because i managed to fix the problem ;)
Some examples/programs are written to compile in Windows/whatever for testing purposes. Prime example is SMS for the PS2. For those programs/examples, they need the ability to use backslashes for Windows when building for Windows for testing.BigNastyCurve wrote:Interestingly, the graphics.c/.h packages in the "standard" PSP tutorial allow you to use escaped backslashes when passing filenames, which is what confused me. Perhaps he does some translation behind the scenes, though I didn't look.J.F. wrote:The PSP, like every other sensible OS in creation, uses forward slashes for the path, not back slashes. Damn DOS...
A relative path would be like "data/datafile" while an absolute path would be like "ms0:/data/datafile".
http://brunni.dev-fr.org/oslib/doc/doxygen/index.htmlAnother question, then: I want to adapt some TTF library code based on freetype2 that writes fonts to an image and/or screen as I've not had great success with the built-in font renderer in osl. I'm looking for a function call similar to
putPixelImage(pixel, i, j, image);
or
putPixelScreen(pixel, i, j);
in osl, but I'm not seeing either (obviously) or even a pixel data structure. Is this something I could remedy by rolling my own functions or am I just hosed?
Look at the images functions. You can oslCreateImage(), do oslGetImagePixelAdr() and fill in the pixel image, then oslDrawImage(). You can also create images from files. All sorts of good image functions in OSL. Just read the docs.
This one doesnt give any errors:nDEV wrote:Is it possible to use vectors ?
I've tried this:
vector<OSL_IMAGE> *VEC;
but im just getting errors -.-..
Here's my make file:
*******EDITED**********TARGET = APP
OBJS = main.o core.o
INCDIR =
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lmad
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = APP
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
I removed the first question , because i managed to fix the problem ;)
vector<OSL_IMAGE*> v;
but when i do this:
v.push_back(OSL_IMAGE*);
im getting errors....
Can someone help please???????????
Thanks for your support and your bug reports ^^
I'm confused when you are saying that oslLoadImageFile is now case sensitive... there is no reason at all.
I'm using sceIoOpen and so on. Maybe fopen (like I was using before) wasn't? But fopen was a wrapper to sceIo anyway. That's something to investigate ^^
At least putting './directory' won't work because of a bug that I will correct (I take the first '.' to detect the extension instead of the last one). You don't need putting a . before the path anyway.
nDEV> What are the errors?
goebish> Which files are missing?
I'm confused when you are saying that oslLoadImageFile is now case sensitive... there is no reason at all.
I'm using sceIoOpen and so on. Maybe fopen (like I was using before) wasn't? But fopen was a wrapper to sceIo anyway. That's something to investigate ^^
At least putting './directory' won't work because of a bug that I will correct (I take the first '.' to detect the extension instead of the last one). You don't need putting a . before the path anyway.
nDEV> What are the errors?
goebish> Which files are missing?
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
I found out what i was doing wrong...with a little help!:Brunni wrote:
nDEV> What are the errors?
Link::
http://forums.ps2dev.org/viewtopic.php?t=8369
I have another question (hahaha!*evil laugh*).
When its time to release all objects , is it better to do it like this :
OSL_IMAGE *TEST;
if (TEST)oslDelteImage(TEST);
or this:
if (TEST)TEST=NULL;
or ..this:
if (TEST!=NULL)(TEST=NULL);
?
I think you are mixing java objects and C structures (which are completely different)...
OSLib is C only, so setting a pointer to NULL won't free the associated memory (of course), it will just... set this pointer to NULL (which is usually a bad idea if your object hasn't been freed first because you'll loose any reference to that object, making a memory leak).
You HAVE to do oslDeleteImage, and maybe later set the pointer to null. If you want a clean way to eventually delete objects that may not have been loaded, you could do something like this:
OSLib is C only, so setting a pointer to NULL won't free the associated memory (of course), it will just... set this pointer to NULL (which is usually a bad idea if your object hasn't been freed first because you'll loose any reference to that object, making a memory leak).
You HAVE to do oslDeleteImage, and maybe later set the pointer to null. If you want a clean way to eventually delete objects that may not have been loaded, you could do something like this:
Code: Select all
OSL_IMAGE *image = NULL;
//Creating an image (if it doesn't exist yet)
if (image)
image = oslLoadImageFile(....)
//Deleting an image (if it does exist; then set it to NULL to indicate it doesn't exist anymore)
if (image) {
oslDeleteImage(image);
image = NULL;
}
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
I'm thinking about automatically swizzling images upon loading but I need your advice. You'll have to specify OSL_UNSWIZZLED to make sure it isn't swizzled, else it will be. Does this seem better to you?
Thanks in advance for your opinion
Thanks in advance for your opinion
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Oh, you can absolutely modify swizzled images... It's just a tiny bit trickier :)
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
Oh thank you. Now oslGet/SetImagePixel take swizzling in account. This is just a problem for people who are using the old method (raw access to image->data) but they will be warned (in the breaking changes section): if they want their old code to work, just put an oslSetImageAutoSwizzle(0) in the beginning of the code. For new projects, you can just specify the OSL_UNSWIZZLED flag at image loading.
I think this behaviour is ok. Many thanks for your advice ^^
I think this behaviour is ok. Many thanks for your advice ^^
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
-
- Posts: 328
- Joined: Sun Jun 03, 2007 10:05 pm
Hmm it's like the first version (OSLib 1.0). What is the problem?
No I'm not pspdonkey. Other people can use the logo if they want because the source is available on my site ;)
No I'm not pspdonkey. Other people can use the logo if they want because the source is available on my site ;)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
LOREK> Ok, now I can answer you precisely ^^
I'm sorry, I'll have to do something more about this PC version, I haven't tested it at all since the 2.0 release (I always use PSPLink, it's a bit more handy). I'll try to fix it and improve a bit for the next release. For now, here is what you can do if you want to begin from zero (you can also use the OSLib pack from Yodajr, which includes cygwin, pspsdk, OSLib, tools and everything you need; but it's always good to know how to do):
- Install Visual C++ Express 2008.
- Modify the Install.bat in the PC directory of the OSLib zip to make it point to C:\Program Files\Microsoft Visual Studio 9.0 instead of 8. Also, the script is missing to copy some files, so modify the lines that copy individual .h files with:
copy *.h "%VCDIR%\include\oslib"
- Execute that Install.bat.
- Create a new, empty Win32 project.
- Add a main.cpp file,
- Paste your sample code in it.
- Right click on your project (just below the solution, containing 1 project),
- Select Properties,
- In the left treeview, select Linker, Input. In the additional dependencies rightwards, add oslib.lib libpng.lib libz.lib opengl32.lib glu32.lib
- Compile with F7, it will probably give an error that "GL/GlExt.h" not found, double click on that error, it will bring you to the line #include "GL/glext.h", which you can comment out.
- Press Ctrl+F5 to compile and launch it directly.
Tip: For a better compilation time, you may try to put the following libraries in the linker, input, additional dependencies section: advapi32.lib gdi32.lib user32.lib oslib.lib opengl32.lib glu32.lib libcmt.lib libpng.lib libz.lib and set Yes (/NODEFAULTLIB) in the Ignore All Default Libraries section.
Hope it helps,
Brunni
Btw I'm sorry if this topic seems dead, I'm still developping this library actively but most people ask their questions on playeradvance and not here.
Has anyone found bugs, ideas or something that can help me for further development? :)
I'm sorry, I'll have to do something more about this PC version, I haven't tested it at all since the 2.0 release (I always use PSPLink, it's a bit more handy). I'll try to fix it and improve a bit for the next release. For now, here is what you can do if you want to begin from zero (you can also use the OSLib pack from Yodajr, which includes cygwin, pspsdk, OSLib, tools and everything you need; but it's always good to know how to do):
- Install Visual C++ Express 2008.
- Modify the Install.bat in the PC directory of the OSLib zip to make it point to C:\Program Files\Microsoft Visual Studio 9.0 instead of 8. Also, the script is missing to copy some files, so modify the lines that copy individual .h files with:
copy *.h "%VCDIR%\include\oslib"
- Execute that Install.bat.
- Create a new, empty Win32 project.
- Add a main.cpp file,
- Paste your sample code in it.
- Right click on your project (just below the solution, containing 1 project),
- Select Properties,
- In the left treeview, select Linker, Input. In the additional dependencies rightwards, add oslib.lib libpng.lib libz.lib opengl32.lib glu32.lib
- Compile with F7, it will probably give an error that "GL/GlExt.h" not found, double click on that error, it will bring you to the line #include "GL/glext.h", which you can comment out.
- Press Ctrl+F5 to compile and launch it directly.
Tip: For a better compilation time, you may try to put the following libraries in the linker, input, additional dependencies section: advapi32.lib gdi32.lib user32.lib oslib.lib opengl32.lib glu32.lib libcmt.lib libpng.lib libz.lib and set Yes (/NODEFAULTLIB) in the Ignore All Default Libraries section.
Hope it helps,
Brunni
Btw I'm sorry if this topic seems dead, I'm still developping this library actively but most people ask their questions on playeradvance and not here.
Has anyone found bugs, ideas or something that can help me for further development? :)
Last edited by Brunni on Sat Aug 11, 2007 4:21 am, edited 1 time in total.
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Thank too answer Brunni! I needed this solution when I bricked my PSP because I couldn't test my games. Currently my PSP is OK and I can continue work over game already.
OSLib is the best for creation 2D games like GBA games! I wish you success in farthest deployment this library! I write on your library shooter game like Contra(NES).
PS.
I use devkitPSP from DevKitPro + Dev-Cpp + MinGw on the Win32 platform.
In the nearest future I will upload alpha demo to this topic.
---> Sorry for my bad English :) <---
OSLib is the best for creation 2D games like GBA games! I wish you success in farthest deployment this library! I write on your library shooter game like Contra(NES).
PS.
I use devkitPSP from DevKitPro + Dev-Cpp + MinGw on the Win32 platform.
In the nearest future I will upload alpha demo to this topic.
---> Sorry for my bad English :) <---
You're welcome. I'm glad you could unbrick your psp :)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
..
Hi Brunni, how to use a Thread for loading images??
I´m can try a make loading system resource.
I´m can try a make loading system resource.
I've answered your question in your topic at playeradvance.org.
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Take a look here --> http://brunni.dev-fr.org/index.php?page=pspsoft_oslib
Hi! :)
Many thanks. :)
Ciaooo
Sakya
Uhhhh..yesterday wasn't there.hibbyware wrote:Take a look here --> http://brunni.dev-fr.org/index.php?page=pspsoft_oslib
Many thanks. :)
Ciaooo
Sakya