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.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?
[Interested?] OldSchool Library
this is my makefile
And i include oslib.h like this in my cpp source code. I'm really not an expert but it works.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
extern "C"
{
#include <oslib/oslib.h>
}
Crash on exit with 2.6 + Super Bach.
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.
(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
Try my homebrew: Open Gladiator, Fur Trader, Skater Maze, Jafe's Hike, Jumping Jack
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.
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.
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? :
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 ^^
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: Select all
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'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
Oldschool library for PSP - PC version released
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?
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?
why swap twice ?
Code: Select all
oslSwapBuffers();
oslSwapBuffers();
10011011 00101010 11010111 10001001 10111010
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 :)
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 :)
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 ;)
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
Oldschool library for PSP - PC version released
Yep, it worked at least 10 times before I got bored and stopped trying :)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?
My images are being loaded into normal RAM.
I'll try your suggestions this evening and let you know what happens.
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:Does using VRAM give the same problem?
I tried that and it ran 10 times in a row without a problem! I didn't try any more than that.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?
VRAM crashes from the first time?
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
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.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'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.
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.I could only get 2 512x512 images loaded into ram so it's a very small space to work with
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).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.
Code: Select all
u32 *ptr = (u32*)0x04110000;
*ptr = 0xaaaaaaaa;
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Nope, it went back to the eLoader normally. It did not crash.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).Does it crash?Code: Select all
u32 *ptr = (u32*)0x04110000; *ptr = 0xaaaaaaaa;
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
Oldschool library for PSP - PC version released
...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
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
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/show ... #post48470
* Tutos: http://www.playeradvance.org/forum/show ... 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 ^^
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/show ... #post48470
* Tutos: http://www.playeradvance.org/forum/show ... 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
Oldschool library for PSP - PC version released