From 5ed01ca6f3d64181f5d67c33edad83cef2e21afd Mon Sep 17 00:00:00 2001 From: illusiony <37698908+illusion0001@users.noreply.github.com> Date: Tue, 15 Jul 2025 15:25:51 +1200 Subject: [PATCH 1/2] Replace PS Plus with our menu and hide offline panels Default settings icon used as placeholder for now --- common/memory.h | 3 +- common/path.h | 2 + common/plugin_common.h | 3 + plugin_mono/Makefile | 1 + plugin_mono/data/hen_settings_icon.png | Bin 0 -> 784 bytes plugin_mono/source/lib.cc | 31 +++- plugin_mono/source/shellui_mono.c | 44 ++++++ plugin_mono/source/shellui_mono.h | 3 + .../source/shellui_patch/settings_menu.c | 145 +++++++++++++++++- 9 files changed, 224 insertions(+), 8 deletions(-) create mode 100644 plugin_mono/data/hen_settings_icon.png diff --git a/common/memory.h b/common/memory.h index d8f6366..3bc7437 100644 --- a/common/memory.h +++ b/common/memory.h @@ -7,8 +7,7 @@ #include "cave.inc.c" -#define _countof(a) sizeof(a) / sizeof(*a) -#define _countof_1(a) (_countof(a) - 1) +#include "plugin_common.h" /* * @brief Scan for a given byte pattern on a module diff --git a/common/path.h b/common/path.h index eb0cad6..3695a00 100644 --- a/common/path.h +++ b/common/path.h @@ -16,3 +16,5 @@ #define SHELLUI_DATA_PATH BASE_PATH "/shellui_data" #define SHELLUI_HEN_SETTINGS SHELLUI_DATA_PATH "/hen_settings.xml" +#define SHELLUI_ICONS_PATH SHELLUI_DATA_PATH "/icons" +#define SHELLUI_HEN_SETTINGS_ICON_PATH SHELLUI_ICONS_PATH "/hen_settings_icon.png" diff --git a/common/plugin_common.h b/common/plugin_common.h index f47783a..b435509 100644 --- a/common/plugin_common.h +++ b/common/plugin_common.h @@ -26,3 +26,6 @@ // Writes null term to copied string #define strncpy0(d, s, sz) strncpy(d, s, sz), d[sz - 1] = '\0' + +#define _countof(a) sizeof(a) / sizeof(*a) +#define _countof_1(a) (_countof(a) - 1) diff --git a/plugin_mono/Makefile b/plugin_mono/Makefile index c7b1e58..4b3a68a 100644 --- a/plugin_mono/Makefile +++ b/plugin_mono/Makefile @@ -58,6 +58,7 @@ endif bundle_data: xxd -i data/hen_settings.xml | sed 's/^unsigned /static const unsigned /' > source/hen_settings.inc.c + xxd -i data/hen_settings_icon.png | sed 's/^unsigned /static const unsigned /' > source/hen_settings_icon.inc.c $(INTDIR): mkdir -p $(INTDIR) diff --git a/plugin_mono/data/hen_settings_icon.png b/plugin_mono/data/hen_settings_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..97a7d0e5606f518fadc8dd0895168c9facdd112b GIT binary patch literal 784 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&83*`;xB}__B!cZzA2k8B36=!; z1v4lFG_2qM{=dNd`wsmE=MxHURi2!~z`#`H>Eakt!T9DTJJV7H9+nG?Q#e z?bCA3BWw3@pShv@K)=*#uHW*@FH5W}<(FB0nr-2K(E5+oqu^)4mX!xT);y9v`8Ytx zsQifn`!RR34);)wiM>e;dsTxK^*5+$PYr8axHe#Ij=^JPYZrdysdKe_RLZ=+{q%Y% z{%pF)G~P))(lIxb)^qPG-1fck`Mw=_KTdw^JKmt1b^lLLg?io#wbp92gQnp>7I0Lp zy;GcNnXGN4dnfqzx*JV)Gp&Q7?TmM^ygPBJ>Ns1;gcGuI*R!5@2l81mcBz}m6f)^` zNvn1J&NW)t(4Men%I)CA1&{-bw`U-7eFqf*0{`YCGfBJYcL@G<;2%p&@5T|@TE zm+Bdh{h4}K={|Tgxkl%1v*RT(huTT~7i^_dwep=7*gaGJS|=d$l{G-Vo`Y+>#cNNV z`*-SjKefHzmA?4^Tg8J*G0%QwE#Sy7-`rTXXx7Db8ydfb>1CvUe!Sh*Brk1J|JM^t z3zHXZkZBJ-zj#ZJ_=P9lGMWbS`a6|bkA2pc(P;Si=ahSf`7Hg;WLCD%wa*e7jV8R; zo9QpQWp?S$sVQ@w3mmd~K9_NkZ@@Ei&Wz`#KgG9w%y=&Hv$I!5WK(UOob2gto~Oo+ zi)TIG?Bsmrvu41|HJ{aAggmYZ({R20$6}Mq@^hH}XHlcbtCZ%azpN&lKbmxS(YNR8&7#e=n(yzpxGePT>HgU_x5d6a zx!nBD4xj9QU!`w!I$w(4TWNbwp*H6_9~&^eNpSp(=3i{9*H@Boq19Pk>`p~R%BQKP r)6MSxtjYMY^z!m+^`4VdPBKi*ZIjjuGqwS0VeoYIb6Mw<(8K@$pYnsF literal 0 HcmV?d00001 diff --git a/plugin_mono/source/lib.cc b/plugin_mono/source/lib.cc index e5d06ed..3530ff7 100644 --- a/plugin_mono/source/lib.cc +++ b/plugin_mono/source/lib.cc @@ -22,6 +22,7 @@ extern "C" #include "patches.h" +#include "hen_settings_icon.inc.c" #include "hen_settings.inc.c" #include "../../common/file.h" @@ -77,8 +78,6 @@ void PrintTimeTick(void) static bool once = false; if (!once) { - Root_Domain = mono_get_root_domain(); - if (Root_Domain) { void* app_exe = mono_get_image("/app0/psm/Application/app.exe"); if (app_exe) @@ -92,8 +91,6 @@ void PrintTimeTick(void) } } UploadNewCorelibStreamReader(); - UploadNewPkgInstallerPath(App_Exe); - UploadOnBranch(App_Exe); MainThreadCheck(); } once = true; @@ -173,6 +170,28 @@ static int sceKernelLoadStartModuleInternalForMono_Hook(const char* param_1, voi RunPost(md); test = true; } + else if (test) + { + static bool once = false; + if (!once) + { + if (!Root_Domain) + { + Root_Domain = mono_get_root_domain(); + } + if (Root_Domain) + { + App_Exe = mono_get_image("/app0/psm/Application/app.exe"); + if (App_Exe) + { + ffinal_printf("app_exe: 0x%p\n", App_Exe); + UploadNewPkgInstallerPath(App_Exe); + UploadOnBranch(App_Exe); + once = true; + } + } + } + } return md; } @@ -193,11 +212,13 @@ static void UploadMonoCall(void) attr_public int plugin_load(struct SceEntry* args) { + open_console(); mkdir(BASE_PATH, 0777); mkdir(SHELLUI_DATA_PATH, 0777); + mkdir(SHELLUI_ICONS_PATH, 0777); mkdir(USER_PLUGIN_PATH, 0777); write_file(SHELLUI_HEN_SETTINGS, data_hen_settings_xml, data_hen_settings_xml_len); - open_console(); + write_file(SHELLUI_HEN_SETTINGS_ICON_PATH, data_hen_settings_icon_png, data_hen_settings_icon_png_len); printf("====\n\nHello from mono module\n\n====\n"); if (0 && file_exists_temp(g_pluginName) == 0) { diff --git a/plugin_mono/source/shellui_mono.c b/plugin_mono/source/shellui_mono.c index 9d82add..694782d 100644 --- a/plugin_mono/source/shellui_mono.c +++ b/plugin_mono/source/shellui_mono.c @@ -83,3 +83,47 @@ void* UI_NewElementData(enum ShellUIElementType ElementType, const char* Id, con } return UI_CreateButton(btype, Id, Title, Title2, Icon); } + +void UI_Push(const char* page, const char* root) +{ + const void* uii = Mono_Get_InstanceEx(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", "UIManager", "Instance"); + if (!uii) + { + return; + } + static void* buttonmethod = 0; + if (!buttonmethod) + { + buttonmethod = Mono_Get_Address_of_Method(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", "UIManager", "Push", 3); + } + if (buttonmethod) + { + enum + { + kDefault = 0, + }; + void (*Push)(const void* i, MonoString*, MonoString*, const uint32_t pushTransType) = (void*)buttonmethod; + Push(uii, Mono_New_String(page), Mono_New_String(root && root[0] ? root : ""), kDefault); + } +} + +void UI_PushPage(const char* page) +{ + UI_Push(page, 0); +} + +void BootPage(const char* page) +{ + static void* buttonmethod = 0; + if (!buttonmethod) + { + buttonmethod = Mono_Get_Address_of_Method(App_Exe, "Sce.Vsh.ShellUI.AppSystem", "BootHelper", "BootAndAdd", 3); + } + if (buttonmethod) + { + bool (*boot_add)(void* s, void*, void*) = (void*)buttonmethod; + char url[1024] = {0}; + snprintf(url, _countof_1(url), "pssettings:play?mode=settings&function=%s", page); + boot_add(Mono_New_String(url), 0, 0); + } +} diff --git a/plugin_mono/source/shellui_mono.h b/plugin_mono/source/shellui_mono.h index a97756a..908c984 100644 --- a/plugin_mono/source/shellui_mono.h +++ b/plugin_mono/source/shellui_mono.h @@ -16,3 +16,6 @@ enum ShellUIElementType : uint32_t void UI_ResetItem(const char* id); void UI_AddItem(void* e); void* UI_NewElementData(enum ShellUIElementType ElementType, const char* Id, const char* Title, const char* Title2, const char* Icon); +void UI_Push(const char* page, const char* root); +void UI_PushPage(const char* page); +void BootPage(const char* page); diff --git a/plugin_mono/source/shellui_patch/settings_menu.c b/plugin_mono/source/shellui_patch/settings_menu.c index 9e462d8..edb0def 100644 --- a/plugin_mono/source/shellui_patch/settings_menu.c +++ b/plugin_mono/source/shellui_patch/settings_menu.c @@ -683,6 +683,96 @@ static void NewOnPageDeactivating(const void* param1, const void* p, const void* g_PageID = 0; } +uiTYPEDEF_FUNCTION_PTR(void, StartSettingsPage_Original, const void* p1); +uiTYPEDEF_FUNCTION_PTR(MonoString*, SettingsApp_GetItem, const void* p1, MonoString*); + +enum +{ + HasInstance, + NoHasInstance, +}; + +static void StartHENSettings(const int type) +{ + switch (type) + { + case HasInstance: + { + UI_PushPage("hen_settings.xml"); + break; + } + case NoHasInstance: + { + BootPage("hen_settings"); + break; + } + } +} + +static void PSPlusStart(void) +{ + StartHENSettings(NoHasInstance); +} + +static void NewStartSettingsPage(void* p1) +{ + if (p1) + { + ffinal_printf("SettingsApp_GetItem: 0x%p\n", SettingsApp_GetItem.ptr); + ffinal_printf("p1: 0x%p\n", p1); + MonoString* s = SettingsApp_GetItem.ptr(p1, Mono_New_String("function")); + switch (wSID(s->str)) + { + case wSID(L"hen_settings"): + { + StartHENSettings(HasInstance); + return; + } + default: + { + break; + } + } + } + StartSettingsPage_Original.ptr(p1); +} + +uiTYPEDEF_FUNCTION_PTR(void, TopMenuPluginSetimage_Original, void* param_1, void* param_2, void* param_3, void* param_4, void* param_5, void* param_6); +uiTYPEDEF_FUNCTION_PTR(MonoString*, TopMenuPluginGetString_Original, MonoString* msg, void* msglist); + +static void NewTopMenuPluginSetimage(void* param_1, void* param_2, void* param_3, void* param_4, void* param_5, void* param_6) +{ + if (param_3) + { + MonoString* param_3s = (MonoString*)param_3; + switch (wSID(param_3s->str)) + { + case wSID(L"cxml://TopMenuPlugin/tex_plus"): + { + param_3 =(void*) Mono_New_String("file:///user" SHELLUI_HEN_SETTINGS_ICON_PATH); + } + } + } + TopMenuPluginSetimage_Original.ptr(param_1, param_2, param_3, param_4, param_5, param_6); +} + +static MonoString* NewTopMenuPluginGetString(MonoString* msg, void* msglist) +{ + ffinal_printf("msg->str: %ls\n", msg->str); + switch (wSID(msg->str)) + { + case wSID(L"msg_psplus_long"): + { + return Mono_New_String("★ HEN Settings"); + } + default: + { + break; + } + } + return TopMenuPluginGetString_Original.ptr(msg, msglist); +} + void UploadOnBranch(void* app_exe) { const uintptr_t OnPress = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.Settings.SettingsRoot", "SettingsRootHandler", "OnPress", 2); @@ -736,6 +826,54 @@ void UploadOnBranch(void* app_exe) Make32to64Jmp((uintptr_t)mm_p, mm_s, OnCheckVisible, (uintptr_t)NewOnCheckVisible, srclen, false, 0); } } + const uintptr_t StartSettingsPage = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI", "SettingsApplication", "StartSettingsPage", 0); + SettingsApp_GetItem.v = Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI", "SettingsApplication", "get_Item", 1); + if (StartSettingsPage && SettingsApp_GetItem.v) + { + const size_t srclen = 6; + const uintptr_t pHook = CreatePrologueHook(StartSettingsPage, srclen); + if (pHook) + { + StartSettingsPage_Original.addr = pHook; + Make32to64Jmp((uintptr_t)mm_p, mm_s, StartSettingsPage, (uintptr_t)NewStartSettingsPage, srclen, false, 0); + } + } + const uintptr_t TopMenuPluginSetimage = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.TopMenu", "TopMenuPlugin", "setImage", 6); + if (TopMenuPluginSetimage) + { + const size_t srclen = 6; + const uintptr_t pHook = CreatePrologueHook(TopMenuPluginSetimage, srclen); + if (pHook) + { + TopMenuPluginSetimage_Original.addr = pHook; + Make32to64Jmp((uintptr_t)mm_p, mm_s, TopMenuPluginSetimage, (uintptr_t)NewTopMenuPluginSetimage, srclen, false, 0); + } + } + const uintptr_t TopMenuPluginGetString = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.TopMenu", "TopMenuPlugin", "GetString", 2); + if (TopMenuPluginGetString) + { + const size_t srclen = 6; + const uintptr_t pHook = CreatePrologueHook(TopMenuPluginGetString, srclen); + if (pHook) + { + TopMenuPluginGetString_Original.addr = pHook; + Make32to64Jmp((uintptr_t)mm_p, mm_s, TopMenuPluginGetString, (uintptr_t)NewTopMenuPluginGetString, srclen, false, 0); + } + } + const uint8_t ret = 0xc3; + const int my_pid = getpid(); + // Hides PS Plus panel + const uintptr_t createOfflinePanel = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.TopMenu", "SystemAreaPluginBase", "createOfflinePanel", 1); + if (createOfflinePanel) + { + sys_proc_rw(my_pid, createOfflinePanel, &ret, sizeof(ret), 1); + } + // Hides you are offline panels + const uintptr_t InitProperty = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.TopMenu", "LiveAreaConfig", "InitProperty", 5); + if (InitProperty) + { + sys_proc_rw(my_pid, InitProperty, &ret, sizeof(ret), 1); + } } } const uintptr_t OnConfirm = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.Settings.Core", "SettingElement", "Confirm", 1); @@ -750,10 +888,15 @@ void UploadOnBranch(void* app_exe) } OnPressed_Original.v = Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.Settings.Core", "SettingElement", "OnPressed", 1); const uintptr_t OnPageDeactivating = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.Settings.Core", "SettingsHandler", "OnPageDeactivating", 2); - if (OnPageDeactivating) + if (OnPageDeactivating && OnPressed_Original.v) { WriteJump64(OnPageDeactivating, (uintptr_t)NewOnPageDeactivating); } + const uintptr_t SystemAreaIconPSPlus_LaunchPlugin = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.TopMenu", "SystemAreaIconPSPlus", "LaunchPlugin", 0); + if (SystemAreaIconPSPlus_LaunchPlugin) + { + WriteJump64(SystemAreaIconPSPlus_LaunchPlugin, (uintptr_t)PSPlusStart); + } } void UploadNewCorelibStreamReader(void) From 997ff50b28f0d0e9ef96ac57e3266a7504cf50f8 Mon Sep 17 00:00:00 2001 From: illusiony <37698908+illusion0001@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:10:58 +1200 Subject: [PATCH 2/2] clang-format --- .clang-format | 3 ++ common/HDE/HDE64.h | 4 +- common/HDE/Table64.h | 4 +- common/file.h | 2 +- common/ini.h | 2 +- common/memory.c | 10 ++-- common/path.h | 4 ++ common/stringid.h | 53 ++++++++++--------- plugin_loader/source/lib.cpp | 41 +++++++------- plugin_mono/source/lib.cc | 2 - plugin_mono/source/mono.c | 2 +- plugin_mono/source/shellui_mono.c | 22 ++++---- .../source/shellui_patch/debug_settings.c | 6 +-- .../source/shellui_patch/settings_menu.c | 2 +- plugin_server/source/ftp/cmd.c | 2 +- 15 files changed, 84 insertions(+), 75 deletions(-) diff --git a/.clang-format b/.clang-format index e202d76..c57895e 100644 --- a/.clang-format +++ b/.clang-format @@ -38,4 +38,7 @@ BinPackParameters: false BinPackArguments: false KeepEmptyLinesAtTheStartOfBlocks: false EmptyLineAfterAccessModifier: Never +BraceWrapping: + AfterExternBlock: false +IndentExternBlock: NoIndent ... diff --git a/common/HDE/HDE64.h b/common/HDE/HDE64.h index 9cc7377..f8d2745 100644 --- a/common/HDE/HDE64.h +++ b/common/HDE/HDE64.h @@ -113,8 +113,8 @@ extern "C" { #endif - /* __cdecl */ - unsigned int hde64_disasm(const void* code, hde64s* hs); +/* __cdecl */ +unsigned int hde64_disasm(const void* code, hde64s* hs); #ifdef __cplusplus } diff --git a/common/HDE/Table64.h b/common/HDE/Table64.h index 3422eac..e2fb556 100644 --- a/common/HDE/Table64.h +++ b/common/HDE/Table64.h @@ -40,7 +40,7 @@ extern "C" { #endif - // clang-format off +// clang-format off unsigned char hde64_table[] = { 0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5, 0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1, @@ -79,7 +79,7 @@ extern "C" 0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08, 0x00,0xf0,0x02,0x00 }; - // clang-format on +// clang-format on #ifdef __cplusplus } diff --git a/common/file.h b/common/file.h index 9d1ead5..ac3a465 100644 --- a/common/file.h +++ b/common/file.h @@ -3,7 +3,7 @@ #include #if defined(__cplusplus) -extern "C" +extern "C" { #endif diff --git a/common/ini.h b/common/ini.h index 2be0fa1..1fb817d 100644 --- a/common/ini.h +++ b/common/ini.h @@ -39,7 +39,7 @@ typedef struct } INIFile; #if defined(__cplusplus) -extern "C" +extern "C" { #endif diff --git a/common/memory.c b/common/memory.c index 0ac178e..f59c140 100644 --- a/common/memory.c +++ b/common/memory.c @@ -590,17 +590,17 @@ static void CaveBlockInit(void) if (!once) { const int pid = getpid(); - //sceKernelMprotect(cavePad, cavePadSize, 7); + // sceKernelMprotect(cavePad, cavePadSize, 7); static const uint8_t m[] = {0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3}; sys_proc_rw(pid, (uintptr_t)cavePadFunc, m, sizeof(m), 1); int (*test)(void); test = (void*)cavePadFunc; - //memcpy(cavePad, m, sizeof(m)); + // memcpy(cavePad, m, sizeof(m)); final_printf("checking executable code, it returned %d\n", test()); sys_proc_memset(pid, (uintptr_t)cavePadFunc, 0xcc, MAX_CAVE_SIZE); - //memset(cavePad, 0xcc, cavePadSize); - // DWORD temp = caveInstSize = 0; - // VirtualProtect(cavePad, cavePadSize, PAGE_EXECUTE_WRITECOPY, &temp); + // memset(cavePad, 0xcc, cavePadSize); + // DWORD temp = caveInstSize = 0; + // VirtualProtect(cavePad, cavePadSize, PAGE_EXECUTE_WRITECOPY, &temp); once = true; printf("cavePad setup at 0x%p! Size %ld\n", (void*)cavePadFunc, MAX_CAVE_SIZE); } diff --git a/common/path.h b/common/path.h index 3695a00..bb9d057 100644 --- a/common/path.h +++ b/common/path.h @@ -1,5 +1,7 @@ #pragma once +// clang-format off + #define BASE_PATH "/data/hen" #define USER_PLUGIN_PATH BASE_PATH "/plugins" #define HEN_INI "hen.ini" @@ -18,3 +20,5 @@ #define SHELLUI_HEN_SETTINGS SHELLUI_DATA_PATH "/hen_settings.xml" #define SHELLUI_ICONS_PATH SHELLUI_DATA_PATH "/icons" #define SHELLUI_HEN_SETTINGS_ICON_PATH SHELLUI_ICONS_PATH "/hen_settings_icon.png" + +// clang-format on diff --git a/common/stringid.h b/common/stringid.h index 19bd64e..d655e79 100644 --- a/common/stringid.h +++ b/common/stringid.h @@ -1,40 +1,43 @@ #pragma once +// https://github.com/icemesh/StringId/blob/main/StringId64/main.c + #include #include -static #if defined(__cplusplus) -constexpr +#define CXX_CONSTEXPR constexpr +#else +#define CXX_CONSTEXPR #endif -// https://github.com/icemesh/StringId/blob/main/StringId64/main.c -uint64_t ToStringId64A(const char* str) + +static CXX_CONSTEXPR uint64_t ToStringId64A(const char* str) { - uint64_t base = 0xCBF29CE484222325; - if(*str) - { - do{ - base = 0x100000001B3 * (base ^ *str++); - }while(*str); - } - return base; + uint64_t base = 0xCBF29CE484222325; + if (*str) + { + do + { + base = 0x100000001B3 * (base ^ *str++); + } while (*str); + } + return base; } -static -#if defined(__cplusplus) -constexpr -#endif -uint64_t ToStringId64W(const wchar_t* str) +static CXX_CONSTEXPR uint64_t ToStringId64W(const wchar_t* str) { - uint64_t base = 0xCBF29CE484222325; - if(*str) - { - do{ - base = 0x100000001B3 * (base ^ *str++); - }while(*str); - } - return base; + uint64_t base = 0xCBF29CE484222325; + if (*str) + { + do + { + base = 0x100000001B3 * (base ^ *str++); + } while (*str); + } + return base; } +#undef CXX_CONSTEXPR + #define SID(x) ToStringId64A(x) #define wSID(x) ToStringId64W(x) diff --git a/plugin_loader/source/lib.cpp b/plugin_loader/source/lib.cpp index 22045f3..c97defa 100644 --- a/plugin_loader/source/lib.cpp +++ b/plugin_loader/source/lib.cpp @@ -84,7 +84,8 @@ static void loadPlugins(SceEntry* args) "m_titleid %s\n" "m_category %s\n" "m_appver %s\n", - info.pid, curr_pid, + info.pid, + curr_pid, info.m_titleid, info.m_category, info.m_appver); @@ -109,23 +110,23 @@ static void loadPlugins(SceEntry* args) extern "C" { - attr_public const char* g_pluginName = "plugin_loader"; - attr_public const char* g_pluginDesc = "Plugin loader."; - attr_public const char* g_pluginAuth = "illusiony"; - attr_public const char* g_pluginVersion = "Git Commit: " GIT_COMMIT - "\n" - "Git Branch: " GIT_VER - "\n" - "Git Commit Number: " GIT_NUM_STR - "\n" - "Built: " BUILD_DATE; // 1.00 - attr_public int plugin_load(SceEntry* args, const void* atexit_handler) - { - loadPlugins(args); - return 0; - } - attr_public int plugin_unload(SceEntry* args, const void* atexit_handler) - { - return 0; - } +attr_public const char* g_pluginName = "plugin_loader"; +attr_public const char* g_pluginDesc = "Plugin loader."; +attr_public const char* g_pluginAuth = "illusiony"; +attr_public const char* g_pluginVersion = "Git Commit: " GIT_COMMIT + "\n" + "Git Branch: " GIT_VER + "\n" + "Git Commit Number: " GIT_NUM_STR + "\n" + "Built: " BUILD_DATE; // 1.00 +attr_public int plugin_load(SceEntry* args, const void* atexit_handler) +{ + loadPlugins(args); + return 0; +} +attr_public int plugin_unload(SceEntry* args, const void* atexit_handler) +{ + return 0; +} } diff --git a/plugin_mono/source/lib.cc b/plugin_mono/source/lib.cc index 3530ff7..513ae33 100644 --- a/plugin_mono/source/lib.cc +++ b/plugin_mono/source/lib.cc @@ -1,6 +1,5 @@ extern "C" { - #include "../../common/entry.h" #include @@ -230,5 +229,4 @@ attr_public int plugin_load(struct SceEntry* args) UploadMonoCall(); return 0; } - } diff --git a/plugin_mono/source/mono.c b/plugin_mono/source/mono.c index 680d81e..fdb6c16 100644 --- a/plugin_mono/source/mono.c +++ b/plugin_mono/source/mono.c @@ -335,7 +335,7 @@ MonoString* Mono_Add_String(MonoString* monoStr, const char* cStr) { MonoString* exc_str = mono_object_to_string(exc, NULL); char* utf8 = mono_string_to_utf8(exc_str); - final_printf( "Exception: %s\n", utf8); + final_printf("Exception: %s\n", utf8); mono_free(utf8); return NULL; } diff --git a/plugin_mono/source/shellui_mono.c b/plugin_mono/source/shellui_mono.c index 694782d..c84d4b6 100644 --- a/plugin_mono/source/shellui_mono.c +++ b/plugin_mono/source/shellui_mono.c @@ -41,17 +41,17 @@ void UI_AddItem(void* e) static void* UI_CreateButton(const char* bb, const char* Id, const char* Title, const char* Title2, const char* Icon) { - void* ButtonElementData = Mono_Get_Class(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", bb); - void* ElementData = Mono_Get_Class(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", "ElementData"); - void* Instance = Mono_New_Object(ButtonElementData); - mono_runtime_object_init(Instance); - Mono_Set_Property(ElementData, Instance, "Id", Mono_New_String(Id)); - Mono_Set_Property(ElementData, Instance, "Title", Mono_New_String(Title)); - Mono_Set_Property(ElementData, Instance, "Description", Mono_New_String(Title2)); - if (Icon && Icon[0]) - { - Mono_Set_Property(ElementData, Instance, "Icon", Mono_New_String(Icon)); - } + void* ButtonElementData = Mono_Get_Class(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", bb); + void* ElementData = Mono_Get_Class(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", "ElementData"); + void* Instance = Mono_New_Object(ButtonElementData); + mono_runtime_object_init(Instance); + Mono_Set_Property(ElementData, Instance, "Id", Mono_New_String(Id)); + Mono_Set_Property(ElementData, Instance, "Title", Mono_New_String(Title)); + Mono_Set_Property(ElementData, Instance, "Description", Mono_New_String(Title2)); + if (Icon && Icon[0]) + { + Mono_Set_Property(ElementData, Instance, "Icon", Mono_New_String(Icon)); + } return Instance; } diff --git a/plugin_mono/source/shellui_patch/debug_settings.c b/plugin_mono/source/shellui_patch/debug_settings.c index 71d2b16..5777b22 100644 --- a/plugin_mono/source/shellui_patch/debug_settings.c +++ b/plugin_mono/source/shellui_patch/debug_settings.c @@ -58,7 +58,7 @@ static int _DownloadRegisterTaskByStorageEx(void* bgft_params, int32_t* refout) { struct bgft_mono { - void* pad[2]; // user id and id str + void* pad[2]; // user id and id str MonoString* content_url; }; struct bgft_mono* bgft_params_u64 = (struct bgft_mono*)bgft_params; @@ -131,7 +131,7 @@ static void* pkg_new_element_ex(void* inst, MonoString* path) { void* ret = pkg_new_element_original.ptr(inst, path); const void* settings = Mono_Get_Class(App_Exe, "Sce.Vsh.ShellUI.Settings.Core", "ButtonElementData"); - char path_desc[260+128] = {0}; + char path_desc[260 + 128] = {0}; const wchar_t* hdd_path = wcsstr(path->str, L"" mnt_sus_path "/data"); snprintf(path_desc, _countof(path_desc) - 1, "Path: %ls", hdd_path ? path->str + (_countof(mnt_sus_path) - 1) : path->str); Mono_Set_Property(settings, ret, "SecondTitle", Mono_New_String(path_desc)); @@ -154,7 +154,7 @@ void UploadNewPkgInstallerPath(void* app_exe) } } const uintptr_t pkg_new_element = (uintptr_t)Mono_Get_Address_of_Method(app_exe, "Sce.Vsh.ShellUI.Settings.PkgInstaller", "PageDefault", "NewElementData", 1); - const int app_exe_h = sceKernelLoadStartModule("/app0/psm/Application/app.exe.sprx", 0,0,0,0,0); + const int app_exe_h = sceKernelLoadStartModule("/app0/psm/Application/app.exe.sprx", 0, 0, 0, 0, 0); if (pkg_new_element && app_exe_h > 0) { struct OrbisKernelModuleInfo info = {0}; diff --git a/plugin_mono/source/shellui_patch/settings_menu.c b/plugin_mono/source/shellui_patch/settings_menu.c index edb0def..7f18653 100644 --- a/plugin_mono/source/shellui_patch/settings_menu.c +++ b/plugin_mono/source/shellui_patch/settings_menu.c @@ -749,7 +749,7 @@ static void NewTopMenuPluginSetimage(void* param_1, void* param_2, void* param_3 { case wSID(L"cxml://TopMenuPlugin/tex_plus"): { - param_3 =(void*) Mono_New_String("file:///user" SHELLUI_HEN_SETTINGS_ICON_PATH); + param_3 = (void*)Mono_New_String("file:///user" SHELLUI_HEN_SETTINGS_ICON_PATH); } } } diff --git a/plugin_server/source/ftp/cmd.c b/plugin_server/source/ftp/cmd.c index 429397b..980b9d8 100644 --- a/plugin_server/source/ftp/cmd.c +++ b/plugin_server/source/ftp/cmd.c @@ -463,7 +463,7 @@ int ftp_cmd_LIST(ftp_env_t* env, const char* arg) ftp_mode_string(statbuf.st_mode, modebuf); // https://github.com/shahrilnet/remote_lua_loader/blob/f1be153946685439b60859ea196acf20c19382f5/payloads/ftp_server.lua#L479 const uintptr_t pSt = (uintptr_t)&statbuf; - LOCALTIME_R((const time_t*)(pSt+0x38), &tm); + LOCALTIME_R((const time_t*)(pSt + 0x38), &tm); strftime(timebuf, sizeof(timebuf), "%b %d %H:%M", &tm); const uint64_t st_size = *(uint64_t*)(pSt + 0x48); ftp_data_printf(env, "%s %lu %lu %lu %llu %s %s\r\n", modebuf, 0, 0, 0, st_size, timebuf, ent->d_name);