forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Interested?] OldSchool Library
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
seventoes



Joined: 02 Oct 2005
Posts: 79

PostPosted: Sat May 19, 2007 10:48 am    Post subject: Reply with quote

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...

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".
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat May 19, 2007 12:51 pm    Post subject: Reply with quote

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...


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".
Back to top
View user's profile Send private message AIM Address
goebish



Joined: 14 Oct 2006
Posts: 29

PostPosted: Sat May 19, 2007 7:51 pm    Post subject: Reply with quote

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 ;)


Last edited by goebish on Sat May 19, 2007 9:51 pm; edited 2 times in total
Back to top
View user's profile Send private message
nDEV



Joined: 13 Apr 2007
Posts: 48

PostPosted: Sat May 19, 2007 8:08 pm    Post subject: Reply with quote

Nice..!
Back to top
View user's profile Send private message
BigNastyCurve



Joined: 13 May 2007
Posts: 9

PostPosted: Sun May 20, 2007 12:11 am    Post subject: Reply with quote

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".


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.

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?
Back to top
View user's profile Send private message
seventoes



Joined: 02 Oct 2005
Posts: 79

PostPosted: Sun May 20, 2007 1:59 am    Post subject: Reply with quote

goebish wrote:
- the install .bat files don't work, you have to copy includes and libs manually, in pspsdk and visual studio for the PC version

You have to edit the .bat's to point to the right folder, it wont work usually by default.
Back to top
View user's profile Send private message
goebish



Joined: 14 Oct 2006
Posts: 29

PostPosted: Sun May 20, 2007 2:02 am    Post subject: Reply with quote

they point to the right folders, but not all files are copied.
Back to top
View user's profile Send private message
seventoes



Joined: 02 Oct 2005
Posts: 79

PostPosted: Sun May 20, 2007 2:18 am    Post subject: Reply with quote

goebish wrote:
they point to the right folders, but not all files are copied.

Weird, it worked fine for me.
Back to top
View user's profile Send private message
nDEV



Joined: 13 Apr 2007
Posts: 48

PostPosted: Sun May 20, 2007 3:28 am    Post subject: Reply with quote

Is it possible to use vectors ?
I've tried this:

vector<OSL_IMAGE> *VEC;

but im just getting errors -.-..

Here's my make file:

Quote:

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


*******EDITED**********
I removed the first question , because i managed to fix the problem ;)
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun May 20, 2007 4:10 am    Post subject: Reply with quote

BigNastyCurve wrote:
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".


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.


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.

Quote:
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?


http://brunni.dev-fr.org/oslib/doc/doxygen/index.html

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.
Back to top
View user's profile Send private message AIM Address
nDEV



Joined: 13 Apr 2007
Posts: 48

PostPosted: Sun May 20, 2007 4:30 am    Post subject: Reply with quote

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:

Quote:

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


*******EDITED**********
I removed the first question , because i managed to fix the problem ;)


This one doesnt give any errors:

vector<OSL_IMAGE*> v;

but when i do this:

v.push_back(OSL_IMAGE*);

im getting errors....
Can someone help please???????????
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Mon May 21, 2007 2:16 am    Post subject: Reply with quote

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?
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
nDEV



Joined: 13 Apr 2007
Posts: 48

PostPosted: Mon May 21, 2007 12:41 pm    Post subject: Reply with quote

Brunni wrote:

nDEV> What are the errors?



I found out what i was doing wrong...with a little help!:
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);

?
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Tue May 22, 2007 2:11 am    Post subject: Reply with quote

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:
Code:
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
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Wed Jun 06, 2007 7:52 pm    Post subject: Reply with quote

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
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
seventoes



Joined: 02 Oct 2005
Posts: 79

PostPosted: Thu Jun 07, 2007 1:25 am    Post subject: Reply with quote

That sounds good to me! What would be the disadvantages?
Back to top
View user's profile Send private message
Yodajr



Joined: 24 Sep 2005
Posts: 13

PostPosted: Thu Jun 07, 2007 1:52 am    Post subject: Reply with quote

You can't modify swizzled images ;)
_________________
Tutorials about OSLib here
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Fri Jun 08, 2007 8:42 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Sun Jun 10, 2007 11:18 pm    Post subject: Reply with quote

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 ^^
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Mon Jun 11, 2007 12:23 am    Post subject: Reply with quote

I've always wondered, Brunni = pspdonkey from psp-hacks? Bcoz he once updated osl to include OslShowpsphacksLogo.
Back to top
View user's profile Send private message
LOREK



Joined: 08 Jun 2007
Posts: 4
Location: Gliwice, Poland

PostPosted: Sun Jun 24, 2007 11:39 pm    Post subject: Reply with quote

How to use oslib2 pc version with "emu.h"?
Back to top
View user's profile Send private message Visit poster's website
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Wed Aug 08, 2007 6:20 am    Post subject: Reply with quote

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 ;)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Fri Aug 10, 2007 10:04 pm    Post subject: Reply with quote

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? :)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released


Last edited by Brunni on Sat Aug 11, 2007 4:21 am; edited 1 time in total
Back to top
View user's profile Send private message
LOREK



Joined: 08 Jun 2007
Posts: 4
Location: Gliwice, Poland

PostPosted: Sat Aug 11, 2007 3:10 am    Post subject: Reply with quote

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 :) <---
Back to top
View user's profile Send private message Visit poster's website
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Sat Aug 11, 2007 8:39 pm    Post subject: Reply with quote

You're welcome. I'm glad you could unbrick your psp :)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
oldrider



Joined: 09 Oct 2007
Posts: 4

PostPosted: Fri Oct 12, 2007 11:16 pm    Post subject: .. Reply with quote

Hi Brunni, how to use a Thread for loading images??
I´m can try a make loading system resource.
Back to top
View user's profile Send private message Visit poster's website
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Tue Oct 16, 2007 1:48 am    Post subject: Reply with quote

I've answered your question in your topic at playeradvance.org.
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Fri Apr 11, 2008 9:07 pm    Post subject: Reply with quote

Hi! :)

Sorry to bother, but: is it possible to have the source code of OSLib version 2.10?
It seems only 1.0 source code has been released...why?

Many thanks
Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
hibbyware



Joined: 28 Mar 2007
Posts: 78

PostPosted: Fri Apr 11, 2008 10:35 pm    Post subject: Reply with quote

Take a look here --> http://brunni.dev-fr.org/index.php?page=pspsoft_oslib
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Fri Apr 11, 2008 10:38 pm    Post subject: Reply with quote

Hi! :)
hibbyware wrote:
Take a look here --> http://brunni.dev-fr.org/index.php?page=pspsoft_oslib

Uhhhh..yesterday wasn't there.
Many thanks. :)

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 8 of 9

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group