Win32 API 日本語リファレンス
ホームUI.Input.GameInput › GameInputRawDeviceReportItemInfo

GameInputRawDeviceReportItemInfo

構造体
サイズx64: 88 バイト / x86: 72 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
bitOffsetDWORD4+0+0レポート内でのこのアイテムのビット開始位置である。
bitSizeDWORD4+4+4このアイテムが占めるビット幅である。
logicalMinLONGLONG8+8+8アイテム値の論理的最小値である。
logicalMaxLONGLONG8+16+16アイテム値の論理的最大値である。
physicalMinDOUBLE8+24+24アイテム値の物理的最小値である。
physicalMaxDOUBLE8+32+32アイテム値の物理的最大値である。
physicalUnitsGameInputRawDevicePhysicalUnitKind4+40+40物理単位の種別を示す値である。
rawPhysicalUnitsDWORD4+44+44HID生データの物理単位コードである。
rawPhysicalUnitsExponentINT4+48+48物理単位の指数(スケール)である。
flagsGameInputRawDeviceReportItemFlags4+52+52アイテムの属性を示すフラグである。
usageCountDWORD4+56+56usages配列のユーセージ個数である。
usagesGameInputUsage*8/4+64+60このアイテムのユーセージ配列へのポインタである。
collectionGameInputRawDeviceItemCollectionInfo*8/4+72+64このアイテムが属するコレクション情報へのポインタである。
itemStringGameInputString*8/4+80+68アイテムに付随する文字列情報へのポインタである。

各言語での定義

#include <windows.h>

// GameInputRawDeviceReportItemInfo  (x64 88 / x86 72 バイト)
typedef struct GameInputRawDeviceReportItemInfo {
    DWORD bitOffset;
    DWORD bitSize;
    LONGLONG logicalMin;
    LONGLONG logicalMax;
    DOUBLE physicalMin;
    DOUBLE physicalMax;
    GameInputRawDevicePhysicalUnitKind physicalUnits;
    DWORD rawPhysicalUnits;
    INT rawPhysicalUnitsExponent;
    GameInputRawDeviceReportItemFlags flags;
    DWORD usageCount;
    GameInputUsage* usages;
    GameInputRawDeviceItemCollectionInfo* collection;
    GameInputString* itemString;
} GameInputRawDeviceReportItemInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputRawDeviceReportItemInfo
{
    public uint bitOffset;
    public uint bitSize;
    public long logicalMin;
    public long logicalMax;
    public double physicalMin;
    public double physicalMax;
    public int physicalUnits;
    public uint rawPhysicalUnits;
    public int rawPhysicalUnitsExponent;
    public int flags;
    public uint usageCount;
    public IntPtr usages;
    public IntPtr collection;
    public IntPtr itemString;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputRawDeviceReportItemInfo
    Public bitOffset As UInteger
    Public bitSize As UInteger
    Public logicalMin As Long
    Public logicalMax As Long
    Public physicalMin As Double
    Public physicalMax As Double
    Public physicalUnits As Integer
    Public rawPhysicalUnits As UInteger
    Public rawPhysicalUnitsExponent As Integer
    Public flags As Integer
    Public usageCount As UInteger
    Public usages As IntPtr
    Public collection As IntPtr
    Public itemString As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class GameInputRawDeviceReportItemInfo(ctypes.Structure):
    _fields_ = [
        ("bitOffset", wintypes.DWORD),
        ("bitSize", wintypes.DWORD),
        ("logicalMin", ctypes.c_longlong),
        ("logicalMax", ctypes.c_longlong),
        ("physicalMin", ctypes.c_double),
        ("physicalMax", ctypes.c_double),
        ("physicalUnits", ctypes.c_int),
        ("rawPhysicalUnits", wintypes.DWORD),
        ("rawPhysicalUnitsExponent", ctypes.c_int),
        ("flags", ctypes.c_int),
        ("usageCount", wintypes.DWORD),
        ("usages", ctypes.c_void_p),
        ("collection", ctypes.c_void_p),
        ("itemString", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct GameInputRawDeviceReportItemInfo {
    pub bitOffset: u32,
    pub bitSize: u32,
    pub logicalMin: i64,
    pub logicalMax: i64,
    pub physicalMin: f64,
    pub physicalMax: f64,
    pub physicalUnits: i32,
    pub rawPhysicalUnits: u32,
    pub rawPhysicalUnitsExponent: i32,
    pub flags: i32,
    pub usageCount: u32,
    pub usages: *mut core::ffi::c_void,
    pub collection: *mut core::ffi::c_void,
    pub itemString: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type GameInputRawDeviceReportItemInfo struct {
	bitOffset uint32
	bitSize uint32
	logicalMin int64
	logicalMax int64
	physicalMin float64
	physicalMax float64
	physicalUnits int32
	rawPhysicalUnits uint32
	rawPhysicalUnitsExponent int32
	flags int32
	usageCount uint32
	usages uintptr
	collection uintptr
	itemString uintptr
}
type
  GameInputRawDeviceReportItemInfo = record
    bitOffset: DWORD;
    bitSize: DWORD;
    logicalMin: Int64;
    logicalMax: Int64;
    physicalMin: Double;
    physicalMax: Double;
    physicalUnits: Integer;
    rawPhysicalUnits: DWORD;
    rawPhysicalUnitsExponent: Integer;
    flags: Integer;
    usageCount: DWORD;
    usages: Pointer;
    collection: Pointer;
    itemString: Pointer;
  end;
const GameInputRawDeviceReportItemInfo = extern struct {
    bitOffset: u32,
    bitSize: u32,
    logicalMin: i64,
    logicalMax: i64,
    physicalMin: f64,
    physicalMax: f64,
    physicalUnits: i32,
    rawPhysicalUnits: u32,
    rawPhysicalUnitsExponent: i32,
    flags: i32,
    usageCount: u32,
    usages: ?*anyopaque,
    collection: ?*anyopaque,
    itemString: ?*anyopaque,
};
type
  GameInputRawDeviceReportItemInfo {.bycopy.} = object
    bitOffset: uint32
    bitSize: uint32
    logicalMin: int64
    logicalMax: int64
    physicalMin: float64
    physicalMax: float64
    physicalUnits: int32
    rawPhysicalUnits: uint32
    rawPhysicalUnitsExponent: int32
    flags: int32
    usageCount: uint32
    usages: pointer
    collection: pointer
    itemString: pointer
struct GameInputRawDeviceReportItemInfo
{
    uint bitOffset;
    uint bitSize;
    long logicalMin;
    long logicalMax;
    double physicalMin;
    double physicalMax;
    int physicalUnits;
    uint rawPhysicalUnits;
    int rawPhysicalUnitsExponent;
    int flags;
    uint usageCount;
    void* usages;
    void* collection;
    void* itemString;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GameInputRawDeviceReportItemInfo サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; bitOffset : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; bitSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; logicalMin : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; logicalMax : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; physicalMin : DOUBLE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; physicalMax : DOUBLE (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; physicalUnits : GameInputRawDevicePhysicalUnitKind (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; rawPhysicalUnits : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; rawPhysicalUnitsExponent : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; flags : GameInputRawDeviceReportItemFlags (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; usageCount : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; usages : GameInputUsage* (+60, 4byte)  varptr(st)+60 を基点に操作(4byte:入れ子/配列)
; collection : GameInputRawDeviceItemCollectionInfo* (+64, 4byte)  varptr(st)+64 を基点に操作(4byte:入れ子/配列)
; itemString : GameInputString* (+68, 4byte)  varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputRawDeviceReportItemInfo サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; bitOffset : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; bitSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; logicalMin : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; logicalMax : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; physicalMin : DOUBLE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; physicalMax : DOUBLE (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; physicalUnits : GameInputRawDevicePhysicalUnitKind (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; rawPhysicalUnits : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; rawPhysicalUnitsExponent : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; flags : GameInputRawDeviceReportItemFlags (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; usageCount : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; usages : GameInputUsage* (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; collection : GameInputRawDeviceItemCollectionInfo* (+72, 8byte)  varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; itemString : GameInputString* (+80, 8byte)  varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputRawDeviceReportItemInfo
    #field int bitOffset
    #field int bitSize
    #field int64 logicalMin
    #field int64 logicalMax
    #field double physicalMin
    #field double physicalMax
    #field int physicalUnits
    #field int rawPhysicalUnits
    #field int rawPhysicalUnitsExponent
    #field int flags
    #field int usageCount
    #field intptr usages
    #field intptr collection
    #field intptr itemString
#endstruct

stdim st, GameInputRawDeviceReportItemInfo        ; NSTRUCT 変数を確保
st->bitOffset = 100
mes "bitOffset=" + st->bitOffset