ホーム › UI.Input.GameInput › GameInputControllerSwitchInfo
GameInputControllerSwitchInfo
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| mappedInputKinds | GameInputKind | 4 | +0 | +0 | このスイッチが対応づく入力種別を示すフラグである。 |
| label | GameInputLabel | 4 | +4 | +4 | スイッチ全体に付与された物理ラベルを示す値である。 |
| positionLabels | GameInputLabel | 36 | +8 | +8 | 各スイッチ位置に対応するラベル配列である。 |
| kind | GameInputSwitchKind | 4 | +44 | +44 | スイッチの種別(2方向/4方向/8方向等)を示す値である。 |
| legacyDInputIndex | WORD | 2 | +48 | +48 | DirectInput互換でのインデックスである。 |
| legacyHidIndex | WORD | 2 | +50 | +50 | HID互換でのインデックスである。 |
| rawReportIndex | DWORD | 4 | +52 | +52 | 生レポート内でのインデックスである。 |
| inputReport | GameInputRawDeviceReportInfo* | 8/4 | +56 | +56 | 対応する入力レポート情報へのポインタである。 |
| inputReportItem | GameInputRawDeviceReportItemInfo* | 8/4 | +64 | +60 | 対応する入力レポートアイテム情報へのポインタである。 |
各言語での定義
#include <windows.h>
// GameInputControllerSwitchInfo (x64 72 / x86 64 バイト)
typedef struct GameInputControllerSwitchInfo {
GameInputKind mappedInputKinds;
GameInputLabel label;
GameInputLabel positionLabels[9];
GameInputSwitchKind kind;
WORD legacyDInputIndex;
WORD legacyHidIndex;
DWORD rawReportIndex;
GameInputRawDeviceReportInfo* inputReport;
GameInputRawDeviceReportItemInfo* inputReportItem;
} GameInputControllerSwitchInfo;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputControllerSwitchInfo
{
public int mappedInputKinds;
public int label;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public int[] positionLabels;
public int kind;
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 GameInputControllerSwitchInfo
Public mappedInputKinds As Integer
Public label As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> Public positionLabels() As Integer
Public kind As Integer
Public legacyDInputIndex As UShort
Public legacyHidIndex As UShort
Public rawReportIndex As UInteger
Public inputReport As IntPtr
Public inputReportItem As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class GameInputControllerSwitchInfo(ctypes.Structure):
_fields_ = [
("mappedInputKinds", ctypes.c_int),
("label", ctypes.c_int),
("positionLabels", ctypes.c_int * 9),
("kind", 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 GameInputControllerSwitchInfo {
pub mappedInputKinds: i32,
pub label: i32,
pub positionLabels: [i32; 9],
pub kind: 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 GameInputControllerSwitchInfo struct {
mappedInputKinds int32
label int32
positionLabels [9]int32
kind int32
legacyDInputIndex uint16
legacyHidIndex uint16
rawReportIndex uint32
inputReport uintptr
inputReportItem uintptr
}type
GameInputControllerSwitchInfo = record
mappedInputKinds: Integer;
label: Integer;
positionLabels: array[0..8] of Integer;
kind: Integer;
legacyDInputIndex: Word;
legacyHidIndex: Word;
rawReportIndex: DWORD;
inputReport: Pointer;
inputReportItem: Pointer;
end;const GameInputControllerSwitchInfo = extern struct {
mappedInputKinds: i32,
label: i32,
positionLabels: [9]i32,
kind: i32,
legacyDInputIndex: u16,
legacyHidIndex: u16,
rawReportIndex: u32,
inputReport: ?*anyopaque,
inputReportItem: ?*anyopaque,
};type
GameInputControllerSwitchInfo {.bycopy.} = object
mappedInputKinds: int32
label: int32
positionLabels: array[9, int32]
kind: int32
legacyDInputIndex: uint16
legacyHidIndex: uint16
rawReportIndex: uint32
inputReport: pointer
inputReportItem: pointerstruct GameInputControllerSwitchInfo
{
int mappedInputKinds;
int label;
int[9] positionLabels;
int kind;
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 レイアウト)
; GameInputControllerSwitchInfo サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; mappedInputKinds : GameInputKind (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; label : GameInputLabel (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; positionLabels : GameInputLabel (+8, 36byte) varptr(st)+8 を基点に操作(36byte:入れ子/配列)
; kind : GameInputSwitchKind (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; legacyDInputIndex : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; legacyHidIndex : WORD (+50, 2byte) wpoke st,50,値 / 値 = wpeek(st,50)
; rawReportIndex : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; inputReport : GameInputRawDeviceReportInfo* (+56, 4byte) varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; inputReportItem : GameInputRawDeviceReportItemInfo* (+60, 4byte) varptr(st)+60 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputControllerSwitchInfo サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; mappedInputKinds : GameInputKind (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; label : GameInputLabel (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; positionLabels : GameInputLabel (+8, 36byte) varptr(st)+8 を基点に操作(36byte:入れ子/配列)
; kind : GameInputSwitchKind (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; legacyDInputIndex : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; legacyHidIndex : WORD (+50, 2byte) wpoke st,50,値 / 値 = wpeek(st,50)
; rawReportIndex : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; inputReport : GameInputRawDeviceReportInfo* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; inputReportItem : GameInputRawDeviceReportItemInfo* (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputControllerSwitchInfo
#field int mappedInputKinds
#field int label
#field int positionLabels 9
#field int kind
#field short legacyDInputIndex
#field short legacyHidIndex
#field int rawReportIndex
#field intptr inputReport
#field intptr inputReportItem
#endstruct
stdim st, GameInputControllerSwitchInfo ; NSTRUCT 変数を確保
st->mappedInputKinds = 100
mes "mappedInputKinds=" + st->mappedInputKinds