| View previous topic :: View next topic |
| Author |
Message |
silverbyte
Joined: 10 Apr 2005 Posts: 18
|
Posted: Tue Jun 27, 2006 10:13 pm Post subject: |
|
|
BRUNNI, ton anglais et marvelous, puis arret de dir votre anglais et pas bon, parceque mon francais is WORSE!!! ;)
Your lib kicks ass. Love it. I have a couple of questions.
1) what does oslCreateSwizzledImage do? is this meant for loading images into VRAM ? there seems to be no documentation on this
2) in your maps/sound sourcecode with the 8 layers (very cool example) how do you create the maps.h file? is there a tool to convert png to c code? and does that support ALPHA? OSL_PF_8888
3) OSL_MAP ; oslDrawMapSimple ; oslCreateMap ; where can i get information on this, i don't understand how you are infinately scrolling in that maps/sound example.
| Code: |
nuages = oslCreateMap(
nuagestileset,
nuages_map,
8,8, //<---???
64,34,
OSL_MF_U16); //<--???
|
|
|
| Back to top |
|
 |
__count
Joined: 23 Mar 2006 Posts: 22
|
Posted: Wed Jun 28, 2006 1:38 am Post subject: |
|
|
| silverbyte wrote: | BRUNNI, ton anglais et marvelous, puis arret de dir votre anglais et pas bon, parceque mon francais is WORSE!!! ;)
Your lib kicks ass. Love it. I have a couple of questions.
1) what does oslCreateSwizzledImage do? is this meant for loading images into VRAM ? there seems to be no documentation on this
|
Swizzled textures have reordered pixel data to optimize read access. I general you should swizzle all your textures because the performance difference is very significant. |
|
| Back to top |
|
 |
silverbyte
Joined: 10 Apr 2005 Posts: 18
|
Posted: Wed Jun 28, 2006 3:17 am Post subject: |
|
|
ok so i load my image
tmpImg = oslLoadImageFile(filename, OSL_IN_RAM, OSL_PF_8888);
then i swizzle it, and use the swizzle image
newImg = oslCreateSwizzledImage(temp, OSL_IN_VRAM);
makes sense, thanx __count.
Anyone know the answer to #2 and #3 in my previous post? |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Wed Jun 28, 2006 3:56 am Post subject: |
|
|
| silverbyte wrote: | ok so i load my image
tmpImg = oslLoadImageFile(filename, OSL_IN_RAM, OSL_PF_8888);
then i swizzle it, and use the swizzle image
newImg = oslCreateSwizzledImage(temp, OSL_IN_VRAM);
makes sense, thanx __count.
Anyone know the answer to #2 and #3 in my previous post? |
Have you read the documentation? It's very good.
I've been wondering how he did the maps.h code too. Probably by hand, but I'm not sure. I'll figure it out someday. There are tools to convert png to c(gimp can save images as c or h), but that's not the case here. If it were, there would be no reson to include the tilesets. Another reason why I think it was written by hand.
As for your 3rd question, read through the documentation and source code til you understand how the whole thing works. |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Jun 28, 2006 10:07 pm Post subject: |
|
|
Thanks ^^ I use GBA Graphics for converting & editing my maps, however it doesn't support alpha channel... :-( _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
silverbyte
Joined: 10 Apr 2005 Posts: 18
|
Posted: Thu Jun 29, 2006 7:13 am Post subject: fantastic |
|
|
thanx for the tip, heres a link for ppl who wanna convert there GRFX to C header style code (i have yet to try)
http://www.megagames.com/gba/files/gfx2gba.zip
(btw brunni you should include it in your tools as part of the OSLIB)
------------------------------------------------------------------------------------
nope.. it works but itz not what is used in his map.h file...
i spent several hours trying to find several tools, and none come close to the same output like the map.h
so brunni what do you use? is it your own converter? |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Thu Jun 29, 2006 6:30 pm Post subject: |
|
|
Yes, "GBA Graphics" is the software name (and yes it's written by me) ^^ _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
silverbyte
Joined: 10 Apr 2005 Posts: 18
|
|
| Back to top |
|
 |
silverbyte
Joined: 10 Apr 2005 Posts: 18
|
Posted: Sun Jul 02, 2006 9:09 am Post subject: |
|
|
| i noticed your GBA graphics has something for COLLISION!!! ? does this mean you will be implementing a collision engine in OSLIB for PSP? |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 03, 2006 2:47 pm Post subject: |
|
|
| silverbyte wrote: | | i noticed your GBA graphics has something for COLLISION!!! ? does this mean you will be implementing a collision engine in OSLIB for PSP? |
oo, that would rock! |
|
| Back to top |
|
 |
popcornx
Joined: 14 Mar 2006 Posts: 6
|
Posted: Thu Jul 06, 2006 4:38 am Post subject: |
|
|
Everything works perfectly but, when I add sound, the screen starts to flicker, I'm not sure why. _________________ 23BDFFFCAFB1000423BD0004
"nothing is impossible, not if you could imagen it" |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Sat Jul 08, 2006 4:15 pm Post subject: |
|
|
| popcornx wrote: | | Everything works perfectly but, when I add sound, the screen starts to flicker, I'm not sure why. |
o rly? pm me the source and I'll see if I can fix it. |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Sun Jul 09, 2006 6:17 am Post subject: |
|
|
| ok, one quick question. How do I load my own font and use it? I know how to convert it into a oft, but how do I use the font? |
|
| Back to top |
|
 |
nakuribon
Joined: 10 Jul 2006 Posts: 5
|
Posted: Mon Jul 10, 2006 6:51 am Post subject: |
|
|
i have a problem... when i try to compile my code i get this:
| Code: |
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -c -o main.o main.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib main.o -losl -lpng -lz -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -o theGame.elf
/usr/local/pspdev/psp/sdk/lib/libosl.a(oslib.o): In function `oslSystemMessage':
/home/Florian/oslib/oslib.c:1071: undefined reference to `sceUtilityGetSystemParamInt'
/home/Florian/oslib/oslib.c:1073: undefined reference to `sceUtilityGetSystemParamInt'
/home/Florian/oslib/oslib.c:1092: undefined reference to `sceUtilityMsgDialogInitStart'
/home/Florian/oslib/oslib.c:1097: undefined reference to `sceUtilityMsgDialogGetStatus'
/home/Florian/oslib/oslib.c:1099: undefined reference to `sceUtilityMsgDialogUpdate'
/home/Florian/oslib/oslib.c:1103: undefined reference to `sceUtilityMsgDialogShutdownStart'
/usr/local/pspdev/psp/sdk/lib/libpng.a(pngerror.o): In function `png_warning':
pngerror.c:(.text+0x14c): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
pngerror.c:(.text+0x1a8): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
pngerror.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
/usr/local/pspdev/psp/sdk/lib/libpng.a(pngerror.o): In function `png_error':
pngerror.c:(.text+0x2a8): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
pngerror.c:(.text+0x310): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
pngerror.c:(.text+0x314): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
/usr/local/pspdev/psp/sdk/lib/libpng.a(pngrutil.o): In function `png_handle_gAMA':
pngrutil.c:(.text+0xd08): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
/usr/local/pspdev/psp/sdk/lib/libpng.a(pngrutil.o): In function `png_handle_cHRM':
pngrutil.c:(.text+0x146c): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
pngrutil.c:(.text+0x14dc): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
/usr/local/pspdev/psp/sdk/lib/libpng.a(pngrutil.o): In function `png_handle_sRGB':
pngrutil.c:(.text+0x178c): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
collect2: ld returned 1 exit status
make.exe: *** [theGame.elf] Error 1
Execution terminated
|
does anyone know how to fix this? heres my Makefile: | Code: | TARGET = theGame
OBJS = main.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
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = The Game
PSPSDK=$(shell psp-config --pspsdk-path)
include e:/cygwin2/$(PSPSDK)/lib/build.mak
|
|
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 10, 2006 7:48 am Post subject: |
|
|
Replace your makefile with this and tell me if it works.
| Code: | TARGET = theGame
OBJS = main.o
CFLAGS = -G0 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
STDLIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = The Game
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
|
|
|
| Back to top |
|
 |
nakuribon
Joined: 10 Jul 2006 Posts: 5
|
Posted: Mon Jul 10, 2006 7:55 am Post subject: |
|
|
nope, same thing
i have no idea whats going on, ive never had a problem with libpng before, i used the one that came with oslib and the one from the psp svn, both do the same thing. also whats with the undefined functions in oslib.o? |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 10, 2006 9:06 am Post subject: |
|
|
| you should probably update your libpng, your sdk, and maybe even the oslib. |
|
| Back to top |
|
 |
nakuribon
Joined: 10 Jul 2006 Posts: 5
|
Posted: Mon Jul 10, 2006 11:55 am Post subject: |
|
|
| thats what im doing, im starting from scratch, and im going to use debian this time instead of stupid cygwin... windows never does anything right lol |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 10, 2006 12:07 pm Post subject: |
|
|
| nakuribon wrote: | | thats what im doing, im starting from scratch, and im going to use debian this time instead of stupid cygwin... windows never does anything right lol |
yeah, Cygwin installed perfectly on the computer I'm using, and my laptop, but for some reason it couldn't install on my other computer. Weird huh? Well, whatever works for you. Goodluck. |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 10, 2006 12:07 pm Post subject: |
|
|
| Zettablade wrote: | | ok, one quick question. How do I load my own font and use it? I know how to convert it into a oft, but how do I use the font? |
Just thought I'de resurface this. Brunni? |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Mon Jul 10, 2006 12:28 pm Post subject: |
|
|
| Zettablade wrote: | | Zettablade wrote: | | ok, one quick question. How do I load my own font and use it? I know how to convert it into a oft, but how do I use the font? |
Just thought I'de resurface this. Brunni? |
From the first page of this very thread...
oslLoadFontFile("yourfont") |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Mon Jul 10, 2006 12:33 pm Post subject: |
|
|
| Insert_witty_name wrote: | | Zettablade wrote: | | Zettablade wrote: | | ok, one quick question. How do I load my own font and use it? I know how to convert it into a oft, but how do I use the font? |
Just thought I'de resurface this. Brunni? |
From the first page of this very thread...
oslLoadFontFile("yourfont") |
Oh, didn't see that. I'll try it and see if it works :)
EDTI:: That just loads a font. thks, that helps, but how do I use the font I loaded? |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Tue Jul 11, 2006 6:44 am Post subject: |
|
|
| Also, The usb doesn't wanna work either... or I'm probably just doing it wrong. |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Tue Jul 11, 2006 5:35 pm Post subject: |
|
|
Sorry I didn't come for a while :-'
1) For USB you must be in kernel mode (you can create a user thread after you loaded the drivers, and use OSLib from either the user or kernel thread, but I recommend running it from the user one - as the rest of your code - for safety reasons).
* There is no more built-in support for USB in OSLib as it requires kernel mode (even if USB is not used), and I don't want to oblige using kernel mode.
2) yourfont = oslLoadFont("yourfont.oft"), then oslSetFont(yourfont) and oslPrintf, oslDrawString and so on ;) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
Kojima
Joined: 26 Jun 2006 Posts: 275
|
Posted: Tue Jul 11, 2006 6:26 pm Post subject: |
|
|
Hi,
I'm using OSlib to add sound to my engine, but I've run into a wierd problem.
If I play the sound once just before my main loop, it works fine.
But if I do this,
| Code: |
if( joy->_triangle==1 )
{
oslStopSound(snd);
oslPlaySound(snd, 1);
}
|
It's as if the sound is being played a thoushand times at quater of a second intervals.
Almost as if the oslstopsound was not working and it was buffering up a shedload of play calls. And it goes without saying what is audible is nothing like the original sound.
But the first method, play once before main loop sounds identical as to it does on the pc.
I think what you might need (Depending on what's causing this) is a channel system. Where by each play sound allocates a channel and returns it, and you can then stop the channel before playing the sound again.
Also will you be adding soundpitch to alter the pitch of a playing sound?
Nice lib btw. |
|
| Back to top |
|
 |
Kojima
Joined: 26 Jun 2006 Posts: 275
|
Posted: Tue Jul 11, 2006 7:26 pm Post subject: |
|
|
ok I changed it to this,
| Code: |
if( joy->_triangle==1 )
{
if(playsnd==0)
{
playsnd = 1;
oslPlaySound(snd, 1);
}
else
{
}
}
else
{
playsnd = 0;
}
|
and the sound now plays fine in the main loop, but only once. it never rings twice much to dismay of glenn close. |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Wed Jul 12, 2006 4:01 am Post subject: |
|
|
You should use the oslib's built in control functions.
| Code: |
if( osl_keys->pressed.triangle )
{
oslPlaySound(snd, 1);
}
|
That's a good technique for sound effects, and it should work if your playing music. Tell me how it goes. |
|
| Back to top |
|
 |
SiW
Joined: 10 Aug 2005 Posts: 7 Location: Whittemore, Iowa, USA
|
Posted: Sat Jul 15, 2006 3:59 pm Post subject: |
|
|
How would I have an image scroll itself? I tried increasing offsetX0 and offsetX1, which works, but has a seam when it repeats. Any ideas?
Also, is there a complete example of drawing to an image? I tried the code snippet from the docs but that only worked in the PC test harness, not on the PSP. |
|
| Back to top |
|
 |
nakuribon
Joined: 10 Jul 2006 Posts: 5
|
Posted: Sun Jul 16, 2006 5:37 am Post subject: |
|
|
| Brunni wrote: | Sorry I didn't come for a while :-'
1) For USB you must be in kernel mode (you can create a user thread after you loaded the drivers, and use OSLib from either the user or kernel thread, but I recommend running it from the user one - as the rest of your code - for safety reasons).
* There is no more built-in support for USB in OSLib as it requires kernel mode (even if USB is not used), and I don't want to oblige using kernel mode.
2) yourfont = oslLoadFont("yourfont.oft"), then oslSetFont(yourfont) and oslPrintf, oslDrawString and so on ;) |
Is there a new version of oslib out? oslDrawString doesn't seem to exist in the documentation or in oslib.h...
Fixed my compiler problems btw, everything's working perfectly under linux... stupid windows.... |
|
| Back to top |
|
 |
waterbottle
Joined: 07 Jul 2006 Posts: 3
|
Posted: Sun Jul 16, 2006 6:20 am Post subject: |
|
|
| Brunni wrote: | It's not documented yet, but you have to create one with font2osl.exe (included in the tools folder) and then oslLoadFontFile("yourfont").
You can also convert an existing Windows font (run font2osl.exe without parameter for more info). | I tried running font2osl.exe but it only popsup for 1/10th of a second and then colses by it self..
it says:
tried copying a font over to the directory but that didn't help.. Does anyone know whta to do? |
|
| Back to top |
|
 |
|