void ethInit(void) { if(ethInitSema() < 0) return; if (gNetworkStartup >= ERROR_ETH_SMB_CONN) { LOG("ETHSUPPORT Re-Init\n"); thmReinit(ethBase); ethULSizePrev = -2; ethGameCount = 0; ioPutRequest(IO_CUSTOM_SIMPLEACTION, ðInitSMB); } else { LOG("ETHSUPPORT Init\n"); ethBase = "smb0:"; ethULSizePrev = -2; memset(ethModifiedCDPrev, 0, 8); memset(ethModifiedDVDPrev, 0, 8); ethGameCount = 0; ethGames = NULL; configGetInt(configGetByType(CONFIG_OPL), "eth_frames_delay", ðGameList.delay); gNetworkStartup = ERROR_ETH_NOT_STARTED; ioPutRequest(IO_CUSTOM_SIMPLEACTION, &smbLoadModules); ethGameList.enabled = 1; } }
void ethInit(void) { LOG("ethInit()\n"); ethPrefix = "smb0:"; ethULSizePrev = -2; memset(ethModifiedCDPrev, 0, 8); memset(ethModifiedDVDPrev, 0, 8); ethGameCount = 0; ethGames = NULL; gNetworkStartup = 6; ioPutRequest(IO_CUSTOM_SIMPLEACTION, ðLoadModules); ethGameList.enabled = 1; }
static void ethLaunchGame(int id, config_set_t* configSet) { int i, compatmask; int EnablePS2Logo = 0; #ifdef CHEAT int result; #endif char filename[32], partname[256]; base_game_info_t* game = ðGames[id]; struct cdvdman_settings_smb *settings; u32 layer1_start, layer1_offset; unsigned short int layer1_part; if (!gPCShareName[0]) { memcpy(gPCShareName, game->name, 32); ethULSizePrev = -2; ethGameCount = 0; ioPutRequest(IO_MENU_UPDATE_DEFFERED, ðGameList.mode); // clear the share list ioPutRequest(IO_CUSTOM_SIMPLEACTION, ðInitSMB); ioPutRequest(IO_MENU_UPDATE_DEFFERED, ðGameList.mode); // reload the game list return; } #ifdef VMC char vmc_name[32]; int vmc_id, size_mcemu_irx = 0; smb_vmc_infos_t smb_vmc_infos; vmc_superblock_t vmc_superblock; for (vmc_id = 0; vmc_id < 2; vmc_id++) { memset(&smb_vmc_infos, 0, sizeof(smb_vmc_infos_t)); configGetVMC(configSet, vmc_name, sizeof(vmc_name), vmc_id); if (vmc_name[0]) { if (sysCheckVMC(ethPrefix, "\\", vmc_name, 0, &vmc_superblock) > 0) { smb_vmc_infos.flags = vmc_superblock.mc_flag & 0xFF; smb_vmc_infos.flags |= 0x100; smb_vmc_infos.specs.page_size = vmc_superblock.page_size; smb_vmc_infos.specs.block_size = vmc_superblock.pages_per_block; smb_vmc_infos.specs.card_size = vmc_superblock.pages_per_cluster * vmc_superblock.clusters_per_card; smb_vmc_infos.active = 1; smb_vmc_infos.fid = 0xFFFF; if (gETHPrefix[0]) snprintf(smb_vmc_infos.fname, sizeof(smb_vmc_infos.fname), "%s\\VMC\\%s.bin", gETHPrefix, vmc_name); else snprintf(smb_vmc_infos.fname, sizeof(smb_vmc_infos.fname), "VMC\\%s.bin", vmc_name); } else { char error[256]; snprintf(error, sizeof(error), _l(_STR_ERR_VMC_CONTINUE), vmc_name, (vmc_id + 1)); if (!guiMsgBox(error, 1, NULL)) return; } } for (i = 0; i < size_smb_mcemu_irx; i++) { if (((u32*)&smb_mcemu_irx)[i] == (0xC0DEFAC0 + vmc_id)) { if (smb_vmc_infos.active) size_mcemu_irx = size_smb_mcemu_irx; memcpy(&((u32*)&smb_mcemu_irx)[i], &smb_vmc_infos, sizeof(smb_vmc_infos_t)); break; } } } #endif #ifdef CHEAT if((result = sbLoadCheats(ethPrefix, game->startup)) < 0) { switch(result) { case -ENOENT: guiWarning(_l(_STR_NO_CHEATS_FOUND), 10); break; default: guiWarning(_l(_STR_ERR_CHEATS_LOAD_FAILED), 10); } } #endif if (gRememberLastPlayed) { configSetStr(configGetByType(CONFIG_LAST), "last_played", game->startup); saveConfig(CONFIG_LAST, 0); } compatmask = sbPrepare(game, configSet, size_smb_cdvdman_irx, &smb_cdvdman_irx, &i); settings = (struct cdvdman_settings_smb *)((u8*)(&smb_cdvdman_irx)+i); switch(game->format) { case GAME_FORMAT_OLD_ISO: sprintf(settings->filename, "%s.%s%s", game->startup, game->name, game->extension); break; case GAME_FORMAT_ISO: sprintf(settings->filename, "%s%s", game->name, game->extension); break; default: //USBExtreme format. sprintf(settings->filename, "ul.%08X.%s", USBA_crc32(game->name), game->startup); settings->common.flags |= IOPCORE_SMB_FORMAT_USBLD; } sprintf(settings->smb_ip, "%u.%u.%u.%u", pc_ip[0], pc_ip[1], pc_ip[2], pc_ip[3]); settings->smb_port=gPCPort; strcpy(settings->smb_share, gPCShareName); strcpy(settings->smb_prefix, gETHPrefix); strcpy(settings->smb_user, gPCUserName); strcpy(settings->smb_password, gPCPassword); //Initialize layer 1 information. switch(game->format) { case GAME_FORMAT_USBLD: sprintf(partname, "%s%s.00", ethPrefix, settings->filename); break; default: //Raw ISO9660 disc image; one part. sprintf(partname, "%s%s\\%s", ethPrefix, game->media == 0x12?"CD":"DVD", settings->filename); } if (gPS2Logo) { int fd = fileXioOpen(partname, O_RDONLY, 0666); if (fd >= 0) { EnablePS2Logo = CheckPS2Logo(fd, 0); fileXioClose(fd); } } layer1_start = sbGetISO9660MaxLBA(partname); switch(game->format) { case GAME_FORMAT_USBLD: layer1_part = layer1_start / 0x80000; layer1_offset = layer1_start % 0x80000; sprintf(partname, "%s%s.%02x", ethPrefix, settings->filename, layer1_part); break; default: //Raw ISO9660 disc image; one part. layer1_part = 0; layer1_offset = layer1_start; } if(sbProbeISO9660_64(partname, game, layer1_offset) != 0) { layer1_start = 0; LOG("DVD detected.\n"); } else { layer1_start -= 16; LOG("DVD-DL layer 1 @ part %u sector 0x%lx.\n", layer1_part, layer1_offset); } settings->common.layer1_start = layer1_start; // disconnect from the active SMB session ethSMBDisconnect(); if (configGetStrCopy(configSet, CONFIG_ITEM_ALTSTARTUP, filename, sizeof(filename)) == 0) strcpy(filename, game->startup); deinit(NO_EXCEPTION); // CAREFUL: deinit will call ethCleanUp, so ethGames/game will be freed #ifdef VMC #define ETH_MCEMU size_mcemu_irx,&smb_mcemu_irx, #else #define ETH_MCEMU #endif sysLaunchLoaderElf(filename, "ETH_MODE", size_smb_cdvdman_irx, &smb_cdvdman_irx, ETH_MCEMU EnablePS2Logo, compatmask); }