port 2V2-b: GamePhase dispatch consumes the Entergame burst
PythonNetworkStreamPhaseGame/PhaseGameActor/PhaseGameItem/Command, NetworkActorManager and PythonChat/PythonChatModule are ported verbatim and dispatched at runtime; the 2V0 chat stub module is removed and initChat() runs before initnet() as in 40250. InstanceBase, PythonCharacterManager and GameLib ActorInstance/RaceData/RaceManager compile but stay TODO until 2V2-c/d wire them. Units not ported yet get their singletons from PythonBoot's GameSingletons (CPythonApplication member order) and platform/pending stand-ins generated by platform_stub.py pending; const char* stand-ins return "". port.login_flow's fake server now sends the CInputLogin::Entergame order (actor insert, NPC positions, PHASE_GAME, land list, time, channel, greet notice, ping) and a TraceError observer asserts no unknown packet header. port.login_live passes against the real server for 10 s of game phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d16fabf61c
commit
62b6e23bfc
@@ -75,28 +75,6 @@ void AddStubConstants_background(PyObject* poModule)
|
||||
PyModule_AddIntConstant(poModule, "TEXTURE_SORT", CMapOutdoor::TEXTURE_SORT);
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonChatModule.cpp
|
||||
void AddStubConstants_chat(PyObject* poModule)
|
||||
{
|
||||
(void) poModule;
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_TALKING", CHAT_TYPE_TALKING);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_INFO", CHAT_TYPE_INFO);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_NOTICE", CHAT_TYPE_NOTICE);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_PARTY", CHAT_TYPE_PARTY);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_GUILD", CHAT_TYPE_GUILD);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_COMMAND", CHAT_TYPE_COMMAND);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_SHOUT", CHAT_TYPE_SHOUT);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_WHISPER", CHAT_TYPE_WHISPER);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_CHAT", CPythonChat::WHISPER_TYPE_CHAT);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_SYSTEM", CPythonChat::WHISPER_TYPE_SYSTEM);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_GM", CPythonChat::WHISPER_TYPE_GM);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_VIEW", CPythonChat::BOARD_STATE_VIEW);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_EDIT", CPythonChat::BOARD_STATE_EDIT);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_LOG", CPythonChat::BOARD_STATE_LOG);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_CHAT_WINDOW", 0);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_LOG_WINDOW", 1);
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonCharacterModule.cpp
|
||||
void AddStubConstants_chr(PyObject* poModule)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// GameplayModuleConstants.cpp: each module's 40250 constants.
|
||||
void AddStubConstants_ServerStateChecker(PyObject* poModule);
|
||||
void AddStubConstants_background(PyObject* poModule);
|
||||
void AddStubConstants_chat(PyObject* poModule);
|
||||
void AddStubConstants_chr(PyObject* poModule);
|
||||
void AddStubConstants_chrmgr(PyObject* poModule);
|
||||
void AddStubConstants_effect(PyObject* poModule);
|
||||
@@ -154,70 +153,6 @@ PyMethodDef methods_background[] = {
|
||||
{ "WarpTest", stub_background_WarpTest, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonChatModule.cpp: chat export names.
|
||||
PyObject* stub_chat_SetChatColor(PyObject*, PyObject*) { return stub_call_named("chat.SetChatColor", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Clear(PyObject*, PyObject*) { return stub_call_named("chat.Clear", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Close(PyObject*, PyObject*) { return stub_call_named("chat.Close", Py_BuildNone()); }
|
||||
PyObject* stub_chat_CreateChatSet(PyObject*, PyObject*) { return stub_call_named("chat.CreateChatSet", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_Update(PyObject*, PyObject*) { return stub_call_named("chat.Update", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Render(PyObject*, PyObject*) { return stub_call_named("chat.Render", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetBoardState(PyObject*, PyObject*) { return stub_call_named("chat.SetBoardState", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetPosition(PyObject*, PyObject*) { return stub_call_named("chat.SetPosition", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetHeight(PyObject*, PyObject*) { return stub_call_named("chat.SetHeight", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetStep(PyObject*, PyObject*) { return stub_call_named("chat.SetStep", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ToggleChatMode(PyObject*, PyObject*) { return stub_call_named("chat.ToggleChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_EnableChatMode(PyObject*, PyObject*) { return stub_call_named("chat.EnableChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_DisableChatMode(PyObject*, PyObject*) { return stub_call_named("chat.DisableChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetEndPos(PyObject*, PyObject*) { return stub_call_named("chat.SetEndPos", Py_BuildNone()); }
|
||||
PyObject* stub_chat_GetLineCount(PyObject*, PyObject*) { return stub_call_named("chat.GetLineCount", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_GetVisibleLineCount(PyObject*, PyObject*) { return stub_call_named("chat.GetVisibleLineCount", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_GetLineStep(PyObject*, PyObject*) { return stub_call_named("chat.GetLineStep", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_AppendChat(PyObject*, PyObject*) { return stub_call_named("chat.AppendChat", Py_BuildNone()); }
|
||||
PyObject* stub_chat_AppendChatWithDelay(PyObject*, PyObject*) { return stub_call_named("chat.AppendChatWithDelay", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ArrangeShowingChat(PyObject*, PyObject*) { return stub_call_named("chat.ArrangeShowingChat", Py_BuildNone()); }
|
||||
PyObject* stub_chat_IgnoreCharacter(PyObject*, PyObject*) { return stub_call_named("chat.IgnoreCharacter", Py_BuildNone()); }
|
||||
PyObject* stub_chat_IsIgnoreCharacter(PyObject*, PyObject*) { return stub_call_named("chat.IsIgnoreCharacter", Py_BuildNone()); }
|
||||
PyObject* stub_chat_CreateWhisper(PyObject*, PyObject*) { return stub_call_named("chat.CreateWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_AppendWhisper(PyObject*, PyObject*) { return stub_call_named("chat.AppendWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_RenderWhisper(PyObject*, PyObject*) { return stub_call_named("chat.RenderWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetWhisperBoxSize(PyObject*, PyObject*) { return stub_call_named("chat.SetWhisperBoxSize", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetWhisperPosition(PyObject*, PyObject*) { return stub_call_named("chat.SetWhisperPosition", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ClearWhisper(PyObject*, PyObject*) { return stub_call_named("chat.ClearWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_InitWhisper(PyObject*, PyObject*) { return stub_call_named("chat.InitWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_GetLinkFromHyperlink(PyObject*, PyObject*) { return stub_call_named("chat.GetLinkFromHyperlink", Py_BuildValue("s", "")); }
|
||||
PyMethodDef methods_chat[] = {
|
||||
{ "SetChatColor", stub_chat_SetChatColor, METH_VARARGS },
|
||||
{ "Clear", stub_chat_Clear, METH_VARARGS },
|
||||
{ "Close", stub_chat_Close, METH_VARARGS },
|
||||
{ "CreateChatSet", stub_chat_CreateChatSet, METH_VARARGS },
|
||||
{ "Update", stub_chat_Update, METH_VARARGS },
|
||||
{ "Render", stub_chat_Render, METH_VARARGS },
|
||||
{ "SetBoardState", stub_chat_SetBoardState, METH_VARARGS },
|
||||
{ "SetPosition", stub_chat_SetPosition, METH_VARARGS },
|
||||
{ "SetHeight", stub_chat_SetHeight, METH_VARARGS },
|
||||
{ "SetStep", stub_chat_SetStep, METH_VARARGS },
|
||||
{ "ToggleChatMode", stub_chat_ToggleChatMode, METH_VARARGS },
|
||||
{ "EnableChatMode", stub_chat_EnableChatMode, METH_VARARGS },
|
||||
{ "DisableChatMode", stub_chat_DisableChatMode, METH_VARARGS },
|
||||
{ "SetEndPos", stub_chat_SetEndPos, METH_VARARGS },
|
||||
{ "GetLineCount", stub_chat_GetLineCount, METH_VARARGS },
|
||||
{ "GetVisibleLineCount", stub_chat_GetVisibleLineCount, METH_VARARGS },
|
||||
{ "GetLineStep", stub_chat_GetLineStep, METH_VARARGS },
|
||||
{ "AppendChat", stub_chat_AppendChat, METH_VARARGS },
|
||||
{ "AppendChatWithDelay", stub_chat_AppendChatWithDelay, METH_VARARGS },
|
||||
{ "ArrangeShowingChat", stub_chat_ArrangeShowingChat, METH_VARARGS },
|
||||
{ "IgnoreCharacter", stub_chat_IgnoreCharacter, METH_VARARGS },
|
||||
{ "IsIgnoreCharacter", stub_chat_IsIgnoreCharacter, METH_VARARGS },
|
||||
{ "CreateWhisper", stub_chat_CreateWhisper, METH_VARARGS },
|
||||
{ "AppendWhisper", stub_chat_AppendWhisper, METH_VARARGS },
|
||||
{ "RenderWhisper", stub_chat_RenderWhisper, METH_VARARGS },
|
||||
{ "SetWhisperBoxSize", stub_chat_SetWhisperBoxSize, METH_VARARGS },
|
||||
{ "SetWhisperPosition", stub_chat_SetWhisperPosition, METH_VARARGS },
|
||||
{ "ClearWhisper", stub_chat_ClearWhisper, METH_VARARGS },
|
||||
{ "InitWhisper", stub_chat_InitWhisper, METH_VARARGS },
|
||||
{ "GetLinkFromHyperlink", stub_chat_GetLinkFromHyperlink, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonCharacterModule.cpp: chr export names.
|
||||
PyObject* stub_chr_DismountHorse(PyObject*, PyObject*) { return stub_call_named("chr.DismountHorse", Py_BuildNone()); }
|
||||
PyObject* stub_chr_MountHorse(PyObject*, PyObject*) { return stub_call_named("chr.MountHorse", Py_BuildNone()); }
|
||||
@@ -1502,11 +1437,6 @@ void init_2v0_gameplay_stubs() {
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_background(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("chat", methods_chat);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_chat(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("chr", methods_chr);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
|
||||
@@ -12,12 +12,31 @@
|
||||
#include "UserInterface/PythonPlayer.h"
|
||||
#include "GameLib/FlyingObjectManager.h"
|
||||
#include "EffectLib/EffectManager.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
#include "UserInterface/PythonCharacterManager.h"
|
||||
#include "UserInterface/PythonItem.h"
|
||||
#include "UserInterface/PythonShop.h"
|
||||
#include "UserInterface/PythonExchange.h"
|
||||
#include "UserInterface/PythonChat.h"
|
||||
#include "UserInterface/PythonTextTail.h"
|
||||
#include "UserInterface/PythonNonPlayer.h"
|
||||
#include "UserInterface/PythonMiniMap.h"
|
||||
#include "UserInterface/PythonEventManager.h"
|
||||
#include "UserInterface/PythonBackground.h"
|
||||
#include "UserInterface/PythonQuest.h"
|
||||
#include "UserInterface/PythonMessenger.h"
|
||||
#include "UserInterface/PythonSafeBox.h"
|
||||
#include "UserInterface/PythonGuild.h"
|
||||
#include "UserInterface/AbstractApplication.h"
|
||||
#include "UserInterface/PythonApplication.h"
|
||||
#include "EterBase/Timer.h"
|
||||
#include "PythonBoot.h"
|
||||
#include "PythonHost.h"
|
||||
#include "../EterLib/UIRenderCommands.h"
|
||||
#include "../EterBase/LogBox.h"
|
||||
|
||||
#include <condition_variable>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <pthread.h>
|
||||
@@ -39,6 +58,61 @@ std::unique_ptr<CAccountConnector> g_account_connector;
|
||||
std::unique_ptr<CPythonPlayer> g_player;
|
||||
std::unique_ptr<CFlyingManager> g_flying_manager;
|
||||
std::unique_ptr<CEffectManager> g_effect_manager;
|
||||
// PORT: CPythonApplication is not constructed by the Godot host yet. GamePhase calls the
|
||||
// 40250 IAbstractApplication singleton, so expose the host's current timer and camera surface.
|
||||
class GameApplicationAdapter final : public IAbstractApplication
|
||||
{
|
||||
public:
|
||||
void GetMousePosition(POINT* point) override { if (point) *point = {}; }
|
||||
float GetGlobalTime() override { return CTimer::Instance().GetCurrentSecond(); }
|
||||
float GetGlobalElapsedTime() override { return CTimer::Instance().GetElapsedSecond(); }
|
||||
void SkipRenderBuffering(DWORD) override {}
|
||||
void SetServerTime(time_t) override {}
|
||||
void SetCenterPosition(float x, float y, float z) override
|
||||
{
|
||||
CPythonApplication::Instance().SetCenterPosition(x, y, z);
|
||||
}
|
||||
void SetEventCamera(const SCameraSetting& setting) override
|
||||
{
|
||||
CPythonApplication::Instance().SetEventCamera(setting);
|
||||
}
|
||||
void BlendEventCamera(const SCameraSetting&, float) override {}
|
||||
void SetDefaultCamera() override { CPythonApplication::Instance().SetDefaultCamera(); }
|
||||
void RunIMEUpdate() override {}
|
||||
void RunIMETabEvent() override {}
|
||||
void RunIMEReturnEvent() override {}
|
||||
void RunIMEChangeCodePage() override {}
|
||||
void RunIMEOpenCandidateListEvent() override {}
|
||||
void RunIMECloseCandidateListEvent() override {}
|
||||
void RunIMEOpenReadingWndEvent() override {}
|
||||
void RunIMECloseReadingWndEvent() override {}
|
||||
};
|
||||
std::unique_ptr<GameApplicationAdapter> g_game_application;
|
||||
// The CPythonApplication members the game phase reaches through Instance() (批次 2V2), in 40250's member
|
||||
// order. All are platform/pending stand-ins so far: their stub constructors leave scalar members unset, so
|
||||
// the object is built in zeroed storage and inline header accessors read null/0 rather than garbage.
|
||||
struct GameSingletons
|
||||
{
|
||||
static void* operator new(size_t size) { return std::calloc(1, size); }
|
||||
static void operator delete(void* p) { std::free(p); }
|
||||
|
||||
CItemManager kItemMgr;
|
||||
CPythonCharacterManager kChrMgr;
|
||||
CPythonItem pyItem;
|
||||
CPythonShop pyShop;
|
||||
CPythonExchange pyExchange;
|
||||
CPythonChat pyChat;
|
||||
CPythonTextTail pyTextTail;
|
||||
CPythonNonPlayer pyNonPlayer;
|
||||
CPythonMiniMap pyMiniMap;
|
||||
CPythonEventManager pyEventManager;
|
||||
CPythonBackground pyBackground;
|
||||
CPythonQuest pyQuest;
|
||||
CPythonMessenger pyManager;
|
||||
CPythonSafeBox pySafeBox;
|
||||
CPythonGuild pyGuild;
|
||||
};
|
||||
std::unique_ptr<GameSingletons> g_game_singletons;
|
||||
|
||||
bool fail(std::string* error, const std::string& text)
|
||||
{
|
||||
@@ -225,6 +299,8 @@ bool Start(const char* stdlib_path, std::string* error)
|
||||
g_player = std::make_unique<CPythonPlayer>();
|
||||
g_flying_manager = std::make_unique<CFlyingManager>();
|
||||
g_effect_manager = std::make_unique<CEffectManager>();
|
||||
g_game_application = std::make_unique<GameApplicationAdapter>();
|
||||
g_game_singletons = std::make_unique<GameSingletons>();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,6 +321,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
|
||||
initgrpText();
|
||||
initwndMgr();
|
||||
initapp();
|
||||
initChat();
|
||||
initnet();
|
||||
init_2v0_gameplay_stubs();
|
||||
|
||||
@@ -411,6 +488,8 @@ 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_game_singletons.reset();
|
||||
g_game_application.reset();
|
||||
g_effect_manager.reset();
|
||||
g_flying_manager.reset();
|
||||
g_player.reset();
|
||||
|
||||
Reference in New Issue
Block a user