pull/130/head
Peter Repukat 3 years ago
parent aee786923f
commit 211d530d25

@ -80,7 +80,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\subhook;$(ExternalIncludePath)</ExternalIncludePath> <ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\ValveFileVDF;$(ExternalIncludePath)</ExternalIncludePath>
<LibraryPath>..\deps\SFML\out\build\x64-Debug\lib;$(LibraryPath)</LibraryPath> <LibraryPath>..\deps\SFML\out\build\x64-Debug\lib;$(LibraryPath)</LibraryPath>
<CopyLocalProjectReference>false</CopyLocalProjectReference> <CopyLocalProjectReference>false</CopyLocalProjectReference>
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent> <CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
@ -122,7 +122,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;SPDLOG_WCHAR_TO_UTF8_SUPPORT;SUBHOOK_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_CONSOLE;SPDLOG_WCHAR_TO_UTF8_SUPPORT;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
@ -138,7 +138,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;SPDLOG_WCHAR_TO_UTF8_SUPPORT;SUBHOOK_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_CONSOLE;SPDLOG_WCHAR_TO_UTF8_SUPPORT;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
@ -150,16 +150,15 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\deps\subhook\subhook.c" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="OverlayDetector.cpp" /> <ClCompile Include="OverlayDetector.cpp" />
<ClCompile Include="SteamTarget.cpp" /> <ClCompile Include="SteamTarget.cpp" />
<ClCompile Include="TargetWindow.cpp" /> <ClCompile Include="TargetWindow.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\deps\subhook\subhook.h" />
<ClInclude Include="OverlayDetector.h" /> <ClInclude Include="OverlayDetector.h" />
<ClInclude Include="SteamTarget.h" /> <ClInclude Include="SteamTarget.h" />
<ClInclude Include="steam_sf_keymap.h" />
<ClInclude Include="TargetWindow.h" /> <ClInclude Include="TargetWindow.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -27,9 +27,6 @@
<ClCompile Include="OverlayDetector.cpp"> <ClCompile Include="OverlayDetector.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\deps\subhook\subhook.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="SteamTarget.h"> <ClInclude Include="SteamTarget.h">
@ -41,7 +38,7 @@
<ClInclude Include="OverlayDetector.h"> <ClInclude Include="OverlayDetector.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\deps\subhook\subhook.h"> <ClInclude Include="steam_sf_keymap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

@ -22,17 +22,11 @@ limitations under the License.
#include <Windows.h> #include <Windows.h>
#endif #endif
#ifdef _WIN32
OverlayDetector::OverlayDetector(std::function<void(bool)> overlay_changed, HWND hwnd)
: overlay_changed_(std::move(overlay_changed)), hwnd_(hwnd)
{
}
#else
OverlayDetector::OverlayDetector(std::function<void(bool)> overlay_changed) OverlayDetector::OverlayDetector(std::function<void(bool)> overlay_changed)
: overlay_changed_(std::move(overlay_changed)) : overlay_changed_(std::move(overlay_changed))
{ {
} }
#endif
void OverlayDetector::update() void OverlayDetector::update()
{ {
@ -48,7 +42,8 @@ void OverlayDetector::update()
// however // however
// reversing on linux SUUUUUUUCKS! // reversing on linux SUUUUUUUCKS!
MSG msg; MSG msg;
if (PeekMessage(&msg, hwnd_, 0, 0, PM_NOREMOVE)) { // okey to use nullptr as hwnd. get EVERY message
if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
// filter out some messages as not all get altered by steam... // filter out some messages as not all get altered by steam...
if (msg.message < 1000 && msg.message > 0) { if (msg.message < 1000 && msg.message > 0) {
return; return;

@ -24,18 +24,14 @@ limitations under the License.
class OverlayDetector { class OverlayDetector {
public: public:
#ifdef _WIN32
explicit OverlayDetector(std::function<void(bool)> overlay_changed = [](bool) {}, HWND hwnd = nullptr);
#else
explicit OverlayDetector( explicit OverlayDetector(
std::function<void(bool)> overlay_changed = [](bool) {}); std::function<void(bool)> overlay_changed = [](bool) {});
#endif
void update(); void update();
private: private:
std::function<void(bool)> overlay_changed_; std::function<void(bool)> overlay_changed_;
#ifdef _WIN32 #ifdef _WIN32
HWND hwnd_;
bool overlay_open_ = false; bool overlay_open_ = false;
int msg_count_ = 0; int msg_count_ = 0;
#endif #endif

Loading…
Cancel
Save