Page 1 of 1

Setting up graphics, uploading a buffer and reading vram(:))

Posted: Wed Jun 28, 2006 7:58 pm
by Kojima
How do you set up the graphics mode? I wish to use raw ps2 libs(I.e not one of the wrappers, no reason just want to do it myself)
Any examples/tutorials etc you can point me to?

I.e

Code: Select all

     Ps2_InitGraphics( PS2_PAL,PS2_HiRes,PS2_32Bit )
Second thing I'll be doing after that will be uploading a system bitmap buffer (I.e a malloced(width*height*3)), so any code/tutorials on that? I've been told I need to construct a gif packet and dma it to the vram, but nothing would help me more than a code example so I can see how it's done.

And something else, not so important, just more curious, is reading vram. Can the ps2 do this fastly? I imagine so because quite a few ps2 games have nice fx like motion blur and even more impressive in Black(Crap game but nice tech) the whole screen blurs when you reload. Or they all done on the gpu?

Any help you can give on any of the above would be cool, even if it's just a link to a article/source code example.


Thanks.

Posted: Wed Jun 28, 2006 8:23 pm
by cheriff
In ps2sdk there is libdraw, libgraph, and libpacket. Some of the routines therein are pretty much as low as you can get without setting bits in various registers yourself.
Some of these routines do nice things like set screen modes and upload textutres to vram.. And a texture in the same format as the sreen buffer can be DMA'd dirtectly to vram[0] (or whereever you set your framebuffer to start). Which is pretty much what I imagine you want to do.
I use these routines to set stuff up, but then custom stuff to do actual drawing ...

Posted: Wed Jun 28, 2006 9:27 pm
by evilo
You can also use gsKit (by neoV), that will do almost all the job for you (building packets, sending to vram, et...) and that reached now a very good level of performances.

the lib is available in the svn.

Posted: Wed Jun 28, 2006 10:29 pm
by Kojima
Don't think I can use GsKit, that would mean compiling it would it not? Which would mean me installing cyngwin and I don't have the hd space for that (14gig hd with most of it used already)
Atm I'm using a prebuilt ps2sdk. or does it come already compiled in lib form?

cherf are there any docs/examples for them? I'm not looking for something too complex, just simple screen initialization, and maybe a single packet set up and sent that draws a rect or something, so I can base my code on that.

Posted: Wed Jun 28, 2006 10:50 pm
by cheriff
If you can compile your own code, you can compile gsKit.. its just a library to link against and can build with whatever prebuilt toolchain you have. It may take some fiddling if you dont want cygwin, Im not sure if you have make or whatnot.

And as with most everything here, examples are in the source. Grab a svn client (turtle svn seems populer on windows, IIRC) or even browse the online at svn.ps2dev.org.
And as for step 1, step 2, step 3 guide that I know of.. there is this: http://ps2dev.org/ps2/Tutorials (the dreamtime ones, in particular) but Im not sure how outdated that are.. Had you looked here?

And rememer... 'Use the Source, Luke'

Posted: Wed Jun 28, 2006 11:03 pm
by Kojima
yeah i checked the tutorials. i dunno why i havn't re-checked them now i have it all up and running. stupidness on my part i guess.

yeah i'll get gs. for some reason i was thinking you had to build it in cyngwin, only just occured to me it's ps2 code so will use the toolchain i already have.

Posted: Thu Jun 29, 2006 12:43 am
by Kojima
Hmm, i'm going through dreamtimes tutorial( the first one) and I've started by cutting and pasting the defines etc into the hello world app, so I can get an overall picture of everything, but there are three functions for dma that are referenced but are not contained within any of the tutorials source code.

However they are referenced in a linker map file include,

Find 'dma' in 'C:\ps2Emu\ps2tut_01\demo1.map' :
C:\ps2Emu\ps2tut_01\demo1.map(5): gs_dma_buf_dma_size
C:\ps2Emu\ps2tut_01\demo1.map(7): gs_dma_buf_cur 0x4 obj/g2.o
C:\ps2Emu\ps2tut_01\demo1.map(8): gs_dma_buf 0x330 obj/g2.o
C:\ps2Emu\ps2tut_01\demo1.map(21): LOAD obj/dma_asm.o
C:\ps2Emu\ps2tut_01\demo1.map(61): .text 0x0000000000202180 0x9c obj/dma_asm.o
C:\ps2Emu\ps2tut_01\demo1.map(62): 0x0000000000202180 dma_reset
C:\ps2Emu\ps2tut_01\demo1.map(107): 0x0000000000202680 gs_dma_buf_dma_size
C:\ps2Emu\ps2tut_01\demo1.map(108): 0x0000000000202684 gs_dma_buf_cur
C:\ps2Emu\ps2tut_01\demo1.map(109): 0x00000000002026c0 gs_dma_buf
C:\ps2Emu\ps2tut_01\demo1.map(125): .mdebug 0x0000000000c84148 0x254 obj/dma_asm.o
Found 'dma' 12 time(s).
----------------------------------------


Know why? I can't make any progress beyond this point without being able to call them functions. (I did try to compile but it just throws an error saying they're undefined.)