remove unneeded template parameter
This commit is contained in:
@@ -1124,7 +1124,7 @@ struct C_OpenFileConfirmation_44_A6 {
|
|||||||
// command number RcvStartGame2 might have been.
|
// command number RcvStartGame2 might have been.
|
||||||
|
|
||||||
// Header flag = entry count
|
// Header flag = entry count
|
||||||
template <typename LobbyDataT, typename DispDataT>
|
template <typename LobbyDataT>
|
||||||
struct S_JoinGame {
|
struct S_JoinGame {
|
||||||
// Note: It seems Sega servers sent uninitialized memory in the variations
|
// Note: It seems Sega servers sent uninitialized memory in the variations
|
||||||
// field when sending this command to start an Episode 3 tournament game. This
|
// field when sending this command to start an Episode 3 tournament game. This
|
||||||
@@ -1164,9 +1164,9 @@ struct S_JoinGame_DCNTE_64 {
|
|||||||
parray<PlayerLobbyDataDCGC, 4> lobby_data;
|
parray<PlayerLobbyDataDCGC, 4> lobby_data;
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
struct S_JoinGame_PC_64 : S_JoinGame<PlayerLobbyDataPC, PlayerDispDataDCPCV3> {
|
struct S_JoinGame_PC_64 : S_JoinGame<PlayerLobbyDataPC> {
|
||||||
} __packed__;
|
} __packed__;
|
||||||
struct S_JoinGame_DC_GC_64 : S_JoinGame<PlayerLobbyDataDCGC, PlayerDispDataDCPCV3> {
|
struct S_JoinGame_DC_GC_64 : S_JoinGame<PlayerLobbyDataDCGC> {
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
struct S_JoinGame_GC_Ep3_64 : S_JoinGame_DC_GC_64 {
|
struct S_JoinGame_GC_Ep3_64 : S_JoinGame_DC_GC_64 {
|
||||||
@@ -1179,11 +1179,11 @@ struct S_JoinGame_GC_Ep3_64 : S_JoinGame_DC_GC_64 {
|
|||||||
} __packed__ players_ep3[4];
|
} __packed__ players_ep3[4];
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
struct S_JoinGame_XB_64 : S_JoinGame<PlayerLobbyDataXB, PlayerDispDataDCPCV3> {
|
struct S_JoinGame_XB_64 : S_JoinGame<PlayerLobbyDataXB> {
|
||||||
parray<le_uint32_t, 6> unknown_a1;
|
parray<le_uint32_t, 6> unknown_a1;
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
struct S_JoinGame_BB_64 : S_JoinGame<PlayerLobbyDataBB, PlayerDispDataBB> {
|
struct S_JoinGame_BB_64 : S_JoinGame<PlayerLobbyDataBB> {
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
// 65 (S->C): Add player to game
|
// 65 (S->C): Add player to game
|
||||||
|
|||||||
+8
-8
@@ -1459,7 +1459,7 @@ static void send_join_spectator_team(shared_ptr<Client> c, shared_ptr<Lobby> l)
|
|||||||
send_command_t(c, 0xE8, player_count, cmd);
|
send_command_t(c, 0xE8, player_count, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LobbyDataT, typename DispDataT>
|
template <typename LobbyDataT>
|
||||||
void send_join_game_t(shared_ptr<Client> c, shared_ptr<Lobby> l) {
|
void send_join_game_t(shared_ptr<Client> c, shared_ptr<Lobby> l) {
|
||||||
if (l->flags & Lobby::Flag::IS_SPECTATOR_TEAM) {
|
if (l->flags & Lobby::Flag::IS_SPECTATOR_TEAM) {
|
||||||
send_join_spectator_team(c, l);
|
send_join_spectator_team(c, l);
|
||||||
@@ -1467,17 +1467,17 @@ void send_join_game_t(shared_ptr<Client> c, shared_ptr<Lobby> l) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_ep3 = l->is_ep3();
|
bool is_ep3 = l->is_ep3();
|
||||||
string data(is_ep3 ? sizeof(S_JoinGame_GC_Ep3_64) : sizeof(S_JoinGame<LobbyDataT, DispDataT>), '\0');
|
string data(is_ep3 ? sizeof(S_JoinGame_GC_Ep3_64) : sizeof(S_JoinGame<LobbyDataT>), '\0');
|
||||||
|
|
||||||
// TODO: This is a terrible way to handle the different Ep3 format within the
|
// TODO: This is a terrible way to handle the different Ep3 format within the
|
||||||
// template. Find a way to make this cleaner.
|
// template. Find a way to make this cleaner.
|
||||||
auto* cmd = reinterpret_cast<S_JoinGame<LobbyDataT, DispDataT>*>(data.data());
|
auto* cmd = reinterpret_cast<S_JoinGame<LobbyDataT>*>(data.data());
|
||||||
S_JoinGame_GC_Ep3_64* cmd_ep3 = nullptr;
|
S_JoinGame_GC_Ep3_64* cmd_ep3 = nullptr;
|
||||||
if (is_ep3) {
|
if (is_ep3) {
|
||||||
cmd_ep3 = reinterpret_cast<S_JoinGame_GC_Ep3_64*>(data.data());
|
cmd_ep3 = reinterpret_cast<S_JoinGame_GC_Ep3_64*>(data.data());
|
||||||
new (cmd_ep3) S_JoinGame_GC_Ep3_64();
|
new (cmd_ep3) S_JoinGame_GC_Ep3_64();
|
||||||
} else {
|
} else {
|
||||||
new (cmd) S_JoinGame<LobbyDataT, DispDataT>();
|
new (cmd) S_JoinGame<LobbyDataT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->variations = l->variations;
|
cmd->variations = l->variations;
|
||||||
@@ -1687,7 +1687,7 @@ void send_join_lobby(shared_ptr<Client> c, shared_ptr<Lobby> l) {
|
|||||||
if (l->is_game()) {
|
if (l->is_game()) {
|
||||||
switch (c->version()) {
|
switch (c->version()) {
|
||||||
case GameVersion::PC:
|
case GameVersion::PC:
|
||||||
send_join_game_t<PlayerLobbyDataPC, PlayerDispDataDCPCV3>(c, l);
|
send_join_game_t<PlayerLobbyDataPC>(c, l);
|
||||||
break;
|
break;
|
||||||
case GameVersion::DC:
|
case GameVersion::DC:
|
||||||
if (c->flags & (Client::Flag::IS_TRIAL_EDITION | Client::Flag::IS_DC_V1_PROTOTYPE)) {
|
if (c->flags & (Client::Flag::IS_TRIAL_EDITION | Client::Flag::IS_DC_V1_PROTOTYPE)) {
|
||||||
@@ -1696,13 +1696,13 @@ void send_join_lobby(shared_ptr<Client> c, shared_ptr<Lobby> l) {
|
|||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case GameVersion::GC:
|
case GameVersion::GC:
|
||||||
send_join_game_t<PlayerLobbyDataDCGC, PlayerDispDataDCPCV3>(c, l);
|
send_join_game_t<PlayerLobbyDataDCGC>(c, l);
|
||||||
break;
|
break;
|
||||||
case GameVersion::XB:
|
case GameVersion::XB:
|
||||||
send_join_game_t<PlayerLobbyDataXB, PlayerDispDataDCPCV3>(c, l);
|
send_join_game_t<PlayerLobbyDataXB>(c, l);
|
||||||
break;
|
break;
|
||||||
case GameVersion::BB:
|
case GameVersion::BB:
|
||||||
send_join_game_t<PlayerLobbyDataBB, PlayerDispDataBB>(c, l);
|
send_join_game_t<PlayerLobbyDataBB>(c, l);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw logic_error("unimplemented versioned command");
|
throw logic_error("unimplemented versioned command");
|
||||||
|
|||||||
Reference in New Issue
Block a user