Draw text on XMB

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Draw text on XMB

Post by hotter »

Now I am using "VSHBlitter0.2" function "blit_string46" to draw text on XMB, but it sometimes makes my psp to crash, for example when I turn my psp to sleep and then on it crashes. And when I draw text atop (x=0 y=0) the text is blinking and it is hard to see it... why is that? is there any thing I can do to change it? or maybe I should use other way to draw text in XMB? is there better functions that are fully working?
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

I found in google that I need to hook sceGuFinish. Can I hook it with a syscall patch? if so what these parameters are: sctrlHENFindFunction("???", "???", ???); ? I cant find these. any help?
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

You can blit anything to XMB without any hooks, you'll just need to setup GE in every display list you sent

You don't need to clear screen each time, cuz XMB will do it for you and you also don't need to setup framebuffer and draw region.

This sample will help you to understand better the concept:
http://foosa.do.am/MDL_SAMPLE.zip
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

But thats user mode only. What about from kernel plugin? And from in-game user mode will usually crash with memory problems.
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

The same thing but in kernel mode (for 5.00FW)
http://foosa.do.am/MDL_SAMPLE_KERNEL.rar

At real if you wanna make it compatible with games and especially with homebrew, you need use:
sceGeSaveContext();
sceGeRestoreContext();
in the signal and finish callbacks of your display list
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

Thx for examples.
Well this is much better when "blit_string46", but text still sometimes blink, I guess when cpu usage is high... I will try it on my prx. Thx again.
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

hotter wrote:Thx for examples.
Well this is much better when "blit_string46", but text still sometimes blink, I guess when cpu usage is high... I will try it on my prx. Thx again.
The text will ALWAYS "blink" or flicker to some extent unless you hook one of the screen swap routines. That's because you can't count on when your text will be drawn, and it's just as likely to be right after the app swaps screens as any other time. The sooner after a swap you draw your text, the more likely it is to be overdrawn by the application running.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

OldPrisoneR wrote:You can blit anything to XMB without any hooks, you'll just need to setup GE in every display list you sent

You don't need to clear screen each time, cuz XMB will do it for you and you also don't need to setup framebuffer and draw region.

This sample will help you to understand better the concept:
http://foosa.do.am/MDL_SAMPLE.zip
Way to let go of everything (4c 45 41 4b)!

-

Good Work?
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

KickinAezz wrote:...(4c 45 41 4b)!
What did you mean?
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

OldPrisoneR wrote:
KickinAezz wrote:...(4c 45 41 4b)!
What did you mean?
Nevertheless, we can see some interesting things in future.. better PRX plugins that donot depend on VRAM blitting, etc

GU acceleration by itself, is a great optimization.
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

OldPrisoneR wrote:
KickinAezz wrote:...(4c 45 41 4b)!
What did you mean?
ASCII for L E A K.
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

ASCII for L E A K.
^^
J.F., have you worked with save/restore GU context fuctions?
I wonder, where to put 'em to my code... to make context the same, after executing my display list.

I assume that whole thing must be something like this:
1. the first command of dlist must be a signal for saving
- In the signal handler I'll save GE context (and GE must wait while handler instructions are executed!)
2. the last command of dlist must be a signal for restoring
- In the signal handler I'll restore GE context (and again GE must wait while handler instructions are executed, that the reason we can't use finish handler - in its case GE won't stop)

Anyway that's just my assumption :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

OldPrisoneR wrote:
ASCII for L E A K.
^^
J.F., have you worked with save/restore GU context fuctions?
I wonder, where to put 'em to my code... to make context the same, after executing my display list.

I assume that whole thing must be something like this:
1. the first command of dlist must be a signal for saving
- In the signal handler I'll save GE context (and GE must wait while handler instructions are executed!)
2. the last command of dlist must be a signal for restoring
- In the signal handler I'll restore GE context (and again GE must wait while handler instructions are executed, that the reason we can't use finish handler - in its case GE won't stop)

Anyway that's just my assumption :)
I've not worked on save/restore of the GE context, but yes, I'd say that the first thing is to SAVE and the last is to RESTORE. That seems like it would work better than the other way around. ;)
:D
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

I have a problem with this. If I edit your text from:

Code: Select all

sprintf(buf,"Hi I'm 0x%x KERNEL ;)",(int)threadDisp);
to:

Code: Select all

sprintf(buf,"Hi I'm 0x%x KERNEL ;) 123456789123456789",(int)threadDisp);
In psp I pres LTRIGGER and go to play video, then psp starts to beep and freezes. why does this happens?
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

This example packs vertexes into dlist, so as more characters you want to draw, as more dlist's size must be.
That means you probably should increase dlist's size (you can use sceGuCheckList to determine right size :)
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

yes, thats helped, thx :)
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

by the way how could I edit font.raw? is there any easy editing tool?
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
OldPrisoneR
Posts: 53
Joined: Thu Mar 20, 2008 2:33 am

Post by OldPrisoneR »

Use Gimp and plugin called RAWTex
(or Photoshop, but it'll work only with 32bit 8888 textures)
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

I tryed gimp with that plugin but it can only save to raw file not to edit :(
I dont know how that font file should look like and with what settings it should be saved... any help?

EDIT: solved :P
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
Post Reply