Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
- Fixed an issue where clock frequencies were reset after suspend-resume cycle
- If HUD position is set to Upper-Right, it will now be reset upon resume to preventl blocking of the peel screen
  • Loading branch information
GrapheneCt committed Jul 23, 2022
1 parent 14a27fa commit c954024
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 18 deletions.
Binary file modified PSVshellPlus_Kernel/libPSVshellPlus_KernelForUser_stub.a
Binary file not shown.
4 changes: 2 additions & 2 deletions PSVshellPlus_Shell/PSVshellPlus_Shell.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</ClCompile>
<Link>
<AdditionalOptions>--no-standard-libraries --no-required-files</AdditionalOptions>
<AdditionalDependencies>-lSceDbg_stub;-lScePafTopLevel_stub_weak;-lScePafStdc_stub_weak;-lScePafCommon_stub_weak;-lScePafWidget_stub_weak;-lScePafThread_stub_weak;-lScePafResource_stub_weak;-lScePafGraphics_stub_weak;-lScePafMisc_stub_weak;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-lSceAppMgr_stub;-lSceGxm_stub;-lSceSysmodule_stub;-lSceVshBridge_stub;-lSceDisplay_stub;-ltaihen_stub;$(SolutionDir)PSVshellPlus_Kernel\libPSVshellPlus_KernelForUser_stub.a;-lsnc;-lvita2d_sys_paf;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>-lSceDbg_stub;-lScePafTopLevel_stub_weak;-lScePafStdc_stub_weak;-lScePafCommon_stub_weak;-lScePafWidget_stub_weak;-lScePafThread_stub_weak;-lScePafResource_stub_weak;-lScePafGraphics_stub_weak;-lScePafMisc_stub_weak;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-lSceAppMgr_stub;-lSceSysmodule_stub;-lSceVshBridge_stub;-lSceDisplay_stub;-lScePower_stub;-ltaihen_stub;$(SolutionDir)PSVshellPlus_Kernel\libPSVshellPlus_KernelForUser_stub.a;-lsnc;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<InfoStripping>StripSymsAndDebug</InfoStripping>
<DataStripping>StripFuncsAndData</DataStripping>
Expand All @@ -89,7 +89,7 @@
</ClCompile>
<Link>
<AdditionalOptions>--no-standard-libraries --no-required-files</AdditionalOptions>
<AdditionalDependencies>-lScePafTopLevel_stub_weak;-lScePafStdc_stub_weak;-lScePafCommon_stub_weak;-lScePafWidget_stub_weak;-lScePafThread_stub_weak;-lScePafResource_stub_weak;-lScePafGraphics_stub_weak;-lScePafMisc_stub_weak;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-lSceAppMgr_stub;-lSceGxm_stub;-lSceSysmodule_stub;-lSceVshBridge_stub;-lSceDisplay_stub;-ltaihen_stub;$(SolutionDir)PSVshellPlus_Kernel\libPSVshellPlus_KernelForUser_stub.a;-lsnc;-lvita2d_sys_paf;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>-lScePafTopLevel_stub_weak;-lScePafStdc_stub_weak;-lScePafCommon_stub_weak;-lScePafWidget_stub_weak;-lScePafThread_stub_weak;-lScePafResource_stub_weak;-lScePafGraphics_stub_weak;-lScePafMisc_stub_weak;-lSceLibKernel_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceAppMgrUser_stub;-lSceAppMgr_stub;-lSceSysmodule_stub;-lSceVshBridge_stub;-lSceDisplay_stub;-lScePower_stub;-ltaihen_stub;$(SolutionDir)PSVshellPlus_Kernel\libPSVshellPlus_KernelForUser_stub.a;-lsnc;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<InfoStripping>StripSymsAndDebug</InfoStripping>
<DataStripping>StripFuncsAndData</DataStripping>
Expand Down
16 changes: 16 additions & 0 deletions PSVshellPlus_Shell/impose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace psvs
arraySize = sizeof(k_gpuClock) / sizeof(SceInt32);
arrayPtr = k_gpuClock;
break;
/*
case psvs_button_impose_bus_down:
currentClock = clock.bus;
clockSet = psvsSetBusClockFrequency;
Expand All @@ -80,6 +81,7 @@ namespace psvs
arraySize = sizeof(k_busClock) / sizeof(SceInt32);
arrayPtr = k_busClock;
break;
*/
case psvs_button_impose_xbar_down:
currentClock = clock.xbar;
clockSet = psvsSetGpuXbarClockFrequency;
Expand Down Expand Up @@ -369,6 +371,20 @@ namespace psvs
}
}

Hud::Position Impose::GetHudPosition()
{
return (Hud::Position)s_hudPos;
}

SceVoid Impose::SetHudPosition(Hud::Position pos)
{
s_hudPos = pos;
Hud *currHud = Hud::GetCurrentHud();
if (currHud != SCE_NULL) {
currHud->SetPosition(pos);
}
}

Impose::Impose(Plugin *plugin, ui::Box *root)
{
rco::Element welement;
Expand Down
5 changes: 5 additions & 0 deletions PSVshellPlus_Shell/impose.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include <kernel.h>
#include <paf.h>

#include "psvs.h"
#include "hud.h"

namespace psvs
{
class Impose
Expand Down Expand Up @@ -109,6 +112,8 @@ namespace psvs
};

static SceVoid Update(ScePVoid arg);
static Hud::Position GetHudPosition();
static SceVoid SetHudPosition(Hud::Position pos);

Impose(paf::Plugin *plugin, paf::ui::Box *root);

Expand Down
32 changes: 29 additions & 3 deletions PSVshellPlus_Shell/tracker.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include <kernel.h>
#include <appmgr.h>
#include <power.h>
#include <libdbg.h>
#include <paf.h>

#include "global.h"
#include "utils.h"
#include "impose.h"
#include "hud.h"
#include "psvs.h"
#include "tracker.h"
#include "profile.h"
Expand All @@ -30,7 +33,6 @@ namespace tracker
SceBool appChanged = SCE_FALSE;

if (tickNow - s_tickOld > PSVS_APP_UPDATE_WINDOW_USEC) {

appId = sceAppMgrGetAppIdByAppId(SCE_APPMGR_APP_ID_ACTIVE);
if (appId > 0) {
if (s_currAppId != appId) {
Expand Down Expand Up @@ -68,7 +70,7 @@ namespace tracker
if (s_currProfile) {
psvsSetArmClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_CPU]);
psvsSetGpuClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_GPU_ES4]);
psvsSetBusClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_BUS]);
//psvsSetBusClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_BUS]);
psvsSetGpuXbarClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_GPU_XBAR]);
psvsClockFrequencyLockProc(s_currPid, (PsvsLockDevice)s_currProfile->lock);
}
Expand Down Expand Up @@ -106,6 +108,26 @@ namespace tracker
return s_fpsTarget;
}

SceInt32 PowerCallback(SceUID notifyId, SceInt32 notifyCount, SceInt32 notifyArg, void *pCommon)
{
if ((notifyArg & SCE_POWER_CALLBACKARG_RESERVED_23) == SCE_POWER_CALLBACKARG_RESERVED_23) {
// Set clocks after resume reset
PSVSClockFrequency clocks;
psvsGetClockFrequency(&clocks);
psvsSetArmClockFrequency(clocks.cpu);
psvsSetGpuClockFrequency(clocks.gpu);
//psvsSetBusClockFrequency(clocks.bus);
psvsSetGpuXbarClockFrequency(clocks.xbar);

// Prevent HUD from blocking peel screen
if (!SCE_PAF_IS_DOLCE && Impose::GetHudPosition() == Hud::Position_UpRight && Hud::GetCurrentHud() != SCE_NULL) {
Impose::SetHudPosition(Hud::Position_UpLeft);
}
}

return SCE_OK;
}

SceVoid Init()
{
s_currPid = sceKernelGetProcessId();
Expand All @@ -115,13 +137,17 @@ namespace tracker
if (s_currProfile) {
psvsSetArmClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_CPU]);
psvsSetGpuClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_GPU_ES4]);
psvsSetBusClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_BUS]);
//psvsSetBusClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_BUS]);
psvsSetGpuXbarClockFrequency(s_currProfile->clock[PSVS_OC_DEVICE_GPU_XBAR]);
psvsClockFrequencyLockProc(s_currPid, (PsvsLockDevice)s_currProfile->lock);
}
else {
psvsClockFrequencyUnlockProc(s_currPid, PSVS_LOCK_DEVICE_ALL);
}

SceUID cbid = sceKernelCreateCallback("PSVshellPlus_PCB", 0, PowerCallback, NULL);
scePowerRegisterCallback(cbid);

task::Register(Update, SCE_NULL);
}

Expand Down
26 changes: 13 additions & 13 deletions PSVshellPlus_Shell/tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

namespace psvs
{
namespace tracker
{
#define PSVS_APP_UPDATE_WINDOW_USEC (100000)
namespace tracker
{
#define PSVS_APP_UPDATE_WINDOW_USEC (100000)

SceVoid Init();
SceVoid Term();
SceVoid Update(ScePVoid arg);
paf::wstring *GetCurrentAppName();
ScePID GetCurrentPID();
SceVoid ReloadCurrentProfile();
psvs::Profile *GetCurrentProfile();
SceInt32 GetCasShift();
SceInt32 GetFpsCounterTarget();
}
SceVoid Init();
SceVoid Term();
SceVoid Update(ScePVoid arg);
paf::wstring *GetCurrentAppName();
ScePID GetCurrentPID();
SceVoid ReloadCurrentProfile();
psvs::Profile *GetCurrentProfile();
SceInt32 GetFpsCounterTarget();
SceInt32 PowerCallback(SceUID notifyId, SceInt32 notifyCount, SceInt32 notifyArg, void *pCommon);
}
}

0 comments on commit c954024

Please sign in to comment.