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
+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('};')]