From 2c317d9a1878ed5d849568e1a2c34b90cd6ce845 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 3 Jul 2023 21:11:03 +0200 Subject: [PATCH] More logs --- app/Mode/ModeControl.cs | 16 ++++++++++++---- app/Ryzen/SendCommand.cs | 35 +++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index 07945f84..897a7486 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -252,10 +252,18 @@ namespace GHelper.Mode if (ProcessHelper.IsUserAdministrator()) { - SendCommand.set_stapm_limit((uint)limit_total * 1000); - SendCommand.set_stapm2_limit((uint)limit_total * 1000); - SendCommand.set_slow_limit((uint)limit_total * 1000); - SendCommand.set_fast_limit((uint)limit_total * 1000); + var stapmResult = SendCommand.set_stapm_limit((uint)limit_total * 1000); + Logger.WriteLine($"STAPM: {limit_total} {stapmResult}"); + + var stapmResult2 = SendCommand.set_stapm2_limit((uint)limit_total * 1000); + Logger.WriteLine($"STAPM2: {limit_total} {stapmResult2}"); + + var slowResult = SendCommand.set_slow_limit((uint)limit_total * 1000); + Logger.WriteLine($"SLOW: {limit_total} {slowResult}"); + + var fastResult = SendCommand.set_fast_limit((uint)limit_total * 1000); + Logger.WriteLine($"FAST: {limit_total} {fastResult}"); + customPower = limit_total; } else if (launchAsAdmin) diff --git a/app/Ryzen/SendCommand.cs b/app/Ryzen/SendCommand.cs index f59a28e4..99a58fe6 100644 --- a/app/Ryzen/SendCommand.cs +++ b/app/Ryzen/SendCommand.cs @@ -26,18 +26,19 @@ namespace Ryzen //STAMP Limit - public static void set_stapm_limit(uint value) + public static Smu.Status? set_stapm_limit(uint value) { RyzenAccess.Initialize(); uint[] Args = new uint[6]; Args[0] = value; + Smu.Status? result = null; switch (FAMID) { case 0: case 1: case 2: - RyzenAccess.SendMp1(0x1a, ref Args); + result = RyzenAccess.SendMp1(0x1a, ref Args); break; case 3: case 5: @@ -46,20 +47,24 @@ namespace Ryzen case 9: case 11: RyzenAccess.SendMp1(0x14, ref Args); - RyzenAccess.SendPsmu(0x31, ref Args); + result = RyzenAccess.SendPsmu(0x31, ref Args); break; default: break; } + RyzenAccess.Deinitialize(); + return result; + } //STAMP2 Limit - public static void set_stapm2_limit(uint value) + public static Smu.Status? set_stapm2_limit(uint value) { RyzenAccess.Initialize(); uint[] Args = new uint[6]; Args[0] = value; + Smu.Status? result = null; switch (FAMID) { @@ -69,26 +74,29 @@ namespace Ryzen case 8: case 9: case 11: - RyzenAccess.SendPsmu(0x31, ref Args); + result = RyzenAccess.SendPsmu(0x31, ref Args); break; default: break; } RyzenAccess.Deinitialize(); + return result; } //Fast Limit - public static void set_fast_limit(uint value) + public static Smu.Status? set_fast_limit(uint value) { RyzenAccess.Initialize(); uint[] Args = new uint[6]; Args[0] = value; + Smu.Status? result = null; + switch (FAMID) { case 0: case 1: case 2: - RyzenAccess.SendMp1(0x1b, ref Args); + result = RyzenAccess.SendMp1(0x1b, ref Args); break; case 3: case 5: @@ -96,27 +104,29 @@ namespace Ryzen case 8: case 9: case 11: - RyzenAccess.SendMp1(0x15, ref Args); + result = RyzenAccess.SendMp1(0x15, ref Args); break; default: break; } RyzenAccess.Deinitialize(); + return result; } //Slow Limit - public static void set_slow_limit(uint value) + public static Smu.Status? set_slow_limit(uint value) { RyzenAccess.Initialize(); uint[] Args = new uint[6]; Args[0] = value; - + Smu.Status? result = null; + switch (FAMID) { case 0: case 1: case 2: - RyzenAccess.SendMp1(0x1c, ref Args); + result = RyzenAccess.SendMp1(0x1c, ref Args); break; case 3: case 5: @@ -124,12 +134,13 @@ namespace Ryzen case 8: case 9: case 11: - RyzenAccess.SendMp1(0x16, ref Args); + result = RyzenAccess.SendMp1(0x16, ref Args); break; default: break; } RyzenAccess.Deinitialize(); + return result; } //Slow time