how can I get some informations in XMB

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

Moderators: cheriff, TyRaNiD

Post Reply
yucopowo2009
Posts: 5
Joined: Fri Sep 18, 2009 5:05 pm

how can I get some informations in XMB

Post by yucopowo2009 »

NOW I'm going to make a prx which can show lyric when playing


But I cant't get the name of the playing music file or othes in XMB

for example,when you play a song ,the prx will get the music name and load the lrc on screen

Have any functions or projects which can get it?

THX

Image
Last edited by yucopowo2009 on Tue Sep 22, 2009 11:54 pm, edited 1 time in total.
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

I think you have to hook the sceIoOpen function and catch what file that function is trying to open, if it is an mp3 then you show the proper lyrics.
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
yucopowo2009
Posts: 5
Joined: Fri Sep 18, 2009 5:05 pm

Post by yucopowo2009 »

iceman755 wrote:I think you have to hook the sceIoOpen function and catch what file that function is trying to open, if it is an mp3 then you show the proper lyrics.

THX for you help
but you don't understand it's meaning

I want get the filename when I play mp3 or wma in XMB
Image
Not in PBP

because I know play the mp3's name in howebrew,but not in XMB

In other words, How can I hook the lyric when i play some mp3 in XMB
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

And I tell you again, you must hook sceIoOpen function to do what you want to do.

Why??? because I'm sure that XMB music player use that function to open the music file to play it, then from that function you can get what file the XMB will try to open.

And why am I sure??? because in the time I'm writing this post, I'm seeing my PSP in front of me showing the name of the file that it is trying to open, I haven't tune it to show only mp3 or wma, so it shows the last file wich sceIoOpen was called with.

But everything is not as ease as it looks, there are technical issues that have to be solved, like breaking CFW patches.
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

There will be 100s of calls to sceIoOpen since the XMB reads ahead the next song and even more when you're scrolling.

Best way is to directly hook the internal functions of the vsh to see the title of the song being played or the filename. You'd best ask Davee or BubbleTune as they are the most experienced with these internal functions.
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

you will need to hook sceIoOpen and look for the mp3 file since, the mp3's are buffered to ram then fed to the Media Engine, so it will be opened via sceIoOpen, after that it is simple, the best way to write text to the XMB, is to catch the on and offscreen buffers, and then just write per pixel what you want. (look in the sdk at the pspDebugScreenPrint, it does exactly this).

the m33 sdk provides simplistic ways to find and patch system functions. However be careful not to hook it too soon or you will loose the m33 patched sceIoOpen and then you will break peoples custom firmware until a cold boot.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

a_noob wrote:you will need to hook sceIoOpen and look for the mp3 file since, the mp3's are buffered to ram then fed to the Media Engine, so it will be opened via sceIoOpen, after that it is simple
How would he know which is the currently playing song? There will be many calls to the function even while a song is playing. How will he know when the song has changed and which is the new song among the multiple calls.
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

sceIoOpen will not be called a lot, it should only be called once... read will be called a lot yes, but why would open be called a lot? Should only have one call to get a file handle. Then every time a new mp3 is played it will call sceIoClose and Open to obtain a new handle, then you have a new song.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

I have been doing some proofs with this and tune it to show only mp3 or wma, hooking sceIoOpen actually shows currently playing song and I didn't see further calls (to music files) while playing, but while accessing (listing the songs) the ms, under the music icon, all (or almost all) music files are called with sceIoOpen which may make dificult to know when the music files are called for playing or listing.

@Torch: do you know if somebody has worked on the functions from music_player.prx??? are those function what you talked about asking Davee or BubbleTune???

OFF-TOPIC (excuse me please):
@a_noob: Are you and A_nub (from psp-programming forums) the same person???
If yes, way back in this topic http://www.psp-programming.com/forums/i ... pic=2624.0 you post an example about GU over XMB, but links are dead, did you move it to another web or do you still have it???
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

@a_noob: why don't you read answers before posting?
a_noob wrote:sceIoOpen will not be called a lot, it should only be called once...
Torch wrote:since the XMB reads ahead the next song and even more when you're scrolling.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

sorry m0skit0 I read it fast and seemed to have missed his point. @ iceman755 yeah I am A_Nub, I have some vsh gu stuff yeah. I plan to make a small little lib soon. That uses proper techniques, such as hooking into the vsh gu calls rather than bruteforcing my display lists into the GE cue. music_player.prx I could take a quick look into that I suppose. But there is another way. Log all the sceIoOpen handles, and the files they are linked to then when read is being called constantly to say an mp3 file, then you know its playing ;)

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

If you instead hook the IMPORTS in music_player.prx from IoFileManagerForUser you should be able to narrow down the sceIo* calls to just the current song and the read ahead one.
Last edited by Torch on Thu Oct 01, 2009 6:03 pm, edited 1 time in total.
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

Excuse me that I ask but, hooking the IMPORTS takes the same aproach as hooking the original function???

I'm doing it like this, this is the line where I hook the original function:

Code: Select all

orgaddr = sctrlHENFindFunction("sceIOFileManager", "IoFileMgrForUser", 0x109F50BC);
and I changed it for this:

Code: Select all

orgaddr = sctrlHENFindFunction("music_player_module", "IoFileMgrForUser", 0x109F50BC);
But it doesn't catch the files that are being open by the music player, well I catch nothing.

P.D.: I know that I didn't start this post, but it is rather interesting for me xDDD
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

hooking the imports would be different, it would be over writing the module code in memory.

so basically an import looks like this

Code: Select all

; ======================================================
; Subroutine sceKernelStartThread - Address 0x0003437C 
; Imported from ThreadManForUser
sceKernelStartThread:		; Refs: 0x00011130 
	0x0003437C: 0x03E00008 '....' - jr         $ra
	0x00034380: 0x00000000 '....' - nop    

so hooking would be something like

Code: Select all

int startThreadOffset = 0x0003437C;
int *startThreadImport = myModuleTxtAddress + startThreadOffset;
*startThreadImport = &#40;0x8 << 27&#41; | &#40;myfunc & ~&#40;0x1F << 27&#41;&#41;;//patch call
int startThreadOriginal = myModuleTxtAddress + startThreadOffset;
actually umm that hooking is quite wrong. Seems the psp has different values for the op codes than my current MIPS documentation. Ill need to get back to this.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

I can help you with hooking imports, I've done it for my eloader.

Let's suppose you wanna hook the import for sceIoOpen. Write a function like this one:

Code: Select all

SceUID my_sceIoOpen &#40;const char *file, int flags, SceMode mode&#41;
&#123;
    /* Your code for replacing sceIoOpen here */
&#125;
Then just make a plain jump (not a call!) to your function with this macro:

Code: Select all

#define MAKE_JUMP&#40;f&#41; &#40;0x08000000 | &#40;&#40;&#40;u32&#41;&#40;f&#41; >> 2&#41;  & 0x03ffffff&#41;&#41;

/*Example using the above macro*/
u32 jump_my_sceIoOpen;
jump_my_sceIoOpen = MAKE_JUMP&#40;my_sceIoOpen&#41;;
Then overwrite the jr $ra (0x03E00008) instruction for the sceIoOpen entry in the import table of the module you wanna hook (you must know the address of this one, of course) with the resulting jump instruction to your function.

Works like a charm ;)

@a_noob: PSP has standard MIPS opcodes, except for a very few instructions that are not standard.

EDIT: of course, this only works if both the module to hook and your own function are in userspace. You can't do a direct jump from userspace to kernelspace.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Post Reply