use flag to separate customized GC clients from non-customized

This commit is contained in:
Martin Michelsen
2024-04-27 14:25:46 -07:00
parent f5c2c930d8
commit c7dd98ccc0
6 changed files with 15 additions and 2 deletions
+3 -1
View File
@@ -108,9 +108,11 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
this->set_flag(Flag::ENCRYPTED_SEND_FUNCTION_CALL);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
break;
case 0x3A: // GC Ep1&2 US v1.2 (Plus) GMK edition
this->set_flag(Flag::IS_CLIENT_CUSTOMIZATION);
[[fallthrough]];
case 0x36: // GC Ep1&2 US v1.2 (Plus)
case 0x39: // GC Ep1&2 JP v1.5 (Plus)
case 0x3A: // GC Ep1&2 US v1.2 (Plus) GMK edition
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::NO_SEND_FUNCTION_CALL);
break;
+1
View File
@@ -69,6 +69,7 @@ public:
SHOULD_SEND_ARTIFICIAL_FLAG_STATE = 0x0002000000000000, // Server-side only
SHOULD_SEND_ENABLE_SAVE = 0x0004000000000000,
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
IS_CLIENT_CUSTOMIZATION = 0x0100000000000000,
// Cheat mode and option flags
INFINITE_HP_ENABLED = 0x0000000200000000,
+6 -1
View File
@@ -792,7 +792,8 @@ Lobby::JoinError Lobby::join_error_for_client(std::shared_ptr<Client> c, const s
if (this->count_clients() >= this->max_clients) {
return JoinError::FULL;
}
if (!this->version_is_allowed(c->version()) && !c->config.check_flag(Client::Flag::DEBUG_ENABLED)) {
bool debug_enabled = c->config.check_flag(Client::Flag::DEBUG_ENABLED);
if (!this->version_is_allowed(c->version()) && !debug_enabled) {
return JoinError::VERSION_CONFLICT;
}
if (this->is_game()) {
@@ -805,6 +806,10 @@ Lobby::JoinError Lobby::join_error_for_client(std::shared_ptr<Client> c, const s
if (this->mode == GameMode::SOLO) {
return JoinError::SOLO;
}
if (!debug_enabled &&
(this->check_flag(Flag::IS_CLIENT_CUSTOMIZATION) != c->config.check_flag(Client::Flag::IS_CLIENT_CUSTOMIZATION))) {
return JoinError::VERSION_CONFLICT;
}
if (!c->login->account->check_flag(Account::Flag::FREE_JOIN_GAMES)) {
if (password && !this->password.empty() && (*password != this->password)) {
return JoinError::INCORRECT_PASSWORD;
+1
View File
@@ -70,6 +70,7 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
QUEST_IN_PROGRESS = 0x00000200,
BATTLE_IN_PROGRESS = 0x00000400,
JOINABLE_QUEST_IN_PROGRESS = 0x00000800,
IS_CLIENT_CUSTOMIZATION = 0x00001000,
IS_SPECTATOR_TEAM = 0x00002000, // episode must be EP3 also
SPECTATORS_FORBIDDEN = 0x00004000,
START_BATTLE_PLAYER_IMMEDIATELY = 0x00008000,
+3
View File
@@ -4149,6 +4149,9 @@ shared_ptr<Lobby> create_game_generic(
default:
throw logic_error("invalid quest script version");
}
if (c->config.check_flag(Client::Flag::IS_CLIENT_CUSTOMIZATION)) {
game->set_flag(Lobby::Flag::IS_CLIENT_CUSTOMIZATION);
}
while (game->floor_item_managers.size() < 0x12) {
game->floor_item_managers.emplace_back(game->lobby_id, game->floor_item_managers.size());
+1
View File
@@ -1436,6 +1436,7 @@ void send_game_menu_t(
for (shared_ptr<Lobby> l : s->all_lobbies()) {
if (l->is_game() &&
(client_has_debug || l->version_is_allowed(c->version())) &&
(client_has_debug || (l->check_flag(Lobby::Flag::IS_CLIENT_CUSTOMIZATION) == c->config.check_flag(Client::Flag::IS_CLIENT_CUSTOMIZATION))) &&
(l->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM) == is_spectator_team_list) &&
(!show_tournaments_only || l->tournament_match)) {
games.emplace(l);