Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarbonNeuron committed Nov 26, 2020
1 parent ac27521 commit f16a0b2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AUCapture-WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@
<mah:MetroHeader Header="Game status:" Margin="0 0 0 5" Foreground="{DynamicResource MahApps.Brushes.Text}">
<TextBox x:Name="StatusBox" mah:TextBoxHelper.Watermark="UNKNOWN"
VerticalAlignment="Center" IsManipulationEnabled="True" Focusable="False"
IsHitTestVisible="False" AllowDrop="False" IsReadOnly="True" />
IsHitTestVisible="False" AllowDrop="False" IsReadOnly="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
</mah:MetroHeader>
</StatusBarItem>
<Separator Grid.Column="1" Style="{DynamicResource MahApps.Styles.Separator.StatusBar}" Foreground="{DynamicResource MahApps.Brushes.Text}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Stretch" />
<StatusBarItem Grid.Column="3" HorizontalAlignment="Right">
<mah:MetroHeader Header="Game code:" Margin="0 0 0 5" Foreground="{DynamicResource MahApps.Brushes.Text}">
<TextBox x:Name="GameCodeBox" Text="" mah:TextBoxHelper.Watermark="UNKNOWN"
ToolTip="Click to copy" VerticalAlignment="Center" Focusable="False" IsHitTestVisible="True"
AllowDrop="False" IsReadOnly="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" dialogs:TextBoxHelper.WatermarkAlignment="Right" />
AllowDrop="False" IsReadOnly="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" dialogs:TextBoxHelper.WatermarkAlignment="Right" VerticalContentAlignment="Center" />
</mah:MetroHeader>
</StatusBarItem>
</StatusBar>
Expand Down
13 changes: 11 additions & 2 deletions AUCapture-WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) =>
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions AmongUsCapture/Memory/GameMemReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()}.");

}

Expand Down Expand Up @@ -168,9 +168,13 @@ public void RunLoop()

try
{
prevChatBubsVersion = ProcessMemory.getInstance().Read<int>(GameAssemblyPtr,
CurrentOffsets.HudManagerOffset, 0x5C,
0, 0x28, 0xC, 0x14, 0x10);
if (CurrentOffsets is not null)
{
prevChatBubsVersion = ProcessMemory.getInstance().Read<int>(GameAssemblyPtr,
CurrentOffsets.HudManagerOffset, 0x5C,
0, 0x28, 0xC, 0x14, 0x10);
}

// prevGameOverReason = ProcessMemory.getInstance().Read<GameOverReason>(GameAssemblyPtr, _gameOffsets.TempDataOffset, 0x5c, 4);
}
catch
Expand All @@ -191,6 +195,7 @@ public void RunLoop()
continue;
}

if (CurrentOffsets is null) continue;
GameState state;
//int meetingHudState = /*meetingHud_cachePtr == 0 ? 4 : */ProcessMemory.ReadWithDefault<int>(GameAssemblyPtr, 4, 0xDA58D0, 0x5C, 0, 0x84); // 0 = Discussion, 1 = NotVoted, 2 = Voted, 3 = Results, 4 = Proceeding
var meetingHud = ProcessMemory.getInstance()
Expand Down

0 comments on commit f16a0b2

Please sign in to comment.