1
0
mirror of synced 2024-11-23 22:41:00 +01:00

this wont compile someone pls halp

This commit is contained in:
doomertheboomer 2023-07-26 20:13:03 +07:00
parent 7a5beba9b7
commit f575830f56
5 changed files with 267 additions and 191 deletions

View File

@ -107,6 +107,7 @@
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>false</OmitFramePointers>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

View File

@ -1,10 +1,10 @@
#include "drs.h"
#include "includes.h"
#pragma pack(push)
#include <windows.h>
#include <thread>
#include "includes.h"
#pragma pack(push)
bool kinectRunning = false;
bool kinectStarted = false;
typedef struct {
union {
@ -48,7 +48,9 @@ void (*touch_callback)(
int unk1,
const void *user_data);
namespace drs {
void* TouchSDK_Constructor(void* in) {
return in;
@ -205,6 +207,83 @@ namespace drs {
touch_callback(&dev, game_touches.get(), (int)event_count, 0, user_data);
}
void start_kinect() {
if (kinectRunning) return;
if (!kinectStarted) {
kinectStarted = true;
std::thread t([] {
puts("starting kinect thread");
// dance floor plane
const float touch_width = 1.f;
const float touch_height = 1.f;
// main loop
while (kinectRunning) {
// iterate foots
for (auto& foot : VR_FOOTS) {
// update event details
foot.event.id = foot.id;
foot.event.x = 0;
foot.event.y = 0;
foot.event.width = 100;
foot.event.height = foot.event.width;
foot.event.type = DRS_DOWN;
// check previous event
switch (foot.event.type) {
case DRS_UP:
// generate down event
foot.event.type = DRS_DOWN;
break;
case DRS_DOWN:
case DRS_MOVE:
// generate move event
foot.event.type = DRS_MOVE;
break;
default:
break;
}
// send event
fire_touches(&foot.event, 1);
continue;
// foot not intersecting with plane
switch (foot.event.type) {
case DRS_DOWN:
case DRS_MOVE:
// generate up event
foot.event.type = DRS_UP;
fire_touches(&foot.event, 1);
break;
case DRS_UP:
default:
break;
}
}
// slow down
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
kinectStarted = false;
return nullptr;
});
t.detach();
}
}
void hookDancepad() {
MH_Initialize();
MH_CreateHookApi(L"TouchSDKDll.dll", "??0TouchSDK@@QEAA@XZ", TouchSDK_Constructor, NULL);
@ -226,4 +305,3 @@ namespace drs {
MH_EnableHook(MH_ALL_HOOKS);
}
}

View File

@ -1,7 +1,5 @@
#pragma once
namespace drs {
enum DRS_TOUCH_TYPE {
DRS_DOWN = 0,
DRS_UP = 1,
@ -26,7 +24,6 @@ namespace drs {
float height = 3;
//linalg::aliases::float4 rotation {0, 0, 0, 1};
drs_touch_t event{};
//unsigned int get_index();
//linalg::aliases::float3 to_world(linalg::aliases::float3 pos);
};
@ -36,8 +33,9 @@ namespace drs {
extern float VR_ROTATION;
extern VRFoot VR_FOOTS[2];
void fire_touches(drs_touch_t* events, size_t event_count);
//void start_vr();
void start_kinect();
void hookDancepad();
}

View File

@ -7,7 +7,7 @@
#include "kiero/minhook/include/MinHook.h"
#include "kiero/injector/injector.hpp"
#include "d3d9.h"
#include "drs.h"
typedef LRESULT(CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
typedef uintptr_t PTR;

View File

@ -1,5 +1,4 @@
#include "includes.h"
#include "drs.h"
static uintptr_t imageBase;
@ -45,7 +44,7 @@ BOOL WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hMod);
imageBase = (uintptr_t)GetModuleHandleA(0);
drs::hookDancepad();
hookDancepad();
break;
}