From 8c38ca2380d7a8a627d319a437b59c64c134171f Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Sun, 24 Nov 2024 18:27:34 +0900 Subject: [PATCH] m1n1.agx: Misc fixes to make m1n1 mode work again Signed-off-by: Asahi Lina --- proxyclient/m1n1/agx/initdata.py | 12 ++++----- proxyclient/m1n1/agx/render.py | 8 +++--- proxyclient/m1n1/fw/agx/initdata.py | 38 +++++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/proxyclient/m1n1/agx/initdata.py b/proxyclient/m1n1/agx/initdata.py index 1a49d339..d92b5e07 100644 --- a/proxyclient/m1n1/agx/initdata.py +++ b/proxyclient/m1n1/agx/initdata.py @@ -536,10 +536,10 @@ def build_initdata(agx): if cs_pstates: hwdata.cs_max_pstate = cs_pstates.count - 1 hwdata.cs_frequencies = [(ps.freq // 1000000) - for ps in cs_pstates.states] + [0] * (16 - cs_pstates.count) + for ps in cs_pstates.states[0]] + [0] * (16 - cs_pstates.count) hwdata.cs_voltages = [[(ps.volt // 1000), 0] - for ps in cs_pstates.states] + [[0, 0]] * (16 - cs_pstates.count) - hwdata.cs_voltages_sram = [[max(i[0], cs_pstates.min_sram_volt // 1000) if i[0] else 0, 0] for i in hwdata.cs_voltages] + for ps in cs_pstates.states[0]] + [[0, 0]] * (16 - cs_pstates.count) + hwdata.cs_voltages_sram = [[max(i[0], cs_pstates.min_sram_volt[0] // 1000) if i[0] else 0, 0] for i in hwdata.cs_voltages] else: hwdata.cs_max_pstate = 0 hwdata.cs_frequencies = [0] * 16 @@ -550,10 +550,10 @@ def build_initdata(agx): if afr_pstates: hwdata.afr_max_pstate = afr_pstates.count - 1 hwdata.afr_frequencies = [(ps.freq // 1000000) - for ps in afr_pstates.states] + [0] * (8 - afr_pstates.count) + for ps in afr_pstates.states[0]] + [0] * (8 - afr_pstates.count) hwdata.afr_voltages = [[(ps.volt // 1000), 0] - for ps in afr_pstates.states] + [[0, 0]] * (8 - afr_pstates.count) - hwdata.afr_voltages_sram = [[max(i[0], afr_pstates.min_sram_volt // 1000) if i[0] else 0, 0] for i in hwdata.afr_voltages] + for ps in afr_pstates.states[0]] + [[0, 0]] * (8 - afr_pstates.count) + hwdata.afr_voltages_sram = [[max(i[0], afr_pstates.min_sram_volt[0] // 1000) if i[0] else 0, 0] for i in hwdata.afr_voltages] else: hwdata.afr_max_pstate = 0 hwdata.afr_frequencies = [0] * 8 diff --git a/proxyclient/m1n1/agx/render.py b/proxyclient/m1n1/agx/render.py index ae351348..9f584041 100644 --- a/proxyclient/m1n1/agx/render.py +++ b/proxyclient/m1n1/agx/render.py @@ -850,7 +850,7 @@ class GPURenderer: if Ver.check("V >= V13_0B4"): ts1.unk_ts_addr = wc_3d.unk_ts._addr ts1.uuid = uuid_3d - ts1.unk_30_padding = 0x0 + ts1.unk_30 = 0x0 ms.append(ts1) if Ver.check("G >= G14X"): @@ -870,7 +870,7 @@ class GPURenderer: if Ver.check("V >= V13_0B4"): ts2.unk_ts_addr = wc_3d.unk_ts._addr ts2.uuid = uuid_3d - ts2.unk_30_padding = 0x0 + ts2.unk_30 = 0x0 ms.append(ts2) finish_3d = Finalize3DCmd() @@ -1202,7 +1202,7 @@ class GPURenderer: if Ver.check("V >= V13_0B4"): ts1.unk_ts_addr = wc_ta.unk_ts._addr ts1.uuid = uuid_ta - ts1.unk_30_padding = 0x0 + ts1.unk_30 = 0x0 ms.append(ts1) if Ver.check("G >= G14X"): @@ -1222,7 +1222,7 @@ class GPURenderer: if Ver.check("V >= V13_0B4"): ts2.unk_ts_addr = wc_ta.unk_ts._addr ts2.uuid = uuid_ta - ts2.unk_30_padding = 0x0 + ts2.unk_30 = 0x0 ms.append(ts2) finish_ta = FinalizeTACmd() diff --git a/proxyclient/m1n1/fw/agx/initdata.py b/proxyclient/m1n1/fw/agx/initdata.py index 2d174548..316a9240 100644 --- a/proxyclient/m1n1/fw/agx/initdata.py +++ b/proxyclient/m1n1/fw/agx/initdata.py @@ -1738,6 +1738,17 @@ class PerfCounterDesc(ConstructClass): "pad0" / Int8ul, "pad1" / Int32ul, ) + def __init__(self): + self.regs = 0 + self.dis_mask = 0 + self.en_mask = 0 + self.source_mask = 0 + self.base_reg = 0 + self.unk_type = 0 + self.count = 0 + self.index = 0 + self.pad0 = 0 + self.pad1 = 0 class InitData_RegionC(ConstructClass): subcon = Struct( @@ -1904,11 +1915,28 @@ class InitData_RegionC(ConstructClass): self.unk_62 = 0 self.unk_66_0 = bytes(0xc) self.unk_66 = 1 - self.unk_6a = bytes(0x16) - self.unk_80 = bytes(0xf80) - self.unk_1000 = bytes(0x7000) - self.unk_8000 = bytes(0x900) - self.unk_8900_0 = 0 + self.unk_6a = bytes(0x12) + + self.perfctrs = [PerfCounterDesc() for i in range(512)] + self.perfctr_count = 0 + self.unk_4080 = bytes(0x3f80) + self.unk_8000 = bytes(0x878) + self.unk_8878 = 0 + self.unk_887c = 0 + self.unk_8880 = bytes(0x10) + self.unk_8890 = 0 + + self.unkptr_8894 = 0 + self.size_889c = 0 + self.unkptr_88a0 = 0 + self.perf_source_list = 0 + self.perf_source_count = 0 + self.unkptr_88b4 = 0 + self.unk_88bc = 0 + self.unk_88c0 = 0 + self.unk_88c2 = 0 + self.unkpad_88c3 = 0 + self.unk_88c4 = 0 self.unk_8900 = 1 # Accessed with OSIncrementAtomic/OSDecrementAtomic self.unk_atomic = 0