vram direct access and pitch

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Atenus
Posts: 9
Joined: Sun Nov 05, 2006 6:37 pm
Location: Argentina

vram direct access and pitch

Post by Atenus »

im accessing vram directly thrugh 0x44000000, but the problem is that i dont know the pitch, so supouse i want to make a code to fill all screen with an RGB color:

Code: Select all

sceDisplaySetMode(0, 480, 272); 

int * p_vram = (int *) 0x44000000; 

    sceDisplaySetFrameBuf((void *)p_vram, 480, 
         PSP_DISPLAY_PIXEL_FORMAT_8888, 
         PSP_DISPLAY_SETBUF_IMMEDIATE); 

int color; 
    
               color = RGB(0xFF,0,0); 
    
   for &#40;int i = 0; i < 272 ; i++&#41; 
   &#123; 

       for &#40;int j = 0; j < 480; j++&#41; 
       &#123; 
          *p_vram = color; 
          p_vram++; 
       &#125; 
    
      p_vram += PITCH_VALUE; 
   &#125; 


where:

- RGB() macro is one for creating an int rgb color passing the three bytes values.
- PITCH_VALUE should be the amout of (bytes / 4) to get the address of the next row.

I have been trying to figure out what value could be the pitch, but no results.

any help?
- Ateneo -
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

It should be 512. Well, 512-480 in your case actually
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Atenus
Posts: 9
Joined: Sun Nov 05, 2006 6:37 pm
Location: Argentina

Post by Atenus »

thanks a lot
- Ateneo -
Post Reply