@@ -1208,65 +1208,17 @@ bool Client::Init() {
12081208
12091209 /* Boards integration, this gets messy lol */
12101210 if (sar.game ->Is (SourceGame_Portal2) || sar.game ->Is (SourceGame_PortalStoriesMel)) {
1211- #ifdef _WIN32
1212- /* left xrefs here so they are easier to find if different in linux mods */
1213-
1214- // @ xref: "#PORTAL2_LeaderboardOnlineWarning_Steam"
1215- auto CPortalLeaderboardPanel_OnThink = Memory::Scan (this ->Name (), " 55 8B EC A1 ? ? ? ? 81 EC ? ? ? ? 53 56 32 DB" );
1216-
1217- // @ xref: "OnProfilesChanged" [CPortalLeaderboardManager::OnEvent]
1218- // .text:003DE52F 68 6C 87 76 00 push offset aOnprofileschan ; "OnProfilesChanged"
1219- // .text:003DE534 E8 37 D0 25 00 call sub_63B570
1220- // ... next fn call
1221- // .text:003DE544 E8 37 FF FF FF call CUtlStringMap_CPortalLeaderboard_ptr__PurgeAndDeleteElements
1222- Client::PurgeAndDeleteElements = Memory::Read<decltype (Client::PurgeAndDeleteElements)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 8D 4E 24 E8 ? ? ? ? 5F" , 1 ));
1223-
1224- // @ xref: "LocatorBG" [CLocatorPanel::PerformLayout]
1225- // .text:00157EAB 68 C0 6A 78 00 push offset aLocatorbg ; "LocatorBG"
1226- // ... last fn call
1227- // .text:00157F0C E8 DF 7B 4F 00 call Panel__SetPos
1228- Panel_SetPos = Memory::Read<decltype (Panel_SetPos)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 03 5D F0" , 1 ));
1229-
1230- // @ xref: "crosshair_default" [CHudCrosshair::ApplySchemeSettings]
1231- // .text:00151B1F 68 6C 5E 78 00 push offset aCrosshairDefau ; "crosshair_default"
1232- // ... last fn call
1233- // .text:00151B52 E8 19 E0 4F 00 call Panel__SetSize
1234- Panel_SetSize = Memory::Read<decltype (Panel_SetSize)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 01 7D EC" , 1 ));
1235-
1236- // @ xref: "portal_leaderboard_avatar_panel" [BaseModUI::AddAvatarPanelItem]
1237- // .text:0036000E 68 18 06 80 00 push offset aPortalLeaderbo ; "portal_leaderboard_avatar_panel"
1238- // ... next fn call
1239- // .text:00360050 E8 6B DD FF FF call CAvatarPanelItem__SetPlayerData
1240- Client::SetPlayerData = Memory::Read<decltype (Client::SetPlayerData)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? EB 2C A1 ? ? ? ?" , 1 ));
1241-
1242- // @ xref: "Avatar image for user %llX cached [refcount=%d]\n" [BaseModUI::CUIGameData::AccessAvatarImage]
1243- // .text:00318CCF E8 8C 60 E5 FF call IMemAlloc__Alloc
1244- // ... next fn call
1245- // .text:00318CDD E8 8E B5 FF FF call CGameUiAvatarImage__CGameUiAvatarImage
1246- // ...
1247- // .text:00318D98 68 30 60 7E 00 push offset aAvatarImageFor ; "Avatar image for user %llX cached [refc"...
1248- CGameUiAvatarImage_Ctor = (decltype (CGameUiAvatarImage_Ctor))Memory::Scan (this ->Name (), " 56 6A 00 8B F1 6A 00 C7 06" );
1249-
1250- // @ xref: "icon_lobby" (fn with Plat_FloatTime call)
1251- CGameUiAvatarImage_InitFromRGBA = Memory::Read<decltype (CGameUiAvatarImage_InitFromRGBA)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 8A 46 1C" , 1 ));
1252-
1253- // @ xref: "steamid/%llu" (small fn with only one string)
1254- Client::ActivateSelectedItem = (decltype (Client::ActivateSelectedItem))Memory::Scan (this ->Name (), " 55 8B EC 83 EC 40 56 8B F1 E8 ? ? ? ? 8B C8" );
1255- #else
1256- /* I reversed these from mel binaries so idk how many work in base game */
1257-
1258- auto CPortalLeaderboardPanel_OnThink = Memory::Scan (this ->Name (), " 55 89 E5 57 56 53 81 EC ? ? ? ? 65 A1 ? ? ? ? 89 45 E4 31 C0 A1 ? ? ? ? 8B 5D 08 8B 70 30" );
1259- Client::PurgeAndDeleteElements = Memory::Read<decltype (Client::PurgeAndDeleteElements)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 8B 46 10 89 46 20 89 3C 24" , 1 ));
1260-
1261- // XXX: these two had weird looking function signature in IDA, might not work
1262- Panel_SetPos = Memory::Read<decltype (Panel_SetPos)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 2B 75 D8" , 1 ));
1263- Panel_SetSize = Memory::Read<decltype (Panel_SetSize)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? EB 68 66 90" , 1 ));
1264-
1265- Client::SetPlayerData = Memory::Read<decltype (Client::SetPlayerData)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 8B 45 D8 89 83 ? ? ? ? 8B 45 DC 85 C0 75 82" , 1 ));
1266- CGameUiAvatarImage_Ctor = Memory::Read<decltype (CGameUiAvatarImage_Ctor)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 8B 45 18 89 74 24 04 89 7C 24 08" , 1 ));
1267- CGameUiAvatarImage_InitFromRGBA = Memory::Read<decltype (CGameUiAvatarImage_InitFromRGBA)>(Memory::Scan (this ->Name (), " E8 ? ? ? ? 0F B6 43 1C" , 1 ));
1268- Client::ActivateSelectedItem = (decltype (Client::ActivateSelectedItem))Memory::Scan (this ->Name (), " 55 89 E5 53 83 EC 74 65 A1" );
1211+ auto CPortalLeaderboardPanel_OnThink = Memory::Scan (this ->Name (), Offsets::CPortalLeaderboardPanel_OnThink);
1212+ Client::PurgeAndDeleteElements = Memory::Read<decltype (Client::PurgeAndDeleteElements)>(Memory::Scan (this ->Name (), Offsets::PurgeAndDeleteElements, 1 ));
1213+ Panel_SetPos = Memory::Read<decltype (Panel_SetPos)>(Memory::Scan (this ->Name (), Offsets::Panel_SetPos, 1 ));
1214+ Panel_SetSize = Memory::Read<decltype (Panel_SetSize)>(Memory::Scan (this ->Name (), Offsets::Panel_SetSize, 1 ));
1215+ Client::SetPlayerData = Memory::Read<decltype (Client::SetPlayerData)>(Memory::Scan (this ->Name (), Offsets::SetPlayerData, 1 ));
1216+ CGameUiAvatarImage_Ctor = (decltype (CGameUiAvatarImage_Ctor))Memory::Scan (this ->Name (), Offsets::CGameUiAvatarImage_CtorSig, Offsets::CGameUiAvatarImage_CtorOff);
1217+ #ifndef _WIN32
1218+ CGameUiAvatarImage_Ctor = Memory::Read<decltype (CGameUiAvatarImage_Ctor)>((uintptr_t )CGameUiAvatarImage_Ctor);
12691219#endif
1220+ CGameUiAvatarImage_InitFromRGBA = Memory::Read<decltype (CGameUiAvatarImage_InitFromRGBA)>(Memory::Scan (this ->Name (), Offsets::CGameUiAvatarImage_InitFromRGBA, 1 ));
1221+ Client::ActivateSelectedItem = (decltype (Client::ActivateSelectedItem))Memory::Scan (this ->Name (), Offsets::ActivateSelectedItem);
12701222 Client::GetLeaderboard = Memory::Read<decltype (Client::GetLeaderboard)>(CPortalLeaderboardPanel_OnThink + Offsets::GetLeaderboard);
12711223 Client::IsQuerying = Memory::Read<decltype (Client::IsQuerying)>(CPortalLeaderboardPanel_OnThink + Offsets::IsQuerying);
12721224 Client::SetPanelStats = Memory::Read<decltype (Client::SetPanelStats)>(CPortalLeaderboardPanel_OnThink + Offsets::SetPanelStats);
0 commit comments