- 浏览: 16113 次
10 12 00 00 _c_rgodfDIKeyboard dd offset _GUID_Key ; DATA XREF: .rdata:00000200o
.data:00000208 00 db 0
.data:00000209 00 db 0
.data:0000020A 00 db 0
.data:0000020B 00 db 0
.data:0000020C 0C db 0Ch
.data:0000020D 00 db 0
.data:0000020E 00 db 0
.data:0000020F 80 db 80h ; €
.data:00000210 00 db 0
.data:00000211 00 db 0
.data:00000212 00 db 0
.data:00000213 00 db 0
.rdata:000001EC 18 _c_dfDIKeyboard db 18h
.rdata:000001ED 00 db 0
.rdata:000001EE 00 db 0
.rdata:000001EF 00 db 0
.rdata:000001F0 10 db 10h
.rdata:000001F1 00 db 0
.rdata:000001F2 00 db 0
.rdata:000001F3 00 db 0
.rdata:000001F4 02 db 2
.rdata:000001F5 00 db 0
.rdata:000001F6 00 db 0
.rdata:000001F7 00 db 0
.rdata:000001F8 00 db 0
.rdata:000001F9 01 db 1
.rdata:000001FA 00 db 0
.rdata:000001FB 00 db 0
.rdata:000001FC 00 db 0
.rdata:000001FD 01 db 1
.rdata:000001FE 00 db 0
.rdata:000001FF 00 db 0
.rdata:00000200 04 02 00 00 dd offset _c_rgodfDIKeyboard
const GUID GUID_Key = {0x55728220, 0xD33C, 0x11CF, [0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00]};
#include <windows.h>
#include <dinput.h>
#define INPUT __declspec(dllimport)
#define OUTPUT __declspec(dllexport)
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
UCHAR HitFlag[256] = {0};
UCHAR KeyArry[256] = {0};
HWND main_window_handle = nullptr;
HINSTANCE main_instance_handle = nullptr;
LPDIRECTINPUT8 lpdi = nullptr;
LPDIRECTINPUTDEVICE8 lpdikey = nullptr;
LPDIRECTINPUTDEVICE8 lpdimouse = nullptr;
LPDIRECTINPUTDEVICE8 lpdijoy = nullptr;
EXTERN_C OUTPUT BOOL CDECL InitInput(HWND hWnd, HINSTANCE hInst)
{
main_window_handle = hWnd;
main_instance_handle = hInst;
return SUCCEEDED(DirectInput8Create (hInst,
DIRECTINPUT_VERSION,
IID_IDirectInput8,
(void **)&lpdi,
nullptr));
}
EXTERN_C OUTPUT BOOL CDECL InitKeyBoard(DWORD dwFlags)
{
BOOL val = 0;
val |= lpdi->CreateDevice (GUID_SysKeyboard, &lpdikey, nullptr);
val |= lpdikey->SetCooperativeLevel (main_window_handle, dwFlags);
val |= lpdikey->SetDataFormat(&c_dfDIKeyboard);
val |= lpdikey->Acquire();
return !val;
}
EXTERN_C OUTPUT BOOL CDECL GetKeyUp(DWORD KeyIndex)
{
// if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry) != DIERR_INPUTLOST) {
lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm cmp eax, 8007001Eh // DIERR_INPUTLOST
__asm jnz most_hit_branch
if (lpdikey->Acquire() != S_OK) {
__asm int 3
} return lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm align 16
most_hit_branch:
UCHAR u8Temp;
u8Temp= HitFlag[KeyIndex];
HitFlag[KeyIndex] = KeyArry[KeyIndex] | ((0x80^HitFlag[KeyIndex]) & HitFlag[KeyIndex]);
return ((0x80 ^ KeyArry[KeyIndex]) & u8Temp);
// }
// else {
// if (lpdikey->Acquire() != S_OK) {
// __asm int 3
// } lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
// }
// return 233;
/*
if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry)==DIERR_INPUTLOST)
{
lpdikey->Acquire();
}
if (KeyArry[KeyIndex] )
{
HitFlag[KeyIndex]=0x80;
return FALSE;
}
else if (HitFlag[KeyIndex] == 0x80)
{
HitFlag[KeyIndex] = 0;
return TRUE;
}
else
return FALSE;*/
}
EXTERN_C OUTPUT BOOL CDECL GetKeyDown(DWORD KeyIndex)
{
// if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry) != DIERR_INPUTLOST) {
lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm cmp eax, 8007001Eh
__asm jnz most_hit_branch
if (lpdikey->Acquire() != S_OK) {
__asm int 3
} return lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm align 16
most_hit_branch:
HitFlag[KeyIndex] |= KeyArry[KeyIndex];
return KeyArry[KeyIndex];
//} else {
// if (lpdikey->Acquire() != S_OK) {
//__asm int 3
// } lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
//} return 233;
}
EXTERN_C OUTPUT BOOL CDECL ShutDownInput ()
{
BOOL val = 0;
if(lpdikey != nullptr)
val |= lpdikey->Unacquire() | lpdikey->Release();
if(lpdimouse != nullptr)
val |= lpdimouse->Unacquire() | lpdimouse->Release();
if(lpdijoy != nullptr)
val |= lpdijoy->Unacquire() | lpdijoy->Release();
if(lpdikey != nullptr)
val |= lpdi->Release();
return !val;
}
EXTERN_C OUTPUT BOOL CDECL InitMouse(DWORD KeyIndex)
{
return 0;
}
EXTERN_C OUTPUT BOOL CDECL InitJoy(HWND hWnd, HINSTANCE hInst)
{
return 0;
}
.data:00000208 00 db 0
.data:00000209 00 db 0
.data:0000020A 00 db 0
.data:0000020B 00 db 0
.data:0000020C 0C db 0Ch
.data:0000020D 00 db 0
.data:0000020E 00 db 0
.data:0000020F 80 db 80h ; €
.data:00000210 00 db 0
.data:00000211 00 db 0
.data:00000212 00 db 0
.data:00000213 00 db 0
.rdata:000001EC 18 _c_dfDIKeyboard db 18h
.rdata:000001ED 00 db 0
.rdata:000001EE 00 db 0
.rdata:000001EF 00 db 0
.rdata:000001F0 10 db 10h
.rdata:000001F1 00 db 0
.rdata:000001F2 00 db 0
.rdata:000001F3 00 db 0
.rdata:000001F4 02 db 2
.rdata:000001F5 00 db 0
.rdata:000001F6 00 db 0
.rdata:000001F7 00 db 0
.rdata:000001F8 00 db 0
.rdata:000001F9 01 db 1
.rdata:000001FA 00 db 0
.rdata:000001FB 00 db 0
.rdata:000001FC 00 db 0
.rdata:000001FD 01 db 1
.rdata:000001FE 00 db 0
.rdata:000001FF 00 db 0
.rdata:00000200 04 02 00 00 dd offset _c_rgodfDIKeyboard
const GUID GUID_Key = {0x55728220, 0xD33C, 0x11CF, [0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00]};
#include <windows.h>
#include <dinput.h>
#define INPUT __declspec(dllimport)
#define OUTPUT __declspec(dllexport)
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
UCHAR HitFlag[256] = {0};
UCHAR KeyArry[256] = {0};
HWND main_window_handle = nullptr;
HINSTANCE main_instance_handle = nullptr;
LPDIRECTINPUT8 lpdi = nullptr;
LPDIRECTINPUTDEVICE8 lpdikey = nullptr;
LPDIRECTINPUTDEVICE8 lpdimouse = nullptr;
LPDIRECTINPUTDEVICE8 lpdijoy = nullptr;
EXTERN_C OUTPUT BOOL CDECL InitInput(HWND hWnd, HINSTANCE hInst)
{
main_window_handle = hWnd;
main_instance_handle = hInst;
return SUCCEEDED(DirectInput8Create (hInst,
DIRECTINPUT_VERSION,
IID_IDirectInput8,
(void **)&lpdi,
nullptr));
}
EXTERN_C OUTPUT BOOL CDECL InitKeyBoard(DWORD dwFlags)
{
BOOL val = 0;
val |= lpdi->CreateDevice (GUID_SysKeyboard, &lpdikey, nullptr);
val |= lpdikey->SetCooperativeLevel (main_window_handle, dwFlags);
val |= lpdikey->SetDataFormat(&c_dfDIKeyboard);
val |= lpdikey->Acquire();
return !val;
}
EXTERN_C OUTPUT BOOL CDECL GetKeyUp(DWORD KeyIndex)
{
// if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry) != DIERR_INPUTLOST) {
lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm cmp eax, 8007001Eh // DIERR_INPUTLOST
__asm jnz most_hit_branch
if (lpdikey->Acquire() != S_OK) {
__asm int 3
} return lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm align 16
most_hit_branch:
UCHAR u8Temp;
u8Temp= HitFlag[KeyIndex];
HitFlag[KeyIndex] = KeyArry[KeyIndex] | ((0x80^HitFlag[KeyIndex]) & HitFlag[KeyIndex]);
return ((0x80 ^ KeyArry[KeyIndex]) & u8Temp);
// }
// else {
// if (lpdikey->Acquire() != S_OK) {
// __asm int 3
// } lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
// }
// return 233;
/*
if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry)==DIERR_INPUTLOST)
{
lpdikey->Acquire();
}
if (KeyArry[KeyIndex] )
{
HitFlag[KeyIndex]=0x80;
return FALSE;
}
else if (HitFlag[KeyIndex] == 0x80)
{
HitFlag[KeyIndex] = 0;
return TRUE;
}
else
return FALSE;*/
}
EXTERN_C OUTPUT BOOL CDECL GetKeyDown(DWORD KeyIndex)
{
// if(lpdikey->GetDeviceState(256, (LPVOID)KeyArry) != DIERR_INPUTLOST) {
lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm cmp eax, 8007001Eh
__asm jnz most_hit_branch
if (lpdikey->Acquire() != S_OK) {
__asm int 3
} return lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
__asm align 16
most_hit_branch:
HitFlag[KeyIndex] |= KeyArry[KeyIndex];
return KeyArry[KeyIndex];
//} else {
// if (lpdikey->Acquire() != S_OK) {
//__asm int 3
// } lpdikey->GetDeviceState(256, (LPVOID)KeyArry);
//} return 233;
}
EXTERN_C OUTPUT BOOL CDECL ShutDownInput ()
{
BOOL val = 0;
if(lpdikey != nullptr)
val |= lpdikey->Unacquire() | lpdikey->Release();
if(lpdimouse != nullptr)
val |= lpdimouse->Unacquire() | lpdimouse->Release();
if(lpdijoy != nullptr)
val |= lpdijoy->Unacquire() | lpdijoy->Release();
if(lpdikey != nullptr)
val |= lpdi->Release();
return !val;
}
EXTERN_C OUTPUT BOOL CDECL InitMouse(DWORD KeyIndex)
{
return 0;
}
EXTERN_C OUTPUT BOOL CDECL InitJoy(HWND hWnd, HINSTANCE hInst)
{
return 0;
}
发表评论
-
我发现表达能力也是非常重要的 ...
2015-07-31 11:27 5有些连之乎者也都蹦不利索的人 出的书籍都什么玩意 ? ... ... -
CMOVcc 这条指令真的使用来加速的么 ?
2015-06-04 18:06 780怎么慢的跟狗一样 ... -
很想知道罗云彬老师的近况
2015-05-10 20:23 25磕磕碰碰地读了一点的他写的汇编书 得到不少有益的提示 ... ... -
D语言 bindings库 XAudio2 无法发音 ...
2015-05-07 15:39 586头文件 XAudio2.d 里 interface IXAud ... -
NES PPU 杂
2015-05-04 17:03 908.686 ... -
6502 masm
2015-04-24 21:48 87.686 ... -
masm 像素碰撞检测
2015-04-13 22:00 608256 * 240 的 directx surface _ ... -
masm10.0
2015-04-13 21:48 361masm 下载 是从 vs10 里抠出来的 裸程序 ml.e ...
相关推荐
**DINPUT8.DLL**是DirectInput 8的一个动态链接库文件,它是Microsoft DirectX的一部分,主要用于游戏和其他应用程序的输入设备管理。DirectInput是Windows平台上一个重要的API(应用程序接口),它允许开发者直接...
**DirectX与dinput8.dll** DirectX是由微软开发的一套用于Windows操作系统的应用程序接口(API),主要用于多媒体、游戏开发和图形渲染。它包含了多个子组件,如Direct3D、DirectDraw、DirectSound、DirectInput等...
头文件 头文件dinput.h
directx 库,必不可少,给缺少该资源的朋友一些帮助吧
dinput8.dll
解决报错 unresolved external symbol _DirectDrawCreateEx@16 的一个依赖库
dinput
dinput.dll
在Windows平台下使用DirectInput8接口,对joystick进行编程。 共2个文件:《DirectInput8开发手册》和Joystick.cpp(代码) 编译器:Visual Studio 2017 主要包含头文件: #include <dinput.h> #include <dinputd.h>
1. **dinput8.dll**:这是DirectInput的动态链接库文件,是dx ACE实现其功能的核心部分。它允许dx ACE与游戏中的DirectInput接口进行交互,读取和修改控制器输入数据。 2. **xinput1_3.dll**:这是XInput的动态链接...
DirectInput8是一个重要的API接口,它是Microsoft DirectX的一部分,主要用于游戏和其他需要高性能输入设备交互的应用程序。这个API允许开发者直接从硬件设备,如鼠标和键盘,获取输入数据,从而实现更高效、更精确...
SPSS input SPSS inputSPSS input SPSS inputSPSS input SPSS input