aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Windows64/Iggy/include
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Windows64/Iggy/include
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Windows64/Iggy/include')
-rw-r--r--Minecraft.Client/Windows64/Iggy/include/gdraw.h726
-rw-r--r--Minecraft.Client/Windows64/Iggy/include/iggy.h1295
-rw-r--r--Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h49
-rw-r--r--Minecraft.Client/Windows64/Iggy/include/iggyperfmon.h89
-rw-r--r--Minecraft.Client/Windows64/Iggy/include/rrCore.h2322
5 files changed, 4481 insertions, 0 deletions
diff --git a/Minecraft.Client/Windows64/Iggy/include/gdraw.h b/Minecraft.Client/Windows64/Iggy/include/gdraw.h
new file mode 100644
index 00000000..404a2642
--- /dev/null
+++ b/Minecraft.Client/Windows64/Iggy/include/gdraw.h
@@ -0,0 +1,726 @@
+// gdraw.h - author: Sean Barrett - copyright 2009 RAD Game Tools
+//
+// This is the graphics rendering abstraction that Iggy is implemented
+// on top of.
+
+#ifndef __RAD_INCLUDE_GDRAW_H__
+#define __RAD_INCLUDE_GDRAW_H__
+
+#include "rrcore.h"
+
+#define IDOC
+
+RADDEFSTART
+
+//idoc(parent,GDrawAPI_Buffers)
+
+#ifndef IGGY_GDRAW_SHARED_TYPEDEF
+
+ #define IGGY_GDRAW_SHARED_TYPEDEF
+ typedef struct GDrawFunctions GDrawFunctions;
+
+ typedef struct GDrawTexture GDrawTexture;
+
+#endif//IGGY_GDRAW_SHARED_TYPEDEF
+
+
+
+IDOC typedef struct GDrawVertexBuffer GDrawVertexBuffer;
+/* An opaque handle to an internal GDraw vertex buffer. */
+
+//idoc(parent,GDrawAPI_Base)
+
+IDOC typedef struct gswf_recti
+{
+ S32 x0,y0; // Minimum corner of the rectangle
+ S32 x1,y1; // Maximum corner of the rectangle
+} gswf_recti;
+/* A 2D rectangle with integer coordinates specifying its minimum and maximum corners. */
+
+IDOC typedef struct gswf_rectf
+{
+ F32 x0,y0; // Minimum corner of the rectangle
+ F32 x1,y1; // Maximum corner of the rectangle
+} gswf_rectf;
+/* A 2D rectangle with floating-point coordinates specifying its minimum and maximum corners. */
+
+IDOC typedef struct gswf_matrix
+{
+ union {
+ F32 m[2][2]; // 2x2 transform matrix
+ struct {
+ F32 m00; // Alternate name for m[0][0], for coding convenience
+ F32 m01; // Alternate name for m[0][1], for coding convenience
+ F32 m10; // Alternate name for m[1][0], for coding convenience
+ F32 m11; // Alternate name for m[1][1], for coding convenience
+ };
+ };
+ F32 trans[2]; // 2D translation vector (the affine component of the matrix)
+} gswf_matrix;
+/* A 2D transform matrix plus a translation offset. */
+
+#define GDRAW_STATS_batches 1
+#define GDRAW_STATS_blits 2
+#define GDRAW_STATS_alloc_tex 4
+#define GDRAW_STATS_frees 8
+#define GDRAW_STATS_defrag 16
+#define GDRAW_STATS_rendtarg 32
+#define GDRAW_STATS_clears 64
+IDOC typedef struct GDrawStats
+{
+ S16 nonzero_flags; // which of the fields below are non-zero
+
+ U16 num_batches; // number of batches, e.g. DrawPrim, DrawPrimUP
+ U16 num_blits; // number of blit operations (resolve, msaa resolve, blend readback)
+ U16 freed_objects; // number of cached objects freed
+ U16 defrag_objects; // number of cached objects defragmented
+ U16 alloc_tex; // number of textures/buffers allocated
+ U16 rendertarget_changes; // number of rendertarget changes
+ U16 num_clears;
+ //0 mod 8
+
+ U32 drawn_indices; // number of indices drawn (3 times number of triangles)
+ U32 drawn_vertices; // number of unique vertices referenced
+ U32 num_blit_pixels;// number of pixels in blit operations
+ U32 alloc_tex_bytes;// number of bytes in textures/buffers allocated
+ U32 freed_bytes; // number of bytes in freed cached objects
+ U32 defrag_bytes; // number of bytes in defragmented cached objects
+ U32 cleared_pixels; // number of pixels cleared by clear operation
+ U32 reserved;
+ //0 mod 8
+} GDrawStats;
+/* A structure with statistics information to show in resource browser/Telemetry */
+
+////////////////////////////////////////////////////////////
+//
+// Queries
+//
+//idoc(parent,GDrawAPI_Queries)
+
+IDOC typedef enum gdraw_bformat
+{
+ GDRAW_BFORMAT_vbib, // Platform uses vertex and index buffers
+ GDRAW_BFORMAT_wii_dlist, // Platform uses Wii-style display lists
+ GDRAW_BFORMAT_vbib_single_format, // Platform uses vertex and index buffers, but doesn't support multiple vertex formats in a single VB
+
+ GDRAW_BFORMAT__count,
+} gdraw_bformat;
+/* Specifies what data format GDraw expects in MakeVertexBuffer_* and DrawIndexedTriangles.
+
+ Most supported platforms prefer Vertex and Index buffers so that's what we use,
+ but this format turns out to be somewhat awkward for Wii, so we use the native
+ graphics processor display list format on that platform. */
+
+IDOC typedef struct GDrawInfo
+{
+ S32 num_stencil_bits; // number of (possibly emulated) stencil buffer bits
+ U32 max_id; // number of unique values that can be easily encoded in zbuffer
+ U32 max_texture_size; // edge length of largest square texture supported by hardware
+ U32 buffer_format; // one of $gdraw_bformat
+ rrbool shared_depth_stencil; // does 0'th framebuffer share depth & stencil with others? (on GL it can't?)
+ rrbool always_mipmap; // if GDraw can generate mipmaps nearly for free, then set this flag
+ rrbool conditional_nonpow2; // non-pow2 textures supported, but only using clamp and without mipmaps
+ rrbool has_rendertargets; // if true, then there is no rendertarget stack support
+ rrbool no_nonpow2; // non-pow2 textures aren't supported at all
+} GDrawInfo; // must be a multiple of 8
+/* $GDrawInfo contains the information that Iggy needs to know about
+ what a GDraw implementation supports and what limits it places on
+ certain important values. */
+
+IDOC typedef void RADLINK gdraw_get_info(GDrawInfo *d);
+/* Iggy queries this at the beginning of rendering to get information
+ about the viewport and the device capabilities. */
+
+////////////////////////////////////////////////////////////
+//
+// Drawing State
+//
+//idoc(parent,GDrawAPI_DrawingState)
+
+IDOC typedef enum gdraw_blend
+{
+ GDRAW_BLEND_none, // Directly copy
+ GDRAW_BLEND_alpha, // Use the source alpha channel to modulate its contribution
+ GDRAW_BLEND_multiply, // Multiply colors componentwise
+ GDRAW_BLEND_add, // Add the source and destination together
+
+ GDRAW_BLEND_filter, // Uses a secondary $gdraw_filter specification to determine how to blend
+ GDRAW_BLEND_special, // Uses a secondary $gdraw_blendspecial specification to determine how to blend
+
+ GDRAW_BLEND__count,
+} gdraw_blend;
+/* Identifier indicating the type of blending operation to use when rendering.*/
+
+IDOC typedef enum gdraw_blendspecial
+{
+ GDRAW_BLENDSPECIAL_layer, // s
+ GDRAW_BLENDSPECIAL_multiply, // s*d
+ GDRAW_BLENDSPECIAL_screen, // sa*da - (da-d)*(sa-s)
+ GDRAW_BLENDSPECIAL_lighten, // max(sa*d,s*da)
+ GDRAW_BLENDSPECIAL_darken, // min(sa*d,s*da)
+ GDRAW_BLENDSPECIAL_add, // min(d+s,1.0)
+ GDRAW_BLENDSPECIAL_subtract, // max(d-s,0.0)
+ GDRAW_BLENDSPECIAL_difference, // abs(sa*d-s*da)
+ GDRAW_BLENDSPECIAL_invert, // sa*(da-d)
+ GDRAW_BLENDSPECIAL_overlay, // d < da/2.0 ? (2.0*s*d) : (sa*da - 2.0*(da-d)*(sa-s))
+ GDRAW_BLENDSPECIAL_hardlight, // s < sa/2.0 ? (2.0*s*d) : (sa*da - 2.0*(da-d)*(sa-s))
+
+ // these do extra-special math on the output alpha
+ GDRAW_BLENDSPECIAL_erase, // d*(1.0-sa)
+ GDRAW_BLENDSPECIAL_alpha_special, // d*sa
+
+ GDRAW_BLENDSPECIAL__count,
+} gdraw_blendspecial;
+/* Specifies a type of "special" blend mode, which is defined as one
+ that has to read from the framebuffer to compute its effect.
+
+ These modes are only used with a 1-to-1 textured quad containing
+ the exact output data in premultiplied alpha. They all need to
+ read from the framebuffer to compute their effect, so a GDraw
+ implementation will usually need a custom path to handle that.
+ Users will not warn in advance whether you're going to need this
+ operation, so implementations either need to always render to a
+ texture in case it happens, or copy the framebuffer to a texture
+ when it does.
+
+ Note that $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_erase) and
+ $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_alpha_special) are unique
+ among $gdraw_blendspecial modes in that they may not actually need
+ to be implemented with the destination input as a texture if
+ the destination buffer doesn't have an alpha channel. */
+
+// (@OPTIMIZE: the last filter in each chain could be combined with
+// the final blend, although only worth doing if the final blend is
+// ALPHA/ADD/MULTIPLY--it's usually ALPHA though so worth doing!)
+IDOC typedef enum gdraw_filter
+{
+ GDRAW_FILTER_blur, // Blurs the source image
+ GDRAW_FILTER_colormatrix, // Transform RGB pixel values by a matrix
+ GDRAW_FILTER_bevel, // Bevels the source image
+ GDRAW_FILTER_dropshadow, // Adds a dropshadow underneath the source image
+
+ GDRAW_FILTER__count,
+} gdraw_filter;
+/* Specifies a type of post-processing graphics filter.
+
+ These modes are only used to implement filter effects, and will
+ always be blending from a temporary buffer to another temporary
+ buffer with no blending, so in general they should not require
+ any additional input.
+*/
+
+IDOC typedef enum gdraw_texture
+{
+ GDRAW_TEXTURE_none, // No texture applied
+ GDRAW_TEXTURE_normal, // Texture is bitmap or linear gradient
+ GDRAW_TEXTURE_alpha, // Texture is an alpha-only font bitmap
+ GDRAW_TEXTURE_radial, // Texture is a radial gradient
+ GDRAW_TEXTURE_focal_gradient, // Texture is a "focal" radial gradient
+ GDRAW_TEXTURE_alpha_test, // Texture is an alpha-only font bitmap, alpha test for alpha >= 0.5
+
+ GDRAW_TEXTURE__count,
+} gdraw_texture;
+/* Specifies how to apply a texture while rendering. */
+
+IDOC typedef enum gdraw_wrap
+{
+ GDRAW_WRAP_clamp, // Texture coordinates clamped to edges
+ GDRAW_WRAP_repeat, // Texture repeats periodically
+ GDRAW_WRAP_mirror, // Repeat periodically, mirror on odd repetititions
+ GDRAW_WRAP_clamp_to_border, // only used internally by some GDraws
+
+ GDRAW_WRAP__count,
+} gdraw_wrap;
+/* Specifies what to do with texture coordinates outside [0,1]. */
+
+typedef struct GDrawRenderState
+{
+ S32 id; // Object "identifier" used for high-quality AA mode
+ U32 test_id:1; // Whether to test zbuffer == id
+ U32 set_id:1; // Whether to set zbuffer == id
+ U32 use_world_space:1; // Whether primitive is defined in object space or world space
+ U32 scissor:1; // Whether rendering will be clipped to $(GDrawRenderState::scissor_rect)
+ U32 identical_state:1; // Whether state is identical to the one used for the previous draw call
+ U32 unused:27;
+ //aligned 0 mod 8
+
+ U8 texgen0_enabled; // Whether to use texgen for tex0
+ U8 tex0_mode; // One of $gdraw_texture
+ U8 wrap0; // One of $gdraw_wrap
+ U8 nearest0; // Whether to sample texture 0 nearest neighbor
+
+ U8 blend_mode; // One of $gdraw_blend
+ U8 special_blend; // One of $gdraw_blendspecial (used only if $(GDrawRenderState::blend_mode) == $(gdraw_blend::GDRAW_BLEND_special)
+ U8 filter; // One of $gdraw_filter (used only if $(GDrawRenderState::blend_mode) == $(gdraw_blend::GDRAW_BLEND_filter)
+ U8 filter_mode; // Used to select the right compositing operation for the $(gdraw_filter::GDRAW_FILTER_bevel) and $(gdraw_filter::GDRAW_FILTER_dropshadow) modes
+ //aligned 0 mod 8
+ U8 stencil_test; // Only draw if these stencil bits are "set"
+ U8 stencil_set; // "Set" these stencil bits (note that actual implementation initializes stencil to 1, and "set" makes them 0)
+
+ U8 reserved[2]; // Currently unused (used to make padding to 4/8-byte boundary for following pointer explicit)
+ S32 blur_passes; // For filters that include blurring, this is the number of box filter passes to run
+ //align 0 mod 8
+
+ S16 *cxf_add; // Color transform addition (discourage additive alpha!)
+
+ GDrawTexture *tex[3]; // One or more textures to apply -- need 3 for gradient dropshadow.
+ //0 mod 8
+ F32 *edge_matrix; // Screen to object space matrix (for edge antialiasing)
+ gswf_matrix *o2w; // Object-to-world matrix
+
+ // --- Everything below this point must be manually initialized
+
+ //0 mod 8
+ F32 color[4]; // Color of the object
+
+ //0 mod 8
+ gswf_recti scissor_rect; // The rectangle to which rendering will be clipped if $(GDrawRenderState::scissor) is set
+ //0 mod 8
+ // --- Everything below this point might be uninitialized if it's not used for this particular render state
+
+ F32 s0_texgen[4]; // "s" (x) row of texgen matrix
+ F32 t0_texgen[4]; // "t" (y) row of texgen matrix
+ //0 mod 8
+ F32 focal_point[4]; // Data used for $(gdraw_texgen_mode::GDRAW_TEXTURE_focal_gradient)
+ //0 mod 8
+ F32 blur_x,blur_y; // The size of the box filter, where '1' is the identity and 2 adds half a pixel on each side
+ //0 mod 8
+ F32 shader_data[20]; // Various data that depends on filter (e.g. drop shadow direction, color)
+} GDrawRenderState;
+/* Encapsulation of the entire drawing state that affects a rendering command. */
+
+IDOC typedef void RADLINK gdraw_set_view_size_and_world_scale(S32 w, S32 h, F32 x_world_to_pixel, F32 y_world_to_pixel);
+/* Sets the size of the rendering viewport and the world to pixel scaling.
+
+ Iggy calls this function with the full size that the viewport would
+ be if it were rendered untiled, even if it will eventually be
+ rendered as a collection of smaller tiles.
+
+ The world scale is used to compensate non-square pixel aspect ratios
+ when rendering wide lines. Both scale factors are 1 unless Iggy is
+ running on a display with non-square pixels. */
+
+typedef void RADLINK gdraw_set_3d_transform(F32 *mat); /* mat[3][4] */
+
+IDOC typedef void RADLINK gdraw_render_tile_begin(S32 tx0, S32 ty0, S32 tx1, S32 ty1, S32 pad, GDrawStats *stats);
+/* Begins rendering of a sub-region of the rendered image. */
+
+IDOC typedef void RADLINK gdraw_render_tile_end(GDrawStats *stats);
+/* Ends rendering of a sub-region of the rendered image. */
+
+IDOC typedef void RADLINK gdraw_rendering_begin(void);
+/* Begins rendering; takes control of the graphics API. */
+
+IDOC typedef void RADLINK gdraw_rendering_end(void);
+/* Ends rendering; gives up control of the graphics API. */
+
+
+////////////////////////////////////////////////////////////
+//
+// Drawing
+//
+//idoc(parent,GDrawAPI_Drawing)
+
+IDOC typedef void RADLINK gdraw_clear_stencil_bits(U32 bits);
+/* Clears the 'bits' parts of the stencil value in the entire framebuffer to the default value. */
+
+IDOC typedef void RADLINK gdraw_clear_id(void);
+/* Clears the 'id' buffer, which is typically the z-buffer but can also be the stencil buffer. */
+
+IDOC typedef void RADLINK gdraw_filter_quad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1, S32 y1, GDrawStats *stats);
+/* Draws a special quad in viewport-relative pixel space.
+
+ May be normal, may be displaced by filters, etc. and require multiple passes,
+ may apply special blending (and require extra resolves/rendertargets)
+ for filter/blend.,
+
+ The x0,y0,x1,y1 always describes the "input" box. */
+
+IDOC typedef struct GDrawPrimitive
+{
+ F32 *vertices; // Pointer to an array of $gswf_vertex_xy, $gswf_vertex_xyst, or $gswf_vertex_xyoffs
+ U16 *indices; // Pointer to an array of 16-bit indices into $(GDrawPrimitive::vertices)
+
+ S32 num_vertices; // Count of elements in $(GDrawPrimitive::vertices)
+ S32 num_indices; // Count of elements in $(GDrawPrimitive::indices)
+
+ S32 vertex_format; // One of $gdraw_vformat, specifying the type of element in $(GDrawPrimitive::vertices)
+
+ U32 uniform_count;
+ F32 *uniforms;
+
+ U8 drawprim_mode;
+} GDrawPrimitive;
+/* Specifies the vertex and index data necessary to draw a batch of graphics primitives. */
+
+IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats);
+/* Draws a collection of indexed triangles, ignoring special filters or blend modes.
+
+ If buf is NULL, then the pointers in 'prim' are machine pointers, and
+ you need to make a copy of the data (note currently all triangles
+ implementing strokes (wide lines) go this path).
+
+ If buf is non-NULL, then use the appropriate vertex buffer, and the
+ pointers in prim are actually offsets from the beginning of the
+ vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL;
+ (note there are separate spaces for vertices and indices; e.g. the
+ first mesh in a given vertex buffer will normally have a 0 offset
+ for the vertices and a 0 offset for the indices)
+*/
+
+IDOC typedef void RADLINK gdraw_set_antialias_texture(S32 width, U8 *rgba);
+/* Specifies the 1D texture data to be used for the antialiasing gradients.
+
+ 'rgba' specifies the pixel values in rgba byte order. This will only be called
+ once during initialization. */
+
+////////////////////////////////////////////////////////////
+//
+// Texture and Vertex Buffers
+//
+//idoc(parent,GDrawAPI_Buffers)
+
+IDOC typedef enum gdraw_texture_format
+{
+ // Platform-independent formats
+ GDRAW_TEXTURE_FORMAT_rgba32, // 32bpp RGBA data in platform-preferred byte order (returned by $gdraw_make_texture_begin as $gdraw_texture_type)
+ GDRAW_TEXTURE_FORMAT_font, // Alpha-only data with at least 4 bits/pixel. Data is submitted as 8 bits/pixel, conversion (if necessary) done by GDraw.
+
+ // First platform-specific format index (for reference)
+ GDRAW_TEXTURE_FORMAT__platform = 16,
+
+ // In the future, we will support platform-specific formats and add them to this list.
+} gdraw_texture_format;
+/* Describes the format of a texture submitted to GDraw. */
+
+IDOC typedef enum gdraw_texture_type
+{
+ GDRAW_TEXTURE_TYPE_rgba, // Raw 4-channel packed texels, in OpenGL-standard order
+ GDRAW_TEXTURE_TYPE_bgra, // Raw 4-channel packed texels, in Direct3D-standard order
+ GDRAW_TEXTURE_TYPE_argb, // Raw 4-channel packed texels, in Flash native order
+
+ GDRAW_TEXTURE_TYPE__count,
+} gdraw_texture_type;
+/* Describes the channel layout of a RGBA texture submitted to GDraw. */
+
+IDOC typedef struct GDraw_MakeTexture_ProcessingInfo
+{
+ U8 *texture_data; // Pointer to the texture image bits
+ S32 num_rows; // Number of rows to upload in the current chunk
+ S32 stride_in_bytes; // Distance between a given pixel and the first pixel in the next row
+ S32 texture_type; // One of $gdraw_texture_type
+
+ U32 temp_buffer_bytes; // Size of temp buffer in bytes
+ U8 *temp_buffer; // Temp buffer for GDraw to work in (used during mipmap creation)
+
+ void *p0,*p1,*p2,*p3,*p4,*p5,*p6,*p7; // Pointers for GDraw to store data across "passes" (never touched by Iggy)
+ U32 i0, i1, i2, i3, i4, i5, i6, i7; // Integers for GDraw to store data across "passes" (never touched by Iggy)
+} GDraw_MakeTexture_ProcessingInfo;
+/* $GDraw_MakeTexture_ProcessingInfo is used when building a texture. */
+
+IDOC typedef struct GDraw_Texture_Description {
+ S32 width; // Width of the texture in pixels
+ S32 height; // Height of the texture in pixels
+ U32 size_in_bytes; // Size of the texture in bytes
+} GDraw_Texture_Description;
+/* $GDraw_Texture_Description contains information about a texture. */
+
+IDOC typedef U32 gdraw_maketexture_flags;
+#define GDRAW_MAKETEXTURE_FLAGS_mipmap 1 IDOC // Generates mip-maps for the texture
+#define GDRAW_MAKETEXTURE_FLAGS_updatable 2 IDOC // Set if the texture might be updated subsequent to its initial submission
+#define GDRAW_MAKETEXTURE_FLAGS_never_flush 4 IDOC // Set to request that the texture never be flushed from the GDraw cache
+
+/* Flags that control the submission and management of GDraw textures. */
+
+IDOC typedef void RADLINK gdraw_set_texture_unique_id(GDrawTexture *tex, void *old_unique_id, void *new_unique_id);
+/* Changes unique id of a texture, only used for TextureSubstitution */
+
+IDOC typedef rrbool RADLINK gdraw_make_texture_begin(void *unique_id,
+ S32 width, S32 height, gdraw_texture_format format, gdraw_maketexture_flags flags,
+ GDraw_MakeTexture_ProcessingInfo *output_info, GDrawStats *stats);
+/* Begins specifying a new texture.
+
+ $:unique_id Unique value specified by Iggy that you can use to identify a reference to the same texture even if its handle has been discarded
+ $:return Error code if there was a problem, IGGY_RESULT_OK otherwise
+*/
+
+IDOC typedef rrbool RADLINK gdraw_make_texture_more(GDraw_MakeTexture_ProcessingInfo *info);
+/* Continues specifying a new texture.
+
+ $:info The same handle initially passed to $gdraw_make_texture_begin
+ $:return True if specification can continue, false if specification must be aborted
+*/
+
+IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_ProcessingInfo *info, GDrawStats *stats);
+/* Ends specification of a new texture.
+
+ $:info The same handle initially passed to $gdraw_make_texture_begin
+ $:return Handle for the newly created texture, or NULL if an error occured
+*/
+
+IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats);
+/* Begins updating a previously submitted texture.
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_texture_begin
+ $:return True on success, false otherwise and the texture must be recreated
+*/
+
+IDOC typedef void RADLINK gdraw_update_texture_rect(GDrawTexture *tex, void *unique_id, S32 x, S32 y, S32 stride, S32 w, S32 h, U8 *data, gdraw_texture_format format);
+/* Updates a rectangle in a previously submitted texture.
+
+ $:format Must be the $gdraw_texture_format that was originally passed to $gdraw_make_texture_begin for this texture.
+*/
+
+IDOC typedef void RADLINK gdraw_update_texture_end(GDrawTexture *tex, void *unique_id, GDrawStats *stats);
+/* Ends an update to a previously submitted texture.
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_texture_begin (and hence $gdraw_update_texture_begin)
+*/
+
+IDOC typedef void RADLINK gdraw_describe_texture(GDrawTexture *tex, GDraw_Texture_Description *desc);
+/* Returns a texture description for a given GDraw texture. */
+
+IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_from_resource(U8 *resource_file, S32 file_len, void *texture);
+/* Loads a texture from a resource file and returns a wrapped pointer. */
+
+IDOC typedef void RADLINK gdraw_free_texture_from_resource(GDrawTexture *tex);
+/* Frees a texture created with gdraw_make_texture_from_resource. */
+
+
+IDOC typedef struct gswf_vertex_xy
+{
+ F32 x,y; // Position of the vertex
+} gswf_vertex_xy;
+/* A 2D point with floating-point position. */
+
+IDOC typedef struct gswf_vertex_xyoffs
+{
+ F32 x,y; // Position of the vertex
+
+ S16 aa; // Stroke/aa texcoord
+ S16 dx, dy; // Vector offset from the position, used for anti-aliasing (signed 11.5 fixed point)
+ S16 unused;
+} gswf_vertex_xyoffs;
+/* A 2D point with floating-point position, additional integer parameter, and integer anti-aliasing offset vector. */
+
+IDOC typedef struct gswf_vertex_xyst
+{
+ F32 x,y; // Position of the vertex
+ F32 s,t; // Explicit texture coordinates for rectangles
+} gswf_vertex_xyst;
+/* A 2D point with floating-point position and texture coordinates. */
+
+typedef int gdraw_verify_size_xy [sizeof(gswf_vertex_xy ) == 8 ? 1 : -1];
+typedef int gdraw_verify_size_xyoffs[sizeof(gswf_vertex_xyoffs) == 16 ? 1 : -1];
+typedef int gdraw_verify_size_xyst [sizeof(gswf_vertex_xyst ) == 16 ? 1 : -1];
+
+IDOC typedef enum gdraw_vformat
+{
+ GDRAW_vformat_v2, // Indicates vertices of type $gswf_vertex_xy (8 bytes per vertex)
+ GDRAW_vformat_v2aa, // Indicates vertices of type $gswf_vertex_xyoffs (16 bytes per vertex)
+ GDRAW_vformat_v2tc2, // Indicates vertices of type $gswf_vertex_xyst (16 bytes per vertex)
+
+ GDRAW_vformat__basic_count,
+ GDRAW_vformat_ihud1 = GDRAW_vformat__basic_count, // primary format for ihud, currently v2tc2mat4 (20 bytes per vertex)
+
+ GDRAW_vformat__count,
+ GDRAW_vformat_mixed, // Special value that denotes a VB containing data in multiple vertex formats. Never used when drawing!
+} gdraw_vformat;
+/* Identifies one of the vertex data types. */
+
+IDOC typedef struct GDraw_MakeVertexBuffer_ProcessingInfo
+{
+ U8 *vertex_data; // location to write vertex data
+ U8 *index_data; // location to write index data
+
+ S32 vertex_data_length; // size of buffer to write vertex data
+ S32 index_data_length; // size of buffer to write index data
+
+ void *p0,*p1,*p2,*p3,*p4,*p5,*p6,*p7; // Pointers for GDraw to store data across "passes" (never touched by Iggy)
+ U32 i0, i1, i2, i3, i4, i5, i6, i7; // Integers for GDraw to store data across "passes" (never touched by Iggy)
+} GDraw_MakeVertexBuffer_ProcessingInfo;
+/* $GDraw_MakeVertexBuffer_ProcessingInfo is used when building a vertex buffer. */
+
+IDOC typedef struct GDraw_VertexBuffer_Description {
+ S32 size_in_bytes; // Size of the vertex buffer in bytes
+} GDraw_VertexBuffer_Description;
+/* $GDraw_VertexBuffer_Description contains information about a vertex buffer. */
+
+IDOC typedef rrbool RADLINK gdraw_make_vertex_buffer_begin(void *unique_id, gdraw_vformat vformat, S32 vdata_len_in_bytes, S32 idata_len_in_bytes, GDraw_MakeVertexBuffer_ProcessingInfo *info, GDrawStats *stats);
+/* Begins specifying a new vertex buffer.
+
+ $:unique_id Unique value that identifies this texture, across potentially multiple flushes and re-creations of its $GDrawTexture handle in GDraw
+ $:vformat One of $gdraw_vformat, denoting the format of the vertex data submitted
+ $:return false if there was a problem, true if ok
+*/
+
+IDOC typedef rrbool RADLINK gdraw_make_vertex_buffer_more(GDraw_MakeVertexBuffer_ProcessingInfo *info);
+/* Continues specifying a new vertex buffer.
+
+ $:info The same handle initially passed to $gdraw_make_vertex_buffer_begin
+ $:return True if specification can continue, false if specification must be aborted
+*/
+
+IDOC typedef GDrawVertexBuffer * RADLINK gdraw_make_vertex_buffer_end(GDraw_MakeVertexBuffer_ProcessingInfo *info, GDrawStats *stats);
+/* Ends specification of a new vertex buffer.
+
+ $:info The same handle initially passed to $gdraw_make_texture_begin
+ $:return Handle for the newly created vertex buffer
+*/
+
+IDOC typedef void RADLINK gdraw_describe_vertex_buffer(GDrawVertexBuffer *buffer, GDraw_VertexBuffer_Description *desc);
+/* Returns a description for a given GDrawVertexBuffer */
+
+
+IDOC typedef rrbool RADLINK gdraw_try_to_lock_texture(GDrawTexture *tex, void *unique_id, GDrawStats *stats);
+/* Tells GDraw that a $GDrawTexture is going to be referenced.
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_texture_begin
+*/
+
+IDOC typedef rrbool RADLINK gdraw_try_to_lock_vertex_buffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats);
+/* Tells GDraw that a $GDrawVertexBuffer is going to be referenced.
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_vertex_buffer_begin
+*/
+
+IDOC typedef void RADLINK gdraw_unlock_handles(GDrawStats *stats);
+/* Indicates that the user of GDraw will not try to reference anything without locking it again.
+
+ Note that although a call to $gdraw_unlock_handles indicates that
+ all $GDrawTexture and $GDrawVertexBuffer handles that have had a
+ "unique_id" specified will no longer be referenced by the user of
+ GDraw, it does not affect those $GDrawTexture handles that were
+ created by $gdraw_start_texture_draw_buffer with a unique_id of 0.
+*/
+
+IDOC typedef void RADLINK gdraw_free_vertex_buffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats);
+/* Free a vertex buffer and invalidate the handle
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_vertex_buffer_begin
+*/
+
+IDOC typedef void RADLINK gdraw_free_texture(GDrawTexture *t, void *unique_id, GDrawStats *stats);
+/* Free a texture and invalidate the handle.
+
+ $:unique_id Must be the same value initially passed to $gdraw_make_texture_begin, or 0 for a texture created by $gdraw_end_texture_draw_buffer
+*/
+
+////////////////////////////////////////////////////////////
+//
+// Render targets
+//
+//idoc(parent,GDrawAPI_Targets)
+
+IDOC typedef U32 gdraw_texturedrawbuffer_flags;
+#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color 1 IDOC // Tells GDraw that you will need the color channel when rendering a texture
+#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha 2 IDOC // Tells GDraw that you will need the alpha channel when rendering a texture
+#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil 4 IDOC // Tells GDraw that you will need the stencil channel when rendering a texture
+#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id 8 IDOC // Tells GDraw that you will need the id channel when rendering a texture
+
+/* Flags that control rendering to a texture. */
+
+IDOC typedef rrbool RADLINK gdraw_texture_draw_buffer_begin(gswf_recti *region, gdraw_texture_format format, gdraw_texturedrawbuffer_flags flags, void *unique_id, GDrawStats *stats);
+/* Starts rendering all GDraw commands to a new texture.
+
+ Creates a rendertarget with destination alpha, initializes to all 0s and prepares to render into it
+*/
+
+
+IDOC typedef GDrawTexture * RADLINK gdraw_texture_draw_buffer_end(GDrawStats *stats);
+/* Ends rendering GDraw commands to a texture, and returns the texture created.
+
+ You can get the size of the resulting texture with $gdraw_query_texture_size.
+*/
+
+////////////////////////////////////////////////////////////
+//
+// Masking
+//
+//idoc(parent,GDrawAPI_Masking)
+
+IDOC typedef void RADLINK gdraw_draw_mask_begin(gswf_recti *region, S32 mask_bit, GDrawStats *stats);
+/* Start a masking operation on the given region for the specified mask bit.
+
+ For most drivers, no special preparation is necessary to start masking, so this is a no-op.
+*/
+
+IDOC typedef void RADLINK gdraw_draw_mask_end(gswf_recti *region, S32 mask_bit, GDrawStats *stats);
+/* End a masking operation on the given region for the specified mask bit.
+
+ For most drivers, no special preparation is necessary to end masking, so this is a no-op.
+*/
+
+////////////////////////////////////////////////////////////
+//
+// GDraw API Function table
+//
+//idoc(parent,GDrawAPI_Base)
+
+IDOC struct GDrawFunctions
+{
+ // queries
+ gdraw_get_info *GetInfo;
+
+ // drawing state
+ gdraw_set_view_size_and_world_scale * SetViewSizeAndWorldScale;
+ gdraw_render_tile_begin * RenderTileBegin;
+ gdraw_render_tile_end * RenderTileEnd;
+ gdraw_set_antialias_texture * SetAntialiasTexture;
+
+ // drawing
+ gdraw_clear_stencil_bits * ClearStencilBits;
+ gdraw_clear_id * ClearID;
+ gdraw_filter_quad * FilterQuad;
+ gdraw_draw_indexed_triangles * DrawIndexedTriangles;
+ gdraw_make_texture_begin * MakeTextureBegin;
+ gdraw_make_texture_more * MakeTextureMore;
+ gdraw_make_texture_end * MakeTextureEnd;
+ gdraw_make_vertex_buffer_begin * MakeVertexBufferBegin;
+ gdraw_make_vertex_buffer_more * MakeVertexBufferMore;
+ gdraw_make_vertex_buffer_end * MakeVertexBufferEnd;
+ gdraw_try_to_lock_texture * TryToLockTexture;
+ gdraw_try_to_lock_vertex_buffer * TryToLockVertexBuffer;
+ gdraw_unlock_handles * UnlockHandles;
+ gdraw_free_texture * FreeTexture;
+ gdraw_free_vertex_buffer * FreeVertexBuffer;
+ gdraw_update_texture_begin * UpdateTextureBegin;
+ gdraw_update_texture_rect * UpdateTextureRect;
+ gdraw_update_texture_end * UpdateTextureEnd;
+
+ // rendertargets
+ gdraw_texture_draw_buffer_begin * TextureDrawBufferBegin;
+ gdraw_texture_draw_buffer_end * TextureDrawBufferEnd;
+
+ gdraw_describe_texture * DescribeTexture;
+ gdraw_describe_vertex_buffer * DescribeVertexBuffer;
+
+ // new functions are always added at the end, so these have no structure
+ gdraw_set_texture_unique_id * SetTextureUniqueID;
+
+ gdraw_draw_mask_begin * DrawMaskBegin;
+ gdraw_draw_mask_end * DrawMaskEnd;
+
+ gdraw_rendering_begin * RenderingBegin;
+ gdraw_rendering_end * RenderingEnd;
+
+ gdraw_make_texture_from_resource * MakeTextureFromResource;
+ gdraw_free_texture_from_resource * FreeTextureFromResource;
+
+ gdraw_set_3d_transform * Set3DTransform;
+};
+/* The function interface called by Iggy to render graphics on all
+ platforms.
+
+ So that Iggy can integrate with the widest possible variety of
+ rendering scenarios, all of its renderer-specific drawing calls
+ go through this table of function pointers. This allows you
+ to dynamically configure which of RAD's supplied drawing layers
+ you wish to use, or to integrate it directly into your own
+ renderer by implementing your own versions of the drawing
+ functions Iggy requires.
+*/
+
+RADDEFEND
+
+#endif
diff --git a/Minecraft.Client/Windows64/Iggy/include/iggy.h b/Minecraft.Client/Windows64/Iggy/include/iggy.h
new file mode 100644
index 00000000..56638a32
--- /dev/null
+++ b/Minecraft.Client/Windows64/Iggy/include/iggy.h
@@ -0,0 +1,1295 @@
+// Iggy -- Copyright 2008-2013 RAD Game Tools
+
+#ifndef __RAD_INCLUDE_IGGY_H__
+#define __RAD_INCLUDE_IGGY_H__
+
+#include <stdlib.h> // size_t
+
+#define IggyVersion "1.2.30"
+#define IggyFlashVersion "9,1,2,30"
+
+#include "rrcore.h" // base data types, macros
+
+RADDEFSTART
+
+#ifndef IGGY_GDRAW_SHARED_TYPEDEF
+
+ #define IGGY_GDRAW_SHARED_TYPEDEF
+
+ typedef struct GDrawFunctions GDrawFunctions;
+ typedef struct GDrawTexture GDrawTexture;
+
+#endif//IGGY_GDRAW_SHARED_TYPEDEF
+
+#define IDOCN // Used by documentation generation system
+
+////////////////////////////////////////////////////////////
+//
+// Basic Operations
+//
+
+typedef enum IggyResult
+{
+ IGGY_RESULT_SUCCESS = 0,
+
+ IGGY_RESULT_Warning_None = 0,
+
+ IGGY_RESULT_Warning_Misc = 100,
+ IGGY_RESULT_Warning_GDraw = 101,
+ IGGY_RESULT_Warning_ProgramFlow = 102,
+ IGGY_RESULT_Warning_Actionscript = 103,
+ IGGY_RESULT_Warning_Graphics = 104,
+ IGGY_RESULT_Warning_Font = 105,
+ IGGY_RESULT_Warning_Timeline = 106,
+ IGGY_RESULT_Warning_Library = 107,
+ IGGY_RESULT_Warning_ValuePath = 108,
+ IGGY_RESULT_Warning_Audio = 109,
+
+ IGGY_RESULT_Warning_CannotSustainFrameRate = 201, // During a call to $IggyPlayerReadyToTick, Iggy detected that its rendering of a Flash file was not keeping up with the frame rate requested.
+ IGGY_RESULT_Warning_ThrewException = 202,
+
+ IGGY_RESULT_Error_Threshhold = 400,
+
+ IGGY_RESULT_Error_Misc = 400, // an uncategorized error
+ IGGY_RESULT_Error_GDraw = 401, // an error occured in GDraw
+ IGGY_RESULT_Error_ProgramFlow = 402, // an error occured with the user's program flow through the Iggy API (e.g. reentrancy issues)
+ IGGY_RESULT_Error_Actionscript = 403, // an error occurred in Actionscript processing
+ IGGY_RESULT_Error_Graphics = 404,
+ IGGY_RESULT_Error_Font = 405,
+ IGGY_RESULT_Error_Create = 406,
+ IGGY_RESULT_Error_Library = 407,
+ IGGY_RESULT_Error_ValuePath = 408, // an error occurred while processing a ValuePath
+ IGGY_RESULT_Error_Audio = 409,
+
+ IGGY_RESULT_Error_Internal = 499,
+
+ IGGY_RESULT_Error_InvalidIggy = 501,
+ IGGY_RESULT_Error_InvalidArgument = 502,
+ IGGY_RESULT_Error_InvalidEntity = 503,
+ IGGY_RESULT_Error_UndefinedEntity = 504,
+
+ IGGY_RESULT_Error_OutOfMemory = 1001, // Iggy ran out of memory while processing the SWF. The Iggy player is now invalid and you cannot do anything further with it (except read AS3 variables). Should this happen, you'll want to $IggyPlayerDestroy and reopen the $Iggy.
+} IggyResult;
+
+typedef enum IggyDatatype
+{
+ IGGY_DATATYPE__invalid_request, // Set only when there is an error
+
+ IGGY_DATATYPE_undefined, // Undefined data type
+ IGGY_DATATYPE_null, // No data type
+ IGGY_DATATYPE_boolean, // Data of type rrbool
+
+ IGGY_DATATYPE_number, // Data of type F64
+ IGGY_DATATYPE_string_UTF8, // Data of type $IggyStringUTF8
+ IGGY_DATATYPE_string_UTF16, // Data of type $IggyStringUTF16
+ IGGY_DATATYPE_fastname, // Only used when calling functions (avoids a copy operation)
+ IGGY_DATATYPE_valuepath, // Only used when calling functions
+ IGGY_DATATYPE_valueref, // Only used when calling functions
+
+ // the following datatypes can be queried, but cannot appear
+ // as function arguments
+
+ IGGY_DATATYPE_array, // Data of type Array in AS3 (appears in datatype query, never as arguments)
+ IGGY_DATATYPE_object, // Data of type Object (or a subclass) in AS3 (appears in datatype query, never as arguments)
+ IGGY_DATATYPE_displayobj, // Data of type DisplayObject (or a subclass) in AS3 (only appears in callbacks)
+
+ IGGY_DATATYPE_xml, // Data of type XML or XMLList in AS3 (appears in datatype query, never as arguments)
+
+ // the following datatypes also exists, but you can't access any data
+ // from within them. we give you the exact type for e.g. debugging
+ IGGY_DATATYPE_namespace, // Data of type Namespace in AS3 (appears in datatype query, never as arguments)
+ IGGY_DATATYPE_qname, // Data of type QName in AS3 (appears in datatype query, never as arguments)
+ IGGY_DATATYPE_function, // Data of type Function in AS3 (appears in datatype query, never as arguments)
+ IGGY_DATATYPE_class, // Data of type Class in AS3 (appears in datatype query, never as arguments)
+} IggyDatatype;
+/* Describes an AS3 datatype visible through iggy interface. */
+
+#ifdef __RADWIN__
+#include <stddef.h>
+IDOCN typedef wchar_t IggyUTF16;
+#else
+typedef unsigned short IggyUTF16;
+#endif
+
+typedef struct IggyStringUTF16
+{
+ IggyUTF16 *string; // Null-terminated, UTF16-encoded characters
+ S32 length; // Count of 16-bit characters in <tt>string</tt>, not including the null terminator
+} IggyStringUTF16;
+
+typedef struct IggyStringUTF8
+{
+ char *string; // Null-terminated, UTF8-encoded characters
+ S32 length; // Count of 8-bit bytes in <tt>string</tt>, not including the null terminator
+} IggyStringUTF8;
+
+typedef UINTa IggyName;
+typedef struct IggyValuePath IggyValuePath;
+typedef void *IggyValueRef;
+typedef UINTa IggyTempRef;
+
+typedef struct IggyDataValue
+{
+ S32 type; // an $IggyDatatype which determines which of the union members is valid.
+ #ifdef __RAD64__
+ S32 padding;
+ #endif
+ IggyTempRef temp_ref; // An opaque temporary reference which you can efficiently turn into an $IggyValueRef; this is written by Iggy on callbacks but never read by Iggy
+ union {
+ IggyStringUTF16 string16; // A UTF16 string, valid if type = $(IggyDatatype::IGGY_DATATYPE_string_UTF16)
+ IggyStringUTF8 string8; // A UTF8 string, valid if type = $(IggyDatatype::IGGY_DATATYPE_string_UTF8)
+ F64 number; // A 64-bit floating point number (a double); valid if type = $(IggyDatatype::IGGY_DATATYPE_number)
+ rrbool boolval; // A boolean value, valid if type = $(IggyDatatype::IGGY_DATATYPE_boolean)
+ IggyName fastname; // A fast name, valid if type = $(IggyDatatype::IGGY_DATATYPE_fastname); this is only an "in" type; Iggy will never define these itself
+ void * userdata; // A userdata pointer from a DisplayObject, valid if type = $(IggyDatatype::IGGY_DATATYPE_displayobj)
+ IggyValuePath * valuepath;// A path to an object in the AS3 VM, valid if type = $(IggyDatatype::IGGY_DATATYPE_valuepath); this is only an "in" type--Iggy will never output this
+ IggyValueRef valueref; // An IggyValueRef, valid if type = $(IggyDatatype::IGGY_DATATYPE_valueref); this is only an "in" type--Iggy will never output this
+ };
+} IggyDataValue;
+
+typedef struct IggyExternalFunctionCallUTF16
+{
+ IggyStringUTF16 function_name; // The name of the function
+ S32 num_arguments; // The number of arguments that must be passed to the function
+ S32 padding;
+ IggyDataValue arguments[1]; // The argument types, assumed to contain <tt>num_arguments</tt> elements
+} IggyExternalFunctionCallUTF16;
+
+typedef struct IggyExternalFunctionCallUTF8
+{
+ IggyStringUTF8 function_name; // The name of the function
+ S32 num_arguments; // The number of arguments that must be passed to the function
+ S32 padding;
+ IggyDataValue arguments[1]; // The argument types, assumed to contain <tt>num_arguments</tt> elements
+} IggyExternalFunctionCallUTF8;
+
+typedef void * RADLINK Iggy_AllocateFunction(void *alloc_callback_user_data, size_t size_requested, size_t *size_returned);
+typedef void RADLINK Iggy_DeallocateFunction(void *alloc_callback_user_data, void *ptr);
+
+typedef struct IggyAllocator
+{
+ void *user_callback_data;
+ Iggy_AllocateFunction *mem_alloc;
+ Iggy_DeallocateFunction *mem_free;
+ #ifndef __RAD64__
+ void *struct_padding; // pad to 8-byte boundary
+ #endif
+} IggyAllocator;
+
+RADEXPFUNC void RADEXPLINK IggyInit(IggyAllocator *allocator);
+RADEXPFUNC void RADEXPLINK IggyShutdown(void);
+
+typedef enum IggyConfigureBoolName
+{
+ IGGY_CONFIGURE_BOOL_StartupExceptionsAreWarnings, // if true, ActionScript exceptions thrown during startup will not prevent Iggy from being created (default false)
+ IGGY_CONFIGURE_BOOL_IgnoreFlashVersion,
+ IGGY_CONFIGURE_BOOL_NeverDelayGotoProcessing,
+ IGGY_CONFIGURE_BOOL_SuppressAntialiasingOnAllBitmaps,
+ IGGY_CONFIGURE_BOOL_SuppressAntialiasingOn9SliceBitmaps,
+} IggyConfigureBoolName;
+
+RADEXPFUNC void RADEXPLINK IggyConfigureBool(IggyConfigureBoolName prop, rrbool value);
+
+typedef enum
+{
+ IGGY_VERSION_1_0_21 = 1, // behavior from 1.0.21 and earlier
+ IGGY_VERSION_1_0_24 = 3, // behavior from 1.0.24 and earlier
+ IGGY_VERSION_1_1_1 = 5, // behavior from 1.1.1 and earlier
+ IGGY_VERSION_1_1_8 = 7, // behavior from 1.1.8 and earlier
+ IGGY_VERSION_1_2_28 = 9, // behavior from 1.2.28 and earlier
+ IGGY_VERSION_default=0x7fffffff, // default (current) Iggy behavior
+} IggyVersionNumber;
+
+typedef enum
+{
+ IGGY_VERSIONED_BEHAVIOR_movieclip_gotoand=128, // This changes the behavior of AS3 gotoAndPlay and gotoAndStop. Valid values: IGGY_VERSION_1_0_21, IGGY_VERSION_default
+ IGGY_VERSIONED_BEHAVIOR_textfield_position=129, // This changes the behavior of textfield positioning as reported by AS3 getBounds/getRect and width/height. Values with different behavior: IGGY_VERSION_1_0_24, IGGY_VERSION_default.
+ IGGY_VERSIONED_BEHAVIOR_bitmap_smoothing=130,
+ IGGY_VERSIONED_BEHAVIOR_textfield_autoscroll=131, // This makes textfield autoscrolling behave specially: Valid values: IGGY_VERSION_1_1_8, IGGY_VERSION_default
+ IGGY_VERSIONED_BEHAVIOR_fast_text_effects=132, // This fixes the behavior of fast text effects to be in the correct direction; Valid values: IGGY_VERSION_1_2_28, IGGY_VERSION_default
+} IggyVersionedBehaviorName;
+
+RADEXPFUNC void RADEXPLINK IggyConfigureVersionedBehavior(IggyVersionedBehaviorName prop, IggyVersionNumber value);
+
+typedef enum IggyTelemetryAmount
+{
+ IGGY_TELEMETRY_normal, // Normal amount for users debugging applications using Iggy
+ IGGY_TELEMETRY_internal, // Shows more internal details, useful when optimizing Iggy itself
+} IggyTelemetryAmount;
+
+RADEXPFUNC void RADEXPLINK IggyUseTmLite(void * context, IggyTelemetryAmount amount);
+RADEXPFUNC void RADEXPLINK IggyUseTelemetry(void * context, IggyTelemetryAmount amount);
+
+////////////////////////////////////////////////////////////
+//
+// Translation
+//
+
+
+typedef struct
+{
+ IggyUTF16 *object_name; /* null-terminated Textfield.name value at the time the text is set */
+ rrbool autosize; /* true if the autosize value is non-zero at the time the text is set */
+ F32 width; /* the objectspace width of the textfield at the time the text is set */
+ F32 height; /* the objectspace height of the textfield at the time the text is set */
+ rrbool is_html_text; /* whether the provided text is going through Textfield.htmlText or Textfield.text */
+} IggyTextfieldInfo;
+
+typedef void RADLINK Iggy_TranslationFreeFunction(void *callback_data, void *data, S32 length);
+typedef rrbool RADLINK Iggy_TranslateFunctionUTF16(void *callback_data, IggyStringUTF16 *src, IggyStringUTF16 *dest);
+typedef rrbool RADLINK Iggy_TranslateFunctionUTF8(void *callback_data, IggyStringUTF8 *src, IggyStringUTF8 *dest);
+typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF16(void *callback_data, IggyStringUTF16 *src, IggyStringUTF16 *dest, IggyTextfieldInfo *textfield);
+typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF8(void *callback_data, IggyStringUTF8 *src, IggyStringUTF8 *dest, IggyTextfieldInfo *textfield);
+
+RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunction(Iggy_TranslateFunctionUTF16 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF16(Iggy_TranslateFunctionUTF16 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF8(Iggy_TranslateFunctionUTF8 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunction(Iggy_TranslateFunctionUTF16 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF16(Iggy_TranslateFunctionUTF16 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF8(Iggy_TranslateFunctionUTF8 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF16(Iggy_TextfieldTranslateFunctionUTF16 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF8(Iggy_TextfieldTranslateFunctionUTF8 *func, void *callback_data, Iggy_TranslationFreeFunction *freefunc, void *free_callback_data);
+
+typedef enum
+{
+ IGGY_LANG_default,
+ IGGY_LANG_ja,
+ IGGY_LANG_ja_flash, // more strictly matches Flash
+} IggyLanguageCode;
+
+RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang);
+
+////////////////////////////////////////////////////////////
+//
+// Playback
+//
+
+typedef struct Iggy Iggy;
+typedef S32 IggyLibrary;
+
+typedef void RADLINK Iggy_TraceFunctionUTF16(void *user_callback_data, Iggy *player, IggyUTF16 const *utf16_string, S32 length_in_16bit_chars);
+typedef void RADLINK Iggy_TraceFunctionUTF8(void *user_callback_data, Iggy *player, char const *utf8_string, S32 length_in_bytes);
+typedef void RADLINK Iggy_WarningFunction(void *user_callback_data, Iggy *player, IggyResult error_code, char const *error_message);
+
+typedef struct
+{
+ S32 total_storage_in_bytes; // the total memory to use for the AS3 heap and garbage collector
+ S32 stack_size_in_bytes; // size of the stack used for AS3 expression evaluation and function activation records
+ S32 young_heap_size_in_bytes; // size of the heap from which initial allocations are made
+ S32 old_heap_size_in_bytes; // this parameter is not supported yet
+ S32 remembered_set_size_in_bytes; // storage used to keep track of pointers from old heap to young heap
+ S32 greylist_size_in_bytes; // storage used to keep track of partially-garbage collected objects on the old heap
+ S32 rootstack_size_in_bytes; // size of the stack used for exposing temporaries to the garbage collector
+ S32 padding;
+} IggyPlayerGCSizes;
+
+typedef struct
+{
+ IggyAllocator allocator;
+ IggyPlayerGCSizes gc;
+ char *filename;
+ char *user_name;
+ rrbool load_in_place;
+ rrbool did_load_in_place;
+} IggyPlayerConfig;
+
+RADEXPFUNC Iggy * RADEXPLINK IggyPlayerCreateFromFileAndPlay(
+ char const * filename,
+ IggyPlayerConfig const*config);
+
+RADEXPFUNC Iggy * RADEXPLINK IggyPlayerCreateFromMemory(
+ void const * data,
+ U32 data_size_in_bytes,
+ IggyPlayerConfig *config);
+
+#define IGGY_INVALID_LIBRARY -1
+
+RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemory(
+ char const * url_utf8_null_terminated,
+ void const * data,
+ U32 data_size_in_bytes,
+ IggyPlayerConfig *config);
+
+RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemoryUTF16(
+ IggyUTF16 const * url_utf16_null_terminated,
+ void const * data,
+ U32 data_size_in_bytes,
+ IggyPlayerConfig *config);
+
+RADEXPFUNC void RADEXPLINK IggyPlayerDestroy(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyLibraryDestroy(IggyLibrary lib);
+RADEXPFUNC void RADEXPLINK IggySetWarningCallback(Iggy_WarningFunction *error, void *user_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF8(Iggy_TraceFunctionUTF8 *trace_utf8, void *user_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF16(Iggy_TraceFunctionUTF16 *trace_utf16, void *user_callback_data);
+
+typedef struct IggyProperties
+{
+ S32 movie_width_in_pixels; // the width of the "document" specified in the SWF file
+ S32 movie_height_in_pixels; // the height of the "document" specified in the SWF file
+
+ F32 movie_frame_rate_current_in_fps; // the current frame rate Iggy is trying to achieve for the file
+ F32 movie_frame_rate_from_file_in_fps; // the frame rate specified in the SWF file
+
+ S32 frames_passed; // the number of times Tick() has been called
+ S32 swf_major_version_number; // the major SWF version number of the file, currently always 9
+
+ F64 time_passed_in_seconds; // the total time passed since starting the file
+ F64 seconds_since_last_tick; // the number of seconds that have ocurred
+ F64 seconds_per_drawn_frame; // 1/render fps, updated on $IggyPlayerDrawTilesStart
+} IggyProperties;
+
+RADEXPFUNC IggyProperties * RADEXPLINK IggyPlayerProperties(Iggy *player);
+
+typedef enum
+{
+ IGGY_PAUSE_continue_audio,
+ IGGY_PAUSE_pause_audio,
+ IGGY_PAUSE_stop_audio
+} IggyAudioPauseMode;
+
+RADEXPFUNC void * RADEXPLINK IggyPlayerGetUserdata(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetUserdata(Iggy *player, void *userdata);
+
+RADEXPFUNC void RADEXPLINK IggyPlayerInitializeAndTickRS(Iggy *player);
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerReadyToTick(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyPlayerTickRS(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyPlayerPause(Iggy *player, IggyAudioPauseMode pause_audio);
+RADEXPFUNC void RADEXPLINK IggyPlayerPlay(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetFrameRate(Iggy *player, F32 frame_rate_in_fps);
+RADEXPFUNC void RADEXPLINK IggyPlayerGotoFrameRS(Iggy *f, S32 frame, rrbool stop);
+
+#ifndef __RAD_HIGGYEXP_
+#define __RAD_HIGGYEXP_
+typedef void * HIGGYEXP;
+/* An IggyExplorer context, it represents a connection to Iggy Explorer. */
+#endif
+
+#ifndef __RAD_HIGGYPERFMON_
+#define __RAD_HIGGYPERFMON_
+typedef void * HIGGYPERFMON;
+/* An IggyPerfMon context */
+#endif
+
+
+IDOCN typedef void RADLINK iggyexp_detach_callback(void *ptr);
+
+IDOCN typedef struct
+{
+ U64 tick_ticks;
+ U64 draw_ticks;
+} IggyPerfmonStats;
+
+IDOCN typedef struct
+{
+ void (RADLINK *get_stats)(Iggy* swf, IggyPerfmonStats* pdest);
+ const char* (RADLINK *get_display_name)(Iggy* swf);
+} IggyForPerfmonFunctions;
+
+// This is used by both Iggy Explorer and Perfmon
+IDOCN typedef struct
+{
+ rrbool (RADLINK *connection_valid)(Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy Explorer is still connected
+ S32 (RADLINK *poll_command)(Iggy* swf, HIGGYEXP iggyexp, U8 **buffer); // stores command in *buffer, returns number of bytes
+ void (RADLINK *send_command)(Iggy* swf, HIGGYEXP iggyexp, U8 command, void *buffer, S32 len); // writes a command with a payload of buffer:len
+ S32 (RADLINK *get_storage)(Iggy* swf, HIGGYEXP iggyexp, U8 **buffer); // returns temporary storage Iggy can use for assembling commands
+ rrbool (RADLINK *attach)(Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback *cb, void *cbdata, IggyForPerfmonFunctions* pmf); // an Iggy file is trying to attach itself to this connection (one at a time)
+ rrbool (RADLINK *detach)(Iggy* swf, HIGGYEXP iggyexp); // the current Iggy file should be detached (generate callback)
+ void (RADLINK *draw_tile_hook)(Iggy* swf, HIGGYEXP iggyexp, GDrawFunctions* iggy_gdraw); // only used by perfmon
+} IggyExpFunctions;
+
+RADEXPFUNC void RADEXPLINK IggyInstallPerfmon(void *perfmon_context);
+
+RADEXPFUNC void RADEXPLINK IggyUseExplorer(Iggy *swf, void *context);
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSendFrameToExplorer(Iggy *f);
+
+////////////////////////////////////////////////////////////
+//
+// Fonts
+//
+
+typedef struct
+{
+ F32 ascent;
+ F32 descent;
+ F32 line_gap;
+ F32 average_glyph_width_for_tab_stops; // for embedded fonts, Iggy uses width of 'g'
+ F32 largest_glyph_bbox_y1;
+} IggyFontMetrics;
+
+typedef struct
+{
+ F32 x0,y0, x1,y1; // bounding box
+ F32 advance; // distance to move origin after this character
+} IggyGlyphMetrics;
+
+typedef enum {
+ IGGY_VERTEX_move = 1,
+ IGGY_VERTEX_line = 2,
+ IGGY_VERTEX_curve = 3,
+} IggyShapeVertexType;
+
+typedef struct
+{
+ F32 x,y; // if IGGY_VERTEX_move, point to start a new loop; if IGGY_VERTEX_line/curve, endpoint of segment
+ F32 cx,cy; // if IGGY_VERTEX_curve, control point on segment; ignored otherwise
+ U8 type; // value from $IggyShapeVertexType
+
+ S8 padding; // ignore
+ U16 f0; // set to 1
+ U16 f1; // set to 0
+ U16 line; // ignore
+} IggyShapeVertex;
+
+typedef struct
+{
+ IggyShapeVertex * vertices;
+ S32 num_vertices;
+ void * user_context_for_free; // you can use this to store data to access on the corresponding free call
+} IggyVectorShape;
+
+typedef struct
+{
+ U8 *pixels_one_per_byte; // pixels from the top left, 0 is transparent and 255 is opaque
+ S32 width_in_pixels; // this is the actual width of the bitmap data
+ S32 height_in_pixels; // this is the actual height of the bitmap data
+ S32 stride_in_bytes; // the distance from one row to the next
+ S32 oversample; // this is the amount of oversampling (0 or 1 = not oversample, 2 = 2x oversampled, 4 = 4x oversampled)
+ rrbool point_sample; // if true, the bitmap will be drawn with point sampling; if false, it will be drawn with bilinear
+ S32 top_left_x; // the offset of the top left corner from the character origin
+ S32 top_left_y; // the offset of the top left corner from the character origin
+ F32 pixel_scale_correct; // the pixel_scale at which this character should be displayed at width_in_pixels
+ F32 pixel_scale_min; // the smallest pixel_scale to allow using this character (scaled down)
+ F32 pixel_scale_max; // the largest pixels cale to allow using this character (scaled up)
+ void * user_context_for_free; // you can use this to store data to access on the corresponding free call
+} IggyBitmapCharacter;
+
+typedef IggyFontMetrics * RADLINK IggyFontGetFontMetrics(void *user_context, IggyFontMetrics *metrics);
+
+#define IGGY_GLYPH_INVALID -1
+typedef S32 RADLINK IggyFontGetCodepointGlyph(void *user_context, U32 codepoint);
+typedef IggyGlyphMetrics * RADLINK IggyFontGetGlyphMetrics(void *user_context, S32 glyph, IggyGlyphMetrics *metrics);
+typedef rrbool RADLINK IggyFontIsGlyphEmpty(void *user_context, S32 glyph);
+typedef F32 RADLINK IggyFontGetKerningForGlyphPair(void *user_context, S32 first_glyph, S32 second_glyph);
+
+typedef void RADLINK IggyVectorFontGetGlyphShape(void *user_context, S32 glyph, IggyVectorShape *shape);
+typedef void RADLINK IggyVectorFontFreeGlyphShape(void *user_context, S32 glyph, IggyVectorShape *shape);
+
+typedef rrbool RADLINK IggyBitmapFontCanProvideBitmap(void *user_context, S32 glyph, F32 pixel_scale);
+typedef rrbool RADLINK IggyBitmapFontGetGlyphBitmap(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
+typedef void RADLINK IggyBitmapFontFreeGlyphBitmap(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
+
+
+typedef struct
+{
+ IggyFontGetFontMetrics *get_font_metrics;
+
+ IggyFontGetCodepointGlyph *get_glyph_for_codepoint;
+ IggyFontGetGlyphMetrics *get_glyph_metrics;
+ IggyFontIsGlyphEmpty *is_empty;
+ IggyFontGetKerningForGlyphPair *get_kerning;
+
+ IggyVectorFontGetGlyphShape *get_shape;
+ IggyVectorFontFreeGlyphShape *free_shape;
+
+ S32 num_glyphs;
+
+ void *userdata;
+} IggyVectorFontProvider;
+
+typedef struct
+{
+ IggyFontGetFontMetrics *get_font_metrics;
+
+ IggyFontGetCodepointGlyph *get_glyph_for_codepoint;
+ IggyFontGetGlyphMetrics *get_glyph_metrics;
+ IggyFontIsGlyphEmpty *is_empty;
+ IggyFontGetKerningForGlyphPair *get_kerning;
+
+ IggyBitmapFontCanProvideBitmap *can_bitmap;
+ IggyBitmapFontGetGlyphBitmap *get_bitmap;
+ IggyBitmapFontFreeGlyphBitmap *free_bitmap;
+
+ S32 num_glyphs;
+
+ void *userdata;
+} IggyBitmapFontProvider;
+
+typedef struct
+{
+ IggyBitmapFontCanProvideBitmap *can_bitmap;
+ IggyBitmapFontGetGlyphBitmap *get_bitmap;
+ IggyBitmapFontFreeGlyphBitmap *free_bitmap;
+ void *userdata;
+} IggyBitmapFontOverride;
+
+RADEXPFUNC void RADEXPLINK IggySetInstalledFontMaxCount(S32 num);
+RADEXPFUNC void RADEXPLINK IggySetIndirectFontMaxCount(S32 num);
+
+#define IGGY_FONTFLAG_none 0
+#define IGGY_FONTFLAG_bold 1
+#define IGGY_FONTFLAG_italic 2
+#define IGGY_FONTFLAG_all (~0U) // indirection only
+
+#define IGGY_TTC_INDEX_none 0
+
+RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF8(const void *truetype_storage, S32 ttc_index, const char *fontname, S32 namelen_in_bytes, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF16(const void *truetype_storage, S32 ttc_index, const U16 *fontname, S32 namelen_in_16bit_quantities, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF8(const char *fontname, S32 len, U32 fontflags, S32 fallback_codepoint);
+RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF16(const U16 *fontname, S32 len, U32 fontflags, S32 fallback_codepoint);
+RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF8(const IggyVectorFontProvider *vfp, const char *fontname, S32 namelen_in_bytes, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF16(const IggyVectorFontProvider *vfp, const U16 *fontname, S32 namelen_in_16bit_quantities, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF8(const IggyBitmapFontProvider *bmf, const char *fontname, S32 namelen_in_bytes, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF16(const IggyBitmapFontProvider *bmf, const U16 *fontname, S32 namelen_in_16bit_quantities, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF8(const IggyBitmapFontOverride *bmf, const char *fontname, S32 namelen_in_bytes, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF16(const IggyBitmapFontOverride *bmf, const U16 *fontname, S32 namelen_in_16bit_quantities, U32 fontflags);
+
+RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF8(const char *fontname, S32 namelen_in_bytes, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF16(const U16 *fontname, S32 namelen_in_16bit_quantities, U32 fontflags);
+
+RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF8(const char *request_name, S32 request_namelen, U32 request_flags, const char *result_name, S32 result_namelen, U32 result_flags);
+RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF16(const U16 *request_name, S32 request_namelen, U32 request_flags, const U16 *result_name, S32 result_namelen, U32 result_flags);
+
+RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF8(const char *fontname, S32 fontname_len, U32 fontflags);
+RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16 *fontname, S32 fontname_len, U32 fontflags);
+
+////////////////////////////////////////////////////////////
+//
+// Audio
+//
+
+struct _RadSoundSystem;
+IDOCN typedef S32 (*IGGYSND_OPEN_FUNC)(struct _RadSoundSystem* i_SoundSystem, U32 i_MinBufferSizeInMs, U32 i_Frequency, U32 i_ChannelCount, U32 i_MaxLockSize, U32 i_Flags);
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioSetDriver(IGGYSND_OPEN_FUNC driver_open, U32 flags);
+
+// These functions cause Iggy to use a specific audio API, most of which
+// are only actually defined on one target platform. Probably, you'll just
+// want to call IggyAudioUseDefault.
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseDirectSound(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseWaveOut(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseXAudio2(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseLibAudio(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseAX(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseCoreAudio(void);
+
+RADEXPFUNC void RADEXPLINK IggyAudioUseDefault(void);
+
+#ifndef __RAD_DEFINE_IGGYMP3__
+#define __RAD_DEFINE_IGGYMP3__
+IDOCN typedef struct IggyMP3Interface IggyMP3Interface;
+IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface *decoder);
+#endif
+
+#ifdef __RADNT__
+ RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void);
+ RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char *path);
+ RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(wchar_t *path);
+#else
+ // this is overkill for non-DLL implementations, which could call into Iggy
+ // directly, but it means everything goes through the same indirection internally
+ IDOCN RADEXPFUNC IggyGetMP3Decoder* RADEXPLINK IggyAudioGetMP3Decoder(void);
+ IDOCN RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3DecoderExplicit(IggyGetMP3Decoder *init);
+
+ #define IggyAudioInstallMP3Decoder() \
+ IggyAudioInstallMP3DecoderExplicit(IggyAudioGetMP3Decoder()) IDOCN
+#endif
+
+RADEXPFUNC rrbool RADEXPLINK IggyAudioSetMaxBufferTime(S32 ms);
+RADEXPFUNC void RADEXPLINK IggyAudioSetLatency(S32 ms);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioVolume(Iggy *iggy, F32 attenuation);
+
+#define IGGY_AUDIODEVICE_default 0
+#define IGGY_AUDIODEVICE_primary 1
+#define IGGY_AUDIODEVICE_secondary 2
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioDevice(Iggy *iggy, S32 device);
+
+
+////////////////////////////////////////////////////////////
+//
+// Rendering
+//
+
+typedef struct IggyCustomDrawCallbackRegion
+{
+ IggyUTF16 *name; // the name of the DisplayObject being substituted
+ F32 x0, y0, x1, y1; // the bounding box of the original DisplayObject, in object space
+ F32 rgba_mul[4]; // any multiplicative color effect specified for the DisplayObject or its parents
+ F32 rgba_add[4]; // any additive color effect specified for the DisplayObject or its parents
+ S32 scissor_x0, scissor_y0, scissor_x1, scissor_y1; // optional scissor rect box
+ U8 scissor_enable; // if non-zero, clip to the scissor rect
+ U8 stencil_func_mask; // D3DRS_STENCILMASK or equivalent
+ U8 stencil_func_ref; // D3DRS_STENCILREF or equivalent
+ U8 stencil_write_mask; // if non-zero, D3DRS_STENCILWRITEMASK or equivalent
+ struct gswf_matrix *o2w; // Iggy object-to-world matrix (used internally)
+} IggyCustomDrawCallbackRegion;
+
+typedef void RADLINK Iggy_CustomDrawCallback(void *user_callback_data, Iggy *player, IggyCustomDrawCallbackRegion *Region);
+typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallback(void *user_callback_data, IggyUTF16 *texture_name, S32 *width, S32 *height, void **destroy_callback_data);
+typedef void RADLINK Iggy_TextureSubstitutionDestroyCallback(void *user_callback_data, void *destroy_callback_data, GDrawTexture *handle);
+typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallbackUTF8(void *user_callback_data, char *texture_name, S32 *width, S32 *height, void **destroy_callback_data);
+
+RADEXPFUNC void RADEXPLINK IggySetCustomDrawCallback(Iggy_CustomDrawCallback *custom_draw, void *user_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacks(Iggy_TextureSubstitutionCreateCallback *texture_create, Iggy_TextureSubstitutionDestroyCallback *texture_destroy, void *user_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacksUTF8(Iggy_TextureSubstitutionCreateCallbackUTF8 *texture_create, Iggy_TextureSubstitutionDestroyCallback *texture_destroy, void *user_callback_data);
+
+typedef enum {
+ IGGY_FLUSH_no_callback, // <i>do not</i> generate the $Iggy_TextureSubstitutionDestroyCallback
+ IGGY_FLUSH_destroy_callback, // do generate the $Iggy_TextureSubstitutionDestroyCallback
+} IggyTextureSubstitutionFlushMode;
+
+RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlush(GDrawTexture *handle, IggyTextureSubstitutionFlushMode do_destroy_callback);
+RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlushAll(IggyTextureSubstitutionFlushMode do_destroy_callback);
+
+RADEXPFUNC void RADEXPLINK IggySetGDraw(GDrawFunctions *gdraw);
+RADEXPFUNC void RADEXPLINK IggyPlayerGetBackgroundColor(Iggy *player, F32 output_color[3]);
+
+typedef enum
+{
+ IGGY_ROTATION_0_degrees = 0,
+ IGGY_ROTATION_90_degrees_counterclockwise = 1,
+ IGGY_ROTATION_180_degrees = 2,
+ IGGY_ROTATION_90_degrees_clockwise = 3,
+} Iggy90DegreeRotation;
+
+RADEXPFUNC void RADEXPLINK IggyPlayerSetDisplaySize(Iggy *f, S32 w, S32 h);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetPixelShape(Iggy *swf, F32 pixel_x, F32 pixel_y);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetStageRotation(Iggy *f, Iggy90DegreeRotation rot);
+RADEXPFUNC void RADEXPLINK IggyPlayerDraw(Iggy *f);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetStageSize(Iggy *f, S32 w, S32 h);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetFaux3DStage(Iggy *f, F32 *top_left, F32 *top_right, F32 *bottom_left, F32 *bottom_right, F32 depth_scale);
+RADEXPFUNC void RADEXPLINK IggyPlayerForceMipmaps(Iggy *f, rrbool force_mipmaps);
+
+RADEXPFUNC void RADEXPLINK IggyPlayerDrawTile(Iggy *f, S32 x0, S32 y0, S32 x1, S32 y1, S32 padding);
+RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesStart(Iggy *f);
+RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesEnd(Iggy *f);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetRootTransform(Iggy *f, F32 mat[4], F32 tx, F32 ty);
+RADEXPFUNC void RADEXPLINK IggyPlayerFlushAll(Iggy *player);
+RADEXPFUNC void RADEXPLINK IggyLibraryFlushAll(IggyLibrary h);
+RADEXPFUNC void RADEXPLINK IggySetTextCursorPixelWidth(S32 width);
+RADEXPFUNC void RADEXPLINK IggyForceBitmapSmoothing(rrbool force_on);
+RADEXPFUNC void RADEXPLINK IggyFlushInstalledFonts(void);
+RADEXPFUNC void RADEXPLINK IggyFastTextFilterEffects(rrbool enable);
+
+typedef enum IggyAntialiasing
+{
+ IGGY_ANTIALIASING_FontsOnly = 2, // Anti-aliasing of bitmapped fonts only
+ IGGY_ANTIALIASING_FontsAndLinesOnly = 4, // Anti-aliasing of fonts and lines, but nothing else
+ IGGY_ANTIALIASING_PrettyGood = 8, // High-quality anti-aliasing on everything, but no rendertargets required
+ IGGY_ANTIALIASING_Good = 10, // High-quality anti-aliasing on everything (on platforms where GDraw doesn't support rendertargets, such as the Wii, this behaves the same as PrettyGood)
+} IggyAntialiasing;
+
+RADEXPFUNC void RADEXPLINK IggyPlayerSetAntialiasing(Iggy *f, IggyAntialiasing antialias_mode);
+
+RADEXPFUNC void RADEXPLINK IggyPlayerSetBitmapFontCaching(
+ Iggy *f,
+ S32 tex_w,
+ S32 tex_h,
+ S32 max_char_pix_width,
+ S32 max_char_pix_height);
+
+RADEXPFUNC void RADEXPLINK IggySetFontCachingCalculationBuffer(
+ S32 max_chars,
+ void *optional_temp_buffer,
+ S32 optional_temp_buffer_size_in_bytes);
+
+typedef struct IggyGeneric IggyGeneric;
+
+RADEXPFUNC IggyGeneric * RADEXPLINK IggyPlayerGetGeneric(Iggy *player);
+RADEXPFUNC IggyGeneric * RADEXPLINK IggyLibraryGetGeneric(IggyLibrary lib);
+
+// each texture metadata block contains one of these, where
+// texture_info is an array of per-format data
+IDOCN typedef struct
+{
+ U16 num_textures;
+ U16 load_alignment_log2;
+ U32 texture_file_size;
+ void *texture_info;
+} IggyTextureResourceMetadata;
+
+RADEXPFUNC void RADEXPLINK IggyGenericInstallResourceFile(IggyGeneric *g, void *data, S32 data_length, rrbool *can_free_now);
+RADEXPFUNC IggyTextureResourceMetadata *RADEXPLINK IggyGenericGetTextureResourceMetadata(IggyGeneric *f);
+RADEXPFUNC void RADEXPLINK IggyGenericSetTextureFromResource(IggyGeneric *f, U16 id, GDrawTexture *handle);
+
+// this is the encoding for the "raw" texture type, which doesn't
+// depend on any platform headers
+typedef enum
+{
+ IFT_FORMAT_rgba_8888,
+ IFT_FORMAT_rgba_4444_LE,
+ IFT_FORMAT_rgba_5551_LE,
+ IFT_FORMAT_la_88,
+ IFT_FORMAT_la_44,
+ IFT_FORMAT_i_8,
+ IFT_FORMAT_i_4,
+ IFT_FORMAT_l_8,
+ IFT_FORMAT_l_4,
+ IFT_FORMAT_DXT1,
+ IFT_FORMAT_DXT3,
+ IFT_FORMAT_DXT5,
+} IggyFileTexture_Format;
+
+typedef struct
+{
+ U32 file_offset;
+ U8 format;
+ U8 mipmaps;
+ U16 w,h;
+ U16 swf_id;
+} IggyFileTextureRaw;
+
+IDOCN typedef struct
+{
+ U32 file_offset;
+ U16 swf_id;
+ U16 padding;
+ struct {
+ U32 data[13];
+ } texture;
+} IggyFileTexture360;
+
+IDOCN typedef struct
+{
+ U32 file_offset;
+ U16 swf_id;
+ U8 format;
+ U8 padding;
+ struct {
+ U32 data[6];
+ } texture;
+} IggyFileTexturePS3;
+
+IDOCN typedef struct
+{
+ U32 file_offset1;
+ U32 file_offset2;
+ U16 swf_id;
+ U8 format;
+ U8 padding;
+ struct {
+ U32 data1[39];
+ } texture;
+} IggyFileTextureWiiu;
+
+IDOCN typedef struct
+{
+ U32 file_offset;
+ U16 swf_id;
+ U8 format;
+ U8 padding;
+ struct {
+ U32 data[8];
+ } texture;
+} IggyFileTexturePS4;
+
+IDOCN typedef struct
+{
+ U32 file_offset;
+ U16 swf_id;
+ U8 format;
+ U8 padding;
+ struct {
+ U32 format;
+ U32 type;
+ U16 width;
+ U16 height;
+ U8 mip_count;
+ U8 pad[3];
+ } texture;
+} IggyFileTexturePSP2;
+
+////////////////////////////////////////////////////////////
+//
+// AS3
+//
+
+typedef rrbool RADLINK Iggy_AS3ExternalFunctionUTF8(void *user_callback_data, Iggy *player, IggyExternalFunctionCallUTF8 *call);
+typedef rrbool RADLINK Iggy_AS3ExternalFunctionUTF16(void *user_callback_data, Iggy *player, IggyExternalFunctionCallUTF16 *call);
+
+RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF8(Iggy_AS3ExternalFunctionUTF8 *as3_external_function_utf8, void *user_callback_data);
+RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF16(Iggy_AS3ExternalFunctionUTF16 *as3_external_function_utf16, void *user_callback_data);
+RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastName(Iggy *f, IggyUTF16 const *name, S32 len);
+RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastNameUTF8(Iggy *f, char const *name, S32 len);
+RADEXPFUNC IggyResult RADEXPLINK IggyPlayerCallFunctionRS(Iggy *player, IggyDataValue *result, IggyName function, S32 numargs, IggyDataValue *args);
+RADEXPFUNC IggyResult RADEXPLINK IggyPlayerCallMethodRS(Iggy *f, IggyDataValue *result, IggyValuePath *target, IggyName methodname, S32 numargs, IggyDataValue *args);
+RADEXPFUNC void RADEXPLINK IggyPlayerGarbageCollect(Iggy *player, S32 strength);
+
+#define IGGY_GC_MINIMAL 0
+#define IGGY_GC_NORMAL 30
+#define IGGY_GC_MAXIMAL 100
+
+typedef struct
+{
+ U32 young_heap_size; // the size of the young heap is the smaller of this number and the size the young heap was originally allocated when the Iggy was created
+ U32 base_old_amount; // the base number of words to process on each minor cycle, default 200
+ F32 old_heap_fraction; // the fraction 0..1 (default 0.125) of the outstanding allocations from the last major GC cycle to traverse during one GC cycle
+ F32 new_allocation_multiplier; // a number from 1..infinity (default 2) which is the amount of the allocations in the last cycle to traverse
+ F32 sweep_multiplier; // a positive number (default 2) which weights the amount of data swept vs marked
+} IggyGarbageCollectorControl;
+
+typedef enum
+{
+ IGGY_GC_EVENT_tenure,
+ IGGY_GC_EVENT_mark_increment,
+ IGGY_GC_EVENT_mark_roots,
+ IGGY_GC_EVENT_sweep_finalize,
+ IGGY_GC_EVENT_sweep_increment,
+ IGGY_GC_WARNING_greylist_overflow, // the grey list overflowed, increase the size of $(IggyPlayerGCSizes::greylist_size_in_bytes).
+ IGGY_GC_WARNING_remembered_overflow, // the remembered set overflowed, increase the size of $(IggyPlayerGCSizes::remembered_set_size_in_bytes).
+} IggyGarbageCollectionEvent;
+
+typedef struct
+{
+ U64 event_time_in_microseconds;
+ U64 total_marked_bytes; // total bytes ever marked by the GC
+ U64 total_swept_bytes; // total bytes ever swept by the GC
+ U64 total_allocated_bytes; // total bytes ever allocated from the old heap
+ U64 total_gc_time_in_microseconds; // total time spent in GC while notify callback was active
+
+ char *name;
+
+ IggyGarbageCollectionEvent event; // the type of garbage collection event that was just performed
+
+ U32 increment_processing_bytes; // the number of bytes that were processed in that event
+
+ U32 last_slice_tenured_bytes; // the number of bytes that were tenured from young-to-old heap since the previous GC step
+ U32 last_slice_old_allocation_bytes; // the number of bytes that were tenured or were directly allocated from the old heap since the previous GC step
+
+ U32 heap_used_bytes; // the number of bytes in use in the old heap (the young heap is empty)
+ U32 heap_size_bytes; // the number of bytes allocated for the old heap
+
+ U32 onstage_display_objects; // the number of on-stage display objects (MovieClips, TextFields, Shapes, etc) visited during tenuring only
+ U32 offstage_display_objects; // the number of off-stage display objects visited during tenuring only
+} IggyGarbageCollectionInfo;
+
+typedef void RADLINK Iggy_GarbageCollectionCallback(Iggy *player, IggyGarbageCollectionInfo *info);
+RADEXPFUNC void RADEXPLINK IggyPlayerConfigureGCBehavior(Iggy *player, Iggy_GarbageCollectionCallback *notify_callack, IggyGarbageCollectorControl *control);
+RADEXPFUNC void RADEXPLINK IggyPlayerQueryGCSizes(Iggy *player, IggyPlayerGCSizes *sizes);
+
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetValid(Iggy *f);
+
+IDOCN struct IggyValuePath
+{
+ Iggy *f;
+ IggyValuePath *parent;
+ //align 0 mod 8
+ IggyName name;
+ IggyValueRef ref;
+ //align 0 mod 8
+ S32 index;
+ S32 type;
+ //align 0 mod 8
+};
+
+typedef enum
+{
+ IGGY_ValueRef,
+ IGGY_ValueRef_Weak,
+} IggyValueRefType;
+
+RADEXPFUNC rrbool RADEXPLINK IggyValueRefCheck(IggyValueRef ref);
+RADEXPFUNC void RADEXPLINK IggyValueRefFree(Iggy *p, IggyValueRef ref);
+RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefFromPath(IggyValuePath *var, IggyValueRefType reftype);
+RADEXPFUNC rrbool RADEXPLINK IggyIsValueRefSameObjectAsTempRef(IggyValueRef value_ref, IggyTempRef temp_ref);
+RADEXPFUNC rrbool RADEXPLINK IggyIsValueRefSameObjectAsValuePath(IggyValueRef value_ref, IggyValuePath *path, IggyName sub_name, char const *sub_name_utf8);
+RADEXPFUNC void RADEXPLINK IggySetValueRefLimit(Iggy *f, S32 max_value_refs);
+RADEXPFUNC S32 RADEXPLINK IggyDebugGetNumValueRef(Iggy *f);
+RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateArray(Iggy *f, S32 num_slots);
+RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateEmptyObject(Iggy *f);
+RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefFromTempRef(Iggy *f, IggyTempRef temp_ref, IggyValueRefType reftype);
+
+RADEXPFUNC IggyValuePath * RADEXPLINK IggyPlayerRootPath(Iggy *f);
+RADEXPFUNC IggyValuePath * RADEXPLINK IggyPlayerCallbackResultPath(Iggy *f);
+RADEXPFUNC rrbool RADEXPLINK IggyValuePathMakeNameRef(IggyValuePath *result, IggyValuePath *parent, char const *text_utf8);
+RADEXPFUNC void RADEXPLINK IggyValuePathFromRef(IggyValuePath *result, Iggy *iggy, IggyValueRef ref);
+
+RADEXPFUNC void RADEXPLINK IggyValuePathMakeNameRefFast(IggyValuePath *result, IggyValuePath *parent, IggyName name);
+RADEXPFUNC void RADEXPLINK IggyValuePathMakeArrayRef(IggyValuePath *result, IggyValuePath *array_path, int array_index);
+
+RADEXPFUNC void RADEXPLINK IggyValuePathSetParent(IggyValuePath *result, IggyValuePath *new_parent);
+RADEXPFUNC void RADEXPLINK IggyValuePathSetArrayIndex(IggyValuePath *result, int new_index);
+
+RADEXPFUNC void RADEXPLINK IggyValuePathSetName(IggyValuePath *result, IggyName name);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetTypeRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, IggyDatatype *result);
+
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF64RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, F64 *result);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, F32 *result);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetS32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, S32 *result);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetU32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, U32 *result);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF8RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, S32 max_result_len, char *utf8_result, S32 *result_len);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF16RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, S32 max_result_len, IggyUTF16 *utf16_result, S32 *result_len);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetBooleanRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, rrbool *result);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetArrayLengthRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, S32 *result);
+
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetF64RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, F64 value);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetF32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, F32 value);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetS32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, S32 value);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetU32RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, U32 value);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF8RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, char const *utf8_string, S32 stringlen);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF16RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, IggyUTF16 const *utf16_string, S32 stringlen);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetBooleanRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, rrbool value);
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetValueRefRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, IggyValueRef value_ref);
+
+RADEXPFUNC rrbool RADEXPLINK IggyValueSetUserDataRS(IggyValuePath *result, void const *userdata);
+RADEXPFUNC IggyResult RADEXPLINK IggyValueGetUserDataRS(IggyValuePath *result, void **userdata);
+
+
+////////////////////////////////////////////////////////////
+//
+// Input Events
+//
+
+typedef enum IggyEventType
+{
+ IGGY_EVENTTYPE_None,
+ IGGY_EVENTTYPE_MouseLeftDown,
+ IGGY_EVENTTYPE_MouseLeftUp,
+ IGGY_EVENTTYPE_MouseRightDown,
+ IGGY_EVENTTYPE_MouseRightUp,
+ IGGY_EVENTTYPE_MouseMiddleDown,
+ IGGY_EVENTTYPE_MouseMiddleUp,
+ IGGY_EVENTTYPE_MouseMove,
+ IGGY_EVENTTYPE_MouseWheel,
+ IGGY_EVENTTYPE_KeyUp,
+ IGGY_EVENTTYPE_KeyDown,
+ IGGY_EVENTTYPE_Char,
+ IGGY_EVENTTYPE_Activate,
+ IGGY_EVENTTYPE_Deactivate,
+ IGGY_EVENTTYPE_Resize,
+ IGGY_EVENTTYPE_MouseLeave,
+ IGGY_EVENTTYPE_FocusLost,
+} IggyEventType;
+
+typedef enum IggyKeyloc
+{
+ IGGY_KEYLOC_Standard = 0, // For keys that have no variants
+ // TODO(casey): Shouldn't these work for ALT and CONTROL too? The code in D3DTEST looks like it only handles VK_SHIFT...
+ IGGY_KEYLOC_Left = 1, // Specifies the left-hand-side key for keys with left/right variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */
+ IGGY_KEYLOC_Right = 2, // Specifies the right-hand-side key for keys with left/right variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */
+ IGGY_KEYLOC_Numpad = 3, // TODO(casey): Is this ever used?
+} IggyKeyloc;
+
+typedef enum IggyKeyevent
+{
+ IGGY_KEYEVENT_Up = IGGY_EVENTTYPE_KeyUp,
+ IGGY_KEYEVENT_Down = IGGY_EVENTTYPE_KeyDown,
+} IggyKeyevent;
+
+typedef enum IggyMousebutton
+{
+ IGGY_MOUSEBUTTON_LeftDown = IGGY_EVENTTYPE_MouseLeftDown,
+ IGGY_MOUSEBUTTON_LeftUp = IGGY_EVENTTYPE_MouseLeftUp,
+ IGGY_MOUSEBUTTON_RightDown = IGGY_EVENTTYPE_MouseRightDown,
+ IGGY_MOUSEBUTTON_RightUp = IGGY_EVENTTYPE_MouseRightUp,
+ IGGY_MOUSEBUTTON_MiddleDown = IGGY_EVENTTYPE_MouseMiddleDown,
+ IGGY_MOUSEBUTTON_MiddleUp = IGGY_EVENTTYPE_MouseMiddleUp,
+} IggyMousebutton;
+
+typedef enum IggyActivestate
+{
+ IGGY_ACTIVESTATE_Activated = IGGY_EVENTTYPE_Activate,
+ IGGY_ACTIVESTATE_Deactivated = IGGY_EVENTTYPE_Deactivate,
+} IggyActivestate;
+
+typedef enum IggyKeycode
+{
+ IGGY_KEYCODE_A = 65,
+ IGGY_KEYCODE_B = 66,
+ IGGY_KEYCODE_C = 67,
+ IGGY_KEYCODE_D = 68,
+ IGGY_KEYCODE_E = 69,
+ IGGY_KEYCODE_F = 70,
+ IGGY_KEYCODE_G = 71,
+ IGGY_KEYCODE_H = 72,
+ IGGY_KEYCODE_I = 73,
+ IGGY_KEYCODE_J = 74,
+ IGGY_KEYCODE_K = 75,
+ IGGY_KEYCODE_L = 76,
+ IGGY_KEYCODE_M = 77,
+ IGGY_KEYCODE_N = 78,
+ IGGY_KEYCODE_O = 79,
+ IGGY_KEYCODE_P = 80,
+ IGGY_KEYCODE_Q = 81,
+ IGGY_KEYCODE_R = 82,
+ IGGY_KEYCODE_S = 83,
+ IGGY_KEYCODE_T = 84,
+ IGGY_KEYCODE_U = 85,
+ IGGY_KEYCODE_V = 86,
+ IGGY_KEYCODE_W = 87,
+ IGGY_KEYCODE_X = 88,
+ IGGY_KEYCODE_Y = 89,
+ IGGY_KEYCODE_Z = 90,
+
+ IGGY_KEYCODE_0 = 48,
+ IGGY_KEYCODE_1 = 49,
+ IGGY_KEYCODE_2 = 50,
+ IGGY_KEYCODE_3 = 51,
+ IGGY_KEYCODE_4 = 52,
+ IGGY_KEYCODE_5 = 53,
+ IGGY_KEYCODE_6 = 54,
+ IGGY_KEYCODE_7 = 55,
+ IGGY_KEYCODE_8 = 56,
+ IGGY_KEYCODE_9 = 57,
+
+ IGGY_KEYCODE_F1 = 112,
+ IGGY_KEYCODE_F2 = 113,
+ IGGY_KEYCODE_F3 = 114,
+ IGGY_KEYCODE_F4 = 115,
+ IGGY_KEYCODE_F5 = 116,
+ IGGY_KEYCODE_F6 = 117,
+ IGGY_KEYCODE_F7 = 118,
+ IGGY_KEYCODE_F8 = 119,
+ IGGY_KEYCODE_F9 = 120,
+ IGGY_KEYCODE_F10 = 121,
+ IGGY_KEYCODE_F11 = 122,
+ IGGY_KEYCODE_F12 = 123,
+ IGGY_KEYCODE_F13 = 124,
+ IGGY_KEYCODE_F14 = 125,
+ IGGY_KEYCODE_F15 = 126,
+
+ IGGY_KEYCODE_COMMAND = 15,
+ IGGY_KEYCODE_SHIFT = 16,
+ IGGY_KEYCODE_CONTROL = 17,
+ IGGY_KEYCODE_ALTERNATE = 18,
+
+ IGGY_KEYCODE_BACKQUOTE = 192,
+ IGGY_KEYCODE_BACKSLASH = 220,
+ IGGY_KEYCODE_BACKSPACE = 8,
+ IGGY_KEYCODE_CAPS_LOCK = 20,
+ IGGY_KEYCODE_COMMA = 188,
+ IGGY_KEYCODE_DELETE = 46,
+ IGGY_KEYCODE_DOWN = 40,
+ IGGY_KEYCODE_END = 35,
+ IGGY_KEYCODE_ENTER = 13,
+ IGGY_KEYCODE_EQUAL = 187,
+ IGGY_KEYCODE_ESCAPE = 27,
+ IGGY_KEYCODE_HOME = 36,
+ IGGY_KEYCODE_INSERT = 45,
+ IGGY_KEYCODE_LEFT = 37,
+ IGGY_KEYCODE_LEFTBRACKET = 219,
+ IGGY_KEYCODE_MINUS = 189,
+ IGGY_KEYCODE_NUMPAD = 21,
+ IGGY_KEYCODE_NUMPAD_0 = 96,
+ IGGY_KEYCODE_NUMPAD_1 = 97,
+ IGGY_KEYCODE_NUMPAD_2 = 98,
+ IGGY_KEYCODE_NUMPAD_3 = 99,
+ IGGY_KEYCODE_NUMPAD_4 = 100,
+ IGGY_KEYCODE_NUMPAD_5 = 101,
+ IGGY_KEYCODE_NUMPAD_6 = 102,
+ IGGY_KEYCODE_NUMPAD_7 = 103,
+ IGGY_KEYCODE_NUMPAD_8 = 104,
+ IGGY_KEYCODE_NUMPAD_9 = 105,
+ IGGY_KEYCODE_NUMPAD_ADD = 107,
+ IGGY_KEYCODE_NUMPAD_DECIMAL = 110,
+ IGGY_KEYCODE_NUMPAD_DIVIDE = 111,
+ IGGY_KEYCODE_NUMPAD_ENTER = 108,
+ IGGY_KEYCODE_NUMPAD_MULTIPLY = 106,
+ IGGY_KEYCODE_NUMPAD_SUBTRACT = 109,
+ IGGY_KEYCODE_PAGE_DOWN = 34,
+ IGGY_KEYCODE_PAGE_UP = 33,
+ IGGY_KEYCODE_PERIOD = 190,
+ IGGY_KEYCODE_QUOTE = 222,
+ IGGY_KEYCODE_RIGHT = 39,
+ IGGY_KEYCODE_RIGHTBRACKET = 221,
+ IGGY_KEYCODE_SEMICOLON = 186,
+ IGGY_KEYCODE_SLASH = 191,
+ IGGY_KEYCODE_SPACE = 32,
+ IGGY_KEYCODE_TAB = 9,
+ IGGY_KEYCODE_UP = 38,
+} IggyKeycode;
+
+typedef enum IggyEventFlag
+{
+ IGGY_EVENTFLAG_PreventDispatchToObject = 0x1,
+ IGGY_EVENTFLAG_PreventFocusTabbing = 0x2,
+ IGGY_EVENTFLAG_PreventDefault = 0x4,
+ IGGY_EVENTFLAG_RanAtLeastOneHandler = 0x8,
+} IggyEventFlag;
+
+typedef struct IggyEvent
+{
+ S32 type; // an $IggyEventType
+ U32 flags;
+ S32 x,y; // mouse position at time of event
+ S32 keycode,keyloc; // keyboard inputs
+} IggyEvent;
+
+typedef enum IggyFocusChange
+{
+ IGGY_FOCUS_CHANGE_None, // The keyboard focus didn't change
+ IGGY_FOCUS_CHANGE_TookFocus, // The keyboard focus changed to something in this Iggy
+ IGGY_FOCUS_CHANGE_LostFocus, // The keyboard focus was lost from this Iggy
+} IggyFocusChange;
+
+typedef struct IggyEventResult
+{
+ U32 new_flags;
+ S32 focus_change; // an $IggyFocusChange that indicates how the focus (may have) changed in response to the event
+ S32 focus_direction; //
+} IggyEventResult;
+
+RADEXPFUNC void RADEXPLINK IggyMakeEventNone(IggyEvent *event);
+
+RADEXPFUNC void RADEXPLINK IggyMakeEventResize(IggyEvent *event);
+RADEXPFUNC void RADEXPLINK IggyMakeEventActivate(IggyEvent *event, IggyActivestate event_type);
+RADEXPFUNC void RADEXPLINK IggyMakeEventMouseLeave(IggyEvent *event);
+RADEXPFUNC void RADEXPLINK IggyMakeEventMouseMove(IggyEvent *event, S32 x, S32 y);
+RADEXPFUNC void RADEXPLINK IggyMakeEventMouseButton(IggyEvent *event, IggyMousebutton event_type);
+RADEXPFUNC void RADEXPLINK IggyMakeEventMouseWheel(IggyEvent *event, S16 mousewheel_delta);
+RADEXPFUNC void RADEXPLINK IggyMakeEventKey(IggyEvent *event, IggyKeyevent event_type, IggyKeycode keycode, IggyKeyloc keyloc);
+RADEXPFUNC void RADEXPLINK IggyMakeEventChar(IggyEvent *event, S32 charcode);
+RADEXPFUNC void RADEXPLINK IggyMakeEventFocusLost(IggyEvent *event);
+RADEXPFUNC void RADEXPLINK IggyMakeEventFocusGained(IggyEvent *event, S32 focus_direction);
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerDispatchEventRS(Iggy *player, IggyEvent *event, IggyEventResult *result);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetShiftState(Iggy *f, rrbool shift, rrbool control, rrbool alt, rrbool command);
+RADEXPFUNC void RADEXPLINK IggySetDoubleClickTime(S32 time_in_ms_from_first_down_to_second_up);
+RADEXPFUNC void RADEXPLINK IggySetTextCursorFlash(U32 cycle_time_in_ms, U32 visible_time_in_ms);
+
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerHasFocusedEditableTextfield(Iggy *f);
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF16(Iggy *f, U16 *string, S32 stringlen);
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF8(Iggy *f, char *string, S32 stringlen);
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerCut(Iggy *f);
+
+#define IGGY_PLAYER_COPY_no_focused_textfield -1
+#define IGGY_PLAYER_COPY_textfield_has_no_selection 0
+RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF16(Iggy *f, U16 *buffer, S32 bufferlen);
+RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF8(Iggy *f, char *buffer, S32 bufferlen);
+
+
+////////////////////////////////////////////////////////////
+//
+// IME
+//
+
+#ifdef __RADNT__
+#define IGGY_IME_SUPPORT
+#endif
+
+RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF8(Iggy *f, const char *font_name_utf8, S32 namelen_in_bytes);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF16(Iggy *f, const IggyUTF16 *font_name_utf16, S32 namelen_in_2byte_words);
+
+#ifdef IGGY_IME_SUPPORT
+
+#define IGGY_IME_MAX_CANDIDATE_LENGTH 256 // matches def in ImeUi.cpp, so no overflow checks needed when copying out.
+
+IDOCN typedef enum {
+ IGGY_IME_COMPOSITION_STYLE_NONE,
+ IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED,
+ IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED_THICK,
+ IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID,
+ IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID_THICK,
+} IggyIMECompositionDrawStyle;
+
+IDOCN typedef enum {
+ IGGY_IME_COMPOSITION_CLAUSE_NORMAL,
+ IGGY_IME_COMPOSITION_CLAUSE_START,
+} IggyIMECompositionClauseState;
+
+IDOCN typedef struct
+{
+ IggyUTF16 str[IGGY_IME_MAX_CANDIDATE_LENGTH];
+ IggyIMECompositionDrawStyle char_style[IGGY_IME_MAX_CANDIDATE_LENGTH];
+ IggyIMECompositionClauseState clause_state[IGGY_IME_MAX_CANDIDATE_LENGTH];
+ S32 cursor_pos;
+ rrbool display_block_cursor;
+ int candicate_clause_start_pos;
+ int candicate_clause_end_pos; // inclusive
+} IggyIMECompostitionStringState;
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32SetCompositionState(Iggy* f, IggyIMECompostitionStringState* s);
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyIMEGetTextExtents(Iggy* f, U32* pdw, U32* pdh, const IggyUTF16* str, U32 text_height);
+IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawString(Iggy* f, S32 px, S32 py, const IggyUTF16* str, U32 text_height, const U8 rgba[4]);
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32GetCandidatePosition(Iggy* f, F32* pdx, F32* pdy, F32* pdcomp_str_height);
+IDOCN RADEXPFUNC void* RADEXPLINK IggyIMEGetFocusedTextfield(Iggy* f);
+IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, const U8 rgb[3]);
+
+#endif
+
+////////////////////////////////////////////////////////////
+//
+// Input focus handling
+//
+
+typedef void *IggyFocusHandle;
+
+#define IGGY_FOCUS_NULL 0
+
+typedef struct
+{
+ IggyFocusHandle object; // unique identifier of Iggy object
+ F32 x0, y0, x1, y1; // bounding box of displayed shape
+} IggyFocusableObject;
+
+RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetFocusableObjects(Iggy *f, IggyFocusHandle *current_focus,
+ IggyFocusableObject *objs, S32 max_obj, S32 *num_obj);
+RADEXPFUNC void RADEXPLINK IggyPlayerSetFocusRS(Iggy *f, IggyFocusHandle object, int focus_key_char);
+
+////////////////////////////////////////////////////////////
+//
+// GDraw helper functions accessors
+//
+
+RADEXPFUNC void * RADEXPLINK IggyGDrawMalloc(SINTa size);
+#define IggyGDrawMalloc(size) IggyGDrawMallocAnnotated(size, __FILE__, __LINE__) IDOCN
+IDOCN RADEXPFUNC void * RADEXPLINK IggyGDrawMallocAnnotated(SINTa size, const char *file, int line);
+
+RADEXPFUNC void RADEXPLINK IggyGDrawFree(void *ptr);
+RADEXPFUNC void RADEXPLINK IggyGDrawSendWarning(Iggy *f, char const *message, ...);
+RADEXPFUNC void RADEXPLINK IggyWaitOnFence(void *id, U32 fence);
+RADEXPFUNC void RADEXPLINK IggyDiscardVertexBufferCallback(void *owner, void *vertex_buffer);
+RADEXPFUNC void RADEXPLINK IggyPlayerDebugEnableFilters(Iggy *f, rrbool enable);
+RADEXPFUNC void RADEXPLINK IggyPlayerDebugSetTime(Iggy *f, F64 time);
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchStartFrame(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchInit(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchMove(S32 dir);
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchSplit(void);
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchChooseEnd(S32 end);
+
+////////////////////////////////////////////////////////////
+//
+// debugging
+//
+
+IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugUpdateReadyToTickWithFakeRender(Iggy *f);
+IDOCN RADEXPFUNC void RADEXPLINK IggyDebugBreakOnAS3Exception(void);
+
+
+typedef struct
+{
+ S32 size;
+ char *source_file;
+ S32 source_line;
+ char *iggy_file;
+ char *info;
+} IggyLeakResultData;
+
+typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData *data);
+
+typedef struct
+{
+ char *subcategory;
+ S32 subcategory_stringlen;
+
+ S32 static_allocation_count; // number of non-freeable allocations for this subcategory
+ S32 static_allocation_bytes; // bytes of non-freeable allocations for this subcategory
+
+ S32 dynamic_allocation_count; // number of freeable allocations for this subcategory
+ S32 dynamic_allocation_bytes; // estimated bytes of freeable allocations for this subcategory
+} IggyMemoryUseInfo;
+
+RADEXPFUNC rrbool RADEXPLINK IggyDebugGetMemoryUseInfo(Iggy *player, IggyLibrary lib, char const *category_string, S32 category_stringlen, S32 iteration, IggyMemoryUseInfo *data);
+RADEXPFUNC void RADEXPLINK IggyDebugSetLeakResultCallback(IggyLeakResultCallback *leak_result_func);
+
+IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_todisk(char *filename_or_null, U32 flags);
+IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_fromdisk(char *filename_or_null, U32 flags);
+IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_end(void);
+#define IGGY_SYNCCHECK_readytotick 1U IDOCN
+
+RADDEFEND
+
+#endif
diff --git a/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h
new file mode 100644
index 00000000..1f1a90a1
--- /dev/null
+++ b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h
@@ -0,0 +1,49 @@
+#ifndef __RAD_INCLUDE_IGGYEXPRUNTIME_H__
+#define __RAD_INCLUDE_IGGYEXPRUNTIME_H__
+
+#include "rrCore.h"
+
+#define IDOC
+
+RADDEFSTART
+
+#ifndef __RAD_HIGGYEXP_
+#define __RAD_HIGGYEXP_
+typedef void * HIGGYEXP;
+#endif
+
+//idoc(parent,IggyExpRuntime_API)
+
+#define IGGYEXP_MIN_STORAGE 1024 IDOC
+/* The minimum-sized block you must provide to $IggyExpCreate */
+
+IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, void *storage, S32 storage_size_in_bytes);
+/* Opens a connection to $IggyExplorer and returns an $HIGGYEXP wrapping the connection.
+
+ $:ip_address The address of the machine running Iggy Explorer (can be numeric with dots, or textual, including "localhost")
+ $:port The port number on which Iggy Explorer is listening for a network connection (the default is 9190)
+ $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE
+ $:storage_size_in_bytes The size of the block pointer to by <tt>storage</tt>
+
+Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer
+can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP
+which you can pass to $IggyUseExplorer. */
+
+IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p);
+/* Closes and destroys a connection to $IggyExplorer */
+
+IDOC RADEXPFUNC rrbool RADEXPLINK IggyExpCheckValidity(HIGGYEXP p);
+/* Checks if the connection represented by an $HIGGYEXP is still valid, i.e.
+still connected to $IggyExplorer.
+
+Returns true if the connection is still valid; returns false if it is not valid.
+
+This might happen if someone closes Iggy Explorer, Iggy Explorer crashes, or
+the network fails. You can this to poll and detect these conditions and do
+something in response, such as trying to open a new connection.
+
+An invalid $HIGGYEXP must still be shutdown with $IggyExpDestroy. */
+
+RADDEFEND
+
+#endif//__RAD_INCLUDE_IGGYEXPRUNTIME_H__ \ No newline at end of file
diff --git a/Minecraft.Client/Windows64/Iggy/include/iggyperfmon.h b/Minecraft.Client/Windows64/Iggy/include/iggyperfmon.h
new file mode 100644
index 00000000..85b84b60
--- /dev/null
+++ b/Minecraft.Client/Windows64/Iggy/include/iggyperfmon.h
@@ -0,0 +1,89 @@
+// $$COPYRIGHT$$
+
+#ifndef __RAD_INCLUDE_IGGYPERFMON_H__
+#define __RAD_INCLUDE_IGGYPERFMON_H__
+
+#include "rrCore.h"
+
+#define IDOC
+
+RADDEFSTART
+
+#ifndef __RAD_HIGGYPERFMON_
+#define __RAD_HIGGYPERFMON_
+typedef void * HIGGYPERFMON;
+#endif
+
+//idoc(parent,IggyPerfmon_API)
+
+typedef void * RADLINK iggyperfmon_malloc(void *handle, U32 size);
+typedef void RADLINK iggyperfmon_free(void *handle, void *ptr);
+
+IDOC RADEXPFUNC HIGGYPERFMON RADEXPLINK IggyPerfmonCreate(iggyperfmon_malloc *perf_malloc, iggyperfmon_free *perf_free, void *callback_handle);
+/* Creates an IggyPerfmon.
+
+You must supply allocator functions. The amount allocated depends on the complexity
+of the Iggys being profiled. */
+
+typedef struct Iggy Iggy;
+typedef struct GDrawFunctions GDrawFunctions;
+
+IDOC typedef union {
+ U32 bits;
+ struct {
+ U32 dpad_up :1;
+ U32 dpad_down :1;
+ U32 dpad_left :1;
+ U32 dpad_right :1;
+ U32 button_up :1; // XBox Y, PS3 tri
+ U32 button_down :1; // XBox A, PS3 X
+ U32 button_left :1; // XBox X, PS3 square
+ U32 button_right :1; // XBox B, PS3 circle
+ U32 shoulder_left_hi :1; // LB/L1
+ U32 shoulder_right_hi :1; // RB/R1
+ U32 trigger_left_low :1;
+ U32 trigger_right_low :1;
+ } field;
+} IggyPerfmonPad;
+
+#define IggyPerfmonPadFromXInputStatePointer(pad, xis) \
+ (pad).bits = 0, \
+ (pad).field.dpad_up = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP), \
+ (pad).field.dpad_down = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN), \
+ (pad).field.dpad_left = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT), \
+ (pad).field.dpad_right = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT), \
+ (pad).field.button_up = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_Y), \
+ (pad).field.button_down = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_A), \
+ (pad).field.button_left = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_X), \
+ (pad).field.button_right = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_B), \
+ (pad).field.shoulder_left_hi = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER), \
+ (pad).field.shoulder_right_hi = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER), \
+ (pad).field.trigger_left_low = 0 != ((xis)->Gamepad.bLeftTrigger >= XINPUT_GAMEPAD_TRIGGER_THRESHOLD), \
+ (pad).field.trigger_right_low = 0 != ((xis)->Gamepad.bRightTrigger >= XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
+
+// All positions in window coords
+IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonTickAndDraw(HIGGYPERFMON p, GDrawFunctions* gdraw_funcs,
+ const IggyPerfmonPad* pad,
+ int pm_tile_ul_x, int pm_tile_ul_y, int pm_tile_lr_x, int pm_tile_lr_y);
+/* Draw and tick an IggyPerfmon.
+
+$:p A perfmon context previously created with IggyPerfmonCreate
+$:gdraw_functions The same GDraw handle used for rendering Iggy
+$:pad An abstracted gamepad state structure. iggyperfmon.h
+includes an example that initializes the abstract gamepad from a 360 controller
+as defined by XInput; this will work on both Windows and the Xbox 360.
+$:pm_tile_ul_x The left coordinate of the rectangle where the perfmon display should be drawn
+$:pm_tile_ul_y The top coordinate of the rectangle where the perfmon display should be drawn
+$:pm_tile_lr_x The right coordinate of the rectangle where the perfmon display should be drawn
+$:pm_tile_lr_y The bottom coordinate of the rectangle where the perfmon display should be drawn
+
+You should only call this function when you want Iggy Perfmon to be visible.
+See $IggyPerfmon for more information. */
+
+IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonDestroy(HIGGYPERFMON p, GDrawFunctions* iggy_draw);
+/* Closes and destroys an IggyPerfmon */
+
+
+RADDEFEND
+
+#endif//__RAD_INCLUDE_IGGYPERFMON_H__ \ No newline at end of file
diff --git a/Minecraft.Client/Windows64/Iggy/include/rrCore.h b/Minecraft.Client/Windows64/Iggy/include/rrCore.h
new file mode 100644
index 00000000..e88b5f8c
--- /dev/null
+++ b/Minecraft.Client/Windows64/Iggy/include/rrCore.h
@@ -0,0 +1,2322 @@
+/// ========================================================================
+// (C) Copyright 1994- 2014 RAD Game Tools, Inc. Global types header file
+// ========================================================================
+
+#ifndef __RADRR_COREH__
+#define __RADRR_COREH__
+#define RADCOPYRIGHT "Copyright (C) 1994-2014, RAD Game Tools, Inc."
+
+// __RAD16__ means 16 bit code (Win16)
+// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac AND Win64)
+// __RAD64__ means 64 bit code (x64)
+
+// Note oddness - __RAD32__ essentially means "at *least* 32-bit code".
+// So, on 64-bit systems, both __RAD32__ and __RAD64__ will be defined.
+
+// __RADDOS__ means DOS code (16 or 32 bit)
+// __RADWIN__ means Windows API (Win16, Win386, Win32s, Win64, Xbox, Xenon)
+// __RADWINEXT__ means Windows 386 extender (Win386)
+// __RADNT__ means Win32 or Win64 code
+// __RADWINRTAPI__ means Windows RT API (Win 8, Win Phone, ARM, Durango)
+// __RADMAC__ means Macintosh
+// __RADCARBON__ means Carbon
+// __RADMACH__ means MachO
+// __RADXBOX__ means the XBox console
+// __RADXENON__ means the Xenon console
+// __RADDURANGO__ or __RADXBOXONE__ means Xbox One
+// __RADNGC__ means the Nintendo GameCube
+// __RADWII__ means the Nintendo Wii
+// __RADWIIU__ means the Nintendo Wii U
+// __RADNDS__ means the Nintendo DS
+// __RADTWL__ means the Nintendo DSi (__RADNDS__ also defined)
+// __RAD3DS__ means the Nintendo 3DS
+// __RADPS2__ means the Sony PlayStation 2
+// __RADPSP__ means the Sony PlayStation Portable
+// __RADPS3__ means the Sony PlayStation 3
+// __RADPS4__ means the Sony PlayStation 4
+// __RADANDROID__ means Android NDK
+// __RADNACL__ means Native Client SDK
+// __RADNTBUILDLINUX__ means building Linux on NT
+// __RADLINUX__ means actually building on Linux (most likely with GCC)
+// __RADPSP2__ means NGP
+// __RADBSD__ means a BSD-style UNIX (OS X, FreeBSD, OpenBSD, NetBSD)
+// __RADPOSIX__ means POSIX-compliant
+// __RADQNX__ means QNX
+// __RADIPHONE__ means iphone
+// __RADIPHONESIM__ means iphone simulator
+
+// __RADX86__ means Intel x86
+// __RADMMX__ means Intel x86 MMX instructions are allowed
+// __RADX64__ means Intel/AMD x64 (NOT IA64=Itanium)
+// __RAD68K__ means 68K
+// __RADPPC__ means PowerPC
+// __RADMIPS__ means Mips (only R5900 right now)
+// __RADARM__ mean ARM processors
+
+// __RADLITTLEENDIAN__ means processor is little-endian (x86)
+// __RADBIGENDIAN__ means processor is big-endian (680x0, PPC)
+
+// __RADNOVARARGMACROS__ means #defines can't use ...
+
+ #ifdef WINAPI_FAMILY
+ // If this is #defined, we might be in a Windows Store App. But
+ // VC++ by default #defines this to a symbolic name, not an integer
+ // value, and those names are defined in "winapifamily.h". So if
+ // WINAPI_FAMILY is #defined, #include the header so we can parse it.
+ #include <winapifamily.h>
+ #define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
+ #else
+ #define RAD_WINAPI_IS_APP 0
+ #endif
+
+ #ifndef __RADRES__
+ // Theoretically, this is to pad structs on platforms that don't support pragma pack or do it poorly. (PS3, PS2)
+ // In general it is assumed that your padding is set via pragma, so this is just a struct.
+ #define RADSTRUCT struct
+
+ #ifdef __GNUC_MINOR__
+ // make a combined GCC version for testing :
+
+ #define __RAD_GCC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+
+ /* Test for GCC > 3.2.0 */
+ // #if GCC_VERSION > 30200
+ #endif
+
+ #if defined(__RADX32__)
+
+ #define __RADX86__
+ #define __RADMMX__
+ #define __RAD32__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ // known platforms under the RAD generic build type
+ #if defined(_WIN32) || defined(_Windows) || defined(WIN32) || defined(__WINDOWS__) || defined(_WINDOWS)
+ #define __RADNT__
+ #define __RADWIN__
+ #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__)
+ #define __RADMAC__
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+ #elif defined(__linux__)
+ #define __RADLINUX__
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+ #endif
+
+#elif defined(ANDROID)
+ #define __RADANDROID__
+ #define __RAD32__
+ #define __RADLITTLEENDIAN__
+ #ifdef __i386__
+ #define __RADX86__
+ #else
+ #define __RADARM__
+ #endif
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+#elif defined(__QNX__)
+ #define __RAD32__
+ #define __RADQNX__
+
+#ifdef __arm__
+ #define __RADARM__
+#elif defined __i386__
+ #define __RADX86__
+#else
+ #error Unknown processor
+#endif
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+#elif defined(__linux__) && defined(__arm__) //This should pull in Raspberry Pi as well
+
+ #define __RAD32__
+ #define __RADLINUX__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+#elif defined(__native_client__)
+ #define __RADNACL__
+ #define __RAD32__
+ #define __RADLITTLEENDIAN__
+ #define __RADX86__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || defined(_XBOX_ONE)
+
+ #define __RADDURANGO__ 1
+ #define __RADXBOXONE__ 1
+ #if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat
+ #define __RADSEKRIT__ 1
+ #endif
+
+ #define __RADWIN__
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX64__
+ #define __RADMMX__
+ #define __RADX86__
+ #define __RAD64REGS__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE __inline
+ #define RADRESTRICT __restrict
+ #define __RADWINRTAPI__
+
+ #elif defined(__ORBIS__)
+
+ #define __RADPS4__
+ #if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat
+ #define __RADSEKRIT2__ 1
+ #endif
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX64__
+ #define __RADMMX__
+ #define __RADX86__
+ #define __RAD64REGS__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP
+
+ #define __RADWINRTAPI__
+ #define __RADWIN__
+ #define RADINLINE __inline
+ #define RADRESTRICT __restrict
+
+ #if defined(_M_IX86) // WinRT on x86
+
+ #define __RAD32__
+ #define __RADX86__
+ #define __RADMMX__
+ #define __RADLITTLEENDIAN__
+
+ #elif defined(_M_X64) // WinRT on x64
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX86__
+ #define __RADX64__
+ #define __RADMMX__
+ #define __RAD64REGS__
+ #define __RADLITTLEENDIAN__
+
+ #elif defined(_M_ARM) // WinRT on ARM
+
+ #define __RAD32__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+
+ #else
+
+ #error Unrecognized WinRT platform!
+
+ #endif
+
+ #elif defined(_WIN64)
+
+ #define __RADWIN__
+ #define __RADNT__
+ // See note at top for why both __RAD32__ and __RAD64__ are defined.
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX64__
+ #define __RADMMX__
+ #define __RADX86__
+ #define __RAD64REGS__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE __inline
+ #define RADRESTRICT __restrict
+
+ #elif defined(GENERIC_ARM)
+
+ #define __RAD32__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+ #define __RADFIXEDPOINT__
+ #define RADINLINE inline
+ #if (defined(__GCC__) || defined(__GNUC__))
+ #define RADRESTRICT __restrict
+ #else
+ #define RADRESTRICT // __restrict not supported on cw
+ #endif
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
+
+ #define __RADWIIU__
+ #define __RAD32__
+ #define __RADPPC__
+ #define __RADBIGENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+
+ #elif defined(HOLLYWOOD_REV) || defined(REVOLUTION)
+
+ #define __RADWII__
+ #define __RAD32__
+ #define __RADPPC__
+ #define __RADBIGENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #elif defined(NN_PLATFORM_CTR)
+
+ #define __RAD3DS__
+ #define __RAD32__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #elif defined(GEKKO)
+
+ #define __RADNGC__
+ #define __RAD32__
+ #define __RADPPC__
+ #define __RADBIGENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT // __restrict not supported on cw
+
+ #elif defined(SDK_ARM9) || defined(SDK_TWL) || (defined(__arm) && defined(__MWERKS__))
+
+ #define __RADNDS__
+ #define __RAD32__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+ #define __RADFIXEDPOINT__
+ #define RADINLINE inline
+ #if (defined(__GCC__) || defined(__GNUC__))
+ #define RADRESTRICT __restrict
+ #else
+ #define RADRESTRICT // __restrict not supported on cw
+ #endif
+
+ #if defined(SDK_TWL)
+ #define __RADTWL__
+ #endif
+
+ #elif defined(R5900)
+
+ #define __RADPS2__
+ #define __RAD32__
+ #define __RADMIPS__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #define __RAD64REGS__
+ #define U128 u_long128
+
+ #if !defined(__MWERKS__)
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+ #endif
+
+ #elif defined(__psp__)
+
+ #define __RADPSP__
+ #define __RAD32__
+ #define __RADMIPS__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #elif defined(__psp2__)
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #define __RADPSP2__
+ #define __RAD32__
+ #define __RADARM__
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ // need packed attribute for struct with snc?
+ #elif defined(__CELLOS_LV2__)
+
+ // CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU
+
+ #ifdef __SPU__
+ #define __RADSPU__
+ #define __RAD32__
+ #define __RADCELL__
+ #define __RADBIGENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #else
+ #define __RAD64REGS__
+ #define __RADPS3__
+ #define __RADPPC__
+ #define __RAD32__
+ #define __RADCELL__
+ #define __RADBIGENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #define __RADALTIVEC__
+ #endif
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #ifndef __LP32__
+ #error "PS3 32bit ABI support only"
+ #endif
+ #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__)
+ #ifdef __APPLE__
+ #include "TargetConditionals.h"
+ #endif
+
+ #if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
+
+ // iPhone/iPad/iOS
+ #define __RADIPHONE__
+ #define __RADMACAPI__
+
+ #define __RAD32__
+ #if defined(__x86_64__)
+ #define __RAD64__
+ #endif
+
+ #define __RADLITTLEENDIAN__
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+ #define __RADMACH__
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
+ #if defined( __x86_64__)
+ #define __RADX64__
+ #else
+ #define __RADX86__
+ #endif
+ #define __RADIPHONESIM__
+ #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+ #define __RADARM__
+ #endif
+ #else
+
+ // An actual MacOSX machine
+ #define __RADMAC__
+ #define __RADMACAPI__
+
+ #if defined(powerc) || defined(__powerc) || defined(__ppc__)
+ #define __RADPPC__
+ #define __RADBIGENDIAN__
+ #define __RADALTIVEC__
+ #define RADRESTRICT
+ #elif defined(__i386__)
+ #define __RADX86__
+ #define __RADMMX__
+ #define __RADLITTLEENDIAN__
+ #define RADRESTRICT __restrict
+ #elif defined(__x86_64__)
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX86__
+ #define __RADX64__
+ #define __RAD64REGS__
+ #define __RADMMX__
+ #define __RADLITTLEENDIAN__
+ #define RADRESTRICT __restrict
+ #else
+ #define __RAD68K__
+ #define __RADBIGENDIAN__
+ #define __RADALTIVEC__
+ #define RADRESTRICT
+ #endif
+
+ #define __RAD32__
+
+ #if defined(__MWERKS__)
+ #if (defined(__cplusplus) || ! __option(only_std_keywords))
+ #define RADINLINE inline
+ #endif
+ #ifdef __MACH__
+ #define __RADMACH__
+ #endif
+ #elif defined(__MRC__)
+ #if defined(__cplusplus)
+ #define RADINLINE inline
+ #endif
+ #elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__)
+ #define RADINLINE inline
+ #define __RADMACH__
+
+ #undef RADRESTRICT /* could have been defined above... */
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+ #endif
+
+ #ifdef __RADX86__
+ #ifndef __RADCARBON__
+ #define __RADCARBON__
+ #endif
+ #endif
+
+ #ifdef TARGET_API_MAC_CARBON
+ #if TARGET_API_MAC_CARBON
+ #ifndef __RADCARBON__
+ #define __RADCARBON__
+ #endif
+ #endif
+ #endif
+ #endif
+ #elif defined(__linux__)
+
+ #define __RADLINUX__
+ #define __RADMMX__
+ #define __RADLITTLEENDIAN__
+ #define __RADX86__
+ #ifdef __x86_64
+ #define __RAD32__
+ #define __RAD64__
+ #define __RADX64__
+ #define __RAD64REGS__
+ #else
+ #define __RAD32__
+ #endif
+ #define RADINLINE inline
+ #define RADRESTRICT __restrict
+
+ #undef RADSTRUCT
+ #define RADSTRUCT struct __attribute__((__packed__))
+
+ #else
+
+ #if _MSC_VER >= 1400
+ #undef RADRESTRICT
+ #define RADRESTRICT __restrict
+ #else
+ #define RADRESTRICT
+ #define __RADNOVARARGMACROS__
+ #endif
+
+ #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) )
+ // Remember that Xenon also defines _XBOX
+ #define __RADPPC__
+ #define __RADBIGENDIAN__
+ #define __RADALTIVEC__
+ #else
+ #define __RADX86__
+ #define __RADMMX__
+ #define __RADLITTLEENDIAN__
+ #endif
+
+ #ifdef __MWERKS__
+ #define _WIN32
+ #endif
+
+ #ifdef __DOS__
+ #define __RADDOS__
+ #define S64_DEFINED // turn off these types
+ #define U64_DEFINED
+ #define S64 double //should error
+ #define U64 double //should error
+ #define __RADNOVARARGMACROS__
+ #endif
+
+ #ifdef __386__
+ #define __RAD32__
+ #endif
+
+ #ifdef _Windows //For Borland
+ #ifdef __WIN32__
+ #define WIN32
+ #else
+ #define __WINDOWS__
+ #endif
+ #endif
+
+ #ifdef _WINDOWS //For MS
+ #ifndef _WIN32
+ #define __WINDOWS__
+ #endif
+ #endif
+
+ #ifdef _WIN32
+ #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) )
+ // Remember that Xenon also defines _XBOX
+ #define __RADXENON__
+ #define __RAD64REGS__
+ #elif defined(_XBOX)
+ #define __RADXBOX__
+ #elif !defined(__RADWINRTAPI__)
+ #define __RADNT__
+ #endif
+ #define __RADWIN__
+ #define __RAD32__
+ #else
+ #ifdef __NT__
+ #if defined(_XENON) || (_XBOX_VER == 200)
+ // Remember that Xenon also defines _XBOX
+ #define __RADXENON__
+ #define __RAD64REGS__
+ #elif defined(_XBOX)
+ #define __RADXBOX__
+ #else
+ #define __RADNT__
+ #endif
+ #define __RADWIN__
+ #define __RAD32__
+ #else
+ #ifdef __WINDOWS_386__
+ #define __RADWIN__
+ #define __RADWINEXT__
+ #define __RAD32__
+ #define S64_DEFINED // turn off these types
+ #define U64_DEFINED
+ #define S64 double //should error
+ #define U64 double //should error
+ #else
+ #ifdef __WINDOWS__
+ #define __RADWIN__
+ #define __RAD16__
+ #else
+ #ifdef WIN32
+ #if defined(_XENON) || (_XBOX_VER == 200)
+ // Remember that Xenon also defines _XBOX
+ #define __RADXENON__
+ #elif defined(_XBOX)
+ #define __RADXBOX__
+ #else
+ #define __RADNT__
+ #endif
+ #define __RADWIN__
+ #define __RAD32__
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+
+ #ifdef __WATCOMC__
+ #define RADINLINE
+ #else
+ #define RADINLINE __inline
+ #endif
+ #endif
+
+ #if defined __RADMAC__ || defined __RADIPHONE__
+ #define __RADBSD__
+ #endif
+
+ #if defined __RADBSD__ || defined __RADLINUX__
+ #define __RADPOSIX__
+ #endif
+
+ #if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \
+ !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \
+ !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \
+ !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && !defined(__RADSPU__) && \
+ !defined(__RADWII__) && !defined(__RADIPHONE__) && !defined(__RADX32__) && !defined(__RADARM__) && \
+ !defined(__RADWIIU__) && !defined(__RADANDROID__) && !defined(__RADNACL__) && !defined (__RADQNX__) )
+ #error "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console."
+ #endif
+
+
+ #ifdef __RADFINAL__
+ #define RADTODO(str) { char __str[0]=str; }
+ #else
+ #define RADTODO(str)
+ #endif
+
+ #ifdef __RADX32__
+ #if defined(_MSC_VER)
+ #define RADLINK __stdcall
+ #define RADEXPLINK __stdcall
+ #else
+ #define RADLINK __attribute__((stdcall))
+ #define RADEXPLINK __attribute__((stdcall))
+ #endif
+ #define RADEXPFUNC RADDEFFUNC
+
+ #elif (defined(__RADNGC__) || defined(__RADWII__) || defined( __RADPS2__) || \
+ defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \
+ defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \
+ (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || defined(__RADWIIU__) || defined(__RADPS4__) )
+
+ #define RADLINK
+ #define RADEXPLINK
+ #define RADEXPFUNC RADDEFFUNC
+ #define RADASMLINK
+
+ #elif defined(__RADANDROID__)
+ #define RADLINK
+ #define RADEXPLINK
+ #define RADEXPFUNC RADDEFFUNC
+ #define RADASMLINK
+ #elif defined(__RADNACL__)
+ #define RADLINK
+ #define RADEXPLINK
+ #define RADEXPFUNC RADDEFFUNC
+ #define RADASMLINK
+ #elif defined(__RADLINUX__) || defined (__RADQNX__)
+
+ #ifdef __RAD64__
+ #define RADLINK
+ #define RADEXPLINK
+ #else
+ #define RADLINK __attribute__((cdecl))
+ #define RADEXPLINK __attribute__((cdecl))
+ #endif
+
+ #define RADEXPFUNC RADDEFFUNC
+ #define RADASMLINK
+
+ #elif defined(__RADMAC__)
+
+ // this define is for CodeWarrior 11's stupid new libs (even though
+ // we don't use longlong's).
+
+ #define __MSL_LONGLONG_SUPPORT__
+
+ #define RADLINK
+ #define RADEXPLINK
+
+ #if defined(__CFM68K__) || defined(__MWERKS__)
+ #ifdef __RADINDLL__
+ #define RADEXPFUNC RADDEFFUNC __declspec(export)
+ #else
+ #define RADEXPFUNC RADDEFFUNC __declspec(import)
+ #endif
+ #else
+ #if defined(__RADMACH__) && !defined(__MWERKS__)
+ #ifdef __RADINDLL__
+ #define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default")))
+ #else
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+ #else
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+ #endif
+ #define RADASMLINK
+
+ #else
+
+ #ifdef __RADNT__
+ #ifndef _WIN32
+ #define _WIN32
+ #endif
+ #ifndef WIN32
+ #define WIN32
+ #endif
+ #endif
+
+ #ifdef __RADWIN__
+ #ifdef __RAD32__
+
+ #ifdef __RADXBOX__
+
+ #define RADLINK __stdcall
+ #define RADEXPLINK __stdcall
+ #define RADEXPFUNC RADDEFFUNC
+
+ #elif defined(__RADXENON__) || defined(__RADDURANGO__)
+
+ #define RADLINK __stdcall
+ #define RADEXPLINK __stdcall
+
+ #define RADEXPFUNC RADDEFFUNC
+
+ #elif defined(__RADWINRTAPI__)
+
+ #define RADLINK __stdcall
+ #define RADEXPLINK __stdcall
+
+ #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) )
+ #define RADEXPFUNC RADDEFFUNC
+ #else
+ #ifndef __RADINDLL__
+ #define RADEXPFUNC RADDEFFUNC __declspec(dllimport)
+ #else
+ #define RADEXPFUNC RADDEFFUNC __declspec(dllexport)
+ #endif
+ #endif
+
+ #elif defined(__RADNTBUILDLINUX__)
+
+ #define RADLINK __cdecl
+ #define RADEXPLINK __cdecl
+ #define RADEXPFUNC RADDEFFUNC
+
+ #else
+ #ifdef __RADNT__
+
+ #define RADLINK __stdcall
+ #define RADEXPLINK __stdcall
+
+ #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) )
+ #define RADEXPFUNC RADDEFFUNC
+ #else
+ #ifndef __RADINDLL__
+ #define RADEXPFUNC RADDEFFUNC __declspec(dllimport)
+ #ifdef __BORLANDC__
+ #if __BORLANDC__<=0x460
+ #undef RADEXPFUNC
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+ #endif
+ #else
+ #define RADEXPFUNC RADDEFFUNC __declspec(dllexport)
+ #endif
+ #endif
+ #else
+ #define RADLINK __pascal
+ #define RADEXPLINK __far __pascal
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+ #endif
+ #else
+ #define RADLINK __pascal
+ #define RADEXPLINK __far __pascal __export
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+ #else
+ #define RADLINK __pascal
+ #define RADEXPLINK __pascal
+ #define RADEXPFUNC RADDEFFUNC
+ #endif
+
+ #define RADASMLINK __cdecl
+
+ #endif
+
+ #if !defined(__RADXBOX__) && !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADXBOXONE__)
+ #ifdef __RADWIN__
+ #ifndef _WINDOWS
+ #define _WINDOWS
+ #endif
+ #endif
+ #endif
+
+ #ifdef __RADLITTLEENDIAN__
+ #ifdef __RADBIGENDIAN__
+ #error both endians !?
+ #endif
+ #endif
+
+ #if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__)
+ #error neither endian!
+ #endif
+
+
+ //-----------------------------------------------------------------
+
+ #ifndef RADDEFFUNC
+
+ #ifdef __cplusplus
+ #define RADDEFFUNC extern "C"
+ #define RADDEFSTART extern "C" {
+ #define RADDEFEND }
+ #define RADDEFINEDATA extern "C"
+ #define RADDECLAREDATA extern "C"
+ #define RADDEFAULT( val ) =val
+
+ #define RR_NAMESPACE rr
+ #define RR_NAMESPACE_START namespace RR_NAMESPACE {
+ #define RR_NAMESPACE_END };
+ #define RR_NAMESPACE_USE using namespace RR_NAMESPACE;
+
+ #else
+ #define RADDEFFUNC
+ #define RADDEFSTART
+ #define RADDEFEND
+ #define RADDEFINEDATA
+ #define RADDECLAREDATA extern
+ #define RADDEFAULT( val )
+
+ #define RR_NAMESPACE
+ #define RR_NAMESPACE_START
+ #define RR_NAMESPACE_END
+ #define RR_NAMESPACE_USE
+
+ #endif
+
+ #endif
+
+ // probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment)
+ #if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || defined(__RADPSP2__) || \
+ defined(__RADPS3__) || defined(__RADSPU__) || defined(__RADPS4__) || \
+ defined(__RADLINUX__) || defined(__RADMAC__)) || defined(__RADNDS__) || defined(__RAD3DS__) || \
+ defined(__RADIPHONE__) || defined(__RADANDROID__) || defined (__RADQNX__)
+ #define RAD_ALIGN(type,var,num) type __attribute__ ((aligned (num))) var
+ #elif (defined(__RADNGC__) || defined(__RADPS2__))
+ #define RAD_ALIGN(type,var,num) __attribute__ ((aligned (num))) type var
+ #elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__)
+ #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
+ #else
+ // NOTE: / / is a guaranteed parse error in C/C++.
+ #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
+ #endif
+
+ // WARNING : RAD_TLS should really only be used for debug/tools stuff
+ // it's not reliable because even if we are built as a lib, our lib can
+ // be put into a DLL and then it doesn't work
+ #if defined(__RADNT__) || defined(__RADXENON__)
+ #ifndef __RADINDLL__
+ // note that you can't use this in windows DLLs
+ #define RAD_TLS(type,var) __declspec(thread) type var
+ #endif
+ #elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__)
+ // works on PS3/gcc I believe :
+ #define RAD_TLS(type,var) __thread type var
+ #else
+ // RAD_TLS not defined
+ #endif
+
+ // Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer.
+ // The size of integers is specified explicitly in the code, i.e. u32 or whatever.
+
+ #define RAD_S8 signed char
+ #define RAD_U8 unsigned char
+
+ #if defined(__RAD64__)
+ // Remember that __RAD32__ will also be defined!
+ #if defined(__RADX64__)
+ // x64 still has 32-bit ints!
+ #define RAD_U32 unsigned int
+ #define RAD_S32 signed int
+ // But pointers are 64 bits.
+ #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
+ #define RAD_SINTa __w64 signed __int64
+ #define RAD_UINTa __w64 unsigned __int64
+ #else // non-vc.net compiler or /Wp64 turned off
+ #define RAD_UINTa unsigned long long
+ #define RAD_SINTa signed long long
+ #endif
+ #else
+ #error Unknown 64-bit processor (see radbase.h)
+ #endif
+ #elif defined(__RAD32__)
+ #define RAD_U32 unsigned int
+ #define RAD_S32 signed int
+ // Pointers are 32 bits.
+
+ #if ( ( defined(_MSC_VER) && (_MSC_VER >= 1300 ) ) && ( defined(_Wp64) && ( _Wp64 ) ) )
+ #define RAD_SINTa __w64 signed long
+ #define RAD_UINTa __w64 unsigned long
+ #else // non-vc.net compiler or /Wp64 turned off
+ #ifdef _Wp64
+ #define RAD_SINTa signed long
+ #define RAD_UINTa unsigned long
+ #else
+ #define RAD_SINTa signed int
+ #define RAD_UINTa unsigned int
+ #endif
+ #endif
+ #else
+ #define RAD_U32 unsigned long
+ #define RAD_S32 signed long
+ // Pointers in 16-bit land are still 32 bits.
+ #define RAD_UINTa unsigned long
+ #define RAD_SINTa signed long
+ #endif
+
+ #define RAD_F32 float
+ #if defined(__RADPS2__) || defined(__RADPSP__)
+ typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles
+ { // while using the same space
+ RAD_U32 vals[ 2 ];
+ } RAD_F64;
+ #define RAD_F64_OR_32 float // type is F64 if available, otherwise F32
+ #else
+ #define RAD_F64 double
+ #define RAD_F64_OR_32 double // type is F64 if available, otherwise F32
+ #endif
+
+ #if (defined(__RADMAC__) || defined(__MRC__) || defined( __RADNGC__ ) || \
+ defined(__RADLINUX__) || defined( __RADWII__ ) || defined(__RADWIIU__) || \
+ defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADPS4__) || \
+ defined(__RADSPU__) || defined(__RADIPHONE__) || defined(__RADNACL__) || defined( __RADANDROID__) || defined( __RADQNX__ ) )
+ #define RAD_U64 unsigned long long
+ #define RAD_S64 signed long long
+ #elif defined(__RADPS2__)
+ #define RAD_U64 unsigned long
+ #define RAD_S64 signed long
+ #elif defined(__RADARM__)
+ #define RAD_U64 unsigned long long
+ #define RAD_S64 signed long long
+ #elif defined(__RADX64__) || defined(__RAD32__)
+ #define RAD_U64 unsigned __int64
+ #define RAD_S64 signed __int64
+ #else
+ // 16-bit
+ typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
+ { // while using the same space
+ RAD_U32 vals[ 2 ];
+ } RAD_U64;
+ typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s
+ { // while using the same space
+ RAD_S32 vals[ 2 ];
+ } RAD_S64;
+ #endif
+
+ #if defined(__RAD32__)
+ #define PTR4
+ #define RAD_U16 unsigned short
+ #define RAD_S16 signed short
+ #else
+ #define PTR4 __far
+ #define RAD_U16 unsigned int
+ #define RAD_S16 signed int
+ #endif
+
+ //-------------------------------------------------
+ // RAD_PTRBITS and such defined here without using sizeof()
+ // so that they can be used in align() and other macros
+
+ #ifdef __RAD64__
+
+ #define RAD_PTRBITS 64
+ #define RAD_PTRBYTES 8
+ #define RAD_TWOPTRBYTES 16
+
+ #else
+
+ #define RAD_PTRBITS 32
+ #define RAD_PTRBYTES 4
+ #define RAD_TWOPTRBYTES 8
+
+ #endif
+
+
+ //-------------------------------------------------
+ // UINTr = int the size of a register
+
+ #ifdef __RAD64REGS__
+
+ #define RAD_UINTr RAD_U64
+ #define RAD_SINTr RAD_S64
+
+ #else
+
+ #define RAD_UINTr RAD_U32
+ #define RAD_SINTr RAD_S32
+
+ #endif
+
+ //===========================================================================
+
+ /*
+ // CB : meh this is enough of a mess that it's probably best to just let each
+ #if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300
+ #define __RADX86INTRIN2003__
+ #endif
+ */
+
+ // RADASSUME(expr) tells the compiler that expr is always true
+ // RADUNREACHABLE must never be reachable - even in event of error
+ // eg. it's okay for compiler to generate completely invalid code after RADUNREACHABLE
+
+ #ifdef _MSC_VER
+ #define RADFORCEINLINE __forceinline
+ #if _MSC_VER >= 1300
+ #define RADNOINLINE __declspec(noinline)
+ #else
+ #define RADNOINLINE
+ #endif
+ #define RADUNREACHABLE __assume(0)
+ #define RADASSUME(exp) __assume(exp)
+ #elif defined(__clang__)
+ #ifdef _DEBUG
+ #define RADFORCEINLINE inline
+ #else
+ #define RADFORCEINLINE inline __attribute((always_inline))
+ #endif
+ #define RADNOINLINE __attribute__((noinline))
+
+ #define RADUNREACHABLE __builtin_unreachable()
+
+ #if __has_builtin(__builtin_assume)
+ #define RADASSUME(exp) __builtin_assume(exp)
+ #else
+ #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); )
+ #endif
+ #elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID)
+ #ifdef _DEBUG
+ #define RADFORCEINLINE inline
+ #else
+ #define RADFORCEINLINE inline __attribute((always_inline))
+ #endif
+ #define RADNOINLINE __attribute__((noinline))
+
+ #if __RAD_GCC_VERSION__ >= 40500
+ #define RADUNREACHABLE __builtin_unreachable()
+ #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); )
+ #else
+ #define RADUNREACHABLE RAD_INFINITE_LOOP( RR_BREAK(); )
+ #define RADASSUME(exp)
+ #endif
+ #elif defined(__CWCC__)
+ #define RADFORCEINLINE inline
+ #define RADNOINLINE __attribute__((never_inline))
+ #define RADUNREACHABLE
+ #define RADASSUME(x) (void)0
+ #else
+ // ? #define RADFORCEINLINE ?
+ #define RADFORCEINLINE inline
+ #define RADNOINLINE
+ #define RADASSUME(x) (void)0
+ #endif
+
+ //===========================================================================
+
+ // RAD_ALIGN_HINT tells the compiler how a given pointer is aligned
+ // it *must* be true, but the compiler may or may not use that information
+ // it is not for cases where the pointer is to an inherently aligned data type,
+ // it's when the compiler cannot tell the alignment but you have extra information.
+ // eg :
+ // U8 * ptr = rrMallocAligned(256,16);
+ // RAD_ALIGN_HINT(ptr,16,0);
+
+ #ifdef __RADSPU__
+ #define RAD_ALIGN_HINT(ptr,alignment,offset) __align_hint(ptr,alignment,offset); RR_ASSERT( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) )
+ #else
+ #define RAD_ALIGN_HINT(ptr,alignment,offset) RADASSUME( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) )
+ #endif
+
+ //===========================================================================
+
+ // RAD_EXPECT is to tell the compiler the *likely* value of an expression
+ // different than RADASSUME in that expr might not have that value
+ // it's use for branch code layout and static branch prediction
+ // condition can technically be a variable but should usually be 0 or 1
+
+ #if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__)
+
+ // __builtin_expect returns value of expr
+ #define RAD_EXPECT(expr,cond) __builtin_expect(expr,cond)
+
+ #else
+
+ #define RAD_EXPECT(expr,cond) (expr)
+
+ #endif
+
+ // helpers for doing an if ( ) with expect :
+ // if ( RAD_LIKELY(expr) ) { ... }
+
+ #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
+ #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
+
+ //===========================================================================
+
+ // __RADX86ASM__ means you can use __asm {} style inline assembly
+ #if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER)
+ #define __RADX86ASM__
+ #endif
+
+ //-------------------------------------------------
+ // typedefs :
+
+ #ifndef RADNOTYPEDEFS
+
+ #ifndef S8_DEFINED
+ #define S8_DEFINED
+ typedef RAD_S8 S8;
+ #endif
+
+ #ifndef U8_DEFINED
+ #define U8_DEFINED
+ typedef RAD_U8 U8;
+ #endif
+
+ #ifndef S16_DEFINED
+ #define S16_DEFINED
+ typedef RAD_S16 S16;
+ #endif
+
+ #ifndef U16_DEFINED
+ #define U16_DEFINED
+ typedef RAD_U16 U16;
+ #endif
+
+ #ifndef S32_DEFINED
+ #define S32_DEFINED
+ typedef RAD_S32 S32;
+ #endif
+
+ #ifndef U32_DEFINED
+ #define U32_DEFINED
+ typedef RAD_U32 U32;
+ #endif
+
+ #ifndef S64_DEFINED
+ #define S64_DEFINED
+ typedef RAD_S64 S64;
+ #endif
+
+ #ifndef U64_DEFINED
+ #define U64_DEFINED
+ typedef RAD_U64 U64;
+ #endif
+
+ #ifndef F32_DEFINED
+ #define F32_DEFINED
+ typedef RAD_F32 F32;
+ #endif
+
+ #ifndef F64_DEFINED
+ #define F64_DEFINED
+ typedef RAD_F64 F64;
+ #endif
+
+ #ifndef F64_OR_32_DEFINED
+ #define F64_OR_32_DEFINED
+ typedef RAD_F64_OR_32 F64_OR_32;
+ #endif
+
+ // UINTa and SINTa are the ints big enough for an address
+
+ #ifndef SINTa_DEFINED
+ #define SINTa_DEFINED
+ typedef RAD_SINTa SINTa;
+ #endif
+
+ #ifndef UINTa_DEFINED
+ #define UINTa_DEFINED
+ typedef RAD_UINTa UINTa;
+ #endif
+
+ #ifndef UINTr_DEFINED
+ #define UINTr_DEFINED
+ typedef RAD_UINTr UINTr;
+ #endif
+
+ #ifndef SINTr_DEFINED
+ #define SINTr_DEFINED
+ typedef RAD_SINTr SINTr;
+ #endif
+
+ #elif !defined(RADNOTYPEDEFINES)
+
+ #ifndef S8_DEFINED
+ #define S8_DEFINED
+ #define S8 RAD_S8
+ #endif
+
+ #ifndef U8_DEFINED
+ #define U8_DEFINED
+ #define U8 RAD_U8
+ #endif
+
+ #ifndef S16_DEFINED
+ #define S16_DEFINED
+ #define S16 RAD_S16
+ #endif
+
+ #ifndef U16_DEFINED
+ #define U16_DEFINED
+ #define U16 RAD_U16
+ #endif
+
+ #ifndef S32_DEFINED
+ #define S32_DEFINED
+ #define S32 RAD_S32
+ #endif
+
+ #ifndef U32_DEFINED
+ #define U32_DEFINED
+ #define U32 RAD_U32
+ #endif
+
+ #ifndef S64_DEFINED
+ #define S64_DEFINED
+ #define S64 RAD_S64
+ #endif
+
+ #ifndef U64_DEFINED
+ #define U64_DEFINED
+ #define U64 RAD_U64
+ #endif
+
+ #ifndef F32_DEFINED
+ #define F32_DEFINED
+ #define F32 RAD_F32
+ #endif
+
+ #ifndef F64_DEFINED
+ #define F64_DEFINED
+ #define F64 RAD_F64
+ #endif
+
+ #ifndef F64_OR_32_DEFINED
+ #define F64_OR_32_DEFINED
+ #define F64_OR_32 RAD_F64_OR_32
+ #endif
+
+ // UINTa and SINTa are the ints big enough for an address (pointer)
+ #ifndef SINTa_DEFINED
+ #define SINTa_DEFINED
+ #define SINTa RAD_SINTa
+ #endif
+
+ #ifndef UINTa_DEFINED
+ #define UINTa_DEFINED
+ #define UINTa RAD_UINTa
+ #endif
+
+ #ifndef UINTr_DEFINED
+ #define UINTr_DEFINED
+ #define UINTr RAD_UINTr
+ #endif
+
+ #ifndef SINTr_DEFINED
+ #define SINTr_DEFINED
+ #define SINTr RAD_SINTr
+ #endif
+
+ #endif
+
+ /// Some error-checking.
+ #if defined(__RAD64__) && !defined(__RAD32__)
+ // See top of file for why this is.
+ #error __RAD64__ must not be defined without __RAD32__ (see radbase.h)
+ #endif
+
+#ifdef _MSC_VER
+ // microsoft compilers
+
+ #if _MSC_VER >= 1400
+ #define RAD_STATEMENT_START \
+ do {
+
+ #define RAD_STATEMENT_END_FALSE \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4127)) \
+ } while(0) \
+ __pragma(warning(pop))
+
+ #define RAD_STATEMENT_END_TRUE \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4127)) \
+ } while(1) \
+ __pragma(warning(pop))
+
+ #else
+ #define RAD_USE_STANDARD_LOOP_CONSTRUCT
+ #endif
+#else
+ #define RAD_USE_STANDARD_LOOP_CONSTRUCT
+#endif
+
+#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
+ #define RAD_STATEMENT_START \
+ do {
+
+ #define RAD_STATEMENT_END_FALSE \
+ } while ( (void)0,0 )
+
+ #define RAD_STATEMENT_END_TRUE \
+ } while ( (void)1,1 )
+
+#endif
+
+#define RAD_STATEMENT_WRAPPER( code ) \
+ RAD_STATEMENT_START \
+ code \
+ RAD_STATEMENT_END_FALSE
+
+#define RAD_INFINITE_LOOP( code ) \
+ RAD_STATEMENT_START \
+ code \
+ RAD_STATEMENT_END_TRUE
+
+
+// Must be placed after variable declarations for code compiled as .c
+#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
+# define RR_UNUSED_VARIABLE(x) (void) x
+#else
+# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
+#endif
+
+//-----------------------------------------------
+// RR_UINT3264 is a U64 in 64-bit code and a U32 in 32-bit code
+// eg. it's pointer sized and the same type as a U32/U64 of the same size
+//
+// @@ CB 05/21/2012 : I think RR_UINT3264 may be deprecated
+// it was useful back when UINTa was /Wp64
+// but since we removed that maybe it's not anymore ?
+//
+
+#ifdef __RAD64__
+#define RR_UINT3264 U64
+#else
+#define RR_UINT3264 U32
+#endif
+
+//RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) );
+
+//--------------------------------------------------
+
+// RR_LINESTRING is the current line number as a string
+#define RR_STRINGIZE( L ) #L
+#define RR_DO_MACRO( M, X ) M(X)
+#define RR_STRINGIZE_DELAY( X ) RR_DO_MACRO( RR_STRINGIZE, X )
+#define RR_LINESTRING RR_STRINGIZE_DELAY( __LINE__ )
+
+#define RR_CAT(X,Y) X ## Y
+
+// RR_STRING_JOIN joins strings in the preprocessor and works with LINESTRING
+#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2)
+#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2)
+#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2
+
+// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to declare
+// variable names and they won't conflict with each other
+// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works
+
+#ifdef _MSC_VER
+ #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__COUNTER__)
+#else
+ #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__LINE__)
+#endif
+
+//--------------------------------------------------
+// current plan is to use "rrbool" with plain old "true" and "false"
+// if true and false give us trouble we might have to go to rrtrue and rrfalse
+// BTW there's a danger for evil bugs here !! If you're checking == true
+// then the rrbool must be set to exactly "1" not just "not zero" !!
+
+#ifndef RADNOTYPEDEFS
+ #ifndef RRBOOL_DEFINED
+ #define RRBOOL_DEFINED
+ typedef S32 rrbool;
+ typedef S32 RRBOOL;
+ #endif
+#elif !defined(RADNOTYPEDEFINES)
+ #ifndef RRBOOL_DEFINED
+ #define RRBOOL_DEFINED
+ #define rrbool S32
+ #define RRBOOL S32
+ #endif
+#endif
+
+//--------------------------------------------------
+// Range macros
+
+ #ifndef RR_MIN
+ #define RR_MIN(a,b) ( (a) < (b) ? (a) : (b) )
+ #endif
+
+ #ifndef RR_MAX
+ #define RR_MAX(a,b) ( (a) > (b) ? (a) : (b) )
+ #endif
+
+ #ifndef RR_ABS
+ #define RR_ABS(a) ( ((a) < 0) ? -(a) : (a) )
+ #endif
+
+ #ifndef RR_CLAMP
+ #define RR_CLAMP(val,lo,hi) RR_MAX( RR_MIN(val,hi), lo )
+ #endif
+
+//--------------------------------------------------
+// Data layout macros
+
+ #define RR_ARRAY_SIZE(array) ( sizeof(array)/sizeof(array[0]) )
+
+ // MEMBER_OFFSET tells you the offset of a member in a type
+ #ifdef __RAD3DS__
+ #define RR_MEMBER_OFFSET(type,member) (unsigned int)(( (char *) &(((type *)0)->member) - (char *) 0 ))
+ #elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADSPU__)
+ // offsetof() gets mucked with by system headers on android, making things dependent on #include order.
+ #define RR_MEMBER_OFFSET(type,member) __builtin_offsetof(type, member)
+ #elif defined(__RADLINUX__)
+ #define RR_MEMBER_OFFSET(type,member) (offsetof(type, member))
+ #else
+ #define RR_MEMBER_OFFSET(type,member) ( (size_t) (UINTa) &(((type *)0)->member) )
+ #endif
+
+ // MEMBER_SIZE tells you the size of a member in a type
+ #define RR_MEMBER_SIZE(type,member) ( sizeof( ((type *) 0)->member) )
+
+ // just to make gcc shut up about derefing null :
+ #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
+ #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
+
+ // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
+ // you should then RR_ASSERT( &(ret->member) == ptr );
+ #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
+
+//--------------------------------------------------
+// Cache / prefetch macros :
+
+// RR_PREFETCH for various platforms :
+//
+// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
+// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
+// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
+// (may be a no-op, may be a normal prefetch, may zero memory)
+// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't do it past the end of buffers
+
+#ifdef __RADX86__
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // nop
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop
+
+#elif defined(__RADXENON__)
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((int)(offset),(void *)(ptr))
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz128((int)(offset),(void *)(ptr))
+
+#elif defined(__RADPS3__)
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((char *)(ptr) + (int)(offset))
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz((char *)(ptr) + (int)(offset))
+
+#elif defined(__RADSPU__)
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop
+
+#elif defined(__RADWII__) || defined(__RADWIIU__)
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP for now
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop
+
+#elif defined(__RAD3DS__)
+
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __pld((char *)(ptr) + (int)(offset))
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __pldw((char *)(ptr) + (int)(offset))
+
+#else
+
+// other platform
+#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // need_prefetch // compile error
+#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // need_writezero // error
+
+#endif
+
+//--------------------------------------------------
+// LIGHTWEIGHT ASSERTS without rrAssert.h
+
+RADDEFSTART
+
+// set up RR_BREAK :
+
+ #ifdef __RADNGC__
+
+ #define RR_BREAK() asm(" .long 0x00000001")
+ #define RR_CACHE_LINE_SIZE xxx
+
+ #elif defined(__RADWII__)
+
+ #define RR_BREAK() __asm__ volatile("trap")
+ #define RR_CACHE_LINE_SIZE 32
+
+ #elif defined(__RADWIIU__)
+
+ #define RR_BREAK() asm("trap")
+ #define RR_CACHE_LINE_SIZE 32
+
+ #elif defined(__RAD3DS__)
+
+ #define RR_BREAK() *((int volatile*)0)=0
+ #define RR_CACHE_LINE_SIZE 32
+
+ #elif defined(__RADNDS__)
+
+ #define RR_BREAK() asm("BKPT 0")
+ #define RR_CACHE_LINE_SIZE xxx
+
+ #elif defined(__RADPS2__)
+
+ #define RR_BREAK() __asm__ volatile("break")
+ #define RR_CACHE_LINE_SIZE 64
+
+ #elif defined(__RADPSP__)
+
+ #define RR_BREAK() __asm__("break 0")
+ #define RR_CACHE_LINE_SIZE 64
+
+ #elif defined(__RADPSP2__)
+
+ #define RR_BREAK() { __asm__ volatile("bkpt 0x0000"); }
+ #define RR_CACHE_LINE_SIZE 32
+
+ #elif defined (__RADQNX__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 32
+ #elif defined (__RADARM__) && defined (__RADLINUX__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 32
+ #elif defined(__RADSPU__)
+
+ #define RR_BREAK() __asm volatile ("stopd 0,1,1")
+ #define RR_CACHE_LINE_SIZE 128
+
+ #elif defined(__RADPS3__)
+
+ // #ifdef snPause // in LibSN.h
+ // snPause
+ // __asm__ volatile ( "tw 31,1,1" )
+
+ #define RR_BREAK() __asm__ volatile ( "tw 31,1,1" )
+ //#define RR_BREAK() __asm__ volatile("trap");
+
+ #define RR_CACHE_LINE_SIZE 128
+
+ #elif defined(__RADMAC__)
+
+ #if defined(__GNUG__) || defined(__GNUC__)
+ #ifdef __RADX86__
+ #define RR_BREAK() __asm__ volatile ( "int $3" )
+ #else
+ #define RR_BREAK() __builtin_trap()
+ #endif
+ #else
+ #ifdef __RADMACH__
+ void DebugStr(unsigned char const *);
+ #else
+ void pascal DebugStr(unsigned char const *);
+ #endif
+ #define RR_BREAK() DebugStr("\pRR_BREAK() was called")
+ #endif
+
+ #define RR_CACHE_LINE_SIZE 64
+
+ #elif defined(__RADIPHONE__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 32
+ #elif defined(__RADXENON__)
+ #define RR_BREAK() __debugbreak()
+ #define RR_CACHE_LINE_SIZE 128
+ #elif defined(__RADANDROID__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 32
+ #elif defined(__RADPS4__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 64
+ #elif defined(__RADNACL__)
+ #define RR_BREAK() __builtin_trap()
+ #define RR_CACHE_LINE_SIZE 64
+ #else
+ // x86 :
+ #define RR_CACHE_LINE_SIZE 64
+
+ #ifdef __RADLINUX__
+ #define RR_BREAK() __asm__ volatile ( "int $3" )
+ #elif defined(__WATCOMC__)
+
+ void RR_BREAK( void );
+ #pragma aux RR_BREAK = "int 0x3";
+
+ #elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300
+
+ #define RR_BREAK __debugbreak
+
+ #else
+
+ #define RR_BREAK() RAD_STATEMENT_WRAPPER( __asm {int 3} )
+
+ #endif
+
+ #endif
+
+// simple RR_ASSERT :
+
+// CB 5-27-10 : use RR_DO_ASSERTS to toggle asserts on and off :
+#if (defined(_DEBUG) && !defined(NDEBUG)) || defined(ASSERT_IN_RELEASE)
+ #define RR_DO_ASSERTS
+#endif
+
+/*********
+
+rrAsserts :
+
+RR_ASSERT(exp) - the normal assert thing, toggled with RR_DO_ASSERTS
+RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds (including final!)
+RR_ASSERT_RELEASE(exp) - assert that you want to test even in release builds (not for final!)
+RR_ASSERT_LITE(exp) - normal assert is not safe from threads or inside malloc; use this instead
+RR_DURING_ASSERT(exp) - wrap operations that compute stuff for assert in here
+RR_DO_ASSERTS - toggle tells you if asserts are enabled or not
+
+RR_BREAK() - generate a debug break - always !
+RR_ASSERT_BREAK() - RR_BREAK for asserts ; disable with RAD_NO_BREAK
+
+RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no condition
+RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds too
+RR_CANT_GET_HERE() - put in spots execution should never go
+RR_COMPILER_ASSERT(exp) - checks constant conditions at compile time
+
+RADTODO - note to search for nonfinal stuff
+RR_PRAGMA_MESSAGE - message dealy, use with #pragma in MSVC
+
+*************/
+
+//-----------------------------------------------------------
+
+
+#if defined(__GNUG__) || defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER > 1200)
+ #define RR_FUNCTION_NAME __FUNCTION__
+#else
+ #define RR_FUNCTION_NAME 0
+
+ // __func__ is in the C99 standard
+#endif
+
+//-----------------------------------------------------------
+
+// rrDisplayAssertion might just log, or it might pop a message box, depending on settings
+// rrDisplayAssertion returns whether you should break or not
+typedef rrbool (RADLINK fp_rrDisplayAssertion)(int * Ignored, const char * fileName,const int line,const char * function,const char * message);
+
+extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
+
+// if I have func pointer, call it, else true ; true = do int 3
+#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
+
+//-----------------------------------------------------------
+
+// RAD_NO_BREAK : option if you don't like your assert to break
+// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
+#ifdef RAD_NO_BREAK
+#define RR_ASSERT_BREAK() 0
+#else
+#define RR_ASSERT_BREAK() RR_BREAK()
+#endif
+
+// assert_always is on FINAL !
+#define RR_ASSERT_ALWAYS(exp) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( ! (exp) ) { if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,#exp) ) RR_ASSERT_BREAK(); } )
+
+// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, you're bad
+#define RR_ASSERT_FAILURE_ALWAYS(str) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,str) ) RR_ASSERT_BREAK(); )
+
+#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
+
+//-----------------------------------
+#ifdef RR_DO_ASSERTS
+
+#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
+#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
+#define RR_ASSERT_NO_ASSUME(exp) RR_ASSERT_ALWAYS(exp)
+// RR_DURING_ASSERT is to set up expressions or declare variables that are only used in asserts
+#define RR_DURING_ASSERT(exp) exp
+
+#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str)
+
+// RR_CANT_GET_HERE is for like defaults in switches that should never be hit
+#define RR_CANT_GET_HERE() RAD_STATEMENT_WRAPPER( RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE; )
+
+
+#else // RR_DO_ASSERTS //-----------------------------------
+
+#define RR_ASSERT(exp) (void)0
+#define RR_ASSERT_LITE(exp) (void)0
+#define RR_ASSERT_NO_ASSUME(exp) (void)0
+
+#define RR_DURING_ASSERT(exp) (void)0
+
+#define RR_ASSERT_FAILURE(str) (void)0
+
+#define RR_CANT_GET_HERE() RADUNREACHABLE
+
+#endif // RR_DO_ASSERTS //-----------------------------------
+
+//=================================================================
+
+// RR_ASSERT_RELEASE is on in release build, but not final
+
+#ifndef __RADFINAL__
+
+#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp)
+#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp)
+
+#else
+
+#define RR_ASSERT_RELEASE(exp) (void)0
+#define RR_ASSERT_LITE_RELEASE(exp) (void)0
+
+#endif
+
+// BH: This never gets compiled away except for __RADFINAL__
+#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE
+
+#define rrAssert RR_ASSERT
+#define rrassert RR_ASSERT
+
+#ifdef _MSC_VER
+ // without this, our assert errors...
+ #if _MSC_VER >= 1300
+ #pragma warning( disable : 4127) // conditional expression is constant
+ #endif
+#endif
+
+//---------------------------------------
+// Get/Put from memory in little or big endian :
+//
+// val = RR_GET32_BE(ptr)
+// RR_PUT32_BE(ptr,val)
+//
+// available here :
+// RR_[GET/PUT][16/32]_[BE/LE][_UNALIGNED][_OFFSET]
+//
+// if you don't specify _UNALIGNED , then ptr & offset shoud both be aligned to type size
+// _OFFSET is in *bytes* !
+
+// you can #define RR_GET_RESTRICT to make all RR_GETs be RESTRICT
+// if you set nothing they are not
+
+#ifdef RR_GET_RESTRICT
+#define RR_GET_PTR_POST RADRESTRICT
+#endif
+#ifndef RR_GET_PTR_POST
+#define RR_GET_PTR_POST
+#endif
+
+// native version of get/put is always trivial :
+
+#define RR_GET16_NATIVE(ptr) *((const U16 * RR_GET_PTR_POST)(ptr))
+#define RR_PUT16_NATIVE(ptr,val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val)
+
+// offset is in bytes
+#define RR_U16_PTR_OFFSET(ptr,offset) ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+#define RR_GET16_NATIVE_OFFSET(ptr,offset) *( RR_U16_PTR_OFFSET((ptr),offset) )
+#define RR_PUT16_NATIVE_OFFSET(ptr,val,offset) *( RR_U16_PTR_OFFSET((ptr),offset)) = (val)
+
+#define RR_GET32_NATIVE(ptr) *((const U32 * RR_GET_PTR_POST)(ptr))
+#define RR_PUT32_NATIVE(ptr,val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val)
+
+// offset is in bytes
+#define RR_U32_PTR_OFFSET(ptr,offset) ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+#define RR_GET32_NATIVE_OFFSET(ptr,offset) *( RR_U32_PTR_OFFSET((ptr),offset) )
+#define RR_PUT32_NATIVE_OFFSET(ptr,val,offset) *( RR_U32_PTR_OFFSET((ptr),offset)) = (val)
+
+#define RR_GET64_NATIVE(ptr) *((const U64 * RR_GET_PTR_POST)(ptr))
+#define RR_PUT64_NATIVE(ptr,val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val)
+
+// offset is in bytes
+#define RR_U64_PTR_OFFSET(ptr,offset) ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+#define RR_GET64_NATIVE_OFFSET(ptr,offset) *( RR_U64_PTR_OFFSET((ptr),offset) )
+#define RR_PUT64_NATIVE_OFFSET(ptr,val,offset) *( RR_U64_PTR_OFFSET((ptr),offset)) = (val)
+
+//---------------------------------------------------
+
+#ifdef __RADLITTLEENDIAN__
+
+#define RR_GET16_LE RR_GET16_NATIVE
+#define RR_PUT16_LE RR_PUT16_NATIVE
+#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET
+#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET
+
+#define RR_GET32_LE RR_GET32_NATIVE
+#define RR_PUT32_LE RR_PUT32_NATIVE
+#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET
+#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET
+
+#define RR_GET64_LE RR_GET64_NATIVE
+#define RR_PUT64_LE RR_PUT64_NATIVE
+#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET
+#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET
+
+#else
+
+#define RR_GET16_BE RR_GET16_NATIVE
+#define RR_PUT16_BE RR_PUT16_NATIVE
+#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET
+#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET
+
+#define RR_GET32_BE RR_GET32_NATIVE
+#define RR_PUT32_BE RR_PUT32_NATIVE
+#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET
+#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET
+
+#define RR_GET64_BE RR_GET64_NATIVE
+#define RR_PUT64_BE RR_PUT64_NATIVE
+#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET
+#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET
+
+#endif
+
+//-------------------------
+// non-native Get/Put implementations go here :
+
+#if defined(__RADX86__)
+// good implementation for X86 :
+
+#if (_MSC_VER >= 1300)
+
+unsigned short __cdecl _byteswap_ushort (unsigned short _Short);
+unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
+#pragma intrinsic(_byteswap_ushort, _byteswap_ulong)
+
+#define RR_BSWAP16 _byteswap_ushort
+#define RR_BSWAP32 _byteswap_ulong
+
+unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
+#pragma intrinsic(_byteswap_uint64)
+#define RR_BSWAP64 _byteswap_uint64
+
+#elif defined(_MSC_VER) // VC6
+
+RADFORCEINLINE unsigned long RR_BSWAP16 (unsigned long _Long)
+{
+ __asm {
+ mov eax, [_Long]
+ rol ax, 8
+ mov [_Long], eax;
+ }
+ return _Long;
+}
+
+RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
+{
+ __asm {
+ mov eax, [_Long]
+ bswap eax
+ mov [_Long], eax
+ }
+ return _Long;
+}
+
+RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
+{
+ __asm {
+ mov eax, DWORD PTR _Long
+ mov edx, DWORD PTR _Long+4
+ bswap eax
+ bswap edx
+ mov DWORD PTR _Long, edx
+ mov DWORD PTR _Long+4, eax
+ }
+ return _Long;
+}
+
+#elif defined(__GNUC__) || defined(__clang__)
+
+// GCC has __builtin_bswap16, but Clang only seems to have added it recently.
+// We use __builtin_bswap32/64 but 16 just uses the macro version. (No big
+// deal if that turns into shifts anyway)
+#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) )
+#define RR_BSWAP32 __builtin_bswap32
+#define RR_BSWAP64 __builtin_bswap64
+
+#endif
+
+#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = (U16) RR_BSWAP16(val)
+#define RR_GET16_BE_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr,offset))
+#define RR_PUT16_BE_OFFSET(ptr,val,offset) *RR_U16_PTR_OFFSET(ptr,offset) = RR_BSWAP16(val)
+
+#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+#define RR_GET32_BE_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr,offset))
+#define RR_PUT32_BE_OFFSET(ptr,val,offset) *RR_U32_PTR_OFFSET(ptr,offset) = RR_BSWAP32(val)
+
+#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr)))
+#define RR_PUT64_BE(ptr,val) *((U64 *)(ptr)) = RR_BSWAP64(val)
+#define RR_GET64_BE_OFFSET(ptr,offset) RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr,offset))
+#define RR_PUT64_BE_OFFSET(ptr,val,offset) *RR_U64_PTR_OFFSET(ptr,offset) = RR_BSWAP64(val)
+
+// end _MSC_VER
+
+#elif defined(__RADXENON__) // Xenon has built-in funcs for this
+
+unsigned short __loadshortbytereverse(int offset, const void *base);
+unsigned long __loadwordbytereverse (int offset, const void *base);
+
+void __storeshortbytereverse(unsigned short val, int offset, void *base);
+void __storewordbytereverse (unsigned int val, int offset, void *base);
+
+#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr)
+#define RR_PUT16_LE(ptr,val) __storeshortbytereverse((U16) (val), 0, ptr)
+
+#define RR_GET16_LE_OFFSET(ptr,offset) __loadshortbytereverse(offset, ptr)
+#define RR_PUT16_LE_OFFSET(ptr,val,offset) __storeshortbytereverse((U16) (val), offset, ptr)
+
+#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr)
+#define RR_PUT32_LE(ptr,val) __storewordbytereverse((U32) (val), 0, ptr)
+
+#define RR_GET32_LE_OFFSET(ptr,offset) __loadwordbytereverse(offset, ptr)
+#define RR_PUT32_LE_OFFSET(ptr,val,offset) __storewordbytereverse((U32) (val), offset, ptr)
+
+#define RR_GET64_LE(ptr) ( ((U64)RR_GET32_OFFSET_LE(ptr,4)<<32) | RR_GET32_LE(ptr) )
+#define RR_PUT64_LE(ptr,val) RR_PUT32_LE(ptr, (U32) (val)), RR_PUT32_OFFSET_LE(ptr, (U32) ((val)>>32),4)
+
+#elif defined(__RADPS3__)
+
+#include <ppu_intrinsics.h>
+
+#define RR_GET16_LE(ptr) __lhbrx(ptr)
+#define RR_PUT16_LE(ptr,val) __sthbrx(ptr, (U16) (val))
+
+#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset))
+#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16) (val))
+
+#define RR_GET32_LE(ptr) __lwbrx(ptr)
+#define RR_PUT32_LE(ptr,val) __stwbrx(ptr, (U32) (val))
+
+#define RR_GET64_LE(ptr) __ldbrx(ptr)
+#define RR_PUT64_LE(ptr,val) __stdbrx(ptr, (U32) (val))
+
+#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset))
+#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32) (val))
+
+#elif defined(__RADWII__)
+
+#define RR_GET16_LE(ptr) __lhbrx(ptr, 0)
+#define RR_PUT16_LE(ptr,val) __sthbrx((U16) (val), ptr, 0)
+
+#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(ptr, offset)
+#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx((U16) (val), ptr, offset)
+
+#define RR_GET32_LE(ptr) __lwbrx(ptr, 0)
+#define RR_PUT32_LE(ptr,val) __stwbrx((U32) (val), ptr, 0)
+
+#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(ptr, offset)
+#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx((U32) (val), ptr, offset)
+
+#elif defined(__RAD3DS__)
+
+#define RR_GET16_BE(ptr) __rev16(*(U16 *) (ptr))
+#define RR_PUT16_BE(ptr,val) *(U16 *) (ptr) = __rev16(val)
+
+#define RR_GET16_BE_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET(ptr,offset))
+#define RR_PUT16_BE_OFFSET(ptr,offset,val) *RR_U16_PTR_OFFSET(ptr,offset) = __rev16(val)
+
+#define RR_GET32_BE(ptr) __rev(*(U32 *) (ptr))
+#define RR_PUT32_BE(ptr,val) *(U32 *) (ptr) = __rev(val)
+
+#define RR_GET32_BE_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET(ptr,offset))
+#define RR_PUT32_BE_OFFSET(ptr,offset,val) *RR_U32_PTR_OFFSET(ptr,offset) = __rev(val)
+
+#elif defined(__RADIPHONE__)
+
+// iPhone does not seem to have intrinsics for this, so use generic fallback!
+
+// Bswap is just here for use of implementing get/put
+// caller should use Get/Put , not bswap
+#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) )
+#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) )
+
+#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val)
+
+#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+
+#elif defined(__RADWIIU__)
+
+#include <ppc_ghs.h>
+
+#define RR_GET16_LE(ptr) (*(__bytereversed U16 *) (ptr))
+#define RR_PUT16_LE(ptr,val) *(__bytereversed U16 *) (ptr) = val
+
+#define RR_GET16_LE_OFFSET(ptr,offset) (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset))
+#define RR_PUT16_LE_OFFSET(ptr,val,offset) *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset) = val
+
+#define RR_GET32_LE(ptr) (*(__bytereversed U32 *) (ptr))
+#define RR_PUT32_LE(ptr,val) *(__bytereversed U32 *) (ptr) = val
+
+#define RR_GET32_LE_OFFSET(ptr,offset) (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset))
+#define RR_PUT32_LE_OFFSET(ptr,val,offset) *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset) = val
+
+#define RR_GET64_LE(ptr) (*(__bytereversed U64 *) (ptr))
+#define RR_PUT64_LE(ptr,val) *(__bytereversed U64 *) (ptr) = val
+
+#define RR_GET64_LE_OFFSET(ptr,offset) (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset))
+#define RR_PUT64_LE_OFFSET(ptr,val,offset) *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset) = val
+
+#elif defined(__RADWINRTAPI__) && defined(__RADARM__)
+
+#include <intrin.h>
+
+#define RR_BSWAP16(u16) _arm_rev16(u16)
+#define RR_BSWAP32(u32) _arm_rev(u32)
+
+#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val)
+
+#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+
+#elif defined(__RADPSP2__)
+
+// no rev16 exposed
+#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) )
+#define RR_BSWAP32(u32) __builtin_rev(u32)
+
+#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val)
+
+#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+
+#else // other platforms ?
+
+// fall back :
+
+// Bswap is just here for use of implementing get/put
+// caller should use Get/Put , not bswap
+#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) )
+#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) )
+#define RR_BSWAP64(u64) ( ((U64) RR_BSWAP32((U32) (u64)) << 32) | (U64) RR_BSWAP32((U32) ((u64) >> 32)) )
+
+#ifdef __RADLITTLEENDIAN__
+
+// comment out fallbacks so users will get errors
+//#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+//#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val)
+//#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+//#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+
+#else
+
+// comment out fallbacks so users will get errors
+//#define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr)))
+//#define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val)
+//#define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr)))
+//#define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val)
+
+#endif
+
+#endif
+
+//===================================================================
+// @@ TEMP : Aliases for old names : remove me when possible :
+
+#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET
+#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET
+#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET
+#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET
+#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET
+#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET
+#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET
+#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET
+
+
+//===================================================================
+// UNALIGNED VERSIONS :
+
+#if defined(__RADX86__) || defined(__RADPPC__) // platforms where unaligned is fast :
+
+#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr)
+#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_BE_OFFSET(ptr,offset)
+#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr)
+#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_BE_OFFSET(ptr,offset)
+
+#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr)
+#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_LE_OFFSET(ptr,offset)
+#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr)
+#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_LE_OFFSET(ptr,offset)
+
+#elif defined(__RAD3DS__)
+
+// arm has a "__packed" qualifier to tell the compiler to do unaligned accesses
+#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+
+#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0))
+#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset))
+#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0))
+#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset))
+
+#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)
+#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)
+#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)
+#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)
+
+#elif defined(__RADPSP2__)
+
+#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset)))
+
+#define RR_GET32_BE_UNALIGNED(ptr) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0))
+#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset))
+#define RR_GET16_BE_UNALIGNED(ptr) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0))
+#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset))
+
+#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)
+#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)
+#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)
+#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)
+
+#else
+// Unaligned via bytes :
+
+#define RR_GET32_BE_UNALIGNED(ptr) ( \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 24 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 16 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 8 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 0 ) )
+
+#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) ( \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 24 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 16 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 8 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 0 ) )
+
+#define RR_GET16_BE_UNALIGNED(ptr) ( \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 8 ) | \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 0 ) )
+
+#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) ( \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 8 ) | \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 0 ) )
+
+#define RR_GET32_LE_UNALIGNED(ptr) ( \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 24 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 16 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) )
+
+#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) ( \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 24 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 16 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \
+ ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) )
+
+#define RR_GET16_LE_UNALIGNED(ptr) ( \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) )
+
+#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) ( \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \
+ ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) )
+
+#endif
+
+//===================================================================
+// RR_ROTL32 : 32-bit rotate
+//
+
+#ifdef _MSC_VER
+
+ unsigned long __cdecl _lrotl(unsigned long, int);
+ #pragma intrinsic(_lrotl)
+
+ #define RR_ROTL32(x,k) _lrotl((unsigned long)(x),(int)(k))
+
+#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || defined(__RADPSP2__)
+
+ // Compiler turns this into rotate correctly :
+ #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) )
+
+#elif defined(__RAD3DS__)
+
+ #define RR_ROTL32(u32,num) __ror(u32, (-(num))&31)
+
+#else
+
+// comment out fallbacks so users will get errors
+// fallback implementation using shift and or :
+//#define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) )
+
+#endif
+
+
+//===================================================================
+// RR_ROTL64 : 64-bit rotate
+
+#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
+
+unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
+#pragma intrinsic(_rotl64)
+
+#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
+
+#elif defined(__RADCELL__)
+
+// PS3 GCC turns this into rotate correctly :
+#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
+
+#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
+
+//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
+#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
+
+#else
+
+// comment out fallbacks so users will get errors
+// fallback implementation using shift and or :
+//#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
+
+#endif
+
+//===================================================================
+
+RADDEFEND
+
+//===================================================================
+
+// RR_COMPILER_ASSERT
+#if defined(__cplusplus) && !defined(RR_COMPILER_ASSERT)
+ #if defined(_MSC_VER) && (_MSC_VER >=1400)
+
+ // better version of COMPILER_ASSERT using boost technique
+ template <int x> struct RR_COMPILER_ASSERT_FAILURE;
+
+ template <> struct RR_COMPILER_ASSERT_FAILURE<1> { enum { value = 1 }; };
+
+ template<int x> struct rr_compiler_assert_test{};
+
+ // __LINE__ macro broken when -ZI is used see Q199057
+ #define RR_COMPILER_ASSERT( B ) \
+ typedef rr_compiler_assert_test<\
+ sizeof(RR_COMPILER_ASSERT_FAILURE< (B) ? 1 : 0 >)\
+ > rr_compiler_assert_typedef_
+
+ #endif
+#endif
+
+#ifndef RR_COMPILER_ASSERT
+ // this happens at declaration time, so if it's inside a function in a C file, drop {} around it
+ #define RR_COMPILER_ASSERT(exp) typedef char RR_STRING_JOIN(_dummy_array, __LINE__) [ (exp) ? 1 : -1 ]
+#endif
+
+//===================================================================
+// some error checks :
+
+ RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == sizeof( RR_STRING_JOIN(RAD_U,RAD_PTRBITS) ) );
+ RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == RAD_PTRBYTES );
+ RR_COMPILER_ASSERT( RAD_TWOPTRBYTES == 2* RAD_PTRBYTES );
+
+//===================================================================
+
+ #endif // __RADRES__
+
+//include "testconstant.inl" // uncomment and include to test statement constants
+
+#endif // __RADRR_COREH__
+
+