How to reinit libmc after IOP reset
Posted: Wed Jun 15, 2005 7:41 pm
In my work to improve LaunchELF I've discovered some problems associated with IOP reset.
One of them is that libmc still 'remembers' having initialized with mcInit before the reset, and refuses to allow it to be done again, even though I've loaded new instances of MCMAN+MCSERV to IOP.
I made some slight changes to libmc.h and libmc.c, which eliminated the problem:
In libmc.h I defined MC_TYPE_RESET:In libmc.c I made a slight change to the start of mc_init:
Nothing else was altered. In the above I'm not sure if the clearing of cdata.server was needed, but I did that as a safety measure. My real objective was to clear mclibInited, as that flag prevented new mcInit.
I believe that other libs too may benefit from similar 'reset' additions, although this is the only one I've had occasion to investigate yet.
Best regards: dlanor
One of them is that libmc still 'remembers' having initialized with mcInit before the reset, and refuses to allow it to be done again, even though I've loaded new instances of MCMAN+MCSERV to IOP.
I made some slight changes to libmc.h and libmc.c, which eliminated the problem:
In libmc.h I defined MC_TYPE_RESET:
Code: Select all
// values to send to mcInit() to use either mcserv or xmcserv
#define MC_TYPE_MC 0
#define MC_TYPE_XMC 1
#define MC_TYPE_RESET 0xDEAD
//RA NB: mcInit(MC_TYPE_RESET) after IOP Reset, to forget old modules
//RA NB: This will not reinitialize anything for use of MC. To do that
//RA NB: you will need to mcInit(MC_TYPE_MC) or mcInit(MC_TYPE_XMC),
//RA NB: after having loaded modules to the IOP again.
Code: Select all
int mcInit(int type)
{
unsigned int i;
int ret=0;
if (type == MC_TYPE_RESET)
{ mclibInited = 0;
cdata.server = NULL;
return 0;
}
I believe that other libs too may benefit from similar 'reset' additions, although this is the only one I've had occasion to investigate yet.
Best regards: dlanor