import os import struct import tempfile import unittest from unittest import mock import setup_tool_dynamic from setup_tool import WowSetupTool from setup_tool_dynamic import ModernWowSetupTool class FakeVar: def __init__(self, value): self.value = value def get(self): return self.value def set(self, value): self.value = value class VanillaTweaksNormalizationTests(unittest.TestCase): def _tool( self, *, fov, sound, quickloot, background, farclip=777, frill=300, nameplate=41, maxcam=100, laa=True, camera=True, custom_glues=True, crossfaction=False, bluemoon=False, ): tool = ModernWowSetupTool.__new__(ModernWowSetupTool) tool.vt_fov = FakeVar(fov) tool.vt_soundchan = FakeVar(sound) tool.vt_quickloot = FakeVar(quickloot) tool.vt_bg_sound = FakeVar(background) tool.vt_farclip = FakeVar(farclip) tool.vt_frill = FakeVar(frill) tool.vt_nameplate = FakeVar(nameplate) tool.vt_maxcam = FakeVar(maxcam) tool.vt_laa = FakeVar(laa) tool.vt_cam_fix = FakeVar(camera) tool.vt_crossfaction_res = FakeVar(crossfaction) tool.vt_custom_glues = FakeVar(custom_glues) tool.vt_bluemoon = FakeVar(bluemoon) tool.core_plugins = {"SuperWoWhook.dll": FakeVar(True)} return tool def _write_exe( self, root, quick1, quick2, background, fov, sound, *, farclip=777.0, frill=70.0, nameplate=20.0, maxcam=50.0, laa_patched=False, camera_patched=False, custom_patched=False, crossfaction_byte=0x01, bluemoon_bytes=None, filename="WoW_Modernized.exe", ): data = bytearray(0x46795C + 16) data[0x0C1ECF:0x0C1ED1] = quick1 data[0x0C2B25:0x0C2B27] = quick2 data[0x3A4869] = background data[0x126:0x128] = b"\x2F\x01" if laa_patched else b"\x0F\x01" for offset, original, patched in setup_tool_dynamic._CAMERA_REGIONS: selected = patched if camera_patched else original data[offset:offset + len(selected)] = selected for offset, original, patched in setup_tool_dynamic._CUSTOM_GLUES_SITES: data[offset] = patched if custom_patched else original struct.pack_into("