Code: Select all
#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>
#include <loadfile.h>
#include <fileio.h>
#include <malloc.h>
#include <libmc.h>
#include <string.h>
#include <modload.h>
#define TYPE_XMC
void LoadModules(void);
int main() {
SifInitRpc(0);
LoadModules();
int inF, ouF;
char line[512];
int bytes;
if((inF = fioOpen("mc0:/BADATA-SYSTEM/TITLE.DB", O_RDONLY)) < 0) {
scr_printf("error opening <mc0:/BADATA-SYSTEM/TITLE.DB>!");
exit(-1);
}
if((ouF = fioOpen("host:TITLE.DB", O_WRONLY | O_CREAT)) < 0) {
scr_printf("error writing <host:TITLE.DB>!");
exit(-1);
}
while((bytes = fioRead(inF, line, sizeof(line))) > 0)
fioWrite(ouF, line, bytes);
fioClose(inF);
fioClose(ouF);
SifExitRpc();
SleepThread();
return 0;
}
void LoadModules(void)
{
int ret;
#ifdef TYPE_MC
ret = SifLoadModule("rom0:SIO2MAN", 0, NULL);
if (ret < 0) {
printf("Failed to load module: SIO2MAN");
SleepThread();
}
ret = SifLoadModule("rom0:MCMAN", 0, NULL);
if (ret < 0) {
printf("Failed to load module: MCMAN");
SleepThread();
}
ret = SifLoadModule("rom0:MCSERV", 0, NULL);
if (ret < 0) {
printf("Failed to load module: MCSERV");
SleepThread();
}
#else
ret = SifLoadModule("rom0:XSIO2MAN", 0, NULL);
if (ret < 0) {
printf("Failed to load module: SIO2MAN");
SleepThread();
}
ret = SifLoadModule("rom0:XMCMAN", 0, NULL);
if (ret < 0) {
printf("Failed to load module: MCMAN");
SleepThread();
}
ret = SifLoadModule("rom0:XMCSERV", 0, NULL);
if (ret < 0) {
printf("Failed to load module: MCSERV");
SleepThread();
}
#endif
}