mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-27 03:35:24 +00:00
Improved Boot UI.
Added dev_usb000. Fixed Game Viewer. Minor fixes.
This commit is contained in:
parent
eaef09df91
commit
23539f13b5
4
bin/dev_usb000/.gitignore
vendored
Normal file
4
bin/dev_usb000/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
@ -175,17 +175,16 @@ void VFS::SaveLoadDevices(Array<VFSManagerEntry>& res, bool is_load)
|
|||||||
res[idx].path = "$(EmulatorDir)\\dev_hdd1\\";
|
res[idx].path = "$(EmulatorDir)\\dev_hdd1\\";
|
||||||
res[idx].mount = "/dev_hdd1/";
|
res[idx].mount = "/dev_hdd1/";
|
||||||
res[idx].device = vfsDevice_LocalFile;
|
res[idx].device = vfsDevice_LocalFile;
|
||||||
/*
|
|
||||||
idx = res.Move(new VFSManagerEntry());
|
idx = res.Move(new VFSManagerEntry());
|
||||||
res[idx].path = "$(GameDir)";
|
res[idx].path = "$(EmulatorDir)\\dev_usb000\\";
|
||||||
res[idx].mount = "";
|
res[idx].mount = "/dev_usb000/";
|
||||||
res[idx].device = vfsDevice_LocalFile;
|
res[idx].device = vfsDevice_LocalFile;
|
||||||
|
|
||||||
idx = res.Move(new VFSManagerEntry());
|
idx = res.Move(new VFSManagerEntry());
|
||||||
res[idx].path = "$(GameDir)";
|
res[idx].path = "$(EmulatorDir)\\dev_usb000\\";
|
||||||
res[idx].mount = "/";
|
res[idx].mount = "/dev_usb/";
|
||||||
res[idx].device = vfsDevice_LocalFile;
|
res[idx].device = vfsDevice_LocalFile;
|
||||||
*/
|
|
||||||
|
|
||||||
idx = res.Move(new VFSManagerEntry());
|
idx = res.Move(new VFSManagerEntry());
|
||||||
res[idx].path = "$(GameDir)";
|
res[idx].path = "$(GameDir)";
|
||||||
@ -196,6 +195,12 @@ void VFS::SaveLoadDevices(Array<VFSManagerEntry>& res, bool is_load)
|
|||||||
res[idx].path = "";
|
res[idx].path = "";
|
||||||
res[idx].mount = "/host_root/";
|
res[idx].mount = "/host_root/";
|
||||||
res[idx].device = vfsDevice_LocalFile;
|
res[idx].device = vfsDevice_LocalFile;
|
||||||
|
|
||||||
|
idx = res.Move(new VFSManagerEntry());
|
||||||
|
res[idx].path = "$(GameDir)";
|
||||||
|
res[idx].mount = "/";
|
||||||
|
res[idx].device = vfsDevice_LocalFile;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ int cellGcmSetFlipCommandWithWaitLabel(u32 ctx, u32 id, u32 label_index, u32 lab
|
|||||||
|
|
||||||
int cellGcmSetFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
|
int cellGcmSetFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
|
||||||
{
|
{
|
||||||
cellGcmSys.Warning("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id);
|
cellGcmSys.Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id);
|
||||||
|
|
||||||
int res = cellGcmSetPrepareFlip(ctxt, id);
|
int res = cellGcmSetPrepareFlip(ctxt, id);
|
||||||
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
|
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
|
||||||
@ -370,7 +370,7 @@ int cellGcmSetFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
|
|||||||
|
|
||||||
int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
|
int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
|
||||||
{
|
{
|
||||||
cellGcmSys.Warning("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
|
cellGcmSys.Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
|
||||||
|
|
||||||
GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
|
GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -172,8 +172,8 @@ int cellPadGetInfo(u32 info_addr)
|
|||||||
if(i >= pads.GetCount()) break;
|
if(i >= pads.GetCount()) break;
|
||||||
|
|
||||||
info.status[i] = re(pads[i].m_port_status);
|
info.status[i] = re(pads[i].m_port_status);
|
||||||
info.product_id[i] = 0xdead; //TODO
|
info.product_id[i] = const_se_t<u16, 0x0268>::value;
|
||||||
info.vendor_id[i] = 0xbeaf; //TODO
|
info.vendor_id[i] = const_se_t<u16, 0x054C>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory.WriteData(info_addr, info);
|
Memory.WriteData(info_addr, info);
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include "Emu/Cell/PPUThread.h"
|
#include "Emu/Cell/PPUThread.h"
|
||||||
#include "Emu/Cell/SPUThread.h"
|
#include "Emu/Cell/SPUThread.h"
|
||||||
#include "Emu/Cell/PPUInstrTable.h"
|
#include "Emu/Cell/PPUInstrTable.h"
|
||||||
|
|
||||||
|
#include "scetool/scetool.h"
|
||||||
|
|
||||||
|
#include "Loader/SELF.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
using namespace PPU_instr;
|
using namespace PPU_instr;
|
||||||
@ -21,7 +25,7 @@ ModuleInitializer::ModuleInitializer()
|
|||||||
Emulator::Emulator()
|
Emulator::Emulator()
|
||||||
: m_status(Stopped)
|
: m_status(Stopped)
|
||||||
, m_mode(DisAsm)
|
, m_mode(DisAsm)
|
||||||
, m_dbg_console(NULL)
|
, m_dbg_console(nullptr)
|
||||||
, m_rsx_callback(0)
|
, m_rsx_callback(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -85,16 +89,126 @@ void Emulator::CheckStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Emulator::IsSelf(const std::string& path)
|
||||||
|
{
|
||||||
|
vfsLocalFile f(path);
|
||||||
|
|
||||||
|
if(!f.IsOpened())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SceHeader hdr;
|
||||||
|
hdr.Load(f);
|
||||||
|
|
||||||
|
return hdr.CheckMagic();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Emulator::DecryptSelf(const std::string& elf, const std::string& self)
|
||||||
|
{
|
||||||
|
// Check if the data really needs to be decrypted.
|
||||||
|
wxFile f(self.c_str());
|
||||||
|
|
||||||
|
if(!f.IsOpened())
|
||||||
|
{
|
||||||
|
ConLog.Error("Could not open SELF file! (%s)", self.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the key version.
|
||||||
|
f.Seek(0x08);
|
||||||
|
be_t<u16> key_version;
|
||||||
|
f.Read(&key_version, sizeof(key_version));
|
||||||
|
|
||||||
|
if(key_version.ToBE() == const_se_t<u16, 0x8000>::value)
|
||||||
|
{
|
||||||
|
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
||||||
|
|
||||||
|
// Get the real elf offset.
|
||||||
|
f.Seek(0x10);
|
||||||
|
be_t<u64> elf_offset;
|
||||||
|
f.Read(&elf_offset, sizeof(elf_offset));
|
||||||
|
|
||||||
|
// Start at the real elf offset.
|
||||||
|
f.Seek(elf_offset);
|
||||||
|
|
||||||
|
wxFile out(elf.c_str(), wxFile::write);
|
||||||
|
|
||||||
|
if(!out.IsOpened())
|
||||||
|
{
|
||||||
|
ConLog.Error("Could not create ELF file! (%s)", elf.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the data.
|
||||||
|
char buf[2048];
|
||||||
|
while (ssize_t size = f.Read(buf, 2048))
|
||||||
|
out.Write(buf, size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!scetool_decrypt((scetool::s8 *)self.c_str(), (scetool::s8 *)elf.c_str()))
|
||||||
|
{
|
||||||
|
ConLog.Write("SELF: Could not decrypt file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Emulator::BootGame(const std::string& path)
|
||||||
|
{
|
||||||
|
static const char* elf_path[6] =
|
||||||
|
{
|
||||||
|
"\\PS3_GAME\\USRDIR\\BOOT.BIN",
|
||||||
|
"\\USRDIR\\BOOT.BIN",
|
||||||
|
"\\BOOT.BIN",
|
||||||
|
"\\PS3_GAME\\USRDIR\\EBOOT.BIN",
|
||||||
|
"\\USRDIR\\EBOOT.BIN",
|
||||||
|
"\\EBOOT.BIN",
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int i=0; i<sizeof(elf_path) / sizeof(*elf_path);i++)
|
||||||
|
{
|
||||||
|
const wxString& curpath = path + elf_path[i];
|
||||||
|
|
||||||
|
if(wxFile::Access(curpath, wxFile::read))
|
||||||
|
{
|
||||||
|
SetPath(curpath);
|
||||||
|
Load();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Emulator::Load()
|
void Emulator::Load()
|
||||||
{
|
{
|
||||||
if(!wxFileExists(m_path)) return;
|
if(!wxFileExists(m_path)) return;
|
||||||
|
|
||||||
|
if(IsSelf(m_path.c_str()))
|
||||||
|
{
|
||||||
|
std::string self_path = m_path;
|
||||||
|
std::string elf_path = wxFileName(m_path).GetPath().c_str();
|
||||||
|
|
||||||
|
if(wxFileName(m_path).GetFullName().CmpNoCase("EBOOT.BIN") == 0)
|
||||||
|
{
|
||||||
|
elf_path += "\\BOOT.BIN";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elf_path += "\\" + wxFileName(m_path).GetName() + ".elf";
|
||||||
|
}
|
||||||
|
|
||||||
|
DecryptSelf(elf_path, self_path);
|
||||||
|
|
||||||
|
m_path = elf_path;
|
||||||
|
}
|
||||||
|
|
||||||
ConLog.Write("Loading '%s'...", m_path.mb_str());
|
ConLog.Write("Loading '%s'...", m_path.mb_str());
|
||||||
GetInfo().Reset();
|
GetInfo().Reset();
|
||||||
m_vfs.Init(m_path);
|
m_vfs.Init(m_path);
|
||||||
//m_vfs.Mount("/", vfsDevice::GetRoot(m_path), new vfsLocalFile());
|
|
||||||
//m_vfs.Mount("/dev_hdd0/", wxGetCwd() + "\\dev_hdd0\\", new vfsLocalFile());
|
|
||||||
//m_vfs.Mount("/app_home/", vfsDevice::GetRoot(m_path), new vfsLocalFile());
|
|
||||||
//m_vfs.Mount(vfsDevice::GetRootPs3(m_path), vfsDevice::GetRoot(m_path), new vfsLocalFile());
|
|
||||||
|
|
||||||
ConLog.SkipLn();
|
ConLog.SkipLn();
|
||||||
ConLog.Write("Mount info:");
|
ConLog.Write("Mount info:");
|
||||||
@ -382,7 +496,7 @@ void Emulator::LoadPoints(const std::string& path)
|
|||||||
if (!f.is_open())
|
if (!f.is_open())
|
||||||
return;
|
return;
|
||||||
f.seekg(0, std::ios::end);
|
f.seekg(0, std::ios::end);
|
||||||
int length = f.tellg();
|
int length = f.tellg();
|
||||||
f.seekg(0, std::ios::beg);
|
f.seekg(0, std::ios::beg);
|
||||||
u32 break_count, marked_count;
|
u32 break_count, marked_count;
|
||||||
u16 version;
|
u16 version;
|
||||||
|
@ -146,6 +146,10 @@ public:
|
|||||||
|
|
||||||
void CheckStatus();
|
void CheckStatus();
|
||||||
|
|
||||||
|
bool IsSelf(const std::string& path);
|
||||||
|
bool DecryptSelf(const std::string& elf, const std::string& self);
|
||||||
|
bool BootGame(const std::string& path);
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
void Run();
|
void Run();
|
||||||
void Pause();
|
void Pause();
|
||||||
|
@ -88,14 +88,13 @@ void GameViewer::DClick(wxListEvent& event)
|
|||||||
long i = GetFirstSelected();
|
long i = GetFirstSelected();
|
||||||
if(i < 0) return;
|
if(i < 0) return;
|
||||||
|
|
||||||
const wxString& path = m_path + "\\" + m_game_data[i].root + "\\USRDIR\\BOOT.BIN";
|
const wxString& path = m_path + m_game_data[i].root;
|
||||||
if(!wxFileExists(path))
|
|
||||||
|
Emu.Stop();
|
||||||
|
if(!Emu.BootGame(path.c_str()))
|
||||||
{
|
{
|
||||||
ConLog.Error("Boot error: elf not found! [%s]", path.mb_str());
|
ConLog.Error("Boot error: elf not found! [%s]", path.mb_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.Stop();
|
|
||||||
Emu.SetPath(path);
|
|
||||||
Emu.Run();
|
Emu.Run();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "Gui/AboutDialog.h"
|
#include "Gui/AboutDialog.h"
|
||||||
#include <wx/dynlib.h>
|
#include <wx/dynlib.h>
|
||||||
|
|
||||||
#include "scetool/scetool.cpp"
|
|
||||||
#include "unpkg/unpkg.c"
|
#include "unpkg/unpkg.c"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MainFrame, FrameBase)
|
BEGIN_EVENT_TABLE(MainFrame, FrameBase)
|
||||||
@ -22,9 +21,8 @@ END_EVENT_TABLE()
|
|||||||
enum IDs
|
enum IDs
|
||||||
{
|
{
|
||||||
id_boot_elf = 0x555,
|
id_boot_elf = 0x555,
|
||||||
id_boot_self,
|
|
||||||
id_boot_game,
|
id_boot_game,
|
||||||
id_boot_pkg,
|
id_install_pkg,
|
||||||
id_sys_pause,
|
id_sys_pause,
|
||||||
id_sys_stop,
|
id_sys_stop,
|
||||||
id_sys_send_open_menu,
|
id_sys_send_open_menu,
|
||||||
@ -47,43 +45,43 @@ wxString GetPaneName()
|
|||||||
|
|
||||||
bool wxMoveDir(wxString sFrom, wxString sTo)
|
bool wxMoveDir(wxString sFrom, wxString sTo)
|
||||||
{
|
{
|
||||||
if (sFrom[sFrom.Len() - 1] != '\\' && sFrom[sFrom.Len() - 1] != '/') sFrom += wxFILE_SEP_PATH;
|
if (sFrom[sFrom.Len() - 1] != '\\' && sFrom[sFrom.Len() - 1] != '/') sFrom += wxFILE_SEP_PATH;
|
||||||
if (sTo[sTo.Len() - 1] != '\\' && sTo[sTo.Len() - 1] != '/') sTo += wxFILE_SEP_PATH;
|
if (sTo[sTo.Len() - 1] != '\\' && sTo[sTo.Len() - 1] != '/') sTo += wxFILE_SEP_PATH;
|
||||||
|
|
||||||
if (!::wxDirExists(sFrom)) {
|
if (!::wxDirExists(sFrom)) {
|
||||||
::wxLogError(wxT("%s does not exist!\r\nCan not copy directory"), sFrom.c_str());
|
::wxLogError(wxT("%s does not exist!\r\nCan not copy directory"), sFrom.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!wxDirExists(sTo)) {
|
if (!wxDirExists(sTo)) {
|
||||||
if (!wxFileName::Mkdir(sTo, 0777, wxPATH_MKDIR_FULL)) {
|
if (!wxFileName::Mkdir(sTo, 0777, wxPATH_MKDIR_FULL)) {
|
||||||
::wxLogError(wxT("%s could not be created!"), sTo.c_str());
|
::wxLogError(wxT("%s could not be created!"), sTo.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDir fDir(sFrom);
|
wxDir fDir(sFrom);
|
||||||
wxString sNext = wxEmptyString;
|
wxString sNext = wxEmptyString;
|
||||||
bool bIsFile = fDir.GetFirst(&sNext);
|
bool bIsFile = fDir.GetFirst(&sNext);
|
||||||
while (bIsFile) {
|
while (bIsFile) {
|
||||||
const wxString sFileFrom = sFrom + sNext;
|
const wxString sFileFrom = sFrom + sNext;
|
||||||
const wxString sFileTo = sTo + sNext;
|
const wxString sFileTo = sTo + sNext;
|
||||||
if (::wxDirExists(sFileFrom)) {
|
if (::wxDirExists(sFileFrom)) {
|
||||||
wxMoveDir(sFileFrom, sFileTo);
|
wxMoveDir(sFileFrom, sFileTo);
|
||||||
::wxRmdir(sFileFrom);
|
::wxRmdir(sFileFrom);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!::wxFileExists(sFileTo)) {
|
if (!::wxFileExists(sFileTo)) {
|
||||||
if (!::wxCopyFile(sFileFrom, sFileTo)) {
|
if (!::wxCopyFile(sFileFrom, sFileTo)) {
|
||||||
::wxLogError(wxT("Could not copy %s to %s !"), sFileFrom.c_str(), sFileTo.c_str());
|
::wxLogError(wxT("Could not copy %s to %s !"), sFileFrom.c_str(), sFileTo.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::wxRemoveFile(sFileFrom);
|
::wxRemoveFile(sFileFrom);
|
||||||
}
|
}
|
||||||
bIsFile = fDir.GetNext(&sNext);
|
bIsFile = fDir.GetNext(&sNext);
|
||||||
}
|
}
|
||||||
::wxRmdir(sFrom);
|
::wxRmdir(sFrom);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainFrame::MainFrame()
|
MainFrame::MainFrame()
|
||||||
@ -113,10 +111,9 @@ MainFrame::MainFrame()
|
|||||||
menubar.Append(&menu_help, "Help");
|
menubar.Append(&menu_help, "Help");
|
||||||
|
|
||||||
menu_boot.Append(id_boot_game, "Boot game");
|
menu_boot.Append(id_boot_game, "Boot game");
|
||||||
menu_boot.Append(id_boot_pkg, "Install PKG");
|
menu_boot.Append(id_install_pkg, "Install PKG");
|
||||||
menu_boot.AppendSeparator();
|
menu_boot.AppendSeparator();
|
||||||
menu_boot.Append(id_boot_elf, "Boot ELF");
|
menu_boot.Append(id_boot_elf, "Boot (S)ELF");
|
||||||
menu_boot.Append(id_boot_self, "Boot SELF");
|
|
||||||
|
|
||||||
menu_sys.Append(id_sys_pause, "Pause")->Enable(false);
|
menu_sys.Append(id_sys_pause, "Pause")->Enable(false);
|
||||||
menu_sys.Append(id_sys_stop, "Stop\tCtrl + S")->Enable(false);
|
menu_sys.Append(id_sys_stop, "Stop\tCtrl + S")->Enable(false);
|
||||||
@ -140,9 +137,8 @@ MainFrame::MainFrame()
|
|||||||
AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM);
|
AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM);
|
||||||
|
|
||||||
Connect( id_boot_game, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootGame) );
|
Connect( id_boot_game, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootGame) );
|
||||||
Connect( id_boot_pkg, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootPkg) );
|
Connect( id_install_pkg, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::InstallPkg) );
|
||||||
Connect( id_boot_elf, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootElf) );
|
Connect( id_boot_elf, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootElf) );
|
||||||
Connect( id_boot_self, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootSelf) );
|
|
||||||
|
|
||||||
Connect( id_sys_pause, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Pause) );
|
Connect( id_sys_pause, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Pause) );
|
||||||
Connect( id_sys_stop, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Stop) );
|
Connect( id_sys_stop, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Stop) );
|
||||||
@ -209,87 +205,20 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
Emu.Stop();
|
Emu.Stop();
|
||||||
|
|
||||||
wxString elf[6] = {
|
if(Emu.BootGame(ctrl.GetPath().c_str()))
|
||||||
"\\PS3_GAME\\USRDIR\\BOOT.BIN",
|
|
||||||
"\\USRDIR\\BOOT.BIN",
|
|
||||||
"\\BOOT.BIN",
|
|
||||||
"\\PS3_GAME\\USRDIR\\EBOOT.BIN",
|
|
||||||
"\\USRDIR\\EBOOT.BIN",
|
|
||||||
"\\EBOOT.BIN"
|
|
||||||
};
|
|
||||||
|
|
||||||
for(int i=0;i<6;i++)
|
|
||||||
{
|
{
|
||||||
if(wxFile::Access(ctrl.GetPath() + elf[i], wxFile::read))
|
ConLog.Write("Game: boot done.");
|
||||||
{
|
}
|
||||||
ConLog.Write("SELF: booting...");
|
else
|
||||||
|
{
|
||||||
Emu.Stop();
|
ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath().mb_str());
|
||||||
|
|
||||||
wxString fileIn = ctrl.GetPath()+elf[i];
|
|
||||||
wxString fileOut = (ctrl.GetPath()+elf[i])+".elf";
|
|
||||||
|
|
||||||
// Check if the data really needs to be decrypted.
|
|
||||||
if(!wxFileExists(fileIn))
|
|
||||||
{
|
|
||||||
ConLog.Error("Could not open game boot file!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFile f(fileIn);
|
|
||||||
// Get the key version.
|
|
||||||
f.Seek(0x08);
|
|
||||||
be_t<u16> key_version;
|
|
||||||
f.Read(&key_version, sizeof(key_version));
|
|
||||||
|
|
||||||
if(key_version.ToBE() == const_se_t<u16, 0x8000>::value)
|
|
||||||
{
|
|
||||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
|
||||||
|
|
||||||
// Get the real elf offset.
|
|
||||||
f.Seek(0x10);
|
|
||||||
be_t<u64> elf_offset;
|
|
||||||
f.Read(&elf_offset, sizeof(elf_offset));
|
|
||||||
|
|
||||||
// Start at the real elf offset.
|
|
||||||
f.Seek(elf_offset);
|
|
||||||
|
|
||||||
wxFile out(fileOut, wxFile::write);
|
|
||||||
|
|
||||||
// Copy the data.
|
|
||||||
char buf[2048];
|
|
||||||
while (ssize_t size = f.Read(buf, 2048))
|
|
||||||
out.Write(buf, size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!scetool_decrypt((scetool::s8 *)fileIn.mb_str(), (scetool::s8 *)fileOut.mb_str()))
|
|
||||||
{
|
|
||||||
ConLog.Write("Could not decrypt game boot file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f.Close();
|
|
||||||
|
|
||||||
Emu.SetPath(fileOut);
|
|
||||||
Emu.Load();
|
|
||||||
if (!wxRemoveFile(fileOut))
|
|
||||||
ConLog.Warning("Could not delete the decrypted ELF file");
|
|
||||||
|
|
||||||
ConLog.Write("Game: boot done.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath().mb_str());
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
|
||||||
void MainFrame::BootPkg(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
{
|
||||||
|
//TODO: progress bar
|
||||||
bool stopped = false;
|
bool stopped = false;
|
||||||
|
|
||||||
if(Emu.IsRunning())
|
if(Emu.IsRunning())
|
||||||
@ -298,7 +227,7 @@ void MainFrame::BootPkg(wxCommandEvent& WXUNUSED(event))
|
|||||||
stopped = true;
|
stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog ctrl (this, L"Select PKG", wxEmptyString, wxEmptyString, "*.*",
|
wxFileDialog ctrl (this, L"Select PKG", wxEmptyString, wxEmptyString, "*.pkg",
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
if(ctrl.ShowModal() == wxID_CANCEL)
|
if(ctrl.ShowModal() == wxID_CANCEL)
|
||||||
@ -333,8 +262,8 @@ void MainFrame::BootPkg(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxString mainDir = wxGetCwd();
|
wxString mainDir = wxGetCwd();
|
||||||
|
|
||||||
// Set PKG dir.
|
// Set PKG dir.
|
||||||
wxString oldPkgDir = wxT(wxGetCwd() + "\\" + titleID_full);
|
wxString oldPkgDir = wxT(mainDir + "\\" + titleID_full);
|
||||||
wxString newPkgDir = wxT(wxGetCwd() + gamePath + titleID);
|
wxString newPkgDir = wxT(mainDir + gamePath + titleID);
|
||||||
|
|
||||||
// Move the final folder.
|
// Move the final folder.
|
||||||
wxMoveDir(oldPkgDir, newPkgDir);
|
wxMoveDir(oldPkgDir, newPkgDir);
|
||||||
@ -344,82 +273,10 @@ void MainFrame::BootPkg(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
ConLog.Write("PKG: extract done.");
|
ConLog.Write("PKG: extract done.");
|
||||||
|
|
||||||
// Travel to the installed PKG.
|
// Travel to the main dir.
|
||||||
wxSetWorkingDirectory(newPkgDir);
|
wxSetWorkingDirectory(mainDir);
|
||||||
|
|
||||||
wxString elf[6] = {
|
Emu.BootGame(newPkgDir.c_str());
|
||||||
"\\PS3_GAME\\USRDIR\\BOOT.BIN",
|
|
||||||
"\\USRDIR\\BOOT.BIN",
|
|
||||||
"\\BOOT.BIN",
|
|
||||||
"\\PS3_GAME\\USRDIR\\EBOOT.BIN",
|
|
||||||
"\\USRDIR\\EBOOT.BIN",
|
|
||||||
"\\EBOOT.BIN"
|
|
||||||
};
|
|
||||||
|
|
||||||
for(int i=0;i<6;i++)
|
|
||||||
{
|
|
||||||
if(wxFile::Access(wxGetCwd() + elf[i], wxFile::read))
|
|
||||||
{
|
|
||||||
ConLog.Write("SELF: booting...");
|
|
||||||
|
|
||||||
wxString fileIn = wxGetCwd()+elf[i];
|
|
||||||
wxString fileOut = (wxGetCwd()+elf[i])+".elf";
|
|
||||||
|
|
||||||
// Check if the data really needs to be decrypted.
|
|
||||||
if(!wxFileExists(fileIn))
|
|
||||||
{
|
|
||||||
ConLog.Error("Could not open game boot file!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFile f(fileIn);
|
|
||||||
// Get the key version.
|
|
||||||
f.Seek(0x08);
|
|
||||||
be_t<u16> key_version;
|
|
||||||
f.Read(&key_version, sizeof(key_version));
|
|
||||||
|
|
||||||
if(key_version.ToBE() == const_se_t<u16, 0x8000>::value)
|
|
||||||
{
|
|
||||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
|
||||||
|
|
||||||
// Get the real elf offset.
|
|
||||||
f.Seek(0x10);
|
|
||||||
be_t<u64> elf_offset;
|
|
||||||
f.Read(&elf_offset, sizeof(elf_offset));
|
|
||||||
|
|
||||||
// Start at the real elf offset.
|
|
||||||
f.Seek(elf_offset);
|
|
||||||
|
|
||||||
wxFile out(fileOut, wxFile::write);
|
|
||||||
|
|
||||||
// Copy the data.
|
|
||||||
char buf[2048];
|
|
||||||
while (ssize_t size = f.Read(buf, 2048))
|
|
||||||
out.Write(buf, size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!scetool_decrypt((scetool::s8 *)fileIn.mb_str(), (scetool::s8 *)fileOut.mb_str()))
|
|
||||||
{
|
|
||||||
ConLog.Write("Could not decrypt game boot file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f.Close();
|
|
||||||
|
|
||||||
// Set the working directory back.
|
|
||||||
wxSetWorkingDirectory(mainDir);
|
|
||||||
|
|
||||||
Emu.SetPath(fileOut);
|
|
||||||
Emu.Load();
|
|
||||||
if (!wxRemoveFile(fileOut))
|
|
||||||
ConLog.Warning("Could not delete the decrypted ELF file");
|
|
||||||
|
|
||||||
ConLog.Write("Game: boot done.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))
|
void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -432,7 +289,7 @@ void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))
|
|||||||
stopped = true;
|
stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog ctrl(this, L"Select ELF", wxEmptyString, wxEmptyString, "*.*",
|
wxFileDialog ctrl(this, L"Select (S)ELF", wxEmptyString, wxEmptyString, "*.*",
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
if(ctrl.ShowModal() == wxID_CANCEL)
|
if(ctrl.ShowModal() == wxID_CANCEL)
|
||||||
@ -441,91 +298,14 @@ void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConLog.Write("ELF: booting...");
|
ConLog.Write("(S)ELF: booting...");
|
||||||
|
|
||||||
Emu.Stop();
|
Emu.Stop();
|
||||||
|
|
||||||
Emu.SetPath(ctrl.GetPath());
|
Emu.SetPath(ctrl.GetPath());
|
||||||
Emu.Load();
|
Emu.Load();
|
||||||
|
|
||||||
ConLog.Write("ELF: boot done.");
|
ConLog.Write("(S)ELF: boot done.");
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::BootSelf(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
bool stopped = false;
|
|
||||||
|
|
||||||
if(Emu.IsRunning())
|
|
||||||
{
|
|
||||||
Emu.Pause();
|
|
||||||
stopped = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFileDialog ctrl(this, L"Select SELF", wxEmptyString, wxEmptyString, "*.*",
|
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
|
||||||
|
|
||||||
if(ctrl.ShowModal() == wxID_CANCEL)
|
|
||||||
{
|
|
||||||
if(stopped) Emu.Resume();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConLog.Write("SELF: booting...");
|
|
||||||
|
|
||||||
Emu.Stop();
|
|
||||||
|
|
||||||
wxString fileIn = ctrl.GetPath();
|
|
||||||
wxString fileOut = ctrl.GetPath()+".elf";
|
|
||||||
|
|
||||||
// Check if the data really needs to be decrypted.
|
|
||||||
if(!wxFileExists(fileIn))
|
|
||||||
{
|
|
||||||
ConLog.Error("Could not open SELF file!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFile f(fileIn);
|
|
||||||
// Get the key version.
|
|
||||||
f.Seek(0x08);
|
|
||||||
be_t<u16> key_version;
|
|
||||||
f.Read(&key_version, sizeof(key_version));
|
|
||||||
|
|
||||||
if(key_version.ToBE() == const_se_t<u16, 0x8000>::value)
|
|
||||||
{
|
|
||||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
|
||||||
|
|
||||||
// Get the real elf offset.
|
|
||||||
f.Seek(0x10);
|
|
||||||
be_t<u64> elf_offset;
|
|
||||||
f.Read(&elf_offset, sizeof(elf_offset));
|
|
||||||
|
|
||||||
// Start at the real elf offset.
|
|
||||||
f.Seek(elf_offset);
|
|
||||||
|
|
||||||
wxFile out(fileOut, wxFile::write);
|
|
||||||
|
|
||||||
// Copy the data.
|
|
||||||
char buf[2048];
|
|
||||||
while (ssize_t size = f.Read(buf, 2048))
|
|
||||||
out.Write(buf, size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!scetool_decrypt((scetool::s8 *)fileIn.mb_str(), (scetool::s8 *)fileOut.mb_str()))
|
|
||||||
{
|
|
||||||
ConLog.Write("SELF: Could not decrypt file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f.Close();
|
|
||||||
|
|
||||||
Emu.SetPath(fileOut);
|
|
||||||
Emu.Load();
|
|
||||||
//if (!wxRemoveFile(fileOut))
|
|
||||||
// ConLog.Warning("Could not delete the decrypted ELF file");
|
|
||||||
|
|
||||||
ConLog.Write("SELF: boot done.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::Pause(wxCommandEvent& WXUNUSED(event))
|
void MainFrame::Pause(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@ -20,9 +20,8 @@ private:
|
|||||||
void OnQuit(wxCloseEvent& event);
|
void OnQuit(wxCloseEvent& event);
|
||||||
|
|
||||||
void BootGame(wxCommandEvent& event);
|
void BootGame(wxCommandEvent& event);
|
||||||
void BootPkg(wxCommandEvent& event);
|
void InstallPkg(wxCommandEvent& event);
|
||||||
void BootElf(wxCommandEvent& event);
|
void BootElf(wxCommandEvent& event);
|
||||||
void BootSelf(wxCommandEvent& event);
|
|
||||||
void Pause(wxCommandEvent& event);
|
void Pause(wxCommandEvent& event);
|
||||||
void Stop(wxCommandEvent& event);
|
void Stop(wxCommandEvent& event);
|
||||||
void SendExit(wxCommandEvent& event);
|
void SendExit(wxCommandEvent& event);
|
||||||
|
@ -199,6 +199,12 @@
|
|||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\scetool\scetool.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\Utilities\Thread.cpp" />
|
<ClCompile Include="..\Utilities\Thread.cpp" />
|
||||||
<ClCompile Include="AppConnector.cpp" />
|
<ClCompile Include="AppConnector.cpp" />
|
||||||
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
|
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
<Filter Include="Emu\ARMv7">
|
<Filter Include="Emu\ARMv7">
|
||||||
<UniqueIdentifier>{bee6a4b4-6371-4c1b-8558-fc7888b1574e}</UniqueIdentifier>
|
<UniqueIdentifier>{bee6a4b4-6371-4c1b-8558-fc7888b1574e}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Utilities\scetool">
|
||||||
|
<UniqueIdentifier>{52b11fe8-a967-4d52-bf88-a3210d4ffb27}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="rpcs3.cpp">
|
<ClCompile Include="rpcs3.cpp">
|
||||||
@ -343,6 +346,9 @@
|
|||||||
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp">
|
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp">
|
||||||
<Filter>Emu\SysCalls\lv2</Filter>
|
<Filter>Emu\SysCalls\lv2</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\scetool\scetool.cpp">
|
||||||
|
<Filter>Utilities\scetool</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="rpcs3.rc" />
|
<ResourceCompile Include="rpcs3.rc" />
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define NOCOMPILE
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
* This file is released under the GPLv2.
|
* This file is released under the GPLv2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
5
scetool/scetool.h
Normal file
5
scetool/scetool.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
bool scetool_decrypt(scetool::s8 *_file_in, scetool::s8 *_file_out);
|
Loading…
x
Reference in New Issue
Block a user