XboxDev / nxdk

The cross-platform, open-source SDK to develop for original Xbox: *new* xdk
437 stars 66 forks source link

pbkit: Support non-standard NVCLK #585

Closed GXTX closed 2 years ago

GXTX commented 2 years ago

Fixes #536

With the release of software based overclocks, and hardware modding becoming more popular I think pbkit should support any given frequency just as XDK does. A stock Xbox will run fine at ~250MHz and as low as ~25MHz.

Ryzee119 commented 2 years ago

Looks pretty good, tested on my 1.6 with stock clocks and didnt break anything. Got this output:

input freq : 233338Hz
num        : 58334
den        : 7812
timer freq : 31248Hz

Output matches the original hardcoded value of ~31.25Mhz

GXTX commented 2 years ago

Thanks for the review. ^

Ernegien commented 2 years ago

Closing due to lack of MIT consent.

GXTX commented 2 years ago

The code is taken directly from Linux, I cannot re-license Linux.

JayFoxRox commented 2 years ago

Could be rewritten to simplify fractions using a GCD, or you can find a source for fraction simplification using this algorithm to ensure it's factual / non-copyrightable (while also providing a second source).

I think it is already factual, although I don't fully understand the choice of the constant 32 and 5.