Win32 API 日本語リファレンス
ホームGraphics.Direct3D9 › D3DINSTRUCTION

D3DINSTRUCTION

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

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

フィールド

フィールドサイズx64x86説明
bOpcodeBYTE1+0+0実行する命令のオペコード(D3DOPCODE)。
bSizeBYTE1+1+1各命令データ単位のサイズ(バイト単位)。
wCountWORD2+2+2この命令に続くデータ単位の個数(WORD)。

各言語での定義

#include <windows.h>

// D3DINSTRUCTION  (x64 4 / x86 4 バイト)
typedef struct D3DINSTRUCTION {
    BYTE bOpcode;
    BYTE bSize;
    WORD wCount;
} D3DINSTRUCTION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DINSTRUCTION
{
    public byte bOpcode;
    public byte bSize;
    public ushort wCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DINSTRUCTION
    Public bOpcode As Byte
    Public bSize As Byte
    Public wCount As UShort
End Structure
import ctypes
from ctypes import wintypes

class D3DINSTRUCTION(ctypes.Structure):
    _fields_ = [
        ("bOpcode", ctypes.c_ubyte),
        ("bSize", ctypes.c_ubyte),
        ("wCount", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct D3DINSTRUCTION {
    pub bOpcode: u8,
    pub bSize: u8,
    pub wCount: u16,
}
import "golang.org/x/sys/windows"

type D3DINSTRUCTION struct {
	bOpcode byte
	bSize byte
	wCount uint16
}
type
  D3DINSTRUCTION = record
    bOpcode: Byte;
    bSize: Byte;
    wCount: Word;
  end;
const D3DINSTRUCTION = extern struct {
    bOpcode: u8,
    bSize: u8,
    wCount: u16,
};
type
  D3DINSTRUCTION {.bycopy.} = object
    bOpcode: uint8
    bSize: uint8
    wCount: uint16
struct D3DINSTRUCTION
{
    ubyte bOpcode;
    ubyte bSize;
    ushort wCount;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DINSTRUCTION サイズ: 4 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; bOpcode : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; bSize : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; wCount : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DINSTRUCTION
    #field byte bOpcode
    #field byte bSize
    #field short wCount
#endstruct

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