make chat filter also apply to info board on proxy server
This commit is contained in:
+24
-18
@@ -989,18 +989,20 @@ static HandlerResult S_6x(shared_ptr<ServerState>,
|
|||||||
|
|
||||||
static HandlerResult C_GXB_61(shared_ptr<ServerState>,
|
static HandlerResult C_GXB_61(shared_ptr<ServerState>,
|
||||||
ProxyServer::LinkedSession& session, uint16_t, uint32_t flag, string& data) {
|
ProxyServer::LinkedSession& session, uint16_t, uint32_t flag, string& data) {
|
||||||
if (session.version == GameVersion::BB) {
|
if (session.options.enable_chat_filter) {
|
||||||
auto& pd = check_size_t<PSOPlayerDataBB>(data, sizeof(PSOPlayerDataBB), 0xFFFF);
|
if (session.version == GameVersion::BB) {
|
||||||
add_color_inplace(pd.info_board.data(), pd.info_board.size());
|
auto& pd = check_size_t<PSOPlayerDataBB>(data, sizeof(PSOPlayerDataBB), 0xFFFF);
|
||||||
|
add_color_inplace(pd.info_board.data(), pd.info_board.size());
|
||||||
|
|
||||||
} else {
|
|
||||||
PSOPlayerDataV3* pd;
|
|
||||||
if (flag == 4) { // Episode 3
|
|
||||||
pd = reinterpret_cast<PSOPlayerDataV3*>(&check_size_t<PSOPlayerDataGCEp3>(data));
|
|
||||||
} else {
|
} else {
|
||||||
pd = &check_size_t<PSOPlayerDataV3>(data, sizeof(PSOPlayerDataV3), 0xFFFF);
|
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);
|
||||||
|
}
|
||||||
|
add_color_inplace(pd->info_board.data(), pd->info_board.size());
|
||||||
}
|
}
|
||||||
add_color_inplace(pd->info_board.data(), pd->info_board.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We should check if the info board text was actually modified and
|
// TODO: We should check if the info board text was actually modified and
|
||||||
@@ -1009,19 +1011,23 @@ static HandlerResult C_GXB_61(shared_ptr<ServerState>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static HandlerResult C_GX_D9(shared_ptr<ServerState>,
|
static HandlerResult C_GX_D9(shared_ptr<ServerState>,
|
||||||
ProxyServer::LinkedSession&, uint16_t, uint32_t, string& data) {
|
ProxyServer::LinkedSession& session, uint16_t, uint32_t, string& data) {
|
||||||
add_color_inplace(data.data(), data.size());
|
if (session.options.enable_chat_filter) {
|
||||||
// TODO: We should check if the info board text was actually modified and
|
add_color_inplace(data.data(), data.size());
|
||||||
// return MODIFIED if so.
|
// TODO: We should check if the info board text was actually modified and
|
||||||
|
// return MODIFIED if so.
|
||||||
|
}
|
||||||
return HandlerResult::Type::FORWARD;
|
return HandlerResult::Type::FORWARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HandlerResult C_B_D9(shared_ptr<ServerState>,
|
static HandlerResult C_B_D9(shared_ptr<ServerState>,
|
||||||
ProxyServer::LinkedSession&, uint16_t, uint32_t, string& data) {
|
ProxyServer::LinkedSession& session, uint16_t, uint32_t, string& data) {
|
||||||
char16_t* text = reinterpret_cast<char16_t*>(data.data());
|
if (session.options.enable_chat_filter) {
|
||||||
add_color_inplace(text, data.size() / sizeof(char16_t));
|
char16_t* text = reinterpret_cast<char16_t*>(data.data());
|
||||||
// TODO: We should check if the info board text was actually modified and
|
add_color_inplace(text, data.size() / sizeof(char16_t));
|
||||||
// return HandlerResult::MODIFIED if so.
|
// TODO: We should check if the info board text was actually modified and
|
||||||
|
// return HandlerResult::MODIFIED if so.
|
||||||
|
}
|
||||||
return HandlerResult::Type::FORWARD;
|
return HandlerResult::Type::FORWARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ vector<MenuItem> quest_download_menu({
|
|||||||
static const unordered_map<uint32_t, const char16_t*> proxy_options_menu_descriptions({
|
static const unordered_map<uint32_t, const char16_t*> proxy_options_menu_descriptions({
|
||||||
{ProxyOptionsMenuItemID::GO_BACK, u"Return to the\nproxy menu"},
|
{ProxyOptionsMenuItemID::GO_BACK, u"Return to the\nproxy menu"},
|
||||||
{ProxyOptionsMenuItemID::CHAT_COMMANDS, u"Enable chat\ncommands"},
|
{ProxyOptionsMenuItemID::CHAT_COMMANDS, u"Enable chat\ncommands"},
|
||||||
{ProxyOptionsMenuItemID::CHAT_FILTER, u"Enable escape\nsequences in\nchat messages"},
|
{ProxyOptionsMenuItemID::CHAT_FILTER, u"Enable escape\nsequences in\nchat messages\nand info board"},
|
||||||
{ProxyOptionsMenuItemID::INFINITE_HP, u"Enable automatic HP\nrestoration when\nyou are hit by an\nenemy or trap\n\nCannot revive you\nfrom one-hit kills"},
|
{ProxyOptionsMenuItemID::INFINITE_HP, u"Enable automatic HP\nrestoration when\nyou are hit by an\nenemy or trap\n\nCannot revive you\nfrom one-hit kills"},
|
||||||
{ProxyOptionsMenuItemID::INFINITE_TP, u"Enable automatic TP\nrestoration when\nyou cast any\ntechnique"},
|
{ProxyOptionsMenuItemID::INFINITE_TP, u"Enable automatic TP\nrestoration when\nyou cast any\ntechnique"},
|
||||||
{ProxyOptionsMenuItemID::SWITCH_ASSIST, u"Automatically try\nto unlock 2-player\ndoors when you step\non both switches\nsequentially"},
|
{ProxyOptionsMenuItemID::SWITCH_ASSIST, u"Automatically try\nto unlock 2-player\ndoors when you step\non both switches\nsequentially"},
|
||||||
|
|||||||
Reference in New Issue
Block a user