diff --git a/ChatCommands.cc b/ChatCommands.cc index d3181c25..f577a136 100644 --- a/ChatCommands.cc +++ b/ChatCommands.cc @@ -36,8 +36,8 @@ unordered_map name_to_section_id({ {u"whitill", 9}}); vector lobby_event_to_name({ - u"none", u"xmas", u"none", u"val", u"easter", u"hallo", u"sonic", - u"newyear", u"summer", u"white", u"wedding", u"fall", u"s-spring", + u"none", u"xmas", u"none", u"val", u"easter", u"hallo", u"sonic", + u"newyear", u"summer", u"white", u"wedding", u"fall", u"s-spring", u"s-summer", u"spring"}); unordered_map name_to_lobby_event({ @@ -87,42 +87,42 @@ unordered_map lobby_type_to_name({ }); unordered_map name_to_lobby_type({ - {u"normal", 0x00}, - {u"inormal", 0x0F}, - {u"ipc", 0x10}, - {u"iball", 0x11}, - {u"cave1", 0xD4}, - {u"cave2u", 0x67}, - {u"dragon", 0xFC}, - {u"derolle", 0xFD}, - {u"volopt", 0xFE}, - {u"darkfalz", 0xFF}, - {u"planet", 0xE9}, - {u"clouds", 0xEA}, - {u"cave", 0xED}, - {u"jungle", 0xEE}, - {u"forest2-2", 0xEF}, - {u"forest2-1", 0xF0}, - {u"windpower", 0xF1}, - {u"overview", 0xF2}, - {u"seaside", 0xF3}, - {u"some?", 0xF4}, - {u"dmorgue", 0xF5}, - {u"caelum", 0xF6}, - {u"digital", 0xF8}, - {u"boss1", 0xF9}, - {u"boss2", 0xFA}, - {u"boss3", 0xFB}, - {u"knight", 0xFC}, - {u"sky", 0xFE}, - {u"morgue", 0xFF}, + {u"normal", 0x00}, + {u"inormal", 0x0F}, + {u"ipc", 0x10}, + {u"iball", 0x11}, + {u"cave1", 0xD4}, + {u"cave2u", 0x67}, + {u"dragon", 0xFC}, + {u"derolle", 0xFD}, + {u"volopt", 0xFE}, + {u"darkfalz", 0xFF}, + {u"planet", 0xE9}, + {u"clouds", 0xEA}, + {u"cave", 0xED}, + {u"jungle", 0xEE}, + {u"forest2-2", 0xEF}, + {u"forest2-1", 0xF0}, + {u"windpower", 0xF1}, + {u"overview", 0xF2}, + {u"seaside", 0xF3}, + {u"some?", 0xF4}, + {u"dmorgue", 0xF5}, + {u"caelum", 0xF6}, + {u"digital", 0xF8}, + {u"boss1", 0xF9}, + {u"boss2", 0xFA}, + {u"boss3", 0xFB}, + {u"knight", 0xFC}, + {u"sky", 0xFE}, + {u"morgue", 0xFF}, }); vector tech_id_to_name({ - u"foie", u"gifoie", u"rafoie", - u"barta", u"gibarta", u"rabarta", - u"zonde", u"gizonde", u"razonde", - u"grants", u"deband", u"jellen", u"zalure", u"shifta", + u"foie", u"gifoie", u"rafoie", + u"barta", u"gibarta", u"rabarta", + u"zonde", u"gizonde", u"razonde", + u"grants", u"deband", u"jellen", u"zalure", u"shifta", u"ryuker", u"resta", u"anti", u"reverser", u"megid"}); unordered_map name_to_tech_id({ @@ -225,7 +225,7 @@ static void check_is_leader(shared_ptr l, shared_ptr c) { //////////////////////////////////////////////////////////////////////////////// // Message commands -static void command_lobby_info(shared_ptr s, shared_ptr l, +static void command_lobby_info(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { // no preconditions - everyone can use this command @@ -253,19 +253,19 @@ static void command_lobby_info(shared_ptr s, shared_ptr l, } } -static void command_ax(shared_ptr s, shared_ptr l, +static void command_ax(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::Announce); log(INFO, "[$ax from %010u] %S\n", c->license->serial_number, args); } -static void command_announce(shared_ptr s, shared_ptr l, +static void command_announce(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::Announce); send_text_message(s, args); } -static void command_arrow(shared_ptr s, shared_ptr l, +static void command_arrow(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { // no preconditions @@ -276,9 +276,9 @@ static void command_arrow(shared_ptr s, shared_ptr l, } //////////////////////////////////////////////////////////////////////////////// -// Lobby commands +// Lobby commands -static void command_cheat(shared_ptr s, shared_ptr l, +static void command_cheat(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_is_leader(l, c); @@ -301,7 +301,7 @@ static void command_cheat(shared_ptr s, shared_ptr l, } } -static void command_lobby_event(shared_ptr s, shared_ptr l, +static void command_lobby_event(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, false); check_privileges(c, Privilege::ChangeEvent); @@ -318,7 +318,7 @@ static void command_lobby_event(shared_ptr s, shared_ptr l, send_command(l, 0xDA, l->event, NULL, 0); } -static void command_lobby_event_all(shared_ptr s, shared_ptr l, +static void command_lobby_event_all(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::ChangeEvent); @@ -340,7 +340,7 @@ static void command_lobby_event_all(shared_ptr s, shared_ptr } } -static void command_lobby_type(shared_ptr s, shared_ptr l, +static void command_lobby_type(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, false); check_privileges(c, Privilege::ChangeEvent); @@ -366,9 +366,9 @@ static void command_lobby_type(shared_ptr s, shared_ptr l, } //////////////////////////////////////////////////////////////////////////////// -// Game commands +// Game commands -static void command_password(shared_ptr s, shared_ptr l, +static void command_password(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_is_leader(l, c); @@ -385,7 +385,7 @@ static void command_password(shared_ptr s, shared_ptr l, } } -static void command_min_level(shared_ptr s, shared_ptr l, +static void command_min_level(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_is_leader(l, c); @@ -396,7 +396,7 @@ static void command_min_level(shared_ptr s, shared_ptr l, l->min_level + 1); } -static void command_max_level(shared_ptr s, shared_ptr l, +static void command_max_level(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_is_leader(l, c); @@ -414,9 +414,9 @@ static void command_max_level(shared_ptr s, shared_ptr l, } //////////////////////////////////////////////////////////////////////////////// -// Character commands +// Character commands -static void command_edit(shared_ptr s, shared_ptr l, +static void command_edit(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, false); check_version(c, GameVersion::BB); @@ -500,7 +500,7 @@ static void command_edit(shared_ptr s, shared_ptr l, s->send_lobby_join_notifications(l, c); } -static void command_change_bank(shared_ptr s, shared_ptr l, +static void command_change_bank(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_version(c, GameVersion::BB); @@ -508,7 +508,7 @@ static void command_change_bank(shared_ptr s, shared_ptr l, // TODO: make sure the bank name is filesystem-safe } -static void command_convert_char_to_bb(shared_ptr s, shared_ptr l, +static void command_convert_char_to_bb(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, false); check_not_version(c, GameVersion::BB); @@ -541,9 +541,9 @@ static void command_convert_char_to_bb(shared_ptr s, shared_ptr s, shared_ptr l, +static void command_silence(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::SilenceUser); @@ -564,7 +564,7 @@ static void command_silence(shared_ptr s, shared_ptr l, target->can_chat ? "un" : ""); } -static void command_kick(shared_ptr s, shared_ptr l, +static void command_kick(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::KickUser); @@ -585,7 +585,7 @@ static void command_kick(shared_ptr s, shared_ptr l, send_text_message_printf(l, "$C6%s kicked off", target->player.disp.name); } -static void command_ban(shared_ptr s, shared_ptr l, +static void command_ban(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::BanUser); @@ -636,9 +636,9 @@ static void command_ban(shared_ptr s, shared_ptr l, } //////////////////////////////////////////////////////////////////////////////// -// Cheat commands +// Cheat commands -static void command_warp(shared_ptr s, shared_ptr l, +static void command_warp(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_cheats_enabled(l); @@ -667,7 +667,7 @@ static void command_warp(shared_ptr s, shared_ptr l, send_warp(c, area); } -static void command_infinite_hp(shared_ptr s, shared_ptr l, +static void command_infinite_hp(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_cheats_enabled(l); @@ -676,7 +676,7 @@ static void command_infinite_hp(shared_ptr s, shared_ptr l, send_text_message_printf(c, "$C6Infinite HP %s", c->infinite_hp ? "enabled" : "disabled"); } -static void command_infinite_tp(shared_ptr s, shared_ptr l, +static void command_infinite_tp(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_cheats_enabled(l); @@ -685,7 +685,7 @@ static void command_infinite_tp(shared_ptr s, shared_ptr l, send_text_message_printf(c, "$C6Infinite TP %s", c->infinite_tp ? "enabled" : "disabled"); } -static void command_item(shared_ptr s, shared_ptr l, +static void command_item(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args) { check_is_game(l, true); check_cheats_enabled(l); @@ -716,7 +716,7 @@ static void command_item(shared_ptr s, shared_ptr l, //////////////////////////////////////////////////////////////////////////////// -typedef void (*handler_t)(shared_ptr s, shared_ptr l, +typedef void (*handler_t)(shared_ptr s, shared_ptr l, shared_ptr c, const char16_t* args); struct ChatCommandDefinition { handler_t handler; diff --git a/Client.hh b/Client.hh index f89b4876..c8d19576 100644 --- a/Client.hh +++ b/Client.hh @@ -20,11 +20,11 @@ enum class ServerBehavior { }; struct ClientConfig { - uint32_t magic; // must be set to 0x48615467 - uint8_t bb_game_state; // status of client connecting on BB - uint8_t bb_player_index; // selected char - uint16_t flags; // just in case we lose them somehow between connections - uint16_t ports[4]; // used by shipgate clients + uint32_t magic; // must be set to 0x48615467 + uint8_t bb_game_state; // status of client connecting on BB + uint8_t bb_player_index; // selected char + uint16_t flags; // just in case we lose them somehow between connections + uint16_t ports[4]; // used by shipgate clients uint32_t unused[4]; }; @@ -54,22 +54,22 @@ struct Client { bool should_disconnect; std::string recv_buffer; - // timing & menus + // timing & menus uint64_t play_time_begin; // time of connection (used for incrementing play time on BB) uint64_t last_recv_time; // time of last data received uint64_t last_send_time; // time of last data sent - // lobby/positioning - uint32_t area; // which area is the client in? - uint32_t lobby_id; // which lobby is this person in? - uint8_t lobby_client_id; // which client number is this person? - uint8_t lobby_arrow_color; // lobby arrow color ID + // lobby/positioning + uint32_t area; // which area is the client in? + uint32_t lobby_id; // which lobby is this person in? + uint8_t lobby_client_id; // which client number is this person? + uint8_t lobby_arrow_color; // lobby arrow color ID Player player; - // miscellaneous (used by chat commands) - uint32_t next_exp_value; // next EXP value to give + // miscellaneous (used by chat commands) + uint32_t next_exp_value; // next EXP value to give bool infinite_hp; // cheats enabled - bool infinite_tp; // cheats enabled + bool infinite_tp; // cheats enabled bool can_chat; std::string pending_bb_save_username; uint8_t pending_bb_save_player_index; diff --git a/Items.cc b/Items.cc index 26cace29..10fd2434 100644 --- a/Items.cc +++ b/Items.cc @@ -15,22 +15,22 @@ using namespace std; 030B04 = TP Material (?) 030C00 = Cell Of MAG 502 030C01 = Cell Of MAG 213 -030C02 = Parts Of RoboChao -030C03 = Heart Of Opa Opa -030C04 = Heart Of Pian -030C05 = Heart Of Chao +030C02 = Parts Of RoboChao +030C03 = Heart Of Opa Opa +030C04 = Heart Of Pian +030C05 = Heart Of Chao 030D00 = Sorcerer's Right Arm -030D01 = S-beat's Arms -030D02 = P-arm's Arms -030D03 = Delsabre's Right Arm -030D04 = C-bringer's Right Arm -030D05 = Delsabre's Left Arm -030D06 = S-red's Arms -030D07 = Dragon's Claw -030D08 = Hildebear's Head -030D09 = Hildeblue's Head -030D0A = Parts of Baranz +030D01 = S-beat's Arms +030D02 = P-arm's Arms +030D03 = Delsabre's Right Arm +030D04 = C-bringer's Right Arm +030D05 = Delsabre's Left Arm +030D06 = S-red's Arms +030D07 = Dragon's Claw +030D08 = Hildebear's Head +030D09 = Hildeblue's Head +030D0A = Parts of Baranz 030D0B = Belra's Right Arms 030D0C = GIGUE'S ARMS 030D0D = S-BERILL'S ARMS @@ -44,11 +44,11 @@ using namespace std; 030E00 = BERILL PHOTON 030E01 = PARASITIC GENE FLOW 030E02 = MAGICSTONE IRITISTA -030E03 = BLUE BLACK STONE -030E04 = SYNCESTA +030E03 = BLUE BLACK STONE +030E04 = SYNCESTA 030E05 = MAGIC WATER 030E06 = PARASITIC CELL TYPE D -030E07 = MAGIC ROCK HEART KEY +030E07 = MAGIC ROCK HEART KEY 030E08 = MAGIC ROCK MOOLA 030E09 = STAR AMPLIFIER 030E0A = BOOK OF HITOGATA @@ -98,7 +98,7 @@ using namespace std; 031207 = WEAPONS BONE BADGE 031208 = LETTER OF APPRECATION 031209 = AUTOGRAPH ALBUM -03120A = VALENTINE'S CHOCOLATE +03120A = VALENTINE'S CHOCOLATE 03120B = NEWYEAR'S CARD 03120C = CRISMAS CARD 03120D = BIRTHDAY CARD diff --git a/Lobby.hh b/Lobby.hh index 4011d0a9..554ce5e5 100644 --- a/Lobby.hh +++ b/Lobby.hh @@ -38,7 +38,7 @@ struct Lobby { std::unordered_map item_id_to_floor_item; uint32_t variations[0x20]; - // game config + // game config GameVersion version; uint8_t section_id; uint8_t episode; @@ -48,16 +48,16 @@ struct Lobby { char16_t name[0x24]; uint32_t rare_seed; - //EP3_GAME_CONFIG* ep3; // only present if this is an Episode 3 game + //EP3_GAME_CONFIG* ep3; // only present if this is an Episode 3 game - // lobby stuff + // lobby stuff uint8_t event; uint8_t block; - uint8_t type; // number to give to PSO for the lobby number + uint8_t type; // number to give to PSO for the lobby number uint8_t leader_id; uint8_t max_clients; uint32_t flags; - uint32_t loading_quest_id; // for use with joinable quests + uint32_t loading_quest_id; // for use with joinable quests std::shared_ptr clients[12]; Lobby(); diff --git a/PSOEncryption.cc b/PSOEncryption.cc index a666ab10..b0e1f7ac 100644 --- a/PSOEncryption.cc +++ b/PSOEncryption.cc @@ -68,7 +68,7 @@ PSOPCEncryption::PSOPCEncryption(uint32_t seed) : offset(1) { } } -uint32_t PSOPCEncryption::next() { +uint32_t PSOPCEncryption::next() { if (this->offset == PC_STREAM_LENGTH) { this->update_stream(); this->offset = 1; diff --git a/Player.hh b/Player.hh index 025c7c86..05ab2a6c 100644 --- a/Player.hh +++ b/Player.hh @@ -166,7 +166,7 @@ struct PlayerDispDataBB { uint32_t name_color; uint8_t extra_model; uint8_t unused[11]; - uint32_t play_time; // not actually a game field; used only by my server + uint32_t play_time; // not actually a game field; used only by my server uint32_t name_color_checksum; uint8_t section_id; uint8_t char_class; @@ -199,8 +199,8 @@ struct GuildCardGC { uint32_t serial_number; char name[0x18]; char desc[0x6C]; - uint8_t reserved1; // should be 1 - uint8_t reserved2; // should be 1 + uint8_t reserved1; // should be 1 + uint8_t reserved2; // should be 1 uint8_t section_id; uint8_t char_class; }; @@ -211,8 +211,8 @@ struct GuildCardBB { char16_t name[0x18]; char16_t teamname[0x10]; char16_t desc[0x58]; - uint8_t reserved1; // should be 1 - uint8_t reserved2; // should be 1 + uint8_t reserved1; // should be 1 + uint8_t reserved2; // should be 1 uint8_t section_id; uint8_t char_class; }; @@ -226,22 +226,22 @@ struct GuildCardEntryBB { // the format of the BB guild card file struct GuildCardFileBB { uint8_t unknown[0x1F84]; - GuildCardEntryBB entry[0x0068]; // that's 104 of them in decimal + GuildCardEntryBB entry[0x0068]; // that's 104 of them in decimal uint8_t unknown2[0x01AC]; }; // PSOBB key config and team info struct KeyAndTeamConfigBB { - uint8_t unknown[0x0114]; // 0000 - uint8_t key_config[0x016C]; // 0114 - uint8_t joystick_config[0x0038]; // 0280 - uint32_t serial_number; // 02B8 - uint32_t team_id; // 02BC - uint32_t team_info[2]; // 02C0 - uint16_t team_privilege_level; // 02C8 - uint16_t reserved; // 02CA - char16_t team_name[0x0010]; // 02CC - uint8_t team_flag[0x0800]; // 02EC + uint8_t unknown[0x0114]; // 0000 + uint8_t key_config[0x016C]; // 0114 + uint8_t joystick_config[0x0038]; // 0280 + uint32_t serial_number; // 02B8 + uint32_t team_id; // 02BC + uint32_t team_info[2]; // 02C0 + uint16_t team_privilege_level; // 02C8 + uint16_t reserved; // 02CA + char16_t team_name[0x0010]; // 02CC + uint8_t team_flag[0x0800]; // 02EC uint32_t team_rewards[2]; // 0AEC }; @@ -322,32 +322,32 @@ struct PlayerLobbyJoinDataBB { // complete BB player data format (used in E7 command) struct PlayerBB { - PlayerInventory inventory; // 0000 // player - PlayerDispDataBB disp; // 034C // player - uint8_t unknown[0x0010]; // 04DC // - uint32_t option_flags; // 04EC // account - uint8_t quest_data1[0x0208]; // 04F0 // player - PlayerBank bank; // 06F8 // player - uint32_t serial_number; // 19C0 // player - char16_t name[0x18]; // 19C4 // player - char16_t team_name[0x10]; // 19C4 // player - char16_t guild_card_desc[0x58]; // 1A14 // player - uint8_t reserved1; // 1AC4 // player - uint8_t reserved2; // 1AC5 // player - uint8_t section_id; // 1AC6 // player - uint8_t char_class; // 1AC7 // player - uint32_t unknown3; // 1AC8 // - uint8_t symbol_chats[0x04E0]; // 1ACC // account - uint8_t shortcuts[0x0A40]; // 1FAC // account - char16_t auto_reply[0x00AC]; // 29EC // player - char16_t info_board[0x00AC]; // 2B44 // player - uint8_t unknown5[0x001C]; // 2C9C // - uint8_t challenge_data[0x0140]; // 2CB8 // player - uint8_t tech_menu_config[0x0028]; // 2DF8 // player - uint8_t unknown6[0x002C]; // 2E20 // - uint8_t quest_data2[0x0058]; // 2E4C // player - KeyAndTeamConfigBB key_config; // 2EA4 // account -}; // total size: 39A0 + PlayerInventory inventory; // 0000 // player + PlayerDispDataBB disp; // 034C // player + uint8_t unknown[0x0010]; // 04DC // + uint32_t option_flags; // 04EC // account + uint8_t quest_data1[0x0208]; // 04F0 // player + PlayerBank bank; // 06F8 // player + uint32_t serial_number; // 19C0 // player + char16_t name[0x18]; // 19C4 // player + char16_t team_name[0x10]; // 19C4 // player + char16_t guild_card_desc[0x58]; // 1A14 // player + uint8_t reserved1; // 1AC4 // player + uint8_t reserved2; // 1AC5 // player + uint8_t section_id; // 1AC6 // player + uint8_t char_class; // 1AC7 // player + uint32_t unknown3; // 1AC8 // + uint8_t symbol_chats[0x04E0]; // 1ACC // account + uint8_t shortcuts[0x0A40]; // 1FAC // account + char16_t auto_reply[0x00AC]; // 29EC // player + char16_t info_board[0x00AC]; // 2B44 // player + uint8_t unknown5[0x001C]; // 2C9C // + uint8_t challenge_data[0x0140]; // 2CB8 // player + uint8_t tech_menu_config[0x0028]; // 2DF8 // player + uint8_t unknown6[0x002C]; // 2E20 // + uint8_t quest_data2[0x0058]; // 2E4C // player + KeyAndTeamConfigBB key_config; // 2EA4 // account +}; // total size: 39A0 @@ -358,7 +358,7 @@ struct SavedPlayerBB { // .nsc file format char16_t auto_reply[0x00AC]; PlayerBank bank; uint8_t challenge_data[0x0140]; - PlayerDispDataBB disp; + PlayerDispDataBB disp; char16_t guild_card_desc[0x58]; char16_t info_board[0x00AC]; PlayerInventory inventory; @@ -390,18 +390,18 @@ struct Player { PlayerDispDataBB disp; // player uint8_t ep3_config[0x2408]; char16_t guild_card_desc[0x58]; // player - GuildCardFileBB guild_cards; // account + GuildCardFileBB guild_cards; // account PlayerInventoryItem identify_result; - char16_t info_board[0x00AC]; // player - PlayerInventory inventory; // player - KeyAndTeamConfigBB key_config; // account - uint32_t option_flags; // account - uint8_t quest_data1[0x0208]; // player - uint8_t quest_data2[0x0058]; // player + char16_t info_board[0x00AC]; // player + PlayerInventory inventory; // player + KeyAndTeamConfigBB key_config; // account + uint32_t option_flags; // account + uint8_t quest_data1[0x0208]; // player + uint8_t quest_data2[0x0058]; // player uint32_t serial_number; - uint8_t shortcuts[0x0A40]; // account - uint8_t symbol_chats[0x04E0]; // account - char16_t team_name[0x0010]; // account + uint8_t shortcuts[0x0A40]; // account + uint8_t symbol_chats[0x04E0]; // account + char16_t team_name[0x0010]; // account uint8_t tech_menu_config[0x0028]; // player void load_player_data(const std::string& filename); diff --git a/ReceiveCommands.cc b/ReceiveCommands.cc index af0ad394..1a662c6e 100644 --- a/ReceiveCommands.cc +++ b/ReceiveCommands.cc @@ -158,7 +158,7 @@ void process_disconnect(shared_ptr s, shared_ptr c) { //////////////////////////////////////////////////////////////////////////////// -void process_verify_license_gc(shared_ptr s, shared_ptr c, +void process_verify_license_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // DB struct Cmd { char unused[0x20]; @@ -176,7 +176,7 @@ void process_verify_license_gc(shared_ptr s, shared_ptr c, try { uint32_t serial_number; sscanf(cmd->serial_number, "%8" PRIX32, &serial_number); - c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, cmd->password); } catch (const exception& e) { u16string message = u"Login failed: " + decode_sjis(e.what()); @@ -189,7 +189,7 @@ void process_verify_license_gc(shared_ptr s, shared_ptr c, send_command(c, 0x9A, 0x02); } -void process_login_a_dc_pc_gc(shared_ptr s, shared_ptr c, +void process_login_a_dc_pc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 9A struct Cmd { char unused[0x20]; @@ -203,10 +203,10 @@ void process_login_a_dc_pc_gc(shared_ptr s, shared_ptr c, uint32_t serial_number; sscanf(cmd->serial_number, "%8" PRIX32, &serial_number); if (c->version == GameVersion::GC) { - c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, NULL); } else { - c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, NULL); } } catch (const exception& e) { @@ -219,7 +219,7 @@ void process_login_a_dc_pc_gc(shared_ptr s, shared_ptr c, send_command(c, 0x9C, 0x01); } -void process_login_c_dc_pc_gc(shared_ptr s, shared_ptr c, +void process_login_c_dc_pc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 9C struct Cmd { char unused[8]; @@ -238,10 +238,10 @@ void process_login_c_dc_pc_gc(shared_ptr s, shared_ptr c, uint32_t serial_number; sscanf(cmd->serial_number, "%8" PRIX32, &serial_number); if (c->version == GameVersion::GC) { - c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, cmd->password); } else { - c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, cmd->password); } } catch (const exception& e) { @@ -254,7 +254,7 @@ void process_login_c_dc_pc_gc(shared_ptr s, shared_ptr c, send_command(c, 0x9C, 0x01); } -void process_login_d_e_pc_gc(shared_ptr s, shared_ptr c, +void process_login_d_e_pc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 9D 9E struct Cmd { char unused[0x10]; @@ -277,10 +277,10 @@ void process_login_d_e_pc_gc(shared_ptr s, shared_ptr c, uint32_t serial_number; sscanf(cmd->serial_number, "%8" PRIX32, &serial_number); if (c->version == GameVersion::GC) { - c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_gc(serial_number, cmd->access_key, NULL); } else { - c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, + c->license = s->license_manager->verify_pc(serial_number, cmd->access_key, NULL); } } catch (const exception& e) { @@ -302,7 +302,7 @@ void process_login_d_e_pc_gc(shared_ptr s, shared_ptr c, process_login_complete(s, c); } -void process_login_bb(shared_ptr s, shared_ptr c, +void process_login_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 93 struct Cmd { char unused[0x14]; @@ -371,12 +371,12 @@ void process_login_bb(shared_ptr s, shared_ptr c, } } -void process_client_checksum(shared_ptr s, shared_ptr c, +void process_client_checksum(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 96 send_command(c, 0x97, 0x01); } -void process_server_time_request(shared_ptr s, shared_ptr c, +void process_server_time_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // B1 check_size(size, 0); send_server_time(c); @@ -388,7 +388,7 @@ void process_server_time_request(shared_ptr s, shared_ptr c // Ep3 commands. Note that these commands are not at all functional. The command // handlers that partially worked were lost in a dead hard drive, unfortunately. -void process_ep3_jukebox(shared_ptr s, shared_ptr c, +void process_ep3_jukebox(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t unknown[3]; // should be FFFFFFFF 00000000 @@ -404,13 +404,13 @@ void process_ep3_jukebox(shared_ptr s, shared_ptr c, send_command(l, command, 0x03, cmd); } -void process_ep3_menu_challenge(shared_ptr s, shared_ptr c, +void process_ep3_menu_challenge(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // DC check_size(size, 0); send_command(c, 0xDC); } -void process_ep3_server_data_request(shared_ptr s, shared_ptr c, +void process_ep3_server_data_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // CA check_size(size, 8, 0xFFFF); const PSOSubcommand* cmds = reinterpret_cast(data); @@ -427,14 +427,14 @@ void process_ep3_server_data_request(shared_ptr s, shared_ptrteamID); memcpy(&ti->ep3game, ((DWORD)c->bufferin + 0x14), 0x2AC); @@ -442,12 +442,12 @@ void process_ep3_server_data_request(shared_ptr s, shared_ptrteamID); - memcpy(&ti->ep3names[*(BYTE*)((DWORD)c->bufferin + 0x24)], ((DWORD)c->bufferin + 0x14), 0x14); // NOTICE: may be 0x26 instead of 0x24 + memcpy(&ti->ep3names[*(BYTE*)((DWORD)c->bufferin + 0x24)], ((DWORD)c->bufferin + 0x14), 0x14); // NOTICE: may be 0x26 instead of 0x24 CommandEp3InitSendNames(s, c); break; case 0x14: ti = FindTeam(s, c->teamID); - memcpy(&ti->ep3decks[*(BYTE*)((DWORD)c->bufferin + 0x14)], ((DWORD)c->bufferin + 0x18), 0x58); // NOTICE: may be 0x16 instead of 0x14 + memcpy(&ti->ep3decks[*(BYTE*)((DWORD)c->bufferin + 0x14)], ((DWORD)c->bufferin + 0x18), 0x58); // NOTICE: may be 0x16 instead of 0x14 Ep3FillHand(&ti->ep3game, &ti->ep3decks[*(BYTE*)((DWORD)c->bufferin + 0x14)], &ti->ep3pcs[*(BYTE*)((DWORD)c->bufferin + 0x14)]); //Ep3RollDice(&ti->ep3game, &ti->ep3pcs[*(BYTE*)((DWORD)c->bufferin + 0x14)]); CommandEp3InitSendDecks(s, c); @@ -455,7 +455,7 @@ void process_ep3_server_data_request(shared_ptr s, shared_ptrep3decks[x].clientID != 0xFFFFFFFF) && (ti->ep3names[x].clientID != 0xFF)) param++; if (param >= ti->ep3game.numPlayers) CommandEp3InitChangeState(s, c, 3); break; - // phase 3: hands & game states + // phase 3: hands & game states case 0x1D: ti = FindTeam(s, c->teamID); Ep3ReprocessMap(&ti->ep3game); @@ -463,7 +463,7 @@ void process_ep3_server_data_request(shared_ptr s, shared_ptrep3decks[x].clientID == 0xFFFFFFFF) || (ti->ep3names[x].clientID == 0xFF)) continue; - Ep3EquipCard(&ti->ep3game, &ti->ep3decks[x], &ti->ep3pcs[x], 0); // equip SC card + Ep3EquipCard(&ti->ep3game, &ti->ep3decks[x], &ti->ep3pcs[x], 0); // equip SC card CommandEp3InitHandUpdate(s, c, x); CommandEp3InitStatUpdate(s, c, x); y++; @@ -500,7 +500,7 @@ void process_ep3_server_data_request(shared_ptr s, shared_ptr s, shared_ptr c, +void process_message_box_closed(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // D6 if (c->flags & ClientFlag::InInformationMenu) { send_menu(c, u"Information", INFORMATION_MENU_ID, *s->information_menu, false); @@ -510,7 +510,7 @@ void process_message_box_closed(shared_ptr s, shared_ptr c, } } -void process_menu_item_info_request(shared_ptr s, shared_ptr c, +void process_menu_item_info_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 09 struct Cmd { uint32_t menu_id; @@ -570,7 +570,7 @@ void process_menu_item_info_request(shared_ptr s, shared_ptr s, shared_ptr c, +void process_menu_selection(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 10 bool uses_unicode = ((c->version == GameVersion::PC) || (c->version == GameVersion::BB)); @@ -795,13 +795,13 @@ void process_change_lobby(shared_ptr s, shared_ptr c, s->change_client_lobby(c, new_lobby); } -void process_game_list_request(shared_ptr s, shared_ptr c, +void process_game_list_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 08 check_size(size, 0); send_game_menu(c, s); } -void process_change_ship(shared_ptr s, shared_ptr c, +void process_change_ship(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // A0 send_message_box(c, u""); // we do this to avoid the "log window in message box" bug @@ -813,14 +813,14 @@ void process_change_ship(shared_ptr s, shared_ptr c, s->port_configuration.at(port_name).port); } -void process_change_block(shared_ptr s, shared_ptr c, +void process_change_block(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // A1 // this server doesn't have blocks; treat block change as ship change process_change_ship(s, c, command, flag, size, data); } //////////////////////////////////////////////////////////////////////////////// -// Quest commands +// Quest commands vector quest_categories_menu({ MenuItem(static_cast(QuestCategory::Retrieval), u"Retrieval", u"$E$C6Quests that involve\nretrieving an object", 0), @@ -832,15 +832,15 @@ vector quest_categories_menu({ }); vector quest_battle_menu({ - MenuItem(static_cast(QuestCategory::Battle), u"Battle", u"$E$C6Battle mode rule\nsets", 0), + MenuItem(static_cast(QuestCategory::Battle), u"Battle", u"$E$C6Battle mode rule\nsets", 0), }); vector quest_challenge_menu({ - MenuItem(static_cast(QuestCategory::Challenge), u"Challenge", u"$E$C6Challenge mode\nquests", 0), + MenuItem(static_cast(QuestCategory::Challenge), u"Challenge", u"$E$C6Challenge mode\nquests", 0), }); vector quest_solo_menu({ - MenuItem(static_cast(QuestCategory::Solo), u"Solo Quests", u"$E$C6Quests that require\na single player", 0), + MenuItem(static_cast(QuestCategory::Solo), u"Solo Quests", u"$E$C6Quests that require\na single player", 0), }); vector quest_government_menu({ @@ -859,7 +859,7 @@ vector quest_download_menu({ MenuItem(static_cast(QuestCategory::Download), u"Download", u"$E$C6Quests to download\nto your Memory Card", 0), }); -void process_quest_list_request(shared_ptr s, shared_ptr c, +void process_quest_list_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // A2 check_size(size, 0); @@ -894,7 +894,7 @@ void process_quest_list_request(shared_ptr s, shared_ptr c, send_quest_menu(c, QUEST_FILTER_MENU_ID, *menu, false); } -void process_quest_ready(shared_ptr s, shared_ptr c, +void process_quest_ready(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // AC check_size(size, 0); @@ -925,9 +925,9 @@ void process_quest_ready(shared_ptr s, shared_ptr c, } //////////////////////////////////////////////////////////////////////////////// -// player data commands +// player data commands -void process_player_data(shared_ptr s, shared_ptr c, +void process_player_data(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 61 98 // note: we add extra buffer on the end when checking sizes because the @@ -987,9 +987,9 @@ void process_player_data(shared_ptr s, shared_ptr c, } //////////////////////////////////////////////////////////////////////////////// -// subcommands +// subcommands -void process_game_command(shared_ptr s, shared_ptr c, +void process_game_command(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 60 62 6C 6D C9 CB (C9 CB are ep3 only) check_size(size, 4, 0xFFFF); const PSOSubcommand* sub = reinterpret_cast(data); @@ -1004,9 +1004,9 @@ void process_game_command(shared_ptr s, shared_ptr c, } //////////////////////////////////////////////////////////////////////////////// -// chat commands +// chat commands -void process_chat_generic(shared_ptr s, shared_ptr c, +void process_chat_generic(shared_ptr s, shared_ptr c, const u16string& text) { // 06 if (!c->can_chat) { @@ -1043,7 +1043,7 @@ void process_chat_generic(shared_ptr s, shared_ptr c, } } -void process_chat_pc_bb(shared_ptr s, shared_ptr c, +void process_chat_pc_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 06 struct Cmd { uint32_t unused[2]; @@ -1055,7 +1055,7 @@ void process_chat_pc_bb(shared_ptr s, shared_ptr c, process_chat_generic(s, c, cmd->text); } -void process_chat_dc_gc(shared_ptr s, shared_ptr c, +void process_chat_dc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t unused[2]; @@ -1071,13 +1071,13 @@ void process_chat_dc_gc(shared_ptr s, shared_ptr c, //////////////////////////////////////////////////////////////////////////////// // BB commands -void process_key_config_request_bb(shared_ptr s, shared_ptr c, +void process_key_config_request_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); send_team_and_key_config_bb(c); } -void process_player_preview_request_bb(shared_ptr s, shared_ptr c, +void process_player_preview_request_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t player_index; @@ -1113,7 +1113,7 @@ void process_player_preview_request_bb(shared_ptr s, shared_ptr s, shared_ptr c, +void process_client_checksum_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); @@ -1126,7 +1126,7 @@ void process_client_checksum_bb(shared_ptr s, shared_ptr c, } } -void process_guild_card_data_request_bb(shared_ptr s, shared_ptr c, +void process_guild_card_data_request_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t unknown; @@ -1141,7 +1141,7 @@ void process_guild_card_data_request_bb(shared_ptr s, shared_ptr s, shared_ptr c, +void process_stream_file_request_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); @@ -1152,7 +1152,7 @@ void process_stream_file_request_bb(shared_ptr s, shared_ptr s, shared_ptr c, +void process_create_character_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t player_index; @@ -1211,16 +1211,16 @@ void process_create_character_bb(shared_ptr s, shared_ptr c send_approve_player_choice_bb(c); } -void process_change_account_data_bb(shared_ptr s, shared_ptr c, +void process_change_account_data_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { union Cmd { - uint32_t option; // 01ED - uint8_t symbol_chats[0x4E0]; // 02ED - uint8_t chat_shortcuts[0xA40]; // 03ED - uint8_t key_config[0x16C]; // 04ED - uint8_t pad_config[0x38]; // 05ED - uint8_t tech_menu[0x28]; // 06ED - uint8_t customize[0xE8]; // 07ED + uint32_t option; // 01ED + uint8_t symbol_chats[0x4E0]; // 02ED + uint8_t chat_shortcuts[0xA40]; // 03ED + uint8_t key_config[0x16C]; // 04ED + uint8_t pad_config[0x38]; // 05ED + uint8_t tech_menu[0x28]; // 06ED + uint8_t customize[0xE8]; // 07ED }; const auto* cmd = reinterpret_cast(data); @@ -1258,7 +1258,7 @@ void process_change_account_data_bb(shared_ptr s, shared_ptr s, shared_ptr c, +void process_return_player_data_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, sizeof(PlayerBB)); const PlayerBB* cmd = reinterpret_cast(data); @@ -1270,9 +1270,9 @@ void process_return_player_data_bb(shared_ptr s, shared_ptr } //////////////////////////////////////////////////////////////////////////////// -// Lobby commands +// Lobby commands -void process_change_arrow_color(shared_ptr s, shared_ptr c, +void process_change_arrow_color(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); @@ -1283,7 +1283,7 @@ void process_change_arrow_color(shared_ptr s, shared_ptr c, } } -void process_card_search(shared_ptr s, shared_ptr c, +void process_card_search(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 40 struct Cmd { uint32_t player_tag; @@ -1301,28 +1301,28 @@ void process_card_search(shared_ptr s, shared_ptr c, } //////////////////////////////////////////////////////////////////////////////// -// Info board commands +// Info board commands -void process_info_board_request(shared_ptr s, shared_ptr c, +void process_info_board_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // D8 check_size(size, 0); auto l = s->find_lobby(c->lobby_id); send_info_board(c, l); } -void process_write_info_board_pc_bb(shared_ptr s, shared_ptr c, +void process_write_info_board_pc_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // D9 check_size(size, 0, 2 * 0xAC); char16cpy(c->player.info_board, reinterpret_cast(data), 0xAC); } -void process_write_info_board_dc_gc(shared_ptr s, shared_ptr c, +void process_write_info_board_dc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // D9 check_size(size, 0, 0xAC); decode_sjis(c->player.info_board, reinterpret_cast(data), 0xAC); } -void process_set_auto_reply_pc_bb(shared_ptr s, shared_ptr c, +void process_set_auto_reply_pc_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0, 2 * 0xAC); if (size == 0) { @@ -1332,7 +1332,7 @@ void process_set_auto_reply_pc_bb(shared_ptr s, shared_ptr } } -void process_set_auto_reply_dc_gc(shared_ptr s, shared_ptr c, +void process_set_auto_reply_dc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0, 0xAC); if (size == 0) { @@ -1342,13 +1342,13 @@ void process_set_auto_reply_dc_gc(shared_ptr s, shared_ptr } } -void process_disable_auto_reply(shared_ptr s, shared_ptr c, +void process_disable_auto_reply(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); c->player.auto_reply[0] = 0; } -void process_set_blocked_list(shared_ptr s, shared_ptr c, +void process_set_blocked_list(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0x78); memcpy(c->player.blocked, data, 0x78); @@ -1357,7 +1357,7 @@ void process_set_blocked_list(shared_ptr s, shared_ptr c, //////////////////////////////////////////////////////////////////////////////// -// Game commands +// Game commands shared_ptr create_game_generic(shared_ptr s, shared_ptr c, const char16_t* name, const char16_t* password, @@ -1365,18 +1365,18 @@ shared_ptr create_game_generic(shared_ptr s, uint8_t solo) { static const uint32_t variation_maxes_online[3][0x20] = { - {1, 1, 1, 5, 1, 5, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 5, 1, 5, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 2, 3, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 3, 1, 3, 1, 3, - 2, 2, 1, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1}, + 2, 2, 1, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; static const uint32_t variation_maxes_solo[3][0x20] = { {1, 1, 1, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + 3, 2, 3, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 3, 1, 3, 1, 3, - 2, 2, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + 2, 2, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; @@ -1480,7 +1480,7 @@ shared_ptr create_game_generic(shared_ptr s, return game; } -void process_create_game_pc(shared_ptr s, shared_ptr c, +void process_create_game_pc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // C1 struct Cmd { uint32_t unused[2]; @@ -1502,7 +1502,7 @@ void process_create_game_pc(shared_ptr s, shared_ptr c, c->flags |= ClientFlag::Loading; } -void process_create_game_dc_gc(shared_ptr s, shared_ptr c, +void process_create_game_dc_gc(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // C1 struct Cmd { uint32_t unused[2]; @@ -1535,7 +1535,7 @@ void process_create_game_dc_gc(shared_ptr s, shared_ptr c, c->flags |= ClientFlag::Loading; } -void process_create_game_bb(shared_ptr s, shared_ptr c, +void process_create_game_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // C1 struct Cmd { uint32_t unused[2]; @@ -1562,7 +1562,7 @@ void process_create_game_bb(shared_ptr s, shared_ptr c, game->assign_item_ids_for_player(c->lobby_client_id, c->player.inventory); } -void process_lobby_name_request(shared_ptr s, shared_ptr c, +void process_lobby_name_request(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 8A check_size(size, 0); auto l = s->find_lobby(c->lobby_id); @@ -1572,7 +1572,7 @@ void process_lobby_name_request(shared_ptr s, shared_ptr c, send_lobby_name(c, l->name); } -void process_client_ready(shared_ptr s, shared_ptr c, +void process_client_ready(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // 6F check_size(size, 0); @@ -1587,14 +1587,14 @@ void process_client_ready(shared_ptr s, shared_ptr c, send_resume_game(l, c); // tell the new player the time //send_server_time(c); - // get character info + // get character info //send_get_player_info(c); } //////////////////////////////////////////////////////////////////////////////// -// Team commands +// Team commands -void process_team_command_bb(shared_ptr s, shared_ptr c, +void process_team_command_bb(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { // EA if (command == 0x01EA) { @@ -1605,15 +1605,15 @@ void process_team_command_bb(shared_ptr s, shared_ptr c, } //////////////////////////////////////////////////////////////////////////////// -// Patch server commands +// Patch server commands -void process_encryption_ok_patch(shared_ptr s, shared_ptr c, +void process_encryption_ok_patch(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { check_size(size, 0); send_command(c, 0x04); // this requests the user's login information } -void process_login_patch(shared_ptr s, shared_ptr c, +void process_login_patch(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data) { struct Cmd { uint32_t unused[3]; @@ -1665,7 +1665,7 @@ void process_unimplemented_command(shared_ptr s, shared_ptr -typedef void (*process_command_t)(shared_ptr s, shared_ptr c, +typedef void (*process_command_t)(shared_ptr s, shared_ptr c, uint16_t command, uint32_t flag, uint16_t size, const void* data); // The entries in these arrays correspond to the ID of the command received. For @@ -1673,10 +1673,10 @@ typedef void (*process_command_t)(shared_ptr s, shared_ptr // array corresponding to the client's version is called. static process_command_t dc_handlers[0x100] = { // 00 - NULL, NULL, NULL, NULL, - NULL, process_ignored_command, process_chat_dc_gc, NULL, - process_game_list_request, process_menu_item_info_request, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, process_ignored_command, process_chat_dc_gc, NULL, + process_game_list_request, process_menu_item_info_request, NULL, NULL, + NULL, NULL, NULL, NULL, // 10 process_menu_selection, NULL, NULL, process_ignored_command, @@ -1780,73 +1780,73 @@ static process_command_t pc_handlers[0x100] = { process_menu_selection, NULL, NULL, process_ignored_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, process_ignored_command, NULL, NULL, + NULL, process_ignored_command, NULL, NULL, // 20 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 30 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 40 process_card_search, NULL, NULL, NULL, process_ignored_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 50 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 60 process_game_command, process_player_data, process_game_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - process_game_command, process_game_command, NULL, process_client_ready, + process_game_command, process_game_command, NULL, process_client_ready, // 70 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 80 NULL, NULL, NULL, NULL, process_change_lobby, NULL, NULL, NULL, NULL, process_change_arrow_color, process_lobby_name_request, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 90 NULL, NULL, NULL, NULL, NULL, NULL, process_client_checksum, NULL, process_player_data, process_ignored_command, process_login_a_dc_pc_gc, NULL, - process_login_c_dc_pc_gc, process_login_d_e_pc_gc, process_login_d_e_pc_gc, NULL, + process_login_c_dc_pc_gc, process_login_d_e_pc_gc, process_login_d_e_pc_gc, NULL, // A0 process_change_ship, process_change_block, process_quest_list_request, NULL, NULL, NULL, NULL, NULL, NULL, process_ignored_command, NULL, NULL, - process_quest_ready, NULL, NULL, NULL, + process_quest_ready, NULL, NULL, NULL, // B0 NULL, process_server_time_request, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // C0 NULL, process_create_game_pc, NULL, NULL, NULL, NULL, process_set_blocked_list, process_set_auto_reply_pc_bb, process_disable_auto_reply, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // D0 NULL, NULL, NULL, NULL, @@ -1970,91 +1970,91 @@ static process_command_t bb_handlers[0x100] = { NULL, NULL, NULL, NULL, NULL, process_ignored_command, process_chat_pc_bb, NULL, process_game_list_request, process_menu_item_info_request, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 10 process_menu_selection, NULL, NULL, process_ignored_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, process_ignored_command, NULL, NULL, + NULL, process_ignored_command, NULL, NULL, // 20 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 30 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 40 process_card_search, NULL, NULL, NULL, process_ignored_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 50 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 60 process_game_command, process_player_data, process_game_command, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - process_game_command, process_game_command, NULL, process_client_ready, + process_game_command, process_game_command, NULL, process_client_ready, // 70 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 80 NULL, NULL, NULL, NULL, process_change_lobby, NULL, NULL, NULL, NULL, process_change_arrow_color, process_lobby_name_request, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // 90 NULL, NULL, NULL, process_login_bb, NULL, NULL, NULL, NULL, process_player_data, process_ignored_command, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // A0 process_change_ship, process_change_block, process_quest_list_request, NULL, NULL, NULL, NULL, NULL, NULL, process_ignored_command, NULL, NULL, - process_quest_ready, NULL, NULL, NULL, + process_quest_ready, NULL, NULL, NULL, // B0 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // C0 NULL, process_create_game_bb, NULL, NULL, NULL, NULL, process_set_blocked_list, process_set_auto_reply_pc_bb, process_disable_auto_reply, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, // D0 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, process_info_board_request, process_write_info_board_pc_bb, NULL, NULL, - process_guild_card_data_request_bb, NULL, NULL, NULL, + process_guild_card_data_request_bb, NULL, NULL, NULL, // E0 process_key_config_request_bb, NULL, NULL, process_player_preview_request_bb, NULL, process_create_character_bb, NULL, process_return_player_data_bb, process_client_checksum_bb, NULL, process_team_command_bb, process_stream_file_request_bb, - process_ignored_command, process_change_account_data_bb, NULL, NULL, + process_ignored_command, process_change_account_data_bb, NULL, NULL, // F0 NULL, NULL, NULL, NULL, @@ -2071,35 +2071,35 @@ static process_command_t patch_handlers[0x100] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 10 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 20 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 30 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 40 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 50 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 60 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 70 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 80 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 90 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // A0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // B0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // C0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // D0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // E0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // F0 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; static process_command_t* handlers[6] = { diff --git a/ReceiveSubcommands.cc b/ReceiveSubcommands.cc index 14e23b20..1216c2c2 100644 --- a/ReceiveSubcommands.cc +++ b/ReceiveSubcommands.cc @@ -75,7 +75,7 @@ void forward_subcommand(shared_ptr l, shared_ptr c, //////////////////////////////////////////////////////////////////////////////// -// Chat commands and the like +// Chat commands and the like // client requests to send a guild card static void process_subcommand_send_guild_card(shared_ptr s, @@ -179,7 +179,7 @@ static void process_subcommand_use_technique(shared_ptr s, } //////////////////////////////////////////////////////////////////////////////// -// BB Item commands +// BB Item commands // player drops an item static void process_subcommand_drop_item(shared_ptr s, @@ -193,7 +193,7 @@ static void process_subcommand_drop_item(shared_ptr s, uint8_t size; uint8_t client_id; uint8_t unused; - uint16_t unused2; // should be 1 + uint16_t unused2; // should be 1 uint16_t area; uint32_t item_id; float x; @@ -394,7 +394,7 @@ static void process_subcommand_bank_action(shared_ptr s, } c->player.bank.meseta -= cmd->meseta_amount; c->player.disp.meseta += cmd->meseta_amount; - } else { // item + } else { // item PlayerBankItem bank_item; c->player.bank.remove_item(cmd->item_id, cmd->item_amount, &bank_item); PlayerInventoryItem item = bank_item.to_inventory_item(); @@ -446,7 +446,7 @@ static void process_subcommand_sort_inventory(shared_ptr s, } //////////////////////////////////////////////////////////////////////////////// -// BB EXP/Drop Item commands +// BB EXP/Drop Item commands // enemy killed; leader sends drop item request static void process_subcommand_enemy_drop_item(shared_ptr s, @@ -655,15 +655,15 @@ static void process_subcommand_monster_killed(shared_ptr s, enemy.hit_flags |= 0x80; for (size_t x = 0; x < l->max_clients; x++) { if (!((enemy.hit_flags >> x) & 1)) { - continue; // player did not hit this enemy + continue; // player did not hit this enemy } auto other_c = l->clients[x]; if (!other_c) { - continue; // no player + continue; // no player } if (other_c->player.disp.level >= 199) { - continue; // player is level 200 or higher + continue; // player is level 200 or higher } // killer gets full experience, others get 77% diff --git a/SendCommands.cc b/SendCommands.cc index 55f45510..2b8cf9b5 100644 --- a/SendCommands.cc +++ b/SendCommands.cc @@ -20,7 +20,7 @@ static FileContentsCache file_cache; -void send_command(shared_ptr c, uint16_t command, uint32_t flag, +void send_command(shared_ptr c, uint16_t command, uint32_t flag, const void* data, size_t size) { string send_data; @@ -85,7 +85,7 @@ void send_command_excluding_client(shared_ptr l, shared_ptr c, } } -void send_command(shared_ptr l, uint16_t command, uint32_t flag, +void send_command(shared_ptr l, uint16_t command, uint32_t flag, const void* data, size_t size) { send_command_excluding_client(l, NULL, command, flag, data, size); } @@ -102,7 +102,7 @@ void send_command(shared_ptr s, uint16_t command, uint32_t flag, // specific command sending functions follow. in general, they're written in // such a way that you don't need to think about anything, even the client's // version, before calling them. for this reason, some of them are quite -// complex. many are split into several functions, one for each version of PSO, +// complex. many are split into several functions, one for each version of PSO, // named with suffixes _GC, _BB, and the like. in these cases, the function // without the suffix simply calls the appropriate function for the client's // version. thus, if you change something in one of the version-specific @@ -275,10 +275,10 @@ void send_pc_gc_split_reconnect(shared_ptr c, uint32_t address, // number and security data void send_client_init_bb(shared_ptr c, uint32_t error) { struct { - uint32_t error; // see below + uint32_t error; // see below uint32_t player_tag; uint32_t serial_number; - uint32_t team_id; // just randomize it; teams aren't supported + uint32_t team_id; // just randomize it; teams aren't supported ClientConfigBB cfg; uint32_t caps; // should be 0x00000102 } cmd = { @@ -332,8 +332,8 @@ void send_guild_card_header_bb(shared_ptr c) { uint32_t checksum = compute_guild_card_checksum(&c->player.guild_cards, sizeof(GuildCardFileBB)); struct { - uint32_t unknown; // should be 1 - uint32_t filesize; // 0x0000490 + uint32_t unknown; // should be 1 + uint32_t filesize; // 0x0000490 uint32_t checksum; } cmd = {1, 0x490, checksum}; send_command(c, 0x01DC, 0x00000000, cmd); @@ -436,7 +436,7 @@ void send_complete_player_bb(shared_ptr c) { //////////////////////////////////////////////////////////////////////////////// -// patch functions +// patch functions void send_check_directory_patch(shared_ptr c, const char* dir) { char data[0x40]; @@ -829,7 +829,7 @@ static void send_menu_pc_bb(shared_ptr c, const char16_t* menu_name, struct Entry { uint32_t menu_id; uint32_t item_id; - uint16_t flags; // should be 0x0F04 + uint16_t flags; // should be 0x0F04 char16_t text[17]; }; @@ -871,7 +871,7 @@ static void send_menu_dc_gc(shared_ptr c, const char16_t* menu_name, struct Entry { uint32_t menu_id; uint32_t item_id; - uint16_t flags; // should be 0x0F04 + uint16_t flags; // should be 0x0F04 char text[18]; }; @@ -1249,7 +1249,7 @@ void send_lobby_list(shared_ptr c, shared_ptr s) { struct Entry { uint32_t menu_id; uint32_t item_id; - uint32_t unused; // should be 0x00000000 + uint32_t unused; // should be 0x00000000 }; vector entries; @@ -1340,7 +1340,7 @@ static void send_join_game_gc(shared_ptr c, shared_ptr l) { uint8_t section_id; uint8_t challenge_mode; uint32_t rare_seed; - uint32_t episode; // for PSOPC, this must be 0x00000100 + uint32_t episode; // for PSOPC, this must be 0x00000100 struct { PlayerInventory inventory; PlayerDispDataPCGC disp; @@ -1761,7 +1761,7 @@ void send_resume_game(shared_ptr l, shared_ptr ready_client) { //////////////////////////////////////////////////////////////////////////////// -// Game/cheat commands +// Game/cheat commands // sends an HP/TP/Meseta modifying command (see flag definitions in command-functions.h) void send_player_stats_change(shared_ptr l, shared_ptr c, @@ -1809,7 +1809,7 @@ void send_warp(shared_ptr c, uint32_t area) { //////////////////////////////////////////////////////////////////////////////// -// BB game commands +// BB game commands // notifies other players of a dropped item from a box or enemy void send_drop_item(shared_ptr l, const ItemData& item, @@ -1949,7 +1949,7 @@ void send_give_experience(shared_ptr l, shared_ptr c, //////////////////////////////////////////////////////////////////////////////// -// ep3 only commands +// ep3 only commands // sends the (PRS-compressed) card list to the client void send_ep3_card_list_update(shared_ptr c) {