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
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Tue Apr 25, 2006 8:15 am    Post subject: Reply with quote

monkey242 wrote:
I'm fairly new to programming for the PSP so forgive me if this is really simple stuff. I'm trying to use oslib to do some C++ programming and I've hit a few snags.

First, on line 60 of oslib.h you typedef a bool as a short. g++ complains that you can't redefine bool so I just put an #ifndef __cplusplus around that line. Is that correct or will it break something else?

Assuming that it was correct to not include that line, the second thing is that I'm getting multiple definitions of 'osl_powerCallback' in 'oslSetupFTrigo' while linking. This then breaks every oslib function that appears in my code.

My code (just a little test stub at the moment) compiles when I change the extension from .cpp to .c and remove -lstdc++ from the makefile.

Does anyone know where I'm going wrong?


Actually I am just as we speak trying to get some C++ Code running and Brunni replied to my message saying that the current version didn't have C++ support and that the next version will.
Back to top
View user's profile Send private message
monkey242



Joined: 25 Apr 2006
Posts: 3

PostPosted: Tue Apr 25, 2006 8:44 am    Post subject: Reply with quote

Quote:
Actually I am just as we speak trying to get some C++ Code running and Brunni replied to my message saying that the current version didn't have C++ support and that the next version will.


Thanks for the quick reply. I was pulling what little hair I have left out.
Back to top
View user's profile Send private message
albator



Joined: 06 Mar 2006
Posts: 4

PostPosted: Tue Apr 25, 2006 7:09 pm    Post subject: Reply with quote

I use OSLib in C++ code and i havn't any problem exept for the bool type.
Back to top
View user's profile Send private message
monkey242



Joined: 25 Apr 2006
Posts: 3

PostPosted: Tue Apr 25, 2006 10:46 pm    Post subject: Reply with quote

Quote:
I use OSLib in C++ code and i havn't any problem exept for the bool type.

Are you using the latest version of OSLib? Did you have to do anything special in your makefile?

Any C++ code / makefiles that you could share, so that I could test, would be greatly appreciated.

Thanks.
Back to top
View user's profile Send private message
albator



Joined: 06 Mar 2006
Posts: 4

PostPosted: Tue Apr 25, 2006 11:36 pm    Post subject: Reply with quote

this is my makefile

Quote:
TARGET = test
OBJS = sprite.o

CFLAGS = -G0 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
LIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc \
-lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lstdc++

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OSL Sample

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


And i include oslib.h like this in my cpp source code. I'm really not an expert but it works.
Quote:

extern "C"
{
#include <oslib/oslib.h>
}
Back to top
View user's profile Send private message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Wed Apr 26, 2006 4:39 am    Post subject: Reply with quote

I can't wait to test it when I get home. You have actually been able to draw graphics to the screen using that method ?
Back to top
View user's profile Send private message
albator



Joined: 06 Mar 2006
Posts: 4

PostPosted: Wed Apr 26, 2006 6:45 am    Post subject: Reply with quote

Yes without problem. Try it, it's a great lib ;)
Back to top
View user's profile Send private message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Wed Apr 26, 2006 6:48 am    Post subject: Reply with quote

Okay I got it to work. The trick is the -G0 in the CFLAGS of the Makefile.
Back to top
View user's profile Send private message
hardhat



Joined: 02 Mar 2006
Posts: 17

PostPosted: Sat Apr 29, 2006 12:28 pm    Post subject: Crash on exit with 2.6 + Super Bach. Reply with quote

I find that both the samples and my app crash on exit. My beta tester sees it too. Specifically it crashes when the eLoader trys to start again. I've tried both the LTRIGGER+RTRIGGER+START method and the oslQuit() method. The MS light goes on, and the message "eLoader v0.97 by Fanjita and Ditlew
(based on the work by ..." which stays for 10 second and then of course turns itself off.

I (and my beta tester) have a 2.6 PSP (mine is US GTA, his is EU GTA) and we are both running eLoader 0.97 Alternative.

Other than that the oslib is everything I could want. Lightning fast, and nicely compact.

HardHat.
_________________
HardHat
Try my homebrew: Open Gladiator, Fur Trader, Skater Maze, Jafe's Hike, Jumping Jack
Back to top
View user's profile Send private message Visit poster's website
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Sun Apr 30, 2006 9:35 pm    Post subject: Reply with quote

I get a similar problem to hardhat, on firmware 2.00 using eLoader as well, but I don't get any crashes.

If I load up the eLoader, I can successfully get into Test_oslib quite happily. However, if I quit Test_oslib, and then try to load it up again, all I get is a black screen. Pressing L+R+Start gets me back to the eLoader however, no crashes or anything. Trying to load it again still doesn't work - I have to quit the eLoader, reset the PSP, load the eLoader again and then Test_oslib will work.

This means I have to soft-reboot my PSP every time I do a new compile :(

I'd love to use the library though, it's just what I was looking for!

Update: Ok, I've just been playing around with it, and it seems that 'oslMessageBox' is causing the problems. Commenting out those lines and using L+R+Start to quit solves everything!

However, after a few quits+restarts of the program (3 or 4) the eLoader gives me an 80010018 error (can't load eboot) and I have to restart the PSP. Still, it's better than before.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Mon May 01, 2006 3:32 pm    Post subject: Reply with quote

this sounds like OSlib has issues with GE init on 2.0
might wanna check that out ;)
_________________
10011011 00101010 11010111 10001001 10111010


Last edited by dot_blank on Mon May 01, 2006 6:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Mon May 01, 2006 5:24 pm    Post subject: Reply with quote

I don't free up all memory when exiting, because the kernel actually does it by itself. But maybe eLoader doesn't, and this can make the program crash after several runs (but I would not say 3, at least 10 or 20). Do other programs have this problem as well?
Please PM me if you want to (seriously) do further tests :)
Could you test this and tell me what happens on a 2.0+ please? :
Code:
oslInit();
oslInitGfx(OSL_PF_8888, 1);
oslSwapBuffers();
oslSwapBuffers();
oslStartDrawing();
oslSetDrawBuffer(OSL_SECONDARY_BUFFER);
oslDrawFillRect(0, 0, 100, 100, RGB(255, 0, 0));
oslEndDrawing();
oslWaitKey();
oslQuit();

I didn't tested it, I hope it works. I'm sorry I have very few free time for now, but I didn't given up ;-)
I'll post the source code once I have some free time to finalize the PC version and clean it.
Thanks for support ^^
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Mon May 01, 2006 8:35 pm    Post subject: Reply with quote

Brunni: I compiled your code, copied it across and it runs fine. I'm able to run it over and over again (about 10 times so far) without any problems. It has not crashed yet.

I also just noticed that eLoader's memory indication does not decrease if I keep running an oslib app. It always says 23.6mb even after a few runs+exits. So maybe the eLoader IS freeing memory and it's a different issue?
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Mon May 01, 2006 9:16 pm    Post subject: Reply with quote

why swap twice ?
Code:
oslSwapBuffers();
oslSwapBuffers();

_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Tue May 02, 2006 5:10 am    Post subject: Reply with quote

Brunni: Some more discoveries.

I've added oslAssert()'s after all my image/sound loads just to make sure they load ok. Again, the program works fine 2 or 3 times, but next time it will throw up a fatal error naming the file it just tried to load. So it sounds like it's failing to load the images after it has been run a few times.

Hope this helps. I'll post more as I get it :)
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Tue May 02, 2006 8:46 pm    Post subject: Reply with quote

Hm that's strange, you said just before that it worked 10 times?
Anyway oslLoadImageFile does a lot of things. Are your images in RAM or VRAM? Does using VRAM give the same problem? Can you try to create empty images (oslCreateImage) of the same dimension/pixelformat/location instead and tell me what happen after some runs?
By the way oslAssert (like oslDebug and all that routines) all call oslMessageBox (but incase of oslAssert, only if condition is false).
dot_blank> To simulate a program that already ran some time before executing this ;)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Tue May 02, 2006 8:55 pm    Post subject: Reply with quote

Brunni wrote:
Hm that's strange, you said just before that it worked 10 times?
Anyway oslLoadImageFile does a lot of things. Are your images in RAM or VRAM? Does using VRAM give the same problem? Can you try to create empty images (oslCreateImage) of the same dimension/pixelformat/location instead and tell me what happen after some runs?


Yep, it worked at least 10 times before I got bored and stopped trying :)

My images are being loaded into normal RAM.

I'll try your suggestions this evening and let you know what happens.
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Wed May 03, 2006 6:27 am    Post subject: Reply with quote

Brunni wrote:
Does using VRAM give the same problem?


Hmm, whenever I try to load or create an image in VRAM, I get a crash. Sometimes it shows an error box. Sometrimes it shows is a black screen and then my PSP turns off. Sometimes it just shows black and I have to use L+R+Start to get back to the eLoader. (My program should quit on 'Start' but it doesn't work when VRAM is used!)

Brunni wrote:
Can you try to create empty images (oslCreateImage) of the same dimension/pixelformat/location instead and tell me what happen after some runs?


I tried that and it ran 10 times in a row without a problem! I didn't try any more than that.
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Wed May 03, 2006 5:06 pm    Post subject: Reply with quote

VRAM crashes from the first time?
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Wed May 03, 2006 5:08 pm    Post subject: Reply with quote

Yep, I think it crashes as soon as it tries to load the first file into VRAM.
Back to top
View user's profile Send private message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Thu May 04, 2006 7:50 am    Post subject: Reply with quote

Are you checking if your file has loaded into VRAM or do you just assume that it did and it crashes when you try to draw or do something with the image ?

I could only get 2 512x512 images loaded into ram so it's a very small space to work with
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Thu May 04, 2006 8:04 am    Post subject: Reply with quote

Giuliano wrote:
Are you checking if your file has loaded into VRAM or do you just assume that it did and it crashes when you try to draw or do something with the image ?


I have an oslAssert check the pointer that oslLoadImage gives me back. However, this isn't throwing up anything so you're right - it's not clear if it happened on load or on drawing it.

I've just tried a different test: a very simple program whose only task is to load up the image into VRAM, and then exit. This crashes/hangs on a black screen and soft-resets my PSP. Change it to use normal RAM and it runs and exits normally.

So I would argue something is definitely going wrong whilst loading the image into VRAM.
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Thu May 04, 2006 6:20 pm    Post subject: Reply with quote

Oh, also, the test image I'm using is a 480x272 loaded as 8888... so a bit heavy :)
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Fri May 05, 2006 5:05 pm    Post subject: Reply with quote

Quote:
I could only get 2 512x512 images loaded into ram so it's a very small space to work with

In VRAM you can put only 2 512x512 images because it's only 2 MB and in double-buffered 8888 mode you already loose more than 1 MB of it for the screen buffer itself (512*272*4*2). But in RAM you can put much more than that.
Quote:
I have an oslAssert check the pointer that oslLoadImage gives me back. However, this isn't throwing up anything so you're right - it's not clear if it happened on load or on drawing it.

That's very strange, looks like you have no access to the VRAM (??). To make sure, can you try this please? (in a simple program that does this and exits then).
Code:
u32 *ptr = (u32*)0x04110000;
*ptr = 0xaaaaaaaa;

Does it crash?
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Sat May 06, 2006 5:42 am    Post subject: Reply with quote

Brunni wrote:

That's very strange, looks like you have no access to the VRAM (??). To make sure, can you try this please? (in a simple program that does this and exits then).
Code:
u32 *ptr = (u32*)0x04110000;
*ptr = 0xaaaaaaaa;

Does it crash?


Nope, it went back to the eLoader normally. It did not crash.
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Sat May 06, 2006 6:46 am    Post subject: Reply with quote

Okay, so I think it'll need some more investigation. If you (or someone else) want to help me, please PM me ;-)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Sat May 06, 2006 8:51 am    Post subject: Reply with quote

Could it be that eLoader or some other programs that are running are taking up VRAM so he can not load any images?
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sat May 06, 2006 9:12 am    Post subject: Reply with quote

most likely you are
1. loading to large an image into vram
2. loading image in address that one of the
frame buffers currently occupy or
3. some bug lies in OSL ;)

eloader does not touch vram
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Wed May 31, 2006 9:55 am    Post subject: Reply with quote

...nice lib, i have to admit, easy to install, since i edited the install.bat to C drive and thats it... now i have this font, its TTF (True Type Font) and i want to con vert it into an OSL compatible format...

I see the tool there for it, but the CMD goes away too quick for me to read what to do... please help as i need this font adn this lib is the only clean, fast, and down right old school way of doing this... thx
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Wed May 31, 2006 9:45 pm    Post subject: Reply with quote

Execute if from console (start, execute, "cmd" then type its name), then infos will stay on screen.
Anyway your font has to be installed, since the name you'll put on the command line is the name of the system font, like "Times New Roman" ;-)

Some news (I've got my exams now, so just wait a bit, but it's not given up)
1) It seems that the cause of problems with 2.6 has been found, the next version (that will come shortly) should work properly, even 10 times without rebooting :-)
2) The PC version is already in beta test on a french forum (I have no time to traduce and make documentation now, sorry):
* Download: http://www.playeradvance.org/forum/showthread.php?t=1155&page=4#post48470
* Tutos: http://www.playeradvance.org/forum/showthread.php?t=2174
But I need help, because this thing doesn't run on all computers and is very slow. It should really be implemented in software. If someone can give me some advice or help, he/she is very welcomed :-)

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