Back to legacygamers.net
WARPGATE

CharMode

CCharMode character select, slot management, char creation/deletion

Functions 25Code 18 KBAddresses 0x00D8CD40 to 0x00D9CE80Group Game Logic
25 functions
AddressSizeNameDescription
0x00D8CD4026CCharMode__set_selected_char_idSets selected character ID at offset 0x6F28 from packet data. Transitions to state 0x18 (map server connect pending). Part of CCharMode class.
0x00D8D960121CCharMode__send_keepaliveSends keepalive packet 0x187 with entity ID. Only sends in states 7/8/0xB/0x13 and when 12-second timer has elapsed. Part of CCharMode class.
0x00D8D9E0426CCharMode__clear_all_char_dataClears all character select data. Destroys STL tree at offset 0x6144, resets counters (0x6148-0x6170). Iterates 0x2C-byte entries in vector at 0x6178, destroying inner string vectors. Part of CCharMode class.
0x00D8E700103CCharMode__get_max_char_priorityIterates through character entries (0xAF bytes each, starting at offset 0x4068, max 0x44 entries). Returns the maximum priority byte value found at offset 0x8A within each entry. Returns -1 if null. Part of CCharMode class.
0x00D8E7E0422CCharMode__remove_char_entry_by_priorityRemoves character entry matching DAT_017304da priority. Allocates temp buffer, copies non-matching entries, decrements count and DAT_01737ff4. Each entry is 0xAF bytes at offset 0x4068. Sets state to 7. Part of CCharMode class.
0x00D8E990169CCharMode__init_char_select_dataInitializes character select data from server packet. Stores slot/count/flags to globals, zeros 0x2E7C byte entry buffer at offset 0x4068. Copies 20-byte auth token from packet to offset 0x6EFC with htonl byte-swaps. Part of CCharMode class.
0x00D8EAC0519CCharMode__load_char_listLoads character list from packet. Copies 20-byte auth token with htonl swaps. Calculates char count from (packet_size-0x1B)/0xAF. Validates size alignment, shows error if misaligned. Copies char data and translates map names. Part of CCharMode class.
0x00D8ECD0230CCharMode__add_char_entryAdds single character entry (0xAF bytes) to global DAT_01730450 and to next slot in entry array at offset 0x4068. Translates map name. Increments char count and DAT_01737ff4. Sets state to 7. Part of CCharMode class.
0x00D8F0401300CCharMode__handle_char_list_pageHandles paginated character list packet. Validates 0xAF entry alignment, checks max 0x44 slots. Copies entries, stamps deletion timers, adjusts class gender codes. If not last page (count!=3), finalizes list and translates map names. Sets state 7. Part of CCharMode class.
0x00D8F7C0282CCharMode__load_char_list_with_authLoads character list with auth token. Copies 20-byte auth token with htonl swaps. Calculates char count from (packet_size-0x18)/0xAF. Copies char entry data to buffer at offset 0x4068. Sets state to 0x13. Part of CCharMode class.
0x00D8F8E0196CCharMode__load_char_list_simpleSimple character list load without auth token. Calculates char count from (packet_size-4)/0xAF, copies data to entry buffer at offset 0x4068. Sets state to 7. Part of CCharMode class.
0x00D917901599CCharMode__handle_disconnect_reasonHandles disconnect reason codes for char mode. Large switch/jump table for codes <0xF5 (via jump table). For codes >=0xF5: 0x1393=msg 0x72F, 0x1394=format with param_3, 0x1395-0x13C8 various disconnect messages. Code 0x1397 opens Stove/member_gate8 URL in browser via ShellExecuteA (XOR-encrypted 'open' command). 0x14B4/0x14B5 use newer messages. Falls through to quit or return to state 3.
0x00D929A0440CCharMode__connect_to_char_serverConnects to character server. Stores map ID at DAT_01733c40. Sends init request via DAT_013495bc vtable (type 0x2719). Unregisters old char select window. Copies server name string, extracts IP via inet_ntoa, stores port and name to globals. Disconnects old session, transitions to state 0xC.
0x00D92B80526CCharMode__handle_char_select_inputHandles char select screen input events. For events 0x2D/0x2E/0x2F (char select actions), shows corresponding messages (0x873/0x874/0x875) in dialog, pushes event to action queue at offset 0x6F1C. If queue changed, repositions window within screen bounds. Returns 1 if action taken, 0 otherwise.
0x00D9718092CCharMode__cleanup_resourcesCleans up char mode resources. Runs anti-cheat counter update, releases all unreferenced resources from CResourceMgr, calls stub_0056fd70. Clears string at offset 0x6F50.
0x00D97410421CCharMode__init_stateInitializes char mode state. Computes anti-cheat session token. Sets 6 counters to 5, initializes connection state fields. Copies server name from PTR_DAT_01348f84. Resets memory (0x80 bytes at offset 0xB8), calls init vtable method. Sets DAT_01360084=3, DAT_01730634=1. Plays BGM if enabled. Resets town info, various subsystem states.
0x00D975C0438CCharMode__process_frameChar mode frame processor. Handles network updates, packet processing, keepalive, crash reports, mouse input. Checks connection timeouts per state. Handles device reset, resource reload for texture changes. Renders UI, minimap, cursor, fade effects, screenshots.
0x00D97780868CCharMode__check_connection_timeoutChecks connection timeouts for various char mode states. State 4: 15s timeout (120s for kRO/jRO), sends 0x2725. State 5: 80s timeout, disconnect with message 1. State 6/0xC: 15s timeout, disconnect. State 0x26: 60s timeout for 2nd password, shows msg 0xD16 or 0xD70.
0x00D97B30507CCharMode__run_main_loopMain loop for char mode. Processes pending state changes, handles quit detection with MessageBox error display (XOR-encrypted title), calls process_frame each iteration. Shows fade-out with logo on exit. Returns 1.
0x00D97D30447CCharMode__process_frame_gameGame variant of char mode frame processor. Similar to process_frame but also runs CUIEventManager__process_events, timer callbacks (1000ms), Steam callbacks (Base_RunCallback). Same rendering pipeline.
0x00D984706222CCharMode__dispatch_network_packetsDispatches network packets during char select mode. 6.2K bytes. Called by CCharMode__process_frame. Reads packets from network session, handles login server list, char create/delete, pincode, map connect, web auth tokens, second password, premium time, and disconnect reasons.
0x00D9B2101170CCharMode__send_login_packetBuilds and sends login packet (0x277). Copies auth data, session keys, encrypted fields. Gets MAC address via Netbios NCB (NCBRESET+NCBASTAT) and formats as string. Falls back to encrypted default on Netbios failure. Gets local IP via gethostbyname+inet_ntoa (fallback to encrypted default). Sends via CNetworkSession__send_data_timed.
0x00D9B6B0730CCharMode__send_udp_analyticsSends UDP analytics packet. If string at 0x6F50 is set and DAT_01733c3c (entity ID) is non-zero, builds payload with entity ID + string data. Resolves encrypted analytics server hostname (XOR decrypted), creates UDP socket, sends to port 0x1771 (6001). Returns 1 on success.
0x00D9B990632CCharMode__handle_messageMain message handler for CCharMode. Massive switch handling 40+ message types (0x2711-0x2736). Handles server selection (0x2713), character selection, state transitions, string storage (names/passwords), server list operations, char slot operations. Message 0x2719 populates character stats to globals. Message 0x2723 handles service type 0x13 (Stove) login with encrypted config paths.
0x00D9CE80103CCharMode__set_loading_screen_pathSets loading screen path string. If param_2 differs from existing string at offset 0x9C, copies via STL_lib_func_004fa8f0. Destroys temporary string.