[PRX] How to print text over the XMB?

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

Moderators: cheriff, TyRaNiD

Post Reply
kweensey
Posts: 26
Joined: Thu Jan 29, 2009 5:43 pm

[PRX] How to print text over the XMB?

Post by kweensey »

Hey,
I'm making a PRX plugin and I want to print some text over the XMB or game.. I heard something about piKey's source code but I found nothing.

Could you tell me how to write text with PRX plugin or give me some source code where it is used, please?

Thank you.
kweensey
hibbyware
Posts: 78
Joined: Wed Mar 28, 2007 10:29 am

Post by hibbyware »

http://code.google.com/p/powermgrprx/so ... #svn/trunk

Take a look at blit.h/c in the contrib directory,
kweensey
Posts: 26
Joined: Thu Jan 29, 2009 5:43 pm

Post by kweensey »

Solved. Lock, please.
Ooblik
Posts: 38
Joined: Thu Apr 10, 2008 1:47 pm

Post by Ooblik »

If you have trouble finding it like I did at first:
http://powermgrprx.googlecode.com/svn/trunk/contrib/

Now this can be Locked :)
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

Where do i have to put the blit.h, blit.c so i can compile ?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

zydeoN wrote:Where do i have to put the blit.h, blit.c so i can compile ?
Same place as your other .c and .h files. ;)

Don't forget to add blit.c to the makefile (normally as blit.o in the OBJS = line).
Dariusc123456
Posts: 388
Joined: Tue Aug 12, 2008 12:46 am

Post by Dariusc123456 »

Also there's a tutorial at psp-hacks.com forums about placing text onto the xmb screen using blit.h and blit.c. Useful tutorial for someone like you.
PSHN - Playstation Hacking Network
PSX/PS1 - HACK - Game Shark
PS2 - HACK - Swap
PSP - HACK - Pandora
PS3 - ?
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

Solved, i was not putting the blit.c right away. Anyway, the path to the two files are psp/sdk/include
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

zydeoN wrote:Solved, i was not putting the blit.c right away. Anyway, the path to the two files are psp/sdk/include
Now i can´t display anything on xmb, although it is compiling well. Here is the code:

Code: Select all

#include <pspctrl.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <pspkernel.h>
#include <psppower.h>
#include <pspsdk.h>
#include <pspdisplay_kernel.h>
#include "contrib/blit.h"
#include "contrib/blit.c"

#define FGCOLOR 0xFFFFFF //Foregorund color is pure white
#define BGCOLOR 0x000000 //Background color is pure black

PSP_MODULE_INFO&#40;"poweroff", 0x1000, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

   SceCtrlData pad;
   int info = 0;
void informacoes&#40;&#41;
&#123;
info=1;
while&#40;info==1&#41;
	&#123;		
		blit_string&#40;0,0,"Informacoes"&#41;;
		sceDisplayWaitVblankStart&#40;&#41;;
                sceCtrlPeekBufferPositive&#40;&pad, 1&#41;;
                if&#40;pad.Buttons & PSP_CTRL_SELECT&#41; info=0;
	&#125;
&#125;

int main_thread&#40;SceSize args, void *argp&#41;
&#123;   
        blit_setup&#40;&#41;;
        blit_set_color&#40;FGCOLOR,BGCOLOR&#41;;
   while&#40;1&#41; // loop is required so buttons get checked more than ONCE
   &#123;
      	sceCtrlPeekBufferPositive&#40;&pad, 1&#41;; // update the var inside the loop
        if&#40;pad.Buttons & PSP_CTRL_SELECT&#41; informacoes&#40;&#41;;
      	if&#40;&#40;pad.Buttons & PSP_CTRL_LTRIGGER&#41; && &#40;pad.Buttons & PSP_CTRL_UP&#41;&#41; scePowerRequestSuspend&#40;&#41;; // 

      sceKernelDelayThread&#40;100000&#41;;// don't use processor for around 1/10 of a second
   &#125;
   return 0;
&#125;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
   // Create a thread
   int thid = sceKernelCreateThread&#40;"poweroff", main_thread, 0x30, 0x1000, 0, NULL&#41;; // 0x30 thread priority lower is higher, 0x1000 initial stack size
   if&#40;thid >= 0&#41;
      sceKernelStartThread&#40;thid, args, argp&#41;;

   return 0;
&#125;
What am i doing wrong ?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

I use FF000000 and FFFFFFFF for my colors as some text routines won't draw the text if the alpha value is 0.
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

Solved again... I had to put 0x18 on createThread in module_start, instead of 0x30.
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

Now im trying to blit images on XMB. Does anyone here have the sources of the vshblitter. I searched the net, but all links are corrupted... Ive heard about GU in XMB but, i dont know anything about GU
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

zydeoN wrote:Now im trying to blit images on XMB. Does anyone here have the sources of the vshblitter. I searched the net, but all links are corrupted... Ive heard about GU in XMB but, i dont know anything about GU
Software blit image (pure kernel; safe for in-game use): http://forums.ps2dev.org/viewtopic.php? ... light=blit

GU blit image (kernel with list in user mem; NOT safe in-game, OK in XMB): http://foosa.do.am/MDL_SAMPLE_KERNEL.rar
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

i found vshblitter, but cannot compile it in kernel mode if i used
USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1
I tried without those and it compiled but the prx didnt work, so i will try the links you gave me..

EDIT: Tried the first one, but it is the same. I think the problem here is when i am loading PNG
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

My code in the first link is only for blitting RAW 8888 data. You need to use libPNG to decompress the image first. However doing this in kernel mode will take up 100s of KiB of space dynamically and isn't recommended at all. Its better you store the RAW 8888 images directly (either embedded or on the memory stick(better)). You can use GIMP to export to RAW 8888 (non-swizzled).
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

I installed GIMP 2.6 and saved as raw image (ourImage.raw) But cannot open this format with gimp, shouldnt this be possible? Btw, how can i store the RAW image either on MS or embedded?
Do i have to do something like that:

Code: Select all

int fd = sceIoOpen&#40;"ms0&#58;/font.raw", PSP_O_RDONLY, 0777&#41;;
	
	if&#40;fd >= 0&#41;
	&#123;
		sceIoRead&#40;fd, font, 0x20000&#41;;
		sceIoClose&#40;fd&#41;;
	&#125; else return 0;
This was on MDL_SAMPLE_KERNEL

EDIT: Solved, i had to use bin2c on this.
Now im trying to blit the image in xmb with the info in the first link Torch gave, but im getting a bunch of errors when i compile. Here is the source: http://codepad.org/FibsnSb2

Compiling errors:
Image

It is only getting problems with vram16 and not with vram32 and both in function drawimage() turn into vram16[offset] and vram32[offset]
Post Reply