protected override void OnStartup(StartupEventArgs e) { instanceMutex = new Mutex(true, mutexName, out createdNew); if (!createdNew) { // App is already running! Exit the application and show the other window. InteropMethods.PostMessage((IntPtr)InteropMethods.HWND_BROADCAST, InteropMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); Current.Shutdown(); Environment.Exit(0); } updater = new Updater(); GC.KeepAlive(instanceMutex); SplashWindow.Start(); base.OnStartup(e); }
private void ReadPowerConfig() { if (dramBaseAddress > 0) { try { SMU.Status status = OPS.TransferTableToDram(); if (status != SMU.Status.OK) { status = OPS.TransferTableToDram(); // retry } if (status != SMU.Status.OK) { return; } for (int i = 0; i < table.Length; ++i) { InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress + (i * 0x4), out uint data); table[i] = data; } if (table.Any(v => v != 0)) { PowerTable.ConfiguredClockSpeed = MEMCFG.Frequency; PowerTable.Table = table; } } catch (EntryPointNotFoundException ex) { throw new ApplicationException(ex.Message); } catch (DllNotFoundException ex) { throw new ApplicationException(ex.Message); } } }
private static void MinimizeFootprint() { InteropMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle); }
private void ReadPowerConfig() { #if DEBUG /*uint prev1 = 0; * uint prev2 = 0; * for (; ; ) * { * uint cmd1 = 0, cmd2 = 0; * uint arg1 = 0, arg2 = 0; * uint rsp1 = 0, rsp2 = 0; * * ops.SmuReadReg(0x03B10564, ref arg1); * ops.SmuReadReg(0x03B10528, ref cmd1); * ops.SmuReadReg(0x03B10598, ref rsp1); * if (cmd1 != prev1) * { * prev1 = cmd1; * Console.WriteLine($"1 -> 0x{cmd1:X2}: 0x{arg1:X8}: 0x{rsp1:X8}"); * } * * ops.SmuReadReg(ops.Smu.SMU_ADDR_ARG, ref arg2); * ops.SmuReadReg(ops.Smu.SMU_ADDR_MSG, ref cmd2); * ops.SmuReadReg(ops.Smu.SMU_ADDR_RSP, ref rsp2); * if (cmd2 != prev2) * { * prev2 = cmd2; * Console.WriteLine($"2 -> 0x{cmd2:X2}: 0x{arg2:X8}: 0x{rsp2:X8}"); * } * }*/ #endif if (dramBaseAddress > 0) { try { SMU.Status status = OPS.TransferTableToDram(); if (status != SMU.Status.OK) { status = OPS.TransferTableToDram(); // retry } if (status != SMU.Status.OK) { return; } for (int i = 0; i < table.Length; ++i) { InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress + (i * 0x4), out uint data); table[i] = data; } if (table.Any(v => v != 0)) { PowerTable.ConfiguredClockSpeed = MEMCFG.Frequency; PowerTable.Table = table; } } catch (EntryPointNotFoundException ex) { throw new ApplicationException(ex.Message); } catch (DllNotFoundException ex) { throw new ApplicationException(ex.Message); } } }