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 

Some newbie programming questions...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Shanoul



Joined: 17 Oct 2005
Posts: 2

PostPosted: Mon Oct 17, 2005 2:42 am    Post subject: Some newbie programming questions... Reply with quote

Hi guys... Just wandering on the forum... I'm a newbie here, and had a little programming experience in C++...
I now started to code somethin' for the psp but cannot get too far...
I installed the cygwin + dev c++ solution and the psp toolchain.
Ok, now i developed a little "star demo" where stars (i.e. random yellow pixels, but i feel poetic today) appear. When I push a key (i.e. X) it puts on pause mode (that is loops lookin for the right key to be pressed) and waits. Then it continues.
I took my infos from various sources downloaded from the net, and trying to understand somethin about the psp hardware.
I plan to release the little demo when it will be enough clear to me to add documentation to it and to make it understandable for all the ppl (or ehm... myself included)
Some questions so...

Please note that i took everything to work from demos, in particular a file called pg.h and pg.c (i.e. primitive graphic, think it is from pspsdk)

1- I had problems accessing the memcpy function... the truth is that i do not exactly remember how it does work. What i mean is this
<save the vram in the screen>
put the "PAUSE MODE" window on screen
<when the right key pressed, load the previous saved screen>
I did it using a cycle but it is not fast and quite ugly for a programmer to see in the code, so I looked for the memcpy function. Here's the prototype of the builtin funct, as far as i can remember it :
memcpy(void*, const void*, size_t)
ok so... I get the VRAM address with a pointer like this :

unsigned short* vram = (unsigned short*) pgGetVramAddr(0,0);

would like to make a memcpy on an allocated buffer. But it gives me errors on compatible types when i try to do it, doing a buf[VRAM_SIZE] or a *buf gives the same result

2- how to allocate dynamic memory? MK_FP does work? malloc and calloc?

3- how to use video ram swapping screens? I wanted to use the screenfilp function but cannot make it work properly...
First I set a screen with pgScreenFrame(1, 1);
then i want to write lines on a "swap page" and then copy it on the main VRAM. Anyone can help?

4- Are there any functions to change the palette like old codes for DOS demos? (I did something in the past with fractals and so on, but now I'm quite rusty, VB at work makes mind lazy!!!!)

Ok for now i think it is enough, thanks for the kindness and good day/night to you all.
Dario
Back to top
View user's profile Send private message
Shanoul



Joined: 17 Oct 2005
Posts: 2

PostPosted: Tue Oct 18, 2005 2:27 pm    Post subject: Reply with quote

No help at all? :(
Am I using the right tools or should I direct myself to other premade libraries?
I would not like to use LUA language, just to program the psp itself...
Back to top
View user's profile Send private message
starman2049



Joined: 19 Sep 2005
Posts: 75

PostPosted: Tue Oct 18, 2005 3:12 pm    Post subject: Reply with quote

I would start with the basic cube sample in the sdk at

samples\gu\cube

Complile it, make sure it runs then you can build from there. There are other samples too, but at the level you are at you should be able to have lots of fun just with that for now...

To answer some of your questions, malloc() works on the psp, and the cube example from above shows how to "flip pages"

Hope that helps...
Back to top
View user's profile Send private message
weak



Joined: 13 Jan 2005
Posts: 114
Location: Vienna, Austria

PostPosted: Tue Oct 18, 2005 4:26 pm    Post subject: Reply with quote

Quote:
unsigned short* vram = (unsigned short*) pgGetVramAddr(0,0);


looks like something from nem's pre sdk code.

make sure to get the latest version of the toolchain and the sdk via svn. hint: wiki

then just take a look at the samples. you'll find nice libraries for gfx stuff aswell as standard c libs.
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
Page 1 of 1

 
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