Files
MrMahoandClaude Opus 5.5 35f2d1330d Erste Version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:26:23 +01:00

37 lines
1.6 KiB
C++

// Test ohne Spiel: laedt dist\dinput8.dll wie das Spiel, erstellt die Tastatur und fragt sie ein paar Mal ab.
// Danach muss dist\BSO\BSO_Loader.txt den .NET-Start und den Bild-Takt zeigen.
// Bauen (x64 Native Tools Prompt): cl /EHsc ProxyTest.cpp /link dinput8.lib dxguid.lib user32.lib
// Starten: ProxyTest.exe <voller Pfad zu dist\dinput8.dll>
// Erwartet im Protokoll: "Vision90.dll ist nicht geladen" - ohne Spiel gibt es keine Engine.
#define DIRECTINPUT_VERSION 0x0800
#include <windows.h>
#include <dinput.h>
#include <stdio.h>
int wmain(int argc, wchar_t** argv)
{
HMODULE proxy = LoadLibraryW(argc > 1 ? argv[1] : L"dinput8.dll");
if (!proxy) { printf("LoadLibrary fehlgeschlagen: %lu\n", GetLastError()); return 1; }
auto create = (decltype(&DirectInput8Create))GetProcAddress(proxy, "DirectInput8Create");
IDirectInput8W* di = nullptr;
HRESULT hr = create(GetModuleHandleW(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8W, (void**)&di, nullptr);
printf("DirectInput8Create: 0x%08lX\n", hr);
if (FAILED(hr)) return 1;
IDirectInputDevice8W* kb = nullptr;
hr = di->CreateDevice(GUID_SysKeyboard, &kb, nullptr);
printf("CreateDevice(Tastatur): 0x%08lX\n", hr);
if (FAILED(hr)) return 1;
kb->SetDataFormat(&c_dfDIKeyboard);
kb->SetCooperativeLevel(GetConsoleWindow(), DISCL_BACKGROUND | DISCL_NONEXCLUSIVE);
kb->Acquire();
BYTE keys[256];
for (int i = 0; i < 30; i++) { kb->GetDeviceState(sizeof(keys), keys); Sleep(16); }
printf("30 Bilder abgefragt\n");
kb->Release();
di->Release();
return 0;
}