Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef BR_TYPES_H
  2. #define BR_TYPES_H
  3.  
  4. #include "br_defs.h"
  5. #include <setjmp.h>
  6. #include <stddef.h>
  7. #include <stdint.h>// size: 20
  8.     br_uint_32 reserved;           // @0
  9.     char* identifier;              // @4
  10.     br_uint_8 res_class;           // @8
  11.     br_resourcefree_cbfn* free_cb; // @12
  12.     br_uint_32 alignment;          // @16
  13. } br_resource_class;
  14.  
  15. typedef struct br_filesystem {
  16.     char* identifier;
  17.     brfile_attributes_cbfn* attributes;
  18.     brfile_open_read_cbfn* open_read;
  19.     brfile_open_write_cbfn* open_write;
  20.     brfile_close_cbfn* close;
  21.     brfile_eof_cbfn* eof;
  22.     brfile_getchr_cbfn* getchr;
  23.     brfile_putchr_cbfn* putchr;
  24.     brfile_read_cbfn* read;
  25.     brfile_write_cbfn* write;
  26.     brfile_getline_cbfn* getline;
  27.     brfile_putline_cbfn* putline;
  28.     brfile_advance_cbfn* advance;
  29. } br_filesystem;
  30.  
  31. typedef struct br_allocator {
  32.     char* identifier;
  33.     brmem_allocate_cbfn* allocate;
  34.     brmem_free_cbfn* free;
  35.     brmem_inquire_cbfn* inquire;
  36.     brmem_align_cbfn* align;
  37. } br_allocator;
  38.  
  39. typedef struct br_diaghandler {
  40.     char* identifier;
  41.     br_diag_warning_cbfn* warning;
  42.     br_diag_failure_cbfn* failure;
  43. } br_diaghandler;
  44.  
  45. typedef struct br_errorhandler {
  46.     char* identifier;
  47.     br_diag_warning_cbfn* message;
  48.     br_diag_failure_cbfn* error;
  49. } br_errorhandler;
  50.  
  51. typedef struct br_colour_range {
  52.     br_colour low;
  53.     br_colour high;
  54. } br_colour_range;
  55.  
  56. typedef struct br_matrix23 {
  57.     br_scalar m[3][2];
  58. } br_matrix23;
  59.  
  60. typedef struct br_matrix23_f {
  61.     br_float m[3][2];
  62. } br_matrix23_f;
  63.  
  64. typedef struct br_matrix23_x {
  65.     br_fixed_ls m[3][2];
  66. } br_matrix23_x;
  67.  
  68. typedef struct br_matrix34 {
  69.     br_scalar m[4][3];
  70. } br_matrix34;
  71.  
  72. typedef struct br_matrix34_f {
  73.     br_float m[4][3];
  74. } br_matrix34_f;
  75.  
  76. typedef struct br_matrix34_x {
  77.     br_fixed_ls m[4][3];
  78. } br_matrix34_x;
  79.  
  80. typedef struct br_matrix4 {
  81.     br_scalar m[4][4];
  82. } br_matrix4;
  83.  
  84. typedef struct br_matrix4_f {
  85.     br_float m[4][4];
  86. } br_matrix4_f;
  87.  
  88. typedef struct br_matrix4_x {
  89.     br_fixed_ls m[4][4];
  90. } br_matrix4_x;
  91.  
  92. typedef struct br_vector2 {
  93.     br_scalar v[2];
  94. } br_vector2;
  95.  
  96. typedef struct br_vector3 {
  97.     br_scalar v[3];
  98. } br_vector3;
  99.  
  100. typedef struct br_vector4 {
  101.     br_scalar v[4];
  102. } br_vector4;
  103.  
  104. typedef struct br_vector2_x {
  105.     br_fixed_ls v[2];
  106. } br_vector2_x;
  107.  
  108. typedef struct br_vector3_x {
  109.     br_fixed_ls v[3];
  110. } br_vector3_x;
  111.  
  112. typedef struct br_vector4_x {
  113.     br_fixed_ls v[4];
  114. } br_vector4_x;
  115.  
  116. typedef struct br_vector2_f {
  117.     br_float v[2];
  118. } br_vector2_f;
  119.  
  120. typedef struct br_vector3_f {
  121.     br_float v[3];
  122. } br_vector3_f;
  123.  
  124. typedef struct br_vector4_f {
  125.     br_float v[4];
  126. } br_vector4_f;
  127.  
  128. typedef struct br_vector2_i {
  129.     br_int_32 v[2];
  130. } br_vector2_i;
  131.  
  132. typedef struct br_vector3_i {
  133.     br_int_32 v[3];
  134. } br_vector3_i;
  135.  
  136. typedef struct br_vector4_i {
  137.     br_int_32 v[4];
  138. } br_vector4_i;
  139.  
  140. typedef struct br_fvector2 {
  141.     br_fraction v[2];
  142. } br_fvector2;
  143.  
  144. typedef struct br_fvector3 {
  145.     br_fraction v[3];
  146. } br_fvector3;
  147.  
  148. typedef struct br_fvector4 {
  149.     br_fraction v[4];
  150. } br_fvector4;
  151.  
  152. typedef struct br_fvector2_f {
  153.     br_fraction_f v[2];
  154. } br_fvector2_f;
  155.  
  156. typedef struct br_fvector3_f {
  157.     br_fraction_f v[3];
  158. } br_fvector3_f;
  159.  
  160. typedef struct br_fvector4_f {
  161.     br_fraction v[4];
  162. } br_fvector4_f;
  163.  
  164. typedef struct br_fvector2_x {
  165.     br_fraction_x v[2];
  166. } br_fvector2_x;
  167.  
  168. typedef struct br_fvector3_x {
  169.     br_fraction_x v[3];
  170. } br_fvector3_x;
  171.  
  172. typedef struct br_fvector4_x {
  173.     br_fraction_x v[4];
  174. } br_fvector4_x;
  175.  
  176. typedef struct br_bounds2 {
  177.     br_vector2 min;
  178.     br_vector2 max;
  179. } br_bounds2;
  180.  
  181. typedef struct br_bounds3 {
  182.     br_vector3 min;
  183.     br_vector3 max;
  184. } br_bounds3;
  185.  
  186. typedef struct br_bounds4 {
  187.     br_vector4 min;
  188.     br_vector4 max;
  189. } br_bounds4;
  190.  
  191. typedef struct br_bounds2_f {
  192.     br_vector2_f min;
  193.     br_vector2_f max;
  194. } br_bounds2_f;
  195.  
  196. typedef struct br_bounds3_f {
  197.     br_vector3_f min;
  198.     br_vector3_f max;
  199. } br_bounds3_f;
  200.  
  201. typedef struct br_bounds4_f {
  202.     br_vector4_f min;
  203.     br_vector4_f max;
  204. } br_bounds4_f;
  205.  
  206. typedef struct br_bounds2_x {
  207.     br_vector2_x min;
  208.     br_vector2_x max;
  209. } br_bounds2_x;
  210.  
  211. typedef struct br_bounds3_x {
  212.     br_vector3_x min;
  213.     br_vector3_x max;
  214. } br_bounds3_x;
  215.  
  216. typedef struct br_bounds4_x {
  217.     br_vector4_x min;
  218.     br_vector4_x max;
  219. } br_bounds4_x;
  220.  
  221. typedef struct br_bounds2_i {
  222.     br_vector2_i min;
  223.     br_vector2_i max;
  224. } br_bounds2_i;
  225.  
  226. typedef struct br_bounds3_i {
  227.     br_vector3_i min;
  228.     br_vector3_i max;
  229. } br_bounds3_i;
  230.  
  231. typedef struct br_bounds4_i {
  232.     br_vector4_i min;
  233.     br_vector4_i max;
  234. } br_bounds4_i;
  235.  
  236. typedef struct br_euler {
  237.     br_angle a;
  238.     br_angle b;
  239.     br_angle c;
  240.     br_uint_8 order;
  241. } br_euler;
  242.  
  243. typedef struct br_quat {
  244.     br_scalar x;
  245.     br_scalar y;
  246.     br_scalar z;
  247.     br_scalar w;
  248. } br_quat;
  249.  
  250. typedef struct br_transform {  // size: 0x34
  251.     br_uint_16 type;           // @0x0
  252.     union {                    // size: 0x30
  253.         br_matrix34 mat;       // @0x0
  254.         struct {               // size: 0x30
  255.             br_euler e;        // @0x0
  256.             br_scalar _pad[7]; // @0x8
  257.             br_vector3 t;      // @0x24
  258.         } euler;               // @0x0
  259.         struct {               // size: 0x30
  260.             br_quat q;         // @0x0
  261.             br_scalar _pad[5]; // @0x10
  262.             br_vector3 t;      // @0x24
  263.         } quat;                // @0x0
  264.         struct {               // size: 0x30
  265.             br_vector3 look;   // @0x0
  266.             br_vector3 up;     // @0xc
  267.             br_scalar _pad[3]; // @0x18
  268.             br_vector3 t;      // @0x24
  269.         } look_up;             // @0x0
  270.         struct {               // size: 0x30
  271.             br_scalar _pad[9]; // @0x0
  272.             br_vector3 t;      // @0x24
  273.         } translate;           // @0x0
  274.     } t;                       // @0x4
  275. } br_transform;
  276.  
  277. typedef struct br_pixelmap {
  278.     br_uint_32 _reserved;
  279.     char* identifier;
  280.     void* pixels;
  281.     br_uint_32 pixels_qualifier;
  282.     br_pixelmap* map;
  283.     br_colour_range src_key;
  284.     br_colour_range dst_key;
  285.     br_uint_32 key;
  286.     br_int_16 row_bytes;
  287.     br_int_16 mip_offset;
  288.     br_uint_8 type;
  289.     br_uint_8 flags;
  290.     br_uint_16 copy_function;
  291.     br_uint_16 base_x;
  292.     br_uint_16 base_y;
  293.     br_uint_16 width;
  294.     br_uint_16 height;
  295.     br_int_16 origin_x;
  296.     br_int_16 origin_y;
  297.     void* user;
  298.     void* stored;
  299. } br_pixelmap;
  300.  
  301. typedef struct br_point {
  302.     br_int_32 x;
  303.     br_int_32 y;
  304. } br_point;
  305.  
  306. typedef struct br_rectangle {
  307.     br_int_32 x;
  308.     br_int_32 y;
  309.     br_int_32 w;
  310.     br_int_32 h;
  311. } br_rectangle;
  312.  
  313. #pragma pack(push, 1)
  314. typedef struct br_font {
  315.     br_uint_32 flags;
  316.     br_uint_16 glyph_x;
  317.     br_uint_16 glyph_y;
  318.     br_int_16 spacing_x;
  319.     br_int_16 spacing_y;
  320.     br_int_8* width;
  321.     br_uint_16* encoding;
  322.     br_uint_8* glyphs;
  323. } br_font;
  324. #pragma pack(pop)
  325.  
  326. typedef struct br_object_dispatch br_object_dispatch;
  327. typedef struct br_object {
  328.     br_object_dispatch* dispatch;
  329. } br_object;
  330.  
  331. typedef struct br_token_value br_token_value;
  332. typedef union br_value_tag {
  333.     br_uint_32 u32;
  334.     br_boolean b;
  335.     void* p;
  336.     br_token t;
  337.     br_int_8 i8;
  338.     br_uint_8 u8;
  339.     br_int_16 i16;
  340.     br_uint_16 u16;
  341.     br_int_32 i32;
  342.     br_fixed_ls x;
  343.     br_float f;
  344.     br_scalar s;
  345.     br_angle a;
  346.     br_colour rgb;
  347.     br_object* o;
  348.     br_vector2_i* v2_i;
  349.     br_vector3_i* v3_i;
  350.     br_vector4_i* v4_i;
  351.     br_vector2_x* v2_x;
  352.     br_vector3_x* v3_x;
  353.     br_vector4_x* v4_x;
  354.     br_vector2_f* v2_f;
  355.     br_vector3_f* v3_f;
  356.     br_vector4_f* v4_f;
  357.     br_matrix23_x* m23_x;
  358.     br_matrix34_x* m34_x;
  359.     br_matrix4_x* m4_x;
  360.     br_matrix23_f* m23_f;
  361.     br_matrix34_f* m34_f;
  362.     br_matrix4_f* m4_f;
  363.     char* str;
  364.     char* cstr;
  365.     br_object** hl;
  366.     br_token* tl;
  367.     void** pl;
  368.     br_token_value* tvl;
  369. } br_value;
  370.  
  371. typedef struct br_token_value {
  372.     br_token t;
  373.     br_value v;
  374. } br_token_value;
  375.  
  376. typedef struct br_pool_block br_pool_block;
  377. typedef struct br_pool_block {
  378.     br_pool_block* next;
  379. } br_pool_block;
  380.  
  381. typedef struct br_pool {
  382.     br_pool_block* free;
  383.     br_uint_32 block_size;
  384.     br_uint_32 chunk_size;
  385.     int mem_type;
  386. } br_pool;
  387.  
  388. typedef struct br_primitive {
  389.     br_primitive* next;
  390.     br_uint_32 type;
  391.     void* stored;
  392.     void* v[3];
  393. } br_primitive;
  394.  
  395. typedef struct br_order_table {
  396.     br_primitive** table;
  397.     br_uint_16 size;
  398.     br_order_table* next;
  399.     br_scalar min_z;
  400.     br_scalar max_z;
  401.     br_scalar sort_z;
  402.     br_scalar scale;
  403.     br_uint_32 flags;
  404.     br_uint_16 type;
  405.     br_uint_16 visits;
  406. } br_order_table;
  407.  
  408. typedef struct br_primitive_heap {
  409.     br_uint_8* base;
  410.     br_size_t size;
  411.     br_uint_8* current;
  412. } br_primitive_heap;
  413.  
  414. typedef struct br_associative_array_tag {
  415.     br_token_value* tv;
  416.     br_uint_16 num_elements;
  417.     br_uint_16 max_elements;
  418. } br_associative_array;
  419.  
  420. typedef struct br_device {                               // size: 68
  421.     br_uint_32 magic;                                    // @0
  422.     char* identifier;                                    // @4
  423.     br_font* default_font;                               // @8
  424.     br_uint_32 qualifier;                                // @12
  425.     dev_fill_cbfn* fill;                                 // @16
  426.     dev_rectangle_copy_cbfn* rectangle_copy;             // @20
  427.     dev_rectangle_fill_cbfn* rectangle_fill;             // @24
  428.     dev_dirty_rectangle_copy_cbfn* dirty_rectangle_copy; // @28
  429.     dev_dirty_rectangle_fill_cbfn* dirty_rectangle_fill; // @32
  430.     dev_plot_cbfn* plot;                                 // @36
  431.     dev_copy_cbfn* copy;                                 // @40
  432.     dev_line_cbfn* line;                                 // @44
  433.     dev_copy_bits_cbfn* copy_bits;                       // @48
  434.     dev_double_buffer_cbfn* double_buffer;               // @52
  435.     dev_match_cbfn* match;                               // @56
  436.     dev_clone_cbfn* clone;                               // @60
  437.     dev_free_cbfn* free;                                 // @64
  438. } br_device;
  439.  
  440. typedef struct br_outfcty_desc {
  441.     br_int_32 width;
  442.     br_int_32 width_min;
  443.     br_int_32 width_max;
  444.     br_int_32 height;
  445.     br_int_32 height_min;
  446.     br_int_32 height_max;
  447.     br_uint_8 pmtype;
  448.     br_int_32 pmbits;
  449.     br_boolean indexed;
  450.     br_boolean fullscreen;
  451. } br_outfcty_desc;
  452.  
  453. typedef struct br_renderer_facility br_renderer_facility;
  454.  
  455. typedef struct br_device_pixelmap_dispatch br_device_pixelmap_dispatch;
  456. typedef struct br_device_pixelmap {        // size: 0x44
  457.     br_device_pixelmap_dispatch* dispatch; // @0x0
  458.     char* pm_identifier;                   // @0x4
  459.     void* pm_pixels;                       // @0x8
  460.     br_uint_32 pm_pixels_qualifier;        // @0xc
  461.     br_pixelmap* pm_map;                   // @0x10
  462.     br_colour_range pm_src_key;            // @0x14
  463.     br_colour_range pm_dst_key;            // @0x1c
  464.     br_uint_32 pm_key;                     // @0x24
  465.     br_int_16 pm_row_bytes;                // @0x28
  466.     br_int_16 pm_mip_offset;               // @0x2a
  467.     br_uint_8 pm_type;                     // @0x2c
  468.     br_uint_8 pm_flags;                    // @0x2d
  469.     br_uint_16 pm_copy_function;           // @0x2e
  470.     br_uint_16 pm_base_x;                  // @0x30
  471.     br_uint_16 pm_base_y;                  // @0x32
  472.     br_uint_16 pm_width;                   // @0x34
  473.     br_uint_16 pm_height;                  // @0x36
  474.     br_int_16 pm_origin_x;                 // @0x38
  475.     br_int_16 pm_origin_y;                 // @0x3a
  476.     void* pm_user;                         // @0x3c
  477.     void* pm_stored;                       // @0x40
  478. } br_device_pixelmap;
  479.  
  480. typedef struct br_primitive_library br_primitive_library;
  481.  
  482. typedef struct br_geometry br_geometry;
  483.  
  484. typedef struct br_renderer_dispatch br_renderer_dispatch;
  485.  
  486. typedef struct br_renderer {
  487.     br_renderer_dispatch* dispatch;
  488. } br_renderer;
  489.  
  490. typedef struct br_material {       // size: 0x74
  491.     br_uint_32 _reserved;          // @0x0
  492.     char* identifier;              // @0x4
  493.     br_colour colour;              // @0x8
  494.     br_uint_8 opacity;             // @0xc
  495.     br_ufraction ka;               // @0x10
  496.     br_ufraction kd;               // @0x14
  497.     br_ufraction ks;               // @0x18
  498.     br_scalar power;               // @0x1c
  499.     br_uint_32 flags;              // @0x20
  500.     br_matrix23 map_transform;     // @0x24
  501.     br_uint_8 index_base;          // @0x3c
  502.     br_uint_8 index_range;         // @0x3d
  503.     br_pixelmap* colour_map;       // @0x40
  504.     br_pixelmap* screendoor;       // @0x44
  505.     br_pixelmap* index_shade;      // @0x48
  506.     br_pixelmap* index_blend;      // @0x4c
  507.     br_pixelmap* index_fog;        // @0x50
  508.     br_token_value* extra_surf;    // @0x54
  509.     br_token_value* extra_prim;    // @0x58
  510.     br_scalar fog_min;             // @0x5c
  511.     br_scalar fog_max;             // @0x60
  512.     br_colour fog_colour;          // @0x64
  513.     br_int_32 subdivide_tolerance; // @0x68
  514.     void* user;                    // @0x6c
  515.     void* stored;                  // @0x70
  516. } br_material;
  517.  
  518. typedef struct br_vertex {
  519.     br_vector3 p;
  520.     br_vector2 map;
  521.     br_uint_8 index;
  522.     br_uint_8 red;
  523.     br_uint_8 grn;
  524.     br_uint_8 blu;
  525.     br_uint_16 _pad0;
  526.     br_fvector3 n;
  527. } br_vertex;
  528.  
  529. typedef struct br_face {
  530.     br_uint_16 vertices[3];
  531.     br_uint_16 smoothing;
  532.     br_material* material;
  533.     br_uint_8 index;
  534.     br_uint_8 red;
  535.     br_uint_8 grn;
  536.     br_uint_8 blu;
  537.     br_uint_8 flags;
  538.     br_uint_8 _pad0;
  539.     br_uint_32 _pad1;
  540.     br_fvector3 n;
  541.     br_scalar d;
  542. } br_face;
  543.  
  544. typedef struct br_primitive_list br_primitive_list;
  545. typedef struct br_primitive_list {
  546.     br_primitive_list* next;
  547.     br_uint_32 prim_type;
  548.     br_uint_16 nprims;
  549.     br_uint_16 nspares;
  550.     void* prim;
  551.     void* spare;
  552. } br_primitive_list;
  553.  
  554. typedef struct br_vertex_single {
  555.     br_vector3 p;
  556.     br_vector2 map;
  557.     br_uint_8 alpha;
  558.     br_uint_8 red;
  559.     br_uint_8 grn;
  560.     br_uint_8 blu;
  561.     br_uint_16 _pad0;
  562.     br_fvector3 n;
  563. } br_vertex_single;
  564.  
  565. typedef struct br_vertex_double {
  566.     br_vector3 p;
  567.     br_vector2 map0;
  568.     br_uint_8 alpha0;
  569.     br_uint_8 red0;
  570.     br_uint_8 grn0;
  571.     br_uint_8 blu0;
  572.     br_vector2 map1;
  573.     br_uint_8 alpha1;
  574.     br_uint_8 red1;
  575.     br_uint_8 grn1;
  576.     br_uint_8 blu1;
  577.     br_fvector3 n;
  578. } br_vertex_double;
  579.  
  580. typedef struct br_point_prim {
  581.     br_uint_16 vertices[1];
  582.     br_material* material;
  583. } br_point_prim;
  584.  
  585. typedef struct br_line {
  586.     br_uint_16 vertices[2];
  587.     br_material* material;
  588.     br_uint_8 alpha0;
  589.     br_uint_8 red0;
  590.     br_uint_8 grn0;
  591.     br_uint_8 blu0;
  592.     br_uint_8 alpha1;
  593.     br_uint_8 red1;
  594.     br_uint_8 grn1;
  595.     br_uint_8 blu1;
  596. } br_line;
  597.  
  598. typedef struct br_triangle {
  599.     br_uint_16 vertices[3];
  600.     br_uint_16 smoothing;
  601.     br_material* material;
  602.     br_uint_8 alpha0;
  603.     br_uint_8 red0;
  604.     br_uint_8 grn0;
  605.     br_uint_8 blu0;
  606.     br_uint_8 alpha1;
  607.     br_uint_8 red1;
  608.     br_uint_8 grn1;
  609.     br_uint_8 blu1;
  610.     br_uint_8 flags;
  611.     br_fvector3 n;
  612.     br_scalar d;
  613. } br_triangle;
  614.  
  615. typedef struct br_quad {
  616.     br_uint_16 vertices[4];
  617.     br_uint_16 smoothing;
  618.     br_material* material;
  619.     br_uint_8 alpha0;
  620.     br_uint_8 red0;
  621.     br_uint_8 grn0;
  622.     br_uint_8 blu0;
  623.     br_uint_8 alpha1;
  624.     br_uint_8 red1;
  625.     br_uint_8 grn1;
  626.     br_uint_8 blu1;
  627.     br_uint_8 flags;
  628.     br_fvector3 n;
  629.     br_scalar d;
  630. } br_quad;
  631.  
  632. typedef struct br_strip_face_data {
  633.     br_uint_16 smoothing;
  634.     br_uint_8 alpha0;
  635.     br_uint_8 red0;
  636.     br_uint_8 grn0;
  637.     br_uint_8 blu0;
  638.     br_uint_8 alpha1;
  639.     br_uint_8 red1;
  640.     br_uint_8 grn1;
  641.     br_uint_8 blu1;
  642.     br_uint_8 flags;
  643.     br_fvector3 n;
  644.     br_scalar d;
  645. } br_strip_face_data;
  646.  
  647. typedef struct br_tri_strip {
  648.     br_uint_16 nvertices;
  649.     br_uint_16* vertices;
  650.     br_material* material;
  651.     br_strip_face_data* face_data;
  652. } br_tri_strip;
  653.  
  654. typedef struct br_actor {   // size: 0x64
  655.     br_actor* next;         // @0x0
  656.     br_actor** prev;        // @0x4
  657.     br_actor* children;     // @0x8
  658.     br_actor* parent;       // @0xc
  659.     br_uint_16 depth;       // @0x10
  660.     br_uint_8 type;         // @0x12
  661.     char* identifier;       // @0x14
  662.     br_model* model;        // @0x18
  663.     br_material* material;  // @0x1c
  664.     br_uint_8 render_style; // @0x20
  665.     void* render_data;      // @0x24
  666.     br_transform t;         // @0x28
  667.     void* type_data;        // @0x5c
  668.     void* user;             // @0x60
  669. } br_actor;
  670.  
  671. typedef struct br_model {         // size: 0x54
  672.     br_uint_32 _reserved;         // @0x0
  673.     char* identifier;             // @0x4
  674.     br_vertex* vertices;          // @0x8
  675.     br_face* faces;               // @0xc
  676.     br_uint_16 nvertices;         // @0x10
  677.     br_uint_16 nfaces;            // @0x12
  678.     br_vector3 pivot;             // @0x14
  679.     br_uint_16 flags;             // @0x20
  680.     br_model_custom_cbfn* custom; // @0x24
  681.     void* user;                   // @0x28
  682.     br_angle crease_angle;        // @0x2c
  683.     br_scalar radius;             // @0x30
  684.     br_bounds bounds;             // @0x34
  685.     void* prepared;               // @0x4c
  686.     void* stored;                 // @0x50
  687. } br_model;
  688.  
  689. typedef struct br_camera {
  690.     char* identifier;
  691.     br_uint_8 type;
  692.     br_angle field_of_view;
  693.     br_scalar hither_z;
  694.     br_scalar yon_z;
  695.     br_scalar aspect;
  696.     br_scalar width;
  697.     br_scalar height;
  698.     br_scalar distance;
  699.     void* user;
  700. } br_camera;
  701.  
  702. typedef struct br_light {
  703.     char* identifier;
  704.     br_uint_8 type;
  705.     br_colour colour;
  706.     br_scalar attenuation_c;
  707.     br_scalar attenuation_l;
  708.     br_scalar attenuation_q;
  709.     br_angle cone_outer;
  710.     br_angle cone_inner;
  711.     void* user;
  712. } br_light;
  713.  
  714. typedef struct br_fmt_results {
  715.     br_actor** actors;
  716.     br_model** models;
  717.     br_light** lights;
  718.     br_camera** cameras;
  719.     br_vector4** clip_planes;
  720.     br_bounds3** bounds;
  721.     br_bounds3** bounds_correct;
  722.     br_material** materials;
  723.     br_pixelmap** pixelmaps;
  724.     br_uint_32 nactors;
  725.     br_uint_32 nmodels;
  726.     br_uint_32 nlights;
  727.     br_uint_32 ncameras;
  728.     br_uint_32 nclip_planes;
  729.     br_uint_32 nbounds;
  730.     br_uint_32 nbounds_correct;
  731.     br_uint_32 nmaterials;
  732.     br_uint_32 npixelmaps;
  733. } br_fmt_results;
  734.  
  735. typedef struct br_fmt_options {
  736.     br_uint_32 convert_flags;
  737. } br_fmt_options;
  738.  
  739. typedef struct br_3ds_options {
  740.     br_uint_32 flags;
  741.     br_scalar hither;
  742.     br_scalar yon;
  743.     br_scalar scale;
  744.     br_fmt_report_cbfn* report;
  745. } br_3ds_options;
  746.  
  747. typedef struct br_registery br_registry;
  748. typedef void* br_find_failed_cbfn(char*);
  749. typedef br_uint_32 br_enum_cbfn(void*, void*);
  750. typedef void br_surface_fn(br_vertex*, br_fvector3*, br_scalar*);
  751. typedef br_uint_32 br_face_surface_fn(br_vertex*, br_face*, int);
  752. typedef struct br_active_light br_active_light;
  753. typedef void br_light_sub_fn(br_vector3*, br_fvector3*, br_active_light*, br_scalar*);
  754. typedef void br_model_update_cbfn(br_model*, br_uint_16);
  755. typedef void br_material_update_cbfn(br_material*, br_uint_16);
  756. typedef void br_table_update_cbfn(br_pixelmap*, br_uint_16);
  757. typedef void br_map_update_cbfn(br_pixelmap*, br_uint_16);
  758. typedef struct br_node br_node;
  759. typedef struct br_node {
  760.     br_node* next;
  761.     br_node* prev;
  762. } br_node;
  763.  
  764. typedef struct br_list {
  765.     br_node* head;
  766.     br_node* _null;
  767.     br_node* tail;
  768. } br_list;
  769.  
  770. typedef struct br_simple_node br_simple_node;
  771. typedef struct br_simple_node {
  772.     br_simple_node* next;
  773.     br_simple_node** prev;
  774. } br_simple_node;
  775.  
  776. typedef struct br_simple_list {
  777.     br_simple_node* head;
  778. } br_simple_list;
  779.  
  780. typedef struct br_registry_entry { // size: 12
  781.     br_node node;                  // @0
  782.     char** item;                   // @8
  783. } br_registry_entry;
  784.  
  785. typedef struct br_registery {              // size: 20
  786.     br_list list;                          // @0
  787.     int count;                             // @12
  788.     br_find_failed_cbfn* find_failed_hook; // @16
  789. } br_registry;
  790.  
  791. typedef struct br_active_light {
  792.     br_scalar intensity;
  793.     br_vector3 view_position;
  794.     br_vector3 view_direction;
  795.     br_vector3 position;
  796.     br_vector3 direction;
  797.     br_vector3 half;
  798.     br_scalar spot_cosine_outer;
  799.     br_scalar spot_cosine_inner;
  800.     void (*light_sub_function)(br_vector3*, br_fvector3*, br_active_light*, br_scalar*);
  801.     int type;
  802.     br_light* light;
  803. } br_active_light;
  804.  
  805. typedef struct br_active_clip_plane {
  806.     br_vector4 screen_plane;
  807. } br_active_clip_plane;
  808.  
  809. typedef struct fw_fn_table {
  810.     br_surface_fn* light;
  811.     br_surface_fn* light_material;
  812.     br_surface_fn* light_vertex;
  813.     br_surface_fn* light_texture;
  814.     br_face_surface_fn* face_light;
  815.     br_light_sub_fn* direct;
  816.     br_light_sub_fn* point;
  817.     br_light_sub_fn* point_attn;
  818.     br_light_sub_fn* spot;
  819.     br_light_sub_fn* spot_attn;
  820. } fw_fn_table;
  821.  
  822. typedef struct br_image_section {
  823.     char* name;
  824.     void* base;
  825.     br_size_t mem_offset;
  826.     br_size_t mem_size;
  827.     br_uint_32 data_offset;
  828.     br_uint_32 data_size;
  829. } br_image_section;
  830.  
  831. typedef struct br_image br_image;
  832. typedef struct br_image {
  833.     br_node node;
  834.     char* identifier;
  835.     br_int_32 type;
  836.     br_int_32 ref_count;
  837.     br_uint_32 ordinal_base;
  838.     br_uint_32 n_functions;
  839.     void** functions;
  840.     br_uint_32 n_names;
  841.     char** names;
  842.     br_uint_16* name_ordinals;
  843.     br_uint_16 n_imports;
  844.     br_image** imports;
  845.     br_uint_16 n_sections;
  846.     br_image_section* sections;
  847.     void* type_pointer;
  848. } br_image;
  849.  
  850. typedef struct br_open_device {
  851.     br_device* dev;
  852.     br_image* image;
  853. } br_open_device;
  854.  
  855. typedef struct br_framework_state {               // size: 1136
  856.     br_boolean active;                            // @0
  857.     br_registry reg_resource_classes;             // @4
  858.     br_resource_class* resource_class_index[256]; // @24
  859.     br_list tokens;                               // @1048
  860.     br_token next_free_token;                     // @1060
  861.     br_filesystem* fsys;                          // @1064
  862.     br_allocator* mem;                            // @1068
  863.     br_diaghandler* diag;                         // @1072
  864.     int open_mode;                                // @1076
  865.     void* res;                                    // @1080
  866.     void* scratch_ptr;                            // @1084
  867.     br_size_t scratch_size;                       // @1088
  868.     br_size_t scratch_last;                       // @1092
  869.     int scratch_inuse;                            // @1096
  870.     br_error last_error_type;                     // @1100
  871.     void** last_error_value;                      // @1104
  872.     br_list images;                               // @1108
  873.     br_open_device* dev_slots;                    // @1120
  874.     br_int_32 ndev_slots;                         // @1124
  875.     br_associative_array* sys_config;             // @1128
  876.     br_boolean bAlreadyLoadedDrivers;             // @1132
  877. } br_framework_state;
  878.  
  879. // br_framework_state defined by "C:\DETHRACE\source\common\finteray.c" module
  880. typedef struct br_framework_state2 {              // size: 0x14d4
  881.     br_surface_fn* surface_fn;                    // @0x0
  882.     br_surface_fn* surface_fn_after_map;          // @0x4
  883.     br_surface_fn* surface_fn_after_copy;         // @0x8
  884.     br_face_surface_fn* face_surface_fn;          // @0xc
  885.     br_matrix23 map_transform;                    // @0x10
  886.     br_scalar index_base;                         // @0x28
  887.     br_scalar index_range;                        // @0x2c
  888.     br_matrix4 model_to_screen;                   // @0x30
  889.     br_matrix4 view_to_screen;                    // @0x70
  890.     br_matrix34 model_to_view;                    // @0xb0
  891.     br_matrix34 view_to_model;                    // @0xe0
  892.     br_matrix34 model_to_environment;             // @0x110
  893.     struct {                                      // size: 0x34
  894.         br_matrix34 m;                            // @0x0
  895.         br_actor* a;                              // @0x30
  896.     } camera_path[16];                            // @0x140
  897.     int vtos_type;                                // @0x480
  898.     br_vector3 eye_m;                             // @0x484
  899.     br_vector3 eye_m_normalised;                  // @0x490
  900.     br_material* material;                        // @0x49c
  901.     br_active_light active_lights_model[16];      // @0x4a0
  902.     br_active_light active_lights_view[16];       // @0x9e0
  903.     br_uint_16 nactive_lights_model;              // @0xf20
  904.     br_uint_16 nactive_lights_view;               // @0xf22
  905.     int light_is_1md;                             // @0xf24
  906.     br_vector3 eye_l;                             // @0xf28
  907.     br_active_clip_plane active_clip_planes[6];   // @0xf34
  908.     br_uint_16 nactive_clip_planes;               // @0xf94
  909.     br_actor* enabled_lights[16];                 // @0xf98
  910.     br_actor* enabled_clip_planes[6];             // @0xfd8
  911.     br_actor* enabled_environment;                // @0xff0
  912.     br_pixelmap* output;                          // @0xff4
  913.     br_scalar vp_width;                           // @0xff8
  914.     br_scalar vp_height;                          // @0xffc
  915.     br_scalar vp_ox;                              // @0x1000
  916.     br_scalar vp_oy;                              // @0x1004
  917.     int rendering;                                // @0x1008
  918.     br_registry reg_models;                       // @0x100c
  919.     br_registry reg_materials;                    // @0x1020
  920.     br_registry reg_textures;                     // @0x1034
  921.     br_registry reg_tables;                       // @0x1048
  922.     br_registry reg_resource_classes;             // @0x105c
  923.     br_resource_class* resource_class_index[256]; // @0x1070
  924.     br_model_update_cbfn* model_update;           // @0x1470
  925.     br_material_update_cbfn* material_update;     // @0x1474
  926.     br_table_update_cbfn* table_update;           // @0x1478
  927.     br_map_update_cbfn* map_update;               // @0x147c
  928.     br_filesystem* fsys;                          // @0x1480
  929.     br_allocator* mem;                            // @0x1484
  930.     br_errorhandler* err;                         // @0x1488
  931.     int open_mode;                                // @0x148c
  932.     void* res;                                    // @0x1490
  933.     br_model* default_model;                      // @0x1494
  934.     br_material* default_material;                // @0x1498
  935.     fw_fn_table fn_table;                         // @0x149c
  936.     void* scratch_ptr;                            // @0x14c4
  937.     br_size_t scratch_size;                       // @0x14c8
  938.     br_size_t scratch_last;                       // @0x14cc
  939.     int scratch_inuse;                            // @0x14d0
  940. } br_framework_state2;
  941.  
  942. typedef br_error br_exception;
  943. typedef void br_resident_fn(void);
  944. typedef struct br_tv_template_entry {
  945.     br_token token;
  946.     char* name;
  947.     br_int_32 offset;
  948.     br_int_16 flags;
  949.     br_int_16 conv;
  950.     br_int_32 conv_arg;
  951.     br_int_32 mask;
  952. } br_tv_template_entry;
  953.  
  954. typedef struct br_tv_template {
  955.     int n_entries;
  956.     br_tv_template_entry* entries;
  957.     br_int_32 map_base;
  958.     br_int_32 n_map_entries;
  959.     br_tv_template_entry** map_query_entry;
  960.     br_tv_template_entry** map_set_entry;
  961.     br_boolean names_resolved;
  962.     void* res;
  963. } br_tv_template;
  964.  
  965. typedef struct br_object_container_dispatch br_object_container_dispatch;
  966. typedef struct br_object_container {
  967.     br_object_container_dispatch* dispatch;
  968. } br_object_container;
  969.  
  970. typedef struct br_object_container_dispatch {
  971.     void (*__reserved0)(br_object*);
  972.     void (*__reserved1)(br_object*);
  973.     void (*__reserved2)(br_object*);
  974.     void (*__reserved3)(br_object*);
  975.     void (*_free)(br_object*);
  976.     char* (*_identifier)(br_object*);
  977.     br_token (*_type)(br_object*);
  978.     br_boolean (*_isType)(br_object*, br_token);
  979.     br_device* (*_device)(br_object*);
  980.     br_int_32 (*_space)(br_object*);
  981.     br_tv_template* (*_templateQuery)(br_object*);
  982.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  983.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  984.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  985.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  986.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  987.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  988.     void* (*_listQuery)(br_object_container*);
  989.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  990.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  991.     void (*_tokensMatchEnd)(br_object_container*, void*);
  992.     br_error (*_addFront)(br_object_container*, br_object*);
  993.     br_error (*_removeFront)(br_object_container*, br_object**);
  994.     br_error (*_remove)(br_object_container*, br_object*);
  995.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  996.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  997.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  998. } br_object_container_dispatch;
  999.  
  1000. typedef struct br_device_dispatch {
  1001.     void (*__reserved0)(br_object*);
  1002.     void (*__reserved1)(br_object*);
  1003.     void (*__reserved2)(br_object*);
  1004.     void (*__reserved3)(br_object*);
  1005.     void (*_free)(br_object*);
  1006.     char* (*_identifier)(br_object*);
  1007.     br_token (*_type)(br_object*);
  1008.     br_boolean (*_isType)(br_object*, br_token);
  1009.     br_device* (*_device)(br_object*);
  1010.     br_int_32 (*_space)(br_object*);
  1011.     br_tv_template* (*_templateQuery)(br_object*);
  1012.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1013.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1014.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1015.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1016.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1017.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1018.     void* (*_listQuery)(br_object_container*);
  1019.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  1020.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  1021.     void (*_tokensMatchEnd)(br_object_container*, void*);
  1022.     br_error (*_addFront)(br_object_container*, br_object*);
  1023.     br_error (*_removeFront)(br_object_container*, br_object**);
  1024.     br_error (*_remove)(br_object_container*, br_object*);
  1025.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  1026.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  1027.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  1028. } br_device_dispatch;
  1029.  
  1030. // br_device. Not sure when this is used
  1031. typedef struct br_device_2 {
  1032.     br_device_dispatch* dispatch;
  1033. } br_device_2;
  1034.  
  1035. typedef struct br_object_dispatch {
  1036.     void (*__reserved0)(br_object*);
  1037.     void (*__reserved1)(br_object*);
  1038.     void (*__reserved2)(br_object*);
  1039.     void (*__reserved3)(br_object*);
  1040.     void (*_free)(br_object*);
  1041.     char* (*_identifier)(br_object*);
  1042.     br_token (*_type)(br_object*);
  1043.     br_boolean (*_isType)(br_object*, br_token);
  1044.     br_device* (*_device)(br_object*);
  1045.     br_int_32 (*_space)(br_object*);
  1046.     br_tv_template* (*_templateQuery)(br_object*);
  1047.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1048.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1049.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1050.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1051.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1052.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1053. } br_object_dispatch;
  1054.  
  1055. typedef struct br_geometry_stored_dispatch br_geometry_stored_dispatch;
  1056. typedef struct br_geometry_stored {
  1057.     br_geometry_stored_dispatch* dispatch;
  1058. } br_geometry_stored;
  1059.  
  1060. typedef struct br_renderer_state_stored_dispatch {
  1061.     void (*__reserved0)(br_object*);
  1062.     void (*__reserved1)(br_object*);
  1063.     void (*__reserved2)(br_object*);
  1064.     void (*__reserved3)(br_object*);
  1065.     void (*_free)(br_object*);
  1066.     char* (*_identifier)(br_object*);
  1067.     br_token (*_type)(br_object*);
  1068.     br_boolean (*_isType)(br_object*, br_token);
  1069.     br_device* (*_device)(br_object*);
  1070.     br_int_32 (*_space)(br_object*);
  1071.     br_tv_template* (*_templateQuery)(br_object*);
  1072.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1073.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1074.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1075.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1076.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1077.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1078. } br_renderer_state_stored_dispatch;
  1079.  
  1080. typedef struct br_renderer_state_stored {
  1081.     br_renderer_state_stored_dispatch* dispatch;
  1082. } br_renderer_state_stored;
  1083.  
  1084. typedef struct br_buffer_stored_dispatch br_buffer_stored_dispatch;
  1085. typedef struct br_buffer_stored {
  1086.     br_buffer_stored_dispatch* dispatch;
  1087. } br_buffer_stored;
  1088.  
  1089. typedef struct br_device_pixelmap_dispatch {                                                                       // size: 0xe0
  1090.     void (*__reserved0)(br_object*);                                                                               // @0x0
  1091.     void (*__reserved1)(br_object*);                                                                               // @0x4
  1092.     void (*__reserved2)(br_object*);                                                                               // @0x8
  1093.     void (*__reserved3)(br_object*);                                                                               // @0xc
  1094.     void (*_free)(br_object*);                                                                                     // @0x10
  1095.     char* (*_identifier)(br_object*);                                                                              // @0x14
  1096.     br_token (*_type)(br_object*);                                                                                 // @0x18
  1097.     br_boolean (*_isType)(br_object*, br_token);                                                                   // @0x1c
  1098.     br_device* (*_device)(br_object*);                                                                             // @0x20
  1099.     br_int_32 (*_space)(br_object*);                                                                               // @0x24
  1100.     br_tv_template* (*_templateQuery)(br_object*);                                                                 // @0x28
  1101.     br_error (*_query)(br_object*, br_uint_32*, br_token);                                                         // @0x2c
  1102.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);                                 // @0x30
  1103.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);                             // @0x34
  1104.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);                                           // @0x38
  1105.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);                                                 // @0x3c
  1106.     br_error (*_queryAllSize)(br_object*, br_size_t*);                                                             // @0x40
  1107.     br_error (*_validSource)(br_device_pixelmap*, br_boolean*, br_object*);                                        // @0x44
  1108.     br_error (*_resize)(br_device_pixelmap*, br_int_32, br_int_32);                                                // @0x48
  1109.     br_error (*_match)(br_device_pixelmap*, br_device_pixelmap**, br_token_value*);                                // @0x4c
  1110.     br_error (*_allocateSub)(br_device_pixelmap*, br_device_pixelmap**, br_rectangle*);                            // @0x50
  1111.     br_error (*_copy)(br_device_pixelmap*, br_device_pixelmap*);                                                   // @0x54
  1112.     br_error (*_copyTo)(br_device_pixelmap*, br_device_pixelmap*);                                                 // @0x58
  1113.     br_error (*_copyFrom)(br_device_pixelmap*, br_device_pixelmap*);                                               // @0x5c
  1114.     br_error (*_fill)(br_device_pixelmap*, br_uint_32);                                                            // @0x60
  1115.     br_error (*_doubleBuffer)(br_device_pixelmap*, br_device_pixelmap*);                                           // @0x64
  1116.     br_error (*_copyDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);                    // @0x68
  1117.     br_error (*_copyToDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);                  // @0x6c
  1118.     br_error (*_copyFromDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);                // @0x70
  1119.     br_error (*_fillDirty)(br_device_pixelmap*, br_uint_32, br_rectangle*, br_int_32);                             // @0x74
  1120.     br_error (*_doubleBufferDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);            // @0x78
  1121.     br_error (*_rectangle)(br_device_pixelmap*, br_rectangle*, br_uint_32);                                        // @0x7c
  1122.     br_error (*_rectangle2)(br_device_pixelmap*, br_rectangle*, br_uint_32, br_uint_32);                           // @0x80
  1123.     br_error (*_rectangleCopy)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);                // @0x84
  1124.     br_error (*_rectangleCopyTo)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);              // @0x88
  1125.     br_error (*_rectangleCopyFrom)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);            // @0x8c
  1126.     br_error (*_rectangleStretchCopy)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*);     // @0x90
  1127.     br_error (*_rectangleStretchCopyTo)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*);   // @0x94
  1128.     br_error (*_rectangleStretchCopyFrom)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*); // @0x98
  1129.     br_error (*_rectangleFill)(br_device_pixelmap*, br_rectangle*, br_uint_32);                                    // @0x9c
  1130.     br_error (*_pixelSet)(br_device_pixelmap*, br_point*, br_uint_32);                                             // @0xa0
  1131.     br_error (*_line)(br_device_pixelmap*, br_point*, br_point*, br_uint_32);                                      // @0xa4
  1132.     br_error (*_copyBits)(br_device_pixelmap*, br_point*, br_uint_8*, br_uint_16, br_rectangle*, br_uint_32);      // @0xa8
  1133.     br_error (*_text)(br_device_pixelmap*, br_point*, br_font*, char*, br_uint_32);                                // @0xac
  1134.     br_error (*_textBounds)(br_device_pixelmap*, br_rectangle*, br_font*, char*);                                  // @0xb0
  1135.     br_error (*_rowSize)(br_device_pixelmap*, br_size_t*);                                                         // @0xb4
  1136.     br_error (*_rowSet)(br_device_pixelmap*, void*, br_size_t, br_uint_32);                                        // @0xb8
  1137.     br_error (*_rowQuery)(br_device_pixelmap*, void*, br_size_t, br_uint_32);                                      // @0xbc
  1138.     br_error (*_pixelQuery)(br_device_pixelmap*, br_uint_32*, br_point*);                                          // @0xc0
  1139.     br_error (*_pixelAddressQuery)(br_device_pixelmap*, void**, br_uint_32*, br_point*);                           // @0xc4
  1140.     br_error (*_pixelAddressSet)(br_device_pixelmap*, void*, br_uint_32*);                                         // @0xc8
  1141.     br_error (*_originSet)(br_device_pixelmap*, br_point*);                                                        // @0xcc
  1142.     br_error (*_flush)(br_device_pixelmap*);                                                                       // @0xd0
  1143.     br_error (*_synchronise)(br_device_pixelmap*, br_token, br_boolean);                                           // @0xd4
  1144.     br_error (*_directLock)(br_device_pixelmap*, br_boolean);                                                      // @0xd8
  1145.     br_error (*_directUnlock)(br_device_pixelmap*);                                                                // @0xdc
  1146. } br_device_pixelmap_dispatch;
  1147.  
  1148. typedef struct br_buffer_stored_dispatch {
  1149.     void (*__reserved0)(br_object*);
  1150.     void (*__reserved1)(br_object*);
  1151.     void (*__reserved2)(br_object*);
  1152.     void (*__reserved3)(br_object*);
  1153.     void (*_free)(br_object*);
  1154.     char* (*_identifier)(br_object*);
  1155.     br_token (*_type)(br_object*);
  1156.     br_boolean (*_isType)(br_object*, br_token);
  1157.     br_device* (*_device)(br_object*);
  1158.     br_int_32 (*_space)(br_object*);
  1159.     br_tv_template* (*_templateQuery)(br_object*);
  1160.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1161.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1162.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1163.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1164.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1165.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1166.     br_error (*_update)(br_buffer_stored*, br_device_pixelmap*, br_token_value*);
  1167. } br_buffer_stored_dispatch;
  1168.  
  1169. typedef struct brp_vertex brp_vertex;
  1170.  
  1171. typedef struct br_renderer_dispatch {
  1172.     void (*__reserved0)(br_object*);
  1173.     void (*__reserved1)(br_object*);
  1174.     void (*__reserved2)(br_object*);
  1175.     void (*__reserved3)(br_object*);
  1176.     void (*_free)(br_object*);
  1177.     char* (*_identifier)(br_object*);
  1178.     br_token (*_type)(br_object*);
  1179.     br_boolean (*_isType)(br_object*, br_token);
  1180.     br_device* (*_device)(br_object*);
  1181.     br_int_32 (*_space)(br_object*);
  1182.     br_tv_template* (*_templateQuery)(br_object*);
  1183.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1184.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1185.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1186.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1187.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1188.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1189.     void* (*_listQuery)(br_object_container*);
  1190.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  1191.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  1192.     void (*_tokensMatchEnd)(br_object_container*, void*);
  1193.     br_error (*_addFront)(br_object_container*, br_object*);
  1194.     br_error (*_removeFront)(br_object_container*, br_object**);
  1195.     br_error (*_remove)(br_object_container*, br_object*);
  1196.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  1197.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  1198.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  1199.     br_error (*_validDestination)(br_renderer*, br_boolean*, br_object*);
  1200.     br_error (*_stateStoredNew)(br_renderer*, br_renderer_state_stored**, br_uint_32, br_token_value*);
  1201.     br_error (*_stateStoredAvail)(br_renderer*, br_int_32*, br_uint_32, br_token_value*);
  1202.     br_error (*_bufferStoredNew)(br_renderer*, br_buffer_stored**, br_token, br_device_pixelmap*, br_token_value*);
  1203.     br_error (*_bufferStoredAvail)(br_renderer*, br_int_32*, br_token, br_token_value*);
  1204.     br_error (*_partSet)(br_renderer*, br_token, br_int_32, br_token, uintptr_t);
  1205.     br_error (*_partSetMany)(br_renderer*, br_token, br_int_32, br_token_value*, br_int_32*);
  1206.     br_error (*_partQuery)(br_renderer*, br_token, br_int_32, br_uint_32*, br_token);
  1207.     br_error (*_partQueryBuffer)(br_renderer*, br_token, br_int_32, br_uint_32*, br_uint_32*, br_size_t, br_token);
  1208.     br_error (*_partQueryMany)(br_renderer*, br_token, br_int_32, br_token_value*, void*, br_size_t, br_int_32*);
  1209.     br_error (*_partQueryManySize)(br_renderer*, br_token, br_int_32, br_size_t*, br_token_value*);
  1210.     br_error (*_partQueryAll)(br_renderer*, br_token, br_int_32, br_token_value*, br_size_t);
  1211.     br_error (*_partQueryAllSize)(br_renderer*, br_token, br_int_32, br_size_t*);
  1212.     br_error (*_partIndexQuery)(br_renderer*, br_token, br_int_32*);
  1213.     br_error (*_modelMulF)(br_renderer*, br_matrix34_f*);
  1214.     br_error (*_modelMulX)(br_renderer*, br_matrix34_x*);
  1215.     br_error (*_modelPopPushMulF)(br_renderer*, br_matrix34_f*);
  1216.     br_error (*_modelPopPushMulX)(br_renderer*, br_matrix34_x*);
  1217.     br_error (*_modelInvert)(br_renderer*);
  1218.     br_error (*_statePush)(br_renderer*, br_uint_32);
  1219.     br_error (*_statePop)(br_renderer*, br_uint_32);
  1220.     br_error (*_stateSave)(br_renderer*, br_renderer_state_stored*, br_uint_32);
  1221.     br_error (*_stateRestore)(br_renderer*, br_renderer_state_stored*, br_uint_32);
  1222.     br_error (*_stateMask)(br_renderer*, br_uint_32*, br_token*, int);
  1223.     br_error (*_stateDefault)(br_renderer*, br_uint_32);
  1224.     br_error (*_boundsTestF)(br_renderer*, br_token*, br_bounds3_f*);
  1225.     br_error (*_boundsTestX)(br_renderer*, br_token*, br_bounds3_x*);
  1226.     br_error (*_coverageTestF)(br_renderer*, br_float*, br_bounds3_f*);
  1227.     br_error (*_coverageTestX)(br_renderer*, br_fixed_ls*, br_bounds3_x*);
  1228.     br_error (*_viewDistanceF)(br_renderer*, br_float*);
  1229.     br_error (*_viewDistanceX)(br_renderer*, br_fixed_ls*);
  1230.     br_error (*_commandModeSet)(br_renderer*, br_token);
  1231.     br_error (*_commandModeQuery)(br_renderer*, br_token*);
  1232.     br_error (*_commandModeDefault)(br_renderer*);
  1233.     br_error (*_commandModePush)(br_renderer*);
  1234.     br_error (*_commandModePop)(br_renderer*);
  1235.     br_error (*_flush)(br_renderer*, br_boolean);
  1236.     br_error (*_synchronise)(br_renderer*, br_token, br_boolean);
  1237.     br_error (*_testRender)(br_renderer*, br_token, brp_vertex*, brp_vertex*, brp_vertex*);
  1238.     br_error (*_partQueryCapability)(br_renderer*, br_token, br_int_32, br_token_value*, br_size_t);
  1239.     br_error (*_stateQueryPerformance)(br_renderer*, br_fixed_lu*);
  1240. } br_renderer_dispatch;
  1241.  
  1242. typedef struct br_geometry_stored_dispatch {
  1243.     void (*__reserved0)(br_object*);
  1244.     void (*__reserved1)(br_object*);
  1245.     void (*__reserved2)(br_object*);
  1246.     void (*__reserved3)(br_object*);
  1247.     void (*_free)(br_object*);
  1248.     char* (*_identifier)(br_object*);
  1249.     br_token (*_type)(br_object*);
  1250.     br_boolean (*_isType)(br_object*, br_token);
  1251.     br_device* (*_device)(br_object*);
  1252.     br_int_32 (*_space)(br_object*);
  1253.     br_tv_template* (*_templateQuery)(br_object*);
  1254.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1255.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1256.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1257.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1258.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1259.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1260.     br_error (*_render)(br_geometry_stored*, br_renderer*);
  1261.     br_error (*_renderOnScreen)(br_geometry_stored*, br_renderer*);
  1262. } br_geometry_stored_dispatch;
  1263.  
  1264. typedef struct br_file_struct_member {
  1265.     br_uint_16 type;
  1266.     br_uint_32 offset;
  1267.     char* name;
  1268.     void* extra;
  1269. } br_file_struct_member;
  1270.  
  1271. typedef struct br_file_struct {
  1272.     char* name;
  1273.     br_uint_32 nmembers;
  1274.     br_file_struct_member* members;
  1275.     int mem_size;
  1276. } br_file_struct;
  1277.  
  1278. typedef struct br_file_primitives br_file_primitives;
  1279. typedef struct br_datafile {   // size: 0x10
  1280.     void* h;                   // @0x0
  1281.     br_file_primitives* prims; // @0x4
  1282.     br_token scalar_type;      // @0x8
  1283.     void* res;                 // @0xc
  1284. } br_datafile;
  1285.  
  1286. typedef struct br_file_primitives {
  1287.     char* identifier;
  1288.     int (*skip)(br_datafile*, br_uint_32);
  1289.     int (*chunk_write)(br_datafile*, br_uint_32, br_uint_32);
  1290.     int (*chunk_read)(br_datafile*, br_uint_32*);
  1291.     void (*count_write)(br_datafile*, br_uint_32);
  1292.     br_uint_32 (*count_read)(br_datafile*);
  1293.     int (*count_size)(br_datafile*);
  1294.     br_uint_32 (*struct_write)(br_datafile*, br_file_struct*, void*);
  1295.     br_uint_32 (*struct_read)(br_datafile*, br_file_struct*, void*);
  1296.     int (*struct_size)(br_datafile*, br_file_struct*, void*);
  1297.     int (*block_write)(br_datafile*, void*, int, int, int, int);
  1298.     void* (*block_read)(br_datafile*, void*, int*, int, int);
  1299.     int (*block_size)(br_datafile*, void*, int, int, int, int);
  1300.     int (*name_write)(br_datafile*, char*);
  1301.     char* (*name_read)(br_datafile*, char*);
  1302.     int (*name_size)(br_datafile*, char*);
  1303. } br_file_primitives;
  1304.  
  1305. typedef struct br_chunks_table_entry {
  1306.     br_uint_32 id;
  1307.     br_uint_8 has_count;
  1308.     int (*handler)(br_datafile*, br_uint_32, br_uint_32, br_uint_32);
  1309. } br_chunks_table_entry;
  1310.  
  1311. typedef struct br_chunks_table {
  1312.     int nentries;
  1313.     br_chunks_table_entry* entries;
  1314. } br_chunks_table;
  1315.  
  1316. typedef struct br_file_enum_member {
  1317.     int value;
  1318.     char* name;
  1319. } br_file_enum_member;
  1320.  
  1321. typedef struct br_file_enum {
  1322.     br_uint_32 nmembers;
  1323.     br_file_enum_member* members;
  1324. } br_file_enum;
  1325.  
  1326. typedef struct br_device_clut_dispatch br_device_clut_dispatch;
  1327. typedef struct br_device_clut {
  1328.     br_device_clut_dispatch* dispatch;
  1329. } br_device_clut;
  1330.  
  1331. typedef struct br_device_clut_dispatch {
  1332.     void (*__reserved0)(br_object*);
  1333.     void (*__reserved1)(br_object*);
  1334.     void (*__reserved2)(br_object*);
  1335.     void (*__reserved3)(br_object*);
  1336.     void (*_free)(br_object*);
  1337.     char* (*_identifier)(br_object*);
  1338.     br_token (*_type)(br_object*);
  1339.     br_boolean (*_isType)(br_object*, br_token);
  1340.     br_device* (*_device)(br_object*);
  1341.     br_int_32 (*_space)(br_object*);
  1342.     br_tv_template* (*_templateQuery)(br_object*);
  1343.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1344.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1345.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1346.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1347.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1348.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1349.     br_error (*_entrySet)(br_device_clut*, br_int_32, br_colour);
  1350.     br_error (*_entryQuery)(br_device_clut*, br_colour*, br_int_32);
  1351.     br_error (*_entrySetMany)(br_device_clut*, br_int_32, br_int_32, br_colour*);
  1352.     br_error (*_entryQueryMany)(br_device_clut*, br_colour*, br_int_32, br_int_32);
  1353. } br_device_clut_dispatch;
  1354.  
  1355. typedef struct br_geometry_dispatch {
  1356.     void (*__reserved0)(br_object*);
  1357.     void (*__reserved1)(br_object*);
  1358.     void (*__reserved2)(br_object*);
  1359.     void (*__reserved3)(br_object*);
  1360.     void (*_free)(br_object*);
  1361.     char* (*_identifier)(br_object*);
  1362.     br_token (*_type)(br_object*);
  1363.     br_boolean (*_isType)(br_object*, br_token);
  1364.     br_device* (*_device)(br_object*);
  1365.     br_int_32 (*_space)(br_object*);
  1366.     br_tv_template* (*_templateQuery)(br_object*);
  1367.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1368.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1369.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1370.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1371.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1372.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1373. } br_geometry_dispatch;
  1374.  
  1375. typedef struct br_geometry_lighting_dispatch br_geometry_lighting_dispatch;
  1376. typedef struct br_geometry_lighting {
  1377.     br_geometry_lighting_dispatch* dispatch;
  1378. } br_geometry_lighting;
  1379.  
  1380. typedef struct br_geometry_lighting_dispatch {
  1381.     void (*__reserved0)(br_object*);
  1382.     void (*__reserved1)(br_object*);
  1383.     void (*__reserved2)(br_object*);
  1384.     void (*__reserved3)(br_object*);
  1385.     void (*_free)(br_object*);
  1386.     char* (*_identifier)(br_object*);
  1387.     br_token (*_type)(br_object*);
  1388.     br_boolean (*_isType)(br_object*, br_token);
  1389.     br_device* (*_device)(br_object*);
  1390.     br_int_32 (*_space)(br_object*);
  1391.     br_tv_template* (*_templateQuery)(br_object*);
  1392.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1393.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1394.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1395.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1396.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1397.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1398.     br_error (*_renderF)(br_geometry_lighting*, br_renderer*, br_vector3_f*, br_vector3_f*, br_colour*, br_colour*, br_uint_16*, int, int, int, int, int);
  1399.     br_error (*_renderX)(br_geometry_lighting*, br_renderer*, br_vector3_x*, br_vector3_x*, br_colour*, br_colour*, br_uint_16*, int, int, int, int, int);
  1400. } br_geometry_lighting_dispatch;
  1401.  
  1402. typedef struct br_v1db_enable {
  1403.     br_int_32 max;
  1404.     br_int_32 count;
  1405.     br_int_32 type;
  1406.     char* name;
  1407.     br_actor** enabled;
  1408. } br_v1db_enable;
  1409.  
  1410. typedef struct br_v1db_state {             // size: 0x504
  1411.     br_boolean active;                     // @0x0
  1412.     br_boolean zs_active;                  // @0x4
  1413.     br_boolean zb_active;                  // @0x8
  1414.     br_int_32 rendering;                   // @0xc
  1415.     br_renderer* renderer;                 // @0x10
  1416.     br_renderer* query_renderer;           // @0x14
  1417.     br_geometry* format_model;             // @0x18
  1418.     br_geometry* format_buckets;           // @0x1c
  1419.     br_geometry_lighting* format_lighting; // @0x20
  1420.     br_matrix4 model_to_screen;            // @0x24
  1421.     br_matrix34 model_to_view;             // @0x64
  1422.     br_boolean model_to_screen_valid;      // @0x94
  1423.     br_uint_32 ttype;                      // @0x98
  1424.     br_actor* render_root;                 // @0x9c
  1425.     struct {                               // size: 0x38
  1426.         br_matrix34 m;                     // @0x0
  1427.         br_actor* a;                       // @0x30
  1428.         br_uint_8 transform_type;          // @0x34
  1429.     } camera_path[16];                     // @0xa0
  1430.     br_v1db_enable enabled_lights;         // @0x420
  1431.     br_v1db_enable enabled_clip_planes;    // @0x434
  1432.     br_v1db_enable enabled_horizon_planes; // @0x448
  1433.     br_int_32 max_light;                   // @0x45c
  1434.     br_int_32 max_clip;                    // @0x460
  1435.     br_actor* enabled_environment;         // @0x464
  1436.     br_registry reg_models;                // @0x468
  1437.     br_registry reg_materials;             // @0x47c
  1438.     br_registry reg_textures;              // @0x490
  1439.     br_registry reg_tables;                // @0x4a4
  1440.     void* res;                             // @0x4b8
  1441.     br_model* default_model;               // @0x4bc
  1442.     br_material* default_material;         // @0x4c0
  1443.     void* default_render_data;             // @0x4c4
  1444.     br_order_table* default_order_table;   // @0x4c8
  1445.     br_order_table* primary_order_table;   // @0x4cc
  1446.     br_order_table* order_table_list;      // @0x4d0
  1447.     br_primitive_heap heap;                // @0x4d4
  1448.     br_primitive_cbfn* primitive_call;     // @0x4e0
  1449.     br_renderbounds_cbfn* bounds_call;     // @0x4e4
  1450.     br_vector2 origin;                     // @0x4e8
  1451.     br_scalar vp_ox;                       // @0x4f0
  1452.     br_scalar vp_oy;                       // @0x4f4
  1453.     br_scalar vp_width;                    // @0x4f8
  1454.     br_scalar vp_height;                   // @0x4fc
  1455.     br_pixelmap* colour_buffer;            // @0x500
  1456. } br_v1db_state;
  1457.  
  1458. typedef struct br_renderer_facility_dispatch {
  1459.     void (*__reserved0)(br_object*);
  1460.     void (*__reserved1)(br_object*);
  1461.     void (*__reserved2)(br_object*);
  1462.     void (*__reserved3)(br_object*);
  1463.     void (*_free)(br_object*);
  1464.     char* (*_identifier)(br_object*);
  1465.     br_token (*_type)(br_object*);
  1466.     br_boolean (*_isType)(br_object*, br_token);
  1467.     br_device* (*_device)(br_object*);
  1468.     br_int_32 (*_space)(br_object*);
  1469.     br_tv_template* (*_templateQuery)(br_object*);
  1470.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1471.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1472.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1473.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1474.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1475.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1476.     void* (*_listQuery)(br_object_container*);
  1477.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  1478.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  1479.     void (*_tokensMatchEnd)(br_object_container*, void*);
  1480.     br_error (*_addFront)(br_object_container*, br_object*);
  1481.     br_error (*_removeFront)(br_object_container*, br_object**);
  1482.     br_error (*_remove)(br_object_container*, br_object*);
  1483.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  1484.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  1485.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  1486.     br_error (*_validDestination)(br_renderer_facility*, br_boolean*, br_object*);
  1487.     br_error (*_rendererNew)(br_renderer_facility*, br_renderer**, br_token_value*);
  1488. } br_renderer_facility_dispatch;
  1489.  
  1490. typedef struct br_output_facility_dispatch br_output_facility_dispatch;
  1491. typedef struct br_output_facility {
  1492.     br_output_facility_dispatch* dispatch;
  1493. } br_output_facility;
  1494.  
  1495. typedef struct br_output_facility_dispatch {
  1496.     void (*__reserved0)(br_object*);
  1497.     void (*__reserved1)(br_object*);
  1498.     void (*__reserved2)(br_object*);
  1499.     void (*__reserved3)(br_object*);
  1500.     void (*_free)(br_object*);
  1501.     char* (*_identifier)(br_object*);
  1502.     br_token (*_type)(br_object*);
  1503.     br_boolean (*_isType)(br_object*, br_token);
  1504.     br_device* (*_device)(br_object*);
  1505.     br_int_32 (*_space)(br_object*);
  1506.     br_tv_template* (*_templateQuery)(br_object*);
  1507.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1508.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1509.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1510.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1511.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1512.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1513.     void* (*_listQuery)(br_object_container*);
  1514.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  1515.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  1516.     void (*_tokensMatchEnd)(br_object_container*, void*);
  1517.     br_error (*_addFront)(br_object_container*, br_object*);
  1518.     br_error (*_removeFront)(br_object_container*, br_object**);
  1519.     br_error (*_remove)(br_object_container*, br_object*);
  1520.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  1521.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  1522.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  1523.     br_error (*_validSource)(br_output_facility*, br_boolean*, br_object*);
  1524.     br_error (*_pixelmapNew)(br_output_facility*, br_device_pixelmap**, br_token_value*);
  1525.     br_error (*_clutNew)(br_output_facility*, br_device_clut**, br_token_value*);
  1526.     br_error (*_queryCapability)(br_output_facility*, br_token_value*, br_token_value*, br_size_t);
  1527. } br_output_facility_dispatch;
  1528.  
  1529. typedef struct br_primitive_state_dispatch br_primitive_state_dispatch;
  1530. typedef struct br_primitive_state {
  1531.     br_primitive_state_dispatch* dispatch;
  1532. } br_primitive_state;
  1533.  
  1534. typedef struct brp_block brp_block;
  1535.  
  1536. typedef struct br_primitive_state_dispatch {
  1537.     void (*__reserved0)(br_object*);
  1538.     void (*__reserved1)(br_object*);
  1539.     void (*__reserved2)(br_object*);
  1540.     void (*__reserved3)(br_object*);
  1541.     void (*_free)(br_object*);
  1542.     char* (*_identifier)(br_object*);
  1543.     br_token (*_type)(br_object*);
  1544.     br_boolean (*_isType)(br_object*, br_token);
  1545.     br_device* (*_device)(br_object*);
  1546.     br_int_32 (*_space)(br_object*);
  1547.     br_tv_template* (*_templateQuery)(br_object*);
  1548.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1549.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1550.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1551.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1552.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1553.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1554.     br_error (*_partSet)(br_primitive_state*, br_token, br_int_32, br_token, uintptr_t);
  1555.     br_error (*_partSetMany)(br_primitive_state*, br_token, br_int_32, br_token_value*, br_int_32*);
  1556.     br_error (*_partQuery)(br_primitive_state*, br_token, br_int_32, br_uint_32*, br_token);
  1557.     br_error (*_partQueryBuffer)(br_primitive_state*, br_token, br_int_32, br_uint_32*, br_uint_32*, br_size_t, br_token);
  1558.     br_error (*_partQueryMany)(br_primitive_state*, br_token, br_int_32, br_token_value*, void*, br_size_t, br_int_32*);
  1559.     br_error (*_partQueryManySize)(br_primitive_state*, br_token, br_int_32, br_size_t*, br_token_value*);
  1560.     br_error (*_partQueryAll)(br_primitive_state*, br_token, br_int_32, br_token_value*, br_size_t);
  1561.     br_error (*_partQueryAllSize)(br_primitive_state*, br_token, br_int_32, br_size_t*);
  1562.     br_error (*_partIndexQuery)(br_primitive_state*, br_token, br_int_32*);
  1563.     br_error (*_stateDefault)(br_primitive_state*, br_uint_32);
  1564.     br_error (*_stateCopy)(br_primitive_state*, br_primitive_state*, br_uint_32);
  1565.     br_error (*_renderBegin)(br_primitive_state*, brp_block**, br_boolean*, br_boolean*, br_boolean, br_int_32);
  1566.     br_error (*_renderEnd)(br_primitive_state*, brp_block*);
  1567.     br_error (*_rangesQueryF)(br_primitive_state*, br_float*, br_float*, br_int_32);
  1568.     br_error (*_rangesQueryX)(br_primitive_state*, br_fixed_ls*, br_fixed_ls*, br_int_32);
  1569.     br_error (*_partQueryCapability)(br_primitive_state*, br_token, br_int_32, br_token_value*, br_size_t);
  1570.     br_error (*_stateQueryPerformance)(br_primitive_state*, br_fixed_lu*);
  1571. } br_primitive_state_dispatch;
  1572.  
  1573. typedef struct br_primitive_library_dispatch {
  1574.     void (*__reserved0)(br_object*);
  1575.     void (*__reserved1)(br_object*);
  1576.     void (*__reserved2)(br_object*);
  1577.     void (*__reserved3)(br_object*);
  1578.     void (*_free)(br_object*);
  1579.     char* (*_identifier)(br_object*);
  1580.     br_token (*_type)(br_object*);
  1581.     br_boolean (*_isType)(br_object*, br_token);
  1582.     br_device* (*_device)(br_object*);
  1583.     br_int_32 (*_space)(br_object*);
  1584.     br_tv_template* (*_templateQuery)(br_object*);
  1585.     br_error (*_query)(br_object*, br_uint_32*, br_token);
  1586.     br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
  1587.     br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
  1588.     br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
  1589.     br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
  1590.     br_error (*_queryAllSize)(br_object*, br_size_t*);
  1591.     void* (*_listQuery)(br_object_container*);
  1592.     void* (*_tokensMatchBegin)(br_object_container*, br_token, br_token_value*);
  1593.     br_boolean (*_tokensMatch)(br_object_container*, br_object*, void*);
  1594.     void (*_tokensMatchEnd)(br_object_container*, void*);
  1595.     br_error (*_addFront)(br_object_container*, br_object*);
  1596.     br_error (*_removeFront)(br_object_container*, br_object**);
  1597.     br_error (*_remove)(br_object_container*, br_object*);
  1598.     br_error (*_find)(br_object_container*, br_object**, br_token, char*, br_token_value*);
  1599.     br_error (*_findMany)(br_object_container*, br_object**, br_int_32, br_int_32*, br_token, char*, br_token_value*);
  1600.     br_error (*_count)(br_object_container*, br_int_32*, br_token, char*, br_token_value*);
  1601.     br_error (*_stateNew)(br_primitive_library*, br_primitive_state**);
  1602.     br_error (*_bufferStoredNew)(br_primitive_library*, br_buffer_stored**, br_token, br_device_pixelmap*, br_token_value*);
  1603.     br_error (*_bufferStoredAvail)(br_primitive_library*, br_int_32*, br_token, br_token_value*);
  1604.     br_error (*_flush)(br_primitive_library*, br_boolean);
  1605.     br_error (*_synchronise)(br_primitive_library*, br_token, br_boolean);
  1606.     br_error (*_mask)(br_primitive_library*, br_uint_32*, br_token*, int);
  1607. } br_primitive_library_dispatch;
  1608.  
  1609. typedef struct br_file {
  1610.     void* raw_file;
  1611.     br_boolean writing;
  1612.     int mode;
  1613.     char name[4];
  1614. } br_file;
  1615.  
  1616. typedef enum br_lexer_token_id {
  1617.     T_EOF = 0,
  1618.     T_ERROR = 1,
  1619.     T_IDENT = 2,
  1620.     T_STRING = 3,
  1621.     T_INTEGER = 4,
  1622.     T_REAL = 5,
  1623.     T_EXCLAM = 33,
  1624.     T_DQUOTE = 34,
  1625.     T_HASH = 35,
  1626.     T_DOLLAR = 36,
  1627.     T_PERCENT = 37,
  1628.     T_AMPERSAND = 38,
  1629.     T_RQUOTE = 39,
  1630.     T_LPAREN = 40,
  1631.     T_RPAREN = 41,
  1632.     T_ASTERISK = 42,
  1633.     T_PLUS = 43,
  1634.     T_COMMA = 44,
  1635.     T_DASH = 45,
  1636.     T_PERIOD = 46,
  1637.     T_SLASH = 47,
  1638.     T_COLON = 58,
  1639.     T_SEMICOLON = 59,
  1640.     T_LANGLE = 60,
  1641.     T_EQUAL = 61,
  1642.     T_RANGLE = 62,
  1643.     T_QUERY = 63,
  1644.     T_COMAT = 64,
  1645.     T_LSQUARE = 91,
  1646.     T_BSLASH = 92,
  1647.     T_RSQUARE = 93,
  1648.     T_CARET = 94,
  1649.     T_UNDERBAR = 95,
  1650.     T_LQUOTE = 96,
  1651.     T_LBRACE = 123,
  1652.     T_VBAR = 124,
  1653.     T_RBRACE = 125,
  1654.     T_TILDE = 126,
  1655.     T_KEYWORD = 128
  1656. } br_lexer_token_id;
  1657. typedef struct br_lexer_source br_lexer_source;
  1658. typedef void br_lexer_getchar_cbfn(br_lexer_source*);
  1659. typedef struct br_lexer br_lexer;
  1660. typedef void br_lexer_error_cbfn(br_lexer*, char*);
  1661. typedef struct br_lexer_source {
  1662.     br_lexer_source* prev;
  1663.     char* name;
  1664.     br_int_32 line;
  1665.     br_int_32 next;
  1666.     br_lexer_getchar_cbfn* getchar;
  1667.     void* ptr;
  1668. } br_lexer_source;
  1669.  
  1670. typedef struct br_lexer_token {
  1671.     br_lexer_token_id id;
  1672.     union {
  1673.         br_int_32 integer;
  1674.         float real;
  1675.         char* string;
  1676.     } v;
  1677. } br_lexer_token;
  1678.  
  1679. typedef struct br_lexer_keyword {
  1680.     char* name;
  1681.     br_int_32 id;
  1682. } br_lexer_keyword;
  1683.  
  1684. typedef struct br_lexer {
  1685.     br_lexer_source* source;
  1686.     br_lexer_token current;
  1687.     br_lexer_keyword* keywords;
  1688.     br_int_32 nkeywords;
  1689.     char eol_comment;
  1690.     void (*advance)(br_lexer*);
  1691.     br_putline_cbfn* putline;
  1692.     void* putline_arg;
  1693.     char* string_buffer;
  1694.     br_int_32 string_buffer_size;
  1695.     br_lexer_error_cbfn* error;
  1696. } br_lexer;
  1697.  
  1698. typedef br_error br_tv_custom_query_cbfn(br_uint_32*, void**, br_size_t*, void*, br_tv_template_entry*);
  1699. typedef br_error br_tv_custom_set_cbfn(void*, br_uint_32*, br_tv_template_entry*);
  1700. typedef br_size_t br_tv_custom_extra_size_cbfn(void*, br_tv_template_entry*);
  1701. typedef struct br_tv_custom {
  1702.     br_tv_custom_query_cbfn* query;
  1703.     br_tv_custom_set_cbfn* set;
  1704.     br_tv_custom_extra_size_cbfn* extra_size;
  1705. } br_tv_custom;
  1706.  
  1707. typedef struct br_token_entry { // size: 24
  1708.     br_node node;               // @0
  1709.     char* identifier;           // @8
  1710.     br_int_32 type;             // @12
  1711.     br_token token;             // @16
  1712.     br_int_32 base_length;      // @20
  1713. } br_token_entry;
  1714.  
  1715. typedef struct br_exception_handler br_exception_handler;
  1716. typedef struct br_exception_handler {
  1717.     br_exception_handler* prev;
  1718.     jmp_buf context;
  1719. } br_exception_handler;
  1720.  
  1721. typedef struct br_pixelmap_state {
  1722.     void* res;
  1723.     br_tv_template* device_pixelmap_template;
  1724.     br_tv_template* pixelmap_match_template;
  1725. } br_pixelmap_state;
  1726.  
  1727. typedef struct pm_type_info {
  1728.     br_uint_16 bits;
  1729.     br_uint_16 file_size;
  1730.     br_uint_16 align;
  1731.     br_uint_16 channels;
  1732. } pm_type_info;
  1733.  
  1734. typedef struct match_tokens {
  1735.     br_token use;
  1736.     br_uint_8 pixel_type;
  1737.     br_int_32 pixel_bits;
  1738.     br_int_32 width;
  1739.     br_int_32 height;
  1740.     br_object* renderer;
  1741. } match_tokens;
  1742.  
  1743. typedef struct host_info {
  1744.     br_uint_32 size;
  1745.     char identifier[40];
  1746.     br_uint_32 capabilities;
  1747.     br_token processor_family;
  1748.     br_token processor_type;
  1749. } host_info;
  1750.  
  1751. typedef struct host_interrupt_hook {
  1752.     br_uint_8 vector;
  1753.     br_boolean active;
  1754.     br_uint_32 old_offset;
  1755.     br_uint_16 old_sel;
  1756. } host_interrupt_hook;
  1757.  
  1758. typedef struct host_exception_hook {
  1759.     br_uint_8 exception;
  1760.     br_boolean active;
  1761.     br_uint_32 old_offset;
  1762.     br_uint_16 old_sel;
  1763.     br_uint_8 scratch[256];
  1764. } host_exception_hook;
  1765.  
  1766. typedef struct host_regs {
  1767.     struct {
  1768.         br_uint_32 edi;
  1769.         br_uint_32 esi;
  1770.         br_uint_32 ebp;
  1771.         br_uint_32 _res;
  1772.         br_uint_32 ebx;
  1773.         br_uint_32 edx;
  1774.         br_uint_32 ecx;
  1775.         br_uint_32 eax;
  1776.         br_uint_16 flags;
  1777.         br_uint_16 es;
  1778.         br_uint_16 ds;
  1779.         br_uint_16 fs;
  1780.         br_uint_16 gs;
  1781.         br_uint_16 ip;
  1782.         br_uint_16 cs;
  1783.         br_uint_16 sp;
  1784.         br_uint_16 ss;
  1785.     } a;
  1786.     struct {
  1787.         br_uint_16 di;
  1788.         br_uint_16 _pad0;
  1789.         br_uint_16 si;
  1790.         br_uint_16 _pad1;
  1791.         br_uint_16 bp;
  1792.         br_uint_16 _pad2;
  1793.         br_uint_16 _res;
  1794.         br_uint_16 _pad3;
  1795.         br_uint_16 bx;
  1796.         br_uint_16 _pad4;
  1797.         br_uint_16 dx;
  1798.         br_uint_16 _pad5;
  1799.         br_uint_16 cx;
  1800.         br_uint_16 _pad6;
  1801.         br_uint_16 ax;
  1802.         br_uint_16 _pad7;
  1803.         br_uint_16 flags;
  1804.         br_uint_16 es;
  1805.         br_uint_16 ds;
  1806.         br_uint_16 fs;
  1807.         br_uint_16 gs;
  1808.         br_uint_16 ip;
  1809.         br_uint_16 cs;
  1810.         br_uint_16 sp;
  1811.         br_uint_16 ss;
  1812.     } b;
  1813.     struct {
  1814.         br_uint_32 _pad0[4];
  1815.         br_uint_8 bl;
  1816.         br_uint_8 bh;
  1817.         br_uint_8 _pad1;
  1818.         br_uint_8 _pad2;
  1819.         br_uint_8 dl;
  1820.         br_uint_8 dh;
  1821.         br_uint_8 _pad3;
  1822.         br_uint_8 _pad4;
  1823.         br_uint_8 cl;
  1824.         br_uint_8 ch;
  1825.         br_uint_8 _pad5;
  1826.         br_uint_8 _pad6;
  1827.         br_uint_8 al;
  1828.         br_uint_8 ah;
  1829.         br_uint_8 _pad7;
  1830.         br_uint_8 _pad8;
  1831.     } c;
  1832. } host_regs;
  1833.  
  1834. typedef struct ldt {
  1835.     unsigned long limit_0 : 10;
  1836.     unsigned long base_0 : 10;
  1837.     unsigned long base_1 : 8;
  1838.     unsigned long type : 4;
  1839.     unsigned long application : 1;
  1840.     unsigned long dpl : 2;
  1841.     unsigned long present : 1;
  1842.     unsigned long limit_1 : 4;
  1843.     unsigned long system : 1;
  1844.     unsigned long reserved : 1;
  1845.     unsigned long use32 : 1;
  1846.     unsigned long granularity : 1;
  1847.     unsigned long base_2 : 8;
  1848. } ldt;
  1849.  
  1850. typedef struct msdos_header {
  1851.     br_uint_16 magic;
  1852.     br_uint_16 last_page_bytes;
  1853.     br_uint_16 pages;
  1854.     br_uint_16 n_relocations;
  1855.     br_uint_16 header_size;
  1856.     br_uint_16 minalloc;
  1857.     br_uint_16 maxalloc;
  1858.     br_uint_16 start_ss;
  1859.     br_uint_16 start_sp;
  1860.     br_uint_16 checksum;
  1861.     br_uint_16 start_ip;
  1862.     br_uint_16 start_cs;
  1863.     br_uint_16 reloc_offset;
  1864.     br_uint_16 overlay_number;
  1865.     br_uint_16 _reserved0[4];
  1866.     br_uint_16 oem_id;
  1867.     br_uint_16 oem_info;
  1868.     br_uint_16 _reserved1[10];
  1869.     br_uint_32 new_header_offset;
  1870. } msdos_header;
  1871.  
  1872. typedef struct coff_header {
  1873.     br_uint_16 machine;
  1874.     br_uint_16 n_sections;
  1875.     br_uint_32 time_date;
  1876.     br_uint_32 symbols_offset;
  1877.     br_uint_32 n_symbols;
  1878.     br_uint_16 opt_header_size;
  1879.     br_uint_16 flags;
  1880. } coff_header;
  1881.  
  1882. typedef struct nt_optional_header {
  1883.     br_uint_16 magic;
  1884.     br_uint_8 l_major;
  1885.     br_uint_8 l_minor;
  1886.     br_uint_32 code_size;
  1887.     br_uint_32 data_size;
  1888.     br_uint_32 bss_size;
  1889.     br_uint_32 entry_point;
  1890.     br_uint_32 code_base;
  1891.     br_uint_32 data_base;
  1892.     br_uint_32 image_base;
  1893.     br_uint_32 section_alignment;
  1894.     br_uint_32 file_alignment;
  1895.     br_uint_16 os_major;
  1896.     br_uint_16 os_minor;
  1897.     br_uint_16 user_major;
  1898.     br_uint_16 user_minor;
  1899.     br_uint_16 subsys_major;
  1900.     br_uint_16 subsys_minor;
  1901.     br_uint_32 _reserved;
  1902.     br_uint_32 image_size;
  1903.     br_uint_32 header_size;
  1904.     br_uint_32 file_checksum;
  1905.     br_uint_16 subsystem;
  1906.     br_uint_16 dll_flags;
  1907.     br_uint_32 stack_reserve_size;
  1908.     br_uint_32 stack_commit_size;
  1909.     br_uint_32 heap_reserve_size;
  1910.     br_uint_32 heap_commit_size;
  1911.     br_uint_32 loader_flags;
  1912.     br_uint_32 n_data_directories;
  1913.     struct {
  1914.         br_uint_32 rva;
  1915.         br_uint_32 size;
  1916.     } directories[16];
  1917. } nt_optional_header;
  1918.  
  1919. typedef struct section_header {
  1920.     br_uint_8 section_name[8];
  1921.     br_uint_32 virtual_size;
  1922.     br_uint_32 rva;
  1923.     br_uint_32 data_size;
  1924.     br_uint_32 data_offset;
  1925.     br_uint_32 relocs_offset;
  1926.     br_uint_32 linenums_offset;
  1927.     br_uint_16 n_relocs;
  1928.     br_uint_16 n_linenums;
  1929.     br_uint_32 flags;
  1930. } section_header;
  1931.  
  1932. #pragma pack(push, 1)
  1933. typedef struct resource_header { // size: 24
  1934.     br_simple_node node;         // @0
  1935.     br_simple_list children;     // @8
  1936. #if BR_ENDIAN_BIG
  1937.     br_uint_8 size_h;
  1938.     br_uint_8 size_m;
  1939.     br_uint_8 size_l;
  1940. #else
  1941.     br_uint_8 size_l; // @12
  1942.     br_uint_8 size_m; // @13
  1943.     br_uint_8 size_h; // @14
  1944. #endif
  1945.     br_uint_8 class;      // @15
  1946.     void* magic_ptr;      // @16
  1947.     br_uint_32 magic_num; // @20
  1948. } resource_header;
  1949. #pragma pack(pop)
  1950.  
  1951. typedef struct host_real_memory {
  1952.     br_uint_32 pm_off;
  1953.     br_uint_16 pm_seg;
  1954.     br_uint_16 _reserved;
  1955.     br_uint_16 rm_off;
  1956.     br_uint_16 rm_seg;
  1957. } host_real_memory;
  1958.  
  1959. typedef struct file_info {
  1960.     br_uint_32 type;
  1961.     br_uint_32 version;
  1962. } file_info;
  1963.  
  1964. typedef struct object_list {
  1965.     br_simple_list l;
  1966. } object_list;
  1967.  
  1968. typedef struct object_list_entry {
  1969.     br_simple_node n;
  1970.     br_object* h;
  1971. } object_list_entry;
  1972.  
  1973. typedef struct token_match {
  1974.     br_token_value* original;
  1975.     br_token_value* query;
  1976.     br_int_32 n;
  1977.     void* extra;
  1978.     br_size_t extra_size;
  1979. } token_match;
  1980.  
  1981. typedef struct token_type {
  1982.     char* identifier;
  1983.     br_token type;
  1984.     int length;
  1985. } token_type;
  1986.  
  1987. typedef struct export_directory {
  1988.     br_uint_32 flags;
  1989.     br_uint_32 timestamp;
  1990.     br_uint_16 major_version;
  1991.     br_uint_16 minor_version;
  1992.     br_uint_32 name;
  1993.     br_uint_32 ordinal_base;
  1994.     br_uint_32 n_entries;
  1995.     br_uint_32 n_names;
  1996.     br_uint_32 export_table;
  1997.     br_uint_32 name_table;
  1998.     br_uint_32 ordinal_table;
  1999. } export_directory;
  2000.  
  2001. typedef struct import_directory {
  2002.     br_uint_32 lookup_table;
  2003.     br_uint_32 timestamp;
  2004.     br_uint_32 forwarder;
  2005.     br_uint_32 name;
  2006.     br_uint_32 address_table;
  2007. } import_directory;
  2008.  
  2009. typedef struct basereloc_header {
  2010.     br_uint_32 rva;
  2011.     br_uint_32 size;
  2012. } basereloc_header;
  2013.  
  2014. typedef struct order_info {
  2015.     br_uint_8 a0;
  2016.     br_uint_8 a1;
  2017.     br_uint_8 a2;
  2018.     br_uint_8 _pad[1];
  2019. } order_info;
  2020.  
  2021. typedef struct transform_type {
  2022.     br_uint_32 id;
  2023.     br_file_struct* fs;
  2024. } transform_type;
  2025.  
  2026. typedef enum dosio_event_type {
  2027.     DOSIO_EVENT_KEY_DOWN = 0,
  2028.     DOSIO_EVENT_KEY_UP = 1,
  2029.     DOSIO_EVENT_POINTER1_DOWN = 2,
  2030.     DOSIO_EVENT_POINTER1_UP = 3,
  2031.     DOSIO_EVENT_POINTER2_DOWN = 4,
  2032.     DOSIO_EVENT_POINTER2_UP = 5,
  2033.     DOSIO_EVENT_POINTER3_DOWN = 6,
  2034.     DOSIO_EVENT_POINTER3_UP = 7,
  2035.     DOSIO_EVENT_POINTER_MOVE = 8,
  2036.     DOSIO_EVENT_MAX = 9
  2037. } dosio_event_type;
  2038.  
  2039. typedef enum dosio_event_qual {
  2040.     DOSIO_QUAL_SHIFT = 1,
  2041.     DOSIO_QUAL_CONTROL = 2,
  2042.     DOSIO_QUAL_ALT = 4
  2043. } dosio_event_qual;
  2044.  
  2045. typedef struct dosio_event {
  2046.     br_uint_16 type;
  2047.     br_uint_16 qualifiers;
  2048.     br_uint_32 value_1;
  2049.     br_uint_32 value_2;
  2050. } dosio_event;
  2051.  
  2052. typedef struct dosio_event_queue {
  2053.     br_uint_16 total;
  2054.     br_uint_16 count;
  2055.     br_uint_16 head;
  2056.     br_uint_16 tail;
  2057.     dosio_event slots[1];
  2058. } dosio_event_queue;
  2059.  
  2060. typedef struct pm_temp_edge {
  2061.     struct pm_temp_edge* next;
  2062.     br_uint_16 first;
  2063.     br_uint_16 last;
  2064.     char other;
  2065. } pm_temp_edge;
  2066.  
  2067. typedef struct prep_vertex {
  2068.     br_vector3 n;
  2069.     br_uint_16 v;
  2070.     br_uint_16 f;
  2071. } prep_vertex;
  2072.  
  2073. typedef struct fmt_vertex {
  2074.     br_vector3 p;
  2075.     br_vector2 map;
  2076.     br_vector3 n;
  2077. } DR_VERTEX, fmt_vertex;
  2078.  
  2079. typedef struct v11face {
  2080.     br_uint_16 vertices[3];
  2081.     br_uint_16 edges[3];
  2082.     br_vector4 eqn;
  2083. } DR_FACE, v11face;
  2084.  
  2085. typedef struct v11group {
  2086.     void* stored;
  2087.     v11face* faces;
  2088.     br_colour* face_colours;
  2089.     br_uint_16* face_user;
  2090.     fmt_vertex* vertices;
  2091.     br_colour* vertex_colours;
  2092.     br_uint_16* vertex_user;
  2093.     br_uint_16 nfaces;
  2094.     br_uint_16 nvertices;
  2095.     br_uint_16 nedges;
  2096.  
  2097.     br_material* face_colours_material; // Added to avoid 64 bit issues trying to pack br_material* into br_colour. eek ;)
  2098. } v11group;
  2099.  
  2100. typedef struct v11model {
  2101.     br_size_t size;
  2102.     br_uint_32 flags;
  2103.     br_uint_16 ngroups;
  2104.     br_vector3 pivot;
  2105.     v11group* groups;
  2106. } v11model;
  2107.  
  2108. // From BRender SDK v1.2
  2109.  
  2110. /*
  2111.  * Type of actor position
  2112.  */
  2113. enum {
  2114.     BR_TRANSFORM_MATRIX34,
  2115.     BR_TRANSFORM_MATRIX34_LP,
  2116.     BR_TRANSFORM_QUAT,
  2117.     BR_TRANSFORM_EULER,
  2118.     BR_TRANSFORM_LOOK_UP,
  2119.     BR_TRANSFORM_TRANSLATION,
  2120.     BR_TRANSFORM_IDENTITY,
  2121.     BR_TRANSFORM_MAX
  2122. };
  2123.  
  2124. /*
  2125.  * Basic types of actor
  2126.  */
  2127. enum {
  2128.     BR_ACTOR_NONE,
  2129.     BR_ACTOR_MODEL,
  2130.     BR_ACTOR_LIGHT,
  2131.     BR_ACTOR_CAMERA,
  2132.     _BR_ACTOR_RESERVED,
  2133.     BR_ACTOR_BOUNDS,
  2134.     BR_ACTOR_BOUNDS_CORRECT,
  2135.     BR_ACTOR_CLIP_PLANE,
  2136.     BR_ACTOR_HORIZONTAL_PLANE,
  2137. };
  2138.  
  2139. /*
  2140.  * Render styles - an actor inherits it's style from the most _distant_
  2141.  * ancestor included in this traversal that does not have default set
  2142.  * (unlike model & material which are inherited from the nearest ancestor)
  2143.  */
  2144. enum {
  2145.     BR_RSTYLE_DEFAULT,
  2146.     BR_RSTYLE_NONE,
  2147.     BR_RSTYLE_POINTS,
  2148.     BR_RSTYLE_EDGES,
  2149.     BR_RSTYLE_FACES,
  2150.     BR_RSTYLE_BOUNDING_POINTS,
  2151.     BR_RSTYLE_BOUNDING_EDGES,
  2152.     BR_RSTYLE_BOUNDING_FACES,
  2153.     BR_RSTYLE_MAX
  2154. };
  2155.  
  2156. enum {
  2157.  
  2158.     BR_LIGHT_POINT = 0x0000,
  2159.     BR_LIGHT_DIRECT = 0x0001,
  2160.     BR_LIGHT_SPOT = 0x0002,
  2161.     BR_LIGHT_TYPE = 0x0003,
  2162.  
  2163.     /*
  2164.      * Flag idicating that caluculations are done in view space
  2165.      */
  2166.     BR_LIGHT_VIEW = 0x0004
  2167. };
  2168.  
  2169. enum {
  2170.     BR_CAMERA_PARALLEL,
  2171.     BR_CAMERA_PERSPECTIVE_FOV,
  2172.     BR_CAMERA_PERSPECTIVE_WHD
  2173. };
  2174.  
  2175. /*
  2176.  * Various types of pixel
  2177.  */
  2178. enum {
  2179.     /*
  2180.      * Each pixel is an index into a colour map
  2181.      */
  2182.     BR_PMT_INDEX_1,
  2183.     BR_PMT_INDEX_2,
  2184.     BR_PMT_INDEX_4,
  2185.     BR_PMT_INDEX_8,
  2186.  
  2187.     /*
  2188.      * True colour RGB
  2189.      */
  2190.     BR_PMT_RGB_555,   /* 16 bits per pixel */
  2191.     BR_PMT_RGB_565,   /* 16 bits per pixel */
  2192.     BR_PMT_RGB_888,   /* 24 bits per pixel */
  2193.     BR_PMT_RGBX_888,  /* 32 bits per pixel */
  2194.     BR_PMT_RGBA_8888, /* 32 bits per pixel */
  2195.  
  2196.     /*
  2197.      * YUV
  2198.      */
  2199.     BR_PMT_YUYV_8888, /* YU YV YU YV ... */
  2200.     BR_PMT_YUV_888,
  2201.  
  2202.     /*
  2203.      * Depth
  2204.      */
  2205.     BR_PMT_DEPTH_16,
  2206.     BR_PMT_DEPTH_32,
  2207.  
  2208.     /*
  2209.      * Opacity
  2210.      */
  2211.     BR_PMT_ALPHA_8,
  2212.  
  2213.     /*
  2214.      * Opacity + Index
  2215.      */
  2216.     BR_PMT_INDEXA_88
  2217. };
  2218.  
  2219. /*
  2220.  * Bits for br_material->flags
  2221.  */
  2222. enum {
  2223.     BR_MATF_LIGHT = 0x00000001,
  2224.     BR_MATF_PRELIT = 0x00000002,
  2225.     BR_MATF_SMOOTH = 0x00000004,
  2226.     BR_MATF_ENVIRONMENT_I = 0x00000008,
  2227.     BR_MATF_ENVIRONMENT_L = 0x00000010,
  2228.     BR_MATF_PERSPECTIVE = 0x00000020,
  2229.     BR_MATF_DECAL = 0x00000040,
  2230.     BR_MATF_I_FROM_U = 0x00000080,
  2231.     BR_MATF_I_FROM_V = 0x00000100,
  2232.     BR_MATF_U_FROM_I = 0x00000200,
  2233.     BR_MATF_V_FROM_I = 0x00000400,
  2234.     BR_MATF_ALWAYS_VISIBLE = 0x00000800,
  2235.     BR_MATF_TWO_SIDED = 0x00001000,
  2236.     BR_MATF_FORCE_Z_0 = 0x00002000,
  2237.     BR_MATF_DITHER = 0x00004000,
  2238.     BR_MATF_CUSTOM = 0x00008000
  2239. };
  2240.  
  2241. /*
  2242.  * Flags to BrModelUpdate()
  2243.  */
  2244. enum {
  2245.     BR_MODU_VERTEX_POSITIONS = 0x0001,
  2246.     BR_MODU_VERTEX_COLOURS = 0x0002,
  2247.     BR_MODU_VERTEX_MAPPING = 0x0004,
  2248.     BR_MODU_VERTEX_NORMALS = 0x0008,
  2249.     BR_MODU_PRIMITIVE_MATERIALS = 0x0010,
  2250.     BR_MODU_PRIMITIVE_COLOURS = 0x0020,
  2251.     BR_MODU_VERTICES = 0x0040,
  2252.     BR_MODU_FACES = 0x0080,
  2253.     BR_MODU_PIVOT = 0x0100,
  2254.     BR_MODU_PREPARED = 0x0200,
  2255.     BR_MODU_PRIMITIVE_EQUATIONS = 0x0400,
  2256.     BR_MODU_ALL = 0x7FFF,
  2257.  
  2258.     _BR_MODU_RESERVED = 0x8000
  2259. };
  2260.  
  2261. /*
  2262.  * Flags to BrMaterialUpdate()
  2263.  */
  2264. enum {
  2265.     BR_MATU_MAP_TRANSFORM = 0x0001,
  2266.     BR_MATU_RENDERING = 0x0002,
  2267.     BR_MATU_LIGHTING = 0x0004,
  2268.     BR_MATU_COLOURMAP = 0x0008,
  2269.     BR_MATU_ALL = 0x7fff
  2270. };
  2271.  
  2272. /*
  2273.  * Flags to BrMapUpdate()
  2274.  */
  2275. enum {
  2276.     BR_MAPU_ALL = 0x7fff
  2277. };
  2278.  
  2279. /*
  2280.  * Flags to BrTableUpdate()
  2281.  */
  2282. enum {
  2283.     BR_TABU_ALL = 0x7fff
  2284. };
  2285.  
  2286. /*
  2287.  * Bits for br_model->flags
  2288.  */
  2289. enum {
  2290.     BR_MODF_DONT_WELD = 0x0001,          /* Vertices with same x,y,z cannot be merged   */
  2291.     BR_MODF_KEEP_ORIGINAL = 0x0002,      /* Don't release model->faces/vertices during ModelUpdate() */
  2292.     BR_MODF_GENERATE_TAGS = 0x0004,      /* Allocate and fill in the face and vertex tag structures */
  2293.     BR_MODF_QUICK_UPDATE = 0x0010,       /* ModelUpdate is fast - but may produce slower models */
  2294.     BR_MODF_CUSTOM = 0x0020,             /* Invoke custom callback for this model */
  2295.     BR_MODF_PREPREPARED = 0x0040,        /* Model structure is pre-prepared - update performs no work */
  2296.     BR_MODF_UPDATEABLE = 0x0080,         /* Added by Jeff from Errols code */
  2297.     BR_MODF_CREASE = 0x0100,             /* Create creases in smoothing along edges if face<->face angle is g.t model->crease */
  2298.     BR_MODF_CUSTOM_NORMALS = 0x0200,     /* Uses vertex normals from br_vertex structure */
  2299.     BR_MODF_CUSTOM_BOUNDS = 0x0400,      /* Bounding box is already set up                              */
  2300.     BR_MODF_FACES_ONLY = 0x0800,         /* Model will only be used to render faces (not edges or points) */
  2301.     BR_MODF_USED_PREPARED_USER = 0x1000, /* User fields in prepared data used */
  2302.     BR_MODF_CUSTOM_EQUATIONS = 0x2000,   /* Uses face equations from br_face structure */
  2303.     _BR_MODF_RESERVED = 0x8000,
  2304.  
  2305.     // Added by dethrace to force the vertex data to be reuploaded to GPU
  2306.     BR_MODF_DETHRACE_FORCE_BUFFER_UPDATE = 0x4000
  2307.  
  2308. };
  2309.  
  2310. enum {
  2311.     BR_STATE_SURFACE = 0x00000001,
  2312.     BR_STATE_MATRIX = 0x00000002,
  2313.     BR_STATE_ENABLE = 0x00000004,
  2314.     BR_STATE_LIGHT = 0x00000008,
  2315.     BR_STATE_CLIP = 0x00000010,
  2316.     BR_STATE_BOUNDS = 0x00000020,
  2317.     BR_STATE_CULL = 0x00000040,
  2318.     BR_STATE_STATS = 0x00000080,
  2319.  
  2320.     BR_STATE_CACHE = 0x00000100,
  2321.  
  2322.     BR_STATE_OUTPUT = 0x40000000,
  2323.     BR_STATE_PRIMITIVE = 0x80000000,
  2324.  
  2325.     BR_STATE_ALL = 0xFFFFFFFF
  2326. };
  2327.  
  2328. #endif /* BR_TYPES_H */
  2329.