Five character slots: header 32 carries PLAYER_PER_ACCOUNT5
LOGIN_SUCCESS4 (32) now always reads the five-slot packet, replacing the racy size-sniffing check; slot index bounds use PLAYER_PER_ACCOUNT5; version mt20261029. Also skip short rows in <map>_point.txt, which read past the token vector and crashed a warp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
da26f52df5
commit
1757643b07
@@ -37,7 +37,7 @@ inline constexpr int GUILD_NAME_MAX_LEN = 12; // -> guild_name[13]
|
||||
inline constexpr int GUILD_GRADE_NAME_MAX_LEN = 8;
|
||||
inline constexpr int GUILD_COMMENT_MAX_LEN = 50;
|
||||
inline constexpr int GUILD_SKILL_MAX_NUM = 12;
|
||||
inline constexpr int PLAYER_PER_ACCOUNT = 4; // common/length.h
|
||||
inline constexpr int PLAYER_PER_ACCOUNT = 5; // common/length.h (ENABLE_PLAYER_PER_ACCOUNT5)
|
||||
inline constexpr int PLAYER_PER_ACCOUNT3 = 3; // legacy GC_LOGIN_SUCCESS (hdr 6)
|
||||
inline constexpr int ID_MAX_NUM = 30; // Packet.h -> login[31]
|
||||
inline constexpr int PASS_MAX_NUM = 16; // -> passwd[17]
|
||||
@@ -445,7 +445,7 @@ struct GCLoginSuccessT { // packet_login_success — 40250 sends the NEWSLOT (N=
|
||||
using GCLoginSuccess = GCLoginSuccessT<PLAYER_PER_ACCOUNT>; // header 32
|
||||
using GCLoginSuccess3 = GCLoginSuccessT<PLAYER_PER_ACCOUNT3>; // header 6 (legacy)
|
||||
// 1 + 103*N + 4*N + 13*N + 4 + 4
|
||||
static_assert(sizeof(GCLoginSuccess) == 1 + sizeof(SimplePlayer) * 4 + 4 * 4 + 13 * 4 + 4 + 4); // 349
|
||||
static_assert(sizeof(GCLoginSuccess) == 1 + sizeof(SimplePlayer) * 5 + 4 * 5 + 13 * 5 + 4 + 4); // 434
|
||||
static_assert(sizeof(GCLoginSuccess3) == 1 + sizeof(SimplePlayer) * 3 + 4 * 3 + 13 * 3 + 4 + 4); // 264
|
||||
|
||||
struct GCLoginFailure { uint8_t header; char status[LOGIN_STATUS_MAX_LEN + 1]; };
|
||||
|
||||
@@ -2033,15 +2033,15 @@ int main(int argc, char** argv)
|
||||
{
|
||||
// 1. Python 导出验证
|
||||
CHECK(py("import app, net\n"
|
||||
"assert app.ENABLE_PLAYER_PER_ACCOUNT5 == 0, 'unsupported fifth slot advertised'\n"
|
||||
"assert app.ENABLE_PLAYER_PER_ACCOUNT5 == 1, 'fifth slot not advertised'\n"
|
||||
"import introselect\n"
|
||||
"assert introselect.SelectCharacterWindow.SLOT_COUNT == 4, 'current server supports four slots'\n"
|
||||
"assert len(introselect.SelectCharacterWindow.SLOT_ROTATION) == 4, 'current selection requires four angles'\n"));
|
||||
"assert introselect.SelectCharacterWindow.SLOT_COUNT == 5, 'server sends five slots'\n"
|
||||
"assert len(introselect.SelectCharacterWindow.SLOT_ROTATION) == 5, 'five-slot selection needs five angles'\n"));
|
||||
|
||||
// 2. 槽位范围与边界安全检查 (0..4 合法, 5 越界)
|
||||
CPythonNetworkStream& stream = CPythonNetworkStream::Instance();
|
||||
CHECK(stream.GetAccountCharacterSlotDatau(0, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_ID) == 1); // 登录成功包设置的第 1 角色
|
||||
CHECK(stream.GetAccountCharacterSlotDatau(4, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_ID) == 0); // 4 槽服务器模式下第 5 槽为空
|
||||
CHECK(stream.GetAccountCharacterSlotDatau(4, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_ID) == 0); // 第 5 槽 (slot 4) 在登录成功包中为空
|
||||
CHECK(std::string(stream.GetAccountCharacterSlotDataz(4, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_NAME)).empty());
|
||||
CHECK(stream.GetAccountCharacterSlotDatau(5, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_ID) == 0); // 越界槽位安全防御
|
||||
CHECK(std::string(stream.GetAccountCharacterSlotDataz(5, CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_NAME)).empty());
|
||||
|
||||
@@ -30,7 +30,7 @@ static const WireSize kPortSizes[] = {
|
||||
{"TPacketGCAuthSuccess", sizeof(TPacketGCAuthSuccess)},
|
||||
{"TSimplePlayerInformation", sizeof(TSimplePlayerInformation)},
|
||||
{"TPacketGCLoginSuccess3", sizeof(TPacketGCLoginSuccess3)},
|
||||
{"TPacketGCLoginSuccess4", sizeof(TPacketGCLoginSuccess4)},
|
||||
{"TPacketGCLoginSuccess5", sizeof(TPacketGCLoginSuccess5)}, // header 32 carries five slots
|
||||
{"TPacketGCLoginFailure", sizeof(TPacketGCLoginFailure)},
|
||||
{"TPacketGCEmpire", sizeof(TPacketGCEmpire)},
|
||||
{"TPacketCGEmpire", sizeof(TPacketCGEmpire)},
|
||||
|
||||
Reference in New Issue
Block a user