summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
committerTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
commit7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch)
tree4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /include
downloadkamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz
kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip
initial commit. now I can start playing with stuff!
Diffstat (limited to '')
-rwxr-xr-xinclude/actors.h813
-rwxr-xr-xinclude/common.h107
-rwxr-xr-xinclude/course.h168
-rwxr-xr-xinclude/event.h16
-rw-r--r--include/g3dhax.h168
-rwxr-xr-xinclude/game.h1102
-rwxr-xr-xinclude/rvl/GXBump.h55
-rwxr-xr-xinclude/rvl/GXCull.h18
-rwxr-xr-xinclude/rvl/GXDispList.h18
-rwxr-xr-xinclude/rvl/GXEnum.h1300
-rwxr-xr-xinclude/rvl/GXGeometry.h82
-rwxr-xr-xinclude/rvl/GXLighting.h94
-rwxr-xr-xinclude/rvl/GXPixel.h49
-rwxr-xr-xinclude/rvl/GXStruct.h132
-rwxr-xr-xinclude/rvl/GXTev.h92
-rwxr-xr-xinclude/rvl/GXTexture.h127
-rwxr-xr-xinclude/rvl/GXTransform.h71
-rwxr-xr-xinclude/rvl/GXVert.h222
-rwxr-xr-xinclude/rvl/OSCache.h61
-rwxr-xr-xinclude/rvl/PPCWGPipe.h37
-rwxr-xr-xinclude/rvl/arc.h115
-rwxr-xr-xinclude/rvl/mtx.h441
-rwxr-xr-xinclude/rvl/tpl.h107
-rwxr-xr-xinclude/rvl/vifuncs.h48
-rwxr-xr-xinclude/rvl/vitypes.h79
-rwxr-xr-xinclude/stage.h63
-rwxr-xr-xinclude/state.h24
27 files changed, 5609 insertions, 0 deletions
diff --git a/include/actors.h b/include/actors.h
new file mode 100755
index 0000000..f1ebe4c
--- /dev/null
+++ b/include/actors.h
@@ -0,0 +1,813 @@
+#ifndef __KAMEK_ACTORS_H
+#define __KAMEK_ACTORS_H
+
+#include <common.h>
+
+enum Actors {
+ BOOT = 0,
+ AUTO_SELECT = 1,
+ SELECT = 2,
+ WORLD_MAP = 3,
+ WORLD_9_DEMO = 4,
+ STAGE = 5,
+ RESTART_CRSIN = 6,
+ CRSIN = 7,
+ MOVIE = 8,
+ GAMEOVER = 9,
+ GAME_SETUP = 10,
+ MULTI_PLAY_COURSE_SELECT = 11,
+ CURSOR = 12,
+ PLAYER = 13,
+ YOSHI = 14,
+ WM_TEST = 15,
+ WM_TEST2 = 16,
+ BG_GM = 17,
+ CAMERA = 18,
+ YOSHI_FIRE = 19,
+ SLOW_QUICK_TAG = 20,
+ TORIDE_KOKOOPA_DEMO = 21,
+ BOSS_KAMECK_DEMO = 22,
+ BOSS_KOOPA_DEMO = 23,
+ CASTLE_KOKOOPA_DEMO_1ST = 24,
+ CASTLE_KOKOOPA_DEMO_2ND = 25,
+ BOSS_KOOPA_JR_DEMO = 26,
+ KOOPA_SHIP_FOR_CASTLE_DEMO = 27,
+ KOOPA_JR_FOR_CASTLE_DEMO = 28,
+ PEACH_FOR_CASTLE_DEMO = 29,
+ KAMECK_FOR_CASTLE_DEMO = 30,
+ LEMMY_FOOTHOLD = 31,
+ LEMMY_FOOTHOLD_MAIN = 32,
+ CASTLE_BOSS_DOOR = 33,
+ CASTLE_BOSS_KEY = 34,
+ AC_BATTLE_GAME = 35,
+ AC_BATTLE_KINOPIO = 36,
+ AC_BATTLE_ITEM = 37,
+ AC_ENDING_MAIN = 38,
+ AC_BLOCK_WIND_TAG = 39,
+ AC_GROUPID = 40,
+ KAWANAGARE = 41,
+ RIVER_PAIPO = 42,
+ RIVER_ITEM = 43,
+ RIVER_COIN = 44,
+ RIVER_STARCOIN = 45,
+ RIVER_LIFT = 46,
+ RIVER_BARREL = 47,
+ RIVER_PUKU = 48,
+ RIVER_PAKKUN = 49,
+ RIVER_MGR = 50,
+ EN_KURIBO = 51,
+ EN_PATA_KURIBO = 52,
+ EN_MAME_KURIBO = 53,
+ EN_NOKONOKO = 54,
+ EN_PATAPATA = 55,
+ EN_MET = 56,
+ EN_TOGEZO = 57,
+ EN_SAKASA_TOGEZO = 58,
+ EN_BLOCK = 59,
+ EN_ITEM = 60,
+ EN_STAR_COIN = 61,
+ EN_STAR_COIN_LINE = 62,
+ EN_STAR_COIN_VOLT = 63,
+ AC_FLAGON = 64,
+ AC_4SWICHAND = 65,
+ AC_4SWICHOR = 66,
+ AC_RANDSWICH = 67,
+ AC_CHNGESWICH = 68,
+ AC_IFSWICH = 69,
+ AC_RNSWICH = 70,
+ EN_BKBLOCK = 71,
+ EN_HNSWICH = 72,
+ EN_PSWICH = 73,
+ EN_QSWICH = 74,
+ EN_BOSS_KOOPA_SWITCH = 75,
+ EN_BOSS_KOOPA_BIG_SWITCH = 76,
+ EN_BLSWICH = 77,
+ EN_BLPSWICH = 78,
+ EN_BLQSWICH = 79,
+ EN_BUBBLE = 80,
+ EN_DOSUN = 81,
+ EN_BIGDOSUN = 82,
+ EN_JUGEM = 83,
+ EN_JUGEM_COIN = 84,
+ EN_EATJUGEM = 85,
+ EN_JUGEM_BODY = 86,
+ EN_TOGEMET = 87,
+ EN_FIREBAR = 88,
+ EN_TOGETEKKYU = 89,
+ EN_BIG_TOGETEKKYU = 90,
+ EN_UP_DOKAN_PAKKUN = 91,
+ EN_DOWN_DOKAN_PAKKUN = 92,
+ EN_RIGHT_DOKAN_PAKKUN = 93,
+ EN_LEFT_DOKAN_PAKKUN = 94,
+ EN_UP_DOKAN_FPAKKUN = 95,
+ EN_DOWN_DOKAN_FPAKKUN = 96,
+ EN_RIGHT_DOKAN_FPAKKUN = 97,
+ EN_LEFT_DOKAN_FPAKKUN = 98,
+ EN_JIMEN_PAKKUN = 99,
+ EN_JIMEN_BIG_PAKKUN = 100,
+ EN_JIMEN_FPAKKUN = 101,
+ EN_JIMEN_BIG_FPAKKUN = 102,
+ EN_WALK_PAKKUN = 103,
+ ICEBALL = 104,
+ PL_FIREBALL = 105,
+ PAKKUN_FIREBALL = 106,
+ BROS_FIREBALL = 107,
+ BOOMERANG = 108,
+ EN_HELPOS = 109,
+ EN_FIREBROS = 110,
+ EN_BOOMERANGBROS = 111,
+ EN_HAMMERBROS = 112,
+ EN_ICEBROS = 113,
+ EN_LIFT_HAMMERBROS = 114,
+ HAMMER = 115,
+ EN_HIMANBROS = 116,
+ MEGA_HAMMER = 117,
+ BROS_ICEBALL = 118,
+ EN_BOYON = 119,
+ EN_REMOCON_TORIMOCHI = 120,
+ TAG_WIND = 121,
+ TAG_THUNDER = 122,
+ TAG_WATER = 123,
+ EN_AUTOSCR = 124,
+ OBJ_GRASS = 125,
+ EN_ENV = 126,
+ EN_KILLER = 127,
+ EN_SEARCH_KILLER = 128,
+ EN_MAGNUM_KILLER = 129,
+ EN_SEARCH_MAGNUM_KILLER = 130,
+ EN_BASABASA = 131,
+ WAKI_PARABOM = 132,
+ EN_BOMHEI = 133,
+ EN_PARA_BOMHEI = 134,
+ EN_MECHA_KOOPA = 135,
+ EN_MOUSE = 136,
+ EN_GHOST_JUGEM = 137,
+ DOKAN_WAKIDASHI = 138,
+ EN_CRASHER = 139,
+ AC_WAKILIFT = 140,
+ EN_BIRIKYU = 141,
+ EN_LINE_BIRIKYU = 142,
+ EN_BIRIKYU_MAKER = 143,
+ EN_CHOROBON = 144,
+ EN_SANBO = 145,
+ EN_SANBO_PARTS = 146,
+ EN_SANBO_EL = 147,
+ EN_GURUGURU = 148,
+ EN_GESSO = 149,
+ EN_BARAMAKI_GESSO = 150,
+ EN_GOALPOLE = 151,
+ EN_GESSO_CHILD = 152,
+ BARNAR_MGR = 153,
+ EN_SYNCRO_BARNAR = 154,
+ EN_BARNAR = 155,
+ EN_LARGE_BARNAR = 156,
+ EN_PUKUPUKU_PARENT = 157,
+ AC_TEAM_PUKUPUKU = 158,
+ EN_PUKUPUKU = 159,
+ EN_TOGEPUKU = 160,
+ EN_MIDDLE_PUKU = 161,
+ EN_PUKUCOIN = 162,
+ EN_KARON = 163,
+ EN_BIGKARON = 164,
+ EN_KARON_HEAD = 165,
+ EN_REVERSE = 166,
+ EN_WAKI_JUGEM = 167,
+ EN_WIRE_TURN = 168,
+ EN_BIG_WIRE_TURN = 169,
+ EN_NET_NOKONOKO_LR = 170,
+ EN_NET_NOKONOKO_UD = 171,
+ BIGHANA_MGR = 172,
+ HANA_MOUNTAIN = 173,
+ EN_HANACHAN = 174,
+ EN_BIG_HANACHAN = 175,
+ EN_TERESA = 176,
+ EN_BIG_TERESA = 177,
+ EN_CROW = 178,
+ EN_BIGPILE_UNDER = 179,
+ EN_BIGPILE_UPPER = 180,
+ EN_BIGPILE_RIGHT = 181,
+ EN_BIGPILE_LEFT = 182,
+ EN_SUPER_BIGPILE_RIGHT = 183,
+ EN_SUPER_BIGPILE_LEFT = 184,
+ EN_GOKUBUTO_BIGPILE_UNDER = 185,
+ EN_GOKUBUTO_BIGPILE_UPPER = 186,
+ EN_MORTON_BIGPILE = 187,
+ EN_YAJIRUSHI = 188,
+ EN_WANWAN = 189,
+ EN_WANWAN_PILE = 190,
+ EN_JUMPPUKU = 191,
+ EN_IGAPUKU = 192,
+ EN_WAKI_IGAPUKU = 193,
+ EN_FIRESNAKE = 194,
+ EN_BOSS_KAMECK = 195,
+ EN_SLIP_PENGUIN = 196,
+ WAKI_SLIP_PENGUIN2 = 197,
+ EN_SLIP_PENGUIN2 = 198,
+ SLIP_PENGUIN2_GLASSES = 199,
+ EN_IGA_KURIBO = 200,
+ EN_WATERSTREAM = 201,
+ AWA = 202,
+ DUMMY_DOOR_PARENT = 203,
+ DUMMY_DOOR_CHILD = 204,
+ DUMMY_DOOR = 205,
+ NOBORIBOU_OBAKE = 206,
+ UNTEI_ROPE = 207,
+ REMO_DOOR = 208,
+ REMO_SLIDE_DOOR = 209,
+ BRANCH = 210,
+ BG_CENTER = 211,
+ KAMECK_MAGIC = 212,
+ SINKDOKAN_UP = 213,
+ SINKDOKAN_DOWN = 214,
+ SINKDOKAN_LEFT = 215,
+ SINKDOKAN_RIGHT = 216,
+ FLYDOKAN_UP = 217,
+ FLYDOKAN_DOWN = 218,
+ FLYDOKAN_LEFT = 219,
+ FLYDOKAN_RIGHT = 220,
+ EN_HATENA_BALLOON = 221,
+ EN_ONEWAY_GATE = 222,
+ EN_PATABLOCK = 223,
+ EN_KERONPA = 224,
+ KERONPA_FIRE = 225,
+ AC_NEXTGOTO_BLOCK = 226,
+ EN_BAKUBAKU = 227,
+ EN_DOOR = 228,
+ EN_SWITCHDOOR = 229,
+ EN_OBAKEDOOR = 230,
+ EN_TORIDEDOOR = 231,
+ EN_CASTLEDOOR = 232,
+ EN_KOOPADOOR = 233,
+ AC_REVERSEBLOCK = 234,
+ CHUKAN_POINT = 235,
+ EN_MAX_UE_LEFT = 236,
+ EN_MAX_UE_RIGHT = 237,
+ EN_MAX_UE2_LEFT = 238,
+ EN_MAX_UE2_RIGHT = 239,
+ EN_ZOOM = 240,
+ EN_BOSS_LARRY = 241,
+ EN_BOSS_WENDY = 242,
+ EN_BOSS_IGGY = 243,
+ EN_BOSS_LEMMY = 244,
+ EN_BOSS_MORTON = 245,
+ EN_BOSS_ROY = 246,
+ EN_BOSS_LUDWIG = 247,
+ EN_BOSS_CASTLE_LARRY = 248,
+ EN_BOSS_CASTLE_ROY = 249,
+ EN_BOSS_CASTLE_WENDY = 250,
+ EN_BOSS_CASTLE_IGGY = 251,
+ CASTLE_LEMMY_BALL = 252,
+ EN_BOSS_CASTLE_LEMMY = 253,
+ EN_BOSS_CASTLE_MORTON = 254,
+ OBJ_LUDWIG = 255,
+ EN_BOSS_CASTLE_LUDWIG = 256,
+ EN_BOSS_KOOPA = 257,
+ EN_BOSS_KOOPA_DEMO_KAMECK = 258,
+ EN_BOSS_KOOPA_DEMO_PEACH = 259,
+ AC_WAKI_KOOPA_FIRE = 260,
+ KOOPA_FIRE = 261,
+ LARRY_FIRE = 262,
+ KOKOOPA_RING = 263,
+ KOKOOPA_BALL = 264,
+ KOKOOPA_THREEWAY_BLITZ = 265,
+ LEMMY_BALL = 266,
+ CASTLE_LEMMY_THROW_BALL = 267,
+ OBJ_IGGY_SLED = 268,
+ OBJ_IGGY_WANWAN = 269,
+ OBJ_MORTON = 270,
+ OBJ_ROY = 271,
+ OBJ_LARRY = 272,
+ OBJ_WENDY = 273,
+ AC_BOSS_KOOPA_SCAFFOLD = 274,
+ AC_BOSS_KOOPA_RUBBLE = 275,
+ AC_BOSS_KOOPA_BG_EFFECT = 276,
+ CASTLE_LUDWIG_BLITZ = 277,
+ CASTLE_LUDWIG_BLITZ_MGR = 278,
+ WAKI_KOKOOPA_FIRE = 279,
+ FALL_FIRE = 280,
+ WAKI_FIRE = 281,
+ FIRE_BLITZ = 282,
+ KOKOOPA_SEARCH_FIRE = 283,
+ EN_UNIZOO = 284,
+ EN_UNIRA = 285,
+ EN_KANIBO = 286,
+ EN_KANITAMA = 287,
+ EN_KOPONE = 288,
+ EN_AKOYA = 289,
+ EN_MIDDLE_KURIBO = 290,
+ EN_LARGE_KURIBO = 291,
+ EN_BEANS_KURIBO = 292,
+ AC_STRONGBOX = 293,
+ EN_REMOCON_CANNON = 294,
+ WAKI_TOGETEKKYU = 295,
+ JR_CLOWN_A = 296,
+ JR_CLOWN_B = 297,
+ JR_CLOWN_C = 298,
+ JR_CLOWN_FOR_PLAYER = 299,
+ FLOOR_JR_A = 300,
+ FLOOR_JR_B = 301,
+ FLOOR_JR_C = 302,
+ FLOOR_JR_C_MGR = 303,
+ BOMB_JR_C = 304,
+ EN_BOSS_KOOPA_JR_A = 305,
+ EN_BOSS_KOOPA_JR_B = 306,
+ EN_BOSS_KOOPA_JR_C = 307,
+ JR_FIRE = 308,
+ JR_FLOOR_FIRE = 309,
+ JR_FLOOR_FIRE_MGR = 310,
+ JR_CLOWN_FOR_JR_C_DEMO = 311,
+ KAMECK_FOR_AIRSHIP_DEMO = 312,
+ PEACH_FOR_AIRSHIP_DEMO = 313,
+ KOOPA_SHIP_FOR_AIRSHIP_DEMO = 314,
+ EN_EATCOIN = 315,
+ AC_WAKI_KILLER = 316,
+ WAKI_KERONPA = 317,
+ AC_WAKI_PUKUPUKU = 318,
+ BELT_NEEDLE = 319,
+ INTERMITTENT = 320,
+ MIST_INTERMITTENT = 321,
+ YOGAN_INTERMITTENT = 322,
+ EN_IBARAMUSHI = 323,
+ WAKI_ANKOH = 324,
+ EN_CHOCHIN_ANKOH = 325,
+ EN_MISTMAN = 326,
+ EN_TESTMAN = 327,
+ EN_CLOUD = 328,
+ AC_ITEM_KEY = 329,
+ AC_YOSHI_EGG = 330,
+ EN_WATERPAIPO = 331,
+ EN_WATERPAKKUN = 332,
+ FOO_BALL = 333,
+ MT_HANACHAN = 334,
+ EN_LR_STOP_UP = 335,
+ EN_LR_STOP_DW = 336,
+ EN_ROT_PAKKUN = 337,
+ EN_POLTER = 338,
+ EN_ICICLE = 339,
+ WALLINSECT_MGR = 340,
+ EN_WALLINSECT = 341,
+ EN_LANDBARREL = 342,
+ EN_IWAO = 343,
+ IWAO_ROCK = 344,
+ KAZAN_MGR = 345,
+ KAZAN_ROCK = 346,
+ EN_CANNON_BULLET = 347,
+ EN_CHOROPU = 348,
+ EN_MANHOLE_CHOROPU = 349,
+ CHOROPOO_SHADOW = 350,
+ MINI_GAME_BALLOON = 351,
+ MINI_GAME_BALLOON_STICK = 352,
+ EN_JELLY_FISH = 353,
+ MINI_GAME_WIRE_MESH = 354,
+ MINI_GAME_GUN_BATTERY_MGR = 355,
+ MINI_GAME_GUN_BATTERY_MGR_OBJ = 356,
+ MINI_GAME_WIRE_MESH_MGR = 357,
+ MINI_GAME_WIRE_MESH_MGR_OBJ = 358,
+ PEACH_CASTLE_SEQUENCE_MGR = 359,
+ PEACH_CASTLE_SEQUENCE_MGR_OBJ = 360,
+ PEACH_CASTLE_BLOCK = 361,
+ MINI_GAME_KINOPIO = 362,
+ AC_KANBAN_ARROW = 363,
+ AC_WATER_BUBBLE = 364,
+ EN_BUBBLE_CONTROL = 365,
+ AC_WAKI_WOODBOX = 366,
+ AC_AUTOSCROOL_SWICH = 367,
+ AC_ROTATION_GHOST_PARENT = 368,
+ EN_ROTATION_GHOST = 369,
+ SHIP_WINDOW = 370,
+ EN_MADOPU = 371,
+ SPANA = 372,
+ EN_GABON = 373,
+ GABON_ROCK = 374,
+ MANHOLE = 375,
+ BGM_INTERLOCKING_DUMMY_BLOCK = 376,
+ BGM_INTERLOCKING_DUMMY_BLOCK_MGR = 377,
+ EN_KING_KILLER = 378,
+ EN_WATER_BUBBLE_BULLET = 379,
+ EN_FRUIT = 380,
+ OBJ_SPARKS = 381,
+ OBJ_SNOW = 382,
+ TAG_SCROLL = 383,
+ AC_BLOCK_GROUP = 384,
+ AC_BLOCK_ONEUP = 385,
+ AC_BLOCK_COIN = 386,
+ AC_WAKI_SEARCH_MAGKILLER = 387,
+ EN_TOBIPUKU = 388,
+ AC_WAKI_TOBIPUKU = 389,
+ NEEDLE_FOR_KOOPA_JR_B = 390,
+ TOP_BG_FOR_CASTLE_LUDWIG = 391,
+ MIDDLE_BG_FOR_CASTLE_LUDWIG = 392,
+ BOTTOM_BG_FOR_CASTLE_LUDWIG = 393,
+ MD_ACTOR = 394,
+ MD_CAMERA = 395,
+ EN_CLOUDLT = 396,
+ UNIT_RAIL = 397,
+ UNIT_CHIKUWA = 398,
+ OBJ_SEAWEED = 399,
+ TAG_ENVSOUND = 400,
+ EN_COIN = 401,
+ EN_COIN_JUGEM = 402,
+ EN_COIN_JUMP = 403,
+ EN_COIN_FLOOR = 404,
+ EN_COIN_VOLT = 405,
+ EN_COIN_WIND = 406,
+ EN_BLUE_COIN = 407,
+ EN_COIN_WATER = 408,
+ EN_REDCOIN = 409,
+ EN_GREENCOIN = 410,
+ ICE_ACTOR = 411,
+ AC_LIGHT_BLOCK = 412,
+ AC_PROP_BLOCK = 413,
+ ENEMY_ICE = 414,
+ PLAYER_ICE = 415,
+ SLIDE_BLOCK = 416,
+ POW_BLOCK = 417,
+ BLOCK_TARU = 418,
+ OBJ_CENTER = 419,
+ OBJ_CENTER2 = 420,
+ EN_LIFT_ROTATION_FULL = 421,
+ LIFT_ROTATION_FULL_CHIKA = 422,
+ LIFT_ROTATION_FULL_KINOKO = 423,
+ LIFT_ROTATION_FULL_COLOR = 424,
+ CAGE_BLOCK = 425,
+ LIFT_ZEN_HAMMER = 426,
+ LIFT_ZEN_SUISYA = 427,
+ LIFT_ZEN_KAITEN_KANAAMI = 428,
+ MOUSE_HOLE = 429,
+ KATAMUKIYUKA = 430,
+ LIFT_TORIDE_ROLL = 431,
+ AC_LIFT_RIDE_HMOVE = 432,
+ AC_LIFT_OBJBG_VMOVE = 433,
+ AC_LIFT_OBJBG_HMOVE = 434,
+ AC_LIFT_OBJBG_HMOVE_BIG = 435,
+ EN_OBJ_POL = 436,
+ EN_OBJ_POL_TORIDE = 437,
+ EN_OBJ_POL_NEEDLE_L = 438,
+ EN_OBJ_POL_NEEDLE_R = 439,
+ EN_OBJ_POL_NEEDLE_LR = 440,
+ EN_OBJ_POL_NEEDLE_U = 441,
+ EN_OBJ_POL_NEEDLE_D = 442,
+ EN_OBJ_POL_NEEDLE_UD = 443,
+ LIFT_ZEN_TOGE = 444,
+ LIFT_ZEN_SHIRO_YOGAN = 445,
+ LIFT_ZEN_KAIHEI = 446,
+ LIFT_DOKAN = 447,
+ EN_PAIR_OBJ_PARENT = 448,
+ EN_PAIR_OBJ_CHILD = 449,
+ LIFT_ZEN_SHIRO = 450,
+ EN_PAIR_OBJ_CHILD_TORIDE = 451,
+ WAKI_ICE_ASHIBA = 452,
+ WAKI_ICE_ASHIBA_WATER = 453,
+ ICE_ASHIBA = 454,
+ ICE_ASHIBA_WATER = 455,
+ ICE_ASHIBA_RAIL = 456,
+ AC_LIFT_RIDE_VMOVE = 457,
+ AC_LIFT_SEESAW = 458,
+ AC_LIFT_FALL = 459,
+ AC_LIFT_REMOCON_SEESAW = 460,
+ EN_LIFT_WHEEL = 461,
+ AC_LIFT_BALANCE = 462,
+ AC_LIFT_REMOCON_BALANCE_CLINCH = 463,
+ AC_LIFT_REMOCON_BALANCE = 464,
+ AC_LIFT_REMOCON_XLINE = 465,
+ EN_LIFT_REMOCON_TRPLN = 466,
+ EN_TRPLN_WALL = 467,
+ EN_CHIKUWA_BLOCK = 468,
+ EN_CLIFF_CHIKUWA_BLOCK = 469,
+ EN_KILLER_HOUDAI = 470,
+ EN_MAGNUM_KILLER_HOUDAI = 471,
+ AC_WAKILIFT_STEP = 472,
+ AC_LINE_LIFT = 473,
+ LINE_SPIN_LIFT = 474,
+ PALM_TREE = 475,
+ NICE_BOAT = 476,
+ LINE_KINOKO_BLOCK = 477,
+ LADDER = 478,
+ TARZAN_TSUTA = 479,
+ TARZAN_IVY = 480,
+ EN_LIFT_ROTATION_HALF = 481,
+ LIFT_HURIKO_CENTER = 482,
+ LIFT_HURIKO = 483,
+ AC_LIFT_RIDEMOVE = 484,
+ EN_LIFT_BURANKO = 485,
+ AC_LIFT_WATERWHEEL = 486,
+ EN_RAIL_POLYGON = 487,
+ EN_RAIL_POLY_ICE = 488,
+ EN_RAIL_POLY_PARENT = 489,
+ EN_RAIL_POLY_CHILD = 490,
+ FREEFALL = 491,
+ EN_GURA_ROCK = 492,
+ EN_GURA_YUKA = 493,
+ EN_KAITEN_HOUDAI = 494,
+ EN_REDRING = 495,
+ EN_BARREL = 496,
+ EN_JUMPDAI = 497,
+ EN_BIG_HNSWICH = 498,
+ EN_BIGBLOCK = 499,
+ EN_SNAKEBLOCK = 500,
+ EN_MARUTA = 501,
+ OBJ_KAMECK = 502,
+ AC_LIFT_SPINROTATION = 503,
+ AC_LIFT_SPINROTATION_SYNC = 504,
+ EN_RULETBLOCK = 505,
+ AC_LIFT_SCALES = 506,
+ AC_LIFT_SCALES_STEP = 507,
+ EN_TARZANROPE = 508,
+ AC_LIFT_BOSS_REMOCON_SEESAW = 509,
+ AC_CHENGE_BLOCK = 510,
+ EN_FIXATION_ICICLE = 511,
+ EN_OBJ_HATENA_BLOCK = 512,
+ EN_OBJ_HATENAB_BLOCK = 513,
+ EN_OBJ_RENGA_BLOCK = 514,
+ EN_OBJ_CLEAR_BLOCK = 515,
+ AC_OBJ_CLEAR_BLOCK = 516,
+ EN_HATENA_BLOCK_LINE = 517,
+ EN_RENGA_BLOCK_LINE = 518,
+ EN_BLOCK_HATENA_WATER = 519,
+ EN_BLOCK_SOROBAN = 520,
+ EN_BLOCK_STAFFROLL = 521,
+ ELASTIC_KINOKO_PARENT = 522,
+ ELASTIC_KINOKO = 523,
+ EN_WHITE_BLOCK = 524,
+ MANTA_MGR = 525,
+ MANTA_MGR2 = 526,
+ MANTA = 527,
+ AC_LIFT_SLIDE_KINOKO = 528,
+ EN_ROTATION_BLOCK = 529,
+ EN_COIN_ANGLE = 530,
+ ROT_DOKAN = 531,
+ EN_BLOCK_HATENA_ANGLE = 532,
+ EN_BLOCK_RENGA_ANGLE = 533,
+ AC_WIRE_CIRCLE = 534,
+ AC_WIRE_REMOCON = 535,
+ AC_LIFT_ICE_SPRING = 536,
+ ICELUMP = 537,
+ ICECUBE = 538,
+ EN_WOODBOX = 539,
+ EN_PATAMET = 540,
+ EN_BIG_PATAMET = 541,
+ NUT = 542,
+ EN_BIG_MET = 543,
+ EN_GAKE_NOKO = 544,
+ AC_DOKAN_CANNON = 545,
+ AC_SHIP_CANNON = 546,
+ AC_ROT_CANNON = 547,
+ AC_ROT_DOKAN_CANNON = 548,
+ ROT_BARNAR = 549,
+ CIRCLE_RIGHT = 550,
+ BLOCK_LIGHT = 551,
+ HAND_RIGHT = 552,
+ EN_BIG_ICICLE = 553,
+ AC_WATER_BUBBLE_PARENT = 554,
+ AC_WATER_BUBBLE_CANNON = 555,
+ EN_KILLER_HOUDAI_SLIDE = 556,
+ EN_BLACK_PAKKUN = 557,
+ TORCHILIGHT = 558,
+ EN_BLOCK_CLOUD = 559,
+ AC_WIRE_MOVE = 560,
+ OBJ_FRUITTREE = 561,
+ EN_BOUNCE_BALL = 562,
+ EN_BLOCK_HATENA_PLAYER = 563,
+ EN_BLOCK_RENGA_PLAYER = 564,
+ AC_FREEZER = 565,
+ AC_WIRE_FOOTHOLD = 566,
+ EN_ITEM_IVY = 567,
+ TARZAN_ROPE = 568,
+ CANNON_PIPE = 569,
+ KINOKO_LIFT_PARENT = 570,
+ KINOKO_LIFT = 571,
+ OBJ_SPIN_PARENT = 572,
+ OBJ_SPIN_CHILD = 573,
+ OBJ_SPIN_ASHIBA = 574,
+ SPIN_WIRE = 575,
+ WARP_CANNON = 576,
+ OBJ_KINOKO = 577,
+ ZOOM_PIPE = 578,
+ ZOOM_PIPE_DOWN = 579,
+ OBJ_PIPE_UP = 580,
+ OBJ_PIPE_UP_NG = 581,
+ OBJ_PIPE_DOWN = 582,
+ OBJ_PIPE_RIGHT = 583,
+ OBJ_PIPE_LEFT = 584,
+ LIFT_DOWN_ON = 585,
+ OBJ_MOVE_ON_GHOST = 586,
+ LIFT_DOWN_ON_NORMAL = 587,
+ LIFT_RIDE_OFF = 588,
+ LINE_TRAIN = 589,
+ REMO_LINE_LIFT = 590,
+ WATER_LIFT = 591,
+ AC_NICE_COIN = 592,
+ AC_NICE_COIN_REGULAR = 593,
+ EN_BLOCK_HELP = 594,
+ FAR_BG = 595,
+ AC_BG_WATER = 596,
+ AC_BG_LAVA = 597,
+ AC_BG_POISON = 598,
+ AC_BG_SAND = 599,
+ AC_BG_CLOUD = 600,
+ AC_BG_MOYA = 601,
+ AC_WATERALL_RAIL = 602,
+ EN_BLUR = 603,
+ MASK = 604,
+ DTEST = 605,
+ AC_WATER_MOVE = 606,
+ AC_WATER_MOVE_REGULAR = 607,
+ AC_WATER_XINFINITE_MOVE = 608,
+ AC_FLOOR_GYRATION = 609,
+ AC_FLOOR_HOLE_DOKAN = 610,
+ AC_FLOOR_DOKAN_EIGHT = 611,
+ AC_GEAR_GYRATION = 612,
+ AC_SHIP_GEAR = 613,
+ AC_BIGSHELL = 614,
+ EN_BOSS_KOOPA_DEMO_CAGE = 615,
+ AC_STAND = 616,
+ AC_HOUSE_LIGHT = 617,
+ AC_LIGHT_WATER = 618,
+ AC_COPYRIGHT = 619,
+ WII_STRAP = 620,
+ WM_CS_SEQ_MNG = 621,
+ WORLD_CAMERA = 622,
+ WM_MAP = 623,
+ WM_IBARA = 624,
+ WM_ANTLION_MNG = 625,
+ WM_CASTLE = 626,
+ WM_TOWER = 627,
+ WM_PEACH_CASTLE = 628,
+ WM_KILLER = 629,
+ WM_KILLERBULLET = 630,
+ WM_SINKSHIP = 631,
+ WM_SWITCH = 632,
+ WM_START = 633,
+ WM_KINOKO_BASE = 634,
+ WM_KINOKO_RED = 635,
+ WM_KINOKO_1UP = 636,
+ WM_KINOKO_STAR = 637,
+ WM_COURSE = 638,
+ WM_STOP = 639,
+ WM_TORIDE = 640,
+ WM_GHOST = 641,
+ WM_DOKAN = 642,
+ WM_CANNON = 643,
+ WM_KOOPASHIP = 644,
+ WM_BOSS_BASE = 645,
+ WM_BOSS_LARRY = 646,
+ WM_BOSS_ROY = 647,
+ WM_BOSS_WENDY = 648,
+ WM_BOSS_IGGY = 649,
+ WM_BOSS_LEMMY = 650,
+ WM_BOSS_MORTON = 651,
+ WM_BOSS_LUDWIG = 652,
+ WM_BOSS_KAMECK = 653,
+ WM_ANTLION = 654,
+ WM_KURIBO = 655,
+ WM_PUKU = 656,
+ WM_PAKKUN = 657,
+ WM_BROS = 658,
+ WM_JUGEM = 659,
+ WM_PLAYER = 660,
+ WM_SUBPLAYER = 661,
+ WM_NOTE = 662,
+ WM_TREASURESHIP = 663,
+ WM_DIRECTOR = 664,
+ WM_GRID = 665,
+ WM_ISLAND = 666,
+ WM_ITEM = 667,
+ WM_CS_W3_PALM = 668,
+ WM_SURRENDER = 669,
+ WM_KOOPA_CASTLE = 670,
+ WM_ANCHOR = 671,
+ WM_PAKKUNHEAD = 672,
+ WM_CLOUD = 673,
+ WM_SMALLCLOUD = 674,
+ WM_KOOPAJR = 675,
+ WM_PEACH = 676,
+ WM_BOARD = 677,
+ WM_BUBBLE = 678,
+ WM_KINOBALLOON = 679,
+ WM_SANDPILLAR = 680,
+ WM_YOGANPILLAR = 681,
+ WM_KINOPIO = 682,
+ WM_DANCE_PAKKUN = 683,
+ WM_DOKANROUTE = 684,
+ WM_HANACHAN = 685,
+ WM_TOGEZO = 686,
+ WM_MANTA = 687,
+ WM_TERESA = 688,
+ WORLD_SELECT = 689,
+ WORLD_SELECT_GUIDE = 690,
+ COLLECTION_COIN_BASE = 691,
+ COLLECTION_COIN = 692,
+ COURSE_SELECT_MENU = 693,
+ NUMBER_OF_PEOPLE_CHANGE = 694,
+ STOCK_ITEM = 695,
+ STOCK_ITEM_SHADOW = 696,
+ EASY_PAIRING = 697,
+ WM_2D_PLAYER = 698,
+ EVENT_OPENING_TITLE = 699,
+ SELECT_PLAYER = 700,
+ MULTI_COURSE_SELECT = 701,
+ TIME_UP = 702,
+ COURSE_TIME_UP = 703,
+ YES_NO_WINDOW = 704,
+ COURSE_SELECT_MANAGER = 705,
+ FUKIDASHI_MANAGER = 706,
+ SMALL_SCORE_MANAGER = 707,
+ GAMEDISPLAY = 708,
+ OTASUKE_INFO = 709,
+ PAUSEWINDOW = 710,
+ RESULT = 711,
+ POINT_RESULT_MULTI = 712,
+ POINT_RESULT_DATE_FILE = 713,
+ POINT_RESULT_DATE_FILE_FREE = 714,
+ GOAL_MANAGER = 715,
+ COURSE_CLEAR = 716,
+ OTEHON_CLEAR = 717,
+ INFO_WINDOW = 718,
+ SELECT_CURSOR = 719,
+ WARNING_MANAGER = 720,
+ SEQUENCE_BG = 721,
+ GAME_OVER = 722,
+ MODE_SELECT = 723,
+ DATE_FILE = 724,
+ FILE_SELECT = 725,
+ CONTINUE = 726,
+ MINI_GAME_CANNON = 727,
+ MINI_GAME_WIRE = 728,
+ MODEL_PLAY_MANAGER = 729,
+ MODEL_PLAY_BASE = 730,
+ MODEL_PLAY_DATE = 731,
+ MODEL_PLAY_ARROW = 732,
+ MODEL_PLAY_GUIDE = 733,
+ MESSAGE_WINDOW = 734,
+ CHARACTER_CHANGE_SELECT_BASE = 735,
+ CHARACTER_CHANGE_SELECT_CONTENTS = 736,
+ CHARACTER_CHANGE_SELECT_ARROW = 737,
+ CHARACTER_CHANGE_INDICATOR = 738,
+ MULTI_COURSE_SELECT_CONTENTS = 739,
+ COLLECTION_COIN_DATE = 740,
+ CONTROLLER_INFORMATION = 741,
+ DRAW_GAME = 742,
+ STAFF_CREDIT_SCORE = 743,
+ THE_END = 744,
+ DEMO_MESSAGE = 745,
+ LETTER_WINDOW = 746,
+ DUMMY_ACTOR = 747,
+ LASTACTOR_STAGE = 748,
+ LASTACTOR = 749
+};
+
+struct Actor {
+ int field_0x00;
+ unsigned int settings;
+ short type;
+ int field_0x0A;
+ char field_0x0E;
+ char field_0x0F;
+ tree_node node;
+ int field_0x24;
+ int field_0x28;
+ void *field_0x2C;
+ short field_0x30;
+ short field_0x32;
+ int field_0x34;
+ int field_0x38;
+ void *field_0x3C;
+ short field_0x40;
+ short field_0x42;
+ int field_0x44;
+ int field_0x48;
+ void *field_0x4C;
+ int field_0x50;
+ int field_0x54;
+ int field_0x58;
+ void *vtable;
+ int field_0x64;
+ int field_0x68;
+ char *class_name;
+ int field_0x70;
+ int field_0x74;
+ void *field_0x78;
+ int field_0x7C;
+ int field_0x80;
+ int field_0x84;
+ int field_0x88;
+ int field_0x8C;
+ int field_0x90;
+ int field_0x94;
+ int field_0x98;
+ int field_0x9C;
+ int field_0xA0;
+ int field_0xA4;
+ int field_0xA8;
+ VEC3 position;
+ // more goes here eventually...
+};
+
+Actor *CreateActor(Actors type, u32 settings, VEC3 *pos, void *rot, char layer);
+Actor *GetActorParent(Actor *ac);
+char *GetActorName(Actors type);
+
+Actor *FindActorByID(int id);
+Actor *FindActorByType(Actors type, Actor *startFrom);
+
+#endif
diff --git a/include/common.h b/include/common.h
new file mode 100755
index 0000000..b8bce80
--- /dev/null
+++ b/include/common.h
@@ -0,0 +1,107 @@
+#ifndef __KAMEK_COMMON_H
+#define __KAMEK_COMMON_H
+
+
+#define GEKKO
+
+/* Common Number Types */
+typedef signed long long s64;
+typedef signed int s32;
+typedef signed short s16;
+typedef signed char s8;
+
+typedef unsigned long long u64;
+typedef unsigned int u32;
+typedef unsigned short u16;
+typedef unsigned char u8;
+
+typedef float f32;
+typedef double f64;
+
+typedef unsigned long ulong;
+typedef unsigned int uint;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+
+typedef char* Ptr; // DUMB
+
+typedef int BOOL;
+#define TRUE 1
+#define FALSE 0
+
+#define NULL 0
+
+/* Structures */
+typedef f32 Mtx[3][4];
+typedef f32 (*MtxPtr)[4];
+typedef f32 Mtx44[4][4];
+typedef f32 (*Mtx44Ptr)[4];
+typedef f32 ROMtx[4][3];
+typedef f32 (*ROMtxPtr)[3];
+
+typedef struct { f32 x, y; } VEC2, Vec2, *Vec2Ptr, Point2d, *Point2dPtr;
+typedef struct { f32 x, y, z; } VEC3, Vec, *VecPtr, Point3d, *Point3dPtr;
+typedef struct { s16 x; s16 y; s16 z; }S16Vec, *S16VecPtr;
+typedef struct { f32 x, y, z, w; } Quaternion, *QuaternionPtr, Qtrn, *QtrnPtr;
+
+#include "rvl/mtx.h"
+
+
+inline void *operator new(unsigned long size, void *ptr) { return ptr; }
+
+
+
+struct tree_node {
+ tree_node *parent, *child, *prev_sibling, *next_sibling;
+ void *obj;
+};
+
+/* Virtual Function Helpers */
+//#define VF_BEGIN(type, obj, id, vtable_offset) \
+// { type __VFUNC = (((u32)(obj))+(vtable_offset));
+#define VF_BEGIN(type, obj, id, vtable_offset) \
+ { type __VFUNC = ((type*)(*((void**)(((u32)(obj))+(vtable_offset)))))[(id)];
+
+#define VF_CALL __VFUNC
+
+#define VF_END }
+
+
+
+
+/* Common Functions */
+
+void OSReport(const char *format, ...);
+int sprintf(char *buffer, const char *format, ...);
+int snprintf(char *buffer, int buff_size, const char *format, ...);
+char *strcat(const char *destination, const char *source);
+void *memset(void *ptr, int value, unsigned int num);
+
+void *AllocFromGameHeap1(u32 size);
+void FreeFromGameHeap1(void *block);
+
+/* Archive */
+/*#ifdef REGION_PAL
+ #define ARC_TABLE ((*((void**)0x8042A318))+4)
+ #define RAW_ARC_TABLE (*((void**)0x8042A318))
+#endif
+
+#ifdef REGION_NTSC
+ #define ARC_TABLE ((*((void**)0x8042A038))+4)
+ #define RAW_ARC_TABLE (*((void**)0x8042A038))
+#endif
+
+char *RetrieveFileFromArc(void *table, char *name, char *path);
+char *RetrieveFileFromArcAlt(void *table, char *name, char *path);*/
+
+extern void *ArchiveHeap; // PAL 0x8042A72C, NTSC 0x8042A44C
+
+
+#ifdef __MWERKS__
+ #define InfiniteLoop for (;;) { asm { nop } }
+#else
+ #define InfiniteLoop for (;;) { asm("nop"); }
+#endif
+
+
+#endif
diff --git a/include/course.h b/include/course.h
new file mode 100755
index 0000000..6fa0f55
--- /dev/null
+++ b/include/course.h
@@ -0,0 +1,168 @@
+#ifndef __KAMEK_COURSE_H
+#define __KAMEK_COURSE_H
+
+#include <common.h>
+
+struct BGDatObject_t {
+ s16 objType;
+ s16 x;
+ s16 y;
+ s16 width;
+ s16 height;
+};
+
+struct Block1 {
+ char tileset0[32];
+ char tileset1[32];
+ char tileset2[32];
+ char tileset3[32];
+};
+
+#define COURSE_FLAG_WRAP 1
+
+struct Block2 {
+ u64 defaultEvents;
+ s16 courseFlags;
+ s16 timeLimit;
+ u8 unk1;
+ u8 unk2;
+ u8 unk3;
+ u8 unk4;
+ u8 startEntrance;
+ u8 unk5;
+ u8 unk6;
+ u8 unk7;
+};
+
+struct Block3 {
+ s32 yBoundNormalTop;
+ s32 yBoundNormalBottom;
+ s32 yBoundSpecialTop;
+ s32 yBoundSpecialBottom;
+ u16 entryID;
+ u16 lockToBottom;
+ u32 unknown;
+};
+
+struct Block4 {
+ u16 unk1;
+ u16 unk2;
+ u16 unk3;
+ u16 unk4;
+};
+
+struct BGSettings {
+ u16 entryID;
+ u16 xScrollRate;
+ u16 yScrollRate;
+ u16 yPosOffset;
+ u16 xPosOffset;
+ u16 fileID1;
+ u16 fileID2;
+ u16 fileID3;
+ u16 unk1;
+ u16 scale;
+ u32 unk2;
+};
+
+#define ENTRANCE_FLAG_NO_ENTRY 0x80
+#define ENTRANCE_FLAG_CONNECTED_PIPE 8
+#define ENTRANCE_FLAG_LINK_TO_FORWARD 4
+#define ENTRANCE_FLAG_CONNECTED_REVERSE 1
+
+struct Block7 {
+ s16 xPos;
+ s16 yPos;
+ s16 cameraXPos;
+ s16 cameraYPos;
+ u8 entryID;
+ u8 destArea;
+ u8 destEntrance;
+ u8 type;
+ u8 unk1;
+ u8 zoneID;
+ u8 layerID;
+ u8 pathID;
+ u16 flags;
+ u16 unk2;
+};
+
+struct Block8 {
+ u16 type;
+ s16 xPos;
+ s16 yPos;
+ u16 eventIDs;
+ u32 settings;
+ u8 zoneID;
+ u8 layerID;
+ u16 unused;
+};
+
+struct Block9 {
+ u16 type;
+ u16 unused;
+};
+
+struct Block10 {
+ s16 xPos;
+ s16 yPos;
+ s16 xSize;
+ s16 ySize;
+ s16 objShading;
+ s16 bgShading;
+ u8 zoneID;
+ u8 boundingID;
+ u8 scrollMode;
+ u8 zoomMode;
+ u8 unk1;
+ u8 lightMode;
+ u8 fgID;
+ u8 bgID;
+ u8 unk2;
+ u8 unk3;
+ u8 music;
+ u8 audioModifier;
+};
+
+struct Block11 {
+ s16 xPos;
+ s16 yPos;
+ s16 xSize;
+ s16 ySize;
+ u8 entryID;
+ u8 unused[3];
+};
+
+struct Block12 {
+ u32 unk1;
+ u32 unk2;
+ u32 unk3;
+ u8 unk4;
+ u8 scrollMode;
+ u8 zoomMode;
+ u8 unk5;
+ u16 unk6;
+ u8 eventID;
+ u8 unk7;
+};
+
+#define PATH_FLAG_LOOP 2
+
+struct Block13 {
+ u8 pathID;
+ u8 unknown;
+ u16 startNode;
+ u16 nodeCount;
+ u16 flags;
+};
+
+struct Block14 {
+ u16 xPos;
+ u16 yPos;
+ float speed;
+ float accel;
+ short unk1;
+ short unk2;
+};
+
+#endif
diff --git a/include/event.h b/include/event.h
new file mode 100755
index 0000000..c0c1c99
--- /dev/null
+++ b/include/event.h
@@ -0,0 +1,16 @@
+#ifndef __KAMEK_EVENT_H
+#define __KAMEK_EVENT_H
+
+#include <common.h>
+
+#ifdef REGION_PAL
+ #define EVENT_TABLE (*((void**)0x8042A358))
+#endif
+
+#ifdef REGION_NTSC
+ // ...
+#endif
+
+void TriggerEventFlag(void *eventstruct, u8 event, u8 delay, u8 method, s32 unk3, u8 expiry, s32 unk5);
+
+#endif
diff --git a/include/g3dhax.h b/include/g3dhax.h
new file mode 100644
index 0000000..c3aeaef
--- /dev/null
+++ b/include/g3dhax.h
@@ -0,0 +1,168 @@
+// nw4r::g3d wrapper
+
+namespace nw4r {
+namespace g3d {
+
+class ResName {
+public:
+ const char *name;
+
+ ResName(const char *p = NULL) {
+ name = p;
+ }
+};
+
+class ResFile {
+public:
+ void * /*ResFileData*/ data;
+
+ ResFile(void *p = NULL) {
+ data = p;
+ }
+
+ void Init();
+ bool CheckRevision() const;
+
+ void * /*ResMdl*/ GetResMdl(const char *str) const;
+ void * /*ResPltt*/ GetResPltt(const ResName n) const;
+ void * /*ResTex*/ GetResTex(const char *str) const;
+ void * /*ResTex*/ GetResTex(const ResName n) const;
+ void * /*ResTex*/ GetResTex(u32 idx) const;
+ void * /*ResAnmChr*/ GetResAnmChr(const char *str) const;
+ void * /*ResAnmVis*/ GetResAnmVis(const char *str) const;
+ void * /*ResAnmClr*/ GetResAnmClr(const char *str) const;
+ void * /*ResAnmTexPat*/ GetResAnmTexPat(const char *str) const;
+ void * /*ResAnmTexSrt*/ GetResAnmTexSrt(const char *str) const;
+ void * /*ResAnmScn*/ GetResAnmScn(const char *str) const;
+
+ bool Bind(ResFile rhs);
+};
+
+void *__ScnMdlSimple__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResMdl*/ mdl,
+ int nView = 1);
+
+
+void *__ScnMdl__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResMdl*/ mdl,
+ u32 bufferOption,
+ int nView = 1);
+
+
+void *__AnmObjChrRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmChr*/ resAnm,
+ void * /*ResMdl*/ resMdl,
+ bool bHasCache);
+
+
+void *__AnmObjVisRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmVis*/ resAnm,
+ void * /*ResMdl*/ resMdl);
+
+
+void *__AnmObjTexPatRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmTexPat*/ resAnm,
+ void * /*ResMdl*/ resMdl,
+ bool bHasCache);
+
+
+void *__AnmObjTexSrtRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmTexSrt*/ resAnm,
+ void * /*ResMdl*/ resMdl,
+ bool bHasCache);
+
+
+void *__AnmObjMatClrRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmMatClr*/ resAnm,
+ void * /*ResMdl*/ resMdl,
+ bool bHasCache);
+
+
+void *__AnmObjShpRes__Construct(
+ void * /*MEMAllocator*/ pHeap,
+ u32 *pSize,
+ void * /*ResAnmShp*/ resAnm,
+ void * /*ResMdl*/ resMdl,
+ bool bHasCache);
+
+
+
+bool InsertIntoScene(void *scnObj); // 80164F90
+
+extern void *g3dMemAllocator; // 8042A6A8
+
+inline void *ConstructScnMdlSimple(void *mdl, int nView = 1) {
+ return __ScnMdlSimple__Construct(g3dMemAllocator, 0, mdl, nView);
+}
+
+inline void *ConstructScnMdl(void *mdl, u32 bufferOption, int nView = 1) {
+ return __ScnMdl__Construct(g3dMemAllocator, 0, mdl, bufferOption, nView);
+}
+
+
+
+}
+}
+
+
+class mHeapAllocator_c { // Actually that weird subclass. INCOMPLETE!!
+public:
+ char data1[0x10];
+
+ mHeapAllocator_c();
+ virtual ~mHeapAllocator_c();
+ virtual void *alloc(u32 size);
+ virtual void free(void *block);
+
+ bool link(s32 size, void *heap, const char *name, int align);
+ u32 unlink();
+
+ char data2[8];
+};
+
+namespace m3d {
+
+ class mdl_c {
+ public:
+ mdl_c();
+ virtual ~mdl_c();
+
+ virtual void _vf0C();
+ virtual void _vf10();
+ virtual bool scheduleForDrawing();
+ virtual void bindAnim(void *anim, float boo);
+ virtual void _vf1C();
+
+ bool setup(void *model, void *allocator, u32 bufferOption, int nView, u32 *size);
+ void oneSetupType();
+ void sub_80064BF0();
+
+ void setDrawMatrix(const Mtx matrix);
+
+ char data[0x3C];
+ };
+};
+
+
+
+void SetupTextures_Player(m3d::mdl_c *model, int sceneID); // 800B3E50
+void SetupTextures_Map(m3d::mdl_c *model, int sceneID); // 800B3F50
+void SetupTextures_Boss(m3d::mdl_c *model, int sceneID); // 800B4050
+void SetupTextures_Enemy(m3d::mdl_c *model, int sceneID); // 800B4170
+void SetupTextures_MapObj(m3d::mdl_c *model, int sceneID); // 800B42B0
+void SetupTextures_Item(m3d::mdl_c *model, int sceneID); // 800B43D0
+
diff --git a/include/game.h b/include/game.h
new file mode 100755
index 0000000..cb567f3
--- /dev/null
+++ b/include/game.h
@@ -0,0 +1,1102 @@
+#ifndef __KAMEK_GAME_H
+#define __KAMEK_GAME_H
+
+#include <common.h>
+#include <rvl/mtx.h>
+#include <rvl/GXEnum.h>
+#include <rvl/vifuncs.h>
+
+
+extern "C" {
+int strlen(const char *str);
+
+float atan(float x);
+float atan2(float y, float x);
+
+float cos(float x);
+float sin(float x);
+}
+
+bool DVD_Start();
+bool DVD_End();
+bool DVD_StillLoading(void *dvdclass2);
+void DVD_LoadFile(void *dvdclass, char *folder, char *file, void *callbackData);
+void DVD_FreeFile(void *dvdclass2, char *file);
+
+extern void *DVDClass;
+
+inline void *GetDVDClass() {
+ return DVDClass;
+}
+
+inline void *GetDVDClass2() {
+ return (void*)(((u32)GetDVDClass())+4);
+}
+
+void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file);
+
+
+extern int Player_Active[4];
+extern int Player_ID[4];
+extern int Player_Powerup[4];
+extern int Player_Flags[4];
+extern int Player_Lives[4];
+extern int Player_Coins[4];
+
+struct StartLevelInfo {
+ int maybeUnused;
+ unsigned char unk1; // 0x04
+ unsigned char unk2; // 0x05
+ unsigned char unk3; // 0x06
+ unsigned char unk4; // 0x07
+ unsigned int purpose; // 0x08
+ unsigned char world1; // 0x0C
+ unsigned char level1; // 0x0D
+ unsigned char world2; // 0x0E
+ unsigned char level2; // 0x0F
+};
+
+extern void *GameMgr;
+inline void *GetGameMgr() {
+ return GameMgr;
+}
+
+bool QueryPlayerAvailability(int id);
+void DoStartLevel(void *gameMgr, StartLevelInfo *sl);
+void SetSomeConditionShit(int world, int level, unsigned int bits);
+
+bool IsWideScreen();
+
+#define GAMEMGR_GET_AFC(gmgr) (*((bool*)(((u32)(gmgr))+0xAFC)))
+
+
+#define COND_COIN1 1
+#define COND_COIN2 2
+#define COND_COIN3 4
+#define COND_NORMAL 0x10
+#define COND_SECRET 0x20
+#define COND_SGNORMAL 0x80
+#define COND_SGSECRET 0x100
+
+class SaveFirstBlock {
+public:
+ char titleID[4]; // 0x00
+ u8 field_00; // 0x04
+ u8 field_01; // 0x05
+ u8 current_file; // 0x06
+ u8 field_03; // 0x07
+ u16 freemode_fav[10][0x2A]; // 0x08
+ u16 coinbtl_fav[10][0x2A]; // 0x350
+ u16 bitfield; // 0x698
+ u16 field_69A; // 0x69A
+ u32 checksum; // 0x69C
+};
+
+class SaveBlock {
+public:
+ u8 field_00; // 0x00
+ u8 field_01; // 0x01
+ u8 bitfield; // 0x02
+ u8 current_world; // 0x03
+ u8 field_04; // 0x04
+ u8 current_path_node; // 0x05
+ u8 field_06; // 0x06
+ u8 switch_on; // 0x07
+ u8 field_08; // 0x08
+ u8 powerups_available[7]; // 0x09
+ u8 toad_level_idx[10]; // 0x10
+ u8 player_continues[4]; // 0x1A
+ u8 player_coins[4]; // 0x1E
+ u8 player_lives[4]; // 0x22
+ u8 player_flags[4]; // 0x26
+ u8 player_type[4]; // 0x2A
+ u8 player_powerup[4]; // 0x2E
+ u8 worlds_available[10]; // 0x32
+ u32 ambush_countdown[10]; // 0x3C
+ u16 field_64; // 0x64
+ u16 credits_hiscore; // 0x66
+ u16 score; // 0x68
+ u32 completions[10][0x2A]; // 0x6C
+ u8 hint_movie_bought[70]; // 0x6FC
+ u8 toad_location[10]; // 0x742
+ u8 field_74C[10][4]; // 0x74C
+ u8 field_774[10][4]; // 0x774
+ u8 field_79C[10][4]; // 0x79C
+ u8 death_counts[10][0x2A]; // 0x7C4
+ u8 death_count_3_4_switch; // 0x968
+ u8 pad[0x13]; // 0x969
+ u32 checksum; // 0x97C
+
+ u32 GetLevelCondition(int world, int level);
+ bool CheckLevelCondition(int world, int level, int cond);
+ bool CheckIfCoinCollected(int world, int level, int num);
+};
+
+class SaveFile {
+public:
+ u32 field_00;
+ u32 field_04;
+ u32 field_08;
+ u32 field_0C;
+ u32 field_10;
+ u32 field_14;
+ u32 field_18;
+ u32 field_1C;
+
+ // Real Savefile starts here
+ SaveFirstBlock header;
+ SaveBlock blocks[3];
+ SaveBlock quickSave[3];
+
+ SaveBlock *GetBlock(int id);
+ SaveBlock *GetQSBlock(int id);
+
+ bool CheckIfWriting(); // 0x800E0540
+};
+
+class SaveHandler {
+public:
+ u8 unknown[0x70];
+ u32 CurrentState;
+ u32 CurrentError;
+ u32 field_7C;
+};
+
+extern SaveFile *SaveFileInstance;
+extern SaveHandler *SaveHandlerInstance;
+
+inline SaveFile *GetSaveFile() {
+ return SaveFileInstance;
+}
+
+inline SaveHandler *GetSaveHandler() {
+ return SaveHandlerInstance;
+}
+
+#define WPAD_DOWN 0x0001 // Actually Left, but rotated
+#define WPAD_UP 0x0002 // Actually Right, but rotated
+#define WPAD_RIGHT 0x0004 // Actually Down, but rotated
+#define WPAD_LEFT 0x0008 // Actually Up, but rotated
+#define WPAD_PLUS 0x0010
+#define WPAD_TWO 0x0100
+#define WPAD_ONE 0x0200
+#define WPAD_B 0x0400
+#define WPAD_A 0x0800
+#define WPAD_MINUS 0x1000
+#define WPAD_HOME 0x8000
+
+struct RemoconMngClass {
+ void *vtable;
+ void *controllers[4];
+};
+
+/*
+ * Ok, here's how the remocon/wiimote shit works:
+ * Remocon is a NSMB-specific class, it handles the different control methods
+ * and D-pad directions and such automatically.
+ *
+ * Wiimote is a generic class (part of EGG) -- well it's not actually called
+ * that, but who cares. It handles different types of controllers. Only
+ * query it if whatever you're accessing is control type dependent.
+ */
+
+extern RemoconMngClass *RemoconMng;
+extern int ActiveWiimoteID;
+extern void *ActiveWiimote;
+
+inline RemoconMngClass *GetRemoconMng() {
+ return RemoconMng;
+}
+
+inline int GetActiveWiimoteID() {
+ return ActiveWiimoteID;
+}
+
+inline void *GetActiveRemocon() {
+ return GetRemoconMng()->controllers[GetActiveWiimoteID()];
+}
+
+inline void *GetActiveWiimote() {
+ return ActiveWiimote;
+}
+
+inline unsigned int Remocon_GetButtons(void *self) {
+ return *((unsigned int*)((u32)self+0x18));
+}
+
+inline unsigned int Remocon_GetPressed(void *self) {
+ return *((unsigned int*)((u32)self+0x1C));
+}
+
+typedef bool (*__Wiimote_TestButtons_type)(void*, unsigned int);
+inline bool Wiimote_TestButtons(void *self, unsigned int btns) {
+ VF_BEGIN(__Wiimote_TestButtons_type, self, 8, 0)
+ return VF_CALL(self, btns);
+ VF_END;
+}
+
+int SearchForIndexOfPlayerID(int id);
+
+bool CheckIfContinueShouldBeActivated();
+
+bool CheckIfMenuShouldBeCancelledForSpecifiedWiimote(int num);
+
+void StartTitleScreenStage(bool realDemo, int sceneParam);
+
+bool CheckIfWeCantDoStuff();
+
+u32 QueryGlobal5758(u32 check);
+
+void SaveGame(void *classDoesntMatter, bool isQuick);
+
+#include <actors.h>
+void *CreateParentedObject(short classID, void *parent, int settings, char something);
+void *CreateChildObject(short classID, void *parent, int settings, int unk1, int unk2);
+
+
+#define WIPE_FADE 0
+#define WIPE_CIRCLE 1
+#define WIPE_BOWSER 2
+#define WIPE_WAVY 3
+#define WIPE_MARIO 4
+#define WIPE_CIRCLE_s 5
+
+void ActivateWipe(int type);
+
+typedef void (*ScreenDrawFunc)();
+
+extern ScreenDrawFunc *CurrentDrawFunc;
+void WorldMapDrawFunc();
+void GameSetupDrawFunc();
+
+void GameSetup__LoadScene(void *self); // 0x80919560
+void FreeScene(int id);
+
+void WpadShit(int unk); // 0x8016F780
+
+void *BgTexMng__LoadAnimTile(void *self, int tileset, short tile, char *name, char *delays, char reverse); // 0x80087B60
+
+extern void *GameHeaps[];
+
+
+
+namespace nw4r {
+
+namespace ut {
+ // this isn't 100% accurate because it doesn't use templates
+ // or detail::LinkListImpl, but oh well
+ // I don't need the methods anyway.
+
+ class LinkListNode {
+ LinkListNode *next;
+ LinkListNode *prev;
+ };
+
+ class LinkList {
+ int count;
+ LinkListNode initialNode;
+ };
+
+ class Color : public GXColor { };
+
+ class Rect {
+ f32 left;
+ f32 top;
+ f32 right;
+ f32 bottom;
+ };
+
+ template <class T>
+ class TagProcessorBase { };
+}
+
+namespace lyt {
+ class Pane; // forward declaration
+ class DrawInfo;
+
+ class AnimTransform; // I'll do these later
+ class AnimResource;
+ class AnimationLink;
+ class ResourceAccessor;
+ class GroupContainer;
+
+ class Layout {
+ public:
+ Layout();
+ virtual ~Layout();
+
+ virtual bool Build(const void *data, ResourceAccessor *resAcc);
+
+ virtual AnimTransform *CreateAnimTransform();
+ virtual AnimTransform *CreateAnimTransform(const void *data, ResourceAccessor *resAcc);
+ virtual AnimTransform *CreateAnimTransform(const AnimResource &res, ResourceAccessor *resAcc);
+
+ virtual void BindAnimation(AnimTransform *anim);
+ virtual void UnbindAnimation(AnimTransform *anim);
+ virtual void UnbindAllAnimation();
+ virtual bool BindAnimationAuto(const AnimResource &res, ResourceAccessor *resAcc);
+
+ virtual void SetAnimationEnable(AnimTransform *anim, bool unk);
+
+ virtual void CalculateMtx(const DrawInfo &info);
+
+ virtual void/*?*/ Draw(const DrawInfo &info);
+ virtual void/*?*/ Animate(ulong flag);
+
+ virtual void/*?*/ SetTagProcessor(ut::TagProcessorBase<wchar_t> *tagProc);
+
+ ut::LinkList animations;
+
+ Pane *rootPane;
+ GroupContainer *groupContainer;
+
+ float width;
+ float height;
+ };
+
+
+ class DrawInfo {
+ public:
+ DrawInfo();
+ virtual ~DrawInfo();
+
+ Mtx matrix;
+ float left;
+ float top;
+ float right;
+ float bottom;
+ float scaleX;
+ float scaleY;
+ float alpha;
+ u8 _50; // this is actually a bitfield. todo: investigate how CW handles bitfields, and so on
+ };
+
+
+ class Material {
+ public:
+ // ...
+ };
+
+ class Pane {
+ public:
+ //Pane(nw4r::lyt::res::Pane const *); // todo: this struct
+ Pane(void *);
+ ~Pane();
+
+ virtual void *GetRuntimeTypeInfo() const;
+ virtual void CalculateMtx(const DrawInfo &info);
+
+ virtual void Draw(const DrawInfo &info);
+ virtual void DrawSelf(const DrawInfo &info);
+ virtual void Animate(ulong flag);
+ virtual void AnimateSelf(ulong flag);
+
+ virtual ut::Color GetVtxColor(ulong id) const;
+ virtual void SetVtxColor(ulong id, ut::Color color);
+ virtual uchar GetColorElement(ulong id) const;
+ virtual void SetColorElement(ulong id, uchar value);
+ virtual uchar GetVtxColorElement(ulong id) const;
+ virtual void SetVtxColorElement(ulong id, uchar value);
+
+ virtual Pane *FindPaneByName(const char *name, bool recursive);
+ virtual Material *FindMaterialByName(const char *name, bool recursive);
+
+ virtual void/*?*/ BindAnimation(AnimTransform *anim, bool unk1, bool unk2);
+ virtual void UnbindAnimation(AnimTransform *anim, bool unk);
+ virtual void UnbindAllAnimation(bool unk);
+ virtual void UnbindAnimationSelf(AnimTransform *anim);
+
+ virtual ut::LinkListNode *FindAnimationLinkSelf(AnimTransform *anim);
+ virtual ut::LinkListNode *FindAnimationLinkSelf(const AnimResource &anim);
+
+ virtual void SetAnimationEnable(AnimTransform *anim, bool unk1, bool unk2);
+ virtual void SetAnimationEnable(const AnimResource &anim, bool unk1, bool unk2);
+
+ virtual ulong GetMaterialNum() const;
+ virtual Material *GetMaterial() const;
+ virtual Material *GetMaterial(ulong id) const;
+
+ virtual void LoadMtx(const DrawInfo &info);
+
+ void AppendChild(Pane *child);
+
+ ut::Rect GetPaneRect(const DrawInfo &info) const;
+
+ ut::LinkListNode *AddAnimationLink(AnimationLink *link);
+
+ Vec2 GetVtxPos() const;
+
+
+ ut::LinkListNode parentLink;
+ Pane *parent;
+
+ ut::LinkList children;
+ ut::LinkList animations;
+
+ Material *material;
+
+ Vec trans;
+ Vec rotate;
+ Vec2 scale;
+ Vec2 size;
+
+ Mtx calcMtx;
+ Mtx effectiveMtx;
+
+ float _B4;
+
+ u8 alpha;
+ u8 effectiveAlpha;
+ u8 origin;
+ u8 flag;
+
+ char name[0x14];
+ char userdata[8];
+
+ u8 _D5;
+ u8 paneIsOwnedBySomeoneElse;
+ u8 _D7;
+ };
+}
+
+
+
+namespace g3d {
+struct CameraData
+{
+enum Flag
+ {
+FLAG_CAMERA_LOOKAT = 0x00000001,
+FLAG_CAMERA_ROTATE = 0x00000002,
+FLAG_CAMERA_AIM = 0x00000004,
+MASK_CAMERA = 0x00000007,
+
+FLAG_CMTX_VALID = 0x00000008,
+
+FLAG_PROJ_FLUSTUM = 0x00000010,
+FLAG_PROJ_PERSP = 0x00000020,
+FLAG_PROJ_ORTHO = 0x00000040,
+MASK_PROJ = 0x00000070,
+
+FLAG_PMTX_VALID = 0x00000080,
+
+FLAG_VIEWPORT_JITTER_ABOVE = 0x00000100
+ };
+
+Mtx cameraMtx;
+Mtx44 projMtx;
+
+u32 flags;
+
+VEC3 cameraPos;
+VEC3 cameraUp;
+VEC3 cameraTarget;
+VEC3 cameraRotate;
+f32 cameraTwist;
+
+GXProjectionType projType;
+f32 projFovy;
+f32 projAspect;
+f32 projNear;
+f32 projFar;
+f32 projTop;
+f32 projBottom;
+f32 projLeft;
+f32 projRight;
+
+f32 lightScaleS;
+f32 lightScaleT;
+f32 lightTransS;
+f32 lightTransT;
+
+VEC2 viewportOrigin;
+VEC2 viewportSize;
+f32 viewportNear;
+f32 viewportFar;
+
+u32 scissorX;
+u32 scissorY;
+u32 scissorWidth;
+u32 scissorHeight;
+
+s32 scissorOffsetX;
+s32 scissorOffsetY;
+};
+
+/* Correct camera
+cameraMtx:
+1.0 0.0 0.0 -0.0
+0.0 1.0 0.0 -0.0
+0.0 0.0 1.0 -6000.0
+
+projMtx:
+0.002345 0.000000 0.000000 -1.000000
+0.000000 0.004386 0.000000 -1.000000
+0.000000 0.000000 -0.000005 -0.500000
+0.000000 0.000000 0.000000 1.000000
+
+flags: 000000C9 : FLAG_CAMERA_LOOKAT | FLAG_CMTX_VALID | FLAG_PROJ_ORTHO | FLAG_PMTX_VALID
+
+cameraPos: {0, 0, 15}
+cameraUp: {0, 1, 0}
+cameraTarget: {0, 0, 0}
+cameraRotate: {0, 0, 0}
+cameraTwist: 0
+
+projType: 1
+projFovy: 60
+projAspect: 1.333333
+projNear: -100000
+projFar: 100000
+projTop: 456
+projBottom: 0
+projLeft: 0
+projRight: 853
+
+lightScaleS: 0.5
+lightScaleT: 0.5
+lightTransS: 0.5
+lightTransT: 0.5
+
+viewportOrigin: {0,0}
+viewportSize: {640,456}
+viewportNear: 0
+viewportFar: 1
+
+scissorX: 0
+scissorY: 0
+scissorWidth: 0x280
+scissorHeight: 0x1C8
+
+scissorOffsetX: 0
+scissorOffsetY: 0
+*/
+
+class Camera {
+public:
+ enum PostureType { POSTURE_LOOKAT, POSTURE_ROTATE, POSTURE_AIM };
+ struct PostureInfo
+ {
+ PostureType tp;
+ VEC3 cameraUp;
+ VEC3 cameraTarget;
+ VEC3 cameraRotate;
+ f32 cameraTwist;
+ };
+private:
+ CameraData *data;
+public:
+ Camera(CameraData *pCamera);
+ void Init();
+ void Init(u16 efbWidth, u16 efbHeight, u16 xfbWidth, u16 xfbHeight, u16 viWidth, u16 viHeight);
+ //void SetPosition(f32 x, f32 y, f32 z);
+ void SetPosition(const VEC3 &pos);
+ //void GetPosition(f32 *px, f32 *py, f32 *pz) const;
+ void GetPosition(VEC3 *pPos) const;
+ void SetPosture(const PostureInfo &info);
+ //void GetPosture(PostureInfo *info) const;
+ void SetCameraMtxDirectly(const Mtx &mtx);
+ void GetCameraMtx(Mtx *pMtx) const;
+ void SetOrtho(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far);
+ //void SetFrustum(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far);
+ void SetPerspective(f32 fovy, f32 aspect, f32 near, f32 far);
+ void SetProjectionMtxDirectly(const Mtx44 *pMtx);
+ void GetProjectionMtx(Mtx44 *pMtx) const;
+ //GXProjectionType GetProjectionType() const;
+ void SetScissor(u32 xOrigin, u32 yOrigin, u32 width, u32 height);
+ void SetScissorBoxOffset(s32 xOffset, s32 yOffset);
+ //void GetScissor(u32 *xOrigin, u32 *yOrigin, u32 *width, u32 *height);
+ void SetViewport(f32 xOrigin, f32 yOrigin, f32 width, f32 height);
+ //void SetViewport(f32 xOrigin, f32 yOrigin, f32 width, f32 height, f32 near, f32 far);
+ void SetViewportZRange(f32 near, f32 far);
+ void SetViewportJitter(u32 field);
+ //void SetViewportJitter(f32 xOrigin, f32 yOrigin, f32 width, f32 height, f32 near, f32 far, u32 field);
+ void GetViewport(f32 *xOrigin, f32 *yOrigin, f32 *width, f32 *height, f32 *near, f32 *far) const;
+ void GXSetViewport() const;
+ void GXSetProjection() const;
+ void GXSetScissor() const;
+ void GXSetScissorBoxOffset() const;
+};
+
+namespace G3DState {
+ GXRenderModeObj *GetRenderModeObj();
+}
+}
+}
+
+
+nw4r::g3d::CameraData *GetCameraByID(int id);
+
+int GetCurrentCameraID(); // 80164C80
+void SetCurrentCameraID(int id); // 80164C90
+
+void LinkScene(int id); // 80164D50
+void UnlinkScene(int id); // 80164CD0
+
+void SceneCalcWorld(int sceneID); // 80164E10
+void SceneCameraStuff(int sceneID); // 80164EA0
+
+void CalcMaterial(); // 80164E90
+void DrawOpa(); // 80164F70
+void DrawXlu(); // 80164F80
+
+bool ChangeAlphaUpdate(bool enable); // 802D3270
+
+void DoSpecialDrawing1(); // 8006CAE0
+void DoSpecialDrawing2(); // 8006CB40
+
+void SetupLYTDrawing(); // 80163360
+void ClearLayoutDrawList(); // 801632B0
+
+void DrawAllLayoutsBeforeX(int x); // 80163440
+void DrawAllLayoutsAfterX(int x); // 801634D0
+void DrawAllLayoutsAfterXandBeforeY(int x, int y); // 80163560
+
+void RenderEffects(int v1, int v2); // 80093F10
+
+void RemoveAllFromScnRoot(); // 80164FB0
+void Reset3DState(); // 80165000
+
+extern "C" void GXDrawDone(); // 801C4FE0
+
+
+
+namespace m2d {
+ class Base_c /*: public nw4r::ut::Link what's this? */ {
+ u32 _00;
+ u32 _04;
+
+ Base_c();
+ virtual ~Base_c();
+ virtual void _vf0C();
+
+ u8 _0C;
+ };
+
+ class Simple_c : public Base_c {
+ nw4r::lyt::Layout layout;
+ nw4r::lyt::DrawInfo drawInfo;
+
+ u32 _84;
+ float _88;
+ float _8C;
+ float _90;
+ u32 _94;
+
+ Simple_c();
+ ~Simple_c();
+
+ void _vf0C();
+ virtual void _vf10();
+ virtual void _vf14();
+ };
+}
+
+
+
+namespace EGG {
+ class Frustum {
+ GXProjectionType projType;
+ int isCentered;
+ float width;
+ float height;
+ float fovy;
+ float dunno;
+ float near;
+ float far;
+ float center_x_maybe;
+ float center_y_maybe;
+ float x_direction;
+ float unk2;
+ float unk3;
+ short some_flag_bit;
+
+
+ // isCentered might actually be isNotCentered, dunno
+ Frustum(GXProjectionType projType, Vec2 size, bool isCentered, float near, float far); // 802C6D20
+ Frustum(Frustum &f); // 802C6D90
+ virtual ~Frustum(); // 802C75F0
+
+ virtual void loadDirectly(); // 802C7050
+ virtual void loadIntoCamera(nw4r::g3d::Camera cam); // 802C7070
+
+ void setOrtho(float top, float bottom, float left, float right, float near, float far); // 802C6DD0
+
+ void setFovy(float newFovy); // 802C6F60
+
+ void getCenterPointsBasedOnPos(float x, float y, float *destX, float *destY); // 802C6FD0
+
+ // no idea what this does
+ float getSomethingForPerspective(float blah); // 802C7020
+
+
+ protected:
+ // not all of these might be protected, dunno
+
+ void copyAllFields(Frustum &f); // 802C6EE0
+
+ void saveSomething(float f1, float f2, float f3, float f4); // 802C70C0
+ void loadSomething(float *f1, float *f2, float *f3, float *f4); // 802C70E0
+
+ void loadPerspective(); // 802C7110
+ void loadOrtho(); // 802C7140
+
+ void setCameraPerspective(nw4r::g3d::Camera cam); // 802C7170
+ void setCameraOrtho(nw4r::g3d::Camera cam); // 802C71E0
+
+ void getPerspectiveProjMtx(Mtx44 *mtx); // 802C7250
+ void getPerspectiveProjv(float *ptr); // 802C72E0
+ void getOrthoProjv(float *ptr); // 802C73A0
+
+ void getOrthoVars(float *top, float *bottom, float *left, float *right); // 802C7480
+ };
+}
+
+
+
+
+struct LinkListEntry {
+ LinkListEntry *prev;
+ LinkListEntry *next;
+ void *owned_obj;
+};
+
+
+struct LinkList {
+ LinkListEntry *first;
+ LinkListEntry *last;
+ // PTMF goes here, but I don't know how to represent it
+};
+
+
+struct OrderedLinkListEntry : LinkListEntry {
+ u16 order;
+ u16 _;
+};
+
+
+struct TreeNode {
+ TreeNode *parent;
+ TreeNode *child;
+ TreeNode *prev;
+ TreeNode *next;
+ void *owned_obj;
+};
+
+
+struct Tree {
+ TreeNode *firstNode;
+ // PTMF goes here, but I don't know how to represent it
+};
+
+
+typedef bool (*ChainedFunc)(void*);
+
+struct FunctionChain {
+ ChainedFunc *functions;
+ u16 count;
+ u16 current;
+};
+
+
+class fBase_c {
+public:
+ u32 id;
+ u32 settings;
+ u16 name;
+ u8 _A;
+ u8 _B;
+ u8 _C;
+ u8 _D;
+ u8 base_type;
+ u8 _F;
+ TreeNode link_connect;
+ OrderedLinkListEntry link_execute;
+ OrderedLinkListEntry link_draw;
+ LinkListEntry link_IDlookup;
+ u32 _50;
+ u32 _54;
+ u32 _58;
+ u32 heap;
+
+ fBase_c();
+
+ virtual int onCreate();
+ virtual int beforeCreate();
+ virtual int afterCreate();
+
+ virtual int onDelete();
+ virtual int beforeDelete();
+ virtual int afterDelete();
+
+ virtual int onExecute();
+ virtual int beforeExecute();
+ virtual int afterExecute();
+
+ virtual int onDraw();
+ virtual int beforeDraw();
+ virtual int afterDraw();
+
+ virtual void willBeDeleted();
+
+ virtual bool moreHeapShit(u32 size, void *parentHeap);
+ virtual bool createHeap(u32 size, void *parentHeap);
+ virtual void heapCreated();
+
+ virtual ~fBase_c();
+
+ void Delete();
+
+ fBase_c *GetParent();
+ fBase_c *GetChild();
+ fBase_c *GetNext();
+};
+
+class dBase_c : public fBase_c {
+public:
+ u32 _64;
+ const char *explanation_string;
+ const char *name_string;
+
+ dBase_c();
+
+ int beforeCreate();
+ int afterCreate();
+ int beforeDelete();
+ int afterDelete();
+ int beforeExecute();
+ int afterExecute();
+ int beforeDraw();
+ int afterDraw();
+
+ ~dBase_c();
+
+ virtual const char *GetExplanationString();
+};
+
+class dScene_c : public dBase_c {
+public:
+ FunctionChain *funcChain;
+
+ dScene_c();
+
+ int beforeCreate();
+ int afterCreate();
+ int beforeDelete();
+ int afterDelete();
+ int beforeExecute();
+ int afterExecute();
+ int beforeDraw();
+ int afterDraw();
+
+ ~dScene_c();
+};
+
+class dActor_c : public dBase_c {
+public:
+ LinkListEntry link_actor;
+ Mtx matrix;
+ Vec pos;
+ Vec last_pos;
+ Vec pos_delta;
+ Vec _D0;
+ Vec scale;
+ Vec speed;
+ Vec max_speed;
+ S16Vec rot;
+ S16Vec _106;
+ u32 _10C;
+ u32 _110;
+ float y_speed_inc;
+ u32 _118;
+ float x_speed_inc;
+ u32 _120;
+ bool visible;
+
+ dActor_c();
+
+ virtual void specialDraw1();
+ virtual void specialDraw2();
+ virtual int _vf58();
+ virtual void _vf5C();
+
+ ~dActor_c();
+};
+
+
+
+class dPlayerModelBase_c {
+ // dunno what's public and what's private here
+ // don't really care
+public:
+ dPlayerModelBase_c(u8 player_id); // 800D5420
+ virtual ~dPlayerModelBase_c(); // 800D55D0
+
+ char allocator[28]; // actually a mHeapAllocatorSubclass but I don't have that
+ u32 _20;
+ u32 _24;
+ char someAnimation[2][0x38]; // actually PlayerAnim's
+ char yetAnotherAnimation[40]; // actually m3d::banm_c afaics -- is it even 40 bytes?
+ Vec someVector[2]; // maybe not an array
+ Vec headOffs;
+ Vec scale;
+ u8 player_id_1;
+ u8 player_id_2;
+ u8 powerup_id;
+ u8 powerup_tex;
+ int current_anim;
+ int last_anim_maybe;
+ u32 _15C;
+ int someFlags;
+ u32 _164;
+ u32 _168; // related to jump_strings
+ u32 _16C;
+ u32 _170;
+ u32 _174;
+ u8 _178;
+ char padding[3]; // not needed?
+ u32 model_visibility_flags_maybe;
+ u32 mode_maybe;
+ float _184;
+ float _188;
+ u32 _18C;
+ char someArray[6][12]; // some unknown class/struct
+ char _1D8[0x24];
+ short _1FC;
+ short _1FE;
+ short _200;
+ char padding_[2]; // not needed?
+ u32 _204;
+ u32 _208;
+
+ virtual int _vf0C(); // 800D6DA0
+ virtual void prepare(); // 800D5720
+ virtual void finaliseModel(); // 800D5740
+ virtual void update(); // 800D5750
+ virtual void update3DStuff(); // 800D5760
+ virtual void _vf20(); // 800D6D90
+ virtual void draw(); // 800D5C70
+ virtual int getCurrentModel(); // 800D5870
+ virtual int getCurrentResFile(); // 800D62D0
+ virtual void setPowerup(u8 powerup_id); // 800D5730
+ virtual void setPowerupTexture(); // 800D5CC0
+ virtual void _vf38(); // 800D6D80
+ virtual void _vf3C(); // 800BD750
+ virtual void _vf40(); // 800D6D70
+ virtual void _vf44(); // 800D6D60
+ virtual void _vf48(); // 800BD740
+ virtual void _vf4C(); // 800BD730
+ virtual void getModelMatrix(u32 unk, MtxPtr dest); // 800D5820
+ virtual int _vf54(); // 80318D0C
+ virtual bool _vf58(int type, char *buf, bool unk); // 800D6930
+ virtual void startAnimation(int id, float frame, float unk, float updateRate); // 800D5EC0
+ virtual int _vf60(); // 800D6920
+ virtual void _vf64(int id, float unk1, float unk2, float unk3); // 800D62F0
+ virtual void _vf68(int id, float unk); // 800D63E0
+ virtual void _vf6C(); // 800D62E0
+ virtual void _vf70(); // 800D6690
+ virtual void _vf74(); // 800D66A0
+ virtual void _vf78(); // 800D66B0
+ virtual void SomethingRelatedToPenguinAnims(); // 800D66C0
+ virtual void _vf80(); // 800D6A20
+ virtual void _vf84(float frame); // 800D5D00
+ virtual void _vf88(float frame); // 800D5D70
+ virtual void _vf8C(float updateRate); // 800D5D80
+ virtual void setUpdateRateForAnim1(float updateRate); // 800D5DF0
+ virtual void _vf94(); // 800D6D40
+ virtual int _vf98(); // 800D6D30
+ virtual void _vf9C(); // 800D6D20
+ virtual int _vfA0(); // 800D6D10
+ virtual void _vfA4(); // 800D6D00
+ virtual int _vfA8(); // 800D6CF0
+ virtual void _vfAC(bool blah); // 800BD720
+
+ // I won't even bother with non-virtual functions....
+};
+
+
+class dPlayerModelHandler_c {
+public:
+ dPlayerModelHandler_c(u8 player_id); // 800D6DB0
+ virtual ~dPlayerModelHandler_c(); // 800D6EF0
+
+ dPlayerModelBase_c *mdlClass; // might be dPlayerModel_c ?
+
+ int loadModel(u8 player_id, int powerup_id, int unk); // 800D6EE0
+ void update(); // 800D6F80
+ void setMatrix(Mtx matrix); // 800D6FA0
+ void setSRT(Vec position, S16Vec rotation, Vec scale); // 800D7030
+ void callVF20(); // 800D70F0
+ void draw(); // 800D7110
+
+private:
+ int hasMatrix; // might be bool ?
+
+ void allocPlayerClass(u8 player_id); // 800D6E00
+};
+
+
+class mTexture_c {
+public:
+ mTexture_c(); // 802C0D20
+ mTexture_c(u16 width, u16 height, GXTexFmt format); // 802C0D70
+
+ // vtable is at 80350450
+ virtual ~mTexture_c(); // 802C0DB0
+ virtual void setFlagTo1(); // 802C0E20
+
+ void setImageBuffer(void *buffer); // 802C0E30
+ void load(GXTexMapID id); // 802C0E50
+ void makeTexObj(GXTexObj *obj); // 802C0E90
+ void flushDC(); // 802C0F10
+
+ void makeRadialGradient(); // 802C0F60 parameters unknown yet
+ void makeLinearGradient(int type, char size, u16 startPos, u16 endPos,
+ GXColor begin, GXColor end, bool startAtCenter); // 802C1120
+ // "type" should be enum once I figure it out
+ // reverse might not be accurate
+
+ void allocateBuffer(/* EGG::Heap */void *heap = 0); // 802C14D0
+
+ void plotPixel(u16 x, u16 y, GXColor pixel); // 802C1570
+
+
+ u16 width;
+ u16 height;
+ u8 flags;
+ u8 format;
+ u8 wrapS;
+ u8 wrapT;
+ u8 minFilter;
+ u8 magFilter;
+
+private:
+ void *buffer;
+ void *myBuffer;
+};
+
+
+class dDvdLoader_c {
+public:
+ dDvdLoader_c(); // 8008F140
+ virtual ~dDvdLoader_c(); // 8008F170
+
+ void *load(const char *filename, u8 unk = 0); // 8008F1B0
+
+ bool close(); // 8008F2B0 -- Frees command, DON'T USE THIS unless you free the buffer yourself
+ bool unload(); // 8008F310 -- Frees command and buffer, USE THIS
+
+ int size;
+ void *command; // really mDvd_toMainRam_c
+ void *heap; // really EGG::Heap
+ void *buffer;
+
+private:
+ virtual void freeBuffer(); // 8008F380
+ void freeCommand(); // 8008F3F0
+};
+
+
+
+#endif
+
diff --git a/include/rvl/GXBump.h b/include/rvl/GXBump.h
new file mode 100755
index 0000000..56cbbd9
--- /dev/null
+++ b/include/rvl/GXBump.h
@@ -0,0 +1,55 @@
+#ifndef __GXBUMP_H__
+#define __GXBUMP_H__
+
+//******************************************************************************
+//
+// Graphics Library Indirect Texture (Bump) functions.
+//
+//******************************************************************************
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//------------------------------------------------------------------------------
+// Bump (indirect texture functions).
+//------------------------------------------------------------------------------
+extern void GXSetNumIndStages (u8 nIndStages);
+extern void GXSetIndTexOrder (GXIndTexStageID ind_stage, GXTexCoordID tex_coord,
+ GXTexMapID tex_map);
+extern void GXSetIndTexCoordScale (GXIndTexStageID ind_state,
+ GXIndTexScale scale_s, GXIndTexScale scale_t);
+extern void GXSetIndTexMtx (GXIndTexMtxID mtx_sel, const f32 offset[2][3], s8 scale_exp);
+extern void GXSetTevIndirect (GXTevStageID tev_stage, GXIndTexStageID ind_stage,
+ GXIndTexFormat format, GXIndTexBiasSel bias_sel,
+ GXIndTexMtxID matrix_sel,
+ GXIndTexWrap wrap_s, GXIndTexWrap wrap_t,
+ GXBool add_prev, GXBool ind_lod, GXIndTexAlphaSel alpha_sel);
+
+//------------------------------------------------------------------------------
+// Convenience functions
+//------------------------------------------------------------------------------
+extern void GXSetTevDirect (GXTevStageID tev_stage);
+extern void GXSetTevIndWarp (GXTevStageID tev_stage, GXIndTexStageID ind_stage,
+ GXBool signed_offset, GXBool replace_mode,
+ GXIndTexMtxID matrix_sel);
+extern void GXSetTevIndTile (GXTevStageID tev_stage, GXIndTexStageID ind_stage,
+ u16 tilesize_s, u16 tilesize_t,
+ u16 tilespacing_s, u16 tilespacing_t,
+ GXIndTexFormat format, GXIndTexMtxID matrix_sel,
+ GXIndTexBiasSel bias_sel, GXIndTexAlphaSel alpha_sel);
+extern void GXSetTevIndBumpST (GXTevStageID tev_stage, GXIndTexStageID ind_stage,
+ GXIndTexMtxID matrix_sel);
+extern void GXSetTevIndBumpXYZ (GXTevStageID tev_stage, GXIndTexStageID ind_stage,
+ GXIndTexMtxID matrix_sel);
+extern void GXSetTevIndRepeat (GXTevStageID tev_stage);
+
+//------------------------------------------------------------------------------
+extern void __GXSetIndirectMask ( u32 mask );
+
+//------------------------------------------------------------------------------
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXBUMP_H__
diff --git a/include/rvl/GXCull.h b/include/rvl/GXCull.h
new file mode 100755
index 0000000..3584439
--- /dev/null
+++ b/include/rvl/GXCull.h
@@ -0,0 +1,18 @@
+#ifndef __GXCULL_H__
+#define __GXCULL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+void GXSetScissor ( u32 left, u32 top, u32 wd, u32 ht );
+void GXSetCullMode ( GXCullMode mode );
+void GXSetCoPlanar ( GXBool enable );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXCULL_H__
diff --git a/include/rvl/GXDispList.h b/include/rvl/GXDispList.h
new file mode 100755
index 0000000..5246525
--- /dev/null
+++ b/include/rvl/GXDispList.h
@@ -0,0 +1,18 @@
+#ifndef __GXDISPLIST_H__
+#define __GXDISPLIST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+void GXBeginDisplayList ( void *list, u32 size );
+u32 GXEndDisplayList ( void );
+void GXCallDisplayList ( const void *list, u32 nbytes );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXDISPLIST_H__
diff --git a/include/rvl/GXEnum.h b/include/rvl/GXEnum.h
new file mode 100755
index 0000000..6f75a0f
--- /dev/null
+++ b/include/rvl/GXEnum.h
@@ -0,0 +1,1300 @@
+#ifndef __GXENUM_H__
+#define __GXENUM_H__
+
+/********************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/********************************/
+typedef u8 GXBool;
+
+/********************************/
+#define GX_TRUE ((GXBool)1)
+#define GX_FALSE ((GXBool)0)
+#define GX_ENABLE ((GXBool)1)
+#define GX_DISABLE ((GXBool)0)
+
+/********************************/
+typedef enum _GXAttr
+{
+ GX_VA_PNMTXIDX = 0, // position/normal matrix index
+ GX_VA_TEX0MTXIDX, // texture 0 matrix index
+ GX_VA_TEX1MTXIDX, // texture 1 matrix index
+ GX_VA_TEX2MTXIDX, // texture 2 matrix index
+ GX_VA_TEX3MTXIDX, // texture 3 matrix index
+ GX_VA_TEX4MTXIDX, // texture 4 matrix index
+ GX_VA_TEX5MTXIDX, // texture 5 matrix index
+ GX_VA_TEX6MTXIDX, // texture 6 matrix index
+ GX_VA_TEX7MTXIDX, // texture 7 matrix index
+ GX_VA_POS = 9, // position
+ GX_VA_NRM, // normal
+ GX_VA_CLR0, // color 0
+ GX_VA_CLR1, // color 1
+ GX_VA_TEX0, // input texture coordinate 0
+ GX_VA_TEX1, // input texture coordinate 1
+ GX_VA_TEX2, // input texture coordinate 2
+ GX_VA_TEX3, // input texture coordinate 3
+ GX_VA_TEX4, // input texture coordinate 4
+ GX_VA_TEX5, // input texture coordinate 5
+ GX_VA_TEX6, // input texture coordinate 6
+ GX_VA_TEX7, // input texture coordinate 7
+
+ GX_POS_MTX_ARRAY, // position matrix array pointer
+ GX_NRM_MTX_ARRAY, // normal matrix array pointer
+ GX_TEX_MTX_ARRAY, // texture matrix array pointer
+ GX_LIGHT_ARRAY, // light parameter array pointer
+ GX_VA_NBT, // normal, bi-normal, tangent
+ GX_VA_MAX_ATTR, // maximum number of vertex attributes
+
+ GX_VA_NULL = 0xff // NULL attribute (to mark end of lists)
+
+} GXAttr;
+
+#define GX_MAX_VTXDESC GX_VA_MAX_ATTR
+#define GX_MAX_VTXDESCLIST_SZ (GX_MAX_VTXDESC+1) // +1 for GX_VA_NULL
+
+#define GX_MAX_VTXATTRFMT GX_VA_MAX_ATTR
+#define GX_MAX_VTXATTRFMTLIST_SZ (GX_MAX_VTXATTRFMT+1) // +1 for GX_VA_NULL
+
+#define GX_MAX_VTXARRAY 16
+
+/********************************/
+typedef enum _GXVtxFmt
+{
+ GX_VTXFMT0 = 0,
+ GX_VTXFMT1,
+ GX_VTXFMT2,
+ GX_VTXFMT3,
+ GX_VTXFMT4,
+ GX_VTXFMT5,
+ GX_VTXFMT6,
+ GX_VTXFMT7,
+ GX_MAX_VTXFMT
+
+} GXVtxFmt;
+
+#define GX_MAX_VTXFMT GX_MAX_VTXFMT
+
+/********************************/
+typedef enum _GXAttrType
+{
+ GX_NONE = 0,
+ GX_DIRECT,
+ GX_INDEX8,
+ GX_INDEX16
+
+} GXAttrType;
+
+/********************************/
+typedef enum _GXTexCoordID
+{
+ GX_TEXCOORD0 = 0x0, // generated texture coordinate 0
+ GX_TEXCOORD1, // generated texture coordinate 1
+ GX_TEXCOORD2, // generated texture coordinate 2
+ GX_TEXCOORD3, // generated texture coordinate 3
+ GX_TEXCOORD4, // generated texture coordinate 4
+ GX_TEXCOORD5, // generated texture coordinate 5
+ GX_TEXCOORD6, // generated texture coordinate 6
+ GX_TEXCOORD7, // generated texture coordinate 7
+ GX_MAX_TEXCOORD = 8,
+ GX_TEXCOORD_NULL = 0xff
+
+} GXTexCoordID;
+
+#define GX_MAX_TEXCOORDGEN GX_MAX_TEXCOORD
+
+/********************************/
+typedef enum _GXTexGenType
+{
+ GX_TG_MTX3x4 = 0,
+ GX_TG_MTX2x4,
+ GX_TG_BUMP0,
+ GX_TG_BUMP1,
+ GX_TG_BUMP2,
+ GX_TG_BUMP3,
+ GX_TG_BUMP4,
+ GX_TG_BUMP5,
+ GX_TG_BUMP6,
+ GX_TG_BUMP7,
+ GX_TG_SRTG
+
+} GXTexGenType;
+
+/********************************/
+typedef enum _GXTexGenSrc
+{
+ GX_TG_POS = 0,
+ GX_TG_NRM,
+ GX_TG_BINRM,
+ GX_TG_TANGENT,
+ GX_TG_TEX0,
+ GX_TG_TEX1,
+ GX_TG_TEX2,
+ GX_TG_TEX3,
+ GX_TG_TEX4,
+ GX_TG_TEX5,
+ GX_TG_TEX6,
+ GX_TG_TEX7,
+ GX_TG_TEXCOORD0,
+ GX_TG_TEXCOORD1,
+ GX_TG_TEXCOORD2,
+ GX_TG_TEXCOORD3,
+ GX_TG_TEXCOORD4,
+ GX_TG_TEXCOORD5,
+ GX_TG_TEXCOORD6,
+ GX_TG_COLOR0,
+ GX_TG_COLOR1
+
+} GXTexGenSrc;
+
+/********************************/
+typedef enum _GXCompCnt
+{
+#if ( GX_REV == 1 )
+ GX_POS_XY = 0,
+ GX_POS_XYZ = 1,
+ GX_NRM_XYZ = 0,
+ GX_NRM_NBT = 1, // not really used, just to make api consistent
+ GX_CLR_RGB = 0,
+ GX_CLR_RGBA = 1,
+ GX_TEX_S = 0,
+ GX_TEX_ST = 1
+
+#else // ( GX_REV >= 2 )
+ GX_POS_XY = 0,
+ GX_POS_XYZ = 1,
+ GX_NRM_XYZ = 0,
+ GX_NRM_NBT = 1, // one index per NBT
+ GX_NRM_NBT3 = 2, // one index per each of N/B/T
+ GX_CLR_RGB = 0,
+ GX_CLR_RGBA = 1,
+ GX_TEX_S = 0,
+ GX_TEX_ST = 1
+
+#endif
+} GXCompCnt;
+
+/********************************/
+typedef enum _GXCompType
+{
+ GX_U8 = 0,
+ GX_S8 = 1,
+ GX_U16 = 2,
+ GX_S16 = 3,
+ GX_F32 = 4,
+
+ GX_RGB565 = 0,
+ GX_RGB8 = 1,
+ GX_RGBX8 = 2,
+ GX_RGBA4 = 3,
+ GX_RGBA6 = 4,
+ GX_RGBA8 = 5
+
+} GXCompType;
+
+/********************************/
+typedef enum _GXChannelID
+{
+ GX_COLOR0,
+ GX_COLOR1,
+ GX_ALPHA0,
+ GX_ALPHA1,
+ GX_COLOR0A0, // Color 0 + Alpha 0
+ GX_COLOR1A1, // Color 1 + Alpha 1
+ GX_COLOR_ZERO, // RGBA = 0
+ GX_ALPHA_BUMP, // bump alpha 0-248, RGB=0
+ GX_ALPHA_BUMPN, // normalized bump alpha, 0-255, RGB=0
+ GX_COLOR_NULL = 0xff
+
+} GXChannelID;
+
+/********************************/
+typedef enum _GXColorSrc
+{
+ GX_SRC_REG = 0,
+ GX_SRC_VTX
+
+} GXColorSrc;
+
+/********************************/
+typedef enum _GXLightID
+{
+ GX_LIGHT0 = 0x001,
+ GX_LIGHT1 = 0x002,
+ GX_LIGHT2 = 0x004,
+ GX_LIGHT3 = 0x008,
+ GX_LIGHT4 = 0x010,
+ GX_LIGHT5 = 0x020,
+ GX_LIGHT6 = 0x040,
+ GX_LIGHT7 = 0x080,
+ GX_MAX_LIGHT = 0x100,
+ GX_LIGHT_NULL = 0x000
+} GXLightID;
+
+/********************************/
+typedef enum _GXDiffuseFn
+{
+ GX_DF_NONE = 0,
+ GX_DF_SIGN,
+ GX_DF_CLAMP
+
+} GXDiffuseFn;
+
+/********************************/
+typedef enum _GXAttnFn
+{
+ GX_AF_SPEC = 0, // use specular attenuation
+ GX_AF_SPOT = 1, // use distance/spotlight attenuation
+ GX_AF_NONE // attenuation is off
+
+} GXAttnFn;
+
+/********************************/
+typedef enum _GXSpotFn
+{
+ GX_SP_OFF = 0,
+ GX_SP_FLAT,
+ GX_SP_COS,
+ GX_SP_COS2,
+ GX_SP_SHARP,
+ GX_SP_RING1,
+ GX_SP_RING2
+} GXSpotFn;
+
+/********************************/
+typedef enum _GXDistAttnFn
+{
+ GX_DA_OFF = 0,
+ GX_DA_GENTLE,
+ GX_DA_MEDIUM,
+ GX_DA_STEEP
+} GXDistAttnFn;
+
+/********************************/
+typedef enum _GXPosNrmMtx
+{
+ GX_PNMTX0 = 0,
+ GX_PNMTX1 = 3,
+ GX_PNMTX2 = 6,
+ GX_PNMTX3 = 9,
+ GX_PNMTX4 = 12,
+ GX_PNMTX5 = 15,
+ GX_PNMTX6 = 18,
+ GX_PNMTX7 = 21,
+ GX_PNMTX8 = 24,
+ GX_PNMTX9 = 27
+
+} GXPosNrmMtx;
+
+/********************************/
+typedef enum _GXTexMtx
+{
+ GX_TEXMTX0 = 30,
+ GX_TEXMTX1 = 33,
+ GX_TEXMTX2 = 36,
+ GX_TEXMTX3 = 39,
+ GX_TEXMTX4 = 42,
+ GX_TEXMTX5 = 45,
+ GX_TEXMTX6 = 48,
+ GX_TEXMTX7 = 51,
+ GX_TEXMTX8 = 54,
+ GX_TEXMTX9 = 57,
+ GX_IDENTITY = 60
+
+} GXTexMtx;
+
+/********************************/
+#if ( GX_REV != 1 ) // Revision 2 or greater only
+typedef enum _GXPTTexMtx
+{
+ GX_PTTEXMTX0 = 64,
+ GX_PTTEXMTX1 = 67,
+ GX_PTTEXMTX2 = 70,
+ GX_PTTEXMTX3 = 73,
+ GX_PTTEXMTX4 = 76,
+ GX_PTTEXMTX5 = 79,
+ GX_PTTEXMTX6 = 82,
+ GX_PTTEXMTX7 = 85,
+ GX_PTTEXMTX8 = 88,
+ GX_PTTEXMTX9 = 91,
+ GX_PTTEXMTX10 = 94,
+ GX_PTTEXMTX11 = 97,
+ GX_PTTEXMTX12 = 100,
+ GX_PTTEXMTX13 = 103,
+ GX_PTTEXMTX14 = 106,
+ GX_PTTEXMTX15 = 109,
+ GX_PTTEXMTX16 = 112,
+ GX_PTTEXMTX17 = 115,
+ GX_PTTEXMTX18 = 118,
+ GX_PTTEXMTX19 = 121,
+ GX_PTIDENTITY = 125
+
+} GXPTTexMtx;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+typedef enum _GXTexMtxType
+{
+ GX_MTX3x4 = 0,
+ GX_MTX2x4
+
+} GXTexMtxType;
+
+/********************************/
+typedef enum _GXPrimitive
+{
+ GX_POINTS = 0xb8,
+ GX_LINES = 0xa8,
+ GX_LINESTRIP = 0xb0,
+ GX_TRIANGLES = 0x90,
+ GX_TRIANGLESTRIP = 0x98,
+ GX_TRIANGLEFAN = 0xa0,
+ GX_QUADS = 0x80
+
+} GXPrimitive;
+
+/********************************/
+typedef enum _GXTexOffset
+{
+ GX_TO_ZERO,
+ GX_TO_SIXTEENTH,
+ GX_TO_EIGHTH,
+ GX_TO_FOURTH,
+ GX_TO_HALF,
+ GX_TO_ONE,
+ GX_MAX_TEXOFFSET
+
+} GXTexOffset;
+
+/********************************/
+typedef enum _GXCullMode
+{
+ GX_CULL_NONE,
+ GX_CULL_FRONT,
+ GX_CULL_BACK,
+ GX_CULL_ALL
+
+} GXCullMode;
+
+/********************************/
+typedef enum _GXClipMode
+{
+ // Note: these are (by design) backwards of typical enable/disables!
+ GX_CLIP_ENABLE = 0,
+ GX_CLIP_DISABLE = 1
+
+} GXClipMode;
+
+/********************************/
+typedef enum _GXTexWrapMode
+{
+ GX_CLAMP,
+ GX_REPEAT,
+ GX_MIRROR,
+ GX_MAX_TEXWRAPMODE
+
+} GXTexWrapMode;
+
+/********************************/
+typedef enum _GXTexFilter
+{
+ GX_NEAR,
+ GX_LINEAR,
+ GX_NEAR_MIP_NEAR,
+ GX_LIN_MIP_NEAR,
+ GX_NEAR_MIP_LIN,
+ GX_LIN_MIP_LIN
+
+} GXTexFilter;
+
+/********************************/
+typedef enum _GXCITexFmt
+{
+ GX_TF_C4 = 0x8,
+ GX_TF_C8 = 0x9,
+ GX_TF_C14X2 = 0xa
+
+} GXCITexFmt;
+
+/********************************/
+typedef enum _GXTexFmt
+{
+#if ( GX_REV == 1 )
+ GX_TF_I4 = 0x0,
+ GX_TF_I8 = 0x1,
+ GX_TF_IA4 = 0x2,
+ GX_TF_IA8 = 0x3,
+ GX_TF_RGB565 = 0x4,
+ GX_TF_RGB5A3 = 0x5,
+ GX_TF_RGBA8 = 0x6,
+ GX_TF_CMPR = 0xE,
+ GX_TF_A8 = (0x20 | GX_TF_I8),
+ GX_TF_Z8 = (0x10 | GX_TF_I8),
+ GX_TF_Z16 = (0x10 | GX_TF_IA8),
+ GX_TF_Z24X8 = (0x10 | GX_TF_RGBA8)
+
+#else // ( GX_REV >= 2 )
+
+#define _GX_TF_CTF 0x20 /* copy-texture-format only */
+#define _GX_TF_ZTF 0x10 /* Z-texture-format */
+
+ GX_TF_I4 = 0x0,
+ GX_TF_I8 = 0x1,
+ GX_TF_IA4 = 0x2,
+ GX_TF_IA8 = 0x3,
+ GX_TF_RGB565 = 0x4,
+ GX_TF_RGB5A3 = 0x5,
+ GX_TF_RGBA8 = 0x6,
+ GX_TF_CMPR = 0xE,
+
+ GX_CTF_R4 = 0x0 | _GX_TF_CTF,
+ GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
+ GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
+ GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
+ GX_CTF_A8 = 0x7 | _GX_TF_CTF,
+ GX_CTF_R8 = 0x8 | _GX_TF_CTF,
+ GX_CTF_G8 = 0x9 | _GX_TF_CTF,
+ GX_CTF_B8 = 0xA | _GX_TF_CTF,
+ GX_CTF_RG8 = 0xB | _GX_TF_CTF,
+ GX_CTF_GB8 = 0xC | _GX_TF_CTF,
+
+ GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
+ GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
+ GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
+
+ GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
+ GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
+ GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
+ GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
+
+ GX_TF_A8 = GX_CTF_A8 // to keep compatibility
+#endif
+} GXTexFmt;
+
+/********************************/
+typedef enum _GXTlutFmt
+{
+ GX_TL_IA8 = 0x0,
+ GX_TL_RGB565 = 0x1,
+ GX_TL_RGB5A3 = 0x2,
+ GX_MAX_TLUTFMT
+
+} GXTlutFmt;
+
+/********************************/
+typedef enum _GXTlutSize
+{
+ GX_TLUT_16 = 1, // number of 16 entry blocks.
+ GX_TLUT_32 = 2,
+ GX_TLUT_64 = 4,
+ GX_TLUT_128 = 8,
+ GX_TLUT_256 = 16,
+ GX_TLUT_512 = 32,
+ GX_TLUT_1K = 64,
+ GX_TLUT_2K = 128,
+ GX_TLUT_4K = 256,
+ GX_TLUT_8K = 512,
+ GX_TLUT_16K = 1024
+
+} GXTlutSize;
+
+/********************************/
+typedef enum _GXTlut
+{
+ // default 256-entry TLUTs
+ GX_TLUT0 = 0,
+ GX_TLUT1,
+ GX_TLUT2,
+ GX_TLUT3,
+ GX_TLUT4,
+ GX_TLUT5,
+ GX_TLUT6,
+ GX_TLUT7,
+ GX_TLUT8,
+ GX_TLUT9,
+ GX_TLUT10,
+ GX_TLUT11,
+ GX_TLUT12,
+ GX_TLUT13,
+ GX_TLUT14,
+ GX_TLUT15,
+ GX_BIGTLUT0,
+ GX_BIGTLUT1,
+ GX_BIGTLUT2,
+ GX_BIGTLUT3
+
+} GXTlut;
+
+/********************************/
+typedef enum _GXTexMapID
+{
+ GX_TEXMAP0,
+ GX_TEXMAP1,
+ GX_TEXMAP2,
+ GX_TEXMAP3,
+ GX_TEXMAP4,
+ GX_TEXMAP5,
+ GX_TEXMAP6,
+ GX_TEXMAP7,
+ GX_MAX_TEXMAP,
+
+ GX_TEXMAP_NULL = 0xff,
+ GX_TEX_DISABLE = 0x100 // mask : disables texture look up
+
+} GXTexMapID;
+
+#define GX_MAX_TEXMAPS GX_MAX_TEXMAP
+
+/********************************/
+typedef enum _GXTexCacheSize
+{
+ GX_TEXCACHE_32K,
+ GX_TEXCACHE_128K,
+ GX_TEXCACHE_512K,
+ GX_TEXCACHE_NONE
+
+} GXTexCacheSize;
+
+/********************************/
+typedef enum _GXIndTexFormat
+{
+ GX_ITF_8, // 8 bit texture offsets.
+ GX_ITF_5, // 5 bit texture offsets.
+ GX_ITF_4, // 4 bit texture offsets.
+ GX_ITF_3, // 3 bit texture offsets.
+ GX_MAX_ITFORMAT
+
+} GXIndTexFormat;
+
+/********************************/
+typedef enum _GXIndTexBiasSel
+{
+ GX_ITB_NONE,
+ GX_ITB_S,
+ GX_ITB_T,
+ GX_ITB_ST,
+ GX_ITB_U,
+ GX_ITB_SU,
+ GX_ITB_TU,
+ GX_ITB_STU,
+ GX_MAX_ITBIAS
+
+} GXIndTexBiasSel;
+
+/********************************/
+typedef enum _GXIndTexAlphaSel
+{
+ GX_ITBA_OFF,
+ GX_ITBA_S,
+ GX_ITBA_T,
+ GX_ITBA_U,
+ GX_MAX_ITBALPHA
+
+} GXIndTexAlphaSel;
+
+/********************************/
+typedef enum _GXIndTexMtxID
+{
+ GX_ITM_OFF,
+ GX_ITM_0,
+ GX_ITM_1,
+ GX_ITM_2,
+ GX_ITM_S0 = 5,
+ GX_ITM_S1,
+ GX_ITM_S2,
+ GX_ITM_T0 = 9,
+ GX_ITM_T1,
+ GX_ITM_T2
+
+} GXIndTexMtxID;
+
+/********************************/
+typedef enum _GXIndTexWrap
+{
+ GX_ITW_OFF, // no wrapping
+ GX_ITW_256, // wrap 256
+ GX_ITW_128, // wrap 128
+ GX_ITW_64, // wrap 64
+ GX_ITW_32, // wrap 32
+ GX_ITW_16, // wrap 16
+ GX_ITW_0, // wrap 0
+ GX_MAX_ITWRAP
+
+} GXIndTexWrap;
+
+/********************************/
+typedef enum _GXIndTexScale
+{
+ GX_ITS_1, // Scale by 1.
+ GX_ITS_2, // Scale by 1/2.
+ GX_ITS_4, // Scale by 1/4.
+ GX_ITS_8, // Scale by 1/8.
+ GX_ITS_16, // Scale by 1/16.
+ GX_ITS_32, // Scale by 1/32.
+ GX_ITS_64, // Scale by 1/64.
+ GX_ITS_128, // Scale by 1/128.
+ GX_ITS_256, // Scale by 1/256.
+ GX_MAX_ITSCALE
+
+} GXIndTexScale;
+
+/********************************/
+typedef enum _GXIndTexStageID
+{
+ GX_INDTEXSTAGE0, // Indirect Texture Stage Names.
+ GX_INDTEXSTAGE1,
+ GX_INDTEXSTAGE2,
+ GX_INDTEXSTAGE3,
+ GX_MAX_INDTEXSTAGE
+
+} GXIndTexStageID;
+
+/********************************/
+typedef enum _GXTevStageID
+{
+ GX_TEVSTAGE0,
+ GX_TEVSTAGE1,
+ GX_TEVSTAGE2,
+ GX_TEVSTAGE3,
+ GX_TEVSTAGE4,
+ GX_TEVSTAGE5,
+ GX_TEVSTAGE6,
+ GX_TEVSTAGE7,
+ GX_TEVSTAGE8,
+ GX_TEVSTAGE9,
+ GX_TEVSTAGE10,
+ GX_TEVSTAGE11,
+ GX_TEVSTAGE12,
+ GX_TEVSTAGE13,
+ GX_TEVSTAGE14,
+ GX_TEVSTAGE15,
+ GX_MAX_TEVSTAGE
+
+} GXTevStageID;
+
+#define GX_MAX_TEVSTAGES GX_MAX_TEVSTAGE
+
+/********************************/
+typedef enum _GXTevRegID
+{
+ GX_TEVPREV = 0,
+ GX_TEVREG0,
+ GX_TEVREG1,
+ GX_TEVREG2,
+ GX_MAX_TEVREG
+
+} GXTevRegID;
+
+/********************************/
+typedef enum _GXTevOp
+{
+#if ( GX_REV == 1 )
+ GX_TEV_ADD,
+ GX_TEV_SUB
+
+#else // ( GX_REV >= 2 )
+ GX_TEV_ADD = 0,
+ GX_TEV_SUB = 1,
+
+ GX_TEV_COMP_R8_GT = 8,
+ GX_TEV_COMP_R8_EQ = 9,
+ GX_TEV_COMP_GR16_GT = 10,
+ GX_TEV_COMP_GR16_EQ = 11,
+ GX_TEV_COMP_BGR24_GT = 12,
+ GX_TEV_COMP_BGR24_EQ = 13,
+ GX_TEV_COMP_RGB8_GT = 14,
+ GX_TEV_COMP_RGB8_EQ = 15,
+
+ GX_TEV_COMP_A8_GT = GX_TEV_COMP_RGB8_GT, // for alpha channel
+ GX_TEV_COMP_A8_EQ = GX_TEV_COMP_RGB8_EQ // for alpha channel
+
+#endif
+} GXTevOp;
+
+/********************************/
+typedef enum _GXTevColorArg
+{
+#if ( GX_REV == 1 )
+ GX_CC_CPREV,
+ GX_CC_APREV,
+ GX_CC_C0,
+ GX_CC_A0,
+ GX_CC_C1,
+ GX_CC_A1,
+ GX_CC_C2,
+ GX_CC_A2,
+ GX_CC_TEXC,
+ GX_CC_TEXA,
+ GX_CC_RASC,
+ GX_CC_RASA,
+ GX_CC_ONE,
+ GX_CC_HALF,
+ GX_CC_QUARTER,
+ GX_CC_ZERO,
+
+ GX_CC_TEXRRR,
+ GX_CC_TEXGGG,
+ GX_CC_TEXBBB
+
+#else // ( GX_REV >= 2 )
+ GX_CC_CPREV,
+ GX_CC_APREV,
+ GX_CC_C0,
+ GX_CC_A0,
+ GX_CC_C1,
+ GX_CC_A1,
+ GX_CC_C2,
+ GX_CC_A2,
+ GX_CC_TEXC,
+ GX_CC_TEXA,
+ GX_CC_RASC,
+ GX_CC_RASA,
+ GX_CC_ONE,
+ GX_CC_HALF,
+ GX_CC_KONST,
+ GX_CC_ZERO
+
+#ifndef GX_NO_LEGACY_HW1
+ , // separator needed only in this case
+
+ GX_CC_TEXRRR, // obsolete
+ GX_CC_TEXGGG, // obsolete
+ GX_CC_TEXBBB, // obsolete
+
+ GX_CC_QUARTER = GX_CC_KONST // obsolete, to keep compatibility
+#endif
+
+#endif
+} GXTevColorArg;
+
+/********************************/
+typedef enum _GXTevAlphaArg
+{
+#if ( GX_REV == 1 )
+ GX_CA_APREV,
+ GX_CA_A0,
+ GX_CA_A1,
+ GX_CA_A2,
+ GX_CA_TEXA,
+ GX_CA_RASA,
+ GX_CA_ONE,
+ GX_CA_ZERO
+
+#else // ( GX_REV >= 2 )
+ GX_CA_APREV,
+ GX_CA_A0,
+ GX_CA_A1,
+ GX_CA_A2,
+ GX_CA_TEXA,
+ GX_CA_RASA,
+ GX_CA_KONST,
+ GX_CA_ZERO
+
+#ifndef GX_NO_LEGACY_HW1
+ , // separator needed only in this case
+
+ GX_CA_ONE = GX_CA_KONST // obsolete, to keep compatibility
+#endif
+
+#endif
+} GXTevAlphaArg;
+
+/********************************/
+typedef enum _GXTevBias
+{
+ GX_TB_ZERO,
+ GX_TB_ADDHALF,
+ GX_TB_SUBHALF,
+ GX_MAX_TEVBIAS
+
+} GXTevBias;
+
+/********************************/
+typedef enum _GXTevClampMode
+{
+ GX_TC_LINEAR,
+ GX_TC_GE,
+ GX_TC_EQ,
+ GX_TC_LE,
+ GX_MAX_TEVCLAMPMODE
+
+} GXTevClampMode;
+
+/********************************/
+#if ( GX_REV != 1 ) // GX Revision 2 or later only
+typedef enum _GXTevKColorID
+{
+ GX_KCOLOR0 = 0,
+ GX_KCOLOR1,
+ GX_KCOLOR2,
+ GX_KCOLOR3,
+ GX_MAX_KCOLOR
+
+} GXTevKColorID;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+#if ( GX_REV != 1 ) // GX Revision 2 or later only
+typedef enum _GXTevKColorSel
+{
+ GX_TEV_KCSEL_8_8 = 0x00,
+ GX_TEV_KCSEL_7_8 = 0x01,
+ GX_TEV_KCSEL_6_8 = 0x02,
+ GX_TEV_KCSEL_5_8 = 0x03,
+ GX_TEV_KCSEL_4_8 = 0x04,
+ GX_TEV_KCSEL_3_8 = 0x05,
+ GX_TEV_KCSEL_2_8 = 0x06,
+ GX_TEV_KCSEL_1_8 = 0x07,
+
+ GX_TEV_KCSEL_1 = GX_TEV_KCSEL_8_8,
+ GX_TEV_KCSEL_3_4 = GX_TEV_KCSEL_6_8,
+ GX_TEV_KCSEL_1_2 = GX_TEV_KCSEL_4_8,
+ GX_TEV_KCSEL_1_4 = GX_TEV_KCSEL_2_8,
+
+ GX_TEV_KCSEL_K0 = 0x0C,
+ GX_TEV_KCSEL_K1 = 0x0D,
+ GX_TEV_KCSEL_K2 = 0x0E,
+ GX_TEV_KCSEL_K3 = 0x0F,
+ GX_TEV_KCSEL_K0_R = 0x10,
+ GX_TEV_KCSEL_K1_R = 0x11,
+ GX_TEV_KCSEL_K2_R = 0x12,
+ GX_TEV_KCSEL_K3_R = 0x13,
+ GX_TEV_KCSEL_K0_G = 0x14,
+ GX_TEV_KCSEL_K1_G = 0x15,
+ GX_TEV_KCSEL_K2_G = 0x16,
+ GX_TEV_KCSEL_K3_G = 0x17,
+ GX_TEV_KCSEL_K0_B = 0x18,
+ GX_TEV_KCSEL_K1_B = 0x19,
+ GX_TEV_KCSEL_K2_B = 0x1A,
+ GX_TEV_KCSEL_K3_B = 0x1B,
+ GX_TEV_KCSEL_K0_A = 0x1C,
+ GX_TEV_KCSEL_K1_A = 0x1D,
+ GX_TEV_KCSEL_K2_A = 0x1E,
+ GX_TEV_KCSEL_K3_A = 0x1F
+
+} GXTevKColorSel;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+#if ( GX_REV != 1 ) // GX Revision 2 or later only
+typedef enum _GXTevKAlphaSel
+{
+ GX_TEV_KASEL_8_8 = 0x00,
+ GX_TEV_KASEL_7_8 = 0x01,
+ GX_TEV_KASEL_6_8 = 0x02,
+ GX_TEV_KASEL_5_8 = 0x03,
+ GX_TEV_KASEL_4_8 = 0x04,
+ GX_TEV_KASEL_3_8 = 0x05,
+ GX_TEV_KASEL_2_8 = 0x06,
+ GX_TEV_KASEL_1_8 = 0x07,
+
+ GX_TEV_KASEL_1 = GX_TEV_KASEL_8_8,
+ GX_TEV_KASEL_3_4 = GX_TEV_KASEL_6_8,
+ GX_TEV_KASEL_1_2 = GX_TEV_KASEL_4_8,
+ GX_TEV_KASEL_1_4 = GX_TEV_KASEL_2_8,
+
+ GX_TEV_KASEL_K0_R = 0x10,
+ GX_TEV_KASEL_K1_R = 0x11,
+ GX_TEV_KASEL_K2_R = 0x12,
+ GX_TEV_KASEL_K3_R = 0x13,
+ GX_TEV_KASEL_K0_G = 0x14,
+ GX_TEV_KASEL_K1_G = 0x15,
+ GX_TEV_KASEL_K2_G = 0x16,
+ GX_TEV_KASEL_K3_G = 0x17,
+ GX_TEV_KASEL_K0_B = 0x18,
+ GX_TEV_KASEL_K1_B = 0x19,
+ GX_TEV_KASEL_K2_B = 0x1A,
+ GX_TEV_KASEL_K3_B = 0x1B,
+ GX_TEV_KASEL_K0_A = 0x1C,
+ GX_TEV_KASEL_K1_A = 0x1D,
+ GX_TEV_KASEL_K2_A = 0x1E,
+ GX_TEV_KASEL_K3_A = 0x1F
+
+} GXTevKAlphaSel;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+#if ( GX_REV != 1 ) // GX Revision 2 or later only
+typedef enum _GXTevSwapSel
+{
+ GX_TEV_SWAP0 = 0,
+ GX_TEV_SWAP1,
+ GX_TEV_SWAP2,
+ GX_TEV_SWAP3,
+ GX_MAX_TEVSWAP
+
+} GXTevSwapSel;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+#if ( GX_REV != 1 ) // GX Revision 2 or later only
+typedef enum _GXTevColorChan
+{
+ GX_CH_RED = 0,
+ GX_CH_GREEN,
+ GX_CH_BLUE,
+ GX_CH_ALPHA
+
+} GXTevColorChan;
+#endif // ( GX_REV != 1 )
+
+/********************************/
+typedef enum _GXAlphaOp
+{
+ GX_AOP_AND,
+ GX_AOP_OR,
+ GX_AOP_XOR,
+ GX_AOP_XNOR,
+ GX_MAX_ALPHAOP
+
+} GXAlphaOp;
+
+/********************************/
+typedef enum _GXTevScale
+{
+ GX_CS_SCALE_1,
+ GX_CS_SCALE_2,
+ GX_CS_SCALE_4,
+ GX_CS_DIVIDE_2,
+ GX_MAX_TEVSCALE
+
+} GXTevScale;
+
+/********************************/
+typedef enum _GXFogType
+{
+ GX_FOG_NONE = 0x00,
+
+ GX_FOG_PERSP_LIN = 0x02,
+ GX_FOG_PERSP_EXP = 0x04,
+ GX_FOG_PERSP_EXP2 = 0x05,
+ GX_FOG_PERSP_REVEXP = 0x06,
+ GX_FOG_PERSP_REVEXP2 = 0x07,
+
+ GX_FOG_ORTHO_LIN = 0x0A,
+ GX_FOG_ORTHO_EXP = 0x0C,
+ GX_FOG_ORTHO_EXP2 = 0x0D,
+ GX_FOG_ORTHO_REVEXP = 0x0E,
+ GX_FOG_ORTHO_REVEXP2 = 0x0F,
+
+ // For compatibility with former versions
+ GX_FOG_LIN = GX_FOG_PERSP_LIN,
+ GX_FOG_EXP = GX_FOG_PERSP_EXP,
+ GX_FOG_EXP2 = GX_FOG_PERSP_EXP2,
+ GX_FOG_REVEXP = GX_FOG_PERSP_REVEXP,
+ GX_FOG_REVEXP2 = GX_FOG_PERSP_REVEXP2
+
+} GXFogType;
+
+/********************************/
+typedef enum _GXBlendMode
+{
+#if ( GX_REV == 1 )
+ GX_BM_NONE,
+ GX_BM_BLEND,
+ GX_BM_LOGIC,
+ GX_MAX_BLENDMODE
+
+#else // ( GX_REV >= 2 )
+ GX_BM_NONE,
+ GX_BM_BLEND,
+ GX_BM_LOGIC,
+ GX_BM_SUBTRACT,
+ GX_MAX_BLENDMODE
+
+#endif
+} GXBlendMode;
+
+/********************************/
+typedef enum _GXBlendFactor
+{
+ GX_BL_ZERO,
+ GX_BL_ONE,
+ GX_BL_SRCCLR,
+ GX_BL_INVSRCCLR,
+ GX_BL_SRCALPHA,
+ GX_BL_INVSRCALPHA,
+ GX_BL_DSTALPHA,
+ GX_BL_INVDSTALPHA,
+
+ GX_BL_DSTCLR = GX_BL_SRCCLR,
+ GX_BL_INVDSTCLR = GX_BL_INVSRCCLR
+
+} GXBlendFactor;
+
+/********************************/
+typedef enum _GXCompare
+{
+ GX_NEVER,
+ GX_LESS,
+ GX_EQUAL,
+ GX_LEQUAL,
+ GX_GREATER,
+ GX_NEQUAL,
+ GX_GEQUAL,
+ GX_ALWAYS
+
+} GXCompare;
+
+/********************************/
+typedef enum _GXLogicOp
+{
+ GX_LO_CLEAR,
+ GX_LO_AND,
+ GX_LO_REVAND,
+ GX_LO_COPY,
+ GX_LO_INVAND,
+ GX_LO_NOOP,
+ GX_LO_XOR,
+ GX_LO_OR,
+ GX_LO_NOR,
+ GX_LO_EQUIV,
+ GX_LO_INV,
+ GX_LO_REVOR,
+ GX_LO_INVCOPY,
+ GX_LO_INVOR,
+ GX_LO_NAND,
+ GX_LO_SET
+
+} GXLogicOp;
+
+/********************************/
+typedef enum _GXPixelFmt
+{
+ GX_PF_RGB8_Z24,
+ GX_PF_RGBA6_Z24,
+ GX_PF_RGB565_Z16,
+ GX_PF_Z24,
+ GX_PF_Y8,
+ GX_PF_U8,
+ GX_PF_V8,
+ GX_PF_YUV420
+
+} GXPixelFmt;
+
+/********************************/
+typedef enum _GXZFmt16
+{
+ GX_ZC_LINEAR,
+ GX_ZC_NEAR,
+ GX_ZC_MID,
+ GX_ZC_FAR
+
+} GXZFmt16;
+
+/********************************/
+typedef enum _GXTevMode
+{
+ GX_MODULATE,
+ GX_DECAL,
+ GX_BLEND,
+ GX_REPLACE,
+ GX_PASSCLR
+
+} GXTevMode;
+
+/********************************/
+typedef enum _GXGamma
+{
+ GX_GM_1_0,
+ GX_GM_1_7,
+ GX_GM_2_2
+
+} GXGamma;
+
+/********************************/
+typedef enum _GXProjectionType
+{
+ GX_PERSPECTIVE,
+ GX_ORTHOGRAPHIC
+
+} GXProjectionType;
+
+
+/********************************/
+typedef enum _GXEvent
+{
+ GX_VCACHE_MISS_ALL,
+ GX_VCACHE_MISS_POS,
+ GX_VCACHE_MISS_NRM
+
+} GXEvent;
+
+/********************************/
+typedef enum _GXFBClamp
+{
+ GX_CLAMP_NONE,
+ GX_CLAMP_TOP,
+ GX_CLAMP_BOTTOM
+
+} GXFBClamp;
+
+/********************************/
+typedef enum _GXAnisotropy
+{
+ GX_ANISO_1,
+ GX_ANISO_2,
+ GX_ANISO_4,
+ GX_MAX_ANISOTROPY
+
+} GXAnisotropy;
+
+/********************************/
+typedef enum _GXZTexOp
+{
+ GX_ZT_DISABLE,
+ GX_ZT_ADD,
+ GX_ZT_REPLACE,
+ GX_MAX_ZTEXOP
+
+} GXZTexOp;
+
+/********************************/
+typedef enum _GXAlphaReadMode
+{
+ GX_READ_00,
+ GX_READ_FF,
+ GX_READ_NONE
+
+} GXAlphaReadMode;
+
+/********************************/
+typedef enum _GXPerf0
+{
+ GX_PERF0_VERTICES,
+ GX_PERF0_CLIP_VTX,
+ GX_PERF0_CLIP_CLKS,
+ GX_PERF0_XF_WAIT_IN,
+ GX_PERF0_XF_WAIT_OUT,
+ GX_PERF0_XF_XFRM_CLKS,
+ GX_PERF0_XF_LIT_CLKS,
+ GX_PERF0_XF_BOT_CLKS,
+ GX_PERF0_XF_REGLD_CLKS,
+ GX_PERF0_XF_REGRD_CLKS,
+ GX_PERF0_CLIP_RATIO,
+
+ GX_PERF0_TRIANGLES,
+ GX_PERF0_TRIANGLES_CULLED,
+ GX_PERF0_TRIANGLES_PASSED,
+ GX_PERF0_TRIANGLES_SCISSORED,
+ GX_PERF0_TRIANGLES_0TEX,
+ GX_PERF0_TRIANGLES_1TEX,
+ GX_PERF0_TRIANGLES_2TEX,
+ GX_PERF0_TRIANGLES_3TEX,
+ GX_PERF0_TRIANGLES_4TEX,
+ GX_PERF0_TRIANGLES_5TEX,
+ GX_PERF0_TRIANGLES_6TEX,
+ GX_PERF0_TRIANGLES_7TEX,
+ GX_PERF0_TRIANGLES_8TEX,
+ GX_PERF0_TRIANGLES_0CLR,
+ GX_PERF0_TRIANGLES_1CLR,
+ GX_PERF0_TRIANGLES_2CLR,
+
+ GX_PERF0_QUAD_0CVG,
+ GX_PERF0_QUAD_NON0CVG,
+ GX_PERF0_QUAD_1CVG,
+ GX_PERF0_QUAD_2CVG,
+ GX_PERF0_QUAD_3CVG,
+ GX_PERF0_QUAD_4CVG,
+ GX_PERF0_AVG_QUAD_CNT,
+
+ GX_PERF0_CLOCKS,
+ GX_PERF0_NONE
+
+} GXPerf0;
+
+/********************************/
+typedef enum _GXPerf1
+{
+ GX_PERF1_TEXELS,
+ GX_PERF1_TX_IDLE,
+ GX_PERF1_TX_REGS,
+ GX_PERF1_TX_MEMSTALL,
+ GX_PERF1_TC_CHECK1_2,
+ GX_PERF1_TC_CHECK3_4,
+ GX_PERF1_TC_CHECK5_6,
+ GX_PERF1_TC_CHECK7_8,
+ GX_PERF1_TC_MISS,
+
+ GX_PERF1_VC_ELEMQ_FULL,
+ GX_PERF1_VC_MISSQ_FULL,
+ GX_PERF1_VC_MEMREQ_FULL,
+ GX_PERF1_VC_STATUS7,
+ GX_PERF1_VC_MISSREP_FULL,
+ GX_PERF1_VC_STREAMBUF_LOW,
+ GX_PERF1_VC_ALL_STALLS,
+ GX_PERF1_VERTICES,
+
+ GX_PERF1_FIFO_REQ,
+ GX_PERF1_CALL_REQ,
+ GX_PERF1_VC_MISS_REQ,
+ GX_PERF1_CP_ALL_REQ,
+
+ GX_PERF1_CLOCKS,
+ GX_PERF1_NONE
+
+} GXPerf1;
+
+/********************************/
+typedef enum _GXVCachePerf
+{
+ GX_VC_POS,
+ GX_VC_NRM,
+ GX_VC_CLR0,
+ GX_VC_CLR1,
+ GX_VC_TEX0,
+ GX_VC_TEX1,
+ GX_VC_TEX2,
+ GX_VC_TEX3,
+ GX_VC_TEX4,
+ GX_VC_TEX5,
+ GX_VC_TEX6,
+ GX_VC_TEX7,
+ GX_VC_ALL = 0xf
+
+} GXVCachePerf;
+
+/********************************/
+typedef enum _GXCopyMode
+{
+ GX_COPY_PROGRESSIVE = 0,
+ GX_COPY_INTLC_EVEN = 2,
+ GX_COPY_INTLC_ODD = 3
+
+} GXCopyMode;
+
+/********************************/
+typedef enum _GXMiscToken
+{
+ GX_MT_XF_FLUSH = 1,
+ GX_MT_DL_SAVE_CONTEXT = 2,
+ GX_MT_ABORT_WAIT_COPYOUT = 3,
+ GX_MT_NULL = 0
+
+} GXMiscToken;
+
+/********************************/
+typedef enum _GXXFFlushVal
+{
+ GX_XF_FLUSH_NONE = 0,
+ GX_XF_FLUSH_SAFE = 8
+
+} GXXFFlushVal;
+
+/********************************/
+// Compile-time checks to ensure that enumerations are compiled
+// as 32-bit integers. If your build breaks at this line,
+// please ensure that you enable the "enumerations are integers"
+// option for the compiler.
+
+#define GXCTASSERT(cond) int GXCTASSERT( int assertion_failed[ (cond) != 0 ] )
+
+GXCTASSERT(sizeof(GXAttrType) == sizeof(u32));
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXENUM_H__
diff --git a/include/rvl/GXGeometry.h b/include/rvl/GXGeometry.h
new file mode 100755
index 0000000..b85a4f0
--- /dev/null
+++ b/include/rvl/GXGeometry.h
@@ -0,0 +1,82 @@
+#ifndef __GXGEOMETRY_H__
+#define __GXGEOMETRY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+#include "rvl/GXStruct.h"
+
+void GXSetVtxDesc ( GXAttr attr, GXAttrType type );
+void GXSetVtxDescv ( const GXVtxDescList *attrPtr );
+void GXClearVtxDesc ( void );
+
+void GXSetVtxAttrFmt(
+ GXVtxFmt vtxfmt,
+ GXAttr attr,
+ GXCompCnt cnt,
+ GXCompType type,
+ u8 frac );
+
+void GXSetVtxAttrFmtv ( GXVtxFmt vtxfmt, const GXVtxAttrFmtList *list );
+void GXSetArray ( GXAttr attr, const void *base_ptr, u8 stride );
+void GXBegin ( GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts );
+
+#if defined(EMU) || defined(WIN32)
+void GXEnd ( void );
+#else // !EMU
+static inline void GXEnd ( void )
+{
+#ifdef _DEBUG
+ extern GXBool __GXinBegin;
+ if (!__GXinBegin)
+ OSPanic(__FILE__, __LINE__, "GXEnd: called without a GXBegin");
+ __GXinBegin = GX_FALSE;
+#endif
+}
+#endif // EMU
+
+#if ( GX_REV != 1 ) // GX revision 2 or later only
+void GXSetTexCoordGen2(
+ GXTexCoordID dst_coord,
+ GXTexGenType func,
+ GXTexGenSrc src_param,
+ u32 mtx,
+ GXBool normalize,
+ u32 postmtx );
+#endif // ( GX_REV != 1 )
+
+#if ( GX_REV == 1 || defined(EMU) ) // GX revision 1 or emulator
+void GXSetTexCoordGen(
+ GXTexCoordID dst_coord,
+ GXTexGenType func,
+ GXTexGenSrc src_param,
+ u32 mtx );
+#else // GX revision 2 or later and real hardware
+static inline void GXSetTexCoordGen (
+ GXTexCoordID dst_coord,
+ GXTexGenType func,
+ GXTexGenSrc src_param,
+ u32 mtx )
+{
+ GXSetTexCoordGen2(dst_coord, func, src_param, mtx,
+ GX_FALSE, GX_PTIDENTITY);
+}
+#endif // ( GX_REV == 1 || defined(EMU) )
+
+
+void GXSetNumTexGens ( u8 nTexGens );
+
+void GXInvalidateVtxCache ( void );
+void GXSetLineWidth ( u8 width, GXTexOffset texOffsets );
+void GXSetPointSize ( u8 pointSize, GXTexOffset texOffsets );
+void GXEnableTexOffsets ( GXTexCoordID coord, GXBool line_enable,
+ GXBool point_enable );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXGEOMETRY_H__
diff --git a/include/rvl/GXLighting.h b/include/rvl/GXLighting.h
new file mode 100755
index 0000000..26139b9
--- /dev/null
+++ b/include/rvl/GXLighting.h
@@ -0,0 +1,94 @@
+#ifndef __GXLIGHTING_H__
+#define __GXLIGHTING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+#include "rvl/GXStruct.h"
+
+/*---------------------------------------------------------------------------*/
+void GXInitLightAttn(
+ GXLightObj* lt_obj,
+ f32 a0,
+ f32 a1,
+ f32 a2,
+ f32 k0,
+ f32 k1,
+ f32 k2 );
+
+void GXInitLightAttnA ( GXLightObj *lt_obj, f32 a0, f32 a1, f32 a2);
+void GXInitLightAttnK ( GXLightObj *lt_obj, f32 k0, f32 k1, f32 k2 );
+
+void GXInitLightSpot(
+ GXLightObj* lt_obj,
+ f32 cutoff,
+ GXSpotFn spot_func );
+
+void GXInitLightDistAttn(
+ GXLightObj* lt_obj,
+ f32 ref_distance,
+ f32 ref_brightness,
+ GXDistAttnFn dist_func );
+
+
+void GXInitLightPos ( GXLightObj* lt_obj, f32 x, f32 y, f32 z );
+void GXInitLightColor ( GXLightObj* lt_obj, GXColor color );
+void GXLoadLightObjImm ( const GXLightObj* lt_obj, GXLightID light );
+void GXLoadLightObjIndx ( u32 lt_obj_indx, GXLightID light );
+void GXSetChanAmbColor ( GXChannelID chan, GXColor amb_color );
+void GXSetChanMatColor ( GXChannelID chan, GXColor mat_color );
+void GXSetNumChans ( u8 nChans );
+
+void GXInitLightDir ( GXLightObj* lt_obj, f32 nx, f32 ny, f32 nz );
+
+// New functions to set light direction and half-angle.
+void GXInitSpecularDir ( GXLightObj* lt_obj, f32 nx, f32 ny, f32 nz );
+void GXInitSpecularDirHA(
+ GXLightObj* lt_obj,
+ f32 nx,
+ f32 ny,
+ f32 nz,
+ f32 hx,
+ f32 hy,
+ f32 hz );
+
+void GXSetChanCtrl(
+ GXChannelID chan,
+ GXBool enable,
+ GXColorSrc amb_src,
+ GXColorSrc mat_src,
+ u32 light_mask,
+ GXDiffuseFn diff_fn,
+ GXAttnFn attn_fn );
+
+/*---------------------------------------------------------------------------*/
+// Convenient Macros
+
+#define GXInitLightPosv(lo,vec) \
+ (GXInitLightPos((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
+
+#define GXInitLightDirv(lo,vec) \
+ (GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
+
+#define GXInitSpecularDirv(lo,vec) \
+ (GXInitSpecularDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
+
+#define GXInitSpecularDirHAv(lo,vec0,vec1) \
+ (GXInitSpecularDirHA((lo), \
+ *(f32*)(vec0), *((f32*)(vec0)+1), *((f32*)(vec0)+2), \
+ *(f32*)(vec1), *((f32*)(vec1)+1), *((f32*)(vec1)+2)))
+
+#define GXInitLightShininess(lobj, shininess) \
+ (GXInitLightAttn(lobj, 0.0F, 0.0F, 1.0F, \
+ (shininess)/2.0F, 0.0F, \
+ 1.0F-(shininess)/2.0F ))
+
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXLIGHTING_H__
diff --git a/include/rvl/GXPixel.h b/include/rvl/GXPixel.h
new file mode 100755
index 0000000..ddacc88
--- /dev/null
+++ b/include/rvl/GXPixel.h
@@ -0,0 +1,49 @@
+#ifndef __GXPIXEL_H__
+#define __GXPIXEL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+#include "rvl/GXEnum.h"
+#include "rvl/GXStruct.h"
+
+/*---------------------------------------------------------------------------*/
+void GXSetFog( GXFogType type,
+ f32 startz,
+ f32 endz,
+ f32 nearz,
+ f32 farz,
+ GXColor color );
+
+void GXSetFogColor( GXColor color );
+
+void GXInitFogAdjTable( GXFogAdjTable* table, u16 width, const f32 projmtx[4][4] );
+
+void GXSetFogRangeAdj( GXBool enable, u16 center, const GXFogAdjTable* table );
+
+void GXSetBlendMode ( GXBlendMode type,
+ GXBlendFactor src_factor,
+ GXBlendFactor dst_factor,
+ GXLogicOp op );
+
+void GXSetColorUpdate( GXBool update_enable );
+void GXSetAlphaUpdate( GXBool update_enable );
+void GXSetZMode( GXBool compare_enable,
+ GXCompare func,
+ GXBool update_enable );
+
+void GXSetZCompLoc( GXBool before_tex );
+void GXSetPixelFmt ( GXPixelFmt pix_fmt, GXZFmt16 z_fmt );
+void GXSetDither( GXBool dither );
+void GXSetDstAlpha( GXBool enable, u8 alpha );
+void GXSetFieldMask( GXBool odd_mask, GXBool even_mask );
+void GXSetFieldMode( GXBool field_mode, GXBool half_aspect_ratio );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif // __GXPIXEL_H__
+
+#endif
diff --git a/include/rvl/GXStruct.h b/include/rvl/GXStruct.h
new file mode 100755
index 0000000..2b58a98
--- /dev/null
+++ b/include/rvl/GXStruct.h
@@ -0,0 +1,132 @@
+#ifndef __GXSTRUCT_H__
+#define __GXSTRUCT_H__
+
+/********************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/********************************/
+#include "rvl/vitypes.h"
+
+/*---------------------------------------------------------------------------*/
+
+#ifdef __MWERKS__
+#pragma warn_padding off
+#endif // __MWERKS__
+
+/*---------------------------------------------------------------------------*/
+
+/********************************/
+typedef struct _GXColor
+{
+ u8 r,
+ g,
+ b,
+ a;
+
+} GXColor;
+
+typedef struct _GXColorS10
+{
+ s16 r, g, b, a; // s10-bit components for Tev constant color
+} GXColorS10;
+
+/********************************/
+typedef struct _GXTexObj
+{
+#ifdef EMU
+ u32 dummy[16]; // emulator version
+#else
+ u32 dummy[8]; // real hardware version
+#endif
+} GXTexObj;
+
+/********************************/
+typedef struct _GXTlutObj
+{
+ u32 dummy[3];
+
+} GXTlutObj;
+
+/********************************/
+typedef struct _GXLightObj
+{
+ u32 dummy[16];
+
+} GXLightObj;
+
+/********************************/
+typedef struct _GXVtxAttrFmtList
+{
+ GXAttr attr;
+ GXCompCnt cnt;
+ GXCompType type;
+ u8 frac;
+
+} GXVtxAttrFmtList;
+
+/********************************/
+typedef struct _GXTexRegion
+{
+#ifdef EMU
+ u32 dummy[8]; // emulator version
+#else
+ u32 dummy[4]; // real hardware version
+#endif
+} GXTexRegion;
+
+/********************************/
+typedef struct _GXTlutRegion
+{
+ u32 dummy[4];
+
+} GXTlutRegion;
+
+/********************************/
+typedef struct _GXVtxDescList
+{
+ GXAttr attr;
+ GXAttrType type;
+
+} GXVtxDescList;
+
+/********************************/
+typedef struct _GXRenderModeObj
+{
+ VITVMode viTVmode;
+ u16 fbWidth; // no xscale from efb to xfb
+ u16 efbHeight; // embedded frame buffer
+ u16 xfbHeight; // external frame buffer, may yscale efb
+ u16 viXOrigin;
+ u16 viYOrigin;
+ u16 viWidth;
+ u16 viHeight;
+ VIXFBMode xFBmode; // whether single-field or double-field in
+ // XFB.
+ u8 field_rendering; // rendering fields or frames?
+ u8 aa; // anti-aliasing on?
+ u8 sample_pattern[12][2]; // aa sample pattern
+ u8 vfilter[7]; // vertical filter coefficients
+} GXRenderModeObj;
+
+/********************************/
+typedef struct _GXFogAdjTable
+{
+ u16 r[10];
+} GXFogAdjTable;
+
+/********************************/
+
+/*---------------------------------------------------------------------------*/
+
+#ifdef __MWERKS__
+#pragma warn_padding reset
+#endif // __MWERKS__
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/rvl/GXTev.h b/include/rvl/GXTev.h
new file mode 100755
index 0000000..1cecafc
--- /dev/null
+++ b/include/rvl/GXTev.h
@@ -0,0 +1,92 @@
+#ifndef __GXTEV_H__
+#define __GXTEV_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+#include "rvl/GXStruct.h"
+
+/*---------------------------------------------------------------------------*/
+void GXSetTevOp(GXTevStageID id, GXTevMode mode);
+
+void GXSetTevColorIn(
+ GXTevStageID stage,
+ GXTevColorArg a,
+ GXTevColorArg b,
+ GXTevColorArg c,
+ GXTevColorArg d );
+
+void GXSetTevAlphaIn(
+ GXTevStageID stage,
+ GXTevAlphaArg a,
+ GXTevAlphaArg b,
+ GXTevAlphaArg c,
+ GXTevAlphaArg d );
+
+void GXSetTevColorOp(
+ GXTevStageID stage,
+ GXTevOp op,
+ GXTevBias bias,
+ GXTevScale scale,
+ GXBool clamp,
+ GXTevRegID out_reg );
+
+void GXSetTevAlphaOp(
+ GXTevStageID stage,
+ GXTevOp op,
+ GXTevBias bias,
+ GXTevScale scale,
+ GXBool clamp,
+ GXTevRegID out_reg );
+
+void GXSetTevColor( GXTevRegID id, GXColor color );
+void GXSetTevColorS10( GXTevRegID id, GXColorS10 color );
+
+// Feature available in GX chip revision 1 only
+// Revision 2 version is defined, but only prints error msg
+void GXSetTevClampMode ( GXTevStageID stage, GXTevClampMode mode );
+
+void GXSetAlphaCompare(
+ GXCompare comp0,
+ u8 ref0,
+ GXAlphaOp op,
+ GXCompare comp1,
+ u8 ref1 );
+
+void GXSetTevOrder(
+ GXTevStageID stage,
+ GXTexCoordID coord,
+ GXTexMapID map,
+ GXChannelID color );
+
+void GXSetZTexture ( GXZTexOp op, GXTexFmt fmt, u32 bias );
+void GXSetNumTevStages( u8 nStages );
+
+#if ( GX_REV != 1 )
+// Features available in GX chip revision 2 or later only
+void GXSetTevKColor( GXTevKColorID id, GXColor color );
+void GXSetTevKColorSel( GXTevStageID stage, GXTevKColorSel sel );
+void GXSetTevKAlphaSel( GXTevStageID stage, GXTevKAlphaSel sel );
+
+void GXSetTevSwapMode(
+ GXTevStageID stage,
+ GXTevSwapSel ras_sel,
+ GXTevSwapSel tex_sel );
+
+void GXSetTevSwapModeTable(
+ GXTevSwapSel table,
+ GXTevColorChan red,
+ GXTevColorChan green,
+ GXTevColorChan blue,
+ GXTevColorChan alpha );
+
+#endif // ( GX_REV != 1 )
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXTEV_H__
diff --git a/include/rvl/GXTexture.h b/include/rvl/GXTexture.h
new file mode 100755
index 0000000..b51f6d5
--- /dev/null
+++ b/include/rvl/GXTexture.h
@@ -0,0 +1,127 @@
+#ifndef __GXTEXTURE_H__
+#define __GXTEXTURE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+
+typedef GXTexRegion* (*GXTexRegionCallback) (const GXTexObj* t_obj, GXTexMapID id);
+typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
+
+/*---------------------------------------------------------------------------*/
+void GXInitTexObj(
+ GXTexObj* obj,
+ void* image_ptr,
+ u16 width,
+ u16 height,
+ GXTexFmt format,
+ GXTexWrapMode wrap_s,
+ GXTexWrapMode wrap_t,
+ GXBool mipmap);
+
+void GXInitTexObjCI(
+ GXTexObj* obj,
+ void* image_ptr,
+ u16 width,
+ u16 height,
+ GXCITexFmt format,
+ GXTexWrapMode wrap_s,
+ GXTexWrapMode wrap_t,
+ GXBool mipmap,
+ u32 tlut_name);
+
+void GXInitTexObjLOD(
+ GXTexObj* obj,
+ GXTexFilter min_filt,
+ GXTexFilter mag_filt,
+ f32 min_lod,
+ f32 max_lod,
+ f32 lod_bias,
+ GXBool bias_clamp,
+ GXBool do_edge_lod,
+ GXAnisotropy max_aniso );
+
+void GXInitTexObjData ( GXTexObj* obj, void* image_ptr );
+void GXInitTexObjWrapMode ( GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t );
+void GXInitTexObjTlut ( GXTexObj* obj, u32 tlut_name );
+void GXInitTexObjFilter ( GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt );
+void GXInitTexObjMaxLOD ( GXTexObj* obj, f32 max_lod );
+void GXInitTexObjMinLOD ( GXTexObj* obj, f32 min_lod );
+void GXInitTexObjLODBias ( GXTexObj* obj, f32 lod_bias );
+void GXInitTexObjBiasClamp( GXTexObj* obj, GXBool bias_clamp );
+void GXInitTexObjEdgeLOD ( GXTexObj* obj, GXBool do_edge_lod );
+void GXInitTexObjMaxAniso ( GXTexObj* obj, GXAnisotropy max_aniso );
+
+
+void GXInitTexObjUserData ( GXTexObj* obj, void* user_data );
+void* GXGetTexObjUserData ( const GXTexObj* obj );
+
+void GXLoadTexObj ( const GXTexObj* obj, GXTexMapID id );
+
+u32 GXGetTexBufferSize(
+ u16 width,
+ u16 height,
+ u32 format,
+ GXBool mipmap,
+ u8 max_lod );
+
+void GXInitTlutObj(
+ GXTlutObj* tlut_obj,
+ void* lut,
+ GXTlutFmt fmt,
+ u16 n_entries );
+
+void GXLoadTlut ( const GXTlutObj* tlut_obj, u32 tlut_name );
+
+void GXInitTexCacheRegion(
+ GXTexRegion* region,
+ GXBool is_32b_mipmap,
+ u32 tmem_even,
+ GXTexCacheSize size_even,
+ u32 tmem_odd,
+ GXTexCacheSize size_odd );
+
+void GXInitTexPreLoadRegion(
+ GXTexRegion* region,
+ u32 tmem_even,
+ u32 size_even,
+ u32 tmem_odd,
+ u32 size_odd );
+
+void GXInitTlutRegion(
+ GXTlutRegion* region,
+ u32 tmem_addr,
+ GXTlutSize tlut_size );
+
+void GXInvalidateTexRegion ( const GXTexRegion* region );
+void GXInvalidateTexAll ( void );
+void GXPreLoadEntireTexture ( const GXTexObj* tex_obj, const GXTexRegion* region );
+
+GXTexRegionCallback GXSetTexRegionCallback ( GXTexRegionCallback f );
+GXTlutRegionCallback GXSetTlutRegionCallback( GXTlutRegionCallback f );
+
+void GXLoadTexObjPreLoaded(
+ const GXTexObj* obj,
+ const GXTexRegion* region,
+ GXTexMapID id );
+
+void GXSetTexCoordScaleManually(GXTexCoordID coord,
+ GXBool enable,
+ u16 ss, u16 ts);
+
+void GXSetTexCoordCylWrap(GXTexCoordID coord,
+ GXBool s_enable,
+ GXBool t_enable);
+
+void GXSetTexCoordBias(GXTexCoordID coord,
+ GXBool s_enable,
+ GXBool t_enable);
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXTEXTURE_H__
diff --git a/include/rvl/GXTransform.h b/include/rvl/GXTransform.h
new file mode 100755
index 0000000..15c508a
--- /dev/null
+++ b/include/rvl/GXTransform.h
@@ -0,0 +1,71 @@
+#ifndef __GXTRANSFORM_H__
+#define __GXTRANSFORM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+
+#define GX_PROJECTION_SZ 7
+#define GX_VIEWPORT_SZ 6
+
+/*---------------------------------------------------------------------------*/
+void GXSetProjection ( const f32 mtx[4][4], GXProjectionType type );
+void GXSetProjectionv ( const f32 *ptr );
+void GXLoadPosMtxImm ( const f32 mtx[3][4], u32 id );
+void GXLoadPosMtxIndx ( u16 mtx_indx, u32 id );
+void GXLoadNrmMtxImm ( const f32 mtx[3][4], u32 id );
+void GXLoadNrmMtxImm3x3 ( const f32 mtx[3][3], u32 id );
+void GXLoadNrmMtxIndx3x3 ( u16 mtx_indx, u32 id );
+void GXSetCurrentMtx ( u32 id );
+void GXLoadTexMtxImm ( const f32 mtx[][4], u32 id, GXTexMtxType type );
+void GXLoadTexMtxIndx ( u16 mtx_indx, u32 id, GXTexMtxType type );
+
+void GXProject (
+ f32 x, // model coordinates
+ f32 y,
+ f32 z,
+ const f32 mtx[3][4], // model-view matrix
+ const f32* pm, // projection matrix, as returned by GXGetProjectionv
+ const f32* vp, // viewport, as returned by GXGetViewportv
+ f32* sx, // screen coordinates
+ f32* sy,
+ f32* sz );
+
+void GXSetViewport(
+ f32 left,
+ f32 top,
+ f32 wd,
+ f32 ht,
+ f32 nearz,
+ f32 farz );
+
+static inline void GXSetViewportv( const f32 *vp )
+{ // Note: doesn't check for NULL ptr
+ GXSetViewport(vp[0], vp[1], vp[2], vp[3], vp[4], vp[5]);
+}
+
+void GXSetViewportJitter(
+ f32 left,
+ f32 top,
+ f32 wd,
+ f32 ht,
+ f32 nearz,
+ f32 farz,
+ u32 field );
+
+void GXSetZScaleOffset ( f32 scale, f32 offset );
+
+#if ( GX_REV != 1 )
+void GXSetScissorBoxOffset( s32 x_off, s32 y_off );
+#endif
+
+void GXSetClipMode( GXClipMode mode );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXTRANSFORM_H__
diff --git a/include/rvl/GXVert.h b/include/rvl/GXVert.h
new file mode 100755
index 0000000..8564563
--- /dev/null
+++ b/include/rvl/GXVert.h
@@ -0,0 +1,222 @@
+#ifndef __GXVERT_H__
+#define __GXVERT_H__
+
+#ifdef WIN32
+#include <win32/win32.h>
+#endif
+
+// NOTE: This file closely mirrors GXVert.c.
+// Don't change this file without considering that one too,
+// and vice-versa.
+
+/********************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*>*******************************(*)*******************************<*/
+#ifndef EMU // real hardware
+/*---------------------------------------------*
+ * Write gather pipe for GFXFifo *
+ *---------------------------------------------*/
+#ifndef MINNOW
+#define GXFIFO_ADDR 0xCC008000
+#else // MINNOW
+#define GXFIFO_ADDR 0x1C008000
+#endif// MINNOW
+
+// SN-Phil: removed 'extern', added AT_ADDRESS
+//volatile PPCWGPipe GXWGFifo AT_ADDRESS(GXFIFO_ADDR) ;
+extern volatile PPCWGPipe GXWGFifo;
+
+#endif // !EMU
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------*
+ * GXVertex functions *
+ *---------------------------------------------*/
+//-------------------------------
+// Define gfx function templates
+//-------------------------------
+//
+// Templates syntax:
+// __GXCDEF (function_prefix, num_of_components, component_type)
+// __GXCDEFX(function_name, num_of_comps, src_comp_type, dest_comp_type)
+//
+#define __GXCDEF(prfx,n,t) __GXCDEF##n(prfx##n##t,t,t)
+#define __GXCDEFX(func,n,t) __GXCDEF##n(func,t,t)
+
+#ifdef _DEBUG
+
+// 1 component
+#define __GXCDEF1(func,ts,td) \
+ void func(const ts x);
+
+// 2 components
+#define __GXCDEF2(func,ts,td) \
+ void func(const ts x, const ts y);
+
+// 3 components
+#define __GXCDEF3(func,ts,td) \
+ void func(const ts x, const ts y, const ts z);
+
+// 4 components
+#define __GXCDEF4(func,ts,td) \
+ void func(const ts x, const ts y, const ts z, const ts w);
+
+
+#else // ifdef _DEBUG
+/*---------------------------------------------*
+ * For real hardware *
+ *---------------------------------------------*/
+#ifndef EMU
+
+// 1 component
+#define __GXCDEF1(func,ts,td) \
+ static inline void func(const ts x) \
+ { \
+ GXWGFifo._##td = (td) x; \
+ return; \
+ }
+
+// 2 components
+#define __GXCDEF2(func,ts,td) \
+ static inline void func(const ts x, const ts y) \
+ { \
+ GXWGFifo._##td = (td) x; \
+ GXWGFifo._##td = (td) y; \
+ return; \
+ }
+
+// 3 components
+#define __GXCDEF3(func,ts,td) \
+ static inline void func(const ts x, const ts y, const ts z) \
+ { \
+ GXWGFifo._##td = (td) x; \
+ GXWGFifo._##td = (td) y; \
+ GXWGFifo._##td = (td) z; \
+ return; \
+ }
+
+// 4 components
+#define __GXCDEF4(func,ts,td) \
+ static inline void func(const ts x, const ts y, const ts z, const ts w) \
+ { \
+ GXWGFifo._##td = (td) x; \
+ GXWGFifo._##td = (td) y; \
+ GXWGFifo._##td = (td) z; \
+ GXWGFifo._##td = (td) w; \
+ return; \
+ }
+
+#endif // ifndef EMU
+
+#endif // ifdef _DEBUG else
+
+//---------------------------
+// Generate inline functions
+//---------------------------
+//---- GXCmd[n][t] ----
+__GXCDEF( GXCmd, 1, u8 )
+__GXCDEF( GXCmd, 1, u16 )
+__GXCDEF( GXCmd, 1, u32 )
+
+//---- GXParam[n][t] ----
+__GXCDEF( GXParam, 1, u8 )
+__GXCDEF( GXParam, 1, u16 )
+__GXCDEF( GXParam, 1, u32 )
+__GXCDEF( GXParam, 1, s8 )
+__GXCDEF( GXParam, 1, s16 )
+__GXCDEF( GXParam, 1, s32 )
+__GXCDEF( GXParam, 1, f32 )
+__GXCDEF( GXParam, 3, f32 ) // for light
+__GXCDEF( GXParam, 4, f32 ) // for matrix
+
+//---- GXPosition[n][t] ----
+ // for GX_POS_XYZ
+__GXCDEF( GXPosition, 3, f32 )
+__GXCDEF( GXPosition, 3, u8 )
+__GXCDEF( GXPosition, 3, s8 )
+__GXCDEF( GXPosition, 3, u16 )
+__GXCDEF( GXPosition, 3, s16 )
+ // for GX_POS_XY
+__GXCDEF( GXPosition, 2, f32 )
+__GXCDEF( GXPosition, 2, u8 )
+__GXCDEF( GXPosition, 2, s8 )
+__GXCDEF( GXPosition, 2, u16 )
+__GXCDEF( GXPosition, 2, s16 )
+ // for Index
+__GXCDEFX( GXPosition1x16, 1, u16 )
+__GXCDEFX( GXPosition1x8, 1, u8 )
+
+//---- GXNormal[n][t] ----
+ // for GX_NRM or GX_NBT
+__GXCDEF( GXNormal, 3, f32 )
+__GXCDEF( GXNormal, 3, s16 )
+__GXCDEF( GXNormal, 3, s8 )
+ // for Index
+__GXCDEFX( GXNormal1x16, 1, u16 )
+__GXCDEFX( GXNormal1x8, 1, u8 )
+
+//---- GXColor[n][t] ----
+ // for GX_CLR_RGBA8 or RGBX8
+__GXCDEF( GXColor, 4, u8 )
+__GXCDEF( GXColor, 1, u32 )
+ // for GX_CLR_RGBA6 or RGB8
+__GXCDEF( GXColor, 3, u8 )
+ // for GX_CLR_RGBA4 or RGB565
+__GXCDEF( GXColor, 1, u16 )
+ // for Index
+__GXCDEFX( GXColor1x16, 1, u16 )
+__GXCDEFX( GXColor1x8, 1, u8 )
+
+//---- GXTexCoord[n][t] ----
+ // for GX_TEX_ST
+__GXCDEF( GXTexCoord, 2, f32 )
+__GXCDEF( GXTexCoord, 2, s16 )
+__GXCDEF( GXTexCoord, 2, u16 )
+__GXCDEF( GXTexCoord, 2, s8 )
+__GXCDEF( GXTexCoord, 2, u8 )
+ // for GX_TEX_S
+__GXCDEF( GXTexCoord, 1, f32 )
+__GXCDEF( GXTexCoord, 1, s16 )
+__GXCDEF( GXTexCoord, 1, u16 )
+__GXCDEF( GXTexCoord, 1, s8 )
+__GXCDEF( GXTexCoord, 1, u8 )
+ // for Index
+__GXCDEFX( GXTexCoord1x16, 1, u16 )
+__GXCDEFX( GXTexCoord1x8, 1, u8 )
+
+//---- GXMatrixIndex* ----
+// GXMatrixIndex1u8
+__GXCDEF( GXMatrixIndex, 1, u8 )
+#define GXMatrixIndex1x8 GXMatrixIndex1u8
+
+//------------------------
+// Undefine all templates
+//------------------------
+#undef __GXCDEF
+#undef __GXCDEFX
+#undef __GXCDEF1
+#undef __GXCDEF2
+#undef __GXCDEF3
+#undef __GXCDEF4
+
+/*---------------------------------------------------------------------------*/
+// Packing macro for a several color format
+#define GXPackedRGB565(r,g,b) \
+ ((u16)((((r)&0xf8)<<8)|(((g)&0xfc)<<3)|(((b)&0xf8)>>3)))
+#define GXPackedRGBA4(r,g,b,a) \
+ ((u16)((((r)&0xf0)<<8)|(((g)&0xf0)<<4)|(((b)&0xf0) )|(((a)&0xf0)>>4)))
+#define GXPackedRGB5A3(r,g,b,a) \
+ ((u16)((a)>=224 ? \
+ ((((r)&0xf8)<<7)|(((g)&0xf8)<<2)|(((b)&0xf8)>>3)|(1<<15)): \
+ ((((r)&0xf0)<<4)|(((g)&0xf0) )|(((b)&0xf0)>>4)|(((a)&0xe0)<<7))))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __GXVERT_H__
+
diff --git a/include/rvl/OSCache.h b/include/rvl/OSCache.h
new file mode 100755
index 0000000..0957139
--- /dev/null
+++ b/include/rvl/OSCache.h
@@ -0,0 +1,61 @@
+/*
+ This header file defines the most common high level cache operations.
+ For finer grain control over the caches, use OSDC.h, OSIC.h, and OSLC.h
+ for data cache, instruction cache, and locked cache routines respectively.
+ */
+
+#ifndef __OSCACHE_H__
+#define __OSCACHE_H__
+
+/*#include <revolution/types.h>
+#include <revolution/os/OSDC.h>
+#include <revolution/os/OSIC.h>
+#include <revolution/os/OSL2.h>
+#include <revolution/os/OSLC.h>*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*
+ L1 Data Cache Operations
+ *---------------------------------------------------------------------------*/
+
+void DCInvalidateRange ( void* addr, u32 nBytes );
+void DCFlushRange ( void* addr, u32 nBytes );
+void DCStoreRange ( void* addr, u32 nBytes );
+void DCFlushRangeNoSync ( void* addr, u32 nBytes );
+void DCStoreRangeNoSync ( void* addr, u32 nBytes );
+void DCZeroRange ( void* addr, u32 nBytes );
+void DCTouchRange ( void* addr, u32 nBytes );
+
+/*---------------------------------------------------------------------------*
+ L1 Instruction Cache Operations
+ *---------------------------------------------------------------------------*/
+
+void ICInvalidateRange ( void* addr, u32 nBytes );
+
+/*---------------------------------------------------------------------------*
+ Locked Cache Operations
+ *---------------------------------------------------------------------------*/
+// 0xEnnn nnnn addresses will be mapped in by LCEnable (DBAT3 will be used)
+#define LC_BASE_PREFIX 0xE000
+#define LC_BASE (LC_BASE_PREFIX << 16)
+
+void LCEnable ( void );
+void LCDisable ( void );
+void LCLoadBlocks ( void* destTag, void* srcAddr, u32 numBlocks );
+void LCStoreBlocks ( void* destAddr, void* srcTag, u32 numBlocks );
+u32 LCLoadData ( void* destAddr, void* srcAddr, u32 nBytes );
+u32 LCStoreData ( void* destAddr, void* srcAddr, u32 nBytes );
+u32 LCQueueLength ( void );
+void LCQueueWait ( u32 len );
+void LCFlushQueue ( void );
+
+#define LCGetBase() ((void*)LC_BASE)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OSCACHE_H__
diff --git a/include/rvl/PPCWGPipe.h b/include/rvl/PPCWGPipe.h
new file mode 100755
index 0000000..1354a93
--- /dev/null
+++ b/include/rvl/PPCWGPipe.h
@@ -0,0 +1,37 @@
+#ifndef __PPCWGPIPE_H__
+#define __PPCWGPIPE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*
+ PPC Write Gather Pipe
+
+ Write Gather Pipe is defined as:
+ PPCWGPipe wgpipe : <Write Gathered Address>;
+
+ Then, used as:
+ wgpipe.u8 = 0xff;
+ wgpipe.s16 = -5;
+ wgpipe.f32 = 0.10f;
+ *---------------------------------------------------------------------------*/
+typedef union uPPCWGPipe
+{
+ u8 _u8;
+ u16 _u16;
+ u32 _u32;
+ u64 _u64;
+ s8 _s8;
+ s16 _s16;
+ s32 _s32;
+ s64 _s64;
+ f32 _f32;
+ f64 _f64;
+} PPCWGPipe;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__PPCWGPIPE_H__
diff --git a/include/rvl/arc.h b/include/rvl/arc.h
new file mode 100755
index 0000000..94d5d5b
--- /dev/null
+++ b/include/rvl/arc.h
@@ -0,0 +1,115 @@
+#ifndef __ARC_H__
+#define __ARC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ unsigned int magic;
+ int fstStart;
+ int fstSize;
+ int fileStart;
+ int reserve[4];
+
+} ARCHeader;
+
+#define DARCH_MAGIC 0x55aa382d
+
+typedef struct
+{
+ void* archiveStartAddr;
+ void* FSTStart;
+ void* fileStart;
+ u32 entryNum;
+ char* FSTStringStart;
+ u32 FSTLength;
+ u32 currDir;
+
+} ARCHandle;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 startOffset;
+ u32 length;
+
+} ARCFileInfo;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 entryNum;
+ u32 location;
+ u32 next;
+} ARCDir;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 entryNum;
+ BOOL isDir;
+ char* name;
+} ARCDirEntry;
+
+
+BOOL ARCInitHandle(void* arcStart, ARCHandle* handle);
+BOOL ARCOpen(ARCHandle* handle, const char* fileName, ARCFileInfo* af);
+BOOL ARCFastOpen(ARCHandle* handle, s32 entrynum, ARCFileInfo* af);
+s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* pathPtr);
+void* ARCGetStartAddrInMem(ARCFileInfo* af);
+u32 ARCGetStartOffset(ARCFileInfo* af);
+u32 ARCGetLength(ARCFileInfo* af);
+BOOL ARCClose(ARCFileInfo* af);
+
+BOOL ARCChangeDir(ARCHandle* handle, const char* dirName);
+BOOL ARCGetCurrentDir(ARCHandle* handle, char* path, u32 maxlen);
+
+BOOL ARCOpenDir(ARCHandle* handle, const char* dirName, ARCDir* dir);
+BOOL ARCReadDir(ARCDir* dir, ARCDirEntry* dirent);
+BOOL ARCCloseDir(ARCDir* dir);
+
+/*---------------------------------------------------------------------------*
+ Name: ARCTellDir
+
+ Description: Returns the current location associated with the directory
+
+ Arguments: dir Pre-opened ARCDir* structure
+
+ Returns: current location
+ *---------------------------------------------------------------------------*/
+#define ARCTellDir(dir) ((dir)->location)
+
+/*---------------------------------------------------------------------------*
+ Name: ARCSeekDir
+
+ Description: Sets the position of the next ARCReadDir on the directory
+
+ Arguments: dir Pre-opened ARCDir* structure
+ loc location to set
+
+ Returns: None
+ *---------------------------------------------------------------------------*/
+#define ARCSeekDir(dir, loc) ((dir)->location = loc)
+
+/*---------------------------------------------------------------------------*
+ Name: ARCRewindDir
+
+ Description: Resets the position of the directory to the beginning
+
+ Arguments: dir Pre-opened ARCDir* structure
+
+ Returns: None
+ *---------------------------------------------------------------------------*/
+#define ARCRewindDir(dir) ((dir)->location = (dir)->entryNum + 1)
+
+#define ARCGetDirEntryName(dirent) ((dirent)->name)
+#define ARCDirEntryIsDir(dirent) ((dirent)->isDir)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ARC_H__
diff --git a/include/rvl/mtx.h b/include/rvl/mtx.h
new file mode 100755
index 0000000..3bb804e
--- /dev/null
+++ b/include/rvl/mtx.h
@@ -0,0 +1,441 @@
+#ifndef __MTX_H__
+#define __MTX_H__
+
+
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*
+ Default function binding configuration
+ *---------------------------------------------------------------------------*/
+// [Binding Rule]
+//
+// "MTX_USE_PS" -> When this flag is specified, it uses PS* (Paired-Single
+// assembler code) functions for non-prefixed function calls.
+// "MTX_USE_C " -> When this flag is specified, it uses C_* (C code) functions
+// for non-prefixed function calls.
+//
+// If both are specified, it will be treated as MTX_USE_PS.
+// If nothing is specified, NDEBUG build refers PS* functions and
+// DEBUG build uses C_* functions.
+
+// For non-Gekko HW (e.g. emulator)
+#ifndef GEKKO
+#define MTX_USE_C
+#undef MTX_USE_PS
+#endif
+
+#if ( !defined(MTX_USE_PS) && !defined(MTX_USE_C) )
+#ifndef _DEBUG
+#define MTX_USE_PS
+#endif
+#endif
+
+/*---------------------------------------------------------------------------*
+ Macro definitions
+ *---------------------------------------------------------------------------*/
+
+// MtxPtr offset to access next Mtx of an array
+#define MTX_PTR_OFFSET 3
+
+// Mtx44Ptr offset to access next Mtx44 of an array
+#define MTX44_PTR_OFFSET 4
+
+
+// matrix stack
+typedef struct
+{
+
+ u32 numMtx;
+ MtxPtr stackBase;
+ MtxPtr stackPtr;
+
+} MtxStack, *MtxStackPtr;
+
+
+// degree <--> radian conversion macros
+#define MTXDegToRad(a) ( (a) * 0.01745329252f )
+#define MTXRadToDeg(a) ( (a) * 57.29577951f )
+
+
+// Matrix-element-referencing macro.
+// Insulates user from changes from row-major to column-major and vice-versa.
+// Fully documents which index is row, which index is column.
+// XXX this version will change once matrices are transposed.
+
+#define MTXRowCol(m,r,c) ((m)[(r)][(c)])
+
+
+/*---------------------------------------------------------------------------*
+ GENERAL MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// C version
+void C_MTXIdentity ( Mtx m );
+void C_MTXCopy ( const Mtx src, Mtx dst );
+void C_MTXConcat ( const Mtx a, const Mtx b, Mtx ab );
+void C_MTXConcatArray ( const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count );
+void C_MTXTranspose ( const Mtx src, Mtx xPose );
+u32 C_MTXInverse ( const Mtx src, Mtx inv );
+u32 C_MTXInvXpose ( const Mtx src, Mtx invX );
+
+// PS assembler version
+#ifdef GEKKO
+void PSMTXIdentity ( Mtx m );
+void PSMTXCopy ( const Mtx src, Mtx dst );
+void PSMTXConcat ( const Mtx a, const Mtx b, Mtx ab );
+void PSMTXConcatArray ( const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count );
+void PSMTXTranspose ( const Mtx src, Mtx xPose );
+u32 PSMTXInverse ( const Mtx src, Mtx inv );
+u32 PSMTXInvXpose ( const Mtx src, Mtx invX );
+#endif
+
+// Bindings
+#ifdef MTX_USE_PS
+#define MTXIdentity PSMTXIdentity
+#define MTXCopy PSMTXCopy
+#define MTXConcat PSMTXConcat
+#define MTXConcatArray PSMTXConcatArray
+#define MTXTranspose PSMTXTranspose
+#define MTXInverse PSMTXInverse
+#define MTXInvXpose PSMTXInvXpose
+#else // MTX_USE_C
+#define MTXIdentity C_MTXIdentity
+#define MTXCopy C_MTXCopy
+#define MTXConcat C_MTXConcat
+#define MTXConcatArray C_MTXConcatArray
+#define MTXTranspose C_MTXTranspose
+#define MTXInverse C_MTXInverse
+#define MTXInvXpose C_MTXInvXpose
+#endif
+
+
+/*---------------------------------------------------------------------------*
+ MATRIX-VECTOR SECTION
+ *---------------------------------------------------------------------------*/
+// C version
+void C_MTXMultVec ( const Mtx m, const Vec *src, Vec *dst );
+void C_MTXMultVecArray ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count );
+void C_MTXMultVecSR ( const Mtx m, const Vec *src, Vec *dst );
+void C_MTXMultVecArraySR ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count );
+
+// PS assembler version
+#ifdef GEKKO
+void PSMTXMultVec ( const Mtx m, const Vec *src, Vec *dst );
+void PSMTXMultVecArray ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count );
+void PSMTXMultVecSR ( const Mtx m, const Vec *src, Vec *dst );
+void PSMTXMultVecArraySR ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count );
+#endif
+
+// Bindings
+#ifdef MTX_USE_PS
+#define MTXMultVec PSMTXMultVec
+#define MTXMultVecArray PSMTXMultVecArray
+#define MTXMultVecSR PSMTXMultVecSR
+#define MTXMultVecArraySR PSMTXMultVecArraySR
+#else // MTX_USE_C
+#define MTXMultVec C_MTXMultVec
+#define MTXMultVecArray C_MTXMultVecArray
+#define MTXMultVecSR C_MTXMultVecSR
+#define MTXMultVecArraySR C_MTXMultVecArraySR
+#endif
+
+
+/*---------------------------------------------------------------------------*
+ MODEL MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// C version
+void C_MTXQuat ( Mtx m, const Quaternion *q );
+void C_MTXReflect ( Mtx m, const Vec *p, const Vec *n );
+
+void C_MTXTrans ( Mtx m, f32 xT, f32 yT, f32 zT );
+void C_MTXTransApply ( const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT );
+void C_MTXScale ( Mtx m, f32 xS, f32 yS, f32 zS );
+void C_MTXScaleApply ( const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS );
+
+void C_MTXRotRad ( Mtx m, char axis, f32 rad );
+void C_MTXRotTrig ( Mtx m, char axis, f32 sinA, f32 cosA );
+void C_MTXRotAxisRad ( Mtx m, const Vec *axis, f32 rad );
+
+// PS assembler version
+#ifdef GEKKO
+void PSMTXQuat ( Mtx m, const Quaternion *q );
+void PSMTXReflect ( Mtx m, const Vec *p, const Vec *n );
+
+void PSMTXTrans ( Mtx m, f32 xT, f32 yT, f32 zT );
+void PSMTXTransApply ( const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT );
+void PSMTXScale ( Mtx m, f32 xS, f32 yS, f32 zS );
+void PSMTXScaleApply ( const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS );
+
+void PSMTXRotRad ( Mtx m, char axis, f32 rad );
+void PSMTXRotTrig ( Mtx m, char axis, f32 sinA, f32 cosA );
+void PSMTXRotAxisRad ( Mtx m, const Vec *axis, f32 rad );
+#endif
+
+// Bindings
+#ifdef MTX_USE_PS
+#define MTXQuat PSMTXQuat
+#define MTXReflect PSMTXReflect
+#define MTXTrans PSMTXTrans
+#define MTXTransApply PSMTXTransApply
+#define MTXScale PSMTXScale
+#define MTXScaleApply PSMTXScaleApply
+#define MTXRotRad PSMTXRotRad
+#define MTXRotTrig PSMTXRotTrig
+#define MTXRotAxisRad PSMTXRotAxisRad
+
+#define MTXRotDeg( m, axis, deg ) \
+ PSMTXRotRad( m, axis, MTXDegToRad(deg) )
+#define MTXRotAxisDeg( m, axis, deg ) \
+ PSMTXRotAxisRad( m, axis, MTXDegToRad(deg) )
+
+#else // MTX_USE_C
+#define MTXQuat C_MTXQuat
+#define MTXReflect C_MTXReflect
+#define MTXTrans C_MTXTrans
+#define MTXTransApply C_MTXTransApply
+#define MTXScale C_MTXScale
+#define MTXScaleApply C_MTXScaleApply
+#define MTXRotRad C_MTXRotRad
+#define MTXRotTrig C_MTXRotTrig
+#define MTXRotAxisRad C_MTXRotAxisRad
+
+#define MTXRotDeg( m, axis, deg ) \
+ C_MTXRotRad( m, axis, MTXDegToRad(deg) )
+#define MTXRotAxisDeg( m, axis, deg ) \
+ C_MTXRotAxisRad( m, axis, MTXDegToRad(deg) )
+
+#endif
+
+
+// Obsolete. Don't use this if possible.
+#define MTXRotAxis MTXRotAxisDeg
+
+
+/*---------------------------------------------------------------------------*
+ VIEW MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// C version only so far
+void C_MTXLookAt ( Mtx m,
+ const Point3d *camPos,
+ const Vec *camUp,
+ const Point3d *target );
+
+// Bindings
+#define MTXLookAt C_MTXLookAt
+
+
+/*---------------------------------------------------------------------------*
+ PROJECTION MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// C version only so far
+void C_MTXFrustum ( Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f );
+void C_MTXPerspective ( Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f );
+void C_MTXOrtho ( Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f );
+
+// Bindings
+#define MTXFrustum C_MTXFrustum
+#define MTXPerspective C_MTXPerspective
+#define MTXOrtho C_MTXOrtho
+
+
+/*---------------------------------------------------------------------------*
+ TEXTURE PROJECTION MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// C version only so far
+void C_MTXLightFrustum ( Mtx m, f32 t, f32 b, f32 l, f32 r, f32 n,
+ f32 scaleS, f32 scaleT, f32 transS,
+ f32 transT );
+
+void C_MTXLightPerspective ( Mtx m, f32 fovY, f32 aspect, f32 scaleS,
+ f32 scaleT, f32 transS, f32 transT );
+
+void C_MTXLightOrtho ( Mtx m, f32 t, f32 b, f32 l, f32 r, f32 scaleS,
+ f32 scaleT, f32 transS, f32 transT );
+
+// Bindings
+#define MTXLightFrustum C_MTXLightFrustum
+#define MTXLightPerspective C_MTXLightPerspective
+#define MTXLightOrtho C_MTXLightOrtho
+
+
+/*---------------------------------------------------------------------------*
+ VECTOR SECTION
+ *---------------------------------------------------------------------------*/
+// C version
+void C_VECAdd ( const Vec *a, const Vec *b, Vec *ab );
+void C_VECSubtract ( const Vec *a, const Vec *b, Vec *a_b );
+void C_VECScale ( const Vec *src, Vec *dst, f32 scale );
+void C_VECNormalize ( const Vec *src, Vec *unit );
+f32 C_VECSquareMag ( const Vec *v );
+f32 C_VECMag ( const Vec *v );
+f32 C_VECDotProduct ( const Vec *a, const Vec *b );
+void C_VECCrossProduct ( const Vec *a, const Vec *b, Vec *axb );
+f32 C_VECSquareDistance ( const Vec *a, const Vec *b );
+f32 C_VECDistance ( const Vec *a, const Vec *b );
+void C_VECReflect ( const Vec *src, const Vec *normal, Vec *dst );
+void C_VECHalfAngle ( const Vec *a, const Vec *b, Vec *half );
+
+// PS assembler version
+#ifdef GEKKO
+void PSVECAdd ( const Vec *a, const Vec *b, Vec *ab );
+void PSVECSubtract ( const Vec *a, const Vec *b, Vec *a_b );
+void PSVECScale ( const Vec *src, Vec *dst, f32 scale );
+void PSVECNormalize ( const Vec *src, Vec *unit );
+f32 PSVECSquareMag ( const Vec *v );
+f32 PSVECMag ( const Vec *v );
+f32 PSVECDotProduct ( const Vec *a, const Vec *b );
+void PSVECCrossProduct ( const Vec *a, const Vec *b, Vec *axb );
+f32 PSVECSquareDistance ( const Vec *a, const Vec *b );
+f32 PSVECDistance ( const Vec *a, const Vec *b );
+#endif
+
+// Bindings
+#ifdef MTX_USE_PS
+#define VECAdd PSVECAdd
+#define VECSubtract PSVECSubtract
+#define VECScale PSVECScale
+#define VECNormalize PSVECNormalize
+#define VECSquareMag PSVECSquareMag
+#define VECMag PSVECMag
+#define VECDotProduct PSVECDotProduct
+#define VECCrossProduct PSVECCrossProduct
+#define VECSquareDistance PSVECSquareDistance
+#define VECDistance PSVECDistance
+#else // MTX_USE_C
+#define VECAdd C_VECAdd
+#define VECSubtract C_VECSubtract
+#define VECScale C_VECScale
+#define VECNormalize C_VECNormalize
+#define VECSquareMag C_VECSquareMag
+#define VECMag C_VECMag
+#define VECDotProduct C_VECDotProduct
+#define VECCrossProduct C_VECCrossProduct
+#define VECSquareDistance C_VECSquareDistance
+#define VECDistance C_VECDistance
+#endif
+
+#define VECReflect C_VECReflect
+#define VECHalfAngle C_VECHalfAngle
+
+
+/*---------------------------------------------------------------------------*
+ QUATERNION SECTION
+ *---------------------------------------------------------------------------*/
+// C version
+void C_QUATAdd ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void C_QUATSubtract ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void C_QUATMultiply ( const Quaternion *p, const Quaternion *q, Quaternion *pq );
+void C_QUATDivide ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void C_QUATScale ( const Quaternion *q, Quaternion *r, f32 scale );
+f32 C_QUATDotProduct ( const Quaternion *p, const Quaternion *q );
+void C_QUATNormalize ( const Quaternion *src, Quaternion *unit );
+void C_QUATInverse ( const Quaternion *src, Quaternion *inv );
+void C_QUATExp ( const Quaternion *q, Quaternion *r );
+void C_QUATLogN ( const Quaternion *q, Quaternion *r );
+
+void C_QUATMakeClosest ( const Quaternion *q, const Quaternion *qto, Quaternion *r );
+void C_QUATRotAxisRad ( Quaternion *r, const Vec *axis, f32 rad );
+void C_QUATMtx ( Quaternion *r, const Mtx m );
+
+void C_QUATLerp ( const Quaternion *p, const Quaternion *q, Quaternion *r, f32 t );
+void C_QUATSlerp ( const Quaternion *p, const Quaternion *q, Quaternion *r, f32 t );
+void C_QUATSquad ( const Quaternion *p, const Quaternion *a, const Quaternion *b,
+ const Quaternion *q, Quaternion *r, f32 t );
+void C_QUATCompA ( const Quaternion *qprev, const Quaternion *q,
+ const Quaternion *qnext, Quaternion *a );
+
+
+// PS assembler version
+#ifdef GEKKO
+void PSQUATAdd ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void PSQUATSubtract ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void PSQUATMultiply ( const Quaternion *p, const Quaternion *q, Quaternion *pq );
+void PSQUATDivide ( const Quaternion *p, const Quaternion *q, Quaternion *r );
+void PSQUATScale ( const Quaternion *q, Quaternion *r, f32 scale );
+f32 PSQUATDotProduct ( const Quaternion *p, const Quaternion *q );
+void PSQUATNormalize ( const Quaternion *src, Quaternion *unit );
+void PSQUATInverse ( const Quaternion *src, Quaternion *inv );
+#endif
+
+
+// Bindings
+#ifdef MTX_USE_PS
+#define QUATAdd PSQUATAdd
+#define QUATSubtract PSQUATSubtract
+#define QUATMultiply PSQUATMultiply
+#define QUATDivide PSQUATDivide
+#define QUATScale PSQUATScale
+#define QUATDotProduct PSQUATDotProduct
+#define QUATNormalize PSQUATNormalize
+#define QUATInverse PSQUATInverse
+#else // MTX_USE_C
+#define QUATAdd C_QUATAdd
+#define QUATSubtract C_QUATSubtract
+#define QUATMultiply C_QUATMultiply
+#define QUATDivide C_QUATDivide
+#define QUATScale C_QUATScale
+#define QUATDotProduct C_QUATDotProduct
+#define QUATNormalize C_QUATNormalize
+#define QUATInverse C_QUATInverse
+#endif
+
+#define QUATExp C_QUATExp
+#define QUATLogN C_QUATLogN
+#define QUATMakeClosest C_QUATMakeClosest
+#define QUATRotAxisRad C_QUATRotAxisRad
+#define QUATMtx C_QUATMtx
+#define QUATLerp C_QUATLerp
+#define QUATSlerp C_QUATSlerp
+#define QUATSquad C_QUATSquad
+#define QUATCompA C_QUATCompA
+
+
+/*---------------------------------------------------------------------------*
+ SPECIAL PURPOSE MATRIX SECTION
+ *---------------------------------------------------------------------------*/
+// Only PS assembler versions are available
+#ifdef GEKKO
+void PSMTXReorder ( const Mtx src, ROMtx dest );
+void PSMTXROMultVecArray ( const ROMtx m, const Vec *srcBase, Vec *dstBase, u32 count );
+void PSMTXROSkin2VecArray ( const ROMtx m0, const ROMtx m1, const f32 *wtBase, const Vec *srcBase, Vec *dstBase, u32 count);
+void PSMTXMultS16VecArray ( const Mtx m, const S16Vec *srcBase, Vec *dstBase, u32 count );
+void PSMTXROMultS16VecArray( const ROMtx m, const S16Vec *srcBase, Vec *dstBase, u32 count );
+#endif
+
+
+/*---------------------------------------------------------------------------*
+ MATRIX STACK SECTION
+ *---------------------------------------------------------------------------*/
+void MTXInitStack ( MtxStack *sPtr, u32 numMtx );
+MtxPtr MTXPush ( MtxStack *sPtr, const Mtx m );
+MtxPtr MTXPushFwd ( MtxStack *sPtr, const Mtx m );
+MtxPtr MTXPushInv ( MtxStack *sPtr, const Mtx m );
+MtxPtr MTXPushInvXpose ( MtxStack *sPtr, const Mtx m );
+MtxPtr MTXPop ( MtxStack *sPtr );
+MtxPtr MTXGetStackPtr ( const MtxStack *sPtr );
+
+
+// macro to create a matrix stack.
+// the macro exposes the use of OSAlloc() for
+// ease of replacement if desired.
+#define MTXAllocStack( sPtr, numMtx ) ( ((MtxStackPtr)(sPtr))->stackBase = (MtxPtr)OSAlloc( ( (numMtx) * sizeof(Mtx) ) ) )
+
+// macro to free a matrix stack
+#define MTXFreeStack( sPtr ) ( OSFree( (void*)( ((MtxStackPtr)(sPtr))->stackBase ) ) )
+
+
+/*---------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __MTX_H__
+
+/*===========================================================================*/
+
diff --git a/include/rvl/tpl.h b/include/rvl/tpl.h
new file mode 100755
index 0000000..9e68fac
--- /dev/null
+++ b/include/rvl/tpl.h
@@ -0,0 +1,107 @@
+/*---------------------------------------------------------------------------*
+ This TPL library provides a simple interface for TPL files, which used
+ to be the texture data format for the character pipeline in the Nintendo GameCube
+ software development kit.
+ This file also contains wrapper definitions for the conventional TEX API in
+ the new library.
+ *---------------------------------------------------------------------------*/
+
+#ifndef TPL_H
+#define TPL_H
+
+/*---------------------------------------------------------------------------*/
+#include "rvl/GXTexture.h"
+
+// Macros for conventional character pipeline functions
+#ifdef COMPATIBLE_OLD_TEXPALETTE
+
+#define TEXPalettePtr TPLPalettePtr
+#define TEXDescriptorPtr TPLDescriptorPtr
+#define TEXGetPalette TPLGetPalette
+#define TEXReleasePalette TPLReleasePalette
+#define TEXGet TPLGet
+
+#define TEXGetGXTexObjFromPalette TPLGetGXTexObjFromPalette
+#define TEXGetGXTexObjFromPaletteCI TPLGetGXTexObjFromPaletteCI
+
+#endif
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*
+ Structure definitions
+ *---------------------------------------------------------------------------*/
+typedef struct
+{
+ u16 numEntries;
+ u8 unpacked;
+ u8 pad8;
+
+ GXTlutFmt format;
+ Ptr data;
+
+} TPLClutHeader, *TPLClutHeaderPtr;
+
+/*---------------------------------------------------------------------------*/
+typedef struct
+{
+ u16 height;
+ u16 width;
+
+ u32 format;
+ Ptr data;
+
+ GXTexWrapMode wrapS;
+ GXTexWrapMode wrapT;
+
+ GXTexFilter minFilter;
+ GXTexFilter magFilter;
+
+ float LODBias;
+
+ u8 edgeLODEnable;
+ u8 minLOD;
+ u8 maxLOD;
+ u8 unpacked;
+
+} TPLHeader, *TPLHeaderPtr;
+
+/*---------------------------------------------------------------------------*/
+typedef struct
+{
+ TPLHeaderPtr textureHeader;
+ TPLClutHeaderPtr CLUTHeader;
+
+} TPLDescriptor, *TPLDescriptorPtr;
+
+/*---------------------------------------------------------------------------*/
+typedef struct
+{
+ u32 versionNumber;
+
+ u32 numDescriptors;
+ TPLDescriptorPtr descriptorArray;
+
+} TPLPalette, *TPLPalettePtr;
+
+/*---------------------------------------------------------------------------*
+ Function prototypes
+ *---------------------------------------------------------------------------*/
+void TPLBind ( TPLPalettePtr pal );
+TPLDescriptorPtr TPLGet ( TPLPalettePtr pal, u32 id );
+
+void TPLGetGXTexObjFromPalette ( TPLPalettePtr pal, GXTexObj *to, u32 id );
+void TPLGetGXTexObjFromPaletteCI ( TPLPalettePtr pal, GXTexObj *to,
+ GXTlutObj *tlo, GXTlut tluts, u32 id );
+
+
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/rvl/vifuncs.h b/include/rvl/vifuncs.h
new file mode 100755
index 0000000..fab95b4
--- /dev/null
+++ b/include/rvl/vifuncs.h
@@ -0,0 +1,48 @@
+#ifndef __VIFUNCS_H
+#define __VIFUNCS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "rvl/vitypes.h"
+#include "rvl/GXStruct.h" // for GXRenderModeObj structure
+
+
+#define VIPadFrameBufferWidth(width) ((u16)(((u16)(width) + 15) & ~15))
+
+void VIInit ( void );
+void VIFlush ( void );
+void VIWaitForRetrace ( void );
+
+void VIConfigure ( const GXRenderModeObj* rm );
+void VIConfigurePan ( u16 PanPosX, u16 PanPosY,
+ u16 PanSizeX, u16 PanSizeY );
+void VISetNextFrameBuffer ( void *fb );
+
+void *VIGetNextFrameBuffer ( void );
+void *VIGetCurrentFrameBuffer( void );
+
+VIRetraceCallback VISetPreRetraceCallback (VIRetraceCallback callback);
+VIRetraceCallback VISetPostRetraceCallback (VIRetraceCallback callback);
+
+void VISetBlack ( bool black );
+u32 VIGetRetraceCount ( void );
+u32 VIGetNextField ( void );
+u32 VIGetCurrentLine ( void );
+u32 VIGetTvFormat ( void );
+u32 VIGetScanMode ( void );
+
+u32 VIGetDTVStatus ( void );
+
+// For test of switch to Progressive from Interlace
+void VISetVSyncTimingTest ( void );
+u32 VIGetVSyncTimingTest ( void );
+
+
+/********************************/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/rvl/vitypes.h b/include/rvl/vitypes.h
new file mode 100755
index 0000000..506a4f4
--- /dev/null
+++ b/include/rvl/vitypes.h
@@ -0,0 +1,79 @@
+#ifndef __VITYPES_H
+#define __VITYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VI_DISPLAY_PIX_SZ 2
+
+#define VI_INTERLACE 0
+#define VI_NON_INTERLACE 1
+#define VI_PROGRESSIVE 2
+// 3 is reserved
+
+#define VI_NTSC 0
+#define VI_PAL 1
+#define VI_MPAL 2
+#define VI_DEBUG 3
+#define VI_DEBUG_PAL 4
+#define VI_EURGB60 5
+// 6,7,8,9 are reserved
+
+#define VI_TVMODE(FMT, INT) ( ((FMT) << 2) + (INT) )
+
+typedef enum
+{
+ VI_TVMODE_NTSC_INT = VI_TVMODE(VI_NTSC, VI_INTERLACE),
+ VI_TVMODE_NTSC_DS = VI_TVMODE(VI_NTSC, VI_NON_INTERLACE),
+ VI_TVMODE_NTSC_PROG = VI_TVMODE(VI_NTSC, VI_PROGRESSIVE),
+
+ VI_TVMODE_PAL_INT = VI_TVMODE(VI_PAL, VI_INTERLACE),
+ VI_TVMODE_PAL_DS = VI_TVMODE(VI_PAL, VI_NON_INTERLACE),
+
+
+ VI_TVMODE_EURGB60_INT = VI_TVMODE(VI_EURGB60, VI_INTERLACE),
+ VI_TVMODE_EURGB60_DS = VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE),
+ VI_TVMODE_EURGB60_PROG = VI_TVMODE(VI_EURGB60, VI_PROGRESSIVE),
+
+ VI_TVMODE_MPAL_INT = VI_TVMODE(VI_MPAL, VI_INTERLACE),
+ VI_TVMODE_MPAL_DS = VI_TVMODE(VI_MPAL, VI_NON_INTERLACE),
+ VI_TVMODE_MPAL_PROG = VI_TVMODE(VI_MPAL, VI_PROGRESSIVE),
+
+ VI_TVMODE_DEBUG_INT = VI_TVMODE(VI_DEBUG, VI_INTERLACE),
+
+ VI_TVMODE_DEBUG_PAL_INT = VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE),
+ VI_TVMODE_DEBUG_PAL_DS = VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE)
+} VITVMode;
+
+typedef enum
+{
+ VI_XFBMODE_SF = 0,
+ VI_XFBMODE_DF
+} VIXFBMode;
+
+
+#define VI_FIELD_ABOVE 1
+#define VI_FIELD_BELOW 0
+
+// Maximum screen space
+#define VI_MAX_WIDTH_NTSC 720
+#define VI_MAX_HEIGHT_NTSC 480
+
+#define VI_MAX_WIDTH_PAL 720
+#define VI_MAX_HEIGHT_PAL 574
+
+#define VI_MAX_WIDTH_MPAL 720
+#define VI_MAX_HEIGHT_MPAL 480
+
+#define VI_MAX_WIDTH_EURGB60 VI_MAX_WIDTH_NTSC
+#define VI_MAX_HEIGHT_EURGB60 VI_MAX_HEIGHT_NTSC
+
+
+typedef void (*VIRetraceCallback)(u32 retraceCount);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/stage.h b/include/stage.h
new file mode 100755
index 0000000..c89c7dc
--- /dev/null
+++ b/include/stage.h
@@ -0,0 +1,63 @@
+#ifndef __KAMEK_STAGE_H
+#define __KAMEK_STAGE_H
+
+#include <common.h>
+#include <course.h>
+
+#define STAGE_01 0
+#define STAGE_02 1
+#define STAGE_03 2
+#define STAGE_04 3
+#define STAGE_05 4
+#define STAGE_06 5
+#define STAGE_07 6
+#define STAGE_08 7
+#define STAGE_09 8
+#define STAGE_10 9
+#define STAGE_11 10
+#define STAGE_12 11
+#define STAGE_13 12
+#define STAGE_14 13
+#define STAGE_15 14
+#define STAGE_16 15
+#define STAGE_17 16
+#define STAGE_18 17
+#define STAGE_19 18
+#define STAGE_COIN 19
+#define STAGE_GHOST 20
+#define STAGE_TOWER1 21
+#define STAGE_TOWER2 22
+#define STAGE_CASTLE1 23
+#define STAGE_CASTLE2 24
+#define STAGE_TOAD1 25
+#define STAGE_TOAD2 26
+#define STAGE_TOAD3 27
+#define STAGE_TOAD4 28
+#define STAGE_ENEMY1 32
+#define STAGE_ENEMY2 33
+#define STAGE_ENEMY3 34
+#define STAGE_WARP 35
+#define STAGE_DOOMSHIP 37
+#define STAGE_HOME 38
+#define STAGE_TITLE 39
+#define STAGE_PEACH 40
+#define STAGE_STAFFROLL 41
+
+enum StageGroup {
+ Normal = 0,
+ Ghost = 1,
+ Tower = 2,
+ Castle = 3,
+ Toad = 4,
+ Enemy = 5,
+ Warp = 6,
+ Level37 = 7,
+ Doomship = 8,
+ Home = 9,
+ Peach = 10,
+ Invalid = 11
+};
+
+
+
+#endif
diff --git a/include/state.h b/include/state.h
new file mode 100755
index 0000000..b22308f
--- /dev/null
+++ b/include/state.h
@@ -0,0 +1,24 @@
+#ifndef __KAMEK_STATE_H
+#define __KAMEK_STATE_H
+
+#include <common.h>
+
+#ifdef REGION_PAL
+ #define SAVED_STATE_TABLE (*((ObjState**)(0x8042A210)))
+#endif
+
+#ifdef REGION_NTSC
+ #define SAVED_STATE_TABLE (*((ObjState**)(0x80429F30)))
+#endif
+
+struct ObjState {
+ s16 area;
+ s16 x;
+ s16 y;
+ s16 value;
+};
+
+s16 RestoreObjectState(ObjState *table, s16 area, float objX, float objY);
+s32 StoreObjectState(ObjState *table, s16 area, s16 value, float objX, float objY);
+
+#endif