diff --git a/TF2.CT b/TF2.CT index d9e4adf..7fc84cf 100644 --- a/TF2.CT +++ b/TF2.CT @@ -7,23 +7,21 @@ 1 "Health (single player) (engine.dll+1122A8DC)" - 4 Bytes
engine.dll+1122A8DC
2 "Player velocity (client.dll+2A9F704)" - Float
client.dll+2A9F704
3 "Map name (multiplayer) (client.dll+23E0FA0)" - + 0 String - 10 + 16 0 0 1 @@ -32,7 +30,6 @@ 4 "Map name (single player) (server.dll+C9BE64)" - String 10 0 @@ -43,7 +40,6 @@ 5 "maybe correct map name (client.dll+B34522)" - String 20 0 @@ -51,52 +47,21 @@ 1
client.dll+B34522
- - 6 - "Possible map name as friendly string (multiplayer) (engine.dll+1397AC5B)" - - String - 17 - 0 - 0 - 1 -
engine.dll+1397AC5B
-
- - 28 - "Mission name (single player) (engine.dll+1397AC5A)" - - String - 14 - 0 - 0 - 1 -
engine.dll+1397AC5A
-
7 "maybe match time?" - 4 Bytes
client.dll+FAF274
8 "maybe match time?" - 4 Bytes
client.dll+FAF23C
- - 9 - "Health (multiplayer) (engine.dll+1123CF64) (wrong)" - - 4 Bytes -
engine.dll+1123CF64
-
34 - "Any of these is my score" + "Any of these is my score (the offset keeps changing for my player's score)" 1
0
@@ -104,42 +69,36 @@ 31 "bruh" - 4 Bytes
engine.dll+1123D53C
32 "No description" - 4 Bytes
engine.dll+1129DE80
33 "No description" - 4 Bytes
engine.dll+1129DE88
36 "No description" - 4 Bytes
engine.dll+1123D534
37 "No description" - 4 Bytes
engine.dll+113B6FC4
38 "No description" - 4 Bytes
engine.dll+113B6FCC
@@ -155,29 +114,25 @@ 29 "My pilot kills (engine.dll+1123D2A8)" - 4 Bytes
engine.dll+1123D2A8
30 "My minion kills (engine.dll+1123D3B0)" - 4 Bytes
engine.dll+1123D3B0
35 "My team's score" - 0 4 Bytes
engine.dll+1121814C
21 - "Enemy team's score" - + "Enemy team's score (my team's score in bounty hunt)" 4 Bytes
engine.dll+11218CA0
@@ -193,21 +148,18 @@ 22 "No description" - 4 Bytes
engine.dll+1123469C
23 "No description" - 4 Bytes
engine.dll+112346A4
24 "No description" - 4 Bytes
engine.dll+1123D514
@@ -215,8 +167,7 @@
27 - "Game mode name (mp) (maybe) (engine.dll+1397AC4E)" - + "Full game mode and map name (engine.dll+1397AC4E)" 0 String 50 @@ -234,22 +185,19 @@ 39 - "No description" - + "My team's score" 4 Bytes
engine.dll+11218CA0
40 "Bounty hunt bonus" - 4 Bytes
engine.dll+1123D48C
41 - "No description" - + "My score" 4 Bytes
engine.dll+1123D510
@@ -257,8 +205,8 @@
43 - "Difficulty (engine.dll+130DAD47)" - + "Difficulty (engine.dll+130DAD47) (investigate wtf this is)" + 0 String 6 0 @@ -269,7 +217,6 @@ 44 "Campaign difficulty (server.dll+C0963C)" - Byte
server.dll+C0963C
diff --git a/assets/icons/playlists/2_ahp.png b/assets/icons/playlists/2_ahp.png new file mode 100644 index 0000000..a6168d9 Binary files /dev/null and b/assets/icons/playlists/2_ahp.png differ diff --git a/assets/icons/playlists/2_at.png b/assets/icons/playlists/2_at.png new file mode 100644 index 0000000..a58b092 Binary files /dev/null and b/assets/icons/playlists/2_at.png differ diff --git a/assets/icons/playlists/2_bh.png b/assets/icons/playlists/2_bh.png new file mode 100644 index 0000000..e8bc1a1 Binary files /dev/null and b/assets/icons/playlists/2_bh.png differ diff --git a/assets/icons/playlists/2_ctf.png b/assets/icons/playlists/2_ctf.png new file mode 100644 index 0000000..70b6871 Binary files /dev/null and b/assets/icons/playlists/2_ctf.png differ diff --git a/assets/icons/playlists/2_glitch.gif b/assets/icons/playlists/2_glitch.gif new file mode 100644 index 0000000..2c57090 Binary files /dev/null and b/assets/icons/playlists/2_glitch.gif differ diff --git a/assets/icons/playlists/2_glitch.pdn b/assets/icons/playlists/2_glitch.pdn new file mode 100644 index 0000000..82e2ed9 Binary files /dev/null and b/assets/icons/playlists/2_glitch.pdn differ diff --git a/assets/icons/playlists/2_lf.png b/assets/icons/playlists/2_lf.png new file mode 100644 index 0000000..0c88738 Binary files /dev/null and b/assets/icons/playlists/2_lf.png differ diff --git a/assets/icons/playlists/2_lts.png b/assets/icons/playlists/2_lts.png new file mode 100644 index 0000000..99317f1 Binary files /dev/null and b/assets/icons/playlists/2_lts.png differ diff --git a/assets/icons/playlists/2_pvp.png b/assets/icons/playlists/2_pvp.png new file mode 100644 index 0000000..4e5f44d Binary files /dev/null and b/assets/icons/playlists/2_pvp.png differ diff --git a/assets/icons/playlists/2_ttdm.png b/assets/icons/playlists/2_ttdm.png new file mode 100644 index 0000000..094f372 Binary files /dev/null and b/assets/icons/playlists/2_ttdm.png differ diff --git a/assets/icons/playlists/README.md b/assets/icons/playlists/README.md new file mode 100644 index 0000000..c9cd8ba --- /dev/null +++ b/assets/icons/playlists/README.md @@ -0,0 +1,9 @@ +# Playlist Icons + +These are the icons that show up when selecting what game modes you want to queue for. The screenshot blow shows these icons. They're a little rough around the edges but they should be fine given my intent to use them as the "small image" in Discord's Rich Presence status. + +![image](https://user-images.githubusercontent.com/6992149/130292150-468a9ebf-dec9-4c6f-af03-a1cfd7970ae2.png) + +## Source + +I nabbed these from the Remnant Fleet Discord server. These icons are the work of mrvn4 (Octo#8859). diff --git a/assets/icons/playlists/playlists.svg b/assets/icons/playlists/playlists.svg new file mode 100644 index 0000000..c1a6bd3 --- /dev/null +++ b/assets/icons/playlists/playlists.svg @@ -0,0 +1,60 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/assets/ripped textures/README.md b/assets/ripped textures/README.md new file mode 100644 index 0000000..c5a1aa6 --- /dev/null +++ b/assets/ripped textures/README.md @@ -0,0 +1,3 @@ +# Ripped Textures + +These are textures ripped from the game while it was running. This was accomplished using [NinjaRipper](https://ninjaripper.com/download.php) version [1.7.1](https://www.mediafire.com/file/z1w91t5keytvq3r/ninjaripper1.7.1_with_new_script.7z). \ No newline at end of file diff --git a/assets/ripped textures/Tex_0387_1.dds b/assets/ripped textures/Tex_0387_1.dds new file mode 100644 index 0000000..ca27b65 Binary files /dev/null and b/assets/ripped textures/Tex_0387_1.dds differ diff --git a/assets/ripped textures/Tex_0407_1.dds b/assets/ripped textures/Tex_0407_1.dds new file mode 100644 index 0000000..764d4af Binary files /dev/null and b/assets/ripped textures/Tex_0407_1.dds differ diff --git a/titanfall2-rp/Program.cs b/titanfall2-rp/Program.cs index 3185c81..3c3c52a 100644 --- a/titanfall2-rp/Program.cs +++ b/titanfall2-rp/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Text.RegularExpressions; using System.Threading; using DiscordRPC; using DiscordRPC.Logging; @@ -50,7 +51,7 @@ static void Main(string[] args) public static void SetCurrentPresence(DiscordRpcClient client, Titanfall2Api tf2Api) { - var (gameDetails, gameState, timestamps) = GetDetailsAndState(tf2Api); + var (gameDetails, gameState, timestamps, assets) = GetDetailsAndState(tf2Api); //Set the rich presence //Call this as many times as you want and anywhere in your code. client.SetPresence(new RichPresence() @@ -58,25 +59,27 @@ public static void SetCurrentPresence(DiscordRpcClient client, Titanfall2Api tf2 Details = gameDetails, State = gameState, Timestamps = timestamps, - Assets = new Assets() + Assets = assets == null ? new Assets() { LargeImageKey = "icon-900x900", LargeImageText = "Large Image Text", // SmallImageKey = "image_small" - } + } : assets }); } - public static (string, string, Timestamps) GetDetailsAndState(Titanfall2Api tf2Api) + public static (string, string, Timestamps, Assets assets) GetDetailsAndState(Titanfall2Api tf2Api) { + Regex rg = new Regex(""); string gameDetails = ""; string gameState = ""; Timestamps timestamps = null; + Assets assets = null; if (tf2Api.GetGameModeName().Contains("Campaign")) { gameDetails = "Campaign (" + tf2Api.GetSinglePlayerDifficulty() + ")"; - gameState = tf2Api.GetSinglePlayerMissionName(); + gameState = tf2Api.GetFriendlyMapName(); timestamps = new Timestamps(StartTimestamp); } else if (tf2Api.GetMultiplayerMapName().Equals("mp_lobby")) @@ -84,6 +87,11 @@ public static (string, string, Timestamps) GetDetailsAndState(Titanfall2Api tf2A gameDetails = "In a lobby"; timestamps = new Timestamps(StartTimestamp); } + else if (tf2Api.GetGameModeAndMapName().Contains("Attrition")) + { + gameDetails = tf2Api.GetGameModeName(); + gameState = tf2Api.GetFriendlyMapName(); + } // Could be main menu, might be some other random thing. This can be cleaned up later else { @@ -91,7 +99,7 @@ public static (string, string, Timestamps) GetDetailsAndState(Titanfall2Api tf2A timestamps = new Timestamps(StartTimestamp); } - return (gameDetails, gameState, timestamps); + return (gameDetails, gameState, timestamps, assets); } } } \ No newline at end of file diff --git a/titanfall2-rp/Titanfall2API.cs b/titanfall2-rp/Titanfall2API.cs index ea85980..588ebc6 100644 --- a/titanfall2-rp/Titanfall2API.cs +++ b/titanfall2-rp/Titanfall2API.cs @@ -1,5 +1,6 @@ using System; using System.Text; +using System.Text.RegularExpressions; using Process.NET; using static titanfall2_rp.ProcessApi; @@ -7,6 +8,7 @@ namespace titanfall2_rp { public class Titanfall2Api { + private static readonly Regex gameModeAndMapRegex = new Regex("Playing (.*) on (.*)"); private ProcessSharp _sharp; private IntPtr _engineDllBaseAddress; private IntPtr _clientDllBaseAddress; @@ -24,16 +26,25 @@ public int GetPlayerVelocity() return _sharp.Memory.Read(_clientDllBaseAddress + 0x2A9F704); } + public string GetGameModeAndMapName() + { + _ensureInit(); + return _sharp.Memory.Read(_engineDllBaseAddress + 0x1397AC46, Encoding.UTF8, 50); + } + public string GetFriendlyMapName() { _ensureInit(); - return _sharp.Memory.Read(_engineDllBaseAddress + 0x1397AC5A); + var m = gameModeAndMapRegex.Match(GetGameModeAndMapName()); + return m.Success ? m.Groups[2].Value : "UNKNOWN MAP NAME"; } public string GetGameModeName() { _ensureInit(); - return _sharp.Memory.Read(_engineDllBaseAddress + 0x1397AC46, Encoding.UTF8, 50); + var m = gameModeAndMapRegex.Match(GetGameModeAndMapName()); + return m.Success ? m.Groups[1].Value : "UNKNOWN GAME MODE"; + } public string GetMultiplayerMapName() @@ -45,13 +56,7 @@ public string GetMultiplayerMapName() public string GetSinglePlayerMapName() { _ensureInit(); - return _sharp.Memory.Read(_serverDllBaseAddress + 0xC9BE64); - } - - public string GetSinglePlayerMissionName() - { - _ensureInit(); - return _sharp.Memory.Read(_engineDllBaseAddress + 0x1397AC5A, Encoding.UTF8, 14); + return _sharp.Memory.Read(_serverDllBaseAddress + 0xC9BE64, Encoding.UTF8, 50); } public string GetSinglePlayerDifficulty() @@ -72,6 +77,10 @@ public string GetSinglePlayerDifficulty() return "UNKNOWN DIFFICULTY"; } + /// + /// Inside this class are multiplayer subclasses for each game mode (because the stats are different + /// based on the game type. They'll also be in different memory locations). + /// class MultiPlayerGameStats { class Attrition { }