rmman problem

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

rmman problem

Post by weltall »

i'm trying to use librm to read returns from my remote but i couldn't get anything just zeroes, i tried also inserting a printf inside the library to see what it get and i get only this: 10a580 either by pressing and not pressing buttons
this is what i do:

Code: Select all

char paddata[256] __attribute__((aligned(64)));  //the controller buffer
int main()
{
	SifInitRpc(0);
	init_scr();
	struct remote_data * datarem;
	datarem = malloc(sizeof(struct remote_data));
	SifLoadModule("rom0:ADDDRV", 0, NULL);
	SifLoadModule("rom1:SIO2MAN", 0, NULL);
	SifLoadModule("rom1:RMMAN", 0, NULL);
	RMMan_Init();
	RMMan_Open(0, 0, paddata);
	while(1)
	{
		
		RMMan_Read(0, 0,datarem);
		//check returns and print if new things appened :)
		printf("data_status = %x, data_button = %x, paddata: %s\n",datarem->status,datarem->button,paddata);
		if(datarem->status == RM_KEYPRESSED)
		{
			scr_printf("return of the remote : %x\n", datarem->button);
		}
	}
	return 0;  
}
all the irxs are loaded successfully, rmman is initialized successfully (ret = 1) and it get version 265.
rmmanopen also returns 1
but in the struct datarem i get only zeroes and if i do this in the source of the lib:

Code: Select all

void RMMan_Read(int port, int slot, struct remote_data *data)
{
   struct rm_data *pdata;

   if&#40;&#40;port < 0&#41; || &#40;port > 1&#41; || &#40;slot != 0&#41;&#41;
   &#123;
      printf&#40;"Error, port must be 0 or 1 and slot set to 0\n"&#41;;
      return;
   &#125;

   pdata = rmGetDmaStr&#40;port, slot&#41;;
	printf&#40;"%x\n",pdata->data&#41;; //what i added
   memcpy&#40;data, pdata->data, 8&#41;;
&#125;
i get only 10a580 from that printf.
thanks in advance of the help :)
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

thanks to TyRaNiD i got it to work.
but while testing i found some problem in the header file, two values in the defines was repeated.
These are the changes, i added also the reset and eject button:

Code: Select all

51c51
< #define RM_TIME	0x0080D049
---
> #define RM_TIME	0x0080D249
69c69
< #define RM_RIGHT	0x0040D5DA
---
> #define RM_RIGHT	0x0050D5DA
78a79,80
> #define RM_EJECT	0x0060D1DA
> #define RM_RESET	0x0050D1DA
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Cool, I have put those updates into cvs.
dave_t
Posts: 4
Joined: Wed Nov 30, 2005 8:57 pm
Location: United Kingdom

Post by dave_t »

I seem to have gone down the same path as weltall above, and have almost exactly the same responses from my hardware.

I too get RMMan loaded with version 265 showing.

Struct datarem only has zeros again, and if i do the same addition to the source of the lib, i get 10a180 from the printf.

What needs doing here to get it working? Thanks in advance,
Dave
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

You need to reset the IOP before loading SIO2MAN and RMMAN as the rom1 version is not compatible with the rom0 version of SIO2MAN.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

from my test i have to add that strangely it doesn't response to signal received throught ir integrated port on v9+ (at least with the use ingame option enabled, now that i think about this i should try this...) but it work well also on v9+ if you insert the ir recevitor into one game port
dave_t
Posts: 4
Joined: Wed Nov 30, 2005 8:57 pm
Location: United Kingdom

Post by dave_t »

Thanks for the help. Just in case anyone has the same problems as me, here's the working code once i finally got it working.

Code: Select all

char paddata&#91;256&#93; __attribute__&#40;&#40;aligned&#40;64&#41;&#41;&#41;;  //the controller buffer

int main&#40;&#41;
&#123;
   int ret = 0;

   SifInitRpc&#40;0&#41;;
   init_scr&#40;&#41;;
   struct remote_data * datarem;
   datarem = &#40;struct remote_data *&#41; malloc&#40;sizeof&#40;struct remote_data&#41;&#41;;
    SifExitIopHeap &#40;&#41;;
    SifLoadFileExit&#40;&#41;;
    SifExitRpc     &#40;&#41;;
    SifIopReset &#40; "rom0&#58;UDNL rom0&#58;EELOADCNF", 0 &#41;;
    while &#40;  SifIopSync &#40;&#41;  &#41;;
    SifInitRpc &#40; 0 &#41;;
   SifLoadModule&#40;"rom0&#58;ADDDRV", 0, NULL&#41;;
   SifLoadModule&#40;"rom1&#58;SIO2MAN", 0, NULL&#41;;
   SifLoadModule&#40;"rom1&#58;RMMAN", 0, NULL&#41;;
   scr_printf&#40;"RMMan_Init&#40;&#41;...                             "&#41;;
   ret = RMMan_Init&#40;&#41;;
   if &#40;ret == 1&#41; scr_printf&#40;"&#91;  OK  &#93;\n"&#41;;
   else scr_printf&#40;"&#91;FAILED&#93;\n\tRMMan_Init&#40;&#41; returned %d &#40;bad&#41;.\n", ret&#41;;
   scr_printf&#40;"RMMan_GetModuleVersion&#40;&#41;...                 "&#41;;
   ret = RMMan_GetModuleVersion&#40;&#41;;
   scr_printf&#40;"&#91; v%d &#93;\n"&#41;;
   scr_printf&#40;"RMMan_Open&#40;&#41;...                             "&#41;;
   ret = RMMan_Open&#40;0, 0, paddata&#41;;
   if &#40;ret == 1&#41; scr_printf&#40;"&#91;  OK  &#93;\n"&#41;;
   else scr_printf&#40;"&#91;FAILED&#93;\n\tRMMan_Open&#40;&#41; returned %d &#40;bad&#41;.\n", ret&#41;;
   scr_printf&#40;"INITIALISATION COMPLETE\n"&#41;;
   scr_printf&#40;"\nPress the remote buttons now&#58;\n"&#41;;
   while&#40;1&#41;
   &#123;

      RMMan_Read&#40;0, 0,datarem&#41;;
      //check returns and print if new things appened &#58;&#41;
      //printf&#40;"data_status = %x, data_button = %x, paddata&#58; %s\n",datarem->status,datarem->button,paddata&#41;;
      if&#40;datarem->status == RM_KEYPRESSED&#41;
      &#123;
         scr_printf&#40;"return of the remote &#58; %x\n", datarem->button&#41;;
      &#125;
   &#125;
   return 0;
&#125;
All that was needed were the additional lines to reset the IOP before loading SIO2MAN and RMMAN. I've no idea what version my console is - how do i find out? It says SCPH-39003 PAL on the back. What's v9?. Surely there must be some way of handling all types of remote/console with the same piece of software - perhaps something that would load a slightly different group of roms depending on which console version was detected.

I'm guessing the reason this hasn't been done yet is because to develop such a driver would require several different PS2 models and most people only have 1.

Dave
misfire
Posts: 110
Joined: Mon Sep 06, 2004 7:53 am
Location: Germany

Post by misfire »

dave_t wrote:[...] I've no idea what version my console is - how do i find out? It says SCPH-39003 PAL on the back. What's v9?. [...]
Referring to a mod chip site, this must be V7.
Post Reply