From a14041dbcfd99df50f7ef769029d230e5b46ae67 Mon Sep 17 00:00:00 2001 From: jamesbrq Date: Wed, 18 Sep 2024 15:59:48 -0400 Subject: [PATCH] Added Logging on stage enter --- worlds/gl/Arrays.py | 29 +++++++++++++++++++++++++++++ worlds/gl/GauntletLegendsClient.py | 14 +++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/worlds/gl/Arrays.py b/worlds/gl/Arrays.py index b1f0a5b547bb..1bfdd524acda 100644 --- a/worlds/gl/Arrays.py +++ b/worlds/gl/Arrays.py @@ -287,6 +287,35 @@ 0x113: infernal_fortress, } +level_names: Dict[int, str] = { + 0x11: "Castle Courtyard", + 0x12: "Dungeon of Torment", + 0x13: "Tower Armory", + 0x14: "Castle Treasury", + 0x15: "Chimera's Keep", + 0x21: "Valley of Fire", + 0x22: "Dagger Peak", + 0x23: "Cliffs of Desolation", + 0x24: "Lost Cave", + 0x25: "Volcanic Cavern", + 0x26: "Dragon's Lair", + 0x71: "Poisoned Fields", + 0x72: "Haunted Cemetery", + 0x73: "Venomous Spire", + 0x74: "Toxic Air Ship", + 0x75: "Vat of the Plague Fiend", + 0x81: "Gates of the Underworld", + 0x91: "Arctic Docks", + 0x92: "Frozen Camp", + 0x93: "Crystal Mine", + 0x94: "Erupting Fissure", + 0x95: "Yeti's Cavern", + 0xF1: "Desecrated Temple", + 0x111: "Battle Trenches", + 0x112: "Battle Towers", + 0x113: "Infernal Fortress", +} + # Count of all spawners in a level # Used for obj_read address offset calculation # Vaules are spawner difficulty diff --git a/worlds/gl/GauntletLegendsClient.py b/worlds/gl/GauntletLegendsClient.py index 9c9702091465..2d94a22ef9ef 100644 --- a/worlds/gl/GauntletLegendsClient.py +++ b/worlds/gl/GauntletLegendsClient.py @@ -1,4 +1,6 @@ import asyncio +import datetime +import os import socket import traceback from typing import List, Optional @@ -22,7 +24,7 @@ timers, sounds, colors, - vanilla, + vanilla, level_names, ) from .Items import ItemData, items_by_id from .Locations import LocationData @@ -278,6 +280,16 @@ async def obj_read(self, mode=0): _obj = [] b: RamChunk if self.offset == -1: + log_arr = [] + for i in range(5): + b = RamChunk(await self.socket.read(message_format(READ, f"0x{format(OBJ_ADDR, 'x')} {100}"))) + b.iterate(0x3C) + log_arr += [b.split] + output_folder = 'logs' + output_file = os.path.join(output_folder, f"[{datetime.datetime.now()}] Gauntlet Legends RAMSTATE: {level_names[self.current_level[1] << 0xF + self.current_level[0]]}.txt") + with open(output_file, 'w') as f: + for arr in log_arr: + f.write(" ".join(f"{byte:02x}" for byte in arr) + '\n') b = RamChunk(await self.socket.read(message_format(READ, f"0x{format(OBJ_ADDR, 'x')} {0x40 * 0x3C}"))) b.iterate(0x3C) for i, obj in enumerate(b.split):