Created
May 25, 2022 02:16
-
-
Save Annihil/b252907cad11dae6643713064da27718 to your computer and use it in GitHub Desktop.
MSI Afterburner VF curve parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
vfcurve = "0000020080000000000000000000E14300007F43000000000020E44300007F43000000000040E74300007F43000000000060EA4300007F43000000000080ED4300007F430000000000A0F04300007F430000000000C0F34300007F430000000000E0F64300007F43000000000000FA4300007F43000000000020FD4300007F43000000000020004400007F430000000000B0014400007F43000000000040034400007F430000000000D0044400007F43000000000060064400007F430000000000F0074400007F430000000000800944000096430000000000100B440080AC430000000000A00C440000C3430000000000300E440000D2430000000000C00F440080E84300000000005011440000FF430000000000E0124400C00A44000000000070144400401244000000000000164400801D440000000000901744000025440000000000201944004030440000000000B01A4400803B440000000000401C44000043440000000000D01D4400404E440000000000601F4400C055440000000000F0204400006144000000000080224400806844000000000010244400C073440000000000A0254400407B440000000000302744004083440000000000C02844000087440000000000502A4400C08A440000000000E02B44006090440000000000702D44002094440000000000002F4400E09744000000000090304400C09944000000000020324400809D440000000000B0334400609F4400000000004035440040A1440000000000D036440020A344000000000060384400E0A6440000000000F0394400C0A8440000000000803B4400A0AA440000000000103D440080AC440000000000A03E440040B04400000000003040440020B2440000000000C041440000B444000000000050434400E0B5440000000000E0444400C0B744000000000070464400A0B94400000000000048440080BB4400000000009049440040BF440000000000204B440020C1440000000000B04C440000C3440000000000404E4400E0C4440000000000D04F4400C0C644000000000060514400A0C8440000000000F052440080CA4400000000008054440060CC4400000000001056440060CC440000000000A057440040CE4400000000003059440020D0440000000000C05A440000D2440000000000505C4400E0D3440000000000E05D4400C0D5440000000000705F4400A0D744000000000000614400A0D74400000000009062440080D94400000000002064440060DB440000000000B065440040DD4400000000004067440020DF440000000000D068440020DF440000000000606A440000E1440000000000F06B4400E0E2440000000000806D4400E0E2440000000000106F4400C0E4440000000000A0704400A0E644000000000030724400A0E6440000000000C073440080E84400000000005075440080E8440000000000E076440060EA4400000000007078440040EC440000000000007A440040EC440000000000907B440020EE440000000000207D440020EE440000000000B07E440000F04400000000002080440000F0440000000000E880440000F0440000000000B0814400E0F144000000000078824400E0F144000000000040834400C0F344000000000008844400C0F3440000000000D0844400C0F344000000000098854400A0F544000000000060864400A0F544000000000028874400A0F5440000000000F0874400A0F5440000000000B888440080F74400000000008089440080F7440000000000488A440080F7440000000000108B440080F7440000000000D88B440060F9440000000000A08C440060F9440000000000688D440060F9440000000000308E440060F9440000000000F88E440060F9440000000000C08F440060F94400000000008890440060F94400000000005091440060F94400000000001892440060F9440000000000E092440060F9440000000000A893440060F94400000000007094440060F94400000000003895440060F94400000000000096440060F9440000000000C896440060F94400000000009097440060F94400000000005898440060F94400000000002099440060F9440000000000E899440060F9440000000000B09A440060F9440000000000789B440060F944000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000E0D3440000A64200E0D3440000A64200E0D3440000AC4200E0D3440000AC4200A0AA440000B44200A0AA440000B44200000000000000000000000000000000" | |
n = 8 | |
arr = [vfcurve[i:i + n] for i in range(0, len(vfcurve) - 1, n)] | |
shift = 10 | |
edit = "" | |
for i in range(3, len(arr) - 3, 3): | |
volt, freq, offset = struct.unpack('fff', bytearray.fromhex(arr[i] + arr[i + 1] + arr[i + 2])) | |
voltNext, freqNext, offsetNext = struct.unpack('fff', bytearray.fromhex(arr[i + shift * 3] + arr[i + shift * 3 + 1] + arr[i + shift * 3 + 2])) | |
if voltNext == 0: break | |
offset = freqNext - freq | |
print(volt, "mV", freq, "MHz", offset, "MHz", voltNext - volt, "mV") | |
bytearray = struct.pack('fff', volt, freq, offset) | |
edit += bytearray.hex() | |
newcurve = vfcurve[0:24] + edit + vfcurve[len(edit) + 24:len(vfcurve)] | |
print(newcurve) | |
# print(len(vfcurve), len(newcurve)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment