void loadmodules(int free) { s32 ret; if(free == 1) { if((ret = SifLoadModule("host0:freesio2.irx", 0, NULL)) < 0) { printf("Failed to load freesio2.irx module (%d)\n", ret); SleepThread(); } if((ret = SifLoadModule("host0:freepad.irx", 0, NULL)) < 0) { printf("Failed to load freepad.irx module (%d)\n", ret); SleepThread(); } } else { if((ret = SifLoadModule("rom0:XSIO2MAN", 0, NULL)) < 0) { printf("Failed to load XSIO2MAN module (%d)\n", ret); SleepThread(); } if((ret = SifLoadModule("rom0:XPADMAN", 0, NULL)) < 0) { printf("Failed to load XPADMAN module (%d)\n", ret); SleepThread(); } } }
void FileSystem::setIoMode(Mode mode) { if (mode == Hdd) { if (!m_hasLodedIrx) { static char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20"; static char pfsarg[] = "-m" "\0" "4" "\0" "-o" "\0" "10" "\0" "-n" "\0" "40"; SifLoadModule("host:data/Irx/fileXio.irx", 0, 0); SifLoadModule("host:data/Irx/ps2atad.irx", 0, 0); SifLoadModule("host:data/Irx/ps2hdd.irx", sizeof(hddarg), hddarg); SifLoadModule("host:data/Irx/ps2fs.irx", sizeof(pfsarg), pfsarg); fileXioMount("pfs0:", "hdd:+WOrk", O_RDONLY); m_hasLodedIrx = true; } } switch (mode) { case Host : m_driveName = "host:"; break; case Hdd : m_driveName = "pfs0:/"; break; case Cdvd : m_driveName = "cdrom0:\\"; break; case DevkitHost : m_driveName = "host0:"; break; } m_mode = mode; }
static void loadModules(void) { int ret; #ifdef ROM_PADMAN ret = SifLoadModule("rom0:SIO2MAN", 0, NULL); #else ret = SifLoadModule("rom0:XSIO2MAN", 0, NULL); #endif if (ret < 0) { SleepThread(); } ret = SifLoadModule("rom0:CDVDMAN", 0, NULL); if(ret < 0) { SleepThread(); } #ifdef ROM_PADMAN ret = SifLoadModule("rom0:PADMAN", 0, NULL); #else ret = SifLoadModule("rom0:XPADMAN", 0, NULL); #endif if (ret < 0) { SleepThread(); } }
int main(void) { int ret; /* Load LibSD (freesd will work too one day, I promise ;) */ ret = SifLoadModule("host:LIBSD.IRX", 0, NULL); if (ret<0) { printf("XXXXX failed to load host:LIBSD.IRX (%d)\n", ret); SleepThread(); } /* Load ps2snd */ ret = SifLoadModule("host:ps2snd.irx", 0, NULL); if (ret<0) { printf("XXXXX failed to load host:ps2snd.irx (%d)\n", ret); SleepThread(); } /* Start LibSD */ if (sceSdInit(0)<0) { printf("Failed to start LibSD\n"); SleepThread(); } /* Setup master volumes for both cores */ sceSdSetParam(0 | SD_PARAM_MVOLL, 0x3fff); sceSdSetParam(0 | SD_PARAM_MVOLR, 0x3fff); sceSdSetParam(1 | SD_PARAM_MVOLL, 0x3fff); sceSdSetParam(1 | SD_PARAM_MVOLR, 0x3fff); /* Open a stream, using voices 0:22 and 0:23 It's stereo and it should be closed when the end is hit. The SPU buffers are at 0x6000 in spu2 ram. The chunksize is 1024 blocks (16kbyte) */ if (sndStreamOpen("host:stream.adpcm", SD_VOICE(0,22) | (SD_VOICE(0,23)<<16), STREAM_STEREO | STREAM_END_CLOSE, 0x6000, 1024)<0) { printf("Failed to open stream\n"); SleepThread(); } sndStreamPlay(); SleepThread(); return(0); }
/* * Load IRX modules into IOP RAM. */ int load_modules(const config_t *config) { const char **modv = _modules; int i = 0, ret; while (modv[i] != NULL) { ret = SifLoadModule(modv[i], 0, NULL); if (ret < 0) { fprintf(stderr, "%s: failed to load module: %s (%i)\n", __FUNCTION__, modv[i], ret); return -1; } i++; } if (config_get_bool(config, SET_USB_SUPPORT)) { SifExecModuleBuffer(_usbd_irx_start, _usbd_irx_size, 0, NULL, &ret); if (ret < 0) { fprintf(stderr, "%s: failed to load module usbd.irx (%i)\n", __FUNCTION__, ret); } SifExecModuleBuffer(_usb_mass_irx_start, _usb_mass_irx_size, 0, NULL, &ret); if (ret < 0) { fprintf(stderr, "%s: failed to load module usb_mass.irx (%i)\n", __FUNCTION__, ret); } } return 0; }
int main(int argc, char *argv[]) { SifInitRpc(0); SifLoadModule("host:ps2ips.irx", 0, NULL); if(ps2ip_init() < 0) { printf("ERROR: ps2ip_init falied!\n"); SleepThread(); } serverThread(); 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 }
void LoadModules(void) { int ret; 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(); } ret = SifLoadModule("host:irx/usbd.irx", 0, NULL); if (ret < 0) { printf("Failed to load module: USBD"); SleepThread(); } ret = SifLoadModule("host:irx/ps2kbd.irx", 0, NULL); if (ret < 0) { printf("Failed to load module: PS2KBD"); SleepThread(); } ret = SifLoadModule("host:irx/ps2mouse.irx", 0, NULL); if (ret < 0) { printf("Failed to load module: PS2MOUSE"); SleepThread(); } }
static int load_modules () { const char *STEP_OK = "*"; const char *FAILED = "failed to load with"; int ret, ipcfg_ret = 0; size_t i; const char *IPCONFIG_DAT_PATHS[] = { "mc0:/BIDATA-SYSTEM/IPCONFIG.DAT", /* japan */ "mc0:/BADATA-SYSTEM/IPCONFIG.DAT", /* us */ "mc0:/BEDATA-SYSTEM/IPCONFIG.DAT", /* europe */ "mc0:/SYS-CONF/IPCONFIG.DAT", /* old location */ NULL }; #if defined (LOAD_MRBROWN_PATCHES) sbv_patch_enable_lmb (); sbv_patch_disable_prefix_check (); scr_printf (STEP_OK); #endif #if defined (LOAD_SIOMAN_AND_MC) ret = SifLoadModule ("rom0:SIO2MAN", 0, NULL); if (ret > 0) scr_printf (STEP_OK); else { scr_printf ("\nrom0:SIO2MAN %s %d\n", FAILED, ret); return (-1); } ret = SifLoadModule ("rom0:MCMAN", 0, NULL); if (ret > 0) scr_printf (STEP_OK); else { scr_printf ("\nrom0:MCMAN %s %d\n", FAILED, ret); return (-1); } ret = SifLoadModule ("rom0:MCSERV", 0, NULL); if (ret > 0) scr_printf (STEP_OK); else { scr_printf ("\nrom0:MCSERV %s %d\n", FAILED, ret); return (-1); } #endif SifExecModuleBuffer (&iomanx_irx, size_iomanx_irx, 0, NULL, &ret); if (ret == 0) scr_printf (STEP_OK); else { scr_printf ("IOMANX.IRX %s %d\n", FAILED, ret); return (-1); } SifExecModuleBuffer (&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret); if (ret == 0) scr_printf (STEP_OK); else { scr_printf ("PS2DEV9.IRX %s %d\n", FAILED, ret); return (-1); } SifExecModuleBuffer (&ps2atad_irx, size_ps2atad_irx, 0, NULL, &ret); if (ret == 0) scr_printf (STEP_OK); else { scr_printf ("PS2ATAD.IRX %s %d\n", FAILED, ret); return (-1); } SifExecModuleBuffer (&ps2ip_irx, size_ps2ip_irx, 0, NULL, &ret); if (ret == 0) scr_printf (STEP_OK); else { scr_printf ("PS2IP.IRX %s %d\n", FAILED, ret); return (-1); } ipcfg_ret = -1; for (i = 0; ipcfg_ret != 0 && IPCONFIG_DAT_PATHS[i] != NULL; ++i) { ipcfg_ret = setup_ip (IPCONFIG_DAT_PATHS[i], if_conf, &if_conf_len); } SifExecModuleBuffer (&ps2smap_irx, size_ps2smap_irx, if_conf_len, if_conf, &ret); if (ret == 0) scr_printf (STEP_OK); else { scr_printf ("PS2SMAP.IRX %s %d\n", FAILED, ret); return (-1); } scr_printf ("\n"); switch (ipcfg_ret) { case 0: scr_printf ("\nusing %s\n", IPCONFIG_DAT_PATHS[i - 1]); break; case -1: scr_printf ("\nuse one of the following locations to set IP address:\n"); for (i = 0; IPCONFIG_DAT_PATHS[i] != NULL; ++i) scr_printf (" %s\n", IPCONFIG_DAT_PATHS[i]); break; case -2: scr_printf ("\nusing %s\n", IPCONFIG_DAT_PATHS[i - 1]); scr_printf ("\ninvalid configuration file format; use:\n" "ip_address network_mask gateway_ip\n" "separated by a single space; for example:" "192.168.0.10 255.255.255.0 192.168.0.1\n\n"); break; } scr_printf ("Playstation 2 IP address: %s\n", if_conf); return (0); }
/* Function to scan the system for joysticks. * This function should set SDL_numjoysticks to the number of available * joysticks. Joystick 0 should be the system default joystick. * It should return number of joysticks, or -1 on an unrecoverable fatal error. */ int SDL_SYS_JoystickInit(void) { int ret; int mtap_enabled; int index; int numports, numdevs; int port, slot; printf("SDL_Joystick: JoystickInit begins\n"); #ifdef PS2SDL_ENABLE_MTAP ret = SifLoadModule("rom0:XSIO2MAN", 0, NULL); if (ret < 0) { SDL_SetError("Failed to load XSIO2MAN"); return 0; } ret = SifLoadModule("rom0:XPADMAN", 0, NULL); if (ret < 0) { SDL_SetError("Failed to load XPADMAN"); return 0; } ret = SifLoadModule("rom0:XMTAPMAN", 0, NULL); if (ret < 0) { SDL_SetError("Failed to load XMTAPMAN"); return 0; } #else ret = SifLoadModule("rom0:SIO2MAN", 0, NULL); if (ret < 0) { SDL_SetError("Failed to load SIO2MAN"); return 0; } ret = SifLoadModule("rom0:PADMAN", 0, NULL); if (ret < 0) { SDL_SetError("Failed to load PADMAN"); return 0; } #endif ret = padInit(0); printf("SDL_Joystick: padInit: %d\n", ret); #ifdef PS2SDL_ENABLE_MTAP ret = mtapInit(); printf("SDL_Joystick: mtapInit: %d\n", ret); #endif numdevs = 0; numports = padGetPortMax(); printf("SDL_Joystick: numports %d\n", numports); index = 0; #ifdef PS2SDL_ENABLE_MTAP /* gawd: look for mtap connection on one of the ports. if it's there, * then don't support the only interface. */ if (mtapPortOpen(0) == 1 && mtapGetConnection(0) == 1) { /* found on port 0 */ mtap_enabled = 1; mtapPortClose(0); printf("SDL_Joystick: found mtap on port 0\n"); } else if (mtapPortOpen(1) == 1 && mtapGetConnection(1) == 1) { /* found on port 1 */ mtap_enabled = 1; mtapPortClose(1); printf("SDL_Joystick: found mtap on port 1\n"); } else { mtap_enabled = 0; printf("SDL_Joystick: mtap adapter not found on either ports\n"); } #endif for (port=0; port<numports; port++) { int maxslots; #ifdef PS2SDL_ENABLE_MTAP if (mtap_enabled) { ret = mtapPortOpen(port); printf("\nSDL_Joystick: Port: %d, mtapPortOpen: %d\n", port, ret); ret = mtapGetConnection(port); printf("SDL_Joystick: Port: %d, mtapGetConnection: %d\n", port, ret); if (ret != 1) { /* failed */ mtapPortClose(port); continue; } } #endif maxslots = padGetSlotMax(port); printf("SDL_Joystick: Port %d, MaxSlots: %d\n", port, maxslots); for (slot=0; slot<maxslots; slot++) { ret = padPortOpen(port, slot, &padbufs[256*index]); if (ret < 0) { //SDL_SetError("padPortOpen %d, %d failed\n", port, slot); //return 0; continue; } printf("Joystick %d at port=%d slot=%d\n", index, port, slot); joyports[index] = port; joyslots[index] = slot; index++; } } SDL_numjoysticks = index; printf("SDL_Joystick: JoystickInit ends with %d joysticks\n", SDL_numjoysticks); return SDL_numjoysticks; }
int main(int argc, char **argv) { int i, ret; FILE* adpcm; audsrv_adpcm_t sample; int size; u8* buffer; SifInitRpc(0); printf("sample: kicking IRXs\n"); ret = SifLoadModule("rom0:LIBSD", 0, NULL); printf("libsd loadmodule %d\n", ret); printf("sample: loading audsrv\n"); ret = SifLoadModule("host:audsrv.irx", 0, NULL); printf("audsrv loadmodule %d\n", ret); ret = audsrv_init(); if (ret != 0) { printf("sample: failed to initialize audsrv\n"); printf("audsrv returned error string: %s\n", audsrv_get_error_string()); return 1; } adpcm = fopen("host:evillaugh.adp", "rb"); if (adpcm == NULL) { printf("failed to open adpcm file\n"); audsrv_quit(); return 1; } fseek(adpcm, 0, SEEK_END); size = ftell(adpcm); fseek(adpcm, 0, SEEK_SET); buffer = malloc(size); fread(buffer, 1, size, adpcm); fclose(adpcm); printf("playing sample..\n"); audsrv_adpcm_init(); audsrv_set_volume(MAX_VOLUME); audsrv_load_adpcm(&sample, buffer, size); audsrv_play_adpcm(&sample); /* Uncomment to hear two samples played simultaenously for (i=0; i<100; i++) { nopdelay(); } audsrv_play_adpcm(&sample); */ printf("sample played..\n"); free(buffer); while (1); return 0; }
int main(void) { video_init(); int ret = SifLoadModule("mass:/ds3ps2.irx", 0, NULL); if (ret < 0) { char *txt = "Could not find 'mass:/ds3ps2.irx'"; while (1) { clear_screen(); font_print(5, 10, txt); flip_screen(); } } struct ds3_input ds3_1, ds3_2; memset(&ds3_1, 0x0, sizeof(struct ds3_input)); memset(&ds3_2, 0x0, sizeof(struct ds3_input)); ds3ps2_init(); float pos_x = gsGlobal->Width/2, pos_y = gsGlobal->Height/2; char text_connected[64]; int led = 1, old_r1 = 0; while (!(ds3_1.PS && ds3_1.start)) { clear_screen(); ds3ps2_get_input(DS3PS2_SLOT_1, (void*)&ds3_1); ds3ps2_get_input(DS3PS2_SLOT_2, (void*)&ds3_2); if (ds3_1.L1) { pos_x = gsGlobal->Width/2; pos_y = gsGlobal->Height/2; } if (ds3_1.R1 && !old_r1) { led++; if (led > 7) led = 0; ds3ps2_set_led(DS3PS2_SLOT_1, led); ds3ps2_send_ledsrumble(DS3PS2_SLOT_1); } old_r1 = ds3_1.R1; #define THRESHOLD 5.0f if (fabs(ds3_1.accelY) > THRESHOLD) pos_y -= ds3_1.accelY; if (fabs(ds3_1.gyroZ) > THRESHOLD) pos_x -= ds3_1.gyroZ/5.0f; draw_circle(gsGlobal, pos_x, pos_y, 19, CircleColor, 0); draw_circle(gsGlobal, pos_x, pos_y, 18, CircleColor, 0); draw_circle(gsGlobal, pos_x, pos_y, 17, CircleColor, 0); draw_circle(gsGlobal, pos_x, pos_y, 16, CircleColor, 0); sprintf(text_connected, "connected: SLOT_1 %i SLOT_2 %i", ds3ps2_slot_connected(DS3PS2_SLOT_1), ds3ps2_slot_connected(DS3PS2_SLOT_2)); font_print(5, 10, text_connected); int y = print_data(30, &ds3_1); print_data(y+10, &ds3_2); flip_screen(); } return 0; }
int main(int argc, char **argv) { int ret; int played; int err; char chunk[2048]; FILE *wav; struct audsrv_fmt_t format; SifInitRpc(0); printf("sample: kicking IRXs\n"); ret = SifLoadModule("rom0:LIBSD", 0, NULL); printf("libsd loadmodule %d\n", ret); printf("sample: loading audsrv\n"); ret = SifLoadModule("host:audsrv.irx", 0, NULL); printf("audsrv loadmodule %d\n", ret); ret = audsrv_init(); if (ret != 0) { printf("sample: failed to initialize audsrv\n"); printf("audsrv returned error string: %s\n", audsrv_get_error_string()); return 1; } format.bits = 16; format.freq = 22050; format.channels = 2; err = audsrv_set_format(&format); printf("set format returned %d\n", err); printf("audsrv returned error string: %s\n", audsrv_get_error_string()); audsrv_set_volume(MAX_VOLUME); wav = fopen("host:song_22k.wav", "rb"); if (wav == NULL) { printf("failed to open wav file\n"); audsrv_quit(); return 1; } fseek(wav, 0x30, SEEK_SET); printf("starting play loop\n"); played = 0; while (1) { ret = fread(chunk, 1, sizeof(chunk), wav); if (ret > 0) { audsrv_wait_audio(ret); audsrv_play_audio(chunk, ret); } if (ret < sizeof(chunk)) { /* no more data */ break; } played++; if (played % 8 == 0) { printf("."); } if (played == 512) break; } fclose(wav); printf("sample: stopping audsrv\n"); audsrv_quit(); printf("sample: ended\n"); return 0; }
int main(int argc, char **argv) { int ret; int played; int err; int bytes; char chunk[2048]; FILE *wav; ee_sema_t sema; int fillbuffer_sema; struct audsrv_fmt_t format; SifInitRpc(0); printf("sample: kicking IRXs\n"); ret = SifLoadModule("rom0:LIBSD", 0, NULL); printf("libsd loadmodule %d\n", ret); printf("sample: loading audsrv\n"); ret = SifLoadModule("host:audsrv.irx", 0, NULL); printf("audsrv loadmodule %d\n", ret); ret = audsrv_init(); if (ret != 0) { printf("sample: failed to initialize audsrv\n"); printf("audsrv returned error string: %s\n", audsrv_get_error_string()); return 1; } format.bits = 16; format.freq = 22050; format.channels = 2; err = audsrv_set_format(&format); printf("set format returned %d\n", err); printf("audsrv returned error string: %s\n", audsrv_get_error_string()); audsrv_set_volume(MAX_VOLUME); sema.init_count = 0; sema.max_count = 1; sema.option = 0; fillbuffer_sema = CreateSema(&sema); err = audsrv_on_fillbuf(sizeof(chunk), fillbuffer, (void *)fillbuffer_sema); if (err != AUDSRV_ERR_NOERROR) { printf("audsrv_on_fillbuf failed with err=%d\n", err); goto loser; } wav = fopen("host:song_22k.wav", "rb"); if (wav == NULL) { printf("failed to open wav file\n"); audsrv_quit(); return 1; } fseek(wav, 0x30, SEEK_SET); printf("starting play loop\n"); played = 0; bytes = 0; while (1) { ret = fread(chunk, 1, sizeof(chunk), wav); if (ret > 0) { WaitSema(fillbuffer_sema); audsrv_play_audio(chunk, ret); } if (ret < sizeof(chunk)) { /* no more data */ break; } played++; bytes = bytes + ret; if (played % 8 == 0) { printf("\r%d bytes sent..", bytes); } if (played == 512) break; } fclose(wav); loser: printf("sample: stopping audsrv\n"); audsrv_quit(); printf("sample: ended\n"); return 0; }
int loadLoaderModules(int debug_mode, int disable_cdrom) { static int load_dvd_config = -1; static int load_netsurf_config = -1; static int load_usb_config = -1; int i; int rv; int lrv = -1; if (debug_mode == 1) { /* Network is used by ps2link and can't be used by Linux. */ network_support = 0; } #ifdef RESET_IOP if (debug_mode == -1) { graphic_setStatusMessage("Flushing cache"); FlushCache(0); graphic_setStatusMessage("Exit IOP Heap"); SifExitIopHeap(); graphic_setStatusMessage("Exit LoadFile"); SifLoadFileExit(); graphic_setStatusMessage("Exit FIO"); fioExit(); graphic_setStatusMessage("Exit RPC"); SifExitRpc(); graphic_setStatusMessage("Stop DMA"); SifStopDma(); graphic_setStatusMessage("PreReset Init RPC"); SifInitRpc(0); graphic_setStatusMessage("Reseting IOP"); while(!SifIopReset(s_pUDNL, 0)); graphic_setStatusMessage("IOP Sync"); while (!SifIopSync()); graphic_setStatusMessage("Initialize RPC"); SifInitRpc(0); } #endif graphic_setStatusMessage("Patching enable LMB"); sbv_patch_enable_lmb(); graphic_setStatusMessage("Patching disable prefix check"); sbv_patch_disable_prefix_check(); /* CDVDMAN is loaded by IopReset and NVRAM can be read. */ graphic_setStatusMessage("Read NVRAM from CDVD"); if (!disable_cdrom) { nvram_init(); } eromdrvSupport = 0; /* FIXME: eedebug handler seems to crash the ee graphic_setStatusMessage("Add eedebug handler"); addEEDebugHandler(); */ graphic_setStatusMessage("Loading modules"); for (i = 0; i < moduleLoaderNumberOfModules; i++) { const rom_entry_t *romfile; if (moduleList[i].debug_mode != 0) { if (moduleList[i].debug_mode != debug_mode) { continue; } } /* Load configuration when necessary modules are loaded. */ if (moduleList[i].loadCfg) { checkForMusicSupport(); setDefaultConfiguration(NULL); lrv = loadConfiguration(CONFIG_FILE); changeMode(); /* Load configuration on startup and not on IOP reset. */ moduleList[i].loadCfg = 0; } graphic_setStatusMessage(moduleList[i].path); kprintf("Loading module (%s)\n", moduleList[i].path); if (!network_support) { if (moduleList[i].network) { continue; } } if (moduleList[i].ps2smap) { moduleList[i].args = getPS2MAPParameter(&moduleList[i].argLen); } if (moduleList[i].dns) { moduleList[i].args = getPS2DNS(&moduleList[i].argLen); } if (moduleList[i].checkMc) { static char file[256]; /* Try to load module from MC if available. */ snprintf(file, sizeof(file), CONFIG_DIR "/%s", moduleList[i].path); rv = SifLoadModule(file, moduleList[i].argLen, moduleList[i].args); } else { rv = -1; } if (rv < 0) { if ((moduleList[i].sms_mod == 0) || (isDVDVSupported())) { if (moduleList[i].eromdrv < 0) { /* Try to detect EROM driver only the first time. */ moduleList[i].eromdrv = 1; if (disable_cdrom) { continue; } rv = open("rom1:EROMDRV", O_RDONLY); if (rv >=0 ) { eromdrvpath[12] = 0; /* This is an old fat PS2 (working with SCPH-50004 and SCPH-39004). */ close(rv); } else { const u8 *nvm; nvm = get_nvram(); if (nvm_errors == 0) { /* NVM layout seems to be correct. */ eromdrvpath[12] = nvm[NVM_REAL_REGION]; rv = open(eromdrvpath, O_RDONLY); if (rv >=0 ) { /* Region code seems to be correct. */ close(rv); } else { error_printf("The region code stored in the NVRAM S%02x T%02x F%02x R%02x " "can't be detected by version string %s (%s).", nvm[0x180], nvm[0x181], nvm[NVM_FAKE_REGION], nvm[NVM_REAL_REGION], ps2_rom_version); continue; } } else { error_printf("%d errors when reading NVRAM. Please set path " "to EROMDRV and reload modules.", nvm_errors); continue; } } } if (moduleList[i].eromdrv != 0) { moduleList[i].args = get_eromdrvpath(); moduleList[i].argLen = strlen(moduleList[i].args) + 1; } romfile = rom_getFile(moduleList[i].path); if (romfile != NULL) { int ret; ret = SifExecModuleBuffer((void *) romfile->start, romfile->size, moduleList[i].argLen, moduleList[i].args, &rv); if (ret < 0) { rv = ret; } } else { rv = SifLoadModule(moduleList[i].path, moduleList[i].argLen, moduleList[i].args); } if (rv < 0) { if (moduleList[i].eromdrv != 0) { kprintf("Failed to load module \"%s\".\n", get_eromdrvpath()); } else { kprintf("Failed to load module \"%s\".\n", moduleList[i].path); } if (moduleList[i].ps2smap && !isSlimPSTwo()) { network_support = 0; } else { if (moduleList[i].eromdrv != 0) { error_printf("Failed to load module \"%s\".", get_eromdrvpath()); } else { error_printf("Failed to load module \"%s\".", moduleList[i].path); } } } else { if (moduleList[i].eromdrv != 0) { eromdrvSupport = -1; } } } } } graphic_setStatusMessage(NULL); printAllModules(); fileXioInit(); if (load_netsurf_config) { load_netsurf_config = 0; if (lrv != 0) { graphic_setStatusMessage("Check for NetSurf config"); lrv = loadConfiguration(PS2NS_CONFIG_FILE); graphic_setStatusMessage(NULL); } } if (load_usb_config) { load_usb_config = 0; if (lrv != 0) { graphic_setStatusMessage("Check for USB config"); lrv = loadConfiguration(USB_CONFIG_FILE); graphic_setStatusMessage(NULL); } } if (load_dvd_config && isDVDVSupported()) { load_dvd_config = 0; graphic_setStatusMessage("Init DVD driver"); CDDA_Init(); CDVD_Init(); if (lrv != 0) { DiskType type; graphic_setStatusMessage("Load config from DVD"); type = CDDA_DiskType(); if (type == DiskType_DVDV) { CDVD_SetDVDV(1); } else { CDVD_SetDVDV(0); } kprintf("kloader disc type %u\n", type); switch (type) { case DiskType_CD: case DiskType_DVD: case DiskType_DVDV: /* Load configuration from disc. */ lrv = loadConfiguration(DVD_CONFIG_FILE); changeMode(); #if 0 if (lrv != 0) { error_printf("Failed to load config from \"%s\", using default configuration.", DVD_CONFIG_FILE); } #endif break; default: kprintf("kloader unsupported disc type %u\n", type); break; } /* Stop CD when finished. */ CDVD_Stop(); CDVD_FlushCache(); } graphic_setStatusMessage(NULL); } snprintf(hardware_information, sizeof(hardware_information), "%s with DVD-R %s, %s sound support and %s network adapter", isSlimPSTwo() ? "slim PSTwo" : "fat PS2", disable_cdrom ? "disabled" : (isDVDVSupported() ? "support" : "problem"), (libsd_version <= 0x104) ? "direct" : "indirect", network_support ? "with" : "without"); return 0; }