add name color proxy option

This commit is contained in:
Martin Michelsen
2023-02-10 10:48:02 -08:00
parent 649246cda2
commit 3bb061951d
4 changed files with 35 additions and 16 deletions
+1
View File
@@ -42,6 +42,7 @@ struct ClientOptions {
bool suppress_remote_login;
bool zero_remote_guild_card;
bool ep3_infinite_meseta;
bool red_name;
int64_t function_call_return_value; // -1 = don't block function calls
ClientOptions();
+4 -3
View File
@@ -66,9 +66,10 @@ namespace ProxyOptionsMenuItemID {
constexpr uint32_t BLOCK_EVENTS = 0xAA5555AA;
constexpr uint32_t BLOCK_PATCHES = 0xAA6666AA;
constexpr uint32_t SAVE_FILES = 0xAA7777AA;
constexpr uint32_t SUPPRESS_LOGIN = 0xAA8888AA;
constexpr uint32_t SKIP_CARD = 0xAA9999AA;
constexpr uint32_t EP3_INFINITE_MESETA = 0xAAAAAAAA;
constexpr uint32_t RED_NAME = 0xAA8888AA;
constexpr uint32_t SUPPRESS_LOGIN = 0xAA9999AA;
constexpr uint32_t SKIP_CARD = 0xAAAAAAAA;
constexpr uint32_t EP3_INFINITE_MESETA = 0xAABBBBAA;
}
+25 -13
View File
@@ -989,25 +989,37 @@ static HandlerResult S_6x(shared_ptr<ServerState>,
static HandlerResult C_GXB_61(shared_ptr<ServerState>,
ProxyServer::LinkedSession& session, uint16_t, uint32_t flag, string& data) {
if (session.options.enable_chat_filter) {
if (session.version == GameVersion::BB) {
auto& pd = check_size_t<PSOPlayerDataBB>(data, sizeof(PSOPlayerDataBB), 0xFFFF);
add_color_inplace(pd.info_board.data(), pd.info_board.size());
bool modified = false;
// TODO: We should check if the info board text was actually modified and
// return MODIFIED if so.
if (session.version == GameVersion::BB) {
auto& pd = check_size_t<PSOPlayerDataBB>(data, sizeof(PSOPlayerDataBB), 0xFFFF);
if (session.options.enable_chat_filter) {
add_color_inplace(pd.info_board.data(), pd.info_board.size());
}
if (session.options.red_name && pd.disp.name_color != 0xFFFF0000) {
pd.disp.name_color = 0xFFFF0000;
modified = true;
}
} else {
PSOPlayerDataV3* pd;
if (flag == 4) { // Episode 3
pd = reinterpret_cast<PSOPlayerDataV3*>(&check_size_t<PSOPlayerDataGCEp3>(data));
} else {
PSOPlayerDataV3* pd;
if (flag == 4) { // Episode 3
pd = reinterpret_cast<PSOPlayerDataV3*>(&check_size_t<PSOPlayerDataGCEp3>(data));
} else {
pd = &check_size_t<PSOPlayerDataV3>(data, sizeof(PSOPlayerDataV3), 0xFFFF);
}
pd = &check_size_t<PSOPlayerDataV3>(data, sizeof(PSOPlayerDataV3), 0xFFFF);
}
if (session.options.enable_chat_filter) {
add_color_inplace(pd->info_board.data(), pd->info_board.size());
}
if (session.options.red_name && pd->disp.name_color != 0xFFFF0000) {
pd->disp.name_color = 0xFFFF0000;
modified = true;
}
}
// TODO: We should check if the info board text was actually modified and
// return MODIFIED if so.
return HandlerResult::Type::FORWARD;
return modified ? HandlerResult::Type::MODIFIED : HandlerResult::Type::FORWARD;
}
static HandlerResult C_GX_D9(shared_ptr<ServerState>,
+5
View File
@@ -81,6 +81,7 @@ static const unordered_map<uint32_t, const char16_t*> proxy_options_menu_descrip
{ProxyOptionsMenuItemID::BLOCK_EVENTS, u"Disable seasonal\nevents in the lobby\nand in games"},
{ProxyOptionsMenuItemID::BLOCK_PATCHES, u"Disable patches sent\nby the remote server"},
{ProxyOptionsMenuItemID::SAVE_FILES, u"Save local copies of\nfiles from the\nremote server\n(quests, etc.)"},
{ProxyOptionsMenuItemID::RED_NAME, u"Set your name\ncolor to red"},
{ProxyOptionsMenuItemID::SUPPRESS_LOGIN, u"Use an alternate\nlogin sequence"},
{ProxyOptionsMenuItemID::SKIP_CARD, u"Use an alternate\nvalue for your initial\nGuild Card"},
});
@@ -116,6 +117,7 @@ static vector<MenuItem> proxy_options_menu_for_client(
add_option(ProxyOptionsMenuItemID::SAVE_FILES, c->options.save_files, u"Save files");
}
if (s->proxy_enable_login_options) {
add_option(ProxyOptionsMenuItemID::RED_NAME, c->options.red_name, u"Red name");
add_option(ProxyOptionsMenuItemID::SUPPRESS_LOGIN, c->options.suppress_remote_login, u"Skip login");
add_option(ProxyOptionsMenuItemID::SKIP_CARD, c->options.zero_remote_guild_card, u"Skip card");
}
@@ -1823,6 +1825,9 @@ static void on_10(shared_ptr<ServerState> s, shared_ptr<Client> c,
case ProxyOptionsMenuItemID::SAVE_FILES:
c->options.save_files = !c->options.save_files;
goto resend_proxy_options_menu;
case ProxyOptionsMenuItemID::RED_NAME:
c->options.red_name = !c->options.red_name;
goto resend_proxy_options_menu;
case ProxyOptionsMenuItemID::SUPPRESS_LOGIN:
c->options.suppress_remote_login = !c->options.suppress_remote_login;
goto resend_proxy_options_menu;