Skip to content

Commit b0e3315

Browse files
authored
Merge pull request #5 from broken-bytes/dev
Dev
2 parents 75f4a5b + 906981a commit b0e3315

File tree

12 files changed

+272
-123
lines changed

12 files changed

+272
-123
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(SRC_INC
2020
include/Window.hxx
2121
include/MainWindow.hxx
2222
include/ColorPicker.hxx
23+
include/DualSenseInfo.hxx
2324
)
2425

2526
set(SRC
@@ -44,15 +45,13 @@ set(ASSETS "$<TARGET_FILE_DIR:${APP}>/assets")
4445

4546
add_executable(${APP} WIN32 ${SRC} ${SRC_INC})
4647
target_link_directories(${APP} PUBLIC lib/)
48+
target_link_libraries(${APP} comctl32.lib)
4749
target_link_libraries(${APP} hidapi.lib)
4850
target_link_libraries(${APP} setupapi)
4951
target_link_libraries(${APP} ViGEmClient.lib)
5052
target_include_directories(${APP} PUBLIC external/)
5153
target_include_directories(${APP} PRIVATE include/)
5254

5355

54-
add_custom_command(TARGET ${APP} POST_BUILD
55-
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/assets/" "${ASSETS}")
56-
5756
add_custom_command(TARGET ${APP} POST_BUILD
5857
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/bin" "$<TARGET_FILE_DIR:${APP}>")

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
DualSense Support for any game based on emulation provided by [ViGEm](https://github.com/ViGEm/ViGEmClient).
33

44
## Features
5-
Get the most out of your DualSense controller.
5+
Get the most out of your DualSense controller.
66
Full support for any game using XInput.
77
Enhanced features like touchpad mouse controls.
88
Freely bind any action your controller is capable of to your desire.
@@ -13,6 +13,9 @@ Freely bind any action your controller is capable of to your desire.
1313
* Rumble Support
1414
* WIP:
1515
* Support for touchpad
16+
* Multiple Controllers
17+
* Profiles
18+
* Persistence
1619

1720
## Installation
1821
Just grab the latest release under [releases](https://github.com/broken-bytes/DualSense4Windows/releases) and run it.
@@ -29,11 +32,10 @@ You'll need to have the following components installed:
2932
You need to provide library files for the following components used
3033
* [ViGEmClient](https://github.com/ViGEm/ViGEmClient)
3134
* [hidapi](https://github.com/libusb/hidapi)
32-
* [Ultralight](https://github.com/ultralight-ux/Ultralight)
3335

3436
### Build Steps
3537
* First, create a dynamic library build for hidapi and ViGEmClient.
36-
* Place `hidapi.lib`, `ViGEmClient.lib`, `AppCore.lib`, `UltraLight.lib`, `UltraLightCore.lib`, and `WebCore.lib` inside the `lib` folder of the project.
38+
* Place `hidapi.lib`, `ViGEmClient.lib` inside the `lib` folder of the project.
3739
* Also place the corrosponding `.dll` files in the `bin` folder of your project root folder
3840
* Execute `CreateVisualStudioSolution.bat`
3941
* Open `DualSense4Windows.sln` created in your `build` folder

assets/css/styles.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

assets/html/app.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

assets/img/dualsense.jpg

-17.1 KB
Binary file not shown.

assets/js/main.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

include/ColorPicker.hxx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
#pragma once
22

33

4-
#include "Core.hxx"
5-
#include "Window.hxx"
64
#include <sigslot/signal.hpp>
75

8-
namespace BrokenBytes::DualSense4Windows::UI {
9-
10-
struct Color {
11-
uint8_t R;
12-
uint8_t G;
13-
uint8_t B;
6+
#include "Core.hxx"
7+
#include "Window.hxx"
8+
#include "DualSenseInfo.hxx"
149

15-
COLORREF RGB_VALUE() const {
16-
return RGB(R, G, B);
17-
}
18-
};
19-
10+
namespace BrokenBytes::DualSense4Windows::UI {
2011
class ColorPicker : public Window {
2112
public:
2213
sigslot::signal<Color> ColorChanged;

include/DualSenseInfo.hxx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#pragma once
2+
#include <string>
3+
#include "Core.hxx"
4+
5+
6+
namespace BrokenBytes::DualSense4Windows::UI {
7+
struct Color {
8+
uint8_t R;
9+
uint8_t G;
10+
uint8_t B;
11+
12+
COLORREF RGB_VALUE() const {
13+
return RGB(R, G, B);
14+
}
15+
};
16+
17+
enum class ConnectionType {
18+
USB,
19+
Bluetooth
20+
};
21+
22+
enum class Mode {
23+
XBox,
24+
DS4,
25+
Native
26+
};
27+
28+
struct DualSenseInfo {
29+
char* Path;
30+
std::wstring Name;
31+
ConnectionType Connection;
32+
Mode Mode;
33+
Color Color;
34+
};
35+
}

include/MainWindow.hxx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
namespace BrokenBytes::DualSense4Windows::UI {
1212

1313
enum class Dimensions : uint16_t {
14-
VSpacer = 1,
14+
VSpacer = 8,
1515
HSpacer = 1,
1616
NameWidth = 30,
1717
ConnectionWidth = 10,
1818
ColorSize = 15,
1919
HideWidth = 10,
20-
BaseHeight = 5
20+
BaseHeight = 16
2121
};
2222

2323
class MainWindow : public Window {
@@ -46,18 +46,14 @@ namespace BrokenBytes::DualSense4Windows::UI {
4646

4747
private:
4848
std::vector<char*> _devices;
49-
std::map<char*, std::array<void*, 4>> _controls;
50-
51-
/// <summary>
52-
/// Adds the controls for a given DualSense
53-
/// </summary>
54-
/// <param name="id">The path of the DualSense</param>
55-
void AddControls(char* id);
56-
57-
/// <summary>
58-
/// Removes the controls for a given DualSense
59-
/// </summary>
60-
/// <param name="id">The path of the DualSense</param>
49+
std::vector<DualSenseInfo> _info;
50+
HWND _tabView;
51+
HWND _listView;
52+
std::map<std::wstring, HWND> _tabs;
53+
54+
HWND CreateTabControl();
55+
HWND CreateListViewControl();
56+
void AddControls(char* id, int index);
6157
void RemoveControls(char* id);
6258
};
6359
}

include/Window.hxx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
namespace BrokenBytes::DualSense4Windows::UI {
1414
constexpr LPCWSTR WINDOW_DEFAULT = L"WINDOW_DEFAULT";
1515

16+
constexpr int FONT_TAB = 19;
17+
constexpr int FONT_HEADLINE = 23;
18+
constexpr int FONT_LABEL = 21;
19+
constexpr int FONT_BTN = 22;
20+
1621
class Window {
1722
public:
1823
Window(
@@ -44,8 +49,8 @@ namespace BrokenBytes::DualSense4Windows::UI {
4449
GetModuleHandle(nullptr),
4550
nullptr
4651
);
47-
SendMessageW(_handle, WM_THEMECHANGED, 0, 0);
4852
SetWindowLongPtr(_handle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
53+
SetFont(Handle(), FONT_HEADLINE);
4954

5055
if (_handle == nullptr) {
5156
return;
@@ -155,6 +160,23 @@ namespace BrokenBytes::DualSense4Windows::UI {
155160
_isRegistered = true;
156161
}
157162

163+
/// <summary>
164+
/// Sets the default font for the given window
165+
/// </summary>
166+
/// <param name="handle"></param>
167+
void SetFont(HWND handle, int size) {
168+
HFONT hFont = CreateFont(size, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
169+
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, HIGH_LEVEL,
170+
DEFAULT_PITCH | FF_DONTCARE, TEXT("Roboto"));
171+
SendMessage(
172+
handle,
173+
WM_SETFONT,
174+
reinterpret_cast<WPARAM>(hFont),
175+
true
176+
);
177+
}
178+
179+
158180
/// <summary>
159181
/// Sets the handle of this Window
160182
/// </summary>

0 commit comments

Comments
 (0)