const char* reios_locate_ip() { if (libGDR_GetDiscType() == GdRom) { base_fad = 45150; descrambl = false; } else { u8 ses[6]; libGDR_GetSessionInfo(ses, 0); libGDR_GetSessionInfo(ses, ses[2]); base_fad = (ses[3] << 16) | (ses[4] << 8) | (ses[5] << 0); descrambl = true; } printf("reios: loading ip.bin from FAD: %d\n", base_fad); libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 16, 2048); memset(reios_bootfile, 0, sizeof(reios_bootfile)); memcpy(reios_bootfile, GetMemPtr(0x8c008060, 0), 16); printf("reios: bootfile is '%s'\n", reios_bootfile); for (int i = 15; i >= 0; i--) { if (reios_bootfile[i] != ' ') break; reios_bootfile[i] = 0; } return reios_bootfile; }
const char* reios_locate_ip(void) { char ip_bin[256]; if (libGDR_GetDiscType() == GdRom) { base_fad = 45150; descrambl = false; } else { u8 ses[6]; libGDR_GetSessionInfo(ses, 0); libGDR_GetSessionInfo(ses, ses[2]); base_fad = (ses[3] << 16) | (ses[4] << 8) | (ses[5] << 0); descrambl = true; } libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 256, 2048); memset(ip_bin, 0, sizeof(ip_bin)); memcpy(ip_bin, GetMemPtr(0x8c008000, 0), 256); memcpy(&reios_hardware_id[0], &ip_bin[0], 16 * sizeof(char)); memcpy(&reios_maker_id[0], &ip_bin[16], 16 * sizeof(char)); memcpy(&reios_device_info[0], &ip_bin[32], 16 * sizeof(char)); memcpy(&reios_area_symbols[0], &ip_bin[48], 8 * sizeof(char)); memcpy(&reios_peripherals[0], &ip_bin[56], 8 * sizeof(char)); memcpy(&reios_product_number[0], &ip_bin[64], 10 * sizeof(char)); memcpy(&reios_product_version[0], &ip_bin[74], 6 * sizeof(char)); memcpy(&reios_releasedate[0], &ip_bin[80], 16 * sizeof(char)); memcpy(&reios_boot_filename[0], &ip_bin[96], 16 * sizeof(char)); memcpy(&reios_software_company[0], &ip_bin[112], 16 * sizeof(char)); memcpy(&reios_software_name[0], &ip_bin[128], 128 * sizeof(char)); printf("reios: IP.bin is '%s'\n", ip_bin); printf("reios: Hardware ID is: %s\n", reios_hardware_id); printf("reios: Maker ID is: %s\n", reios_maker_id); printf("reios: Device info is: %s\n", reios_device_info); printf("reios: Area symbols is: %s\n", reios_area_symbols); printf("reios: Peripherals is: %s\n", reios_peripherals); printf("reios: Product number is: %s\n", reios_product_number); printf("reios: Product version is: %s\n", reios_product_version); printf("reios: Release date is: %s\n", reios_releasedate); printf("reios: Boot filename is: %s\n", reios_boot_filename); printf("reios: Software company is: %s\n", reios_software_company); printf("reios: Software name is: %s\n", reios_software_name); printf("reios: loading ip.bin from FAD: %d\n", base_fad); libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 16, 2048); memset(reios_bootfile, 0, sizeof(reios_bootfile)); memcpy(reios_bootfile, GetMemPtr(0x8c008060, 0), 16); printf("reios: bootfile is '%s'\n", reios_bootfile); for (int i = 15; i >= 0; i--) { if (reios_bootfile[i] != ' ') break; reios_bootfile[i] = 0; } return reios_bootfile; }