recover every shipped iggy build and its internal layout

This commit is contained in:
coah
2026-07-13 01:46:10 -05:00
parent d470c46f8c
commit 43be64a200
628 changed files with 846539 additions and 39 deletions

View File

@@ -12,16 +12,36 @@ AR="$LLVM_DIR/bin/llvm-ar"
NM="$LLVM_DIR/bin/llvm-nm"
READOBJ="$LLVM_DIR/bin/llvm-readobj"
LLD_LINK="$LLVM_DIR/bin/lld-link"
LD_LLD="$LLVM_DIR/bin/ld.lld"
PDBUTIL="$LLVM_DIR/bin/llvm-pdbutil"
HEADLESS="$GHIDRA_HOME/support/analyzeHeadless"
SCRIPT_DIR="$ROOT/tools/ghidra"
TYPE_ARCHIVE="$WORK_DIR/iggy-abi.gdt"
CORE_ARCHIVE="$SOURCE_DIR/Minecraft.Client/Durango/Iggy/lib/iggy_durango.lib"
PERFMON_ARCHIVE="$SOURCE_DIR/Minecraft.Client/Durango/Iggy/lib/iggyperfmon_durango.lib"
WINDOWS_DLL="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/redist64/iggy_w64.dll"
ORBIS_CORE="$SOURCE_DIR/Minecraft.Client/Orbis/Iggy/lib/libiggy_orbis.a"
ORBIS_PERFMON="$SOURCE_DIR/Minecraft.Client/Orbis/Iggy/lib/libiggyperfmon_orbis.a"
PS3_CORE="$SOURCE_DIR/Minecraft.Client/PS3/Iggy/lib/libiggy_ps3.a"
PS3_PERFMON="$SOURCE_DIR/Minecraft.Client/PS3/Iggy/lib/libiggyperfmon_ps3.a"
PS3_EXPR="$SOURCE_DIR/Minecraft.Client/PS3/Iggy/lib/libiggyexpruntime_ps3.a"
VITA_CORE="$SOURCE_DIR/Minecraft.Client/PSVita/Iggy/lib/libiggy_psp2.a"
VITA_PERFMON="$SOURCE_DIR/Minecraft.Client/PSVita/Iggy/lib/libiggyperfmon_psp2.a"
DURANGO_DEBUG="$SOURCE_DIR/Minecraft.Client/Durango/Iggy/lib/iggy_durango_debugcrt.lib"
DURANGO_PERFMON_DEBUG="$SOURCE_DIR/Minecraft.Client/Durango/Iggy/lib/iggyperfmon_durango_debugcrt.lib"
WINDOWS_IGGY_64="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib"
WINDOWS_IGGY_32="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggy_w32.lib"
WINDOWS_EXPR_64="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggyexpruntime_w64.lib"
WINDOWS_EXPR_32="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggyexpruntime_w32.lib"
WINDOWS_PERFMON_64="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggyperfmon_w64.lib"
WINDOWS_PERFMON_32="$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/lib/iggyperfmon_w32.lib"
for required in "$AR" "$NM" "$READOBJ" "$LLD_LINK" "$PDBUTIL" "$HEADLESS" "$CORE_ARCHIVE" "$PERFMON_ARCHIVE" "$WINDOWS_DLL"; do
for required in "$AR" "$NM" "$READOBJ" "$LLD_LINK" "$LD_LLD" "$PDBUTIL" "$HEADLESS" \
"$CORE_ARCHIVE" "$PERFMON_ARCHIVE" "$WINDOWS_DLL" \
"$ORBIS_CORE" "$ORBIS_PERFMON" "$PS3_CORE" "$PS3_PERFMON" "$PS3_EXPR" \
"$VITA_CORE" "$VITA_PERFMON" "$DURANGO_DEBUG" "$DURANGO_PERFMON_DEBUG" \
"$WINDOWS_IGGY_64" "$WINDOWS_IGGY_32" "$WINDOWS_EXPR_64" "$WINDOWS_EXPR_32" \
"$WINDOWS_PERFMON_64" "$WINDOWS_PERFMON_32"; do
[[ -e "$required" ]] || { echo "missing: $required" >&2; exit 1; }
done
@@ -40,6 +60,36 @@ extract_archive() {
)
}
link_orbis_for_analysis() {
local input="$WORK_DIR/orbis-objects"
local patched="$WORK_DIR/orbis-patched-objects"
local image="$WORK_DIR/iggy_orbis_linked.so"
local map="$WORK_DIR/iggy_orbis_linked.map"
cmake -E remove_directory "$patched"
python3 "$ROOT/patch_orbis_relocations.py" "$input" "$patched"
"$LD_LLD" -shared --build-id=sha1 --whole-archive "$patched"/*.obj \
--no-whole-archive --unresolved-symbols=ignore-all \
-o "$image" "--Map=$map" > "$WORK_DIR/iggy-orbis-linked.link.log" 2>&1
cp "$map" "$OUTPUT_DIR/symbols/iggy_orbis_linked.map"
}
record_archive() {
local archive="$1"
local stem="$2"
"$AR" t "$archive" > "$OUTPUT_DIR/symbols/$stem.members.txt"
"$NM" --demangle "$archive" > "$OUTPUT_DIR/symbols/$stem.symbols.txt"
}
copy_source_tree() {
local platform="$1"
local source="$SOURCE_DIR/Minecraft.Client/$2/Iggy"
local output="$OUTPUT_DIR/original/$platform"
mkdir -p "$output"
cp -R "$source/gdraw" "$output/"
cp -R "$source/include" "$output/"
}
link_archive_for_analysis() {
local archive="$1"
local stem="$2"
@@ -61,7 +111,10 @@ decompile_linked_image() {
local project="$1"
local image="$2"
local output="$3"
local platform="$4"
local include_directory="$5"
local map="${image%.dll}.map"
local type_archive="$WORK_DIR/iggy-abi-$platform.gdt"
mkdir -p "$output" "$WORK_DIR/ghidra-project"
"$HEADLESS" "$WORK_DIR/ghidra-project" "$project" \
@@ -69,25 +122,49 @@ decompile_linked_image() {
-analysisTimeoutPerFile 1200 \
-scriptPath "$SCRIPT_DIR" \
-postScript ApplyLinkMap.java "$map" \
-postScript ApplyIggyTypes.java "$OUTPUT_DIR/include" "$SCRIPT_DIR/stubs" "$TYPE_ARCHIVE" \
-postScript ApplyIggyTypes.java "$include_directory" "$SCRIPT_DIR/stubs" "$type_archive" "$platform" \
-postScript ExportDecompiled.java "$output" \
-deleteProject > "$WORK_DIR/$project.log" 2>&1
}
decompile_linked_elf() {
local project="$1"
local image="$2"
local output="$3"
local platform="$4"
local include_directory="$5"
local type_archive="$WORK_DIR/iggy-abi-$platform.gdt"
mkdir -p "$output" "$WORK_DIR/ghidra-project"
"$HEADLESS" "$WORK_DIR/ghidra-project" "$project" \
-import "$image" \
-analysisTimeoutPerFile 1200 \
-scriptPath "$SCRIPT_DIR" \
-postScript ApplyIggyTypes.java "$include_directory" "$SCRIPT_DIR/stubs" "$type_archive" "$platform" \
-postScript ExportDecompiled.java "$output" 30 \
-deleteProject > "$WORK_DIR/$project.log" 2>&1
}
decompile_input() {
local project="$1"
local input="$2"
local output="$3"
local recursive="$4"
local platform="$5"
local include_directory="$6"
local fid_output="$OUTPUT_DIR/symbols/fid/${project#iggy-}"
local type_archive="$WORK_DIR/iggy-abi-$platform.gdt"
mkdir -p "$output" "$fid_output" "$WORK_DIR/ghidra-project"
local recursive_args=()
local processor_args=()
[[ "$recursive" == 1 ]] && recursive_args=(-recursive)
[[ "$platform" == ps3 ]] && processor_args=(-processor PowerPC:BE:64:64-32addr)
"$HEADLESS" "$WORK_DIR/ghidra-project" "$project" \
-import "$input" "${recursive_args[@]}" \
"${processor_args[@]}" \
-analysisTimeoutPerFile 300 \
-scriptPath "$SCRIPT_DIR" \
-postScript ApplyIggyTypes.java "$OUTPUT_DIR/include" "$SCRIPT_DIR/stubs" "$TYPE_ARCHIVE" \
-postScript ApplyIggyTypes.java "$include_directory" "$SCRIPT_DIR/stubs" "$type_archive" "$platform" \
-postScript ExportFidHashes.java "$fid_output" \
-postScript ExportDecompiled.java "$output" \
-deleteProject > "$WORK_DIR/$project.log" 2>&1
@@ -96,27 +173,63 @@ decompile_input() {
cmake -E remove_directory "$OUTPUT_DIR/raw"
cmake -E remove_directory "$OUTPUT_DIR/linked"
cmake -E remove_directory "$OUTPUT_DIR/symbols/fid"
cmake -E remove_directory "$OUTPUT_DIR/original"
rm -f "$WORK_DIR"/iggy-abi-*.gdt
mkdir -p "$OUTPUT_DIR/raw" "$OUTPUT_DIR/linked" "$OUTPUT_DIR/symbols" "$OUTPUT_DIR/include"
extract_archive "$CORE_ARCHIVE" "$WORK_DIR/durango-objects"
extract_archive "$PERFMON_ARCHIVE" "$WORK_DIR/perfmon-objects"
extract_archive "$ORBIS_CORE" "$WORK_DIR/orbis-objects"
extract_archive "$ORBIS_PERFMON" "$WORK_DIR/orbis-perfmon-objects"
extract_archive "$PS3_CORE" "$WORK_DIR/ps3-objects"
extract_archive "$PS3_PERFMON" "$WORK_DIR/ps3-perfmon-objects"
extract_archive "$PS3_EXPR" "$WORK_DIR/ps3-expr-objects"
extract_archive "$VITA_CORE" "$WORK_DIR/vita-objects"
extract_archive "$VITA_PERFMON" "$WORK_DIR/vita-perfmon-objects"
"$AR" t "$CORE_ARCHIVE" > "$OUTPUT_DIR/symbols/iggy_durango.members.txt"
"$NM" --demangle "$CORE_ARCHIVE" > "$OUTPUT_DIR/symbols/iggy_durango.symbols.txt"
"$AR" t "$PERFMON_ARCHIVE" > "$OUTPUT_DIR/symbols/iggyperfmon_durango.members.txt"
"$NM" --demangle "$PERFMON_ARCHIVE" > "$OUTPUT_DIR/symbols/iggyperfmon_durango.symbols.txt"
record_archive "$CORE_ARCHIVE" iggy_durango
record_archive "$PERFMON_ARCHIVE" iggyperfmon_durango
record_archive "$ORBIS_CORE" iggy_orbis
record_archive "$ORBIS_PERFMON" iggyperfmon_orbis
record_archive "$PS3_CORE" iggy_ps3
record_archive "$PS3_PERFMON" iggyperfmon_ps3
record_archive "$PS3_EXPR" iggyexpruntime_ps3
record_archive "$VITA_CORE" iggy_vita
record_archive "$VITA_PERFMON" iggyperfmon_vita
record_archive "$DURANGO_DEBUG" iggy_durango_debugcrt
record_archive "$DURANGO_PERFMON_DEBUG" iggyperfmon_durango_debugcrt
record_archive "$WINDOWS_IGGY_64" iggy_w64_import
record_archive "$WINDOWS_IGGY_32" iggy_w32_import
record_archive "$WINDOWS_EXPR_64" iggyexpruntime_w64_import
record_archive "$WINDOWS_EXPR_32" iggyexpruntime_w32_import
record_archive "$WINDOWS_PERFMON_64" iggyperfmon_w64_import
record_archive "$WINDOWS_PERFMON_32" iggyperfmon_w32_import
"$READOBJ" --file-headers --coff-exports --coff-imports --coff-debug-directory \
"$WINDOWS_DLL" | sed "s|$SOURCE_DIR/|<neoLegacy>/|g" \
> "$OUTPUT_DIR/symbols/iggy_w64.pe.txt"
cp "$SOURCE_DIR/Minecraft.Client/Windows64/Iggy/include/"*.h "$OUTPUT_DIR/include/"
copy_source_tree windows Windows64
copy_source_tree durango Durango
copy_source_tree orbis Orbis
copy_source_tree ps3 PS3
copy_source_tree vita PSVita
decompile_input iggy-durango "$WORK_DIR/durango-objects" "$OUTPUT_DIR/raw/durango" 1
decompile_input iggy-perfmon "$WORK_DIR/perfmon-objects" "$OUTPUT_DIR/raw/perfmon" 1
decompile_input iggy-durango "$WORK_DIR/durango-objects" "$OUTPUT_DIR/raw/durango" 1 durango "$OUTPUT_DIR/include"
decompile_input iggy-perfmon "$WORK_DIR/perfmon-objects" "$OUTPUT_DIR/raw/perfmon" 1 durango "$OUTPUT_DIR/include"
decompile_input iggy-orbis "$WORK_DIR/orbis-objects" "$OUTPUT_DIR/raw/orbis" 1 orbis "$SOURCE_DIR/Minecraft.Client/Orbis/Iggy/include"
decompile_input iggy-orbis-perfmon "$WORK_DIR/orbis-perfmon-objects" "$OUTPUT_DIR/raw/orbis-perfmon" 1 orbis "$SOURCE_DIR/Minecraft.Client/Orbis/Iggy/include"
decompile_input iggy-ps3 "$WORK_DIR/ps3-objects" "$OUTPUT_DIR/raw/ps3" 1 ps3 "$SOURCE_DIR/Minecraft.Client/PS3/Iggy/include"
decompile_input iggy-ps3-perfmon "$WORK_DIR/ps3-perfmon-objects" "$OUTPUT_DIR/raw/ps3-perfmon" 1 ps3 "$SOURCE_DIR/Minecraft.Client/PS3/Iggy/include"
decompile_input iggy-ps3-expr "$WORK_DIR/ps3-expr-objects" "$OUTPUT_DIR/raw/ps3-expr" 1 ps3 "$SOURCE_DIR/Minecraft.Client/PS3/Iggy/include"
decompile_input iggy-vita "$WORK_DIR/vita-objects" "$OUTPUT_DIR/raw/vita" 1 vita "$SOURCE_DIR/Minecraft.Client/PSVita/Iggy/include"
decompile_input iggy-vita-perfmon "$WORK_DIR/vita-perfmon-objects" "$OUTPUT_DIR/raw/vita-perfmon" 1 vita "$SOURCE_DIR/Minecraft.Client/PSVita/Iggy/include"
link_archive_for_analysis "$CORE_ARCHIVE" iggy_durango_linked
link_archive_for_analysis "$PERFMON_ARCHIVE" iggyperfmon_durango_linked
decompile_linked_image iggy-durango-linked "$WORK_DIR/iggy_durango_linked.dll" "$OUTPUT_DIR/linked/durango"
decompile_linked_image iggy-perfmon-linked "$WORK_DIR/iggyperfmon_durango_linked.dll" "$OUTPUT_DIR/linked/perfmon"
decompile_input iggy-windows "$WINDOWS_DLL" "$OUTPUT_DIR/raw/windows" 0
decompile_linked_image iggy-durango-linked "$WORK_DIR/iggy_durango_linked.dll" "$OUTPUT_DIR/linked/durango" durango "$OUTPUT_DIR/include"
decompile_linked_image iggy-perfmon-linked "$WORK_DIR/iggyperfmon_durango_linked.dll" "$OUTPUT_DIR/linked/perfmon" durango "$OUTPUT_DIR/include"
link_orbis_for_analysis
decompile_linked_elf iggy-orbis-linked "$WORK_DIR/iggy_orbis_linked.so" "$OUTPUT_DIR/linked/orbis" orbis "$SOURCE_DIR/Minecraft.Client/Orbis/Iggy/include"
decompile_input iggy-windows "$WINDOWS_DLL" "$OUTPUT_DIR/raw/windows" 0 windows "$OUTPUT_DIR/include"
python3 "$ROOT/match-iggy-functions.py" \
"$OUTPUT_DIR/symbols/fid/durango" \
"$OUTPUT_DIR/symbols/fid/windows" \
@@ -127,7 +240,7 @@ python3 "$ROOT/match-iggy-functions.py" \
-analysisTimeoutPerFile 900 \
-scriptPath "$SCRIPT_DIR" \
-postScript ApplyFunctionMap.java "$OUTPUT_DIR/symbols/windows-durango-function-map.tsv" \
-postScript ApplyIggyTypes.java "$OUTPUT_DIR/include" "$SCRIPT_DIR/stubs" "$TYPE_ARCHIVE" \
-postScript ApplyIggyTypes.java "$OUTPUT_DIR/include" "$SCRIPT_DIR/stubs" "$WORK_DIR/iggy-abi-windows.gdt" windows \
-postScript ExportDecompiled.java "$OUTPUT_DIR/raw/windows" \
-deleteProject > "$WORK_DIR/iggy-windows-named.log" 2>&1
@@ -138,7 +251,26 @@ python3 "$ROOT/summarize-iggy-decomp.py" \
"$OUTPUT_DIR/raw/perfmon" "$OUTPUT_DIR/symbols/iggyperfmon_durango.members.txt" \
"$OUTPUT_DIR/symbols/iggyperfmon_durango.modules.tsv"
shasum -a 256 "$CORE_ARCHIVE" "$PERFMON_ARCHIVE" "$WINDOWS_DLL" | \
for summary in \
'orbis|iggy_orbis' \
'orbis-perfmon|iggyperfmon_orbis' \
'ps3|iggy_ps3' \
'ps3-perfmon|iggyperfmon_ps3' \
'ps3-expr|iggyexpruntime_ps3' \
'vita|iggy_vita' \
'vita-perfmon|iggyperfmon_vita'; do
output_name="${summary%%|*}"
symbol_name="${summary#*|}"
python3 "$ROOT/summarize-iggy-decomp.py" \
"$OUTPUT_DIR/raw/$output_name" "$OUTPUT_DIR/symbols/$symbol_name.members.txt" \
"$OUTPUT_DIR/symbols/$symbol_name.modules.tsv"
done
shasum -a 256 "$CORE_ARCHIVE" "$PERFMON_ARCHIVE" "$WINDOWS_DLL" \
"$ORBIS_CORE" "$ORBIS_PERFMON" "$PS3_CORE" "$PS3_PERFMON" "$PS3_EXPR" \
"$VITA_CORE" "$VITA_PERFMON" "$DURANGO_DEBUG" "$DURANGO_PERFMON_DEBUG" \
"$WINDOWS_IGGY_64" "$WINDOWS_IGGY_32" "$WINDOWS_EXPR_64" "$WINDOWS_EXPR_32" \
"$WINDOWS_PERFMON_64" "$WINDOWS_PERFMON_32" | \
sed "s|$SOURCE_DIR/|<neoLegacy>/|g" > "$OUTPUT_DIR/symbols/SHA256SUMS"
find "$OUTPUT_DIR/raw" -type f -name '*.c' -print | sort

View File

@@ -8,18 +8,29 @@ same source revision as the shipping Windows DLL. The archive contains 80
unstripped x86-64 COFF objects with original translation-unit and function
names. `iggyperfmon_durango.lib` adds 12 symbol-rich performance-monitor
objects. The stripped `iggy_w64.dll` is recovered separately for platform and
export parity.
export parity. The Orbis, PS3, and Vita static archives provide independent
x86-64, PowerPC, and ARM compiler views of the same runtime. All 18 Iggy binary
artifacts shipped in neoLegacy are hashed and inventoried.
`raw/durango`, `raw/orbis`, `raw/ps3`, and `raw/vita` are module-by-module core
runtime decompiles. Platform perfmon directories and `raw/ps3-expr` recover the
remaining implementation archives. The Windows `.lib` files are import
metadata, so their members and symbols are recorded rather than misrepresented
as implementation code.
`raw/durango` and `raw/perfmon` are module-by-module decompiler output.
`linked/durango` and `linked/perfmon` are synthetic whole-archive views: the
original objects are linked without CRT/platform dependencies so relocations and
cross-module calls resolve, then their PDB public symbols and linker-map static
symbols are reapplied before decompilation. Every analyzed function in these
linked views has an original symbol name. `raw/windows` is the shipping DLL
linked views has an original symbol name. `linked/orbis` is the corresponding
cross-module SysV view. Sony's private relocation type 40 is normalized to
standard `R_X86_64_GOTPCREL` before linking; the transformation is byte-exact,
idempotent, and covered by a real-archive link test. `raw/windows` is the shipping DLL
decompile. `symbols` contains archive members, COFF symbols, synthetic link maps
and PDB reports, PE import/export data, build identity, Function ID hashes,
cross-platform function matches, and file hashes. `include` contains the shipped
public ABI headers used for type reconciliation.
cross-platform function matches, and file hashes. `original` contains the 59
renderer, shader, and public-header source files that were shipped unobfuscated.
`include` contains the canonical public ABI headers used for type reconciliation.
The shipped ABI headers are parsed and applied automatically to matching public
functions before export. Internal structures, locals, and non-public signatures
@@ -30,4 +41,11 @@ These files are recovered source, not yet hand-cleaned build inputs.
Reconstructed buildable source belongs under `src` as internal structures are
reconciled and validated against the original objects.
`src/internal` begins that reconstruction with compile-checked x86-64
player/library layouts (`0x3750` on Durango and `0x3610` on Orbis) and the
common `0x6b28` AS3 VM allocation. PS3 and Vita add compile-checked 32-bit
layouts and their common `0x4840` AS3 VM allocation. Named offsets are backed by
concrete accesses in every runtime; all unreconciled spans remain explicit
unknown bytes.
Run `./decompile-iggy-libs.sh` to regenerate the complete recovery set.

View File

@@ -7,6 +7,11 @@
| `iggy_durango.lib` | 2014-06-20 20:51:17, 80 unstripped x64 COFF objects | Original module and symbol recovery |
| `iggyperfmon_durango.lib` | 12 unstripped x64 COFF objects | Performance monitor recovery |
| `iggy_w64.dll` | 2014-06-20 20:50:46, Iggy 1.2.30, 203 exports | Shipping Windows implementation |
| `libiggy_orbis.a` | 76 unstripped x64 ELF objects | Independent SysV implementation |
| `libiggy_ps3.a` | 76 unstripped PPC64/32-address ELF objects | Independent big-endian implementation |
| `libiggy_psp2.a` | 76 unstripped ARM ELF objects | Independent 32-bit implementation |
| Platform perfmon/expr archives | 29 unstripped objects | Auxiliary implementation recovery |
| Windows `.lib` files | 417 import members | Complete DLL import/export metadata |
The Durango archive and Windows DLL were produced 31 seconds apart from the
same Iggy source tree. The DLL records the missing PDB as
@@ -20,13 +25,25 @@ same Iggy source tree. The DLL records the missing PDB as
| Core archive | 80 | 4,060 | 151,044 | 0 |
| Perfmon archive | 12 | 237 | 9,262 | 0 |
| Shipping Windows DLL | 1 | 2,236 | 139,910 | 0 |
| Total | 93 | 6,533 | 300,216 | 0 |
| Orbis core | 76 | 3,732 | 159,994 | 0 |
| Orbis perfmon | 8 | 150 | 6,745 | 0 |
| PS3 core | 76 | 3,732 | 180,716 | 0 |
| PS3 perfmon | 8 | 131 | 8,175 | 0 |
| PS3 expression runtime | 5 | 102 | 2,556 | 0 |
| Vita core | 76 | 3,939 | 181,353 | 0 |
| Vita perfmon | 8 | 142 | 7,667 | 0 |
| Raw total | 350 | 18,461 | 847,422 | 0 |
The synthetic linked views add a non-additive cross-module representation of
2,080 core functions (111,035 lines) and 175 perfmon functions (8,502 lines).
They duplicate archive code, so they are excluded from the unique-function
total above.
The Orbis linked view adds 3,329 functions and 160,686 lines. Its one 64-KiB
generated class-initializer function exceeds the linked-view timeout; the same
function is fully recovered with zero failures in the module-level Orbis output.
Linked views are cross-reference aids and are not counted in the raw total.
The shipped headers supplied 193 public ABI signatures across the symbol-rich
archives and 172 signatures in the linked Windows DLL. Function ID matching
cross-mapped 302 DLL functions to their Durango counterparts; 270 stripped
@@ -38,6 +55,13 @@ function names and 636 static data names. Perfmon adds 63 static function names
and 52 static data names. Neither linked decompile contains anonymous `FUN_`
function definitions.
The Orbis normalizer rewrites exactly 2,463 Sony relocation records while
preserving symbol indices, offsets, addends, and all non-relocation bytes. LLVM
rejects the original archive with `unknown relocation (40)` and links the
normalized whole archive successfully. The PS3 loader is explicitly forced to
Ghidra's 64-bit-instruction/32-bit-address ABI so its recovered pointer layout
matches the original `__LP32__` build.
## Module coverage
| Area | Functions | Lines |
@@ -51,9 +75,8 @@ function definitions.
| Platform layer | 106 | 2,275 |
| Support code | 94 | 7,333 |
Exact per-module counts and original COFF object paths are in
`symbols/iggy_durango.modules.tsv` and
`symbols/iggyperfmon_durango.modules.tsv`.
Exact per-module counts and original object paths are in the platform module
indexes under `symbols`.
## Fidelity boundary
@@ -62,3 +85,12 @@ ABI types are applied from the original headers, and symbol-rich archive names
are retained. Internal aggregate layouts, local variable names, and types not
present in the public headers remain provisional and require manual structure
recovery before the raw output can be compiled as a drop-in library.
The first internal aggregate is now recovered under `src/internal`: the x86-64
player/library object is exactly `0x3750` bytes on Durango and `0x3610` on
Orbis, where libc uses smaller jump buffers. Both independently place the AS3
VM allocation size at `0x6b28` bytes and agree on the recovered field offsets
through `0x3550`. PS3 and Vita independently recover the 32-bit layout as
`0x3018` and `0x2d58` bytes with a common `0x4840`-byte AS3 VM allocation. The
evidenced fields have compile-time size and offset assertions; unknown spans
remain untyped pending further reconciliation.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,147 @@
#include "stdafx.h" // 4J
// gdraw_d3d11.cpp - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// This implements the Iggy graphics driver layer for D3D 11.
// GDraw consists of several components that interact fairly loosely with each other;
// e.g. the resource management, drawing and filtering parts are all fairly independent
// of each other. If you want to modify some aspect of GDraw - say the texture allocation
// logic - your best bet is usually to just look for one of the related entry points,
// e.g. MakeTextureBegin, and take it from there. There's a bunch of code in this file,
// but none of it is really complicated.
//
// The one bit you might want to change that's not that localized is to integrate
// GDraw with an existing state caching system. The following bits all modify D3D state
// in some way:
// - The rendering helpers (set_viewport_raw, set_projection_raw, set_*_renderstate)
// - RenderTile*/TextureDrawBuffer* may change the active rendertarget and depth/stencil surface,
// as do D3D1X_(NoMoreGDrawThisFrame) and set_render_target
// - set_texture
// - set_renderstate and set_renderstate_full. These are the main places where render state changes occur;
// you should probably start here.
// - DrawIndexedTriangles sets the active vertex/index buffers and vertex declaration
// - Most of the functions in the "filter effects" section modify D3D state, mostly
// pixel shader constants and textures
#define GDRAW_ASSERTS
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// We temporarily disable this warning for the shared interface portions
#pragma warning (push)
#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
#include <windows.h>
#include <d3d11_x.h> // 4J changed to use monolithic version
#include "gdraw.h"
#include "iggy.h"
#include <string.h>
#include <math.h>
#include "gdraw_d3d11.h"
#pragma warning (pop)
// Some macros to allow as much sharing between D3D10 and D3D11 code as possible.
#define D3D1X_(id) D3D11_##id
#define ID3D1X(id) ID3D11##id
#define gdraw_D3D1X_(id) gdraw_D3D11_##id
#define GDRAW_D3D1X_(id) GDRAW_D3D11_##id
typedef ID3D11Device ID3D1XDevice;
typedef ID3D11DeviceContext ID3D1XContext;
typedef F32 ViewCoord;
typedef gdraw_d3d11_resourcetype gdraw_resourcetype;
static void report_d3d_error(HRESULT hr, char *call, char *context);
static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard)
{
D3D11_MAPPED_SUBRESOURCE msr;
HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr);
if (FAILED(hr)) {
report_d3d_error(hr, "Map", "of buffer");
return nullptr;
} else
return msr.pData;
}
static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf)
{
ctx->Unmap(buf, 0);
}
static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader)
{
ctx->PSSetShader(shader, nullptr, 0);
}
static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader)
{
ctx->VSSetShader(shader, nullptr, 0);
}
static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst)
{
D3D11_BLEND_DESC desc = {};
desc.RenderTarget[0].BlendEnable = blend;
desc.RenderTarget[0].SrcBlend = src;
desc.RenderTarget[0].DestBlend = dst;
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].SrcBlendAlpha = (src == D3D11_BLEND_DEST_COLOR ) ? D3D11_BLEND_DEST_ALPHA : src;
desc.RenderTarget[0].DestBlendAlpha = dst;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
ID3D11BlendState *res;
HRESULT hr = dev->CreateBlendState(&desc, &res);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateBlendState", "");
res = nullptr;
}
return res;
}
#define GDRAW_SHADER_FILE "gdraw_d3d10_shaders.inl"
#include "gdraw_d3d1x_shared.inl"
static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreatePixelShader", "");
p->pshader = nullptr;
return;
}
}
}
static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateVertexShader", "");
p->vshader = nullptr;
return;
}
}
}
GDrawFunctions *gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11DeviceContext *ctx, S32 w, S32 h)
{
return create_context(dev, ctx, w, h);
}
// 4J added - interface so we can set the viewport back to the one that Iggy last set up
void gdraw_D3D11_setViewport_4J()
{
set_viewport();
}

View File

@@ -0,0 +1,137 @@
#pragma once
// gdraw_d3d11.h - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// Interface for creating a D3D11 GDraw driver.
#define IDOC
//idoc(parent,GDraw_d3d11)
typedef enum gdraw_d3d11_resourcetype
{
GDRAW_D3D11_RESOURCE_rendertarget,
GDRAW_D3D11_RESOURCE_texture,
GDRAW_D3D11_RESOURCE_vertexbuffer,
GDRAW_D3D11_RESOURCE_dynbuffer, // Streaming buffer for dynamic vertex/index data (handle count ignored)
GDRAW_D3D11_RESOURCE__count,
} gdraw_d3d11_resourcetype;
IDOC extern int gdraw_D3D11_SetResourceLimits(gdraw_d3d11_resourcetype type, S32 num_handles, S32 num_bytes);
/* This sets how large the memory pool for a given resource types is, and how many handles
GDraw should allocate for it. GDraw keeps track of allocations in each pool, and will free
old resources in a LRU manner to make space if one of the limits is about to be exceeded.
Returns 1 if value successfully changed, 0 on error.
You need to call IggyPlayerFlushAll on all active Iggys before you do this to make
them flush their resources since changing the resource limits invalidates all handles.
You also need to call IggyFlushInstalledFonts if you have any installed fonts.
*/
IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11DeviceContext *ctx, S32 w, S32 h);
/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device,
the device context to use for rendering, and the width/height of render target textures.
The width/height is used solely for sizing internal rendertargets. They will be
allocated to the larger of this size and the size of any rendered tiles (with padding).
In other words, you can pass in (0,0) and the rendertargets will be allocated to the
right size. However, if you draw multiple Iggy files or tiles of different sizes,
they might first be allocated too small; it's best to pass in the correct size initially
to avoid unnecessary allocation/deallocation of too-small rendertargets.
There can only be one D3D GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_D3D11_DestroyContext(void);
/* Destroys the current GDraw context, if any. */
IDOC extern void gdraw_D3D11_SetErrorHandler(void (__cdecl *error_handler)(HRESULT hr));
/* Sets the GDraw D3D error handler.
This will get called with the respective D3D error code if GDraw encounters an error
that it can't handle by itself (e.g. running out of state objects). */
IDOC extern void gdraw_D3D11_SetRendertargetSize(S32 w, S32 h);
/* Changes the current render target size (and recreates all rendertargets if necessary).
This allows you to shrink the rendertargets if the new needed size is smaller
than it was previously. As with $gdraw_D3D11_CreateContext, the width and
height specified here are only minimums; GDraw will reallocate larger rendertargets
as needed. */
IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D11DepthStencilView *main_ds,
ID3D11ShaderResourceView *non_msaa_rt, S32 x, S32 y);
/* This sets the main rendertarget and matching depth/stencil buffer that GDraw
should render to and the x/y position of the output location of the top-left
of the current tile (allowing you to finely-position content, or to do tiled
rendering).
If your rendertarget uses multisampling, you also need to specify a shader
resource view for a non-MSAA rendertarget texture (identically sized to main_rt)
in non_msaa_rt. This is only used if the Flash content includes non-standard
blend modes which have to use a special blend shader, so you can leave it nullptr
if you forbid such content.
You need to call this before Iggy calls any rendering functions. */
IDOC extern void gdraw_D3D11_NoMoreGDrawThisFrame(void);
/* Tells GDraw that no more rendering operations will occur this frame. This triggers
some end-of-frame processing; most importantly, GDraw uses this call as a marker to
detect thrashing (and react accordingly), so please do not forget to call this
every frame! (As long as Iggy does any rendering, that is) */
IDOC extern void gdraw_D3D11_PreReset(void);
/* Call this before D3D device Reset(); it will free all default pool resources allocated
by GDraw. */
IDOC extern void gdraw_D3D11_PostReset(void);
/* Call after D3D device Reset(). */
IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw_4J(IggyCustomDrawCallbackRegion *Region, F32 mat[16]);
IDOC extern void RADLINK gdraw_D3D11_CalculateCustomDraw_4J(IggyCustomDrawCallbackRegion *Region, F32 mat[16]);
IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, F32 mat[4][4]);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set on the D3D device, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_D3D11_EndCustomDraw(IggyCustomDrawCallbackRegion *Region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern void RADLINK gdraw_D3D11_GetResourceUsageStats(gdraw_d3d11_resourcetype type, S32 *handles_used, S32 *bytes_used);
/* D3D only: Get resource usage stats for last frame.
This can be used to get an estimate of how much graphics memory got used by GDraw
during the last frame.
For the dynbuffer, this always returns 0 in handles_used and the *size of the largest
single allocation* in bytes_used. It needs to be sized so that this allocation fits;
make it smaller and it won't work, but if you make it much larger (say more than 2x
as big), it's just a waste of memory. That said, we still recommend to make it no
smaller than 64k, and the default is 256k.
Caveat: This counts the number of bytes that GDraw knows about. 3D hardware usually
has its own management overhead, alignment requirements, allocation granularity
and so on. In short, this is not an accurate estimate of how much memory is actually
used by the GPU - it is a lower bound, though, and makes for a useful ballpark estimate. */
IDOC extern GDrawTexture *gdraw_D3D11_WrappedTextureCreate(ID3D11ShaderResourceView *tex_view);
/* Create a wrapped texture from a shader resource view.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application. */
IDOC extern void gdraw_D3D11_WrappedTextureChange(GDrawTexture *tex, ID3D11ShaderResourceView *tex_view);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying D3D view. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_D3D11_WrappedTextureDestroy(GDrawTexture *tex);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated D3D texture; that is
up to you. */
GDrawTexture * RADLINK gdraw_D3D11_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture);
void RADLINK gdraw_D3D11_DestroyTextureFromResource(GDrawTexture *tex);
// 4J added
extern void RADLINK gdraw_D3D11_setViewport_4J();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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 "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 nullptr, 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-nullptr, 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*) nullptr;
(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 nullptr 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,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 nullptr 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-nullptr $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__

View File

@@ -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__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,196 @@
#pragma once // 4J
// gdraw_orbis.h - author: Fabian Giesen - copyright 2012 RAD Game Tools
//
// Interface for creating an Orbis GDraw driver.
#include "gdraw.h"
#define IDOC
//idoc(parent,GDraw_orbis)
// Size and alignment requirements of GDraw context memory.
#define GDRAW_ORBIS_CONTEXT_MEM_SIZE (64*1024)
// Alignment requirements for different resource types
#define GDRAW_ORBIS_TEXTURE_ALIGNMENT 256 // NOTE this may change in the future!
#define GDRAW_ORBIS_VERTEXBUFFER_ALIGNMENT 256 // NOTE this may change in the future!
typedef enum gdraw_orbis_resourcetype
{
GDRAW_ORBIS_RESOURCE_rendertarget, // put in video private memory if possible, must be GPU visible
GDRAW_ORBIS_RESOURCE_texture, // put in video private memory if possible, must be GPU visible
GDRAW_ORBIS_RESOURCE_vertexbuffer, // put in any GPU visible memory
GDRAW_ORBIS_RESOURCE__count,
} gdraw_orbis_resourcetype;
typedef struct
{
U32 allocs_attempted; // number of allocations attempted from the staging buffer
U32 allocs_succeeded; // number of allocations that succeeded
U32 bytes_attempted; // number of bytes attempted to allocate
U32 bytes_succeeded; // number of bytes successfully allocated
U32 largest_bytes_attempted; // number of bytes in largest attempted alloc
U32 largest_bytes_succeeded; // number of bytes in lagrest successful alloc
} gdraw_orbis_staging_stats;
IDOC extern int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 num_handles, void *ptr, S32 num_bytes);
/* Sets up the resource pools that GDraw uses for its video memory management.
It sets both the number of handles and the address and size of memory to use.
GDraw keeps track of allocations in each pool, and will free old resources in
a LRU manner to make space if one of the limits is about to be exceeded. It will
also automatically defragment memory if necessary to fulfill an allocation
request.
You need to set up all of the resource pools before you can start rendering.
If you modify this at runtime, you need to call IggyPlayerFlushAll on all
active Iggys (if any) since this call invalidates all resource handles they
currently hold.
SetResourceMemory takes a void* argument for the address of the resource pool.
Pass in nullptr and zero bytes to reset a specific pool.
Resource pool memory has certain alignment requirements - see the #defines
above. If you pass in an unaligned pointer, GDraw will automatically clip off
some bytes at the front to make the buffer aligned - in other words, you get
somewhat less usable bytes, but it should work fine.
"rendertarget" memory is only used during Iggy rendering. In other words, you
are free to use that memory for other purposes such as your own render targets
or depth buffers as long as it doesn't need to be preserved across IggyPlayerDraw*
calls.
If any Iggy draw calls are in flight, this call will block waiting for
those calls to finish (i.e. for the resource memory to become
unused).
*/
IDOC extern void gdraw_orbis_ResetAllResourceMemory();
/* Frees all resource pools managed by GDraw.
Use this as a quick way of freeing (nearly) all memory allocated by GDraw
without shutting it down completely. For example, you might want to use this
to quickly flush all memory allocated by GDraw when transitioning between the
main menu and the game proper. Like with SetResourceMemory, you need to call
IggyPlayerFlushAll on all currently active Iggy players if you do this - although
we recommend that you only use this function when there aren't any. */
IDOC extern GDrawFunctions * gdraw_orbis_CreateContext(S32 w, S32 h, void *context_mem);
/* Creates a GDraw context for rendering using GNM. You need to pass in the width/height
of the Iggy content for use by internal render targets. context_mem must point to an
area in video shared memory that is GDRAW_ORBIS_CONTEXT_MEM_SIZE bytes big - this is
used by GDraw to store labels and shaders in.
There can only be one GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_orbis_DestroyContext(void);
/* Destroys the current GDraw context, if any.
If any Iggy draw calls are in flight, this call will block waiting for
those calls to finish (i.e. for the resource memory to become
unused).
*/
IDOC extern void gdraw_orbis_Begin(sce::Gnmx::GfxContext *context, void *staging_buffer, U32 staging_buf_bytes);
/* This sets the GfxContext that GDraw writes its commands to. It also sets the
address and size of the staging buffer used for dynamic vertex data and in-frame
resource uploads. Any GDraw / Iggy rendering calls outside a Begin / End bracket
are an error and will be treated as such. The GfxContext must be live during the
entire Begin / End bracket.
GDraw maintains a persistent resource cache shared across all Iggys. Because of this,
it is *vital* that all GfxContexts generated from GDraw be kicked in the order
they were generated, or the resource pools might get corrupted. Hence it's recommended
to use only one GfxContext for all Iggy rendering during a frame.
The staging buffer should be allocated in write-combined memory. If it is of insufficient
size, GDraw will not be able to allocate dynamic vertex data or upload new texture/vertex
buffer data during some frames, resulting in glitching! (When this happens, it will be
reported as a warning, so make sure to install a warning callback).
The user is expected to handle GfxContext and staging buffer synchronization; there are
no safeguards on the GDraw side to prevent CPU-GPU race conditions. Please make sure that
the GPU is finished with a GfxContext / staging buffer before reusing its memory!
Typically, this would be accomplished by double buffering everything. */
IDOC extern void gdraw_orbis_End(gdraw_orbis_staging_stats *staging_stats);
/* This marks the end of GDraw rendering for a frame. It also triggers end-of-frame processing,
which is important for GDraw's internal resource management. GDraw will not touch the GfxContext
or staging buffer after this call, so you are free to append other rendering commands after
this call returns.
staging_stats will be filled with stats for the staging buffer, denoting how much memory
was actually used and which allocations were attempted. If you're not interested, just
pass nullptr. */
IDOC extern void gdraw_orbis_SetTileOrigin(sce::Gnm::RenderTarget *color, sce::Gnm::DepthRenderTarget *depth, S32 x, S32 y);
/* This sets the main color and depth buffers that GDraw should render to and the
x/y position of the output location of the top-left pixel of the current tile
(to be used for tiled rendering).
You should call this inside a gdraw_orbis_Begin / gdraw_orbis_End bracket, before
any Iggy / GDraw rendering takes place. */
IDOC extern void gdraw_orbis_ClearWholeRenderTarget(const F32 clear_color_rgba[4]);
/* You typically need to clear the render target before you start Iggy rendering.
This is a convenience function, if you don't want to do the clear yourself. Fast clears
will be used if the render target has them enabled. Note that if fast clears are enabled,
you also need to call gdraw_orbis_EliminateFastClears once you're done with the render target
to make sure the clears are actually properly completed.
This counts as a rendering operation, so it must be called inside a
gdraw_orbis_Begin / gdraw_orbis_End bracket, after gdraw_orbis_SetTileOrigin has been called. */
IDOC extern void gdraw_orbis_EliminateFastClears(void);
/* If the render target specified in gdraw_orbis_SetTileOrigin has fast clears enabled, you
need to do a post-process step to make sure the clears get properly computed. This function
performs that step. If your render target doesn't have fast clears enabled, it simply does
nothing.
This counts as a rendering operation, so it must be called inside a
gdraw_orbis_Begin / gdraw_orbis_End bracket, after gdraw_orbis_SetTileOrigin has been called. */
IDOC extern void RADLINK gdraw_orbis_CalculateCustomDraw_4J(IggyCustomDrawCallbackRegion *region, float matrix[16]);
IDOC extern void RADLINK gdraw_orbis_BeginCustomDraw(IggyCustomDrawCallbackRegion *region, float matrix[16]);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_orbis_EndCustomDraw(IggyCustomDrawCallbackRegion *region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern GDrawTexture *gdraw_orbis_WrappedTextureCreate(sce::Gnm::Texture *tex);
/* Create a wrapped texture from a GNM texture.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application.
GDraw makes a copy of the contents of the Gnm::Texture (the contents of the struct
that is, not the data it points to). If you later modify the fields of "tex", you
need to call $gdraw_orbis_WrappedTextureChange.
*/
IDOC extern void gdraw_orbis_WrappedTextureChange(GDrawTexture *handle, sce::Gnm::Texture *tex);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying GNM texture. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_orbis_WrappedTextureDestroy(GDrawTexture *handle);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated GNM texture; that is
up to you. */
IDOC extern GDrawTexture * RADLINK gdraw_orbis_MakeTextureFromResource(U8 *file_in_memory, S32 length, IggyFileTexturePS4 *tex);
/* Sets up a texture loaded from a .sekrit2.iggytex file. */
extern void RADLINK gdraw_orbis_DestroyTextureFromResource(GDrawTexture *tex);
// 4J added
extern void RADLINK gdraw_orbis_setViewport_4J();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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 "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 nullptr, 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-nullptr, 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*) nullptr;
(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 nullptr 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,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 nullptr 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-nullptr $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__

View File

@@ -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__

View File

@@ -0,0 +1,21 @@
#ifndef __RAD_INCLUDE_IGGYPERFMON_ORBIS_H__
#define __RAD_INCLUDE_IGGYPERFMON_ORBIS_H__
// You still need to include regular iggyperfmon.h first. This is just for convenience.
#define IggyPerfmonPadFromScePadData(pad, paddata) \
(pad).bits = 0, \
(pad).field.dpad_up = 0 != ((paddata).buttons & SCE_PAD_BUTTON_UP), \
(pad).field.dpad_down = 0 != ((paddata).buttons & SCE_PAD_BUTTON_DOWN), \
(pad).field.dpad_left = 0 != ((paddata).buttons & SCE_PAD_BUTTON_LEFT), \
(pad).field.dpad_right = 0 != ((paddata).buttons & SCE_PAD_BUTTON_RIGHT), \
(pad).field.button_up = 0 != ((paddata).buttons & SCE_PAD_BUTTON_TRIANGLE), \
(pad).field.button_down = 0 != ((paddata).buttons & SCE_PAD_BUTTON_CROSS), \
(pad).field.button_left = 0 != ((paddata).buttons & SCE_PAD_BUTTON_SQUARE), \
(pad).field.button_right = 0 != ((paddata).buttons & SCE_PAD_BUTTON_CIRCLE), \
(pad).field.shoulder_left_hi = 0 != ((paddata).buttons & SCE_PAD_BUTTON_L1), \
(pad).field.shoulder_right_hi = 0 != ((paddata).buttons & SCE_PAD_BUTTON_R1), \
(pad).field.trigger_left_low = 0 != ((paddata).buttons & SCE_PAD_BUTTON_L2), \
(pad).field.trigger_right_low = 0 != ((paddata).buttons & SCE_PAD_BUTTON_R2)
#endif//__RAD_INCLUDE_IGGYPERFMON_ORBIS_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,159 @@
#pragma once
// gdraw_ps3gcm.h - copyright 2010-2011 RAD Game Tools
//
// Interface for creating a GCM GDraw driver.
#include "gdraw.h"
#define IDOC
//idoc(parent, GDraw_ps3gcm)
typedef enum gdraw_gcm_resourcetype
{
GDRAW_GCM_RESOURCE_texture,
GDRAW_GCM_RESOURCE_vertexbuffer,
GDRAW_GCM_RESOURCE_dyn_vertexbuffer,
GDRAW_GCM_RESOURCE__count,
} gdraw_gcm_resourcetype;
IDOC extern int gdraw_GCM_SetResourceMemory(gdraw_gcm_resourcetype type, S32 num_handles, void *ptr, S32 num_bytes);
/* This sets up the resource pools that GDraw uses for its video memory management.
It sets both the number of handles and the address and size of memory to use.
GDraw keeps track of allocations in each pool, and will free old resources in
a LRU manner to make space if one of the limits is about to be exceeded. It will
also automatically defragment memory if necessary to fulfill an allocation
request. The pointer should be either to RSX local memory or to RSX-mapped
main memory. It also needs to be aligned to a cache line boundary (128 bytes).
You need to set up all of the resource pools before you can start rendering.
If you modify this at runtime, you need to call IggyPlayerFlushAll on all
active Iggys (if any) since this call invalidates all resource handles they
currently hold.
If any Iggy draw calls are in flight, this call will block waiting for
those calls to finish (i.e. for the resource memory to become
unused).
*/
IDOC extern int gdraw_GCM_SetRendertargetMemory(void *ptr, S32 num_bytes, S32 width, S32 height, S32 pitch);
/* Specifies the start address, size and physical dimensions of the region used to allocate render targets from.
All render targets allocated by GDraw have the same size (width x height pixels) and will use the same pitch;
thus you can pack them all into one tile region, which is recommended from a performance perspective.
Pitch must allow for 4-byte-per-pixel rendertargets (so pitch must be at least width*4).
On other platforms, Iggy does not require you to correctly specify the width and height of the
rendertargets; the size you specify is a hint, and GDraw will detect the actual
needed size and reallocate the rendertargets to be large enough as needed.
Because of the need to set pitch accurately, this is not true on the PS3; instead,
the width and height you specify here _must_ be sufficiently large. To be explicit,
each of width and height be as large as the largest Iggy you will render in that
dimension, or if you're rendering with tiles, the largest tile you'll render,
including padding (possibly on both sides).
For example, if all you ever render is a 400x300 Iggy, you could call this
with width,height=300. If all you render is a 1920x1080 Iggy split into two
horizontal tiles with 8 pixels of padding, you could call this with
width=960+8*2, height=1080+8*2. (This is assuming there is padding on all
sides of the tile; in practice, with this particular arrangement, there is
only ever one column of horizontal padding, so technically it is large
enough to use <960+8,1080>. I prefer to just always pad all sides so that
I don't have to worry about how things change depending on 3-tiles-in-a-row
versus 4-quadrant-tiles, but this does waste some memory.)
If you render multiple Iggys in one frame (or, generally, during a single "major mode",
since you don't want to reallocate rendertargets on the fly), you must take the max
of each dimension. For example, if you were to render:
$* A 500x200 Iggy
$* An 800x100 Iggy
$* One Iggy using two 400x300 tiles, each with 8 pixels of padding
Then the necessary width would be max(500,800,300+8*2) and the necessary height
would be max(200,100,400+8*2); in other words, you would need to call this
function with width and height no smaller than <800,416>.
You can use this memory for your own purposes as well. IggyPlayerDraw* calls will write to it,
and you should not touch it _during_ IggyDraw calls. GDraw only touches this memory from
the GPU, so you must only access it from the GPU.
Calling this function causes GDraw to wait for all outstanding GDraw operations
to drain from the GPU pipeline.
*/
IDOC extern void gdraw_GCM_ResetAllResourceMemory();
/* Frees all resource pools managed by GDraw. (This includes rendertargets)
Use this as a quick way of freeing (nearly) all memory allocated by GDraw
without shutting it down completely. For example, you might want to use this
to quickly flush all memory allocated by GDraw when transitioning between the
main menu and the game proper. Like with SetResourceMemory, you need to call
IggyPlayerFlushAll on all currently active Iggy players if you do this - although
we recommend that you only use this function when there aren't any. */
#define GDRAW_GCM_LOCAL_WORKMEM_SIZE (64*1024)
// GDraw needs some amount of RSX local memory for itself, to allocate fragment programs and other system resources in.
IDOC extern GDrawFunctions * gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_workmem, U8 rsx_label_index);
/* Creates a GDraw context for rendering using GCM. You need to pass in the GcmContextData
(this needs to be your main command buffer; GDraw does its own resource management,
inserts sync commands, and expects them to be executed at some point!).
You also need to pass a pointer to GDRAW_GCM_LOCAL_WORKMEM_SIZE bytes of RSX
local memory; GDraw stores its fragment programs and some other small resources
there. Finally, you need to pass in the number of a free RSX label index to be
used by GDraw.
There can only be one GCM GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_GCM_DestroyContext(void);
/* Destroys the current GDraw context, if any. */
IDOC extern void gdraw_GCM_SetTileOrigin(CellGcmSurface *rt, S32 x, S32 y);
/* This sets the surface that GDraw should render to and the x/y position of the
output location of the top-left pixel of the current tile (to be used for tiled rendering).
The main rendertarget needs to be non-multisampled ARGB with 32 bits/pixel;
multisampling is not currently supported (nor is it necessary, as Iggy does its
own antialiasing). The Z-buffer needs to be 24-bit depth with 8 bits of stencil.
Rendertargets 1-3 should be disabled (i.e. no MRT).
You need to call this before Iggy calls any rendering functions. */
IDOC extern void gdraw_GCM_NoMoreGDrawThisFrame(void);
/* Tells GDraw that no more rendering operations will occur this frame. This triggers
some end-of-frame processing, which is important for GDraws resource management to
work, so please do not forget to call this every frame! (As long as Iggy does any
rendering, that is) */
IDOC extern void RADLINK gdraw_GCM_CalculateCustomDraw_4J(IggyCustomDrawCallbackRegion *Region, F32 mat[16]);
IDOC extern void RADLINK gdraw_GCM_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, float *mat);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set on the RSX, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_GCM_EndCustomDraw(IggyCustomDrawCallbackRegion *Region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern GDrawTexture *gdraw_GCM_WrappedTextureCreate(CellGcmTexture *gcm_tex);
/* Create a wrapped texture from a CellGcmTexture.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; object lifetime management is up to you. */
IDOC extern void gdraw_GCM_WrappedTextureChange(GDrawTexture *tex, CellGcmTexture *gcm_tex);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying GCM texture. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not do any lifetime management. */
IDOC extern void gdraw_GCM_WrappedTextureDestroy(GDrawTexture *tex);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle, nothing else. */
extern GDrawTexture * RADLINK gdraw_GCM_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTexturePS3 *texture);
extern void RADLINK gdraw_GCM_DestroyTextureFromResource(GDrawTexture *tex);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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 "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 nullptr, 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-nullptr, 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*) nullptr;
(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 nullptr 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,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 nullptr 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-nullptr $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__

View File

@@ -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__

View File

@@ -0,0 +1,21 @@
#ifndef __RAD_INCLUDE_IGGYPERFMON_PS3_H__
#define __RAD_INCLUDE_IGGYPERFMON_PS3_H__
// You still need to include regular iggyperfmon.h first. This is just for convenience.
#define IggyPerfmonPadFromCellPadData(pad, paddata) \
(pad).bits = 0, \
(pad).field.dpad_up = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_UP), \
(pad).field.dpad_down = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_DOWN), \
(pad).field.dpad_left = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_LEFT), \
(pad).field.dpad_right = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_RIGHT), \
(pad).field.button_up = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE), \
(pad).field.button_down = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CROSS), \
(pad).field.button_left = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_SQUARE), \
(pad).field.button_right = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CIRCLE), \
(pad).field.shoulder_left_hi = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L1), \
(pad).field.shoulder_right_hi = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R1), \
(pad).field.trigger_left_low = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L2), \
(pad).field.trigger_right_low = 0 != ((paddata).button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R2)
#endif//__RAD_INCLUDE_IGGYPERFMON_PS3_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,264 @@
// gdraw_psp2.h - author: Fabian Giesen - copyright 2014 RAD Game Tools
//
// Interface for creating a PSP2 GDraw driver.
#include "gdraw.h"
#define IDOC
//idoc(parent,GDraw_psp2)
// Size and alignment requirements of GDraw context memory.
#define GDRAW_PSP2_CONTEXT_MEM_SIZE (16*1024)
// Alignment requirements for different resource types (in bytes)
#define GDRAW_PSP2_TEXTURE_ALIGNMENT 16
#define GDRAW_PSP2_VERTEXBUFFER_ALIGNMENT 16
typedef enum gdraw_psp2_resourcetype
{
GDRAW_PSP2_RESOURCE_texture,
GDRAW_PSP2_RESOURCE_vertexbuffer,
GDRAW_PSP2_RESOURCE__count,
} gdraw_psp2_resourcetype;
typedef struct
{
U32 allocs_attempted; // number of allocations attempted from the staging buffer
U32 allocs_succeeded; // number of allocations that succeeded
U32 bytes_attempted; // number of bytes attempted to allocate
U32 bytes_succeeded; // number of bytes successfully allocated
U32 largest_bytes_attempted; // number of bytes in largest attempted alloc
U32 largest_bytes_succeeded; // number of bytes in lagrest successful alloc
} gdraw_psp2_dynamic_stats;
typedef struct
{
void *start; // pointer to the start of the buffer
U32 size_in_bytes; // size of the buffer in bytes
U64 sync; // used internally by GDraw for synchronization.
gdraw_psp2_dynamic_stats stats; // stats on buffer usage - these are for your benefit!
} gdraw_psp2_dynamic_buffer;
IDOC extern void gdraw_psp2_InitDynamicBuffer(gdraw_psp2_dynamic_buffer *buffer, void *ptr, U32 num_bytes);
/* Initializes a GDraw dynamic buffer struct.
The "dynamic buffer" is where GDraw stores all transient data for a scene - dynamic
vertex and index data, uniform buffers and the like. We wrap them in a struct
so we can handle synchronization with the GPU.
"ptr" should point to non-cached, GPU-mapped readable memory. "num_bytes" is the size of
the buffer in bytes. */
IDOC extern void gdraw_psp2_WaitForDynamicBufferIdle(gdraw_psp2_dynamic_buffer *buffer);
/* Waits until a GDraw dynamic buffer is idle, i.e. not being used by the
GPU anymore. You need to call this if you intend to free the allocated storage. */
IDOC extern int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles, void *ptr, S32 num_bytes);
/* Sets up the resource pools that GDraw uses for its video memory management.
It sets both the number of handles and the address and size of memory to use.
GDraw keeps track of allocations in each pool, and will free old resources in
a LRU manner to make space if one of the limits is about to be exceeded. It will
also automatically defragment memory if necessary to fulfill an allocation
request.
"ptr" points to the address of the resource pool. This memory needs to be
mapped to the GPU and *writeable*. If it isn't, the GPU will crash during
either this function or CreateContext!
Pass in nullptr for "ptr" and zero "num_bytes" to free the memory allocated to
a specific pool.
GDraw can run into cases where resource memory gets fragmented; we defragment
automatically in that case. However, to make this work, GDraw on PSP2 needs
resource pool memory equivalent to *twice* the largest working set in any
scene. So for example, if you use 10MB worth of textures, GDraw needs at least
a 20MB texture pool! On other platforms, we can avoid this extra cost by
draining the GPU pipeline in the middle of a frame in certain rare cases, but
doing so on PSP2 would mean not supporting deferred contexts.
You need to set up all of the resource pools before you can start rendering.
If you modify this at runtime, you need to call IggyPlayerFlushAll on all
active Iggys (if any) since this call invalidates all resource handles they
currently hold.
Resource pool memory has certain alignment requirements - see the #defines
above. If you pass in an unaligned pointer, GDraw will automatically clip off
some bytes at the front to make the buffer aligned - in other words, you get
somewhat less usable bytes, but it should work fine.
If any Iggy draw calls are in flight, this call will block waiting for
those calls to finish (i.e. for the resource memory to become
unused).
*/
IDOC extern void gdraw_psp2_ResetAllResourceMemory();
/* Frees all resource pools managed by GDraw.
Use this as a quick way of freeing (nearly) all memory allocated by GDraw
without shutting it down completely. For example, you might want to use this
to quickly flush all memory allocated by GDraw when transitioning between the
main menu and the game proper. Like with SetResourceMemory, you need to call
IggyPlayerFlushAll on all currently active Iggy players if you do this - although
we recommend that you only use this function when there aren't any. */
IDOC extern GDrawFunctions * gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, void *context_mem, volatile U32 *notification, SceGxmOutputRegisterFormat reg_format);
/* Creates a GDraw context for rendering using GXM. You need to pass in a pointer to
the shader patcher to use, a pointer to "context memory" which holds a few persistent
resources shared by all Iggys (it needs to hold GDRAW_PSP2_CONTEXT_MEM_SIZE bytes
and must be mapped to be GPU readable), and a pointer to the notificaiton to use for
GDraw sync.
"reg_format" specifies the output register format to specify when creating
GDraw's fragment shaders. This should match your color surface. Typical choices
are:
- SCE_GXM_OUTPUT_REGISTER_FORMAT_UCHAR4 (32-bit output register size in color surface)
- SCE_GXM_OUTPUT_REGISTER_FORMAT_HALF4 (64-bit output register size in color surface)
There can only be one GDraw context active at any one time. The shader_patcher must
be valid for as long as a GDraw context is alive.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_psp2_DestroyContext(void);
/* Destroys the current GDraw context, if any.
If any Iggy draw calls are in flight, this call will block waiting for
those calls to finish (i.e. for the resource memory to become
unused).
*/
IDOC extern void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, const SceGxmDepthStencilSurface *depth,
gdraw_psp2_dynamic_buffer *dynamic_buffer);
/* This sets the SceGxmContext that GDraw writes its commands to. It also specifies
the dynamic buffer to use. Any GDraw / Iggy rendering calls outside a
Begin / End bracket are an error and will be treated as such. The GXM context
and dynamic buffer must be live during the entire Begin / End bracket.
NOTE: If you are passing in a deferred context, see important notes below!
GDraw uses the color and depth surfaces for parameter validation. Make sure to
pass in the same values you passed in to sceGxmBeginScene. Also, inside a given
scene, you may have only *one* $gdraw_psp2_Begin / $gdraw_psp2_End pair.
GDraw maintains a persistent resource cache shared across all Iggys. Because of this,
it is *vital* that all command lists generated from GDraw be executed in the order
they were generated, or the resource pools might get corrupted.
If the dynamic buffer is of insufficient size, GDraw will not be able to allocate dynamic
vertex data or upload new texture/vertex buffer data during some frames, resulting in
glitching! (When this happens, it will be reported as a warning, so make sure to install
a warning callback).
You should use multiple dynamic buffers (at least double-buffer it); otherwise,
GDraw needs to stall every frame to wait for the GPU to process the previous one.
GDraw starts no scenes of its own; you must call BeginScene before you issue
gdraw_psp2_Begin.
If you are a using a deferred context:
--------------------------------------
It's allowed to pass in a deferred context as "context". You may perform Iggy
rendering on a separate thread. However, because there is only a single global
resource pool that is modified directly by GDraw, rendering is *not* thread-safe;
that is, you may do Iggy rendering on any thread, but only a single thread may
be inside a GDraw Begin / End bracket at any given time.
Furthermore, if you use a deferred context, you must use (and execute!) the
resulting command list and end the containing scene *before* you call
$gdraw_psp2_Begin again. That is, usage must look like this:
Main thread: | Other thread:
<other work> | gdraw_psp2_Begin(deferred_ctx, ...)
| <render Iggys>
| gdraw_psp2_End(deferred_ctx, ...)
| ...
| sceGxmEndCommandList(deferred_ctx, &cmd_list)
|
sceGxmBeginScene(...) | <other work>
sceGxmExecuteCommandList(..., cmd_list) |
sceGxmEndScene() |
The second thread may *not* start another $gdraw_psp2_Begin before the main thread
calls sceGxmEndScene().
This is inconvenient, but unfortunately required by our resource management: every
GDraw Begin / End Bracket may end up having to wait for the GPU to finish work done
during a previous bracket, and this only works if the corresponding jobs have been
submitted to the GPU by the point $gdraw_psp2_Begin is called!
*/
IDOC extern SceGxmNotification gdraw_psp2_End();
/* This marks the end of GDraw rendering for a frame. It also triggers end-of-frame processing,
which is important for GDraw's internal resource management. GDraw will not touch the GXM context
or staging buffer after this call, so you are free to append other rendering commands after
this call returns.
This function will also update the "stats" field in the dynamic buffer you passed
to "Begin".
You are *required* to pass the returned SceGxmNotification as your "fragment notification"
when calling sceGxmEndScene. This is necessary to make GDraw's resource management work! */
IDOC extern void gdraw_psp2_SetTileOrigin(S32 x, S32 y);
/* This sets the x/y position of the output location of the top-left pixel of the current
tile. Iggy has support for manual splitting of rendering into multiple tiles; PSP2 is
already a tiled renderer that handles all this in hardware, so in practice
you will probably always pass (0,0) here.
You should call this inside a gdraw_psp2_Begin / gdraw_psp2_End bracket, before
any Iggy / GDraw rendering takes place. */
IDOC extern void gdraw_psp2_ClearBeforeNextRender(const F32 clear_color_rgba[4]);
/* You often want to clear the render target before you start Iggy rendering.
This is a convenience function, if you don't want to do the clear yourself.
Iggy always clears the depth/stencil buffers when it starts rendering; if you
call this function first, it will also clear the color surface to the
specified color during that initial clear. If this function is not called
before rendering, GDraw will leave the contents of the color surface alone.
This function does not do any rendering; it just sets some internal state
that GDraw processes when it starts rendering. That state gets reset for every
call to IggyPlayerDraw or IggyPlayerDrawTile. */
IDOC extern void RADLINK gdraw_psp2_CalculateCustomDraw_4J(IggyCustomDrawCallbackRegion *region, float matrix[16]);
IDOC extern void RADLINK gdraw_psp2_BeginCustomDraw(IggyCustomDrawCallbackRegion *region, float matrix[16]);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_psp2_EndCustomDraw(IggyCustomDrawCallbackRegion *region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern GDrawTexture *gdraw_psp2_WrappedTextureCreate(SceGxmTexture *tex);
/* Create a wrapped texture from a GXM texture.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application.
GDraw makes a copy of the contents of the sceGxmTexture (the contents of the struct
that is, not the data it points to). If you later modify the fields of "tex", you
need to call $gdraw_psp2_WrappedTextureChange.
*/
IDOC extern void gdraw_psp2_WrappedTextureChange(GDrawTexture *handle, SceGxmTexture *tex);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying GXM texture. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_psp2_WrappedTextureDestroy(GDrawTexture *handle);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated GXM texture; that is
up to you. */
IDOC extern GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S32 length, IggyFileTexturePSP2 *tex);
/* Sets up a texture loaded from a .psp2.iggytex file. */
extern void RADLINK gdraw_psp2_DestroyTextureFromResource(GDrawTexture *tex);

View File

@@ -0,0 +1,697 @@
// This file was automatically generated by shadergen. Do not edit by hand!
static unsigned char pshader_basic_0[340] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x51,0x01,0x00,0x00,0xb1,0xcf,0x41,0xdf,
0x8a,0x6b,0xd3,0x79,0x05,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x04,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x05,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xff,
0xbc,0x0d,0xc0,0x40,0x02,0x80,0xb9,0xaf,0xbc,0x0d,0x80,0x40,0x7c,0x0f,0x04,0x00,
0x86,0x47,0xa4,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x31,
0x00,0x00,0x00,0x00,
};
static unsigned char pshader_basic_1[356] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x61,0x01,0x00,0x00,0x49,0x0b,0xba,0x2a,
0x3e,0xd8,0x8d,0x62,0x01,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xf4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x04,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x07,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xaf,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0xcf,0x84,0x4f,0xa4,0x08,0x02,0x01,0x4d,0xcf,
0x80,0x8b,0xb1,0x18,0x7c,0x5f,0x04,0x0f,0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,
0x7e,0x0d,0x81,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x31,
0x00,0x00,0x00,0x00,
};
static unsigned char pshader_basic_2[324] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x41,0x01,0x00,0x00,0x5c,0xcc,0x1b,0x49,
0x32,0xab,0x31,0x63,0x05,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x04,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x00,0x00,
0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x74,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,
0x40,0x09,0x00,0xf8,0x41,0x80,0x36,0x9f,0x88,0x1f,0x85,0x08,0x06,0x82,0xb9,0xff,
0xbc,0x0d,0xc0,0x40,0x00,0x11,0x11,0xcf,0x80,0x87,0xb1,0x18,0x3c,0x8f,0x2d,0x00,
0x86,0x47,0xc4,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x31,
0x00,0x00,0x00,0x00,
};
static unsigned char pshader_basic_3[384] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x7e,0x01,0x00,0x00,0xe7,0x9e,0xee,0x87,
0xbb,0x31,0xff,0xe5,0x05,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x00,0x00,
0xac,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x00,0xf1,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x06,0x82,0x99,0xaf,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x8f,0x84,0x4f,0xa4,0x08,0x02,0x80,0xb9,0xff,
0xbc,0x0d,0x80,0x40,0x3d,0x0f,0x04,0x00,0x86,0x47,0xa4,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_4[400] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x8e,0x01,0x00,0x00,0xbd,0xda,0xe1,0x5f,
0x27,0xe6,0x61,0x9a,0x01,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00,
0xac,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0xcc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x00,0xf1,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x06,0x82,0x99,0xaf,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x8f,0x84,0x4f,0xa4,0x08,0x3c,0x00,0x04,0xcf,
0x84,0x4f,0xa4,0x08,0x02,0x01,0x4d,0xcf,0x80,0x8b,0xb1,0x18,0x7c,0x5f,0x04,0x0f,
0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,0x7e,0x0d,0x81,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_5[416] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x9e,0x01,0x00,0x00,0x6a,0xe8,0x8d,0x48,
0xfa,0xd9,0xd7,0xda,0x07,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x1c,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0d,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x84,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x00,0xf1,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x80,0x80,0x03,0x90,
0x91,0xc2,0x09,0x48,0x04,0x00,0x00,0x00,0x40,0x00,0x00,0xfd,0x81,0x00,0x40,0x80,
0x0a,0x00,0x80,0x30,0x02,0x00,0x04,0xa0,0x86,0x01,0xa4,0x08,0x42,0x00,0x44,0xa0,
0x8a,0x00,0xc0,0x08,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xff,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x8f,0x84,0x4f,0xa4,0x08,0xc1,0x80,0x76,0x9f,
0x88,0x1f,0x85,0x08,0x06,0x82,0xd9,0xff,0xbc,0x0d,0xc0,0x40,0x3c,0x21,0x11,0x1f,
0x80,0x87,0xb1,0x18,0x3c,0x8f,0x2d,0x00,0x86,0x47,0xc4,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_6[376] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x76,0x01,0x00,0x00,0x48,0xfe,0x0b,0xe9,
0x54,0x56,0xde,0x04,0x05,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xf4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x05,0x00,0x00,0x00,
0xac,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x01,0xf1,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0xf9,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x03,0x00,0x04,0xef,
0x84,0x1f,0xa4,0x08,0x02,0x80,0xb9,0xaf,0xbc,0x0d,0x80,0x40,0x3d,0x0f,0x04,0x00,
0x86,0x47,0xa4,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,
0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_7[392] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x86,0x01,0x00,0x00,0x1f,0x4a,0xd5,0xc9,
0x08,0xc3,0x7b,0x19,0x01,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x07,0x00,0x00,0x00,
0xac,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x01,0xf1,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0xf9,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x03,0x00,0x04,0xef,
0x84,0x1f,0xa4,0x08,0x3c,0x00,0x04,0x8f,0x84,0x4f,0xa4,0x08,0x02,0x01,0x4d,0xcf,
0x80,0x8b,0xb1,0x18,0x7c,0x5f,0x04,0x0f,0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,
0x7e,0x0d,0x81,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,
0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_8[368] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x6e,0x01,0x00,0x00,0x15,0x2c,0xa8,0x0d,
0xfc,0x95,0x7c,0xda,0x05,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x07,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x84,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x00,0xf1,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,
0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xff,0xbc,0x0d,0xc0,0x40,0x43,0x80,0x4d,0x8f,
0x80,0x88,0xe1,0x18,0x41,0x0f,0x00,0x2f,0x00,0x1c,0x80,0x08,0xbc,0x10,0x04,0xcf,
0x84,0x47,0xa4,0x08,0x3c,0x8f,0x2d,0x00,0x86,0x47,0xc4,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_9[440] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xb6,0x01,0x00,0x00,0xb2,0x8c,0x0d,0xc0,
0x79,0x78,0x36,0xe0,0x05,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x34,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0c,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0xf4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x00,0x00,0xf0,0x83,
0x20,0x0d,0x00,0x38,0x3c,0x42,0x3e,0x0f,0x80,0x88,0x01,0x18,0x01,0x3e,0x80,0x0f,
0x00,0x02,0x00,0x30,0x03,0x3e,0x00,0x00,0x02,0x00,0x00,0x30,0x00,0x03,0x00,0xe0,
0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x08,0x20,0xf9,0x04,0x81,0x99,0xaf,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,0x84,0x4f,0xa4,0x08,0x02,0x80,0xb9,0xff,
0xbc,0x0d,0x80,0x40,0x3d,0x0f,0x04,0x00,0x86,0x47,0xa4,0x10,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,
0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_10[456] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xc6,0x01,0x00,0x00,0x88,0xc8,0xca,0xdb,
0xe6,0x2c,0x49,0x11,0x01,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x44,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0e,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x00,0x00,0xf0,0x83,
0x20,0x0d,0x00,0x38,0x3c,0x42,0x3e,0x0f,0x80,0x88,0x01,0x18,0x01,0x3e,0x80,0x0f,
0x00,0x02,0x00,0x30,0x03,0x3e,0x00,0x00,0x02,0x00,0x00,0x30,0x00,0x03,0x00,0xe0,
0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x08,0x20,0xf9,0x04,0x81,0x99,0xaf,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,0x84,0x4f,0xa4,0x08,0x3c,0x00,0x04,0xcf,
0x84,0x4f,0xa4,0x08,0x02,0x01,0x4d,0xcf,0x80,0x8b,0xb1,0x18,0x7c,0x5f,0x04,0x0f,
0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,0x7e,0x0d,0x81,0x40,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,
0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_11[480] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xde,0x01,0x00,0x00,0x47,0xd0,0x44,0x86,
0xb9,0x20,0xfa,0x25,0x07,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x5c,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x14,0x00,0x00,0x00,
0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x74,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,
0x04,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x1c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,
0x40,0x09,0x00,0xf8,0x00,0x00,0xf0,0x83,0x20,0x0d,0x00,0x38,0x3c,0x42,0x3e,0x0f,
0x80,0x88,0x01,0x18,0x01,0x3e,0x80,0x0f,0x00,0x02,0x00,0x30,0x03,0x3e,0x00,0x00,
0x02,0x00,0x10,0x30,0x00,0x03,0x00,0xe0,0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0xf9,0x80,0x80,0x03,0x10,0x91,0xc2,0x09,0x48,0x04,0x00,0x00,0x00,
0x40,0x00,0x00,0xfd,0x81,0x00,0x00,0x00,0x0a,0x00,0x80,0x30,0x00,0x00,0x04,0x20,
0x84,0x01,0xa4,0x08,0x40,0x00,0x44,0x20,0x88,0x00,0xc0,0x08,0x00,0x00,0x00,0x00,
0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xff,0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,
0x84,0x4f,0xa4,0x08,0x81,0x80,0x76,0x9f,0x88,0x1f,0x85,0x08,0x06,0x82,0xd9,0xff,
0xbc,0x0d,0xc0,0x40,0x3c,0x21,0x11,0x1f,0x80,0x87,0xb1,0x18,0x3c,0x8f,0x2d,0x00,
0x86,0x47,0xc4,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,
0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,
0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_12[464] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xce,0x01,0x00,0x00,0x5e,0x9f,0x65,0x75,
0x57,0x52,0xaa,0xe4,0x05,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x4c,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0f,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x04,0x10,0x00,0xb0,0x82,0x08,0x00,0x08,0x00,0x00,0x00,0xaf,
0x80,0x00,0x00,0x08,0x3c,0x00,0x14,0x80,0x06,0x01,0x00,0x00,0x00,0x81,0x28,0xe0,
0x84,0x49,0x24,0x08,0x00,0x00,0x00,0x0f,0x80,0x28,0x00,0x00,0x01,0x3e,0x80,0x0f,
0x00,0x0a,0x00,0x30,0x01,0x3e,0x80,0x0f,0x00,0x00,0x00,0x30,0x3c,0x01,0x10,0xc0,
0xa6,0x01,0x00,0x00,0x00,0x03,0x00,0xe0,0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,
0x00,0x08,0x20,0xf9,0x04,0x81,0x99,0xaf,0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,
0x84,0x4f,0xa4,0x08,0x02,0x80,0xb9,0xff,0xbc,0x0d,0x80,0x40,0x3d,0x0f,0x04,0x00,
0x86,0x47,0xa4,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,
0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,
0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_13[480] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xde,0x01,0x00,0x00,0x34,0xdb,0x2b,0x2d,
0x0b,0xbf,0x65,0xd1,0x01,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x5c,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x11,0x00,0x00,0x00,
0x9c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,
0x04,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x1c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x44,0xfa,0x04,0x10,0x00,0xb0,0x82,0x08,0x00,0x08,0x00,0x00,0x00,0xaf,
0x80,0x00,0x00,0x08,0x3c,0x00,0x14,0x80,0x06,0x01,0x00,0x00,0x00,0x81,0x28,0xe0,
0x84,0x49,0x24,0x08,0x00,0x00,0x00,0x0f,0x80,0x28,0x00,0x00,0x01,0x3e,0x80,0x0f,
0x00,0x0a,0x00,0x30,0x01,0x3e,0x80,0x0f,0x00,0x00,0x00,0x30,0x3c,0x01,0x10,0xc0,
0xa6,0x01,0x00,0x00,0x00,0x03,0x00,0xe0,0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,
0x00,0x08,0x20,0xf9,0x04,0x81,0x99,0xaf,0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,
0x84,0x4f,0xa4,0x08,0x3c,0x00,0x04,0xcf,0x84,0x4f,0xa4,0x08,0x02,0x01,0x4d,0xcf,
0x80,0x8b,0xb1,0x18,0x7c,0x5f,0x04,0x0f,0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,
0x7e,0x0d,0x81,0x40,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,
0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,
0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_14[504] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xf6,0x01,0x00,0x00,0x7b,0x93,0xc6,0xae,
0xff,0x91,0x70,0x86,0x07,0x18,0x18,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x74,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x06,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x17,0x00,0x00,0x00,
0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x74,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x00,0x00,
0x04,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,
0x02,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x34,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x01,0x09,0x40,0x0e,0x01,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x04,0x10,0x00,0xb0,
0x82,0x08,0x00,0x08,0x00,0x00,0x00,0xaf,0x80,0x00,0x00,0x08,0x3c,0x00,0x14,0x80,
0x06,0x01,0x00,0x00,0x00,0x81,0x68,0xe0,0x86,0x49,0x24,0x08,0x41,0x10,0x00,0xaf,
0x84,0x28,0x00,0x00,0x01,0x3e,0x80,0x0f,0x00,0x0a,0x00,0x30,0x01,0x3e,0x80,0x0f,
0x00,0x00,0x00,0x30,0x3c,0x01,0x10,0xc0,0xa6,0x01,0x10,0x00,0x00,0x03,0x00,0xe0,
0x04,0xc4,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xf9,0x80,0x80,0x03,0x10,
0x91,0xc2,0x09,0x48,0x04,0x00,0x00,0x00,0x40,0x00,0x00,0xfd,0x81,0x00,0x00,0x00,
0x0a,0x00,0x80,0x30,0x00,0x00,0x04,0x20,0x84,0x01,0xa4,0x08,0x40,0x00,0x44,0x20,
0x88,0x00,0xc0,0x08,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,0x02,0x80,0x99,0xff,
0xbc,0x0d,0xc0,0x40,0x3c,0x00,0x04,0x0f,0x84,0x4f,0xa4,0x08,0x81,0x80,0x76,0x9f,
0x88,0x1f,0x85,0x08,0x06,0x82,0xd9,0xff,0xbc,0x0d,0xc0,0x40,0x3c,0x21,0x11,0x1f,
0x80,0x87,0xb1,0x18,0x3c,0x8f,0x2d,0x00,0x86,0x47,0xc4,0x10,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0c,0x00,0x13,0x00,0x00,0x00,0x0c,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,
0x02,0x04,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,
0x00,0x74,0x65,0x78,0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_15[436] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xb2,0x01,0x00,0x00,0xa4,0x49,0x85,0x88,
0x51,0xb7,0x36,0xb2,0x09,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x30,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x0a,0x00,0x00,0x00,
0xb0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x01,0x00,0x00,0x00,0xcc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x01,0xf1,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0xf9,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,
0x03,0x00,0x04,0xef,0x84,0x1f,0xa4,0x08,0x00,0x81,0x11,0x80,0x82,0x81,0xe1,0x18,
0x7c,0x00,0x44,0x80,0x8a,0xb1,0xc0,0x08,0x8c,0x80,0x03,0x90,0x15,0xc9,0x89,0x48,
0x0c,0x06,0x00,0xf0,0x06,0x04,0x30,0xf9,0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x02,0x80,0x19,0xa0,0x7e,0x0d,0x80,0x40,
0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,
0x13,0x00,0x00,0x00,0x0c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,
0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_16[468] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xd2,0x01,0x00,0x00,0x4a,0xa5,0x50,0x5f,
0x06,0x24,0xb9,0x90,0x09,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x50,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x0e,0x00,0x00,0x00,
0xb0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3d,0x03,0x00,
0x01,0x00,0x00,0x00,0xec,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x01,0xf1,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0xf9,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x40,0x80,0x24,0xa0,0x82,0x41,0x84,0x08,0x41,0x80,0x54,0xa0,0x8a,0x41,0xc0,0x08,
0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,
0x03,0x00,0x04,0xef,0x84,0x1f,0xa4,0x08,0x00,0x81,0x11,0x80,0x82,0x81,0xe1,0x18,
0x7c,0x00,0x44,0x80,0x8a,0xb1,0xc0,0x08,0x8c,0x80,0x03,0x90,0x15,0xc9,0x89,0x48,
0x0c,0x06,0x00,0xf0,0x06,0x04,0x30,0xf9,0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x00,0x00,0x00,0x00,0x40,0x09,0x00,0xf8,
0x02,0x80,0x99,0xaf,0xbc,0x0d,0xc0,0x40,0x02,0x01,0x4d,0xcf,0x80,0x8b,0xb1,0x18,
0x7c,0x5f,0x04,0x0f,0x84,0x33,0xa4,0x08,0x00,0xbc,0x19,0x20,0x7e,0x0d,0x81,0x40,
0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,
0x13,0x00,0x00,0x00,0x0c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,
0x31,0x00,0x00,0x00,
};
static unsigned char pshader_basic_17[436] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xb2,0x01,0x00,0x00,0xcc,0xea,0x40,0x96,
0xf9,0xf6,0xb3,0x74,0x09,0x08,0x18,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x30,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x08,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x0d,0x00,0x00,0x00,
0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x84,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x01,0x00,0x00,0x00,0xcc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x02,0x00,0x02,0x00,0x04,0x00,0x00,0x00,
0x00,0xf1,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x01,0xf9,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x44,0xfa,
0x43,0x80,0x24,0xe0,0x82,0x10,0x84,0x08,0x00,0x01,0x40,0xe0,0x0a,0x00,0x81,0x50,
0x01,0x00,0x41,0xa0,0x02,0x11,0x80,0x08,0x80,0x10,0x04,0xf0,0x86,0x41,0xa4,0x08,
0xc1,0x10,0x64,0xe0,0x82,0x41,0x84,0x08,0x8c,0x80,0x03,0x90,0x15,0xc9,0x89,0x48,
0x0c,0x06,0x00,0xf0,0x06,0x04,0x30,0xf9,0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x01,0x00,0x04,0xa0,0x86,0x11,0xa4,0x08,
0x41,0x00,0x44,0xa0,0x8a,0x10,0xc0,0x08,0x02,0x80,0x19,0xa0,0x7e,0x0d,0x80,0x40,
0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,
0x13,0x00,0x00,0x00,0x0c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x04,0x01,0x00,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x30,0x00,0x74,0x65,0x78,
0x31,0x00,0x00,0x00,
};
static ShaderCode pshader_basic_arr[18] = {
{ pshader_basic_0, { nullptr } },
{ pshader_basic_1, { nullptr } },
{ pshader_basic_2, { nullptr } },
{ pshader_basic_3, { nullptr } },
{ pshader_basic_4, { nullptr } },
{ pshader_basic_5, { nullptr } },
{ pshader_basic_6, { nullptr } },
{ pshader_basic_7, { nullptr } },
{ pshader_basic_8, { nullptr } },
{ pshader_basic_9, { nullptr } },
{ pshader_basic_10, { nullptr } },
{ pshader_basic_11, { nullptr } },
{ pshader_basic_12, { nullptr } },
{ pshader_basic_13, { nullptr } },
{ pshader_basic_14, { nullptr } },
{ pshader_basic_15, { nullptr } },
{ pshader_basic_16, { nullptr } },
{ pshader_basic_17, { nullptr } },
};
static unsigned char pshader_manual_clear_0[220] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0xdc,0x00,0x00,0x00,0xe1,0x66,0xdd,0xe7,
0x28,0x0f,0xc4,0xfd,0x01,0x00,0x18,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x02,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,
0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x64,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x02,0x80,0x19,0xf0,
0x7e,0x0d,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,
0x94,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
static ShaderCode pshader_manual_clear_arr[1] = {
{ pshader_manual_clear_0, { nullptr } },
};
static unsigned char vshader_vspsp2_0[360] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x66,0x01,0x00,0x00,0x7a,0x09,0xc6,0xf5,
0xbc,0x09,0x6e,0xf4,0x00,0x00,0x19,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x18,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x02,0x00,0x18,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0d,0x00,0x00,0x00,
0x90,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,
0x09,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x14,0x91,
0x8a,0x11,0xc1,0x08,0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x00,0x01,0x04,0xc3,0x21,0x0d,0x80,0x38,
0x02,0x80,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x12,0x80,0x80,0x88,0x91,0x18,
0x06,0x82,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x12,0x80,0x00,0x81,0x91,0x18,
0x8b,0x02,0x00,0xf0,0x81,0x99,0xa0,0x00,0x0e,0x86,0x99,0xff,0xbc,0x0d,0x80,0x40,
0x00,0xc2,0x92,0x80,0x81,0x88,0x91,0x18,0x12,0x88,0x99,0xff,0xbc,0x0d,0x80,0x40,
0x00,0xc2,0x92,0x80,0x01,0x81,0x91,0x18,0x80,0x00,0x0c,0x43,0x21,0x05,0x82,0x38,
0x00,0x00,0x20,0xa0,0x00,0x50,0x27,0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,
0x20,0x00,0x00,0x00,0x30,0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x76,0x64,0x61,0x74,0x61,0x00,0x00,0x00,
};
static unsigned char vshader_vspsp2_1[584] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x46,0x02,0x00,0x00,0x4e,0x78,0x52,0xa2,
0xf0,0x4e,0xd4,0x64,0x04,0x00,0x19,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xf8,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x04,0x00,0x1e,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x1f,0x00,0x00,0x00,
0xc8,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x01,0x00,0x00,0x00,0x3d,0x03,0x00,
0x02,0x00,0x00,0x00,0x8c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x8c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x01,0x00,0x00,
0x02,0x00,0x00,0x00,0x7c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,
0x09,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x09,0x00,0xf8,0x02,0x80,0x81,0xaf,0x9c,0x0d,0xc0,0x40,0x44,0x46,0xbe,0x83,
0x82,0x88,0x81,0x18,0x80,0x00,0xf4,0x83,0x20,0x0d,0x80,0x38,0x44,0x46,0xbe,0x93,
0x02,0x89,0x81,0x18,0x04,0x44,0x7e,0x83,0x82,0x90,0x80,0x18,0x01,0x0f,0x55,0x11,
0x82,0x11,0x81,0x08,0x01,0x03,0x14,0x91,0x82,0x11,0x81,0x08,0x00,0x00,0x00,0x00,
0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,
0x00,0x01,0xc0,0xa0,0x85,0x09,0x81,0x40,0x01,0x01,0x40,0xa0,0x86,0x09,0x81,0x40,
0x80,0x01,0x60,0xa0,0x86,0x09,0xc1,0x40,0x4c,0x00,0x44,0xbf,0x84,0x19,0xa4,0x08,
0x3d,0x42,0x3e,0x1f,0x80,0x88,0x81,0x18,0x40,0x0f,0x00,0x03,0x20,0x0d,0x80,0x38,
0x00,0x0f,0xf8,0x0f,0x00,0x0d,0x80,0x38,0x02,0x80,0x99,0xff,0xbc,0x0d,0xc0,0x40,
0x00,0xc2,0x12,0x8f,0x80,0x88,0x91,0x18,0x06,0x82,0xb9,0xff,0xbc,0x0d,0xc0,0x40,
0x00,0xc2,0x12,0x9f,0x00,0x89,0x91,0x18,0x40,0x01,0xf0,0xcc,0x40,0x0d,0x80,0x38,
0x00,0xbf,0x03,0x10,0x81,0x82,0xc9,0x48,0x40,0x03,0x44,0xc0,0x86,0x09,0xa4,0x08,
0x81,0x03,0x44,0xef,0x80,0x99,0x80,0x00,0x3d,0x42,0x7e,0x10,0x82,0x88,0x81,0x18,
0xfd,0x08,0x1c,0x10,0x01,0x54,0x84,0x20,0x81,0x13,0x34,0x90,0x02,0x35,0xc0,0x28,
0x81,0x00,0x20,0x80,0x02,0x0a,0x80,0x30,0x3c,0x10,0x40,0x4f,0x84,0x99,0x80,0x01,
0x7c,0xef,0xf3,0x0f,0xa0,0x4d,0x80,0x38,0x8b,0xc2,0x03,0xff,0x80,0x99,0xa0,0x00,
0x00,0x0f,0x00,0x03,0x21,0x05,0x80,0x38,0x00,0x0f,0x04,0x03,0x59,0x0d,0x80,0x38,
0x0e,0x86,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x92,0x80,0x81,0x88,0x91,0x18,
0x12,0x88,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x92,0x80,0x01,0x81,0x91,0x18,
0xc4,0x00,0xd0,0x70,0x85,0x41,0xa4,0x08,0x00,0x00,0x20,0xa0,0x00,0x50,0x27,0xfb,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x3c,
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x13,0x00,0x00,0x00,0x18,0x00,0x02,0x00,
0x20,0x00,0x00,0x00,0x30,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x76,0x64,0x61,0x74,0x61,0x00,0x00,0x00,
};
static unsigned char vshader_vspsp2_2[336] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x4e,0x01,0x00,0x00,0xa9,0x68,0x75,0x9f,
0xa5,0xeb,0x06,0xda,0x00,0x00,0x19,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x70,0x00,0x00,0x00,
0x04,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,
0x90,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,
0x09,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x14,0x91,
0x8a,0x11,0xc1,0x08,0x00,0x00,0x00,0x00,0x40,0x01,0x04,0xf8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x40,0x00,0x08,0x83,0x21,0x0d,0x80,0x38,
0x02,0x80,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x52,0x80,0x82,0x88,0x91,0x18,
0x06,0x82,0x99,0xff,0xbc,0x0d,0x80,0x40,0x00,0xc2,0x52,0x80,0x02,0x81,0x91,0x18,
0x00,0x01,0x04,0xc3,0x21,0x05,0x80,0x38,0x8b,0x12,0x00,0xf0,0x85,0x91,0xa0,0x00,
0x80,0x00,0x0c,0x43,0x21,0x05,0x82,0x38,0x00,0x00,0x20,0xa0,0x00,0x50,0x27,0xfb,
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x30,0x01,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,
0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x64,0x61,0x74,0x61,0x00,0x00,0x00,
};
static ShaderCode vshader_vspsp2_arr[3] = {
{ vshader_vspsp2_0, { nullptr } },
{ vshader_vspsp2_1, { nullptr } },
{ vshader_vspsp2_2, { nullptr } },
};
static unsigned char vshader_vspsp2_mask_0[304] = {
0x47,0x58,0x50,0x00,0x01,0x05,0x10,0x03,0x30,0x01,0x00,0x00,0x5d,0x89,0x60,0xf7,
0x7b,0x8f,0xec,0x47,0x04,0x00,0x1b,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x01,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0b,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,0x00,0x3d,0x03,0x00,
0x00,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x04,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x44,0xfa,0x02,0x00,0x00,0xa0,0x05,0x00,0x81,0x68,
0x80,0x01,0x20,0x90,0x02,0x00,0xca,0x50,0x80,0x01,0x80,0xaf,0x00,0x00,0xc2,0x50,
0x00,0x32,0xa0,0x2f,0x08,0x00,0xc3,0x50,0x00,0x3e,0x20,0x20,0x0a,0x00,0xc9,0x50,
0x00,0x30,0x00,0x20,0x09,0x00,0x83,0x50,0x80,0x3e,0x20,0x20,0x09,0x00,0x81,0x50,
0x40,0x80,0x24,0x50,0x81,0x41,0x86,0x08,0x01,0x80,0x56,0x90,0x81,0x11,0x83,0x08,
0x00,0x00,0x20,0xa0,0x00,0x50,0x27,0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x94,0x00,0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
static ShaderCode vshader_vspsp2_mask_arr[1] = {
{ vshader_vspsp2_mask_0, { nullptr } },
};

File diff suppressed because it is too large Load Diff

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 "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 nullptr, 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-nullptr, 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*) nullptr;
(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 nullptr 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,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 nullptr 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-nullptr $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__

View File

@@ -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__

View File

@@ -0,0 +1,40 @@
#ifndef __RAD_INCLUDE_IGGYPERFMON_PSP2_H__
#define __RAD_INCLUDE_IGGYPERFMON_PSP2_H__
// You still need to include regular iggyperfmon.h first. This is just for convenience.
#define IggyPerfmonDPadWithShift(ctrldata, testfor) ((testfor) == ((ctrldata).buttons & ((testfor) | SCE_CTRL_L | SCE_CTRL_R)))
// From SceCtrlData (built-in controller)
#define IggyPerfmonPadFromSceCtrlData(pad, ctrldata) \
(pad).bits = 0, \
(pad).field.dpad_up = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_UP), \
(pad).field.dpad_down = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_DOWN), \
(pad).field.dpad_left = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_LEFT), \
(pad).field.dpad_right = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_RIGHT), \
(pad).field.button_up = 0 != ((ctrldata).buttons & SCE_CTRL_TRIANGLE), \
(pad).field.button_down = 0 != ((ctrldata).buttons & SCE_CTRL_CROSS), \
(pad).field.button_left = 0 != ((ctrldata).buttons & SCE_CTRL_SQUARE), \
(pad).field.button_right = 0 != ((ctrldata).buttons & SCE_CTRL_CIRCLE), \
(pad).field.shoulder_left_hi = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_LEFT|SCE_CTRL_L), \
(pad).field.shoulder_right_hi = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_RIGHT|SCE_CTRL_L),\
(pad).field.trigger_left_low = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_LEFT|SCE_CTRL_R), \
(pad).field.trigger_right_low = IggyPerfmonDPadWithShift(ctrldata, SCE_CTRL_RIGHT|SCE_CTRL_R)
// From SceCtrlData2 (wireless controller)
#define IggyPerfmonPadFromSceCtrlData2(pad, ctrldata) \
(pad).bits = 0, \
(pad).field.dpad_up = 0 != ((ctrldata).buttons & SCE_CTRL_UP), \
(pad).field.dpad_down = 0 != ((ctrldata).buttons & SCE_CTRL_DOWN), \
(pad).field.dpad_left = 0 != ((ctrldata).buttons & SCE_CTRL_LEFT), \
(pad).field.dpad_right = 0 != ((ctrldata).buttons & SCE_CTRL_RIGHT), \
(pad).field.button_up = 0 != ((ctrldata).buttons & SCE_CTRL_TRIANGLE), \
(pad).field.button_down = 0 != ((ctrldata).buttons & SCE_CTRL_CROSS), \
(pad).field.button_left = 0 != ((ctrldata).buttons & SCE_CTRL_SQUARE), \
(pad).field.button_right = 0 != ((ctrldata).buttons & SCE_CTRL_CIRCLE), \
(pad).field.shoulder_left_hi = 0 != ((ctrldata).buttons & SCE_CTRL_L1), \
(pad).field.shoulder_right_hi = 0 != ((ctrldata).buttons & SCE_CTRL_R1), \
(pad).field.trigger_left_low = 0 != ((ctrldata).buttons & SCE_CTRL_L2), \
(pad).field.trigger_right_low = 0 != ((ctrldata).buttons & SCE_CTRL_R2)
#endif//__RAD_INCLUDE_IGGYPERFMON_PSP2_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,107 @@
// gdraw_d3d.h - author: Sean Barrett - copyright 2009-2011 RAD Game Tools
//
// Interface for creating a D3D GDraw driver.
#include "gdraw.h"
#define IDOC
//idoc(parent,GDraw_d3d9)
typedef enum gdraw_d3d_resourcetype
{
GDRAW_D3D_RESOURCE_rendertarget,
GDRAW_D3D_RESOURCE_texture,
GDRAW_D3D_RESOURCE_vertexbuffer,
GDRAW_D3D_RESOURCE__count,
} gdraw_d3d_resourcetype;
IDOC extern int gdraw_D3D_SetResourceLimits(gdraw_d3d_resourcetype type, S32 num_handles, S32 num_bytes);
/* This sets how large the memory pool for a given resource types is, and how many handles
GDraw should allocate for it. GDraw keeps track of allocations in each pool, and will free
old resources in a LRU manner to make space if one of the limits is about to be exceeded.
Returns 1 if value successfully changed, 0 on error.
You need to call IggyPlayerFlushAll on all active Iggys before you do this to make
them flush their resources since changing the resource limits invalidates all handles.
You also need to call IggyFlushInstalledFonts if you have any installed fonts.
*/
IDOC extern GDrawFunctions * gdraw_D3D_CreateContext(IDirect3DDevice9 *dev, S32 w, S32 h);
/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device
and the width/height of the content you're displaying.
The width/height is used solely for sizing internal rendertargets. They will be
allocated to the larger of this size and the size of any rendered tiles (with padding).
In other words, you can pass in (0,0) and the rendertargets will be allocated to the
right size. However, if you draw multiple Iggy files or tiles of different sizes,
they might first be allocated too small; it's best to pass in the correct size initially
to avoid unnecessary allocation/deallocation of too-small rendertargets.
There can only be one D3D GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_D3D_SetRendertargetSize(S32 w, S32 h);
/* Reset the size used for internal rendertargets defined by CreateContext. Flushes
all existing rendertargets if the size changes. */
IDOC extern void gdraw_D3D_DestroyContext(void);
/* Destroys the current GDraw context, if any. */
IDOC extern void gdraw_D3D_SetTileOrigin(IDirect3DSurface9 *rt, IDirect3DSurface9 *depth, S32 x, S32 y);
/* This sets the main rendertarget that GDraw should render to, the corresponding
depth/stencil surface, and the x/y position where to draw the top-left of the current tile (to be used for tiled
rendering). You need to call this before Iggy calls any rendering functions. */
IDOC extern void gdraw_D3D_NoMoreGDrawThisFrame(void);
/* Tells GDraw that no more rendering operations will occur this frame. This triggers
some end-of-frame processing; most importantly, GDraw uses this call as a marker to
detect thrashing (and react accordingly), so please do not forget to call this
every frame! (As long as Iggy does any rendering, that is) */
IDOC extern void gdraw_D3D_PreReset(void);
/* Call this before D3D device Reset(); it will free all default pool resources allocated
by GDraw. */
IDOC extern void gdraw_D3D_PostReset(void);
/* Call after D3D device Reset(). */
IDOC extern void RADLINK gdraw_D3D_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, D3DMATRIX *mat);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set on the D3D device, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_D3D_EndCustomDraw(IggyCustomDrawCallbackRegion *Region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern void RADLINK gdraw_D3D_GetResourceUsageStats(gdraw_d3d_resourcetype type, S32 *handles_used, S32 *bytes_used);
/* D3D only: Get resource usage stats for last frame.
This can be used to get an estimate of how much graphics memory got used by GDraw
during the last frame.
Caveat: This counts the number of bytes that GDraw knows about. 3D hardware usually
has its own management overhead, alignment requirements, allocation granularity
and so on. In short, this is not an accurate estimate of how much memory is actually
used by the GPU - it is a lower bound, though, and makes for a useful ballpark estimate. */
IDOC extern GDrawTexture *gdraw_D3D_WrappedTextureCreate(IDirect3DTexture9 *tex_handle);
/* Create a wrapped texture from a D3D texture.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application. */
IDOC extern void gdraw_D3D_WrappedTextureChange(GDrawTexture *tex, IDirect3DTexture9 *tex_handle);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying D3D texture. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_D3D_WrappedTextureDestroy(GDrawTexture *tex);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated D3D texture; that is
up to you. */
extern GDrawTexture * RADLINK gdraw_D3D_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture);
extern void RADLINK gdraw_D3D_DestroyTextureFromResource(GDrawTexture *tex);

View File

@@ -0,0 +1,138 @@
// gdraw_d3d10.cpp - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// This implements the Iggy graphics driver layer for D3D 10.
// GDraw consists of several components that interact fairly loosely with each other;
// e.g. the resource management, drawing and filtering parts are all fairly independent
// of each other. If you want to modify some aspect of GDraw - say the texture allocation
// logic - your best bet is usually to just look for one of the related entry points,
// e.g. MakeTextureBegin, and take it from there. There's a bunch of code in this file,
// but none of it is really complicated.
//
// The one bit you might want to change that's not that localized is to integrate
// GDraw with an existing state caching system. The following bits all modify D3D state
// in some way:
// - The rendering helpers (set_viewport_raw, set_projection_raw, set_*_renderstate)
// - RenderTile*/TextureDrawBuffer* may change the active rendertarget and depth/stencil surface,
// as do D3D1X_(NoMoreGDrawThisFrame) and set_render_target
// - set_texture
// - set_renderstate and set_renderstate_full. These are the main places where render state changes occur;
// you should probably start here.
// - DrawIndexedTriangles sets the active vertex/index buffers and vertex declaration
// - Most of the functions in the "filter effects" section modify D3D state, mostly
// pixel shader constants and textures
#define GDRAW_ASSERTS
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// We temporarily disable this warning for the shared interface portions
#pragma warning (push)
#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
#include <windows.h>
#include <d3d10.h>
#include "gdraw.h"
#include "iggy.h"
#include <string.h>
#include <math.h>
#include "gdraw_d3d10.h"
#pragma warning (pop)
// Some macros to allow as much sharing between D3D10 and D3D11 code as possible.
#define D3D1X_(id) D3D10_##id
#define ID3D1X(id) ID3D10##id
#define gdraw_D3D1X_(id) gdraw_D3D10_##id
#define GDRAW_D3D1X_(id) GDRAW_D3D10_##id
typedef ID3D10Device ID3D1XDevice;
typedef ID3D10Device ID3D1XContext;
typedef S32 ViewCoord;
typedef gdraw_d3d10_resourcetype gdraw_resourcetype;
static void report_d3d_error(HRESULT hr, char *call, char *context);
static void *map_buffer(ID3D1XContext *, ID3D10Buffer *buf, bool discard)
{
void *ptr;
if (FAILED(buf->Map(discard ? D3D10_MAP_WRITE_DISCARD : D3D10_MAP_WRITE_NO_OVERWRITE, 0, &ptr)))
return NULL;
else
return ptr;
}
static void unmap_buffer(ID3D1XContext *, ID3D10Buffer *buf)
{
buf->Unmap();
}
static RADINLINE void set_pixel_shader(ID3D10Device *ctx, ID3D10PixelShader *shader)
{
ctx->PSSetShader(shader);
}
static RADINLINE void set_vertex_shader(ID3D10Device *ctx, ID3D10VertexShader *shader)
{
ctx->VSSetShader(shader);
}
static ID3D10BlendState *create_blend_state(ID3D10Device *dev, BOOL blend, D3D10_BLEND src, D3D10_BLEND dst)
{
D3D10_BLEND_DESC desc = {};
desc.BlendEnable[0] = blend;
desc.SrcBlend = src;
desc.DestBlend = dst;
desc.BlendOp = D3D10_BLEND_OP_ADD;
desc.SrcBlendAlpha = (src == D3D10_BLEND_DEST_COLOR ) ? D3D10_BLEND_DEST_ALPHA : src;
desc.DestBlendAlpha = dst;
desc.BlendOpAlpha = D3D10_BLEND_OP_ADD;
desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL;
ID3D10BlendState *res;
HRESULT hr = dev->CreateBlendState(&desc, &res);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateBlendState", "");
res = NULL;
}
return res;
}
#define GDRAW_SHADER_FILE "gdraw_d3d10_shaders.inl"
#include "gdraw_d3d1x_shared.inl"
static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, &p->pshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreatePixelShader", "");
p->pshader = NULL;
return;
}
}
}
static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, &p->vshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateVertexShader", "");
p->vshader = NULL;
return;
}
}
}
GDrawFunctions *gdraw_D3D10_CreateContext(ID3D10Device *dev, S32 w, S32 h)
{
return create_context(dev, dev, w, h);
}

View File

@@ -0,0 +1,132 @@
// gdraw_d3d10.h - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// Interface for creating a D3D10 GDraw driver.
#define IDOC
//idoc(parent,GDraw_d3d10)
typedef enum gdraw_d3d10_resourcetype
{
GDRAW_D3D10_RESOURCE_rendertarget,
GDRAW_D3D10_RESOURCE_texture,
GDRAW_D3D10_RESOURCE_vertexbuffer,
GDRAW_D3D10_RESOURCE_dynbuffer, // Streaming buffer for dynamic vertex/index data (handle count ignored)
GDRAW_D3D10_RESOURCE__count,
} gdraw_d3d10_resourcetype;
IDOC extern int gdraw_D3D10_SetResourceLimits(gdraw_d3d10_resourcetype type, S32 num_handles, S32 num_bytes);
/* This sets how large the memory pool for a given resource types is, and how many handles
GDraw should allocate for it. GDraw keeps track of allocations in each pool, and will free
old resources in a LRU manner to make space if one of the limits is about to be exceeded.
Returns 1 if value successfully changed, 0 on error.
You need to call IggyPlayerFlushAll on all active Iggys before you do this to make
them flush their resources since changing the resource limits invalidates all handles.
You also need to call IggyFlushInstalledFonts if you have any installed fonts.
*/
IDOC extern GDrawFunctions * gdraw_D3D10_CreateContext(ID3D10Device *dev, S32 w, S32 h);
/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device
and the width/height of render target textures.
The width/height is used solely for sizing internal rendertargets. They will be
allocated to the larger of this size and the size of any rendered tiles (with padding).
In other words, you can pass in (0,0) and the rendertargets will be allocated to the
right size. However, if you draw multiple Iggy files or tiles of different sizes,
they might first be allocated too small; it's best to pass in the correct size initially
to avoid unnecessary allocation/deallocation of too-small rendertargets.
There can only be one D3D GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_D3D10_DestroyContext(void);
/* Destroys the current GDraw context, if any. */
IDOC extern void gdraw_D3D10_SetErrorHandler(void (__cdecl *error_handler)(HRESULT hr));
/* Sets the GDraw D3D error handler.
This will get called with the respective D3D error code if GDraw encounters an error
that it can't handle by itself (e.g. running out of state objects). */
IDOC extern void gdraw_D3D10_SetRendertargetSize(S32 w, S32 h);
/* Changes the current render target size (and recreates all rendertargets if necessary).
This allows you to shrink the rendertargets if the new needed size is smaller
than it was previously. As with $gdraw_D3D10_CreateContext, the width and
height specified here are only minimums; GDraw will reallocate larger rendertargets
as needed. */
IDOC extern void gdraw_D3D10_SetTileOrigin(ID3D10RenderTargetView *main_rt, ID3D10DepthStencilView *main_ds,
ID3D10ShaderResourceView *non_msaa_rt, S32 x, S32 y);
/* This sets the main rendertarget and matching depth/stencil buffer that GDraw
should render to and the x/y position of the output location of the top-left
of the current tile (allowing you to finely-position content, or to do tiled
rendering).
If your rendertarget uses multisampling, you also need to specify a shader
resource view for a non-MSAA rendertarget texture (identically sized to main_rt)
in non_msaa_rt. This is only used if the Flash content includes non-standard
blend modes which have to use a special blend shader, so you can leave it NULL
if you forbid such content.
You need to call this before Iggy calls any rendering functions. */
IDOC extern void gdraw_D3D10_NoMoreGDrawThisFrame(void);
/* Tells GDraw that no more rendering operations will occur this frame. This triggers
some end-of-frame processing; most importantly, GDraw uses this call as a marker to
detect thrashing (and react accordingly), so please do not forget to call this
every frame! (As long as Iggy does any rendering, that is) */
IDOC extern void gdraw_D3D10_PreReset(void);
/* Call this before D3D device Reset(); it will free all default pool resources allocated
by GDraw. */
IDOC extern void gdraw_D3D10_PostReset(void);
/* Call after D3D device Reset(). */
IDOC extern void RADLINK gdraw_D3D10_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, F32 mat[4][4]);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set on the D3D device, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_D3D10_EndCustomDraw(IggyCustomDrawCallbackRegion *Region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern void RADLINK gdraw_D3D10_GetResourceUsageStats(gdraw_d3d10_resourcetype type, S32 *handles_used, S32 *bytes_used);
/* D3D only: Get resource usage stats for last frame.
This can be used to get an estimate of how much graphics memory got used by GDraw
during the last frame.
For the dynbuffer, this always returns 0 in handles_used and the *size of the largest
single allocation* in bytes_used. It needs to be sized so that this allocation fits;
make it smaller and it won't work, but if you make it much larger (say more than 2x
as big), it's just a waste of memory. That said, we still recommend to make it no
smaller than 64k, and the default is 256k.
Caveat: This counts the number of bytes that GDraw knows about. 3D hardware usually
has its own management overhead, alignment requirements, allocation granularity
and so on. In short, this is not an accurate estimate of how much memory is actually
used by the GPU - it is a lower bound, though, and makes for a useful ballpark estimate. */
IDOC extern GDrawTexture *gdraw_D3D10_WrappedTextureCreate(ID3D10ShaderResourceView *tex_view);
/* Create a wrapped texture from a shader resource view.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application. */
IDOC extern void gdraw_D3D10_WrappedTextureChange(GDrawTexture *tex, ID3D10ShaderResourceView *tex_view);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying D3D view. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_D3D10_WrappedTextureDestroy(GDrawTexture *tex);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated D3D texture; that is
up to you. */
extern GDrawTexture * RADLINK gdraw_D3D10_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture);
extern void RADLINK gdraw_D3D10_DestroyTextureFromResource(GDrawTexture *tex);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,147 @@
#include "stdafx.h" // 4J
// gdraw_d3d11.cpp - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// This implements the Iggy graphics driver layer for D3D 11.
// GDraw consists of several components that interact fairly loosely with each other;
// e.g. the resource management, drawing and filtering parts are all fairly independent
// of each other. If you want to modify some aspect of GDraw - say the texture allocation
// logic - your best bet is usually to just look for one of the related entry points,
// e.g. MakeTextureBegin, and take it from there. There's a bunch of code in this file,
// but none of it is really complicated.
//
// The one bit you might want to change that's not that localized is to integrate
// GDraw with an existing state caching system. The following bits all modify D3D state
// in some way:
// - The rendering helpers (set_viewport_raw, set_projection_raw, set_*_renderstate)
// - RenderTile*/TextureDrawBuffer* may change the active rendertarget and depth/stencil surface,
// as do D3D1X_(NoMoreGDrawThisFrame) and set_render_target
// - set_texture
// - set_renderstate and set_renderstate_full. These are the main places where render state changes occur;
// you should probably start here.
// - DrawIndexedTriangles sets the active vertex/index buffers and vertex declaration
// - Most of the functions in the "filter effects" section modify D3D state, mostly
// pixel shader constants and textures
#define GDRAW_ASSERTS
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// We temporarily disable this warning for the shared interface portions
#pragma warning (push)
#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
#include <windows.h>
#include <d3d11.h>
#include "gdraw.h"
#include "iggy.h"
#include <string.h>
#include <math.h>
#include "gdraw_d3d11.h"
#pragma warning (pop)
// Some macros to allow as much sharing between D3D10 and D3D11 code as possible.
#define D3D1X_(id) D3D11_##id
#define ID3D1X(id) ID3D11##id
#define gdraw_D3D1X_(id) gdraw_D3D11_##id
#define GDRAW_D3D1X_(id) GDRAW_D3D11_##id
typedef ID3D11Device ID3D1XDevice;
typedef ID3D11DeviceContext ID3D1XContext;
typedef F32 ViewCoord;
typedef gdraw_d3d11_resourcetype gdraw_resourcetype;
static void report_d3d_error(HRESULT hr, const char *call, const char *context);
static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard)
{
D3D11_MAPPED_SUBRESOURCE msr;
HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr);
if (FAILED(hr)) {
report_d3d_error(hr, "Map", "of buffer");
return nullptr;
} else
return msr.pData;
}
static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf)
{
ctx->Unmap(buf, 0);
}
static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader)
{
ctx->PSSetShader(shader, nullptr, 0);
}
static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader)
{
ctx->VSSetShader(shader, nullptr, 0);
}
static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst)
{
D3D11_BLEND_DESC desc = {};
desc.RenderTarget[0].BlendEnable = blend;
desc.RenderTarget[0].SrcBlend = src;
desc.RenderTarget[0].DestBlend = dst;
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].SrcBlendAlpha = (src == D3D11_BLEND_DEST_COLOR ) ? D3D11_BLEND_DEST_ALPHA : src;
desc.RenderTarget[0].DestBlendAlpha = dst;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
ID3D11BlendState *res;
HRESULT hr = dev->CreateBlendState(&desc, &res);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateBlendState", "");
res = nullptr;
}
return res;
}
#define GDRAW_SHADER_FILE "gdraw_d3d10_shaders.inl"
#include "gdraw_d3d1x_shared.inl"
static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreatePixelShader", "");
p->pshader = nullptr;
return;
}
}
}
static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src)
{
*p = *src;
if(p->bytecode) {
HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader);
if (FAILED(hr)) {
report_d3d_error(hr, "CreateVertexShader", "");
p->vshader = nullptr;
return;
}
}
}
GDrawFunctions *gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11DeviceContext *ctx, S32 w, S32 h)
{
return create_context(dev, ctx, w, h);
}
// 4J added - interface so we can set the viewport back to the one that Iggy last set up
void gdraw_D3D11_setViewport_4J()
{
set_viewport();
}

View File

@@ -0,0 +1,139 @@
#pragma once // 4J
// gdraw_d3d11.h - author: Fabian Giesen - copyright 2011 RAD Game Tools
//
// Interface for creating a D3D11 GDraw driver.
#define IDOC
//idoc(parent,GDraw_d3d11)
typedef enum gdraw_d3d11_resourcetype
{
GDRAW_D3D11_RESOURCE_rendertarget,
GDRAW_D3D11_RESOURCE_texture,
GDRAW_D3D11_RESOURCE_vertexbuffer,
GDRAW_D3D11_RESOURCE_dynbuffer, // Streaming buffer for dynamic vertex/index data (handle count ignored)
GDRAW_D3D11_RESOURCE__count,
} gdraw_d3d11_resourcetype;
IDOC extern int gdraw_D3D11_SetResourceLimits(gdraw_d3d11_resourcetype type, S32 num_handles, S32 num_bytes);
/* This sets how large the memory pool for a given resource types is, and how many handles
GDraw should allocate for it. GDraw keeps track of allocations in each pool, and will free
old resources in a LRU manner to make space if one of the limits is about to be exceeded.
Returns 1 if value successfully changed, 0 on error.
You need to call IggyPlayerFlushAll on all active Iggys before you do this to make
them flush their resources since changing the resource limits invalidates all handles.
You also need to call IggyFlushInstalledFonts if you have any installed fonts.
*/
IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11DeviceContext *ctx, S32 w, S32 h);
/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device,
the device context to use for rendering, and the width/height of render target textures.
The width/height is used solely for sizing internal rendertargets. They will be
allocated to the larger of this size and the size of any rendered tiles (with padding).
In other words, you can pass in (0,0) and the rendertargets will be allocated to the
right size. However, if you draw multiple Iggy files or tiles of different sizes,
they might first be allocated too small; it's best to pass in the correct size initially
to avoid unnecessary allocation/deallocation of too-small rendertargets.
There can only be one D3D GDraw context active at any one time.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_D3D11_DestroyContext(void);
/* Destroys the current GDraw context, if any. */
IDOC extern void gdraw_D3D11_SetErrorHandler(void (__cdecl *error_handler)(HRESULT hr));
/* Sets the GDraw D3D error handler.
This will get called with the respective D3D error code if GDraw encounters an error
that it can't handle by itself (e.g. running out of state objects). */
IDOC extern void gdraw_D3D11_SetRendertargetSize(S32 w, S32 h);
/* Changes the current render target size (and recreates all rendertargets if necessary).
This allows you to shrink the rendertargets if the new needed size is smaller
than it was previously. As with $gdraw_D3D11_CreateContext, the width and
height specified here are only minimums; GDraw will reallocate larger rendertargets
as needed. */
IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D11DepthStencilView *main_ds,
ID3D11ShaderResourceView *non_msaa_rt, S32 x, S32 y);
/* This sets the main rendertarget and matching depth/stencil buffer that GDraw
should render to and the x/y position of the output location of the top-left
of the current tile (allowing you to finely-position content, or to do tiled
rendering).
If your rendertarget uses multisampling, you also need to specify a shader
resource view for a non-MSAA rendertarget texture (identically sized to main_rt)
in non_msaa_rt. This is only used if the Flash content includes non-standard
blend modes which have to use a special blend shader, so you can leave it nullptr
if you forbid such content.
You need to call this before Iggy calls any rendering functions. */
IDOC extern void gdraw_D3D11_NoMoreGDrawThisFrame(void);
/* Tells GDraw that no more rendering operations will occur this frame. This triggers
some end-of-frame processing; most importantly, GDraw uses this call as a marker to
detect thrashing (and react accordingly), so please do not forget to call this
every frame! (As long as Iggy does any rendering, that is) */
IDOC extern void gdraw_D3D11_PreReset(void);
/* Call this before D3D device Reset(); it will free all default pool resources allocated
by GDraw. */
IDOC extern void gdraw_D3D11_PostReset(void);
/* Call after D3D device Reset(). */
IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw_4J(IggyCustomDrawCallbackRegion *Region, F32 mat[16]);
IDOC extern void RADLINK gdraw_D3D11_CalculateCustomDraw_4J(IggyCustomDrawCallbackRegion *Region, F32 mat[16]);
IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, F32 mat[4][4]);
/* Call at the beginning of Iggy custom draw callback to clear any odd render states GDraw has
set on the D3D device, and to get the current 2D object-to-world transformation. */
IDOC extern void RADLINK gdraw_D3D11_EndCustomDraw(IggyCustomDrawCallbackRegion *Region);
/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */
IDOC extern void RADLINK gdraw_D3D11_GetResourceUsageStats(gdraw_d3d11_resourcetype type, S32 *handles_used, S32 *bytes_used);
/* D3D only: Get resource usage stats for last frame.
This can be used to get an estimate of how much graphics memory got used by GDraw
during the last frame.
For the dynbuffer, this always returns 0 in handles_used and the *size of the largest
single allocation* in bytes_used. It needs to be sized so that this allocation fits;
make it smaller and it won't work, but if you make it much larger (say more than 2x
as big), it's just a waste of memory. That said, we still recommend to make it no
smaller than 64k, and the default is 256k.
Caveat: This counts the number of bytes that GDraw knows about. 3D hardware usually
has its own management overhead, alignment requirements, allocation granularity
and so on. In short, this is not an accurate estimate of how much memory is actually
used by the GPU - it is a lower bound, though, and makes for a useful ballpark estimate. */
IDOC extern GDrawTexture *gdraw_D3D11_WrappedTextureCreate(ID3D11ShaderResourceView *tex_view);
/* Create a wrapped texture from a shader resource view.
A wrapped texture can be used to let Iggy draw using the contents of a texture
you create and manage on your own. For example, you might render to this texture,
or stream video into it. Wrapped textures take up a handle. They will never be
freed or otherwise modified by GDraw; nor will GDraw change any reference counts.
All this is up to the application. */
IDOC extern void gdraw_D3D11_WrappedTextureChange(GDrawTexture *tex, ID3D11ShaderResourceView *tex_view);
/* Switch an existing GDrawTexture * that represents a wrapped texture to use
a new underlying D3D view. For example, you might internally double-buffer
a dynamically updated texture. As above, GDraw will leave this texture alone
and not touch any reference counts. */
IDOC extern void gdraw_D3D11_WrappedTextureDestroy(GDrawTexture *tex);
/* Destroys the GDraw wrapper for a wrapped texture object. This will free up
a GDraw texture handle but not release the associated D3D texture; that is
up to you. */
GDrawTexture * RADLINK gdraw_D3D11_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture);
void RADLINK gdraw_D3D11_DestroyTextureFromResource(GDrawTexture *tex);
// 4J added
extern void RADLINK gdraw_D3D11_setViewport_4J();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,202 @@
// gdraw_wgl.c - copyright 2011-2012 RAD Game Tools
//
// This implements the Iggy graphics driver layer for GL on Windows.
#define GDRAW_ASSERTS
#include "iggy.h"
#include "gdraw.h"
#include "gdraw_wgl.h"
#include <windows.h>
#include <gl/gl.h>
#include "glext.h"
#include <string.h>
#include <math.h>
#define true 1
#define false 0
///////////////////////////////////////////////////////////////////////////////
//
// Extensions (we map to GL 2.0 function names for a uniform interface
// across platforms)
//
#define GDRAW_GL_EXTENSION_LIST \
/* identifier import procname */ \
/* GL_ARB_multitexture */ \
GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \
/* GL_ARB_texture_compression */ \
GLE(CompressedTexImage2D, "CompressedTexImage2DARB", COMPRESSEDTEXIMAGE2DARB) \
/* GL_ARB_vertex_buffer_object */ \
GLE(GenBuffers, "GenBuffersARB", GENBUFFERSARB) \
GLE(DeleteBuffers, "DeleteBuffersARB", DELETEBUFFERSARB) \
GLE(BindBuffer, "BindBufferARB", BINDBUFFERARB) \
GLE(BufferData, "BufferDataARB", BUFFERDATAARB) \
GLE(MapBuffer, "MapBufferARB", MAPBUFFERARB) \
GLE(UnmapBuffer, "UnmapBufferARB", UNMAPBUFFERARB) \
GLE(VertexAttribPointer, "VertexAttribPointerARB", VERTEXATTRIBPOINTERARB) \
GLE(EnableVertexAttribArray, "EnableVertexAttribArrayARB", ENABLEVERTEXATTRIBARRAYARB) \
GLE(DisableVertexAttribArray, "DisableVertexAttribArrayARB", DISABLEVERTEXATTRIBARRAYARB) \
/* GL_ARB_shader_objects */ \
GLE(CreateShader, "CreateShaderObjectARB", CREATESHADEROBJECTARB) \
GLE(DeleteShader, "DeleteObjectARB", DELETEOBJECTARB) \
GLE(ShaderSource, "ShaderSourceARB", SHADERSOURCEARB) \
GLE(CompileShader, "CompileShaderARB", COMPILESHADERARB) \
GLE(GetShaderiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \
GLE(GetShaderInfoLog, "GetInfoLogARB", GETINFOLOGARB) \
GLE(CreateProgram, "CreateProgramObjectARB", CREATEPROGRAMOBJECTARB) \
GLE(DeleteProgram, "DeleteObjectARB", DELETEOBJECTARB) \
GLE(AttachShader, "AttachObjectARB", ATTACHOBJECTARB) \
GLE(LinkProgram, "LinkProgramARB", LINKPROGRAMARB) \
GLE(GetUniformLocation, "GetUniformLocationARB", GETUNIFORMLOCATIONARB) \
GLE(UseProgram, "UseProgramObjectARB", USEPROGRAMOBJECTARB) \
GLE(GetProgramiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \
GLE(GetProgramInfoLog, "GetInfoLogARB", GETINFOLOGARB) \
GLE(Uniform1i, "Uniform1iARB", UNIFORM1IARB) \
GLE(Uniform4f, "Uniform4fARB", UNIFORM4FARB) \
GLE(Uniform4fv, "Uniform4fvARB", UNIFORM4FVARB) \
/* GL_ARB_vertex_shader */ \
GLE(BindAttribLocation, "BindAttribLocationARB", BINDATTRIBLOCATIONARB) \
/* GL_EXT_framebuffer_object */ \
GLE(GenRenderbuffers, "GenRenderbuffersEXT", GENRENDERBUFFERSEXT) \
GLE(DeleteRenderbuffers, "DeleteRenderbuffersEXT", DELETERENDERBUFFERSEXT) \
GLE(BindRenderbuffer, "BindRenderbufferEXT", BINDRENDERBUFFEREXT) \
GLE(RenderbufferStorage, "RenderbufferStorageEXT", RENDERBUFFERSTORAGEEXT) \
GLE(GenFramebuffers, "GenFramebuffersEXT", GENFRAMEBUFFERSEXT) \
GLE(DeleteFramebuffers, "DeleteFramebuffersEXT", DELETEFRAMEBUFFERSEXT) \
GLE(BindFramebuffer, "BindFramebufferEXT", BINDFRAMEBUFFEREXT) \
GLE(CheckFramebufferStatus, "CheckFramebufferStatusEXT", CHECKFRAMEBUFFERSTATUSEXT) \
GLE(FramebufferRenderbuffer, "FramebufferRenderbufferEXT", FRAMEBUFFERRENDERBUFFEREXT) \
GLE(FramebufferTexture2D, "FramebufferTexture2DEXT", FRAMEBUFFERTEXTURE2DEXT) \
GLE(GenerateMipmap, "GenerateMipmapEXT", GENERATEMIPMAPEXT) \
/* GL_EXT_framebuffer_blit */ \
GLE(BlitFramebuffer, "BlitFramebufferEXT", BLITFRAMEBUFFEREXT) \
/* GL_EXT_framebuffer_multisample */ \
GLE(RenderbufferStorageMultisample, "RenderbufferStorageMultisampleEXT",RENDERBUFFERSTORAGEMULTISAMPLEEXT) \
/* <end> */
#define gdraw_GLx_(id) gdraw_GL_##id
#define GDRAW_GLx_(id) GDRAW_GL_##id
#define GDRAW_SHADERS "gdraw_gl_shaders.inl"
typedef GLhandleARB GLhandle;
typedef gdraw_gl_resourcetype gdraw_resourcetype;
// Extensions
#define GLE(id, import, procname) static PFNGL##procname##PROC gl##id;
GDRAW_GL_EXTENSION_LIST
#undef GLE
static void load_extensions(void)
{
#define GLE(id, import, procname) gl##id = (PFNGL##procname##PROC) wglGetProcAddress("gl" import);
GDRAW_GL_EXTENSION_LIST
#undef GLE
}
static void clear_renderstate_platform_specific(void)
{
glDisable(GL_ALPHA_TEST);
}
static void error_msg_platform_specific(const char *msg)
{
OutputDebugStringA(msg);
}
///////////////////////////////////////////////////////////////////////////////
//
// Shared code
//
#define GDRAW_MULTISAMPLING
#include "gdraw_gl_shared.inl"
///////////////////////////////////////////////////////////////////////////////
//
// Initialization and platform-specific functionality
//
GDrawFunctions *gdraw_GL_CreateContext(S32 w, S32 h, S32 msaa_samples)
{
static const TextureFormatDesc tex_formats[] = {
{ IFT_FORMAT_rgba_8888, 1, 1, 4, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_rgba_4444_LE, 1, 1, 2, GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 },
{ IFT_FORMAT_rgba_5551_LE, 1, 1, 2, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 },
{ IFT_FORMAT_la_88, 1, 1, 2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_la_44, 1, 1, 1, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_i_8, 1, 1, 1, GL_INTENSITY8, GL_ALPHA, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_i_4, 1, 1, 1, GL_INTENSITY4, GL_ALPHA, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_l_8, 1, 1, 1, GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_l_4, 1, 1, 1, GL_LUMINANCE4, GL_LUMINANCE, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_DXT1, 4, 4, 8, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 0, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_DXT3, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 0, GL_UNSIGNED_BYTE },
{ IFT_FORMAT_DXT5, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 0, GL_UNSIGNED_BYTE },
{ 0, 0, 0, 0, 0, 0, 0 },
};
GDrawFunctions *funcs;
const char *s;
GLint n;
// check for the extensions we need
s = (const char *) glGetString(GL_EXTENSIONS);
if (s == NULL) {
assert(s != NULL); // if this is NULL, you're probably trying to create the device too early
return NULL;
}
// check for the extensions we won't work without
if (!hasext(s, "GL_ARB_multitexture") ||
!hasext(s, "GL_ARB_texture_compression") ||
!hasext(s, "GL_ARB_texture_mirrored_repeat") ||
!hasext(s, "GL_ARB_texture_non_power_of_two") || // with caveats - see below!
!hasext(s, "GL_ARB_vertex_buffer_object") ||
!hasext(s, "GL_EXT_framebuffer_object") ||
!hasext(s, "GL_ARB_shader_objects") ||
!hasext(s, "GL_ARB_vertex_shader") ||
!hasext(s, "GL_ARB_fragment_shader"))
return NULL;
// if user requests multisampling and HW doesn't support it, bail
if (!hasext(s, "GL_EXT_framebuffer_multisample") && msaa_samples > 1)
return NULL;
load_extensions();
funcs = create_context(w, h);
if (!funcs)
return NULL;
gdraw->tex_formats = tex_formats;
// check for optional extensions
gdraw->has_mapbuffer = true; // part of core VBO extension on regular GL
gdraw->has_depth24 = true; // we just assume.
gdraw->has_texture_max_level = true; // core on regular GL
if (hasext(s, "GL_EXT_packed_depth_stencil")) gdraw->has_packed_depth_stencil = true;
// we require ARB_texture_non_power_of_two - on actual HW, this may either give us
// "full" non-power-of-two support, or "conditional" non-power-of-two (wrap mode must
// be CLAMP_TO_EDGE, no mipmaps). figure out which it is using this heuristic by
// Unity's Aras Pranckevicius (thanks!):
// http://www.aras-p.info/blog/2012/10/17/non-power-of-two-textures/
//
// we use the second heuristic (texture size <8192 for cards without full NPOT support)
// since we don't otherwise use ARB_fragment_program and don't want to create a program
// just to be able to query MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB!
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &n);
gdraw->has_conditional_non_power_of_two = n < 8192;
// clamp number of multisampling levels to max supported
if (msaa_samples > 1) {
glGetIntegerv(GL_MAX_SAMPLES, &n);
gdraw->multisampling = RR_MIN(msaa_samples, n);
}
opengl_check();
return funcs;
}

View File

@@ -0,0 +1,38 @@
#ifndef __RAD_INCLUDE_GDRAW_GL_H__
#define __RAD_INCLUDE_GDRAW_GL_H__
#include "rrCore.h"
#include "gdraw.h"
RADDEFSTART
typedef enum gdraw_gl_resourcetype
{
GDRAW_GL_RESOURCE_rendertarget,
GDRAW_GL_RESOURCE_texture,
GDRAW_GL_RESOURCE_vertexbuffer,
GDRAW_GL_RESOURCE__count,
} gdraw_gl_resourcetype;
struct IggyCustomDrawCallbackRegion;
extern int gdraw_GL_SetResourceLimits(gdraw_gl_resourcetype type, S32 num_handles, S32 num_bytes);
extern GDrawFunctions * gdraw_GL_CreateContext(S32 min_w, S32 min_h, S32 msaa_samples);
extern void gdraw_GL_DestroyContext(void);
extern void gdraw_GL_SetTileOrigin(S32 vx, S32 vy, U32 framebuffer); // framebuffer=FBO handle, or 0 for main frame buffer
extern void gdraw_GL_NoMoreGDrawThisFrame(void);
extern GDrawTexture *gdraw_GL_WrappedTextureCreate(S32 gl_texture_handle, S32 width, S32 height, rrbool has_mipmaps);
extern void gdraw_GL_WrappedTextureChange(GDrawTexture *tex, S32 new_gl_texture_handle, S32 new_width, S32 new_height, rrbool new_has_mipmaps);
extern void gdraw_GL_WrappedTextureDestroy(GDrawTexture *tex);
extern void gdraw_GL_BeginCustomDraw(struct IggyCustomDrawCallbackRegion *region, F32 *matrix);
extern void gdraw_GL_EndCustomDraw(struct IggyCustomDrawCallbackRegion *region);
extern GDrawTexture * RADLINK gdraw_GL_MakeTextureFromResource(U8 *resource_file, S32 resource_len, IggyFileTextureRaw *texture);
extern void RADLINK gdraw_GL_DestroyTextureFromResource(GDrawTexture *tex);
RADDEFEND
#endif

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 "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 nullptr, 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-nullptr, 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*) nullptr;
(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 nullptr 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,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 nullptr 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-nullptr $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__

View File

@@ -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__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,222 @@
/* Recovered from ORBIS_rrAtomics.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rrAtomicMemoryBarrierFull */
void rrAtomicMemoryBarrierFull(void)
{
return;
}
/* 00100010 rrAtomicLoadAcquire32 */
undefined4 rrAtomicLoadAcquire32(undefined4 *param_1)
{
return *param_1;
}
/* 00100020 rrAtomicLoadAcquire64 */
undefined8 rrAtomicLoadAcquire64(undefined8 *param_1)
{
return *param_1;
}
/* 00100030 rrAtomicStoreRelease32 */
void rrAtomicStoreRelease32(undefined4 *param_1,undefined4 param_2)
{
*param_1 = param_2;
return;
}
/* 00100040 rrAtomicStoreRelease64 */
void rrAtomicStoreRelease64(undefined8 *param_1,undefined8 param_2)
{
*param_1 = param_2;
return;
}
/* 00100050 rrAtomicCAS32 */
bool rrAtomicCAS32(int *param_1,int *param_2,int param_3)
{
int iVar1;
int iVar2;
iVar1 = *param_2;
LOCK();
iVar2 = *param_1;
if (iVar1 == iVar2) {
*param_1 = param_3;
iVar2 = iVar1;
}
UNLOCK();
iVar1 = *param_2;
if (iVar2 != iVar1) {
*param_2 = iVar2;
}
return iVar2 == iVar1;
}
/* 00100070 rrAtomicCAS64 */
bool rrAtomicCAS64(ulong *param_1,ulong *param_2,ulong param_3)
{
ulong uVar1;
ulong uVar2;
bool bVar3;
uVar1 = *param_2;
LOCK();
uVar2 = *param_1;
if (uVar1 == uVar2) {
*param_1 = param_3;
uVar2 = uVar1;
}
UNLOCK();
bVar3 = (int)uVar2 == (int)*param_2;
if (!bVar3) {
*param_2 = uVar2 & 0xffffffff;
}
return bVar3;
}
/* 00100090 rrAtomicCmpXchg32 */
int rrAtomicCmpXchg32(int *param_1,int param_2,int param_3)
{
int iVar1;
LOCK();
iVar1 = *param_1;
if (param_3 == iVar1) {
*param_1 = param_2;
iVar1 = param_3;
}
UNLOCK();
return iVar1;
}
/* 001000a0 rrAtomicCmpXchg64 */
long rrAtomicCmpXchg64(long *param_1,long param_2,long param_3)
{
long lVar1;
LOCK();
lVar1 = *param_1;
if (param_3 == lVar1) {
*param_1 = param_2;
lVar1 = param_3;
}
UNLOCK();
return lVar1;
}
/* 001000b0 rrAtomicExchange32 */
int rrAtomicExchange32(int *param_1,int param_2)
{
int iVar1;
int iVar2;
do {
iVar1 = *param_1;
LOCK();
iVar2 = *param_1;
if (iVar1 == iVar2) {
*param_1 = param_2;
iVar2 = iVar1;
}
UNLOCK();
} while (iVar1 != iVar2);
return iVar1;
}
/* 001000c0 rrAtomicExchange64 */
long rrAtomicExchange64(long *param_1,long param_2)
{
long lVar1;
long lVar2;
do {
lVar1 = *param_1;
LOCK();
lVar2 = *param_1;
if (lVar1 == lVar2) {
*param_1 = param_2;
lVar2 = lVar1;
}
UNLOCK();
} while (lVar1 != lVar2);
return lVar1;
}
/* 001000e0 rrAtomicAddExchange32 */
int rrAtomicAddExchange32(int *param_1,int param_2)
{
int iVar1;
LOCK();
iVar1 = *param_1;
*param_1 = *param_1 + param_2;
UNLOCK();
return iVar1;
}
/* 001000f0 rrAtomicAddExchange64 */
long rrAtomicAddExchange64(long *param_1,long param_2)
{
long lVar1;
LOCK();
lVar1 = *param_1;
*param_1 = *param_1 + param_2;
UNLOCK();
return lVar1;
}

View File

@@ -0,0 +1,43 @@
/* Recovered from ORBIS_rrCpu.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rrGetTotalCPUs */
undefined8 rrGetTotalCPUs(void)
{
return 6;
}
/* 00100010 rrGetTotalSlowerCPUs */
undefined8 rrGetTotalSlowerCPUs(void)
{
return 0;
}
/* 00100020 rrGetCPUCoreByPrecedence */
int rrGetCPUCoreByPrecedence(int param_1)
{
return ((param_1 / 6) * 6 - param_1) + 5;
}
/* 00100050 rrGetSlowerCPUCoreByPrecedence */
int rrGetSlowerCPUCoreByPrecedence(int param_1)
{
return param_1 % 6;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,329 @@
/* Recovered from ORBIS_rrTime.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100020 rrGetTime */
void rrGetTime(void)
{
int iVar1;
uint uVar2;
long local_28;
long local_20;
iVar1 = rrAtomicLoadAcquire32(0x100000);
if (iVar1 != 1) {
uVar2 = 0;
while( true ) {
iVar1 = rrAtomicCmpXchg32(0x100000,2,0);
if (iVar1 == 0) break;
if (iVar1 == 1) goto LAB_0010003c;
if (uVar2 < 0x65) {
uVar2 = uVar2 + 1;
if (10 < uVar2) {
scePthreadYield();
}
}
else {
sceKernelUsleep(1000);
uVar2 = 0;
}
}
sceKernelGettimeofday(&local_28);
first_time = local_28 * 1000000 + local_20;
last_largest_time = 0;
rrAtomicStoreRelease32(0x100000,1);
}
LAB_0010003c:
our_get_time();
return;
}
/* 001000d0 our_get_time */
/* our_get_time() */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* our_get_time() */
ulong our_get_time(void)
{
ulong uVar1;
ulong uVar2;
ulong uVar3;
uint uVar4;
ulong uVar5;
long local_38;
long local_30;
sceKernelGettimeofday(&local_38);
uVar5 = (local_38 * 1000000 + local_30) - first_time;
uVar1 = rrAtomicLoadAcquire64(&last_largest_time);
if ((uVar1 <= uVar5) &&
(uVar2 = rrAtomicLoadAcquire64(&last_largest_time), uVar1 = uVar5, uVar2 < uVar5)) {
uVar4 = 0;
do {
uVar3 = rrAtomicCmpXchg64(&last_largest_time,uVar5,uVar2);
if (uVar3 == uVar2) {
return uVar5;
}
if (uVar4 < 0x65) {
uVar4 = uVar4 + 1;
if (10 < uVar4) {
sceKernelUsleep(1);
}
}
else {
sceKernelUsleep(1000);
uVar4 = 0;
}
uVar2 = rrAtomicLoadAcquire64(&last_largest_time);
} while (uVar2 < uVar5);
}
return uVar1;
}
/* 001001a0 rrGetTicks */
void rrGetTicks(void)
{
int iVar1;
uint uVar2;
long local_28;
long local_20;
iVar1 = rrAtomicLoadAcquire32(0x100000);
if (iVar1 != 1) {
uVar2 = 0;
while( true ) {
iVar1 = rrAtomicCmpXchg32(0x100000,2,0);
if (iVar1 == 0) break;
if (iVar1 == 1) goto LAB_001001bc;
if (uVar2 < 0x65) {
uVar2 = uVar2 + 1;
if (10 < uVar2) {
scePthreadYield();
}
}
else {
sceKernelUsleep(1000);
uVar2 = 0;
}
}
sceKernelGettimeofday(&local_28);
first_time = local_28 * 1000000 + local_20;
last_largest_time = 0;
rrAtomicStoreRelease32(0x100000,1);
}
LAB_001001bc:
our_get_time();
return;
}
/* 001002a0 rrTimeToSeconds */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double rrTimeToSeconds(ulong param_1)
{
undefined1 auVar1 [16];
auVar1._8_8_ = 0;
auVar1._0_8_ = param_1;
auVar1 = vpunpckldq_avx(auVar1,__LCPI3_0);
auVar1 = vsubpd_avx(auVar1,__LCPI3_1);
return (auVar1._0_8_ + auVar1._8_8_) * _LCPI3_2;
}
/* 001002d0 rrTimePerSecond */
undefined8 rrTimePerSecond(void)
{
return 1000000;
}
/* 001002e0 rrTicksToCycles */
undefined8 rrTicksToCycles(undefined8 param_1)
{
return param_1;
}
/* 001002f0 rrTicksToSeconds */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double rrTicksToSeconds(ulong param_1)
{
undefined1 auVar1 [16];
auVar1._8_8_ = 0;
auVar1._0_8_ = param_1;
auVar1 = vpunpckldq_avx(auVar1,__LCPI6_0);
auVar1 = vsubpd_avx(auVar1,__LCPI6_1);
return (auVar1._0_8_ + auVar1._8_8_) * _LCPI6_2;
}
/* 00100320 rrTimeToMillis */
ulong rrTimeToMillis(long param_1)
{
return (param_1 + 500U) / 1000;
}
/* 00100340 rrTimeToMicros */
undefined8 rrTimeToMicros(undefined8 param_1)
{
return param_1;
}
/* 00100350 rrMillisToTime */
long rrMillisToTime(long param_1)
{
return param_1 * 1000;
}
/* 00100360 rrMicrosToTime */
undefined8 rrMicrosToTime(undefined8 param_1)
{
return param_1;
}
/* 00101000 <EXTERNAL>::rrAtomicCmpXchg32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicCmpXchg32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101008 <EXTERNAL>::rrAtomicCmpXchg64 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicCmpXchg64(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101010 <EXTERNAL>::rrAtomicLoadAcquire32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicLoadAcquire32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101018 <EXTERNAL>::rrAtomicLoadAcquire64 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicLoadAcquire64(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101020 <EXTERNAL>::rrAtomicStoreRelease32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicStoreRelease32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101028 <EXTERNAL>::sceKernelGettimeofday */
/* WARNING: Control flow encountered bad instruction data */
void sceKernelGettimeofday(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101030 <EXTERNAL>::sceKernelUsleep */
/* WARNING: Control flow encountered bad instruction data */
void sceKernelUsleep(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101038 <EXTERNAL>::scePthreadYield */
/* WARNING: Control flow encountered bad instruction data */
void scePthreadYield(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
/* Recovered from rrCore.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */

View File

@@ -0,0 +1,3 @@
/* Recovered from rrassert.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */

View File

@@ -0,0 +1,296 @@
/* Recovered from rrstring.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rrstpcpy */
char * rrstpcpy(char *param_1,char *param_2)
{
char cVar1;
cVar1 = *param_2;
while (cVar1 != '\0') {
param_2 = param_2 + 1;
*param_1 = cVar1;
param_1 = param_1 + 1;
cVar1 = *param_2;
}
*param_1 = '\0';
return param_1;
}
/* 00100030 rrmemset16 */
void rrmemset16(uint *param_1,uint param_2,uint param_3)
{
int iVar1;
uint *puVar2;
if (((ulong)param_1 & 2) != 0) {
*(short *)param_1 = (short)param_2;
param_3 = param_3 - 1;
param_1 = (uint *)((long)param_1 + 2);
}
if (param_3 >> 1 != 0) {
iVar1 = -(param_3 >> 1);
puVar2 = param_1;
do {
*puVar2 = param_2 << 0x10 | param_2;
puVar2 = puVar2 + 1;
iVar1 = iVar1 + 1;
} while (iVar1 != 0);
param_1 = param_1 + (ulong)((param_3 >> 1) - 1) + 1;
}
if ((param_3 & 1) != 0) {
*(short *)param_1 = (short)param_2;
}
return;
}
/* 00100090 rrmemset32 */
void rrmemset32(undefined4 *param_1,undefined4 param_2,uint param_3)
{
undefined4 *puVar1;
puVar1 = param_1 + param_3;
for (; param_1 < puVar1; param_1 = param_1 + 1) {
*param_1 = param_2;
}
return;
}
/* 001000b0 rrwcscpy */
short * rrwcscpy(short *param_1,short *param_2)
{
short sVar1;
sVar1 = *param_2;
while (sVar1 != 0) {
param_2 = param_2 + 1;
*param_1 = sVar1;
param_1 = param_1 + 1;
sVar1 = *param_2;
}
*param_1 = 0;
return param_1;
}
/* 001000e0 rrwcslen */
void rrwcslen(long param_1)
{
ulong uVar1;
uVar1 = 0xffffffff;
do {
uVar1 = (ulong)((int)uVar1 + 1);
} while (*(short *)(param_1 + uVar1 * 2) != 0);
return;
}
/* 00100100 rrwcscmp */
uint rrwcscmp(ushort *param_1,ushort *param_2)
{
uint uVar1;
ushort uVar2;
ushort uVar3;
uVar3 = *param_2;
uVar2 = *param_1;
if (uVar2 == uVar3) {
do {
param_1 = param_1 + 1;
param_2 = param_2 + 1;
if (uVar2 == 0) {
return 0;
}
uVar3 = *param_2;
uVar2 = *param_1;
} while (uVar2 == uVar3);
}
uVar1 = 0xffffffff;
if (uVar3 <= uVar2) {
uVar1 = -(uint)(uVar3 < uVar2) & 1;
}
return uVar1;
}
/* 00100150 rrwcsncmp */
uint rrwcsncmp(long param_1,long param_2,uint param_3)
{
ushort uVar1;
ushort uVar2;
long lVar3;
lVar3 = 0;
while( true ) {
if (param_3 <= (uint)lVar3) {
return 0;
}
uVar1 = *(ushort *)(param_2 + lVar3 * 2);
uVar2 = *(ushort *)(param_1 + lVar3 * 2);
if (uVar2 != uVar1) break;
lVar3 = lVar3 + 1;
if (uVar2 == 0) {
return 0;
}
}
if (uVar2 < uVar1) {
return 0xffffffff;
}
return -(uint)(uVar1 < uVar2) & 1;
}
/* 001001a0 rrwcschr */
long rrwcschr(long param_1,short param_2)
{
short *psVar1;
param_1 = param_1 + -2;
do {
psVar1 = (short *)(param_1 + 2);
if (*psVar1 == 0) {
return 0;
}
param_1 = param_1 + 2;
} while (*psVar1 != param_2);
return param_1;
}
/* 001001d0 rrwcsrchr */
short * rrwcsrchr(short *param_1,short param_2)
{
short *psVar1;
short *psVar2;
short sVar3;
psVar2 = (short *)0x0;
sVar3 = *param_1;
while (sVar3 != 0) {
if (sVar3 == param_2) {
psVar2 = param_1;
}
psVar1 = param_1 + 1;
param_1 = param_1 + 1;
sVar3 = *psVar1;
}
return psVar2;
}
/* 00100200 rrwcstol */
uint rrwcstol(short *param_1,undefined8 *param_2,uint param_3)
{
short sVar1;
bool bVar2;
bool bVar3;
bool bVar4;
ushort uVar5;
uint uVar6;
uint uVar7;
uint uVar8;
uVar6 = 2;
if ((1 < (int)param_3) && (uVar6 = 0x24, (int)param_3 < 0x25)) {
uVar6 = param_3;
}
if (*param_1 == 0x2d) {
param_1 = param_1 + 1;
bVar2 = true;
}
else {
bVar2 = false;
if (*param_1 == 0x2b) {
param_1 = param_1 + 1;
bVar2 = false;
}
}
uVar8 = 0;
bVar3 = false;
do {
bVar4 = bVar3;
if ((0x80000000 - uVar6) / uVar6 < uVar8) {
do {
bVar3 = bVar4;
sVar1 = *param_1;
if ((ushort)(sVar1 - 0x30U) < 10) {
uVar7 = (uint)(ushort)(sVar1 - 0x30U);
}
else {
uVar5 = sVar1 - 0x41;
if ((0x19 < uVar5) && (uVar5 = sVar1 - 0x61, 0x19 < uVar5)) goto LAB_00100318;
uVar7 = uVar5 + 10;
}
if (uVar6 <= uVar7) goto LAB_00100318;
param_1 = param_1 + 1;
bVar4 = true;
} while ((0x7fffffff - uVar7) / uVar6 < uVar8);
}
else {
sVar1 = *param_1;
if ((ushort)(sVar1 - 0x30U) < 10) {
uVar7 = (uint)(ushort)(sVar1 - 0x30U);
}
else {
uVar5 = sVar1 - 0x41;
if ((0x19 < uVar5) && (uVar5 = sVar1 - 0x61, 0x19 < uVar5)) {
LAB_00100318:
if (bVar2) {
uVar8 = -uVar8;
uVar6 = 0x80000000;
}
else {
uVar6 = 0x7fffffff;
}
if (bVar3) {
uVar8 = uVar6;
}
if (param_2 != (undefined8 *)0x0) {
*param_2 = param_1;
}
return uVar8;
}
uVar7 = uVar5 + 10;
}
if (uVar6 <= uVar7) goto LAB_00100318;
param_1 = param_1 + 1;
}
uVar8 = uVar8 * uVar6 + uVar7;
} while( true );
}

View File

@@ -0,0 +1,222 @@
/* Recovered from ORBIS_rrAtomics.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rrAtomicMemoryBarrierFull */
void rrAtomicMemoryBarrierFull(void)
{
return;
}
/* 00100010 rrAtomicLoadAcquire32 */
undefined4 rrAtomicLoadAcquire32(undefined4 *param_1)
{
return *param_1;
}
/* 00100020 rrAtomicLoadAcquire64 */
undefined8 rrAtomicLoadAcquire64(undefined8 *param_1)
{
return *param_1;
}
/* 00100030 rrAtomicStoreRelease32 */
void rrAtomicStoreRelease32(undefined4 *param_1,undefined4 param_2)
{
*param_1 = param_2;
return;
}
/* 00100040 rrAtomicStoreRelease64 */
void rrAtomicStoreRelease64(undefined8 *param_1,undefined8 param_2)
{
*param_1 = param_2;
return;
}
/* 00100050 rrAtomicCAS32 */
bool rrAtomicCAS32(int *param_1,int *param_2,int param_3)
{
int iVar1;
int iVar2;
iVar1 = *param_2;
LOCK();
iVar2 = *param_1;
if (iVar1 == iVar2) {
*param_1 = param_3;
iVar2 = iVar1;
}
UNLOCK();
iVar1 = *param_2;
if (iVar2 != iVar1) {
*param_2 = iVar2;
}
return iVar2 == iVar1;
}
/* 00100070 rrAtomicCAS64 */
bool rrAtomicCAS64(ulong *param_1,ulong *param_2,ulong param_3)
{
ulong uVar1;
ulong uVar2;
bool bVar3;
uVar1 = *param_2;
LOCK();
uVar2 = *param_1;
if (uVar1 == uVar2) {
*param_1 = param_3;
uVar2 = uVar1;
}
UNLOCK();
bVar3 = (int)uVar2 == (int)*param_2;
if (!bVar3) {
*param_2 = uVar2 & 0xffffffff;
}
return bVar3;
}
/* 00100090 rrAtomicCmpXchg32 */
int rrAtomicCmpXchg32(int *param_1,int param_2,int param_3)
{
int iVar1;
LOCK();
iVar1 = *param_1;
if (param_3 == iVar1) {
*param_1 = param_2;
iVar1 = param_3;
}
UNLOCK();
return iVar1;
}
/* 001000a0 rrAtomicCmpXchg64 */
long rrAtomicCmpXchg64(long *param_1,long param_2,long param_3)
{
long lVar1;
LOCK();
lVar1 = *param_1;
if (param_3 == lVar1) {
*param_1 = param_2;
lVar1 = param_3;
}
UNLOCK();
return lVar1;
}
/* 001000b0 rrAtomicExchange32 */
int rrAtomicExchange32(int *param_1,int param_2)
{
int iVar1;
int iVar2;
do {
iVar1 = *param_1;
LOCK();
iVar2 = *param_1;
if (iVar1 == iVar2) {
*param_1 = param_2;
iVar2 = iVar1;
}
UNLOCK();
} while (iVar1 != iVar2);
return iVar1;
}
/* 001000c0 rrAtomicExchange64 */
long rrAtomicExchange64(long *param_1,long param_2)
{
long lVar1;
long lVar2;
do {
lVar1 = *param_1;
LOCK();
lVar2 = *param_1;
if (lVar1 == lVar2) {
*param_1 = param_2;
lVar2 = lVar1;
}
UNLOCK();
} while (lVar1 != lVar2);
return lVar1;
}
/* 001000e0 rrAtomicAddExchange32 */
int rrAtomicAddExchange32(int *param_1,int param_2)
{
int iVar1;
LOCK();
iVar1 = *param_1;
*param_1 = *param_1 + param_2;
UNLOCK();
return iVar1;
}
/* 001000f0 rrAtomicAddExchange64 */
long rrAtomicAddExchange64(long *param_1,long param_2)
{
long lVar1;
LOCK();
lVar1 = *param_1;
*param_1 = *param_1 + param_2;
UNLOCK();
return lVar1;
}

View File

@@ -0,0 +1,43 @@
/* Recovered from ORBIS_rrCpu.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rrGetTotalCPUs */
undefined8 rrGetTotalCPUs(void)
{
return 6;
}
/* 00100010 rrGetTotalSlowerCPUs */
undefined8 rrGetTotalSlowerCPUs(void)
{
return 0;
}
/* 00100020 rrGetCPUCoreByPrecedence */
int rrGetCPUCoreByPrecedence(int param_1)
{
return ((param_1 / 6) * 6 - param_1) + 5;
}
/* 00100050 rrGetSlowerCPUCoreByPrecedence */
int rrGetSlowerCPUCoreByPrecedence(int param_1)
{
return param_1 % 6;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,329 @@
/* Recovered from ORBIS_rrTime.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100020 rrGetTime */
void rrGetTime(void)
{
int iVar1;
uint uVar2;
long local_28;
long local_20;
iVar1 = rrAtomicLoadAcquire32(0x100000);
if (iVar1 != 1) {
uVar2 = 0;
while( true ) {
iVar1 = rrAtomicCmpXchg32(0x100000,2,0);
if (iVar1 == 0) break;
if (iVar1 == 1) goto LAB_0010003c;
if (uVar2 < 0x65) {
uVar2 = uVar2 + 1;
if (10 < uVar2) {
scePthreadYield();
}
}
else {
sceKernelUsleep(1000);
uVar2 = 0;
}
}
sceKernelGettimeofday(&local_28);
first_time = local_28 * 1000000 + local_20;
last_largest_time = 0;
rrAtomicStoreRelease32(0x100000,1);
}
LAB_0010003c:
our_get_time();
return;
}
/* 001000d0 our_get_time */
/* our_get_time() */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* our_get_time() */
ulong our_get_time(void)
{
ulong uVar1;
ulong uVar2;
ulong uVar3;
uint uVar4;
ulong uVar5;
long local_38;
long local_30;
sceKernelGettimeofday(&local_38);
uVar5 = (local_38 * 1000000 + local_30) - first_time;
uVar1 = rrAtomicLoadAcquire64(&last_largest_time);
if ((uVar1 <= uVar5) &&
(uVar2 = rrAtomicLoadAcquire64(&last_largest_time), uVar1 = uVar5, uVar2 < uVar5)) {
uVar4 = 0;
do {
uVar3 = rrAtomicCmpXchg64(&last_largest_time,uVar5,uVar2);
if (uVar3 == uVar2) {
return uVar5;
}
if (uVar4 < 0x65) {
uVar4 = uVar4 + 1;
if (10 < uVar4) {
sceKernelUsleep(1);
}
}
else {
sceKernelUsleep(1000);
uVar4 = 0;
}
uVar2 = rrAtomicLoadAcquire64(&last_largest_time);
} while (uVar2 < uVar5);
}
return uVar1;
}
/* 001001a0 rrGetTicks */
void rrGetTicks(void)
{
int iVar1;
uint uVar2;
long local_28;
long local_20;
iVar1 = rrAtomicLoadAcquire32(0x100000);
if (iVar1 != 1) {
uVar2 = 0;
while( true ) {
iVar1 = rrAtomicCmpXchg32(0x100000,2,0);
if (iVar1 == 0) break;
if (iVar1 == 1) goto LAB_001001bc;
if (uVar2 < 0x65) {
uVar2 = uVar2 + 1;
if (10 < uVar2) {
scePthreadYield();
}
}
else {
sceKernelUsleep(1000);
uVar2 = 0;
}
}
sceKernelGettimeofday(&local_28);
first_time = local_28 * 1000000 + local_20;
last_largest_time = 0;
rrAtomicStoreRelease32(0x100000,1);
}
LAB_001001bc:
our_get_time();
return;
}
/* 001002a0 rrTimeToSeconds */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double rrTimeToSeconds(ulong param_1)
{
undefined1 auVar1 [16];
auVar1._8_8_ = 0;
auVar1._0_8_ = param_1;
auVar1 = vpunpckldq_avx(auVar1,__LCPI3_0);
auVar1 = vsubpd_avx(auVar1,__LCPI3_1);
return (auVar1._0_8_ + auVar1._8_8_) * _LCPI3_2;
}
/* 001002d0 rrTimePerSecond */
undefined8 rrTimePerSecond(void)
{
return 1000000;
}
/* 001002e0 rrTicksToCycles */
undefined8 rrTicksToCycles(undefined8 param_1)
{
return param_1;
}
/* 001002f0 rrTicksToSeconds */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double rrTicksToSeconds(ulong param_1)
{
undefined1 auVar1 [16];
auVar1._8_8_ = 0;
auVar1._0_8_ = param_1;
auVar1 = vpunpckldq_avx(auVar1,__LCPI6_0);
auVar1 = vsubpd_avx(auVar1,__LCPI6_1);
return (auVar1._0_8_ + auVar1._8_8_) * _LCPI6_2;
}
/* 00100320 rrTimeToMillis */
ulong rrTimeToMillis(long param_1)
{
return (param_1 + 500U) / 1000;
}
/* 00100340 rrTimeToMicros */
undefined8 rrTimeToMicros(undefined8 param_1)
{
return param_1;
}
/* 00100350 rrMillisToTime */
long rrMillisToTime(long param_1)
{
return param_1 * 1000;
}
/* 00100360 rrMicrosToTime */
undefined8 rrMicrosToTime(undefined8 param_1)
{
return param_1;
}
/* 00101000 <EXTERNAL>::rrAtomicCmpXchg32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicCmpXchg32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101008 <EXTERNAL>::rrAtomicCmpXchg64 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicCmpXchg64(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101010 <EXTERNAL>::rrAtomicLoadAcquire32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicLoadAcquire32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101018 <EXTERNAL>::rrAtomicLoadAcquire64 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicLoadAcquire64(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101020 <EXTERNAL>::rrAtomicStoreRelease32 */
/* WARNING: Control flow encountered bad instruction data */
void rrAtomicStoreRelease32(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101028 <EXTERNAL>::sceKernelGettimeofday */
/* WARNING: Control flow encountered bad instruction data */
void sceKernelGettimeofday(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101030 <EXTERNAL>::sceKernelUsleep */
/* WARNING: Control flow encountered bad instruction data */
void sceKernelUsleep(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101038 <EXTERNAL>::scePthreadYield */
/* WARNING: Control flow encountered bad instruction data */
void scePthreadYield(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

View File

@@ -0,0 +1,950 @@
/* Recovered from as3_component_helpers.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_F32_setter */
void as3vm_F32_setter(undefined8 *param_1)
{
int iVar1;
double in_RAX;
double local_18;
local_18 = in_RAX;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str,&local_18);
if (iVar1 == 0) {
*(float *)(*(long *)param_1[3] + -1 + (long)*(int *)(param_1[4] + 0x18)) = (float)local_18;
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100060 as3vm_component_parse_arguments_GC */
undefined8
as3vm_component_parse_arguments_GC
(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4,
undefined8 param_5,undefined8 param_6,undefined8 param_7,undefined8 param_8,long *param_9,
char *param_10,undefined8 param_11,undefined8 param_12,undefined8 param_13,
undefined8 param_14)
{
long lVar1;
double dVar2;
long lVar3;
ulong *puVar4;
undefined8 *puVar5;
bool bVar6;
char in_AL;
char cVar7;
int iVar9;
long *plVar10;
undefined8 uVar11;
ulong uVar12;
long lVar13;
int iVar14;
int iVar15;
char *local_220;
undefined1 local_218 [16];
undefined8 local_208;
undefined8 local_200;
undefined8 local_1f8;
undefined8 local_1f0;
undefined8 local_1e8;
undefined8 local_1d8;
undefined8 local_1c8;
undefined8 local_1b8;
undefined8 local_1a8;
undefined8 local_198;
undefined8 local_188;
undefined8 local_178;
double local_168;
double local_160;
uint local_158;
undefined4 local_154;
long *local_150;
undefined1 *local_148;
long alStack_138 [33];
uint uVar8;
if (in_AL != '\0') {
local_1e8 = param_1;
local_1d8 = param_2;
local_1c8 = param_3;
local_1b8 = param_4;
local_1a8 = param_5;
local_198 = param_6;
local_188 = param_7;
local_178 = param_8;
}
lVar3 = *param_9;
local_150 = (long *)&stack0x00000008;
local_148 = local_218;
local_154 = 0x30;
local_158 = 0x10;
iVar14 = 0;
iVar15 = 1;
lVar1 = lRam0000000000100113 + 1;
bVar6 = false;
local_208 = param_11;
local_200 = param_12;
local_1f8 = param_13;
local_1f0 = param_14;
do {
for (; cVar7 = *param_10, cVar7 == '?'; param_10 = param_10 + 1) {
bVar6 = true;
}
if (cVar7 == '\0') {
LAB_0010096c:
if (iVar14 != 0) {
iVar14 = iVar14 + -1;
do {
lVar1 = *(long *)(lVar3 + 0x6b18);
*(long *)(lVar3 + 0x6b18) = lVar1 + -8;
*(undefined8 *)alStack_138[iVar14] = *(undefined8 *)(lVar1 + -8);
iVar14 = iVar14 + -1;
} while (iVar14 != -1);
}
if ((!bVar6) && (iVar15 <= (int)param_9[2])) {
return 1;
}
return 0;
}
if ((int)param_9[2] < iVar15) {
if (bVar6) goto LAB_0010096c;
uVar11 = 1;
goto LAB_001009d1;
}
local_220 = param_10;
if (cVar7 == '!') {
lVar13 = *(long *)(param_9[3] + (long)iVar15 * 8);
cVar7 = param_10[1];
local_220 = param_10 + 1;
if (lVar13 != lVar1) {
if (cVar7 == '!') {
cVar7 = param_10[2];
local_220 = param_10 + 2;
if (lVar13 == lRam00000000001001b6 + 9) {
if (cVar7 == 'O') {
if (local_158 < 0x29) {
local_158 = local_158 + 8;
}
else {
local_150 = local_150 + 1;
}
}
if (local_158 < 0x29) {
local_158 = local_158 + 8;
}
else {
local_150 = local_150 + 1;
}
goto switchD_0010020d_caseD_42;
}
}
goto LAB_001001eb;
}
if (cVar7 == 'O') {
if (local_158 < 0x29) {
local_158 = local_158 + 8;
}
else {
local_150 = local_150 + 1;
}
}
if (local_158 < 0x29) {
local_158 = local_158 + 8;
}
else {
local_150 = local_150 + 1;
}
goto switchD_0010020d_caseD_42;
}
LAB_001001eb:
uVar8 = (uint)cVar7;
if (uVar8 < 0x61) {
switch(uVar8) {
case 0x41:
uVar12 = *(ulong *)(param_9[3] + (long)iVar15 * 8);
if (((uVar12 & 3) == 1) && (*(char *)(uVar12 - 1) == ' ')) goto LAB_0010073f;
goto LAB_001009c5;
default:
break;
case 0x45:
iVar9 = as3vm_ToNumberDirect_GC
(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8),&local_160);
if (((iVar9 != 0) && (local_160 != *pdRam0000000000100314)) &&
(dVar2 = local_160, local_160 != *pdRam0000000000100325)) goto LAB_0010035e;
goto LAB_001009c5;
case 0x46:
iVar9 = as3vm_ToNumberDirect_GC
(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8),&local_168);
dVar2 = local_168;
if (iVar9 == 0) goto LAB_001009c5;
LAB_0010035e:
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
*(float *)*plVar10 = (float)dVar2;
break;
case 0x49:
lVar13 = as3vm_ToString_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8));
if (lVar13 == 7) goto LAB_001009c5;
uVar11 = as3vm_string_interned(lVar3,lVar13);
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
*(undefined8 *)*plVar10 = uVar11;
break;
case 0x4b:
lVar13 = as3vm_ToString_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8));
if ((lVar13 == 7) || (lVar13 = as3vm_string_interned_nocreate(lVar3,lVar13), lVar13 == 7))
goto LAB_001009c5;
uVar8 = (uint)*(byte *)(lVar13 + 0x2a);
LAB_001004df:
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
*(uint *)*plVar10 = uVar8;
break;
case 0x4f:
lVar13 = (long)iVar15;
uVar12 = *(ulong *)(param_9[3] + lVar13 * 8);
if (((uVar12 & 3) == 1) && (0x1f < *(byte *)(uVar12 - 1))) {
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
iVar9 = as3vm_is_ofclass(*(long *)(param_9[3] + lVar13 * 8) + -1,*plVar10);
if (iVar9 != 0) {
uVar12 = *(ulong *)(param_9[3] + lVar13 * 8);
goto LAB_0010073f;
}
}
goto LAB_001009c5;
}
}
else {
switch(uVar8) {
case 0x61:
lVar13 = (long)iVar15;
uVar12 = *(ulong *)(param_9[3] + lVar13 * 8);
if (((uVar12 & 3) == 1) && (*(char *)(uVar12 - 1) == ' ')) {
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
if ((*(long *)(*plVar10 + 0x80) != 0) &&
(iVar9 = as3vm_is_ofclass(*(long *)(param_9[3] + lVar13 * 8) + -1), iVar9 != 0)) {
uVar11 = *(undefined8 *)(param_9[3] + lVar13 * 8);
puVar5 = *(undefined8 **)(lVar3 + 0x6b18);
*(undefined8 **)(lVar3 + 0x6b18) = puVar5 + 1;
*puVar5 = uVar11;
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
alStack_138[iVar14] = *plVar10;
goto LAB_00100796;
}
}
goto LAB_001009c5;
case 0x62:
uVar8 = as3vm_to_boolean_direct(*(undefined8 *)(param_9[3] + (long)iVar15 * 8));
goto LAB_001004df;
case 99:
uVar12 = *(ulong *)(param_9[3] + (long)iVar15 * 8);
if (((uVar12 & 3) == 1) && ((*(byte *)(uVar12 - 1) & 0x10) != 0)) goto LAB_0010073f;
goto LAB_001009c5;
case 100:
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
iVar9 = as3vm_ToInt32_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8),*plVar10);
goto joined_r0x0010081e;
case 0x66:
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
iVar9 = as3vm_ToNumberDirect_GC
(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8),*plVar10);
goto joined_r0x0010081e;
case 0x6b:
lVar13 = as3vm_ToString_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8));
if (lVar13 == 7) goto LAB_001009c5;
lVar13 = as3vm_string_interned_nocreate(lVar3,lVar13);
if (lVar13 == 7) {
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
*(undefined4 *)*plVar10 = 0;
}
else {
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
*(uint *)*plVar10 = (uint)*(byte *)(lVar13 + 0x2a);
}
break;
case 0x6f:
uVar12 = *(ulong *)(param_9[3] + (long)iVar15 * 8);
if (((uVar12 & 3) == 1) && (0x1f < *(byte *)(uVar12 - 1))) {
uVar12 = *(ulong *)(param_9[3] + (long)iVar15 * 8);
goto LAB_0010073f;
}
LAB_001009c5:
uVar11 = 2;
LAB_001009d1:
if (iVar14 != 0) {
*(long *)(lVar3 + 0x6b18) = *(long *)(lVar3 + 0x6b18) + ~(ulong)(iVar14 - 1) * 8;
}
return uVar11;
case 0x73:
lVar13 = as3vm_ToString_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8));
if (lVar13 == 7) goto LAB_001009c5;
plVar10 = *(long **)(lVar3 + 0x6b18);
*(long **)(lVar3 + 0x6b18) = plVar10 + 1;
*plVar10 = lVar13;
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
alStack_138[iVar14] = *plVar10;
iVar14 = iVar14 + 1;
break;
case 0x75:
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
iVar9 = as3vm_ToUInt32_GC(lVar3,*(undefined8 *)(param_9[3] + (long)iVar15 * 8),*plVar10);
joined_r0x0010081e:
if (iVar9 == 0) goto LAB_001009c5;
break;
case 0x76:
uVar12 = *(ulong *)(param_9[3] + (long)iVar15 * 8);
LAB_0010073f:
puVar4 = *(ulong **)(lVar3 + 0x6b18);
*(ulong **)(lVar3 + 0x6b18) = puVar4 + 1;
*puVar4 = uVar12;
uVar12 = (ulong)(int)local_158;
if (uVar12 < 0x29) {
local_158 = local_158 + 8;
plVar10 = (long *)(local_148 + uVar12);
}
else {
plVar10 = local_150;
local_150 = local_150 + 1;
}
alStack_138[iVar14] = *plVar10;
LAB_00100796:
iVar14 = iVar14 + 1;
}
}
switchD_0010020d_caseD_42:
iVar15 = iVar15 + 1;
param_10 = local_220 + 1;
} while( true );
}
/* 00100a90 as3vm_F32_getter */
void as3vm_F32_getter(undefined8 *param_1)
{
undefined8 uVar1;
uVar1 = as3vm_make_number_GC
((double)*(float *)(*(long *)param_1[3] + -1 + (long)*(int *)(param_1[4] + 0x18)
),*param_1);
*(undefined8 *)param_1[1] = uVar1;
return;
}
/* 00100ad0 as3vm_U8_bool_setter */
void as3vm_U8_bool_setter(undefined8 *param_1)
{
int iVar1;
undefined8 in_RAX;
undefined1 local_14 [4];
local_14[0] = (undefined1)((ulong)in_RAX >> 0x20);
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str1,local_14);
if (iVar1 == 0) {
*(undefined1 *)(*(long *)param_1[3] + -1 + (long)*(int *)(param_1[4] + 0x18)) = local_14[0];
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100b20 as3vm_U8_bool_getter */
void as3vm_U8_bool_getter(long param_1)
{
**(undefined8 **)(param_1 + 8) =
*(undefined8 *)
(lRam0000000000100b3f +
(ulong)*(byte *)(**(long **)(param_1 + 0x18) + -1 +
(long)*(int *)(*(long *)(param_1 + 0x20) + 0x18)) * 8);
return;
}
/* 00100b50 as3vm_set_helper_F32_GC */
bool as3vm_set_helper_F32_GC(undefined8 *param_1,undefined8 param_2)
{
int iVar1;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str2,param_2);
if (iVar1 != 0) {
as3vm_exception_GC(*param_1,0x78);
}
return iVar1 == 0;
}
/* 00100b90 as3vm_set_helper_S16_GC */
bool as3vm_set_helper_S16_GC(undefined8 *param_1,undefined2 *param_2)
{
int iVar1;
undefined2 local_1c [2];
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str3,local_1c);
if (iVar1 == 0) {
*param_2 = local_1c[0];
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return iVar1 == 0;
}
/* 00100be0 as3vm_setter_bool8 */
void as3vm_setter_bool8(undefined8 *param_1,int param_2)
{
int iVar1;
undefined4 local_1c;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str1,&local_1c);
if (iVar1 == 0) {
*(undefined4 *)(*(long *)param_1[3] + -1 + (long)param_2) = local_1c;
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100c30 as3vm_setter_S32 */
void as3vm_setter_S32(undefined8 *param_1,int param_2)
{
int iVar1;
undefined4 local_1c;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str3,&local_1c);
if (iVar1 == 0) {
*(undefined4 *)(*(long *)param_1[3] + -1 + (long)param_2) = local_1c;
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100c80 as3vm_setter_U32 */
void as3vm_setter_U32(undefined8 *param_1,int param_2)
{
int iVar1;
undefined4 local_1c;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str4,&local_1c);
if (iVar1 == 0) {
*(undefined4 *)(*(long *)param_1[3] + -1 + (long)param_2) = local_1c;
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100cd0 as3vm_setter_F32 */
void as3vm_setter_F32(undefined8 *param_1,int param_2)
{
int iVar1;
double local_20;
iVar1 = as3vm_component_parse_arguments_GC(param_1,&_L_str,&local_20);
if (iVar1 == 0) {
*(float *)(*(long *)param_1[3] + -1 + (long)param_2) = (float)local_20;
}
else {
as3vm_exception_GC(*param_1,0x78);
}
return;
}
/* 00100d30 as3vm_getter_bool8 */
void as3vm_getter_bool8(long param_1,int param_2)
{
long lVar1;
if (*(char *)(**(long **)(param_1 + 0x18) + -1 + (long)param_2) == '\0') {
lVar1 = lRam0000000000100d37 + 1;
}
else {
lVar1 = lRam0000000000100d37 + 9;
}
**(long **)(param_1 + 8) = lVar1;
return;
}
/* 00100d60 as3vm_getter_S32 */
void as3vm_getter_S32(undefined8 *param_1,int param_2)
{
undefined8 uVar1;
uVar1 = as3vm_make_int_GC(*param_1,*(undefined4 *)(*(long *)param_1[3] + -1 + (long)param_2));
*(undefined8 *)param_1[1] = uVar1;
return;
}
/* 00100d90 as3vm_getter_U32 */
void as3vm_getter_U32(undefined8 *param_1,int param_2)
{
undefined8 uVar1;
uVar1 = as3vm_make_uint_GC(*param_1,*(undefined4 *)(*(long *)param_1[3] + -1 + (long)param_2));
*(undefined8 *)param_1[1] = uVar1;
return;
}
/* 00100dc0 as3vm_getter_F32 */
void as3vm_getter_F32(undefined8 *param_1,int param_2)
{
undefined8 uVar1;
uVar1 = as3vm_make_number_GC
((double)*(float *)(*(long *)param_1[3] + -1 + (long)param_2),*param_1);
*(undefined8 *)param_1[1] = uVar1;
return;
}
/* 00100e00 as3vmcomp_set_value */
void as3vmcomp_set_value(undefined8 param_1,long param_2,int param_3,byte *param_4)
{
if (((((ulong)param_4 & 3) == 1) && (param_4 != (byte *)0x7)) &&
(0x17 < ((*param_4 ^ 0xf8) & *(byte *)(param_2 + 1)))) {
as3vm_write_barrier_slowpath(param_1,param_2,param_4 + -1);
}
*(byte **)(param_2 +
(ulong)*(ushort *)(*(long *)(*(long *)(param_2 + 8) + 0x58) + (long)param_3 * 2)) =
param_4;
return;
}
/* 00100e70 as3vm_create_interleaved_string_GC */
void as3vm_create_interleaved_string_GC
(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4,
undefined8 param_5,undefined8 param_6,undefined8 param_7,undefined8 param_8,
long param_9,int param_10,undefined8 param_11,undefined8 param_12,undefined8 param_13
,undefined8 param_14)
{
long lVar1;
char in_AL;
undefined8 *puVar2;
undefined8 uVar3;
ulong uVar4;
int iVar5;
undefined1 local_f8 [16];
undefined8 local_e8;
undefined8 local_e0;
undefined8 local_d8;
undefined8 local_d0;
undefined8 local_c8;
undefined8 local_b8;
undefined8 local_a8;
undefined8 local_98;
undefined8 local_88;
undefined8 local_78;
undefined8 local_68;
undefined8 local_58;
int local_48;
undefined4 local_44;
undefined8 *local_40;
undefined1 *local_38;
if (in_AL != '\0') {
local_c8 = param_1;
local_b8 = param_2;
local_a8 = param_3;
local_98 = param_4;
local_88 = param_5;
local_78 = param_6;
local_68 = param_7;
local_58 = param_8;
}
local_38 = local_f8;
local_40 = (undefined8 *)&stack0x00000008;
local_44 = 0x30;
local_48 = 0x10;
local_e8 = param_11;
local_e0 = param_12;
local_d8 = param_13;
local_d0 = param_14;
if (0 < param_10) {
lVar1 = *(long *)(param_9 + 0x6b18);
iVar5 = 0;
do {
uVar4 = (ulong)local_48;
if (uVar4 < 0x29) {
local_48 = local_48 + 8;
puVar2 = (undefined8 *)(local_38 + uVar4);
}
else {
puVar2 = local_40;
local_40 = local_40 + 1;
}
uVar3 = as3vm_make_string_c_GC(param_9,*puVar2);
puVar2 = *(undefined8 **)(param_9 + 0x6b18);
*(undefined8 **)(param_9 + 0x6b18) = puVar2 + 1;
*puVar2 = uVar3;
if (iVar5 < param_10 + -1) {
uVar3 = *(undefined8 *)(lVar1 + -8 + (long)((2 - param_10) + iVar5) * 8);
puVar2 = *(undefined8 **)(param_9 + 0x6b18);
*(undefined8 **)(param_9 + 0x6b18) = puVar2 + 1;
*puVar2 = uVar3;
}
iVar5 = iVar5 + 1;
} while (iVar5 != param_10);
}
as3vm_array_join(param_9,0,*(long *)(param_9 + 0x6b18) + (long)(param_10 * -2 + 1) * 8,
param_10 * 2 + -1,0,0,0,1);
*(long *)(param_9 + 0x6b18) = *(long *)(param_9 + 0x6b18) + (long)(param_10 * 3 + -2) * -8;
return;
}
/* 00102020 <EXTERNAL>::as3vm_ToInt32_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_ToInt32_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102028 <EXTERNAL>::as3vm_ToNumberDirect_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_ToNumberDirect_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102030 <EXTERNAL>::as3vm_ToString_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_ToString_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102038 <EXTERNAL>::as3vm_ToUInt32_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_ToUInt32_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102040 <EXTERNAL>::as3vm_array_join */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_array_join(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102048 <EXTERNAL>::as3vm_exception_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_exception_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102050 <EXTERNAL>::as3vm_is_ofclass */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_is_ofclass(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102058 <EXTERNAL>::as3vm_make_int_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_make_int_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102060 <EXTERNAL>::as3vm_make_number_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_make_number_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102068 <EXTERNAL>::as3vm_make_string_c_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_make_string_c_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102070 <EXTERNAL>::as3vm_make_uint_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_make_uint_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102080 <EXTERNAL>::as3vm_string_interned */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_string_interned(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102088 <EXTERNAL>::as3vm_string_interned_nocreate */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_string_interned_nocreate(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102090 <EXTERNAL>::as3vm_to_boolean_direct */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_to_boolean_direct(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 001020a0 <EXTERNAL>::as3vm_write_barrier_slowpath */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_write_barrier_slowpath(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
/* Recovered from as3vm_abc_dump.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,896 @@
/* Recovered from as3vm_classes_base_dummy.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_QName__construct */
void as3vm_QName__construct(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100010 as3vm_QName_get_localName */
void as3vm_QName_get_localName(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100020 as3vm_QName_get_uri */
void as3vm_QName_get_uri(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100030 as3vm_QName_toString */
void as3vm_QName_toString(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100040 as3vm_QName_valueOf */
void as3vm_QName_valueOf(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100050 as3vm_XML__construct */
void as3vm_XML__construct(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100060 as3vm_XML_get_ignoreComments */
void as3vm_XML_get_ignoreComments(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100070 as3vm_XML_get_ignoreProcessingInstructions */
void as3vm_XML_get_ignoreProcessingInstructions(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100080 as3vm_XML_get_ignoreWhitespace */
void as3vm_XML_get_ignoreWhitespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100090 as3vm_XML_get_prettyIndent */
void as3vm_XML_get_prettyIndent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000a0 as3vm_XML_get_prettyPrinting */
void as3vm_XML_get_prettyPrinting(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000b0 as3vm_XML_set_ignoreComments */
void as3vm_XML_set_ignoreComments(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000c0 as3vm_XML_set_ignoreProcessingInstructions */
void as3vm_XML_set_ignoreProcessingInstructions(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000d0 as3vm_XML_set_ignoreWhitespace */
void as3vm_XML_set_ignoreWhitespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000e0 as3vm_XML_set_prettyIndent */
void as3vm_XML_set_prettyIndent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001000f0 as3vm_XML_set_prettyPrinting */
void as3vm_XML_set_prettyPrinting(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100100 as3vm_XML_addNamespace */
void as3vm_XML_addNamespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100110 as3vm_XML_appendChild */
void as3vm_XML_appendChild(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100120 as3vm_XML_attribute */
void as3vm_XML_attribute(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100130 as3vm_XML_attributes */
void as3vm_XML_attributes(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100140 as3vm_XML_child */
void as3vm_XML_child(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100150 as3vm_XML_childIndex */
void as3vm_XML_childIndex(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100160 as3vm_XML_children */
void as3vm_XML_children(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100170 as3vm_XML_comments */
void as3vm_XML_comments(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100180 as3vm_XML_contains */
void as3vm_XML_contains(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100190 as3vm_XML_copy */
void as3vm_XML_copy(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001a0 as3vm_XML_defaultSettings */
void as3vm_XML_defaultSettings(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001b0 as3vm_XML_descendents */
void as3vm_XML_descendents(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001c0 as3vm_XML_elements */
void as3vm_XML_elements(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001d0 as3vm_XML_hasComplexContent */
void as3vm_XML_hasComplexContent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001e0 as3vm_XML_hasOwnProperty */
void as3vm_XML_hasOwnProperty(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001001f0 as3vm_XML_hashSimpleContent */
void as3vm_XML_hashSimpleContent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100200 as3vm_XML_inScopeNamespaces */
void as3vm_XML_inScopeNamespaces(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100210 as3vm_XML_insertChildAfter */
void as3vm_XML_insertChildAfter(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100220 as3vm_XML_insertChildBefore */
void as3vm_XML_insertChildBefore(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100230 as3vm_XML_length */
void as3vm_XML_length(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100240 as3vm_XML_localName */
void as3vm_XML_localName(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100250 as3vm_XML_name */
void as3vm_XML_name(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100260 as3vm_XML_namespace */
void as3vm_XML_namespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100270 as3vm_XML_namespaceDeclarations */
void as3vm_XML_namespaceDeclarations(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100280 as3vm_XML_nodeKind */
void as3vm_XML_nodeKind(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100290 as3vm_XML_normalize */
void as3vm_XML_normalize(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002a0 as3vm_XML_parent */
void as3vm_XML_parent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002b0 as3vm_XML_prependChild */
void as3vm_XML_prependChild(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002c0 as3vm_XML_processingInstructions */
void as3vm_XML_processingInstructions(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002d0 as3vm_XML_propertyIsEnumerable */
void as3vm_XML_propertyIsEnumerable(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002e0 as3vm_XML_removeNamespace */
void as3vm_XML_removeNamespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001002f0 as3vm_XML_replace */
void as3vm_XML_replace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100300 as3vm_XML_setChildren */
void as3vm_XML_setChildren(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100310 as3vm_XML_setLocalName */
void as3vm_XML_setLocalName(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100320 as3vm_XML_setName */
void as3vm_XML_setName(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100330 as3vm_XML_setNamespace */
void as3vm_XML_setNamespace(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100340 as3vm_XML_setSettings */
void as3vm_XML_setSettings(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100350 as3vm_XML_settings */
void as3vm_XML_settings(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100360 as3vm_XML_text */
void as3vm_XML_text(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100370 as3vm_XML_toString */
void as3vm_XML_toString(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100380 as3vm_XML_toXMLString */
void as3vm_XML_toXMLString(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100390 as3vm_XML_valueOf */
void as3vm_XML_valueOf(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003a0 as3vm_XMLList__construct */
void as3vm_XMLList__construct(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003b0 as3vm_XMLList_attribute */
void as3vm_XMLList_attribute(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003c0 as3vm_XMLList_attributes */
void as3vm_XMLList_attributes(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003d0 as3vm_XMLList_child */
void as3vm_XMLList_child(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003e0 as3vm_XMLList_children */
void as3vm_XMLList_children(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001003f0 as3vm_XMLList_comments */
void as3vm_XMLList_comments(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100400 as3vm_XMLList_contains */
void as3vm_XMLList_contains(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100410 as3vm_XMLList_copy */
void as3vm_XMLList_copy(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100420 as3vm_XMLList_descendents */
void as3vm_XMLList_descendents(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100430 as3vm_XMLList_elements */
void as3vm_XMLList_elements(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100440 as3vm_XMLList_hasComplexContent */
void as3vm_XMLList_hasComplexContent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100450 as3vm_XMLList_hasOwnProperty */
void as3vm_XMLList_hasOwnProperty(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100460 as3vm_XMLList_hashSimpleContent */
void as3vm_XMLList_hashSimpleContent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100470 as3vm_XMLList_length */
void as3vm_XMLList_length(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100480 as3vm_XMLList_normalize */
void as3vm_XMLList_normalize(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00100490 as3vm_XMLList_parent */
void as3vm_XMLList_parent(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004a0 as3vm_XMLList_processingInstructions */
void as3vm_XMLList_processingInstructions(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004b0 as3vm_XMLList_propertyIsEnumerable */
void as3vm_XMLList_propertyIsEnumerable(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004c0 as3vm_XMLList_text */
void as3vm_XMLList_text(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004d0 as3vm_XMLList_toString */
void as3vm_XMLList_toString(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004e0 as3vm_XMLList_toXMLString */
void as3vm_XMLList_toXMLString(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 001004f0 as3vm_XMLList_valueOf */
void as3vm_XMLList_valueOf(undefined8 *param_1)
{
as3vm_exception_GC(*param_1,0x74);
return;
}
/* 00101000 <EXTERNAL>::as3vm_exception_GC */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_exception_GC(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
/* Recovered from as3vm_debugger_interface.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_debugger_info */
undefined8 as3vm_debugger_info(void)
{
return 0;
}
/* 00100010 as3vm_watch */
undefined8 as3vm_watch(void)
{
return 0;
}

View File

@@ -0,0 +1,3 @@
/* Recovered from as3vm_dump_value.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,798 @@
/* Recovered from as3vm_names.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_find_intern_string */
undefined1 * as3vm_find_intern_string(undefined8 *param_1,ulong param_2,ushort *param_3,int param_4)
{
undefined8 uVar1;
uint uVar2;
uint uVar3;
int iVar4;
int iVar5;
long lVar6;
undefined8 *puVar7;
undefined1 *puVar8;
int iVar9;
uint uVar10;
int iVar11;
ushort *puVar12;
long lVar13;
ulong uVar14;
long lVar15;
undefined1 *puVar16;
uVar2 = (uint)param_2;
lVar15 = param_1[0x1a7];
while( true ) {
if ((int)uVar2 < 0x33) {
uVar14 = param_2 & 0xffffffff;
puVar12 = param_3;
uVar3 = uVar2;
if (0 < (int)uVar2) {
do {
uVar3 = (uVar3 << 7 | uVar3 >> 0x19) + (uint)*puVar12;
uVar10 = (int)uVar14 - 1;
uVar14 = (ulong)uVar10;
puVar12 = puVar12 + 1;
} while (uVar10 != 0);
}
}
else {
uVar3 = (uint)*param_3 + (uVar2 << 7 | uVar2 >> 0x19);
uVar3 = (uint)param_3[1] + (uVar3 * 0x80 | uVar3 >> 0x19);
uVar3 = (uint)param_3[2] + (uVar3 * 0x80 | uVar3 >> 0x19);
uVar3 = (uint)param_3[3] + (uVar3 * 0x80 | uVar3 >> 0x19);
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[4];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[5];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[6];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[7];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[8];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[9];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[10];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[0xb];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[0xc];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[0xd];
uVar3 = (uVar3 * 0x80 | uVar3 >> 0x19) + (uint)param_3[0xe];
uVar3 = uVar3 * 8 ^ uVar3;
uVar3 = (uVar3 >> 5) + uVar3;
uVar3 = uVar3 * 4 ^ uVar3;
uVar3 = (uVar3 >> 0xf) + uVar3;
uVar3 = uVar3 * 0x400 ^ uVar3;
iVar9 = uVar2 - 0xf;
do {
uVar3 = (uVar3 << 7 | uVar3 >> 0x19) + (uint)param_3[iVar9];
iVar9 = iVar9 + 1;
} while (iVar9 < (int)uVar2);
}
uVar3 = uVar3 * 8 ^ uVar3;
uVar3 = (uVar3 >> 5) + uVar3;
uVar3 = uVar3 * 4 ^ uVar3;
uVar3 = (uVar3 >> 0xf) + uVar3;
uVar3 = uVar3 * 0x400 ^ uVar3;
uVar14 = (ulong)(uVar3 & *(uint *)((long)param_1 + 0xd54));
puVar16 = *(undefined1 **)(lVar15 + 8 + uVar14 * 0x10);
if (puVar16 != (undefined1 *)0x0) {
if ((*(uint *)(lVar15 + uVar14 * 0x10) == uVar3) &&
(lVar6 = 0, (long)*(int *)(puVar16 + 0x30) == param_2)) {
do {
if ((long)param_2 <= lVar6) {
return puVar16;
}
lVar13 = lVar6 * 2;
puVar12 = param_3 + lVar6;
lVar6 = lVar6 + 1;
} while (*(ushort *)(puVar16 + lVar13 + 0x34) == *puVar12);
}
uVar10 = uVar3 * 8 ^ uVar3;
uVar10 = (uVar10 >> 5) + uVar10;
uVar10 = uVar10 * 4 ^ uVar10;
uVar10 = (uVar10 >> 0xf) + uVar10;
while( true ) {
uVar14 = (ulong)((int)uVar14 + (uVar10 * 0x400 ^ uVar10 | 1) &
*(uint *)((long)param_1 + 0xd54));
puVar16 = *(undefined1 **)(lVar15 + 8 + uVar14 * 0x10);
if (puVar16 == (undefined1 *)0x0) break;
if ((*(uint *)(lVar15 + uVar14 * 0x10) == uVar3) &&
(lVar6 = 0, (long)*(int *)(puVar16 + 0x30) == param_2)) {
do {
if ((long)param_2 <= lVar6) {
return puVar16;
}
lVar13 = lVar6 * 2;
puVar12 = param_3 + lVar6;
lVar6 = lVar6 + 1;
} while (*(ushort *)(puVar16 + lVar13 + 0x34) == *puVar12);
}
}
}
if (param_4 == 0) break;
if (*(int *)(param_1 + 0x1a9) < *(int *)((long)param_1 + 0xd4c)) {
puVar8 = (undefined1 *)iggy_arena_malloc_aligned(*param_1,0,uVar2 * 2 + 0x36,8,0x7b);
*puVar8 = 8;
puVar8[1] = 0x30;
puVar8[2] = 0x58;
puVar8[3] = 0;
*(undefined2 *)(puVar8 + 6) = 0;
*(undefined2 *)(puVar8 + 4) = 0;
*(undefined1 **)(puVar8 + 8) = puVar8 + 0x29;
puVar8[0x2a] = 99;
puVar8[0x29] = 0x30;
puVar8[0x28] = 1;
puVar8[0x2b] = 0;
*(uint *)(puVar8 + 0x30) = uVar2;
memcpy(puVar8 + 0x34,param_3,(long)(param_2 << 0x20) >> 0x1f);
*(undefined2 *)(puVar8 + (long)(int)uVar2 * 2 + 0x34) = 0;
puVar16 = (undefined1 *)0x0;
if (puVar8 != (undefined1 *)0x0) {
*(undefined1 **)(lVar15 + 8 + uVar14 * 0x10) = puVar8;
*(uint *)(lVar15 + uVar14 * 0x10) = uVar3;
iVar9 = *(int *)(param_1 + 0x1ab);
*(int *)(param_1 + 0x1ab) = iVar9 + 1;
iVar5 = iggy_rand(*param_1);
*(int *)(puVar8 + 0x20) = iVar5 * 0x10000 + iVar9;
*(undefined8 *)(puVar8 + 0x18) = 0;
*(undefined8 *)(puVar8 + 0x10) = 0;
*(int *)(param_1 + 0x1a9) = *(int *)(param_1 + 0x1a9) + 1;
puVar16 = puVar8;
}
return puVar16;
}
iVar9 = *(int *)(param_1 + 0x1aa);
lVar6 = iggy_malloc_fileline
(*param_1,*param_1,iVar9 << 5,5,"c:\\projects\\g\\src\\flash\\as3vm_names.c",
0x35);
uVar3 = iVar9 * 2 - 1;
iVar5 = iVar9 * 2;
if ((lVar6 == 0) || (iVar5 < 1)) {
if (lVar6 == 0) {
return (undefined1 *)0x0;
}
}
else {
puVar7 = (undefined8 *)(lVar6 + 8);
iVar11 = iVar5;
do {
*puVar7 = 0;
puVar7 = puVar7 + 2;
iVar11 = iVar11 + -1;
} while (iVar11 != 0);
}
iVar11 = *(int *)(param_1 + 0x1aa);
iVar4 = 0;
if (0 < iVar11) {
do {
lVar13 = (long)iVar4 * 0x10;
if (*(long *)(lVar15 + 8 + lVar13) != 0) {
uVar10 = *(uint *)(lVar15 + lVar13);
uVar14 = (ulong)(uVar10 & uVar3);
if (*(long *)(lVar6 + 8 + uVar14 * 0x10) != 0) {
uVar10 = uVar10 * 8 ^ uVar10;
uVar10 = (uVar10 >> 5) + uVar10;
uVar10 = uVar10 * 4 ^ uVar10;
uVar10 = (uVar10 >> 0xf) + uVar10;
do {
uVar14 = (ulong)((int)uVar14 + (uVar10 * 0x400 ^ uVar10 | 1) & uVar3);
} while (*(long *)(lVar6 + 8 + uVar14 * 0x10) != 0);
}
uVar1 = *(undefined8 *)(lVar13 + lVar15);
*(undefined8 *)(lVar6 + 8 + uVar14 * 0x10) = ((undefined8 *)(lVar13 + lVar15))[1];
*(undefined8 *)(lVar6 + uVar14 * 0x10) = uVar1;
iVar11 = *(int *)(param_1 + 0x1aa);
}
iVar4 = iVar4 + 1;
} while (iVar4 < iVar11);
}
iggy_free_alloc(*param_1,param_1[0x1a7]);
param_1[0x1a7] = lVar6;
*(int *)((long)param_1 + 0xd4c) = iVar9 * 6 >> 2;
*(int *)(param_1 + 0x1aa) = iVar5;
*(uint *)((long)param_1 + 0xd54) = uVar3;
lVar15 = lVar6;
}
return (undefined1 *)0x0;
}
/* 00100510 as3vm_namespace_find */
void as3vm_namespace_find(undefined8 *param_1,char param_2,long param_3)
{
long lVar1;
long *plVar2;
undefined1 *puVar3;
if (param_2 != '\a') {
if ((param_2 == -1) && (*(long *)(param_3 + 0x10) != 0)) {
return;
}
plVar2 = (long *)(param_3 + 0x10);
while (lVar1 = *plVar2, lVar1 != 0) {
if (*(char *)(lVar1 + 2) == param_2) {
return;
}
plVar2 = (long *)(lVar1 + 8);
}
}
puVar3 = (undefined1 *)iggy_arena_malloc(*param_1,0,0x18,0x7f);
puVar3[1] = 0x30;
*puVar3 = 0xc;
*(undefined2 *)(puVar3 + 4) = 0;
*(undefined2 *)(puVar3 + 6) = 0;
puVar3[2] = param_2;
*(long *)(puVar3 + 0x10) = param_3;
if (param_2 != '\a') {
*(undefined8 *)(puVar3 + 8) = *(undefined8 *)(param_3 + 0x10);
*(undefined1 **)(param_3 + 0x10) = puVar3;
}
return;
}
/* 001005a0 as3vm_set_namespace_slots */
void as3vm_set_namespace_slots(long param_1)
{
long lVar1;
long lVar2;
long *plVar3;
if (0 < *(int *)(param_1 + 0xd50)) {
lVar2 = 0;
do {
lVar1 = *(long *)(*(long *)(param_1 + 0xd38) + 8 + lVar2 * 0x10);
if (lVar1 != 0) {
plVar3 = (long *)(lVar1 + 0x10);
do {
lVar1 = *plVar3;
plVar3 = (long *)(lVar1 + 8);
} while (lVar1 != 0);
}
lVar2 = lVar2 + 1;
} while ((int)lVar2 != *(int *)(param_1 + 0xd50));
}
return;
}
/* 00100600 as3vm_qname_find */
void as3vm_qname_find(long param_1,long param_2,long param_3,undefined4 param_4)
{
if ((1 < *(ulong *)(param_2 + 0x18)) && (*(long *)(*(ulong *)(param_2 + 0x18) + 0x10) == param_3))
{
return;
}
qname_find(param_1,param_1 + 0xd60,param_2,param_3,param_4);
return;
}
/* 00100630 qname_find */
int * qname_find(undefined8 *param_1,undefined8 *param_2,long param_3,long param_4,int param_5)
{
int iVar1;
undefined8 uVar2;
long lVar3;
int iVar4;
int iVar5;
void *__s;
int *piVar6;
uint uVar7;
ulong uVar8;
uint uVar9;
void *pvVar10;
uVar9 = *(uint *)((long)param_2 + 0x1c);
pvVar10 = (void *)*param_2;
while( true ) {
uVar7 = *(int *)(*(long *)(param_4 + 0x10) + 0x20) * 5 + *(int *)(param_3 + 0x20);
uVar8 = (ulong)(uVar7 & uVar9);
piVar6 = *(int **)((long)pvVar10 + uVar8 * 8);
if (piVar6 != (int *)0x0) {
if ((*(long *)(piVar6 + 2) == param_3) && (*(long *)(piVar6 + 4) == param_4)) {
return piVar6;
}
while( true ) {
uVar8 = (ulong)((int)uVar8 + ((uVar7 >> 0x10) + uVar7 | 1) & uVar9);
piVar6 = *(int **)((long)pvVar10 + uVar8 * 8);
if (piVar6 == (int *)0x0) break;
if ((*(long *)(piVar6 + 2) == param_3) && (*(long *)(piVar6 + 4) == param_4)) {
return piVar6;
}
}
}
if (param_5 == 0) {
return (int *)0x0;
}
if (*(int *)(param_2 + 2) < *(int *)((long)param_2 + 0x14)) break;
iVar1 = *(int *)(param_2 + 3);
__s = (void *)iggy_malloc_fileline
(*param_1,*param_1,iVar1 << 4,6,
"c:\\projects\\g\\src\\flash\\as3vm_names.c",0x100);
uVar9 = iVar1 * 2 - 1;
if ((__s == (void *)0x0) || (iVar1 * 2 < 1)) {
if (__s == (void *)0x0) {
return (int *)0x0;
}
}
else {
memset(__s,0,(ulong)(iVar1 * 2 - 1) * 8 + 8);
}
uVar2 = param_2[1];
iVar5 = *(int *)(param_2 + 3);
iVar4 = 0;
if (0 < iVar5) {
do {
lVar3 = *(long *)((long)pvVar10 + (long)iVar4 * 8);
if (lVar3 != 0) {
uVar7 = *(int *)(*(long *)(*(long *)(lVar3 + 0x10) + 0x10) + 0x20) * 5 +
*(int *)(*(long *)(lVar3 + 8) + 0x20);
uVar8 = (ulong)(uVar7 & uVar9);
if (*(long *)((long)__s + uVar8 * 8) != 0) {
do {
uVar8 = (ulong)((int)uVar8 + ((uVar7 >> 0x10) + uVar7 | 1) & uVar9);
} while (*(long *)((long)__s + uVar8 * 8) != 0);
}
*(long *)((long)__s + uVar8 * 8) = lVar3;
iVar5 = *(int *)(param_2 + 3);
}
iVar4 = iVar4 + 1;
} while (iVar4 < iVar5);
}
iggy_free_alloc(*param_1,*param_2);
*param_2 = __s;
param_2[1] = uVar2;
*(int *)((long)param_2 + 0x14) = iVar1 * 4 >> 2;
*(int *)(param_2 + 3) = iVar1 * 2;
*(uint *)((long)param_2 + 0x1c) = uVar9;
pvVar10 = __s;
}
piVar6 = (int *)iggy_arena_malloc(*param_1,0,0x18,0x82);
*(int **)((long)pvVar10 + uVar8 * 8) = piVar6;
*(long *)(piVar6 + 2) = param_3;
*(long *)(piVar6 + 4) = param_4;
iVar1 = *(int *)(param_2 + 4);
*(int *)(param_2 + 4) = iVar1 + 1;
iVar5 = iggy_rand(*param_1);
*piVar6 = iVar5 * 0x10000 + iVar1;
*(int *)(param_2 + 2) = *(int *)(param_2 + 2) + 1;
return piVar6;
}
/* 00100880 as3vm_qname_store_with */
void as3vm_qname_store_with(long param_1)
{
long lVar1;
lVar1 = *(long *)(param_1 + 8);
if (*(long *)(lVar1 + 0x18) != param_1) {
if (*(long *)(lVar1 + 0x18) == 0) {
*(long *)(lVar1 + 0x18) = param_1;
return;
}
*(undefined8 *)(lVar1 + 0x18) = 1;
}
return;
}
/* 001008a0 as3vm_qname_find_classname */
ulong as3vm_qname_find_classname(long param_1,long param_2,long param_3)
{
long lVar1;
ulong uVar2;
ulong uVar3;
uint uVar4;
long lVar5;
uVar3 = *(ulong *)(param_2 + 0x18);
if ((uVar3 < 2) || (*(long *)(*(long *)(uVar3 + 0x10) + 0x10) != param_3)) {
lVar5 = *(long *)(param_3 + 0x10);
if (lVar5 != 0) {
do {
if ((uVar3 < 2) || (*(long *)(uVar3 + 0x10) != lVar5)) {
uVar4 = *(int *)(*(long *)(lVar5 + 0x10) + 0x20) * 5 + *(int *)(param_2 + 0x20);
uVar2 = (ulong)(uVar4 & *(uint *)(param_1 + 0xd7c));
uVar3 = *(ulong *)(*(long *)(param_1 + 0xd60) + uVar2 * 8);
if (uVar3 != 0) {
if ((*(long *)(uVar3 + 8) != param_2) || (*(long *)(uVar3 + 0x10) != lVar5)) {
do {
uVar2 = (ulong)((int)uVar2 + ((uVar4 >> 0x10) + uVar4 | 1) &
*(uint *)(param_1 + 0xd7c));
uVar3 = *(ulong *)(*(long *)(param_1 + 0xd60) + uVar2 * 8);
if (uVar3 == 0) goto LAB_00100960;
} while ((*(long *)(uVar3 + 8) != param_2) || (*(long *)(uVar3 + 0x10) != lVar5));
}
if (uVar3 != 0) goto LAB_00100950;
}
}
else {
LAB_00100950:
lVar1 = as3vm_classmap_get(param_1,uVar3);
if (lVar1 != 0) {
return uVar3;
}
}
LAB_00100960:
lVar5 = *(long *)(lVar5 + 8);
if (lVar5 == 0) break;
uVar3 = *(ulong *)(param_2 + 0x18);
} while( true );
}
uVar3 = 1;
}
return uVar3;
}
/* 00100980 as3vm_multiname_make */
ulong as3vm_multiname_make(undefined8 *param_1,long param_2,int *param_3,int param_4)
{
int iVar1;
ulong uVar2;
undefined4 *puVar3;
int iVar4;
iVar1 = *param_3;
if (param_4 != 0) {
if (iVar1 == 0) {
return 1;
}
if (iVar1 == 1) {
uVar2 = *(ulong *)(param_2 + 0x18);
if ((1 < uVar2) && (*(long *)(uVar2 + 0x10) == *(long *)(param_3 + 2))) {
return uVar2;
}
uVar2 = qname_find(param_1,param_1 + 0x1ac,param_2,*(long *)(param_3 + 2),1);
return uVar2;
}
}
iVar1 = iVar1 * 8 + 8;
iVar4 = 0x18;
if (0x17 < iVar1) {
iVar4 = iVar1;
}
puVar3 = (undefined4 *)iggy_arena_malloc(*param_1,0,iVar4,0x83);
*puVar3 = 0xffffffff;
*(long *)(puVar3 + 2) = param_2;
*(int **)(puVar3 + 4) = param_3;
return (long)puVar3 + 1;
}
/* 00100a10 as3vm_multiname_optimize */
void as3vm_multiname_optimize(long param_1,long param_2)
{
long lVar1;
int *piVar2;
long lVar3;
ulong uVar4;
ulong uVar5;
int iVar6;
int iVar7;
int iVar8;
uint uVar9;
lVar1 = *(long *)(param_2 + 7);
piVar2 = *(int **)(param_2 + 0xf);
iVar6 = *piVar2;
iVar8 = 0;
if ((0 < iVar6) && (lVar3 = *(long *)(piVar2 + 2), iVar8 = 0, lVar3 == *(long *)(param_1 + 0xd98))
) {
uVar4 = *(ulong *)(lVar1 + 0x18);
if ((uVar4 < 2) || (*(long *)(uVar4 + 0x10) != lVar3)) {
uVar4 = qname_find(param_1,param_1 + 0xd60,lVar1,lVar3,1);
}
*(ulong *)(param_2 + 7) = uVar4;
iVar6 = *piVar2;
iVar8 = 1;
}
iVar7 = iVar8;
if (iVar8 < iVar6) {
do {
lVar3 = *(long *)(piVar2 + (long)iVar8 * 2 + 2);
uVar4 = *(ulong *)(lVar1 + 0x18);
if ((uVar4 < 2) || (*(long *)(uVar4 + 0x10) != lVar3)) {
uVar9 = *(int *)(*(long *)(lVar3 + 0x10) + 0x20) * 5 + *(int *)(lVar1 + 0x20);
uVar5 = (ulong)(uVar9 & *(uint *)(param_1 + 0xd7c));
uVar4 = *(ulong *)(*(long *)(param_1 + 0xd60) + uVar5 * 8);
if (uVar4 != 0) {
if ((*(long *)(uVar4 + 8) != lVar1) || (*(long *)(uVar4 + 0x10) != lVar3)) {
do {
uVar5 = (ulong)((int)uVar5 + ((uVar9 >> 0x10) + uVar9 | 1) &
*(uint *)(param_1 + 0xd7c));
uVar4 = *(ulong *)(*(long *)(param_1 + 0xd60) + uVar5 * 8);
if (uVar4 == 0) goto LAB_00100b1f;
} while ((*(long *)(uVar4 + 8) != lVar1) || (*(long *)(uVar4 + 0x10) != lVar3));
}
if (uVar4 != 0) goto LAB_00100b10;
}
}
else {
LAB_00100b10:
*(ulong *)(param_2 + 7 + (long)iVar7 * 8) = uVar4;
iVar7 = iVar7 + 1;
iVar6 = *piVar2;
}
LAB_00100b1f:
iVar8 = iVar8 + 1;
} while (iVar8 < iVar6);
}
*(int *)(param_2 + -1) = iVar7;
return;
}
/* 00100b50 as3vm_multiname_make_optimized */
ulong as3vm_multiname_make_optimized(undefined8 *param_1,long param_2,int *param_3,int param_4)
{
undefined8 uVar1;
long lVar2;
int iVar3;
ulong *__src;
undefined8 *puVar4;
ulong uVar5;
int *piVar6;
long lVar7;
ulong uVar8;
int iVar9;
int iVar10;
ulong auStack_60 [2];
int local_4c;
long local_48;
ulong *local_40;
undefined8 *local_38;
if (param_4 == 0) {
uVar8 = *(ulong *)(param_2 + 0x18);
if (1 < uVar8) {
lVar7 = 0;
do {
if (*param_3 <= (int)lVar7) {
return 1;
}
lVar2 = lVar7 * 2;
lVar7 = lVar7 + 1;
} while (*(long *)(param_3 + lVar2 + 2) != *(long *)(uVar8 + 0x10));
return uVar8;
}
if (uVar8 == 0) {
return 1;
}
}
lVar7 = -((long)*param_3 * 8 + 0xfU & 0xfffffffffffffff0);
local_40 = (ulong *)((long)auStack_60 + lVar7 + 8);
uVar8 = 1;
if (0 < (long)*param_3) {
iVar9 = 0;
iVar10 = 0;
local_4c = param_4;
local_48 = param_2;
local_38 = param_1;
do {
puVar4 = local_38;
lVar2 = local_48;
iVar3 = local_4c;
uVar1 = *(undefined8 *)(param_3 + (long)iVar10 * 2 + 2);
*(undefined8 *)((long)auStack_60 + lVar7) = 0x100c1c;
uVar5 = qname_find(puVar4,param_1 + 0x1ac,lVar2,uVar1,iVar3);
if (uVar5 != 0) {
local_40[iVar9] = uVar5;
iVar9 = iVar9 + 1;
}
iVar10 = iVar10 + 1;
} while (iVar10 < *param_3);
if (iVar9 != 0) {
if (iVar9 == 1) {
uVar8 = *local_40;
}
else if (*(int *)((long)local_38 + 0x14) == 0) {
uVar1 = *local_38;
*(undefined8 *)((long)auStack_60 + lVar7) = 0x100c80;
piVar6 = (int *)iggy_malloc_fileline
(uVar1,0,iVar9 * 8 + 8,0xc,
"c:\\projects\\g\\src\\flash\\as3vm_names.c",500);
__src = local_40;
*(undefined8 *)((long)auStack_60 + lVar7) = 0x100c97;
memcpy(piVar6 + 2,__src,(long)iVar9 << 3);
*piVar6 = iVar9;
uVar8 = (long)piVar6 + 1;
}
}
}
return uVar8;
}
/* 00100cb0 as3vm_multiname_free */
void as3vm_multiname_free(undefined8 *param_1)
{
iggy_free_alloc(*param_1);
return;
}
/* 00100cc0 as3vm_interning_init */
void as3vm_interning_init(undefined8 *param_1)
{
undefined8 *puVar1;
long lVar2;
*(undefined4 *)(param_1 + 0x1af) = 0x200;
puVar1 = (undefined8 *)
iggy_malloc_fileline
(*param_1,*param_1,0x1000,6,"c:\\projects\\g\\src\\flash\\as3vm_names.c",0x100)
;
param_1[0x1ac] = puVar1;
param_1[0x1ae] = 0x10000000000;
*(undefined4 *)((long)param_1 + 0xd7c) = 0x1ff;
*(undefined4 *)(param_1 + 0x1b0) = 1;
if (puVar1 != (undefined8 *)0x0) {
*puVar1 = 0;
lVar2 = 1;
do {
*(undefined8 *)(param_1[0x1ac] + lVar2 * 8) = 0;
lVar2 = lVar2 + 1;
} while ((int)lVar2 != 0x200);
}
param_1[0x1ad] = param_1[0xd2d];
*(undefined4 *)(param_1 + 0x1aa) = 0x200;
lVar2 = iggy_malloc_fileline
(*param_1,*param_1,0x2000,5,"c:\\projects\\g\\src\\flash\\as3vm_names.c",0x35);
param_1[0x1a7] = lVar2;
param_1[0x1a9] = 0x18000000000;
*(undefined4 *)((long)param_1 + 0xd54) = 0x1ff;
*(undefined4 *)(param_1 + 0x1ab) = 1;
if (lVar2 != 0) {
*(undefined8 *)(lVar2 + 8) = 0;
lVar2 = 0;
do {
*(undefined8 *)(param_1[0x1a7] + 0x18 + lVar2) = 0;
lVar2 = lVar2 + 0x10;
} while ((int)lVar2 != 0x1ff0);
}
param_1[0x1a8] = param_1[0xd2d];
return;
}
/* 00101000 <EXTERNAL>::as3vm_classmap_get */
/* WARNING: Control flow encountered bad instruction data */
void as3vm_classmap_get(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101008 <EXTERNAL>::iggy_arena_malloc */
/* WARNING: Control flow encountered bad instruction data */
void iggy_arena_malloc(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101010 <EXTERNAL>::iggy_arena_malloc_aligned */
/* WARNING: Control flow encountered bad instruction data */
void iggy_arena_malloc_aligned(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101018 <EXTERNAL>::iggy_free_alloc */
/* WARNING: Control flow encountered bad instruction data */
void iggy_free_alloc(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101020 <EXTERNAL>::iggy_malloc_fileline */
/* WARNING: Control flow encountered bad instruction data */
void iggy_malloc_fileline(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101028 <EXTERNAL>::iggy_rand */
/* WARNING: Control flow encountered bad instruction data */
void iggy_rand(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101030 <EXTERNAL>::memcpy */
/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
void * memcpy(void *__dest,void *__src,size_t __n)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00101038 <EXTERNAL>::memset */
/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
void * memset(void *__s,int __c,size_t __n)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

View File

@@ -0,0 +1,13 @@
/* Recovered from as3vm_op_strings.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_opcode_name */
undefined8 as3vm_opcode_name(void)
{
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,889 @@
/* Recovered from as3vm_util.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 rriswdigit */
byte rriswdigit(short param_1)
{
return -((ushort)(param_1 - 0x30U) < 10) & 1;
}
/* 00100010 rrUTF8toUTF16 */
uint rrUTF8toUTF16(long param_1,int param_2,long param_3,int param_4,uint param_5,int param_6)
{
byte bVar1;
byte bVar2;
byte bVar3;
char cVar4;
int iVar5;
int iVar6;
int iVar7;
uint uVar8;
uint uVar9;
uint uVar10;
uint uVar11;
if (param_1 == 0) {
param_2 = 0x7fffffff;
}
iVar7 = 0x7fffffff;
if (-1 < param_4) {
iVar7 = param_4;
}
iVar6 = 0;
uVar11 = 0;
while( true ) {
uVar9 = uVar11;
if (param_4 < 0) {
cVar4 = *(char *)(param_3 + iVar6);
}
else {
cVar4 = iVar6 < param_4;
}
if (cVar4 == '\0') break;
bVar1 = *(byte *)(param_3 + iVar6);
if ((bVar1 & 0x80) == 0) {
iVar6 = iVar6 + 1;
uVar8 = (uint)bVar1;
LAB_001002c5:
uVar11 = uVar9 + 1;
if (param_2 < (int)uVar11) goto LAB_001002ee;
if (param_1 != 0) {
*(short *)(param_1 + (long)(int)uVar9 * 2) = (short)uVar8;
}
}
else {
uVar11 = (uint)bVar1;
if ((bVar1 & 0xe0) == 0xc0) {
if ((iVar7 < iVar6 + 1) ||
(uVar11 = (uint)*(byte *)(param_3 + (iVar6 + 1)), (uVar11 & 0xc0) != 0x80))
goto LAB_00100270;
uVar8 = (bVar1 & 0x1f) << 6 | uVar11 & 0x3f;
iVar6 = iVar6 + 2;
if (uVar8 < 0x80) goto LAB_001002b8;
goto LAB_001002c5;
}
if ((uVar11 & 0xf0) == 0xe0) {
if (((iVar6 + 2 <= iVar7) &&
(bVar2 = *(byte *)(param_3 + (iVar6 + 1)), (bVar2 & 0xc0) == 0x80)) &&
(bVar3 = *(byte *)(param_3 + (iVar6 + 2)), (bVar3 & 0xc0) == 0x80)) {
uVar8 = bVar3 & 0x3f | (bVar2 & 0x3f) << 6 | (bVar1 & 0xf) << 0xc;
iVar6 = iVar6 + 3;
if (uVar8 < 0x800) goto LAB_001002b8;
goto LAB_001002c5;
}
LAB_00100270:
iVar5 = iVar6 + 1;
if (param_4 < 0) {
do {
iVar6 = iVar5;
if (param_4 <= iVar6) break;
iVar5 = iVar6 + 1;
} while ((*(byte *)(param_3 + iVar6) & 0xc0) == 0x80);
}
else {
do {
iVar6 = iVar5;
if (*(char *)(param_3 + iVar6) == '\0') break;
iVar5 = iVar6 + 1;
} while ((*(byte *)(param_3 + iVar6) & 0xc0) == 0x80);
}
LAB_001002b8:
uVar8 = param_5;
if ((int)param_5 < 0) {
return 0xfffffffe;
}
goto LAB_001002c5;
}
if ((((uVar11 & 0xf8) != 0xf0) || (iVar7 < iVar6 + 3)) ||
((bVar1 = *(byte *)(param_3 + (iVar6 + 1)), (bVar1 & 0xc0) != 0x80 ||
((bVar2 = *(byte *)(param_3 + (iVar6 + 2)), (bVar2 & 0xc0) != 0x80 ||
(bVar3 = *(byte *)(param_3 + (iVar6 + 3)), (bVar3 & 0xc0) != 0x80))))))
goto LAB_00100270;
uVar10 = (bVar1 & 0x3f) << 0xc | (uVar11 & 7) << 0x12;
uVar11 = (bVar2 & 0x3f) << 6;
uVar8 = (bVar3 & 0x3f | uVar11 | uVar10) - 0x10000;
iVar6 = iVar6 + 4;
if ((0xfffff < uVar8) || ((uVar11 & 0x1ff800 | uVar10) == 0xd800)) goto LAB_001002b8;
uVar11 = uVar9 + 2;
if (param_2 < (int)uVar11) goto LAB_001002ee;
if (param_1 != 0) {
*(ushort *)(param_1 + (long)(int)uVar9 * 2) = (ushort)(uVar8 >> 10) & 0x3ff | 0xd800;
*(ushort *)(param_1 + (long)(int)(uVar9 + 1) * 2) = (ushort)uVar8 & 0x3ff | 0xdc00;
}
}
}
if (param_4 < 0) {
if (param_2 < (int)(uVar9 + 1)) {
LAB_001002ee:
return -(uint)(param_6 == 0) | uVar9;
}
}
else if (param_2 < (int)(uVar9 + 1)) {
return uVar9;
}
if (param_1 == 0) {
return uVar9;
}
*(undefined2 *)(param_1 + (long)(int)uVar9 * 2) = 0;
return uVar9;
}
/* 00100320 rrUTF16toUTF8 */
uint rrUTF16toUTF8(undefined1 *param_1,int param_2,short *param_3,int param_4,int param_5)
{
uint uVar1;
ushort uVar2;
uint uVar3;
int iVar4;
int iVar5;
undefined1 *puVar6;
undefined1 local_38 [8];
if (param_1 == (undefined1 *)0x0) {
param_2 = 0x7fffffff;
}
iVar4 = 0x7fffffff;
if (-1 < param_4) {
iVar4 = param_4;
}
puVar6 = param_1;
uVar3 = 0;
iVar5 = 0;
while( true ) {
if (param_4 < 0) {
uVar2 = param_3[iVar5];
}
else {
uVar2 = (ushort)(iVar5 < iVar4);
}
if (uVar2 == 0) break;
if (param_1 == (undefined1 *)0x0) {
puVar6 = local_38 + -(long)(int)uVar3;
}
uVar2 = param_3[iVar5];
if (uVar2 < 0x80) {
if (param_2 <= (int)uVar3) goto LAB_0010054b;
puVar6[(int)uVar3] = (char)uVar2;
uVar3 = uVar3 + 1;
iVar5 = iVar5 + 1;
}
else if (uVar2 < 0x800) {
if (param_2 <= (int)(uVar3 + 1)) goto LAB_0010054b;
puVar6[(int)uVar3] = (char)(uVar2 >> 6) + -0x40;
puVar6[(int)(uVar3 + 1)] = *(byte *)(param_3 + iVar5) & 0x3f | 0x80;
uVar3 = uVar3 + 2;
iVar5 = iVar5 + 1;
}
else if ((ushort)(*param_3 + 0x2800U) < 0x400) {
if (iVar4 <= iVar5 + 1) {
return 0xfffffffe;
}
if (param_2 <= (int)(uVar3 + 3)) goto LAB_0010054b;
if (0x3ff < (ushort)(param_3[iVar5 + 1] + 0x2400U)) {
return 0xfffffffe;
}
uVar1 = (uint)uVar2 * 0x400 + -0x35fdc00 + (uint)(ushort)param_3[iVar5 + 1];
puVar6[(int)uVar3] = (char)(uVar1 >> 0x12) + -0x10;
puVar6[(int)(uVar3 + 1)] = (byte)(uVar1 >> 0xc) & 0x3f | 0x80;
puVar6[(int)(uVar3 + 2)] = (byte)(uVar1 >> 6) & 0x3f | 0x80;
puVar6[(int)(uVar3 + 3)] = (byte)uVar1 & 0x3f | 0x80;
uVar3 = uVar3 + 4;
iVar5 = iVar5 + 2;
}
else {
if ((ushort)(*param_3 + 0x2400U) < 0x400) {
return 0xfffffffe;
}
if (param_2 <= (int)(uVar3 + 2)) goto LAB_0010054b;
puVar6[(int)uVar3] = (byte)(uVar2 >> 0xc) | 0xe0;
puVar6[(int)(uVar3 + 1)] = (byte)((ushort)param_3[iVar5] >> 6) & 0x3f | 0x80;
puVar6[(int)(uVar3 + 2)] = *(byte *)(param_3 + iVar5) & 0x3f | 0x80;
uVar3 = uVar3 + 3;
iVar5 = iVar5 + 1;
}
}
if (-1 < param_4) {
if (param_1 == (undefined1 *)0x0) {
return uVar3;
}
if (param_2 <= (int)uVar3) {
return uVar3;
}
param_1[(int)uVar3] = 0;
return uVar3;
}
if ((int)uVar3 < param_2) {
if (param_1 != (undefined1 *)0x0) {
param_1[(int)uVar3] = 0;
}
return uVar3 + 1;
}
LAB_0010054b:
return -(uint)(param_5 == 0) | uVar3;
}
/* 00100560 iggyCompareUTF8toUTF16 */
ulong iggyCompareUTF8toUTF16(char *param_1,uint param_2,ushort *param_3,int param_4)
{
ushort uVar1;
size_t sVar2;
int iVar3;
uint uVar4;
ushort *puVar5;
int iVar6;
sVar2 = (size_t)param_2;
if ((int)param_2 < 0) {
sVar2 = strlen(param_1);
}
iVar6 = (int)sVar2;
if (param_4 < 0) {
param_4 = rrwcslen(param_3);
}
iVar3 = 0;
do {
if (param_4 == 0) {
return (ulong)(iVar3 < iVar6);
}
puVar5 = param_3 + 1;
uVar1 = *param_3;
iVar6 = (int)sVar2;
if (uVar1 < 0x80) {
if (iVar6 <= iVar3) {
return 0xffffffff;
}
if ((byte)param_1[iVar3] != uVar1) {
return 0xffffffff;
}
iVar3 = iVar3 + 1;
}
else if (uVar1 < 0x800) {
if (iVar6 <= iVar3 + 1) {
return 0xffffffff;
}
if ((ushort)(byte)param_1[iVar3] != (ushort)((uVar1 >> 6) + 0xc0)) {
return 0xffffffff;
}
if ((ushort)(byte)param_1[iVar3 + 1] != (uVar1 & 0x3f | 0x80)) {
return 0xffffffff;
}
iVar3 = iVar3 + 2;
}
else if ((ushort)(uVar1 + 0x2800) < 0x400) {
if (iVar6 <= iVar3 + 3) {
return 0xffffffff;
}
uVar4 = (uint)uVar1 * 0x400 + -0x35fdc00 + (uint)*puVar5;
if ((uint)(byte)param_1[iVar3] != (uVar4 >> 0x12) + 0xf0) {
return 0xffffffff;
}
if ((uint)(byte)param_1[iVar3 + 1] != (uVar4 >> 0xc & 0x3f | 0x80)) {
return 0xffffffff;
}
if ((uint)(byte)param_1[iVar3 + 2] != (uVar4 >> 6 & 0x3f | 0x80)) {
return 0xffffffff;
}
if ((uint)(byte)param_1[iVar3 + 3] != (uVar4 & 0x3f | 0x80)) {
return 0xffffffff;
}
puVar5 = param_3 + 2;
sVar2 = (size_t)(iVar6 - 1);
iVar3 = iVar3 + 4;
}
else {
if ((ushort)(uVar1 + 0x2400) < 0x400) {
return 0xffffffff;
}
if (iVar6 <= iVar3 + 2) {
return 0xffffffff;
}
if ((ushort)(byte)param_1[iVar3] != (ushort)(uVar1 >> 0xc | 0xe0)) {
return 0xffffffff;
}
if ((ushort)(byte)param_1[iVar3 + 1] != (uVar1 >> 6 & 0x3f | 0x80)) {
return 0xffffffff;
}
if ((ushort)(byte)param_1[iVar3 + 2] != (uVar1 & 0x3f | 0x80)) {
return 0xffffffff;
}
iVar3 = iVar3 + 3;
}
iVar6 = (int)sVar2;
param_4 = param_4 + -1;
param_3 = puVar5;
} while( true );
}
/* 001007a0 rr_utf16_read_integer_hex_ecmascript */
undefined8
rr_utf16_read_integer_hex_ecmascript
(ushort *param_1,int param_2,undefined8 *param_3,int *param_4,int param_5)
{
ushort *puVar1;
ushort uVar2;
bool bVar3;
undefined8 uVar4;
int iVar5;
uint uVar6;
int iVar7;
puVar1 = param_1 + param_2;
for (; param_1 < puVar1; param_1 = param_1 + 1) {
uVar2 = *param_1;
if (10 < (ushort)(uVar2 + 0xe000)) {
if (uVar2 < 0x3000) {
uVar6 = (uint)uVar2;
if (uVar6 < 0x205f) {
if (uVar6 < 0x2028) {
if (uVar2 < 0x180e) {
if (uVar2 < 0x1680) {
if (((4 < uVar2 - 9) && (uVar2 != 0x20)) && (uVar2 != 0xa0)) break;
}
else if (uVar2 != 0x1680) break;
}
else if (uVar2 != 0x180e) break;
}
else if ((7 < uVar6 - 0x2028) || ((0x83U >> (uVar6 - 0x2028 & 0x1f) & 1) == 0)) break;
}
else if (uVar6 != 0x205f) break;
}
else if (uVar2 != 0x3000) break;
}
}
uVar4 = 0;
if (((param_1 != puVar1) && (*param_1 == 0x30)) && ((param_1[1] | 0x20) == 0x78)) {
bVar3 = false;
iVar7 = 0;
for (param_1 = param_1 + 2; param_1 < puVar1; param_1 = param_1 + 1) {
uVar2 = *param_1;
if ((ushort)(uVar2 - 0x30) < 10) {
LAB_001008e2:
iVar5 = uVar2 - 0x30;
}
else {
if ((5 < (ushort)(uVar2 - 0x61)) && (5 < (ushort)(uVar2 - 0x41))) {
bVar3 = true;
break;
}
if (uVar2 < 0x3a) goto LAB_001008e2;
iVar5 = -0x41;
if (0x60 < uVar2) {
iVar5 = -0x61;
}
iVar5 = uVar2 + 10 + iVar5;
}
iVar7 = iVar5 + iVar7 * 0x10;
}
if (param_5 == 0) {
if (bVar3) {
do {
uVar2 = *param_1;
if (10 < (ushort)(uVar2 + 0xe000)) {
uVar6 = (uint)uVar2;
if (uVar2 < 0x3000) {
if (uVar6 < 0x205f) {
if (uVar2 < 0x2028) {
if (uVar6 < 0x180e) {
if (uVar2 < 0x1680) {
if (((4 < uVar2 - 9) && (uVar2 != 0x20)) && (uVar6 != 0xa0)) break;
}
else if (uVar2 != 0x1680) break;
}
else if (uVar2 != 0x180e) break;
}
else if ((7 < uVar6 - 0x2028) || ((0x83U >> (uVar6 - 0x2028 & 0x1f) & 1) == 0))
break;
}
else if (uVar2 != 0x205f) break;
}
else if (uVar6 != 0x3000) break;
}
param_1 = param_1 + 1;
} while (param_1 < puVar1);
}
if (param_1 < puVar1) {
return 0;
}
}
if (param_3 != (undefined8 *)0x0) {
*param_3 = param_1;
}
*param_4 = iVar7;
uVar4 = 1;
}
return uVar4;
}
/* 00100a10 rr_utf16_read_hex_ecmascript */
undefined8
rr_utf16_read_hex_ecmascript
(ushort *param_1,int param_2,undefined8 *param_3,double *param_4,int param_5)
{
ushort *puVar1;
ushort uVar2;
bool bVar3;
undefined8 uVar4;
uint uVar5;
int iVar6;
double dVar7;
undefined1 auVar8 [64];
puVar1 = param_1 + param_2;
for (; param_1 < puVar1; param_1 = param_1 + 1) {
uVar2 = *param_1;
if (10 < (ushort)(uVar2 + 0xe000)) {
if (uVar2 < 0x3000) {
uVar5 = (uint)uVar2;
if (uVar5 < 0x205f) {
if (uVar5 < 0x2028) {
if (uVar2 < 0x180e) {
if (uVar2 < 0x1680) {
if (((4 < uVar2 - 9) && (uVar2 != 0x20)) && (uVar2 != 0xa0)) break;
}
else if (uVar2 != 0x1680) break;
}
else if (uVar2 != 0x180e) break;
}
else if ((7 < uVar5 - 0x2028) || ((0x83U >> (uVar5 - 0x2028 & 0x1f) & 1) == 0)) break;
}
else if (uVar5 != 0x205f) break;
}
else if (uVar2 != 0x3000) break;
}
}
uVar4 = 0;
if (((param_1 != puVar1) && (*param_1 == 0x30)) && ((param_1[1] | 0x20) == 0x78)) {
bVar3 = false;
dVar7 = 0.0;
auVar8 = ZEXT1264(ZEXT812(0));
for (param_1 = param_1 + 2; param_1 < puVar1; param_1 = param_1 + 1) {
uVar2 = *param_1;
dVar7 = auVar8._0_8_;
if ((ushort)(uVar2 - 0x30) < 10) {
iVar6 = uVar2 - 0x30;
}
else {
if ((5 < (ushort)(uVar2 - 0x61)) && (5 < (ushort)(uVar2 - 0x41))) {
bVar3 = true;
break;
}
if (uVar2 < 0x3a) {
iVar6 = uVar2 - 0x30;
}
else {
iVar6 = -0x41;
if (0x60 < uVar2) {
iVar6 = -0x61;
}
iVar6 = uVar2 + 10 + iVar6;
}
}
dVar7 = dVar7 * _LCPI5_0 + (double)iVar6;
auVar8 = ZEXT864((ulong)dVar7);
}
if (param_5 == 0) {
if (bVar3) {
do {
uVar2 = *param_1;
if (10 < (ushort)(uVar2 + 0xe000)) {
if (uVar2 < 0x3000) {
uVar5 = (uint)uVar2;
if (uVar5 < 0x205f) {
if (uVar5 < 0x2028) {
if (uVar2 < 0x180e) {
if (uVar2 < 0x1680) {
if (((4 < uVar2 - 9) && (uVar2 != 0x20)) && (uVar2 != 0xa0)) break;
}
else if (uVar2 != 0x1680) break;
}
else if (uVar2 != 0x180e) break;
}
else if ((7 < uVar5 - 0x2028) || ((0x83U >> (uVar5 - 0x2028 & 0x1f) & 1) == 0))
break;
}
else if (uVar5 != 0x205f) break;
}
else if (uVar2 != 0x3000) break;
}
param_1 = param_1 + 1;
} while (param_1 < puVar1);
}
if (param_1 < puVar1) {
return 0;
}
}
if (param_3 != (undefined8 *)0x0) {
*param_3 = param_1;
}
*param_4 = dVar7;
uVar4 = 1;
}
return uVar4;
}
/* 00100c80 rr_utf16_read_decimal_ecmascript */
undefined8
rr_utf16_read_decimal_ecmascript
(ushort *param_1,int param_2,ulong *param_3,double *param_4,int param_5)
{
ushort *puVar1;
double dVar2;
ushort uVar3;
uint uVar4;
ushort *puVar5;
undefined8 uVar6;
double dVar7;
double dVar8;
double dVar9;
undefined1 auVar10 [64];
puVar1 = param_1 + param_2;
for (; param_1 < puVar1; param_1 = param_1 + 1) {
uVar3 = *param_1;
if (10 < (ushort)(uVar3 + 0xe000)) {
if (uVar3 < 0x3000) {
uVar4 = (uint)uVar3;
if (uVar4 < 0x205f) {
if (uVar4 < 0x2028) {
if (uVar3 < 0x180e) {
if (uVar3 < 0x1680) {
if (((4 < uVar3 - 9) && (uVar3 != 0x20)) && (uVar3 != 0xa0)) break;
}
else if (uVar3 != 0x1680) break;
}
else if (uVar3 != 0x180e) break;
}
else if ((7 < uVar4 - 0x2028) || ((0x83U >> (uVar4 - 0x2028 & 0x1f) & 1) == 0)) break;
}
else if (uVar4 != 0x205f) break;
}
else if (uVar3 != 0x3000) break;
}
}
uVar6 = 0;
if (param_1 != puVar1) {
if (*param_1 == 0x2d) {
param_1 = param_1 + 1;
dVar8 = _LCPI6_1;
}
else {
dVar8 = _LCPI6_0;
if (*param_1 == 0x2b) {
param_1 = param_1 + 1;
}
}
if (param_1 != puVar1) {
uVar3 = *param_1;
dVar9 = 0.0;
if ((ushort)(uVar3 - 0x30) < 10) {
if (param_1 < puVar1) {
auVar10 = ZEXT464(0) << 0x20;
while( true ) {
dVar9 = auVar10._0_8_;
puVar5 = param_1 + 1;
if (9 < (ushort)(uVar3 - 0x30)) break;
dVar9 = dVar9 * _LCPI6_2 + (double)(int)(uVar3 - 0x30);
auVar10 = ZEXT864((ulong)dVar9);
param_1 = puVar5;
if (puVar1 <= puVar5) break;
uVar3 = *puVar5;
}
}
}
else if (uVar3 != 0x2e) {
return 0;
}
if ((param_1 < puVar1) && (*param_1 == 0x2e)) {
auVar10 = ZEXT1264(ZEXT812(0));
dVar7 = 0.0;
dVar2 = _LCPI6_0;
while (param_1 = param_1 + 1, param_1 < puVar1) {
dVar7 = auVar10._0_8_;
if (9 < (ushort)(*param_1 - 0x30)) break;
dVar7 = dVar7 * _LCPI6_2 + (double)(int)(*param_1 - 0x30);
auVar10 = ZEXT864((ulong)dVar7);
dVar2 = dVar2 * _LCPI6_2;
}
dVar9 = dVar9 + dVar7 / dVar2;
}
puVar5 = param_1;
if ((param_1 < puVar1) && ((*param_1 | 0x20) == 0x65)) {
puVar5 = param_1 + 1;
dVar7 = 0.0;
if (puVar5 < puVar1) {
if (*puVar5 == 0x2d) {
puVar5 = param_1 + 2;
dVar7 = _LCPI6_3;
}
else if (*puVar5 == 0x2b) {
puVar5 = param_1 + 2;
dVar7 = 0.0;
}
}
if (puVar5 == puVar1) {
return 0;
}
if (9 < (ushort)(*puVar5 - 0x30)) {
return 0;
}
dVar7 = pow(_LCPI6_2,dVar7);
dVar9 = dVar9 * dVar7;
}
if (param_5 == 0) {
for (; puVar5 < puVar1; puVar5 = puVar5 + 1) {
uVar3 = *puVar5;
if (10 < (ushort)(uVar3 + 0xe000)) {
if (uVar3 < 0x3000) {
uVar4 = (uint)uVar3;
if (uVar4 < 0x205f) {
if (uVar4 < 0x2028) {
if (uVar3 < 0x180e) {
if (uVar3 < 0x1680) {
if (((4 < uVar3 - 9) && (uVar3 != 0x20)) && (uVar3 != 0xa0)) break;
}
else if (uVar3 != 0x1680) break;
}
else if (uVar3 != 0x180e) break;
}
else if ((7 < uVar4 - 0x2028) || ((0x83U >> (uVar4 - 0x2028 & 0x1f) & 1) == 0))
break;
}
else if (uVar4 != 0x205f) break;
}
else if (uVar3 != 0x3000) break;
}
}
if (puVar5 < puVar1) {
return 0;
}
}
if (param_3 != (ulong *)0x0) {
*param_3 = (ulong)puVar5;
}
*param_4 = dVar8 * dVar9;
uVar6 = 1;
}
}
return uVar6;
}
/* 00100fe0 rr_utf16_simple_printf */
void rr_utf16_simple_printf(ushort *param_1,int param_2,ushort *param_3)
{
ushort *puVar1;
uint uVar2;
ushort *puVar3;
bool bVar4;
ushort uVar5;
uint *puVar6;
ulong uVar7;
ushort *puVar8;
long lVar9;
uint uVar10;
uint local_108 [48];
ushort local_46 [7];
uint local_38;
undefined4 local_34;
uint *local_30;
uint *local_28;
if (0 < param_2) {
local_28 = local_108;
local_30 = (uint *)&stack0x00000008;
local_34 = 0x30;
local_38 = 0x18;
uVar5 = *param_3;
if ((uVar5 != 0) && (puVar1 = param_1 + (long)param_2 + -1, param_1 < puVar1)) {
LAB_001011d0:
do {
puVar6 = local_30;
uVar2 = local_38;
puVar8 = param_3 + 1;
if (uVar5 == 0x25) {
uVar5 = *puVar8;
if (uVar5 == 0x25) {
*param_1 = 0x25;
param_1 = param_1 + 1;
param_3 = param_3 + 2;
}
else {
param_3 = param_3 + 2;
if (uVar5 == 0x73) {
if ((ulong)(long)(int)local_38 < 0x29) {
puVar6 = (uint *)((long)local_108 + (long)(int)local_38);
local_38 = local_38 + 8;
}
else {
local_30 = local_30 + 2;
}
puVar8 = *(ushort **)puVar6;
if (puVar8 == (ushort *)0x0) {
puVar8 = &rr_utf16_simple_printf_str_null;
}
lVar9 = -1;
}
else {
if (uVar5 != 0x53) {
if (uVar5 == 100) {
if ((ulong)(long)(int)local_38 < 0x29) {
puVar6 = (uint *)((long)local_108 + (long)(int)local_38);
local_38 = local_38 + 8;
}
else {
local_30 = local_30 + 2;
}
uVar2 = *puVar6;
uVar10 = -uVar2;
if (0 < (int)uVar2) {
uVar10 = uVar2;
}
local_46[2] = 0;
puVar3 = local_46 + 1;
do {
puVar8 = puVar3;
*puVar8 = (short)uVar10 + (short)(uVar10 / 10) * -10 | 0x30;
puVar3 = puVar8 + -1;
bVar4 = 9 < uVar10;
uVar10 = uVar10 / 10;
} while (bVar4);
if ((int)uVar2 < 0) {
*puVar3 = 0x2d;
puVar8 = puVar3;
}
lVar9 = 0xc;
if (puVar8 != (ushort *)0x0) goto LAB_00101162;
uVar5 = *param_3;
puVar8 = param_3;
}
param_3 = puVar8;
if (uVar5 == 0) break;
goto LAB_001011d0;
}
uVar7 = (ulong)(int)local_38;
if (uVar7 < 0x29) {
local_38 = local_38 + 8;
uVar10 = *(uint *)((long)local_108 + uVar7);
if (0x28 < local_38) goto LAB_00101133;
puVar6 = (uint *)((long)local_108 + (long)(int)local_38);
local_38 = uVar2 + 0x10;
}
else {
uVar10 = *local_30;
local_30 = local_30 + 2;
LAB_00101133:
puVar6 = local_30;
local_30 = local_30 + 2;
}
puVar3 = *(ushort **)puVar6;
puVar8 = puVar3;
if (puVar3 == (ushort *)0x0) {
puVar8 = &rr_utf16_simple_printf_str_null;
}
uVar10 = -(uint)(puVar3 == (ushort *)0x0) | uVar10;
lVar9 = -1;
if (-1 < (int)uVar10) {
lVar9 = (long)(int)uVar10;
}
}
LAB_00101162:
uVar5 = *puVar8;
if ((uVar5 != 0) && (lVar9 != 0)) {
lVar9 = -lVar9;
do {
lVar9 = lVar9 + 1;
puVar8 = puVar8 + 1;
*param_1 = uVar5;
param_1 = param_1 + 1;
uVar5 = *puVar8;
if (uVar5 == 0) break;
} while (lVar9 != 0);
}
}
}
else {
*param_1 = uVar5;
param_1 = param_1 + 1;
param_3 = puVar8;
}
uVar5 = *param_3;
if ((uVar5 == 0) || (puVar1 <= param_1)) break;
} while( true );
}
*param_1 = 0;
}
return;
}
/* 00102000 <EXTERNAL>::pow */
/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
double pow(double __x,double __y)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102008 <EXTERNAL>::rrwcslen */
/* WARNING: Control flow encountered bad instruction data */
void rrwcslen(void)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}
/* 00102010 <EXTERNAL>::strlen */
/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
size_t strlen(char *__s)
{
/* WARNING: Bad instruction - Truncating control flow here */
halt_baddata();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
/* Recovered from avm2_microcode.obj by Ghidra 12.0.4. */
/* Function and variable types are provisional until reconciled with the Iggy headers. */
/* 00100000 as3vm_microcode_init */
void as3vm_microcode_init(void)
{
long lVar1;
long lVar2;
lVar1 = lRam0000000000100010;
lVar2 = 0;
do {
*(undefined **)(lVar1 + (ulong)(byte)(&avm2_pseudo_microcode_data)[lVar2] * 8) =
&DAT_00100031 + lVar2;
lVar2 = lVar2 + 5;
} while ((int)lVar2 != 0x2d0);
return;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More