Advertisement
try_brzy

brzy's Mod menu rev 0.1

Mar 6th, 2025
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.63 KB | None | 0 0
  1. #include <xtl.h>
  2. #include <xboxmath.h>
  3.  
  4. // TU9 Function Pointers
  5. typedef void (*SV_GameSendServerCommand_t)(int clientNum, int type, const char *text);
  6. SV_GameSendServerCommand_t SV = (SV_GameSendServerCommand_t)0x822548D8;
  7. typedef int (*Key_IsDown_t)(int clientNum, int buttonEnum);
  8. Key_IsDown_t Key_IsDown = (Key_IsDown_t)0x821411E0;
  9. typedef bool (*Dvar_GetBool_t)(const char *dvarName);
  10. Dvar_GetBool_t Dvar_GetBool = (Dvar_GetBool_t)0x8229EEE8;
  11. typedef void (*R_AddCmdDrawText_t)(const char*, int, int, int, float, float, float*, int);
  12. R_AddCmdDrawText_t R_AddCmdDrawText = (R_AddCmdDrawText_t)0x8232B4C8;
  13. typedef int (*G_Spawn_t)(void);
  14. G_Spawn_t G_Spawn = (G_Spawn_t)0x8220C7C8;
  15. typedef void (*G_SetModel_t)(int entity, const char *model);
  16. G_SetModel_t G_SetModel = (G_SetModel_t)0x8220D1E8;
  17. typedef void (*G_SetOrigin_t)(int entity, float *origin);
  18. G_SetOrigin_t G_SetOrigin = (G_SetOrigin_t)0x8220E008;
  19. typedef void (*G_GetPlayerOrigin_t)(int clientNum, float *origin);
  20. G_GetPlayerOrigin_t G_GetPlayerOrigin = (G_GetPlayerOrigin_t)0x821E6520;
  21.  
  22. // Button Checks
  23. int LeftBumper() { return Key_IsDown(0, 0x05); }
  24. int RightBumper() { return Key_IsDown(0, 0x06); }
  25. int RightStick() { return Key_IsDown(0, 0x11); }
  26. int DpadUp() { return Key_IsDown(0, 0x14); }
  27. int DpadDown() { return Key_IsDown(0, 0x15); }
  28. int AButton() { return Key_IsDown(0, 0x01); }
  29. int BButton() { return Key_IsDown(0, 0x02); }
  30.  
  31. // Notification
  32. void Notify(const wchar_t* message) {
  33.     typedef void (*XNotifyQueueUI_t)(uint64_t stringId, uint64_t playerIndex, uint64_t r5, wchar_t* displayText, uint64_t r7);
  34.     XNotifyQueueUI_t XNotifyQueueUI = (XNotifyQueueUI_t)0x816B10A0;
  35.     wchar_t buffer[256];
  36.     swprintf(buffer, 256, L"%s", message);
  37.     XNotifyQueueUI(0x22, 0, 2, buffer, 0);
  38. }
  39.  
  40. // Menu State
  41. int MenuActive = 0;
  42. int CurrentMenu = 0;
  43. int Scroll = 0;
  44. const int MAIN_MENU_COUNT = 6;
  45. const int MAIN_SUB_COUNT = 4;
  46. const int ACCOUNT_SUB_COUNT = 5;
  47. const int BETA_TESTING_SUB_COUNT = 1;
  48.  
  49. // Menu Rendering
  50. void DrawMenu(const char* title, const char* options[], int optionCount, int selected) {
  51.     float white[4] = {1, 1, 1, 1};
  52.     char buffer[256];
  53.     sprintf(buffer, "^7%s", title);
  54.     R_AddCmdDrawText(buffer, 0x7FFFFFFF, 480, 50, 1.2f, 1.2f, white, 0);
  55.     for (int i = 0; i < optionCount; i++) {
  56.         sprintf(buffer, "%s%s", i == selected ? "^2" : "^7", options[i]);
  57.         R_AddCmdDrawText(buffer, 0x7FFFFFFF, 480, 80 + i * 25, 1.0f, 1.0f, white, 0);
  58.     }
  59.     R_AddCmdDrawText("^7Press [{+actionslot 1}]/[{+actionslot 2}] to Scroll", 0x7FFFFFFF, 50, 400, 0.8f, 0.8f, white, 0);
  60.     R_AddCmdDrawText("^7Press [{+gostand}] to Select, [{+stance}] to Back", 0x7FFFFFFF, 50, 420, 0.8f, 0.8f, white, 0);
  61. }
  62.  
  63. // Menu Options
  64. const char* MainMenuOptions[] = {"Main", "Account", "Lobby", "VIP", "Host", "Beta Testing"};
  65. const char* MainSubOptions[] = {"Visuals", "Models", "Weapons", "Game Modes"};
  66. const char* AccountSubOptions[] = {"Select Prestige", "Set Level", "Unlock All", "Custom Classes", "Clan Tags"};
  67. const char* BetaTestingSubOptions[] = {"Spawn Care Package Base"};
  68.  
  69. // Spawn Care Package Base
  70. void SpawnCarePackageBase() {
  71.     float playerOrigin[3];
  72.     G_GetPlayerOrigin(0, playerOrigin);
  73.     const int width = 3, depth = 3, height = 2;
  74.     const float crateSize = 50.0f;
  75.     for (int x = 0; x < width; x++) {
  76.         for (int z = 0; z < depth; z++) {
  77.             for (int y = 0; y < height; y++) {
  78.                 if (y == 1 && x > 0 && x < width - 1 && z > 0 && z < depth - 1) continue;
  79.                 int entity = G_Spawn();
  80.                 if (entity) {
  81.                     G_SetModel(entity, "com_plasticcase_friendly");
  82.                     float cratePos[3];
  83.                     cratePos[0] = playerOrigin[0] + (x * crateSize) - (width * crateSize / 2);
  84.                     cratePos[1] = playerOrigin[1] + (z * crateSize) - (depth * crateSize / 2);
  85.                     cratePos[2] = playerOrigin[2] + (y * crateSize);
  86.                     G_SetOrigin(entity, cratePos);
  87.                 }
  88.             }
  89.         }
  90.     }
  91.     SV(-1, 0, "c \"^2Care Package Base Spawned!\"");
  92.     Notify(L"Care Package Base Spawned");
  93. }
  94.  
  95. // Mod Logic
  96. void ModLoop() {
  97.     Notify(L"Brzy's Mod Menu Rev 0.1 Loaded - Press LB+RS to Open");
  98.     bool debounce = false;
  99.     float white[4] = {1, 1, 1, 1};
  100.     R_AddCmdDrawText("^7Brzy's Mod Menu Rev 0.1", 0x7FFFFFFF, 50, 30, 1.0f, 1.0f, white, 0); // Updated name
  101.     while (true) {
  102.         if (Dvar_GetBool("cl_ingame")) {
  103.             int lb = LeftBumper();
  104.             int rb = RightBumper();
  105.             int rs = RightStick();
  106.             int du = DpadUp();
  107.             int dd = DpadDown();
  108.             int a = AButton();
  109.             int b = BButton();
  110.             if (lb && rs && !MenuActive && !debounce) {
  111.                 MenuActive = 1;
  112.                 CurrentMenu = 0;
  113.                 Scroll = 0;
  114.                 SV(-1, 0, "c \"^2Menu Opened\"");
  115.                 Notify(L"Menu Activated");
  116.                 debounce = true;
  117.             }
  118.             if (lb && rb && MenuActive && !debounce) {
  119.                 MenuActive = 0;
  120.                 SV(-1, 0, "c \"^1Menu Closed\"");
  121.                 Notify(L"Menu Deactivated");
  122.                 debounce = true;
  123.             }
  124.             if (MenuActive) {
  125.                 if (du && !debounce) {
  126.                     Scroll--;
  127.                     if (Scroll < 0) Scroll = (CurrentMenu == 0 ? MAIN_MENU_COUNT : CurrentMenu == 1 ? MAIN_SUB_COUNT : CurrentMenu == 2 ? ACCOUNT_SUB_COUNT : BETA_TESTING_SUB_COUNT) - 1;
  128.                     debounce = true;
  129.                 }
  130.                 if (dd && !debounce) {
  131.                     Scroll++;
  132.                     if (Scroll >= (CurrentMenu == 0 ? MAIN_MENU_COUNT : CurrentMenu == 1 ? MAIN_SUB_COUNT : CurrentMenu == 2 ? ACCOUNT_SUB_COUNT : BETA_TESTING_SUB_COUNT)) Scroll = 0;
  133.                     debounce = true;
  134.                 }
  135.                 if (a && !debounce) {
  136.                     if (CurrentMenu == 0) {
  137.                         CurrentMenu = Scroll + 1;
  138.                         Scroll = 0;
  139.                         SV(-1, 0, "c \"^3Submenu Opened\"");
  140.                     }
  141.                     else if (CurrentMenu == 6 && Scroll == 0) {
  142.                         SpawnCarePackageBase();
  143.                     }
  144.                     debounce = true;
  145.                 }
  146.                 if (b && !debounce && CurrentMenu > 0) {
  147.                     CurrentMenu = 0;
  148.                     Scroll = 0;
  149.                     SV(-1, 0, "c \"^3Back to Main\"");
  150.                     debounce = true;
  151.                 }
  152.                 if (CurrentMenu == 0) DrawMenu("MAIN MENU", MainMenuOptions, MAIN_MENU_COUNT, Scroll);
  153.                 else if (CurrentMenu == 1) DrawMenu("MAIN", MainSubOptions, MAIN_SUB_COUNT, Scroll);
  154.                 else if (CurrentMenu == 2) DrawMenu("ACCOUNT", AccountSubOptions, ACCOUNT_SUB_COUNT, Scroll);
  155.                 else if (CurrentMenu == 6) DrawMenu("BETA TESTING", BetaTestingSubOptions, BETA_TESTING_SUB_COUNT, Scroll);
  156.                 else DrawMenu(MainMenuOptions[CurrentMenu - 1], MainMenuOptions, 1, 0);
  157.             }
  158.             if (!lb && !rb && !rs && !du && !dd && !a && !b) debounce = false;
  159.         }
  160.         Sleep(50);
  161.     }
  162. }
  163.  
  164. // XEX Entry Point
  165. extern "C" VOID XexStart() {
  166.     HANDLE thread;
  167.     DWORD threadId;
  168.     ExCreateThread(&thread, 0, &threadId, (PVOID)ModLoop, 0, 0, 0x1);
  169.     XSetThreadProcessor(thread, 4);
  170.     ResumeThread(thread);
  171. }
  172.  
  173. // DLL Export
  174. extern "C" {
  175.     __declspec(dllexport) DWORD DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) {
  176.         if (dwReason == DLL_PROCESS_ATTACH) {
  177.             XexStart();
  178.         }
  179.         return TRUE;
  180.     }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement