Skip to content

Commit

Permalink
Added DEV mode
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt committed May 5, 2023
1 parent 99eb269 commit b70f1c7
Show file tree
Hide file tree
Showing 30 changed files with 748 additions and 696 deletions.
2 changes: 1 addition & 1 deletion PSVshellPlus_Kernel/PSVshellPlus_Kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
;-lSceProcessmgrForDriver_stub;-lSceSysrootForKernel_stub;-ltaihenForKernel_stub;-ltaihenModuleUtils_stub;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)_$(TargetName).skprx"
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)$(TargetName).skprx"
"$(SCE_PSP2_SDK_DIR)\host_tools\build\bin\armlibgen.exe" --dump lib.emd --stub-archive</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
Expand Down
4 changes: 4 additions & 0 deletions PSVshellPlus_Kernel/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ typedef struct PSVSVenezia {
SceInt32 peak;
} PSVSVenezia;

typedef struct PSVSBattery {
SceInt32 current;
} PSVSBattery;

typedef struct PSVSKPLS {
SceUInt32 lock;
} PSVSKPLS;
Expand Down
13 changes: 13 additions & 0 deletions PSVshellPlus_Kernel/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,18 @@ SceInt32 psvsGetVeneziaInfo(PSVSVenezia *data)

sceKernelCopyToUser(data, &kdata, sizeof(PSVSVenezia));

return ret;
}

SceInt32 psvsGetBatteryInfo(PSVSBattery *data)
{
PSVSBattery kdata;
SceInt32 ret = SCE_KERNEL_ERROR_UNSUP;

kdata.current = 0;
ret = sceSysconGetBatteryCurrent(&kdata.current);
kdata.current = -kdata.current;

sceKernelCopyToUser(data, &kdata, sizeof(PSVSBattery));
return ret;
}
2 changes: 2 additions & 0 deletions PSVshellPlus_Kernel/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@

int(*sceKernelGetPhyMemPartInfoCore)(SceKernelPhyMemPart *pPhyMemPart, ScePhyMemPartInfoCore *pInfo);

int(*sceSysconGetBatteryCurrent)(SceInt32 *res);

SceVoid psvsCalcFps();
1 change: 1 addition & 0 deletions PSVshellPlus_Kernel/lib.emd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Library: PSVshellPlus_KernelForUser function: psvsSetGpuXbarClockFrequency
Library: PSVshellPlus_KernelForUser function: psvsSetBusClockFrequency
Library: PSVshellPlus_KernelForUser function: psvsGetClockFrequency
Library: PSVshellPlus_KernelForUser function: psvsGetVeneziaInfo
Library: PSVshellPlus_KernelForUser function: psvsGetBatteryInfo
Library: PSVshellPlus_KernelForUser function: psvsClockFrequencyLockProc
Library: PSVshellPlus_KernelForUser function: psvsClockFrequencyUnlockProc
Library: PSVshellPlus_KernelForUser function: psvsClockFrequencyIsLockedProc
Expand Down
Binary file modified PSVshellPlus_Kernel/libPSVshellPlus_KernelForUser_stub.a
Binary file not shown.
18 changes: 14 additions & 4 deletions PSVshellPlus_Kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ static SceUID s_reqPid = -1;

static SceUInt32 *scePowerKPLSKey = NULL;

int(*scePervasiveArmSetClock)(int mul, int ndiv);
static SceUInt32 **ScePervasiveBaseClk = NULL;

int(*scePervasiveArmClockSelect)(int mul, int ndiv);

SceVoid psvsSetFpsCounterTarget(SceInt32 target)
{
Expand Down Expand Up @@ -67,7 +69,7 @@ int scePowerSetArmClockFrequency_patched(int clock)
ret = psvsClockFrequencyLockProc(pid, PSVS_500_MHZ_KEY);
if (ret == SCE_OK) {
// Apply mul:div (15:0)
ret = scePervasiveArmSetClock(15, 16 - 0);
ret = scePervasiveArmClockSelect(15, 16 - 0);
}

return ret;
Expand Down Expand Up @@ -143,6 +145,11 @@ int __module_start(SceSize args, const void * argp)

module_get_offset(KERNEL_PID, tai_info.modid, 1, 0, (uintptr_t *)&scePowerKPLSKey);

tai_info.size = sizeof(tai_module_info_t);
taiGetModuleInfoForKernel(KERNEL_PID, "SceLowio", &tai_info);

module_get_offset(KERNEL_PID, tai_info.modid, 1, 0xa0, (uintptr_t *)&ScePervasiveBaseClk);

s_hookId[0] = taiHookFunctionExportForKernel(KERNEL_PID, &s_hookRef[0],
"SceDisplay", 0x9FED47AC, 0x16466675, sceDisplaySetFrameBufInternal_patched);

Expand All @@ -164,7 +171,10 @@ int __module_start(SceSize args, const void * argp)
}

module_get_export_func(KERNEL_PID,
"SceLowio", 0xE692C727, 0xE9D95643, (uintptr_t *)&scePervasiveArmSetClock);
"SceLowio", 0xE692C727, 0xE9D95643, (uintptr_t *)&scePervasiveArmClockSelect);

module_get_export_func(KERNEL_PID,
"SceSyscon", 0x60A35F64, 0x0826BA07, (uintptr_t *)&sceSysconGetBatteryCurrent);

/*
ret = module_get_export_func(KERNEL_PID,
Expand Down Expand Up @@ -227,7 +237,7 @@ int __module_start(SceSize args, const void * argp)

const SceUInt8 nop[] = { 0x00, 0xBF };
s_injectId[0] = taiInjectAbsForKernel(KERNEL_PID,
(void *)((uintptr_t)scePervasiveArmSetClock + 0x1D), &nop, 2);
(void *)((uintptr_t)scePervasiveArmClockSelect + 0x1D), &nop, 2);

return SCE_KERNEL_START_SUCCESS;
}
Expand Down
5 changes: 3 additions & 2 deletions PSVshellPlus_Shell/PSVshellPlus_Shell.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<DuplicateStripping>true</DuplicateStripping>
</Link>
<PostBuildEvent>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)_$(TargetName).suprx"</Command>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(LocalDebuggerCommand)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
Expand All @@ -86,6 +86,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CppLanguageStd>Cpp11</CppLanguageStd>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalOptions>--no-standard-libraries --no-required-files</AdditionalOptions>
Expand All @@ -96,7 +97,7 @@
<DuplicateStripping>true</DuplicateStripping>
</Link>
<PostBuildEvent>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)_$(TargetName).suprx"</Command>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(LocalDebuggerCommand)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Condition="'$(ConfigurationType)' == 'Makefile' and Exists('$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets')" Project="$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="Mini" id="psvs_msg_hud_mini" />
<string src="Full" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="HPOS:" id="psvs_msg_hud_pos" />
<string src="U-L" id="psvs_msg_hud_pos_ul" />
<string src="U-R" id="psvs_msg_hud_pos_ur" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="Mini" id="psvs_msg_hud_mini" />
<string src="Tout" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="POS:" id="psvs_msg_hud_pos" />
<string src="H-G" id="psvs_msg_hud_pos_ul" />
<string src="H-D" id="psvs_msg_hud_pos_ur" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="ミニ" id="psvs_msg_hud_mini" />
<string src="フル" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="HPOS:" id="psvs_msg_hud_pos" />
<string src="U-L" id="psvs_msg_hud_pos_ul" />
<string src="U-R" id="psvs_msg_hud_pos_ur" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="Мини" id="psvs_msg_hud_mini" />
<string src="Полный" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="Поз.:" id="psvs_msg_hud_pos" />
<string src="В-Л" id="psvs_msg_hud_pos_ul" />
<string src="В-П" id="psvs_msg_hud_pos_ur" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_zh-s.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="迷你" id="psvs_msg_hud_mini" />
<string src="完整" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="HPOS:" id="psvs_msg_hud_pos" />
<string src="左上" id="psvs_msg_hud_pos_ul" />
<string src="右上" id="psvs_msg_hud_pos_ur" />
Expand Down
2 changes: 2 additions & 0 deletions PSVshellPlus_Shell/RES_RCO/locale/psvshell_locale_zh-t.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<stringset>
<string src="CPU:" id="psvs_msg_cpu" />
<string src="VNZ:" id="psvs_msg_vnz" />
<string src="BAT:" id="psvs_msg_bat" />
<string src="GPU:" id="psvs_msg_gpu" />
<string src="BUS:" id="psvs_msg_bus" />
<string src="XBAR:" id="psvs_msg_xbar" />
Expand All @@ -17,6 +18,7 @@
<string src="FPS" id="psvs_msg_hud_micro" />
<string src="迷你" id="psvs_msg_hud_mini" />
<string src="完整" id="psvs_msg_hud_full" />
<string src="Dev" id="psvs_msg_hud_dev" />
<string src="HPOS:" id="psvs_msg_hud_pos" />
<string src="左上" id="psvs_msg_hud_pos_ul" />
<string src="右上" id="psvs_msg_hud_pos_ur" />
Expand Down
Loading

0 comments on commit b70f1c7

Please sign in to comment.