 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
reefbarman
Joined: 08 Jan 2007 Posts: 87 Location: Australia
|
Posted: Wed Feb 21, 2007 11:44 am Post subject: |
|
|
| im currently using OSLib to write my app called psp Super Portable Calendar, i absolutely love it even though i have come accross some bugs that could only have been produced by the library its self, but i found work arounds for them so im okay, but what i wanted to know is there a way to use OSLib in prxs cause im currently up to writing a plugin for my app for the vsh and i want to overlay some graphics and text onto the vsh is this possible with oslib?? |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Fri Feb 23, 2007 9:46 am Post subject: |
|
|
Hello :)
I've told you that I would release MMSPlus source code, here it is:
http://oslib.palib.info/samples/download/smspsp.7z
I've also told you that I would release the PC source code:
http://oslib.palib.info/OSLib_PC_src.7z
For the PC source code, open the MyOGL/MyOGL.sln, it should compile as long as you've got a working Visual C++ install with OSLib PC version.
By pressing Ctrl+F5 (execute) it will automatically execute the contents of the "blit.c" file (in OSLib directory).
The OSLib directory is a cut & paste version of the PSP folder. Files are used there for compiling.
MyOGL is an OpenGL wrapper that permits the PSP code to work.
The Library folder just containts the project that generates the OSLib.lib file. It's open at the same time with the MyOGL solution.
The PC directory contains all the files and an installation script (Install.bat), I think it's quite easy to understand ;)
For MMSPlus, you just need a working PSPSDK + OSLib install, and to type make -f Makefile.psp at command line prompt. This will specify to use Makefile.psp, because the original Makefile isn't designed for PSP.
If you've got any problem, please post there ;)
reefbarman> Please post there the problems you've got, and how you worked around them, so that I can fix them once for all ;)
| NeoTechni wrote: | Is there a standard map format? Or an editor?
If there is no editor I could make one for Windows |
There is no official OSLib map editor. Personnaly I use GBA Graphics, it works quite good althrough it's lacking an export to a binary format, which would be extremely useful.
| dot_blank wrote: | why not work on this library on your long train rides :)
i know that for me the train is a nice quiet place to get
great work done as you see the country side pass by
so use natures own inspiration |
Lol I've tried, but I can't work very well in the train in fact. And I don't like my laptop's screen, which is very grainy (excessive antiglare coating), it's hard to work seriously if you add the fact that I'm usually more than tired. But 4h30 train per day wasn't possible, I didn't have any social life anymore :p So I've rented a room for the rest of my year, it should go by far better ^^ _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
goebish
Joined: 14 Oct 2006 Posts: 29
|
Posted: Fri Feb 23, 2007 4:56 pm Post subject: |
|
|
Thanks Brunni, you're a chief :)
In fact I did like to have a look at SMS Plus source code because I thought it had AdHoc network support ... but I was wrong. The only source code with AdHoc support I could find are NJ's emulators (MVSPSP, CPS1PSP ...), I can compile them but they crash (when I compile them without AdHoc support they run OK).
I really need some working AdHoc code to complete my OSLib game, it would be really wonderfull if someone post some :) |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Fri Feb 23, 2007 8:13 pm Post subject: |
|
|
Sorry, I can't help you, because I don't have two PSP (nor do I have a wifi network at home) so I've never been interested in wifi ^^
But I've heard that somebody did it with OSLib, but it was long ago. Anyway, it's no different from a standard software without using OSLib. You can look at the original SMSPlus port by Chris Swindle, it does feature Adhoc wifi ;) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
goebish
Joined: 14 Oct 2006 Posts: 29
|
Posted: Fri Feb 23, 2007 9:07 pm Post subject: |
|
|
Thanks a lot for your support Brunni :)
Some friends can lend me their PSPs while the week ends so I can test my wifi code.
I'll try to find the original SMSPlus port by Chris Swindle (I didn't know this version)
Edit: I found Chris Swindle sources code on QJ, I'll have a look at it this weekend |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Sat Feb 24, 2007 11:17 pm Post subject: |
|
|
Hi! :)
I'm trying to use the OSLib...I think it's great. Good job. :)
I've got a question: can I draw text on an image?
I found nothing in the documentation.
Many thanks.
Ciaooo
Sakya |
|
| Back to top |
|
 |
goebish
Joined: 14 Oct 2006 Posts: 29
|
Posted: Sun Feb 25, 2007 2:08 am Post subject: |
|
|
| You can use oslPrintf_xy to print text where you want on the screen. If you use this function after drawing your image the text can be printed on it. |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Sun Feb 25, 2007 2:14 am Post subject: |
|
|
Hi! :)
| goebish wrote: | | You can use oslPrintf_xy to print text where you want on the screen. If you use this function after drawing your image the text can be printed on it. |
Thaks, I know. :)
I was asking because if I have "a lot" of text over an image I think it's faster to draw it once over the image and then draw only the image then drawing the image and all the text at every frame.
Ciaooo
Sakya |
|
| Back to top |
|
 |
goebish
Joined: 14 Oct 2006 Posts: 29
|
Posted: Sun Feb 25, 2007 2:22 am Post subject: |
|
|
Sorry, I can't understand what you want ... maybe you should have a look at the clipping functions, but I'm not sure.
Drawing a full screen of text on every frame should not drop performances too much anyway |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Sun Feb 25, 2007 2:32 am Post subject: |
|
|
Hi! :)
| goebish wrote: | Sorry, I can't understand what you want ... maybe you should have a look at the clipping functions, but I'm not sure.
Drawing a full screen of text on every frame should not drop performances too much anyway |
Thanks for your reply.
Sorry for my english. :)
I want:
1.load an image
2.draw all the text over this image
3.draw this image at every frame
instead of
1.load an image
2.draw the image at every frame
3.draw all the text at every frame
Ciaooo
Sakya |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Tue Feb 27, 2007 9:06 pm Post subject: |
|
|
Hi! :)
Is there a way to calculate the width/height of a text in pixel?
How can I adjust text to the right? :)
Many thanks
Ciaooo
Sakya |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Feb 28, 2007 7:27 am Post subject: |
|
|
Sorry for the late reply again, I was not at home these last days ^^
Sayka> You can, using oslSetDrawBuffer.
First, load your image, make sure to put it in VRAM, the GPU can't write to conventional RAM.
Set it as a drawbuffer (using oslSetDrawBuffer).
Draw your text on it like you would on the screen. It will be drawn to the image you set as drawbuffer instead of the screen.
Restore the original drawbuffer (the screen) using oslSetDrawBuffer(OSL_DEFAULT_BUFFER).
Do anything you want with your image ;)
| sakya wrote: | Hi! :)
Is there a way to calculate the width/height of a text in pixel?
How can I adjust text to the right? :)
Many thanks
Ciaooo
Sakya |
Look at the text.c file in the source, I think you'll understand easily how oslDrawString works.
Basically you've got an array in the current font (osl_curFont) containing the width of every character. Use osl_curFont->charWidths[yourCar] to get its width. The height is fixed for all characters in each fonts, you can get it with osl_curFont->charHeight. I think MMSPlus includes a function that calculates the width of a string, but I'm not sure anymore.
| goebish wrote: | | Drawing a full screen of text on every frame should not drop performances too much anyway |
Effectively it doesn't. Drawing your text directly on the image is a bit faster but it becomes only critical if you draw that image say 20 or 50 times per frame.
The (only) advantage of drawing text directly on an image is if you want to get the whole thing transparent, else you'll get a semi-transparent image plus a semi-transparent text over it, making a double-semi-transparent = 1/4 transparent text instead of 1/2. It's also okay if you want to scale or rotate your text.
Please note that putting an image to VRAM (for drawing) is not always a good idea. It's much faster for drawing but the VRAM is quite small (2 MB, minus the screen drawbuffer, that is 557 kB or 1.12 MB respectively for 16 or 32-bit mode) and should be reserved to critical images (drawn a lot of times, like map tilesets).
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM. _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Wed Feb 28, 2007 8:06 am Post subject: |
|
|
Hi! :)
| Brunni wrote: | Sayka> You can, using oslSetDrawBuffer.
[...]
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM. |
Wow, many thanks for the reply. I think I undestand (I'm not an experienced C/C++ coder). :)
Ciaooo
Sakya |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Feb 28, 2007 9:05 am Post subject: |
|
|
| sakya wrote: | Hi! :)
| Brunni wrote: | Sayka> You can, using oslSetDrawBuffer.
[...]
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM. |
Wow, many thanks for the reply. I think I undestand (I'm not an experienced C/C++ coder). :)
Ciaooo
Sakya |
You're welcome ^^
Btw that not really has to do with C/C++, look at oslCreateImageCopy(sourceImage, newLocation) and oslDeleteImage(anyImage). Please remember that for images placed in VRAM OSLib acts like a stack, so the last image created must be the first deleted, and so on ;) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Mon Mar 12, 2007 6:55 am Post subject: |
|
|
Hey Brunni! Thanks for this awsome lib, im using it to make my next (first!) game, and im loving it so far, but i have one small problem.
Im not sure if its a bug, or me not understanding exactly what a buffer is, but i have this code:
| Code: |
#define draw oslDrawImage
...
// Create draw buffer in VRAM
OSL_IMAGE *screen = oslCreateImage(WIDTH,HEIGHT,OSL_IN_VRAM,OSL_PF_8888);
oslSetDrawBuffer(screen);
if (curState->menu == TRUE) {
menuBack->angle++;
if (menuBack->angle==360) menuBack->angle=0;
draw(menuBack);
}
oslSetDrawBuffer(OSL_DEFAULT_BUFFER); // Restore default buffer
screen->centerX = screen->sizeX/2; // Use center of screen buffer
screen->centerY = screen->sizeY/2;
screen->x = WIDTH/2;
screen->y = HEIGHT/2;
draw(screen);
oslDeleteImage(screen);
//End of display code
oslEndDrawing();
//Synchronization
oslSyncFrame(); |
And 'menuBack' is being drawn under 'screen'. Shouldnt oslDrawImage draw onto the current buffer, which would be 'screen' in this case? |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Thu Mar 15, 2007 4:25 am Post subject: |
|
|
Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Thu Mar 15, 2007 5:41 am Post subject: |
|
|
| Brunni wrote: | Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;) |
Thats the thing though, thats what i expect to happen, but menuback isnt being shown at all, like its underneath screen, or being drawn onto OSL_DEFAULT_BUFFER before screen. |
|
| Back to top |
|
 |
goonjamin
Joined: 25 Mar 2007 Posts: 1
|
Posted: Sun Mar 25, 2007 10:14 am Post subject: Maps Sample Freeze |
|
|
Hi,
I've installed OSlib 1.0 from brunni.dev-fr.org and tried to compile the maps sample found at http://oslib.palib.info/samples/.
Everything compiled fine and the program loads on my PSP. Everything works (scrolling, sound, adding and removing layers) except the screenshot function just freezes when I press select? I have no choice but to shutdown the PSP and restart.
I am using 3.03oe-c and running this from the GAME150 directory would that cause any problems with the screenshot function in this example?
Thanks for a great programing lib! :) |
|
| Back to top |
|
 |
Shatai
Joined: 06 Apr 2007 Posts: 1
|
Posted: Fri Apr 06, 2007 8:10 pm Post subject: |
|
|
With OSLib, how can I access map-specific data as to what type of tile lies at a particular coordinate of an OSL_MAP?
edit: nevermind, I am retarded. |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Tue Apr 10, 2007 7:20 pm Post subject: Re: Maps Sample Freeze |
|
|
| goonjamin wrote: | | I am using 3.03oe-c and running this from the GAME150 directory would that cause any problems with the screenshot function in this example? |
This is not normal. At least it works perfectly for me (3.10 OE-A'). Anyway I don't want to debug this now as I'm preparing the next version and a lot of things changed, however if you're still getting this problem with the next version, please contact me ;-) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Apr 11, 2007 3:45 am Post subject: |
|
|
| seventoes wrote: | | Brunni wrote: | Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;) |
Thats the thing though, thats what i expect to happen, but menuback isnt being shown at all, like its underneath screen, or being drawn onto OSL_DEFAULT_BUFFER before screen. |
Now that I think about it, you must make sure that the alpha in the drawbuffer is nonzero (or disable alpha by calling oslSetAlpha(OSL_FX_NONE, 0), or use a format that doesn't contain alpha: OSL_PF_5650) else nothing will be drawn because alpha=0 means a transparent pixel. You can clear the image by yourself if you want:
| Code: | u32 backColor = oslConvertColor(image->pixelFormat, OSL_PF_8888, RGBA(0, 0, 0, 255));
oslClearImage(image, backColor); |
Note that the convertcolor is not necessary, it's just here to ensure that the color will be in the same pixel format as the image. The important thing is: alpha is 255, that is, opaque. _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Wed Apr 11, 2007 3:46 pm Post subject: |
|
|
| Brunni wrote: |
Now that I think about it, you must make sure that the alpha in the drawbuffer is nonzero (or disable alpha by calling oslSetAlpha(OSL_FX_NONE, 0), or use a format that doesn't contain alpha: OSL_PF_5650) else nothing will be drawn because alpha=0 means a transparent pixel. You can clear the image by yourself if you want:
| Code: | u32 backColor = oslConvertColor(image->pixelFormat, OSL_PF_8888, RGBA(0, 0, 0, 255));
oslClearImage(image, backColor); |
Note that the convertcolor is not necessary, it's just here to ensure that the color will be in the same pixel format as the image. The important thing is: alpha is 255, that is, opaque. |
Aha! That worked perfectly, thanks brunni! Cant wait for the next version of OSLib! (feature request: drawing an image with specific alpha ;) ) |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Apr 11, 2007 11:00 pm Post subject: |
|
|
| seventoes wrote: | | Aha! That worked perfectly, thanks brunni! Cant wait for the next version of OSLib! |
Thanks! I hope you'll be happy with it ;-)
| seventoes wrote: | | (feature request: drawing an image with specific alpha ;) ) |
Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want? _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Thu Apr 12, 2007 1:40 pm Post subject: |
|
|
| Brunni wrote: | | seventoes wrote: | | (feature request: drawing an image with specific alpha ;) ) |
Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want? |
Not really, i mean kind of like oslDrawImageXY, but with alpha instead of XY, for example i could draw an image all blue and semi-transparent by calling oslDrawImageAlpha(image,RGBA(0,0,255,100));
Right now there isnt (or im not seeing!) a way to do anything like that. Any advice? :) |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Fri Apr 13, 2007 8:45 pm Post subject: |
|
|
| seventoes wrote: | | Brunni wrote: | | seventoes wrote: | | (feature request: drawing an image with specific alpha ;) ) |
Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want? |
Not really, i mean kind of like oslDrawImageXY, but with alpha instead of XY, for example i could draw an image all blue and semi-transparent by calling oslDrawImageAlpha(image,RGBA(0,0,255,100));
Right now there isnt (or im not seeing!) a way to do anything like that. Any advice? :) |
With this version:
| Code: | void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Save current alpha params
int oldEffect = osl_currentAlphaEffect, oldAlpha = osl_currentAlphaCoeff;
//Temporarily set alpha
oslSetAlpha(OSL_FX_ALPHA | OSL_FX_COLOR, alpha);
oslDrawImage(img);
//Restore old value
oslSetAlpha(oldEffect, oldAlpha);
} |
With the new version:
| Code: | void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Save current alpha params
OSL_ALPHA_PARAMS p;
oslGetAlphaEx(&p);
oslSetAlpha(OSL_FX_TINT, alpha);
oslDrawImage(img);
oslSetAlphaEx(&p);
} |
Raw method (the alpha mode must be OSL_FX_DEFAULT):
| Code: | void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Does not resotre original alpha value, so next images will also appear tinted unless you issue a oslSetAlpha(OSL_FX_DEFAULT, 0) after this call
sceGuAmbientColor(alpha);
oslDrawImage(img);
} |
_________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Sat Apr 14, 2007 4:54 am Post subject: |
|
|
ohhh thanks, that should work just fine.
any release date estimate? :) |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Sat Apr 14, 2007 5:12 am Post subject: |
|
|
I don't know exactly yet, but there should be a beta very soon, and the final 2.0 (with new samples and documentation) in planned for summer (as Yodajr is unavailable until then) ;-) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
Yodajr
Joined: 24 Sep 2005 Posts: 13
|
Posted: Sat Apr 14, 2007 9:24 am Post subject: |
|
|
Huhuhu... I'll do my best ;) _________________ Tutorials about OSLib here |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Sat Apr 14, 2007 7:57 pm Post subject: |
|
|
Brunni , can you help me a little with your library?
Brunni, pouvez-vous m'aider avec votre bibliothèque ? (translation by babel fish)
Please because you're the only one who can.
Svp parce que vous êtes le seul qui peut. (translation by babel fish)
Here's my code for the animation!
Voici mon code pour l'animation ! (translation by babel fish)
| Quote: | s++;
oslSetImageTileSize(Soldier_dead,(s * 30),0,30,47);
if (s>soldier_max_frame) s=0; |
Do you know how i can create a new instance of the object every time?
Savez-vous je peux créer un nouvel exemple de l'objet chaque fois ?(translation by babel fish) |
|
| Back to top |
|
 |
|
|
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
|