2V1-d: offline login -> select -> loading against a fake 40250 server

port.login_flow drives the real 40250 root scripts through the ported
CPythonNetworkStream and CAccountConnector against a loopback auth + game
server built from net/classic (wire layouts, sequence table, cipher) that
answers like the 40250 desc.cpp/input*.cpp: handshake, key agreement,
LOGIN3/AUTH_SUCCESS, LOGIN2, the character list, DirectEnter reconnect,
CHARACTER_SELECT, the loading packets and CLIENT_VERSION, with every
sequence byte checked.

- NetStream::ActivateCipher decrypts ciphertext already buffered behind
  KEY_AGREEMENT_COMPLETED (PORT)
- CPythonApplication is final (PORT): no application object exists on the
  platform yet, so its virtual overrides must be called directly
- app.GetTime (GetGlobalTime) and camera/center-position stubs
- SendClientVersionPacket verbatim in the PhaseGame stand-in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-23 15:20:32 +09:00
co-authored by Claude Opus 5.5
parent 4d9b800efb
commit 8d9d863c7e
10 changed files with 753 additions and 5 deletions
+7 -1
View File
@@ -3006,6 +3006,12 @@ bool CNetworkStream::Activate(size_t agreed_length, const void* buffer, size_t l
void CNetworkStream::ActivateCipher()
{
return m_cipher.set_activated(true);
m_cipher.set_activated(true);
// PORT: __RecvInternalBuffer decrypts each recv as it arrives, so encrypted bytes the server sent right
// behind KEY_AGREEMENT_COMPLETED that landed in the same recv are still ciphertext. In 40250 the
// server's next pulse usually keeps them apart; on loopback or a fast LAN they arrive together, so
// decrypt the unread rest of the buffer here.
if (m_recvBufInputPos > m_recvBufOutputPos)
m_cipher.Decrypt(m_recvBuf + m_recvBufOutputPos, m_recvBufInputPos - m_recvBufOutputPos);
}
#endif // _IMPROVED_PACKET_ENCRYPTION_