2V1-b/c: PythonNetworkStream phases, AccountConnector and the net module

Port PythonNetworkStream with its HandShake/Login/Select/Loading/Offline
phases, AccountConnector and PythonNetworkStreamModule verbatim; the net
stub goes. PythonBoot creates the network stream, account connector,
player, flying manager and effect manager like CPythonApplication, and
app.Create/Process drive CNetworkDevice and both connectors.

Packet.h long fields become 32-bit LONG; port.packet checks 38
login/select/loading packet sizes against wire_classic.h. Unported units
in the link closure live under platform/pending/ as stand-ins. The macOS
gate now builds all and finds iconv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-23 15:02:14 +09:00
co-authored by Claude Opus 5.5
parent cd3b8b506f
commit 4d9b800efb
44 changed files with 8292 additions and 324 deletions
+77
View File
@@ -0,0 +1,77 @@
// 批次 2V1: the ported 40250 UserInterface/Packet.h against the classic wire layouts in net/classic/wire_classic.h,
// which the mtnet backend checked 1:1 against the 40250 server on 192.168.21.203. Win32 `long` is 32 bits and
// Packet.h now says LONG; a 64-bit long, or a missing #pragma pack(1), shows up here as a size mismatch.
// Covers the packets the login/select/loading phases send and read. The two headers cannot share a translation unit
// (Packet.h's macros such as SKILL_MAX_NUM collide with wire_classic.h's constants), so the wire sizes come from
// port_packet_test_wire.cpp.
#include "UserInterface/StdAfx.h"
#include "UserInterface/Packet.h"
#include <cstdio>
#include <cstddef>
struct WireSize { const char* name; std::size_t size; };
extern const WireSize kWireSizes[];
static const WireSize kPortSizes[] = {
// HandShake phase
{"TPacketGCHandshake", sizeof(TPacketGCHandshake)},
{"TPacketGCPhase", sizeof(TPacketGCPhase)},
{"TPacketGCBindUDP", sizeof(TPacketGCBindUDP)},
{"TPacketKeyAgreement", sizeof(TPacketKeyAgreement)},
{"TPacketKeyAgreementCompleted", sizeof(TPacketKeyAgreementCompleted)},
{"TPacketGCPing", sizeof(TPacketGCPing)},
{"TPacketCGPong", sizeof(TPacketCGPong)},
// Login phase (and the auth server, CAccountConnector)
{"TPacketCGLogin", sizeof(TPacketCGLogin)},
{"TPacketCGLogin2", sizeof(TPacketCGLogin2)},
{"TPacketCGLogin3", sizeof(TPacketCGLogin3)},
{"TPacketGCLoginKey", sizeof(TPacketGCLoginKey)},
{"TPacketGCAuthSuccess", sizeof(TPacketGCAuthSuccess)},
{"TSimplePlayerInformation", sizeof(TSimplePlayerInformation)},
{"TPacketGCLoginSuccess3", sizeof(TPacketGCLoginSuccess3)},
{"TPacketGCLoginSuccess4", sizeof(TPacketGCLoginSuccess4)},
{"TPacketGCLoginFailure", sizeof(TPacketGCLoginFailure)},
{"TPacketGCEmpire", sizeof(TPacketGCEmpire)},
{"TPacketCGEmpire", sizeof(TPacketCGEmpire)},
// Select phase
{"TPacketCGSelectCharacter", sizeof(TPacketCGSelectCharacter)},
{"TPacketCGCreateCharacter", sizeof(TPacketCGCreateCharacter)},
{"TPacketCGDestroyCharacter", sizeof(TPacketCGDestroyCharacter)},
{"TPacketCGChangeName", sizeof(TPacketCGChangeName)},
{"TPacketGCPlayerCreateSuccess", sizeof(TPacketGCPlayerCreateSuccess)},
{"TPacketGCCreateFailure", sizeof(TPacketGCCreateFailure)},
{"TPacketGCDestroyCharacterSuccess", sizeof(TPacketGCDestroyCharacterSuccess)},
{"TPacketGCChangeName", sizeof(TPacketGCChangeName)},
// Loading phase
{"TPacketGCMainCharacter", sizeof(TPacketGCMainCharacter)},
{"TPacketGCMainCharacter2_EMPIRE", sizeof(TPacketGCMainCharacter2_EMPIRE)},
{"TPacketGCMainCharacter3_BGM", sizeof(TPacketGCMainCharacter3_BGM)},
{"TPacketGCMainCharacter4_BGM_VOL", sizeof(TPacketGCMainCharacter4_BGM_VOL)},
{"TPacketGCPoints", sizeof(TPacketGCPoints)},
{"TPacketGCPointChange", sizeof(TPacketGCPointChange)},
{"TPacketGCItemSet2", sizeof(TPacketGCItemSet2)},
{"TPacketGCQuickSlotAdd", sizeof(TPacketGCQuickSlotAdd)},
{"TPacketGCCharacterUpdate", sizeof(TPacketGCCharacterUpdate)},
{"TPacketCGClientVersion2", sizeof(TPacketCGClientVersion2)},
{"TPacketCGEnterFrontGame", sizeof(TPacketCGEnterFrontGame)},
{nullptr, 0},
};
int main()
{
int failures = 0;
for (int i = 0; kPortSizes[i].name; ++i)
{
if (kPortSizes[i].size != kWireSizes[i].size)
{
std::fprintf(stderr, "%s is %zu bytes, %s is %zu\n", kPortSizes[i].name, kPortSizes[i].size,
kWireSizes[i].name, kWireSizes[i].size);
++failures;
}
}
if (failures)
return 1;
std::printf("port_packet_test: ok\n");
return 0;
}
+49
View File
@@ -0,0 +1,49 @@
// The classic wire sizes for port_packet_test.cpp, in the same order as its kPortSizes.
#include "../src/net/classic/wire_classic.h"
#include <cstddef>
struct WireSize { const char* name; std::size_t size; };
namespace w = mtnet::classic;
extern const WireSize kWireSizes[] = {
{"Handshake", sizeof(w::Handshake)},
{"Phase_", sizeof(w::Phase_)},
{"BindUDP", sizeof(w::BindUDP)},
{"KeyAgreement", sizeof(w::KeyAgreement)},
{"KeyAgreementCompleted", sizeof(w::KeyAgreementCompleted)},
{"Blank", sizeof(w::Blank)},
{"Blank", sizeof(w::Blank)},
{"CGLogin", sizeof(w::CGLogin)},
{"CGLogin2", sizeof(w::CGLogin2)},
{"CGLogin3", sizeof(w::CGLogin3)},
{"GCLoginKey", sizeof(w::GCLoginKey)},
{"GCAuthSuccess", sizeof(w::GCAuthSuccess)},
{"SimplePlayer", sizeof(w::SimplePlayer)},
{"GCLoginSuccess3", sizeof(w::GCLoginSuccess3)},
{"GCLoginSuccess", sizeof(w::GCLoginSuccess)},
{"GCLoginFailure", sizeof(w::GCLoginFailure)},
{"GCEmpire", sizeof(w::GCEmpire)},
{"CGEmpire", sizeof(w::CGEmpire)},
{"CGPlayerSelect", sizeof(w::CGPlayerSelect)},
{"CGPlayerCreate", sizeof(w::CGPlayerCreate)},
{"CGPlayerDelete", sizeof(w::CGPlayerDelete)},
{"CGChangeName", sizeof(w::CGChangeName)},
{"GCPlayerCreateSuccess", sizeof(w::GCPlayerCreateSuccess)},
{"GCPlayerCreateFailure", sizeof(w::GCPlayerCreateFailure)},
{"GCPlayerDeleteSuccess", sizeof(w::GCPlayerDeleteSuccess)},
{"GCChangeName", sizeof(w::GCChangeName)},
{"GCMainCharacterOld", sizeof(w::GCMainCharacterOld)},
{"GCMainCharacter", sizeof(w::GCMainCharacter)},
{"GCMainCharacter3BGM", sizeof(w::GCMainCharacter3BGM)},
{"GCMainCharacter4BGM", sizeof(w::GCMainCharacter4BGM)},
{"GCPoints", sizeof(w::GCPoints)},
{"GCPointChange", sizeof(w::GCPointChange)},
{"GCItemSet", sizeof(w::GCItemSet)},
{"GCQuickSlotAdd", sizeof(w::GCQuickSlotAdd)},
{"GCCharacterUpdate", sizeof(w::GCCharacterUpdate)},
{"CGClientVersion2", sizeof(w::CGClientVersion2)},
{"CGEnterGame", sizeof(w::CGEnterGame)},
{nullptr, 0},
};