diff --git a/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.cpp b/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.cpp index 02d54b30..a90b9ab2 100644 --- a/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.cpp +++ b/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.cpp @@ -75,7 +75,13 @@ namespace board { } void CacheGpuVoltTable() { - const u32 voltagePattern[] = { 600000, 12500, 1400000, }; + + + UnkRegulator reg = { + .voltageMinUV = 600000, + .voltageStep = 12500, + .voltageMax = 1400000, + }; Handle handle = GetPcvHandle(); if (handle == INVALID_HANDLE) { @@ -115,19 +121,19 @@ namespace board { break; } - u8 *resultPattern = static_cast(memmem_impl(buffer, sizeof(buffer), voltagePattern, sizeof(voltagePattern))); - u32 index = resultPattern - buffer; + u8 *resultFindReg = static_cast(memmem_impl(buffer, sizeof(buffer), ®, sizeof(reg))); + u32 index = resultFindReg - buffer; - if (!resultPattern) { + if (!resultFindReg) { continue; } /* Assuming mariko. */ const u32 vmax = 800; - constexpr u32 DvfsTableOffset = 312; - if (!std::memcmp(&buffer[index + DvfsTableOffset], &vmax, sizeof(vmax))) { - std::memcpy(voltData.voltTable, &buffer[index + DvfsTableOffset], sizeof(dvfsTable)); - voltData.voltTableAddress = base + memoryInfo.addr + DvfsTableOffset + index; + constexpr u32 VoltageTableOffset = 312; + if (!std::memcmp(&buffer[index + VoltageTableOffset], &vmax, sizeof(vmax))) { + std::memcpy(voltData.voltTable, &buffer[index + VoltageTableOffset], sizeof(voltData.voltTable)); + voltData.voltTableAddress = base + memoryInfo.addr + VoltageTableOffset + index; } svcCloseHandle(handle); diff --git a/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.hpp b/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.hpp index 80925e18..d61a4b5b 100644 --- a/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.hpp +++ b/Source/rewrite-hoc-clk/sysmodule/src/board/board_ram_oc_dvfs.hpp @@ -35,6 +35,13 @@ namespace board { u32 ramVmin; }; + /* TODO: Find out what component this actually targets. */ + struct UnkRegulator { + u32 voltageMinUV; + u32 voltageStep; + u32 voltageMax; + } + void CacheGpuVoltTable(); void PcvHijackGpuVolts(u32 vmin); u32 GetMinimumVmin(u32 freqMhz, u32 bracket);