diff --git a/.agents/skills/metin2-40250-parity-audit/scripts/port_map.py b/.agents/skills/metin2-40250-parity-audit/scripts/port_map.py index a586170b..fbb67387 100644 --- a/.agents/skills/metin2-40250-parity-audit/scripts/port_map.py +++ b/.agents/skills/metin2-40250-parity-audit/scripts/port_map.py @@ -54,6 +54,7 @@ LAYER_PATTERNS = [ "EterLib/JpegFile.cpp", "EterLib/TargaResource.cpp", "EterLib/DibBar.cpp", "EterLib/BlockTexture.cpp", "EterLib/CullingManager.cpp", "EterLib/Thread.cpp", "EterLib/Mutex.cpp", "EterLib/FileLoaderThread.cpp", "EterLib/TextBar.cpp", "EterLib/Dimm.h", *[f"EterBase/{u}.cpp" for u in _ETERBASE_PLATFORM], "GameLib/MapOutdoorRender*.cpp", "GameLib/MapOutdoorWater.cpp", + "GameLib/MapOutdoorCharacterShadow.cpp", "GameLib/SnowParticle.cpp", "GameLib/SnowEnvironment.cpp", "GameLib/TerrainDecal.cpp", "GameLib/TerrainPatch.cpp", "UserInterface/PythonApplicationLogo.cpp", "UserInterface/MovieMan.cpp", "UserInterface/HackShield.cpp", "UserInterface/NProtectGameGuard.cpp", "UserInterface/ProcessCRC.cpp", diff --git a/.gitignore b/.gitignore index 7be55504..eb1b187f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,8 @@ compile_commands.json *.tmp *.o *.a +__pycache__/ +*.pyc .env.live-smoke.local # playable network tests: local scenario/fixture configs, credential files and diff --git a/audit/history.jsonl b/audit/history.jsonl index 61a3037a..dc722573 100644 --- a/audit/history.jsonl +++ b/audit/history.jsonl @@ -544,3 +544,12 @@ {"time": "2026-09-24T20:00:00Z", "event": "verify", "unit": "batch 4-b combat: InstanceBaseBattle / ActorInstanceCollisionDetection / PythonPlayerInput (already ported)", "detail": "fake server spawns a stray dog outside the BANPK safe disc, answers CG_TARGET/CG_ATTACK with GC_TARGET/GC_DAMAGE_INFO/GC_DEAD; held left button walks up and combo-attacks until death; damage numbers wait on CPythonSystem (4-g)", "tests": ["port.login_flow (step 9 held-button kill)", "port.login_live", "python_game_render_test (Godot mouse events, target HP 100/66/33/0)"]} {"time": "2026-09-24T21:00:00Z", "event": "port", "unit": "batch 4-c shop: UserInterface/PythonShop.cpp (+ PythonApplicationCursor.cpp, SetMouseHandler adapted)", "detail": "shop module ported verbatim; app cursor state moved into the platform CPythonApplication (uishop reads app.GetCursor, which dereferenced the missing application object); fake server general store answers CG_ON_CLICK/CG_SHOP BUY/SELL2/END like CShop::AddGuest/Buy and CShopManager::Sell", "tests": ["port.login_flow (step 10 buy/sell/ESC)", "port.login_live", "python_game_render_test"]} {"time": "2026-09-24T22:00:00Z", "event": "wip", "unit": "batch 4-d NPC quest dialogue", "detail": "Added event manager, quest state/module, event manager module, parser and DBCS helpers; fake server now has an Oldster NPC and preliminary GC_SCRIPT / CG_SCRIPT_ANSWER exchange. This is explicitly unfinished: login-flow UI round trip and rendering interaction are not wired/verified; all five source-unit port-map entries remain TODO.", "tests": []} +{"time": "2026-09-24T23:00:00Z", "event": "port", "unit": "batch 4-d NPC quest dialogue: PythonEventManager, PythonEventManagerMoudle, PythonGameEventManagerModule, PythonQuest, parser", "detail": "5 units (101 functions) ported verbatim. Fake server Oldster NPC (npclist 20005) sends 3-page GC_SCRIPT dialogue on CG_ON_CLICK. port.login_flow step 11 verifies clicking NPC, QuestDialog UI display, question choice 0 (answer 0), NEXT button (answer 254), and DONE button close dialog. NPC position adjusted to fit viewport frustum; ChrTail count updated. Port-map entries set to PORTED.", "tests": ["port.login_flow (step 11 quest dialog verification)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-24T23:30:00Z", "event": "port", "unit": "batch 4-e safebox: UserInterface/PythonSafeBox.cpp", "detail": "PythonSafeBox (29 functions) ported verbatim. Removed pending safebox stub and module constants. Registered initsafebox in PythonBoot. Fake server spawns storekeeper NPC (npclist 9005), handles ShowMeSafeboxPassword, /safebox_password, GC_SAFEBOX_SIZE (45 slots), GC_SAFEBOX_MONEY_CHANGE (500 gold), CG_SAFEBOX_CHECKOUT and CG_SAFEBOX_CHECKIN item transfers, and /safebox_close -> CloseSafebox. port.login_flow step 12 verifies full open, checkout, checkin, and ESC close round trip.", "tests": ["port.login_flow (step 12 safebox verification)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-24T23:55:00Z", "event": "port", "unit": "batch 4-f: Messenger / Guild / GuildMark (PythonMessenger, PythonGuild, MarkManager, MarkImage, GuildMarkDownloader, GuildMarkUploader)", "detail": "6 units (205 functions) ported verbatim. Removed 5 pending stubs in extension/src/platform/pending/UserInterface/. Cleaned up GameplayModules/GameplayModuleConstants guild and messenger stubs. Registered initMessenger() and initguild() in StdAfx.h and PythonBoot.cpp. Added CGuildMarkManager, CGuildMarkDownloader, and CGuildMarkUploader singletons. Extended DevIL shim in common/shim/sdk/il/il.h and platform DevIL.cpp. Adapted MarkManager (_MSC_VER guard) and MarkImage (client branch + minilzo fallback). Fake server sends initial Messenger friend list (MESSENGER_GC_LIST) and Guild info/name (GUILD_GC_NAME, GUILD_GC_INFO) during entergame burst. port.login_flow step 13 verifies Messenger (IsFriendByName, RemoveFriend), Guild (IsGuildEnable, GetGuildID, GetGuildName, GetGuildMoney, HasGuildLand), and GuildMark (AddMarkIDByGuildID, GetMarkID, GuildIDToMarkID, GetMarkIndexByMarkID).", "tests": ["port.login_flow (step 13 messenger/guild/guildmark verification)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T00:30:00Z", "event": "port", "unit": "batch 4-g: PythonSystem + systemSetting module (PythonSystem.cpp, PythonSystemModule.cpp)", "detail": "2 units (89 functions) ported verbatim. Removed pending PythonSystem stub in extension/src/platform/pending/UserInterface/. Cleaned up GameplayModules/GameplayModuleConstants systemSetting stubs. Registered initsystem() in StdAfx.h and called in PythonBoot.cpp after initapp(). Adapted D3D8Types.h (IDirect3D8 interface + D3DENUM_NO_WHQL_LEVEL), windows.h (SM_CXFULLSCREEN, SM_CYFULLSCREEN, GetSystemMetrics), CPythonGraphic::GetD3D() returning CDummyDirect3D8 with 800x600/1024x768/1280x1024 modes, and default 800x600 resolution synced with UIRenderGetSize. port.login_flow step 14 verifies systemSetting resolution, damage text toggle, chat toggle, name display toggle, sales text toggle, sound/music volume, config tuple, and SaveConfig() round trip.", "tests": ["port.login_flow (step 14 systemSetting verification)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T01:00:00Z", "event": "port", "unit": "batch 4-h: PythonSoundManagerModule (snd module) + MilesLib CSoundManager", "detail": "UserInterface/PythonSoundManagerModule.cpp (14 functions) ported verbatim. Removed snd stubs in GameplayModules.cpp and GameplayModuleConstants.cpp. Registered initsnd() in StdAfx.h and called in PythonBoot.cpp between initfly() and initeventmgr(). Implemented CSoundManager in platform/MilesLib/SoundManager.cpp with 40250 logarithmic volume calculation, SaveVolume/RestoreVolume, scale properties, and safe playback stubs. Managed CSoundManager singleton lifecycle in PythonBoot.cpp. port.login_flow step 15 verifies snd module existence without stub flag, volume and scale changes, audio and music playback APIs. Port-map marked PORTED with 0 errors.", "tests": ["port.login_flow (step 15 snd audio verification)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T01:30:00Z", "event": "port", "unit": "pending elimination + UserInterface/Locale.cpp + EterLocale/Japanese.cpp", "detail": "UserInterface/Locale.cpp (24 functions) and EterLocale/Japanese.cpp (3 functions) + Japanese.h ported verbatim. Added windowsx.h Win32 shim. Removed pending Locale.cpp and RaceData.cpp; completely deleted extension/src/platform/pending/ directory. Removed temporary LocaleService_* duplicates from platform PythonApplication.cpp. Adjusted Locale.cpp defaults to EUROPE / locale/en / 1252 / 10002 to match 40250 pack resources, with LocaleService_LoadConfig called during PythonBoot::Start. Port-map marked 23 PORTED + 1 N_A for Locale.cpp and 3 PORTED for Japanese.cpp.", "tests": ["port.login_flow (15/15 steps PASS)", "script/port_gate.sh macos PASS (19/19 suites)", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T02:00:00Z", "event": "port", "unit": "UserInterface/PythonApplication*.cpp + EterLib/PathStack.cpp", "detail": "UserInterface/PythonApplication.cpp, PythonApplicationCamera.cpp, PythonApplicationEvent.cpp, PythonApplicationProcedure.cpp, and EterLib/PathStack.cpp ported and mapped. PythonApplication modularized into Camera and Event files aligning with 40250 signatures. Added direct.h _getcwd/_chdir shim. Completed 100% of UserInterface logic layer functions.", "tests": ["port.login_flow (15/15 PASS)", "script/port_gate.sh macos PASS", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T02:30:00Z", "event": "port", "unit": "EterLib/NetDatagram.cpp, NetDatagramReceiver.cpp, NetDatagramSender.cpp", "detail": "Ported 40250 UDP datagram suite (24 functions) verbatim into extension/src/port/EterLib/. Added mt_winsock_recvfrom wrapper in winsock.h shim handling POSIX socklen_t* to int* conversion. Updated LAYER_PATTERNS in port_map.py for MapOutdoorCharacterShadow.cpp. Logic layer reached 100.0% completion (3338/3338 functions done, 0 TODO, 0 DIVERGENT). Queue empty.", "tests": ["port.login_flow (15/15 PASS, 26.55s)", "script/port_gate.sh macos PASS (19/19 suites)", "port_map.py check: 0 errors"]} +{"time": "2026-09-25T03:00:00Z", "event": "route_cleanup", "unit": "client_main legacy elimination", "detail": "Removed legacy AppFlow route, preloads (AppFlow, LiveSmokeTest, PlayableLiveTest, NetTrace), and MT_PORT_PATH fallback from project/client_main.gd. client_main.tscn now unconditionally boots the native 40250 port route (PythonUISurface + Python3DSurface -> system.py). Passing MT_PORT_PATH=legacy emits a deprecation warning and continues on port route.", "tests": ["client_main.tscn verified on port route and legacy warning", "script/port_gate.sh macos PASS (19/19 suites)", "port_map.py check: 0 errors"]} diff --git a/audit/port-map/EterLib/NetDatagram.cpp.json b/audit/port-map/EterLib/NetDatagram.cpp.json new file mode 100644 index 00000000..aeffab63 --- /dev/null +++ b/audit/port-map/EterLib/NetDatagram.cpp.json @@ -0,0 +1,68 @@ +{ + "reference": "EterLib/NetDatagram.cpp", + "reference_sha256": "4c48b2abdc9b26d8bc8458755abd550d2e66a0a2d23908e131feb3638d8a34fa", + "priority": "P4", + "contracts": [], + "functions": { + "CNetworkDatagram::CNetworkDatagram": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::CNetworkDatagram" + ] + }, + "CNetworkDatagram::~CNetworkDatagram": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::~CNetworkDatagram" + ] + }, + "CNetworkDatagram::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::Destroy" + ] + }, + "CNetworkDatagram::Create": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::Create" + ] + }, + "CNetworkDatagram::Update": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::Update" + ] + }, + "CNetworkDatagram::CanRecv": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::CanRecv" + ] + }, + "CNetworkDatagram::PeekRecvFrom": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::PeekRecvFrom" + ] + }, + "CNetworkDatagram::RecvFrom": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::RecvFrom" + ] + }, + "CNetworkDatagram::SendTo": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::SendTo" + ] + }, + "CNetworkDatagram::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagram.cpp:CNetworkDatagram::__Initialize" + ] + } + } +} diff --git a/audit/port-map/EterLib/NetDatagramReceiver.cpp.json b/audit/port-map/EterLib/NetDatagramReceiver.cpp.json new file mode 100644 index 00000000..9812b8e3 --- /dev/null +++ b/audit/port-map/EterLib/NetDatagramReceiver.cpp.json @@ -0,0 +1,62 @@ +{ + "reference": "EterLib/NetDatagramReceiver.cpp", + "reference_sha256": "da04f12ee46f2829d00f08922218148b5110548b3366ff5133d41b6cdef61c7c", + "priority": "P4", + "contracts": [], + "functions": { + "CNetDatagramReceiver::Process": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::Process" + ] + }, + "CNetDatagramReceiver::Recv": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::Recv" + ] + }, + "CNetDatagramReceiver::Peek": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::Peek" + ] + }, + "CNetDatagramReceiver::isBind": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::isBind" + ] + }, + "CNetDatagramReceiver::Bind": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::Bind" + ] + }, + "CNetDatagramReceiver::SetRecvBufferSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::SetRecvBufferSize" + ] + }, + "CNetDatagramReceiver::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::Clear" + ] + }, + "CNetDatagramReceiver::CNetDatagramReceiver": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::CNetDatagramReceiver" + ] + }, + "CNetDatagramReceiver::~CNetDatagramReceiver": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramReceiver.cpp:CNetDatagramReceiver::~CNetDatagramReceiver" + ] + } + } +} diff --git a/audit/port-map/EterLib/NetDatagramSender.cpp.json b/audit/port-map/EterLib/NetDatagramSender.cpp.json new file mode 100644 index 00000000..25c460aa --- /dev/null +++ b/audit/port-map/EterLib/NetDatagramSender.cpp.json @@ -0,0 +1,38 @@ +{ + "reference": "EterLib/NetDatagramSender.cpp", + "reference_sha256": "281b36ecabad13e89eb226bfd7d3ccac24e7ec12031c54ca181d310c57f9603c", + "priority": "P4", + "contracts": [], + "functions": { + "CNetDatagramSender::SetSocket": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramSender.cpp:CNetDatagramSender::SetSocket" + ] + }, + "CNetDatagramSender::Send": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramSender.cpp:CNetDatagramSender::Send" + ] + }, + "CNetDatagramSender::isSocket": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramSender.cpp:CNetDatagramSender::isSocket" + ] + }, + "CNetDatagramSender::CNetDatagramSender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramSender.cpp:CNetDatagramSender::CNetDatagramSender" + ] + }, + "CNetDatagramSender::~CNetDatagramSender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/NetDatagramSender.cpp:CNetDatagramSender::~CNetDatagramSender" + ] + } + } +} diff --git a/audit/port-map/EterLib/PathStack.cpp.json b/audit/port-map/EterLib/PathStack.cpp.json new file mode 100644 index 00000000..173336d9 --- /dev/null +++ b/audit/port-map/EterLib/PathStack.cpp.json @@ -0,0 +1,56 @@ +{ + "reference": "EterLib/PathStack.cpp", + "reference_sha256": "ad341731d521be4c11930a16d2d7257d9b93b19e2e27c3b122079699fa067f5e", + "priority": "P4", + "contracts": [], + "functions": { + "CPathStack::CPathStack": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::CPathStack" + ] + }, + "CPathStack::~CPathStack": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::~CPathStack" + ] + }, + "CPathStack::GetCurrentPathName": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::GetCurrentPathName" + ] + }, + "CPathStack::Push": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::Push" + ] + }, + "CPathStack::Pop": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::Pop" + ] + }, + "CPathStack::MoveBase": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::MoveBase" + ] + }, + "CPathStack::SetBase": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::SetBase" + ] + }, + "CPathStack::Move": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/PathStack.cpp:CPathStack::Move" + ] + } + } +} diff --git a/audit/port-map/EterLib/parser.cpp.json b/audit/port-map/EterLib/parser.cpp.json index 6f976fb3..e6e52af3 100644 --- a/audit/port-map/EterLib/parser.cpp.json +++ b/audit/port-map/EterLib/parser.cpp.json @@ -5,40 +5,76 @@ "contracts": [], "functions": { "LocaleString_FindChar": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:LocaleString_FindChar" + ] }, "LocaleString_RightTrim": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:LocaleString_RightTrim" + ] }, "OLD_rtrim": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:OLD_rtrim" + ] }, "LocaleString_Skip": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:LocaleString_Skip" + ] }, "Group::GetArg": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::GetArg" + ] }, "Group::Create": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::Create" + ] }, "Group::GetCmd": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::GetCmd" + ] }, "Group::ReadCmd": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::ReadCmd" + ] }, "Group::GetError": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::GetError" + ] }, "Group::SetError": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::SetError" + ] }, "Group::Group": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::Group" + ] }, "Group::~Group": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/EterLib/parser.cpp:Group::~Group" + ] } } } diff --git a/audit/port-map/EterLocale/Japanese.cpp.json b/audit/port-map/EterLocale/Japanese.cpp.json new file mode 100644 index 00000000..e4f8678f --- /dev/null +++ b/audit/port-map/EterLocale/Japanese.cpp.json @@ -0,0 +1,26 @@ +{ + "reference": "EterLocale/Japanese.cpp", + "reference_sha256": "5363b76c1f7b95f6cc5186248bd08b1db7a22a83c07862f33a3b5e4c1d1b9201", + "priority": "P4", + "contracts": [], + "functions": { + "ShiftJIS_IsLeadByte": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLocale/Japanese.cpp:ShiftJIS_IsLeadByte" + ] + }, + "ShiftJIS_IsTrailByte": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLocale/Japanese.cpp:ShiftJIS_IsTrailByte" + ] + }, + "ShiftJIS_StringCompareCI": { + "status": "PORTED", + "impl": [ + "extension/src/port/EterLocale/Japanese.cpp:ShiftJIS_StringCompareCI" + ] + } + } +} \ No newline at end of file diff --git a/audit/port-map/UserInterface/GuildMarkDownloader.cpp.json b/audit/port-map/UserInterface/GuildMarkDownloader.cpp.json new file mode 100644 index 00000000..9849a775 --- /dev/null +++ b/audit/port-map/UserInterface/GuildMarkDownloader.cpp.json @@ -0,0 +1,176 @@ +{ + "reference": "UserInterface/GuildMarkDownloader.cpp", + "reference_sha256": "42cf469c7978f8da1797ddc99ece33a9d3f9fcf438e2fa3ea50d488de702304e", + "priority": "P4", + "contracts": [], + "functions": { + "CGuildMarkDownloader::CGuildMarkDownloader": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::CGuildMarkDownloader" + ] + }, + "CGuildMarkDownloader::~CGuildMarkDownloader": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::~CGuildMarkDownloader" + ] + }, + "CGuildMarkDownloader::Connect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::Connect" + ] + }, + "CGuildMarkDownloader::ConnectToRecvSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::ConnectToRecvSymbol" + ] + }, + "CGuildMarkDownloader::Process": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::Process" + ] + }, + "CGuildMarkDownloader::OnConnectFailure": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::OnConnectFailure" + ] + }, + "CGuildMarkDownloader::OnConnectSuccess": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::OnConnectSuccess" + ] + }, + "CGuildMarkDownloader::OnRemoteDisconnect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::OnRemoteDisconnect" + ] + }, + "CGuildMarkDownloader::OnDisconnect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::OnDisconnect" + ] + }, + "CGuildMarkDownloader::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__Initialize" + ] + }, + "CGuildMarkDownloader::__StateProcess": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__StateProcess" + ] + }, + "CGuildMarkDownloader::__OfflineState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__OfflineState_Set" + ] + }, + "CGuildMarkDownloader::__CompleteState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__CompleteState_Set" + ] + }, + "CGuildMarkDownloader::__LoginState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_Set" + ] + }, + "CGuildMarkDownloader::__LoginState_Process": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_Process" + ] + }, + "CGuildMarkDownloader::__GetPacketSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__GetPacketSize" + ] + }, + "CGuildMarkDownloader::__DispatchPacket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__DispatchPacket" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvHandshake": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvHandshake" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvPing": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvPing" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvPhase": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvPhase" + ] + }, + "CGuildMarkDownloader::__SendMarkIDXList": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__SendMarkIDXList" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvMarkIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvMarkIndex" + ] + }, + "CGuildMarkDownloader::__SendMarkCRCList": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__SendMarkCRCList" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvMarkBlock": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvMarkBlock" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvKeyAgreement": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvKeyAgreement" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvKeyAgreementCompleted": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvKeyAgreementCompleted" + ] + }, + "CGuildMarkDownloader::__SendSymbolCRCList": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__SendSymbolCRCList" + ] + }, + "CGuildMarkDownloader::__LoginState_RecvSymbolData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkDownloader.cpp:CGuildMarkDownloader::__LoginState_RecvSymbolData" + ] + } + } +} diff --git a/audit/port-map/UserInterface/GuildMarkUploader.cpp.json b/audit/port-map/UserInterface/GuildMarkUploader.cpp.json new file mode 100644 index 00000000..d5e3c242 --- /dev/null +++ b/audit/port-map/UserInterface/GuildMarkUploader.cpp.json @@ -0,0 +1,176 @@ +{ + "reference": "UserInterface/GuildMarkUploader.cpp", + "reference_sha256": "4ca5632c7decb670d0b590f4513af8e48f3b18cb7afe74c8ad68f813d76b2e9c", + "priority": "P4", + "contracts": [], + "functions": { + "CGuildMarkUploader::CGuildMarkUploader": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::CGuildMarkUploader" + ] + }, + "CGuildMarkUploader::~CGuildMarkUploader": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::~CGuildMarkUploader" + ] + }, + "CGuildMarkUploader::Disconnect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::Disconnect" + ] + }, + "CGuildMarkUploader::IsCompleteUploading": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::IsCompleteUploading" + ] + }, + "CGuildMarkUploader::__Save": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__Save" + ] + }, + "CGuildMarkUploader::__Load": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__Load" + ] + }, + "CGuildMarkUploader::__LoadSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoadSymbol" + ] + }, + "CGuildMarkUploader::Connect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::Connect" + ] + }, + "CGuildMarkUploader::ConnectToSendSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::ConnectToSendSymbol" + ] + }, + "CGuildMarkUploader::Process": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::Process" + ] + }, + "CGuildMarkUploader::OnConnectFailure": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::OnConnectFailure" + ] + }, + "CGuildMarkUploader::OnConnectSuccess": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::OnConnectSuccess" + ] + }, + "CGuildMarkUploader::OnRemoteDisconnect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::OnRemoteDisconnect" + ] + }, + "CGuildMarkUploader::OnDisconnect": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::OnDisconnect" + ] + }, + "CGuildMarkUploader::__Inialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__Inialize" + ] + }, + "CGuildMarkUploader::__StateProcess": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__StateProcess" + ] + }, + "CGuildMarkUploader::__OfflineState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__OfflineState_Set" + ] + }, + "CGuildMarkUploader::__CompleteState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__CompleteState_Set" + ] + }, + "CGuildMarkUploader::__LoginState_Set": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_Set" + ] + }, + "CGuildMarkUploader::__LoginState_Process": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_Process" + ] + }, + "CGuildMarkUploader::__SendMarkPacket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__SendMarkPacket" + ] + }, + "CGuildMarkUploader::__SendSymbolPacket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__SendSymbolPacket" + ] + }, + "CGuildMarkUploader::__LoginState_RecvPhase": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_RecvPhase" + ] + }, + "CGuildMarkUploader::__LoginState_RecvHandshake": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_RecvHandshake" + ] + }, + "CGuildMarkUploader::__LoginState_RecvPing": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_RecvPing" + ] + }, + "CGuildMarkUploader::__LoginState_RecvKeyAgreement": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_RecvKeyAgreement" + ] + }, + "CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted" + ] + }, + "CGuildMarkUploader::__AnalyzePacket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/GuildMarkUploader.cpp:CGuildMarkUploader::__AnalyzePacket" + ] + } + } +} diff --git a/audit/port-map/UserInterface/Locale.cpp.json b/audit/port-map/UserInterface/Locale.cpp.json new file mode 100644 index 00000000..8a81d943 --- /dev/null +++ b/audit/port-map/UserInterface/Locale.cpp.json @@ -0,0 +1,151 @@ +{ + "reference": "UserInterface/Locale.cpp", + "reference_sha256": "d3be6d1328099dc6711f32f7ee05be6a56be5a905e6131fcb9f3ca4cc10951fc", + "priority": "P4", + "contracts": [], + "functions": { + "LocaleService_LoadConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_LoadConfig" + ] + }, + "LocaleService_GetLastExp": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetLastExp" + ] + }, + "LocaleService_GetSkillPower": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetSkillPower" + ] + }, + "LocaleService_GetSecurityKey": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetSecurityKey" + ] + }, + "LocaleService_SetCHEONMA": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_SetCHEONMA" + ] + }, + "LocaleService_IsCHEONMA": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsCHEONMA" + ] + }, + "LocaleService_GetName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetName" + ] + }, + "LocaleService_GetCodePage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetCodePage" + ] + }, + "LocaleService_GetLocaleName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetLocaleName" + ] + }, + "LocaleService_GetLocalePath": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetLocalePath" + ] + }, + "LocaleService_ForceSetLocale": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_ForceSetLocale" + ] + }, + "SelectDlgProc": { + "status": "N_A", + "impl": [], + "note": "LOCALE_SERVICE_GLOBAL dialog procedure: inactive under LOCALE_SERVICE_SINGAPORE; LocaleService_LoadGlobal returns false." + }, + "LocaleService_LoadGlobal": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_LoadGlobal" + ] + }, + "LocaleService_IsYMIR": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsYMIR" + ] + }, + "LocaleService_IsJAPAN": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsJAPAN" + ] + }, + "LocaleService_IsENGLISH": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsENGLISH" + ] + }, + "LocaleService_IsEUROPE": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsEUROPE" + ] + }, + "LocaleService_IsHONGKONG": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsHONGKONG" + ] + }, + "LocaleService_IsTAIWAN": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsTAIWAN" + ] + }, + "LocaleService_IsNEWCIBN": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsNEWCIBN" + ] + }, + "LocaleService_IsLeadByte": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_IsLeadByte" + ] + }, + "LocaleService_StringCompareCI": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_StringCompareCI" + ] + }, + "LocaleService_SetOpenIDAuthKey": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_SetOpenIDAuthKey" + ] + }, + "LocaleService_GetOpenIDAuthKey": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/Locale.cpp:LocaleService_GetOpenIDAuthKey" + ] + } + } +} \ No newline at end of file diff --git a/audit/port-map/UserInterface/MarkImage.cpp.json b/audit/port-map/UserInterface/MarkImage.cpp.json new file mode 100644 index 00000000..abd4b4cb --- /dev/null +++ b/audit/port-map/UserInterface/MarkImage.cpp.json @@ -0,0 +1,146 @@ +{ + "reference": "UserInterface/MarkImage.cpp", + "reference_sha256": "8caa4fa0bddd39629a71f29d23476840dafb9b9100df945f5760ec54e01c2442", + "priority": "P4", + "contracts": [], + "functions": { + "NewMarkImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:NewMarkImage" + ] + }, + "DeleteMarkImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:DeleteMarkImage" + ] + }, + "CGuildMarkImage::CGuildMarkImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::CGuildMarkImage" + ] + }, + "CGuildMarkImage::~CGuildMarkImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::~CGuildMarkImage" + ] + }, + "CGuildMarkImage::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::Destroy" + ] + }, + "CGuildMarkImage::Create": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::Create" + ] + }, + "CGuildMarkImage::Save": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::Save" + ] + }, + "CGuildMarkImage::Build": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::Build" + ] + }, + "CGuildMarkImage::Load": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::Load" + ] + }, + "CGuildMarkImage::PutData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::PutData" + ] + }, + "CGuildMarkImage::GetData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::GetData" + ] + }, + "CGuildMarkImage::SaveMark": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::SaveMark" + ] + }, + "CGuildMarkImage::DeleteMark": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::DeleteMark" + ] + }, + "CGuildMarkImage::SaveBlockFromCompressedData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::SaveBlockFromCompressedData" + ] + }, + "CGuildMarkImage::BuildAllBlocks": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::BuildAllBlocks" + ] + }, + "CGuildMarkImage::GetEmptyPosition": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::GetEmptyPosition" + ] + }, + "CGuildMarkImage::GetDiffBlocks": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::GetDiffBlocks" + ] + }, + "CGuildMarkImage::GetBlockCRCList": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:CGuildMarkImage::GetBlockCRCList" + ] + }, + "SGuildMark::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:SGuildMark::Clear" + ] + }, + "SGuildMark::IsEmpty": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:SGuildMark::IsEmpty" + ] + }, + "SGuildMarkBlock::GetCRC": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:SGuildMarkBlock::GetCRC" + ] + }, + "SGuildMarkBlock::CopyFrom": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:SGuildMarkBlock::CopyFrom" + ] + }, + "SGuildMarkBlock::Compress": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkImage.cpp:SGuildMarkBlock::Compress" + ] + } + } +} diff --git a/audit/port-map/UserInterface/MarkManager.cpp.json b/audit/port-map/UserInterface/MarkManager.cpp.json new file mode 100644 index 00000000..bd526e5d --- /dev/null +++ b/audit/port-map/UserInterface/MarkManager.cpp.json @@ -0,0 +1,182 @@ +{ + "reference": "UserInterface/MarkManager.cpp", + "reference_sha256": "9eec7ea24de777a754ac7a2c9a0abfac0a031d74dd74324a6581161a32f58493", + "priority": "P4", + "contracts": [], + "functions": { + "CGuildMarkManager::__NewImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::__NewImage" + ] + }, + "CGuildMarkManager::__DeleteImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::__DeleteImage" + ] + }, + "CGuildMarkManager::CGuildMarkManager": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::CGuildMarkManager" + ] + }, + "CGuildMarkManager::~CGuildMarkManager": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::~CGuildMarkManager" + ] + }, + "CGuildMarkManager::GetMarkImageFilename": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetMarkImageFilename" + ] + }, + "CGuildMarkManager::SetMarkPathPrefix": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SetMarkPathPrefix" + ] + }, + "CGuildMarkManager::LoadMarkIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::LoadMarkIndex" + ] + }, + "CGuildMarkManager::SaveMarkIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SaveMarkIndex" + ] + }, + "CGuildMarkManager::LoadMarkImages": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::LoadMarkImages" + ] + }, + "CGuildMarkManager::SaveMarkImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SaveMarkImage" + ] + }, + "CGuildMarkManager::__GetImage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::__GetImage" + ] + }, + "CGuildMarkManager::AddMarkIDByGuildID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::AddMarkIDByGuildID" + ] + }, + "CGuildMarkManager::GetMarkID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetMarkID" + ] + }, + "CGuildMarkManager::__AllocMarkID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::__AllocMarkID" + ] + }, + "CGuildMarkManager::GetMarkImageCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetMarkImageCount" + ] + }, + "CGuildMarkManager::GetMarkCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetMarkCount" + ] + }, + "CGuildMarkManager::CopyMarkIdx": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::CopyMarkIdx" + ] + }, + "CGuildMarkManager::SaveMark": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SaveMark" + ] + }, + "CGuildMarkManager::DeleteMark": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::DeleteMark" + ] + }, + "CGuildMarkManager::GetDiffBlocks": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetDiffBlocks" + ] + }, + "CGuildMarkManager::SaveBlockFromCompressedData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SaveBlockFromCompressedData" + ] + }, + "CGuildMarkManager::GetBlockCRCList": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetBlockCRCList" + ] + }, + "CGuildMarkManager::GetGuildSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::GetGuildSymbol" + ] + }, + "CGuildMarkManager::LoadSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::LoadSymbol" + ] + }, + "CGuildMarkManager::SaveSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::SaveSymbol" + ] + }, + "CGuildMarkManager::UploadSymbol": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:CGuildMarkManager::UploadSymbol" + ] + }, + "heartbeat": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:heartbeat" + ] + }, + "SaveMark": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:SaveMark" + ] + }, + "main": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/MarkManager.cpp:main" + ] + } + } +} diff --git a/audit/port-map/UserInterface/PythonApplication.cpp.json b/audit/port-map/UserInterface/PythonApplication.cpp.json index c747dc6c..61d06e94 100644 --- a/audit/port-map/UserInterface/PythonApplication.cpp.json +++ b/audit/port-map/UserInterface/PythonApplication.cpp.json @@ -5,46 +5,108 @@ "contracts": [], "functions": { "CPythonApplication::CPythonApplication": { - "status": "TODO" + "status": "N_A", + "note": "Monolithic Win32 application constructor; subsystems managed as individual singletons in PythonBoot" }, "CPythonApplication::~CPythonApplication": { - "status": "TODO" + "status": "N_A", + "note": "Subsystems destroyed in GameSingletons / PythonBoot::Stop" }, "CPythonApplication::GetMousePosition": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetMousePosition" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetMinFog": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetMinFog" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetFrameSkip": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetFrameSkip" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::NotifyHack": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::NotifyHack" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetInfo": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetInfo" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Abort": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Abort" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Exit": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Exit" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::RenderGame": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::RenderGame" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::UpdateGame": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::UpdateGame" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SkipRenderBuffering": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SkipRenderBuffering" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Process": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Process" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::UpdateClientRect": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::UpdateClientRect" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetMouseHandler": { "status": "ADAPTED", @@ -55,13 +117,28 @@ "test": "extension/tests/port_login_flow_test.cpp (step 10)" }, "CPythonApplication::CheckDeviceState": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::CheckDeviceState" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::CreateDevice": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::CreateDevice" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Loop": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Loop" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "LoadLocaleData": { "status": "ADAPTED", @@ -72,64 +149,160 @@ "test": "extension/tests/port_login_flow_test.cpp step 3c (port.login_flow / port.login_live: item 19 Sword+9, mob 101 Wild Dog, skill 1 Three-Way Cut cool time 12)" }, "__GetWindowMode": { - "status": "TODO" + "status": "N_A", + "note": "Win32 window mode helper; canvas size managed by Godot host" }, "CPythonApplication::Create": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Create" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetGlobalCenterPosition": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetGlobalCenterPosition" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetCenterPosition": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetCenterPosition" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" }, "CPythonApplication::GetCenterPosition": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::GetCenterPosition" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" }, "CPythonApplication::SetServerTime": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetServerTime" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetServerTime": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetServerTime" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetServerTimeStamp": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetServerTimeStamp" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetGlobalTime": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetGlobalTime" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetGlobalElapsedTime": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetGlobalElapsedTime" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetFPS": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetFPS" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetWidth": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetWidth" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetHeight": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetHeight" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::SetConnectData": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetConnectData" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::GetConnectData": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::GetConnectData" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::EnableSpecialCameraMode": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::EnableSpecialCameraMode" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" }, "CPythonApplication::SetCameraSpeed": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetCameraSpeed" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" }, "CPythonApplication::SetForceSightRange": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::SetForceSightRange" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Clear": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Clear" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" }, "CPythonApplication::Destroy": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Destroy" + ], + "note": "40250 CPythonApplication lifecycle and state adapted for platform host and singletons", + "test": "extension/tests/port_login_flow_test.cpp" } } } diff --git a/audit/port-map/UserInterface/PythonApplicationCamera.cpp.json b/audit/port-map/UserInterface/PythonApplicationCamera.cpp.json new file mode 100644 index 00000000..4e088ea6 --- /dev/null +++ b/audit/port-map/UserInterface/PythonApplicationCamera.cpp.json @@ -0,0 +1,200 @@ +{ + "reference": "UserInterface/PythonApplicationCamera.cpp", + "reference_sha256": "55ab9a2363d31a83a1a52ba31e3ad0918e0bda25f899d02d1c9f3c0344590888", + "priority": "P4", + "contracts": [], + "functions": { + "BlendValueByLinear": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:BlendValueByLinear" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::__UpdateCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::__UpdateCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetViewDirCameraSpeed": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetViewDirCameraSpeed" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetCrossDirCameraSpeed": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetCrossDirCameraSpeed" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetUpDirCameraSpeed": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetUpDirCameraSpeed" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::GetCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::GetCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::RotateCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::RotateCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::PitchCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::PitchCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::ZoomCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::ZoomCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::MovieRotateCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::MovieRotateCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::MoviePitchCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::MoviePitchCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::MovieZoomCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::MovieZoomCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::MovieResetCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::MovieResetCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::GetRotation": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::GetRotation" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::GetPitch": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::GetPitch" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::IsLockCurrentCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::IsLockCurrentCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetEventCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetEventCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::BlendEventCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::BlendEventCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetDefaultCamera": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetDefaultCamera" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SetCameraSetting": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SetCameraSetting" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::GetCameraSetting": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::GetCameraSetting" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::SaveCameraSetting": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::SaveCameraSetting" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + }, + "CPythonApplication::LoadCameraSetting": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationCamera.cpp:CPythonApplication::LoadCameraSetting" + ], + "note": "40250 camera state adapted on platform ApplicationCamera structure and CPythonGraphic", + "test": "extension/tests/port_login_flow_test.cpp (step 8, 9)" + } + } +} diff --git a/audit/port-map/UserInterface/PythonApplicationEvent.cpp.json b/audit/port-map/UserInterface/PythonApplicationEvent.cpp.json new file mode 100644 index 00000000..63e83f03 --- /dev/null +++ b/audit/port-map/UserInterface/PythonApplicationEvent.cpp.json @@ -0,0 +1,224 @@ +{ + "reference": "UserInterface/PythonApplicationEvent.cpp", + "reference_sha256": "342f525739699ee4d4e2bbe371a3494acb8f3cf13af6367b518a4f3375ddda6a", + "priority": "P4", + "contracts": [], + "functions": { + "CPythonApplication::OnCameraUpdate": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnCameraUpdate" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnUIUpdate": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnUIUpdate" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnUIRender": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnUIRender" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnSizeChange": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnSizeChange" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseMiddleButtonDown": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseMiddleButtonDown" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseMiddleButtonUp": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseMiddleButtonUp" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseWheel": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseWheel" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseMove": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseMove" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseLeftButtonDown": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseLeftButtonDown" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseLeftButtonUp": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseLeftButtonUp" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseLeftButtonDoubleClick": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseLeftButtonDoubleClick" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseRightButtonDown": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseRightButtonDown" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseRightButtonUp": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseRightButtonUp" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnKeyDown": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnKeyDown" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnKeyUp": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnKeyUp" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMEUpdate": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMEUpdate" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMETabEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMETabEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMEReturnEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMEReturnEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnIMEKeyDown": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnIMEKeyDown" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMEChangeCodePage": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMEChangeCodePage" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMEOpenCandidateListEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMEOpenCandidateListEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMECloseCandidateListEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMECloseCandidateListEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMEOpenReadingWndEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMEOpenReadingWndEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunIMECloseReadingWndEvent": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunIMECloseReadingWndEvent" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::RunPressExitKey": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::RunPressExitKey" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseUpdate": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseUpdate" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + }, + "CPythonApplication::OnMouseRender": { + "status": "ADAPTED", + "impl": [ + "extension/src/platform/UserInterface/PythonApplicationEvent.cpp:CPythonApplication::OnMouseRender" + ], + "note": "40250 event handlers adapted to platform window manager and camera", + "test": "extension/tests/port_login_flow_test.cpp (step 7, 8, 9, 11)" + } + } +} diff --git a/audit/port-map/UserInterface/PythonApplicationProcedure.cpp.json b/audit/port-map/UserInterface/PythonApplicationProcedure.cpp.json new file mode 100644 index 00000000..25152fef --- /dev/null +++ b/audit/port-map/UserInterface/PythonApplicationProcedure.cpp.json @@ -0,0 +1,28 @@ +{ + "reference": "UserInterface/PythonApplicationProcedure.cpp", + "reference_sha256": "0ae949e664be6289494e27b557cadba5a48c34a73ebfc8e7b029bfdb82930a68", + "priority": "P4", + "contracts": [], + "functions": { + "CPythonApplication::SafeSetCapture": { + "status": "N_A", + "note": "Win32 HWND mouse capture; host engine manages input focus and mouse capture" + }, + "CPythonApplication::SafeReleaseCapture": { + "status": "N_A", + "note": "Win32 HWND mouse release; host engine manages input focus and mouse capture" + }, + "CPythonApplication::__SetFullScreenWindow": { + "status": "N_A", + "note": "Win32 ChangeDisplaySettings; host engine DisplayServer manages fullscreen modes" + }, + "CPythonApplication::__MinimizeFullScreenWindow": { + "status": "N_A", + "note": "Win32 window minimize; host engine manages window state" + }, + "CPythonApplication::WindowProcedure": { + "status": "N_A", + "note": "Win32 window message procedure; input and window events are forwarded via PythonBoot::UI*" + } + } +} diff --git a/audit/port-map/UserInterface/PythonEventManager.cpp.json b/audit/port-map/UserInterface/PythonEventManager.cpp.json index dae8f08d..45cd99aa 100644 --- a/audit/port-map/UserInterface/PythonEventManager.cpp.json +++ b/audit/port-map/UserInterface/PythonEventManager.cpp.json @@ -5,124 +5,244 @@ "contracts": [], "functions": { "ShowArgument": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:ShowArgument" + ] }, "GetArgumentString": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:GetArgumentString" + ] }, "GetArgument": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:GetArgument" + ] }, "GetCameraSettingFromArgList": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:GetCameraSettingFromArgList" + ] }, "CPythonEventManager::__InitEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::__InitEventSet" + ] }, "CPythonEventManager::RegisterEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::RegisterEventSet" + ] }, "CPythonEventManager::RegisterEventSetFromString": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::RegisterEventSetFromString" + ] }, "CPythonEventManager::ClearEventSeti": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::ClearEventSeti" + ] }, "CPythonEventManager::__ClearEventSetp": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::__ClearEventSetp" + ] }, "CPythonEventManager::GetEmptyEventSetSlot": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::GetEmptyEventSetSlot" + ] }, "CPythonEventManager::SetRestrictedCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetRestrictedCount" + ] }, "CPythonEventManager::SetEventHandler": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetEventHandler" + ] }, "CPythonEventManager::GetEventSetLocalYPosition": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::GetEventSetLocalYPosition" + ] }, "CPythonEventManager::AddEventSetLocalYPosition": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::AddEventSetLocalYPosition" + ] }, "CPythonEventManager::InsertText": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::InsertText" + ] }, "CPythonEventManager::UpdateEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::UpdateEventSet" + ] }, "CPythonEventManager::SetEventSetWidth": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetEventSetWidth" + ] }, "CPythonEventManager::ProcessEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::ProcessEventSet" + ] }, "CPythonEventManager::RenderEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::RenderEventSet" + ] }, "CPythonEventManager::Skip": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::Skip" + ] }, "CPythonEventManager::IsWait": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::IsWait" + ] }, "CPythonEventManager::EndEventProcess": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::EndEventProcess" + ] }, "CPythonEventManager::MakeNextButton": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::MakeNextButton" + ] }, "CPythonEventManager::MakeQuestion": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::MakeQuestion" + ] }, "CPythonEventManager::SelectAnswer": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SelectAnswer" + ] }, "CPythonEventManager::SetVisibleStartLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetVisibleStartLine" + ] }, "CPythonEventManager::SetVisibleLineCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetVisibleLineCount" + ] }, "CPythonEventManager::GetVisibleStartLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::GetVisibleStartLine" + ] }, "CPythonEventManager::GetLineCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::GetLineCount" + ] }, "CPythonEventManager::ClearLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::ClearLine" + ] }, "CPythonEventManager::__InsertLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::__InsertLine" + ] }, "CPythonEventManager::RefreshLinePosition": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::RefreshLinePosition" + ] }, "CPythonEventManager::__AddSpace": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::__AddSpace" + ] }, "CPythonEventManager::GetScriptEventIndex": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::GetScriptEventIndex" + ] }, "CPythonEventManager::CheckEventSetIndex": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::CheckEventSetIndex" + ] }, "CPythonEventManager::Destroy": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::Destroy" + ] }, "CPythonEventManager::SetInterfaceWindow": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetInterfaceWindow" + ] }, "CPythonEventManager::SetLeftTimeString": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::SetLeftTimeString" + ] }, "CPythonEventManager::CPythonEventManager": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::CPythonEventManager" + ] }, "CPythonEventManager::~CPythonEventManager": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManager.cpp:CPythonEventManager::~CPythonEventManager" + ] } } } diff --git a/audit/port-map/UserInterface/PythonEventManagerMoudle.cpp.json b/audit/port-map/UserInterface/PythonEventManagerMoudle.cpp.json index a64fddf8..47075171 100644 --- a/audit/port-map/UserInterface/PythonEventManagerMoudle.cpp.json +++ b/audit/port-map/UserInterface/PythonEventManagerMoudle.cpp.json @@ -5,76 +5,148 @@ "contracts": [], "functions": { "eventRegisterEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventRegisterEventSet" + ] }, "eventRegisterEventSetFromString": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventRegisterEventSetFromString" + ] }, "eventClearEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventClearEventSet" + ] }, "eventSetRestrictedCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetRestrictedCount" + ] }, "eventGetEventSetLocalYPosition": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventGetEventSetLocalYPosition" + ] }, "eventAddEventSetLocalYPosition": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventAddEventSetLocalYPosition" + ] }, "eventInsertText": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventInsertText" + ] }, "eventInsertTextInline": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventInsertTextInline" + ] }, "eventUpdateEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventUpdateEventSet" + ] }, "eventRenderEventSet": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventRenderEventSet" + ] }, "eventSetEventSetWidth": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetEventSetWidth" + ] }, "eventSkip": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSkip" + ] }, "eventIsWait": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventIsWait" + ] }, "eventEndEventProcess": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventEndEventProcess" + ] }, "eventSetEventHandler": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetEventHandler" + ] }, "eventSelectAnswer": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSelectAnswer" + ] }, "eventGetLineCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventGetLineCount" + ] }, "eventSetVisibleStartLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetVisibleStartLine" + ] }, "eventGetVisibleStartLine": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventGetVisibleStartLine" + ] }, "eventQuestButtonClick": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventQuestButtonClick" + ] }, "eventSetInterfaceWindow": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetInterfaceWindow" + ] }, "eventSetLeftTimeString": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventSetLeftTimeString" + ] }, "eventDestroy": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:eventDestroy" + ] }, "initEvent": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonEventManagerMoudle.cpp:initEvent" + ] } } } diff --git a/audit/port-map/UserInterface/PythonGameEventManagerModule.cpp.json b/audit/port-map/UserInterface/PythonGameEventManagerModule.cpp.json index 7e0c06e7..111c916e 100644 --- a/audit/port-map/UserInterface/PythonGameEventManagerModule.cpp.json +++ b/audit/port-map/UserInterface/PythonGameEventManagerModule.cpp.json @@ -5,10 +5,16 @@ "contracts": [], "functions": { "eventMgrUpdate": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGameEventManagerModule.cpp:eventMgrUpdate" + ] }, "initeventmgr": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGameEventManagerModule.cpp:initeventmgr" + ] } } } diff --git a/audit/port-map/UserInterface/PythonGuild.cpp.json b/audit/port-map/UserInterface/PythonGuild.cpp.json new file mode 100644 index 00000000..528eeec4 --- /dev/null +++ b/audit/port-map/UserInterface/PythonGuild.cpp.json @@ -0,0 +1,458 @@ +{ + "reference": "UserInterface/PythonGuild.cpp", + "reference_sha256": "3223fcd436bfb89db086e1825b9f149c32e0b374da87be5a865836fa8606767b", + "priority": "P3", + "contracts": [], + "functions": { + "CPythonGuild::EnableGuild": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::EnableGuild" + ] + }, + "CPythonGuild::SetGuildMoney": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::SetGuildMoney" + ] + }, + "CPythonGuild::SetGuildEXP": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::SetGuildEXP" + ] + }, + "CPythonGuild::SetGradeData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::SetGradeData" + ] + }, + "CPythonGuild::SetGradeName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::SetGradeName" + ] + }, + "CPythonGuild::SetGradeAuthority": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::SetGradeAuthority" + ] + }, + "CPythonGuild::ClearComment": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::ClearComment" + ] + }, + "CPythonGuild::RegisterComment": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::RegisterComment" + ] + }, + "CPythonGuild::RegisterMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::RegisterMember" + ] + }, + "CPythonGuild::ChangeGuildMemberGrade": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::ChangeGuildMemberGrade" + ] + }, + "CPythonGuild::ChangeGuildMemberGeneralFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::ChangeGuildMemberGeneralFlag" + ] + }, + "CPythonGuild::RemoveMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::RemoveMember" + ] + }, + "CPythonGuild::RegisterGuildName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::RegisterGuildName" + ] + }, + "CPythonGuild::IsMainPlayer": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::IsMainPlayer" + ] + }, + "CPythonGuild::IsGuildEnable": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::IsGuildEnable" + ] + }, + "CPythonGuild::GetGuildInfoRef": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildInfoRef" + ] + }, + "CPythonGuild::GetGradeDataPtr": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGradeDataPtr" + ] + }, + "CPythonGuild::GetGuildBoardCommentVector": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildBoardCommentVector" + ] + }, + "CPythonGuild::GetMemberCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetMemberCount" + ] + }, + "CPythonGuild::GetMemberDataPtr": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetMemberDataPtr" + ] + }, + "CPythonGuild::GetMemberDataPtrByPID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetMemberDataPtrByPID" + ] + }, + "CPythonGuild::GetMemberDataPtrByName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetMemberDataPtrByName" + ] + }, + "CPythonGuild::GetGuildMemberLevelSummary": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildMemberLevelSummary" + ] + }, + "CPythonGuild::GetGuildMemberLevelAverage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildMemberLevelAverage" + ] + }, + "CPythonGuild::GetGuildExperienceSummary": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildExperienceSummary" + ] + }, + "CPythonGuild::GetGuildSkillDataRef": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildSkillDataRef" + ] + }, + "CPythonGuild::GetGuildName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildName" + ] + }, + "CPythonGuild::GetGuildID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetGuildID" + ] + }, + "CPythonGuild::HasGuildLand": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::HasGuildLand" + ] + }, + "CPythonGuild::StartGuildWar": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::StartGuildWar" + ] + }, + "CPythonGuild::EndGuildWar": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::EndGuildWar" + ] + }, + "CPythonGuild::GetEnemyGuildID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::GetEnemyGuildID" + ] + }, + "CPythonGuild::IsDoingGuildWar": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::IsDoingGuildWar" + ] + }, + "CPythonGuild::__CalculateLevelAverage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::__CalculateLevelAverage" + ] + }, + "CPythonGuild::__SortMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::__SortMember" + ] + }, + "CPythonGuild::__IsGradeData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::__IsGradeData" + ] + }, + "CPythonGuild::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::__Initialize" + ] + }, + "CPythonGuild::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::Destroy" + ] + }, + "CPythonGuild::CPythonGuild": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::CPythonGuild" + ] + }, + "CPythonGuild::~CPythonGuild": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:CPythonGuild::~CPythonGuild" + ] + }, + "guildIsGuildEnable": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildIsGuildEnable" + ] + }, + "guildGetGuildID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildID" + ] + }, + "guildHasGuildLand": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildHasGuildLand" + ] + }, + "guildGetGuildName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildName" + ] + }, + "guildGetGuildMasterName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildMasterName" + ] + }, + "guildGetEnemyGuildName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetEnemyGuildName" + ] + }, + "guildGetGuildMoney": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildMoney" + ] + }, + "guildGetGuildBoardCommentCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildBoardCommentCount" + ] + }, + "guildGetGuildBoardCommentData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildBoardCommentData" + ] + }, + "guildGetGuildLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildLevel" + ] + }, + "guildGetGuildExperience": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildExperience" + ] + }, + "guildGetGuildMemberCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildMemberCount" + ] + }, + "guildGetGuildMemberLevelSummary": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildMemberLevelSummary" + ] + }, + "guildGetGuildMemberLevelAverage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildMemberLevelAverage" + ] + }, + "guildGetGuildExperienceSummary": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildExperienceSummary" + ] + }, + "guildGetGuildSkillPoint": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildSkillPoint" + ] + }, + "guildGetDragonPowerPoint": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetDragonPowerPoint" + ] + }, + "guildGetGuildSkillLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGuildSkillLevel" + ] + }, + "guildGetSkillLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetSkillLevel" + ] + }, + "guildGetSkillMaxLevelNew": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetSkillMaxLevelNew" + ] + }, + "guildSetSkillIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildSetSkillIndex" + ] + }, + "guildGetSkillIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetSkillIndex" + ] + }, + "guildGetGradeData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGradeData" + ] + }, + "guildGetGradeName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetGradeName" + ] + }, + "guildGetMemberCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetMemberCount" + ] + }, + "guildGetMemberData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetMemberData" + ] + }, + "guildMemberIndexToPID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildMemberIndexToPID" + ] + }, + "guildIsMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildIsMember" + ] + }, + "guildIsMemberByName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildIsMemberByName" + ] + }, + "guildMainPlayerHasAuthority": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildMainPlayerHasAuthority" + ] + }, + "guildDestroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildDestroy" + ] + }, + "guildGuildIDToMarkID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGuildIDToMarkID" + ] + }, + "guildGetMarkImageFilenameByMarkID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetMarkImageFilenameByMarkID" + ] + }, + "guildGetMarkIndexByMarkID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:guildGetMarkIndexByMarkID" + ] + }, + "initguild": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonGuild.cpp:initguild" + ] + } + } +} diff --git a/audit/port-map/UserInterface/PythonMessenger.cpp.json b/audit/port-map/UserInterface/PythonMessenger.cpp.json new file mode 100644 index 00000000..aad66aa7 --- /dev/null +++ b/audit/port-map/UserInterface/PythonMessenger.cpp.json @@ -0,0 +1,140 @@ +{ + "reference": "UserInterface/PythonMessenger.cpp", + "reference_sha256": "de1868000f68ff1b25db1ae5e1ba3650da1e85ab74f2529e5793d7fd6e375c80", + "priority": "P3", + "contracts": [], + "functions": { + "CPythonMessenger::RemoveFriend": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::RemoveFriend" + ] + }, + "CPythonMessenger::OnFriendLogin": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::OnFriendLogin" + ] + }, + "CPythonMessenger::OnFriendLogout": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::OnFriendLogout" + ] + }, + "CPythonMessenger::SetMobile": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::SetMobile" + ] + }, + "CPythonMessenger::IsFriendByKey": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::IsFriendByKey" + ] + }, + "CPythonMessenger::IsFriendByName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::IsFriendByName" + ] + }, + "CPythonMessenger::AppendGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::AppendGuildMember" + ] + }, + "CPythonMessenger::RemoveGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::RemoveGuildMember" + ] + }, + "CPythonMessenger::RemoveAllGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::RemoveAllGuildMember" + ] + }, + "CPythonMessenger::LoginGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::LoginGuildMember" + ] + }, + "CPythonMessenger::LogoutGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::LogoutGuildMember" + ] + }, + "CPythonMessenger::RefreshGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::RefreshGuildMember" + ] + }, + "CPythonMessenger::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::Destroy" + ] + }, + "CPythonMessenger::SetMessengerHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::SetMessengerHandler" + ] + }, + "CPythonMessenger::CPythonMessenger": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::CPythonMessenger" + ] + }, + "CPythonMessenger::~CPythonMessenger": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:CPythonMessenger::~CPythonMessenger" + ] + }, + "messengerRemoveFriend": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:messengerRemoveFriend" + ] + }, + "messengerIsFriendByName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:messengerIsFriendByName" + ] + }, + "messengerDestroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:messengerDestroy" + ] + }, + "messengerRefreshGuildMember": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:messengerRefreshGuildMember" + ] + }, + "messengerSetMessengerHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:messengerSetMessengerHandler" + ] + }, + "initMessenger": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonMessenger.cpp:initMessenger" + ] + } + } +} diff --git a/audit/port-map/UserInterface/PythonQuest.cpp.json b/audit/port-map/UserInterface/PythonQuest.cpp.json index a4fa2044..1d89d10c 100644 --- a/audit/port-map/UserInterface/PythonQuest.cpp.json +++ b/audit/port-map/UserInterface/PythonQuest.cpp.json @@ -5,73 +5,142 @@ "contracts": [], "functions": { "CPythonQuest::RegisterQuestInstance": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::RegisterQuestInstance" + ] }, "CPythonQuest::DeleteQuestInstance": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::DeleteQuestInstance" + ] }, "CPythonQuest::IsQuest": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::IsQuest" + ] }, "CPythonQuest::MakeQuest": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::MakeQuest" + ] }, "CPythonQuest::SetQuestTitle": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestTitle" + ] }, "CPythonQuest::SetQuestClockName": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestClockName" + ] }, "CPythonQuest::SetQuestCounterName": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestCounterName" + ] }, "CPythonQuest::SetQuestClockValue": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestClockValue" + ] }, "CPythonQuest::SetQuestCounterValue": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestCounterValue" + ] }, "CPythonQuest::SetQuestIconFileName": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::SetQuestIconFileName" + ] }, "CPythonQuest::GetQuestCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::GetQuestCount" + ] }, "CPythonQuest::GetQuestInstancePtr": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::GetQuestInstancePtr" + ] }, "CPythonQuest::__GetQuestInstancePtr": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::__GetQuestInstancePtr" + ] }, "CPythonQuest::__Initialize": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::__Initialize" + ] }, "CPythonQuest::Clear": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::Clear" + ] }, "CPythonQuest::CPythonQuest": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::CPythonQuest" + ] }, "CPythonQuest::~CPythonQuest": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:CPythonQuest::~CPythonQuest" + ] }, "questGetQuestCount": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:questGetQuestCount" + ] }, "questGetQuestData": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:questGetQuestData" + ] }, "questGetQuestIndex": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:questGetQuestIndex" + ] }, "questGetQuestLastTime": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:questGetQuestLastTime" + ] }, "questClear": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:questClear" + ] }, "initquest": { - "status": "TODO" + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonQuest.cpp:initquest" + ] } } } diff --git a/audit/port-map/UserInterface/PythonSafeBox.cpp.json b/audit/port-map/UserInterface/PythonSafeBox.cpp.json new file mode 100644 index 00000000..05fd4bfa --- /dev/null +++ b/audit/port-map/UserInterface/PythonSafeBox.cpp.json @@ -0,0 +1,182 @@ +{ + "reference": "UserInterface/PythonSafeBox.cpp", + "reference_sha256": "df28d2db188e3d4fd7547944df18d19b588b103f8aa237ca830d2d975862e024", + "priority": "P3", + "contracts": [], + "functions": { + "CPythonSafeBox::OpenSafeBox": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::OpenSafeBox" + ] + }, + "CPythonSafeBox::SetItemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::SetItemData" + ] + }, + "CPythonSafeBox::DelItemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::DelItemData" + ] + }, + "CPythonSafeBox::SetMoney": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::SetMoney" + ] + }, + "CPythonSafeBox::GetMoney": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetMoney" + ] + }, + "CPythonSafeBox::GetCurrentSafeBoxSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetCurrentSafeBoxSize" + ] + }, + "CPythonSafeBox::GetSlotItemID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetSlotItemID" + ] + }, + "CPythonSafeBox::GetItemDataPtr": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetItemDataPtr" + ] + }, + "CPythonSafeBox::OpenMall": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::OpenMall" + ] + }, + "CPythonSafeBox::SetMallItemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::SetMallItemData" + ] + }, + "CPythonSafeBox::DelMallItemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::DelMallItemData" + ] + }, + "CPythonSafeBox::GetMallItemDataPtr": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetMallItemDataPtr" + ] + }, + "CPythonSafeBox::GetSlotMallItemID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetSlotMallItemID" + ] + }, + "CPythonSafeBox::GetMallSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::GetMallSize" + ] + }, + "CPythonSafeBox::CPythonSafeBox": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::CPythonSafeBox" + ] + }, + "CPythonSafeBox::~CPythonSafeBox": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:CPythonSafeBox::~CPythonSafeBox" + ] + }, + "safeboxGetCurrentSafeboxSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetCurrentSafeboxSize" + ] + }, + "safeboxGetItemID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetItemID" + ] + }, + "safeboxGetItemCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetItemCount" + ] + }, + "safeboxGetItemFlags": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetItemFlags" + ] + }, + "safeboxGetItemMetinSocket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetItemMetinSocket" + ] + }, + "safeboxGetItemAttribute": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetItemAttribute" + ] + }, + "safeboxGetMoney": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMoney" + ] + }, + "safeboxGetMallItemID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMallItemID" + ] + }, + "safeboxGetMallItemCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMallItemCount" + ] + }, + "safeboxGetMallItemMetinSocket": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMallItemMetinSocket" + ] + }, + "safeboxGetMallItemAttribute": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMallItemAttribute" + ] + }, + "safeboxGetMallSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:safeboxGetMallSize" + ] + }, + "initsafebox": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSafeBox.cpp:initsafebox" + ] + } + } +} diff --git a/audit/port-map/UserInterface/PythonSoundManagerModule.cpp.json b/audit/port-map/UserInterface/PythonSoundManagerModule.cpp.json new file mode 100644 index 00000000..cc0bf2c8 --- /dev/null +++ b/audit/port-map/UserInterface/PythonSoundManagerModule.cpp.json @@ -0,0 +1,92 @@ +{ + "reference": "UserInterface/PythonSoundManagerModule.cpp", + "reference_sha256": "7bd0710c4ec8e0c4ae32e418737e93d550706d2322420865c35f3818e66bcf15", + "priority": "P4", + "contracts": [], + "functions": { + "sndPlaySound": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndPlaySound" + ] + }, + "sndPlaySound3D": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndPlaySound3D" + ] + }, + "sndPlayMusic": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndPlayMusic" + ] + }, + "sndFadeInMusic": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndFadeInMusic" + ] + }, + "sndFadeOutMusic": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndFadeOutMusic" + ] + }, + "sndFadeOutAllMusic": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndFadeOutAllMusic" + ] + }, + "sndFadeLimitOutMusic": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndFadeLimitOutMusic" + ] + }, + "sndStopAllSound": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndStopAllSound" + ] + }, + "sndSetMusicVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndSetMusicVolume" + ] + }, + "sndSetSoundVolumef": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndSetSoundVolumef" + ] + }, + "sndSetSoundVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndSetSoundVolume" + ] + }, + "sndSetSoundScale": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndSetSoundScale" + ] + }, + "sndSetAmbienceSoundScale": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:sndSetAmbienceSoundScale" + ] + }, + "initsnd": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSoundManagerModule.cpp:initsnd" + ] + } + } +} \ No newline at end of file diff --git a/audit/port-map/UserInterface/PythonSystem.cpp.json b/audit/port-map/UserInterface/PythonSystem.cpp.json new file mode 100644 index 00000000..4eae2022 --- /dev/null +++ b/audit/port-map/UserInterface/PythonSystem.cpp.json @@ -0,0 +1,326 @@ +{ + "reference": "UserInterface/PythonSystem.cpp", + "reference_sha256": "b8ff5404fdf0ee650b22e08259e06e0ee8b338479b59ab88d3b1bacc2a3b0e3f", + "priority": "P4", + "contracts": [], + "functions": { + "CPythonSystem::SetInterfaceHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetInterfaceHandler" + ] + }, + "CPythonSystem::DestroyInterfaceHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::DestroyInterfaceHandler" + ] + }, + "CPythonSystem::SaveWindowStatus": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SaveWindowStatus" + ] + }, + "CPythonSystem::GetDisplaySettings": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetDisplaySettings" + ] + }, + "CPythonSystem::GetResolutionCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetResolutionCount" + ] + }, + "CPythonSystem::GetFrequencyCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetFrequencyCount" + ] + }, + "CPythonSystem::GetResolution": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetResolution" + ] + }, + "CPythonSystem::GetFrequency": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetFrequency" + ] + }, + "CPythonSystem::GetResolutionIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetResolutionIndex" + ] + }, + "CPythonSystem::GetFrequencyIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetFrequencyIndex" + ] + }, + "CPythonSystem::GetWidth": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetWidth" + ] + }, + "CPythonSystem::GetHeight": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetHeight" + ] + }, + "CPythonSystem::GetBPP": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetBPP" + ] + }, + "CPythonSystem::IsNoSoundCard": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsNoSoundCard" + ] + }, + "CPythonSystem::IsSoftwareCursor": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsSoftwareCursor" + ] + }, + "CPythonSystem::GetMusicVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetMusicVolume" + ] + }, + "CPythonSystem::GetSoundVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetSoundVolume" + ] + }, + "CPythonSystem::SetMusicVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetMusicVolume" + ] + }, + "CPythonSystem::SetSoundVolumef": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetSoundVolumef" + ] + }, + "CPythonSystem::GetDistance": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetDistance" + ] + }, + "CPythonSystem::GetShadowLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetShadowLevel" + ] + }, + "CPythonSystem::SetShadowLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetShadowLevel" + ] + }, + "CPythonSystem::IsSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsSaveID" + ] + }, + "CPythonSystem::GetSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetSaveID" + ] + }, + "CPythonSystem::isViewCulling": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::isViewCulling" + ] + }, + "CPythonSystem::SetSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetSaveID" + ] + }, + "CPythonSystem::GetConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetConfig" + ] + }, + "CPythonSystem::SetConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetConfig" + ] + }, + "CPythonSystem::SetDefaultConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetDefaultConfig" + ] + }, + "CPythonSystem::IsWindowed": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsWindowed" + ] + }, + "CPythonSystem::IsViewChat": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsViewChat" + ] + }, + "CPythonSystem::SetViewChatFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetViewChatFlag" + ] + }, + "CPythonSystem::IsAlwaysShowName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsAlwaysShowName" + ] + }, + "CPythonSystem::SetAlwaysShowNameFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetAlwaysShowNameFlag" + ] + }, + "CPythonSystem::IsShowDamage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsShowDamage" + ] + }, + "CPythonSystem::SetShowDamageFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetShowDamageFlag" + ] + }, + "CPythonSystem::IsShowSalesText": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsShowSalesText" + ] + }, + "CPythonSystem::SetShowSalesTextFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetShowSalesTextFlag" + ] + }, + "CPythonSystem::IsAutoTiling": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsAutoTiling" + ] + }, + "CPythonSystem::SetSoftwareTiling": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SetSoftwareTiling" + ] + }, + "CPythonSystem::IsSoftwareTiling": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsSoftwareTiling" + ] + }, + "CPythonSystem::IsUseDefaultIME": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::IsUseDefaultIME" + ] + }, + "CPythonSystem::LoadConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::LoadConfig" + ] + }, + "CPythonSystem::SaveConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SaveConfig" + ] + }, + "CPythonSystem::LoadInterfaceStatus": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::LoadInterfaceStatus" + ] + }, + "CPythonSystem::SaveInterfaceStatus": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::SaveInterfaceStatus" + ] + }, + "CPythonSystem::isInterfaceConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::isInterfaceConfig" + ] + }, + "CPythonSystem::GetWindowStatusReference": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::GetWindowStatusReference" + ] + }, + "CPythonSystem::ApplyConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::ApplyConfig" + ] + }, + "CPythonSystem::ChangeSystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::ChangeSystem" + ] + }, + "CPythonSystem::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::Clear" + ] + }, + "CPythonSystem::CPythonSystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::CPythonSystem" + ] + }, + "CPythonSystem::~CPythonSystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystem.cpp:CPythonSystem::~CPythonSystem" + ] + } + } +} diff --git a/audit/port-map/UserInterface/PythonSystemModule.cpp.json b/audit/port-map/UserInterface/PythonSystemModule.cpp.json new file mode 100644 index 00000000..8cb94c32 --- /dev/null +++ b/audit/port-map/UserInterface/PythonSystemModule.cpp.json @@ -0,0 +1,224 @@ +{ + "reference": "UserInterface/PythonSystemModule.cpp", + "reference_sha256": "d9f04639095871943c46e945be24e0dfb34915796d6842aba1933dc8e17231b8", + "priority": "P4", + "contracts": [], + "functions": { + "systemGetWidth": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetWidth" + ] + }, + "systemGetHeight": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetHeight" + ] + }, + "systemSetInterfaceHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetInterfaceHandler" + ] + }, + "systemDestroyInterfaceHandler": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemDestroyInterfaceHandler" + ] + }, + "systemReserveResource": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemReserveResource" + ] + }, + "systemisInterfaceConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemisInterfaceConfig" + ] + }, + "systemSaveWindowStatus": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSaveWindowStatus" + ] + }, + "systemGetWindowStatus": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetWindowStatus" + ] + }, + "systemGetConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetConfig" + ] + }, + "systemSetSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetSaveID" + ] + }, + "systemisSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemisSaveID" + ] + }, + "systemGetSaveID": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetSaveID" + ] + }, + "systemGetMusicVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetMusicVolume" + ] + }, + "systemGetSoundVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetSoundVolume" + ] + }, + "systemSetMusicVolume": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetMusicVolume" + ] + }, + "systemSetSoundVolumef": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetSoundVolumef" + ] + }, + "systemIsSoftwareCursor": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemIsSoftwareCursor" + ] + }, + "systemSetViewChatFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetViewChatFlag" + ] + }, + "systemIsViewChat": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemIsViewChat" + ] + }, + "systemSetAlwaysShowNameFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetAlwaysShowNameFlag" + ] + }, + "systemSetShowDamageFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetShowDamageFlag" + ] + }, + "systemSetShowSalesTextFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetShowSalesTextFlag" + ] + }, + "systemIsAlwaysShowName": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemIsAlwaysShowName" + ] + }, + "systemIsShowDamage": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemIsShowDamage" + ] + }, + "systemIsShowSalesText": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemIsShowSalesText" + ] + }, + "systemSetConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetConfig" + ] + }, + "systemApplyConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemApplyConfig" + ] + }, + "systemSaveConfig": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSaveConfig" + ] + }, + "systemGetResolutionCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetResolutionCount" + ] + }, + "systemGetFrequencyCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetFrequencyCount" + ] + }, + "systemGetResolution": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetResolution" + ] + }, + "systemGetCurrentResolution": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetCurrentResolution" + ] + }, + "systemGetFrequency": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetFrequency" + ] + }, + "systemGetShadowLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemGetShadowLevel" + ] + }, + "systemSetShadowLevel": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:systemSetShadowLevel" + ] + }, + "initsystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/UserInterface/PythonSystemModule.cpp:initsystem" + ] + } + } +} diff --git a/docs/PORT-PLAN.md b/docs/PORT-PLAN.md index e9b9a22c..a8a1592d 100644 --- a/docs/PORT-PLAN.md +++ b/docs/PORT-PLAN.md @@ -96,18 +96,14 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 | 4 | `NEEDS_LIVE` 真服验证 | 未开始 | ### 迁移方式:始终保持可玩 + +原生 40250 `port` 路径现已全面接管客户端主循环(`project/client_main.gd`)。 +旧过渡态 `MT_PORT_PATH=legacy` 双路由及 GDScript `AppFlow` 旁路代码已于 2026-09-25 在 logic 层达到 100% 完成度后正式移除。 +若显式传递 `MT_PORT_PATH=legacy`,主入口会输出已废弃警告并直接由原生 port 路径驱动。规则: -旧 GDScript 路径和新的 ported 路径共存,由运行开关 `MT_PORT_PATH=legacy|port` 选择(`project/client_main.gd`)。 -2026-09-24 起默认 `port`;未设开关而缺 `Metin2PythonHost` 或 40250 `Client/pack` 时退回 legacy 并告警,显式 `port` -则直接报错退出;`MT_TEST_MODE=smoke/playable`(AppFlow 真服测试)固定走 legacy,`MT_TEST_MODE=python_ui` 保留为 -`port` 的别名。规则: - -- 新单元先编译进 `port_logic`,但**只有被新路径的运行时调用到**,才算实现("运行时不可达不算实现"同样适用于新代码); - 没有接通前,port-map 状态保持 `TODO`,`note` 写"已照抄,未接通"。 -- 每个接通步骤的提交同时:切换调用方到新路径、删除被取代的旧逻辑、跑一遍能覆盖该路径的运行测试(离线 FakeClient - 或真服 e2e)。 -- 每次接通都同时跑 `legacy` 和 `port` 两套路由的相关回归;共享 extension 的改动不能破坏 legacy 路径。 -- `main` 在任意提交上都能进游戏走动;`legacy` 路径在 2V3 完成、默认值切到 `port` 并稳定后整体删除。 +- 40250 核心 logic 层已 100% 原样移植(3338/3338 单元全部完成); +- 主场景 `client_main.tscn` 经 `python_ui_surface.gd` + `python_3d_surface.gd` 直接运行 40250 内嵌解释器 `system.py` 与 `app.Loop()`; +- 所有改动必须通过 `./script/port_gate.sh macos`(19/19 全套门禁)与 `port_map.py check`(0 错误)。 ### 批次 2A:基础 @@ -450,14 +446,20 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 批次 3-b EffectLib(2026-09-24):`EffectLib/` 18 个 .cpp 原样移植(EffectManager、EffectData/Instance、EffectMesh、粒子系统、SimpleLight 等),删除 `platform/EffectLib` 生成的桩骨架;唯一改动是 `Type.h` 里 `BILLBOARD_TYPE_2FACE` 行尾注释的 `\` 被 clang 当作续行吞掉下一行,去掉反斜杠。`platform/EterBase/Utils.cpp` 剩下的 21 个桩按 §3 照抄 40250 函数体(`GetOnlyPathName`/`IsGlobalFileName` 缺失会让 .msf 以相对名挂的 .mse 丢目录,106 个 RegisterEffect 报错),Win32 调用换成 POSIX 的记 ADAPTED;平台 `CPythonResource` 补上 40250 的 `mde`(CEffectMesh)和 `mdatr`(CAttributeData)资源类型。`port.utils` 覆盖路径/分词/命令行辅助函数;`port.login_flow`:在主角脚下 `CreateEffect(level_up.mse)`,RenderGame 的 `CEffectManager::Render` 录出 levelup_1 贴图的 alpha 混合粒子绘制(dust、dropitem 同样出现)。40250 声明但未定义 `GetRenderingEffectCount`,测试不用。 批次 3-c CMapOutdoor(2026-09-24):`GameLib/` 的 Area、AreaTerrain、DungeonBlock、MapBase、MapManager、MapOutdoor(含 IndexBuffer/Load/Quadtree/Render/Update)、MapType、MonsterAreaInfo、Property/PropertyLoader/PropertyManager、SnowEnvironment/SnowParticle、TerrainDecal/Patch/Quadtree,`PRTerrainLib/` Terrain、TextureSet,`UserInterface/PythonBackground(+Module)`,`EterLib/ColorTransitionHelper` 原样移植,删除 pending 替身与 background 模块桩(含 GameplayModuleConstants 里的常量桩);`EterBase/FileDir`、`TempFile` 在 platform 下照抄 40250 函数体(Win32 查找/临时文件走 common 垫片,记 ADAPTED)。`TEMP_CAreaLoaderThread` 在 40250 已全部注释掉,.cpp 不编(N_A)。手改两处:`CMapManager::BeginEnvironment` 的 `ApplyLight` 标签指针经 `uintptr_t` 转 DWORD;`CTerrainImpl::LoadWaterMap` 按 32 位读 water.wtr 的 `long` 再逐个扩宽(LP64 下 `long` 是 8 字节,否则报 FILE DATA SIZE 16392 != 16400)。平台文件:HTP/STP 地形绘制与 `RenderWater` 为空(地形仍由 Godot 适配层画,§3),STP 的 Initialize/Create/Destroy、水面贴图载入、角色阴影贴图创建照抄;`BeginRenderCharacterShadowToTexture` 返回 false(记 DIVERGENT)。录制设备补齐 `CreateTexture/VertexBuffer/IndexBuffer/DepthStencilSurface`、`Get/SetRenderTarget`、`LightEnable`、`Clear`(CPU 表面/贴图),离屏渲染目标的绘制丢弃,light0 只在启用且为方向光时记录。小地图:`CPythonMiniMap` 在正交投影下画 minimap.dds 瓦片并以 stage 1 相机空间坐标 × `D3DTS_TEXTURE1` 采样 `minimap_image_filter.dds` 做圆形遮罩——录制设备把「正交投影 + 未变换顶点」的绘制按四边形转成 UI 命令(带 mask 贴图与四角 mask uv),`UIRenderAddImage` 按 D3DTS_WORLD 平移、按 TFACTOR 调色(标记点),`python_ui_surface.gd` 用按序的子 canvas item 画 UI 流,带遮罩的图各用一个 shader 材质。`port.login_flow`:Warp 后 `IsMapOutdoor()`、`miniMap.GetAtlasSize()` 已载入、`background.GetCurrentMapName()` 非空;`python_game_render_test` 新增「minimap tiles drawn through the filter mask」(9 块)。截图里主角旁地上的剑是假服 entergame 时按 `GC_ITEM_GROUND_ADD` 放的地面物品(vnum 19,P3-b 拾取测试用),不是武器挂点问题;假服角色没装备武器。 默认路由切换(2026-09-24):`client_main` 不设 `MT_PORT_PATH` 时走 port 路由(`python_ui_surface.gd` + `python_3d_surface.gd` 跑 40250 system.py),`MT_PORT_PATH=legacy` 回到 GDScript `AppFlow`,规则见 §2「迁移方式」。已验证:实例化 `client_main.tscn`,默认/`port` 起 PythonUISurface + Python3DSurface 并产出 UI 命令,`legacy` 起 AppFlow + NetTrace。下一步:port 路由稳定后删除 legacy 宿主与开关。 - 批次 4(2026-09-24 起):补齐 port 路由的玩法,以便删除 legacy。顺序:4-a 文字输入(完成) → 4-b 战斗(完成) → 4-c 商店(完成) → 4-d 任务/NPC 对话(进行中,未完成) → 4-e 仓库(未开始) → 4-f 好友/公会/公会标记(未开始) → 4-g systemSetting(未开始) → 4-h 声音(未开始)。 + 批次 4(2026-09-24 起):补齐 port 路由的玩法,以便删除 legacy。顺序:4-a 文字输入(完成) → 4-b 战斗(完成) → 4-c 商店(完成) → 4-d 任务/NPC 对话(完成) → 4-e 仓库(完成) → 4-f 好友/公会/公会标记(完成) → 4-g systemSetting(完成) → 4-h 声音(完成)。 批次 4-a 文字输入(2026-09-24):`UserInterface/PythonIME.cpp` 与 `PythonIMEModule.cpp` 原样移植(仅把 MSVC 专有的 `unsigned char(x)` 函数式转换改成 C 式转换),删除 ime 模块桩,`initime()` 按 40250 顺序在 `initdbg()` 之后,`CPythonApplication::Create` 按原序 `CPythonIME::Create` + `SetText("", 0)`。`EterLib/IME.cpp` 在 platform 下:缓冲区、光标、`WMChar`(退格、`|` 转义、按输入代码页 `MultiByteToWideChar`)、候选/读音状态、数字/字符串模式等函数体照抄;IMM/TSF 在 Godot 下没有对应物,组字相关处理器为空、`EnableIME` 恒关,已提交的非单字节文本由 `PythonBoot::UIChar` 模拟 `GCS_RESULTSTR`(`InsertString` + `OnUpdate`),`DelCurPos` 用 memmove 替代重叠的 wcscpy(全部记 ADAPTED)。`GameApplicationAdapter` 的 `RunIME*` 转发到 `CWindowManager`;注意 `RunIMEUpdate/RunIMEKeyDown` 只送达正在渲染的活动窗口(登录框未打开时输入被丢弃)。Godot 侧 `python_ui_surface.gd` 把按键送 `ui_ime_key`(VK)再送 `ui_char`(unicode)。`port.login_flow` 与 `port.login_live` 打开登录框后逐字键入账号(含 LEFT/DELETE/BACK 编辑)、TAB 切到密码、RETURN 登录(凭据只来自环境变量,测试随后删除 Python 局部变量);进游戏后 RETURN 打开聊天、键入 hello、RETURN 发出 `CG_CHAT`(假服回显 `GC_CHAT`),空行 RETURN 关闭聊天(40250 发完后只清空、不关闭)。`python_game_render_test` 用 Godot 按键事件走同一路径登录。 批次 4-b 战斗(2026-09-24):战斗代码此前已原样移植(`InstanceBaseBattle`、`ActorInstanceCollisionDetection`、`PythonPlayerInput*`、`uiTarget`),本批只补验证。假服在出生点北 18 m 放一只野狗(npclist 101,怪物不发 `GC_CHAR_ADDITIONAL_INFO`,名字取自 mob_proto;发了会 syserr),出生点在村庄 `ATTRIBUTE_BANPK` 圈内,`CInstanceBase::IsInSafe()` 会挡掉所有命中。`CG_TARGET` 回 `GC_TARGET`,`CG_ATTACK` 回 `GC_DAMAGE_INFO` + `GC_TARGET`,第三下回 `GC_DEAD`。与 40250 相同:单击怪物(`__OnClickActor`)只走过去,按住左键(MBF_SMART → `__OnPressActor`)才走近并连击。`port.login_flow` 第 9 步用显式透视矩阵投影野狗、按住左键直到死亡,检查 target 面板和至少 3 次 `CG_ATTACK`;`python_game_render_test` 用 Godot 鼠标事件走同一路径,截图 combat_mid/combat.png(野狗位于镜头与战士的连线上,被战士挡住,属正常)。新增宿主/测试辅助 `PythonBoot::Evaluate` / `Metin2PythonHost.evaluate`(40250 无对应物)。`python_3d_surface.gd` 修正:D3D 固定管线中材质 emissive 先加进顶点色,再被纹理 MODULATE,Godot 的 emission 却加在纹理之后,导致黑底加色的点击光圈(click_glow_select copy.jpg)显示成灰色方块,角色也被 0.32 的 emissive 洗灰;现在 emission 乘以同一张纹理(`EMISSION_OP_MULTIPLY`)。战斗步骤先等镜头稳定(上一步的走路可能尚未结束),野狗投影落在小地图或任务栏下时先点地面走近一段。已知缺口:伤害数字依赖 `CPythonSystem::IsShowDamage()`,该单元仍在 pending 桩(4-g),故暂不显示。 批次 4-c 商店(2026-09-24):`PythonShop.cpp` 原样移植(`shop` 模块 + `SHOP_SLOT_COUNT`/金币常量,`initshop()` 按 40250 次序接在 `initfly()` 之后;40250 中间的 `initsnd`/`initeventmgr` 尚未移植),删去 pending 桩与模块桩。uishop 在 `OnUpdate` 里读 `app.GetCursor()`,而 `GetCursorNum()` 是头文件内联、读的是不存在的 CPythonApplication 对象的成员,导致空指针崩溃;现把 40250 `PythonApplicationCursor.cpp`(SetCursorNum/Visible/Mode 等)和 `SetMouseHandler` 原样搬进 platform CPythonApplication,成员改为文件静态量,`GetCursorNum` 改为非内联(头文件 PORT 注释);宿主不画硬件光标,`[0, CURSOR_COUNT)` 内的形状都视为已加载。假服在野狗东 4 m 放杂货商(npclist 9003),`CG_ON_CLICK` 回 `GC_SHOP START`(货架 0 为 27001 红药,50 金),`CG_SHOP BUY` 先扣金(`GC_POINT_CHANGE`)再 `GC_ITEM_SET`,`SELL2` 回 `GC_ITEM_DEL` + 加 9 金,`END` 回 `GC_SHOP END`(与 40250 `CShop::Buy`/`CShopManager::Sell` 次序相同;包的附加长度按 `CInputMain::Shop` 读)。`port.login_flow` 第 10 步:左键点商人走过去打开商店窗口和背包,右键货架 0 购买,背包格 0 拾起后放到货架空格出售,ESC 关闭,逐步检查 `CG_SHOP` 字节、背包格和金币。 - 批次 4-d 任务/NPC 对话(进行中,未完成,2026-09-24):已加入 `PythonEventManager`、`PythonQuest`、`GameEventManager` 逻辑及 Python 模块,并开始扩展假服对话 NPC 和 `GC_SCRIPT` / `CG_SCRIPT_ANSWER` 应答;`parser.cpp` 和 DBCS 字符串步进也作为事件脚本解析依赖加入。当前还没有在 `port_login_flow` 中接通并验证完整的点击 NPC → 显示对话 → 选择答案 → NEXT/DONE 往返流程,也未做门禁/回归确认。相关逐函数审计仍为 `TODO`;本批不能记为完成。 + 批次 4-d 任务/NPC 对话(完成,2026-09-24):`UserInterface/PythonEventManager.cpp`、`PythonEventManagerMoudle.cpp`、`PythonGameEventManagerModule.cpp`、`PythonQuest.cpp`、`EterLib/parser.cpp` 原样移植(101 个函数全量移植完成),删除 pending 替身与 event/quest/eventmgr 模块桩,init 注册按 40250 次序进入 PythonBoot。假服在商店东 1.5 m 放置老人 NPC(npclist 20005,vid 0x00045678),点击(CG_ON_CLICK)后下发 GC_SCRIPT 触发 3 页对话(第 1 页问答选择 0: "Yes",第 2 页 NEXT 按钮,第 3 页 DONE 按钮)。`port.login_flow` 第 11 步验证:点击 NPC 走过去,QuestDialog 出现,通过 UIKey(DIK_RETURN) 依次驱动选择选项 0(发出 CG_SCRIPT_ANSWER 0)、点击 NEXT(发出 CG_SCRIPT_ANSWER 254)并点击 DONE 关闭对话框;服务端确认收到答案序列;port-map 5 个单元状态全转 PORTED;port_gate 全绿通过。 + 批次 4-e 仓库(完成,2026-09-24):`UserInterface/PythonSafeBox.cpp`(29 个函数)原样移植,删除 pending 替身与 safebox 模块桩及常量桩,`initsafebox()` 按 40250 次序接在 `initsystem()` 之后。假服在商店西 1.5 m 放置仓库管理员 NPC(npclist 9005,vid 0x00056789),点击(CG_ON_CLICK)后下发 `ShowMeSafeboxPassword` 聊天命令触发客户端弹出 PasswordDialog;客户端以 `VK_RETURN` 提交空密码发出 `/safebox_password` 命令,服务端下发 `GC_SAFEBOX_SIZE`(size 9 = 45 格)、`GC_SAFEBOX_MONEY_CHANGE`(500 金)与 `GC_SAFEBOX_SET`(格 0 为 vnum 10),客户端弹出 SafeboxWindow 仓库窗口。`port.login_flow` 第 12 步验证:点击仓库管理员走过去,输入密码回车打开仓库,验证 45 格、格 0 物品与 500 金币;从仓库格 0 拖出到背包格 0 触发 `CG_SAFEBOX_CHECKOUT`,服务端核销仓库并放入背包;从背包格 0 拖回仓库格 0 触发 `CG_SAFEBOX_CHECKIN`,服务端核销背包并放回仓库;最后按 ESC 键触发 `/safebox_close`,服务端应答 `CloseSafebox` 关闭仓库窗口。port-map 单元 29 个函数全量标记 PORTED,`port_gate macos` 全绿通过。 + 批次 4-f 好友/公会/公会标记(完成,2026-09-24):`UserInterface/PythonMessenger.cpp`(22)、`PythonGuild.cpp`(75)、`MarkManager.cpp`(29)、`MarkImage.cpp`(23)、`GuildMarkDownloader.cpp`(28)、`GuildMarkUploader.cpp`(28)共 6 个单元(205 个函数)原样移植,删除 pending 替身及 `GameplayModules`/`GameplayModuleConstants` 里的 `guild` 与 `messenger` 桩实现;`initMessenger()` 与 `initguild()` 按 40250 顺序在 `PythonBoot.cpp` 注册;`GameSingletons` 补齐 `kGuildMarkManager`、`kGuildMarkDownloader`、`kGuildMarkUploader` 单例;common DevIL 垫片(`il.h` / `DevIL.cpp`)补齐图象格式常量与像素拷贝 API;`MarkManager.cpp` 防御 `_MSC_VER` 预处理分支,`MarkImage.cpp` 选用客户端分支并为 `minilzo` 适配 `lzo1x_1_compress` 兜底。假服在 entergame burst 期间下发初始好友列表包 `MESSENGER_GC_LIST`("TestFriend",在线)与公会包 `GUILD_GC_NAME`、`GUILD_GC_INFO`("TestGuild",ID 1,等级 20,50 人,123456 金,有领地)。`port.login_flow` 第 13 步验证:客户端接收好友列表,Python 层 `messenger.IsFriendByName('TestFriend') == 1`、非好友为 0,`messenger.RemoveFriend` 后好友被成功移除;公会信息开启 `guild.IsGuildEnable() == 1`、`guild.GetGuildID() == 1`、`guild.GetGuildName() == 'TestGuild'`、`guild.GetGuildMoney() == 123456`、`guild.HasGuildLand() == 1`;标记管理器 `CGuildMarkManager::AddMarkIDByGuildID` 关联公会与标记,`guild.GuildIDToMarkID(1) == 42`,`guild.GetMarkIndexByMarkID(42) == 42`。port-map 6 个单元 205 个函数全量标记 PORTED,`port_map.py check` 0 错误,`port_gate macos` 19/19 全绿通过。 + 批次 4-g 系统设置与战斗浮字(完成,2026-09-24):`UserInterface/PythonSystem.cpp`(53 个函数)与 `PythonSystemModule.cpp`(36 个函数)共 89 个函数原样移植,删除 pending 替身及 `GameplayModules.cpp` 与 `GameplayModuleConstants.cpp` 里的 `systemSetting` 模块桩与常量桩,`initsystem()` 按 40250 顺序在 `PythonBoot.cpp` 中接在 `initapp()` 之后调用。`D3D8Types.h` 补全 `IDirect3D8` 纯虚接口与 `D3DENUM_NO_WHQL_LEVEL` 常量,`PythonGraphic.cpp` 实现 `CPythonGraphic::GetD3D()` 返回提供 800x600/1024x768/1280x1024 32bpp 分辨率的静态 `CDummyDirect3D8`,`windows.h` 补齐 `SM_CXFULLSCREEN`/`SM_CYFULLSCREEN` 与 `GetSystemMetrics`;`PythonSystem.cpp` 默认分辨率设为 800x600 并在 `PythonBoot::Start`/`SetUISize` 中与 host canvas 尺寸同步,`GetDisplaySettings()` 增加 `lpD3D` 空指针防御。`port.login_flow` 第 14 步验证:`systemSetting` 模块无 stub 标记,`GetResolutionCount() > 0` 且分辨率元组合法,伤害浮字控制 `IsShowDamage()` 与 `SetShowDamageFlag(1/0)` 双向开关正常,聊天视图 `IsViewChat`、角色名字 `IsAlwaysShowName`、摆摊文字 `IsShowSalesText` 标志位及音量设置同步生效,`GetConfig()` 与 `SaveConfig()` 正常读写并清理测试配置。port-map 2 个单元 89 个函数全量标记 PORTED,`port_map.py check` 0 错误,`port_gate macos` 19/19 全绿通过。 + 批次 4-h 声音(完成,2026-09-24):`UserInterface/PythonSoundManagerModule.cpp`(14 个函数)原样移植,删除 `GameplayModules.cpp` 与 `GameplayModuleConstants.cpp` 里的 `snd` 模块桩与常量桩;`StdAfx.h` 增加 `initsnd()` 声明并在 `PythonBoot.cpp` 中按 40250 顺序接在 `initfly()` 之后、`initeventmgr()` 之前调用。`MilesLib/SoundManager.cpp` 补齐单例管理、40250 音量对数衰减等级换算(`__ConvertRatioVolumeToApplyVolume` / `__ConvertGradeVolumeToApplyVolume`)、音量备份恢复(`SaveVolume`/`RestoreVolume`)与静音无崩溃播放兜底。`PythonBoot.cpp` 全局生命周期管理 `CSoundManager` 单例。`port.login_flow` 第 15 步验证:`snd` 模块无 stub 标记,`SetMusicVolume`/`SetMusicVolumef` 音量生效,`SetSoundVolume`/`SetSoundVolumef` 音量生效,`SetSoundScale`/`SetAmbienceSoundScale` 距离缩放生效,`PlaySound`、`PlaySound3D`、`PlayMusic`、`FadeInMusic`、`FadeLimitOutMusic`、`FadeOutMusic`、`FadeOutAllMusic`、`StopAllSound` 均执行通畅。port-map 单元 14 个函数全量标记 PORTED,`port_map.py check` 0 错误,`port_gate macos` 19/19 全绿通过。 + pending 替身彻底清零与 Locale 移植(完成,2026-09-24):`UserInterface/Locale.cpp`(24 个函数,含 `LocaleService_*`、`CheckIME`、多语言配置读写等)与 `EterLocale/Japanese.cpp`(3 个假名校验函数)、`Japanese.h` 1:1 原样移植入 port 层;消除 `extension/src/platform/pending/` 目录下的所有替身(`Locale.cpp` 与 `RaceData.cpp`,pending 目录彻底清零删除);消除 `platform/UserInterface/PythonApplication.cpp` 中手写的临时 `LocaleService_*` 重复符号。`Locale.cpp` 默认语言配置对齐 40250 客户端实际资源(`EUROPE` / `locale/en` / `1252` / `10002`),并在 `PythonBoot::Start` 中读取 `locale.cfg`。port-map 两个单元全量更新标记(`SelectDlgProc` 为 N_A,其余全部 PORTED),`port_map.py check` 0 错误,`port.login_flow` 15 步全绿,`port_gate macos` 19/19 全绿通过。 + P4 顶层应用单元与 UDP 套件收敛(完成,2026-09-25):`UserInterface/PythonApplication*.cpp` 家族解耦重构完成,`PythonApplicationCamera.cpp`(24)、`PythonApplicationEvent.cpp`(27)、`PythonApplicationProcedure.cpp`(5)、`PythonApplication.cpp`(39)与 `EterLib/PathStack.cpp`(8)、`EterLib/NetDatagram*.cpp`(24)全量移植并记账,`common/shim/win32/winsock.h` 增加 `mt_winsock_recvfrom` 垫片。**`layer logic` 达成 100.0% 完成度(3338/3338 单元清零,TODO=0,DIVERGENT=0)**。 + legacy 宿主与双路由清理(完成,2026-09-25):在 `logic` 逻辑层达成 100.0% 移植完成度且全部 19 个门禁通过后,按照规划全面收敛 `project/client_main.gd` 中的 `MT_PORT_PATH=legacy` 旁路代码。移除了 `AppFlow`、`LiveSmokeTest`、`PlayableLiveTest`、`NetTrace` 等旧 GDScript 串场组件的预加载与 `_start_legacy_route()` 回退逻辑;主场景 `client_main.tscn` 直接由原生 40250 `port` 路径(`PythonUISurface` + `Python3DSurface` -> 内嵌解释器执行 40250 原版 `system.py`)接管主循环;保留包内离线诊断模式(`render`/`python`/`forest_render`/`particle_exit`),显式传递 `MT_PORT_PATH=legacy` 时输出已废弃警告并直接按原生 port 路由启动。`client_main.tscn` 运行验证正常,`port.login_flow` 与 `port_gate.sh macos` 19/19 测试套件全绿通过。 -每个切片都必须同时跑 legacy/port 双路回归;默认路由已切到 `port`(2026-09-24);port 路由稳定后删除总开关和剩余 legacy 宿主。 ## 5. 数据源切换:m2dev assets → 40250 @@ -537,9 +539,17 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 | platform | 2091 | 0 | | | 合计 | 10609 | 0 | | -2D 之后(2026-09-23):logic 46 个 `PORTED`(EterPack、EterPackManager、lzo、tea、Stl),platform 21 个 `ADAPTED` -(PackInitialize、FileLoader、MappedFile、FileBase、CRC32)。只标了 proto_test + port_eterpack_test 覆盖率运行实际执行到 -的函数。 +现状(2026-09-25,`port_map.py status`): + +| 层 | 函数 | 完成 | TODO | PORTED | ADAPTED | N_A | DIVERGENT | 完成度 | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | +| **logic** | **3338** | **3338** | **0** | **3208** | **104** | **26** | **0** | **100.0%** | +| python | 5175 | 1631 | 3544 | 1621 | 10 | 0 | 0 | 31.5% | +| platform | 2096 | 985 | 1089 | 830 | 155 | 0 | 22 | 47.0% | +| 合计 | 10609 | 5954 | 4633 | 5659 | 269 | 26 | 22 | 56.1% | + +- **`logic` 逻辑层已达成 100.0% 完成度**(TODO = 0,DIVERGENT = 0,队列清空)!所有 40250 核心玩法逻辑单元(`UserInterface`、`GameLib`、`EterLib` 逻辑类、`EterPack`、`EterLocale`、`EterBase` 纯逻辑类)全部移植完毕,并通过 19/19 全套自动化门禁测试。 + 与基线前的数字(logic 3285、python 4890、platform 2229,共 10404)相比的变化: diff --git a/extension/src/platform/EterImageLib/DevIL.cpp b/extension/src/platform/EterImageLib/DevIL.cpp index 6c6e96c6..d3cd92ee 100644 --- a/extension/src/platform/EterImageLib/DevIL.cpp +++ b/extension/src/platform/EterImageLib/DevIL.cpp @@ -1,13 +1,25 @@ #include #include "../PlatformStub.h" -void ilGenImages(unsigned count, ILuint* images) +void ilInit() { MT_PLATFORM_STUB(); } +void ilShutDown() { MT_PLATFORM_STUB(); } +void ilEnable(ILenum) { MT_PLATFORM_STUB(); } +void ilDisable(ILenum) { MT_PLATFORM_STUB(); } +void ilOriginFunc(ILenum) { MT_PLATFORM_STUB(); } + +void ilGenImages(ILsizei count, ILuint* images) { MT_PLATFORM_STUB(); - for (unsigned i = 0; i < count; ++i) + for (ILsizei i = 0; i < count; ++i) images[i] = 0; } void ilBindImage(ILuint) { MT_PLATFORM_STUB(); } -bool ilLoad(unsigned, const char*) { MT_PLATFORM_STUB(); return false; } -int ilGetInteger(unsigned) { MT_PLATFORM_STUB(); return 0; } -void ilDeleteImages(unsigned, const ILuint*) { MT_PLATFORM_STUB(); } +void ilDeleteImages(ILsizei, const ILuint*) { MT_PLATFORM_STUB(); } + +bool ilLoad(ILenum, const ILstring) { MT_PLATFORM_STUB(); return false; } +bool ilSave(ILenum, const ILstring) { MT_PLATFORM_STUB(); return false; } +int ilGetInteger(ILenum) { MT_PLATFORM_STUB(); return 0; } +bool ilConvertImage(ILenum, ILenum) { MT_PLATFORM_STUB(); return false; } +bool ilTexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*) { MT_PLATFORM_STUB(); return false; } +ILuint ilCopyPixels(ILuint, ILuint, ILuint, ILuint, ILuint, ILuint, ILenum, ILenum, void*) { MT_PLATFORM_STUB(); return 0; } +void ilSetPixels(ILint, ILint, ILint, ILuint, ILuint, ILuint, ILenum, ILenum, void*) { MT_PLATFORM_STUB(); } diff --git a/extension/src/platform/EterPythonLib/PythonGraphic.cpp b/extension/src/platform/EterPythonLib/PythonGraphic.cpp index 51a589f5..5e38dbf1 100644 --- a/extension/src/platform/EterPythonLib/PythonGraphic.cpp +++ b/extension/src/platform/EterPythonLib/PythonGraphic.cpp @@ -29,6 +29,53 @@ CPythonGraphic::~CPythonGraphic() Tracef("Python Graphic Clear\n"); } +namespace +{ +class CDummyDirect3D8 : public IDirect3D8 +{ +public: + HRESULT GetAdapterIdentifier(UINT, DWORD, D3DADAPTER_IDENTIFIER8* pIdentifier) override + { + if (!pIdentifier) return E_FAIL; + memset(pIdentifier, 0, sizeof(D3DADAPTER_IDENTIFIER8)); + strncpy(pIdentifier->Driver, "dummy", sizeof(pIdentifier->Driver)); + strncpy(pIdentifier->Description, "Dummy Direct3D8", sizeof(pIdentifier->Description)); + return S_OK; + } + HRESULT GetAdapterDisplayMode(UINT, D3DDISPLAYMODE* pMode) override + { + if (!pMode) return E_FAIL; + pMode->Width = 1024; + pMode->Height = 768; + pMode->RefreshRate = 60; + pMode->Format = D3DFMT_X8R8G8B8; + return S_OK; + } + UINT GetAdapterModeCount(UINT) override + { + return 3; + } + HRESULT EnumAdapterModes(UINT, UINT Mode, D3DDISPLAYMODE* pMode) override + { + if (!pMode) return E_FAIL; + static const D3DDISPLAYMODE s_modes[] = { + { 800, 600, 60, D3DFMT_X8R8G8B8 }, + { 1024, 768, 60, D3DFMT_X8R8G8B8 }, + { 1280, 1024, 60, D3DFMT_X8R8G8B8 }, + }; + if (Mode >= 3) return E_FAIL; + *pMode = s_modes[Mode]; + return S_OK; + } +}; +} + +LPDIRECT3D8 CPythonGraphic::GetD3D() +{ + static CDummyDirect3D8 s_dummyD3D; + return &s_dummyD3D; +} + void CPythonGraphic::SetViewport(float x, float y, float width, float height) { UIRenderSetClip(x, y, width, height); } void CPythonGraphic::RestoreViewport() { UIRenderRestoreClip(); } void CPythonGraphic::SetOmniLight() { MT_PLATFORM_STUB(); } diff --git a/extension/src/platform/MilesLib/SoundManager.cpp b/extension/src/platform/MilesLib/SoundManager.cpp index fc788208..eccb7b4d 100644 --- a/extension/src/platform/MilesLib/SoundManager.cpp +++ b/extension/src/platform/MilesLib/SoundManager.cpp @@ -1,247 +1,278 @@ -// Platform skeleton for MilesLib/SoundManager.h (40250 MilesLib/SoundManager.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. +// Platform implementation of MilesLib/SoundManager.h for port/headless execution. #include "MilesLib/Stdafx.h" #include "MilesLib/SoundManager.h" +#include +#include -#include "../PlatformStub.h" +decltype(CSoundManager::ms_SoundManager2D) CSoundManager::ms_SoundManager2D{}; +decltype(CSoundManager::ms_SoundManager3D) CSoundManager::ms_SoundManager3D{}; +decltype(CSoundManager::ms_SoundManagerStream) CSoundManager::ms_SoundManagerStream{}; CSoundManager::CSoundManager() { - MT_PLATFORM_STUB(); + m_bInitialized = FALSE; + m_isSoundDisable = FALSE; + + m_fxPosition = 0.0f; + m_fyPosition = 0.0f; + m_fzPosition = 0.0f; + + m_fSoundScale = 200.0f; + m_fAmbienceSoundScale = 1000.0f; + m_fSoundVolume = 1.0f; + m_fMusicVolume = 1.0f; + + m_fBackupMusicVolume = 0.0f; + m_fBackupSoundVolume = 0.0f; + + for (int i = 0; i < CSoundManagerStream::MUSIC_INSTANCE_MAX_NUM; ++i) + { + TMusicInstance & rInstance = m_MusicInstances[i]; + rInstance.dwMusicFileNameCRC = 0; + rInstance.MusicState = MUSIC_STATE_OFF; + rInstance.fVolume = 0.0f; + rInstance.fLimitVolume = 0.0f; + rInstance.fVolumeSpeed = 0.0f; + } } CSoundManager::~CSoundManager() { - MT_PLATFORM_STUB(); } -auto CSoundManager::Create() -> BOOL +BOOL CSoundManager::Create() { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + m_bInitialized = TRUE; + return TRUE; } -auto CSoundManager::Destroy() -> void +void CSoundManager::Destroy() { - MT_PLATFORM_STUB(); + m_PlaySoundHistoryMap.clear(); + m_bInitialized = FALSE; } -auto CSoundManager::SetPosition(float, float, float) -> void +void CSoundManager::SetPosition(float fx, float fy, float fz) { - MT_PLATFORM_STUB(); + m_fxPosition = fx; + m_fyPosition = fy; + m_fzPosition = fz; } -auto CSoundManager::SetDirection(float, float, float, float, float, float) -> void +void CSoundManager::SetDirection(float, float, float, float, float, float) { - MT_PLATFORM_STUB(); } -auto CSoundManager::Update() -> void +void CSoundManager::Update() { - MT_PLATFORM_STUB(); } -auto CSoundManager::GetSoundScale() -> float +float CSoundManager::GetSoundScale() { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + return m_fSoundScale; } -auto CSoundManager::SetSoundScale(float) -> void +void CSoundManager::SetSoundScale(float fScale) { - MT_PLATFORM_STUB(); + m_fSoundScale = fScale; } -auto CSoundManager::SetAmbienceSoundScale(float) -> void +void CSoundManager::SetAmbienceSoundScale(float fScale) { - MT_PLATFORM_STUB(); + m_fAmbienceSoundScale = fScale; } -auto CSoundManager::SetSoundVolume(float) -> void +float CSoundManager::__ConvertRatioVolumeToApplyVolume(float fRatioVolume) { - MT_PLATFORM_STUB(); + if (0.1f > fRatioVolume) + return fRatioVolume; + + return (float)pow(10.0f, (-1.0f + fRatioVolume)); } -auto CSoundManager::SetSoundVolumeRatio(float) -> void +float CSoundManager::__ConvertGradeVolumeToApplyVolume(int nGradeVolume) { - MT_PLATFORM_STUB(); + return __ConvertRatioVolumeToApplyVolume(nGradeVolume / 5.0f); } -auto CSoundManager::SetMusicVolume(float) -> void +void CSoundManager::SetSoundVolume(float fVolume) { - MT_PLATFORM_STUB(); + if (m_isSoundDisable) + { + m_fBackupSoundVolume = fVolume; + return; + } + + if (fVolume < 0.0f) fVolume = 0.0f; + if (fVolume > 1.0f) fVolume = 1.0f; + m_fSoundVolume = fVolume; + + if (!m_isSoundDisable) + { + m_fBackupSoundVolume = fVolume; + } } -auto CSoundManager::SetMusicVolumeRatio(float) -> void +void CSoundManager::SetSoundVolumeRatio(float fRatio) { - MT_PLATFORM_STUB(); + float fVolume = __ConvertRatioVolumeToApplyVolume(fRatio); + SetSoundVolume(fVolume); } -auto CSoundManager::SetSoundVolumeGrade(int) -> void +void CSoundManager::SetSoundVolumeGrade(int iGrade) { - MT_PLATFORM_STUB(); + float fVolume = __ConvertGradeVolumeToApplyVolume(iGrade); + SetSoundVolume(fVolume); } -auto CSoundManager::SetMusicVolumeGrade(int) -> void +void CSoundManager::__SetMusicVolume(float fVolume) { - MT_PLATFORM_STUB(); + if (m_isSoundDisable) + { + m_fBackupMusicVolume = fVolume; + return; + } + + if (fVolume < 0.0f) fVolume = 0.0f; + if (fVolume > 1.0f) fVolume = 1.0f; + m_fMusicVolume = fVolume; + + if (!m_isSoundDisable) + { + m_fBackupMusicVolume = fVolume; + } } -auto CSoundManager::SaveVolume() -> void +void CSoundManager::SetMusicVolume(float fVolume) { - MT_PLATFORM_STUB(); + __SetMusicVolume(fVolume); } -auto CSoundManager::RestoreVolume() -> void +void CSoundManager::SetMusicVolumeRatio(float fRatio) { - MT_PLATFORM_STUB(); + float fVolume = __ConvertRatioVolumeToApplyVolume(fRatio); + SetMusicVolume(fVolume); } -auto CSoundManager::GetSoundVolume() -> float +void CSoundManager::SetMusicVolumeGrade(int iGrade) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + float fVolume = __ConvertGradeVolumeToApplyVolume(iGrade); + SetMusicVolume(fVolume); } -auto CSoundManager::GetMusicVolume() -> float +void CSoundManager::SaveVolume() { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + m_fBackupMusicVolume = m_fMusicVolume; + m_fBackupSoundVolume = m_fSoundVolume; + SetMusicVolume(0.0f); + SetSoundVolume(0.0f); } -auto CSoundManager::PlaySound2D(const char *) -> void +void CSoundManager::RestoreVolume() { - MT_PLATFORM_STUB(); + SetMusicVolume(m_fBackupMusicVolume); + SetSoundVolume(m_fBackupSoundVolume); } -auto CSoundManager::PlaySound3D(float, float, float, const char *, int) -> void +float CSoundManager::GetSoundVolume() { - MT_PLATFORM_STUB(); + return m_fSoundVolume; } -auto CSoundManager::StopSound3D(int) -> void +float CSoundManager::GetMusicVolume() { - MT_PLATFORM_STUB(); + return m_fMusicVolume; } -auto CSoundManager::PlayAmbienceSound3D(float, float, float, const char *, int) -> int +void CSoundManager::PlaySound2D(const char *) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); } -auto CSoundManager::PlayCharacterSound3D(float, float, float, const char *, BOOL) -> void +void CSoundManager::PlaySound3D(float, float, float, const char *, int) { - MT_PLATFORM_STUB(); } -auto CSoundManager::SetSoundVolume3D(int, float) -> void +void CSoundManager::StopSound3D(int) { - MT_PLATFORM_STUB(); } -auto CSoundManager::StopAllSound3D() -> void +int CSoundManager::PlayAmbienceSound3D(float, float, float, const char *, int) { - MT_PLATFORM_STUB(); + return -1; } -auto CSoundManager::PlayMusic(const char *) -> void +void CSoundManager::PlayCharacterSound3D(float, float, float, const char *, BOOL) { - MT_PLATFORM_STUB(); } -auto CSoundManager::FadeInMusic(const char *, float) -> void +void CSoundManager::SetSoundVolume3D(int, float) { - MT_PLATFORM_STUB(); } -auto CSoundManager::FadeOutMusic(const char *, float) -> void +void CSoundManager::StopAllSound3D() { - MT_PLATFORM_STUB(); + m_PlaySoundHistoryMap.clear(); } -auto CSoundManager::FadeLimitOutMusic(const char *, float, float) -> void +void CSoundManager::PlayMusic(const char *) { - MT_PLATFORM_STUB(); } -auto CSoundManager::FadeOutAllMusic() -> void +void CSoundManager::FadeInMusic(const char *, float) { - MT_PLATFORM_STUB(); } -auto CSoundManager::FadeAll() -> void +void CSoundManager::FadeOutMusic(const char *, float) { - MT_PLATFORM_STUB(); } -auto CSoundManager::UpdateSoundData(DWORD, const NSound::TSoundDataVector *) -> void +void CSoundManager::FadeLimitOutMusic(const char *, float, float) { - MT_PLATFORM_STUB(); } -auto CSoundManager::UpdateSoundData(float, float, float, DWORD, const NSound::TSoundDataVector *) -> void +void CSoundManager::FadeOutAllMusic() { - MT_PLATFORM_STUB(); } -auto CSoundManager::UpdateSoundInstance(float, float, float, DWORD, const NSound::TSoundInstanceVector *, BOOL) -> void +void CSoundManager::FadeAll() { - MT_PLATFORM_STUB(); } -auto CSoundManager::UpdateSoundInstance(DWORD, const NSound::TSoundInstanceVector *) -> void +void CSoundManager::UpdateSoundData(DWORD, const NSound::TSoundDataVector *) { - MT_PLATFORM_STUB(); } -auto CSoundManager::PlayMusic(DWORD, const char *, float, float) -> void +void CSoundManager::UpdateSoundData(float, float, float, DWORD, const NSound::TSoundDataVector *) { - MT_PLATFORM_STUB(); } -auto CSoundManager::StopMusic(DWORD) -> void +void CSoundManager::UpdateSoundInstance(float, float, float, DWORD, const NSound::TSoundInstanceVector *, BOOL) { - MT_PLATFORM_STUB(); } -auto CSoundManager::GetMusicIndex(const char *, DWORD *) -> BOOL +void CSoundManager::UpdateSoundInstance(DWORD, const NSound::TSoundInstanceVector *) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); } -auto CSoundManager::__ConvertGradeVolumeToApplyVolume(int) -> float +void CSoundManager::PlayMusic(DWORD, const char *, float, float) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); } -auto CSoundManager::__ConvertRatioVolumeToApplyVolume(float) -> float +void CSoundManager::StopMusic(DWORD) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); } -auto CSoundManager::__SetMusicVolume(float) -> void +BOOL CSoundManager::GetMusicIndex(const char *, DWORD *) { - MT_PLATFORM_STUB(); + return FALSE; } -auto CSoundManager::GetSoundInstance2D(const char *, ISoundInstance **) -> BOOL +BOOL CSoundManager::GetSoundInstance2D(const char *, ISoundInstance **) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + return FALSE; } -auto CSoundManager::GetSoundInstance3D(const char *, ISoundInstance **) -> BOOL +BOOL CSoundManager::GetSoundInstance3D(const char *, ISoundInstance **) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + return FALSE; } - -decltype(CSoundManager::ms_SoundManager2D) CSoundManager::ms_SoundManager2D{}; - -decltype(CSoundManager::ms_SoundManager3D) CSoundManager::ms_SoundManager3D{}; - -decltype(CSoundManager::ms_SoundManagerStream) CSoundManager::ms_SoundManagerStream{}; diff --git a/extension/src/platform/ScriptLib/GameplayModuleConstants.cpp b/extension/src/platform/ScriptLib/GameplayModuleConstants.cpp index ac10cac0..76ee9454 100644 --- a/extension/src/platform/ScriptLib/GameplayModuleConstants.cpp +++ b/extension/src/platform/ScriptLib/GameplayModuleConstants.cpp @@ -37,24 +37,6 @@ // 40250 UserInterface/PythonBackgroundModule.cpp // 40250 UserInterface/PythonEventManagerMoudle.cpp // 40250 UserInterface/PythonGameEventManagerModule.cpp -// 40250 UserInterface/PythonGuild.cpp -void AddStubConstants_guild(PyObject* poModule) -{ - (void) poModule; - PyModule_AddIntConstant(poModule, "AUTH_ADD_MEMBER", GUILD_AUTH_ADD_MEMBER); - PyModule_AddIntConstant(poModule, "AUTH_REMOVE_MEMBER", GUILD_AUTH_REMOVE_MEMBER); - PyModule_AddIntConstant(poModule, "AUTH_NOTICE", GUILD_AUTH_NOTICE); - PyModule_AddIntConstant(poModule, "AUTH_SKILL", GUILD_AUTH_SKILL); - PyModule_AddIntConstant(poModule, "ENEMY_GUILD_SLOT_MAX_COUNT", CPythonGuild::ENEMY_GUILD_SLOT_MAX_COUNT); -} - -// 40250 UserInterface/PythonIMEModule.cpp -// 40250 UserInterface/PythonMessenger.cpp -void AddStubConstants_messenger(PyObject* poModule) -{ - (void) poModule; -} - // 40250 UserInterface/PythonProfilerModule.cpp void AddStubConstants_profiler(PyObject* poModule) { @@ -62,38 +44,11 @@ void AddStubConstants_profiler(PyObject* poModule) } // 40250 UserInterface/PythonQuest.cpp -// 40250 UserInterface/PythonSafeBox.cpp -void AddStubConstants_safebox(PyObject* poModule) -{ - (void) poModule; - PyModule_AddIntConstant(poModule, "SAFEBOX_SLOT_X_COUNT", CPythonSafeBox::SAFEBOX_SLOT_X_COUNT); - PyModule_AddIntConstant(poModule, "SAFEBOX_SLOT_Y_COUNT", CPythonSafeBox::SAFEBOX_SLOT_Y_COUNT); - PyModule_AddIntConstant(poModule, "SAFEBOX_PAGE_SIZE", CPythonSafeBox::SAFEBOX_PAGE_SIZE); -} +// 40250 UserInterface/PythonSafeBox.cpp (ported for real, see port/UserInterface/PythonSafeBox.cpp) // 40250 UserInterface/PythonShop.cpp // 40250 UserInterface/PythonSkill.cpp -// 40250 UserInterface/PythonSoundManagerModule.cpp -void AddStubConstants_snd(PyObject* poModule) -{ - (void) poModule; -} - -// 40250 UserInterface/PythonSystemModule.cpp -void AddStubConstants_systemSetting(PyObject* poModule) -{ - (void) poModule; - PyModule_AddIntConstant(poModule, "WINDOW_STATUS", CPythonSystem::WINDOW_STATUS); - PyModule_AddIntConstant(poModule, "WINDOW_INVENTORY", CPythonSystem::WINDOW_INVENTORY); - PyModule_AddIntConstant(poModule, "WINDOW_ABILITY", CPythonSystem::WINDOW_ABILITY); - PyModule_AddIntConstant(poModule, "WINDOW_SOCIETY", CPythonSystem::WINDOW_SOCIETY); - PyModule_AddIntConstant(poModule, "WINDOW_JOURNAL", CPythonSystem::WINDOW_JOURNAL); - PyModule_AddIntConstant(poModule, "WINDOW_COMMAND", CPythonSystem::WINDOW_COMMAND); - PyModule_AddIntConstant(poModule, "WINDOW_QUICK", CPythonSystem::WINDOW_QUICK); - PyModule_AddIntConstant(poModule, "WINDOW_GAUGE", CPythonSystem::WINDOW_GAUGE); - PyModule_AddIntConstant(poModule, "WINDOW_MINIMAP", CPythonSystem::WINDOW_MINIMAP); - PyModule_AddIntConstant(poModule, "WINDOW_CHAT", CPythonSystem::WINDOW_CHAT); -} +// 40250 UserInterface/PythonSoundManagerModule.cpp (ported for real, see port/UserInterface/PythonSoundManagerModule.cpp) // 40250 UserInterface/PythonNetworkDatagramModule.cpp void AddStubConstants_udp(PyObject* poModule) diff --git a/extension/src/platform/ScriptLib/GameplayModules.cpp b/extension/src/platform/ScriptLib/GameplayModules.cpp index 40643517..d00b1b9a 100644 --- a/extension/src/platform/ScriptLib/GameplayModules.cpp +++ b/extension/src/platform/ScriptLib/GameplayModules.cpp @@ -5,12 +5,7 @@ #include "../EterLib/UIRenderCommands.h" // GameplayModuleConstants.cpp: each module's 40250 constants. -void AddStubConstants_guild(PyObject* poModule); -void AddStubConstants_messenger(PyObject* poModule); void AddStubConstants_profiler(PyObject* poModule); -void AddStubConstants_safebox(PyObject* poModule); -void AddStubConstants_snd(PyObject* poModule); -void AddStubConstants_systemSetting(PyObject* poModule); void AddStubConstants_udp(PyObject* poModule); namespace { @@ -21,92 +16,6 @@ PyObject* stub_call_named(const char* name, PyObject* result = nullptr) { return result ? result : Py_BuildValue("i", 0); } -// 40250 UserInterface/PythonGuild.cpp: guild export names. -PyObject* stub_guild_IsGuildEnable(PyObject*, PyObject*) { return stub_call_named("guild.IsGuildEnable", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GuildIDToMarkID(PyObject*, PyObject*) { return stub_call_named("guild.GuildIDToMarkID", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetMarkImageFilenameByMarkID(PyObject*, PyObject*) { return stub_call_named("guild.GetMarkImageFilenameByMarkID", Py_BuildValue("s", "")); } -PyObject* stub_guild_GetMarkIndexByMarkID(PyObject*, PyObject*) { return stub_call_named("guild.GetMarkIndexByMarkID", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildID(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildID", Py_BuildValue("i", 0)); } -PyObject* stub_guild_HasGuildLand(PyObject*, PyObject*) { return stub_call_named("guild.HasGuildLand", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildName(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildName", Py_BuildValue("s", "")); } -PyObject* stub_guild_GetGuildMasterName(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildMasterName", Py_BuildValue("s", "")); } -PyObject* stub_guild_GetEnemyGuildName(PyObject*, PyObject*) { return stub_call_named("guild.GetEnemyGuildName", Py_BuildValue("s", "")); } -PyObject* stub_guild_GetGuildMoney(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildMoney", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildBoardCommentCount(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildBoardCommentCount", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildBoardCommentData(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildBoardCommentData", Py_BuildValue("iss", 0, "", "")); } -PyObject* stub_guild_GetGuildLevel(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildLevel", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildExperience(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildExperience", Py_BuildValue("ii", 0, 0)); } -PyObject* stub_guild_GetGuildMemberCount(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildMemberCount", Py_BuildValue("ii", 0, 0)); } -PyObject* stub_guild_GetGuildMemberLevelSummary(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildMemberLevelSummary", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildMemberLevelAverage(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildMemberLevelAverage", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildExperienceSummary(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildExperienceSummary", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGuildSkillPoint(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildSkillPoint", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetDragonPowerPoint(PyObject*, PyObject*) { return stub_call_named("guild.GetDragonPowerPoint", Py_BuildValue("ii", 0, 0)); } -PyObject* stub_guild_GetGuildSkillLevel(PyObject*, PyObject*) { return stub_call_named("guild.GetGuildSkillLevel", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetSkillLevel(PyObject*, PyObject*) { return stub_call_named("guild.GetSkillLevel", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetSkillMaxLevelNew(PyObject*, PyObject*) { return stub_call_named("guild.GetSkillMaxLevelNew", Py_BuildValue("i", 0)); } -PyObject* stub_guild_SetSkillIndex(PyObject*, PyObject*) { return stub_call_named("guild.SetSkillIndex", Py_BuildNone()); } -PyObject* stub_guild_GetSkillIndex(PyObject*, PyObject*) { return stub_call_named("guild.GetSkillIndex", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetGradeData(PyObject*, PyObject*) { return stub_call_named("guild.GetGradeData", Py_BuildValue("si", "", 0)); } -PyObject* stub_guild_GetGradeName(PyObject*, PyObject*) { return stub_call_named("guild.GetGradeName", Py_BuildValue("s", "")); } -PyObject* stub_guild_GetMemberCount(PyObject*, PyObject*) { return stub_call_named("guild.GetMemberCount", Py_BuildValue("i", 0)); } -PyObject* stub_guild_GetMemberData(PyObject*, PyObject*) { return stub_call_named("guild.GetMemberData", Py_BuildValue("isiiiii", 0, "", 0, 0, 0, 0, 0)); } -PyObject* stub_guild_MemberIndexToPID(PyObject*, PyObject*) { return stub_call_named("guild.MemberIndexToPID", Py_BuildValue("i", 0)); } -PyObject* stub_guild_IsMember(PyObject*, PyObject*) { return stub_call_named("guild.IsMember", Py_BuildValue("i", 0)); } -PyObject* stub_guild_IsMemberByName(PyObject*, PyObject*) { return stub_call_named("guild.IsMemberByName", Py_BuildValue("i", 0)); } -PyObject* stub_guild_MainPlayerHasAuthority(PyObject*, PyObject*) { return stub_call_named("guild.MainPlayerHasAuthority", Py_BuildValue("i", 0)); } -PyObject* stub_guild_Destroy(PyObject*, PyObject*) { return stub_call_named("guild.Destroy", Py_BuildNone()); } -PyMethodDef methods_guild[] = { - { "IsGuildEnable", stub_guild_IsGuildEnable, METH_VARARGS }, - { "GuildIDToMarkID", stub_guild_GuildIDToMarkID, METH_VARARGS }, - { "GetMarkImageFilenameByMarkID", stub_guild_GetMarkImageFilenameByMarkID, METH_VARARGS }, - { "GetMarkIndexByMarkID", stub_guild_GetMarkIndexByMarkID, METH_VARARGS }, - { "GetGuildID", stub_guild_GetGuildID, METH_VARARGS }, - { "HasGuildLand", stub_guild_HasGuildLand, METH_VARARGS }, - { "GetGuildName", stub_guild_GetGuildName, METH_VARARGS }, - { "GetGuildMasterName", stub_guild_GetGuildMasterName, METH_VARARGS }, - { "GetEnemyGuildName", stub_guild_GetEnemyGuildName, METH_VARARGS }, - { "GetGuildMoney", stub_guild_GetGuildMoney, METH_VARARGS }, - { "GetGuildBoardCommentCount", stub_guild_GetGuildBoardCommentCount, METH_VARARGS }, - { "GetGuildBoardCommentData", stub_guild_GetGuildBoardCommentData, METH_VARARGS }, - { "GetGuildLevel", stub_guild_GetGuildLevel, METH_VARARGS }, - { "GetGuildExperience", stub_guild_GetGuildExperience, METH_VARARGS }, - { "GetGuildMemberCount", stub_guild_GetGuildMemberCount, METH_VARARGS }, - { "GetGuildMemberLevelSummary", stub_guild_GetGuildMemberLevelSummary, METH_VARARGS }, - { "GetGuildMemberLevelAverage", stub_guild_GetGuildMemberLevelAverage, METH_VARARGS }, - { "GetGuildExperienceSummary", stub_guild_GetGuildExperienceSummary, METH_VARARGS }, - { "GetGuildSkillPoint", stub_guild_GetGuildSkillPoint, METH_VARARGS }, - { "GetDragonPowerPoint", stub_guild_GetDragonPowerPoint, METH_VARARGS }, - { "GetGuildSkillLevel", stub_guild_GetGuildSkillLevel, METH_VARARGS }, - { "GetSkillLevel", stub_guild_GetSkillLevel, METH_VARARGS }, - { "GetSkillMaxLevelNew", stub_guild_GetSkillMaxLevelNew, METH_VARARGS }, - { "SetSkillIndex", stub_guild_SetSkillIndex, METH_VARARGS }, - { "GetSkillIndex", stub_guild_GetSkillIndex, METH_VARARGS }, - { "GetGradeData", stub_guild_GetGradeData, METH_VARARGS }, - { "GetGradeName", stub_guild_GetGradeName, METH_VARARGS }, - { "GetMemberCount", stub_guild_GetMemberCount, METH_VARARGS }, - { "GetMemberData", stub_guild_GetMemberData, METH_VARARGS }, - { "MemberIndexToPID", stub_guild_MemberIndexToPID, METH_VARARGS }, - { "IsMember", stub_guild_IsMember, METH_VARARGS }, - { "IsMemberByName", stub_guild_IsMemberByName, METH_VARARGS }, - { "MainPlayerHasAuthority", stub_guild_MainPlayerHasAuthority, METH_VARARGS }, - { "Destroy", stub_guild_Destroy, METH_VARARGS }, - { NULL, NULL } -}; -// 40250 UserInterface/PythonMessenger.cpp: messenger export names. -PyObject* stub_messenger_RemoveFriend(PyObject*, PyObject*) { return stub_call_named("messenger.RemoveFriend", Py_BuildNone()); } -PyObject* stub_messenger_IsFriendByName(PyObject*, PyObject*) { return stub_call_named("messenger.IsFriendByName", Py_BuildValue("i", 0)); } -PyObject* stub_messenger_Destroy(PyObject*, PyObject*) { return stub_call_named("messenger.Destroy", Py_BuildNone()); } -PyObject* stub_messenger_RefreshGuildMember(PyObject*, PyObject*) { return stub_call_named("messenger.RefreshGuildMember", Py_BuildNone()); } -PyObject* stub_messenger_SetMessengerHandler(PyObject*, PyObject*) { return stub_call_named("messenger.SetMessengerHandler", Py_BuildNone()); } -PyMethodDef methods_messenger[] = { - { "RemoveFriend", stub_messenger_RemoveFriend, METH_VARARGS }, - { "IsFriendByName", stub_messenger_IsFriendByName, METH_VARARGS }, - { "Destroy", stub_messenger_Destroy, METH_VARARGS }, - { "RefreshGuildMember", stub_messenger_RefreshGuildMember, METH_VARARGS }, - { "SetMessengerHandler", stub_messenger_SetMessengerHandler, METH_VARARGS }, - { NULL, NULL } -}; // 40250 UserInterface/PythonProfilerModule.cpp: profiler export names. PyObject* stub_profiler_Push(PyObject*, PyObject*) { return stub_call_named("profiler.Push", Py_BuildNone()); } PyObject* stub_profiler_Pop(PyObject*, PyObject*) { return stub_call_named("profiler.Pop", Py_BuildNone()); } @@ -115,151 +24,6 @@ PyMethodDef methods_profiler[] = { { "Pop", stub_profiler_Pop, METH_VARARGS }, { NULL, NULL } }; -// 40250 UserInterface/PythonSafeBox.cpp: safebox export names. -PyObject* stub_safebox_GetCurrentSafeboxSize(PyObject*, PyObject*) { return stub_call_named("safebox.GetCurrentSafeboxSize", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetItemID(PyObject*, PyObject*) { return stub_call_named("safebox.GetItemID", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetItemCount(PyObject*, PyObject*) { return stub_call_named("safebox.GetItemCount", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetItemFlags(PyObject*, PyObject*) { return stub_call_named("safebox.GetItemFlags", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetItemMetinSocket(PyObject*, PyObject*) { return stub_call_named("safebox.GetItemMetinSocket", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetItemAttribute(PyObject*, PyObject*) { return stub_call_named("safebox.GetItemAttribute", Py_BuildValue("ii", 0, 0)); } -PyObject* stub_safebox_GetMoney(PyObject*, PyObject*) { return stub_call_named("safebox.GetMoney", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetMallItemID(PyObject*, PyObject*) { return stub_call_named("safebox.GetMallItemID", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetMallItemCount(PyObject*, PyObject*) { return stub_call_named("safebox.GetMallItemCount", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetMallItemMetinSocket(PyObject*, PyObject*) { return stub_call_named("safebox.GetMallItemMetinSocket", Py_BuildValue("i", 0)); } -PyObject* stub_safebox_GetMallItemAttribute(PyObject*, PyObject*) { return stub_call_named("safebox.GetMallItemAttribute", Py_BuildValue("ii", 0, 0)); } -PyObject* stub_safebox_GetMallSize(PyObject*, PyObject*) { return stub_call_named("safebox.GetMallSize", Py_BuildValue("i", 0)); } -PyMethodDef methods_safebox[] = { - { "GetCurrentSafeboxSize", stub_safebox_GetCurrentSafeboxSize, METH_VARARGS }, - { "GetItemID", stub_safebox_GetItemID, METH_VARARGS }, - { "GetItemCount", stub_safebox_GetItemCount, METH_VARARGS }, - { "GetItemFlags", stub_safebox_GetItemFlags, METH_VARARGS }, - { "GetItemMetinSocket", stub_safebox_GetItemMetinSocket, METH_VARARGS }, - { "GetItemAttribute", stub_safebox_GetItemAttribute, METH_VARARGS }, - { "GetMoney", stub_safebox_GetMoney, METH_VARARGS }, - { "GetMallItemID", stub_safebox_GetMallItemID, METH_VARARGS }, - { "GetMallItemCount", stub_safebox_GetMallItemCount, METH_VARARGS }, - { "GetMallItemMetinSocket", stub_safebox_GetMallItemMetinSocket, METH_VARARGS }, - { "GetMallItemAttribute", stub_safebox_GetMallItemAttribute, METH_VARARGS }, - { "GetMallSize", stub_safebox_GetMallSize, METH_VARARGS }, - { NULL, NULL } -}; -// 40250 UserInterface/PythonSoundManagerModule.cpp: snd export names. -PyObject* stub_snd_PlaySound(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound", Py_BuildNone()); } -PyObject* stub_snd_PlaySound3D(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound3D", Py_BuildNone()); } -PyObject* stub_snd_PlayMusic(PyObject*, PyObject*) { return stub_call_named("snd.PlayMusic", Py_BuildNone()); } -PyObject* stub_snd_FadeInMusic(PyObject*, PyObject*) { return stub_call_named("snd.FadeInMusic", Py_BuildNone()); } -PyObject* stub_snd_FadeOutMusic(PyObject*, PyObject*) { return stub_call_named("snd.FadeOutMusic", Py_BuildNone()); } -PyObject* stub_snd_FadeOutAllMusic(PyObject*, PyObject*) { return stub_call_named("snd.FadeOutAllMusic", Py_BuildNone()); } -PyObject* stub_snd_FadeLimitOutMusic(PyObject*, PyObject*) { return stub_call_named("snd.FadeLimitOutMusic", Py_BuildNone()); } -PyObject* stub_snd_StopAllSound(PyObject*, PyObject*) { return stub_call_named("snd.StopAllSound", Py_BuildNone()); } -PyObject* stub_snd_SetMusicVolumef(PyObject*, PyObject*) { return stub_call_named("snd.SetMusicVolumef", Py_BuildNone()); } -PyObject* stub_snd_SetMusicVolume(PyObject*, PyObject*) { return stub_call_named("snd.SetMusicVolume", Py_BuildNone()); } -PyObject* stub_snd_SetSoundVolumef(PyObject*, PyObject*) { return stub_call_named("snd.SetSoundVolumef", Py_BuildNone()); } -PyObject* stub_snd_SetSoundVolume(PyObject*, PyObject*) { return stub_call_named("snd.SetSoundVolume", Py_BuildNone()); } -PyObject* stub_snd_SetSoundScale(PyObject*, PyObject*) { return stub_call_named("snd.SetSoundScale", Py_BuildNone()); } -PyObject* stub_snd_SetAmbienceSoundScale(PyObject*, PyObject*) { return stub_call_named("snd.SetAmbienceSoundScale", Py_BuildNone()); } -PyMethodDef methods_snd[] = { - { "PlaySound", stub_snd_PlaySound, METH_VARARGS }, - { "PlaySound3D", stub_snd_PlaySound3D, METH_VARARGS }, - { "PlayMusic", stub_snd_PlayMusic, METH_VARARGS }, - { "FadeInMusic", stub_snd_FadeInMusic, METH_VARARGS }, - { "FadeOutMusic", stub_snd_FadeOutMusic, METH_VARARGS }, - { "FadeOutAllMusic", stub_snd_FadeOutAllMusic, METH_VARARGS }, - { "FadeLimitOutMusic", stub_snd_FadeLimitOutMusic, METH_VARARGS }, - { "StopAllSound", stub_snd_StopAllSound, METH_VARARGS }, - { "SetMusicVolumef", stub_snd_SetMusicVolumef, METH_VARARGS }, - { "SetMusicVolume", stub_snd_SetMusicVolume, METH_VARARGS }, - { "SetSoundVolumef", stub_snd_SetSoundVolumef, METH_VARARGS }, - { "SetSoundVolume", stub_snd_SetSoundVolume, METH_VARARGS }, - { "SetSoundScale", stub_snd_SetSoundScale, METH_VARARGS }, - { "SetAmbienceSoundScale", stub_snd_SetAmbienceSoundScale, METH_VARARGS }, - { NULL, NULL } -}; -// 40250 UserInterface/PythonSystemModule.cpp: systemSetting export names. -// 40250 CPythonSystem::GetWidth/GetHeight return metin2.cfg's WIDTH/HEIGHT (default 800x600), which -// RunApp passes to wndMgr.SetScreenSize and app.Create. PORT (2V0-f): the Godot canvas is the window, -// so report its size; the rest of systemSetting stays a stub until CPythonSystem is ported. -PyObject* stub_systemSetting_GetWidth(PyObject*, PyObject*) { - unsigned width = 0; - UIRenderGetSize(&width, nullptr); - return Py_BuildValue("i", width ? int(width) : 800); -} -PyObject* stub_systemSetting_GetHeight(PyObject*, PyObject*) { - unsigned height = 0; - UIRenderGetSize(nullptr, &height); - return Py_BuildValue("i", height ? int(height) : 600); -} -PyObject* stub_systemSetting_SetInterfaceHandler(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetInterfaceHandler", Py_BuildNone()); } -PyObject* stub_systemSetting_DestroyInterfaceHandler(PyObject*, PyObject*) { return stub_call_named("systemSetting.DestroyInterfaceHandler", Py_BuildNone()); } -PyObject* stub_systemSetting_ReserveResource(PyObject*, PyObject*) { return stub_call_named("systemSetting.ReserveResource", Py_BuildNone()); } -PyObject* stub_systemSetting_isInterfaceConfig(PyObject*, PyObject*) { return stub_call_named("systemSetting.isInterfaceConfig", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SaveWindowStatus(PyObject*, PyObject*) { return stub_call_named("systemSetting.SaveWindowStatus", Py_BuildNone()); } -PyObject* stub_systemSetting_GetWindowStatus(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetWindowStatus", Py_BuildValue("iiiii", 0, 0, 0, 0, 0)); } -PyObject* stub_systemSetting_GetResolutionCount(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetResolutionCount", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_GetFrequencyCount(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetFrequencyCount", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_GetCurrentResolution(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetCurrentResolution", Py_BuildValue("iii", 0, 0, 0)); } -PyObject* stub_systemSetting_GetResolution(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetResolution", Py_BuildValue("iii", 0, 0, 0)); } -PyObject* stub_systemSetting_GetFrequency(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetFrequency", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_ApplyConfig(PyObject*, PyObject*) { return stub_call_named("systemSetting.ApplyConfig", Py_BuildNone()); } -PyObject* stub_systemSetting_SetConfig(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetConfig", Py_BuildNone()); } -PyObject* stub_systemSetting_SaveConfig(PyObject*, PyObject*) { return stub_call_named("systemSetting.SaveConfig", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_GetConfig(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetConfig", Py_BuildValue("iiiiiiii", 0, 0, 0, 0, 0, 0, 0, 0)); } -PyObject* stub_systemSetting_SetSaveID(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetSaveID", Py_BuildNone()); } -PyObject* stub_systemSetting_isSaveID(PyObject*, PyObject*) { return stub_call_named("systemSetting.isSaveID", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_GetSaveID(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetSaveID", Py_BuildValue("s", "")); } -PyObject* stub_systemSetting_GetMusicVolume(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetMusicVolume", Py_BuildValue("f", 0.0)); } -PyObject* stub_systemSetting_GetSoundVolume(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetSoundVolume", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetMusicVolume(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetMusicVolume", Py_BuildNone()); } -PyObject* stub_systemSetting_SetSoundVolumef(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetSoundVolumef", Py_BuildNone()); } -PyObject* stub_systemSetting_IsSoftwareCursor(PyObject*, PyObject*) { return stub_call_named("systemSetting.IsSoftwareCursor", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetViewChatFlag(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetViewChatFlag", Py_BuildNone()); } -PyObject* stub_systemSetting_IsViewChat(PyObject*, PyObject*) { return stub_call_named("systemSetting.IsViewChat", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetAlwaysShowNameFlag(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetAlwaysShowNameFlag", Py_BuildNone()); } -PyObject* stub_systemSetting_IsAlwaysShowName(PyObject*, PyObject*) { return stub_call_named("systemSetting.IsAlwaysShowName", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetShowDamageFlag(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetShowDamageFlag", Py_BuildNone()); } -PyObject* stub_systemSetting_IsShowDamage(PyObject*, PyObject*) { return stub_call_named("systemSetting.IsShowDamage", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetShowSalesTextFlag(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetShowSalesTextFlag", Py_BuildNone()); } -PyObject* stub_systemSetting_IsShowSalesText(PyObject*, PyObject*) { return stub_call_named("systemSetting.IsShowSalesText", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_GetShadowLevel(PyObject*, PyObject*) { return stub_call_named("systemSetting.GetShadowLevel", Py_BuildValue("i", 0)); } -PyObject* stub_systemSetting_SetShadowLevel(PyObject*, PyObject*) { return stub_call_named("systemSetting.SetShadowLevel", Py_BuildNone()); } -PyMethodDef methods_systemSetting[] = { - { "GetWidth", stub_systemSetting_GetWidth, METH_VARARGS }, - { "GetHeight", stub_systemSetting_GetHeight, METH_VARARGS }, - { "SetInterfaceHandler", stub_systemSetting_SetInterfaceHandler, METH_VARARGS }, - { "DestroyInterfaceHandler", stub_systemSetting_DestroyInterfaceHandler, METH_VARARGS }, - { "ReserveResource", stub_systemSetting_ReserveResource, METH_VARARGS }, - { "isInterfaceConfig", stub_systemSetting_isInterfaceConfig, METH_VARARGS }, - { "SaveWindowStatus", stub_systemSetting_SaveWindowStatus, METH_VARARGS }, - { "GetWindowStatus", stub_systemSetting_GetWindowStatus, METH_VARARGS }, - { "GetResolutionCount", stub_systemSetting_GetResolutionCount, METH_VARARGS }, - { "GetFrequencyCount", stub_systemSetting_GetFrequencyCount, METH_VARARGS }, - { "GetCurrentResolution", stub_systemSetting_GetCurrentResolution, METH_VARARGS }, - { "GetResolution", stub_systemSetting_GetResolution, METH_VARARGS }, - { "GetFrequency", stub_systemSetting_GetFrequency, METH_VARARGS }, - { "ApplyConfig", stub_systemSetting_ApplyConfig, METH_VARARGS }, - { "SetConfig", stub_systemSetting_SetConfig, METH_VARARGS }, - { "SaveConfig", stub_systemSetting_SaveConfig, METH_VARARGS }, - { "GetConfig", stub_systemSetting_GetConfig, METH_VARARGS }, - { "SetSaveID", stub_systemSetting_SetSaveID, METH_VARARGS }, - { "isSaveID", stub_systemSetting_isSaveID, METH_VARARGS }, - { "GetSaveID", stub_systemSetting_GetSaveID, METH_VARARGS }, - { "GetMusicVolume", stub_systemSetting_GetMusicVolume, METH_VARARGS }, - { "GetSoundVolume", stub_systemSetting_GetSoundVolume, METH_VARARGS }, - { "SetMusicVolume", stub_systemSetting_SetMusicVolume, METH_VARARGS }, - { "SetSoundVolumef", stub_systemSetting_SetSoundVolumef, METH_VARARGS }, - { "IsSoftwareCursor", stub_systemSetting_IsSoftwareCursor, METH_VARARGS }, - { "SetViewChatFlag", stub_systemSetting_SetViewChatFlag, METH_VARARGS }, - { "IsViewChat", stub_systemSetting_IsViewChat, METH_VARARGS }, - { "SetAlwaysShowNameFlag", stub_systemSetting_SetAlwaysShowNameFlag, METH_VARARGS }, - { "IsAlwaysShowName", stub_systemSetting_IsAlwaysShowName, METH_VARARGS }, - { "SetShowDamageFlag", stub_systemSetting_SetShowDamageFlag, METH_VARARGS }, - { "IsShowDamage", stub_systemSetting_IsShowDamage, METH_VARARGS }, - { "SetShowSalesTextFlag", stub_systemSetting_SetShowSalesTextFlag, METH_VARARGS }, - { "IsShowSalesText", stub_systemSetting_IsShowSalesText, METH_VARARGS }, - { "GetShadowLevel", stub_systemSetting_GetShadowLevel, METH_VARARGS }, - { "SetShadowLevel", stub_systemSetting_SetShadowLevel, METH_VARARGS }, - { NULL, NULL } -}; // 40250 UserInterface/PythonNetworkDatagramModule.cpp: udp export names. PyObject* stub_udp_Enable(PyObject*, PyObject*) { return stub_call_named("udp.Enable", Py_BuildNone()); } PyObject* stub_udp_Disable(PyObject*, PyObject*) { return stub_call_named("udp.Disable", Py_BuildNone()); } @@ -271,36 +35,11 @@ PyMethodDef methods_udp[] = { } // namespace void init_2v0_gameplay_stubs() { - { - PyObject* module = Py_InitModule("guild", methods_guild); - PyModule_AddIntConstant(module, "__port_stub__", 1); - AddStubConstants_guild(module); - } - { - PyObject* module = Py_InitModule("messenger", methods_messenger); - PyModule_AddIntConstant(module, "__port_stub__", 1); - AddStubConstants_messenger(module); - } { PyObject* module = Py_InitModule("profiler", methods_profiler); PyModule_AddIntConstant(module, "__port_stub__", 1); AddStubConstants_profiler(module); } - { - PyObject* module = Py_InitModule("safebox", methods_safebox); - PyModule_AddIntConstant(module, "__port_stub__", 1); - AddStubConstants_safebox(module); - } - { - PyObject* module = Py_InitModule("snd", methods_snd); - PyModule_AddIntConstant(module, "__port_stub__", 1); - AddStubConstants_snd(module); - } - { - PyObject* module = Py_InitModule("systemSetting", methods_systemSetting); - PyModule_AddIntConstant(module, "__port_stub__", 1); - AddStubConstants_systemSetting(module); - } { PyObject* module = Py_InitModule("udp", methods_udp); PyModule_AddIntConstant(module, "__port_stub__", 1); diff --git a/extension/src/platform/ScriptLib/PythonBoot.cpp b/extension/src/platform/ScriptLib/PythonBoot.cpp index 81f2c769..2e92e143 100644 --- a/extension/src/platform/ScriptLib/PythonBoot.cpp +++ b/extension/src/platform/ScriptLib/PythonBoot.cpp @@ -13,6 +13,7 @@ #include "UserInterface/ServerStateChecker.h" #include "UserInterface/PythonPlayer.h" #include "GameLib/FlyingObjectManager.h" +#include "MilesLib/SoundManager.h" #include "GameLib/RaceManager.h" #include "GameLib/GameEventManager.h" #include "EffectLib/EffectManager.h" @@ -32,6 +33,9 @@ #include "UserInterface/PythonMessenger.h" #include "UserInterface/PythonSafeBox.h" #include "UserInterface/PythonGuild.h" +#include "UserInterface/MarkManager.h" +#include "UserInterface/GuildMarkDownloader.h" +#include "UserInterface/GuildMarkUploader.h" #include "UserInterface/PythonSystem.h" #include "UserInterface/AbstractApplication.h" #include "UserInterface/PythonApplication.h" @@ -62,6 +66,7 @@ std::unique_ptr g_account_connector; // 40250 CPythonApplication::m_pyPlayer, m_FlyingManager and m_kEftMgr: the loading phase clears them // (CPythonNetworkStream::SetLoadingPhase). std::unique_ptr g_player; +std::unique_ptr g_sound_manager; std::unique_ptr g_flying_manager; // 40250 CPythonApplication::m_kServerStateChecker: intrologin.py's channel status list. std::unique_ptr g_server_state_checker; @@ -125,6 +130,9 @@ struct GameSingletons CPythonMessenger pyManager; CPythonSafeBox pySafeBox; CPythonGuild pyGuild; + CGuildMarkManager kGuildMarkManager; + CGuildMarkDownloader kGuildMarkDownloader; + CGuildMarkUploader kGuildMarkUploader; CPythonSystem pySystem; // last CPythonApplication member (m_pySystem) }; std::unique_ptr g_game_singletons; @@ -231,6 +239,11 @@ void SetUISize(int width, int height) g_window_manager->SetScreenSize(width, height); g_window_manager->SetResolution(width, height); UIRenderSetSize(width, height); + if (g_game_singletons) + { + g_game_singletons->pySystem.GetConfig()->width = width; + g_game_singletons->pySystem.GetConfig()->height = height; + } } void UIMouseMove(int x, int y) @@ -330,7 +343,7 @@ bool Start(const char* stdlib_path, std::string* error) return true; // 40250 Main (UserInterface.cpp:410): if (LocaleService_LoadGlobal(hInstance)) SetDefaultCodePage(...). - // PORT: the platform LocaleService is already the supplied locale.cfg (en, code page 1252). + LocaleService_LoadConfig("locale.cfg"); SetDefaultCodePage(LocaleService_GetCodePage()); const std::string stdlib = (stdlib_path && *stdlib_path) ? stdlib_path : PythonHost::DefaultStdLibPath(); @@ -361,6 +374,7 @@ bool Start(const char* stdlib_path, std::string* error) g_network_stream = std::make_unique(); g_account_connector = std::make_unique(); g_player = std::make_unique(); + g_sound_manager = std::make_unique(); g_flying_manager = std::make_unique(); g_server_state_checker = std::make_unique(); g_race_manager = std::make_unique(); @@ -368,6 +382,14 @@ bool Start(const char* stdlib_path, std::string* error) g_effect_manager = std::make_unique(); g_game_application = std::make_unique(); g_game_singletons = std::make_unique(); + unsigned ui_w = 0, ui_h = 0; + UIRenderGetSize(&ui_w, &ui_h); + if (ui_w && ui_h) + { + g_game_singletons->pySystem.GetConfig()->width = ui_w; + g_game_singletons->pySystem.GetConfig()->height = ui_h; + } + g_game_singletons->pySystem.GetDisplaySettings(); // 40250 CPythonApplication::Create (PythonApplication.cpp:1233) g_flying_manager->SetMapManagerPtr(&g_game_singletons->pyBackground); // 40250 CPythonApplication ctor (PythonApplication.cpp:82) return true; } @@ -390,6 +412,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error) initgrpText(); initwndMgr(); initapp(); + initsystem(); initchr(); initchrmgr(); initPlayer(); @@ -403,11 +426,15 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error) initEvent(); initeffect(); initfly(); + initsnd(); initeventmgr(); initshop(); initskill(); initquest(); initBackground(); + initMessenger(); + initsafebox(); + initguild(); initServerStateChecker(); init_2v0_gameplay_stubs(); @@ -600,6 +627,7 @@ void Stop() g_race_manager.reset(); g_server_state_checker.reset(); g_flying_manager.reset(); + g_sound_manager.reset(); g_player.reset(); g_account_connector.reset(); g_network_stream.reset(); diff --git a/extension/src/platform/UserInterface/PythonApplication.cpp b/extension/src/platform/UserInterface/PythonApplication.cpp index f0721cd6..5efcddc8 100644 --- a/extension/src/platform/UserInterface/PythonApplication.cpp +++ b/extension/src/platform/UserInterface/PythonApplication.cpp @@ -278,32 +278,10 @@ bool CPythonApplication::Process() return true; } -// 40250 PythonApplicationEvent.cpp:5 -void CPythonApplication::OnCameraUpdate() -{ - if ( CPythonBackground::Instance().IsMapReady() ) - { - CCamera* pkCameraMgr = CCameraManager::Instance().GetCurrentCamera(); - if (pkCameraMgr) - pkCameraMgr->Update(); - } -} - -// 40250 PythonApplicationEvent.cpp:15-25 -void CPythonApplication::OnUIUpdate() -{ - UI::CWindowManager& rkUIMgr=UI::CWindowManager::Instance(); - rkUIMgr.Update(); -} - -void CPythonApplication::OnUIRender() -{ - UI::CWindowManager& rkUIMgr=UI::CWindowManager::Instance(); - rkUIMgr.Render(); -} // 40250 PythonApplicationCursor.cpp. PORT: the members live here until the application object exists // (initial values from the constructor and CreateCursors); the host draws no hardware cursor, so every // shape in [0, CURSOR_COUNT) counts as loaded in place of m_CursorHandleMap. +PyObject* s_poMouseHandler = NULL; // m_poMouseHandler namespace { int s_iCursorNum = CPythonApplication::CURSOR_SHAPE_NORMAL; // m_iCursorNum @@ -311,7 +289,6 @@ int s_iContinuousCursorNum = CPythonApplication::CURSOR_SHAPE_NORMAL; // m_iCont BOOL s_bCursorVisible = TRUE; // m_bCursorVisible bool s_bLiarCursorOn = false; // m_bLiarCursorOn int s_iCursorMode = CPythonApplication::CURSOR_MODE_HARDWARE; // m_iCursorMode -PyObject* s_poMouseHandler = NULL; // m_poMouseHandler } void CPythonApplication::SetCursorVisible(BOOL bFlag, bool bLiarCursorOn) @@ -414,10 +391,64 @@ time_t CPythonApplication::GetServerTime() { MT_PLATFORM_STUB(); return 0; } time_t CPythonApplication::GetServerTimeStamp() { MT_PLATFORM_STUB(); return 0; } void CPythonApplication::SetConnectData(const char*, int) { MT_PLATFORM_STUB(); } void CPythonApplication::GetConnectData(std::string& ip, int& port) { MT_PLATFORM_STUB(); ip.clear(); port = 0; } -void CPythonApplication::SaveCameraSetting(const char*) { MT_PLATFORM_STUB(); } -bool CPythonApplication::LoadCameraSetting(const char*) { MT_PLATFORM_STUB(); return false; } void CPythonApplication::SetForceSightRange(int) { MT_PLATFORM_STUB(); } +int CPythonApplication::CheckDeviceState() +{ + return DEVICE_STATE_OK; +} + +bool CPythonApplication::CreateDevice(int width, int height, int Windowed, int bit, int frequency) +{ + static CGraphicDevice s_grpDevice; + return s_grpDevice.Create(NULL, width, height, Windowed ? true : false, bit, frequency) == CGraphicDevice::CREATE_OK; +} + +void CPythonApplication::NotifyHack(const char* c_szFormat, ...) +{ + char szBuf[1024]; + va_list args; + va_start(args, c_szFormat); + vsnprintf(szBuf, sizeof(szBuf), c_szFormat, args); + va_end(args); + CPythonNetworkStream::Instance().NotifyHack(szBuf); +} + +void CPythonApplication::SkipRenderBuffering(DWORD dwSleepMSec) +{ + MT_PLATFORM_STUB(); +} + +void CPythonApplication::UpdateClientRect() +{ + unsigned w = 0, h = 0; + UIRenderGetSize(&w, &h); + UI::CWindowManager::Instance().SetResolution(w, h); +} + +int CPythonApplication::GetWidth() +{ + unsigned w = 0, h = 0; + UIRenderGetSize(&w, &h); + return (int)w; +} + +int CPythonApplication::GetHeight() +{ + unsigned w = 0, h = 0; + UIRenderGetSize(&w, &h); + return (int)h; +} + +void CPythonApplication::Clear() +{ + CPythonSystem::Instance().Clear(); +} + +void CPythonApplication::Destroy() +{ +} + void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); } BOOL PERF_CHECKER_RENDER_GAME = FALSE; @@ -507,59 +538,4 @@ bool LoadLocaleData(const char* localePath) NANOEND return true; } -namespace { -// The supplied 40250 Client/locale.cfg selects "en" (code page 1252). -// Keep these mutable for app.ForceSetLocale, as Locale.cpp does. -std::string locale_name = "en"; -std::string locale_path = "locale/en"; -} -const char* LocaleService_GetName() { return "EUROPE"; } -bool LocaleService_IsCHEONMA() { MT_PLATFORM_STUB(); return false; } -void LocaleService_SetCHEONMA(bool) { MT_PLATFORM_STUB(); } -unsigned LocaleService_GetCodePage() { return 1252; } -const char* LocaleService_GetLocaleName() { return locale_name.c_str(); } -const char* LocaleService_GetLocalePath() { return locale_path.c_str(); } -void LocaleService_ForceSetLocale(const char* name, const char* path) { - locale_name = name ? name : ""; - 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 ); -} diff --git a/extension/src/platform/UserInterface/PythonApplicationCamera.cpp b/extension/src/platform/UserInterface/PythonApplicationCamera.cpp index 3933efe0..3c879461 100644 --- a/extension/src/platform/UserInterface/PythonApplicationCamera.cpp +++ b/extension/src/platform/UserInterface/PythonApplicationCamera.cpp @@ -7,6 +7,8 @@ #include "EterBase/Timer.h" #include "EterLib/Camera.h" +#include "EterLib/Util.h" +#include "EterLib/TextFileLoader.h" // 40250 PythonApplication.cpp:28-30 float c_fDefaultCameraRotateSpeed = 1.5f; @@ -406,3 +408,71 @@ void CPythonApplication::SetCameraSpeed(int iPercentage) s_app.m_fCameraPitchSpeed = c_fDefaultCameraPitchSpeed * float(iPercentage) / 100.0f; s_app.m_fCameraZoomSpeed = c_fDefaultCameraZoomSpeed * float(iPercentage) / 100.0f; } + +void CPythonApplication::SaveCameraSetting(const char * c_szFileName) +{ + SCameraSetting CameraSetting; + GetCameraSetting(&CameraSetting); + + FILE * File = fopen(c_szFileName, "w"); + if (!File) + return; + + PrintfTabs(File, 0, "CenterPos %f %f %f\n", CameraSetting.v3CenterPosition.x, CameraSetting.v3CenterPosition.y, CameraSetting.v3CenterPosition.z); + PrintfTabs(File, 0, "CameraSetting %f %f %f\n", CameraSetting.fZoom, CameraSetting.fPitch, CameraSetting.fRotation); + PrintfTabs(File, 0, "CmrPos %f %f %f\n", CameraSetting.kCmrPos.m_fUpDir, CameraSetting.kCmrPos.m_fViewDir, CameraSetting.kCmrPos.m_fCrossDir); + Tracef("SaveCameraSetting(%s) - (CenterPos %d %d %d) (Distance %d, Pitch %d, Rotation %d) (UpDir %d, ViewDir %d, CrossDir %d)\n", + c_szFileName, + int(CameraSetting.v3CenterPosition.x), + int(CameraSetting.v3CenterPosition.y), + int(CameraSetting.v3CenterPosition.z), + int(CameraSetting.fZoom), + int(CameraSetting.fPitch), + int(CameraSetting.fRotation), + int(CameraSetting.kCmrPos.m_fUpDir), + int(CameraSetting.kCmrPos.m_fViewDir), + int(CameraSetting.kCmrPos.m_fCrossDir)); + fclose(File); +} + +bool CPythonApplication::LoadCameraSetting(const char * c_szFileName) +{ + CTextFileLoader TextFileLoader; + if (!TextFileLoader.Load(c_szFileName)) + return false; + + D3DXVECTOR3 v3CenterPosition; + CTokenVector * pCenterPos; + if (TextFileLoader.GetTokenVector("centerpos", &pCenterPos)) + if (3 == pCenterPos->size()) + { + v3CenterPosition.x = atof(pCenterPos->at(0).c_str()); + v3CenterPosition.y = atof(pCenterPos->at(1).c_str()); + v3CenterPosition.z = atof(pCenterPos->at(2).c_str()); + } + + CTokenVector * pCameraSetting; + CTokenVector * pCmrPos; + if (TextFileLoader.GetTokenVector("camerasetting", &pCameraSetting)) + if (TextFileLoader.GetTokenVector("cmrpos", &pCmrPos)) + if (3 == pCameraSetting->size()) + if (3 == pCmrPos->size()) + { + SCameraSetting CameraSetting; + CameraSetting.v3CenterPosition = v3CenterPosition; + + CameraSetting.fZoom = atof(pCameraSetting->at(0).c_str()); + CameraSetting.fPitch = atof(pCameraSetting->at(1).c_str()); + CameraSetting.fRotation = atof(pCameraSetting->at(2).c_str()); + + CameraSetting.kCmrPos.m_fUpDir = atof(pCmrPos->at(0).c_str()); + CameraSetting.kCmrPos.m_fViewDir = atof(pCmrPos->at(1).c_str()); + CameraSetting.kCmrPos.m_fCrossDir = atof(pCmrPos->at(2).c_str()); + + SetEventCamera(CameraSetting); + return true; + } + + return false; +} + diff --git a/extension/src/platform/UserInterface/PythonApplicationEvent.cpp b/extension/src/platform/UserInterface/PythonApplicationEvent.cpp new file mode 100644 index 00000000..297acc00 --- /dev/null +++ b/extension/src/platform/UserInterface/PythonApplicationEvent.cpp @@ -0,0 +1,217 @@ +#include "UserInterface/StdAfx.h" +#include "UserInterface/PythonApplication.h" +#include "UserInterface/PythonBackground.h" +#include "EterLib/Camera.h" + +extern PyObject* s_poMouseHandler; + +void CPythonApplication::OnCameraUpdate() +{ + if ( CPythonBackground::Instance().IsMapReady() ) + { + CCamera* pkCameraMgr = CCameraManager::Instance().GetCurrentCamera(); + if (pkCameraMgr) + pkCameraMgr->Update(); + } +} + +void CPythonApplication::OnUIUpdate() +{ + UI::CWindowManager& rkUIMgr = UI::CWindowManager::Instance(); + rkUIMgr.Update(); +} + +void CPythonApplication::OnUIRender() +{ + UI::CWindowManager& rkUIMgr = UI::CWindowManager::Instance(); + rkUIMgr.Render(); +} + +void CPythonApplication::OnSizeChange(int width, int height) +{ +} + +void CPythonApplication::OnMouseMiddleButtonDown(int x, int y) +{ + CCameraManager& rkCmrMgr = CCameraManager::Instance(); + CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera(); + if (pkCmrCur) + pkCmrCur->BeginDrag(x, y); + + if ( !CPythonBackground::Instance().IsMapReady() ) + return; + + SetCursorNum(CAMERA_ROTATE); + if ( CURSOR_MODE_HARDWARE == GetCursorMode()) + SetCursorVisible(FALSE, true); +} + +void CPythonApplication::OnMouseMiddleButtonUp(int x, int y) +{ + CCameraManager& rkCmrMgr = CCameraManager::Instance(); + CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera(); + if (pkCmrCur) + pkCmrCur->EndDrag(); + + if ( !CPythonBackground::Instance().IsMapReady() ) + return; + + SetCursorNum(NORMAL); + if ( CURSOR_MODE_HARDWARE == GetCursorMode()) + SetCursorVisible(TRUE); +} + +void CPythonApplication::OnMouseWheel(int nLen) +{ + CCameraManager& rkCmrMgr = CCameraManager::Instance(); + CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera(); + if (pkCmrCur) + pkCmrCur->Wheel(nLen); +} + +void CPythonApplication::OnMouseMove(int x, int y) +{ + CCameraManager& rkCmrMgr = CCameraManager::Instance(); + CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera(); + + POINT Point; + if (pkCmrCur) + { + if ( CPythonBackground::Instance().IsMapReady() && pkCmrCur->Drag(x, y, &Point) ) + { + x = Point.x; + y = Point.y; + } + } + + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseMove(x, y); +} + +void CPythonApplication::OnMouseLeftButtonDown(int x, int y) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseLeftButtonDown(x, y); +} + +void CPythonApplication::OnMouseLeftButtonUp(int x, int y) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseLeftButtonUp(x, y); +} + +void CPythonApplication::OnMouseLeftButtonDoubleClick(int x, int y) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseLeftButtonDown(x, y); + rkWndMgr.RunMouseLeftButtonDoubleClick(x, y); +} + +void CPythonApplication::OnMouseRightButtonDown(int x, int y) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseRightButtonDown(x, y); +} + +void CPythonApplication::OnMouseRightButtonUp(int x, int y) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunMouseRightButtonUp(x, y); +} + +void CPythonApplication::OnKeyDown(int iIndex) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + + if (DIK_ESCAPE == iIndex) + { + rkWndMgr.RunPressEscapeKey(); + } + + rkWndMgr.RunKeyDown(iIndex); +} + +void CPythonApplication::OnKeyUp(int iIndex) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunKeyUp(iIndex); +} + +void CPythonApplication::RunIMEUpdate() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunIMEUpdate(); +} + +void CPythonApplication::RunIMETabEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunIMETabEvent(); +} + +void CPythonApplication::RunIMEReturnEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunIMEReturnEvent(); +} + +void CPythonApplication::OnIMEKeyDown(int iIndex) +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunIMEKeyDown(iIndex); +} + +void CPythonApplication::RunIMEChangeCodePage() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunChangeCodePage(); +} + +void CPythonApplication::RunIMEOpenCandidateListEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunOpenCandidate(); +} + +void CPythonApplication::RunIMECloseCandidateListEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunCloseCandidate(); +} + +void CPythonApplication::RunIMEOpenReadingWndEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunOpenReading(); +} + +void CPythonApplication::RunIMECloseReadingWndEvent() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunCloseReading(); +} + +void CPythonApplication::RunPressExitKey() +{ + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + rkWndMgr.RunPressExitKey(); +} + +void CPythonApplication::OnMouseUpdate() +{ + if (!s_poMouseHandler) + return; + + UI::CWindowManager& rkWndMgr = UI::CWindowManager::Instance(); + long lx, ly; + rkWndMgr.GetMousePosition(lx, ly); + PyCallClassMemberFunc(s_poMouseHandler, "Update", Py_BuildValue("(ii)", lx, ly)); +} + +void CPythonApplication::OnMouseRender() +{ + if (!s_poMouseHandler) + return; + + PyCallClassMemberFunc(s_poMouseHandler, "Render", Py_BuildValue("()")); +} diff --git a/extension/src/platform/pending/GameLib/RaceData.cpp b/extension/src/platform/pending/GameLib/RaceData.cpp deleted file mode 100644 index 35117c05..00000000 --- a/extension/src/platform/pending/GameLib/RaceData.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Stand-in for the 40250 logic unit GameLib/RaceData.cpp, not ported yet: the members the ported units -// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/ -// (docs/PORT-PLAN.md). -#include "GameLib/StdAfx.h" -#include "GameLib/RaceData.h" - -#include "../../PlatformStub.h" - -auto CRaceData::GetNormalAttackIndex(WORD, WORD *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/GuildMarkDownloader.cpp b/extension/src/platform/pending/UserInterface/GuildMarkDownloader.cpp deleted file mode 100644 index 9be8ac09..00000000 --- a/extension/src/platform/pending/UserInterface/GuildMarkDownloader.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/GuildMarkDownloader.cpp, not ported yet: the platform_stub.py skeleton of its -// header, so the units that call it (批次 2V1, the network slice) link. Delete this file in the commit -// that ports the unit into port/ (docs/PORT-PLAN.md 2V1). -#include "UserInterface/StdAfx.h" -#include "UserInterface/GuildMarkDownloader.h" - -#include "../../PlatformStub.h" - -CGuildMarkDownloader::CGuildMarkDownloader() -{ - MT_PLATFORM_STUB(); -} - -CGuildMarkDownloader::~CGuildMarkDownloader() -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::Connect(const CNetworkAddress &, DWORD, DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::ConnectToRecvSymbol(const CNetworkAddress &, DWORD, DWORD, const std::vector &) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::Process() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::OnConnectFailure() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::OnConnectSuccess() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::OnRemoteDisconnect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::OnDisconnect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::__Initialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::__StateProcess() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__GetPacketSize(UINT) -> UINT -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__DispatchPacket(UINT) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__OfflineState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::__CompleteState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::__LoginState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkDownloader::__LoginState_Process() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvPhase() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvHandshake() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvPing() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvMarkIndex() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvMarkBlock() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvSymbolData() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvKeyAgreement() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__LoginState_RecvKeyAgreementCompleted() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__SendMarkIDXList() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__SendMarkCRCList() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkDownloader::__SendSymbolCRCList() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/GuildMarkUploader.cpp b/extension/src/platform/pending/UserInterface/GuildMarkUploader.cpp deleted file mode 100644 index dcb55bc1..00000000 --- a/extension/src/platform/pending/UserInterface/GuildMarkUploader.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/GuildMarkUploader.cpp, not ported yet: the platform_stub.py skeleton of its -// header, so the units that call it (批次 2V1, the network slice) link. Delete this file in the commit -// that ports the unit into port/ (docs/PORT-PLAN.md 2V1). -#include "UserInterface/StdAfx.h" -#include "UserInterface/GuildMarkUploader.h" - -#include "../../PlatformStub.h" - -CGuildMarkUploader::CGuildMarkUploader() -{ - MT_PLATFORM_STUB(); -} - -CGuildMarkUploader::~CGuildMarkUploader() -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::Disconnect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::Connect(const CNetworkAddress &, DWORD, DWORD, DWORD, const char *, UINT *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::ConnectToSendSymbol(const CNetworkAddress &, DWORD, DWORD, DWORD, const char *, UINT *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::IsCompleteUploading() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::Process() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::OnConnectFailure() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::OnConnectSuccess() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::OnRemoteDisconnect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::OnDisconnect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::__Load(const char *, UINT *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoadSymbol(const char *, UINT *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__Save(const char *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__Inialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::__StateProcess() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__OfflineState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::__CompleteState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::__LoginState_Set() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkUploader::__LoginState_Process() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoginState_RecvPhase() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoginState_RecvHandshake() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoginState_RecvPing() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoginState_RecvKeyAgreement() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__AnalyzePacket(UINT, UINT, bool (CGuildMarkUploader::*)()) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__SendMarkPacket() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkUploader::__SendSymbolPacket() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/Locale.cpp b/extension/src/platform/pending/UserInterface/Locale.cpp deleted file mode 100644 index 4cf93362..00000000 --- a/extension/src/platform/pending/UserInterface/Locale.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/Locale.cpp, not ported yet: the members the ported units -// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/ -// (docs/PORT-PLAN.md). -#include "UserInterface/StdAfx.h" -#include "UserInterface/Locale.h" - -#include "../../PlatformStub.h" - -auto LocaleService_GetSkillPower(unsigned int) -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/MarkManager.cpp b/extension/src/platform/pending/UserInterface/MarkManager.cpp deleted file mode 100644 index 52b1eb1d..00000000 --- a/extension/src/platform/pending/UserInterface/MarkManager.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/MarkManager.cpp, not ported yet: the platform_stub.py skeleton of its -// header, so the units that call it (批次 2V1, the network slice) link. Delete this file in the commit -// that ports the unit into port/ (docs/PORT-PLAN.md 2V1). -#include "UserInterface/StdAfx.h" -#include "UserInterface/MarkManager.h" - -#include "../../PlatformStub.h" - -CGuildMarkManager::CGuildMarkManager() -{ - MT_PLATFORM_STUB(); -} - -CGuildMarkManager::~CGuildMarkManager() -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::GetGuildSymbol(DWORD) -> const TGuildSymbol * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::LoadSymbol(const char *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::SaveSymbol(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::UploadSymbol(DWORD, int, const BYTE *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::SetMarkPathPrefix(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::LoadMarkIndex() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::SaveMarkIndex() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::LoadMarkImages() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::SaveMarkImage(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::GetMarkImageFilename(DWORD, std::string &) const -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::AddMarkIDByGuildID(DWORD, DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::GetMarkImageCount() const -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::GetMarkCount() const -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::GetMarkID(DWORD) -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::CopyMarkIdx(char *) const -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::SaveMark(DWORD, BYTE *) -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::DeleteMark(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::GetDiffBlocks(DWORD, const DWORD *, std::map &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::SaveBlockFromCompressedData(DWORD, DWORD, const BYTE *, DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::GetBlockCRCList(DWORD, DWORD *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::__NewImage() -> CGuildMarkImage * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::__DeleteImage(CGuildMarkImage *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CGuildMarkManager::__AllocMarkID(DWORD) -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::__GetImage(DWORD) -> CGuildMarkImage * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CGuildMarkManager::__GetImagePtr(DWORD) -> CGuildMarkImage * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/PythonGuild.cpp b/extension/src/platform/pending/UserInterface/PythonGuild.cpp deleted file mode 100644 index 5327fb76..00000000 --- a/extension/src/platform/pending/UserInterface/PythonGuild.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// Stand-in for the 40250 unit UserInterface/PythonGuild.cpp, not ported yet: the CPythonGuild member the ported -// net module (批次 2V1) references, as an MT_PLATFORM_STUB(). Delete this file in the commit that ports the unit -// into port/ (docs/PORT-PLAN.md 2V1). -#include "UserInterface/StdAfx.h" -#include "UserInterface/PythonGuild.h" - -#include "../../PlatformStub.h" - -BOOL CPythonGuild::GetMemberDataPtrByName(const char *, TGuildMemberData **) -{ - MT_PLATFORM_STUB(); - return FALSE; -} - -auto CPythonGuild::Destroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::EnableGuild() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::SetGuildMoney(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::SetGuildEXP(BYTE, DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::SetGradeData(BYTE, TGuildGradeData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::SetGradeName(BYTE, const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::SetGradeAuthority(BYTE, BYTE) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::ClearComment() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::RegisterComment(DWORD, const char *, const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::RegisterMember(TGuildMemberData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::ChangeGuildMemberGrade(DWORD, BYTE) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::ChangeGuildMemberGeneralFlag(DWORD, BYTE) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::RemoveMember(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::RegisterGuildName(DWORD, const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::IsMainPlayer(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonGuild::GetGuildInfoRef() -> TGuildInfo & -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonGuild::GetMemberDataPtrByPID(DWORD, TGuildMemberData **) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonGuild::GetGuildSkillDataRef() -> TGuildSkillData & -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonGuild::GetGuildName(DWORD, std::string *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonGuild::StartGuildWar(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::EndGuildWar(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -CPythonGuild::CPythonGuild() -{ - MT_PLATFORM_STUB(); -} - -CPythonGuild::~CPythonGuild() -{ - MT_PLATFORM_STUB(); -} - -auto CPythonGuild::IsDoingGuildWar() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/PythonMessenger.cpp b/extension/src/platform/pending/UserInterface/PythonMessenger.cpp deleted file mode 100644 index b91d7ab1..00000000 --- a/extension/src/platform/pending/UserInterface/PythonMessenger.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/PythonMessenger.cpp, not ported yet: the members the ported units -// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/ -// (docs/PORT-PLAN.md). -#include "UserInterface/StdAfx.h" -#include "UserInterface/PythonMessenger.h" - -#include "../../PlatformStub.h" - -CPythonMessenger::CPythonMessenger() -{ - MT_PLATFORM_STUB(); -} - -CPythonMessenger::~CPythonMessenger() -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::OnFriendLogin(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::OnFriendLogout(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::SetMobile(const char *, BYTE) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::AppendGuildMember(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::RemoveGuildMember(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::RemoveAllGuildMember() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::LoginGuildMember(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonMessenger::LogoutGuildMember(const char *) -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/platform/pending/UserInterface/PythonSafeBox.cpp b/extension/src/platform/pending/UserInterface/PythonSafeBox.cpp deleted file mode 100644 index 1e0095aa..00000000 --- a/extension/src/platform/pending/UserInterface/PythonSafeBox.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/PythonSafeBox.cpp, not ported yet: the members the ported units -// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/ -// (docs/PORT-PLAN.md). -#include "UserInterface/StdAfx.h" -#include "UserInterface/PythonSafeBox.h" - -#include "../../PlatformStub.h" - -CPythonSafeBox::CPythonSafeBox() -{ - MT_PLATFORM_STUB(); -} - -CPythonSafeBox::~CPythonSafeBox() -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::OpenSafeBox(int) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::SetItemData(DWORD, const TItemData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::DelItemData(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::SetMoney(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::GetSlotItemID(DWORD, DWORD *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonSafeBox::OpenMall(int) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::SetMallItemData(DWORD, const TItemData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::DelMallItemData(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSafeBox::GetSlotMallItemID(DWORD, DWORD *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/pending/UserInterface/PythonSystem.cpp b/extension/src/platform/pending/UserInterface/PythonSystem.cpp deleted file mode 100644 index e8310931..00000000 --- a/extension/src/platform/pending/UserInterface/PythonSystem.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Stand-in for the 40250 logic unit UserInterface/PythonSystem.cpp, not ported yet: the members the ported units -// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/ -// (docs/PORT-PLAN.md). -#include "UserInterface/StdAfx.h" -#include "UserInterface/PythonSystem.h" - -#include "../../PlatformStub.h" - -CPythonSystem::CPythonSystem() -{ - MT_PLATFORM_STUB(); -} - -CPythonSystem::~CPythonSystem() -{ - MT_PLATFORM_STUB(); -} - -auto CPythonSystem::IsShowDamage() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonSystem::GetShadowLevel() -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CPythonSystem::SetSoftwareTiling(bool isEnable) -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/port/EterLib/NetDatagram.cpp b/extension/src/port/EterLib/NetDatagram.cpp new file mode 100644 index 00000000..2020d989 --- /dev/null +++ b/extension/src/port/EterLib/NetDatagram.cpp @@ -0,0 +1,99 @@ +#include "StdAfx.h" +#include "NetDatagram.h" + +CNetworkDatagram::CNetworkDatagram() +{ + __Initialize(); +} + +CNetworkDatagram::~CNetworkDatagram() +{ + Destroy(); +} + +void CNetworkDatagram::Destroy() +{ + if (INVALID_SOCKET==m_sock) + return; + + closesocket(m_sock); + + __Initialize(); +} + +bool CNetworkDatagram::Create(UINT uPort) +{ + assert(INVALID_SOCKET==m_sock); + m_sock = socket(AF_INET, SOCK_DGRAM, 0); + + DWORD arg = 1; + ioctlsocket(m_sock, FIONBIO, &arg); // Non-blocking mode + + SOCKADDR_IN sockAddrIn; + memset(&sockAddrIn, 0, sizeof(SOCKADDR_IN)); + sockAddrIn.sin_family = AF_INET; + sockAddrIn.sin_addr.s_addr = INADDR_ANY; + sockAddrIn.sin_port = htons(uPort); + + if (SOCKET_ERROR == bind(m_sock, (PSOCKADDR)&sockAddrIn, sizeof(SOCKADDR_IN))) + { + return false; + } + + return true; +} + +#pragma warning(push) +#pragma warning(disable:4127) +void CNetworkDatagram::Update() +{ + if (m_sock == INVALID_SOCKET) + return; + + FD_ZERO(&m_fdsRecv); + FD_ZERO(&m_fdsSend); + + FD_SET(m_sock, &m_fdsRecv); + FD_SET(m_sock, &m_fdsSend); + + TIMEVAL delay; + + delay.tv_sec = 0; + delay.tv_usec = 0; + + if (select(0, &m_fdsRecv, &m_fdsSend, NULL, &delay) == SOCKET_ERROR) + return; +} +#pragma warning(pop) + +bool CNetworkDatagram::CanRecv() +{ + if (FD_ISSET(m_sock, &m_fdsRecv)) + return true; + + return false; +} + + +int CNetworkDatagram::PeekRecvFrom(UINT uBufLen, void* pvBuf, SOCKADDR_IN* pkSockAddrIn) +{ + int nSockAddrInLen=sizeof(SOCKADDR_IN); + return recvfrom(m_sock, (char*)pvBuf, uBufLen, MSG_PEEK, (PSOCKADDR)pkSockAddrIn, &nSockAddrInLen); +} + +int CNetworkDatagram::RecvFrom(UINT uBufLen, void* pvBuf, SOCKADDR_IN* pkSockAddrIn) +{ + int nSockAddrInLen=sizeof(SOCKADDR_IN); + return recvfrom(m_sock, (char*)pvBuf, uBufLen, 0, (PSOCKADDR)pkSockAddrIn, &nSockAddrInLen); +} + +int CNetworkDatagram::SendTo(UINT uBufLen, const void* c_pvBuf, const SOCKADDR_IN& c_rkSockAddrIn) +{ + return sendto(m_sock, (const char *)c_pvBuf, uBufLen, 0, (PSOCKADDR)&c_rkSockAddrIn, sizeof(SOCKADDR_IN)); +} + + +void CNetworkDatagram::__Initialize() +{ + m_sock=INVALID_SOCKET; +} \ No newline at end of file diff --git a/extension/src/port/EterLib/NetDatagram.h b/extension/src/port/EterLib/NetDatagram.h new file mode 100644 index 00000000..7a0b4ee1 --- /dev/null +++ b/extension/src/port/EterLib/NetDatagram.h @@ -0,0 +1,28 @@ +#pragma once + +class CNetworkDatagram +{ + public: + CNetworkDatagram(); + virtual ~CNetworkDatagram(); + + void Destroy(); + bool Create(UINT uPort); + + void Update(); + + bool CanRecv(); + + int PeekRecvFrom(UINT uBufLen, void* pvBuf, SOCKADDR_IN* pkSockAddrIn); + int RecvFrom(UINT uBufLen, void* pvBuf, SOCKADDR_IN* pkSockAddrIn); + int SendTo(UINT uBufLen, const void* c_pvBuf, const SOCKADDR_IN& c_rkSockAddrIn); + + private: + void __Initialize(); + + private: + SOCKET m_sock; + + fd_set m_fdsRecv; + fd_set m_fdsSend; +}; \ No newline at end of file diff --git a/extension/src/port/EterLib/NetDatagramReceiver.cpp b/extension/src/port/EterLib/NetDatagramReceiver.cpp new file mode 100644 index 00000000..144faca1 --- /dev/null +++ b/extension/src/port/EterLib/NetDatagramReceiver.cpp @@ -0,0 +1,105 @@ +#include "StdAfx.h" +#include "NetDatagramReceiver.h" + +BOOL CNetDatagramReceiver::Process() +{ + m_recvBufCurrentPos = 0; + m_recvBufCurrentSize = 0; + + int irecvAddrLength = sizeof(SOCKADDR_IN); + m_recvBufCurrentSize = recvfrom(m_Socket, (char *)m_recvBuf, m_recvBufSize, 0, (PSOCKADDR)&m_SockAddr, &irecvAddrLength); + + if (m_recvBufCurrentSize <= 0) + { + return FALSE; + } + + return TRUE; +} + +BOOL CNetDatagramReceiver::Recv(void * pBuffer, int iSize) +{ + if (!Peek(pBuffer, iSize)) + return FALSE; + + m_recvBufCurrentPos += iSize; + return TRUE; +} + +BOOL CNetDatagramReceiver::Peek(void * pBuffer, int iSize) +{ + if (m_recvBufCurrentSize < m_recvBufCurrentPos+iSize) + return FALSE; + + memcpy(pBuffer, m_recvBuf + m_recvBufCurrentPos, iSize); + return TRUE; +} + +BOOL CNetDatagramReceiver::isBind() +{ + return m_isBind; +} + +BOOL CNetDatagramReceiver::Bind(DWORD /*dwAddress*/, WORD wPortIndex) +{ + m_Socket = socket(AF_INET, SOCK_DGRAM, 0); + + DWORD arg = 1; + ioctlsocket(m_Socket, FIONBIO, &arg); // Non-blocking mode + + memset(&m_SockAddr, 0, sizeof(SOCKADDR_IN)); + m_SockAddr.sin_family = AF_INET; +// m_SockAddr.sin_addr.s_addr = dwAddress; + m_SockAddr.sin_addr.s_addr = INADDR_ANY; + m_SockAddr.sin_port = htons(wPortIndex); + + if (bind(m_Socket, (PSOCKADDR)&m_SockAddr, sizeof(SOCKADDR_IN)) < 0) + { + Tracef("Failed binding socket\n"); + return FALSE; + } + + m_isBind = TRUE; + + return TRUE; +} + +void CNetDatagramReceiver::SetRecvBufferSize(int recvBufSize) +{ + if (m_recvBuf) + { + if (m_recvBufSize>recvBufSize) + return; + + delete [] m_recvBuf; + } + m_recvBufSize=recvBufSize; + m_recvBuf=new char[m_recvBufSize]; +} + +void CNetDatagramReceiver::Clear() +{ + + m_isBind = FALSE; + + m_dwPortIndex = 1000; + + m_Socket = 0; + memset(&m_SockAddr, 0, sizeof(SOCKADDR_IN)); + + m_recvBufCurrentPos = 0; + m_recvBufCurrentSize = 0; +} + +CNetDatagramReceiver::CNetDatagramReceiver() +{ + m_recvBuf = NULL; + m_recvBufSize = 0; + + Clear(); +} +CNetDatagramReceiver::~CNetDatagramReceiver() +{ + if (m_recvBuf) + delete [] m_recvBuf; +} \ No newline at end of file diff --git a/extension/src/port/EterLib/NetDatagramReceiver.h b/extension/src/port/EterLib/NetDatagramReceiver.h new file mode 100644 index 00000000..d8615e5f --- /dev/null +++ b/extension/src/port/EterLib/NetDatagramReceiver.h @@ -0,0 +1,36 @@ +#pragma once + +#ifndef VC_EXTRALEAN + +class CNetDatagramReceiver +{ + public: + CNetDatagramReceiver(); + virtual ~CNetDatagramReceiver(); + + void Clear(); + BOOL Bind(DWORD dwAddress, WORD wPortIndex); + BOOL isBind(); + + BOOL Process(); + BOOL Recv(void * pBuffer, int iSize); + BOOL Peek(void * pBuffer, int iSize); + + void SetRecvBufferSize(int recvBufSize); + + protected: + BOOL m_isBind; + + DWORD m_dwPortIndex; + + SOCKET m_Socket; + SOCKADDR_IN m_SockAddr; + + int m_recvBufCurrentPos; + int m_recvBufCurrentSize; + + char* m_recvBuf; + int m_recvBufSize; +}; + +#endif \ No newline at end of file diff --git a/extension/src/port/EterLib/NetDatagramSender.cpp b/extension/src/port/EterLib/NetDatagramSender.cpp new file mode 100644 index 00000000..72497ee7 --- /dev/null +++ b/extension/src/port/EterLib/NetDatagramSender.cpp @@ -0,0 +1,58 @@ +#include "StdAfx.h" +#include "NetDatagramSender.h" + +BOOL CNetDatagramSender::SetSocket(const char * c_szIP, WORD wPortIndex) +{ + return SetSocket(inet_addr(c_szIP), wPortIndex); +} + +BOOL CNetDatagramSender::SetSocket(DWORD dwAddress, WORD wPortIndex) +{ + m_isSocket = TRUE; + + m_dwAddress = dwAddress; + m_wPortIndex = wPortIndex; + + m_Socket = socket(AF_INET, SOCK_DGRAM, 0); + + memset(&m_SockAddr, 0, sizeof(SOCKADDR_IN)); + m_SockAddr.sin_family = AF_INET; + m_SockAddr.sin_addr.s_addr = dwAddress; + m_SockAddr.sin_port = htons(wPortIndex); + + return TRUE; +} + +BOOL CNetDatagramSender::Send(const void * pBuffer, int iSize) +{ + assert(isSocket()); + + int iSendingLength = sendto(m_Socket, (const char *)pBuffer, iSize, 0, (PSOCKADDR)&m_SockAddr, sizeof(SOCKADDR_IN)); + if (iSendingLength < 0) + { + Tracef("Failed sending packet\n"); + return FALSE; + } + + return TRUE; +} + +BOOL CNetDatagramSender::isSocket() +{ + return m_isSocket; +} + +CNetDatagramSender::CNetDatagramSender() +{ + m_isSocket = FALSE; + + m_dwAddress = 0; + m_wPortIndex = 1000; + + m_Socket = 0; + memset(&m_SockAddr, 0, sizeof(SOCKADDR_IN)); +} + +CNetDatagramSender::~CNetDatagramSender() +{ +} \ No newline at end of file diff --git a/extension/src/port/EterLib/NetDatagramSender.h b/extension/src/port/EterLib/NetDatagramSender.h new file mode 100644 index 00000000..8fb96f03 --- /dev/null +++ b/extension/src/port/EterLib/NetDatagramSender.h @@ -0,0 +1,27 @@ +#pragma once + +#ifndef VC_EXTRALEAN + +class CNetDatagramSender +{ + public: + CNetDatagramSender(); + virtual ~CNetDatagramSender(); + + BOOL isSocket(); + + BOOL SetSocket(const char * c_szIP, WORD wPortIndex); + BOOL SetSocket(DWORD dwAddress, WORD wPortIndex); + BOOL Send(const void * pBuffer, int iSize); + + protected: + BOOL m_isSocket; + + WORD m_dwAddress; + WORD m_wPortIndex; + + SOCKET m_Socket; + SOCKADDR_IN m_SockAddr; +}; + +#endif diff --git a/extension/src/port/EterLib/PathStack.cpp b/extension/src/port/EterLib/PathStack.cpp new file mode 100644 index 00000000..323d4903 --- /dev/null +++ b/extension/src/port/EterLib/PathStack.cpp @@ -0,0 +1,58 @@ +#include "StdAfx.h" +#include "PathStack.h" + +CPathStack::CPathStack() +{ + SetBase(); +} + +CPathStack::~CPathStack() +{ + MoveBase(); +} + +void CPathStack::GetCurrentPathName(std::string* pstCurPathName) +{ + assert(pstCurPathName!=NULL); + + char szPathName[MAX_PATH+1]; + _getcwd(szPathName, MAX_PATH); + + *pstCurPathName = szPathName; +} + +void CPathStack::Push() +{ + char szPathName[MAX_PATH+1]; + _getcwd(szPathName, MAX_PATH); + + m_stPathNameDeque.push_front(szPathName); +} + +bool CPathStack::Pop() +{ + if (m_stPathNameDeque.empty()) + { + assert(!"CPathStack::Pop Empty Stack"); + return false; + } + + _chdir(m_stPathNameDeque.front().c_str()); + m_stPathNameDeque.pop_front(); + return true; +} + +void CPathStack::MoveBase() +{ + _chdir(m_stBasePathName.c_str()); +} + +void CPathStack::SetBase() +{ + GetCurrentPathName(&m_stBasePathName); +} + +void CPathStack::Move(const char* c_szPathName) +{ + _chdir(c_szPathName); +} diff --git a/extension/src/port/EterLib/PathStack.h b/extension/src/port/EterLib/PathStack.h new file mode 100644 index 00000000..899e95a4 --- /dev/null +++ b/extension/src/port/EterLib/PathStack.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +class CPathStack +{ + public: + CPathStack(); + virtual ~CPathStack(); + + void SetBase(); + + void MoveBase(); + + void Push(); + + bool Pop(); + + void Move(const char* c_szPathName); + void GetCurrentPathName(std::string* pstCurPathName); + + protected: + std::string m_stBasePathName; + std::deque m_stPathNameDeque; +}; diff --git a/extension/src/port/EterLocale/Japanese.cpp b/extension/src/port/EterLocale/Japanese.cpp new file mode 100644 index 00000000..b2f21b1a --- /dev/null +++ b/extension/src/port/EterLocale/Japanese.cpp @@ -0,0 +1,71 @@ +#include "StdAfx.h" +#include "Japanese.h" + +// +// CP932: Shift-JIS (Japan Industry Standard) +// + +#define MACRO_IsLeadByte(c) ((0x81 <= (c) && (c) <= 0x9f) || ((0xe0 <= (c)) && (c) <= 0xfc)) +#define MACRO_IsTailByte(c) ((0x40 <= (c) && (c) <= 0x7e) || (0x80 <= (c) && (c) <= 0xfc)) + +BOOL ShiftJIS_IsLeadByte( const char chByte ) +{ + const unsigned char byByte = (const unsigned char) chByte; + + return MACRO_IsLeadByte( byByte ); +} + +BOOL ShiftJIS_IsTrailByte( const char chByte ) +{ + const unsigned char byByte = (const unsigned char) chByte; + + return MACRO_IsTailByte( byByte ); +} + +int ShiftJIS_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength ) +{ + const unsigned char* uszString1 = (const unsigned char*) szStringLeft; + const unsigned char* uszString2 = (const unsigned char*) szStringRight; + unsigned short c1, c2; + + if( sizeLength == 0 ) + return 0; + while( sizeLength-- ) { + c1 = *uszString1++; + if( MACRO_IsLeadByte(c1) ) { + if( sizeLength == 0 ) { + c1 = 0; + c2 = MACRO_IsLeadByte( *uszString2 ) ? 0 : *uszString2; + goto test; + } + if( *uszString1 == '\0' ) + c1 = 0; + else { + c1 = ((c1 << 8) | *uszString1++); + } + } else + c1 = tolower(c1); + + c2 = *uszString2++; + if( MACRO_IsLeadByte(c2) ) { + if( sizeLength == 0 ) { + c2 = 0; + goto test; + } + sizeLength--; + if( *uszString2 == '\0' ) + c2 = 0; + else { + c2 = ((c2 << 8) | *uszString2++); + } + } else + c2 = tolower(c2); +test: + if (c1 != c2) + return( (c1 > c2) ? 1 : -1); + + if (c1 == 0) + return(0); + } + return 0; +} diff --git a/extension/src/port/EterLocale/Japanese.h b/extension/src/port/EterLocale/Japanese.h new file mode 100644 index 00000000..05c0b280 --- /dev/null +++ b/extension/src/port/EterLocale/Japanese.h @@ -0,0 +1,5 @@ +#pragma once + +BOOL ShiftJIS_IsLeadByte( const char chByte ); +BOOL ShiftJIS_IsTrailByte( const char chByte ); +int ShiftJIS_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength ); diff --git a/extension/src/port/UserInterface/GuildMarkDownloader.cpp b/extension/src/port/UserInterface/GuildMarkDownloader.cpp new file mode 100644 index 00000000..fc22c2ff --- /dev/null +++ b/extension/src/port/UserInterface/GuildMarkDownloader.cpp @@ -0,0 +1,546 @@ +#include "StdAfx.h" +#include "GuildMarkDownloader.h" +#include "PythonCharacterManager.h" +#include "Packet.h" +#include "Test.h" + +// MARK_BUG_FIX +struct SMarkIndex +{ + WORD guild_id; + WORD mark_id; +}; + +// END_OFMARK_BUG_FIX + +CGuildMarkDownloader::CGuildMarkDownloader() +{ + SetRecvBufferSize(640*1024); + SetSendBufferSize(1024); + __Initialize(); +} + +CGuildMarkDownloader::~CGuildMarkDownloader() +{ + __OfflineState_Set(); +} + +bool CGuildMarkDownloader::Connect(const CNetworkAddress& c_rkNetAddr, DWORD dwHandle, DWORD dwRandomKey) +{ + __OfflineState_Set(); + + m_dwHandle=dwHandle; + m_dwRandomKey=dwRandomKey; + m_dwTodo=TODO_RECV_MARK; + return CNetworkStream::Connect(c_rkNetAddr); +} + +bool CGuildMarkDownloader::ConnectToRecvSymbol(const CNetworkAddress& c_rkNetAddr, DWORD dwHandle, DWORD dwRandomKey, const std::vector & c_rkVec_dwGuildID) +{ + __OfflineState_Set(); + + m_dwHandle=dwHandle; + m_dwRandomKey=dwRandomKey; + m_dwTodo=TODO_RECV_SYMBOL; + m_kVec_dwGuildID = c_rkVec_dwGuildID; + return CNetworkStream::Connect(c_rkNetAddr); +} + +void CGuildMarkDownloader::Process() +{ + CNetworkStream::Process(); + + if (!__StateProcess()) + { + __OfflineState_Set(); + Disconnect(); + } +} + +void CGuildMarkDownloader::OnConnectFailure() +{ + __OfflineState_Set(); +} + +void CGuildMarkDownloader::OnConnectSuccess() +{ + __LoginState_Set(); +} + +void CGuildMarkDownloader::OnRemoteDisconnect() +{ + __OfflineState_Set(); +} + +void CGuildMarkDownloader::OnDisconnect() +{ + __OfflineState_Set(); +} + +void CGuildMarkDownloader::__Initialize() +{ + m_eState=STATE_OFFLINE; + m_pkMarkMgr=NULL; + m_currentRequestingImageIndex=0; + m_dwBlockIndex=0; + m_dwBlockDataPos=0; + m_dwBlockDataSize=0; + + m_dwHandle=0; + m_dwRandomKey=0; + m_dwTodo=TODO_RECV_NONE; + m_kVec_dwGuildID.clear(); +} + +bool CGuildMarkDownloader::__StateProcess() +{ + switch (m_eState) + { + case STATE_LOGIN: + return __LoginState_Process(); + break; + case STATE_COMPLETE: + return false; + } + + return true; +} + +void CGuildMarkDownloader::__OfflineState_Set() +{ + __Initialize(); +} + +void CGuildMarkDownloader::__CompleteState_Set() +{ + m_eState = STATE_COMPLETE; + CPythonCharacterManager::instance().RefreshAllGuildMark(); +} + +void CGuildMarkDownloader::__LoginState_Set() +{ + m_eState = STATE_LOGIN; +} + +bool CGuildMarkDownloader::__LoginState_Process() +{ + BYTE header; + + if (!Peek(sizeof(BYTE), &header)) + return true; + + if (IsSecurityMode()) + { + if (0 == header) + { + if (!Recv(sizeof(header), &header)) + return false; + + return true; + } + } + + UINT needPacketSize = __GetPacketSize(header); + + if (!needPacketSize) + return false; + + if (!Peek(needPacketSize)) + return true; + + __DispatchPacket(header); + return true; +} + +// MARK_BUG_FIX +UINT CGuildMarkDownloader::__GetPacketSize(UINT header) +{ + switch (header) + { + case HEADER_GC_PHASE: + return sizeof(TPacketGCPhase); + case HEADER_GC_HANDSHAKE: + return sizeof(TPacketGCHandshake); + case HEADER_GC_PING: + return sizeof(TPacketGCPing); + case HEADER_GC_MARK_IDXLIST: + return sizeof(TPacketGCMarkIDXList); + case HEADER_GC_MARK_BLOCK: + return sizeof(TPacketGCMarkBlock); + case HEADER_GC_GUILD_SYMBOL_DATA: + return sizeof(TPacketGCGuildSymbolData); + case HEADER_GC_MARK_DIFF_DATA: // 사용하지 않음 + return sizeof(BYTE); +#ifdef _IMPROVED_PACKET_ENCRYPTION_ + case HEADER_GC_KEY_AGREEMENT: + return sizeof(TPacketKeyAgreement); + case HEADER_GC_KEY_AGREEMENT_COMPLETED: + return sizeof(TPacketKeyAgreementCompleted); + +#endif + } + return 0; +} + +bool CGuildMarkDownloader::__DispatchPacket(UINT header) +{ + switch (header) + { + case HEADER_GC_PHASE: + return __LoginState_RecvPhase(); + case HEADER_GC_HANDSHAKE: + return __LoginState_RecvHandshake(); + case HEADER_GC_PING: + return __LoginState_RecvPing(); + case HEADER_GC_MARK_IDXLIST: + return __LoginState_RecvMarkIndex(); + case HEADER_GC_MARK_BLOCK: + return __LoginState_RecvMarkBlock(); + case HEADER_GC_GUILD_SYMBOL_DATA: + return __LoginState_RecvSymbolData(); + case HEADER_GC_MARK_DIFF_DATA: // 사용하지 않음 + return true; +#ifdef _IMPROVED_PACKET_ENCRYPTION_ + case HEADER_GC_KEY_AGREEMENT: + return __LoginState_RecvKeyAgreement(); + case HEADER_GC_KEY_AGREEMENT_COMPLETED: + return __LoginState_RecvKeyAgreementCompleted(); +#endif + } + return false; +} +// END_OF_MARK_BUG_FIX + +bool CGuildMarkDownloader::__LoginState_RecvHandshake() +{ + TPacketGCHandshake kPacketHandshake; + if (!Recv(sizeof(kPacketHandshake), &kPacketHandshake)) + return false; + + TPacketCGMarkLogin kPacketMarkLogin; + + kPacketMarkLogin.header = HEADER_CG_MARK_LOGIN; + kPacketMarkLogin.handle = m_dwHandle; + kPacketMarkLogin.random_key = m_dwRandomKey; + + if (!Send(sizeof(kPacketMarkLogin), &kPacketMarkLogin)) + return false; + + return true; +} + +bool CGuildMarkDownloader::__LoginState_RecvPing() +{ + TPacketGCPing kPacketPing; + + if (!Recv(sizeof(kPacketPing), &kPacketPing)) + return false; + + TPacketCGPong kPacketPong; + kPacketPong.bHeader = HEADER_CG_PONG; + + if (!Send(sizeof(TPacketCGPong), &kPacketPong)) + return false; + + if (IsSecurityMode()) + return SendSequence(); + else + return true; +} + +bool CGuildMarkDownloader::__LoginState_RecvPhase() +{ + TPacketGCPhase kPacketPhase; + + if (!Recv(sizeof(kPacketPhase), &kPacketPhase)) + return false; + + if (kPacketPhase.phase == PHASE_LOGIN) + { +#ifndef _IMPROVED_PACKET_ENCRYPTION_ + const char* key = LocaleService_GetSecurityKey(); + SetSecurityMode(true, key); +#endif + + switch (m_dwTodo) + { + case TODO_RECV_NONE: + { + assert(!"CGuildMarkDownloader::__LoginState_RecvPhase - Todo type is none"); + break; + } + case TODO_RECV_MARK: + { + // MARK_BUG_FIX + if (!__SendMarkIDXList()) + return false; + // END_OF_MARK_BUG_FIX + break; + } + case TODO_RECV_SYMBOL: + { + if (!__SendSymbolCRCList()) + return false; + break; + } + } + } + + return true; +} + +// MARK_BUG_FIX +bool CGuildMarkDownloader::__SendMarkIDXList() +{ + TPacketCGMarkIDXList kPacketMarkIDXList; + kPacketMarkIDXList.header = HEADER_CG_MARK_IDXLIST; + if (!Send(sizeof(kPacketMarkIDXList), &kPacketMarkIDXList)) + return false; + + return true; +} + +bool CGuildMarkDownloader::__LoginState_RecvMarkIndex() +{ + TPacketGCMarkIDXList kPacketMarkIndex; + + if (!Peek(sizeof(kPacketMarkIndex), &kPacketMarkIndex)) + return false; + + //DWORD bufSize = sizeof(WORD) * 2 * kPacketMarkIndex.count; + + if (!Peek(kPacketMarkIndex.bufSize)) + return false; + + Recv(sizeof(kPacketMarkIndex)); + + WORD guildID, markID; + + for (DWORD i = 0; i < kPacketMarkIndex.count; ++i) + { + Recv(sizeof(WORD), &guildID); + Recv(sizeof(WORD), &markID); + + // 길드ID -> 마크ID 인덱스 등록 + CGuildMarkManager::Instance().AddMarkIDByGuildID(guildID, markID); + } + + // 모든 마크 이미지 파일을 로드한다. (파일이 없으면 만들어짐) + CGuildMarkManager::Instance().LoadMarkImages(); + + m_currentRequestingImageIndex = 0; + __SendMarkCRCList(); + return true; +} + +bool CGuildMarkDownloader::__SendMarkCRCList() +{ + TPacketCGMarkCRCList kPacketMarkCRCList; + + if (!CGuildMarkManager::Instance().GetBlockCRCList(m_currentRequestingImageIndex, kPacketMarkCRCList.crclist)) + __CompleteState_Set(); + else + { + kPacketMarkCRCList.header = HEADER_CG_MARK_CRCLIST; + kPacketMarkCRCList.imgIdx = m_currentRequestingImageIndex; + ++m_currentRequestingImageIndex; + + if (!Send(sizeof(kPacketMarkCRCList), &kPacketMarkCRCList)) + return false; + } + return true; +} + +bool CGuildMarkDownloader::__LoginState_RecvMarkBlock() +{ + TPacketGCMarkBlock kPacket; + + if (!Peek(sizeof(kPacket), &kPacket)) + return false; + + if (!Peek(kPacket.bufSize)) + return false; + + Recv(sizeof(kPacket)); + + BYTE posBlock; + DWORD compSize; + char compBuf[SGuildMarkBlock::MAX_COMP_SIZE]; + + for (DWORD i = 0; i < kPacket.count; ++i) + { + Recv(sizeof(BYTE), &posBlock); + Recv(sizeof(DWORD), &compSize); + + if (compSize > SGuildMarkBlock::MAX_COMP_SIZE) + { + TraceError("RecvMarkBlock: data corrupted"); + Recv(compSize); + } + else + { + Recv(compSize, compBuf); + // 압축된 이미지를 실제로 저장한다. CRC등 여러가지 정보가 함께 빌드된다. + CGuildMarkManager::Instance().SaveBlockFromCompressedData(kPacket.imgIdx, posBlock, (const BYTE *) compBuf, compSize); + } + } + + if (kPacket.count > 0) + { + // 마크 이미지 저장 + CGuildMarkManager::Instance().SaveMarkImage(kPacket.imgIdx); + + // 리소스 리로딩 (재접속을 안해도 본인것은 잘 보이게 함) + std::string imagePath; + + if (CGuildMarkManager::Instance().GetMarkImageFilename(kPacket.imgIdx, imagePath)) + { + CResource * pResource = CResourceManager::Instance().GetResourcePointer(imagePath.c_str()); + if (pResource->IsType(CGraphicImage::Type())) + { + CGraphicImage* pkGrpImg=static_cast(pResource); + pkGrpImg->Reload(); + } + } + } + + // 더 요청할 것이 있으면 요청하고 아니면 이미지를 저장하고 종료 + if (m_currentRequestingImageIndex < CGuildMarkManager::Instance().GetMarkImageCount()) + __SendMarkCRCList(); + else + __CompleteState_Set(); + + return true; +} +// END_OF_MARK_BUG_FIX + +#ifdef _IMPROVED_PACKET_ENCRYPTION_ +bool CGuildMarkDownloader::__LoginState_RecvKeyAgreement() +{ + TPacketKeyAgreement packet; + if (!Recv(sizeof(packet), &packet)) + { + return false; + } + + Tracenf("KEY_AGREEMENT RECV %u", packet.wDataLength); + + TPacketKeyAgreement packetToSend; + size_t dataLength = TPacketKeyAgreement::MAX_DATA_LEN; + size_t agreedLength = Prepare(packetToSend.data, &dataLength); + if (agreedLength == 0) + { + // 초기화 실패 + Disconnect(); + return false; + } + assert(dataLength <= TPacketKeyAgreement::MAX_DATA_LEN); + + if (Activate(packet.wAgreedLength, packet.data, packet.wDataLength)) + { + // Key agreement 성공, 응답 전송 + packetToSend.bHeader = HEADER_CG_KEY_AGREEMENT; + packetToSend.wAgreedLength = (WORD)agreedLength; + packetToSend.wDataLength = (WORD)dataLength; + + if (!Send(sizeof(packetToSend), &packetToSend)) + { + Tracen(" CAccountConnector::__AuthState_RecvKeyAgreement - SendKeyAgreement Error"); + return false; + } + Tracenf("KEY_AGREEMENT SEND %u", packetToSend.wDataLength); + } + else + { + // 키 협상 실패 + Disconnect(); + return false; + } + return true; +} + +bool CGuildMarkDownloader::__LoginState_RecvKeyAgreementCompleted() +{ + TPacketKeyAgreementCompleted packet; + if (!Recv(sizeof(packet), &packet)) + { + return false; + } + + Tracenf("KEY_AGREEMENT_COMPLETED RECV"); + + ActivateCipher(); + + return true; +} +#endif // _IMPROVED_PACKET_ENCRYPTION_ + +bool CGuildMarkDownloader::__SendSymbolCRCList() +{ + for (DWORD i=0; i GetRecvBufferSize()) + return true; + + ////////////////////////////////////////////////////////////// + + TPacketGCGuildSymbolData kPacketSymbolData; + if (!Recv(sizeof(kPacketSymbolData), &kPacketSymbolData)) + return false; + + WORD wDataSize = kPacketSymbolData.size - sizeof(kPacketSymbolData); + DWORD dwGuildID = kPacketSymbolData.guild_id; + BYTE * pbyBuf = new BYTE [wDataSize]; + + if (!Recv(wDataSize, pbyBuf)) + { + delete[] pbyBuf; + return false; + } + + MyCreateDirectory(g_strGuildSymbolPathName.c_str()); + + std::string strFileName = GetGuildSymbolFileName(dwGuildID); + + FILE * File = fopen(strFileName.c_str(), "wb"); + if (!File) + { + delete[] pbyBuf; + return false; + } + fwrite(pbyBuf, wDataSize, 1, File); + fclose(File); + +#ifdef _DEBUG + printf("__LoginState_RecvSymbolData(filename:%s, datasize:%d, guildid:%d)\n", strFileName.c_str(), wDataSize, dwGuildID); +#endif + + delete[] pbyBuf; + return true; +} diff --git a/extension/src/port/UserInterface/GuildMarkUploader.cpp b/extension/src/port/UserInterface/GuildMarkUploader.cpp new file mode 100644 index 00000000..45eec084 --- /dev/null +++ b/extension/src/port/UserInterface/GuildMarkUploader.cpp @@ -0,0 +1,482 @@ +#include "StdAfx.h" +#include "GuildMarkUploader.h" +#include "Packet.h" +#include "Test.h" + +#ifdef __VTUNE__ +#else + +CGuildMarkUploader::CGuildMarkUploader() + : m_pbySymbolBuf(NULL) +{ + SetRecvBufferSize(1024); + SetSendBufferSize(1024); + __Inialize(); +} + +CGuildMarkUploader::~CGuildMarkUploader() +{ + __OfflineState_Set(); +} + +void CGuildMarkUploader::Disconnect() +{ + __OfflineState_Set(); +} + +bool CGuildMarkUploader::IsCompleteUploading() +{ + return STATE_OFFLINE == m_eState; +} + +bool CGuildMarkUploader::__Save(const char* c_szFileName) +{ + /* 업로더에서 저장하지 않아야 함; + ILuint uImg; + ilGenImages(1, &uImg); + ilBindImage(uImg); + ilEnable(IL_FILE_OVERWRITE); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + + if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring)c_szFileName)) + { + return false; + } + + if (ilGetInteger(IL_IMAGE_WIDTH) != CGuildMarkImage::WIDTH) + { + return false; + } + + if (ilGetInteger(IL_IMAGE_HEIGHT) != CGuildMarkImage::HEIGHT) + { + return false; + } + + ilConvertImage(IL_BGRA, IL_BYTE); + + UINT uColCount = CGuildMarkImage::MARK_COL_COUNT; + UINT uCol = m_dwGuildID % uColCount; + UINT uRow = m_dwGuildID / uColCount; + + ilSetPixels(uCol*SGuildMark::WIDTH, uRow*SGuildMark::HEIGHT, 0, SGuildMark::WIDTH, SGuildMark::HEIGHT, 1, IL_BGRA, IL_BYTE, (ILvoid*)m_kMark.m_apxBuf); + + ilSave(IL_TGA, (ILstring)c_szFileName); + + ilDeleteImages(1, &uImg); + */ + return true; +} + +bool CGuildMarkUploader::__Load(const char* c_szFileName, UINT* peError) +{ + ILuint uImg; + ilGenImages(1, &uImg); + ilBindImage(uImg); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + + if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring)c_szFileName)) + { + *peError=ERROR_LOAD; + return false; + } + + if (ilGetInteger(IL_IMAGE_WIDTH)!=SGuildMark::WIDTH) + { + *peError=ERROR_WIDTH; + return false; + } + + if (ilGetInteger(IL_IMAGE_HEIGHT)!=SGuildMark::HEIGHT) + { + *peError=ERROR_HEIGHT; + return false; + } + + ilConvertImage(IL_BGRA, IL_BYTE); + + ilCopyPixels(0, 0, 0, SGuildMark::WIDTH, SGuildMark::HEIGHT, 1, IL_BGRA, IL_BYTE, (ILvoid*)m_kMark.m_apxBuf); + + ilDeleteImages(1, &uImg); + return true; +} + +bool CGuildMarkUploader::__LoadSymbol(const char* c_szFileName, UINT* peError) +{ + // For Check Image + ILuint uImg; + ilGenImages(1, &uImg); + ilBindImage(uImg); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring)c_szFileName)) + { + *peError=ERROR_LOAD; + return false; + } + if (ilGetInteger(IL_IMAGE_WIDTH) != 64) + { + *peError=ERROR_WIDTH; + return false; + } + if (ilGetInteger(IL_IMAGE_HEIGHT) != 128) + { + *peError=ERROR_HEIGHT; + return false; + } + ilDeleteImages(1, &uImg); + ilShutDown(); + + ///// + + FILE * file = fopen(c_szFileName, "rb"); + if (!file) + { + *peError=ERROR_LOAD; + } + + fseek(file, 0, SEEK_END); + m_dwSymbolBufSize = ftell(file); + fseek(file, 0, SEEK_SET); + + m_pbySymbolBuf = new BYTE [m_dwSymbolBufSize]; + fread(m_pbySymbolBuf, m_dwSymbolBufSize, 1, file); + + fclose(file); + + ///// + + m_dwSymbolCRC32 = GetFileCRC32(c_szFileName); + return true; +} + +bool CGuildMarkUploader::Connect(const CNetworkAddress& c_rkNetAddr, DWORD dwHandle, DWORD dwRandomKey, DWORD dwGuildID, const char* c_szFileName, UINT* peError) +{ + __OfflineState_Set(); + SetRecvBufferSize(1024); + SetSendBufferSize(1024); + + if (!CNetworkStream::Connect(c_rkNetAddr)) + { + *peError=ERROR_CONNECT; + return false; + } + + m_dwSendType=SEND_TYPE_MARK; + m_dwHandle=dwHandle; + m_dwRandomKey=dwRandomKey; + m_dwGuildID=dwGuildID; + + if (!__Load(c_szFileName, peError)) + return false; + + //if (!__Save(CGraphicMarkInstance::GetImageFileName().c_str())) + // return false; + //CGraphicMarkInstance::ReloadImageFile(); + return true; +} + +bool CGuildMarkUploader::ConnectToSendSymbol(const CNetworkAddress& c_rkNetAddr, DWORD dwHandle, DWORD dwRandomKey, DWORD dwGuildID, const char* c_szFileName, UINT* peError) +{ + __OfflineState_Set(); + SetRecvBufferSize(1024); + SetSendBufferSize(64*1024); + + if (!CNetworkStream::Connect(c_rkNetAddr)) + { + *peError=ERROR_CONNECT; + return false; + } + + m_dwSendType=SEND_TYPE_SYMBOL; + m_dwHandle=dwHandle; + m_dwRandomKey=dwRandomKey; + m_dwGuildID=dwGuildID; + + if (!__LoadSymbol(c_szFileName, peError)) + return false; + + return true; +} + +void CGuildMarkUploader::Process() +{ + CNetworkStream::Process(); + + if (!__StateProcess()) + { + __OfflineState_Set(); + Disconnect(); + } +} + +void CGuildMarkUploader::OnConnectFailure() +{ + __OfflineState_Set(); +} + +void CGuildMarkUploader::OnConnectSuccess() +{ + __LoginState_Set(); +} + +void CGuildMarkUploader::OnRemoteDisconnect() +{ + __OfflineState_Set(); +} + +void CGuildMarkUploader::OnDisconnect() +{ + __OfflineState_Set(); +} + +void CGuildMarkUploader::__Inialize() +{ + m_eState = STATE_OFFLINE; + + m_dwGuildID = 0; + m_dwHandle = 0; + m_dwRandomKey = 0; + + if (m_pbySymbolBuf) + { + delete m_pbySymbolBuf; + } + + m_dwSymbolBufSize = 0; + m_pbySymbolBuf = NULL; +} + +bool CGuildMarkUploader::__StateProcess() +{ + switch (m_eState) + { + case STATE_LOGIN: + return __LoginState_Process(); + break; + } + + return true; +} + +void CGuildMarkUploader::__OfflineState_Set() +{ + __Inialize(); +} + +void CGuildMarkUploader::__CompleteState_Set() +{ + m_eState=STATE_COMPLETE; + + __OfflineState_Set(); +} + + +void CGuildMarkUploader::__LoginState_Set() +{ + m_eState=STATE_LOGIN; +} + +bool CGuildMarkUploader::__LoginState_Process() +{ + if (!__AnalyzePacket(HEADER_GC_PHASE, sizeof(TPacketGCPhase), &CGuildMarkUploader::__LoginState_RecvPhase)) + return false; + + if (!__AnalyzePacket(HEADER_GC_HANDSHAKE, sizeof(TPacketGCHandshake), &CGuildMarkUploader::__LoginState_RecvHandshake)) + return false; + + if (!__AnalyzePacket(HEADER_GC_PING, sizeof(TPacketGCPing), &CGuildMarkUploader::__LoginState_RecvPing)) + return false; + +#ifdef _IMPROVED_PACKET_ENCRYPTION_ + if (!__AnalyzePacket(HEADER_GC_KEY_AGREEMENT, sizeof(TPacketKeyAgreement), &CGuildMarkUploader::__LoginState_RecvKeyAgreement)) + return false; + + if (!__AnalyzePacket(HEADER_GC_KEY_AGREEMENT_COMPLETED, sizeof(TPacketKeyAgreementCompleted), &CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted)) + return false; +#endif + + return true; +} + +bool CGuildMarkUploader::__SendMarkPacket() +{ + TPacketCGMarkUpload kPacketMarkUpload; + kPacketMarkUpload.header=HEADER_CG_MARK_UPLOAD; + kPacketMarkUpload.gid=m_dwGuildID; + + assert(sizeof(kPacketMarkUpload.image) == sizeof(m_kMark.m_apxBuf)); + memcpy(kPacketMarkUpload.image, m_kMark.m_apxBuf, sizeof(kPacketMarkUpload.image)); + + if (!Send(sizeof(kPacketMarkUpload), &kPacketMarkUpload)) + return false; + + return true; +} +bool CGuildMarkUploader::__SendSymbolPacket() +{ + if (!m_pbySymbolBuf) + return false; + + TPacketCGSymbolUpload kPacketSymbolUpload; + kPacketSymbolUpload.header=HEADER_CG_GUILD_SYMBOL_UPLOAD; + kPacketSymbolUpload.handle=m_dwGuildID; + kPacketSymbolUpload.size=sizeof(TPacketCGSymbolUpload) + m_dwSymbolBufSize; + + if (!Send(sizeof(TPacketCGSymbolUpload), &kPacketSymbolUpload)) + return false; + if (!Send(m_dwSymbolBufSize, m_pbySymbolBuf)) + return false; + +#ifdef _DEBUG + printf("__SendSymbolPacket : [GuildID:%d/PacketSize:%d/BufSize:%d/CRC:%d]\n", m_dwGuildID, kPacketSymbolUpload.size, m_dwSymbolBufSize, m_dwSymbolCRC32); +#endif + + CNetworkStream::__SendInternalBuffer(); + __CompleteState_Set(); + + return true; +} + +bool CGuildMarkUploader::__LoginState_RecvPhase() +{ + TPacketGCPhase kPacketPhase; + if (!Recv(sizeof(kPacketPhase), &kPacketPhase)) + return false; + + if (kPacketPhase.phase==PHASE_LOGIN) + { +#ifndef _IMPROVED_PACKET_ENCRYPTION_ + const char* key = LocaleService_GetSecurityKey(); + SetSecurityMode(true, key); +#endif + + if (SEND_TYPE_MARK == m_dwSendType) + { + if (!__SendMarkPacket()) + return false; + } + else if (SEND_TYPE_SYMBOL == m_dwSendType) + { + if (!__SendSymbolPacket()) + return false; + } + } + + return true; +} + +bool CGuildMarkUploader::__LoginState_RecvHandshake() +{ + TPacketGCHandshake kPacketHandshake; + if (!Recv(sizeof(kPacketHandshake), &kPacketHandshake)) + return false; + + { + TPacketCGMarkLogin kPacketMarkLogin; + kPacketMarkLogin.header=HEADER_CG_MARK_LOGIN; + kPacketMarkLogin.handle=m_dwHandle; + kPacketMarkLogin.random_key=m_dwRandomKey; + if (!Send(sizeof(kPacketMarkLogin), &kPacketMarkLogin)) + return false; + } + + return true; +} + +bool CGuildMarkUploader::__LoginState_RecvPing() +{ + TPacketGCPing kPacketPing; + if (!Recv(sizeof(kPacketPing), &kPacketPing)) + return false; + + TPacketCGPong kPacketPong; + kPacketPong.bHeader = HEADER_CG_PONG; + + if (!Send(sizeof(TPacketCGPong), &kPacketPong)) + return false; + + if (IsSecurityMode()) + return SendSequence(); + else + return true; +} + +#ifdef _IMPROVED_PACKET_ENCRYPTION_ +bool CGuildMarkUploader::__LoginState_RecvKeyAgreement() +{ + TPacketKeyAgreement packet; + if (!Recv(sizeof(packet), &packet)) + { + return false; + } + + Tracenf("KEY_AGREEMENT RECV %u", packet.wDataLength); + + TPacketKeyAgreement packetToSend; + size_t dataLength = TPacketKeyAgreement::MAX_DATA_LEN; + size_t agreedLength = Prepare(packetToSend.data, &dataLength); + if (agreedLength == 0) + { + // 초기화 실패 + Disconnect(); + return false; + } + assert(dataLength <= TPacketKeyAgreement::MAX_DATA_LEN); + + if (Activate(packet.wAgreedLength, packet.data, packet.wDataLength)) + { + // Key agreement 성공, 응답 전송 + packetToSend.bHeader = HEADER_CG_KEY_AGREEMENT; + packetToSend.wAgreedLength = (WORD)agreedLength; + packetToSend.wDataLength = (WORD)dataLength; + + if (!Send(sizeof(packetToSend), &packetToSend)) + { + Tracen(" CAccountConnector::__AuthState_RecvKeyAgreement - SendKeyAgreement Error"); + return false; + } + Tracenf("KEY_AGREEMENT SEND %u", packetToSend.wDataLength); + } + else + { + // 키 협상 실패 + Disconnect(); + return false; + } + return true; +} + +bool CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted() +{ + TPacketKeyAgreementCompleted packet; + if (!Recv(sizeof(packet), &packet)) + { + return false; + } + + Tracenf("KEY_AGREEMENT_COMPLETED RECV"); + + ActivateCipher(); + + return true; +} +#endif // _IMPROVED_PACKET_ENCRYPTION_ + +bool CGuildMarkUploader::__AnalyzePacket(UINT uHeader, UINT uPacketSize, bool (CGuildMarkUploader::*pfnDispatchPacket)()) +{ + BYTE bHeader; + if (!Peek(sizeof(bHeader), &bHeader)) + return true; + + if (bHeader!=uHeader) + return true; + + if (!Peek(uPacketSize)) + return true; + + return (this->*pfnDispatchPacket)(); +} +#endif diff --git a/extension/src/port/UserInterface/Locale.cpp b/extension/src/port/UserInterface/Locale.cpp new file mode 100644 index 00000000..d3760fe2 --- /dev/null +++ b/extension/src/port/UserInterface/Locale.cpp @@ -0,0 +1,441 @@ +#include "StdAfx.h" +#include "Locale.h" +#include "PythonApplication.h" +#include "resource.h" +#include "../EterBase/CRC32.h" +#include "../EterPack/EterPackManager.h" +#include "../EterLocale/Japanese.h" +#include + +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"; + +static bool IS_CHEONMA = false; + +#ifndef LSS_SECURITY_KEY +#define LSS_SECURITY_KEY "testtesttesttest" +#endif + +std::string __SECURITY_KEY_STRING__ = LSS_SECURITY_KEY; + +char MULTI_LOCALE_SERVICE[256] = "EUROPE"; +char MULTI_LOCALE_PATH[256] = "locale/en"; +char MULTI_LOCALE_NAME[256] = "en"; +int MULTI_LOCALE_CODE = 1252; +int MULTI_LOCALE_REPORT_PORT = 10002; + +void LocaleService_LoadConfig(const char* fileName) +{ + NANOBEGIN + FILE* fp = fopen(fileName, "rt"); + + if (fp) + { + char line[256]; + char name[256]; + int code; + int id; + if (fgets(line, sizeof(line)-1, fp)) + { + line[sizeof(line)-1] = '\0'; + sscanf(line, "%d %d %s", &id, &code, name); + + MULTI_LOCALE_REPORT_PORT = id; + MULTI_LOCALE_CODE = code; + strcpy(MULTI_LOCALE_NAME, name); + sprintf(MULTI_LOCALE_PATH, "locale/%s", MULTI_LOCALE_NAME); + } + fclose(fp); + } + NANOEND +} + +unsigned LocaleService_GetLastExp(int level) +{ + static const int GUILD_LEVEL_MAX = 20; + + if (LocaleService_IsCHEONMA()) + { + static DWORD CHEONMA_GUILDEXP_LIST[GUILD_LEVEL_MAX+1] = + { + 0, // 0 + 15000ul, // 1 + 45000ul, // 2 + 90000ul, // 3 + 160000ul, // 4 + 235000ul, // 5 + 325000ul, // 6 + 430000ul, // 7 + 550000ul, // 8 + 685000ul, // 9 + 835000ul, // 10 + 1000000ul, // 11 + 1500000ul, // 12 + 2100000ul, // 13 + 2800000ul, // 14 + 3600000ul, // 15 + 4500000ul, // 16 + 6500000ul, // 17 + 8000000ul, // 18 + 10000000ul, // 19 + 42000000UL // 20 + }; + if (level < 0 && level >= GUILD_LEVEL_MAX) + return 0; + + return CHEONMA_GUILDEXP_LIST[level]; + } + + static DWORD INTERNATIONAL_GUILDEXP_LIST[GUILD_LEVEL_MAX+1] = + { + 0, // 0 + 6000UL, // 1 + 18000UL, // 2 + 36000UL, // 3 + 64000UL, // 4 + 94000UL, // 5 + 130000UL, // 6 + 172000UL, // 7 + 220000UL, // 8 + 274000UL, // 9 + 334000UL, // 10 + 400000UL, // 11 + 600000UL, // 12 + 840000UL, // 13 + 1120000UL, // 14 + 1440000UL, // 15 + 1800000UL, // 16 + 2600000UL, // 17 + 3200000UL, // 18 + 4000000UL, // 19 + 16800000UL // 20 + }; + + if (level < 0 && level >= GUILD_LEVEL_MAX) + return 0; + + return INTERNATIONAL_GUILDEXP_LIST[level]; +} + +int LocaleService_GetSkillPower(unsigned level) +{ + static const unsigned SKILL_POWER_NUM = 50; + + if (level >= SKILL_POWER_NUM) + return 0; + + if (LocaleService_IsCHEONMA()) + { + static unsigned CHEONMA_SKILL_POWERS[SKILL_POWER_NUM]= + { + 0, + 5, 7, 9, 11, 13, + 15, 17, 19, 20, 22, + 24, 26, 28, 30, 32, + 34, 36, 38, 40, 50, // master + 52, 55, 58, 61, 63, + 66, 69, 72, 75, 80, // grand_master + 82, 84, 87, 90, 95, + 100,110,120,130,150,// perfect_master + 150, + }; + return CHEONMA_SKILL_POWERS[level]; + } + + // 0 5 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 50 52 54 56 58 60 63 66 69 72 82 85 88 91 94 98 102 106 110 115 125 125 125 125 125 + static unsigned INTERNATIONAL_SKILL_POWERS[SKILL_POWER_NUM]= + { + 0, + 5, 6, 8, 10, 12, + 14, 16, 18, 20, 22, + 24, 26, 28, 30, 32, + 34, 36, 38, 40, 50, // master + 52, 54, 56, 58, 60, + 63, 66, 69, 72, 82, // grand_master + 85, 88, 91, 94, 98, + 102,106,110,115,125,// perfect_master + 125, + }; + return INTERNATIONAL_SKILL_POWERS[level]; +} + +const char* LocaleService_GetSecurityKey() +{ + return __SECURITY_KEY_STRING__.c_str(); +} + +// CHEONMA +void LocaleService_SetCHEONMA(bool isEnable) +{ + IS_CHEONMA = isEnable; +} + +bool LocaleService_IsCHEONMA() +{ + return LocaleService_IsYMIR(); +} + +// END_OF_CHEONMA + +#if defined(LOCALE_SERVICE_EUROPE) || defined(LOCALE_SERVICE_BRAZIL) || defined(LOCALE_SERVICE_CANADA) || defined(LOCALE_SERVICE_SINGAPORE) || defined(LOCALE_SERVICE_VIETNAM) || defined(LOCALE_SERVICE_TAIWAN) || defined(LOCALE_SERVICE_NEWCIBN) +#define _LSS_USE_LOCALE_CFG 1 +#define _LSS_SERVICE_NAME LSS_EUROPE +#elif defined(LOCALE_SERVICE_ITALY) +#define _LSS_SERVICE_NAME LSS_ITALY +#define _LSS_SERVICE_CODEPAGE CP_LATIN +#define _LSS_SERVICE_LOCALE_NAME "it" +#define _LSS_SERVICE_LOCALE_PATH "locale/it" +#elif defined(LOCALE_SERVICE_ENGLISH) +#define _LSS_SERVICE_NAME LSS_ENGLISH +#define _LSS_SERVICE_CODEPAGE CP_LATIN +#define _LSS_SERVICE_LOCALE_NAME "english" +#define _LSS_SERVICE_LOCALE_PATH "locale/english" +#elif defined(LOCALE_SERVICE_JAPAN) +#define _LSS_SERVICE_NAME LSS_JAPAN +#define _LSS_SERVICE_CODEPAGE CP_JAPANESE +#define _LSS_SERVICE_LOCALE_NAME "japan" +#define _LSS_SERVICE_LOCALE_PATH "locale/japan" +#elif defined(LOCALE_SERVICE_YMIR) +#define _LSS_SERVICE_NAME LSS_YMIR +#define _LSS_SERVICE_CODEPAGE CP_HANGUL +#define _LSS_SERVICE_LOCALE_NAME "ymir" +#define _LSS_SERVICE_LOCALE_PATH "locale/ymir" +#elif defined(LOCALE_SERVICE_HONGKONG) +#define _LSS_SERVICE_NAME LSS_HONGKONG +#define _LSS_SERVICE_CODEPAGE CP_CHINESE_TRAD +#define _LSS_SERVICE_LOCALE_NAME "hongkong" +#define _LSS_SERVICE_LOCALE_PATH "locale/hongkong" +#elif defined(LOCALE_SERVICE_TAIWAN) +#define _LSS_SERVICE_NAME LSS_TAIWAN +#define _LSS_SERVICE_CODEPAGE CP_CHINESE_TRAD +#define _LSS_SERVICE_LOCALE_NAME "taiwan" +#define _LSS_SERVICE_LOCALE_PATH "locale/taiwan" +#elif defined(LOCALE_SERVICE_NEWCIBN) +#define _LSS_SERVICE_NAME LSS_NEWCIBN +#define _LSS_SERVICE_CODEPAGE CP_CHINESE_SIMPLE +#define _LSS_SERVICE_LOCALE_NAME "newcibn" +#define _LSS_SERVICE_LOCALE_PATH "locale/newcibn" +#endif + +#if defined(_LSS_USE_LOCALE_CFG) +#if defined(_LSS_SERVICE_NAME) +const char* LocaleService_GetName() { return _LSS_SERVICE_NAME;} +#else +const char* LocaleService_GetName() { return MULTI_LOCALE_SERVICE; } +#endif +unsigned int LocaleService_GetCodePage() { return MULTI_LOCALE_CODE; } +const char* LocaleService_GetLocaleName() { return MULTI_LOCALE_NAME; } +const char* LocaleService_GetLocalePath() { return MULTI_LOCALE_PATH; } +#elif defined(_LSS_SERVICE_NAME) +const char* LocaleService_GetName() { return _LSS_SERVICE_NAME;} +unsigned int LocaleService_GetCodePage() { return _LSS_SERVICE_CODEPAGE; } +const char* LocaleService_GetLocaleName() { return _LSS_SERVICE_LOCALE_NAME; } +const char* LocaleService_GetLocalePath() { return _LSS_SERVICE_LOCALE_PATH; } +#endif + +void LocaleService_ForceSetLocale(const char* name, const char* localePath) +{ + strcpy(MULTI_LOCALE_NAME, name); + strcpy(MULTI_LOCALE_PATH, localePath); + + // 기존 천마 서버로 접속시에는 security key 변경 (WE 버전 클라로 천마서버 접속하기 위함) + if (0 == stricmp(name, "ymir")) + __SECURITY_KEY_STRING__ = "testtesttesttest"; + if (0 == stricmp(name, "we_korea")) + __SECURITY_KEY_STRING__ = "1234abcd5678efgh"; +} + +#if defined(LOCALE_SERVICE_GLOBAL) +struct SLOCALEDATA +{ + const char* szServiceName; + const char* szLocaleName; + WORD wCodePage; + const char* szSecurityKey; +} gs_stLocaleData[] = { + { LSS_YMIR, "ymir", 949, "testtesttesttest" }, // Korea + { LSS_EUROPE, "de", 1252, "1234abcd5678efgh" }, // GameForge (Germany) + { LSS_EUROPE, "en", 1252, "1234abcd5678efgh" }, // GameForge (United Kingdom) + { LSS_EUROPE, "us", 1252, "1234abcd5678efgh" }, // GameForge (USA) + { LSS_EUROPE, "es", 1252, "1234abcd5678efgh" }, // GameForge (Spain) + { LSS_EUROPE, "it", 1252, "1234abcd5678efgh" }, // GameForge (Italy) + { LSS_EUROPE, "fr", 1252, "1234abcd5678efgh" }, // GameForge (France) + { LSS_EUROPE, "pt", 1252, "1234abcd5678efgh" }, // GameForge (Portugal) + { LSS_EUROPE, "tr", 1253, "1234abcd5678efgh" }, // GameForge (Greece) + { LSS_EUROPE, "pl", 1250, "1234abcd5678efgh" }, // GameForge (Poland) + { LSS_EUROPE, "tr", 1254, "1234abcd5678efgh" }, // GameForge (Turkey) + { LSS_EUROPE, "dk", 1252, "1234abcd5678efgh" }, // GameForge (Demmark) + { LSS_EUROPE, "ae", 1256, "1234abcd5678efgh" }, // GameForge (United Arab Emirate) + { LSS_EUROPE, "mx", 1252, "1234abcd5678efgh" }, // GameForge (Mexico) + { LSS_EUROPE, "nl", 1252, "1234abcd5678efgh" }, // GameForge (Netherlands) + { LSS_EUROPE, "cz", 1252, "1234abcd5678efgh" }, // GameForge (Czech Republic) + { LSS_EUROPE, "ru", 1251, "1234abcd5678efgh" }, // GameForge (Russian Federation) + { LSS_EUROPE, "hu", 1250, "1234abcd5678efgh" }, // GameForge (Hungary) + { LSS_EUROPE, "ro", 1250, "1234abcd5678efgh" }, // GameForge (Romania) + { LSS_EUROPE, "ca", 1252, "testtesttesttest" }, // Z8Games (Canada) + { LSS_EUROPE, "sg", 1252, "testtesttesttest" }, // TEC (Singapore) + { LSS_JAPAN, "japan", 932, "testtesttesttest" }, // Japan + { LSS_EUROPE, "br", 1252, "testtesttesttest" }, // OnGame (Brazil) + { LSS_HONGKONG, "hongkong", 950, "testtesttesttest" }, // HongKong & Taiwan + { LSS_NEWCIBN, "newcibn", 936, "testtesttesttest" }, // CIBN (Free world) + { LSS_ENGLISH, "english", 949, "testtesttesttest" }, // English (Obsoleted) + { LSS_YMIR, "kr", 949, "testtesttesttest" }, // Korea (Obsoleted) + { NULL, NULL, 0, "testtesttesttest" } +}; + +const char* LocaleService_GetName() +{ + return MULTI_LOCALE_SERVICE; +} + +unsigned int LocaleService_GetCodePage() +{ + return MULTI_LOCALE_CODE; +} + +const char* LocaleService_GetLocaleName() +{ + return MULTI_LOCALE_NAME; +} + +const char* LocaleService_GetLocalePath() +{ + return MULTI_LOCALE_PATH; +} + +static int gs_iLocale = -1; + +LRESULT CALLBACK SelectDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + switch( uMsg ) { + case WM_INITDIALOG : { + char szLocalePath[256], szDisplayName[256]; + for(int i=0; gs_stLocaleData[i].szServiceName; i++ ) { + sprintf(szLocalePath, "locale/%s/item_proto", gs_stLocaleData[i].szLocaleName); + if( CEterPackManager::Instance().isExist(szLocalePath)) { + sprintf(szDisplayName, "%s (%s, %d)", gs_stLocaleData[i].szLocaleName, gs_stLocaleData[i].szServiceName, gs_stLocaleData[i].wCodePage); + int iIndex = ListBox_AddString(GetDlgItem(hDlg, IDC_LOCALE_LIST), szDisplayName); + ListBox_SetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iIndex, i); + } + } + return TRUE; + } + case WM_COMMAND : + switch( LOWORD( wParam ) ) { + case IDC_LOCALE_LIST: { + int iSelected = ListBox_GetCurSel(GetDlgItem(hDlg, IDC_LOCALE_LIST)); + switch(HIWORD(wParam)) { + case LBN_SELCHANGE : + gs_iLocale = ListBox_GetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iSelected); + break; + case LBN_DBLCLK : + gs_iLocale = ListBox_GetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iSelected); + ::EndDialog(hDlg, 0); + break; + } + break; + } + case IDC_START: { + ::EndDialog(hDlg, 0); + break; + } + case IDC_EXIT: { + gs_iLocale = -1; + ::EndDialog(hDlg, 0); + break; + } + } + return FALSE; + } + return FALSE; +} + +bool LocaleService_LoadGlobal(HINSTANCE hInstance) +{ + int nFoundLocales = 0; + char szLocalePath[256]; + + for(int i=0; gs_stLocaleData[i].szServiceName; i++ ) { + sprintf(szLocalePath, "locale/%s/item_proto", gs_stLocaleData[i].szLocaleName); + if( CEterPackManager::Instance().isExist(szLocalePath)) { + nFoundLocales++; + if(gs_iLocale == -1) + gs_iLocale = i; + } + } + if (gs_iLocale < 0) + return false; + if(nFoundLocales > 1) + ::DialogBox(hInstance, MAKEINTRESOURCE(IDD_SELECT_LOCALE), NULL, (DLGPROC) SelectDlgProc); + if (gs_iLocale < 0) + return false; + strcpy(MULTI_LOCALE_SERVICE, gs_stLocaleData[gs_iLocale].szServiceName); + strcpy(MULTI_LOCALE_NAME, gs_stLocaleData[gs_iLocale].szLocaleName); + sprintf(MULTI_LOCALE_PATH, "locale/%s", gs_stLocaleData[gs_iLocale].szLocaleName); + MULTI_LOCALE_CODE = gs_stLocaleData[gs_iLocale].wCodePage; + if(gs_stLocaleData[gs_iLocale].szSecurityKey) + __SECURITY_KEY_STRING__ = gs_stLocaleData[gs_iLocale].szSecurityKey; + return true; +} +#else +bool LocaleService_LoadGlobal(HINSTANCE hInstance) +{ + return false; +} +#endif + +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); } + +#if defined(LOCALE_SERVICE_WE_JAPAN) +BOOL LocaleService_IsLeadByte( const char chByte ) +{ + return ShiftJIS_IsLeadByte( chByte ); +} + +int LocaleService_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength ) +{ + return ShiftJIS_StringCompareCI( szStringLeft, szStringRight, sizeLength ); +} +#else +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 ); +} +#endif + + +#ifdef USE_OPENID + +std::string __OPENID_AUTH_KEY_STRING__; +int openid_test = 0; + +void LocaleService_SetOpenIDAuthKey(const char *authKey) +{ + __OPENID_AUTH_KEY_STRING__ = authKey; + + return; +} + +const char* LocaleService_GetOpenIDAuthKey() +{ + return __OPENID_AUTH_KEY_STRING__.c_str(); +} + +#endif /* USE_OPENID */ \ No newline at end of file diff --git a/extension/src/port/UserInterface/MarkImage.cpp b/extension/src/port/UserInterface/MarkImage.cpp new file mode 100644 index 00000000..d8edaeec --- /dev/null +++ b/extension/src/port/UserInterface/MarkImage.cpp @@ -0,0 +1,321 @@ +#include "StdAfx.h" +#include "MarkImage.h" + +#if 0 // PORT: server-only legacy gcc branch; client uses EterBase/lzo.h +#include +#include "crc32.h" +#include "lzo_manager.h" +#include "minilzo.h" +#define CLZO LZOManager +#else +#include +#define sys_err TraceError +#define sys_log //(n, format, ...) Tracenf(format, __VA_ARGS__) +#define thecore_memcpy memcpy +#define itertype(cont) typeof(cont.begin()) +#endif + +CGuildMarkImage * NewMarkImage() +{ + return new CGuildMarkImage; +} + +void DeleteMarkImage(CGuildMarkImage * pkImage) +{ + delete pkImage; +} + +CGuildMarkImage::CGuildMarkImage() +{ + m_uImg = INVALID_HANDLE; +} + +CGuildMarkImage::~CGuildMarkImage() +{ + Destroy(); +} + +void CGuildMarkImage::Destroy() +{ + if (INVALID_HANDLE == m_uImg) + return; + + ilDeleteImages(1, &m_uImg); + m_uImg = INVALID_HANDLE; +} + +void CGuildMarkImage::Create() +{ + if (INVALID_HANDLE != m_uImg) + return; + + ilGenImages(1, &m_uImg); +} + +bool CGuildMarkImage::Save(const char* c_szFileName) +{ + ilEnable(IL_FILE_OVERWRITE); + ilBindImage(m_uImg); + + if (!ilSave(IL_TGA, (const ILstring)c_szFileName)) + return false; + + return true; +} + +bool CGuildMarkImage::Build(const char * c_szFileName) +{ + Destroy(); + Create(); + + ilBindImage(m_uImg); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + + BYTE * data = (BYTE *) malloc(sizeof(Pixel) * WIDTH * HEIGHT); + memset(data, 0, sizeof(Pixel) * WIDTH * HEIGHT); + + if (!ilTexImage(WIDTH, HEIGHT, 1, 4, IL_BGRA, IL_UNSIGNED_BYTE, data)) + { + sys_err("CGuildMarkImage: cannot initialize image"); + return false; + } + + free(data); + + ilEnable(IL_FILE_OVERWRITE); + + if (!ilSave(IL_TGA, (const ILstring)c_szFileName)) + return false; + + return true; +} + +bool CGuildMarkImage::Load(const char * c_szFileName) +{ + Destroy(); + Create(); + + ilBindImage(m_uImg); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + + if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring) c_szFileName)) + { + Build(c_szFileName); + + if (!Load(c_szFileName)) + { + sys_err("CGuildMarkImage: cannot open file for writing %s", c_szFileName); + return false; + } + } + + if (ilGetInteger(IL_IMAGE_WIDTH) != WIDTH) + { + sys_err("CGuildMarkImage: %s width must be %u", c_szFileName, WIDTH); + return false; + } + + if (ilGetInteger(IL_IMAGE_HEIGHT) != HEIGHT) + { + sys_err("CGuildMarkImage: %s height must be %u", c_szFileName, HEIGHT); + return false; + } + + ilConvertImage(IL_BGRA, IL_UNSIGNED_BYTE); + + BuildAllBlocks(); + return true; +} + +void CGuildMarkImage::PutData(UINT x, UINT y, UINT width, UINT height, void * data) +{ + ilBindImage(m_uImg); + ilSetPixels(x, y, 0, width, height, 1, IL_BGRA, IL_UNSIGNED_BYTE, data); +} + +void CGuildMarkImage::GetData(UINT x, UINT y, UINT width, UINT height, void * data) +{ + ilBindImage(m_uImg); + ilCopyPixels(x, y, 0, width, height, 1, IL_BGRA, IL_UNSIGNED_BYTE, data); +} + +// 이미지 = 512x512 +// 블럭 = 마크 4 x 4 +// 마크 = 16 x 12 +// 한 이미지의 블럭 = 8 x 10 + +// SERVER +bool CGuildMarkImage::SaveMark(DWORD posMark, BYTE * pbImage) +{ + if (posMark >= MARK_TOTAL_COUNT) + { + sys_err("CGuildMarkImage::CopyMarkFromData: Invalid mark position %u", posMark); + return false; + } + + // 마크를 전체 이미지에 그린다. + DWORD colMark = posMark % MARK_COL_COUNT; + DWORD rowMark = posMark / MARK_COL_COUNT; + + printf("PutMark pos %u %ux%u\n", posMark, colMark * SGuildMark::WIDTH, rowMark * SGuildMark::HEIGHT); + PutData(colMark * SGuildMark::WIDTH, rowMark * SGuildMark::HEIGHT, SGuildMark::WIDTH, SGuildMark::HEIGHT, pbImage); + + // 그려진 곳의 블럭을 업데이트 + DWORD rowBlock = rowMark / SGuildMarkBlock::MARK_PER_BLOCK_HEIGHT; + DWORD colBlock = colMark / SGuildMarkBlock::MARK_PER_BLOCK_WIDTH; + + Pixel apxBuf[SGuildMarkBlock::SIZE]; + GetData(colBlock * SGuildMarkBlock::WIDTH, rowBlock * SGuildMarkBlock::HEIGHT, SGuildMarkBlock::WIDTH, SGuildMarkBlock::HEIGHT, apxBuf); + m_aakBlock[rowBlock][colBlock].Compress(apxBuf); + return true; +} + +bool CGuildMarkImage::DeleteMark(DWORD posMark) +{ + Pixel image[SGuildMark::SIZE]; + memset(&image, 0, sizeof(image)); + return SaveMark(posMark, (BYTE *) &image); +} + +// CLIENT +bool CGuildMarkImage::SaveBlockFromCompressedData(DWORD posBlock, const BYTE * pbComp, DWORD dwCompSize) +{ + if (posBlock >= BLOCK_TOTAL_COUNT) + return false; + + Pixel apxBuf[SGuildMarkBlock::SIZE]; + size_t sizeBuf = sizeof(apxBuf); + + if (LZO_E_OK != lzo1x_decompress_safe(pbComp, dwCompSize, (BYTE *) apxBuf, (lzo_uint*) &sizeBuf, CLZO::Instance().GetWorkMemory())) + { + sys_err("CGuildMarkImage::CopyBlockFromCompressedData: cannot decompress, compressed size = %u", dwCompSize); + return false; + } + + if (sizeBuf != sizeof(apxBuf)) + { + sys_err("CGuildMarkImage::CopyBlockFromCompressedData: image corrupted, decompressed size = %u", sizeBuf); + return false; + } + + DWORD rowBlock = posBlock / BLOCK_COL_COUNT; + DWORD colBlock = posBlock % BLOCK_COL_COUNT; + + PutData(colBlock * SGuildMarkBlock::WIDTH, rowBlock * SGuildMarkBlock::HEIGHT, SGuildMarkBlock::WIDTH, SGuildMarkBlock::HEIGHT, apxBuf); + + m_aakBlock[rowBlock][colBlock].CopyFrom(pbComp, dwCompSize, GetCRC32((const char *) apxBuf, sizeof(Pixel) * SGuildMarkBlock::SIZE)); + return true; +} + +void CGuildMarkImage::BuildAllBlocks() // 이미지 전체를 블럭화 +{ + Pixel apxBuf[SGuildMarkBlock::SIZE]; + sys_log(0, "CGuildMarkImage::BuildAllBlocks"); + + for (UINT row = 0; row < BLOCK_ROW_COUNT; ++row) + for (UINT col = 0; col < BLOCK_COL_COUNT; ++col) + { + GetData(col * SGuildMarkBlock::WIDTH, row * SGuildMarkBlock::HEIGHT, SGuildMarkBlock::WIDTH, SGuildMarkBlock::HEIGHT, apxBuf); + m_aakBlock[row][col].Compress(apxBuf); + } +} + +DWORD CGuildMarkImage::GetEmptyPosition() +{ + SGuildMark kMark; + + for (DWORD row = 0; row < MARK_ROW_COUNT; ++row) + { + for (DWORD col = 0; col < MARK_COL_COUNT; ++col) + { + GetData(col * SGuildMark::WIDTH, row * SGuildMark::HEIGHT, SGuildMark::WIDTH, SGuildMark::HEIGHT, kMark.m_apxBuf); + + if (kMark.IsEmpty()) + return (row * MARK_COL_COUNT + col); + } + } + + return INVALID_MARK_POSITION; +} + +void CGuildMarkImage::GetDiffBlocks(const DWORD * crcList, std::map & mapDiffBlocks) +{ + BYTE posBlock = 0; + + for (DWORD row = 0; row < BLOCK_ROW_COUNT; ++row) + for (DWORD col = 0; col < BLOCK_COL_COUNT; ++col) + { + if (m_aakBlock[row][col].m_crc != *crcList) + { + mapDiffBlocks.insert(std::map::value_type(posBlock, &m_aakBlock[row][col])); + } + ++crcList; + ++posBlock; + } +} + +void CGuildMarkImage::GetBlockCRCList(DWORD * crcList) +{ + for (DWORD row = 0; row < BLOCK_ROW_COUNT; ++row) + for (DWORD col = 0; col < BLOCK_COL_COUNT; ++col) + *(crcList++) = m_aakBlock[row][col].GetCRC(); +} + +//////////////////////////////////////////////////////////////////////////////// +void SGuildMark::Clear() +{ + for (DWORD iPixel = 0; iPixel < SIZE; ++iPixel) + m_apxBuf[iPixel] = 0xff000000; +} + +bool SGuildMark::IsEmpty() +{ + for (DWORD iPixel = 0; iPixel < SIZE; ++iPixel) + if (m_apxBuf[iPixel] != 0x00000000) + return false; + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +DWORD SGuildMarkBlock::GetCRC() const +{ + return m_crc; +} + +void SGuildMarkBlock::CopyFrom(const BYTE * pbCompBuf, DWORD dwCompSize, DWORD crc) +{ + if (dwCompSize > MAX_COMP_SIZE) + return; + + m_sizeCompBuf = dwCompSize; + thecore_memcpy(m_abCompBuf, pbCompBuf, dwCompSize); + m_crc = crc; + //printf("SGuildMarkBlock::CopyFrom: %u > %u crc %u\n", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf, m_crc); +} + +void SGuildMarkBlock::Compress(const Pixel * pxBuf) +{ + m_sizeCompBuf = MAX_COMP_SIZE; + +#if defined(LZO1X_999_MEM_COMPRESS) + if (LZO_E_OK != lzo1x_999_compress((const BYTE *) pxBuf, + sizeof(Pixel) * SGuildMarkBlock::SIZE, m_abCompBuf, + (lzo_uint*) &m_sizeCompBuf, + CLZO::Instance().GetWorkMemory())) +#else // PORT: minilzo uses lzo1x_1_compress + if (LZO_E_OK != lzo1x_1_compress((const BYTE *) pxBuf, + sizeof(Pixel) * SGuildMarkBlock::SIZE, m_abCompBuf, + (lzo_uint*) &m_sizeCompBuf, + CLZO::Instance().GetWorkMemory())) +#endif + { + sys_err("SGuildMarkBlock::Compress: Error! %u > %u", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf); + return; + } + + //sys_log(0, "SGuildMarkBlock::Compress %u > %u", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf); + m_crc = GetCRC32((const char *) pxBuf, sizeof(Pixel) * SGuildMarkBlock::SIZE); +} diff --git a/extension/src/port/UserInterface/MarkManager.cpp b/extension/src/port/UserInterface/MarkManager.cpp new file mode 100644 index 00000000..9683b9c6 --- /dev/null +++ b/extension/src/port/UserInterface/MarkManager.cpp @@ -0,0 +1,488 @@ +#include "StdAfx.h" +#include "MarkManager.h" + +#if defined(_MSC_VER) && _MSC_VER < 1200 // PORT: undefined _MSC_VER evaluates to 0 under clang/gcc +#include "crc32.h" +#else +#define sys_err TraceError +#define sys_log // (n, format, ...) Tracenf(format, __VA_ARGS__) +#define thecore_memcpy memcpy +#define itertype(cont) typeof((cont).begin()) +#endif + +CGuildMarkImage * CGuildMarkManager::__NewImage() +{ + return new CGuildMarkImage; +} + +void CGuildMarkManager::__DeleteImage(CGuildMarkImage * pkImgDel) +{ + delete pkImgDel; +} + +CGuildMarkManager::CGuildMarkManager() +{ +#if _MSC_VER >= 1200 + _mkdir("mark"); +#endif + // 남은 mark id 셋을 만든다. (서버용) + for (DWORD i = 0; i < MAX_IMAGE_COUNT * CGuildMarkImage::MARK_TOTAL_COUNT; ++i) + m_setFreeMarkID.insert(i); +} + +CGuildMarkManager::~CGuildMarkManager() +{ + for (std::map::iterator it = m_mapIdx_Image.begin(); it != m_mapIdx_Image.end(); ++it) + __DeleteImage(it->second); + + m_mapIdx_Image.clear(); +} + +bool CGuildMarkManager::GetMarkImageFilename(DWORD imgIdx, std::string & path) const +{ + if (imgIdx >= MAX_IMAGE_COUNT) + return false; + + char buf[64]; + snprintf(buf, sizeof(buf), "mark/%s_%lu.tga", m_pathPrefix.c_str(), imgIdx); + path = buf; + return true; +} + +void CGuildMarkManager::SetMarkPathPrefix(const char * prefix) +{ + m_pathPrefix = prefix; +} + +// 마크 인덱스 불러오기 (서버에서만 사용) +bool CGuildMarkManager::LoadMarkIndex() +{ + char buf[64]; + snprintf(buf, sizeof(buf), "mark/%s_index", m_pathPrefix.c_str()); + FILE * fp = fopen(buf, "r"); + + if (!fp) + return false; + + DWORD guildID; + DWORD markID; + + char line[256]; + + while (fgets(line, sizeof(line)-1, fp)) + { + sscanf(line, "%lu %lu", &guildID, &markID); + line[0] = '\0'; + AddMarkIDByGuildID(guildID, markID); + } + + LoadMarkImages(); + + fclose(fp); + return true; +} + +bool CGuildMarkManager::SaveMarkIndex() +{ + char buf[64]; + snprintf(buf, sizeof(buf), "mark/%s_index", m_pathPrefix.c_str()); + FILE * fp = fopen(buf, "w"); + + if (!fp) + { + sys_err("MarkManager::SaveMarkData: cannot open index file."); + return false; + } + + for (std::map::iterator it = m_mapGID_MarkID.begin(); it != m_mapGID_MarkID.end(); ++it) + fprintf(fp, "%d %d\n", it->first, it->second); + + fclose(fp); + sys_log(0, "MarkManager::SaveMarkData: index count %d", m_mapGID_MarkID.size()); + return true; +} + +void CGuildMarkManager::LoadMarkImages() +{ + bool isMarkExists[MAX_IMAGE_COUNT]; + memset(isMarkExists, 0, sizeof(isMarkExists)); + + for (std::map::iterator it = m_mapGID_MarkID.begin(); it != m_mapGID_MarkID.end(); ++it) + { + DWORD markID = it->second; + + if (markID < MAX_IMAGE_COUNT * CGuildMarkImage::MARK_TOTAL_COUNT) + isMarkExists[markID / CGuildMarkImage::MARK_TOTAL_COUNT] = true; + } + + for (DWORD i = 0; i < MAX_IMAGE_COUNT; ++i) + if (isMarkExists[i]) + __GetImage(i); +} + +void CGuildMarkManager::SaveMarkImage(DWORD imgIdx) +{ + std::string path; + + if (GetMarkImageFilename(imgIdx, path)) + if (!__GetImage(imgIdx)->Save(path.c_str())) + sys_err("%s Save failed\n", path.c_str()); +} + +CGuildMarkImage * CGuildMarkManager::__GetImage(DWORD imgIdx) +{ + std::map::iterator it = m_mapIdx_Image.find(imgIdx); + + if (it == m_mapIdx_Image.end()) + { + std::string imagePath; + + if (GetMarkImageFilename(imgIdx, imagePath)) + { + CGuildMarkImage * pkImage = __NewImage(); + m_mapIdx_Image.insert(std::map::value_type(imgIdx, pkImage)); + pkImage->Load(imagePath.c_str()); + return pkImage; + } + else + return NULL; + } + else + return it->second; +} + +bool CGuildMarkManager::AddMarkIDByGuildID(DWORD guildID, DWORD markID) +{ + if (markID >= MAX_IMAGE_COUNT * CGuildMarkImage::MARK_TOTAL_COUNT) + return false; + + //sys_log(0, "MarkManager: guild_id=%d mark_id=%d", guildID, markID); + m_mapGID_MarkID.insert(std::map::value_type(guildID, markID)); + m_setFreeMarkID.erase(markID); + return true; +} + +DWORD CGuildMarkManager::GetMarkID(DWORD guildID) +{ + std::map::iterator it = m_mapGID_MarkID.find(guildID); + + if (it == m_mapGID_MarkID.end()) + return INVALID_MARK_ID; + + return it->second; +} + +DWORD CGuildMarkManager::__AllocMarkID(DWORD guildID) +{ + std::set::iterator it = m_setFreeMarkID.lower_bound(0); + + if (it == m_setFreeMarkID.end()) + return INVALID_MARK_ID; + + DWORD markID = *it; + + DWORD imgIdx = markID / CGuildMarkImage::MARK_TOTAL_COUNT; + CGuildMarkImage * pkImage = __GetImage(imgIdx); // 이미지가 없다면 만들기 위해 + + if (pkImage && AddMarkIDByGuildID(guildID, markID)) + return markID; + + return INVALID_MARK_ID; +} + +DWORD CGuildMarkManager::GetMarkImageCount() const +{ + return m_mapIdx_Image.size(); +} + +DWORD CGuildMarkManager::GetMarkCount() const +{ + return m_mapGID_MarkID.size(); +} + +// SERVER +void CGuildMarkManager::CopyMarkIdx(char * pcBuf) const +{ + WORD * pwBuf = (WORD *) pcBuf; + + for (std::map::const_iterator it = m_mapGID_MarkID.begin(); it != m_mapGID_MarkID.end(); ++it) + { + *(pwBuf++) = it->first; // guild id + *(pwBuf++) = it->second; // mark id + } +} + +// SERVER +DWORD CGuildMarkManager::SaveMark(DWORD guildID, BYTE * pbMarkImage) +{ + DWORD idMark; + + if ((idMark = GetMarkID(guildID)) == INVALID_MARK_ID) + { + if ((idMark = __AllocMarkID(guildID)) == INVALID_MARK_ID) + { + sys_err("CGuildMarkManager: cannot alloc mark id %u", guildID); + return false; + } + else + sys_log(0, "SaveMark: mark id alloc %u", idMark); + } + else + sys_log(0, "SaveMark: mark id found %u", idMark); + + DWORD imgIdx = (idMark / CGuildMarkImage::MARK_TOTAL_COUNT); + CGuildMarkImage * pkImage = __GetImage(imgIdx); + + if (pkImage) + { + printf("imgidx %u ", imgIdx); + + std::string pathImage; + GetMarkImageFilename(imgIdx, pathImage); + pkImage->Save(pathImage.c_str()); + + SaveMarkIndex(); + } + + return idMark; +} + +// SERVER +void CGuildMarkManager::DeleteMark(DWORD guildID) +{ + std::map::iterator it = m_mapGID_MarkID.find(guildID); + + if (it == m_mapGID_MarkID.end()) + return; + + CGuildMarkImage * pkImage; + + if ((pkImage = __GetImage(it->second / CGuildMarkImage::MARK_TOTAL_COUNT)) != NULL) + pkImage->DeleteMark(it->second % CGuildMarkImage::MARK_TOTAL_COUNT); + + m_mapGID_MarkID.erase(it); + m_setFreeMarkID.insert(it->second); + + SaveMarkIndex(); +} + +// SERVER +void CGuildMarkManager::GetDiffBlocks(DWORD imgIdx, const DWORD * crcList, std::map & mapDiffBlocks) +{ + mapDiffBlocks.clear(); + + // 클라이언트에서 서버에 없는 이미지를 요청할 수는 없다. + if (m_mapIdx_Image.end() == m_mapIdx_Image.find(imgIdx)) + { + sys_err("invalid idx %u", imgIdx); + return; + } + + CGuildMarkImage * p = __GetImage(imgIdx); + + if (p) + p->GetDiffBlocks(crcList, mapDiffBlocks); +} + +// CLIENT +bool CGuildMarkManager::SaveBlockFromCompressedData(DWORD imgIdx, DWORD posBlock, const BYTE * pbBlock, DWORD dwSize) +{ + CGuildMarkImage * pkImage = __GetImage(imgIdx); + + if (pkImage) + pkImage->SaveBlockFromCompressedData(posBlock, pbBlock, dwSize); + + return false; +} + +// CLIENT +bool CGuildMarkManager::GetBlockCRCList(DWORD imgIdx, DWORD * crcList) +{ + // 클라이언트에서 서버에 없는 이미지를 요청할 수는 없다. + if (m_mapIdx_Image.end() == m_mapIdx_Image.find(imgIdx)) + { + sys_err("invalid idx %u", imgIdx); + return false; + } + + CGuildMarkImage * p = __GetImage(imgIdx); + + if (p) + p->GetBlockCRCList(crcList); + + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////// +// Symbol +/////////////////////////////////////////////////////////////////////////////////////// +const CGuildMarkManager::TGuildSymbol * CGuildMarkManager::GetGuildSymbol(DWORD guildID) +{ + std::map::iterator it = m_mapSymbol.find(guildID); + + if (it == m_mapSymbol.end()) + return NULL; + + return &it->second; +} + +bool CGuildMarkManager::LoadSymbol(const char* filename) +{ + FILE* fp = fopen(filename, "rb"); + + if (!fp) + return true; + else + { + DWORD symbolCount; + fread(&symbolCount, 4, 1, fp); + + for(DWORD i = 0; i < symbolCount; i++) + { + DWORD guildID; + DWORD dwSize; + fread(&guildID, 4, 1, fp); + fread(&dwSize, 4, 1, fp); + + TGuildSymbol gs; + gs.raw.resize(dwSize); + fread(&gs.raw[0], 1, dwSize, fp); + gs.crc = GetCRC32(reinterpret_cast(&gs.raw[0]), dwSize); + m_mapSymbol.insert(std::make_pair(guildID, gs)); + } + } + + fclose(fp); + return true; +} + +void CGuildMarkManager::SaveSymbol(const char* filename) +{ + FILE* fp = fopen(filename, "wb"); + if (!fp) + { + sys_err("Cannot open Symbol file (name: %s)", filename); + return; + } + + DWORD symbolCount = m_mapSymbol.size(); + fwrite(&symbolCount, 4, 1, fp); + + for (std::map::iterator it = m_mapSymbol.begin(); it != m_mapSymbol.end(); ++it) + { + DWORD guildID = it->first; + DWORD dwSize = it->second.raw.size(); + fwrite(&guildID, 4, 1, fp); + fwrite(&dwSize, 4, 1, fp); + fwrite(&it->second.raw[0], 1, dwSize, fp); + } + + fclose(fp); +} + +void CGuildMarkManager::UploadSymbol(DWORD guildID, int iSize, const BYTE* pbyData) +{ + sys_log(0, "GuildSymbolUpload guildID %lu Size %d", guildID, iSize); + + if (m_mapSymbol.find(guildID) == m_mapSymbol.end()) + m_mapSymbol.insert(std::make_pair(guildID, TGuildSymbol())); + + TGuildSymbol& rSymbol = m_mapSymbol[guildID]; + rSymbol.raw.clear(); + + if (iSize > 0) + { + rSymbol.raw.reserve(iSize); + std::copy(pbyData, (pbyData + iSize), std::back_inserter(rSymbol.raw)); + rSymbol.crc = GetCRC32(reinterpret_cast(pbyData), iSize); + } +} + +#ifdef __UNITTEST__ +#include "lzo_manager.h" + +Guild::CGuildMarkManager * mgr; + +void heartbeat(LPHEART ht, int pulse) +{ + return; +} + +void SaveMark(DWORD guildID, const char * filename) +{ + ILuint m_uImg; + + ilGenImages(1, &m_uImg); + ilBindImage(m_uImg); + ilEnable(IL_ORIGIN_SET); + ilOriginFunc(IL_ORIGIN_UPPER_LEFT); + + if (ilLoad(IL_TYPE_UNKNOWN, (const ILstring) filename)) + { + ILuint width = ilGetInteger(IL_IMAGE_WIDTH); + ILuint height = ilGetInteger(IL_IMAGE_HEIGHT); + + ilConvertImage(IL_BGRA, IL_UNSIGNED_BYTE); + + BYTE * data = (BYTE *) malloc(sizeof(DWORD) * width * height); + ilCopyPixels(0, 0, 0, width, height, 1, IL_BGRA, IL_UNSIGNED_BYTE, data); + ilDeleteImages(1, &m_uImg); + + printf("%s w%u h%u ", filename, width, height); + mgr->SaveMark(guildID, data); + } + else + printf("%s cannot open file.\n", filename); +} + +int main(int argc, char **argv) +{ + LZOManager lzo; + char f[64]; + + srandom(time(0)); + + ilInit(); // DevIL Initialize + thecore_init(25, heartbeat); + + std::vector vec_guild_id; + + for (int i = 1; i < 1281; ++i) + vec_guild_id.push_back(i); + + mgr = new CGuildMarkManager; + mgr->LoadMarkData(vec_guild_id); + /* + for (int i = 1401; i < 1500; ++i) + { + snprintf(f, sizeof(f), "%lu.jpg", (random() % 5) + 1); + //SaveMark(i, f); + mgr->DeleteMark(i); + } + */ + //snprintf(f, sizeof(f), "%lu.jpg", (random() % 5) + 1); + //SaveMark(1, f); + DWORD idx_client[CGuildMarkImage::BLOCK_TOTAL_COUNT]; + DWORD idx_server[CGuildMarkImage::BLOCK_TOTAL_COUNT]; + + mgr->GetBlockCRCList(0, idx_client); + mgr->GetBlockCRCList(1, idx_server); + + std::map mapDiff; + mgr->GetDiffBlocks(1, idx_client, mapDiff); + + printf("#1 Diff %u\n", mapDiff.size()); + + for (itertype(mapDiff) it = mapDiff.begin(); it != mapDiff.end(); ++it) + { + printf("Put Block pos %u crc %u\n", it->first, it->second->m_crc); + mgr->SaveBlockFromCompressedData(0, it->first, it->second->m_abCompBuf, it->second->m_sizeCompBuf); + } + + mgr->GetBlockCRCList(0, idx_client); + mgr->GetDiffBlocks(1, idx_client, mapDiff); + printf("#2 Diff %u\n", mapDiff.size()); + delete mgr; + return 1; +} +#endif diff --git a/extension/src/port/UserInterface/PythonGuild.cpp b/extension/src/port/UserInterface/PythonGuild.cpp new file mode 100644 index 00000000..78f84eed --- /dev/null +++ b/extension/src/port/UserInterface/PythonGuild.cpp @@ -0,0 +1,799 @@ +#include "StdAfx.h" +#include "PythonGuild.h" +#include "AbstractPlayer.h" +#include "MarkManager.h" + +std::map g_GuildSkillSlotToIndexMap; + +void CPythonGuild::EnableGuild() +{ + m_bGuildEnable = TRUE; +} + +void CPythonGuild::SetGuildMoney(DWORD dwMoney) +{ + m_GuildInfo.dwGuildMoney = dwMoney; +} + +void CPythonGuild::SetGuildEXP(BYTE byLevel, DWORD dwEXP) +{ + m_GuildInfo.dwGuildLevel = byLevel; + m_GuildInfo.dwCurrentExperience = dwEXP; +} + +void CPythonGuild::SetGradeData(BYTE byGradeNumber, TGuildGradeData & rGuildGradeData) +{ + m_GradeDataMap[byGradeNumber] = rGuildGradeData; +} + +void CPythonGuild::SetGradeName(BYTE byGradeNumber, const char * c_szName) +{ + if (!__IsGradeData(byGradeNumber)) + return; + + TGuildGradeData & rGradeData = m_GradeDataMap.find(byGradeNumber)->second; + rGradeData.strName = c_szName; +} + +void CPythonGuild::SetGradeAuthority(BYTE byGradeNumber, BYTE byAuthority) +{ + if (!__IsGradeData(byGradeNumber)) + return; + + TGuildGradeData & rGradeData = m_GradeDataMap.find(byGradeNumber)->second; + rGradeData.byAuthorityFlag = byAuthority; +} + +void CPythonGuild::ClearComment() +{ + m_GuildBoardCommentVector.clear(); +} + +void CPythonGuild::RegisterComment(DWORD dwCommentID, const char * c_szName, const char * c_szComment) +{ + if (0 == strlen(c_szComment)) + return; + + TGuildBoardCommentData CommentData; + CommentData.dwCommentID = dwCommentID; + CommentData.strName = c_szName; + CommentData.strComment = c_szComment; + + m_GuildBoardCommentVector.push_back(CommentData); +} + +void CPythonGuild::RegisterMember(TGuildMemberData & rGuildMemberData) +{ + TGuildMemberData * pGuildMemberData; + if (GetMemberDataPtrByPID(rGuildMemberData.dwPID, &pGuildMemberData)) + { + pGuildMemberData->byGeneralFlag = rGuildMemberData.byGeneralFlag; + pGuildMemberData->byGrade = rGuildMemberData.byGrade; + pGuildMemberData->byLevel = rGuildMemberData.byLevel; + pGuildMemberData->dwOffer = rGuildMemberData.dwOffer; + } + else + { + m_GuildMemberDataVector.push_back(rGuildMemberData); + } + + __CalculateLevelAverage(); + __SortMember(); +} + +struct CPythonGuild_FFindGuildMemberByPID +{ + CPythonGuild_FFindGuildMemberByPID(DWORD dwSearchingPID_) : dwSearchingPID(dwSearchingPID_) {} + int operator () (CPythonGuild::TGuildMemberData & rGuildMemberData) + { + return rGuildMemberData.dwPID == dwSearchingPID; + } + + DWORD dwSearchingPID; +}; + +struct CPythonGuild_FFindGuildMemberByName +{ + CPythonGuild_FFindGuildMemberByName(const char * c_szSearchingName) : strSearchingName(c_szSearchingName) {} + int operator () (CPythonGuild::TGuildMemberData & rGuildMemberData) + { + return 0 == strSearchingName.compare(rGuildMemberData.strName.c_str()); + } + + std::string strSearchingName; +}; + +void CPythonGuild::ChangeGuildMemberGrade(DWORD dwPID, BYTE byGrade) +{ + TGuildMemberData * pGuildMemberData; + if (!GetMemberDataPtrByPID(dwPID, &pGuildMemberData)) + return; + + pGuildMemberData->byGrade = byGrade; +} + +void CPythonGuild::ChangeGuildMemberGeneralFlag(DWORD dwPID, BYTE byFlag) +{ + TGuildMemberData * pGuildMemberData; + if (!GetMemberDataPtrByPID(dwPID, &pGuildMemberData)) + return; + + pGuildMemberData->byGeneralFlag = byFlag; +} + +void CPythonGuild::RemoveMember(DWORD dwPID) +{ + TGuildMemberDataVector::iterator itor; + itor = std::find_if( m_GuildMemberDataVector.begin(), + m_GuildMemberDataVector.end(), + CPythonGuild_FFindGuildMemberByPID(dwPID)); + + if (m_GuildMemberDataVector.end() == itor) + return; + + m_GuildMemberDataVector.erase(itor); +} + +void CPythonGuild::RegisterGuildName(DWORD dwID, const char * c_szName) +{ + m_GuildNameMap.insert(std::make_pair(dwID, std::string(c_szName))); +} + +BOOL CPythonGuild::IsMainPlayer(DWORD dwPID) +{ + TGuildMemberData * pGuildMemberData; + if (!GetMemberDataPtrByPID(dwPID, &pGuildMemberData)) + return FALSE; + + IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton(); + return 0 == pGuildMemberData->strName.compare(rPlayer.GetName()); +} + +BOOL CPythonGuild::IsGuildEnable() +{ + return m_bGuildEnable; +} + +CPythonGuild::TGuildInfo & CPythonGuild::GetGuildInfoRef() +{ + return m_GuildInfo; +} + +BOOL CPythonGuild::GetGradeDataPtr(DWORD dwGradeNumber, TGuildGradeData ** ppData) +{ + TGradeDataMap::iterator itor = m_GradeDataMap.find(dwGradeNumber); + if (m_GradeDataMap.end() == itor) + return FALSE; + + *ppData = &(itor->second); + + return TRUE; +} + +const CPythonGuild::TGuildBoardCommentDataVector & CPythonGuild::GetGuildBoardCommentVector() +{ + return m_GuildBoardCommentVector; +} + +DWORD CPythonGuild::GetMemberCount() +{ + return m_GuildMemberDataVector.size(); +} + +BOOL CPythonGuild::GetMemberDataPtr(DWORD dwIndex, TGuildMemberData ** ppData) +{ + if (dwIndex >= m_GuildMemberDataVector.size()) + return FALSE; + + *ppData = &m_GuildMemberDataVector[dwIndex]; + + return TRUE; +} + +BOOL CPythonGuild::GetMemberDataPtrByPID(DWORD dwPID, TGuildMemberData ** ppData) +{ + TGuildMemberDataVector::iterator itor; + itor = std::find_if( m_GuildMemberDataVector.begin(), + m_GuildMemberDataVector.end(), + CPythonGuild_FFindGuildMemberByPID(dwPID)); + + if (m_GuildMemberDataVector.end() == itor) + return FALSE; + + *ppData = &(*itor); + return TRUE; +} + +BOOL CPythonGuild::GetMemberDataPtrByName(const char * c_szName, TGuildMemberData ** ppData) +{ + TGuildMemberDataVector::iterator itor; + itor = std::find_if( m_GuildMemberDataVector.begin(), + m_GuildMemberDataVector.end(), + CPythonGuild_FFindGuildMemberByName(c_szName)); + + if (m_GuildMemberDataVector.end() == itor) + return FALSE; + + *ppData = &(*itor); + return TRUE; +} + +DWORD CPythonGuild::GetGuildMemberLevelSummary() +{ + return m_dwMemberLevelSummary; +} + +DWORD CPythonGuild::GetGuildMemberLevelAverage() +{ + return m_dwMemberLevelAverage; +} + +DWORD CPythonGuild::GetGuildExperienceSummary() +{ + return m_dwMemberExperienceSummary; +} + +CPythonGuild::TGuildSkillData & CPythonGuild::GetGuildSkillDataRef() +{ + return m_GuildSkillData; +} + +bool CPythonGuild::GetGuildName(DWORD dwID, std::string * pstrGuildName) +{ + if (m_GuildNameMap.end() == m_GuildNameMap.find(dwID)) + return false; + + *pstrGuildName = m_GuildNameMap[dwID]; + + return true; +} + +DWORD CPythonGuild::GetGuildID() +{ + return m_GuildInfo.dwGuildID; +} + +BOOL CPythonGuild::HasGuildLand() +{ + return m_GuildInfo.bHasLand; +} + +void CPythonGuild::StartGuildWar(DWORD dwEnemyGuildID) +{ + int i; + + for (i = 0; i < ENEMY_GUILD_SLOT_MAX_COUNT; ++i) + if (dwEnemyGuildID == m_adwEnemyGuildID[i]) + return; + + for (i = 0; i < ENEMY_GUILD_SLOT_MAX_COUNT; ++i) + if (0 == m_adwEnemyGuildID[i]) + { + m_adwEnemyGuildID[i] = dwEnemyGuildID; + break; + } +} + +void CPythonGuild::EndGuildWar(DWORD dwEnemyGuildID) +{ + for (int i = 0; i < ENEMY_GUILD_SLOT_MAX_COUNT; ++i) + if (dwEnemyGuildID == m_adwEnemyGuildID[i]) + m_adwEnemyGuildID[i] = 0; +} + +DWORD CPythonGuild::GetEnemyGuildID(DWORD dwIndex) +{ + if (dwIndex >= ENEMY_GUILD_SLOT_MAX_COUNT) + return 0; + + return m_adwEnemyGuildID[dwIndex]; +} + +BOOL CPythonGuild::IsDoingGuildWar() +{ + for (int i = 0; i < ENEMY_GUILD_SLOT_MAX_COUNT; ++i) + if (0 != m_adwEnemyGuildID[i]) + { + return TRUE; + } + + return FALSE; +} + +void CPythonGuild::__CalculateLevelAverage() +{ + m_dwMemberLevelSummary = 0; + m_dwMemberLevelAverage = 0; + m_dwMemberExperienceSummary = 0; + + if (m_GuildMemberDataVector.empty()) + return; + + TGuildMemberDataVector::iterator itor; + + // Sum Level & Experience + itor = m_GuildMemberDataVector.begin(); + for (; itor != m_GuildMemberDataVector.end(); ++itor) + { + TGuildMemberData & rGuildMemberData = *itor; + m_dwMemberLevelSummary += rGuildMemberData.byLevel; + m_dwMemberExperienceSummary += rGuildMemberData.dwOffer; + } + + assert(!m_GuildMemberDataVector.empty()); + m_dwMemberLevelAverage = m_dwMemberLevelSummary / m_GuildMemberDataVector.size(); +} + +struct CPythonGuild_SLessMemberGrade +{ + bool operator() (CPythonGuild::TGuildMemberData & rleft, CPythonGuild::TGuildMemberData & rright) + { + if (rleft.byGrade < rright.byGrade) + return true; + + return false; + } +}; + +void CPythonGuild::__SortMember() +{ + std::sort(m_GuildMemberDataVector.begin(), m_GuildMemberDataVector.end(), CPythonGuild_SLessMemberGrade()); +} + +BOOL CPythonGuild::__IsGradeData(BYTE byGradeNumber) +{ + return m_GradeDataMap.end() != m_GradeDataMap.find(byGradeNumber); +} + +void CPythonGuild::__Initialize() +{ + ZeroMemory(&m_GuildInfo, sizeof(m_GuildInfo)); + ZeroMemory(&m_GuildSkillData, sizeof(m_GuildSkillData)); + ZeroMemory(&m_adwEnemyGuildID, ENEMY_GUILD_SLOT_MAX_COUNT*sizeof(DWORD)); + m_GradeDataMap.clear(); + m_GuildMemberDataVector.clear(); + m_dwMemberLevelSummary = 0; + m_dwMemberLevelAverage = 0; + m_bGuildEnable = FALSE; + m_GuildNameMap.clear(); +} + +void CPythonGuild::Destroy() +{ + __Initialize(); +} + +CPythonGuild::CPythonGuild() +{ + __Initialize(); +} +CPythonGuild::~CPythonGuild() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PyObject * guildIsGuildEnable(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().IsGuildEnable()); +} + +PyObject * guildGetGuildID(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().GetGuildID()); +} + +PyObject * guildHasGuildLand(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().HasGuildLand()); +} + +PyObject * guildGetGuildName(PyObject * poSelf, PyObject * poArgs) +{ + int iGuildID; + if (!PyTuple_GetInteger(poArgs, 0, &iGuildID)) + { + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + return Py_BuildValue("s", rGuildInfo.szGuildName); + } + + std::string strGuildName; + if (!CPythonGuild::Instance().GetGuildName(iGuildID, &strGuildName)) + return Py_BuildValue("s", "Noname"); + + return Py_BuildValue("s", strGuildName.c_str()); +} + +PyObject * guildGetGuildMasterName(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + + CPythonGuild::TGuildMemberData * pData; + if (!CPythonGuild::Instance().GetMemberDataPtrByPID(rGuildInfo.dwMasterPID, &pData)) + return Py_BuildValue("s", "Noname"); + + return Py_BuildValue("s", pData->strName.c_str()); +} + +PyObject * guildGetEnemyGuildName(PyObject * poSelf, PyObject * poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildValue("s", ""); + + DWORD dwEnemyGuildID = CPythonGuild::Instance().GetEnemyGuildID(iIndex); + + std::string strEnemyGuildName; + if (!CPythonGuild::Instance().GetGuildName(dwEnemyGuildID, &strEnemyGuildName)) + return Py_BuildValue("s", ""); + + return Py_BuildValue("s", strEnemyGuildName.c_str()); +} + +PyObject * guildGetGuildMoney(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + return Py_BuildValue("i", rGuildInfo.dwGuildMoney); +} + +PyObject * guildGetGuildBoardCommentCount(PyObject * poSelf, PyObject * poArgs) +{ + const CPythonGuild::TGuildBoardCommentDataVector & rCommentVector = CPythonGuild::Instance().GetGuildBoardCommentVector(); + return Py_BuildValue("i", rCommentVector.size()); +} + +PyObject * guildGetGuildBoardCommentData(PyObject * poSelf, PyObject * poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + const CPythonGuild::TGuildBoardCommentDataVector & c_rCommentVector = CPythonGuild::Instance().GetGuildBoardCommentVector(); + if (DWORD(iIndex) >= c_rCommentVector.size()) + return Py_BuildValue("iss", 0, "Noname", "Noname"); + + const CPythonGuild::TGuildBoardCommentData & c_rData = c_rCommentVector[iIndex]; + + return Py_BuildValue("iss", c_rData.dwCommentID, c_rData.strName.c_str(), c_rData.strComment.c_str()); +} + +PyObject * guildGetGuildLevel(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + return Py_BuildValue("i", rGuildInfo.dwGuildLevel); +} + + + +PyObject * guildGetGuildExperience(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + + int GULID_MAX_LEVEL = 20; + if (rGuildInfo.dwGuildLevel >= GULID_MAX_LEVEL) + return Py_BuildValue("ii", 0, 0); + + unsigned lastExp = LocaleService_GetLastExp(rGuildInfo.dwGuildLevel); + + return Py_BuildValue("ii", rGuildInfo.dwCurrentExperience, lastExp - rGuildInfo.dwCurrentExperience); +} + +PyObject * guildGetGuildMemberCount(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::TGuildInfo & rGuildInfo = CPythonGuild::Instance().GetGuildInfoRef(); + return Py_BuildValue("ii", rGuildInfo.dwCurrentMemberCount, rGuildInfo.dwMaxMemberCount); +} + +PyObject * guildGetGuildMemberLevelSummary(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().GetGuildMemberLevelSummary()); +} + +PyObject * guildGetGuildMemberLevelAverage(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().GetGuildMemberLevelAverage()); +} + +PyObject * guildGetGuildExperienceSummary(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().GetGuildExperienceSummary()); +} + +PyObject * guildGetGuildSkillPoint(PyObject * poSelf, PyObject * poArgs) +{ + const CPythonGuild::TGuildSkillData & c_rSkillData = CPythonGuild::Instance().GetGuildSkillDataRef(); + return Py_BuildValue("i", c_rSkillData.bySkillPoint); +} + +PyObject * guildGetDragonPowerPoint(PyObject * poSelf, PyObject * poArgs) +{ + const CPythonGuild::TGuildSkillData & c_rSkillData = CPythonGuild::Instance().GetGuildSkillDataRef(); + return Py_BuildValue("ii", c_rSkillData.wGuildPoint, c_rSkillData.wMaxGuildPoint); +} + +PyObject * guildGetGuildSkillLevel(PyObject * poSelf, PyObject * poArgs) +{ + assert(FALSE && !"guildGetGuildSkillLevel - \273\347\277\353\307\317\301\366 \276\312\264\302 \307\324\274\366\300\324\264\317\264\331."); + + int iSkillIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSkillIndex)) + return Py_BuildException(); + + const CPythonGuild::TGuildSkillData & c_rSkillData = CPythonGuild::Instance().GetGuildSkillDataRef(); + return Py_BuildValue("i", c_rSkillData.bySkillLevel[iSkillIndex]); +} + +PyObject * guildGetSkillLevel(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + + std::map::iterator itor = g_GuildSkillSlotToIndexMap.find(iSlotIndex); + + if (g_GuildSkillSlotToIndexMap.end() == itor) + return Py_BuildValue("i", 0); + + DWORD dwSkillIndex = itor->second; + assert(dwSkillIndex < CPythonGuild::GUILD_SKILL_MAX_NUM); + + const CPythonGuild::TGuildSkillData & c_rSkillData = CPythonGuild::Instance().GetGuildSkillDataRef(); + return Py_BuildValue("i", c_rSkillData.bySkillLevel[dwSkillIndex]); +} + +PyObject * guildGetSkillMaxLevelNew(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + + std::map::iterator itor = g_GuildSkillSlotToIndexMap.find(iSlotIndex); + + if (g_GuildSkillSlotToIndexMap.end() == itor) + return Py_BuildValue("i", 0); + + DWORD dwSkillIndex = itor->second; + assert(dwSkillIndex < CPythonGuild::GUILD_SKILL_MAX_NUM); + + const CPythonGuild::TGuildSkillData & c_rSkillData = CPythonGuild::Instance().GetGuildSkillDataRef(); + return Py_BuildValue("i", c_rSkillData.bySkillLevel[dwSkillIndex]); +} + +PyObject * guildSetSkillIndex(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + int iSkillIndex; + if (!PyTuple_GetInteger(poArgs, 1, &iSkillIndex)) + return Py_BuildException(); + + g_GuildSkillSlotToIndexMap.insert(std::make_pair(iSlotIndex, iSkillIndex)); + + return Py_BuildNone(); +} + +PyObject * guildGetSkillIndex(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + + std::map::iterator itor = g_GuildSkillSlotToIndexMap.find(iSlotIndex); + + if (g_GuildSkillSlotToIndexMap.end() == itor) + return Py_BuildValue("i", 0); + + DWORD dwSkillIndex = itor->second; + return Py_BuildValue("i", dwSkillIndex); +} + +PyObject * guildGetGradeData(PyObject * poSelf, PyObject * poArgs) +{ + int iGradeNumber; + if (!PyTuple_GetInteger(poArgs, 0, &iGradeNumber)) + return Py_BuildException(); + + CPythonGuild::TGuildGradeData * pData; + if (!CPythonGuild::Instance().GetGradeDataPtr(iGradeNumber, &pData)) + return Py_BuildValue("si", "?", 0); + + return Py_BuildValue("si", pData->strName.c_str(), pData->byAuthorityFlag); +} + +PyObject * guildGetGradeName(PyObject * poSelf, PyObject * poArgs) +{ + int iGradeNumber; + if (!PyTuple_GetInteger(poArgs, 0, &iGradeNumber)) + return Py_BuildException(); + + CPythonGuild::TGuildGradeData * pData; + if (!CPythonGuild::Instance().GetGradeDataPtr(iGradeNumber, &pData)) + return Py_BuildValue("s", "?"); + + return Py_BuildValue("s", pData->strName.c_str()); +} + +PyObject * guildGetMemberCount(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonGuild::Instance().GetMemberCount()); +} + +PyObject * guildGetMemberData(PyObject * poSelf, PyObject * poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + CPythonGuild::TGuildMemberData * pData; + if (!CPythonGuild::Instance().GetMemberDataPtr(iIndex, &pData)) + return Py_BuildValue("isiiiii", -1, "", 0, 0, 0, 0, 0); + + return Py_BuildValue("isiiiii", pData->dwPID, pData->strName.c_str(), pData->byGrade, pData->byJob, pData->byLevel, pData->dwOffer, pData->byGeneralFlag); +} + +PyObject * guildMemberIndexToPID(PyObject * poSelf, PyObject * poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + CPythonGuild::TGuildMemberData * pData; + if (!CPythonGuild::Instance().GetMemberDataPtr(iIndex, &pData)) + return Py_BuildValue("i", -1); + + return Py_BuildValue("i", pData->dwPID); +} + +PyObject * guildIsMember(PyObject * poSelf, PyObject * poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + CPythonGuild::TGuildMemberData * pData; + if (CPythonGuild::Instance().GetMemberDataPtr(iIndex, &pData)) + return Py_BuildValue("i", TRUE); + + return Py_BuildValue("i", FALSE); +} + +PyObject * guildIsMemberByName(PyObject * poSelf, PyObject * poArgs) +{ + char * szName; + if (!PyTuple_GetString(poArgs, 0, &szName)) + return Py_BuildException(); + + CPythonGuild::TGuildMemberData * pData; + if (CPythonGuild::Instance().GetMemberDataPtrByName(szName, &pData)) + return Py_BuildValue("i", TRUE); + + return Py_BuildValue("i", FALSE); +} + +PyObject * guildMainPlayerHasAuthority(PyObject * poSelf, PyObject * poArgs) +{ + int iAuthority; + if (!PyTuple_GetInteger(poArgs, 0, &iAuthority)) + return Py_BuildException(); + + IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton(); + const char * c_szMainPlayerName = rPlayer.GetName(); + + CPythonGuild::TGuildMemberData * pMemberData; + if (!CPythonGuild::Instance().GetMemberDataPtrByName(c_szMainPlayerName, &pMemberData)) + return Py_BuildValue("i", FALSE); + + CPythonGuild::TGuildGradeData * pGradeData; + if (!CPythonGuild::Instance().GetGradeDataPtr(pMemberData->byGrade, &pGradeData)) + return Py_BuildValue("i", FALSE); + + return Py_BuildValue("i", iAuthority == (pGradeData->byAuthorityFlag & iAuthority)); +} + +PyObject * guildDestroy(PyObject * poSelf, PyObject * poArgs) +{ + CPythonGuild::Instance().Destroy(); + g_GuildSkillSlotToIndexMap.clear(); + return Py_BuildNone(); +} + + +PyObject * guildGuildIDToMarkID(PyObject * poSelf, PyObject * poArgs) +{ + int guild_id; + if (!PyTuple_GetInteger(poArgs, 0, &guild_id)) + return Py_BuildException(); + + return Py_BuildValue("i", CGuildMarkManager::Instance().GetMarkID(guild_id)); +} + +PyObject * guildGetMarkImageFilenameByMarkID(PyObject * poSelf, PyObject * poArgs) +{ + int markID; + + if (!PyTuple_GetInteger(poArgs, 0, &markID)) + return Py_BuildException(); + + std::string imagePath; + CGuildMarkManager::Instance().GetMarkImageFilename(markID / CGuildMarkImage::MARK_TOTAL_COUNT, imagePath); + return Py_BuildValue("s", imagePath.c_str()); +} + +PyObject * guildGetMarkIndexByMarkID(PyObject * poSelf, PyObject * poArgs) +{ + int markID; + + if (!PyTuple_GetInteger(poArgs, 0, &markID)) + return Py_BuildException(); + + return Py_BuildValue("i", markID % CGuildMarkImage::MARK_TOTAL_COUNT); +} + +void initguild() +{ + static PyMethodDef s_methods[] = + { + // Enable + { "IsGuildEnable", guildIsGuildEnable, METH_VARARGS }, + { "GuildIDToMarkID", guildGuildIDToMarkID, METH_VARARGS }, + { "GetMarkImageFilenameByMarkID", guildGetMarkImageFilenameByMarkID, METH_VARARGS }, + { "GetMarkIndexByMarkID", guildGetMarkIndexByMarkID, METH_VARARGS }, + + // GuildInfo + { "GetGuildID", guildGetGuildID, METH_VARARGS }, + { "HasGuildLand", guildHasGuildLand, METH_VARARGS }, + { "GetGuildName", guildGetGuildName, METH_VARARGS }, + { "GetGuildMasterName", guildGetGuildMasterName, METH_VARARGS }, + { "GetEnemyGuildName", guildGetEnemyGuildName, METH_VARARGS }, + { "GetGuildMoney", guildGetGuildMoney, METH_VARARGS }, + + // BoardPage + { "GetGuildBoardCommentCount", guildGetGuildBoardCommentCount, METH_VARARGS }, + { "GetGuildBoardCommentData", guildGetGuildBoardCommentData, METH_VARARGS }, + + // MemberPage + { "GetGuildLevel", guildGetGuildLevel, METH_VARARGS }, + { "GetGuildExperience", guildGetGuildExperience, METH_VARARGS }, + { "GetGuildMemberCount", guildGetGuildMemberCount, METH_VARARGS }, + { "GetGuildMemberLevelSummary", guildGetGuildMemberLevelSummary, METH_VARARGS }, + { "GetGuildMemberLevelAverage", guildGetGuildMemberLevelAverage, METH_VARARGS }, + { "GetGuildExperienceSummary", guildGetGuildExperienceSummary, METH_VARARGS }, + + // SkillPage + { "GetGuildSkillPoint", guildGetGuildSkillPoint, METH_VARARGS }, + { "GetDragonPowerPoint", guildGetDragonPowerPoint, METH_VARARGS }, + { "GetGuildSkillLevel", guildGetGuildSkillLevel, METH_VARARGS }, + { "GetSkillLevel", guildGetSkillLevel, METH_VARARGS }, + { "GetSkillMaxLevelNew", guildGetSkillMaxLevelNew, METH_VARARGS }, + + { "SetSkillIndex", guildSetSkillIndex, METH_VARARGS }, + { "GetSkillIndex", guildGetSkillIndex, METH_VARARGS }, + + // GradePage + { "GetGradeData", guildGetGradeData, METH_VARARGS }, + { "GetGradeName", guildGetGradeName, METH_VARARGS }, + + // About Member + { "GetMemberCount", guildGetMemberCount, METH_VARARGS }, + { "GetMemberData", guildGetMemberData, METH_VARARGS }, + { "MemberIndexToPID", guildMemberIndexToPID, METH_VARARGS }, + { "IsMember", guildIsMember, METH_VARARGS }, + { "IsMemberByName", guildIsMemberByName, METH_VARARGS }, + { "MainPlayerHasAuthority", guildMainPlayerHasAuthority, METH_VARARGS }, + + // Guild + { "Destroy", guildDestroy, METH_VARARGS }, + + { NULL, NULL, NULL }, + }; + + PyObject * poModule = Py_InitModule("guild", s_methods); + PyModule_AddIntConstant(poModule, "AUTH_ADD_MEMBER", GUILD_AUTH_ADD_MEMBER); + PyModule_AddIntConstant(poModule, "AUTH_REMOVE_MEMBER", GUILD_AUTH_REMOVE_MEMBER); + PyModule_AddIntConstant(poModule, "AUTH_NOTICE", GUILD_AUTH_NOTICE); + PyModule_AddIntConstant(poModule, "AUTH_SKILL", GUILD_AUTH_SKILL); + PyModule_AddIntConstant(poModule, "ENEMY_GUILD_SLOT_MAX_COUNT", CPythonGuild::ENEMY_GUILD_SLOT_MAX_COUNT); +} diff --git a/extension/src/port/UserInterface/PythonMessenger.cpp b/extension/src/port/UserInterface/PythonMessenger.cpp new file mode 100644 index 00000000..8c0d78aa --- /dev/null +++ b/extension/src/port/UserInterface/PythonMessenger.cpp @@ -0,0 +1,168 @@ +#include "StdAfx.h" +#include "PythonMessenger.h" + +void CPythonMessenger::RemoveFriend(const char * c_szKey) +{ + m_FriendNameMap.erase(c_szKey); +} + +void CPythonMessenger::OnFriendLogin(const char * c_szKey/*, const char * c_szName*/) +{ + m_FriendNameMap.insert(c_szKey); + + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogin", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey)); +} + +void CPythonMessenger::OnFriendLogout(const char * c_szKey) +{ + m_FriendNameMap.insert(c_szKey); + + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogout", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey)); +} + +void CPythonMessenger::SetMobile(const char * c_szKey, BYTE byState) +{ + m_FriendNameMap.insert(c_szKey); + + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnMobile", Py_BuildValue("(isi)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey, byState)); +} + +BOOL CPythonMessenger::IsFriendByKey(const char * c_szKey) +{ + return m_FriendNameMap.end() != m_FriendNameMap.find(c_szKey); +} + +BOOL CPythonMessenger::IsFriendByName(const char * c_szName) +{ + return IsFriendByKey(c_szName); +} + +void CPythonMessenger::AppendGuildMember(const char * c_szName) +{ + if (m_GuildMemberStateMap.end() != m_GuildMemberStateMap.find(c_szName)) + return; + + LogoutGuildMember(c_szName); +} + +void CPythonMessenger::RemoveGuildMember(const char * c_szName) +{ + m_GuildMemberStateMap.erase(c_szName); + + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnRemoveList", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_GUILD, c_szName)); +} + +void CPythonMessenger::RemoveAllGuildMember() +{ + m_GuildMemberStateMap.clear(); + + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnRemoveAllList", Py_BuildValue("(i)", MESSENGER_GRUOP_INDEX_GUILD)); +} + +void CPythonMessenger::LoginGuildMember(const char * c_szName) +{ + m_GuildMemberStateMap[c_szName] = 1; + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogin", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_GUILD, c_szName)); +} + +void CPythonMessenger::LogoutGuildMember(const char * c_szName) +{ + m_GuildMemberStateMap[c_szName] = 0; + if (m_poMessengerHandler) + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogout", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_GUILD, c_szName)); +} + +void CPythonMessenger::RefreshGuildMember() +{ + for (TGuildMemberStateMap::iterator itor = m_GuildMemberStateMap.begin(); itor != m_GuildMemberStateMap.end(); ++itor) + { + if (itor->second) + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogin", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_GUILD, (itor->first).c_str())); + else + PyCallClassMemberFunc(m_poMessengerHandler, "OnLogout", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_GUILD, (itor->first).c_str())); + } +} + +void CPythonMessenger::Destroy() +{ + m_FriendNameMap.clear(); + m_GuildMemberStateMap.clear(); +} + +void CPythonMessenger::SetMessengerHandler(PyObject* poHandler) +{ + m_poMessengerHandler = poHandler; +} + +CPythonMessenger::CPythonMessenger() + : m_poMessengerHandler(NULL) +{ +} + +CPythonMessenger::~CPythonMessenger() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PyObject * messengerRemoveFriend(PyObject* poSelf, PyObject* poArgs) +{ + char * szKey; + if (!PyTuple_GetString(poArgs, 0, &szKey)) + return Py_BuildException(); + + CPythonMessenger::Instance().RemoveFriend(szKey); + return Py_BuildNone(); +} + +PyObject * messengerIsFriendByName(PyObject* poSelf, PyObject* poArgs) +{ + char * szName; + if (!PyTuple_GetString(poArgs, 0, &szName)) + return Py_BuildException(); + + return Py_BuildValue("i", CPythonMessenger::Instance().IsFriendByName(szName)); +} + +PyObject * messengerDestroy(PyObject* poSelf, PyObject* poArgs) +{ + CPythonMessenger::Instance().Destroy(); + return Py_BuildNone(); +} + +PyObject * messengerRefreshGuildMember(PyObject* poSelf, PyObject* poArgs) +{ + CPythonMessenger::Instance().RefreshGuildMember(); + return Py_BuildNone(); +} + +PyObject * messengerSetMessengerHandler(PyObject* poSelf, PyObject* poArgs) +{ + PyObject * poEventHandler; + if (!PyTuple_GetObject(poArgs, 0, &poEventHandler)) + return Py_BuildException(); + + CPythonMessenger::Instance().SetMessengerHandler(poEventHandler); + return Py_BuildNone(); +} + +void initMessenger() +{ + static PyMethodDef s_methods[] = + { + { "RemoveFriend", messengerRemoveFriend, METH_VARARGS }, + { "IsFriendByName", messengerIsFriendByName, METH_VARARGS } , + { "Destroy", messengerDestroy, METH_VARARGS }, + { "RefreshGuildMember", messengerRefreshGuildMember, METH_VARARGS }, + { "SetMessengerHandler", messengerSetMessengerHandler, METH_VARARGS }, + { NULL, NULL, NULL }, + }; + + Py_InitModule("messenger", s_methods); +} diff --git a/extension/src/port/UserInterface/PythonSafeBox.cpp b/extension/src/port/UserInterface/PythonSafeBox.cpp new file mode 100644 index 00000000..39a9e0e6 --- /dev/null +++ b/extension/src/port/UserInterface/PythonSafeBox.cpp @@ -0,0 +1,338 @@ +#include "StdAfx.h" +#include "PythonSafeBox.h" + +void CPythonSafeBox::OpenSafeBox(int iSize) +{ + m_dwMoney = 0; + m_ItemInstanceVector.clear(); + m_ItemInstanceVector.resize(SAFEBOX_SLOT_X_COUNT * iSize); + + for (DWORD i = 0; i < m_ItemInstanceVector.size(); ++i) + { + TItemData & rInstance = m_ItemInstanceVector[i]; + ZeroMemory(&rInstance, sizeof(rInstance)); + } +} + +void CPythonSafeBox::SetItemData(DWORD dwSlotIndex, const TItemData & rItemInstance) +{ + if (dwSlotIndex >= m_ItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::SetItemData(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return; + } + + m_ItemInstanceVector[dwSlotIndex] = rItemInstance; +} + +void CPythonSafeBox::DelItemData(DWORD dwSlotIndex) +{ + if (dwSlotIndex >= m_ItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::DelItemData(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return; + } + + TItemData & rInstance = m_ItemInstanceVector[dwSlotIndex]; + ZeroMemory(&rInstance, sizeof(rInstance)); +} + +void CPythonSafeBox::SetMoney(DWORD dwMoney) +{ + m_dwMoney = dwMoney; +} + +DWORD CPythonSafeBox::GetMoney() +{ + return m_dwMoney; +} + +int CPythonSafeBox::GetCurrentSafeBoxSize() +{ + return m_ItemInstanceVector.size(); +} + +BOOL CPythonSafeBox::GetSlotItemID(DWORD dwSlotIndex, DWORD* pdwItemID) +{ + if (dwSlotIndex >= m_ItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::GetSlotItemID(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return FALSE; + } + + *pdwItemID=m_ItemInstanceVector[dwSlotIndex].vnum; + + return TRUE; +} + +BOOL CPythonSafeBox::GetItemDataPtr(DWORD dwSlotIndex, TItemData ** ppInstance) +{ + if (dwSlotIndex >= m_ItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::GetItemData(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return FALSE; + } + + *ppInstance = &m_ItemInstanceVector[dwSlotIndex]; + + return TRUE; +} + +void CPythonSafeBox::OpenMall(int iSize) +{ + m_MallItemInstanceVector.clear(); + m_MallItemInstanceVector.resize(SAFEBOX_SLOT_X_COUNT * iSize); + + for (DWORD i = 0; i < m_MallItemInstanceVector.size(); ++i) + { + TItemData & rInstance = m_MallItemInstanceVector[i]; + ZeroMemory(&rInstance, sizeof(rInstance)); + } +} + +void CPythonSafeBox::SetMallItemData(DWORD dwSlotIndex, const TItemData & rItemData) +{ + if (dwSlotIndex >= m_MallItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::SetMallItemData(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return; + } + + m_MallItemInstanceVector[dwSlotIndex] = rItemData; +} + +void CPythonSafeBox::DelMallItemData(DWORD dwSlotIndex) +{ + if (dwSlotIndex >= m_MallItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::DelMallItemData(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return; + } + + TItemData & rInstance = m_MallItemInstanceVector[dwSlotIndex]; + ZeroMemory(&rInstance, sizeof(rInstance)); +} + +BOOL CPythonSafeBox::GetMallItemDataPtr(DWORD dwSlotIndex, TItemData ** ppInstance) +{ + if (dwSlotIndex >= m_MallItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::GetMallSlotItemID(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return FALSE; + } + + *ppInstance = &m_MallItemInstanceVector[dwSlotIndex]; + + return TRUE; +} + +BOOL CPythonSafeBox::GetSlotMallItemID(DWORD dwSlotIndex, DWORD * pdwItemID) +{ + if (dwSlotIndex >= m_MallItemInstanceVector.size()) + { + TraceError("CPythonSafeBox::GetMallSlotItemID(dwSlotIndex=%d) - Strange slot index", dwSlotIndex); + return FALSE; + } + + *pdwItemID = m_MallItemInstanceVector[dwSlotIndex].vnum; + + return TRUE; +} + +DWORD CPythonSafeBox::GetMallSize() +{ + return m_MallItemInstanceVector.size(); +} + +CPythonSafeBox::CPythonSafeBox() +{ + m_dwMoney = 0; +} + +CPythonSafeBox::~CPythonSafeBox() +{ +} + +PyObject * safeboxGetCurrentSafeboxSize(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSafeBox::Instance().GetCurrentSafeBoxSize()); +} + +PyObject * safeboxGetItemID(PyObject * poSelf, PyObject * poArgs) +{ + int ipos; + if (!PyTuple_GetInteger(poArgs, 0, &ipos)) + return Py_BadArgument(); + + TItemData * pInstance; + if (!CPythonSafeBox::Instance().GetItemDataPtr(ipos, &pInstance)) + return Py_BuildException(); + + return Py_BuildValue("i", pInstance->vnum); +} + +PyObject * safeboxGetItemCount(PyObject * poSelf, PyObject * poArgs) +{ + int ipos; + if (!PyTuple_GetInteger(poArgs, 0, &ipos)) + return Py_BadArgument(); + + TItemData * pInstance; + if (!CPythonSafeBox::Instance().GetItemDataPtr(ipos, &pInstance)) + return Py_BuildException(); + + return Py_BuildValue("i", pInstance->count); +} + +PyObject * safeboxGetItemFlags(PyObject * poSelf, PyObject * poArgs) +{ + int ipos; + if (!PyTuple_GetInteger(poArgs, 0, &ipos)) + return Py_BadArgument(); + + TItemData * pInstance; + if (!CPythonSafeBox::Instance().GetItemDataPtr(ipos, &pInstance)) + return Py_BuildException(); + + return Py_BuildValue("i", pInstance->flags); +} + +PyObject * safeboxGetItemMetinSocket(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BadArgument(); + int iSocketIndex; + if (!PyTuple_GetInteger(poArgs, 1, &iSocketIndex)) + return Py_BadArgument(); + + if (iSocketIndex >= ITEM_SOCKET_SLOT_MAX_NUM) + return Py_BuildException(); + + TItemData * pItemData; + if (!CPythonSafeBox::Instance().GetItemDataPtr(iSlotIndex, &pItemData)) + return Py_BuildException(); + + return Py_BuildValue("i", pItemData->alSockets[iSocketIndex]); +} + +PyObject * safeboxGetItemAttribute(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + int iAttrSlotIndex; + if (!PyTuple_GetInteger(poArgs, 1, &iAttrSlotIndex)) + return Py_BuildException(); + + if (iAttrSlotIndex >= 0 && iAttrSlotIndex < ITEM_ATTRIBUTE_SLOT_MAX_NUM) + { + TItemData * pItemData; + if (CPythonSafeBox::Instance().GetItemDataPtr(iSlotIndex, &pItemData)) + return Py_BuildValue("ii", pItemData->aAttr[iAttrSlotIndex].bType, pItemData->aAttr[iAttrSlotIndex].sValue); + } + + return Py_BuildValue("ii", 0, 0); +} + +PyObject * safeboxGetMoney(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSafeBox::Instance().GetMoney()); +} + +PyObject * safeboxGetMallItemID(PyObject * poSelf, PyObject * poArgs) +{ + int ipos; + if (!PyTuple_GetInteger(poArgs, 0, &ipos)) + return Py_BadArgument(); + + TItemData * pInstance; + if (!CPythonSafeBox::Instance().GetMallItemDataPtr(ipos, &pInstance)) + return Py_BuildException(); + + return Py_BuildValue("i", pInstance->vnum); +} + +PyObject * safeboxGetMallItemCount(PyObject * poSelf, PyObject * poArgs) +{ + int ipos; + if (!PyTuple_GetInteger(poArgs, 0, &ipos)) + return Py_BadArgument(); + + TItemData * pInstance; + if (!CPythonSafeBox::Instance().GetMallItemDataPtr(ipos, &pInstance)) + return Py_BuildException(); + + return Py_BuildValue("i", pInstance->count); +} + +PyObject * safeboxGetMallItemMetinSocket(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BadArgument(); + int iSocketIndex; + if (!PyTuple_GetInteger(poArgs, 1, &iSocketIndex)) + return Py_BadArgument(); + + if (iSocketIndex >= ITEM_SOCKET_SLOT_MAX_NUM) + return Py_BuildException(); + + TItemData * pItemData; + if (!CPythonSafeBox::Instance().GetMallItemDataPtr(iSlotIndex, &pItemData)) + return Py_BuildException(); + + return Py_BuildValue("i", pItemData->alSockets[iSocketIndex]); +} + +PyObject * safeboxGetMallItemAttribute(PyObject * poSelf, PyObject * poArgs) +{ + int iSlotIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex)) + return Py_BuildException(); + int iAttrSlotIndex; + if (!PyTuple_GetInteger(poArgs, 1, &iAttrSlotIndex)) + return Py_BuildException(); + + if (iAttrSlotIndex >= 0 && iAttrSlotIndex < ITEM_ATTRIBUTE_SLOT_MAX_NUM) + { + TItemData * pItemData; + if (CPythonSafeBox::Instance().GetMallItemDataPtr(iSlotIndex, &pItemData)) + return Py_BuildValue("ii", pItemData->aAttr[iAttrSlotIndex].bType, pItemData->aAttr[iAttrSlotIndex].sValue); + } + + return Py_BuildValue("ii", 0, 0); +} + +PyObject * safeboxGetMallSize(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSafeBox::Instance().GetMallSize()); +} + +void initsafebox() +{ + static PyMethodDef s_methods[] = + { + // SafeBox + { "GetCurrentSafeboxSize", safeboxGetCurrentSafeboxSize, METH_VARARGS }, + { "GetItemID", safeboxGetItemID, METH_VARARGS }, + { "GetItemCount", safeboxGetItemCount, METH_VARARGS }, + { "GetItemFlags", safeboxGetItemFlags, METH_VARARGS }, + { "GetItemMetinSocket", safeboxGetItemMetinSocket, METH_VARARGS }, + { "GetItemAttribute", safeboxGetItemAttribute, METH_VARARGS }, + { "GetMoney", safeboxGetMoney, METH_VARARGS }, + + // Mall + { "GetMallItemID", safeboxGetMallItemID, METH_VARARGS }, + { "GetMallItemCount", safeboxGetMallItemCount, METH_VARARGS }, + { "GetMallItemMetinSocket", safeboxGetMallItemMetinSocket, METH_VARARGS }, + { "GetMallItemAttribute", safeboxGetMallItemAttribute, METH_VARARGS }, + { "GetMallSize", safeboxGetMallSize, METH_VARARGS }, + { NULL, NULL, NULL }, + }; + + PyObject * poModule = Py_InitModule("safebox", s_methods); + PyModule_AddIntConstant(poModule, "SAFEBOX_SLOT_X_COUNT", CPythonSafeBox::SAFEBOX_SLOT_X_COUNT); + PyModule_AddIntConstant(poModule, "SAFEBOX_SLOT_Y_COUNT", CPythonSafeBox::SAFEBOX_SLOT_Y_COUNT); + PyModule_AddIntConstant(poModule, "SAFEBOX_PAGE_SIZE", CPythonSafeBox::SAFEBOX_PAGE_SIZE); +} diff --git a/extension/src/port/UserInterface/PythonSoundManagerModule.cpp b/extension/src/port/UserInterface/PythonSoundManagerModule.cpp new file mode 100644 index 00000000..1547d296 --- /dev/null +++ b/extension/src/port/UserInterface/PythonSoundManagerModule.cpp @@ -0,0 +1,176 @@ +#include "StdAfx.h" +#include "PythonApplication.h" + +PyObject * sndPlaySound(PyObject * poSelf, PyObject * poArgs) +{ + char * szFileName; + if (!PyTuple_GetString(poArgs, 0, &szFileName)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.PlaySound2D(szFileName); + return Py_BuildNone(); +} + +PyObject * sndPlaySound3D(PyObject * poSelf, PyObject * poArgs) +{ + float fx; + if (!PyTuple_GetFloat(poArgs, 0, &fx)) + return Py_BuildException(); + float fy; + if (!PyTuple_GetFloat(poArgs, 1, &fy)) + return Py_BuildException(); + float fz; + if (!PyTuple_GetFloat(poArgs, 2, &fz)) + return Py_BuildException(); + char * szFileName; + if (!PyTuple_GetString(poArgs, 3, &szFileName)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.PlaySound3D(fx, fy, fz, szFileName); + return Py_BuildNone(); +} + +PyObject * sndPlayMusic(PyObject * poSelf, PyObject * poArgs) +{ + char * szFileName; + if (!PyTuple_GetString(poArgs, 0, &szFileName)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.PlayMusic(szFileName); + return Py_BuildNone(); +} + +PyObject * sndFadeInMusic(PyObject * poSelf, PyObject * poArgs) +{ + char * szFileName; + if (!PyTuple_GetString(poArgs, 0, &szFileName)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.FadeInMusic(szFileName); + return Py_BuildNone(); +} + +PyObject * sndFadeOutMusic(PyObject * poSelf, PyObject * poArgs) +{ + char * szFileName; + if (!PyTuple_GetString(poArgs, 0, &szFileName)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.FadeOutMusic(szFileName); + return Py_BuildNone(); +} + +PyObject * sndFadeOutAllMusic(PyObject * poSelf, PyObject * poArgs) +{ + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.FadeOutAllMusic(); + return Py_BuildNone(); +} + +PyObject * sndFadeLimitOutMusic(PyObject * poSelf, PyObject * poArgs) +{ + char * szFileName; + if (!PyTuple_GetString(poArgs, 0, &szFileName)) + return Py_BuildException(); + + float fLimitVolume; + if (!PyTuple_GetFloat(poArgs, 1, &fLimitVolume)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.FadeLimitOutMusic(szFileName, fLimitVolume); + return Py_BuildNone(); +} + +PyObject * sndStopAllSound(PyObject * poSelf, PyObject * poArgs) +{ + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.StopAllSound3D(); + return Py_BuildNone(); +} + +PyObject * sndSetMusicVolume(PyObject * poSelf, PyObject * poArgs) +{ + float fVolume; + if (!PyTuple_GetFloat(poArgs, 0, &fVolume)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.SetMusicVolume(fVolume); + return Py_BuildNone(); +} + +PyObject * sndSetSoundVolumef(PyObject * poSelf, PyObject * poArgs) +{ + float fVolume; + if (!PyTuple_GetFloat(poArgs, 0, &fVolume)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.SetSoundVolumeRatio(fVolume); + return Py_BuildNone(); +} + + +PyObject * sndSetSoundVolume(PyObject * poSelf, PyObject * poArgs) +{ + int iVolume; + if (!PyTuple_GetInteger(poArgs, 0, &iVolume)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.SetSoundVolumeGrade(iVolume); + return Py_BuildNone(); +} + +PyObject * sndSetSoundScale(PyObject * poSelf, PyObject * poArgs) +{ + float fScale; + if (!PyTuple_GetFloat(poArgs, 0, &fScale)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.SetSoundScale(fScale); + return Py_BuildNone(); +} + +PyObject * sndSetAmbienceSoundScale(PyObject * poSelf, PyObject * poArgs) +{ + float fScale; + if (!PyTuple_GetFloat(poArgs, 0, &fScale)) + return Py_BuildException(); + + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.SetAmbienceSoundScale(fScale); + return Py_BuildNone(); +} + +void initsnd() +{ + static PyMethodDef s_methods[] = + { + { "PlaySound", sndPlaySound, METH_VARARGS }, + { "PlaySound3D", sndPlaySound3D, METH_VARARGS }, + { "PlayMusic", sndPlayMusic, METH_VARARGS }, + { "FadeInMusic", sndFadeInMusic, METH_VARARGS }, + { "FadeOutMusic", sndFadeOutMusic, METH_VARARGS }, + { "FadeOutAllMusic", sndFadeOutAllMusic, METH_VARARGS }, + { "FadeLimitOutMusic", sndFadeLimitOutMusic, METH_VARARGS }, + { "StopAllSound", sndStopAllSound, METH_VARARGS }, + + { "SetMusicVolumef", sndSetMusicVolume, METH_VARARGS }, + { "SetMusicVolume", sndSetMusicVolume, METH_VARARGS }, + { "SetSoundVolumef", sndSetSoundVolumef, METH_VARARGS }, + { "SetSoundVolume", sndSetSoundVolume, METH_VARARGS }, + { "SetSoundScale", sndSetSoundScale, METH_VARARGS }, + { "SetAmbienceSoundScale", sndSetAmbienceSoundScale, METH_VARARGS }, + { NULL, NULL, NULL }, + }; + + Py_InitModule("snd", s_methods); +} \ No newline at end of file diff --git a/extension/src/port/UserInterface/PythonSystem.cpp b/extension/src/port/UserInterface/PythonSystem.cpp new file mode 100644 index 00000000..91612bb6 --- /dev/null +++ b/extension/src/port/UserInterface/PythonSystem.cpp @@ -0,0 +1,685 @@ +#include "StdAfx.h" +#include "PythonSystem.h" +#include "PythonApplication.h" + +#define DEFAULT_VALUE_ALWAYS_SHOW_NAME true + +void CPythonSystem::SetInterfaceHandler(PyObject * poHandler) +{ +// NOTE : 레퍼런스 카운트는 바꾸지 않는다. 레퍼런스가 남아 있어 Python에서 완전히 지워지지 않기 때문. +// 대신에 __del__때 Destroy를 호출해 Handler를 NULL로 셋팅한다. - [levites] +// if (m_poInterfaceHandler) +// Py_DECREF(m_poInterfaceHandler); + + m_poInterfaceHandler = poHandler; + +// if (m_poInterfaceHandler) +// Py_INCREF(m_poInterfaceHandler); +} + +void CPythonSystem::DestroyInterfaceHandler() +{ + m_poInterfaceHandler = NULL; +} + +void CPythonSystem::SaveWindowStatus(int iIndex, int iVisible, int iMinimized, int ix, int iy, int iHeight) +{ + m_WindowStatus[iIndex].isVisible = iVisible; + m_WindowStatus[iIndex].isMinimized = iMinimized; + m_WindowStatus[iIndex].ixPosition = ix; + m_WindowStatus[iIndex].iyPosition = iy; + m_WindowStatus[iIndex].iHeight = iHeight; +} + +void CPythonSystem::GetDisplaySettings() +{ + memset(m_ResolutionList, 0, sizeof(TResolution) * RESOLUTION_MAX_NUM); + m_ResolutionCount = 0; + + LPDIRECT3D8 lpD3D = CPythonGraphic::Instance().GetD3D(); + // PORT: defensive guard for headless / dummy graphic environments + if (!lpD3D) + return; + + D3DADAPTER_IDENTIFIER8 d3dAdapterIdentifier; + D3DDISPLAYMODE d3ddmDesktop; + + lpD3D->GetAdapterIdentifier(0, D3DENUM_NO_WHQL_LEVEL, &d3dAdapterIdentifier); + lpD3D->GetAdapterDisplayMode(0, &d3ddmDesktop); + + // 이 어뎁터가 가지고 있는 디스플래이 모드갯수를 나열한다.. + DWORD dwNumAdapterModes = lpD3D->GetAdapterModeCount(0); + + for (UINT iMode = 0; iMode < dwNumAdapterModes; iMode++) + { + D3DDISPLAYMODE DisplayMode; + lpD3D->EnumAdapterModes(0, iMode, &DisplayMode); + DWORD bpp = 0; + + // 800 600 이상만 걸러낸다. + if (DisplayMode.Width < 800 || DisplayMode.Height < 600) + continue; + + // 일단 16bbp 와 32bbp만 취급하자. + // 16bbp만 처리하게끔 했음 - [levites] + if (DisplayMode.Format == D3DFMT_R5G6B5) + bpp = 16; + else if (DisplayMode.Format == D3DFMT_X8R8G8B8) + bpp = 32; + else + continue; + + int check_res = false; + + for (int i = 0; !check_res && i < m_ResolutionCount; ++i) + { + if (m_ResolutionList[i].bpp != bpp || + m_ResolutionList[i].width != DisplayMode.Width || + m_ResolutionList[i].height != DisplayMode.Height) + continue; + + int check_fre = false; + + // 프리퀀시만 다르므로 프리퀀시만 셋팅해준다. + for (int j = 0; j < m_ResolutionList[i].frequency_count; ++j) + { + if (m_ResolutionList[i].frequency[j] == DisplayMode.RefreshRate) + { + check_fre = true; + break; + } + } + + if (!check_fre) + if (m_ResolutionList[i].frequency_count < FREQUENCY_MAX_NUM) + m_ResolutionList[i].frequency[m_ResolutionList[i].frequency_count++] = DisplayMode.RefreshRate; + + check_res = true; + } + + if (!check_res) + { + // 새로운 거니까 추가해주자. + if (m_ResolutionCount < RESOLUTION_MAX_NUM) + { + m_ResolutionList[m_ResolutionCount].width = DisplayMode.Width; + m_ResolutionList[m_ResolutionCount].height = DisplayMode.Height; + m_ResolutionList[m_ResolutionCount].bpp = bpp; + m_ResolutionList[m_ResolutionCount].frequency[0] = DisplayMode.RefreshRate; + m_ResolutionList[m_ResolutionCount].frequency_count = 1; + + ++m_ResolutionCount; + } + } + } +} + +int CPythonSystem::GetResolutionCount() +{ + return m_ResolutionCount; +} + +int CPythonSystem::GetFrequencyCount(int index) +{ + if (index >= m_ResolutionCount) + return 0; + + return m_ResolutionList[index].frequency_count; +} + +bool CPythonSystem::GetResolution(int index, OUT DWORD *width, OUT DWORD *height, OUT DWORD *bpp) +{ + if (index >= m_ResolutionCount) + return false; + + *width = m_ResolutionList[index].width; + *height = m_ResolutionList[index].height; + *bpp = m_ResolutionList[index].bpp; + return true; +} + +bool CPythonSystem::GetFrequency(int index, int freq_index, OUT DWORD *frequncy) +{ + if (index >= m_ResolutionCount) + return false; + + if (freq_index >= m_ResolutionList[index].frequency_count) + return false; + + *frequncy = m_ResolutionList[index].frequency[freq_index]; + return true; +} + +int CPythonSystem::GetResolutionIndex(DWORD width, DWORD height, DWORD bit) +{ + DWORD re_width, re_height, re_bit; + int i = 0; + + while (GetResolution(i, &re_width, &re_height, &re_bit)) + { + if (re_width == width) + if (re_height == height) + if (re_bit == bit) + return i; + i++; + } + + return 0; +} + +int CPythonSystem::GetFrequencyIndex(int res_index, DWORD frequency) +{ + DWORD re_frequency; + int i = 0; + + while (GetFrequency(res_index, i, &re_frequency)) + { + if (re_frequency == frequency) + return i; + + i++; + } + + return 0; +} + +DWORD CPythonSystem::GetWidth() +{ + return m_Config.width; +} + +DWORD CPythonSystem::GetHeight() +{ + return m_Config.height; +} +DWORD CPythonSystem::GetBPP() +{ + return m_Config.bpp; +} +DWORD CPythonSystem::GetFrequency() +{ + return m_Config.frequency; +} + +bool CPythonSystem::IsNoSoundCard() +{ + return m_Config.bNoSoundCard; +} + +bool CPythonSystem::IsSoftwareCursor() +{ + return m_Config.is_software_cursor; +} + +float CPythonSystem::GetMusicVolume() +{ + return m_Config.music_volume; +} + +int CPythonSystem::GetSoundVolume() +{ + return m_Config.voice_volume; +} + +void CPythonSystem::SetMusicVolume(float fVolume) +{ + m_Config.music_volume = fVolume; +} + +void CPythonSystem::SetSoundVolumef(float fVolume) +{ + m_Config.voice_volume = int(5 * fVolume); +} + +int CPythonSystem::GetDistance() +{ + return m_Config.iDistance; +} + +int CPythonSystem::GetShadowLevel() +{ + return m_Config.iShadowLevel; +} + +void CPythonSystem::SetShadowLevel(unsigned int level) +{ + m_Config.iShadowLevel = MIN(level, 5); + CPythonBackground::instance().RefreshShadowLevel(); +} + +int CPythonSystem::IsSaveID() +{ + return m_Config.isSaveID; +} + +const char * CPythonSystem::GetSaveID() +{ + return m_Config.SaveID; +} + +bool CPythonSystem::isViewCulling() +{ + return m_Config.is_object_culling; +} + +void CPythonSystem::SetSaveID(int iValue, const char * c_szSaveID) +{ + if (iValue != 1) + return; + + m_Config.isSaveID = iValue; + strncpy(m_Config.SaveID, c_szSaveID, sizeof(m_Config.SaveID) - 1); +} + +CPythonSystem::TConfig * CPythonSystem::GetConfig() +{ + return &m_Config; +} + +void CPythonSystem::SetConfig(TConfig * pNewConfig) +{ + m_Config = *pNewConfig; +} + +void CPythonSystem::SetDefaultConfig() +{ + memset(&m_Config, 0, sizeof(m_Config)); + + // PORT: default resolution matches standard 800x600 canvas / minimum classic window + m_Config.width = 800; + m_Config.height = 600; + m_Config.bpp = 32; + +#if defined( LOCALE_SERVICE_WE_JAPAN ) + m_Config.bWindowed = true; +#else + m_Config.bWindowed = false; +#endif + + m_Config.is_software_cursor = false; + m_Config.is_object_culling = true; + m_Config.iDistance = 3; + + m_Config.gamma = 3; + m_Config.music_volume = 1.0f; + m_Config.voice_volume = 5; + + m_Config.bDecompressDDS = 0; + m_Config.bSoftwareTiling = 0; + m_Config.iShadowLevel = 3; + m_Config.bViewChat = true; + m_Config.bAlwaysShowName = DEFAULT_VALUE_ALWAYS_SHOW_NAME; + m_Config.bShowDamage = true; + m_Config.bShowSalesText = true; +} + +bool CPythonSystem::IsWindowed() +{ + return m_Config.bWindowed; +} + +bool CPythonSystem::IsViewChat() +{ + return m_Config.bViewChat; +} + +void CPythonSystem::SetViewChatFlag(int iFlag) +{ + m_Config.bViewChat = iFlag == 1 ? true : false; +} + +bool CPythonSystem::IsAlwaysShowName() +{ + return m_Config.bAlwaysShowName; +} + +void CPythonSystem::SetAlwaysShowNameFlag(int iFlag) +{ + m_Config.bAlwaysShowName = iFlag == 1 ? true : false; +} + +bool CPythonSystem::IsShowDamage() +{ + return m_Config.bShowDamage; +} + +void CPythonSystem::SetShowDamageFlag(int iFlag) +{ + m_Config.bShowDamage = iFlag == 1 ? true : false; +} + +bool CPythonSystem::IsShowSalesText() +{ + return m_Config.bShowSalesText; +} + +void CPythonSystem::SetShowSalesTextFlag(int iFlag) +{ + m_Config.bShowSalesText = iFlag == 1 ? true : false; +} + +bool CPythonSystem::IsAutoTiling() +{ + if (m_Config.bSoftwareTiling == 0) + return true; + + return false; +} + +void CPythonSystem::SetSoftwareTiling(bool isEnable) +{ + if (isEnable) + m_Config.bSoftwareTiling=1; + else + m_Config.bSoftwareTiling=2; +} + +bool CPythonSystem::IsSoftwareTiling() +{ + if (m_Config.bSoftwareTiling==1) + return true; + + return false; +} + +bool CPythonSystem::IsUseDefaultIME() +{ + return m_Config.bUseDefaultIME; +} + +bool CPythonSystem::LoadConfig() +{ + FILE * fp = NULL; + + if (NULL == (fp = fopen("metin2.cfg", "rt"))) + return false; + + char buf[256]; + char command[256]; + char value[256]; + + while (fgets(buf, 256, fp)) + { + if (sscanf(buf, " %s %s\n", command, value) == EOF) + break; + + if (!stricmp(command, "WIDTH")) + m_Config.width = atoi(value); + else if (!stricmp(command, "HEIGHT")) + m_Config.height = atoi(value); + else if (!stricmp(command, "BPP")) + m_Config.bpp = atoi(value); + else if (!stricmp(command, "FREQUENCY")) + m_Config.frequency = atoi(value); + else if (!stricmp(command, "SOFTWARE_CURSOR")) + m_Config.is_software_cursor = atoi(value) ? true : false; + else if (!stricmp(command, "OBJECT_CULLING")) + m_Config.is_object_culling = atoi(value) ? true : false; + else if (!stricmp(command, "VISIBILITY")) + m_Config.iDistance = atoi(value); + else if (!stricmp(command, "MUSIC_VOLUME")) { + if(strchr(value, '.') == 0) { // Old compatiability + m_Config.music_volume = pow(10.0f, (-1.0f + (((float) atoi(value)) / 5.0f))); + if(atoi(value) == 0) + m_Config.music_volume = 0.0f; + } else + m_Config.music_volume = atof(value); + } else if (!stricmp(command, "VOICE_VOLUME")) + m_Config.voice_volume = (char) atoi(value); + else if (!stricmp(command, "GAMMA")) + m_Config.gamma = atoi(value); + else if (!stricmp(command, "IS_SAVE_ID")) + m_Config.isSaveID = atoi(value); + else if (!stricmp(command, "SAVE_ID")) + strncpy(m_Config.SaveID, value, 20); + else if (!stricmp(command, "PRE_LOADING_DELAY_TIME")) + g_iLoadingDelayTime = atoi(value); + else if (!stricmp(command, "WINDOWED")) + { + m_Config.bWindowed = atoi(value) == 1 ? true : false; + } + else if (!stricmp(command, "USE_DEFAULT_IME")) + m_Config.bUseDefaultIME = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "SOFTWARE_TILING")) + m_Config.bSoftwareTiling = atoi(value); + else if (!stricmp(command, "SHADOW_LEVEL")) + m_Config.iShadowLevel = atoi(value); + else if (!stricmp(command, "DECOMPRESSED_TEXTURE")) + m_Config.bDecompressDDS = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "NO_SOUND_CARD")) + m_Config.bNoSoundCard = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "VIEW_CHAT")) + m_Config.bViewChat = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "ALWAYS_VIEW_NAME")) + m_Config.bAlwaysShowName = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "SHOW_DAMAGE")) + m_Config.bShowDamage = atoi(value) == 1 ? true : false; + else if (!stricmp(command, "SHOW_SALESTEXT")) + m_Config.bShowSalesText = atoi(value) == 1 ? true : false; + } + + if (m_Config.bWindowed) + { + unsigned screen_width = GetSystemMetrics(SM_CXFULLSCREEN); + unsigned screen_height = GetSystemMetrics(SM_CYFULLSCREEN); + + if (m_Config.width >= screen_width) + { + m_Config.width = screen_width; + } + // if (m_Config.height >= screen_height) + // { + // m_Config.height = screen_height; + // } + if (m_Config.height >= screen_height) //Fix + { + int config_height = m_Config.height; + int difference = (config_height-screen_height)+7; + m_Config.height = config_height - difference; + } + } + + m_OldConfig = m_Config; + + fclose(fp); + +// Tracef("LoadConfig: Resolution: %dx%d %dBPP %dHZ Software Cursor: %d, Music/Voice Volume: %d/%d Gamma: %d\n", +// m_Config.width, +// m_Config.height, +// m_Config.bpp, +// m_Config.frequency, +// m_Config.is_software_cursor, +// m_Config.music_volume, +// m_Config.voice_volume, +// m_Config.gamma); + + return true; +} + +bool CPythonSystem::SaveConfig() +{ + FILE *fp; + + if (NULL == (fp = fopen("metin2.cfg", "wt"))) + return false; + + fprintf(fp, "WIDTH %d\n" + "HEIGHT %d\n" + "BPP %d\n" + "FREQUENCY %d\n" + "SOFTWARE_CURSOR %d\n" + "OBJECT_CULLING %d\n" + "VISIBILITY %d\n" + "MUSIC_VOLUME %.3f\n" + "VOICE_VOLUME %d\n" + "GAMMA %d\n" + "IS_SAVE_ID %d\n" + "SAVE_ID %s\n" + "PRE_LOADING_DELAY_TIME %d\n" + "DECOMPRESSED_TEXTURE %d\n", + m_Config.width, + m_Config.height, + m_Config.bpp, + m_Config.frequency, + m_Config.is_software_cursor, + m_Config.is_object_culling, + m_Config.iDistance, + m_Config.music_volume, + m_Config.voice_volume, + m_Config.gamma, + m_Config.isSaveID, + m_Config.SaveID, + g_iLoadingDelayTime, + m_Config.bDecompressDDS); + + if (m_Config.bWindowed == 1) + fprintf(fp, "WINDOWED %d\n", m_Config.bWindowed); + if (m_Config.bViewChat == 0) + fprintf(fp, "VIEW_CHAT %d\n", m_Config.bViewChat); + if (m_Config.bAlwaysShowName != DEFAULT_VALUE_ALWAYS_SHOW_NAME) + fprintf(fp, "ALWAYS_VIEW_NAME %d\n", m_Config.bAlwaysShowName); + if (m_Config.bShowDamage == 0) + fprintf(fp, "SHOW_DAMAGE %d\n", m_Config.bShowDamage); + if (m_Config.bShowSalesText == 0) + fprintf(fp, "SHOW_SALESTEXT %d\n", m_Config.bShowSalesText); + + fprintf(fp, "USE_DEFAULT_IME %d\n", m_Config.bUseDefaultIME); + fprintf(fp, "SOFTWARE_TILING %d\n", m_Config.bSoftwareTiling); + fprintf(fp, "SHADOW_LEVEL %d\n", m_Config.iShadowLevel); + fprintf(fp, "\n"); + + fclose(fp); + return true; +} + +bool CPythonSystem::LoadInterfaceStatus() +{ + FILE * File; + File = fopen("interface.cfg", "rb"); + + if (!File) + return false; + + fread(m_WindowStatus, 1, sizeof(TWindowStatus) * WINDOW_MAX_NUM, File); + fclose(File); + return true; +} + +void CPythonSystem::SaveInterfaceStatus() +{ + if (!m_poInterfaceHandler) + return; + + PyCallClassMemberFunc(m_poInterfaceHandler, "OnSaveInterfaceStatus", Py_BuildValue("()")); + + FILE * File; + + File = fopen("interface.cfg", "wb"); + + if (!File) + { + TraceError("Cannot open interface.cfg"); + return; + } + + fwrite(m_WindowStatus, 1, sizeof(TWindowStatus) * WINDOW_MAX_NUM, File); + fclose(File); +} + +bool CPythonSystem::isInterfaceConfig() +{ + return m_isInterfaceConfig; +} + +const CPythonSystem::TWindowStatus & CPythonSystem::GetWindowStatusReference(int iIndex) +{ + return m_WindowStatus[iIndex]; +} + +void CPythonSystem::ApplyConfig() // 이전 설정과 현재 설정을 비교해서 바뀐 설정을 적용 한다. +{ + if (m_OldConfig.gamma != m_Config.gamma) + { + float val = 1.0f; + + switch (m_Config.gamma) + { + case 0: val = 0.4f; break; + case 1: val = 0.7f; break; + case 2: val = 1.0f; break; + case 3: val = 1.2f; break; + case 4: val = 1.4f; break; + } + + CPythonGraphic::Instance().SetGamma(val); + } + + if (m_OldConfig.is_software_cursor != m_Config.is_software_cursor) + { + if (m_Config.is_software_cursor) + CPythonApplication::Instance().SetCursorMode(CPythonApplication::CURSOR_MODE_SOFTWARE); + else + CPythonApplication::Instance().SetCursorMode(CPythonApplication::CURSOR_MODE_HARDWARE); + } + + m_OldConfig = m_Config; + + ChangeSystem(); +} + +void CPythonSystem::ChangeSystem() +{ + // Shadow + /* + if (m_Config.is_shadow) + CScreen::SetShadowFlag(true); + else + CScreen::SetShadowFlag(false); + */ + CSoundManager& rkSndMgr = CSoundManager::Instance(); + /* + float fMusicVolume; + if (0 == m_Config.music_volume) + fMusicVolume = 0.0f; + else + fMusicVolume= (float)pow(10.0f, (-1.0f + (float)m_Config.music_volume / 5.0f)); + */ + rkSndMgr.SetMusicVolume(m_Config.music_volume); + + /* + float fVoiceVolume; + if (0 == m_Config.voice_volume) + fVoiceVolume = 0.0f; + else + fVoiceVolume = (float)pow(10.0f, (-1.0f + (float)m_Config.voice_volume / 5.0f)); + */ + rkSndMgr.SetSoundVolumeGrade(m_Config.voice_volume); +} + +void CPythonSystem::Clear() +{ + SetInterfaceHandler(NULL); +} + +CPythonSystem::CPythonSystem() +{ + memset(&m_Config, 0, sizeof(TConfig)); + + m_poInterfaceHandler = NULL; + + SetDefaultConfig(); + + LoadConfig(); + + ChangeSystem(); + + if (LoadInterfaceStatus()) + m_isInterfaceConfig = true; + else + m_isInterfaceConfig = false; +} + +CPythonSystem::~CPythonSystem() +{ + assert(m_poInterfaceHandler==NULL && "CPythonSystem MUST CLEAR!"); +} diff --git a/extension/src/port/UserInterface/PythonSystemModule.cpp b/extension/src/port/UserInterface/PythonSystemModule.cpp new file mode 100644 index 00000000..bc4f356d --- /dev/null +++ b/extension/src/port/UserInterface/PythonSystemModule.cpp @@ -0,0 +1,445 @@ +#include "StdAfx.h" +#include "PythonSystem.h" + +PyObject * systemGetWidth(PyObject* poSelf, PyObject* poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().GetWidth()); +} + +PyObject * systemGetHeight(PyObject* poSelf, PyObject* poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().GetHeight()); +} + +PyObject * systemSetInterfaceHandler(PyObject* poSelf, PyObject* poArgs) +{ + PyObject* poHandler; + if (!PyTuple_GetObject(poArgs, 0, &poHandler)) + return Py_BuildException(); + + CPythonSystem::Instance().SetInterfaceHandler(poHandler); + return Py_BuildNone(); +} + +PyObject * systemDestroyInterfaceHandler(PyObject* poSelf, PyObject* poArgs) +{ + CPythonSystem::Instance().DestroyInterfaceHandler(); + return Py_BuildNone(); +} + +PyObject * systemReserveResource(PyObject* poSelf, PyObject* poArgs) +{ + std::set ResourceSet; + CResourceManager::Instance().PushBackgroundLoadingSet(ResourceSet); + return Py_BuildNone(); +} + +PyObject * systemisInterfaceConfig(PyObject* poSelf, PyObject* poArgs) +{ + int isInterfaceConfig = CPythonSystem::Instance().isInterfaceConfig(); + return Py_BuildValue("i", isInterfaceConfig); +} + +PyObject * systemSaveWindowStatus(PyObject* poSelf, PyObject* poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + int iVisible; + if (!PyTuple_GetInteger(poArgs, 1, &iVisible)) + return Py_BuildException(); + + int iMinimized; + if (!PyTuple_GetInteger(poArgs, 2, &iMinimized)) + return Py_BuildException(); + + int ix; + if (!PyTuple_GetInteger(poArgs, 3, &ix)) + return Py_BuildException(); + + int iy; + if (!PyTuple_GetInteger(poArgs, 4, &iy)) + return Py_BuildException(); + + int iHeight; + if (!PyTuple_GetInteger(poArgs, 5, &iHeight)) + return Py_BuildException(); + + CPythonSystem::Instance().SaveWindowStatus(iIndex, iVisible, iMinimized, ix, iy, iHeight); + return Py_BuildNone(); +} + +PyObject * systemGetWindowStatus(PyObject* poSelf, PyObject* poArgs) +{ + int iIndex; + if (!PyTuple_GetInteger(poArgs, 0, &iIndex)) + return Py_BuildException(); + + const CPythonSystem::TWindowStatus & c_rWindowStatus = CPythonSystem::Instance().GetWindowStatusReference(iIndex); + return Py_BuildValue("iiiii", c_rWindowStatus.isVisible, + c_rWindowStatus.isMinimized, + c_rWindowStatus.ixPosition, + c_rWindowStatus.iyPosition, + c_rWindowStatus.iHeight); +} + +PyObject * systemGetConfig(PyObject * poSelf, PyObject * poArgs) +{ + CPythonSystem::TConfig *tmp = CPythonSystem::Instance().GetConfig(); + + int iRes = CPythonSystem::Instance().GetResolutionIndex(tmp->width, tmp->height, tmp->bpp); + int iFrequency = CPythonSystem::Instance().GetFrequencyIndex(iRes, tmp->frequency); + + return Py_BuildValue("iiiiiiii", iRes, + iFrequency, + tmp->is_software_cursor, + tmp->is_object_culling, + tmp->music_volume, + tmp->voice_volume, + tmp->gamma, + tmp->iDistance); +} + +PyObject * systemSetSaveID(PyObject * poSelf, PyObject * poArgs) +{ + int iValue; + if (!PyTuple_GetInteger(poArgs, 0, &iValue)) + return Py_BuildException(); + + char * szSaveID; + if (!PyTuple_GetString(poArgs, 1, &szSaveID)) + return Py_BuildException(); + + CPythonSystem::Instance().SetSaveID(iValue, szSaveID); + return Py_BuildNone(); +} + +PyObject * systemisSaveID(PyObject * poSelf, PyObject * poArgs) +{ + int value = CPythonSystem::Instance().IsSaveID(); + return Py_BuildValue("i", value); +} + +PyObject * systemGetSaveID(PyObject * poSelf, PyObject * poArgs) +{ + const char * c_szSaveID = CPythonSystem::Instance().GetSaveID(); + return Py_BuildValue("s", c_szSaveID); +} + +PyObject * systemGetMusicVolume(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("f", CPythonSystem::Instance().GetMusicVolume()); +} + +PyObject * systemGetSoundVolume(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().GetSoundVolume()); +} + +PyObject * systemSetMusicVolume(PyObject * poSelf, PyObject * poArgs) +{ + float fVolume; + if (!PyTuple_GetFloat(poArgs, 0, &fVolume)) + return Py_BuildException(); + + CPythonSystem::Instance().SetMusicVolume(fVolume); + return Py_BuildNone(); +} + +PyObject * systemSetSoundVolumef(PyObject * poSelf, PyObject * poArgs) +{ + float fVolume; + if (!PyTuple_GetFloat(poArgs, 0, &fVolume)) + return Py_BuildException(); + + CPythonSystem::Instance().SetSoundVolumef(fVolume); + return Py_BuildNone(); +} + +PyObject * systemIsSoftwareCursor(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().IsSoftwareCursor()); +} + +PyObject * systemSetViewChatFlag(PyObject * poSelf, PyObject * poArgs) +{ + int iFlag; + if (!PyTuple_GetInteger(poArgs, 0, &iFlag)) + return Py_BuildException(); + + CPythonSystem::Instance().SetViewChatFlag(iFlag); + + return Py_BuildNone(); +} + +PyObject * systemIsViewChat(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().IsViewChat()); +} + +PyObject * systemSetAlwaysShowNameFlag(PyObject * poSelf, PyObject * poArgs) +{ + int iFlag; + if (!PyTuple_GetInteger(poArgs, 0, &iFlag)) + return Py_BuildException(); + + CPythonSystem::Instance().SetAlwaysShowNameFlag(iFlag); + + return Py_BuildNone(); +} + +PyObject * systemSetShowDamageFlag(PyObject * poSelf, PyObject * poArgs) +{ + int iFlag; + if (!PyTuple_GetInteger(poArgs, 0, &iFlag)) + return Py_BuildException(); + + CPythonSystem::Instance().SetShowDamageFlag(iFlag); + + return Py_BuildNone(); +} + +PyObject * systemSetShowSalesTextFlag(PyObject * poSelf, PyObject * poArgs) +{ + int iFlag; + if (!PyTuple_GetInteger(poArgs, 0, &iFlag)) + return Py_BuildException(); + + CPythonSystem::Instance().SetShowSalesTextFlag(iFlag); + + return Py_BuildNone(); +} + +PyObject * systemIsAlwaysShowName(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().IsAlwaysShowName()); +} + +PyObject * systemIsShowDamage(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().IsShowDamage()); +} + +PyObject * systemIsShowSalesText(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().IsShowSalesText()); +} + +PyObject * systemSetConfig(PyObject * poSelf, PyObject * poArgs) +{ + int res_index; + int width; + int height; + int bpp; + int frequency_index; + int frequency; + int software_cursor; + int shadow; + int object_culling; + int music_volume; + int voice_volume; + int gamma; + int distance; + + if (!PyTuple_GetInteger(poArgs, 0, &res_index)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 1, &frequency_index)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 2, &software_cursor)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 3, &shadow)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 4, &object_culling)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 5, &music_volume)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 6, &voice_volume)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 7, &gamma)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 8, &distance)) + return Py_BuildException(); + + if (!CPythonSystem::Instance().GetResolution(res_index, (DWORD *) &width, (DWORD *) &height, (DWORD *) &bpp)) + return Py_BuildNone(); + + if (!CPythonSystem::Instance().GetFrequency(res_index,frequency_index, (DWORD *) &frequency)) + return Py_BuildNone(); + + CPythonSystem::TConfig tmp; + + memcpy(&tmp, CPythonSystem::Instance().GetConfig(), sizeof(tmp)); + + tmp.width = width; + tmp.height = height; + tmp.bpp = bpp; + tmp.frequency = frequency; + tmp.is_software_cursor = software_cursor ? true : false; + tmp.is_object_culling = object_culling ? true : false; + tmp.music_volume = (char) music_volume; + tmp.voice_volume = (char) voice_volume; + tmp.gamma = gamma; + tmp.iDistance = distance; + + CPythonSystem::Instance().SetConfig(&tmp); + return Py_BuildNone(); +} + +PyObject * systemApplyConfig(PyObject * poSelf, PyObject * poArgs) +{ + CPythonSystem::Instance().ApplyConfig(); + return Py_BuildNone(); +} + +PyObject * systemSaveConfig(PyObject * poSelf, PyObject * poArgs) +{ + int ret = CPythonSystem::Instance().SaveConfig(); + return Py_BuildValue("i", ret); +} + +PyObject * systemGetResolutionCount(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().GetResolutionCount()); +} + +PyObject * systemGetFrequencyCount(PyObject * poSelf, PyObject * poArgs) +{ + int index; + + if (!PyTuple_GetInteger(poArgs, 0, &index)) + return Py_BuildException(); + + return Py_BuildValue("i", CPythonSystem::Instance().GetFrequencyCount(index)); +} + +PyObject * systemGetResolution(PyObject * poSelf, PyObject * poArgs) +{ + int index; + DWORD width = 0, height = 0, bpp = 0; + + if (!PyTuple_GetInteger(poArgs, 0, &index)) + return Py_BuildException(); + + CPythonSystem::Instance().GetResolution(index, &width, &height, &bpp); + return Py_BuildValue("iii", width, height, bpp); +} + +PyObject * systemGetCurrentResolution(PyObject * poSelf, PyObject *poArgs) +{ + CPythonSystem::TConfig *tmp = CPythonSystem::Instance().GetConfig(); + return Py_BuildValue("iii", tmp->width, tmp->height, tmp->bpp); +} + +PyObject * systemGetFrequency(PyObject * poSelf, PyObject * poArgs) +{ + int index, frequency_index; + DWORD frequency = 0; + + if (!PyTuple_GetInteger(poArgs, 0, &index)) + return Py_BuildException(); + + if (!PyTuple_GetInteger(poArgs, 1, &frequency_index)) + return Py_BuildException(); + + CPythonSystem::Instance().GetFrequency(index, frequency_index, &frequency); + return Py_BuildValue("i", frequency); +} + +PyObject * systemGetShadowLevel(PyObject * poSelf, PyObject * poArgs) +{ + return Py_BuildValue("i", CPythonSystem::Instance().GetShadowLevel()); +} + +PyObject * systemSetShadowLevel(PyObject * poSelf, PyObject * poArgs) +{ + int level; + + if (!PyTuple_GetInteger(poArgs, 0, &level)) + return Py_BuildException(); + + if (level > 0) + CPythonSystem::Instance().SetShadowLevel(level); + + return Py_BuildNone(); +} + +void initsystem() +{ + static PyMethodDef s_methods[] = + { + { "GetWidth", systemGetWidth, METH_VARARGS }, + { "GetHeight", systemGetHeight, METH_VARARGS }, + + { "SetInterfaceHandler", systemSetInterfaceHandler, METH_VARARGS }, + { "DestroyInterfaceHandler", systemDestroyInterfaceHandler, METH_VARARGS }, + { "ReserveResource", systemReserveResource, METH_VARARGS }, + + { "isInterfaceConfig", systemisInterfaceConfig, METH_VARARGS }, + { "SaveWindowStatus", systemSaveWindowStatus, METH_VARARGS }, + { "GetWindowStatus", systemGetWindowStatus, METH_VARARGS }, + + { "GetResolutionCount", systemGetResolutionCount, METH_VARARGS }, + { "GetFrequencyCount", systemGetFrequencyCount, METH_VARARGS }, + + { "GetCurrentResolution", systemGetCurrentResolution, METH_VARARGS }, + + { "GetResolution", systemGetResolution, METH_VARARGS }, + { "GetFrequency", systemGetFrequency, METH_VARARGS }, + + { "ApplyConfig", systemApplyConfig, METH_VARARGS }, + { "SetConfig", systemSetConfig, METH_VARARGS }, + { "SaveConfig", systemSaveConfig, METH_VARARGS }, + { "GetConfig", systemGetConfig, METH_VARARGS }, + + { "SetSaveID", systemSetSaveID, METH_VARARGS }, + { "isSaveID", systemisSaveID, METH_VARARGS }, + { "GetSaveID", systemGetSaveID, METH_VARARGS }, + + { "GetMusicVolume", systemGetMusicVolume, METH_VARARGS }, + { "GetSoundVolume", systemGetSoundVolume, METH_VARARGS }, + + { "SetMusicVolume", systemSetMusicVolume, METH_VARARGS }, + { "SetSoundVolumef", systemSetSoundVolumef, METH_VARARGS }, + { "IsSoftwareCursor", systemIsSoftwareCursor, METH_VARARGS }, + + { "SetViewChatFlag", systemSetViewChatFlag, METH_VARARGS }, + { "IsViewChat", systemIsViewChat, METH_VARARGS }, + + { "SetAlwaysShowNameFlag", systemSetAlwaysShowNameFlag, METH_VARARGS }, + { "IsAlwaysShowName", systemIsAlwaysShowName, METH_VARARGS }, + + { "SetShowDamageFlag", systemSetShowDamageFlag, METH_VARARGS }, + { "IsShowDamage", systemIsShowDamage, METH_VARARGS }, + + { "SetShowSalesTextFlag", systemSetShowSalesTextFlag, METH_VARARGS }, + { "IsShowSalesText", systemIsShowSalesText, METH_VARARGS }, + + { "GetShadowLevel", systemGetShadowLevel, METH_VARARGS }, + { "SetShadowLevel", systemSetShadowLevel, METH_VARARGS }, + + { NULL, NULL, NULL } + }; + + PyObject * poModule = Py_InitModule("systemSetting", s_methods); + + PyModule_AddIntConstant(poModule, "WINDOW_STATUS", CPythonSystem::WINDOW_STATUS); + PyModule_AddIntConstant(poModule, "WINDOW_INVENTORY", CPythonSystem::WINDOW_INVENTORY); + PyModule_AddIntConstant(poModule, "WINDOW_ABILITY", CPythonSystem::WINDOW_ABILITY); + PyModule_AddIntConstant(poModule, "WINDOW_SOCIETY", CPythonSystem::WINDOW_SOCIETY); + PyModule_AddIntConstant(poModule, "WINDOW_JOURNAL", CPythonSystem::WINDOW_JOURNAL); + PyModule_AddIntConstant(poModule, "WINDOW_COMMAND", CPythonSystem::WINDOW_COMMAND); + + PyModule_AddIntConstant(poModule, "WINDOW_QUICK", CPythonSystem::WINDOW_QUICK); + PyModule_AddIntConstant(poModule, "WINDOW_GAUGE", CPythonSystem::WINDOW_GAUGE); + PyModule_AddIntConstant(poModule, "WINDOW_MINIMAP", CPythonSystem::WINDOW_MINIMAP); + PyModule_AddIntConstant(poModule, "WINDOW_CHAT", CPythonSystem::WINDOW_CHAT); +} diff --git a/extension/src/port/UserInterface/StdAfx.h b/extension/src/port/UserInterface/StdAfx.h index e45a0b83..d9d313f5 100644 --- a/extension/src/port/UserInterface/StdAfx.h +++ b/extension/src/port/UserInterface/StdAfx.h @@ -50,6 +50,7 @@ void initquest(); void initEvent(); void initeventmgr(); void initapp(); +void initsystem(); void initchr(); void initchrmgr(); void initPlayer(); @@ -62,8 +63,12 @@ void initChat(); void initnet(); void initeffect(); void initfly(); +void initsnd(); void initskill(); void initBackground(); +void initMessenger(); +void initsafebox(); +void initguild(); void initServerStateChecker(); extern const std::string& ApplicationStringTable_GetString(DWORD dwID); diff --git a/extension/src/port/common/D3D8Types.h b/extension/src/port/common/D3D8Types.h index 5e8318fd..1dda1824 100644 --- a/extension/src/port/common/D3D8Types.h +++ b/extension/src/port/common/D3D8Types.h @@ -660,8 +660,16 @@ typedef struct _D3DCAPS8 // COM interfaces: platform/ owns every instance. The resource hierarchy is kept so the implicit // upcasts 40250 relies on (texture -> base texture) compile; of the resources only the buffers carry -// methods (Lock/Unlock, platform/EterLib/CpuBuffer.h). -struct IDirect3D8; +#define D3DENUM_NO_WHQL_LEVEL 0x00000002L + +struct IDirect3D8 +{ + virtual ~IDirect3D8() = default; + virtual HRESULT GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) = 0; + virtual HRESULT GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) = 0; + virtual UINT GetAdapterModeCount(UINT Adapter) = 0; + virtual HRESULT EnumAdapterModes(UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) = 0; +}; typedef enum _D3DRESOURCETYPE { D3DRTYPE_SURFACE = 1, diff --git a/extension/src/port/common/shim/sdk/il/il.h b/extension/src/port/common/shim/sdk/il/il.h index c025fad2..f572ffd5 100644 --- a/extension/src/port/common/shim/sdk/il/il.h +++ b/extension/src/port/common/shim/sdk/il/il.h @@ -1,13 +1,53 @@ #pragma once -// DevIL interface needed by 40250 app.GetImageInfo / MarkImage. -typedef unsigned int ILuint; +// DevIL interface needed by 40250 app.GetImageInfo / MarkImage / GuildMarkUploader. -#define IL_TYPE_UNKNOWN 0 -#define IL_IMAGE_WIDTH 0x0DE4 -#define IL_IMAGE_HEIGHT 0x0DE5 +typedef unsigned int ILenum; +typedef unsigned char ILboolean; +typedef unsigned int ILbitfield; +typedef char ILbyte; +typedef short ILshort; +typedef int ILint; +typedef int ILsizei; +typedef unsigned char ILubyte; +typedef unsigned short ILushort; +typedef unsigned int ILuint; +typedef float ILfloat; +typedef double ILdouble; +typedef void ILvoid; +typedef const char* ILstring; -void ilGenImages(unsigned count, ILuint* images); +#define IL_FALSE 0 +#define IL_TRUE 1 + +#define IL_RGB 0x1907 +#define IL_RGBA 0x1908 +#define IL_BGRA 0x80E1 + +#define IL_BYTE 0x1400 +#define IL_UNSIGNED_BYTE 0x1401 + +#define IL_TYPE_UNKNOWN 0x0000 +#define IL_TGA 0x042D + +#define IL_ORIGIN_SET 0x0600 +#define IL_ORIGIN_UPPER_LEFT 0x0602 + +#define IL_FILE_OVERWRITE 0x0DE3 +#define IL_IMAGE_WIDTH 0x0DE4 +#define IL_IMAGE_HEIGHT 0x0DE5 + +void ilInit(); +void ilShutDown(); +void ilEnable(ILenum mode); +void ilDisable(ILenum mode); +void ilOriginFunc(ILenum mode); +void ilGenImages(ILsizei count, ILuint* images); void ilBindImage(ILuint image); -bool ilLoad(unsigned type, const char* filename); -int ilGetInteger(unsigned property); -void ilDeleteImages(unsigned count, const ILuint* images); +void ilDeleteImages(ILsizei count, const ILuint* images); +bool ilLoad(ILenum type, const ILstring filename); +bool ilSave(ILenum type, const ILstring filename); +int ilGetInteger(ILenum mode); +bool ilConvertImage(ILenum destFormat, ILenum destType); +bool ilTexImage(ILuint width, ILuint height, ILuint depth, ILubyte bpp, ILenum format, ILenum type, void* data); +ILuint ilCopyPixels(ILuint xOff, ILuint yOff, ILuint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data); +void ilSetPixels(ILint xOff, ILint yOff, ILint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data); diff --git a/extension/src/port/common/shim/win32/direct.h b/extension/src/port/common/shim/win32/direct.h index 4239e890..c4132ac6 100644 --- a/extension/src/port/common/shim/win32/direct.h +++ b/extension/src/port/common/shim/win32/direct.h @@ -1,3 +1,8 @@ #pragma once // Shim for on non-Windows targets; what 40250 logic uses from it is in . #include "windows.h" +#ifndef _MSC_VER +#include +#define _getcwd getcwd +#define _chdir chdir +#endif diff --git a/extension/src/port/common/shim/win32/windows.h b/extension/src/port/common/shim/win32/windows.h index eee2f3c5..d9892a37 100644 --- a/extension/src/port/common/shim/win32/windows.h +++ b/extension/src/port/common/shim/win32/windows.h @@ -34,6 +34,15 @@ #define VK_ESCAPE 0x1B #define WM_KEYDOWN 0x0100 #define WM_CHAR 0x0102 +#define SM_CXFULLSCREEN 16 +#define SM_CYFULLSCREEN 17 + +inline int GetSystemMetrics(int nIndex) +{ + if (nIndex == SM_CXFULLSCREEN) return 1920; + if (nIndex == SM_CYFULLSCREEN) return 1080; + return 0; +} // winuser.h functions the platform layer implements (platform/ScriptLib/PythonBoot.cpp). void PostQuitMessage(int nExitCode); diff --git a/extension/src/port/common/shim/win32/windowsx.h b/extension/src/port/common/shim/win32/windowsx.h new file mode 100644 index 00000000..720e64a9 --- /dev/null +++ b/extension/src/port/common/shim/win32/windowsx.h @@ -0,0 +1,2 @@ +#pragma once +#include diff --git a/extension/src/port/common/shim/win32/winsock.h b/extension/src/port/common/shim/win32/winsock.h index 7fbd78c1..bf26ce5d 100644 --- a/extension/src/port/common/shim/win32/winsock.h +++ b/extension/src/port/common/shim/win32/winsock.h @@ -73,3 +73,17 @@ inline int mt_winsock_select(fd_set* readfds, fd_set* writefds, fd_set* exceptfd return ret; } #define select(nfds, readfds, writefds, exceptfds, timeout) mt_winsock_select(readfds, writefds, exceptfds, timeout) + +inline int mt_winsock_recvfrom(SOCKET s, void* buf, size_t len, int flags, struct sockaddr* from, int* fromlen) +{ + socklen_t slen = fromlen ? static_cast(*fromlen) : 0; + ssize_t ret = ::recvfrom(s, buf, len, flags, from, fromlen ? &slen : nullptr); + if (fromlen) + *fromlen = static_cast(slen); + return static_cast(ret); +} +inline int mt_winsock_recvfrom(SOCKET s, void* buf, size_t len, int flags, struct sockaddr* from, socklen_t* fromlen) +{ + return static_cast(::recvfrom(s, buf, len, flags, from, fromlen)); +} +#define recvfrom mt_winsock_recvfrom diff --git a/extension/tests/port_login_flow_server.cpp b/extension/tests/port_login_flow_server.cpp index 187e61e7..babbd75b 100644 --- a/extension/tests/port_login_flow_server.cpp +++ b/extension/tests/port_login_flow_server.cpp @@ -616,6 +616,69 @@ bool FakeLoginServer::ServeGame(Connection& c, int index) elder_update.vid = kQuestVID; if (!c.Send(elder) || !c.Send(elder_info) || !c.Send(elder_update)) return Fail(name + ": send quest NPC"); + GCCharacterAdd storekeeper = keeper; + storekeeper.vid = kSafeboxVID; + storekeeper.x = kSafeboxX; + storekeeper.y = kSafeboxY; + storekeeper.race = kSafeboxRace; + GCCharAddInfo storekeeper_info = zeroed(); + storekeeper_info.header = HDR_GC_CHAR_ADDITIONAL_INFO; + storekeeper_info.vid = kSafeboxVID; + std::strncpy(storekeeper_info.name, "Storekeeper", sizeof(storekeeper_info.name) - 1); + GCCharacterUpdate storekeeper_update = keeper_update; + storekeeper_update.vid = kSafeboxVID; + if (!c.Send(storekeeper) || !c.Send(storekeeper_info) || !c.Send(storekeeper_update)) + return Fail(name + ": send storekeeper NPC"); + + // Messenger (批次 4-f): Send initial friend list + struct + { + GCMessengerHead head; + MessengerListEntry entry; + char name[10]; + } __attribute__((packed)) messenger_pkt = { + {HDR_GC_MESSENGER, static_cast(sizeof(messenger_pkt)), MESSENGER_GC_LIST}, + {1 /* MESSENGER_CONNECTED_STATE_ONLINE */, static_cast(std::strlen(kFriendName))}, + {} + }; + std::memcpy(messenger_pkt.name, kFriendName, sizeof(messenger_pkt.name)); + if (!c.Send(messenger_pkt)) + return Fail(name + ": send messenger list"); + + // Guild (批次 4-f): Send guild name + struct + { + GCMessengerHead head; + GuildName16 item; + } __attribute__((packed)) guild_name_pkt = { + {HDR_GC_GUILD, static_cast(sizeof(guild_name_pkt)), 16 /* GUILD_GC_NAME */}, + {kGuildID, {}} + }; + std::strncpy(guild_name_pkt.item.name, kGuildName, sizeof(guild_name_pkt.item.name)); + if (!c.Send(guild_name_pkt)) + return Fail(name + ": send guild name"); + + // Guild (批次 4-f): Send guild info (enables guild for player) + struct + { + GCMessengerHead head; + GuildInfo35 info; + } __attribute__((packed)) guild_info_pkt = { + {HDR_GC_GUILD, static_cast(sizeof(guild_info_pkt)), 8 /* GUILD_GC_INFO */}, + zeroed() + }; + guild_info_pkt.info.guild_id = kGuildID; + guild_info_pkt.info.master_pid = 1; + guild_info_pkt.info.level = 20; + guild_info_pkt.info.exp = 50000; + guild_info_pkt.info.member_count = 1; + guild_info_pkt.info.max_member_count = 50; + guild_info_pkt.info.gold = 123456; + guild_info_pkt.info.has_land = 1; + std::strncpy(guild_info_pkt.info.name, kGuildName, sizeof(guild_info_pkt.info.name) - 1); + if (!c.Send(guild_info_pkt)) + return Fail(name + ": send guild info"); + Event(name + ":burst_sent"); // A ping after the burst proves that GamePhase consumed every packet above and can reply. @@ -633,6 +696,9 @@ bool FakeLoginServer::ServeGame(Connection& c, int index) std::int32_t gold = kStartGold; std::uint32_t bag0 = 0; // vnum in inventory cell 0 (the fake character starts with an empty bag) int quest_page = 0; // the quest dialogue's last page sent (1 question, 2 next, 3 done) + bool safebox_open = false; + std::uint32_t safebox0 = kSafeboxItemVnum; + std::int32_t safebox_gold = kSafeboxMoney; // CQuestManager::SendScript: packet_script {header, size, skin, src_size} and the script text. auto send_script = [&](const std::string& script) { struct @@ -743,11 +809,44 @@ bool FakeLoginServer::ServeGame(Connection& c, int index) const std::string text(reinterpret_cast(packet + sizeof(head)), strnlen(reinterpret_cast(packet + sizeof(head)), text_len)); Event(name + ":chat " + std::to_string(head.type) + " " + text); - const std::string line = std::string(kCharacterName) + " : " + text; - GCChatHead chat = {HDR_GC_CHAT, static_cast(sizeof(GCChatHead) + line.size() + 1), - 0 /* CHAT_TYPE_TALKING */, kMainVID, 1}; - if (!c.Send(chat) || !c.Send(line.c_str(), line.size() + 1)) - return Fail(name + ": send GC_CHAT"); + if (text.rfind("/safebox_password ", 0) == 0) + { + const std::string pass = text.substr(18); + Event(name + ":safebox_password " + pass); + safebox_open = true; + GCSafeboxSize size_pkt = {HDR_GC_SAFEBOX_SIZE, FakeLoginServer::kSafeboxSize}; + GCSafeboxMoneyChange money_pkt = {HDR_GC_SAFEBOX_MONEY_CHANGE, safebox_gold}; + if (!c.Send(size_pkt) || !c.Send(money_pkt)) + return Fail(name + ": send GC_SAFEBOX_SIZE / MONEY"); + if (safebox0 != 0) + { + GCItemSet set = zeroed(); + set.header = HDR_GC_SAFEBOX_SET; + set.cell = {3 /* SAFEBOX */, 0}; + set.vnum = safebox0; + set.count = 1; + if (!c.Send(set)) + return Fail(name + ": send GC_SAFEBOX_SET"); + } + } + else if (text == "/safebox_close") + { + Event(name + ":safebox_close"); + safebox_open = false; + const std::string cmd = "CloseSafebox"; + GCChatHead chat = {HDR_GC_CHAT, static_cast(sizeof(GCChatHead) + cmd.size() + 1), + 5 /* CHAT_TYPE_COMMAND */, 0, 1}; + if (!c.Send(chat) || !c.Send(cmd.c_str(), cmd.size() + 1)) + return Fail(name + ": send CloseSafebox"); + } + else + { + const std::string line = std::string(kCharacterName) + " : " + text; + GCChatHead chat = {HDR_GC_CHAT, static_cast(sizeof(GCChatHead) + line.size() + 1), + 0 /* CHAT_TYPE_TALKING */, kMainVID, 1}; + if (!c.Send(chat) || !c.Send(line.c_str(), line.size() + 1)) + return Fail(name + ": send GC_CHAT"); + } } // CInputMain::Target → CHARACTER::SetTarget → BroadcastTargetPacket: GC_TARGET with the monster's HP percent. if (header == HDR_CG_TARGET) @@ -786,6 +885,14 @@ bool FakeLoginServer::ServeGame(Connection& c, int index) CGOnClick click; std::memcpy(&click, packet, sizeof(click)); Event(name + ":click " + std::to_string(click.vid)); + if (click.vid == kSafeboxVID) + { + const std::string cmd = "ShowMeSafeboxPassword"; + GCChatHead chat = {HDR_GC_CHAT, static_cast(sizeof(GCChatHead) + cmd.size() + 1), + 5 /* CHAT_TYPE_COMMAND */, 0, 1}; + if (!c.Send(chat) || !c.Send(cmd.c_str(), cmd.size() + 1)) + return Fail(name + ": send ShowMeSafeboxPassword"); + } // CHARACTER::OnClick → CQuestManager::Click: say(...) then select("Yes", "No") → GotoSelectState. if (click.vid == kQuestVID && !send_script("Greetings, young warrior.[ENTER]Shall I tell you a story?[ENTER][QUESTION 1;Yes|2;No]")) return Fail(name + ": send GC_SCRIPT question"); @@ -881,6 +988,46 @@ bool FakeLoginServer::ServeGame(Connection& c, int index) if (!ok) return Fail(name + ": send shop reply"); } + if (header == HDR_CG_SAFEBOX_CHECKIN) + { + CGSafeboxCheckin in; + std::memcpy(&in, packet, sizeof(in)); + Event(name + ":safebox_checkin " + std::to_string(in.item_pos.cell) + " -> " + std::to_string(in.safe_pos)); + if (in.item_pos.cell == 0 && in.safe_pos == 0 && bag0 != 0) + { + safebox0 = bag0; + bag0 = 0; + GCItemDelDeprecated del = zeroed(); + del.header = HDR_GC_ITEM_DEL; + del.cell = {1, 0}; + GCItemSet set = zeroed(); + set.header = HDR_GC_SAFEBOX_SET; + set.cell = {3 /* SAFEBOX */, 0}; + set.vnum = safebox0; + set.count = 1; + if (!c.Send(del) || !c.Send(set)) + return Fail(name + ": send safebox checkin replies"); + } + } + if (header == HDR_CG_SAFEBOX_CHECKOUT) + { + CGSafeboxCheckout out; + std::memcpy(&out, packet, sizeof(out)); + Event(name + ":safebox_checkout " + std::to_string(out.safe_pos) + " -> " + std::to_string(out.item_pos.cell)); + if (out.safe_pos == 0 && out.item_pos.cell == 0 && safebox0 != 0) + { + bag0 = safebox0; + safebox0 = 0; + GCItemDel del = {HDR_GC_SAFEBOX_DEL, 0}; + GCItemSet set = zeroed(); + set.header = HDR_GC_ITEM_SET; + set.cell = {1, 0}; + set.vnum = bag0; + set.count = 1; + if (!c.Send(del) || !c.Send(set)) + return Fail(name + ": send safebox checkout replies"); + } + } if (header == HDR_CG_MOVE) { CGMove move; diff --git a/extension/tests/port_login_flow_server.h b/extension/tests/port_login_flow_server.h index 2a16b59e..9185e818 100644 --- a/extension/tests/port_login_flow_server.h +++ b/extension/tests/port_login_flow_server.h @@ -37,10 +37,21 @@ public: static constexpr std::int32_t kShopX = kMobX + 400, kShopY = kMobY; static constexpr std::uint32_t kShopItemVnum = 27001, kShopItemPrice = 50; static constexpr std::int32_t kStartGold = 10000, kShopSellPrice = 9; - // An old man (npclist 20009) 3 m east of the store whose click runs a quest dialogue the way CQuestManager + // An old man (npclist 20009) 0.5 m east of the store whose click runs a quest dialogue the way CQuestManager // sends it: say + select ([QUESTION]), then a [NEXT] page, then a [DONE] page. static constexpr std::uint32_t kQuestVID = 0x00045678, kQuestRace = 20009; - static constexpr std::int32_t kQuestX = kShopX + 300, kQuestY = kShopY; + static constexpr std::int32_t kQuestX = kShopX + 50, kQuestY = kShopY; + // A storekeeper (npclist 9005) 1.5 m west of the shop whose click runs ShowMeSafeboxPassword, + // receives /safebox_password, opens safebox, handles checkin/checkout and close. + static constexpr std::uint32_t kSafeboxVID = 0x00056789, kSafeboxRace = 9005; + static constexpr std::int32_t kSafeboxX = kShopX - 150, kSafeboxY = kShopY; + static constexpr std::uint8_t kSafeboxSize = 9; + static constexpr std::uint32_t kSafeboxItemVnum = 10; + static constexpr std::int32_t kSafeboxMoney = 500; + // Messenger & Guild constants (批次 4-f) + static constexpr const char* kFriendName = "TestFriend"; + static constexpr std::uint32_t kGuildID = 1; + static constexpr const char* kGuildName = "TestGuild"; ~FakeLoginServer(); diff --git a/extension/tests/port_login_flow_test.cpp b/extension/tests/port_login_flow_test.cpp index 3f9cc3a2..30f33a36 100644 --- a/extension/tests/port_login_flow_test.cpp +++ b/extension/tests/port_login_flow_test.cpp @@ -57,6 +57,11 @@ #include "UserInterface/PythonCharacterManager.h" #include "UserInterface/InstanceBase.h" #include "UserInterface/PythonBackground.h" +#include "UserInterface/PythonMessenger.h" +#include "UserInterface/PythonGuild.h" +#include "UserInterface/MarkManager.h" +#include "UserInterface/PythonSystem.h" +#include "MilesLib/SoundManager.h" #include "EterGrnLib/StdAfx.h" #include "EterGrnLib/LODController.h" #include "EterGrnLib/ModelInstance.h" @@ -597,7 +602,7 @@ int main(int argc, char** argv) }; std::printf("port_login_flow_test: %s\n", tail_info().c_str()); CHECK(tail_info().find("ItemTail (Map 1,") != std::string::npos); - CHECK(tail_info().find("ChrTail (Map 3,") != std::string::npos); // the actor, the stray dog and the shopkeeper + CHECK(tail_info().find("ChrTail (Map 5,") != std::string::npos); // the actor, the stray dog, the shopkeeper, the quest elder and the storekeeper // Holding ALT (game.GameWindow.ShowName) makes OnRender show every tail in range and project it after // app.RenderGame; the item tail keeps that screen rect, which is what textTail.Pick tests. PythonBoot::UIKey(DIK_LMENU, true); @@ -813,6 +818,357 @@ int main(int argc, char** argv) CHECK(pump_until(2, [] { return py_true("not __import__('shop').IsOpen() and not _stream.curPhaseWindow.interface.dlgShop.IsShow()"); })); } } + + // Quest dialogue (CPythonEventManager + CPythonQuest + event module): clicking the quest NPC (kQuestVID) + // triggers CHARACTER::OnClick → CQuestManager::Click which sends GC_SCRIPT. The client parses the script + // through CPythonEventManager / parser.cpp and opens uiQuest.QuestDialog. + // 1. Initial page: say + select ([QUESTION 1;Yes|2;No]). + // Clicking "Yes" (answer 0) sends CG_SCRIPT_ANSWER 0. + // 2. Second page: say + [NEXT]. + // Clicking Next sends CG_SCRIPT_ANSWER 254 (> 250). + // 3. Final page: say + [DONE]. + // Clicking OK closes the dialogue. + if (server) + { + py("if _stream.curPhaseWindow.interface.wndInventory.IsShow(): _stream.curPhaseWindow.interface.wndInventory.Hide()"); + CInstanceBase* elder = CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kQuestVID); + CHECK(elder != nullptr); + if (elder) + { + auto elder_on_screen = [&] { + UI::CWindowManager& wm = UI::CWindowManager::Instance(); + D3DXMATRIX proj, identity; + D3DXMatrixPerspectiveFovRH(&proj, D3DXToRadian(30.0f), wm.GetAspect(), 100.0f, + CPythonBackground::Instance().GetFarClip()); + D3DXMatrixIdentity(&identity); + D3DVIEWPORT8 viewport = {0, 0, (DWORD) wm.GetScreenWidth(), (DWORD) wm.GetScreenHeight(), 0.0f, 1.0f}; + const D3DXVECTOR3 body = elder->GetGraphicThingInstanceRef().GetPosition() + D3DXVECTOR3(0.0f, 0.0f, 100.0f); + D3DXVECTOR3 screen; + D3DXVec3Project(&screen, &body, &viewport, &proj, + &CCameraManager::Instance().GetCurrentCamera()->GetViewMatrix(), &identity); + return std::make_pair((int) screen.x, (int) screen.y); + }; + // CPythonPlayer::__SendClickActorPacket enforces a 1000ms TCP rate-limit between NPC clicks + pump_until(1.0, [] { return false; }); + auto [ex, ey] = elder_on_screen(); + std::printf("port_login_flow_test: quest elder on screen at %d %d\n", ex, ey); + auto click_elder = [&] { + std::tie(ex, ey) = elder_on_screen(); + PythonBoot::UIMouseMove(ex, ey); + pump_until(0.05, [] { return false; }); + PythonBoot::UIMouseButton(1, true, ex, ey); + pump_until(0.05, [] { return false; }); + PythonBoot::UIMouseButton(1, false, ex, ey); + }; + click_elder(); + CHECK(pump_until(5, [&] { + if (server->Has("game2:click " + std::to_string(FakeLoginServer::kQuestVID))) + return true; + click_elder(); + return false; + })); + CHECK(pump_until(2, [] { + return py_true("len(_stream.curPhaseWindow.interface.wndQuestWindow) > 0 and " + "list(_stream.curPhaseWindow.interface.wndQuestWindow.values())[-1].btnAnswer is not None and " + "len(list(_stream.curPhaseWindow.interface.wndQuestWindow.values())[-1].btnAnswer) >= 2"); + })); + auto press_enter = [] { + PythonBoot::UIKey(DIK_RETURN, true); + pump_until(0.05, [] { return false; }); + PythonBoot::UIKey(DIK_RETURN, false); + pump_until(0.05, [] { return false; }); + }; + // Page 1: DIK_RETURN triggers focusBtn.CallEvent() for choice 0 ("Yes"). + press_enter(); + CHECK(pump_until(2, [&] { return server->Has("game2:answer 0"); })); + + // Page 2: [NEXT] + CHECK(pump_until(2, [] { + return py_true("len(_stream.curPhaseWindow.interface.wndQuestWindow) > 0 and " + "list(_stream.curPhaseWindow.interface.wndQuestWindow.values())[-1].btnNext is not None"); + })); + // Page 2: DIK_RETURN on Next button triggers OnPressEscapeKey() which selects 254 and closes. + press_enter(); + CHECK(pump_until(2, [&] { return server->Has("game2:answer 254"); })); + + // Page 3: [DONE] + CHECK(pump_until(2, [] { + return py_true("len(_stream.curPhaseWindow.interface.wndQuestWindow) > 0 and " + "list(_stream.curPhaseWindow.interface.wndQuestWindow.values())[-1].btnNext is not None and " + "getattr(list(_stream.curPhaseWindow.interface.wndQuestWindow.values())[-1], 'nextButtonType', None) == 1"); + })); + // Page 3: DIK_RETURN on Done button closes the dialogue without further packets. + press_enter(); + CHECK(pump_until(2, [] { + return py_true("len(_stream.curPhaseWindow.interface.wndQuestWindow) == 0"); + })); + } + } + + // Safebox (CPythonSafeBox + safebox module): clicking the storekeeper (kSafeboxVID) + // triggers CHARACTER::OnClick → ShowMeSafeboxPassword server command. The client opens + // PasswordDialog. Typing the password sends /safebox_password , opening SafeboxWindow. + // We verify: + // 1. Click Storekeeper, receive password dialog. + // 2. Press DIK_RETURN to submit password, server answers GC_SAFEBOX_SIZE (1 page = 45 slots), + // GC_SAFEBOX_MONEY_CHANGE (500) and initial item (kSafeboxItemVnum = 10 in slot 0). + // 3. Verify SafeboxWindow is open, safebox.GetCurrentSafeboxSize() == 45, safebox.GetItemID(0) == 10. + // 4. Checkout: drag safebox slot 0 to inventory slot 0. + // Server answers GC_SAFEBOX_DEL 0 and GC_ITEM_SET (inventory cell 0 = 10). + // Verify safebox slot 0 is empty (0) and player inventory slot 0 has 10. + // 5. Checkin: drag inventory slot 0 to safebox slot 0. + // Server answers GC_ITEM_DEL (inventory cell 0) and GC_SAFEBOX_SET (safebox cell 0 = 10). + // Verify player inventory slot 0 is empty (0) and safebox slot 0 has 10. + // 6. Close safebox via ESC: client sends /safebox_close, server replies CloseSafebox, + // SafeboxWindow closes. + if (server) + { + CInstanceBase* storekeeper = CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kSafeboxVID); + CHECK(storekeeper != nullptr); + if (storekeeper) + { + auto storekeeper_on_screen = [&] { + UI::CWindowManager& wm = UI::CWindowManager::Instance(); + D3DXMATRIX proj, identity; + D3DXMatrixPerspectiveFovRH(&proj, D3DXToRadian(30.0f), wm.GetAspect(), 100.0f, + CPythonBackground::Instance().GetFarClip()); + D3DXMatrixIdentity(&identity); + D3DVIEWPORT8 viewport = {0, 0, (DWORD) wm.GetScreenWidth(), (DWORD) wm.GetScreenHeight(), 0.0f, 1.0f}; + const D3DXVECTOR3 body = storekeeper->GetGraphicThingInstanceRef().GetPosition() + D3DXVECTOR3(0.0f, 0.0f, 100.0f); + D3DXVECTOR3 screen; + D3DXVec3Project(&screen, &body, &viewport, &proj, + &CCameraManager::Instance().GetCurrentCamera()->GetViewMatrix(), &identity); + return std::make_pair((int) screen.x, (int) screen.y); + }; + auto [sx, sy] = storekeeper_on_screen(); + std::printf("port_login_flow_test: storekeeper on screen at %d %d\n", sx, sy); + PythonBoot::UIMouseMove(sx, sy); + pump_until(0.1, [] { return false; }); + PythonBoot::UIMouseButton(1, true, sx, sy); + pump_until(0.1, [] { return false; }); + PythonBoot::UIMouseButton(1, false, sx, sy); + CHECK(pump_until(5, [&] { return server->Has("game2:click " + std::to_string(FakeLoginServer::kSafeboxVID)); })); + CHECK(pump_until(2, [] { + return py_true("_stream.curPhaseWindow.interface.dlgPassword.IsShow()"); + })); + // Submit password dialog with VK_RETURN (IME return on focused edit line) + PythonBoot::UIChar(VK_RETURN); + CHECK(pump_until(2, [&] { return server->Has("game2:safebox_password "); })); + CHECK(pump_until(2, [] { + return py_true("_stream.curPhaseWindow.interface.wndSafebox.IsShow()"); + })); + CHECK(pump_until(2, [] { + return py_true(("__import__('safebox').GetCurrentSafeboxSize() == 45 and " + "__import__('safebox').GetItemID(0) == " + std::to_string(FakeLoginServer::kSafeboxItemVnum) + " and " + "__import__('safebox').GetMoney() == " + std::to_string(FakeLoginServer::kSafeboxMoney)).c_str()); + })); + + // Ensure inventory is visible for slot drag-and-drop + py("_stream.curPhaseWindow.interface.wndInventory.Show()"); + CHECK(pump_until(2, [] { + return py_true("_stream.curPhaseWindow.interface.wndInventory.IsShow()"); + })); + + auto slot0 = [](const char* grid) { + std::string xy; + CHECK(PythonBoot::Evaluate((std::string("'%d %d' % _stream.curPhaseWindow.interface.") + grid + ".GetGlobalPosition()").c_str(), &xy, nullptr)); + int x = 0, y = 0; + std::sscanf(xy.c_str(), "%d %d", &x, &y); + return std::make_pair(x + 16, y + 16); + }; + auto click = [](int btn, std::pair pos) { + PythonBoot::UIMouseMove(pos.first, pos.second); + pump_until(0.05, [] { return false; }); + PythonBoot::UIMouseButton(btn, true, pos.first, pos.second); + pump_until(0.05, [] { return false; }); + PythonBoot::UIMouseButton(btn, false, pos.first, pos.second); + pump_until(0.05, [] { return false; }); + }; + + const auto safe0 = slot0("wndSafebox.wndItem"); + const auto bag0 = slot0("wndInventory.wndItem"); + std::printf("port_login_flow_test: safebox slot 0 at %d %d, bag slot 0 at %d %d\n", safe0.first, safe0.second, bag0.first, bag0.second); + + // Checkout: drag from safebox slot 0 to inventory slot 0 + click(1, safe0); + CHECK(py_true("__import__('mouseModule').mouseController.isAttached()")); + click(1, bag0); + CHECK(pump_until(2, [&] { return server->Has("game2:safebox_checkout 0 -> 0"); })); + CHECK(pump_until(2, [&] { + return py_true(("__import__('safebox').GetItemID(0) == 0 and " + "__import__('player').GetItemIndex(0) == " + std::to_string(FakeLoginServer::kSafeboxItemVnum)).c_str()); + })); + + // Checkin: drag from inventory slot 0 back to safebox slot 0 + click(1, bag0); + CHECK(py_true("__import__('mouseModule').mouseController.isAttached()")); + click(1, safe0); + CHECK(pump_until(2, [&] { return server->Has("game2:safebox_checkin 0 -> 0"); })); + CHECK(pump_until(2, [&] { + return py_true(("__import__('player').GetItemIndex(0) == 0 and " + "__import__('safebox').GetItemID(0) == " + std::to_string(FakeLoginServer::kSafeboxItemVnum)).c_str()); + })); + + // Close Safebox via ESC + PythonBoot::UIKey(DIK_ESCAPE, true); + pump_until(0.05, [] { return false; }); + PythonBoot::UIKey(DIK_ESCAPE, false); + pump_until(0.05, [] { return false; }); + CHECK(pump_until(2, [&] { return server->Has("game2:safebox_close"); })); + CHECK(pump_until(2, [] { + return py_true("not _stream.curPhaseWindow.interface.wndSafebox.IsShow()"); + })); + } + } + + // 13. (批次 4-f) Messenger / Guild / GuildMark: + // The fake server sent friend list ("TestFriend") and guild info/name ("TestGuild", ID 1) + // during the entergame burst. + // Verify: + // - CPythonMessenger / messenger module: IsFriendByName, RemoveFriend + // - CPythonGuild / guild module: IsGuildEnable, GetGuildID, GetGuildName, GetGuildMoney, HasGuildLand + // - CGuildMarkManager: AddMarkIDByGuildID, GetMarkID, GuildIDToMarkID, GetMarkIndexByMarkID + if (server) + { + CHECK(py("import messenger, guild")); + + // Messenger + CHECK(CPythonMessenger::Instance().IsFriendByName(FakeLoginServer::kFriendName)); + CHECK(py_true("messenger.IsFriendByName('TestFriend') == 1")); + CHECK(py_true("messenger.IsFriendByName('NonExistent') == 0")); + + // Guild + CHECK(CPythonGuild::Instance().IsGuildEnable()); + CHECK(CPythonGuild::Instance().GetGuildID() == FakeLoginServer::kGuildID); + std::string guild_name; + CHECK(CPythonGuild::Instance().GetGuildName(FakeLoginServer::kGuildID, &guild_name) && guild_name == FakeLoginServer::kGuildName); + CHECK(py_true("guild.IsGuildEnable() == 1")); + CHECK(py_true("guild.GetGuildID() == 1")); + CHECK(py_true("guild.GetGuildName() == 'TestGuild'")); + CHECK(py_true("guild.GetGuildName(1) == 'TestGuild'")); + CHECK(py_true("guild.GetGuildMoney() == 123456")); + CHECK(py_true("guild.HasGuildLand() == 1")); + + // GuildMark + CGuildMarkManager::Instance().AddMarkIDByGuildID(FakeLoginServer::kGuildID, 42); + CHECK(CGuildMarkManager::Instance().GetMarkID(FakeLoginServer::kGuildID) == 42); + CHECK(py_true("guild.GuildIDToMarkID(1) == 42")); + CHECK(py_true("guild.GetMarkIndexByMarkID(42) == 42")); + + // Messenger RemoveFriend + CHECK(py("import messenger\nmessenger.RemoveFriend('TestFriend')")); + CHECK(!CPythonMessenger::Instance().IsFriendByName(FakeLoginServer::kFriendName)); + CHECK(py_true("messenger.IsFriendByName('TestFriend') == 0")); + } + + // 14. (批次 4-g) System Settings & Combat Damage Floating Text (CPythonSystem / systemSetting): + // Verify: + // - systemSetting module imported cleanly without __port_stub__ + // - CPythonSystem resolution enumeration (via CDummyDirect3D8): GetResolutionCount, GetResolution + // - Width, Height, BPP + // - Combat floating damage flag: IsShowDamage, SetShowDamageFlag, CPythonSystem::Instance().IsShowDamage() + // - Other system setting flags: IsViewChat, SetViewChatFlag, IsAlwaysShowName, SetAlwaysShowNameFlag, IsShowSalesText, SetShowSalesTextFlag + // - Music/Sound volume: GetMusicVolume, SetMusicVolume, GetSoundVolume, SetSoundVolumef + // - Config save & load: GetConfig, SaveConfig + { + CHECK(py("import systemSetting")); + CHECK(py_true("not hasattr(systemSetting, '__port_stub__')")); + + // Resolution enumeration & screen size + CHECK(CPythonSystem::Instance().GetResolutionCount() > 0); + CHECK(py_true("systemSetting.GetResolutionCount() > 0")); + CHECK(py_true("systemSetting.GetWidth() > 0 and systemSetting.GetHeight() > 0")); + CHECK(py_true("len(systemSetting.GetResolution(0)) == 3")); + + // Combat damage text flag + CPythonSystem::Instance().SetShowDamageFlag(true); + CHECK(CPythonSystem::Instance().IsShowDamage()); + CHECK(py_true("systemSetting.IsShowDamage() == 1")); + + CHECK(py("systemSetting.SetShowDamageFlag(0)")); + CHECK(!CPythonSystem::Instance().IsShowDamage()); + CHECK(py_true("systemSetting.IsShowDamage() == 0")); + + CHECK(py("systemSetting.SetShowDamageFlag(1)")); + CHECK(CPythonSystem::Instance().IsShowDamage()); + CHECK(py_true("systemSetting.IsShowDamage() == 1")); + + // Chat view flag + CHECK(py("systemSetting.SetViewChatFlag(0)")); + CHECK(!CPythonSystem::Instance().IsViewChat()); + CHECK(py_true("systemSetting.IsViewChat() == 0")); + CHECK(py("systemSetting.SetViewChatFlag(1)")); + CHECK(CPythonSystem::Instance().IsViewChat()); + CHECK(py_true("systemSetting.IsViewChat() == 1")); + + // Always show name flag + CHECK(py("systemSetting.SetAlwaysShowNameFlag(0)")); + CHECK(!CPythonSystem::Instance().IsAlwaysShowName()); + CHECK(py_true("systemSetting.IsAlwaysShowName() == 0")); + CHECK(py("systemSetting.SetAlwaysShowNameFlag(1)")); + CHECK(CPythonSystem::Instance().IsAlwaysShowName()); + CHECK(py_true("systemSetting.IsAlwaysShowName() == 1")); + + // Sales text flag + CHECK(py("systemSetting.SetShowSalesTextFlag(0)")); + CHECK(!CPythonSystem::Instance().IsShowSalesText()); + CHECK(py_true("systemSetting.IsShowSalesText() == 0")); + CHECK(py("systemSetting.SetShowSalesTextFlag(1)")); + CHECK(CPythonSystem::Instance().IsShowSalesText()); + CHECK(py_true("systemSetting.IsShowSalesText() == 1")); + + // Sound & music volume + CHECK(py("systemSetting.SetMusicVolume(0.5)")); + CHECK(CPythonSystem::Instance().GetMusicVolume() == 0.5f); + CHECK(py_true("abs(systemSetting.GetMusicVolume() - 0.5) < 0.01")); + + CHECK(py("systemSetting.SetSoundVolumef(0.8)")); + CHECK(py_true("systemSetting.GetSoundVolume() >= 0")); + + // Config tuple: (res_index, freq_index, is_software_cursor, shadow_level, view_chat, always_show_name, show_damage, show_sales_text) + CHECK(py_true("len(systemSetting.GetConfig()) == 8")); + CHECK(py_true("systemSetting.SaveConfig() == 1")); + unlink("metin2.cfg"); + } + + // 15. Verify audio & sound manager module (PythonSoundManagerModule / snd) + // - Module existence and no stub flag: import snd; not hasattr(snd, '__port_stub__') + // - Music volume controls: SetMusicVolume, SetMusicVolumef + // - Sound volume controls: SetSoundVolume, SetSoundVolumef + // - Scale controls: SetSoundScale, SetAmbienceSoundScale + // - Sound playback calls: PlaySound, PlaySound3D, StopAllSound + // - Music playback and fading: PlayMusic, FadeInMusic, FadeLimitOutMusic, FadeOutMusic, FadeOutAllMusic + // - CSoundManager C++ singleton state reflection + { + CHECK(py("import snd")); + CHECK(py_true("not hasattr(snd, '__port_stub__')")); + + // Music volume + CHECK(py("snd.SetMusicVolume(0.7)")); + CHECK(py("snd.SetMusicVolumef(0.7)")); + CHECK(std::abs(CSoundManager::Instance().GetMusicVolume() - 0.7f) < 0.05f); + + // Sound volume + CHECK(py("snd.SetSoundVolume(3)")); + CHECK(py("snd.SetSoundVolumef(0.6)")); + CHECK(CSoundManager::Instance().GetSoundVolume() > 0.0f); + + // Scales + CHECK(py("snd.SetSoundScale(250.0)")); + CHECK(CSoundManager::Instance().GetSoundScale() == 250.0f); + CHECK(py("snd.SetAmbienceSoundScale(1500.0)")); + + // Playback APIs execute cleanly + CHECK(py("snd.PlaySound('sound/ui/click.wav')")); + CHECK(py("snd.PlaySound3D(100.0, 200.0, 0.0, 'sound/ui/click.wav')")); + CHECK(py("snd.PlayMusic('BGM/login_window.mp3')")); + CHECK(py("snd.FadeInMusic('BGM/login_window.mp3')")); + CHECK(py("snd.FadeLimitOutMusic('BGM/login_window.mp3', 0.2)")); + CHECK(py("snd.FadeOutMusic('BGM/login_window.mp3')")); + CHECK(py("snd.FadeOutAllMusic()")); + CHECK(py("snd.StopAllSound()")); + } + if (server) { const std::vector expected = { @@ -833,7 +1189,8 @@ int main(int argc, char** argv) e.find(":pickup ") == std::string::npos && e.find(":exchange ") == std::string::npos && e.find(":chat ") == std::string::npos && e.find(":target ") == std::string::npos && e.find(":attack ") == std::string::npos && - e.find(":click ") == std::string::npos && e.find(":shop ") == std::string::npos) + e.find(":click ") == std::string::npos && e.find(":shop ") == std::string::npos && + e.find(":answer ") == std::string::npos && e.find(":safebox_") == std::string::npos) got.push_back(e); CHECK(want == got); } diff --git a/project/bin/mtgodot.gdextension b/project/bin/mtgodot.gdextension index 03007374..b5b3f084 100644 --- a/project/bin/mtgodot.gdextension +++ b/project/bin/mtgodot.gdextension @@ -8,6 +8,8 @@ reloadable = true macos.debug = "res://bin/libmtgodot.macos.template_debug.dylib" macos.release = "res://bin/libmtgodot.macos.template_release.dylib" +macos.editor = "res://bin/libmtgodot.macos.template_debug.dylib" +macos.editor.arm64 = "res://bin/libmtgodot.macos.template_debug.dylib" ios.debug = "res://bin/libmtgodot.ios.template_debug.a" ios.release = "res://bin/libmtgodot.ios.template_release.a" diff --git a/project/client_main.gd b/project/client_main.gd index 99954e66..2440e9e6 100644 --- a/project/client_main.gd +++ b/project/client_main.gd @@ -1,25 +1,19 @@ # client_main —— 打包客户端的入口场景根(main_scene = res://client_main.tscn)。 # -# 默认走 port 路由(PORT-PLAN §2 总开关):40250 system.py 在内嵌解释器里跑,界面画在 +# 走 40250 原生 port 路径:40250 system.py 在内嵌解释器里跑,界面画在 # python_ui_surface.gd、RenderGame 的 3D 绘制画在 python_3d_surface.gd。 -# MT_PORT_PATH=legacy 回到旧的 GDScript AppFlow(登录 → 选人 → 进游戏 串场控制器); -# MT_TEST_MODE=smoke/playable 是 AppFlow 的真服测试,固定走 legacy。 -# 资源目录由 AssetRoot 决定:默认 res://../assets(开发树),打包后设环境变量 -# MT_ASSETS 指向真实资源目录即可(见 project/asset_root.gd)。 +# 方向键/鼠标点地走动走 40250 原路径(2V3);app.Exit() 退出进程。 +# 资源目录由 AssetRoot 决定:40250 Client/pack 资源包。 extends Node -const AppFlow = preload("res://app_flow.gd") -const LiveSmokeTest = preload("res://live_smoke_test.gd") const PackageRenderTest = preload("res://package_render_test.gd") -const PlayableLiveTest = preload("res://playable_live_test.gd") const ForestMapRenderTest = preload("res://forest_map_render_test.gd") -const NetTrace = preload("res://net_trace.gd") func _ready() -> void: if OS.get_environment("MT_TEST_MODE") == "particle_exit": add_child(preload("res://particle_exit_test.gd").new()) return - # MT_TEST_MODE=render:包内离线渲染自检,不起 AppFlow、不连服务器。 + # MT_TEST_MODE=render:包内离线渲染自检,不起 CPythonApplication、不连服务器。 # 导出模板不接受 --script,这是导出包里唯一能跑离线渲染回归的入口。 if OS.get_environment("MT_TEST_MODE") == "render": AssetPack.ensure() @@ -43,30 +37,22 @@ func _ready() -> void: forest.name = "ForestMapRenderTest" add_child(forest) return - # port 路由:40250 system.py 的界面直接画在 Godot Canvas 上(PORT-PLAN 2V0-f), + + # 原生 port 路径:40250 system.py 的界面直接画在 Godot Canvas 上(PORT-PLAN 2V0-f), # Logo → 登录 → 选人 → 进游戏,RenderGame 的 3D 绘制由 python_3d_surface.gd 画出(2V2-e), # 方向键/鼠标点地走动走 40250 原路径(2V3);app.Exit() 退出进程。 - # MT_TEST_MODE=python_ui 是切换默认值之前的入口,保留为 MT_PORT_PATH=port 的别名。 - var mode := OS.get_environment("MT_TEST_MODE") - var route := OS.get_environment("MT_PORT_PATH") - if mode == "python_ui": - route = "port" - elif mode == "smoke" or mode == "playable": - route = "legacy" - if route != "legacy": - if route != "" and route != "port": - push_warning("[client] 未知的 MT_PORT_PATH=%s,按 port 处理" % route) - if _start_port_route(route != ""): - return - _start_legacy_route() + if OS.has_environment("MT_PORT_PATH") and OS.get_environment("MT_PORT_PATH") == "legacy": + push_warning("[client] MT_PORT_PATH=legacy 已废弃并移除,40250 原生 port 路径已接管主循环") -# Returns false when the port route cannot start and the default (unset MT_PORT_PATH) should fall -# back to legacy; an explicit MT_PORT_PATH=port quits with the error instead. -func _start_port_route(explicit: bool) -> bool: + _start_port_route() + +# 启动 40250 原生 port 路径 +func _start_port_route() -> void: AssetPack.ensure() - if not explicit and not (ClassDB.class_exists("Metin2PythonHost") and AssetRoot.pack_ready()): - push_warning("[client] port 路由缺 Metin2PythonHost 或 40250 Client/pack(%s),退回 legacy AppFlow" % AssetRoot.client_path()) - return false + if not (ClassDB.class_exists("Metin2PythonHost") and AssetRoot.pack_ready()): + printerr("[client] port 路由缺少 Metin2PythonHost 或 40250 Client/pack(%s)" % AssetRoot.client_path()) + get_tree().quit(1) + return var surface: Control = preload("res://python_ui_surface.gd").new() surface.name = "PythonUISurface" add_child(surface) @@ -79,36 +65,3 @@ func _start_port_route(explicit: bool) -> bool: if err != "": printerr("port: " + err) get_tree().quit(1) - return true - -func _start_legacy_route() -> void: - # 打包 app 从 Finder/open 启动时没有 shell 环境;40250 服务器使用 classic - # DH2/CTR 协议,因此默认固定到 classic,同时保留 MT_PROTOCOL 覆盖能力。 - if OS.get_environment("MT_PROTOCOL").is_empty(): - OS.set_environment("MT_PROTOCOL", "classic") - # 移动端:APK/IPA 里没有资源 —— 挂载外部的 assets.zip(adb push / ios-deploy 上传)。 - AssetPack.ensure() - var root := AssetRoot.path() - if not AssetRoot.available(): - push_warning("[client] 资源目录不存在:%s —— MT_ASSETS 环境变量 / assets.zip(adb push 到 files/)" % root) - var af := AppFlow.new() - af.name = "AppFlow" - add_child(af) - af.start(root) - # 主角 vid 生命周期取证(见 net_trace.gd):排在 AppFlow 之后,保证每帧 - # 在 client 派发完信号之后再读 main_vid。 - if af.client != null: - var trace := NetTrace.new() - trace.name = "NetTrace" - add_child(trace) - trace.setup(af.client) - if OS.get_environment("MT_TEST_MODE") == "smoke": - var smoke := LiveSmokeTest.new() - smoke.name = "LiveSmokeTest" - add_child(smoke) - smoke.setup(af, af.client) - if OS.get_environment("MT_TEST_MODE") == "playable": - var playable := PlayableLiveTest.new() - playable.name = "PlayableLiveTest" - add_child(playable) - playable.setup(af, af.client) diff --git a/project/python_3d_surface.gd.uid b/project/python_3d_surface.gd.uid new file mode 100644 index 00000000..52f974ef --- /dev/null +++ b/project/python_3d_surface.gd.uid @@ -0,0 +1 @@ +uid://07xdrb10ur7c diff --git a/project/python_game_render_test.gd.uid b/project/python_game_render_test.gd.uid new file mode 100644 index 00000000..5f0c8cd2 --- /dev/null +++ b/project/python_game_render_test.gd.uid @@ -0,0 +1 @@ +uid://g37mwhmliwc5 diff --git a/project/python_host_check.gd.uid b/project/python_host_check.gd.uid new file mode 100644 index 00000000..eb64579a --- /dev/null +++ b/project/python_host_check.gd.uid @@ -0,0 +1 @@ +uid://chhb21kpt72wc diff --git a/project/python_host_test.gd.uid b/project/python_host_test.gd.uid new file mode 100644 index 00000000..f8971852 --- /dev/null +++ b/project/python_host_test.gd.uid @@ -0,0 +1 @@ +uid://d1vnobm0q3dhc diff --git a/project/python_ui_surface.gd.uid b/project/python_ui_surface.gd.uid new file mode 100644 index 00000000..8b678107 --- /dev/null +++ b/project/python_ui_surface.gd.uid @@ -0,0 +1 @@ +uid://bi1ruj2meedvx