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

GameInputControllerButtonInfo

構造体
サイズx64: 32 バイト / x86: 24 バイト

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

フィールド

フィールドサイズx64x86説明
mappedInputKindsGameInputKind4+0+0このボタンが対応づく入力種別を示すフラグである。
labelGameInputLabel4+4+4ボタンに付与された物理ラベルを示す値である。
legacyDInputIndexWORD2+8+8DirectInput互換でのインデックスである。
legacyHidIndexWORD2+10+10HID互換でのインデックスである。
rawReportIndexDWORD4+12+12生レポート内でのインデックスである。
inputReportGameInputRawDeviceReportInfo*8/4+16+16対応する入力レポート情報へのポインタである。
inputReportItemGameInputRawDeviceReportItemInfo*8/4+24+20対応する入力レポートアイテム情報へのポインタである。

各言語での定義

#include <windows.h>

// GameInputControllerButtonInfo  (x64 32 / x86 24 バイト)
typedef struct GameInputControllerButtonInfo {
    GameInputKind mappedInputKinds;
    GameInputLabel label;
    WORD legacyDInputIndex;
    WORD legacyHidIndex;
    DWORD rawReportIndex;
    GameInputRawDeviceReportInfo* inputReport;
    GameInputRawDeviceReportItemInfo* inputReportItem;
} GameInputControllerButtonInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputControllerButtonInfo
{
    public int mappedInputKinds;
    public int label;
    public ushort legacyDInputIndex;
    public ushort legacyHidIndex;
    public uint rawReportIndex;
    public IntPtr inputReport;
    public IntPtr inputReportItem;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputControllerButtonInfo
    Public mappedInputKinds As Integer
    Public label As Integer
    Public legacyDInputIndex As UShort
    Public legacyHidIndex As UShort
    Public rawReportIndex As UInteger
    Public inputReport As IntPtr
    Public inputReportItem As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class GameInputControllerButtonInfo(ctypes.Structure):
    _fields_ = [
        ("mappedInputKinds", ctypes.c_int),
        ("label", ctypes.c_int),
        ("legacyDInputIndex", ctypes.c_ushort),
        ("legacyHidIndex", ctypes.c_ushort),
        ("rawReportIndex", wintypes.DWORD),
        ("inputReport", ctypes.c_void_p),
        ("inputReportItem", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct GameInputControllerButtonInfo {
    pub mappedInputKinds: i32,
    pub label: i32,
    pub legacyDInputIndex: u16,
    pub legacyHidIndex: u16,
    pub rawReportIndex: u32,
    pub inputReport: *mut core::ffi::c_void,
    pub inputReportItem: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type GameInputControllerButtonInfo struct {
	mappedInputKinds int32
	label int32
	legacyDInputIndex uint16
	legacyHidIndex uint16
	rawReportIndex uint32
	inputReport uintptr
	inputReportItem uintptr
}
type
  GameInputControllerButtonInfo = record
    mappedInputKinds: Integer;
    label: Integer;
    legacyDInputIndex: Word;
    legacyHidIndex: Word;
    rawReportIndex: DWORD;
    inputReport: Pointer;
    inputReportItem: Pointer;
  end;
const GameInputControllerButtonInfo = extern struct {
    mappedInputKinds: i32,
    label: i32,
    legacyDInputIndex: u16,
    legacyHidIndex: u16,
    rawReportIndex: u32,
    inputReport: ?*anyopaque,
    inputReportItem: ?*anyopaque,
};
type
  GameInputControllerButtonInfo {.bycopy.} = object
    mappedInputKinds: int32
    label: int32
    legacyDInputIndex: uint16
    legacyHidIndex: uint16
    rawReportIndex: uint32
    inputReport: pointer
    inputReportItem: pointer
struct GameInputControllerButtonInfo
{
    int mappedInputKinds;
    int label;
    ushort legacyDInputIndex;
    ushort legacyHidIndex;
    uint rawReportIndex;
    void* inputReport;
    void* inputReportItem;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GameInputControllerButtonInfo サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; mappedInputKinds : GameInputKind (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; label : GameInputLabel (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; legacyDInputIndex : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; legacyHidIndex : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; rawReportIndex : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; inputReport : GameInputRawDeviceReportInfo* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; inputReportItem : GameInputRawDeviceReportItemInfo* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputControllerButtonInfo サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; mappedInputKinds : GameInputKind (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; label : GameInputLabel (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; legacyDInputIndex : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; legacyHidIndex : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; rawReportIndex : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; inputReport : GameInputRawDeviceReportInfo* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; inputReportItem : GameInputRawDeviceReportItemInfo* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputControllerButtonInfo
    #field int mappedInputKinds
    #field int label
    #field short legacyDInputIndex
    #field short legacyHidIndex
    #field int rawReportIndex
    #field intptr inputReport
    #field intptr inputReportItem
#endstruct

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