Add Linux version of Iggy [Please Squash into feat branch] (#182)

* Added Linux version of Iggy

* Expose audio functionality

* Reimplemented IggyAudioOutParamExtendedInformation more carefully

* Link to .o files directly

* Allow required SWF files to be loaded on Linux

* Some other misc ifdef WINDOWS64 fixes

* Another ifdef windows64 fix
This commit is contained in:
niansa/tuxifan 2026-03-11 19:25:27 +01:00 committed by Tropical
parent 44ade1f2b2
commit 5c5f533cdd
88 changed files with 4785 additions and 263 deletions

View file

@ -89,6 +89,7 @@ static void RADLINK WarningCallback(void *user_callback_data, Iggy *player, Iggy
use for debugging, otherwise debugging errors in the
ActionScript 3 code in your Flash content will be very
difficult! */
app.DebugPrintf(app.USER_SR, "[Iggy] ");
app.DebugPrintf(app.USER_SR, message);
app.DebugPrintf(app.USER_SR, "\n");
break;
@ -173,7 +174,7 @@ UIController::UIController()
#endif
// 4J Stu - This is a bit of a hack until we change the Minecraft initialisation to store the proper screen size for other platforms
#if defined _WINDOWS64 || defined _DURANGO || defined __ORBIS__
#if defined _WINDOWS64 || defined _DURANGO || defined __ORBIS__ || defined(__linux__)
m_fScreenWidth = 1920.0f;
m_fScreenHeight = 1080.0f;
m_bScreenWidthSetup = true;
@ -425,7 +426,7 @@ void UIController::loadSkins()
platformSkinPath = L"skinPS3.swf";
#elif defined __PSVITA__
platformSkinPath = L"skinVita.swf";
#elif defined _WINDOWS64
#elif defined(_WINDOWS64) || defined(__linux__)
if(m_fScreenHeight==1080.0f)
{
platformSkinPath = L"skinHDWin.swf";
@ -477,7 +478,7 @@ void UIController::loadSkins()
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
#endif
#if ( defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) )
#if ( defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) || defined(__linux__))
#if defined(_WINDOWS64)
// 4J Stu - Load the 720/480 skins so that we have something to fallback on during development
@ -511,14 +512,21 @@ void UIController::loadSkins()
IggyLibrary UIController::loadSkin(const std::wstring &skinPath, const std::wstring &skinName)
{
IggyLibrary lib = IGGY_INVALID_LIBRARY;
// 4J Stu - We need to load the platformskin before the normal skin, as the normal skin requires some elements from the platform skin
if(!skinPath.empty() && app.hasArchiveFile(skinPath))
{
byteArray baFile = app.getArchiveFile(skinPath);
lib = IggyLibraryCreateFromMemoryUTF16( (IggyUTF16 *)skinName.c_str() , (void *)baFile.data, baFile.length, NULL );
// Copy 32-bit wchar_t to 16-bit IggyUTF16
std::vector<IggyUTF16> utf16Name(skinName.length() + 1);
for(size_t i = 0; i < skinName.length(); ++i) {
utf16Name[i] = static_cast<IggyUTF16>(skinName[i]);
}
utf16Name[skinName.length()] = 0; // null terminator
lib = IggyLibraryCreateFromMemoryUTF16( utf16Name.data() , (void *)baFile.data, baFile.length, NULL );
delete[] baFile.data;
#ifdef _DEBUG
#ifdef _DEBUG
IggyMemoryUseInfo memoryInfo;
rrbool res;
int iteration = 0;
@ -558,7 +566,7 @@ void UIController::ReloadSkin()
m_iggyLibraries[i] = IGGY_INVALID_LIBRARY;
}
#ifdef _WINDOWS64
#ifdef _WINDOWS64 || defined(__linux__))
// 4J Stu - Don't load on a thread on windows. I haven't investigated this in detail, so a quick fix
reloadSkinThreadProc(this);
#else

View file

@ -283,7 +283,7 @@ void UIScene::loadMovie()
#elif defined __PSVITA__
moviePath.append(L"Vita.swf");
m_loadedResolution = eSceneResolution_Vita;
#elif defined _WINDOWS64
#elif defined _WINDOWS64 || defined __linux__
if(ui.getScreenHeight() == 720)
{
moviePath.append(L"720.swf");

View file

@ -21,30 +21,6 @@
#define true 1
#define false 0
// Iggy GDraw support functions - normally in the Iggy library, stubbed here
void * IggyGDrawMallocAnnotated(SINTa size, const char *file, int line) {
(void)file; (void)line;
return malloc((size_t)size);
}
void IggyGDrawFree(void *ptr) {
free(ptr);
}
void IggyGDrawSendWarning(Iggy *f, char const *message, ...) {
(void)f;
va_list args;
va_start(args, message);
fprintf(stderr, "[Iggy GDraw Warning] ");
vfprintf(stderr, message, args);
fprintf(stderr, "\n");
va_end(args);
}
void IggyDiscardVertexBufferCallback(void *owner, void *buf) {
(void)owner; (void)buf;
}
///////////////////////////////////////////////////////////////////////////////
//
// Extensions (we map to GL 2.0 function names for a uniform interface

View file

@ -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 "../../../Windows64/Miles/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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
#ifndef IGGY_AUDIO_SHIM_H
#define IGGY_AUDIO_SHIM_H
#ifdef __cplusplus
extern "C" {
#endif
#define IGGY_AUDIO_OK 0
enum IggyAudioOutPort {
Main = 0,
Bgm = 1,
Voice = 2,
Personal = 3,
PadSpk = 4,
Audio3d = 126,
Aux = 127,
};
enum IggyAudioOutParamAttr {
None = 0,
Restricted = 1,
MixToMain = 2,
};
enum IggyAudioOutParamFormat {
S16Mono = 0,
S16Stereo = 1,
S16_8CH = 2,
FloatMono = 3,
FloatStereo = 4,
Float_8CH = 5,
S16_8CH_Std = 6,
Float_8CH_Std = 7
};
typedef union IggyAudioOutParamExtendedInformation {
unsigned raw;
struct {
unsigned data_format : 8; // bits 0.. 7
unsigned reserve0 : 8; // bits 8..15
unsigned attributes : 4; // bits 16..19
unsigned reserve1 : 10; // bits 20..29
unsigned : 1; // bit 30 (padding)
unsigned unused : 1; // bit 31
} bits;
} IggyAudioOutParamExtendedInformation;
typedef struct IggyAudioShimCallbacks {
int (*iggyAudioOutOpen)(
int user_id,
enum IggyAudioOutPort port_type,
int index,
unsigned length,
unsigned sample_rate,
IggyAudioOutParamExtendedInformation param_type);
int (*iggyAudioOutSetVolume)(int handle, int flag, int* vol);
int (*iggyAudioOutClose)(int handle);
int (*iggyAudioOutOutput)(int handle, void* ptr);
} IggyAudioShimCallbacks;
// Registers callback table used by the shim
int iggyAudioShimRegisterCallbacks(const IggyAudioShimCallbacks* callbacks);
#ifdef __cplusplus
}
#endif
#endif // IGGY_AUDIO_SHIM_H

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,338 @@
#define _GNU_SOURCE
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include <errno.h>
#include <time.h>
#include <stdio.h>
#include <ctype.h>
#include <sched.h>
#include <stdlib.h>
#include <stdint.h>
#include <fenv.h>
#include "iggy_audio_shim.h"
_Static_assert(sizeof(pthread_t) == 8, "pthread_t must be 8 bytes");
_Static_assert(sizeof(int) == 4, "int must be 32 bit");
_Static_assert(sizeof(unsigned) == 4, "unsigned must be 32 bit");
/* ============================================================
* CRT & Math Shims
* ============================================================ */
double _Sin(double x) { return sin(x); }
double _Log(double x) { return log(x); }
// Map to the C fenv.h rounding modes
int _Fltrounds(void) {
switch (fegetround()) {
case FE_TOWARDZERO: return 0;
case FE_TONEAREST: return 1;
case FE_DOWNWARD: return 2;
case FE_UPWARD: return 3;
default: return 1;
}
}
// BSD specific function supposed to return pointer to thread-local errno
#if defined(__GLIBC__)
int *__error(void) { return __errno_location(); }
#else
int *__error(void) { return &errno; }
#endif
// Microsoft specific variant of gmtime
int gmtime_s(struct tm *tmDest, const time_t *sourceTime) {
if (!tmDest || !sourceTime) return EINVAL;
if (gmtime_r(sourceTime, tmDest) == NULL) return EINVAL; /* conservative */
return 0;
}
// Returns pointer to ctype classification table
const unsigned short *_Getpctype(void) {
#if defined(__GLIBC__)
return (const unsigned short *)(*__ctype_b_loc());
#else
// We might still be alright
errno = ENOSYS;
return NULL;
#endif
}
/* ============================================================
* Helpers for heap-allocated opaque objects
* ============================================================ */
static int alloc_and_init(void **out, size_t size, int (*init_fn)(void *), void (*free_fn)(void *)) {
if (!out) return EINVAL;
*out = NULL;
void *p = malloc(size);
if (!p) return ENOMEM;
int rc = init_fn(p);
if (rc != 0) {
if (free_fn) free_fn(p);
else free(p);
return rc;
}
*out = p;
return 0;
}
/* ============================================================
* Pthread Shims (opaque handles allocated on heap)
* ============================================================ */
// Mutex Attributes
static int mutexattr_init_thunk(void *p) {
return pthread_mutexattr_init((pthread_mutexattr_t *)p);
}
int scePthreadMutexattrInit(void **attr) {
return alloc_and_init(attr, sizeof(pthread_mutexattr_t), mutexattr_init_thunk, free);
}
int scePthreadMutexattrSettype(void **attr, int type) {
if (!attr || !*attr) return EINVAL;
return pthread_mutexattr_settype((pthread_mutexattr_t *)*attr, type);
}
int scePthreadMutexattrDestroy(void **attr) {
if (!attr || !*attr) return EINVAL;
pthread_mutexattr_t *a = (pthread_mutexattr_t *)*attr;
int rc = pthread_mutexattr_destroy(a);
if (rc == 0) {
free(a);
*attr = NULL;
}
return rc;
}
// Mutexes
int scePthreadMutexInit(void **mutex, void **attr, const char *name) {
(void)name;
if (!mutex) return EINVAL;
*mutex = NULL;
pthread_mutex_t *m = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
if (!m) return ENOMEM;
pthread_mutexattr_t *a = (attr && *attr) ? (pthread_mutexattr_t *)*attr : NULL;
int rc = pthread_mutex_init(m, a);
if (rc != 0) {
free(m);
return rc;
}
*mutex = m;
return 0;
}
int scePthreadMutexLock(void **mutex) {
if (!mutex || !*mutex) return EINVAL;
return pthread_mutex_lock((pthread_mutex_t *)*mutex);
}
int scePthreadMutexTrylock(void **mutex) {
if (!mutex || !*mutex) return EINVAL;
return pthread_mutex_trylock((pthread_mutex_t *)*mutex);
}
int scePthreadMutexUnlock(void **mutex) {
if (!mutex || !*mutex) return EINVAL;
return pthread_mutex_unlock((pthread_mutex_t *)*mutex);
}
int scePthreadMutexTimedlock(void **mutex, unsigned int usecs) {
if (!mutex || !*mutex) return EINVAL;
struct timespec ts;
// Get current wall clock time
if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
return errno;
// Add the relative microseconds to the current time
ts.tv_sec += (usecs / 1000000);
ts.tv_nsec += (usecs % 1000000) * 1000;
// Handle nanosecond overflow
if (ts.tv_nsec >= 1000000000L) {
ts.tv_sec++;
ts.tv_nsec -= 1000000000L;
}
// Call the standard POSIX function with the absolute time
return pthread_mutex_timedlock(*mutex, &ts);
}
int scePthreadMutexDestroy(void **mutex) {
if (!mutex || !*mutex) return EINVAL;
pthread_mutex_t *m = (pthread_mutex_t *)*mutex;
int rc = pthread_mutex_destroy(m);
if (rc == 0) {
free(m);
*mutex = NULL;
}
return rc;
}
// Thread Attributes
static int attr_init_thunk(void *p) {
return pthread_attr_init((pthread_attr_t *)p);
}
int scePthreadAttrInit(void **attr) {
return alloc_and_init(attr, sizeof(pthread_attr_t), attr_init_thunk, free);
}
int scePthreadAttrSetstacksize(void **attr, size_t stacksize) {
if (!attr || !*attr) return EINVAL;
return pthread_attr_setstacksize((pthread_attr_t *)*attr, stacksize);
}
int scePthreadAttrDestroy(void **attr) {
if (!attr || !*attr) return EINVAL;
pthread_attr_t *a = (pthread_attr_t *)*attr;
int rc = pthread_attr_destroy(a);
if (rc == 0) {
free(a);
*attr = NULL;
}
return rc;
}
// Threads
int scePthreadCreate(pthread_t *thread_out, void **attr, void *(*start_routine)(void *), void *arg, const char *name) {
(void)name;
if (!thread_out || !start_routine) return EINVAL;
pthread_attr_t *a = (attr && *attr) ? (pthread_attr_t *)*attr : NULL;
return pthread_create(thread_out, a, start_routine, arg);
}
int scePthreadJoin(pthread_t thread, void **value_ptr) {
return pthread_join(thread, value_ptr);
}
int scePthreadDetach(pthread_t thread) {
return pthread_detach(thread);
}
pthread_t scePthreadSelf(void) {
return pthread_self();
}
void scePthreadYield(void) {
sched_yield();
}
int scePthreadSetschedparam(pthread_t thread, int policy, const struct sched_param *param) {
if (!param) return EINVAL;
return pthread_setschedparam(thread, policy, param);
}
int scePthreadGetschedparam(pthread_t thread, int *policy, struct sched_param *param) {
if (!policy || !param) return EINVAL;
return pthread_getschedparam(thread, policy, param);
}
// TLS Keys
int scePthreadKeyCreate(pthread_key_t *key, void (*destructor)(void *), const char *name) {
(void)name;
if (!key) return EINVAL;
return pthread_key_create(key, destructor);
}
int scePthreadSetspecific(pthread_key_t key, const void *value) {
return pthread_setspecific(key, value);
}
void *scePthreadGetspecific(pthread_key_t key) {
return pthread_getspecific(key);
}
// Affinity
int scePthreadSetaffinity(pthread_t thread, uint64_t cpumask) {
(void)thread;
(void)cpumask;
return 0; // Could return ENOSYS here, but this should be alright too
}
/* ============================================================
* Kernel & Hardware Shims
* ============================================================ */
int sceKernelGettimeofday(struct timeval *tp) {
if (!tp) return EINVAL;
return gettimeofday(tp, NULL);
}
int sceKernelUsleep(unsigned microseconds) {
return usleep(microseconds);
}
/* ============================================================
* Audio Shims
* ============================================================ */
static IggyAudioShimCallbacks g_audioCbs = {};
int iggyAudioShimRegisterCallbacks(const IggyAudioShimCallbacks* callbacks) {
if (callbacks) {
g_audioCbs = *callbacks;
} else {
IggyAudioShimCallbacks cbs = {};
g_audioCbs = cbs;
}
return IGGY_AUDIO_OK;
}
int sceAudioOutOpen(int user_id, enum IggyAudioOutPort port_type, int index, unsigned length, unsigned sample_rate, IggyAudioOutParamExtendedInformation param_type) {
if (g_audioCbs.iggyAudioOutOpen)
return g_audioCbs.iggyAudioOutOpen(user_id, port_type, index, length, sample_rate, param_type);
return IGGY_AUDIO_OK;
}
int sceAudioOutSetVolume(int handle, int flag, int* vol) {
if (g_audioCbs.iggyAudioOutSetVolume)
return g_audioCbs.iggyAudioOutSetVolume(handle, flag, vol);
return IGGY_AUDIO_OK;
}
int sceAudioOutClose(int handle) {
if (g_audioCbs.iggyAudioOutClose)
return g_audioCbs.iggyAudioOutClose(handle);
return IGGY_AUDIO_OK;
}
int sceAudioOutOutput(int handle, void* ptr) {
if (g_audioCbs.iggyAudioOutOutput)
return g_audioCbs.iggyAudioOutOutput(handle, ptr);
return IGGY_AUDIO_OK;
}
/* ============================================================
* Misc
* ============================================================ */
void gdraw_ps4_wait(void) {
usleep(1000);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -30,6 +30,5 @@
#include "winapi_stubs.h"
#include "d3d11_stubs.h"
#include "xbox_stubs.h"
#include "iggy_stubs.h"
#endif // STUBS_H
#endif // STUBS_H

View file

@ -1,227 +0,0 @@
#ifndef IGGYSTUBS_H
#define IGGYSTUBS_H
#pragma once
#include "../../Windows64/Iggy/include/iggy.h"
#define STUBBED {}
RADEXPFUNC inline IggyValuePath * RADEXPLINK IggyPlayerRootPath(Iggy *f) {
STUBBED;
return nullptr;
}
RADEXPFUNC inline IggyResult RADEXPLINK IggyPlayerCallMethodRS(Iggy *f, IggyDataValue *result, IggyValuePath *target, IggyName methodname, S32 numargs, IggyDataValue *args) {
STUBBED;
return IGGY_RESULT_SUCCESS;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerDestroy(Iggy *player) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerSetDisplaySize(Iggy *f, S32 w, S32 h) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerDrawTilesStart(Iggy *f) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerDrawTile(Iggy *f, S32 x0, S32 y0, S32 x1, S32 y1, S32 padding) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerDrawTilesEnd(Iggy *f) {
STUBBED;
}
// Each fake Iggy player gets its own state block
struct FakeIggyPlayer {
int tickCount;
bool needsTick;
IggyProperties props;
void *userdata;
};
// Simple player pool
static FakeIggyPlayer s_fakePlayers[64];
static int s_fakePlayerCount = 0;
RADEXPFUNC inline Iggy * RADEXPLINK IggyPlayerCreateFromMemory(
void const * data,
U32 data_size_in_bytes,
IggyPlayerConfig *config) {
if(s_fakePlayerCount >= 64) return nullptr;
FakeIggyPlayer *fp = &s_fakePlayers[s_fakePlayerCount++];
fp->tickCount = 0;
fp->needsTick = true;
fp->userdata = nullptr;
// Default to 1920x1080 at 30fps
memset(&fp->props, 0, sizeof(fp->props));
fp->props.movie_width_in_pixels = 1920;
fp->props.movie_height_in_pixels = 1080;
fp->props.movie_frame_rate_from_file_in_fps = 30.0f;
fp->props.movie_frame_rate_current_in_fps = 30.0f;
fprintf(stderr, "[Iggy Stub] Created fake player %d (data=%p, size=%u)\n", s_fakePlayerCount-1, data, data_size_in_bytes);
return (Iggy*)fp;
}
static FakeIggyPlayer* getFakePlayer(Iggy *player) {
return (FakeIggyPlayer*)player;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerInitializeAndTickRS(Iggy *player) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp) { fp->tickCount = 0; fp->needsTick = true; }
}
RADEXPFUNC inline IggyProperties * RADEXPLINK IggyPlayerProperties(Iggy *player) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp) return &fp->props;
static IggyProperties defaultProps = {};
return &defaultProps;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerSetUserdata(Iggy *player, void *userdata) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp) fp->userdata = userdata;
}
RADEXPFUNC inline IggyName RADEXPLINK IggyPlayerCreateFastName(Iggy *f, IggyUTF16 const *name, S32 len) {
STUBBED;
return 0;
}
RADEXPFUNC inline rrbool RADEXPLINK IggyDebugGetMemoryUseInfo(Iggy *player, IggyLibrary lib, char const *category_string, S32 category_stringlen, S32 iteration, IggyMemoryUseInfo *data) {
STUBBED;
return false;
}
RADEXPFUNC inline rrbool RADEXPLINK IggyPlayerReadyToTick(Iggy *player) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp && fp->needsTick) return true;
return false;
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerTickRS(Iggy *player) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp) {
fp->tickCount++;
// Allow one tick per frame cycle
fp->needsTick = false;
}
}
RADEXPFUNC inline void RADEXPLINK IggyPlayerDraw(Iggy *f) {
// Re-arm tick for next frame
FakeIggyPlayer *fp = getFakePlayer(f);
if(fp) fp->needsTick = true;
}
RADEXPFUNC inline void RADEXPLINK IggyMakeEventKey(IggyEvent *event, IggyKeyevent event_type, IggyKeycode keycode, IggyKeyloc keyloc) {
STUBBED;
}
RADEXPFUNC inline rrbool RADEXPLINK IggyPlayerDispatchEventRS(Iggy *player, IggyEvent *event, IggyEventResult *result) {
STUBBED;
return false;
}
RADEXPFUNC inline void RADEXPLINK IggyFontRemoveUTF8(const char *fontname, S32 namelen_in_bytes, U32 fontflags) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyFontInstallBitmapUTF8(const IggyBitmapFontProvider *bmf, const char *fontname, S32 namelen_in_bytes, U32 fontflags) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyFontSetIndirectUTF8(const char *request_name, S32 request_namelen, U32 request_flags, const char *result_name, S32 result_namelen, U32 result_flags) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyFontInstallTruetypeUTF8(const void *truetype_storage, S32 ttc_index, const char *fontname, S32 namelen_in_bytes, U32 fontflags) {
STUBBED;
}
RADEXPFUNC inline rrbool RADEXPLINK IggyValuePathMakeNameRef(IggyValuePath *result, IggyValuePath *parent, char const *text_utf8) {
STUBBED;
return false;
}
RADEXPFUNC inline IggyResult RADEXPLINK IggyValueGetBooleanRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, rrbool *result) {
STUBBED;
return IGGY_RESULT_SUCCESS;
}
RADEXPFUNC inline void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF8(const char *fontname, S32 len, U32 fontflags, S32 fallback_codepoint) {
STUBBED;
}
RADEXPFUNC inline IggyResult RADEXPLINK IggyValueGetF64RS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, F64 *result) {
STUBBED;
return IGGY_RESULT_SUCCESS;
}
RADEXPFUNC inline rrbool RADEXPLINK IggyValueSetBooleanRS(IggyValuePath *var, IggyName sub_name, char const *sub_name_utf8, rrbool value) {
STUBBED;
return true;
}
RADEXPFUNC inline void RADEXPLINK IggyInit(IggyAllocator *allocator) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetWarningCallback(Iggy_WarningFunction *error, void *user_callback_data) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetTraceCallbackUTF8(Iggy_TraceFunctionUTF8 *trace_utf8, void *user_callback_data) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetFontCachingCalculationBuffer(
S32 max_chars,
void *optional_temp_buffer,
S32 optional_temp_buffer_size_in_bytes) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetCustomDrawCallback(Iggy_CustomDrawCallback *custom_draw, void *user_callback_data) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF16(Iggy_AS3ExternalFunctionUTF16 *as3_external_function_utf16, void *user_callback_data) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggyMakeEventMouseMove(IggyEvent *event, S32 x, S32 y) {
STUBBED;
}
RADEXPFUNC inline void RADEXPLINK IggySetTextureSubstitutionCallbacks(Iggy_TextureSubstitutionCreateCallback *texture_create, Iggy_TextureSubstitutionDestroyCallback *texture_destroy, void *user_callback_data) {
STUBBED;
}
RADEXPFUNC inline void * RADEXPLINK IggyPlayerGetUserdata(Iggy *player) {
FakeIggyPlayer *fp = getFakePlayer(player);
if(fp) return fp->userdata;
return 0;
}
RADEXPFUNC inline IggyLibrary RADEXPLINK IggyLibraryCreateFromMemoryUTF16(
IggyUTF16 const * url_utf16_null_terminated,
void const * data,
U32 data_size_in_bytes,
IggyPlayerConfig *config) {
STUBBED;
return 0;
}
RADEXPFUNC inline void RADEXPLINK IggyLibraryDestroy(IggyLibrary lib) {
STUBBED;
}
// Iggy is fake
static GDrawFunctions *s_iggy_gdraw_funcs = 0;
RADEXPFUNC inline void RADEXPLINK IggySetGDraw(GDrawFunctions *gdraw_funcs) {
s_iggy_gdraw_funcs = gdraw_funcs;
}
// Audio stubs
RADEXPFUNC inline void RADEXPLINK IggyAudioUseDefault(void) {
STUBBED;
}
// Explorer/Perfmon, shit implmentation
RADEXPFUNC inline void * RADEXPLINK IggyExpCreate(const char *host, int port, void *storage, int storage_size) {
STUBBED;
return 0;
}
RADEXPFUNC inline void RADEXPLINK IggyUseExplorer(Iggy *player, void *explorer) {
STUBBED;
}
RADEXPFUNC inline void * RADEXPLINK IggyPerfmonCreate(void *(*alloc_func)(unsigned long), void (*free_func)(void *), void *user) {
STUBBED;
return 0;
}
RADEXPFUNC inline void RADEXPLINK IggyInstallPerfmon(void *perfmon) {
STUBBED;
}
// GDraw memory/warning functions are defined in gdraw_glfw.c (C linkage)
// Juicey you stupid idiot do NOT define them here
#endif // IGGYSTUBS_H

View file

@ -299,6 +299,7 @@ typedef XUID GameSessionUID;
// Linux build: avoid pulling in Windows64 platform headers (they cause
// symbol/class redefinitions). Use Orbis-compatible stubs and Linux controller.
#include "../Platform/Linux/Linux_App.h"
#include "../Platform/Linux/Iggy/include/iggy.h"
#include "../Platform/Orbis/Sentient/SentientTelemetryCommon.h"
#include "../Platform/Orbis/Sentient/DynamicConfigurations.h"
#include "../Platform/Orbis/GameConfig/Minecraft.spa.h"

View file

@ -35,19 +35,32 @@ platform_sources += run_command(
).stdout().strip().split('\n')
# linux-specific files (everything in Platform/Linux)
linux_objects = []
if host_machine.system() == 'linux'
platform_sources += run_command(
'sh', '-c',
'find "'
+ meson.current_source_dir() / 'Platform/Linux'
+ '" \\( -name "*.cpp" -o -name "*.c" \\) ',
check : true,
check : true,
).stdout().strip().split('\n')
_linux_objects_str = run_command(
'sh', '-c',
'find "'
+ meson.current_source_dir() / 'Platform/Linux'
+ '" -name "*.o"',
check : true,
).stdout().strip()
if _linux_objects_str != ''
linux_objects += _linux_objects_str.split('\n')
endif
endif
client = executable('Minecraft.Client',
client_sources + platform_sources + localisation[1],
include_directories : include_directories('Platform'),
objects : linux_objects,
include_directories : include_directories('Platform', 'Platform/Linux/Iggy/include'),
dependencies : [
render_dep,
input_dep,