Skip to content

Commit

Permalink
Cemu Triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Denellyne committed Jan 16, 2024
1 parent 2836404 commit f469d1e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Bluetooth and USB mode

Gamecube Triggers, (Triggers with [Dolphin](https://pt.dolphin-emu.org/) Emulator)

Nintendo Switch Triggers, (Triggers with [Yuzu](https://yuzu-emu.org/) Emulator)
Nintendo Triggers, (Triggers with [Yuzu](https://yuzu-emu.org/) Emulator and [Cemu](https://cemu.info/))

Auto updater [PCXSense Updater](https://github.com/Denellyne/PCXSense-Updater)

Expand Down
16 changes: 16 additions & 0 deletions customInclude/ControllerIO/controllerIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ void inline isEmulatorRunning(unsigned char* outputHID, int bluetooth, int& shor
return;
}

if (EnumWindows(FindWindowBySubstr, (LPARAM)L"Cemu") == false) {

shortTriggers = 0;
outputHID[11 + bluetooth] = 0x2;
outputHID[12 + bluetooth] = 30;
outputHID[13 + bluetooth] = 180;
outputHID[14 + bluetooth] = 50;

outputHID[22 + bluetooth] = 0x2;
outputHID[23 + bluetooth] = 23;
outputHID[24 + bluetooth] = 180;
outputHID[25 + bluetooth] = 50;

return;
}

if (EnumWindows(FindWindowBySubstr, (LPARAM)L"Dolphin ") == false) {

shortTriggers = 0;
Expand Down
6 changes: 3 additions & 3 deletions customInclude/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool inline isFocus() {
*/

int GUI(controller& x360Controller,std::vector<Macros>& Macro){
GLuint Images[18];
GLuint Images[21];

glfwInit();
GLFWwindow* window = glfwCreateWindow(defaultWindowWidth, defaultWindowHeigth, "PCXSense", nullptr, nullptr);
Expand Down Expand Up @@ -239,12 +239,11 @@ void inline drawController(const float& displaySizeX, const float& displaySizeY,
ImGui::SetCursorPos({ displaySizeX / 2.49f, displaySizeY / 3.935f });
ImGui::Image((void*)Images[3], { (801 / 3) * displaySizeX / 1280,(388 / 2.7f) * displaySizeY / 720 }, {}, { 1,1 }, { x360Controller.RGB.red / 255,x360Controller.RGB.green / 255,x360Controller.RGB.blue / 255,lightbar }); //RGB


//Controller
ImGui::SetCursorPos(controllerPosition);
ImGui::Image((void*)Images[1 - (bool)x360Controller.isConnected], controllerSize);


//Left Analogic
ImGui::SetCursorPos({ ((displaySizeX / 2.935f) + (((int)(x360Controller.ControllerState.Gamepad.sThumbLX + 32768) / 470)) * xMultiplier) ,
(displaySizeY / 2.62f) + (((32767 - (int)x360Controller.ControllerState.Gamepad.sThumbLY) / 470)) * yMultiplier });
Expand All @@ -253,6 +252,7 @@ void inline drawController(const float& displaySizeX, const float& displaySizeY,
ImGui::Image((void*)Images[2], { (226 / 3) * displaySizeX / 1280,(226 / 2.7f) * displaySizeY / 720 }, {}, { 1,1 }, { 0.8f, 0.8f, 0.8f, 1 });
else ImGui::Image((void*)Images[2], { (226 / 3) * displaySizeX / 1280,(226 / 2.7f) * displaySizeY / 720 }, {}, { 1,1 }, { 1,1,1, (float)x360Controller.isConnected });


//Right Analogic
ImGui::SetCursorPos({ ((displaySizeX / 1.99f) + ((int)(x360Controller.ControllerState.Gamepad.sThumbRX + 32768) / 470) * xMultiplier) ,
(displaySizeY / 2.61f) + ((32767 - (int)x360Controller.ControllerState.Gamepad.sThumbRY) / 470) * yMultiplier });
Expand Down
2 changes: 1 addition & 1 deletion imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Size=400,400

[Window][PSXSense]
Pos=0,0
Size=1280,720
Size=32,32

[Window][Rumble Test]
Pos=60,60
Expand Down
Binary file modified macros.txt
Binary file not shown.
3 changes: 2 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _DEBUG
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")

#include "misc\util.h"
#include "GUI\GUI.h"
Expand Down Expand Up @@ -94,7 +95,7 @@ int main() {
std::thread(asyncMacro, std::ref(x360Controller),std::ref(Macro)).detach();

#if _DEBUG
std::thread(asyncDataReport, std::ref(x360Controller)).detach(); // Displays controller info
//std::thread(asyncDataReport, std::ref(x360Controller)).detach(); // Displays controller info
#endif

vigem_target_x360_register_notification(x360Controller.client, x360Controller.emulateX360, &getRumble, ptrController);
Expand Down

0 comments on commit f469d1e

Please sign in to comment.