Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Commit

Permalink
Testing restmode with loader.
Browse files Browse the repository at this point in the history
  • Loading branch information
OSM-Made committed Jun 9, 2021
1 parent b07c241 commit 180f9cd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 95 deletions.
8 changes: 4 additions & 4 deletions Loader/Kernel/source/kproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ void test2_thread(void* arg)
#endif

klog("Registering Events...");
//Register Events
SystemSuspendEvent = EVENTHANDLER_REGISTER(system_suspend_phase1, (void*)OnSystemSuspend, nullptr, EVENTHANDLER_PRI_FIRST);
SystemResumeEvent = EVENTHANDLER_REGISTER(system_resume_phase1, (void*)OnSystemResume, nullptr, EVENTHANDLER_PRI_FIRST);
ProcessStartEvent = EVENTHANDLER_REGISTER(process_exec_end, (void*)OnProcessStart, nullptr, EVENTHANDLER_PRI_LAST);
//SystemSuspendEvent = EVENTHANDLER_REGISTER(system_suspend_phase1, (void*)OnSystemSuspend, nullptr, EVENTHANDLER_PRI_FIRST);
//SystemResumeEvent = EVENTHANDLER_REGISTER(system_resume_phase1, (void*)OnSystemResume, nullptr, EVENTHANDLER_PRI_FIRST);
ProcessStartEvent = EVENTHANDLER_REGISTER(process_exec_end, (void*)OnProcessStart, nullptr, EVENTHANDLER_PRI_ANY);
ProcessExitEvent = EVENTHANDLER_REGISTER(process_exit, (void*)OnProcessExit, nullptr, EVENTHANDLER_PRI_ANY);
klog("Events Registered Sucessfully.");

Expand All @@ -152,6 +151,7 @@ void test2_thread(void* arg)
void kproc_Init()
{
klog("kproc_Init()");

proc* kernel = proc_find_by_name("kernel");
if(kernel)
{
Expand Down
76 changes: 0 additions & 76 deletions Loader/Userland/source/Resolver/Patches-505.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ void Install_505()
{
uint8_t *kmem;

// Enable UART
kmem = (uint8_t *)&gKernelBase[0x019ECEB0];
kmem[0] = 0x00;

// Verbose Panics
kmem = (uint8_t *)&gKernelBase[0x00171627];
kmem[0] = 0x90;
Expand All @@ -19,37 +15,6 @@ void Install_505()
kmem[5] = 0x65;
kmem[6] = 0x8B;
kmem[7] = 0x34;

// sceSblACMgrIsAllowedSystemLevelDebugging
kmem = (uint8_t *)&gKernelBase[0x00010FC0];
kmem[0] = 0xB8;
kmem[1] = 0x01;
kmem[2] = 0x00;
kmem[3] = 0x00;
kmem[4] = 0x00;
kmem[5] = 0xC3;
kmem[6] = 0x90;
kmem[7] = 0x90;

kmem = (uint8_t *)&gKernelBase[0x00011730];
kmem[0] = 0xB8;
kmem[1] = 0x01;
kmem[2] = 0x00;
kmem[3] = 0x00;
kmem[4] = 0x00;
kmem[5] = 0xC3;
kmem[6] = 0x90;
kmem[7] = 0x90;

kmem = (uint8_t *)&gKernelBase[0x00011750];
kmem[0] = 0xB8;
kmem[1] = 0x01;
kmem[2] = 0x00;
kmem[3] = 0x00;
kmem[4] = 0x00;
kmem[5] = 0xC3;
kmem[6] = 0x90;
kmem[7] = 0x90;

// Enable rwx mapping
kmem = (uint8_t *)&gKernelBase[0x000FCD48];
Expand All @@ -67,30 +32,6 @@ void Install_505()
kmem[0] = 0x90;
kmem[1] = 0x90;

// Enable MAP_SELF
kmem = (uint8_t*)&gKernelBase[0x000117b0];
kmem[0] = 0xB8;
kmem[1] = 0x01;
kmem[2] = 0x00;
kmem[3] = 0x00;
kmem[4] = 0x00;
kmem[5] = 0xC3;

kmem = (uint8_t *)&gKernelBase[0x000117c0];
kmem[0] = 0xB8;
kmem[1] = 0x01;
kmem[2] = 0x00;
kmem[3] = 0x00;
kmem[4] = 0x00;
kmem[5] = 0xC3;

kmem = (uint8_t *)&gKernelBase[0x0013F03F];
kmem[0] = 0x31;
kmem[1] = 0xC0;
kmem[2] = 0x90;
kmem[3] = 0x90;
kmem[4] = 0x90;

// Patch copyinstr
kmem = (uint8_t *)&gKernelBase[0x001EAB93];
kmem[0] = 0x90;
Expand All @@ -103,21 +44,4 @@ void Install_505()
// Patch memcpy stack
kmem = (uint8_t *)&gKernelBase[0x001EA53D];
kmem[0] = 0xEB;

// ptrace patches
kmem = (uint8_t *)&gKernelBase[0x0030D9C3];
kmem[0] = 0x90;
kmem[1] = 0x90;
kmem[2] = 0x90;
kmem[3] = 0x90;
kmem[4] = 0x90;
kmem[5] = 0x90;

// setlogin patch (for autolaunch check)
kmem = (uint8_t *)&gKernelBase[0x0005775C];
kmem[0] = 0x48;
kmem[1] = 0x31;
kmem[2] = 0xC0;
kmem[3] = 0x90;
kmem[4] = 0x90;
}
4 changes: 2 additions & 2 deletions Orbis Toolbox/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Menu
template<typename Value>
static MenuOption* Add_Option(const char* Option_Id, Value* Data, Data_Type Type, std::function<void()> OnPress = nullptr, std::function<void()> OnPreCreate = nullptr, std::function<void()> OnPageActivating = nullptr)
{
klog("Add_Option(): %s\n", Option_Id);
//klog("Add_Option(): %s\n", Option_Id);
MenuOption* Temp = new MenuOption();
strcpy(Temp->Id, Option_Id);
Temp->Data = (uint64_t*)Data;
Expand All @@ -56,7 +56,7 @@ class Menu

static MenuOption* Add_Option(const char* Option_Id, std::function<void()> OnPress = nullptr, std::function<void()> OnPreCreate = nullptr, std::function<void()> OnPageActivating = nullptr)
{
klog("Add_Option(): %s\n", Option_Id);
//klog("Add_Option(): %s\n", Option_Id);
MenuOption* Temp = new MenuOption();
strcpy(Temp->Id, Option_Id);
Temp->Type = Type_None;
Expand Down
3 changes: 1 addition & 2 deletions Orbis Toolbox/Settings_Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void Settings_Menu::Init()

Log("Install Patches");
Patch_IsDevkit->Install_Method_Patch(Mono::KernelSysWrapper, "Sce.Vsh", "KernelSysWrapper", "IsDevKit", 0, 0, "\x48\xc7\xc0\x01\x00\x00\x00\xC3", 8);
//Patch_IsDebugMenuEnable->Install_Method_Patch(Mono::App_exe, "Sce.Vsh.ShellUI.DebugSystem", "KeyMonitorTask", "IsDebugMenuEnable", 0, 0, "\x48\xc7\xc0\x01\x00\x00\x00\xC3", 8);
Patch_IsDebugMenuEnable->Install_Method_Patch(Mono::App_exe, "Sce.Vsh.ShellUI.DebugSystem", "KeyMonitorTask", "IsDebugMenuEnable", 0, 0, "\x48\xc7\xc0\x01\x00\x00\x00\xC3", 8);
Patch_AllowDebugMenu->Install_Method_Patch(Mono::platform_dll, "Sce.Vsh.ShellUI.Settings.Sbl", "SblWrapper", "SblRcMgrIsAllowDebugMenuForSettings", 0, 0, "\x48\xc7\xc0\x01\x00\x00\x00\xC3", 8);
Patch_MainThreadCheck->Install_Method_Patch(Mono::PlayStation_Core, "Sce.PlayStation.Core.Runtime", "Diagnostics", "CheckRunningOnMainThread", 0, 0, "\xC3", 1);

Expand All @@ -261,7 +261,6 @@ void Settings_Menu::Init()
Log("Init Menu");
Menu::Init();

//Detours
Log("Init Detours");
Detour_GetManifestResourceStream = new Detour();
Detour_OnCheckVisible = new Detour();
Expand Down
Loading

0 comments on commit 180f9cd

Please sign in to comment.