From c1565e55e5b1b18f74d69737fd63ac434ad1e658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Mon, 14 Oct 2013 21:40:44 +0200 Subject: [PATCH] Experimental SELF decryption support This SELF decryption feature is not portable and its code looks really ugly. It is experimental and is meant to save time to developers when doing tests with SELF files. Besides that, it works (under Windows). :-) How to use it: 1. Place "scetool.exe" (and "zlib1.dll") into the main rpcs3 folder. 2. Obtain a LEGAL copy of the SELF decryption keys and place them in a folder named "data" next to the main executable in a format that is readable for "scetool.exe". That is, following files should be present: data/keys data/ldr_curves data/vsh_curves (See screenshot in the comments) NOTE: These are the steps to enable SELF decryption and it applies to future commits regarding this matter. We do NOT take any responsibility about the way you obtain the keys or (until we include SELF decryption into our code) the actions "scetool.exe" (or "zlib1.dll") perform. --- .gitignore | 2 ++ rpcs3/Emu/System.cpp | 2 +- rpcs3/Gui/MainFrame.cpp | 34 +++++++++++++++++++++++++++------- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8055e8c2e3..fb1396b652 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ *.log *.exe +*.dll *.elf *.lastbuildstate *.unsuccessfulbuild @@ -39,4 +40,5 @@ /bin/VertexProgram.txt /bin/BreakPoints.dat /bin/textures +/bin/data/ rpcs3/git-version.h diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index dac1680129..cee38f932d 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -322,7 +322,7 @@ void Emulator::LoadPoints(const wxString& path) if(version != bpdb_version || (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != f.Length()) { - ConLog.Error("'%s' is borken", path); + ConLog.Error("'%s' is broken", path); return; } diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index f6512eb2be..f8a8ffc251 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -60,8 +60,8 @@ MainFrame::MainFrame() menu_boot.Append(id_boot_game, "Boot game"); menu_boot.AppendSeparator(); - menu_boot.Append(id_boot_elf, "Boot Elf"); - //menu_boot.Append(id_boot_self, "Boot Self"); + menu_boot.Append(id_boot_elf, "Boot ELF"); + menu_boot.Append(id_boot_self, "Boot SELF"); menu_sys.Append(id_sys_pause, "Pause")->Enable(false); menu_sys.Append(id_sys_stop, "Stop\tCtrl + S")->Enable(false); @@ -188,14 +188,14 @@ void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event)) return; } - ConLog.Write("Elf: booting..."); + ConLog.Write("ELF: booting..."); Emu.Stop(); Emu.SetPath(ctrl.GetPath()); Emu.Load(); - ConLog.Write("Elf: boot done."); + ConLog.Write("ELF: boot done."); } void MainFrame::BootSelf(wxCommandEvent& WXUNUSED(event)) @@ -221,8 +221,28 @@ void MainFrame::BootSelf(wxCommandEvent& WXUNUSED(event)) Emu.Stop(); - Emu.SetPath(ctrl.GetPath()); + if (!wxFileExists("scetool.exe")) + { + ConLog.Error("Could not load SELF file: scetool.exe is missing"); + return; + } + if (!wxFileExists("data/keys") || + !wxFileExists("data/ldr_curves") || + !wxFileExists("data/vsh_curves")) + { + ConLog.Error("Could not load SELF file: Key files are missing"); + return; + } + //(TODO: This is not portable. I should feel bad for this) + wxString cmd = "scetool.exe -d"; + cmd += " " + ctrl.GetPath(); + cmd += " " + ctrl.GetPath()+".elf"; + system(cmd.mb_str()); + + Emu.SetPath(ctrl.GetPath()+".elf"); Emu.Load(); + if (!wxRemoveFile(ctrl.GetPath()+".elf")) + ConLog.Warning("Could not delete the decrypted ELF file"); ConLog.Write("SELF: boot done."); } @@ -323,11 +343,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_keyboard_handler->Append("Null"); cbox_keyboard_handler->Append("Windows"); - //cbox_pad_handler->Append("DirectInput"); + //cbox_keyboard_handler->Append("DirectInput"); cbox_mouse_handler->Append("Null"); cbox_mouse_handler->Append("Windows"); - //cbox_pad_handler->Append("DirectInput"); + //cbox_mouse_handler->Append("DirectInput"); chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue());