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 

How to use SyncDCache properyly?

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



Joined: 01 Sep 2007
Posts: 15

PostPosted: Sun Jun 20, 2010 12:27 am    Post subject: How to use SyncDCache properyly? Reply with quote

I'm probably having trouble with SyncDCache.It doesn't work.

It's a font program.
There is a 640x480 PSMCT4 image(mem_image) in the memory.
Font data was converted to PSMCT4 format on the fly,then was writed into this image,and was displayed.

Problem is:When display() runs,it always display things that should be displayed last time.
Eg:I first write "X" font data,display() runs,it display nothing.
then I write "Y" font data,display() runs,it display "X".
then I write "Z" font data,display() runs,it display "Y".
.....

can someone help me?


Code:

static inline void putpixel(unsigned char *memimg,unsigned char* src, int offset)
{
// font width 20 height 23
   int i,j,x,y;
   x=offset%32;
   y=offset/32;
   x=x*(20/2);
   y=(y*2)*(640/2);
   for(j=0;j<18;j++){
      for(i=0;i<9;i++){
         memimg[y+j*(640/2)+x+i]=src[j*9+i];
      }
   }
   SyncDCache(memimg+y, memimg+y+(640/2)*23);
}


static int display(unsigned char *pixel, int num)
{
unsigned char buf[512];
convToPSMCT4(pixel, buf);
putpixel(mem_image,buf,num);
gs_load(mem_image);
displayfont();
......
}
Back to top
View user's profile Send private message
Mega Man



Joined: 18 Jun 2005
Posts: 274

PostPosted: Fri Jun 25, 2010 8:58 am    Post subject: Reply with quote

I assume that SyncDCache is working, but the problem is somewhere else. Maybe you are confusing the frame buffers or there is just a missing GS_TEXFLUSH or your data is not properly aligned. What graphic library are you using?
Back to top
View user's profile Send private message Visit poster's website
Fakeuser



Joined: 01 Sep 2007
Posts: 15

PostPosted: Thu Jul 01, 2010 9:08 pm    Post subject: Reply with quote

Thanks your attention.
Forget it,I found it's old pcsx2's fault.:p
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 -> PS2 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