Skip to content

Commit

Permalink
Update offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
stenlan committed Sep 24, 2020
1 parent 9388fed commit 845f527
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Binary file modified .vs/AmongUsCapture/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
23 changes: 16 additions & 7 deletions AmongUsCapture/GameMemReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ class GameMemReader
private bool shouldForceUpdate = false;
private bool shouldTransmitState = false;

private int AmongUsClientOffset = 0x1468840;
private int GameDataOffset = 0x1468864;
private int MeetingHudOffset = 0x14686A0;
private int GameStartManagerOffset = 0x0;
private int HudManagerOffset = 0x13EEB44;

public static GameMemReader getInstance()
{
return instance;
Expand Down Expand Up @@ -82,16 +88,16 @@ public void RunLoop()


Console.WriteLine($"({GameAssemblyPtr})");
prevChatBubsVersion = ProcessMemory.Read<int>(GameAssemblyPtr, 0xD0B25C, 0x5C, 0, 0x28, 0xC, 0x14, 0x10);
prevChatBubsVersion = ProcessMemory.Read<int>(GameAssemblyPtr, HudManagerOffset, 0x5C, 0, 0x28, 0xC, 0x14, 0x10);
}
}

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
IntPtr meetingHud = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, 0xDA58D0, 0x5C, 0);
IntPtr meetingHud = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, MeetingHudOffset, 0x5C, 0);
uint meetingHud_cachePtr = meetingHud == IntPtr.Zero ? 0 : ProcessMemory.Read<uint>(meetingHud, 0x8);
int meetingHudState = meetingHud_cachePtr == 0 ? 4 : ProcessMemory.ReadWithDefault<int>(meetingHud, 4, 0x84); // 0 = Discussion, 1 = NotVoted, 2 = Voted, 3 = Results, 4 = Proceeding
int gameState = ProcessMemory.Read<int>(GameAssemblyPtr, 0xDA5ACC, 0x5C, 0, 0x64); // 0 = NotJoined, 1 = Joined, 2 = Started, 3 = Ended (during "defeat" or "victory" screen only)
int gameState = ProcessMemory.Read<int>(GameAssemblyPtr, AmongUsClientOffset, 0x5C, 0, 0x64); // 0 = NotJoined, 1 = Joined, 2 = Started, 3 = Ended (during "defeat" or "victory" screen only)

if (gameState == 0)
{
Expand All @@ -115,7 +121,7 @@ public void RunLoop()
state = GameState.TASKS;
}

IntPtr allPlayersPtr = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, 0xDA5A60, 0x5C, 0, 0x24);
IntPtr allPlayersPtr = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, GameDataOffset, 0x5C, 0, 0x24);
IntPtr allPlayers = ProcessMemory.Read<IntPtr>(allPlayersPtr, 0x08);
int playerCount = ProcessMemory.Read<int>(allPlayersPtr, 0x0C);

Expand All @@ -124,7 +130,7 @@ public void RunLoop()
// check if exile causes end
if (oldState == GameState.DISCUSSION && state == GameState.TASKS)
{
byte exiledPlayerId = ProcessMemory.ReadWithDefault<byte>(GameAssemblyPtr, 255, 0xDA58D0, 0x5C, 0, 0x94, 0x08);
byte exiledPlayerId = ProcessMemory.ReadWithDefault<byte>(GameAssemblyPtr, 255, MeetingHudOffset, 0x5C, 0, 0x94, 0x08);
int impostorCount = 0, innocentCount = 0;

for (int i = 0; i < playerCount; i++)
Expand Down Expand Up @@ -275,8 +281,8 @@ public void RunLoop()
}
}

IntPtr chatBubblesPtr = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, 0xD0B25C, 0x5C, 0, 0x28, 0xC, 0x14);
int poolSize = 20; // = ProcessMemory.Read<int>(GameAssemblyPtr, 0xD0B25C, 0x5C, 0, 0x28, 0xC, 0xC)
IntPtr chatBubblesPtr = ProcessMemory.Read<IntPtr>(GameAssemblyPtr, HudManagerOffset, 0x5C, 0, 0x28, 0xC, 0x14);
int poolSize = 20; // = ProcessMemory.Read<int>(GameAssemblyPtr, 0x13EEB44, 0x5C, 0, 0x28, 0xC, 0xC)
int numChatBubbles = ProcessMemory.Read<int>(chatBubblesPtr, 0xC);
int chatBubsVersion = ProcessMemory.Read<int>(chatBubblesPtr, 0x10);
IntPtr chatBubblesAddr = ProcessMemory.Read<IntPtr>(chatBubblesPtr, 0x8) + 0x10;
Expand Down Expand Up @@ -328,6 +334,9 @@ public void RunLoop()
});
}

//string gameCode = ProcessMemory.ReadString(ProcessMemory.Read<IntPtr>(GameAssemblyPtr, GameStartManagerOffset, 0x5c, 0, 0x20, 0x28));
//Console.WriteLine(gameCode);

Thread.Sleep(250);
}
}
Expand Down
2 changes: 1 addition & 1 deletion AmongUsCapture/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace AmongUsCapture
{
static class Program
{
private static bool debugGui = false;
private static bool debugGui = true;
public static ConsoleInterface conInterface = null;
/// <summary>
/// The main entry point for the application.
Expand Down

0 comments on commit 845f527

Please sign in to comment.