Skip to content

Commit

Permalink
Fix for the latest game update on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrupinski committed Oct 3, 2024
1 parent b6d5f1a commit 1c36359
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Source/Features/Hud/DefusingAlert/DefusingAlertContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class DefusingAlertContext {
});
})();
)"
, "", 0);
, "", 1);

const auto defusingAlertContainer = hudTeamCounter.findChildInLayoutFile("DefusingAlertContainer");
if (!defusingAlertContainer)
Expand Down
2 changes: 1 addition & 1 deletion Source/GameClasses/PanoramaUiPanelContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct PanoramaUiPanelContext {
{
if (const auto style = getStyle()) {
// FIXME: hardcoded virtual method index
reinterpret_cast<void(*)(cs2::CPanelStyle* thisptr, const cs2::Color* color)>((*reinterpret_cast<void(***)()>(style))[54])(style, &color);
reinterpret_cast<void(*)(cs2::CPanelStyle* thisptr, const cs2::Color* color)>((*reinterpret_cast<void(***)()>(style))[55])(style, &color);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/MemoryPatterns/Windows/ClientPatternsWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ClientPatterns {

[[nodiscard]] cs2::CLoopModeGame** loopModeGame() const noexcept
{
return patternFinders.clientPatternFinder("48 89 35 ? ? ? ? 49 8B 73"_pat).add(3).abs().template as<cs2::CLoopModeGame**>();
return patternFinders.clientPatternFinder("48 8B 0D ? ? ? ? 44 0F 28 ? 24"_pat).add(3).abs().template as<cs2::CLoopModeGame**>();
}

[[nodiscard]] cs2::GlobalVars** globalVars() const noexcept
Expand Down
4 changes: 2 additions & 2 deletions Source/MemoryPatterns/Windows/EntityPatternsWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct EntityPatterns {

[[nodiscard]] OffsetToHealth offsetToHealth() const noexcept
{
return patternFinders.clientPatternFinder("83 B9 ? ? ? ? 00 48 8B D9 7E ? C7"_pat).add(2).template readOffset<OffsetToHealth>();
return patternFinders.clientPatternFinder("D9 ? ? C7 81 ? ? ? ? 00 00 00 00 48 8D 15"_pat).add(5).template readOffset<OffsetToHealth>();
}

[[nodiscard]] OffsetToLifeState offsetToLifeState() const noexcept
Expand All @@ -34,7 +34,7 @@ struct EntityPatterns {

[[nodiscard]] OffsetToRenderComponent offsetToRenderComponent() const noexcept
{
return patternFinders.clientPatternFinder("8B ? ? ? ? ? 48 85 C0 74 ? 39 58 ? 7E"_pat).add(2).template readOffset<OffsetToRenderComponent>();
return patternFinders.clientPatternFinder("8B ? ? ? ? ? 48 85 C0 74 ? 39 ? ? 7E"_pat).add(2).template readOffset<OffsetToRenderComponent>();
}

[[nodiscard]] OffsetToOwnerEntity offsetToOwnerEntity() const noexcept
Expand Down
5 changes: 3 additions & 2 deletions Source/MemoryPatterns/Windows/FileSystemPatternsWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ struct FileSystemPatterns {

[[nodiscard]] cs2::CBaseFileSystem** fileSystem() const noexcept
{
return patternFinders.soundSystemPatternFinder("22 74 ? 48 8B 0D ? ? ? ? 4C 8D 44"_pat).add(6).abs().template as<cs2::CBaseFileSystem**>();
// todo: find better pattern (from filesystem dll?)
return patternFinders.soundSystemPatternFinder("48 8B 57 10 48 83 C2 28 39 ? 74 ? 48 8B 0D ? ? ? ? 4C 8D 44 24 ? 48 8B 01 FF 90 ? ? ? ? 8B 44 24"_pat).add(15).abs().template as<cs2::CBaseFileSystem**>();
}

[[nodiscard]] FileNamesOffset fileNamesOffset() const noexcept
{
return patternFinders.fileSystemPatternFinder("E8 ? ? ? ? 48 8D 8B ? ? ? ? FF 15"_pat).add(8).template readOffset<FileNamesOffset>();
return patternFinders.fileSystemPatternFinder("E8 ? ? ? ? 48 8D 8B ? ? ? ? FF 15 ? ? ? ? 8B"_pat).add(8).template readOffset<FileNamesOffset>();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ struct PanoramaImagePanelPatterns {

[[nodiscard]] cs2::CImagePanel::Constructor* constructor() const noexcept
{
return patternFinders.clientPatternFinder("E8 ? ? ? ? 48 8B F0 45 33 ED"_pat).add(1).abs().template as<cs2::CImagePanel::Constructor*>();
return patternFinders.clientPatternFinder("E8 ? ? ? ? EB 03 48 8B ? BA"_pat).add(1).abs().template as<cs2::CImagePanel::Constructor*>();
}

[[nodiscard]] std::uint32_t* size() const noexcept
{
return patternFinders.clientPatternFinder("FF 90 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 4C 8B E8"_pat).add(7).template as<std::uint32_t*>();
return patternFinders.clientPatternFinder("01 FF 90 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 48 85 C0 74 ? 48"_pat).add(8).template as<std::uint32_t*>();
}

[[nodiscard]] ImagePropertiesOffset imagePropertiesOffset() const noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct PanoramaUiEnginePatterns {

[[nodiscard]] cs2::CUIEngine::runScript runScript() const noexcept
{
return patternFinders.panoramaPatternFinder("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 81 EC ? ? ? ? 4C 8B"_pat).template as<cs2::CUIEngine::runScript>();
return patternFinders.panoramaPatternFinder("4C 89 4C 24 ? 4C 89 44 24 ? 48 89 54 24 ? 55"_pat).template as<cs2::CUIEngine::runScript>();
}

[[nodiscard]] cs2::CUIEngine::makeSymbol makeSymbol() const noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct PanoramaUiPanelPatterns {

[[nodiscard]] std::int32_t* getAttributeString() const noexcept
{
return patternFinders.clientPatternFinder("12 48 8B 01 FF 90 ? ? ? ? 48 8B D0 48 85 C0"_pat).add(6).template as<std::int32_t*>();
return patternFinders.clientPatternFinder("12 48 8B 01 FF 90 ? ? ? ? 48 8B ? 48 85 C0 74 ? 80 38 00 74 ? 48"_pat).add(6).template as<std::int32_t*>();
}

[[nodiscard]] std::int32_t* setAttributeString() const noexcept
Expand Down
2 changes: 1 addition & 1 deletion Source/MemoryPatterns/Windows/PlantedC4PatternsWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct PlantedC4Patterns {

[[nodiscard]] BombBlowTimeOffset m_flC4Blow() const noexcept
{
return patternFinders.clientPatternFinder("F3 0F 10 ? ? ? ? ? BB FF"_pat).add(4).template readOffset<BombBlowTimeOffset>();
return patternFinders.clientPatternFinder("F3 0F 10 ? ? ? ? ? BB FF FF"_pat).add(4).template readOffset<BombBlowTimeOffset>();
}

[[nodiscard]] BombDefuserOffset m_hBombDefuser() const noexcept
Expand Down
2 changes: 1 addition & 1 deletion Source/MemoryPatterns/Windows/PlayerPawnPatternsWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ struct PlayerPawnPatterns {

[[nodiscard]] OffsetToFlashBangEndTime offsetToFlashBangEndTime() const noexcept
{
return patternFinders.clientPatternFinder("0F 2F 86 ? ? ? ? 48 8B 7C 24"_pat).add(3).template readOffset<OffsetToFlashBangEndTime>();
return patternFinders.clientPatternFinder("? ? ? ? 0F 2F 43 ? 0F 86 ? ? ? ? 48"_pat).template readOffset<OffsetToFlashBangEndTime>();
}
};
6 changes: 3 additions & 3 deletions Source/UI/Panorama/PanoramaGUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class PanoramaGUI {

// ensure settings tab is loaded because we use CSS classes from settings
// TODO: replace use of settings CSS classes with raw style properties
uiEngine().runScript(mainMenu, "if (!$('#JsSettings')) MainMenu.NavigateToTab('JsSettings', 'settings/settings');", "", 0);
uiEngine().runScript(mainMenu, "if (!$('#JsSettings')) MainMenu.NavigateToTab('JsSettings', 'settings/settings');", "", 1);

const auto settings = mainMenu.findChildInLayoutFile("JsSettings");
if (settings)
state().settingsPanelHandle = settings.getHandle();

uiEngine().runScript(settings, reinterpret_cast<const char*>(
#include "CreateGUI.js"
), "", 0);
), "", 1);

uiEngine().runScript(mainMenu, R"(
(function () {
Expand All @@ -49,7 +49,7 @@ class PanoramaGUI {
$.DispatchEvent('Activated', $.GetContextPanel().FindChildTraverse("MainMenuNavBarHome"), 'mouse');
})();
)", "", 0);
)", "", 1);

if (const auto guiButtonPanel = mainMenu.findChildInLayoutFile("OsirisOpenMenuButton"))
state().guiButtonHandle = guiButtonPanel.getHandle();
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/Panorama/PanoramaGuiUnloadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct PanoramaGuiUnloadHandler {
uiEngine.deletePanelByHandle(state().guiPanelHandle);

if (auto&& settingsPanel = uiEngine.getPanelFromHandle(state().settingsPanelHandle))
uiEngine.runScript(settingsPanel, "delete $.Osiris", "", 0);
uiEngine.runScript(settingsPanel, "delete $.Osiris", "", 1);
}

private:
Expand Down

0 comments on commit 1c36359

Please sign in to comment.