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
@@ -5,6 +5,9 @@
#include "EterLib/Camera.h"
#include "EterBase/Timer.h"
#include "EterLib/ResourceManager.h"
#include "UserInterface/PythonNetworkStream.h"
#include "UserInterface/AccountConnector.h"
#include "EterLib/NetDevice.h"
#include "../PlatformStub.h"
#include "../EterLib/UIRenderCommands.h"
#include "../ScriptLib/PythonBoot.h"
@@ -63,6 +66,15 @@ bool CPythonApplication::Create(PyObject*, const char*, int, int, int)
PyErr_SetString(PyExc_RuntimeError, "CREATE_DEVICE");
return false;
}
// In 40250 m_netDevice is a member created here (PythonApplication.cpp:1242).
static CNetworkDevice s_netDevice;
if (!s_netDevice.Create())
{
TraceError("NetDevice::Create failed");
PyErr_SetString(PyExc_RuntimeError, "CREATE_NETWORK");
return false;
}
return true;
}
void CPythonApplication::UpdateGame() { MT_PLATFORM_STUB(); }
@@ -79,6 +91,12 @@ bool CPythonApplication::Process()
CTimer& rkTimer=CTimer::Instance();
rkTimer.Advance();
// Network I/O
CPythonNetworkStream::Instance().Process();
// PORT: m_kGuildMarkUploader/m_kGuildMarkDownloader.Process() follow here in 40250; the guild mark
// transfer is not ported yet (GuildMarkDownloader.cpp/GuildMarkUploader.cpp).
CAccountConnector::Instance().Process();
CResourceManager::Instance().Update();
OnUIUpdate();
@@ -137,7 +155,6 @@ void CPythonApplication::SetForceSightRange(int) { MT_PLATFORM_STUB(); }
void CCamera::SetResistance(float) { MT_PLATFORM_STUB(); }
void CCamera::SetCameraMaxDistance(float) { MT_PLATFORM_STUB(); }
void CGuildMarkManager::SetMarkPathPrefix(const char*) { MT_PLATFORM_STUB(); }
void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); }
float GetDegreeDifference(float, float) { MT_PLATFORM_STUB(); return 0; }
@@ -173,6 +190,46 @@ void LocaleService_ForceSetLocale(const char* name, const char* path) {
locale_path = path ? path : "";
}
// 40250 UserInterface/Locale.cpp:9-31, 168-172 and 393-423 (the non-Japan branch), verbatim: what the network
// slice (批次 2V1) and InsultChecker call.
const char* LSS_YMIR = "YMIR";
const char* LSS_JAPAN = "JAPAN";
const char* LSS_ENGLISH = "ENGLISH";
const char* LSS_HONGKONG = "HONGKONG";
const char* LSS_TAIWAN = "TAIWAN";
const char* LSS_NEWCIBN = "NEWCIBN";
const char* LSS_EUROPE = "EUROPE";
const char* LSS_GLOBAL = "GLOBAL";
#ifndef LSS_SECURITY_KEY
#define LSS_SECURITY_KEY "testtesttesttest"
#endif
std::string __SECURITY_KEY_STRING__ = LSS_SECURITY_KEY;
const char* LocaleService_GetSecurityKey()
{
return __SECURITY_KEY_STRING__.c_str();
}
bool LocaleService_IsYMIR() { return (stricmp( LocaleService_GetName(), LSS_YMIR ) == 0) || (stricmp( LocaleService_GetLocaleName(), "ymir" ) == 0); }
bool LocaleService_IsJAPAN() { return (stricmp( LocaleService_GetName(), LSS_JAPAN ) == 0) || (stricmp( LocaleService_GetLocaleName(), "japan" ) == 0); }
bool LocaleService_IsENGLISH() { return (stricmp( LocaleService_GetName(), LSS_ENGLISH ) == 0); }
bool LocaleService_IsEUROPE() { return (stricmp( LocaleService_GetName(), LSS_EUROPE ) == 0); }
bool LocaleService_IsHONGKONG() { return (stricmp( LocaleService_GetName(), LSS_HONGKONG ) == 0); }
bool LocaleService_IsTAIWAN() { return (stricmp( LocaleService_GetName(), LSS_TAIWAN ) == 0); }
bool LocaleService_IsNEWCIBN() { return (stricmp( LocaleService_GetName(), LSS_NEWCIBN ) == 0); }
BOOL LocaleService_IsLeadByte( const char chByte )
{
return (((unsigned char) chByte) & 0x80) != 0;
}
int LocaleService_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength )
{
return strnicmp( szStringLeft, szStringRight, sizeLength );
}
// 40250 UserInterface/GameType.cpp:9-73 (DEFAULT_FONT), verbatim.
// PORT: the default names are CP949 literals in 40250; ui.py sets the locale font (app.SetDefaultFontName)
// before anything asks for it.