Restore GC EXP direct menu patches

This commit is contained in:
2026-05-21 03:43:48 -04:00
parent 7c7ecf0383
commit 6b3669dfd6
15 changed files with 17 additions and 3744 deletions
-2
View File
@@ -148,8 +148,6 @@ public:
// Basic state
uint64_t enabled_flags = DEFAULT_FLAGS; // Client::Flag enum
std::string last_psopeeps_gc_exp_key;
void* last_psopeeps_gc_exp_lobby = nullptr;
uint32_t specific_version = 0;
uint8_t override_section_id = 0xFF; // FF = no override
uint8_t override_lobby_event = 0xFF; // FF = no override
+3 -67
View File
@@ -34,66 +34,6 @@ const char* QUEST_BARRIER_DISCONNECT_HOOK_NAME = "quest_barrier";
const char* ADD_NEXT_CLIENT_DISCONNECT_HOOK_NAME = "add_next_game_client";
static asio::awaitable<void> dispatch_gc_v3_exp_patch_for_lobby(shared_ptr<Client> c, shared_ptr<Lobby> l) {
if (c->version() != Version::GC_V3) {
co_return;
}
if (!c->check_flag(Client::Flag::HAS_SEND_FUNCTION_CALL)) {
co_return;
}
if (!c->login || !c->login->account) {
co_return;
}
if (!c->login->account->auto_patches_enabled.count("PsoPeepsGCEXP_enabled")) {
co_return;
}
if (!l || !l->is_game()) {
co_return;
}
const char* episode_str = nullptr;
switch (l->episode) {
case Episode::EP1:
episode_str = "ep1";
break;
case Episode::EP2:
episode_str = "ep2";
break;
default:
co_return;
}
auto server_state = c->require_server_state();
string key = "PsoPeepsGCEXP_internal_";
key += std::to_string(server_state->psopeeps_gc_exp_multiplier);
key += "x_";
key += episode_str;
void* lobby_token = l.get();
if ((c->last_psopeeps_gc_exp_lobby == lobby_token) &&
(c->last_psopeeps_gc_exp_key == key)) {
co_return;
}
try {
co_await prepare_client_for_patches(c);
if (!c->channel->connected()) {
co_return;
}
auto fn = server_state->client_functions->get(key, c->specific_version);
co_await send_function_call(c, fn);
c->last_psopeeps_gc_exp_lobby = lobby_token;
c->last_psopeeps_gc_exp_key = key;
} catch (const out_of_range&) {
c->log.warning_f("GC V3 EXP dispatcher could not find client function {}", key);
}
}
static string bb_test_taint_filename(shared_ptr<Client> c) {
return c->character_filename() + ".test-tainted";
}
@@ -3215,16 +3155,15 @@ static asio::awaitable<void> on_10_proxy_destinations(shared_ptr<Client> c, uint
}
}
static asio::awaitable<void> on_10_game_menu(shared_ptr<Client> c, uint32_t item_id, const std::string& password) {
static void on_10_game_menu(shared_ptr<Client> c, uint32_t item_id, const std::string& password) {
auto s = c->require_server_state();
auto game = s->find_lobby(item_id);
if (!game) {
send_lobby_message_box(c, "$C7You cannot join this\ngame because it no\nlonger exists.");
co_return;
return;
}
switch (game->join_error_for_client(c, &password)) {
case Lobby::JoinError::ALLOWED:
co_await dispatch_gc_v3_exp_patch_for_lobby(c, game);
if (!s->change_client_lobby(c, game)) {
throw logic_error("client cannot join game after all preconditions satisfied");
}
@@ -3539,7 +3478,7 @@ static asio::awaitable<void> on_10(shared_ptr<Client> c, Channel::Message& msg)
co_await on_10_proxy_destinations(c, base_cmd.item_id);
break;
case MenuID::GAME:
co_await on_10_game_menu(c, base_cmd.item_id, std::move(password));
on_10_game_menu(c, base_cmd.item_id, std::move(password));
break;
case MenuID::QUEST_CATEGORIES_EP1_EP3_EP4:
case MenuID::QUEST_CATEGORIES_EP2:
@@ -5352,7 +5291,6 @@ static asio::awaitable<void> on_C1_PC(shared_ptr<Client> c, Channel::Message& ms
}
auto game = create_game_generic(s, c, cmd.name.decode(c->language()), cmd.password.decode(c->language()), Episode::EP1, mode, cmd.difficulty, true);
if (game) {
co_await dispatch_gc_v3_exp_patch_for_lobby(c, game);
s->change_client_lobby(c, game);
c->set_flag(Client::Flag::LOADING);
c->log.info_f("LOADING flag set");
@@ -5435,7 +5373,6 @@ static asio::awaitable<void> on_0C_C1_E7_EC(shared_ptr<Client> c, Channel::Messa
}
if (game) {
co_await dispatch_gc_v3_exp_patch_for_lobby(c, game);
s->change_client_lobby(c, game);
c->set_flag(Client::Flag::LOADING);
c->log.info_f("LOADING flag set");
@@ -5492,7 +5429,6 @@ static asio::awaitable<void> on_C1_BB(shared_ptr<Client> c, Channel::Message& ms
auto game = create_game_generic(s, c, cmd.name.decode(c->language()), cmd.password.decode(c->language()), episode, mode, cmd.difficulty);
if (game) {
co_await dispatch_gc_v3_exp_patch_for_lobby(c, game);
s->change_client_lobby(c, game);
c->set_flag(Client::Flag::LOADING);
c->log.info_f("LOADING flag set");
-4
View File
@@ -883,10 +883,6 @@ void ServerState::load_config_early() {
throw runtime_error("PsoPeepsDCV2EXPMultiplier must be 5 or 10");
}
this->psopeeps_gc_exp_multiplier = this->config_json->get_int("PsoPeepsGCEXPMultiplier", 5);
if ((this->psopeeps_gc_exp_multiplier != 5) && (this->psopeeps_gc_exp_multiplier != 10)) {
throw runtime_error("PsoPeepsGCEXPMultiplier must be 5 or 10");
}
this->ip_stack_debug = this->config_json->get_bool("IPStackDebug", false);
this->allow_unregistered_users = this->config_json->get_bool("AllowUnregisteredUsers", false);
-1
View File
@@ -124,7 +124,6 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
uint64_t client_idle_timeout_usecs = 60000000;
uint64_t patch_client_idle_timeout_usecs = 300000000;
uint64_t psopeeps_dcv2_exp_multiplier = 5;
uint64_t psopeeps_gc_exp_multiplier = 5;
bool is_debug = false;
bool ip_stack_debug = false;
bool allow_unregistered_users = false;