ClassStructsConnProtocol.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #pragma once
  2. /*
  3. NetConnection inherits from both ConnectionProtocol and SimGroup:
  4. class NetConnection : public ConnectionProtocol, public SimGroup
  5. The address of the single object depends on what a function expects.
  6. For example, any Sim-facing function (such as any working with the scripting engine) will see this object as a SimObject.
  7. In memory, the ConnectionProtocol section is located immediately before the SimObject section, like such:
  8. +0 bytes ConnectionProtocol section
  9. Field 0 0x725d9c GameConnection::vftable
  10. Contains GameConnection-specific functions
  11. Field 1 Unknown
  12. ...
  13. Field 39 Unknown
  14. +160 bytes SimObject section
  15. Field 0 0x725e24 GameConnection::vftable
  16. Regular Representation as a SimObject
  17. ...
  18. */
  19. #define ClassStruct_NetConnection_to_ConnectionProtocol_NetConnection_offset -160
  20. //Totals 156 bytes, exactly as written in engine/core/dnet.h:
  21. #define ClassStruct_ConnectionProtocol \
  22. void* ConnectionProtocol_vftable; \
  23. unsigned int mLastSeqRecvdAtSend[32]; \
  24. unsigned int mLastSeqRecvd; \
  25. unsigned int mHighestAckedSeq; \
  26. unsigned int mLastSendSeq; \
  27. unsigned int mAckMask; \
  28. unsigned int mConnectSequence; \
  29. unsigned int mLastRecvAckAck; \
  30. bool mConnectionEstablished; \
  31. struct ConnectionProtocol
  32. {
  33. ClassStruct_ConnectionProtocol
  34. };
  35. //Start of object after SimGroup unknown
  36. //Size before GameConnection unknown
  37. //64 + ? bytes
  38. #define ClassStruct_NetConnection \
  39. void* NetConnection_0[12]; \
  40. struct NetConnection
  41. {
  42. ClassStruct_SimObject
  43. ClassStruct_SimSet
  44. ClassStruct_SimGroup
  45. ClassStruct_NetConnection
  46. };
  47. #define ClassStruct_ConnectionProtocol_NetConnection \
  48. struct ConnectionProtocol_NetConnection
  49. {
  50. ClassStruct_ConnectionProtocol
  51. ClassStruct_ConnectionProtocol_NetConnection
  52. ClassStruct_SimObject
  53. ClassStruct_SimSet
  54. ClassStruct_SimGroup
  55. ClassStruct_NetConnection
  56. };
  57. /*
  58. Some of these fields may actually belong to NetConnection, however,
  59. GameConnection is the only inheritor of NetConnection.
  60. */
  61. #define ClassStruct_GameConnection \
  62. int simtimeLastScopeQuery; /* CP+272, SO+112 */ \
  63. void* GameConnection_1[8]; \
  64. void** mSceneManager; /* CP+308, SO+148 (pointer to pointer to gClientContainer or gServerContainer) */ \
  65. void* GameConnection_2[10]; \
  66. unsigned int mCurRate_updateDelay; /* CP+352, SO+192 */ \
  67. unsigned int mCurRate_packetSize; /* CP+356, SO+196 */ \
  68. boolean mCurRate_changed; /* CP+360, SO+200 */ \
  69. unsigned int mMaxRate_updateDelay; /* CP+364, SO+204 */ \
  70. unsigned int mMaxRate_packetSize; /* CP+368, SO+208 */ \
  71. void* GameConnection_3[29]; \
  72. void* mGhostArray; /* CP+488, SO+328 */ \
  73. struct GameConnection
  74. {
  75. ClassStruct_SimObject
  76. ClassStruct_SimSet
  77. ClassStruct_SimGroup
  78. ClassStruct_NetConnection
  79. ClassStruct_GameConnection
  80. };
  81. struct ConnectionProtocol_GameConnection
  82. {
  83. ClassStruct_ConnectionProtocol
  84. ClassStruct_ConnectionProtocol_NetConnection
  85. ClassStruct_SimObject
  86. ClassStruct_SimSet
  87. ClassStruct_SimGroup
  88. ClassStruct_NetConnection
  89. ClassStruct_GameConnection
  90. };