Switchbot gate: find the mt<date> mark anywhere in the client timestamp

Every locale.cfg client build is LOCALE_SERVICE_EUROPE and sends
CG_CLIENT_VERSION2, and 203 compares that timestamp with atoi against
1215955205. The client now sends "1215955205 mt20261016", so the gate
looks for "mt" instead of requiring it at the start. Found on channel5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 20:35:08 +09:00
co-authored by Claude Opus 5.5
parent a28393b16b
commit 972c200cd0
3 changed files with 10 additions and 7 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ Header numbers, subheaders and field order are AVA2's. The structs are `pack(1)`
CG is registered in `packet_info.cpp` with `Set(..., true)` and GG with `Set(..., false)`. The 40250 base packets are unchanged.
**Version gate.** The new client sends `mt20261016` as the `CG_CLIENT_VERSION` timestamp, in place of `__TIMESTAMP__`. Before `EnterGame` sends anything, it checks `SwitchbotHelper::IsClientSupported`, which requires `mt<date>` with date >= `PORT_SWITCHBOT_CLIENT_VERSION`. An older client gets no GC_SWITCHBOT packet. It can't fill the window either. The EU-branch client timestamp (`1215955205`) doesn't pass the gate.
**Version gate.** The client is built with `LOCALE_SERVICE_EUROPE`, so every locale sends `CG_CLIENT_VERSION2`. The new client's timestamp is `1215955205 mt20261016`. 203 is a europe locale and checks the version with `atoi`, which still reads 1215955205. Before `EnterGame` sends anything, it checks `SwitchbotHelper::IsClientSupported`, which looks for `mt<date>` in the timestamp with date >= `PORT_SWITCHBOT_CLIENT_VERSION`. An older client sends `1215955205` only and gets no GC_SWITCHBOT packet. It can't fill the window either. (The non-EU branch sends `mt20261016`.)
## Verification
@@ -60,4 +60,4 @@ CG is registered in `packet_info.cpp` with `Set(..., true)` and GG with `Set(...
- the version gate;
- that `/mt_switchbot` is gone.
- Client: `metin2-client/tests/wiki/test_switchbot.py` checks that the window script is AVA2 `uiswitchbot.py` verbatim, plus its glue.
- Not yet compiled on 203 and not deployed. The live 203 still runs v1, so the server and client must be deployed together.
- Compiled on 203 (dev tree) and run on channel5. Not deployed. The live 203 still runs v1, so the server and client must be deployed together.
+5 -4
View File
@@ -12,8 +12,9 @@
// "switchbot_stop <reason>") for localeInfo text, instead of AVA2's numeric locale ids 864 / 865.
// - Leaving the core deletes the table after it is sent (AVA2 leaked it), and a logout that unregisters the last
// active slot stops the roll event.
// - Version gate: EnterGame sends nothing unless the CG_CLIENT_VERSION timestamp is "mt<date>" with
// date >= PORT_SWITCHBOT_CLIENT_VERSION (older clients send __TIMESTAMP__ or "1215955205").
// - Version gate: EnterGame sends nothing unless the CG_CLIENT_VERSION(2) timestamp carries "mt<date>" with
// date >= PORT_SWITCHBOT_CLIENT_VERSION. The EU client sends "1215955205 mt<date>": the europe version
// check reads the timestamp with atoi, so it still sees 1215955205. Older clients send "1215955205" only.
// - The attribute list has two pseudo sets after ATTRIBUTE_SET_MAX_NUM: 8 = rings (port_rings.cpp) and
// 9 = talismans (port_pendant.cpp), whose pools are not in item_attr.
#include "stdafx.h"
@@ -742,8 +743,8 @@ void CSwitchbotManager::SendSwitchbotUpdate(DWORD player_id)
bool SwitchbotHelper::IsClientSupported(LPCHARACTER ch)
{
LPDESC d = ch ? ch->GetDesc() : NULL;
const char* c_pszVersion = d ? d->GetClientVersion() : "";
return c_pszVersion[0] == 'm' && c_pszVersion[1] == 't' && atoi(c_pszVersion + 2) >= PORT_SWITCHBOT_CLIENT_VERSION;
const char* c_pszMark = d ? strstr(d->GetClientVersion(), "mt") : NULL;
return c_pszMark && atoi(c_pszMark + 2) >= PORT_SWITCHBOT_CLIENT_VERSION;
}
void CSwitchbotManager::EnterGame(LPCHARACTER ch)
+3 -1
View File
@@ -82,7 +82,7 @@ assert 'CSwitchbotManager::Instance().EnterGame(ch);' in source('game/src/input_
assert 'enum { PORT_SWITCHBOT_CLIENT_VERSION = 20261016 };' in source('game/src/port_switchbot.h')
enter=port[port.index('void CSwitchbotManager::EnterGame'):];enter=enter[:enter.index('\n}\n')]
assert enter.index('if (!SwitchbotHelper::IsClientSupported(ch))\n\t\treturn;')<enter.index('SendItemAttributeInformations(ch);')
assert "c_pszVersion[0] == 'm' && c_pszVersion[1] == 't' && atoi(c_pszVersion + 2) >= PORT_SWITCHBOT_CLIENT_VERSION" in port
assert 'strstr(d->GetClientVersion(), "mt")' in port and 'atoi(c_pszMark + 2) >= PORT_SWITCHBOT_CLIENT_VERSION' in port
assert 'case SWITCHBOT:' in source('game/src/input_db.cpp')
main=source('game/src/main.cpp')
assert 'CSwitchbotManager switchbotManager;' in main and 'PortSwitchbotBoot();' in main
@@ -102,6 +102,8 @@ if cpacket.is_file():
assert 'static_assert(sizeof(TSwitchbotUpdateItem) == 40,' in client
assert 'static_assert(sizeof(TPacketCGSwitchbot) == 7 && sizeof(TPacketGCSwitchbot) == 7,' in client
stream=(CLIENT/'PythonNetworkStreamPhaseGame.cpp').read_bytes().decode('latin1')
# the EU branch (the one every locale.cfg build takes) keeps 1215955205 first for the atoi version check
assert 'strncpy(kVersionPacket.timestamp, "1215955205 mt20261016", sizeof(kVersionPacket.timestamp)-1);' in stream
assert 'strncpy(kVersionPacket.timestamp, "mt20261016", sizeof(kVersionPacket.timestamp)-1);' in stream
pyswitch=(CLIENT/'PythonSwitchbot.h').read_bytes().decode('latin1')
ctable=pyswitch[pyswitch.index('struct TSwitchbotTable'):];ctable=ctable[:ctable.index('};')]