Add daemon loader

This commit is contained in:
Greg
2023-02-14 22:59:51 -07:00
parent 662dbab34f
commit f820c5ea02
11 changed files with 126 additions and 49 deletions
+11 -11
View File
@@ -1,11 +1,11 @@
#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
#pragma once
#define ORBISLIB_MAJOR 3
#define ORBISLIB_MINOR 0
#define ORBISLIB_BUILDVERSION 1071
#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
+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.14 2121> temp.txt
echo open 1.1.0.15 2121> temp.txt
echo anonymous>> temp.txt
echo anonymous>> temp.txt
echo cd "/data/Orbis Suite/">> temp.txt
+1 -1
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
set libraries=-lc++ -lc -lSceSysModule -lkernel -lSceVideoOut -lSceSystemService -lSceSysCore -lSceSystemStateMgr -lSceNet -lScePad -lSceUserService -lSceRegMgr -lSceFreeType -lSceMsgDialog -lSceCommonDialog -lGoldHEN_Hook -lSceLncUtil
Rem Read the script arguments into local vars
set intdir=%1
+38 -6
View File
@@ -1,5 +1,10 @@
#include "Common.h"
#include "GoldHEN.h"
#include <orbis/LncUtil.h>
#include <orbis/SystemService.h>
#include <orbis/UserService.h>
#define DEBUG
int main()
{
@@ -32,14 +37,41 @@ int main()
mount_large_fs("/dev/da0x4.crypt", "/system", "exfatfs", "511", MNT_UPDATE);
// Install all the things! :D
//InstallDaemon("ORBS30000"); // Orbis Lib
//InstallOrbisToolbox();
//InstallOrbisSuite();
InstallDaemon("ORBS30000"); // Orbis Lib
InstallOrbisToolbox();
InstallOrbisSuite();
// Start the API.
auto appId = sceLncUtilGetAppId("ORBS30000");
if (appId)
{
#ifdef DEBUG
sceLncUtilKillApp(appId);
#else
sceSystemServiceLoadExec("exit", 0);
return 0;
#endif
}
LaunchAppParam appParam;
appParam.size = sizeof(LaunchAppParam);
sceUserServiceGetForegroundUser(&appParam.userId);
appParam.enableCrashReport = 0;
appParam.checkFlag = 0;
appParam.appAttr = 0;
auto res = sceLncUtilLaunchApp("ORBS30000", nullptr, &appParam);
#ifdef DEBUG
if (res != 0)
{
klog("Failed to load Daemon.\n");
}
#endif // DEBUG
//TODO: use IPC to see if prx is already loaded.
// Use GoldHEN SDK to load PRX to SceShellUI.
/*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)
klog("Orbis Toolbox loaded! %d\n", Handle);
@@ -47,7 +79,7 @@ int main()
{
klog("error: %d\n", Handle);
Notify("Failed to load Orbis Toolbox!");
}*/
}
sceSystemServiceLoadExec("exit", 0);
+9 -2
View File
@@ -76,7 +76,7 @@ void Menu::Init()
End:
free(Dent_Buffer);
});
})->Visible = false;
Add_Option("id_option_daemon_refresh", []() -> void {
@@ -126,7 +126,7 @@ void Menu::Init()
End:
free(Dent_Buffer);
});
})->Visible = false;
// ShellUI Plugin Manager
Add_Option("id_plugins")->Visible = false;
@@ -162,6 +162,8 @@ void Menu::Init()
Add_Option("id_system_disp_devkit_panel", &Debug_Feature::DevkitPanel::ShowPanel, Type_Boolean, Debug_Feature::DevkitPanel::Update);
Add_Option("id_system_disp_debug_settings_panel", &Debug_Feature::Custom_Content::Show_Debug_Settings, Type_Boolean, UI::Utilities::ReloadItemList);
Add_Option("id_system_disp_app_home_panel", &Debug_Feature::Custom_Content::Show_App_Home, Type_Boolean, UI::Utilities::ReloadItemList);
Add_Option("id_mount_system_rw", []() -> void { mount_large_fs("/dev/da0x4.crypt", "/system", "exfatfs", "511", MNT_UPDATE); Notify("/system mounted as R/W."); });
Add_Option("id_disable_system_updates", []() -> void { DisableUpdates(); Notify("System updates are disabled/blocked.\nMake sure to do this after every database rebuild just in case."); });
//Debug Overlay
Add_Option("id_overlay_dbg", &Build_Overlay::Draw, Type_Boolean, Build_Overlay::Update);
@@ -199,7 +201,12 @@ void Menu::Init()
});
Add_Option("id_save_settings", []() -> void { Config::Write(SETTIN_DIR) ? Notify("Orbis Toolbox: Saved Settings Sucessfully!") : Notify("Orbis Toolbox: Failed to Save Settings..."); });
// Orbis Suite Debug
Add_Option("orbis_debug", []() -> void
{
})->Visible = false;
Add_Option("id_orbis_api", []() -> void
{
});
@@ -9,10 +9,6 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Header Files\Utilities">
<UniqueIdentifier>{a1e7d8c0-9965-4dae-9e21-fec87fa057a9}</UniqueIdentifier>
</Filter>
+43 -9
View File
@@ -62,21 +62,14 @@ void Notify_Custom(const char* IconURI, const char* MessageFMT, ...)
// I found some clues on how to build the buffer.
}
struct Myiovec
{
void* iov_base;
size_t iov_len;
};
void build_iovec(Myiovec** iov, int* iovlen, const char* name, const void* val, size_t len)
{
static void build_iovec(iovec** iov, int* iovlen, const char* name, const void* val, size_t len) {
int i;
if (*iovlen < 0)
return;
i = *iovlen;
*iov = (Myiovec*)realloc(*iov, sizeof **iov * (i + 2));
*iov = (iovec*)realloc(*iov, sizeof * *iov * (i + 2));
if (*iov == NULL) {
*iovlen = -1;
return;
@@ -98,6 +91,47 @@ void build_iovec(Myiovec** iov, int* iovlen, const char* name, const void* val,
*iovlen = ++i;
}
int nmount(struct iovec* iov, uint32_t niov, int flags)
{
return syscall(378, iov, niov, flags);
}
int unmount(const char* dir, int flags)
{
return syscall(22, dir, flags);
}
int mount_large_fs(const char* device, const char* mountpoint, const char* fstype, const char* mode, unsigned int flags)
{
struct iovec* iov = NULL;
int iovlen = 0;
build_iovec(&iov, &iovlen, "fstype", fstype, -1);
build_iovec(&iov, &iovlen, "fspath", mountpoint, -1);
build_iovec(&iov, &iovlen, "from", device, -1);
build_iovec(&iov, &iovlen, "large", "yes", -1);
build_iovec(&iov, &iovlen, "timezone", "static", -1);
build_iovec(&iov, &iovlen, "async", "", -1);
build_iovec(&iov, &iovlen, "ignoreacl", "", -1);
if (mode) {
build_iovec(&iov, &iovlen, "dirmask", mode, -1);
build_iovec(&iov, &iovlen, "mask", mode, -1);
}
return nmount(iov, iovlen, flags);
}
void DisableUpdates()
{
sceKernelUnlink("/update/PS4UPDATE.PUP.net.temp");
sceKernelRmdir("/update/PS4UPDATE.PUP.net.temp");
sceKernelMkdir("/update/PS4UPDATE.PUP.net.temp", 777);
sceKernelUnlink("/update/PS4UPDATE.PUP");
sceKernelRmdir("/update/PS4UPDATE.PUP");
sceKernelMkdir("/update/PS4UPDATE.PUP", 777);
}
/*
+3 -1
View File
@@ -14,12 +14,14 @@ typedef unsigned char vm_prot_t; /* protection codes */
#define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE)
#define VM_PROT_DEFAULT VM_PROT_ALL
#define MNT_UPDATE 0x0000000000010000ULL /* not real mount, just update */
#define MNT_UPDATE 0x00010000 /* not real mount, just update */
void klog(const char* fmt, ...);
void Notify(const char* MessageFMT, ...);
void Notify_Custom(const char* IconURI, const char* MessageFMT, ...);
int mount_large_fs(const char* device, const char* mountpoint, const char* fstype, const char* mode, unsigned int flags);
void DisableUpdates();
void Get_Page_Table_Stats(int vm, int type, int* Used, int* Free, int* Total);
bool SockSendInt(OrbisNetId Sock, int val);
+11 -11
View File
@@ -1,11 +1,11 @@
#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
#pragma once
#define ORBIS_TOOLBOX_MAJOR 2
#define ORBIS_TOOLBOX_MINOR 0
#define ORBIS_TOOLBOX_BUILDVERSION 345
#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
+2 -2
View File
@@ -1,7 +1,7 @@
SETLOCAL EnableDelayedExpansion
Rem Libraries to link in
set libraries=-lSceLibcInternal -lSceLibcInternalExt -lkernel -lmonosgen -lSceSystemService -lSceLncUtil -lSceUserService -lSceRegMgr -lSceFreeType -lSceSysCore -lSceSystemStateMgr -lSceNet
set libraries=-lc++ -lc -lSceLibcInternal -lSceLibcInternalExt -lkernel -lmonosgen -lSceSystemService -lSceLncUtil -lSceUserService -lSceRegMgr -lSceFreeType -lSceSysCore -lSceSystemStateMgr -lSceNet
Rem Read the script arguments into local vars
set intdir=%1
@@ -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.14 2121> temp.txt
echo open 1.1.0.15 2121> temp.txt
echo anonymous>> temp.txt
echo anonymous>> temp.txt
echo cd "/data/Orbis Toolbox/">> temp.txt
@@ -143,12 +143,18 @@
<!-- Show Devkit Panel -->
<toggle_switch id="id_system_disp_devkit_panel" title="Show Devkit Panel" value="0"/>
<!-- Show"★Orbis Toolbox" shortcu -->
<!-- Show"★Orbis Toolbox" shortcut -->
<toggle_switch id="id_system_disp_debug_settings_panel" title="Show &quot;★Orbis Toolbox&quot; shortcut" value="0"/>
<!-- Show ";★APP_HOME" -->
<toggle_switch id="id_system_disp_app_home_panel" title="Show &quot;★APP_HOME&quot;" value="0"/>
<!-- Mount System as R/W -->
<button id="id_mount_system_rw" title="Mount System as R/W"/>
<!-- Disable System Updates -->
<button id="id_disable_system_updates" title="Disable System Updates"/>
<!-- Debug Overlay -->
<toggle_switch id="id_overlay_dbg" title="Debug Overlay" value="0"/>