Skip to content

Commit 1ef090b

Browse files
committed
QOL improvements
1 parent 68ba7bd commit 1ef090b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,24 @@ ULONG get_GPU_frequency()
6767

6868
void outputClocks()
6969
{
70+
if (!wanted_mp)
71+
wanted_mp++;
7072
calc_clock_params(wanted_fsb, &wanted_n, &wanted_m);
7173
hidden_fsb = (BASE_CLOCK_FLOAT / wanted_m) * wanted_n;
72-
74+
7375
ULONG cpu_clk = (int)(wanted_fsb * CPU_BASE_MULTIPLIER);
7476
ULONG mem_clk = ((BASE_CLOCK_FLOAT / wanted_m) * (wanted_p * 2 * wanted_n)) / (2 * wanted_mp);
7577

7678
cpu_coeff = (pci_buff & ~0x00FFFFFF) | (wanted_mp << 20) | (wanted_p << 16) | (wanted_n << 8) | wanted_m;
7779

78-
debugPrint("\nFSB: %03luMHz, CPU: %03luMHz, RAM: %03luMHz\n", wanted_fsb, cpu_clk, mem_clk);
80+
debugPrint("\nFSB: %03luMHz, CPU: %03luMHz, RAM: %3luMHz\n", wanted_fsb, cpu_clk, mem_clk);
7981
debugPrint("NVCLK : %03luMHz\n", wanted_nvclk);
8082
}
8183

8284
static inline void writeCPUClocks(ULONG coeff)
8385
{
8486
// wait and disable interrupts
85-
Sleep(1000);
87+
KeStallExecutionProcessor(10000);
8688
__asm__("cli\n\t"
8789
"sfence\n\t"
8890
"nop\n\t"
@@ -103,7 +105,7 @@ static inline void writeCPUClocks(ULONG coeff)
103105
"sfence\n\t"
104106
"sti\n\t"
105107
);
106-
Sleep(1000);
108+
KeStallExecutionProcessor(10000);
107109
}
108110

109111
int main(void)
@@ -189,8 +191,8 @@ int main(void)
189191
Sleep(500);
190192
}
191193

192-
// We MUST set this before CPU clocks
193-
if (wanted_mp != original_mp) {
194+
// If we're overclocking we need to make sure we write this first
195+
if (wanted_mp != original_mp && wanted_fsb > original_fsb) {
194196
debugClearScreen();
195197
debugPrint("Setting MemDiv to: %d\n", wanted_mp);
196198

0 commit comments

Comments
 (0)