Formatting

main
Peter Repukat 3 years ago
parent c7467003fb
commit d7af75a976

@ -4,3 +4,4 @@ BreakBeforeBraces: "Stroustrup"
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
PointerAlignment: "Left"

@ -129,7 +129,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>sfml-window-d.lib;sfml-system-d.lib;sfml-graphics-d.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-graphics-d.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -147,11 +147,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\deps\subhook\subhook.c" />
<ClCompile Include="HidHide.cpp" />
<ClCompile Include="InputRedirector.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="OverlayDetector.cpp" />
@ -160,6 +161,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\deps\subhook\subhook.h" />
<ClInclude Include="HidHide.h" />
<ClInclude Include="InputRedirector.h" />
<ClInclude Include="OverlayDetector.h" />
<ClInclude Include="SteamTarget.h" />

@ -33,6 +33,9 @@
<ClCompile Include="InputRedirector.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="HidHide.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SteamTarget.h">
@ -53,6 +56,9 @@
<ClInclude Include="InputRedirector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="HidHide.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\deps\SFML\out\build\x64-Debug\lib\sfml-system-d-2.dll" />

@ -1,3 +1,18 @@
/*
Copyright 2021 Peter Repukat - FlatspotSoftware
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "InputRedirector.h"
#include <SFML/System/Clock.hpp>
@ -11,7 +26,8 @@ InputRedirector::InputRedirector()
vigem_connected_ = VIGEM_SUCCESS(vigem_connect(driver_));
if (vigem_connected_) {
spdlog::debug("Connected to ViGEm");
} else {
}
else {
spdlog::error("Error initializing ViGEm");
// TODO: setup some mechanic to draw to window...
}
@ -60,7 +76,8 @@ void InputRedirector::runLoop()
if (XInputGetState(i, &state) == ERROR_SUCCESS) {
if (vt_x360_[i] != nullptr) {
vigem_target_x360_update(driver_, vt_x360_[i], *reinterpret_cast<XUSB_REPORT*>(&state.Gamepad));
} else {
}
else {
vt_x360_[i] = vigem_target_x360_alloc();
// By using VID and PID of Valve's Emulated Controller
// ( https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices )
@ -95,7 +112,8 @@ void InputRedirector::runLoop()
}
}
}
} else {
}
else {
if (vt_x360_[i] != nullptr) {
if (VIGEM_SUCCESS(vigem_target_remove(driver_, vt_x360_[i]))) {
spdlog::info("Unplugged controller {}, {}", i, vigem_target_get_index(vt_x360_[i]));

@ -1,10 +1,25 @@
/*
Copyright 2021 Peter Repukat - FlatspotSoftware
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <thread>
#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
#include <ViGEm/Client.h>
#include <Xinput.h>
#include <ViGEm/Client.h>
#endif
class InputRedirector {

@ -22,7 +22,6 @@ limitations under the License.
#include <Windows.h>
#endif
OverlayDetector::OverlayDetector(std::function<void(bool)> overlay_changed)
: overlay_changed_(std::move(overlay_changed))
{
@ -68,5 +67,4 @@ void OverlayDetector::update()
}
}
#endif
}

@ -24,7 +24,6 @@ limitations under the License.
class OverlayDetector {
public:
explicit OverlayDetector(
std::function<void(bool)> overlay_changed = [](bool) {});
void update();
@ -35,5 +34,4 @@ class OverlayDetector {
bool overlay_open_ = false;
int msg_count_ = 0;
#endif
};

@ -15,11 +15,14 @@ limitations under the License.
*/
#pragma once
#include "InputRedirector.h"
#include "OverlayDetector.h"
#include "TargetWindow.h"
#ifdef _WIN32
#include "InputRedirector.h"
#endif
class SteamTarget {
public:
explicit SteamTarget(int argc, char* argv[]);

@ -17,7 +17,6 @@ limitations under the License.
#include "steam_sf_keymap.h"
#include <iostream>
#include <utility>
#include <SFML/Window/Event.hpp>

@ -26,7 +26,6 @@ using WindowHandle = HWND;
using WindowHandle = int; // ???
#endif
class TargetWindow {
public:
explicit TargetWindow(
@ -56,5 +55,4 @@ class TargetWindow {
const std::function<void()> on_close_;
sf::RenderWindow window_;
std::vector<std::string> screenshot_keys_;
};

@ -33,8 +33,7 @@ int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
)
_In_ int nCmdShow)
#endif
#else
int main(int argc, char* argv[])

@ -1,3 +1,18 @@
/*
Copyright 2021 Peter Repukat - FlatspotSoftware
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <SFML/Window/Keyboard.hpp>
#include <unordered_map>

Loading…
Cancel
Save