Back to legacygamers.net
WARPGATE

Encoding

Base64, Base62, RC4, hex, BigNum, CBOR/JSON, UTF-8, GameGuard XOR/hex obfuscation

Functions 63Code 29 KBAddresses 0x004DD810 to 0x00A85F20
63 functions
AddressSizeNameDescription
0x004DD810351STL_utf8_encode_codepointEncodes a Unicode codepoint to UTF-8 bytes, determining sequence length (1-4 bytes) and delegating to appropriate encoder via jump table.
0x004DE410193STL_detect_bom_encodingDetects BOM encoding type (UTF-8/16/32 LE/BE) and advances pointer past BOM; returns encoding ID or unknown.
0x004DE4E0118STL_detect_encoding_from_bom_or_nullsDetects text encoding (UTF-32/UTF-16/UTF-8) by checking BOM or null byte patterns in buffer.
0x004DEFC0165STL_utf8_validate_trailing_bytesValidates UTF-8 multi-byte character sequences by checking continuation byte markers and lead byte ranges for E0, ED, F0, F4.
0x0050B0E0719hex_encode_bytesEncodes binary data as hexadecimal string characters
0x0050B3C084hex_encode_byte_rangeEncodes binary data as hexadecimal string characters
0x0050B42027base64_encode_standardWrapper that encodes data using standard base64 alphabet (A-Z, a-z, 0-9, +/, =) for RO client data encoding.
0x0050B44027base64_encode_standard_to_stringWrapper that encodes data to base64 using standard alphabet (A-Za-z0-9+/=) and writes to string
0x0050B46027base64_decode_standardWrapper that decodes base64-encoded data using standard RFC 4648 alphabet (+/ padding).
0x0050B4801330base64_encodeEncodes binary data to base64 using provided lookup table, appending result to std::string output buffer with dynamic allocation.
0x0050B9D0354base64_encode_to_stringEncodes binary data to base64 string using custom alphabet from param_3 config, with configurable padding char
0x0050BB40382base64_decode_from_stringEncodes 3-byte chunks into 4-character base64 strings using custom alphabet, padding with configurable char.
0x0050BCC027base64url_encodeEncodes data using base64url alphabet (RFC 4648) with '-' and '_' instead of '+' and '/'
0x0050BCE027base64url_encode_to_stringEncodes data to base64url format (RFC 4648) using URL-safe alphabet with '-' and '_' instead of '+' and '/'
0x0050BD0027base64url_decodeDecodes base64url-encoded strings using RFC 4648 alphabet (replacing + with - and / with _)
0x0050BEF0877json_escape_stringEscapes JSON string by encoding special chars (\b\t\n\f\r\"\\), control chars, non-ASCII (if param_3), and / (if param_4) as \uXXXX or surrogate pairs.
0x0050C9A01059BigNum__ParseDecimalStringParses decimal string into BigNum, handles negative sign, validates digits, builds limb representation with error handling.
0x0050CF80314utf8_decode_codepoint_v2Decodes single UTF-8 codepoint from byte stream, validates trailing bytes, returns U+FFFD for invalid sequences.
0x0050D8401123BigInt__SerializeToBase256Serializes a big integer to base-256 representation by repeatedly dividing by 256 and pushing remainder bytes to vector.
0x00515050159JsonValue__GetArrayRangeExtracts begin/end iterators from JSON array value, throws exception if type is not array (type==9).
0x005150F0174JsonValue__GetArrayRange_recursiveRecursively dereferences JSON array values of type reference (0xC) to extract array bounds into output parameter.
0x005151A0199JsonValue__GetBoolExtracts boolean value from JSON value object, handling bool/int/reference types with recursive dereferencing.
0x00515290159JsonValue__GetByteStringExtracts byte string data (type 8) from JsonValue, recursively dereferences type 0xC references, throws on type mismatch.
0x00515330158JsonValue__GetCStringExtracts C string pointer from JSON value, dereferencing type 6/7/C nodes; throws exception if not string type.
0x005153D0318JsonValue__GetDoubleExtracts double value from JsonValue, supporting int/uint/half-float/double/string types with locale-aware parsing and reference dereferencing.
0x00515540181JsonValue__GetStringPtrLenExtracts string pointer and length from JsonValue; handles inline strings (type 6), allocated strings (type 7), and references (type 0xC).
0x00515600275BigInt__CompareCompares two BigInt objects by sign, then magnitude (128-bit limbs), returns -1/0/1 with negation if negative.
0x00515720165JsonValue__HasMapKeyChecks if a JSON map contains a given key; dereferences type 0xC references and searches the map's string-keyed entries.
0x005157D0185BigInt__AllocateLimbsAllocates and initializes limb array for BigInt, rounding count to 4-limb multiples, using aligned allocation for sizes >=4KB.
0x00515D603571BigInt__DivModPerforms big integer division with remainder using Knuth Algorithm D, handling both single and multi-limb divisors.
0x00516BE0801CborValue__AcceptImplements visitor pattern dispatch for CBOR value types, invoking appropriate handler vtable methods based on value type tag.
0x00516F40180CborValue__GetMajorTypeExtracts the major type (upper 3 bits) from a CBOR value's type byte at offset +4
0x00517000276CborValue__MapLookupLooks up a key in a CBOR map structure, returns pointer to value at offset +0x18, throws exception if key not found or invalid type.
0x0051712049CborValue__GetByteStringTagExtracts 8-byte tag value from CBOR byte string, dereferencing indirect references (type 0xC) until reaching actual data.
0x00517160167CborValue__FindMapEntryLocates a key entry in a CBOR map/tag structure; returns iterator to matching or end position for binary search.
0x005752A0129safe_wchar_reallocReallocates wide-character buffer with size validation; doubles allocation size and throws error code 0x8007000e on failure.
0x00575650182mbstr_to_wstr_allocConverts multibyte string to dynamically allocated wide string using locale-aware _Mbrtowc conversion, caller must free.
0x00581BF071count_mbcs_charsCounts multi-byte characters in a string within optional bounds using CharNextExA for codepage-aware iteration.
0x00581C4071count_utf8_charsCounts UTF-8 characters in a byte range by skipping continuation bytes (0x80-0xBF), handling null-terminated or bounded strings.
0x00581C9076get_mbcs_byte_lengthCalculates byte length of MBCS string within optional bounds using CharNextExA for proper multi-byte character iteration.
0x00581CE036utf8_skip_charSkips past one UTF-8 character by advancing pointer over continuation bytes (0x80-0xBF).
0x00581D1034utf8_retreat_charMoves a UTF-8 string pointer backwards by one character, skipping continuation bytes (0x80-0xBF).
0x005843D0423BigNum__SubtractRepeatedRepeatedly subtracts a divisor from a BigNum until result < divisor, returning quotient via trial division with borrow propagation.
0x00588820334utf8_decode_codepointDecodes UTF-8 byte sequence to Unicode codepoint with validation flags for underflow, surrogates, and max codepoint violations.
0x005F6A301820base64_decodeDecodes base64-encoded strings with optional newline stripping, outputting to STL string buffer with length validation.
0x005F7160115base64_decode_assignAssigns base64-decoded data from param_1 to STL string param_2, managing stack frame setup/teardown
0x005F71E0155base64_encode_with_string_outputWraps base64_encode_to_string_v2 to encode param_1 into an STL string output, with stack canary protection.
0x005F72802808std_string__append_base64_charAppends a single base64-encoded character to a std::string with dynamic reallocation, using param_4 to select alphabet variant.
0x005F818090base64_decode_char_lookupDecodes base64 character to 6-bit value (0-63); supports standard and URL-safe alphabet variants (+/- and -/_ mappings.
0x006B2EF01630JSON__EscapeStringEscapes JSON string by wrapping in quotes and converting special chars (\b,\t,\n,\f,\r,\",\\) and control chars (<0x20) to escape sequences.
0x006B35E0149JSON__IntToStringConverts a signed integer to a string representation and assigns it to a std::string object.
0x006B3760293JSON__DoubleToStringConverts double to JSON string, formats with "%#.16g", strips trailing zeros and unnecessary decimals.
0x006B3B101334JSON__WriteArraySerializes a Variant array to JSON format, supporting both inline and expanded (newline-indented) output modes.
0x006B40501056JSON__WriteArray_PrettyPrintSerializes JSON array to string with pretty-printing, handling multiline formatting, indentation, and element iteration with commas.
0x00735B601652rc4_cryptRC4 stream cipher encryption/decryption processing 8 bytes per iteration, updating S-box state and XORing keystream with data
0x007FBBD0257item_link_base62_decodeDecodes a base62-encoded string into an integer value using alphabet "0-9a-zA-Z".
0x007FBCE0694item_link_base62_encodeEncodes a numeric value using base-62 alphabet into a std::vector<char> string buffer.
0x0081C4B0257DecodeBase62StringDecodes a base-62 encoded string (0-9a-zA-Z) into a 32-bit integer value for item/chat IDs.
0x00842A20257Base62__DecodeDecodes a base-62 encoded string (0-9a-zA-Z) into an integer using positional weighting with base 62.
0x00842B30694Base62__EncodeEncodes a 32-bit integer to base-62 string using charset "0-9a-zA-Z", stores result in std::string output parameter.
0x0097DF00257base62_decodeDecodes base-62 encoded string (0-9a-zA-Z) to integer using positional notation with base 62.
0x0097E170140find_line_break_in_textFinds the next line break in text, skipping multi-byte color codes and handling character boundaries for rendering.
0x00A85F20107string_to_lower_mbcsConverts ASCII uppercase letters to lowercase in MBCS strings, respecting multibyte character boundaries via CharNextExA.