Gfx GX Fn GXInitLightDirv - wowjinxy/libPorpoise GitHub Wiki

GXInitLightDirv

  • Category: Lighting
  • Matrix Status: Implemented
  • Matrix Notes: Official macro API; added SDK-compatible vector macro wrapper.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Lighting/GXInitLightDirv.html
  • Reference header: reference/gx/GXLighting.h
  • SDK behavior:
    • Macro API, not a standalone function:
      • #define GXInitLightDirv(lo, vec) (GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
    • Accepts f32[3] or any struct with first three contiguous f32 members.
    • Writes light object state via GXInitLightDir; no direct register loads.

libPorpoise Implementation

  • Public API header: include/dolphin/gx/GXLighting.h
  • Implementation style:
    • Macro-only wrapper matching SDK expression and layout.
    • Forwards to GXInitLightDir, inheriting its sign-convention behavior.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: macro (lo, vec) form.
    • Porpoise: same macro form.
  • Behavioral parity:
    • SDK: reads three contiguous floats from vec and forwards to GXInitLightDir.
    • Porpoise: same contiguous-float read and forward path.
  • Known divergence:
    • None identified for this macro.

Validation Checklist

  • GX demo coverage checked
  • Pikmin usage path checked
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • Verified manual macro text in reference/man/gfx/gx/Lighting/GXInitLightDirv.html.
  • Verified header macro parity in reference/gx/GXLighting.h and include/dolphin/gx/GXLighting.h.