fixing broken thread things for oosdk, add tasks for c#, and fixing bugs.

This commit is contained in:
Greg
2023-02-14 21:24:25 -07:00
parent 918a61d1d8
commit fcf43107f3
37 changed files with 188 additions and 162 deletions
Vendored Submodule
+1
Submodule External/HexView added at a6f43ec0d8
+6
View File
@@ -35,3 +35,9 @@ struct LibPacket
int SegmentCount; int SegmentCount;
OrbisKernelModuleSegmentInfo Segments[4]; OrbisKernelModuleSegmentInfo Segments[4];
}; };
struct PRXPacket
{
uint32_t Handle;
char Path[256];
};
+15 -7
View File
@@ -3,7 +3,6 @@
#include "APIHelper.h" #include "APIHelper.h"
#include "GeneralIPC.h" #include "GeneralIPC.h"
#include "Events.h" #include "Events.h"
#include <sys/ptrace.h> #include <sys/ptrace.h>
#define HelperPrxPath "/data/Orbis Suite/OrbisLibGeneralHelper.sprx" #define HelperPrxPath "/data/Orbis Suite/OrbisLibGeneralHelper.sprx"
@@ -54,8 +53,6 @@ void Debug::HandleAPI(OrbisNetId Sock, APIPacket* Packet)
break; break;
//...
case API_DBG_LOAD_LIBRARY: case API_DBG_LOAD_LIBRARY:
LoadLibrary(Sock); LoadLibrary(Sock);
@@ -105,7 +102,7 @@ bool Debug::TryDetach(int pid)
CurrentPID = -1; CurrentPID = -1;
// Wait for the current proc thread to die. // Wait for the current proc thread to die.
scePthreadJoin(*ProcMonitorThreadHandle, nullptr); scePthreadJoin(ProcMonitorThreadHandle, nullptr);
return true; return true;
} }
@@ -124,6 +121,9 @@ void* Debug::ProcessMonotorThread()
{ {
klog("Proc %d has died.\n", CurrentPID); klog("Proc %d has died.\n", CurrentPID);
// Release the IPC file
GeneralIPC::DeleteTempFile(CurrentPID);
// Aquire lock. // Aquire lock.
scePthreadMutexLock(&DebugMutex); scePthreadMutexLock(&DebugMutex);
@@ -149,6 +149,7 @@ void* Debug::ProcessMonotorThread()
{ {
int signal = WSTOPSIG(status); int signal = WSTOPSIG(status);
klog("Process %d has recieved the signal %d\n", CurrentPID, signal); klog("Process %d has recieved the signal %d\n", CurrentPID, signal);
// TODO: Back trace here on bad sig
switch (signal) switch (signal)
{ {
@@ -162,8 +163,6 @@ void* Debug::ProcessMonotorThread()
} }
Thread_Exit: Thread_Exit:
klog("Client Thread Exiting!\n");
// TODO: Remove any Watchpoints / Breakpoints now. // TODO: Remove any Watchpoints / Breakpoints now.
// Unless the process is dying maybe? // Unless the process is dying maybe?
@@ -304,7 +303,16 @@ void Debug::LoadLibrary(OrbisNetId Sock)
// Get next packet. // Get next packet.
auto Packet = (DbgSPRXPacket*)malloc(sizeof(DbgSPRXPacket)); 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. // Load the library.
int handle = 0; int handle = 0;
+1 -1
View File
@@ -4,7 +4,7 @@ class Debug
{ {
public: public:
OrbisPthreadMutex DebugMutex; OrbisPthreadMutex DebugMutex;
OrbisPthread* ProcMonitorThreadHandle; OrbisPthread ProcMonitorThreadHandle;
bool IsDebugging; bool IsDebugging;
int CurrentPID; int CurrentPID;
+23 -21
View File
@@ -47,6 +47,14 @@ bool GeneralIPC::SendCommand(OrbisNetId Sock, int Command)
return Status == GIPC_OK; 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) bool GeneralIPC::TestConnection(int pid)
{ {
// Open a new local socket connection for the process. // 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); Jailbreak(pid);
// Create next packet. // Create next packet.
auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket));
strcpy(Packet->Path, Path); strcpy(Packet->Path, Path);
// Send the packet. // Send the packet.
if (sceNetSend(sock, Packet, sizeof(LibPacket), 0) < 0) if (sceNetSend(sock, Packet, sizeof(PRXPacket), 0) < 0)
{ {
// Close the socket. // Close the socket.
sceNetSocketClose(sock); sceNetSocketClose(sock);
klog("[GeneralIPC] Failed to send LibPacket.\n"); klog("[GeneralIPC] Failed to send PRXPacket.\n");
// Restore the jail. // Restore the jail.
Jail(pid); Jail(pid);
@@ -194,25 +202,19 @@ bool GeneralIPC::LoadLibrary(int pid, const char* Path, int* HandleOut)
return false; return false;
} }
// Check to see if it was loaded successfully. // Close the socket.
if (*HandleOut <= 0) sceNetSocketClose(sock);
{
// Close the socket.
sceNetSocketClose(sock);
klog("[GeneralIPC] Failed to load PRX '%s' (0x%llX).\n", *HandleOut);
// Restore the jail.
Jail(pid);
return false;
}
// Restore the jail. // Restore the jail.
Jail(pid); Jail(pid);
// Close the socket. // Check to see if it was loaded successfully.
sceNetSocketClose(sock); if (*HandleOut <= 0)
{
klog("[GeneralIPC] Failed to load PRX '%s' (0x%llX).\n", Path, *HandleOut);
return false;
}
return true; return true;
} }
@@ -238,11 +240,11 @@ bool GeneralIPC::UnLoadLibrary(int pid, int Handle)
} }
// Create next packet. // Create next packet.
auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket));
Packet->Handle = Handle; Packet->Handle = Handle;
// Send the packet. // Send the packet.
if (sceNetSend(sock, Packet, sizeof(LibPacket), 0) < 0) if (sceNetSend(sock, Packet, sizeof(PRXPacket), 0) < 0)
{ {
// Close the socket. // Close the socket.
sceNetSocketClose(sock); sceNetSocketClose(sock);
@@ -250,7 +252,7 @@ bool GeneralIPC::UnLoadLibrary(int pid, int Handle)
// Cleanup // Cleanup
free(Packet); free(Packet);
klog("[GeneralIPC] Failed to send LibPacket.\n"); klog("[GeneralIPC] Failed to send PRXPacket.\n");
return false; return false;
} }
+1
View File
@@ -8,6 +8,7 @@ private:
static bool SendCommand(OrbisNetId Sock, int Command); static bool SendCommand(OrbisNetId Sock, int Command);
public: public:
static void DeleteTempFile(int pid);
static bool TestConnection(int pid); static bool TestConnection(int pid);
static bool GetLibraryList(int pid, std::vector<LibraryPacket>& Libraries); static bool GetLibraryList(int pid, std::vector<LibraryPacket>& Libraries);
static bool LoadLibrary(int pid, const char* Path, int* HandleOut); static bool LoadLibrary(int pid, const char* Path, int* HandleOut);
+3 -3
View File
@@ -98,9 +98,9 @@ void* SocketListener::DoWork()
Params->sin_addr = ClientAddr.sin_addr; Params->sin_addr = ClientAddr.sin_addr;
// Create Thread to handle connection. // Create Thread to handle connection.
OrbisPthread* Thread; OrbisPthread Thread;
scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread");
scePthreadDetach(*Thread); scePthreadDetach(Thread);
// Reset ClientSocket. // Reset ClientSocket.
ClientSocket = -1; ClientSocket = -1;
@@ -143,7 +143,7 @@ SocketListener::~SocketListener()
klog("~Socket Listener.\n"); klog("~Socket Listener.\n");
this->ServerRunning = false; this->ServerRunning = false;
scePthreadJoin(*ListenThreadHandle, nullptr); scePthreadJoin(ListenThreadHandle, nullptr);
klog("Destruction sucessful.\n"); klog("Destruction sucessful.\n");
} }
+1 -1
View File
@@ -10,7 +10,7 @@ private:
/// Used to see when listen thread has closed. /// Used to see when listen thread has closed.
bool ThreadCleanedUp; bool ThreadCleanedUp;
unsigned short Port; unsigned short Port;
OrbisPthread* ListenThreadHandle; OrbisPthread ListenThreadHandle;
void* DoWork(); void* DoWork();
static void* ClientThread(void* tdParam); static void* ClientThread(void* tdParam);
+1 -1
View File
@@ -1,7 +1,7 @@
#include "Common.h" #include "Common.h"
#include "System.h" #include "System.h"
int ChangeSystemState(SystemState State) int ChangeSystemState(NewSystemState State)
{ {
OrbisKernelEventFlag EventFlag = 0; OrbisKernelEventFlag EventFlag = 0;
int ret = 0; int ret = 0;
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
enum SystemState enum NewSystemState
{ {
Suspend = 0x8004000, Suspend = 0x8004000,
Shutdown = 0x4000, Shutdown = 0x4000,
@@ -24,7 +24,7 @@ enum ConsoleTypes
CT_KRATOS, //0xA0 IMPOSSIBLE?? CT_KRATOS, //0xA0 IMPOSSIBLE??
}; };
int ChangeSystemState(SystemState State); int ChangeSystemState(NewSystemState State);
void SetConsoleLED(ConsoleLEDColours Colour); void SetConsoleLED(ConsoleLEDColours Colour);
void SetControllerLED(); void SetControllerLED();
void RingBuzzer(BuzzerType Type); void RingBuzzer(BuzzerType Type);
+5 -5
View File
@@ -1,6 +1,7 @@
#include "Common.h" #include "Common.h"
#include "SystemMonitor.h" #include "SystemMonitor.h"
OrbisPthread SystemMonitor::ThreadId;
int SystemMonitor::Thread_Count = 0; int SystemMonitor::Thread_Count = 0;
int SystemMonitor::Busy_Core = 0; int SystemMonitor::Busy_Core = 0;
float SystemMonitor::Usage[8] = { 0 }; float SystemMonitor::Usage[8] = { 0 };
@@ -177,14 +178,13 @@ void* SystemMonitor::MonitorThread(void* args)
void SystemMonitor::Init() void SystemMonitor::Init()
{ {
klog("[System Monitor] Starting System Monitor Thread...\n"); klog("[System Monitor] Starting System Monitor Thread...\n");
OrbisPthread* id; scePthreadCreate(&ThreadId, nullptr, MonitorThread, NULL, "System Monitor Thread");
scePthreadCreate(&id, nullptr, MonitorThread, NULL, "System Monitor Thread"); scePthreadDetach(ThreadId);
scePthreadDetach(*id);
} }
void SystemMonitor::Term() void SystemMonitor::Term()
{ {
Should_Run_Thread = false; Should_Run_Thread = false;
while (!Should_Run_Thread) { sceKernelUsleep(1000 * 10); } scePthreadJoin(ThreadId, nullptr);
} }
+1
View File
@@ -12,6 +12,7 @@ public:
float Percentage; float Percentage;
}; };
static OrbisPthread ThreadId;
static int Thread_Count; static int Thread_Count;
static int Busy_Core; static int Busy_Core;
static float Usage[8]; static float Usage[8];
+3 -3
View File
@@ -21,19 +21,19 @@ void Target::HandleAPI(OrbisNetId Sock, APIPacket* Packet)
case APICommands::API_TARGET_RESTMODE: case APICommands::API_TARGET_RESTMODE:
ChangeSystemState(SystemState::Suspend); ChangeSystemState(NewSystemState::Suspend);
break; break;
case APICommands::API_TARGET_SHUTDOWN: case APICommands::API_TARGET_SHUTDOWN:
ChangeSystemState(SystemState::Shutdown); ChangeSystemState(NewSystemState::Shutdown);
break; break;
case APICommands::API_TARGET_REBOOT: case APICommands::API_TARGET_REBOOT:
ChangeSystemState(SystemState::Reboot);; ChangeSystemState(NewSystemState::Reboot);;
break; break;
+4
View File
@@ -61,6 +61,8 @@ bool LoadModules()
return false; return false;
} }
sceSysmoduleLoadModuleInternal(0x8000000D);
// Start up networking interface // Start up networking interface
res = sceNetInit(); res = sceNetInit();
if (res != 0) if (res != 0)
@@ -179,6 +181,8 @@ bool Jailbreak()
klog("jbc failed to jailbreak cred.\n"); klog("jbc failed to jailbreak cred.\n");
return false; return false;
} }
//cred.sonyCred = 0x3800000000010003;
if (jbc_set_cred(&cred) != 0) if (jbc_set_cred(&cred) != 0)
{ {
+11 -11
View File
@@ -1,11 +1,11 @@
#pragma once #pragma once
#define ORBISLIB_MAJOR 3 #define ORBISLIB_MAJOR 3
#define ORBISLIB_MINOR 0 #define ORBISLIB_MINOR 0
#define ORBISLIB_BUILDVERSION 1021 #define ORBISLIB_BUILDVERSION 1070
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a
#if defined(_DEBUG) #if defined(_DEBUG)
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) #define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
#else #else
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) #define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
#endif #endif
+2 -2
View File
@@ -1,7 +1,7 @@
SETLOCAL EnableDelayedExpansion SETLOCAL EnableDelayedExpansion
Rem Libraries to link in 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 Rem Read the script arguments into local vars
set intdir=%1 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" 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 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 Rem Cleanup
copy "eboot.bin" %outputPath%\Playstation\Build\pkg\Daemons\ORBS30000\eboot.bin copy "eboot.bin" %outputPath%\Playstation\Build\pkg\Daemons\ORBS30000\eboot.bin
+8 -11
View File
@@ -3,6 +3,7 @@
#include "API.h" #include "API.h"
#include "GoldHEN.h" #include "GoldHEN.h"
#include "Events.h" #include "Events.h"
#include <orbis/NpManager.h>
void exiting() void exiting()
{ {
@@ -21,16 +22,8 @@ void exiting()
} }
// Signal handler function
void signal_handler(int signum) {
klog("Signal %d\n", signum);
}
int main() int main()
{ {
signal(17, signal_handler);
signal(SIGTERM, signal_handler);
// Jailbreak our current process. // Jailbreak our current process.
if (!Jailbreak()) if (!Jailbreak())
{ {
@@ -66,10 +59,11 @@ int main()
return 0; return 0;
} }
// start up the API. NOTE: this is blocking. // Mount data & hostapp into ShellUI sandbox
API::Init(); LinkDir("/data/", "/mnt/sandbox/NPXS20001_000/data");
LinkDir("/hostapp/", "/mnt/sandbox/NPXS20001_000/hostapp");
//#define LOADTOOLBOX #define LOADTOOLBOX
#ifdef LOADTOOLBOX #ifdef LOADTOOLBOX
auto handle = sys_sdk_proc_prx_load("SceShellUI", "/user/data/Orbis Toolbox/OrbisToolbox-2.0.sprx"); auto handle = sys_sdk_proc_prx_load("SceShellUI", "/user/data/Orbis Toolbox/OrbisToolbox-2.0.sprx");
if (handle > 0) { if (handle > 0) {
@@ -81,6 +75,9 @@ int main()
Notify("Failed to load Orbis Toolbox!"); Notify("Failed to load Orbis Toolbox!");
} }
#endif #endif
// start up the API. NOTE: this is blocking.
API::Init();
//#define KILLSHELLUI //#define KILLSHELLUI
#ifdef KILLSHELLUI #ifdef KILLSHELLUI
@@ -98,9 +98,9 @@ void* LocalSocketListener::DoWork()
Params->Sock = ClientSocket; Params->Sock = ClientSocket;
// Create Thread to handle connection. // Create Thread to handle connection.
OrbisPthread* Thread; OrbisPthread Thread;
scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread");
scePthreadDetach(*Thread); scePthreadDetach(Thread);
// Reset ClientSocket. // Reset ClientSocket.
ClientSocket = -1; ClientSocket = -1;
@@ -134,7 +134,7 @@ LocalSocketListener::LocalSocketListener(void(*ClientCallBack)(void* tdParam, Or
strcpy(this->ServerAddress, ServerAddress); strcpy(this->ServerAddress, ServerAddress);
scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread"); scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread");
scePthreadDetach(*ListenThreadHandle); scePthreadDetach(ListenThreadHandle);
} }
LocalSocketListener::~LocalSocketListener() LocalSocketListener::~LocalSocketListener()
@@ -142,7 +142,7 @@ LocalSocketListener::~LocalSocketListener()
klog("~Socket Listener.\n"); klog("~Socket Listener.\n");
this->ServerRunning = false; this->ServerRunning = false;
scePthreadJoin(*ListenThreadHandle, nullptr); scePthreadJoin(ListenThreadHandle, nullptr);
klog("Destruction sucessful.\n"); klog("Destruction sucessful.\n");
} }
@@ -3,7 +3,7 @@
class LocalSocketListener class LocalSocketListener
{ {
private: private:
OrbisPthread* ListenThreadHandle; OrbisPthread ListenThreadHandle;
OrbisNetId Socket; OrbisNetId Socket;
/// Used to signal thread to shut down /// Used to signal thread to shut down
bool ServerRunning; bool ServerRunning;
@@ -38,8 +38,8 @@ void SendLibraryList(OrbisNetId Sock)
void LoadUnloadLib(int Command, OrbisNetId Sock) void LoadUnloadLib(int Command, OrbisNetId Sock)
{ {
auto Packet = (LibPacket*)malloc(sizeof(LibPacket)); auto Packet = (PRXPacket*)malloc(sizeof(PRXPacket));
sceNetRecv(Sock, Packet, sizeof(LibPacket), 0); sceNetRecv(Sock, Packet, sizeof(PRXPacket), 0);
if (Command == GIPC_LIB_LOAD) if (Command == GIPC_LIB_LOAD)
{ {
@@ -114,6 +114,7 @@ void ReadWriteMemory(OrbisNetId Sock)
return; return;
} }
// Let the client know we have validated the memory.
Sockets::SendInt(Sock, 1); Sockets::SendInt(Sock, 1);
// Read / Write the memory. // Read / Write the memory.
@@ -157,6 +158,7 @@ Exit:
free(Packet); free(Packet);
// success!
Sockets::SendInt(Sock, 1); Sockets::SendInt(Sock, 1);
} }
@@ -224,7 +226,7 @@ void ListenerClientThread(void* tdParam, OrbisNetId Sock)
break; break;
case GIPC_PROT: case GIPC_PROT:
// Might not really need this either? Depends on if we can set the protection from the debug proc.
break; break;
} }
} }
+1 -1
View File
@@ -48,7 +48,7 @@ copy "%outputPrx%" "%outputPath%\Playstation\Build\pkg\Orbis Suite\%targetname%.
del "%outputPrx%" del "%outputPrx%"
REM Generate the script. Will overwrite any existing temp.txt 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 anonymous>> temp.txt echo anonymous>> temp.txt
echo cd "/data/Orbis Suite/">> temp.txt echo cd "/data/Orbis Suite/">> temp.txt
+2 -2
View File
@@ -33,8 +33,8 @@ int main()
// Install all the things! :D // Install all the things! :D
//InstallDaemon("ORBS30000"); // Orbis Lib //InstallDaemon("ORBS30000"); // Orbis Lib
InstallOrbisToolbox(); //InstallOrbisToolbox();
InstallOrbisSuite(); //InstallOrbisSuite();
//TODO: use IPC to see if prx is already loaded. //TODO: use IPC to see if prx is already loaded.
@@ -92,9 +92,9 @@ void* LocalSocketListener::DoWork()
Params->Sock = ClientSocket; Params->Sock = ClientSocket;
// Create Thread to handle connection. // Create Thread to handle connection.
OrbisPthread* Thread; OrbisPthread Thread;
scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread"); scePthreadCreate(&Thread, NULL, &ClientThread, Params, "Client Thread");
scePthreadDetach(*Thread); scePthreadDetach(Thread);
// Reset ClientSocket. // Reset ClientSocket.
ClientSocket = -1; ClientSocket = -1;
@@ -128,7 +128,7 @@ LocalSocketListener::LocalSocketListener(void(*ClientCallBack)(void* tdParam, Or
strcpy(this->ServerAddress, ServerAddress); strcpy(this->ServerAddress, ServerAddress);
scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread"); scePthreadCreate(&ListenThreadHandle, NULL, &ListenThread, this, "Local Listen Thread");
scePthreadDetach(*ListenThreadHandle); scePthreadDetach(ListenThreadHandle);
} }
LocalSocketListener::~LocalSocketListener() LocalSocketListener::~LocalSocketListener()
@@ -136,7 +136,7 @@ LocalSocketListener::~LocalSocketListener()
klog("~Socket Listener.\n"); klog("~Socket Listener.\n");
this->ServerRunning = false; this->ServerRunning = false;
scePthreadJoin(*ListenThreadHandle, nullptr); scePthreadJoin(ListenThreadHandle, nullptr);
klog("Destruction sucessful.\n"); klog("Destruction sucessful.\n");
} }
@@ -3,7 +3,7 @@
class LocalSocketListener class LocalSocketListener
{ {
private: private:
OrbisPthread* ListenThreadHandle; OrbisPthread ListenThreadHandle;
OrbisNetId Socket; OrbisNetId Socket;
/// Used to signal thread to shut down /// Used to signal thread to shut down
bool ServerRunning; bool ServerRunning;
@@ -69,9 +69,9 @@ extern "C"
{ {
int __cdecl module_start(size_t argc, const void* args) int __cdecl module_start(size_t argc, const void* args)
{ {
OrbisPthread* hThread; OrbisPthread hThread;
scePthreadCreate(&hThread, nullptr, InitThread, nullptr, "Init"); scePthreadCreate(&hThread, nullptr, InitThread, nullptr, "Init");
scePthreadJoin(*hThread, nullptr); scePthreadJoin(hThread, nullptr);
return 0; return 0;
} }
@@ -179,8 +179,9 @@ void System_Monitor::Init()
scePthreadAttrSetstacksize(&attr, 0x80000); scePthreadAttrSetstacksize(&attr, 0x80000);
OrbisPthread* id; OrbisPthread id;
scePthreadCreate(&id, &attr, Monitor_Thread, NULL, "System Monitor Thread"); scePthreadCreate(&id, &attr, Monitor_Thread, NULL, "System Monitor Thread");
scePthreadDetach(id);
} }
void System_Monitor::Term() void System_Monitor::Term()
+11 -11
View File
@@ -1,11 +1,11 @@
#pragma once #pragma once
#define ORBIS_TOOLBOX_MAJOR 2 #define ORBIS_TOOLBOX_MAJOR 2
#define ORBIS_TOOLBOX_MINOR 0 #define ORBIS_TOOLBOX_MINOR 0
#define ORBIS_TOOLBOX_BUILDVERSION 325 #define ORBIS_TOOLBOX_BUILDVERSION 342
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a
#if defined(ORBIS_TOOLBOX_DEBUG) #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__) #define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Dev Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__)
#else #else
#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) #define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__)
#endif #endif
+1 -1
View File
@@ -48,7 +48,7 @@ copy "%outputPrx%" "%outputPath%\Playstation\Build\pkg\Orbis Toolbox\%targetname
del "%outputPrx%" del "%outputPrx%"
REM Generate the script. Will overwrite any existing temp.txt 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 anonymous>> temp.txt echo anonymous>> temp.txt
echo cd "/data/Orbis Toolbox/">> temp.txt echo cd "/data/Orbis Toolbox/">> temp.txt
@@ -66,7 +66,7 @@ namespace OrbisLib2.Common.Helpers
Socket s_Client = s_Listener.EndAccept(ar); Socket s_Client = s_Listener.EndAccept(ar);
if (SocketAccepted != null) if (SocketAccepted != null)
{ {
SocketAccepted(s_Client); Task.Run(() => SocketAccepted(s_Client));
} }
//Begin Accepting other Connections again with our call back. //Begin Accepting other Connections again with our call back.
@@ -35,8 +35,8 @@
Fill="{DynamicResource WindowBar}" Grid.ColumnSpan="2"/> Fill="{DynamicResource WindowBar}" Grid.ColumnSpan="2"/>
<!-- Separation bar --> <!-- Separation bar -->
<Rectangle Grid.Column="0" Grid.Row="0" <Rectangle Grid.Column="0"
Height="0.5" VerticalAlignment="Top" Height="0.6" VerticalAlignment="Top"
Fill="{DynamicResource WindowBackground}" Grid.ColumnSpan="2"/> Fill="{DynamicResource WindowBackground}" Grid.ColumnSpan="2"/>
<!-- Current Target --> <!-- Current Target -->
@@ -216,7 +216,7 @@ namespace OrbisLibraryManager
} }
else 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 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 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.");
} }
} }
@@ -13,6 +13,7 @@ using OrbisLib2.Common.Database.Types;
using OrbisLib2.Common.API; using OrbisLib2.Common.API;
using OrbisLib2.Targets; using OrbisLib2.Targets;
using OrbisLib2.Common.Database; using OrbisLib2.Common.Database;
using System.Threading.Tasks;
namespace OrbisNeighborHood.Controls namespace OrbisNeighborHood.Controls
{ {
@@ -244,74 +245,80 @@ namespace OrbisNeighborHood.Controls
private void LocateTarget_Click(object sender, RoutedEventArgs e) 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) private void SendPayload_Click(object sender, RoutedEventArgs e)
{ {
try Task.Run(() =>
{ {
string PayloadPath = string.Empty; try
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)
{ {
PayloadPath = openFileDialog.FileName; string PayloadPath = string.Empty;
Properties.Settings.Default.LastPayloadPath = System.IO.Path.GetDirectoryName(openFileDialog.FileName); var openFileDialog = new OpenFileDialog();
Properties.Settings.Default.Save();
}
else
return;
FileStream fPayload = File.Open(PayloadPath, FileMode.Open); openFileDialog.Title = "Open BIN File...";
if (fPayload.CanRead) openFileDialog.CheckFileExists = true;
{ openFileDialog.CheckPathExists = true;
byte[] PayloadBuffer = new byte[fPayload.Length]; 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)) PayloadPath = openFileDialog.FileName;
{ Properties.Settings.Default.LastPayloadPath = System.IO.Path.GetDirectoryName(openFileDialog.FileName);
SimpleMessageBox.ShowError(Window.GetWindow(this), "Failed to send payload to target please try again.", "Error: Failed to inject payload."); Properties.Settings.Default.Save();
}
else
{
SimpleMessageBox.ShowInformation(Window.GetWindow(this), "The payload has been sucessfully sent.", "Payload Sent!");
}
} }
else 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) private void RestartTarget_Click(object sender, RoutedEventArgs e)
{ {
_thisTarget.Reboot(); Task.Run(() => _thisTarget.Reboot());
} }
private void ShutdownTarget_Click(object sender, RoutedEventArgs e) private void ShutdownTarget_Click(object sender, RoutedEventArgs e)
{ {
_thisTarget.Shutdown(); Task.Run(() => _thisTarget.Shutdown());
} }
private void SuspendTarget_Click(object sender, RoutedEventArgs e) private void SuspendTarget_Click(object sender, RoutedEventArgs e)
{ {
_thisTarget.Suspend(); Task.Run(() => _thisTarget.Suspend());
} }
#endregion #endregion
+2 -1
View File
@@ -75,9 +75,10 @@
<!-- Current Target --> <!-- Current Target -->
<controls:CurrentTargetDisplay VerticalAlignment="Stretch" <controls:CurrentTargetDisplay VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"/> HorizontalAlignment="Stretch"/>
<!-- Separation bar --> <!-- Separation bar -->
<Rectangle Grid.Column="0" Grid.Row="0" <Rectangle Grid.Column="0" Grid.Row="0"
Height="0.5" VerticalAlignment="Top" Height="0.6" VerticalAlignment="Top"
Fill="{DynamicResource WindowBackground}"/> Fill="{DynamicResource WindowBackground}"/>
<!-- Menu Controls --> <!-- Menu Controls -->
@@ -1 +1 @@
2528 2595
@@ -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
+5 -10
View File
@@ -360,13 +360,6 @@ namespace OrbisPeeknPoke
for (int i = 7; i >= 0; i--) for (int i = 7; i >= 0; i--)
RawJumpAddress[i] = HexBox.ByteProvider.ReadByte(HexBox.SelectionStart + 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; ulong address;
try try
{ {
@@ -407,15 +400,17 @@ namespace OrbisPeeknPoke
if (JumpList.Count == 0) if (JumpList.Count == 0)
ReturnPointer.IsEnabled = false; ReturnPointer.IsEnabled = false;
GetPeekPokeInfo(out var lastAddress, out var length); GetPeekPokeInfo(out var address, out var length);
Task.Run(() => 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) if (data != null && data.Length > 0)
{ {
// Add the last address to the list. // Add the last address to the list.
JumpList.Remove(JumpList.Last()); JumpList.Remove(lastAddress);
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {