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
@@ -7,6 +7,11 @@
#include "EterPythonLib/StdAfx.h"
#include "EterBase/Timer.h"
#include "EterLib/Util.h"
#include "UserInterface/PythonNetworkStream.h"
#include "UserInterface/AccountConnector.h"
#include "UserInterface/PythonPlayer.h"
#include "GameLib/FlyingObjectManager.h"
#include "EffectLib/EffectManager.h"
#include "PythonBoot.h"
#include "PythonHost.h"
#include "../EterLib/UIRenderCommands.h"
@@ -25,6 +30,15 @@ std::unique_ptr<UI::CWindowManager> g_window_manager;
std::unique_ptr<CPythonResource> g_resource;
// 40250 CPythonApplication::m_timer; CSlotWindow's cool time and Process() read it via Instance().
std::unique_ptr<CTimer> g_timer;
// 40250 CPythonApplication::m_pyNetworkStream and m_kAccountConnector (CSingletons); the app loop
// processes them every frame and the net module reaches them through Instance().
std::unique_ptr<CPythonNetworkStream> g_network_stream;
std::unique_ptr<CAccountConnector> g_account_connector;
// 40250 CPythonApplication::m_pyPlayer, m_FlyingManager and m_kEftMgr: the loading phase clears them
// (CPythonNetworkStream::SetLoadingPhase). PythonPlayer and FlyingObjectManager are platform/pending stand-ins.
std::unique_ptr<CPythonPlayer> g_player;
std::unique_ptr<CFlyingManager> g_flying_manager;
std::unique_ptr<CEffectManager> g_effect_manager;
bool fail(std::string* error, const std::string& text)
{
@@ -206,6 +220,11 @@ bool Start(const char* stdlib_path, std::string* error)
g_timer = std::make_unique<CTimer>();
g_resource = std::make_unique<CPythonResource>();
g_window_manager = std::make_unique<UI::CWindowManager>();
g_network_stream = std::make_unique<CPythonNetworkStream>();
g_account_connector = std::make_unique<CAccountConnector>();
g_player = std::make_unique<CPythonPlayer>();
g_flying_manager = std::make_unique<CFlyingManager>();
g_effect_manager = std::make_unique<CEffectManager>();
return true;
}
@@ -226,6 +245,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
initgrpText();
initwndMgr();
initapp();
initnet();
init_2v0_gameplay_stubs();
ClearLogBoxMessage();
@@ -391,6 +411,11 @@ void Stop()
// 40250 Main(): pyLauncher.Clear() runs before app->Destroy()/delete app, so the window manager
// (a CPythonApplication member) is still alive while Py_Finalize runs the windows' __del__.
g_launcher->Clear();
g_effect_manager.reset();
g_flying_manager.reset();
g_player.reset();
g_account_connector.reset();
g_network_stream.reset();
g_window_manager.reset();
g_resource.reset();
g_timer.reset();
@@ -398,3 +423,10 @@ void Stop()
}
}
// winuser.h (declared in the port's windows.h shim). WM_QUIT ends 40250's CPythonApplication::Loop;
// here the script fiber's loop ends the same way.
void PostQuitMessage(int)
{
PythonBoot::AppRequestQuit();
}