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 

ExecModuleBuffer issue

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



Joined: 05 May 2004
Posts: 75
Location: NC, USA

PostPosted: Tue Dec 07, 2004 7:14 pm    Post subject: ExecModuleBuffer issue Reply with quote

This is a little wierd I think. The following code works:
Code:
printf("Executing module size=%d\n",size);
      if (size>0)
      {
         module.Close();
         char temp2[1025];
         sprintf(temp2,"host:%s.irx",filename);
         File o(temp2,O_CREAT|O_WRONLY);
         o.Write((u8*)buffer,size);
         o.Close();
         SifExecModuleBuffer((char*)buffer, size, ag_len, args, mod_res);
         delete [] buffer;
         return 1;
}


But this code doesn't (causes the system to freeze)
Code:

printf("Executing module size=%d\n",size);
      if (size>0)
      {
         module.Close();
         SifExecModuleBuffer((char*)buffer, size, ag_len, args, mod_res);
         delete [] buffer;
         return 1;
}


My first thought was the delay caused by the file writting but I added a for loop and that didn't help. But if that is probably the issue, maybe my loop wasn't big enough.

Anyone else have any ideas?

Also, after the modules necessary for HD access are loaded, if I hit RESET on InLink to restart ps2link, the system freezes instead of restarting. It only happens when the modules have been loaded and as far as I can tell, I use the same steps that I used in MCMGR, which reset fine. This is pretty important 'cause it'd be VERY hard to code if I have to do a complete ps2 reboot everytime I make a change. Anyone else had a similar problem and solved it?
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
ole



Joined: 08 May 2004
Posts: 92
Location: Czech Republic

PostPosted: Wed Dec 08, 2004 6:54 am    Post subject: Reply with quote

I would trace/debug the scenario this way:
1) comment single lines (those which are missing in the second case) and search for the "trouble_making_line" or the combination
OR -
2) rewrite the code to the C (not cpp) and unfold all the content of the methods (constructors etc) into single function (main). Then put trace printfs between the trouble section lines and watch the results.

BTW: Do you know for sure that freeze is caused by SifExecModuleBuffer function and not by the delete function (can you comment the SifExecModuleBuffer and test wether it freeze too ?)?
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Wed Dec 08, 2004 7:31 am    Post subject: Reply with quote

Maybe you'd want to look at the asm code too...
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
ole



Joined: 08 May 2004
Posts: 92
Location: Czech Republic

PostPosted: Wed Dec 08, 2004 7:40 am    Post subject: Reply with quote

or check this out: http://forums.ps2dev.org/viewtopic.php?t=316.
If I remember well the key to load modules from buffer is to reset iop correctly....
Back to top
View user's profile Send private message
KaylaKaze



Joined: 05 May 2004
Posts: 75
Location: NC, USA

PostPosted: Wed Dec 08, 2004 12:57 pm    Post subject: Reply with quote

I commented out the SifExecModuleBuffer and I get a weird situation. But first, some background. The ExecModule funtion I'm working on searches for the irx file to load (first in SYS-MODULES on the MCs, then host, then if the HDD is initialized, SYS-MODULES on __boot). First it looks for compressed modules (compressed with zlib) and loads them with my ReadCompFile function which reads a compressed file and stores the uncompressed data to the memory buffer (which I've tested over and over and it decompresses perfectly). Now the weird part. If I just comment out the SifExecModuleBuffer in the second block of code I previously posted, the ReadCompFile function says the fileID on the compressed file is 0x0000 (should be 0x4C5A) and fails to load the file. If I put a printf() (such as printf("Closing module.\n)) before the Close() call, it reads fine. It also works fine if I put a for loop before it. So it seems it's continuing to carry out instructions even before the file is completely handled (and as far as I can tell, ReadCompFile shouldn't return until the file is handled). Is this normal?

Well, even if I flank the call to SifExecModuleBuffer with like .75 second delays (which is much more than the file writing caused) it still freezes (it loads the first 2 modules (poweroff and iomanx but freezes on filexio))

I'm going to try to make some sense of that post you referenced, though since it works properly with the file writing code, I'm not sure if that would be the case. Maybe I should update my PS2SDK code and see if that fixes it.

Oh! I forgot that I had tried the code using only the noncompressed, not the compressed and it worked perfectly (except for not restarting when I wanted it to). So I think I'll get back to the compressed drivers later and figuring out the reset issue should be my #1 priority right now.

Update: I changed the order in which my modules start and it seems to have fixed the PS2Link problem. Yay!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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