Skip to content

Commit

Permalink
re-add cached tdp
Browse files Browse the repository at this point in the history
  • Loading branch information
aarron-lee committed Jan 21, 2024
1 parent b19c30b commit 6022b08
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
1 change: 0 additions & 1 deletion py_modules/cpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def ryzenadj(tdp: int):
with file_timeout.time_limit(2):
if advanced_options.get_device_name() == advanced_options.Devices.ROG_ALLY.value:
rog_ally.set_tdp_platform_profile(tdp)

tdp = tdp*1000

if RYZENADJ_PATH:
Expand Down
26 changes: 13 additions & 13 deletions src/redux-modules/steamPatchMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ export const steamPatchMiddleware =

if (action.type === resumeAction.type) {
if (steamPatchEnabled) {
// if (steamPatchProfile?.tdp) {
// setSteamPatchTDP(steamPatchProfile.tdp);
// }
getSteamPerfSettings();
if (steamPatchProfile?.tdp) {
setSteamPatchTDP(steamPatchProfile.tdp);
}
// getSteamPerfSettings();
}
}

// if (action.type === setCurrentGameInfo.type) {
// if (steamPatchEnabled) {
// // if (steamPatchProfile?.tdp) {
// // setSteamPatchTDP(steamPatchProfile.tdp);
// // }
// // get steam perf settings when currentGameId changes
// getSteamPerfSettings();
// }
// }
if (action.type === setCurrentGameInfo.type) {
if (steamPatchEnabled) {
if (steamPatchProfile?.tdp) {
setSteamPatchTDP(steamPatchProfile.tdp);
}
// get steam perf settings when currentGameId changes
// getSteamPerfSettings();
}
}

if (saveToBackendTypes.includes(action.type)) {
saveSteamPatchTdpProfiles(state.settings.tdpProfiles, advancedState);
Expand Down
23 changes: 12 additions & 11 deletions src/steamPatch/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { debounce, get } from "lodash";
import { setSteamPatchGPU, setSteamPatchTDP } from "../backend/utils";
// import {
// // cacheSteamPatchGpu,
// cacheSteamPatchTdp,
// } from "../redux-modules/settingsSlice";
import {
// cacheSteamPatchGpu,
cacheSteamPatchTdp,
} from "../redux-modules/settingsSlice";
import { RootState, store } from "../redux-modules/store";
import { extractCurrentGameId } from "../utils/constants";

let previousTdp: number | undefined;
let previousGameIdForTdp: string | undefined;

const setTdpOriginal = (updatedTdp: number) => {
export const setTdp = (updatedTdp: number) => {
const id = extractCurrentGameId();
previousGameIdForTdp = id;
previousTdp = updatedTdp;

setSteamPatchTDP(updatedTdp);
// store.dispatch(cacheSteamPatchTdp([id, updatedTdp]));
};
if (previousTdp !== updatedTdp || previousGameIdForTdp !== id) {
previousGameIdForTdp = id;
previousTdp = updatedTdp;

export const setTdp = debounce(setTdpOriginal, 100);
setSteamPatchTDP(updatedTdp);
store.dispatch(cacheSteamPatchTdp([id, updatedTdp]));
}
};

let previousMinGpu: number | undefined;
let previousMaxGpu: number | undefined;
Expand Down

0 comments on commit 6022b08

Please sign in to comment.