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

GameInputHapticWaveformInfo

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

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

フィールド

フィールドサイズx64x86説明
usageGameInputUsage4+0+0波形を識別するHIDユーセージである。
isDurationSupportedBYTE1+4+4再生時間の指定に対応するかを示す真偽値である。
isIntensitySupportedBYTE1+5+5強度の指定に対応するかを示す真偽値である。
isRepeatSupportedBYTE1+6+6繰り返し再生に対応するかを示す真偽値である。
isRepeatDelaySupportedBYTE1+7+7繰り返し間隔の指定に対応するかを示す真偽値である。
defaultDurationULONGLONG8+8+8波形の既定再生時間(マイクロ秒)である。

各言語での定義

#include <windows.h>

// GameInputUsage  (x64 4 / x86 4 バイト)
typedef struct GameInputUsage {
    WORD page;
    WORD id;
} GameInputUsage;

// GameInputHapticWaveformInfo  (x64 16 / x86 16 バイト)
typedef struct GameInputHapticWaveformInfo {
    GameInputUsage usage;
    BYTE isDurationSupported;
    BYTE isIntensitySupported;
    BYTE isRepeatSupported;
    BYTE isRepeatDelaySupported;
    ULONGLONG defaultDuration;
} GameInputHapticWaveformInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputUsage
{
    public ushort page;
    public ushort id;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputHapticWaveformInfo
{
    public GameInputUsage usage;
    public byte isDurationSupported;
    public byte isIntensitySupported;
    public byte isRepeatSupported;
    public byte isRepeatDelaySupported;
    public ulong defaultDuration;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputUsage
    Public page As UShort
    Public id As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputHapticWaveformInfo
    Public usage As GameInputUsage
    Public isDurationSupported As Byte
    Public isIntensitySupported As Byte
    Public isRepeatSupported As Byte
    Public isRepeatDelaySupported As Byte
    Public defaultDuration As ULong
End Structure
import ctypes
from ctypes import wintypes

class GameInputUsage(ctypes.Structure):
    _fields_ = [
        ("page", ctypes.c_ushort),
        ("id", ctypes.c_ushort),
    ]

class GameInputHapticWaveformInfo(ctypes.Structure):
    _fields_ = [
        ("usage", GameInputUsage),
        ("isDurationSupported", ctypes.c_ubyte),
        ("isIntensitySupported", ctypes.c_ubyte),
        ("isRepeatSupported", ctypes.c_ubyte),
        ("isRepeatDelaySupported", ctypes.c_ubyte),
        ("defaultDuration", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct GameInputUsage {
    pub page: u16,
    pub id: u16,
}

#[repr(C)]
pub struct GameInputHapticWaveformInfo {
    pub usage: GameInputUsage,
    pub isDurationSupported: u8,
    pub isIntensitySupported: u8,
    pub isRepeatSupported: u8,
    pub isRepeatDelaySupported: u8,
    pub defaultDuration: u64,
}
import "golang.org/x/sys/windows"

type GameInputUsage struct {
	page uint16
	id uint16
}

type GameInputHapticWaveformInfo struct {
	usage GameInputUsage
	isDurationSupported byte
	isIntensitySupported byte
	isRepeatSupported byte
	isRepeatDelaySupported byte
	defaultDuration uint64
}
type
  GameInputUsage = record
    page: Word;
    id: Word;
  end;

  GameInputHapticWaveformInfo = record
    usage: GameInputUsage;
    isDurationSupported: Byte;
    isIntensitySupported: Byte;
    isRepeatSupported: Byte;
    isRepeatDelaySupported: Byte;
    defaultDuration: UInt64;
  end;
const GameInputUsage = extern struct {
    page: u16,
    id: u16,
};

const GameInputHapticWaveformInfo = extern struct {
    usage: GameInputUsage,
    isDurationSupported: u8,
    isIntensitySupported: u8,
    isRepeatSupported: u8,
    isRepeatDelaySupported: u8,
    defaultDuration: u64,
};
type
  GameInputUsage {.bycopy.} = object
    page: uint16
    id: uint16

  GameInputHapticWaveformInfo {.bycopy.} = object
    usage: GameInputUsage
    isDurationSupported: uint8
    isIntensitySupported: uint8
    isRepeatSupported: uint8
    isRepeatDelaySupported: uint8
    defaultDuration: uint64
struct GameInputUsage
{
    ushort page;
    ushort id;
}

struct GameInputHapticWaveformInfo
{
    GameInputUsage usage;
    ubyte isDurationSupported;
    ubyte isIntensitySupported;
    ubyte isRepeatSupported;
    ubyte isRepeatDelaySupported;
    ulong defaultDuration;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputHapticWaveformInfo サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; usage : GameInputUsage (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; isDurationSupported : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; isIntensitySupported : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; isRepeatSupported : BYTE (+6, 1byte)  poke st,6,値  /  値 = peek(st,6)
; isRepeatDelaySupported : BYTE (+7, 1byte)  poke st,7,値  /  値 = peek(st,7)
; defaultDuration : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GameInputUsage
    #field short page
    #field short id
#endstruct

#defstruct global GameInputHapticWaveformInfo
    #field GameInputUsage usage
    #field byte isDurationSupported
    #field byte isIntensitySupported
    #field byte isRepeatSupported
    #field byte isRepeatDelaySupported
    #field int64 defaultDuration
#endstruct

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