diff --git a/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj new file mode 100644 index 0000000..e12d302 --- /dev/null +++ b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj @@ -0,0 +1,86 @@ + + + + + Debug + PSVita + + + Release + PSVita + + + + + + + + {D9477093-D1DF-4A70-B333-C114DDF9EC04} + + + + DynamicLibrary + + + DynamicLibrary + + + + + + + + + + + + + + + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions); + Level3 + NotUsing + $(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories) + Cpp11 + + + $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) + -lScePafStdc_stub;-lScePafMisc_stub;-lScePafCommon_stub;-lSceLibKernel_stub;-lSceAppMgrUser_stub;-ltaihen_stub;-lsnc;%(AdditionalDependencies) + StripSymsAndDebug + --no-standard-libraries + StripFuncsAndData + true + + + "$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --strip --compress "$(LocalDebuggerCommand)" "$(OutDir)download_enabler_empva.suprx" +copy /Y "$(OutDir)download_enabler_empva.suprx" "$(SolutionDir)\ElevenMPV-A\CONTENTS\module\download_enabler_empva.suprx" + + + + + _DEBUG;%(PreprocessorDefinitions); + true + NotUsing + $(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories) + Cpp11 + + + $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) + -lScePafStdc_stub;-lScePafMisc_stub;-lScePafCommon_stub;-lSceLibKernel_stub;-lSceAppMgrUser_stub;-ltaihen_stub;-lsnc;%(AdditionalDependencies) + --no-standard-libraries + + + + + + + \ No newline at end of file diff --git a/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.filters b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.filters new file mode 100644 index 0000000..67de2f6 --- /dev/null +++ b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;cc;s;asm + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.user b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/ElevenMPV-A-DE/ElevenMPV-A-DE.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ElevenMPV-A-DE/download_enabler.cpp b/ElevenMPV-A-DE/download_enabler.cpp new file mode 100644 index 0000000..c864528 --- /dev/null +++ b/ElevenMPV-A-DE/download_enabler.cpp @@ -0,0 +1,193 @@ +/* + VitaTweaks: Download Enabler + Copyright (C) 2018, TheFloW + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include +#include + +using namespace paf; + +static tai_hook_ref_t ExportFileRef; +static tai_hook_ref_t GetFileTypeRef; + +static SceUID hooks[3]; + +static SceInt32 ExportFilePatched(uint32_t *data) +{ + int res = TAI_NEXT(ExportFilePatched, ExportFileRef, data); + + if (res == 0x80101A09) { + char download_path[1024]; + char bgdl_path[1024]; + char file_name[256]; + char short_name[256]; + uint16_t url_length = 0; + uint32_t count = 0; + + uint32_t num = *(uint32_t *)data[0]; + + sce_paf_snprintf(bgdl_path, sizeof(bgdl_path), "ux0:bgdl/t/%08x/d0.pdb", num); + + SceUID fd = sceIoOpen(bgdl_path, SCE_O_RDONLY, 0); + if (fd < 0) + return fd; + + sceIoPread(fd, &url_length, sizeof(uint16_t), 0xD6); + sceIoPread(fd, file_name, sizeof(file_name), 0xF7 + url_length); + sceIoClose(fd); + + sce_paf_snprintf(bgdl_path, sizeof(bgdl_path), "ux0:bgdl/t/%08x/%s", num, file_name); + + char *ext = sce_paf_strrchr(file_name, '.'); + + if (!ext || sce_paf_strcmp(ext, ".webmyt")) { + return 0x80101A09; + } + + ext[5] = '\0'; + int len = ext - file_name; + if (len > sizeof(short_name) - 1) + len = sizeof(short_name) - 1; + sce_paf_strncpy(short_name, file_name, len); + short_name[len] = '\0'; + + while (1) { + if (count == 0) + sce_paf_snprintf(download_path, sizeof(download_path), "ux0:empva_download/%s", file_name); + else + sce_paf_snprintf(download_path, sizeof(download_path), "ux0:empva_download/%s (%d)%s", short_name, count, ext); + + if (!io::Misc::Exists(download_path)) + break; + + count++; + } + + res = io::Misc::MkdirRWSYS("ux0:empva_download"); + if (res < 0 && res != 0x80010011) + return res; + + return io::Misc::Rename(bgdl_path, download_path); + } + + return res; +} + +static SceInt32 GetFileTypePatched(int unk, int *type, char **filename, char **mime_type) +{ + int res = TAI_NEXT(GetFileTypePatched, GetFileTypeRef, unk, type, filename, mime_type); + + if (res == 0x80103A21) { + *type = 1; // Type photo + return 0; + } + + return res; +} + +extern "C" { + + #include + + SCE_MODULE_INFO(ElevenMPV_A_DE, 2, 1, 1) + + int module_start(SceSize args, const void * argp) + { + tai_module_info_t info; + info.size = sizeof(info); + if (taiGetModuleInfo("SceShell", &info) >= 0) { + switch (info.module_nid) { + case 0x0552F692: // 3.60 retail + { + hooks[0] = taiInjectData(info.modid, 0, 0x50A4A8, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x1163F6, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x11B5E4, 1, GetFileTypePatched); + break; + } + + case 0x6CB01295: // 3.60 PDEL + { + hooks[0] = taiInjectData(info.modid, 0, 0x4F9A18, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x111D5A, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x116F48, 1, GetFileTypePatched); + break; + } + + case 0xEAB89D5C: // 3.60 PTEL + { + hooks[0] = taiInjectData(info.modid, 0, 0x4FEBF8, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x112756, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x117944, 1, GetFileTypePatched); + break; + } + + case 0x5549BF1F: // 3.65 retail + case 0x34B4D82E: // 3.67 retail + case 0x12DAC0F3: // 3.68 retail + { + hooks[0] = taiInjectData(info.modid, 0, 0x50A9E8, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x11644E, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x11B63C, 1, GetFileTypePatched); + break; + } + + case 0x0703C828: // 3.69 retail + case 0x2053B5A5: // 3.70 retail + case 0xF476E785: // 3.71 retail + case 0x939FFBE9: // 3.72 retail + case 0x734D476A: // 3.73 retail + { + hooks[0] = taiInjectData(info.modid, 0, 0x50AA28, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x11644E, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x11B63C, 1, GetFileTypePatched); + break; + } + + case 0xE6A02F2B: // 3.65 PDEL + { + hooks[0] = taiInjectData(info.modid, 0, 0x4F9F58, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x111DB2, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x116FA0, 1, GetFileTypePatched); + break; + } + + case 0x587F9CED: // 3.65 PTEL + { + hooks[0] = taiInjectData(info.modid, 0, 0x4FF0F8, "GET", 4); + hooks[1] = taiHookFunctionOffset(&ExportFileRef, info.modid, 0, 0x1127AE, 1, ExportFilePatched); + hooks[2] = taiHookFunctionOffset(&GetFileTypeRef, info.modid, 0, 0x11799C, 1, GetFileTypePatched); + break; + } + } + } + + return SCE_KERNEL_START_SUCCESS; + } + + int module_stop(SceSize args, const void * argp) + { + if (hooks[2] >= 0) + taiHookRelease(hooks[2], GetFileTypeRef); + if (hooks[1] >= 0) + taiHookRelease(hooks[1], ExportFileRef); + if (hooks[0] >= 0) + taiInjectRelease(hooks[0]); + return SCE_KERNEL_STOP_SUCCESS; + } + +} \ No newline at end of file diff --git a/ElevenMPV-A-DE/paf_runtime.cpp b/ElevenMPV-A-DE/paf_runtime.cpp new file mode 100644 index 0000000..7da6819 --- /dev/null +++ b/ElevenMPV-A-DE/paf_runtime.cpp @@ -0,0 +1,18 @@ + +extern "C" { + + int _sceLdTlsRegisterModuleInfo() + { + return 0; + } + + int _sceLdTlsUnregisterModuleInfo() + { + return 0; + } + + int __at_quick_exit() + { + return 0; + } +} \ No newline at end of file diff --git a/ElevenMPV-A-ShellPlugin/ElevenMPV-A-ShellPlugin.vcxproj b/ElevenMPV-A-ShellPlugin/ElevenMPV-A-ShellPlugin.vcxproj index 4ffb143..50f7d66 100644 --- a/ElevenMPV-A-ShellPlugin/ElevenMPV-A-ShellPlugin.vcxproj +++ b/ElevenMPV-A-ShellPlugin/ElevenMPV-A-ShellPlugin.vcxproj @@ -59,7 +59,7 @@ --no-standard-libraries $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) - -lSceDbg_stub;-lScePafTopLevel_stub;-lScePafStdc_stub;-lScePafCommon_stub;-lScePafWidget_stub;-lScePafThread_stub;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-ltaihen_stub;%(AdditionalDependencies) + -lSceDbg_stub;-lScePafTopLevel_stub;-lScePafStdc_stub;-lScePafCommon_stub;-lScePafWidget_stub;-lScePafThread_stub;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-ltaihen_stub;-lsnc;%(AdditionalDependencies) "$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --strip --compress "$(LocalDebuggerCommand)" "$(OutDir)shell_plugin.suprx" @@ -75,9 +75,12 @@ copy /Y "$(OutDir)shell_plugin.suprx" "$(SolutionDir)\ElevenMPV-A\CONTENTS\modul Cpp11 - -lSceDbg_stub;-lScePafTopLevel_stub;-lScePafStdc_stub;-lScePafCommon_stub;-lScePafWidget_stub;-lScePafThread_stub;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-ltaihen_stub;%(AdditionalDependencies) + -lSceDbg_stub;-lScePafTopLevel_stub;-lScePafStdc_stub;-lScePafCommon_stub;-lScePafWidget_stub;-lScePafThread_stub;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-ltaihen_stub;-lsnc;%(AdditionalDependencies) $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) - --no-standard-libraries %(AdditionalOptions) + --no-standard-libraries + StripSymsAndDebug + StripFuncsAndData + true "$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --strip --compress "$(LocalDebuggerCommand)" "$(OutDir)shell_plugin.suprx" diff --git a/ElevenMPV-A-ShellPlugin/main.cpp b/ElevenMPV-A-ShellPlugin/main.cpp index 870764e..5ef89ba 100644 --- a/ElevenMPV-A-ShellPlugin/main.cpp +++ b/ElevenMPV-A-ShellPlugin/main.cpp @@ -13,18 +13,18 @@ using namespace paf; -static widget::Widget *imposeRoot = SCE_NULL; +static ui::Widget *imposeRoot = SCE_NULL; static ImposeThread *mainThread = SCE_NULL; static RxThread *rxThread = SCE_NULL; static SceUID ipcPipeRX = SCE_UID_INVALID_UID; static SceUID ipcPipeTX = SCE_UID_INVALID_UID; -static widget::Widget *buttonREW = SCE_NULL; -static widget::Widget *buttonPLAY = SCE_NULL; -static widget::Widget *buttonFF = SCE_NULL; -static widget::Widget *textTop = SCE_NULL; -static widget::Widget *textBottom = SCE_NULL; +static ui::Widget *buttonREW = SCE_NULL; +static ui::Widget *buttonPLAY = SCE_NULL; +static ui::Widget *buttonFF = SCE_NULL; +static ui::Widget *textTop = SCE_NULL; +static ui::Widget *textBottom = SCE_NULL; static tai_hook_ref_t hookRef[1]; static SceUID hookId[1]; @@ -38,23 +38,26 @@ static SceBool imposeIpcActive = SCE_FALSE; int setup_stage1() { + Plugin *imposePlugin = SCE_NULL; + ScePVoid powerRoot = SCE_NULL; + //Get power manage plugin object - Plugin *imposePlugin = Plugin::Find("power_manage_plugin"); + imposePlugin = Plugin::Find("power_manage_plugin"); if (imposePlugin == NULL) { SCE_DBG_LOG_ERROR("Power manage plugin not found\n"); goto setup_error_return; } //Power manage plugin -> power manage root - widget::Widget *powerRoot = imposePlugin->GetInterface(1); + powerRoot = imposePlugin->GetInterface(1); if (powerRoot == NULL) { SCE_DBG_LOG_ERROR("Power root not found\n"); goto setup_error_return; } //Power manage root -> impose root (some virtual function) - widget::Widget *(*getImposeRoot)(); - getImposeRoot = (widget::Widget *(*)()) *(int *)((void *)powerRoot + 0x54); + ui::Widget *(*getImposeRoot)(); + getImposeRoot = (ui::Widget *(*)()) *(int *)((void *)powerRoot + 0x54); imposeRoot = getImposeRoot(); if (imposeRoot == NULL) { SCE_DBG_LOG_ERROR("Impose root not found\n"); @@ -77,11 +80,11 @@ void setup_stage2() ipcPipeRX = sceKernelCreateMsgPipe("ElevenMPVA::ShellIPC_RX", SCE_KERNEL_MSG_PIPE_TYPE_USER_MAIN, IPC_PIPE_ATTR, sizeof(IpcDataRX), SCE_NULL); ipcPipeTX = sceKernelCreateMsgPipe("ElevenMPVA::ShellIPC_TX", SCE_KERNEL_MSG_PIPE_TYPE_USER_MAIN, IPC_PIPE_ATTR, sizeof(IpcDataTX), SCE_NULL); - mainThread = new ImposeThread(250, 0x1000, "ElevenMPVA::ShellControl"); + mainThread = new ImposeThread(SCE_KERNEL_LOWEST_PRIORITY_USER, SCE_KERNEL_4KiB, "ElevenMPVA::ShellControl"); mainThread->done = SCE_FALSE; mainThread->Start(); - rxThread = new RxThread(249, 0x1000, "ElevenMPVA::ShellRx"); + rxThread = new RxThread(SCE_KERNEL_LOWEST_PRIORITY_USER, SCE_KERNEL_4KiB, "ElevenMPVA::ShellRx"); rxThread->Start(); } @@ -107,6 +110,9 @@ void cleanup() if (ipcPipeTX > 0) sceKernelDeleteMsgPipe(ipcPipeTX); + + if (hookId[0] > 0) + taiHookRelease(hookId[0], hookRef[0]); } int findWidgets() @@ -118,7 +124,7 @@ int findWidgets() buttonREW = SCE_NULL; while (buttonREW == NULL) { buttonREW = imposeRoot->GetChildByHash(&widgetSearchResult, 0); - thread::Thread::Sleep(100); + thread::Sleep(100); } widgetSearchResult.hash = PlayerButtonCB::ButtonHash_Ff; @@ -163,6 +169,8 @@ int resetWidgets() buttonFF = SCE_NULL; textTop = SCE_NULL; textBottom = SCE_NULL; + + return 0; } void setButtonState() @@ -183,19 +191,19 @@ void setButtonState() void setText() { - widget::Widget::Color col; + ui::Widget::Color col; col.r = 1.0f; col.g = 1.0f; col.b = 1.0f; col.a = 1.0f; - textTop->SetFilterColor(&col); - textBottom->SetFilterColor(&col); + textTop->SetColor(&col); + textBottom->SetColor(&col); textTop->SetLabel(topText); textBottom->SetLabel(bottomText); } -SceVoid PlayerButtonCB::PlayerButtonCBFun(SceInt32 eventId, widget::Widget *self, SceInt32 a3, ScePVoid pUserData) +SceVoid PlayerButtonCB::PlayerButtonCBFun(SceInt32 eventId, ui::Widget *self, SceInt32 a3, ScePVoid pUserData) { IpcDataTX ipcDataTX; ipcDataTX.cmd = 0; @@ -226,7 +234,7 @@ SceVoid RxThread::EntryFunction() IpcDataRX ipcDataRX; WString text16; SceUInt32 artLen, albLen; - widget::Widget::Color col; + ui::Widget::Color col; col.r = 1.0f; col.g = 1.0f; col.b = 1.0f; @@ -255,32 +263,30 @@ SceVoid RxThread::EntryFunction() if ((ipcDataRX.flags & EMPVA_IPC_REFRESH_TEXT) == EMPVA_IPC_REFRESH_TEXT) { - text16.Set(ipcDataRX.title); + text16 = (wchar_t *)ipcDataRX.title; if (textTop != SCE_NULL && impose) { textTop->SetLabel(&text16); - textTop->SetFilterColor(&col); + textTop->SetColor(&col); } topText->Clear(); - topText->Set(text16.data, text16.length); - text16.Clear(); + topText->Append(text16.data, text16.length); - text16.Set(ipcDataRX.artist); + text16 = (wchar_t *)ipcDataRX.artist; artLen = sce_paf_wcslen((wchar_t *)ipcDataRX.artist); albLen = sce_paf_wcslen((wchar_t *)ipcDataRX.album); if (artLen != 0 && albLen != 0) - text16.Append((SceWChar16 *)L" / ", 4); - text16.Append(ipcDataRX.album, albLen); + text16.Append(L" / ", 4); + text16.Append((wchar_t *)ipcDataRX.album, albLen); if (textBottom != SCE_NULL && impose) { textBottom->SetLabel(&text16); - textBottom->SetFilterColor(&col); + textBottom->SetColor(&col); } bottomText->Clear(); - bottomText->Set(text16.data, text16.length); - text16.Clear(); + bottomText->Append(text16.data, text16.length); } break; @@ -301,7 +307,7 @@ SceVoid ImposeThread::EntryFunction() if (impose != appState.isSystemUiOverlaid && appState.isSystemUiOverlaid == SCE_TRUE) { SCE_DBG_LOG_INFO("Impose detected\n"); if (imposeIpcActive) { - thread::Thread::Sleep(100); + thread::Sleep(100); findWidgets(); setButtonState(); setText(); @@ -312,7 +318,7 @@ SceVoid ImposeThread::EntryFunction() resetWidgets(); } impose = appState.isSystemUiOverlaid; - thread::Thread::Sleep(100); + thread::Sleep(100); } sceKernelExitDeleteThread(0); @@ -350,14 +356,14 @@ extern "C" { setup_stage2(); - hookId[0] = taiHookFunctionImport(&hookRef[0], "SceShell", 0xA6605D6F, 0x62BEBD65, sceAppMgrGetCurrentBgmState2_patched); + hookId[0] = taiHookFunctionImport(&hookRef[0], "SceShell", 0xA6605D6F, 0x62BEBD65, (const void *)sceAppMgrGetCurrentBgmState2_patched); + + return ret; } int module_stop(SceSize args, const void * argp) { cleanup(); - if (hookId[0] > 0) - taiHookRelease(hookId[0], hookRef[0]); return SCE_KERNEL_STOP_SUCCESS; } diff --git a/ElevenMPV-A-ShellPlugin/main.h b/ElevenMPV-A-ShellPlugin/main.h index f1e646c..e81d175 100644 --- a/ElevenMPV-A-ShellPlugin/main.h +++ b/ElevenMPV-A-ShellPlugin/main.h @@ -1,3 +1,4 @@ +#pragma once #include using namespace paf; @@ -22,7 +23,7 @@ class RxThread : public paf::thread::Thread virtual SceVoid EntryFunction(); }; -class PlayerButtonCB : public widget::Widget::EventCallback +class PlayerButtonCB : public ui::Widget::EventCallback { public: @@ -43,6 +44,6 @@ class PlayerButtonCB : public widget::Widget::EventCallback }; - static SceVoid PlayerButtonCBFun(SceInt32 eventId, widget::Widget *self, SceInt32 a3, ScePVoid pUserData); + static SceVoid PlayerButtonCBFun(SceInt32 eventId, ui::Widget *self, SceInt32 a3, ScePVoid pUserData); }; \ No newline at end of file diff --git a/ElevenMPV-A-ShellPlugin/paf_runtime.cpp b/ElevenMPV-A-ShellPlugin/paf_runtime.cpp index a5d6212..7da6819 100644 --- a/ElevenMPV-A-ShellPlugin/paf_runtime.cpp +++ b/ElevenMPV-A-ShellPlugin/paf_runtime.cpp @@ -1,11 +1,6 @@ extern "C" { - void __cxa_set_dso_handle_main(void *dso) - { - - } - int _sceLdTlsRegisterModuleInfo() { return 0; @@ -16,13 +11,8 @@ extern "C" { return 0; } - int __aeabi_unwind_cpp_pr0() + int __at_quick_exit() { - return 9; - } - - int __aeabi_unwind_cpp_pr1() - { - return 9; + return 0; } } \ No newline at end of file diff --git a/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj new file mode 100644 index 0000000..946fb97 --- /dev/null +++ b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj @@ -0,0 +1,79 @@ + + + + + Debug + PSVita + + + Release + PSVita + + + + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D} + + + + DynamicLibrary + + + DynamicLibrary + + + + + + + + + + + + + + + + + + + + + + + + _DEBUG;%(PreprocessorDefinitions); + true + NotUsing + + + --no-required-files + -lSceSysmodule_stub;-lSceAppmgr_stub;%(AdditionalDependencies) + $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) + + + + + NDEBUG;%(PreprocessorDefinitions); + Level3 + NotUsing + + + --no-required-files + StripSymsAndDebug + -lSceSysmodule_stub;-lSceAppmgr_stub;%(AdditionalDependencies) + $(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories) + + + "$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --strip --compress "$(LocalDebuggerCommand)" "$(OutDir)paf_preload.suprx" +copy /Y "$(OutDir)paf_preload.suprx" "$(SolutionDir)\ElevenMPV-A\CONTENTS\module\libScePafPreload.suprx" + + + + + + + + + + \ No newline at end of file diff --git a/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.filters b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.filters new file mode 100644 index 0000000..d7e45bc --- /dev/null +++ b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.filters @@ -0,0 +1,18 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;cc;s;asm + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp + + + + + Source Files + + + \ No newline at end of file diff --git a/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.user b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/ElevenMPV-A-libScePafPreload/libScePafPreload.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ElevenMPV-A-libScePafPreload/prx.c b/ElevenMPV-A-libScePafPreload/prx.c new file mode 100644 index 0000000..2aded10 --- /dev/null +++ b/ElevenMPV-A-libScePafPreload/prx.c @@ -0,0 +1,74 @@ +#include +#include + +int sceAppMgrGrowMemory3(unsigned int a1, int a2); + +#define GROW_MEMORY + +typedef struct SceSysmoduleOpt { + int flags; + int *result; + int unused[2]; +} SceSysmoduleOpt; + +typedef struct ScePafInit { + SceSize global_heap_size; + int a2; + int a3; + int cdlg_mode; + int heap_opt_param1; + int heap_opt_param2; +} ScePafInit; // size is 0x18 + +int __module_stop(SceSize argc, const void *args) +{ + return SCE_KERNEL_STOP_SUCCESS; +} + +int __module_exit() +{ + return SCE_KERNEL_STOP_SUCCESS; +} + +int __module_start(SceSize argc, void *args) +{ + SceInt32 ret = -1, load_res; + void* pRet = 0; + + ScePafInit init_param; + SceSysmoduleOpt sysmodule_opt; + +#ifdef GROW_MEMORY + + init_param.global_heap_size = 4 * 1024 * 1024 + 512 * 1024; + + //Grow memory if possible + ret = sceAppMgrGrowMemory3(41 * 1024 * 1024, 1); // 57 MB + if (ret < 0) { + ret = sceAppMgrGrowMemory3(16 * 1024 * 1024, 1); // 32 MB + if (ret == 0) + init_param.global_heap_size = 12 * 1024 * 1024; + } + else + init_param.global_heap_size = 23 * 1024 * 1024; +#else + init_param.global_heap_size = 12 * 1024 * 1024; +#endif + init_param.a2 = 0x0000EA60; + init_param.a3 = 0x00040000; + init_param.cdlg_mode = 0; + init_param.heap_opt_param1 = 0; + init_param.heap_opt_param2 = 0; + + sysmodule_opt.flags = 0; // with arg + sysmodule_opt.result = &load_res; + + ret = sceSysmoduleLoadModuleInternalWithArg(SCE_SYSMODULE_INTERNAL_PAF, sizeof(init_param), &init_param, &sysmodule_opt); + + if (ret < 0) { + sceClibPrintf("[PAF PRX] Loader: 0x%x\n", ret); + sceClibPrintf("[PAF PRX] Loader result: 0x%x\n", load_res); + } + + return SCE_KERNEL_START_NO_RESIDENT; +} \ No newline at end of file diff --git a/ElevenMPV-A.sln b/ElevenMPV-A.sln index 8ea022f..2c9fcb8 100644 --- a/ElevenMPV-A.sln +++ b/ElevenMPV-A.sln @@ -6,10 +6,16 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElevenMPV-A", "ElevenMPV-A\ElevenMPV-A.vcxproj", "{C1CA520F-B824-44D0-91F4-33EE6287D6EB}" ProjectSection(ProjectDependencies) = postProject {08427615-73E3-4334-B91C-89425EFCA190} = {08427615-73E3-4334-B91C-89425EFCA190} + {D9477093-D1DF-4A70-B333-C114DDF9EC04} = {D9477093-D1DF-4A70-B333-C114DDF9EC04} + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D} = {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElevenMPV-A-ShellPlugin", "ElevenMPV-A-ShellPlugin\ElevenMPV-A-ShellPlugin.vcxproj", "{08427615-73E3-4334-B91C-89425EFCA190}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElevenMPV-A-DE", "ElevenMPV-A-DE\ElevenMPV-A-DE.vcxproj", "{D9477093-D1DF-4A70-B333-C114DDF9EC04}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libScePafPreload", "ElevenMPV-A-libScePafPreload\libScePafPreload.vcxproj", "{584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|PSVita = Debug|PSVita @@ -24,6 +30,14 @@ Global {08427615-73E3-4334-B91C-89425EFCA190}.Debug|PSVita.Build.0 = Debug|PSVita {08427615-73E3-4334-B91C-89425EFCA190}.Release|PSVita.ActiveCfg = Release|PSVita {08427615-73E3-4334-B91C-89425EFCA190}.Release|PSVita.Build.0 = Release|PSVita + {D9477093-D1DF-4A70-B333-C114DDF9EC04}.Debug|PSVita.ActiveCfg = Debug|PSVita + {D9477093-D1DF-4A70-B333-C114DDF9EC04}.Debug|PSVita.Build.0 = Debug|PSVita + {D9477093-D1DF-4A70-B333-C114DDF9EC04}.Release|PSVita.ActiveCfg = Release|PSVita + {D9477093-D1DF-4A70-B333-C114DDF9EC04}.Release|PSVita.Build.0 = Release|PSVita + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D}.Debug|PSVita.ActiveCfg = Debug|PSVita + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D}.Debug|PSVita.Build.0 = Debug|PSVita + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D}.Release|PSVita.ActiveCfg = Release|PSVita + {584C4FE4-880C-4EF6-9E2A-22BBE98EBA2D}.Release|PSVita.Build.0 = Release|PSVita EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ElevenMPV-A/CONTENTS/empva_plugin.rco b/ElevenMPV-A/CONTENTS/empva_plugin.rco index 79fb912..6895bd1 100644 Binary files a/ElevenMPV-A/CONTENTS/empva_plugin.rco and b/ElevenMPV-A/CONTENTS/empva_plugin.rco differ diff --git a/ElevenMPV-A/CONTENTS/empva_settings.xml b/ElevenMPV-A/CONTENTS/empva_settings.xml new file mode 100644 index 0000000..d7e10d8 --- /dev/null +++ b/ElevenMPV-A/CONTENTS/empva_settings.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -373,121 +108,157 @@ - - + + + + + + + + + + - - + + - - + + - - + + - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + - - - - + + + + - - - - - + + + + + - + - - - - - - + + + + + + @@ -558,6 +423,16 @@ + + + + + + + + + + diff --git a/Resource/empva_settings.xml b/Resource/empva_settings.xml new file mode 100644 index 0000000..d7e10d8 --- /dev/null +++ b/Resource/empva_settings.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +