FOR DEVELOPERS / ABI PREVIEW
A boundary we can keep stable.
The GameReader SDK distributes public headers and prebuilt libraries. This plain-C preview tests the rules for a future binary interface across native, .NET, and Unreal consumers. Its API documentation is public; implementation source requires a separate license.
What exists now Binary SDK terms apply
Every symbol and signature is documented publicly. Commercial use of the prebuilt GameReader library at or above EUR 1 trillion annual revenue needs an enterprise license; implementation source needs a separate paid agreement. See API access and licensing.
The CMake package exports AmoosedWeb::GameReaderC as a shared library. Its amw_preview_* functions parse a game catalogue, open hosted or externally keyed Windows and Linux sites, list indexed paths, and download verified byte-addressable, PNG low-bit, AWF1/AWF2 sparse-frame, and WAV tone resources. Plain C and .NET 10 callers run against Windows and Linux libraries and local carrier fixtures. The prefix says exactly what it is: a changeable preview, not a 1.0 compatibility promise.
The proposed general Reader 1.0 contract has a C header draft and a design explanation. The draft is for review only: no shipped library exports its amw1_ names, and its values are not frozen. Game and compiler APIs are deliberately outside that draft.
Start with the plain C Reader quickstart, or download the complete source example. It checks revision and capabilities, opens a hosted index or an externally keyed index from a local .amwkey or packed ICO file, selects the entry or a named resource, and saves verified bytes without overwriting an existing file. Use native-c-site --external CREDENTIAL_FILE ORIGIN [RESOURCE_PATH] ABSOLUTE_OUTPUT_PATH for the external edition; the file is read locally and credential bytes are never passed as command arguments. For a protected resource, add --member MEMBER_FILE before the origin and name the resource path. The example parses the local .amwmember file, checks its edition ID against the verified index, and clears its key bytes after use. The Linux x64 review ZIP compiles this example against its extracted prebuilt library and tests exact external and protected recovery from local fixtures, including refusal to overwrite an existing output.
find_package(AmoosedWebGameReader 0.28 CONFIG REQUIRED)
target_link_libraries(your_tool PRIVATE AmoosedWeb::GameReaderC)The header is AmoosedWeb/PreviewC.h in the local CMake install. It declares fixed-width integer arguments and opaque catalogue, site, and game handles.
Complete preview symbol set
PreviewC.h gives the exact signatures, constants, field IDs, and calling convention. The machine-readable ABI inventory records the preview revision, capability bit values, public header hash, and exported symbol names for tooling. It is generated from the same header shipped in the SDK. The current exported API is:
| Symbol | Purpose |
|---|---|
amw_preview_abi_revision, amw_preview_capabilities | Return preview ABI revision 16 and query this binary's supported features. |
amw_preview_audio_decode_file | Authenticate one self-contained standalone WAV and copy recovered bytes into a caller-owned buffer. A 64 MiB input limit and a verified length query bound the local operation. |
amw_preview_catalogue_parse, amw_preview_catalogue_release | Create and release an opaque catalogue handle. |
amw_preview_catalogue_revision, amw_preview_catalogue_item_count, amw_preview_catalogue_item_string | Read catalogue revision and indexed item fields. |
amw_preview_site_open_hosted, amw_preview_site_open_external, amw_preview_site_release | Open verified hosted or externally keyed indexes and release the site handle. Site operations are Windows and Linux preview exports. |
amw_preview_site_prepare, amw_preview_site_load_hosted, amw_preview_site_load_external | Prepare a handle before network I/O, then load a hosted or external index. Another thread may cancel while loading. |
amw_preview_site_prepare_callback | Prepare a site with a caller supplied synchronous HTTP callback. The bounded response contract names range, suffix, or complete requests and checks the exact final URL and identity content encoding before normal index and resource verification. The local Node.js review bridge uses this callback. |
amw_preview_site_cancel | Request cancellation from another thread. |
amw_preview_site_resource_count, amw_preview_site_resource_path, amw_preview_site_resource_length, amw_preview_site_resource_string | Enumerate resource paths, plaintext sizes, and metadata. |
amw_preview_site_entry_path, amw_preview_site_member_key_id | Read app entry and protected edition ID. |
amw_preview_site_download | Download, verify, and publish one resource without overwriting an existing file. |
amw_preview_site_read_memory, amw_preview_site_read_memory_operation | Query verified-index length, then copy up to 64 MiB into caller memory only after full resource verification. The operation form supports cancellation. |
amw_preview_game_create, amw_preview_game_release, amw_preview_game_cancel | Own a Windows or Linux game session with a fixed game ID, version, and origin. |
amw_preview_game_refresh_hosted, amw_preview_game_refresh_external | Stage and accept a verified index plus game catalogue; explicit rollback flag is required for a lower revision. |
amw_preview_game_catalogue_revision, amw_preview_game_item_count, amw_preview_game_item_string, amw_preview_game_index_digest | Read the pinned catalogue and index digest from caller-owned buffers. |
amw_preview_game_fetch_item | Verify and publish a catalogue item by ID, with an optional 32-byte member key. |
amw_preview_operation_prepare, amw_preview_operation_cancel, amw_preview_operation_release | Create a single-use operation before worker dispatch, cancel it from another thread, and release it after the worker returns. |
amw_preview_site_load_hosted_operation, amw_preview_site_load_external_operation, amw_preview_site_download_operation | Run cancellable site I/O without permanently cancelling the site handle. |
amw_preview_game_refresh_hosted_operation, amw_preview_game_refresh_external_operation, amw_preview_game_fetch_item_operation | Run cancellable game I/O while retaining the previous verified snapshot on failed refresh. |
Status codes include NOT_FOUND for an absent indexed path or game item, INVALID_STATE for an unready or consumed handle, STALE_REVISION for a rejected game rollback, BAD_FORMAT for malformed catalogue data, plus authentication, verification, network, output, cancellation, and unsupported failures. Revision 16 retains the old numeric INVALID_DATA and READ_ERROR definitions only for preview compatibility; callers should use the precise statuses. The header defines the numeric values and the catalogue and resource field selectors. A delayed-carrier .NET P/Invoke test cancels an active download and checks that no final or staging file remains. Prepare a single-use operation before dispatching a synchronous site or game call, cancel it from another thread, and release it after the call returns. The older convenience open calls still return a handle only after opening completes. These preview values may change before 1.0.
Standalone WAV from plain C Public API documentation
Revision 14 adds amw_preview_audio_decode_file for one self-contained AWA1 WAV. It needs the original WAV bytes and the separate 32-byte media key. It does not need a website index or member key. Check AMW_PREVIEW_CAP_AUDIO_FILE, then call once with a null output and zero capacity to authenticate and query the plaintext length. Allocate that many bytes and call again to copy the authenticated result. The 64 MiB WAV input bound and 4,068-byte plaintext profile apply; this local call is synchronous and has no cancellation handle.
uint64_t required = 0;
int32_t status = amw_preview_audio_decode_file(wav, wav_length,
media_key, 32, NULL, 0, &required, error, sizeof(error));
if (status != AMW_PREVIEW_OK) { /* handle typed status */ }
/* Allocate required bytes, then call again with that buffer and capacity. */Download the complete plain-C example, also included in both source-free review SDK ZIPs. It reads the media key from a local hex file, authenticates the WAV, and creates the requested output without overwriting an existing file. Pass a trusted local output path; the key stays out of command arguments.
A short buffer returns BUFFER_TOO_SMALL and leaves it untouched. Wrong keys return AUTHENTICATION_FAILED; malformed WAV and damaged packets have separate status categories. No recovered bytes are released before full verification. Keep the key out of command arguments, pipeline strings, and logs. An optional GStreamer element can use this C boundary later; no GStreamer plugin is shipped today.
Capability negotiation Public API documentation
Call amw_preview_capabilities after checking the preview revision, then require the bits for the operations your product uses. The mask describes compiled support in the loaded binary; it is not a license, site permission, or credential. Unknown bits may be ignored. Windows x64 and Linux x64 preview builds report catalogue, site, game, cancellation, and media capabilities. Query the actual loaded binary; other platforms are not yet packaged.
| Bit | Available preview behavior |
|---|---|
CATALOGUE | Parse and inspect a game catalogue. |
HOSTED_INDEX, EXTERNAL_INDEX | Open a verified hosted or externally keyed site index. |
BYTE_CARRIERS | Recover append, PNG chunk, and MP4 UUID parts. |
MEMBER_CONTENT | Authenticate protected resources with a supplied member key. |
GAME_SESSION | Refresh a verified game catalogue and fetch indexed items. |
OPERATION_CANCEL | Cancel a prepared site or game operation from another thread. |
MEMORY_READ | Read a verified resource into a bounded caller-owned buffer. |
PNG_LOW_BITS, FRAME_LUMA, WAV_TONES | Use the Windows or Linux media decoders for those carrier modes. |
uint64_t available = 0;
uint64_t required = AMW_PREVIEW_CAP_HOSTED_INDEX |
AMW_PREVIEW_CAP_BYTE_CARRIERS;
if (amw_preview_abi_revision() != AMW_PREVIEW_ABI_REVISION ||
amw_preview_capabilities(&available) != AMW_PREVIEW_OK ||
(available & required) != required) {
/* Disable the integration or report unsupported runtime. */
}The future 1.0 amw1_query will use a separate stable major/minor contract. This preview mask does not freeze those future bit numbers.
Verified bytes in memory
amw_preview_site_read_memory copies a resource into caller-owned memory after all carrier and resource hashes pass. Pass NULL with capacity zero to query its plaintext length from the already verified index; this query does not download or verify the resource bytes. A short buffer returns BUFFER_TOO_SMALL, reports the required length, and leaves the buffer unchanged. Other failures leave both the buffer unchanged and the reported length zero. The limit is AMW_PREVIEW_MEMORY_LIMIT (64 MiB); use the file download for larger resources. The plain-C memory example checks capabilities, queries the length, allocates a bounded caller buffer, and uses the bytes only after a successful verified read. Pass a prepared operation to amw_preview_site_read_memory_operation when another thread must be able to cancel the read. The standalone .NET preview facade exposes this operation as ReadBytesAsync.
Text and binary input rules
Every direct C text argument uses an explicit byte length, strict UTF-8, and no embedded NUL. Invalid text returns INVALID_ARGUMENT before network or filesystem I/O. Catalogue JSON with malformed UTF-8 returns BAD_FORMAT. External-index credentials and 32-byte member keys remain binary inputs; they are not decoded as text at the ABI boundary. A valid multibyte UTF-8 path is accepted subject to the normal path and resource checks.
Output values on failure
The preview clears supplied handle and numeric outputs before returning an error: an unsuccessful handle is NULL, and a byte count, revision, item count, or resource length is zero. Caller-owned text buffers remain unchanged on a failed field query. A valid length query or BUFFER_TOO_SMALL sets required to the UTF-8 byte count without the terminating NUL; other failures set it to zero. Diagnostic error buffers are separate and may contain bounded text. Check the status before using any output.
Cancellation and operation lifetime
Prepare one operation before dispatching a synchronous site or game call to a worker. A different thread may cancel it. Join the worker before releasing the operation or its site/game handle. Each operation is single-use; create another for the next call. Calls on the same site or game handle remain serialized.
amw_preview_operation *operation = NULL;
if (amw_preview_operation_prepare(&operation) != AMW_PREVIEW_OK) return;
/* A worker calls amw_preview_site_download_operation(site, operation, ...).
Another thread may call amw_preview_operation_cancel(operation).
Join the worker before releasing either handle. */
amw_preview_operation_release(operation);A cancelled operation returns CANCELLED. A later operation on the same site or game can proceed; the legacy handle-level cancel calls remain in the preview for existing consumers. The public header lists every operation variant and its exact arguments.
Failure status reference Public API documentation
The status value is machine-readable. The caller-owned error buffer provides diagnostic detail and may change between preview releases. Check the status before using any output handle or file.
| Status | Meaning and caller action |
|---|---|
NOT_FOUND | The requested resource or game item is absent from a verified index. Choose an indexed path or ID. |
INVALID_STATE | A site is not loaded, a game session is not refreshed, or a single-use operation was already used. Prepare or load a new handle as required. |
STALE_REVISION | A game refresh would roll the verified catalogue revision backward. Allow rollback explicitly only if intended. |
BAD_FORMAT | The index, credential, catalogue, or resource metadata is malformed. Correct the input before retrying. |
AUTHENTICATION_FAILED | A required member key is absent or incorrect, or encrypted content failed authentication. Supply the matching key. |
VERIFICATION_FAILED | A fetched carrier part or reconstructed resource failed its expected digest. Check that the host serves the exact published bytes. |
NETWORK_ERROR | Transport failed while fetching the index or carrier. Check connectivity and the configured origin. |
OUTPUT_ERROR | The destination could not be staged or committed. Check the path and filesystem permissions. |
ALREADY_EXISTS | The destination existed before or appeared during publication. Choose another path; the library does not overwrite it. |
CANCELLED | An active index load, download, game refresh, or item fetch was cancelled. Retry with a new operation if needed. |
UNSUPPORTED | The requested resource or platform capability is unavailable in this preview. Use a supported carrier or adapter. |
INVALID_ARGUMENT, BUFFER_TOO_SMALL, INTERNAL_ERROR | See the public header for exact numeric values. BUFFER_TOO_SMALL reports the required buffer size. INTERNAL_ERROR includes local SHA-256 and AES-GCM provider failures; it does not by itself mean the key or hosted bytes are wrong. Legacy INVALID_DATA and READ_ERROR values remain reserved in this preview. |
These categories describe the current Windows and Linux preview and can be refined before the 1.0 ABI freeze. The licensed SDK uses the same publicly documented status contract.
Call and ownership rules
amw_preview_catalogue *catalogue = NULL;
char error[128] = {0};
int32_t status = amw_preview_catalogue_parse(
json_bytes, json_length, &catalogue, error, sizeof(error));
if (status == AMW_PREVIEW_OK) {
uint64_t count = 0;
amw_preview_catalogue_item_count(catalogue, &count);
/* Query a field's length, then copy into your own buffer. */
amw_preview_catalogue_release(catalogue);
}The caller owns input JSON, error text, and output buffers. The library owns the opaque handle until amw_preview_catalogue_release. Strings are copied, so no pointer into C++ object storage escapes. A too-small output buffer is left untouched and the required length is returned. Site and game handles also remain caller-owned; serialize their operations, call cancel from another thread if needed, and release only after active calls return. A .NET 10 interop example exercises these rules and hosted/external downloads with the installed DLL; its setup notes and project file are available separately.
Proposed 1.0 contract
The first stable C boundary is for the general Reader: verified hosted and external indexes, resource metadata, public and member memory reads and downloads, cancellation, and transactional output across every carrier mode claimed by a platform package. Game catalogue and Unreal operations remain optional preview layers until their own parity gate passes. The native compiler needs a separate stable contract after compiler parity. The symbol namespace, calling convention, fixed status codes, handle and operation lifetimes, and packaged binaries must be specified and tested before the Reader's 1.0 freeze.
We propose amw1_ for the stable Reader major and a separate future amwc1_ namespace for the compiler, with independent capability queries and immutable baselines. A 1.x ABI adds functions without changing existing signatures; a breaking ABI uses a new major namespace. The revision-16 preview now distinguishes NOT_FOUND, INVALID_STATE, malformed format, and transport failures. A failed local SHA-256 or AES-GCM provider is classified separately from changed carrier bytes or a rejected authentication tag in the built-in Windows and Linux Readers. These names, values, and behavior still need a stable 1.0 freeze gate. The complete proposal and release gate are in the 1.0 design.
Compatibility contract before 1.0
Public API documentation The current source DLL reports preview revision 16. Its plain-C callback fixture has passed on Windows. The local Windows .NET and Node review packages use revision 16. The Linux and Unreal review packages still target revision 14 and cannot use this DLL. Preview consumers check the exact revision because signatures may change. The local SDK packaging gate compares the Windows x64 DLL export table and the Linux x86_64 ELF export table with every declaration in the public C header; missing or undocumented symbols fail the package build.
For 1.0, we propose a permanent amw1_ symbol namespace and a major/minor capability query. A 1.x library would retain existing signatures, status values, ownership, and calling conventions; new functions or optional capabilities would be additive. A breaking change would use a new major namespace. This is a design rule, not a claim that the current preview already provides 1.0 compatibility. Read the proposed 1.0 contract for version, ownership, cancellation, and error rules. The release gate lists the parity and platform checks still required.
Reader migration
The published .NET Reader still invokes the native amw CLI, and the Unreal plugin now has a locally tested Win64 hosted-catalogue and public-item path. This preview proves cross-language calling, ownership, and verified Windows downloads. A clean Linux .NET consumer now lists a hosted index and recovers exact bytes. Linux plain-C fixtures cover a hosted public download, an external index, rejection of member data with an absent or incorrect key, and exact member recovery. Linux C++ fixtures also cover PNG low-bit, AWF1/AWF2 sparse-frame, and WAV tone carriers. This does not yet justify changing the published Reader or Unreal plugin. See the capability matrix for the remaining gates.