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;
OrbisKernelModuleSegmentInfo Segments[4];
};
struct PRXPacket
{
uint32_t Handle;
char Path[256];
};
+15 -7
View File
@@ -3,7 +3,6 @@
#include "APIHelper.h"
#include "GeneralIPC.h"
#include "Events.h"
#include <sys/ptrace.h>
#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;
+1 -1
View File
@@ -4,7 +4,7 @@ class Debug
{
public:
OrbisPthreadMutex DebugMutex;
OrbisPthread* ProcMonitorThreadHandle;
OrbisPthread ProcMonitorThreadHandle;
bool IsDebugging;
int CurrentPID;
+23 -21
View File
@@ -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;
}
+1
View File
@@ -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<LibraryPacket>& Libraries);
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;
// 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");
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -1,7 +1,7 @@
#include "Common.h"
#include "System.h"
int ChangeSystemState(SystemState State)
int ChangeSystemState(NewSystemState State)
{
OrbisKernelEventFlag EventFlag = 0;
int ret = 0;
+2 -2
View File
@@ -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);
+5 -5
View File
@@ -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);
}
+1
View File
@@ -12,6 +12,7 @@ public:
float Percentage;
};
static OrbisPthread ThreadId;
static int Thread_Count;
static int Busy_Core;
static float Usage[8];
+3 -3
View File
@@ -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;
+4
View File
@@ -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)
{
+11 -11
View File
@@ -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
+2 -2
View File
@@ -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
+8 -11
View File
@@ -3,6 +3,7 @@
#include "API.h"
#include "GoldHEN.h"
#include "Events.h"
#include <orbis/NpManager.h>
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
@@ -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");
}
@@ -3,7 +3,7 @@
class LocalSocketListener
{
private:
OrbisPthread* ListenThreadHandle;
OrbisPthread ListenThreadHandle;
OrbisNetId Socket;
/// Used to signal thread to shut down
bool ServerRunning;
@@ -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;
}
}
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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.
@@ -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");
}
@@ -3,7 +3,7 @@
class LocalSocketListener
{
private:
OrbisPthread* ListenThreadHandle;
OrbisPthread ListenThreadHandle;
OrbisNetId Socket;
/// Used to signal thread to shut down
bool ServerRunning;
@@ -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;
}
@@ -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()
+11 -11
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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.
@@ -35,8 +35,8 @@
Fill="{DynamicResource WindowBar}" Grid.ColumnSpan="2"/>
<!-- Separation bar -->
<Rectangle Grid.Column="0" Grid.Row="0"
Height="0.5" VerticalAlignment="Top"
<Rectangle Grid.Column="0"
Height="0.6" VerticalAlignment="Top"
Fill="{DynamicResource WindowBackground}" Grid.ColumnSpan="2"/>
<!-- Current Target -->
@@ -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.");
}
}
@@ -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
+2 -1
View File
@@ -75,9 +75,10 @@
<!-- Current Target -->
<controls:CurrentTargetDisplay VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"/>
<!-- Separation bar -->
<Rectangle Grid.Column="0" Grid.Row="0"
Height="0.5" VerticalAlignment="Top"
Height="0.6" VerticalAlignment="Top"
Fill="{DynamicResource WindowBackground}"/>
<!-- 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--)
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(() =>
{