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

@ -80,7 +80,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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>
<CopyLocalProjectReference>false</CopyLocalProjectReference>
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
@ -122,7 +122,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<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>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
@ -138,7 +138,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<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>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
@ -150,16 +150,15 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\deps\subhook\subhook.c" />
<ClCompile Include="main.cpp" />
<ClCompile Include="OverlayDetector.cpp" />
<ClCompile Include="SteamTarget.cpp" />
<ClCompile Include="TargetWindow.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\deps\subhook\subhook.h" />
<ClInclude Include="OverlayDetector.h" />
<ClInclude Include="SteamTarget.h" />
<ClInclude Include="steam_sf_keymap.h" />
<ClInclude Include="TargetWindow.h" />
</ItemGroup>
<ItemGroup>

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

@ -22,17 +22,11 @@ limitations under the License.
#include <Windows.h>
#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)
: overlay_changed_(std::move(overlay_changed))
{
}
#endif
void OverlayDetector::update()
{
@ -48,7 +42,8 @@ void OverlayDetector::update()
// however
// reversing on linux SUUUUUUUCKS!
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...
if (msg.message < 1000 && msg.message > 0) {
return;

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

Loading…
Cancel
Save