Skip to content

Commit

Permalink
more hacky code yay yay
Browse files Browse the repository at this point in the history
  • Loading branch information
mdev-new committed Nov 20, 2023
1 parent a73b419 commit 44029d5
Show file tree
Hide file tree
Showing 14 changed files with 770 additions and 38 deletions.
8 changes: 8 additions & 0 deletions _dist/test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
setlocal enabledelayedexpansion
rundll32 getinput.dll,inject
:a
rem for /l %%x in (1,1,10000) do title !keyspressed!
rem title !keyspressed!
set /p=hello?
goto :a
24 changes: 20 additions & 4 deletions audioplayer/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,28 @@ DWORD CALLBACK RunAudioQueue(LPVOID data) {
if (ConnectNamedPipe(hPipe, NULL) != FALSE) { // wait for someone to connect to the pipe
while (ReadFile(hPipe, buffer.data(), MAXLEN - 1, &dwRead, NULL) != FALSE) {
/* add terminating zero */
buffer[dwRead] = '\0';
if(dwRead >= 1) {
buffer[dwRead-1] = '\0';

audio.SetFile(buffer);
snd.Play(audio);
if(strncmp(buffer, "play", 4) == 0) {
audio.SetFile(buffer+5);
snd.Play(audio);
}

if(strncmp(buffer, "stop", 4) == 0) {
snd.Stop();
}

if(strncmp(buffer, "pause", 5) == 0) {} // todo pause
if(strncmp(buffer, "resume", 6) == 0) {} // todo resume
}
}
}

DisconnectNamedPipe(hPipe);
}

return 0;
}

// manual dllmain since i dont need one process thread, i need many of them
Expand All @@ -54,10 +67,13 @@ extern "C" __declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst, DWORD d
if (dwReason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hInst);

CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ0"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ1"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ2"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ3"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ4"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ5"), 0, NULL);
CreateThread(NULL, 0, RunAudioQueue, (LPVOID)TEXT("\\\\.\\pipe\\BatAudQ6"), 0, NULL);

}

return TRUE;
Expand Down
14 changes: 14 additions & 0 deletions batch_native.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Položky řešení", "Polo
_dist\batch_native.txt = _dist\batch_native.txt
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "report_conmode", "report_conmode\Project.vcxproj", "{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -81,6 +83,18 @@ Global
{36465235-492F-465C-9554-6113F3B1E850}.Release|x64.Build.0 = Release|x64
{36465235-492F-465C-9554-6113F3B1E850}.Release|x86.ActiveCfg = Release|Win32
{36465235-492F-465C-9554-6113F3B1E850}.Release|x86.Build.0 = Release|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|Win32.ActiveCfg = Debug|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|Win32.Build.0 = Debug|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|x64.ActiveCfg = Debug|x64
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|x64.Build.0 = Debug|x64
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|x86.ActiveCfg = Debug|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Debug|x86.Build.0 = Debug|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|Win32.ActiveCfg = Release|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|Win32.Build.0 = Release|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|x64.ActiveCfg = Release|x64
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|x64.Build.0 = Release|x64
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|x86.ActiveCfg = Release|Win32
{6979CFBE-D913-4637-B4EF-2DBFD3A3E6F8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions getinput/controllers.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// taken from some good man on github

#include <stdio.h>
#include <Windows.h>
#include <Xinput.h>
Expand Down
Loading

0 comments on commit 44029d5

Please sign in to comment.