Skip to content

Commit

Permalink
Misc bugs (thanks photo)
Browse files Browse the repository at this point in the history
  • Loading branch information
denverquane committed Sep 20, 2020
1 parent 4026e67 commit bbf6635
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
30 changes: 15 additions & 15 deletions AmongUsCapture/DebugConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ public void Run()
GameMemReader.getInstance().GameStateChanged += GameStateChangedHandler;
GameMemReader.getInstance().PlayerChanged += PlayerChangedHandler;

//while(true)
//{
// string command = Console.ReadLine();
// Console.WriteLine($"Received command: {command}");
// if (command == "list")
// {
// Console.WriteLine("Player List:");
// foreach (KeyValuePair<string, PlayerInfo> kvp in GameMemReader.getInstance().oldPlayerInfos) // thread safety ??
// {
// string playerName = kvp.Key;
// PlayerInfo pi = kvp.Value;
// Console.WriteLine(kvp.Key);
// }
// }
//}
while (true)
{
string command = Console.ReadLine();
Console.WriteLine($"Received command: {command}");
if (command == "list")
{
Console.WriteLine("Player List:");
foreach (KeyValuePair<string, PlayerInfo> kvp in GameMemReader.getInstance().oldPlayerInfos) // thread safety ??
{
string playerName = kvp.Key;
PlayerInfo pi = kvp.Value;
Console.WriteLine(kvp.Key);
}
}
}

Thread.Sleep(Timeout.Infinite);
}
Expand Down
1 change: 1 addition & 0 deletions AmongUsCapture/GameMemReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void RunLoop()
{
IntPtr playerAddr = ProcessMemory.Read<IntPtr>(playerAddrPtr);
PlayerInfo pi = ProcessMemory.Read<PlayerInfo>(playerAddr);
if (pi.PlayerName == 0) { continue; }
string playerName = pi.GetPlayerName();

newPlayerInfos[playerName] = pi; // add to new playerinfos for comparison later
Expand Down
2 changes: 1 addition & 1 deletion AmongUsCapture/PlayerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AmongUsCapture
public struct PlayerInfo
{
[System.Runtime.InteropServices.FieldOffset(8)] public byte PlayerId;
[System.Runtime.InteropServices.FieldOffset(12)] public int PlayerName;
[System.Runtime.InteropServices.FieldOffset(12)] public uint PlayerName;
[System.Runtime.InteropServices.FieldOffset(16)] public byte ColorId;
[System.Runtime.InteropServices.FieldOffset(20)] public uint HatId;
[System.Runtime.InteropServices.FieldOffset(24)] public uint PetId;
Expand Down

0 comments on commit bbf6635

Please sign in to comment.