// 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 // Erwartet im Protokoll: "Vision90.dll ist nicht geladen" - ohne Spiel gibt es keine Engine. #define DIRECTINPUT_VERSION 0x0800 #include #include #include 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; }