diff --git a/Makefile b/Makefile index 27962932..2b762c75 100644 --- a/Makefile +++ b/Makefile @@ -135,12 +135,18 @@ copy-bin: $(Q)cp contrib/PSP/IPL/nandipl_02G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_02g.bin $(Q)cp contrib/PSP/IPL/nandipl_03G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_03g.bin $(Q)cp contrib/PSP/IPL/nandipl_04G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_04g.bin + $(Q)cp contrib/PSP/IPL/nandipl_05G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_05g.bin + $(Q)cp contrib/PSP/IPL/nandipl_07G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_07g.bin $(Q)cp contrib/PSP/IPL/nandipl_09G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_09g.bin $(Q)cp contrib/PSP/IPL/nandipl_11G.bin dist/PC/MagicMemoryCreator/TM/DCARK/ipl_11g.bin + $(Q)cp loader/perma/cipl/new/ipl_01G.dec dist/PC/MagicMemoryCreator/TM/DCARK/nandipl_01g.bin + $(Q)cp loader/perma/cipl/new/ipl_02G.dec dist/PC/MagicMemoryCreator/TM/DCARK/nandipl_02g.bin $(Q)cp loader/perma/cipl/new/cipl_01G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_01g.bin $(Q)cp loader/perma/cipl/new/cipl_02G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_02g.bin $(Q)cp loader/perma/cipl/new/cipl_03G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_03g.bin $(Q)cp loader/perma/cipl/new/cipl_04G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_04g.bin + $(Q)cp loader/perma/cipl/new/cipl_05G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_05g.bin + $(Q)cp loader/perma/cipl/new/cipl_07G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_07g.bin $(Q)cp loader/perma/cipl/new/cipl_09G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_09g.bin $(Q)cp loader/perma/cipl/new/cipl_11G.bin dist/PC/MagicMemoryCreator/TM/DCARK/cipl_11g.bin $(Q)cp contrib/PC/timemachine/tm_msipl_legacy.bin dist/PC/MagicMemoryCreator/ diff --git a/loader/dc/installer/main.c b/loader/dc/installer/main.c index 6eed5768..9f22c9ab 100644 --- a/loader/dc/installer/main.c +++ b/loader/dc/installer/main.c @@ -78,8 +78,8 @@ static u8 *g_dataOut2; static int PSAR_BUFFER_SIZE; static const int SMALL_BUFFER_SIZE = 2500000; -static char flash_table[4][0x4000]; -static int flash_table_size[4]; +static char flash_table[14][0x4000]; +static int flash_table_size[14]; // Gui vars int begin_install_text; @@ -428,8 +428,8 @@ void ExtractPrxs(int cbFile, SceUID fd) if (is5Dnum(name)) { int num = atoi(name); - // Files from 01g-02g - if (num >= 1 && num <= 2) { + // Files from 01g-11g + if (num >= 1 && num <= 11) { flash_table_size[num] = pspDecryptTable(g_dataOut2, g_dataOut, cbExpanded, 4); if (flash_table_size[num] <= 0) { ErrorExit(1000, "Cannot decrypt %02dg table.\n", num); @@ -463,69 +463,123 @@ void ExtractPrxs(int cbFile, SceUID fd) } else if (strstr(name, "ipl") == name) { + + int is1g = (strstr(name, "01g") != NULL); int is2g = (strstr(name, "02g") != NULL); - if (is2g) + if (is1g || is2g) { - cbExpanded = pspDecryptPRX(g_dataOut2, g_dataOut, cbExpanded); - if (cbExpanded <= 0) + if (is2g) + { + cbExpanded = pspDecryptPRX(g_dataOut2, g_dataOut, cbExpanded); + if (cbExpanded <= 0) + { + ErrorExit(1000, "Cannot pre-decrypt 2000 IPL\n"); + } + else + { + memcpy(g_dataOut2, g_dataOut, cbExpanded); + } + } + + if (is2g) { - ErrorExit(1000, "Cannot pre-decrypt 2000 IPL\n"); + if (WriteFile(ARK_DC_PATH "/ipl_02g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 02g ipl.\n"); + } } else { - memcpy(g_dataOut2, g_dataOut, cbExpanded); - } - } - else { - int is1g = (strstr(name, "01g") != NULL); + if (WriteFile(ARK_DC_PATH "/ipl_01g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 01g ipl.\n"); + } + } + + int cb1 = pspDecryptIPL1(g_dataOut2, g_dataOut, cbExpanded); + if (cb1 < 0) + { + ErrorExit(1000, "Error in IPL decryption.\n"); + } - if (!is1g) { - ErrorExit(1000, "Unexpected ipl! %s\n", name); + int cb2 = pspLinearizeIPL2(g_dataOut, g_dataOut2, cb1); + if (cb2 < 0) + { + ErrorExit(1000, "Error in IPL Linearize.\n"); } - } - if (is2g) - { - if (WriteFile(ARK_DC_PATH "/ipl_02g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + sceKernelDcacheWritebackAll(); + + if (is2g) { - ErrorExit(1000, "Error writing 02g ipl.\n"); + if (WriteFile(ARK_DC_PATH "/nandipl_02g.bin", g_dataOut2, cb2) != (cb2)) + { + ErrorExit(1000, "Error writing 02g ipl.\n"); + } + } + else + { + if (WriteFile(ARK_DC_PATH "/nandipl_01g.bin", g_dataOut2, cb2) != (cb2)) + { + ErrorExit(1000, "Error writing 01g ipl.\n"); + } } } else { - if (WriteFile(ARK_DC_PATH "/ipl_01g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + cbExpanded = pspDecryptPRX(g_dataOut2, g_dataOut, cbExpanded); + if (cbExpanded <= 0) { - ErrorExit(1000, "Error writing 01g ipl.\n"); + ErrorExit(1000, "Cannot pre-decrypt 3000+ IPL\n"); + } + else + { + memcpy(g_dataOut2, g_dataOut, cbExpanded); + } + int is3g = (strstr(name, "03g") != NULL); + if (is3g) + { + if (WriteFile(ARK_DC_PATH "/ipl_03g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 03g ipl.\n"); + } } - } - - int cb1 = pspDecryptIPL1(g_dataOut2, g_dataOut, cbExpanded); - if (cb1 < 0) - { - ErrorExit(1000, "Error in IPL decryption.\n"); - } - int cb2 = pspLinearizeIPL2(g_dataOut, g_dataOut2, cb1); - if (cb2 < 0) - { - ErrorExit(1000, "Error in IPL Linearize.\n"); - } + int is4g = (strstr(name, "04g") != NULL); + if (is4g) + { + if (WriteFile(ARK_DC_PATH "/ipl_04g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 04g ipl.\n"); + } + } - sceKernelDcacheWritebackAll(); + int is5g = (strstr(name, "05g") != NULL); + if (is5g) + { + if (WriteFile(ARK_DC_PATH "/ipl_05g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 05g ipl.\n"); + } + } - if (is2g) - { - if (WriteFile(ARK_DC_PATH "/nandipl_02g.bin", g_dataOut2, cb2) != (cb2)) + int is7g = (strstr(name, "07g") != NULL); + if (is7g) { - ErrorExit(1000, "Error writing 02g ipl.\n"); + if (WriteFile(ARK_DC_PATH "/ipl_07g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 07g ipl.\n"); + } } - } - else - { - if (WriteFile(ARK_DC_PATH "/nandipl_01g.bin", g_dataOut2, cb2) != (cb2)) + + int is11g = (strstr(name, "11g") != NULL); + if (is11g) { - ErrorExit(1000, "Error writing 01g ipl.\n"); + if (WriteFile(ARK_DC_PATH "/ipl_11g.bin", g_dataOut2, cbExpanded) != (cbExpanded)) + { + ErrorExit(1000, "Error writing 11g ipl.\n"); + } } } } diff --git a/loader/dc/vunbricker/install.c b/loader/dc/vunbricker/install.c index a99a2878..9a833ca2 100644 --- a/loader/dc/vunbricker/install.c +++ b/loader/dc/vunbricker/install.c @@ -1095,7 +1095,7 @@ int install_thread(SceSize args, void *argp) } #endif - size = ReadFile(ipl_name, 0, big_buffer+offset, BIG_BUFFER_SIZE); + size = ReadFile(ipl_name, 0, big_buffer+offset, BIG_BUFFER_SIZE-offset); if (size <= 0) { InstallError(fw, "Cannot read nandipl\n");