fix all trailing whitespace

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