diff --git a/AUCapture-WPF/MainWindow.xaml b/AUCapture-WPF/MainWindow.xaml index 10443dfe..79c1ec61 100644 --- a/AUCapture-WPF/MainWindow.xaml +++ b/AUCapture-WPF/MainWindow.xaml @@ -210,7 +210,7 @@ + IsHitTestVisible="False" AllowDrop="False" IsReadOnly="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" /> @@ -218,7 +218,7 @@ + AllowDrop="False" IsReadOnly="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" dialogs:TextBoxHelper.WatermarkAlignment="Right" VerticalContentAlignment="Center" /> diff --git a/AUCapture-WPF/MainWindow.xaml.cs b/AUCapture-WPF/MainWindow.xaml.cs index 162bac28..87727ed2 100644 --- a/AUCapture-WPF/MainWindow.xaml.cs +++ b/AUCapture-WPF/MainWindow.xaml.cs @@ -19,6 +19,8 @@ using ControlzEx.Theming; using MahApps.Metro.Controls; using MahApps.Metro.Controls.Dialogs; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Color = System.Drawing.Color; namespace AUCapture_WPF @@ -73,6 +75,7 @@ public MainWindow() GameMemReader.getInstance().PlayerChanged += UserForm_PlayerChanged; GameMemReader.getInstance().ChatMessageAdded += OnChatMessageAdded; GameMemReader.getInstance().JoinedLobby += OnJoinedLobby; + GameMemReader.getInstance().GameOver += OnGameOver; IPCAdapter.getInstance().OnToken += (sender, token) => { this.BeginInvoke((w) => { @@ -109,7 +112,13 @@ public MainWindow() }); //ApplyDarkMode(); } - + + private void OnGameOver(object? sender, GameOverEventArgs e) + { + WriteConsoleLineFormatted("GameOver", Color.BlueViolet, JsonConvert.SerializeObject(e, Formatting.None, new StringEnumConverter())); + Console.WriteLine(JsonConvert.SerializeObject(e, Formatting.Indented)); + } + private void UserForm_PlayerChanged(object sender, PlayerChangedEventArgs e) { @@ -327,7 +336,7 @@ public void WriteColoredText(string ColoredText) } tb.Document.Blocks.Add(paragraph); tb.ScrollToEnd(); - }, DispatcherPriority.Send); + }, DispatcherPriority.Input); } private void MetroWindow_Loaded(object sender, RoutedEventArgs e) diff --git a/AmongUsCapture/Memory/GameMemReader.cs b/AmongUsCapture/Memory/GameMemReader.cs index 7fdb77ed..91e1f2fc 100644 --- a/AmongUsCapture/Memory/GameMemReader.cs +++ b/AmongUsCapture/Memory/GameMemReader.cs @@ -140,7 +140,7 @@ public void RunLoop() { Settings.conInterface.WriteModuleTextColored("GameMemReader", Color.Lime, - $"No offsets found for: {Color.Aqua.ToTextColor()}{GameAssemblyhashSb.ToString()}."); + $"No offsets found for: {Color.Aqua.ToTextColor()}{GameAssemblyhashSb.ToString()}{Settings.conInterface.getNormalColor().ToTextColor()}."); } @@ -168,9 +168,13 @@ public void RunLoop() try { - prevChatBubsVersion = ProcessMemory.getInstance().Read(GameAssemblyPtr, - CurrentOffsets.HudManagerOffset, 0x5C, - 0, 0x28, 0xC, 0x14, 0x10); + if (CurrentOffsets is not null) + { + prevChatBubsVersion = ProcessMemory.getInstance().Read(GameAssemblyPtr, + CurrentOffsets.HudManagerOffset, 0x5C, + 0, 0x28, 0xC, 0x14, 0x10); + } + // prevGameOverReason = ProcessMemory.getInstance().Read(GameAssemblyPtr, _gameOffsets.TempDataOffset, 0x5c, 4); } catch @@ -191,6 +195,7 @@ public void RunLoop() continue; } + if (CurrentOffsets is null) continue; GameState state; //int meetingHudState = /*meetingHud_cachePtr == 0 ? 4 : */ProcessMemory.ReadWithDefault(GameAssemblyPtr, 4, 0xDA58D0, 0x5C, 0, 0x84); // 0 = Discussion, 1 = NotVoted, 2 = Voted, 3 = Results, 4 = Proceeding var meetingHud = ProcessMemory.getInstance()