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 can I get some informations in XMB

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



Joined: 18 Sep 2009
Posts: 6

PostPosted: Sun Sep 20, 2009 10:26 am    Post subject: how can I get some informations in XMB Reply with quote

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



Last edited by yucopowo2009 on Tue Sep 22, 2009 11:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Mon Sep 21, 2009 3:16 am    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message
yucopowo2009



Joined: 18 Sep 2009
Posts: 6

PostPosted: Mon Sep 21, 2009 1:09 pm    Post subject: Reply with quote

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

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
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Mon Sep 21, 2009 3:42 pm    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Sep 22, 2009 4:47 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Tue Sep 22, 2009 4:27 pm    Post subject: Reply with quote

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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Sep 22, 2009 7:58 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Wed Sep 23, 2009 2:41 am    Post subject: Reply with quote

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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Wed Sep 23, 2009 3:01 am    Post subject: Reply with quote

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/index.php?topic=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"
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Wed Sep 23, 2009 7:26 am    Post subject: Reply with quote

@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.
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Wed Sep 30, 2009 4:24 pm    Post subject: Reply with quote

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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Oct 01, 2009 5:23 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Thu Oct 01, 2009 10:35 am    Post subject: Reply with quote

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:
orgaddr = sctrlHENFindFunction("sceIOFileManager", "IoFileMgrForUser", 0x109F50BC);


and I changed it for this:
Code:
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"
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Thu Oct 01, 2009 3:33 pm    Post subject: Reply with quote

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

so basically an import looks like this

Code:

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



so hooking would be something like

Code:

int startThreadOffset = 0x0003437C;
int *startThreadImport = myModuleTxtAddress + startThreadOffset;
*startThreadImport = (0x8 << 27) | (myfunc & ~(0x1F << 27));//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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Thu Oct 01, 2009 8:57 pm    Post subject: Reply with quote

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:
SceUID my_sceIoOpen (const char *file, int flags, SceMode mode)
{
    /* Your code for replacing sceIoOpen here */
}


Then just make a plain jump (not a call!) to your function with this macro:

Code:
#define MAKE_JUMP(f) (0x08000000 | (((u32)(f) >> 2)  & 0x03ffffff))

/*Example using the above macro*/
u32 jump_my_sceIoOpen;
jump_my_sceIoOpen = MAKE_JUMP(my_sceIoOpen);


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.
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 -> PSP 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