diff --git a/External/Be.HexEditor b/External/Be.HexEditor index c558750..64e9357 160000 --- a/External/Be.HexEditor +++ b/External/Be.HexEditor @@ -1 +1 @@ -Subproject commit c55875024e5e1a86cf3b4ddc0506f51b09569b86 +Subproject commit 64e9357f1a1b05118cbe59f8a4053f9baab44a49 diff --git a/External/HexView b/External/HexView new file mode 160000 index 0000000..a6f43ec --- /dev/null +++ b/External/HexView @@ -0,0 +1 @@ +Subproject commit a6f43ec0d8be2eb87d885608d192643098a9cd72 diff --git a/Misc/General_IPC.h b/Misc/General_IPC.h index 6cd2c93..dad0af6 100644 --- a/Misc/General_IPC.h +++ b/Misc/General_IPC.h @@ -35,3 +35,9 @@ struct LibPacket int SegmentCount; OrbisKernelModuleSegmentInfo Segments[4]; }; + +struct PRXPacket +{ + uint32_t Handle; + char Path[256]; +}; diff --git a/Playstation/OrbisLibAPI/Debug.cpp b/Playstation/OrbisLibAPI/Debug.cpp index 9fc3003..92d77cd 100644 --- a/Playstation/OrbisLibAPI/Debug.cpp +++ b/Playstation/OrbisLibAPI/Debug.cpp @@ -3,7 +3,6 @@ #include "APIHelper.h" #include "GeneralIPC.h" #include "Events.h" - #include #define HelperPrxPath "/data/Orbis Suite/OrbisLibGeneralHelper.sprx" @@ -54,8 +53,6 @@ void Debug::HandleAPI(OrbisNetId Sock, APIPacket* Packet) break; - //... - case API_DBG_LOAD_LIBRARY: LoadLibrary(Sock); @@ -105,7 +102,7 @@ bool Debug::TryDetach(int pid) CurrentPID = -1; // Wait for the current proc thread to die. - scePthreadJoin(*ProcMonitorThreadHandle, nullptr); + scePthreadJoin(ProcMonitorThreadHandle, nullptr); return true; } @@ -124,6 +121,9 @@ void* Debug::ProcessMonotorThread() { klog("Proc %d has died.\n", CurrentPID); + // Release the IPC file + GeneralIPC::DeleteTempFile(CurrentPID); + // Aquire lock. scePthreadMutexLock(&DebugMutex); @@ -149,6 +149,7 @@ void* Debug::ProcessMonotorThread() { int signal = WSTOPSIG(status); klog("Process %d has recieved the signal %d\n", CurrentPID, signal); + // TODO: Back trace here on bad sig switch (signal) { @@ -162,8 +163,6 @@ void* Debug::ProcessMonotorThread() } Thread_Exit: - klog("Client Thread Exiting!\n"); - // TODO: Remove any Watchpoints / Breakpoints now. // Unless the process is dying maybe? @@ -304,7 +303,16 @@ void Debug::LoadLibrary(OrbisNetId Sock) // Get next packet. auto Packet = (DbgSPRXPacket*)malloc(sizeof(DbgSPRXPacket)); - sceNetRecv(Sock, Packet, sizeof(DbgSPRXPacket), 0); + if (sceNetRecv(Sock, Packet, sizeof(DbgSPRXPacket), 0) < 0) + { + klog("Failed to recieve next packet.\n"); + + free(Packet); + + Sockets::SendInt(Sock, -1); + + return; + } // Load the library. int handle = 0; diff --git a/Playstation/OrbisLibAPI/Debug.h b/Playstation/OrbisLibAPI/Debug.h index 6476273..1c1b2ae 100644 --- a/Playstation/OrbisLibAPI/Debug.h +++ b/Playstation/OrbisLibAPI/Debug.h @@ -4,7 +4,7 @@ class Debug { public: OrbisPthreadMutex DebugMutex; - OrbisPthread* ProcMonitorThreadHandle; + OrbisPthread ProcMonitorThreadHandle; bool IsDebugging; int CurrentPID; diff --git a/Playstation/OrbisLibAPI/GeneralIPC.cpp b/Playstation/OrbisLibAPI/GeneralIPC.cpp index 94ff0dd..53c6a02 100644 --- a/Playstation/OrbisLibAPI/GeneralIPC.cpp +++ b/Playstation/OrbisLibAPI/GeneralIPC.cpp @@ -47,6 +47,14 @@ bool GeneralIPC::SendCommand(OrbisNetId Sock, int Command) return Status == GIPC_OK; } +void GeneralIPC::DeleteTempFile(int pid) +{ + char fullPath[0x200]; + snprintf(fullPath, sizeof(fullPath), GENERAL_IPC_ADDR, pid); + + sceKernelUnlink(fullPath); +} + bool GeneralIPC::TestConnection(int pid) { // Open a new local socket connection for the process. @@ -157,16 +165,16 @@ bool GeneralIPC::LoadLibrary(int pid, const char* Path, int* HandleOut) Jailbreak(pid); // Create next packet. - auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); + auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket)); strcpy(Packet->Path, Path); // Send the packet. - if (sceNetSend(sock, Packet, sizeof(LibPacket), 0) < 0) + if (sceNetSend(sock, Packet, sizeof(PRXPacket), 0) < 0) { // Close the socket. sceNetSocketClose(sock); - klog("[GeneralIPC] Failed to send LibPacket.\n"); + klog("[GeneralIPC] Failed to send PRXPacket.\n"); // Restore the jail. Jail(pid); @@ -194,25 +202,19 @@ bool GeneralIPC::LoadLibrary(int pid, const char* Path, int* HandleOut) return false; } - // Check to see if it was loaded successfully. - if (*HandleOut <= 0) - { - // Close the socket. - sceNetSocketClose(sock); - - klog("[GeneralIPC] Failed to load PRX '%s' (0x%llX).\n", *HandleOut); - - // Restore the jail. - Jail(pid); - - return false; - } + // Close the socket. + sceNetSocketClose(sock); // Restore the jail. Jail(pid); - // Close the socket. - sceNetSocketClose(sock); + // Check to see if it was loaded successfully. + if (*HandleOut <= 0) + { + klog("[GeneralIPC] Failed to load PRX '%s' (0x%llX).\n", Path, *HandleOut); + + return false; + } return true; } @@ -238,11 +240,11 @@ bool GeneralIPC::UnLoadLibrary(int pid, int Handle) } // Create next packet. - auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); + auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket)); Packet->Handle = Handle; // Send the packet. - if (sceNetSend(sock, Packet, sizeof(LibPacket), 0) < 0) + if (sceNetSend(sock, Packet, sizeof(PRXPacket), 0) < 0) { // Close the socket. sceNetSocketClose(sock); @@ -250,7 +252,7 @@ bool GeneralIPC::UnLoadLibrary(int pid, int Handle) // Cleanup free(Packet); - klog("[GeneralIPC] Failed to send LibPacket.\n"); + klog("[GeneralIPC] Failed to send PRXPacket.\n"); return false; } diff --git a/Playstation/OrbisLibAPI/GeneralIPC.h b/Playstation/OrbisLibAPI/GeneralIPC.h index d10fa1c..2fbc92a 100644 --- a/Playstation/OrbisLibAPI/GeneralIPC.h +++ b/Playstation/OrbisLibAPI/GeneralIPC.h @@ -8,6 +8,7 @@ private: static bool SendCommand(OrbisNetId Sock, int Command); public: + static void DeleteTempFile(int pid); static bool TestConnection(int pid); static bool GetLibraryList(int pid, std::vector& Libraries); static bool LoadLibrary(int pid, const char* Path, int* HandleOut); diff --git a/Playstation/OrbisLibAPI/SocketListener.cpp b/Playstation/OrbisLibAPI/SocketListener.cpp index 2092bf0..db7eddc 100644 --- a/Playstation/OrbisLibAPI/SocketListener.cpp +++ b/Playstation/OrbisLibAPI/SocketListener.cpp @@ -98,9 +98,9 @@ void* SocketListener::DoWork() Params->sin_addr = ClientAddr.sin_addr; // Create Thread to handle connection. - OrbisPthread* Thread; + OrbisPthread Thread; scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); - scePthreadDetach(*Thread); + scePthreadDetach(Thread); // Reset ClientSocket. ClientSocket = -1; @@ -143,7 +143,7 @@ SocketListener::~SocketListener() klog("~Socket Listener.\n"); this->ServerRunning = false; - scePthreadJoin(*ListenThreadHandle, nullptr); + scePthreadJoin(ListenThreadHandle, nullptr); klog("Destruction sucessful.\n"); } \ No newline at end of file diff --git a/Playstation/OrbisLibAPI/SocketListener.h b/Playstation/OrbisLibAPI/SocketListener.h index 8ff9621..9669e37 100644 --- a/Playstation/OrbisLibAPI/SocketListener.h +++ b/Playstation/OrbisLibAPI/SocketListener.h @@ -10,7 +10,7 @@ private: /// Used to see when listen thread has closed. bool ThreadCleanedUp; unsigned short Port; - OrbisPthread* ListenThreadHandle; + OrbisPthread ListenThreadHandle; void* DoWork(); static void* ClientThread(void* tdParam); diff --git a/Playstation/OrbisLibAPI/System.cpp b/Playstation/OrbisLibAPI/System.cpp index f92df74..6f79189 100644 --- a/Playstation/OrbisLibAPI/System.cpp +++ b/Playstation/OrbisLibAPI/System.cpp @@ -1,7 +1,7 @@ #include "Common.h" #include "System.h" -int ChangeSystemState(SystemState State) +int ChangeSystemState(NewSystemState State) { OrbisKernelEventFlag EventFlag = 0; int ret = 0; diff --git a/Playstation/OrbisLibAPI/System.h b/Playstation/OrbisLibAPI/System.h index 2969518..43373f7 100644 --- a/Playstation/OrbisLibAPI/System.h +++ b/Playstation/OrbisLibAPI/System.h @@ -1,6 +1,6 @@ #pragma once -enum SystemState +enum NewSystemState { Suspend = 0x8004000, Shutdown = 0x4000, @@ -24,7 +24,7 @@ enum ConsoleTypes CT_KRATOS, //0xA0 IMPOSSIBLE?? }; -int ChangeSystemState(SystemState State); +int ChangeSystemState(NewSystemState State); void SetConsoleLED(ConsoleLEDColours Colour); void SetControllerLED(); void RingBuzzer(BuzzerType Type); diff --git a/Playstation/OrbisLibAPI/SystemMonitor.cpp b/Playstation/OrbisLibAPI/SystemMonitor.cpp index 557c953..efe91c9 100644 --- a/Playstation/OrbisLibAPI/SystemMonitor.cpp +++ b/Playstation/OrbisLibAPI/SystemMonitor.cpp @@ -1,6 +1,7 @@ #include "Common.h" #include "SystemMonitor.h" +OrbisPthread SystemMonitor::ThreadId; int SystemMonitor::Thread_Count = 0; int SystemMonitor::Busy_Core = 0; float SystemMonitor::Usage[8] = { 0 }; @@ -177,14 +178,13 @@ void* SystemMonitor::MonitorThread(void* args) void SystemMonitor::Init() { klog("[System Monitor] Starting System Monitor Thread...\n"); - - OrbisPthread* id; - scePthreadCreate(&id, nullptr, MonitorThread, NULL, "System Monitor Thread"); - scePthreadDetach(*id); + + scePthreadCreate(&ThreadId, nullptr, MonitorThread, NULL, "System Monitor Thread"); + scePthreadDetach(ThreadId); } void SystemMonitor::Term() { Should_Run_Thread = false; - while (!Should_Run_Thread) { sceKernelUsleep(1000 * 10); } + scePthreadJoin(ThreadId, nullptr); } \ No newline at end of file diff --git a/Playstation/OrbisLibAPI/SystemMonitor.h b/Playstation/OrbisLibAPI/SystemMonitor.h index f119285..16f00e2 100644 --- a/Playstation/OrbisLibAPI/SystemMonitor.h +++ b/Playstation/OrbisLibAPI/SystemMonitor.h @@ -12,6 +12,7 @@ public: float Percentage; }; + static OrbisPthread ThreadId; static int Thread_Count; static int Busy_Core; static float Usage[8]; diff --git a/Playstation/OrbisLibAPI/Target.cpp b/Playstation/OrbisLibAPI/Target.cpp index bb8e7f9..218508b 100644 --- a/Playstation/OrbisLibAPI/Target.cpp +++ b/Playstation/OrbisLibAPI/Target.cpp @@ -21,19 +21,19 @@ void Target::HandleAPI(OrbisNetId Sock, APIPacket* Packet) case APICommands::API_TARGET_RESTMODE: - ChangeSystemState(SystemState::Suspend); + ChangeSystemState(NewSystemState::Suspend); break; case APICommands::API_TARGET_SHUTDOWN: - ChangeSystemState(SystemState::Shutdown); + ChangeSystemState(NewSystemState::Shutdown); break; case APICommands::API_TARGET_REBOOT: - ChangeSystemState(SystemState::Reboot);; + ChangeSystemState(NewSystemState::Reboot);; break; diff --git a/Playstation/OrbisLibAPI/Utilities.cpp b/Playstation/OrbisLibAPI/Utilities.cpp index 3e6f67d..14661d2 100644 --- a/Playstation/OrbisLibAPI/Utilities.cpp +++ b/Playstation/OrbisLibAPI/Utilities.cpp @@ -61,6 +61,8 @@ bool LoadModules() return false; } + sceSysmoduleLoadModuleInternal(0x8000000D); + // Start up networking interface res = sceNetInit(); if (res != 0) @@ -179,6 +181,8 @@ bool Jailbreak() klog("jbc failed to jailbreak cred.\n"); return false; } + + //cred.sonyCred = 0x3800000000010003; if (jbc_set_cred(&cred) != 0) { diff --git a/Playstation/OrbisLibAPI/Version.h b/Playstation/OrbisLibAPI/Version.h index 0bceb14..4c1fa46 100644 --- a/Playstation/OrbisLibAPI/Version.h +++ b/Playstation/OrbisLibAPI/Version.h @@ -1,11 +1,11 @@ -#pragma once -#define ORBISLIB_MAJOR 3 -#define ORBISLIB_MINOR 0 -#define ORBISLIB_BUILDVERSION 1021 -#define stringify(a) stringify_(a) -#define stringify_(a) #a -#if defined(_DEBUG) -#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) -#else -#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) -#endif +#pragma once +#define ORBISLIB_MAJOR 3 +#define ORBISLIB_MINOR 0 +#define ORBISLIB_BUILDVERSION 1070 +#define stringify(a) stringify_(a) +#define stringify_(a) #a +#if defined(_DEBUG) +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#else +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#endif diff --git a/Playstation/OrbisLibAPI/build.bat b/Playstation/OrbisLibAPI/build.bat index 97928ac..cbe8743 100644 --- a/Playstation/OrbisLibAPI/build.bat +++ b/Playstation/OrbisLibAPI/build.bat @@ -1,7 +1,7 @@ SETLOCAL EnableDelayedExpansion Rem Libraries to link in -set libraries=-lc++ -lc -lSceSysmodule -lkernel -lSceVideoOut -lSceSystemService -lSceSysCore -lSceSystemStateMgr -lSceNet -lScePad -lSceUserService -lSceRegMgr -lSceFreeType -lSceMsgDialog -lSceCommonDialog -lGoldHEN_Hook -lSQLite -lSceAppInstUtil -lSceLncUtil -lSceShellCoreUtil +set libraries=-lc++ -lc -lSceSysmodule -lkernel -lSceVideoOut -lSceSystemService -lSceSysCore -lSceSystemStateMgr -lSceNet -lScePad -lSceUserService -lSceRegMgr -lSceFreeType -lSceMsgDialog -lSceCommonDialog -lGoldHEN_Hook -lSQLite -lSceAppInstUtil -lSceLncUtil -lSceShellCoreUtil -lSceNpManager Rem Read the script arguments into local vars set intdir=%1 @@ -24,7 +24,7 @@ Rem Link the input ELF ld.lld -m elf_x86_64 -pie --script "%OO_PS4_TOOLCHAIN%\link.x" --eh-frame-hdr -o "%outputElf%" "-L%OO_PS4_TOOLCHAIN%\\lib" "-L..\\..\\External\\GoldHEN_Plugins_SDK" "-L..\\..\\External\\LibSQLite-ps4" %libraries% --verbose "%OO_PS4_TOOLCHAIN%\lib\crt1.o" %obj_files% "..\\..\\External\\ps4-libjbc\\jbc.o" Rem Create the eboot -%OO_PS4_TOOLCHAIN%\bin\windows\create-fself.exe -in "%outputElf%" --out "%outputOelf%" --eboot "eboot.bin" --paid 0x3800000000000010 --authinfo 000000000000000000000000001C004000FF000000000080000000000000000000000000000000000000008000400040000000000000008000000000000000080040FFFF000000F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +%OO_PS4_TOOLCHAIN%\bin\windows\create-fself.exe -in "%outputElf%" --out "%outputOelf%" --eboot "eboot.bin" --paid 0x3800000000010003 --authinfo 000000000000000000000000001C004000FF000000000080000000000000000000000000000000000000008000400040000000000000008000000000000000080040FFFF000000F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Rem Cleanup copy "eboot.bin" %outputPath%\Playstation\Build\pkg\Daemons\ORBS30000\eboot.bin diff --git a/Playstation/OrbisLibAPI/main.cpp b/Playstation/OrbisLibAPI/main.cpp index 7c3341b..4ff732a 100644 --- a/Playstation/OrbisLibAPI/main.cpp +++ b/Playstation/OrbisLibAPI/main.cpp @@ -3,6 +3,7 @@ #include "API.h" #include "GoldHEN.h" #include "Events.h" +#include void exiting() { @@ -21,16 +22,8 @@ void exiting() } -// Signal handler function -void signal_handler(int signum) { - klog("Signal %d\n", signum); -} - int main() { - signal(17, signal_handler); - signal(SIGTERM, signal_handler); - // Jailbreak our current process. if (!Jailbreak()) { @@ -66,10 +59,11 @@ int main() return 0; } - // start up the API. NOTE: this is blocking. - API::Init(); + // Mount data & hostapp into ShellUI sandbox + LinkDir("/data/", "/mnt/sandbox/NPXS20001_000/data"); + LinkDir("/hostapp/", "/mnt/sandbox/NPXS20001_000/hostapp"); -//#define LOADTOOLBOX +#define LOADTOOLBOX #ifdef LOADTOOLBOX auto handle = sys_sdk_proc_prx_load("SceShellUI", "/user/data/Orbis Toolbox/OrbisToolbox-2.0.sprx"); if (handle > 0) { @@ -81,6 +75,9 @@ int main() Notify("Failed to load Orbis Toolbox!"); } #endif + + // start up the API. NOTE: this is blocking. + API::Init(); //#define KILLSHELLUI #ifdef KILLSHELLUI diff --git a/Playstation/OrbisLibGeneralHelper/LocalSocketListener.cpp b/Playstation/OrbisLibGeneralHelper/LocalSocketListener.cpp index ac70e82..9d4c9f9 100644 --- a/Playstation/OrbisLibGeneralHelper/LocalSocketListener.cpp +++ b/Playstation/OrbisLibGeneralHelper/LocalSocketListener.cpp @@ -98,9 +98,9 @@ void* LocalSocketListener::DoWork() Params->Sock = ClientSocket; // Create Thread to handle connection. - OrbisPthread* Thread; + OrbisPthread Thread; scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); - scePthreadDetach(*Thread); + scePthreadDetach(Thread); // Reset ClientSocket. ClientSocket = -1; @@ -134,7 +134,7 @@ LocalSocketListener::LocalSocketListener(void(*ClientCallBack)(void* tdParam, Or strcpy(this->ServerAddress, ServerAddress); scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread"); - scePthreadDetach(*ListenThreadHandle); + scePthreadDetach(ListenThreadHandle); } LocalSocketListener::~LocalSocketListener() @@ -142,7 +142,7 @@ LocalSocketListener::~LocalSocketListener() klog("~Socket Listener.\n"); this->ServerRunning = false; - scePthreadJoin(*ListenThreadHandle, nullptr); + scePthreadJoin(ListenThreadHandle, nullptr); klog("Destruction sucessful.\n"); } \ No newline at end of file diff --git a/Playstation/OrbisLibGeneralHelper/LocalSocketListener.h b/Playstation/OrbisLibGeneralHelper/LocalSocketListener.h index 8e9012d..d08d2e2 100644 --- a/Playstation/OrbisLibGeneralHelper/LocalSocketListener.h +++ b/Playstation/OrbisLibGeneralHelper/LocalSocketListener.h @@ -3,7 +3,7 @@ class LocalSocketListener { private: - OrbisPthread* ListenThreadHandle; + OrbisPthread ListenThreadHandle; OrbisNetId Socket; /// Used to signal thread to shut down bool ServerRunning; diff --git a/Playstation/OrbisLibGeneralHelper/OrbisLibGeneralHelper.cpp b/Playstation/OrbisLibGeneralHelper/OrbisLibGeneralHelper.cpp index 90faadc..ea172fc 100644 --- a/Playstation/OrbisLibGeneralHelper/OrbisLibGeneralHelper.cpp +++ b/Playstation/OrbisLibGeneralHelper/OrbisLibGeneralHelper.cpp @@ -38,8 +38,8 @@ void SendLibraryList(OrbisNetId Sock) void LoadUnloadLib(int Command, OrbisNetId Sock) { - auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); - sceNetRecv(Sock, Packet, sizeof(LibPacket), 0); + auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket)); + sceNetRecv(Sock, Packet, sizeof(PRXPacket), 0); if (Command == GIPC_LIB_LOAD) { @@ -114,6 +114,7 @@ void ReadWriteMemory(OrbisNetId Sock) return; } + // Let the client know we have validated the memory. Sockets::SendInt(Sock, 1); // Read / Write the memory. @@ -157,6 +158,7 @@ Exit: free(Packet); + // success! Sockets::SendInt(Sock, 1); } @@ -224,7 +226,7 @@ void ListenerClientThread(void* tdParam, OrbisNetId Sock) break; case GIPC_PROT: - // Might not really need this either? Depends on if we can set the protection from the debug proc. + break; } } diff --git a/Playstation/OrbisLibGeneralHelper/build.bat b/Playstation/OrbisLibGeneralHelper/build.bat index 3357b63..e27ebeb 100644 --- a/Playstation/OrbisLibGeneralHelper/build.bat +++ b/Playstation/OrbisLibGeneralHelper/build.bat @@ -48,7 +48,7 @@ copy "%outputPrx%" "%outputPath%\Playstation\Build\pkg\Orbis Suite\%targetname%. del "%outputPrx%" REM Generate the script. Will overwrite any existing temp.txt -echo open 1.1.0.15 2121> temp.txt +echo open 1.1.0.14 2121> temp.txt echo anonymous>> temp.txt echo anonymous>> temp.txt echo cd "/data/Orbis Suite/">> temp.txt diff --git a/Playstation/OrbisSuite/main.cpp b/Playstation/OrbisSuite/main.cpp index e8b0fde..fae4115 100644 --- a/Playstation/OrbisSuite/main.cpp +++ b/Playstation/OrbisSuite/main.cpp @@ -33,8 +33,8 @@ int main() // Install all the things! :D //InstallDaemon("ORBS30000"); // Orbis Lib - InstallOrbisToolbox(); - InstallOrbisSuite(); + //InstallOrbisToolbox(); + //InstallOrbisSuite(); //TODO: use IPC to see if prx is already loaded. diff --git a/Playstation/OrbisToolbox-2.0/LocalSocketListener.cpp b/Playstation/OrbisToolbox-2.0/LocalSocketListener.cpp index 85875ef..faf0852 100644 --- a/Playstation/OrbisToolbox-2.0/LocalSocketListener.cpp +++ b/Playstation/OrbisToolbox-2.0/LocalSocketListener.cpp @@ -92,9 +92,9 @@ void* LocalSocketListener::DoWork() Params->Sock = ClientSocket; // Create Thread to handle connection. - OrbisPthread* Thread; + OrbisPthread Thread; scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); - scePthreadDetach(*Thread); + scePthreadDetach(Thread); // Reset ClientSocket. ClientSocket = -1; @@ -128,7 +128,7 @@ LocalSocketListener::LocalSocketListener(void(*ClientCallBack)(void* tdParam, Or strcpy(this->ServerAddress, ServerAddress); scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread"); - scePthreadDetach(*ListenThreadHandle); + scePthreadDetach(ListenThreadHandle); } LocalSocketListener::~LocalSocketListener() @@ -136,7 +136,7 @@ LocalSocketListener::~LocalSocketListener() klog("~Socket Listener.\n"); this->ServerRunning = false; - scePthreadJoin(*ListenThreadHandle, nullptr); + scePthreadJoin(ListenThreadHandle, nullptr); klog("Destruction sucessful.\n"); } \ No newline at end of file diff --git a/Playstation/OrbisToolbox-2.0/LocalSocketListener.h b/Playstation/OrbisToolbox-2.0/LocalSocketListener.h index 8e9012d..d08d2e2 100644 --- a/Playstation/OrbisToolbox-2.0/LocalSocketListener.h +++ b/Playstation/OrbisToolbox-2.0/LocalSocketListener.h @@ -3,7 +3,7 @@ class LocalSocketListener { private: - OrbisPthread* ListenThreadHandle; + OrbisPthread ListenThreadHandle; OrbisNetId Socket; /// Used to signal thread to shut down bool ServerRunning; diff --git a/Playstation/OrbisToolbox-2.0/OrbisToolbox.cpp b/Playstation/OrbisToolbox-2.0/OrbisToolbox.cpp index 30e4a23..c84cb42 100644 --- a/Playstation/OrbisToolbox-2.0/OrbisToolbox.cpp +++ b/Playstation/OrbisToolbox-2.0/OrbisToolbox.cpp @@ -69,9 +69,9 @@ extern "C" { int __cdecl module_start(size_t argc, const void* args) { - OrbisPthread* hThread; + OrbisPthread hThread; scePthreadCreate(&hThread, nullptr, InitThread, nullptr, "Init"); - scePthreadJoin(*hThread, nullptr); + scePthreadJoin(hThread, nullptr); return 0; } diff --git a/Playstation/OrbisToolbox-2.0/System_Monitor.cpp b/Playstation/OrbisToolbox-2.0/System_Monitor.cpp index 178a95e..9065420 100644 --- a/Playstation/OrbisToolbox-2.0/System_Monitor.cpp +++ b/Playstation/OrbisToolbox-2.0/System_Monitor.cpp @@ -179,8 +179,9 @@ void System_Monitor::Init() scePthreadAttrSetstacksize(&attr, 0x80000); - OrbisPthread* id; + OrbisPthread id; scePthreadCreate(&id, &attr, Monitor_Thread, NULL, "System Monitor Thread"); + scePthreadDetach(id); } void System_Monitor::Term() diff --git a/Playstation/OrbisToolbox-2.0/Version.h b/Playstation/OrbisToolbox-2.0/Version.h index 3d95a08..1461c20 100644 --- a/Playstation/OrbisToolbox-2.0/Version.h +++ b/Playstation/OrbisToolbox-2.0/Version.h @@ -1,11 +1,11 @@ -#pragma once -#define ORBIS_TOOLBOX_MAJOR 2 -#define ORBIS_TOOLBOX_MINOR 0 -#define ORBIS_TOOLBOX_BUILDVERSION 325 -#define stringify(a) stringify_(a) -#define stringify_(a) #a -#if defined(ORBIS_TOOLBOX_DEBUG) -#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Dev Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) -#else -#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) -#endif +#pragma once +#define ORBIS_TOOLBOX_MAJOR 2 +#define ORBIS_TOOLBOX_MINOR 0 +#define ORBIS_TOOLBOX_BUILDVERSION 342 +#define stringify(a) stringify_(a) +#define stringify_(a) #a +#if defined(ORBIS_TOOLBOX_DEBUG) +#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Dev Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) +#else +#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) +#endif diff --git a/Playstation/OrbisToolbox-2.0/build.bat b/Playstation/OrbisToolbox-2.0/build.bat index 7b53847..6622c9d 100644 --- a/Playstation/OrbisToolbox-2.0/build.bat +++ b/Playstation/OrbisToolbox-2.0/build.bat @@ -48,7 +48,7 @@ copy "%outputPrx%" "%outputPath%\Playstation\Build\pkg\Orbis Toolbox\%targetname del "%outputPrx%" REM Generate the script. Will overwrite any existing temp.txt -echo open 1.1.0.15 2121> temp.txt +echo open 1.1.0.14 2121> temp.txt echo anonymous>> temp.txt echo anonymous>> temp.txt echo cd "/data/Orbis Toolbox/">> temp.txt diff --git a/Windows/Libraries/OrbisLib2/Common/Helpers/Listener.cs b/Windows/Libraries/OrbisLib2/Common/Helpers/Listener.cs index d559054..9d611de 100644 --- a/Windows/Libraries/OrbisLib2/Common/Helpers/Listener.cs +++ b/Windows/Libraries/OrbisLib2/Common/Helpers/Listener.cs @@ -66,7 +66,7 @@ namespace OrbisLib2.Common.Helpers Socket s_Client = s_Listener.EndAccept(ar); if (SocketAccepted != null) { - SocketAccepted(s_Client); + Task.Run(() => SocketAccepted(s_Client)); } //Begin Accepting other Connections again with our call back. diff --git a/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml b/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml index 39daa03..66614e8 100644 --- a/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml +++ b/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml @@ -35,8 +35,8 @@ Fill="{DynamicResource WindowBar}" Grid.ColumnSpan="2"/> - diff --git a/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml.cs b/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml.cs index 1fdfb18..f17d5b1 100644 --- a/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml.cs +++ b/Windows/OrbisLibraryManager/OrbisLibraryManager.xaml.cs @@ -216,7 +216,7 @@ namespace OrbisLibraryManager } else { - SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not load \"{SPRXPath}\" since it is already loaded.", "Error: Failed to load SPRX."); + SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not load \"{SPRXPath.FieldText}\" since it is already loaded.", "Error: Failed to load SPRX."); } } @@ -236,7 +236,7 @@ namespace OrbisLibraryManager } else { - SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not unload \"{SPRXPath}\" since it is not loaded.", "Error: Failed to unload SPRX."); + SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not unload \"{SPRXPath.FieldText}\" since it is not loaded.", "Error: Failed to unload SPRX."); } } @@ -259,7 +259,7 @@ namespace OrbisLibraryManager } else { - SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not reload \"{SPRXPath}\" since it is not loaded.", "Error: Failed to reload SPRX."); + SimpleMessageBox.ShowError(Window.GetWindow(this), $"Could not reload \"{SPRXPath.FieldText}\" since it is not loaded.", "Error: Failed to reload SPRX."); } } diff --git a/Windows/OrbisNeighborHood/Controls/TargetPanel.xaml.cs b/Windows/OrbisNeighborHood/Controls/TargetPanel.xaml.cs index 95bb756..a39dac8 100644 --- a/Windows/OrbisNeighborHood/Controls/TargetPanel.xaml.cs +++ b/Windows/OrbisNeighborHood/Controls/TargetPanel.xaml.cs @@ -13,6 +13,7 @@ using OrbisLib2.Common.Database.Types; using OrbisLib2.Common.API; using OrbisLib2.Targets; using OrbisLib2.Common.Database; +using System.Threading.Tasks; namespace OrbisNeighborHood.Controls { @@ -244,74 +245,80 @@ namespace OrbisNeighborHood.Controls private void LocateTarget_Click(object sender, RoutedEventArgs e) { - _thisTarget.Buzzer(BuzzerType.RingThree); + Task.Run(() => + { + _thisTarget.Buzzer(BuzzerType.RingThree); + }); } private void SendPayload_Click(object sender, RoutedEventArgs e) { - try + Task.Run(() => { - string PayloadPath = string.Empty; - var openFileDialog = new OpenFileDialog(); - - openFileDialog.Title = "Open BIN File..."; - openFileDialog.CheckFileExists = true; - openFileDialog.CheckPathExists = true; - openFileDialog.InitialDirectory = Properties.Settings.Default.LastPayloadPath; - openFileDialog.Filter = "BIN files (*.BIN)|*.BIN"; - openFileDialog.FilterIndex = 2; - openFileDialog.RestoreDirectory = true; - - if (openFileDialog.ShowDialog() == true) + try { - PayloadPath = openFileDialog.FileName; - Properties.Settings.Default.LastPayloadPath = System.IO.Path.GetDirectoryName(openFileDialog.FileName); - Properties.Settings.Default.Save(); - } - else - return; + string PayloadPath = string.Empty; + var openFileDialog = new OpenFileDialog(); - FileStream fPayload = File.Open(PayloadPath, FileMode.Open); - if (fPayload.CanRead) - { - byte[] PayloadBuffer = new byte[fPayload.Length]; + openFileDialog.Title = "Open BIN File..."; + openFileDialog.CheckFileExists = true; + openFileDialog.CheckPathExists = true; + openFileDialog.InitialDirectory = Properties.Settings.Default.LastPayloadPath; + openFileDialog.Filter = "BIN files (*.BIN)|*.BIN"; + openFileDialog.FilterIndex = 2; + openFileDialog.RestoreDirectory = true; - if (fPayload.Read(PayloadBuffer, 0, (int)fPayload.Length) == fPayload.Length) + if (openFileDialog.ShowDialog() == true) { - if (!_thisTarget.Payload.InjectPayload(PayloadBuffer)) - { - SimpleMessageBox.ShowError(Window.GetWindow(this), "Failed to send payload to target please try again.", "Error: Failed to inject payload."); - } - else - { - SimpleMessageBox.ShowInformation(Window.GetWindow(this), "The payload has been sucessfully sent.", "Payload Sent!"); - } + PayloadPath = openFileDialog.FileName; + Properties.Settings.Default.LastPayloadPath = System.IO.Path.GetDirectoryName(openFileDialog.FileName); + Properties.Settings.Default.Save(); } else - SimpleMessageBox.ShowError(Window.GetWindow(this), "Failed read payload from disc to target please try again.", "Error: Failed to inject payload."); + return; + + FileStream fPayload = File.Open(PayloadPath, FileMode.Open); + if (fPayload.CanRead) + { + byte[] PayloadBuffer = new byte[fPayload.Length]; + + if (fPayload.Read(PayloadBuffer, 0, (int)fPayload.Length) == fPayload.Length) + { + if (!_thisTarget.Payload.InjectPayload(PayloadBuffer)) + { + SimpleMessageBox.ShowError(Window.GetWindow(this), "Failed to send payload to target please try again.", "Error: Failed to inject payload."); + } + else + { + SimpleMessageBox.ShowInformation(Window.GetWindow(this), "The payload has been sucessfully sent.", "Payload Sent!"); + } + } + else + SimpleMessageBox.ShowError(Window.GetWindow(this), "Failed read payload from disc to target please try again.", "Error: Failed to inject payload."); + } + + fPayload.Close(); } + catch + { - fPayload.Close(); - } - catch - { - - } + } + }); } private void RestartTarget_Click(object sender, RoutedEventArgs e) { - _thisTarget.Reboot(); + Task.Run(() => _thisTarget.Reboot()); } private void ShutdownTarget_Click(object sender, RoutedEventArgs e) { - _thisTarget.Shutdown(); + Task.Run(() => _thisTarget.Shutdown()); } private void SuspendTarget_Click(object sender, RoutedEventArgs e) { - _thisTarget.Suspend(); + Task.Run(() => _thisTarget.Suspend()); } #endregion diff --git a/Windows/OrbisNeighborHood/NeighborHood.xaml b/Windows/OrbisNeighborHood/NeighborHood.xaml index 6028019..1cc4e2a 100644 --- a/Windows/OrbisNeighborHood/NeighborHood.xaml +++ b/Windows/OrbisNeighborHood/NeighborHood.xaml @@ -75,9 +75,10 @@ + diff --git a/Windows/OrbisNeighborHood/Resources/BuildNumber.txt b/Windows/OrbisNeighborHood/Resources/BuildNumber.txt index 91488bb..49d31a3 100644 --- a/Windows/OrbisNeighborHood/Resources/BuildNumber.txt +++ b/Windows/OrbisNeighborHood/Resources/BuildNumber.txt @@ -1 +1 @@ -2528 +2595 diff --git a/Windows/OrbisNeighborHood/Resources/BuildString.txt b/Windows/OrbisNeighborHood/Resources/BuildString.txt index 73358d1..8599884 100644 --- a/Windows/OrbisNeighborHood/Resources/BuildString.txt +++ b/Windows/OrbisNeighborHood/Resources/BuildString.txt @@ -1 +1 @@ -Version 3.0.2528 Debug Build Thursday January 19 2023 10:59 PM +Version 3.0.2595 Debug Build Tuesday February 14 2023 8:21 PM diff --git a/Windows/OrbisPeeknPoke/OrbisPeeknPoke.xaml.cs b/Windows/OrbisPeeknPoke/OrbisPeeknPoke.xaml.cs index 71369a3..f0917c9 100644 --- a/Windows/OrbisPeeknPoke/OrbisPeeknPoke.xaml.cs +++ b/Windows/OrbisPeeknPoke/OrbisPeeknPoke.xaml.cs @@ -360,13 +360,6 @@ namespace OrbisPeeknPoke for (int i = 7; i >= 0; i--) RawJumpAddress[i] = HexBox.ByteProvider.ReadByte(HexBox.SelectionStart + i); - // Hex or decimal value of offset - ulong offset; - if (TryConvertStringToUlong(Offset.FieldText, out offset)) - { - lastAddress += offset; - } - ulong address; try { @@ -407,15 +400,17 @@ namespace OrbisPeeknPoke if (JumpList.Count == 0) ReturnPointer.IsEnabled = false; - GetPeekPokeInfo(out var lastAddress, out var length); + GetPeekPokeInfo(out var address, out var length); Task.Run(() => { - var data = TargetManager.SelectedTarget.Debug.ReadMemory(JumpList.Last(), length); + var lastAddress = JumpList.Last(); + + var data = TargetManager.SelectedTarget.Debug.ReadMemory(lastAddress, length); if (data != null && data.Length > 0) { // Add the last address to the list. - JumpList.Remove(JumpList.Last()); + JumpList.Remove(lastAddress); Dispatcher.Invoke(() => {