Advertisement
djhonga2001

Untitled

Feb 11th, 2017
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1. #if _DEBUG
  2. static void*(*getNetMessageIDOrig)(void*, intptr_t);
  3. void tryPrintDescName(int descID);
  4.  
  5. static void* getNetMessageID(void* outMessageID, intptr_t data) {
  6. void* retVal = getNetMessageIDOrig(outMessageID, data);
  7. intptr_t *netMessageID = (intptr_t*)*&outMessageID;
  8. int messageID = netMessageID[0];
  9. tryPrintDescName(messageID);
  10. return retVal;
  11. }
  12.  
  13. typedef struct {
  14. char* messageName;
  15. int messageID;
  16. } MessageIDStruct;
  17.  
  18. MessageIDStruct msgIDData[] = {
  19. { "CMsgTextChatStatusMSGID", 0 },
  20. { "msgScriptJoinMSGID", 1 },
  21. { "reassignConfirmMsgMSGID", 2 },
  22. { "MsgTransitionToGameNotifyMSGID", 3 },
  23. { "rlMsgSearchRequestMSGID", 4 },
  24. { "MsgBlacklistMSGID", 5 },
  25. { "cloneSyncMsgMSGID", 6 },
  26. { "MsgTransitionParametersMSGID", 7 },
  27. { "MsgTransitionToActivityStartMSGID", 8 },
  28. { "cxnRelayAddrChangedMsgMSGID", 9 },
  29. { "MsgCheckQueuedJoinRequestMSGID", 10 },
  30. { "msgRequestKickFromHostMSGID", 11 },
  31. { "MsgTransitionLaunchMSGID", 12 },
  32. { "MsgTransitionGamerInstructionMSGID", 13 },
  33. { "msgScriptVerifyHostMSGID", 14 },
  34. { "playerDataMsgMSGID", 15 },
  35. { "netIceSessionPingMSGID", 16 },
  36. { "MsgRadioStationSyncRequestMSGID", 17 },
  37. { "snMsgGamerMatchInfoRequestMSGID", 18 },
  38. { "PaddingMSGID19", 19 },
  39. { "rlSessionDetailResponseMSGID", 20 },
  40. { "MsgTransitionToActivityFinishMSGID", 21 },
  41. { "netIceSessionAnswerMSGID", 22 },
  42. { "PaddingMSGID23", 23 },
  43. { "msgScriptLeaveAckMSGID", 24 },
  44. { "nonPhysicalDataMsgMSGID", 25 },
  45. { "msgScriptHostRequestMSGID", 26 },
  46. { "CRoamingInitialBubbleMsgMSGID", 27 },
  47. { "msgScriptBotJoinAckMSGID", 28 },
  48. { "rlMsgQosProbeRequestMSGID", 29 },
  49. { "snMsgRequestGamerInfoMSGID", 30 },
  50. { "MsgRequestTransitionParametersMSGID", 31 },
  51. { "snMsgChangeSessionAttributesCmdMSGID", 32 },
  52. { "requestObjectIdsMsgMSGID", 33 },
  53. { "MsgCheckQueuedJoinRequestReplyMSGID", 34 },
  54. { "PaddingMSGID35", 35 },
  55. { "rlSessionDetailRequest@rageMSGID", 36 },
  56. { "snMsgSetInvitableCmdMSGID", 37 },
  57. { "MsgCheckQueuedJoinRequestInviteReplyMSGID", 38 },
  58. { "CMsgPackedEventsMSGID", 39 },
  59. { "MsgKickPlayerMSGID", 40 },
  60. { "reassignResponseMsgMSGID", 41 },
  61. { "MsgTransitionLaunchNotifyMSGID", 42 },
  62. { "unkMessageID__2bhMSGID", 43 },
  63. { "unkMessageID__2chMSGID", 44 },
  64. { "informObjectIdsMsgMSGID", 45 },
  65. { "snMsgHostLeftWhilstJoiningCmdMSGID", 46 },
  66. { "msgScriptMigrateHostMSGID", 47 },
  67. { "PaddingMSGID48", 48 },
  68. { "snMsgMigrateHostResponseMSGID", 49 },
  69. { "MsgTextMessageMSGID", 50 },
  70. { "CMsgPlayerIsTypingMSGID", 51 },
  71. { "reassignNegotiateMsgMSGID", 52 },
  72. { "msgScriptBotLeaveMSGID", 53 },
  73. { "CMsgVoiceStatusMSGID", 54 },
  74. { "msgScriptMigrateHostFailAckMSGID", 55 },
  75. { "snMsgRegisterForMatchRequestMSGID", 56 },
  76. { "MsgPlayerCardSyncMSGID", 57 },
  77. { "netComplaintMsg@rageMSGID", 58 },
  78. { "CMsgJoinRequestMSGID", 59 },
  79. { "MsgPlayerCardRequestMSGID", 60 },
  80. { "snMsgSessionAcceptChatMSGID", 61 },
  81. { "packedReliablesMSGID", 62 },
  82. { "snMsgEndMatchCmdMSGID", 63 },
  83. { "msgScriptVerifyHostAckMSGID", 64 },
  84. { "PaddingMSGID65", 65 },
  85. { "MsgReserveSlotsAckMSGID", 66 },
  86. { "msgScriptBotJoinMSGID", 67 },
  87. { "snMsgAddGamerToSessionCmdMSGID", 68 },
  88. { "msgScriptJoinHostAckMSGID", 69 },
  89. { "unkMessageID__46hMSGID", 70 },
  90. { "MsgRadioStationSyncMSGID", 71 },
  91. { "netIceSessionPong@rageMSGID", 72 },
  92. { "PaddingMSGID73", 73 },
  93. { "CMsgTextMessageMSGID", 74 },
  94. { "netIceSessionOffer@rageMSGID", 75 },
  95. { "msgScriptBotHandshakeAckMSGID", 76 },
  96. { "snMsgConfigRequestMSGID", 77 },
  97. { "msgScriptHandshakeMSGID", 78 },
  98. { "packedCloneSyncACKsMsgMSGID", 79 },
  99. { "CMsgPackedEventReliablesMsgsMSGID", 80 },
  100. { "CRoamingRequestBubbleMsgMSGID", 81 },
  101. { "MsgTransitionParameterStringMSGID", 82 },
  102. { "snMsgMigrateHostRequestMSGID", 83 },
  103. { "snMsgSessionMemberIdsMSGID", 84 },
  104. { "PaddingMSGID85", 85 },
  105. { "netTimeSyncMsgMSGID", 86 },
  106. { "msgScriptHandshakeAckMSGID", 87 },
  107. { "snMsgStartMatchCmdMSGID", 88 },
  108. { "CRoamingJoinBubbleAckMsgMSGID", 89 },
  109. { "MsgReserveSlotsMSGID", 90 },
  110. { "snMsgGamerMatchInfoResponseMSGID", 91 },
  111. { "msgScriptLeaveMSGID", 92 },
  112. { "msgScriptJoinAckMSGID", 93 },
  113. { "msgUpdate@netArrayManagerMSGID", 94 },
  114. { "msgSplitUpdateAck@netArrayManagerMSGID", 95 },
  115. { "CRoamingJoinBubbleMsgMSGID", 96 },
  116. { "snMsgJoinRequestMSGID", 97 },
  117. { "msgUpdateAck@netArrayManagerMSGID", 98 },
  118. { "MsgTransitionToGameStartMSGID", 99 },
  119. { "msgScriptBotHandshakeMSGID", 100 },
  120. { "PaddingMSGID101", 101 },
  121. { "snMsgRemoveGamersFromSessionCmdMSGID", 102 },
  122. { "PaddingMSGID103", 103 },
  123. { "snMsgRegisterForMatchResponseMSGID", 104 },
  124. { "msgScriptNewHostMSGID", 105 },
  125. { "snMsgJoinResponseMSGID", 106 },
  126. { "CMsgJoinResponseMSGID", 107 },
  127. { "rlMsgSearchResponseMSGID", 108 }
  128. };
  129.  
  130. void tryPrintDescName(int descID) {
  131. int arrSize = sizeof(msgIDData) / sizeof(MessageIDStruct);
  132. if (descID > arrSize || descID < 0) return; //Can never be sure
  133. trace("tryPrintDescName: %s\n", msgIDData[descID].messageName);
  134. }
  135. #endif
  136.  
  137. static HookFunction hookFunction([] ()
  138. {
  139. #if _DEBUG
  140. // find getNetMessageID funcs and replace the calls (not all of them just some, couldn't make a signature for all of them and didn't feel like hooking the function itself)
  141.  
  142. auto getNetMessageIDs = hook::pattern("48 8D 54 24 ? 48 8D 4C 24 ? E8 ? ? ? ? BF ? ? ? ? 85 C0");
  143. if (getNetMessageIDs.size() > 0)
  144. {
  145. location = getNetMessageIDs.get(0).get<char>(0xA);
  146. hook::set_call(&getNetMessageIDOrig, location);
  147.  
  148. for (int i = 0; i < getNetMessageIDs.size(); i++)
  149. {
  150. location = getNetMessageIDs.get(i).get<char>(0xA);
  151. hook::call(location, getNetMessageID);
  152. }
  153. }
  154. #endif
  155. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement