├── il2cpp.zip ├── Examples ├── RichPresence │ ├── include │ │ └── discord-rpc │ │ │ ├── lib │ │ │ └── discord-rpc.lib │ │ │ └── include │ │ │ ├── discord_register.h │ │ │ └── discord_rpc.h │ ├── dllmain.h │ ├── dllmain.cpp │ ├── main.cpp │ └── RichPresence.vcxproj ├── Randomizer │ ├── dllmain.h │ ├── dllmain.cpp │ ├── Randomizer.vcxproj │ └── main.cpp ├── Speedhack │ ├── dllmain.h │ ├── dllmain.cpp │ ├── main.cpp │ └── Speedhack.vcxproj ├── TestDLL │ ├── dllmain.h │ ├── dllmain.cpp │ ├── main.cpp │ └── TestDLL.vcxproj ├── MasteryMode │ ├── dllmain.h │ ├── dllmain.cpp │ ├── main.cpp │ └── MasteryMode.vcxproj └── HypersonicTowers │ ├── dllmain.h │ ├── dllmain.cpp │ ├── main.cpp │ └── HypersonicTowers.vcxproj ├── SharedPCH ├── pch.cpp ├── pch.hpp ├── SharedPCH.vcxproj.filters ├── SharedPCH.props └── SharedPCH.vcxproj ├── DEA.md ├── README.md ├── .gitattributes ├── .gitignore └── BTD6API.sln /il2cpp.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BowDown097/BTD6API/HEAD/il2cpp.zip -------------------------------------------------------------------------------- /Examples/RichPresence/include/discord-rpc/lib/discord-rpc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BowDown097/BTD6API/HEAD/Examples/RichPresence/include/discord-rpc/lib/discord-rpc.lib -------------------------------------------------------------------------------- /SharedPCH/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch.hpp" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. 6 | -------------------------------------------------------------------------------- /Examples/Randomizer/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /Examples/Speedhack/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /Examples/TestDLL/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /Examples/MasteryMode/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /Examples/RichPresence/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /Examples/HypersonicTowers/dllmain.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | // Entry point declaration for custom injected code 4 | void Run(); 5 | 6 | // IL2CPP initializer 7 | void init_il2cpp(); -------------------------------------------------------------------------------- /SharedPCH/pch.hpp: -------------------------------------------------------------------------------- 1 | // pch.h: This is a precompiled header file. 2 | // Files listed below are compiled only once, improving build performance for future builds. 3 | // This also affects IntelliSense performance, including code completion and many code browsing features. 4 | // However, files listed here are ALL re-compiled if any one of them is updated between builds. 5 | // Do not add files here that you will be updating frequently as this negates the performance advantage. 6 | 7 | #pragma once 8 | #include "../il2cpp/il2cpp-utils.hpp" 9 | 10 | #include 11 | #include 12 | #include -------------------------------------------------------------------------------- /Examples/MasteryMode/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain(HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /Examples/TestDLL/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain(HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /Examples/RichPresence/include/discord-rpc/include/discord_register.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(DISCORD_DYNAMIC_LIB) 4 | #if defined(_WIN32) 5 | #if defined(DISCORD_BUILDING_SDK) 6 | #define DISCORD_EXPORT __declspec(dllexport) 7 | #else 8 | #define DISCORD_EXPORT __declspec(dllimport) 9 | #endif 10 | #else 11 | #define DISCORD_EXPORT __attribute__((visibility("default"))) 12 | #endif 13 | #else 14 | #define DISCORD_EXPORT 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command); 22 | DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /Examples/Randomizer/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain( HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /Examples/Speedhack/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain( HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /Examples/HypersonicTowers/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain( HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /Examples/RichPresence/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include "windows.h" 5 | #include "dllmain.h" 6 | 7 | // DLL entry point 8 | BOOL APIENTRY DllMain( HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | init_il2cpp(); 17 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL); 18 | break; 19 | case DLL_THREAD_ATTACH: 20 | case DLL_THREAD_DETACH: 21 | case DLL_PROCESS_DETACH: 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /SharedPCH/SharedPCH.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /DEA.md: -------------------------------------------------------------------------------- 1 | DEA bot, the very bot, the very spaghetti code that I made myself. A highly customizable DEA cash system and a really easy way to set it up and get it running so you can host this bot yourself and customize all the settings you would possibly want. So first off, to be able to run this - unfortunately this is only going to be for Windows guide - you're going to need community 2017 of visual studios, and when you install it, you have to choose the dot net core; in the installer, there's going to be a bunch of choices of things that you can add to visual studios 2017. All you got to do is check dot net core. Once that's done, all you got to do is go on the official RealBlazeIt/DEA GitHub where there is the full source code of DEA, then you just go make sure you're on the master branch, because the development one is not always stable and some others won't even work. You download the master branch as a zip file. Now, once you download that you have to unzip it. You have the unzipped files here, which is the exact same thing as you had here. And after you have the visual studios 2017 community version - including dot net core - you can open up the solution file for DEA. Now, once you have this - quite running, quite good and gold, you might think, "ok that's all i got to do I just gotta fuckin press the run button and it should work." But if you try to press the run button and start it, well this is exactly what's going to happen. First, it's going to compile, it's going to work, it's going to load up. But then right away, it's going to say error while loading up credentials.json. You got to fix this and restart it. The file doesn't exist. You need to have the file in your source file. So let's go into source files. And here, you can see there's only the credentials example, but there isn't the credentials file itself. So what we're going to do is we're just going to rename this, we're going to remove the example part, then we'll enter that. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BTD6API 2 | An API allowing you to develop BTD6 mods that can be injected using [BTD6 Mod Manager](https://github.com/TDToolbox/BTD6-Mod-Manager/releases/latest). There's also another, much more noob friendly API made in C# that you can check out called [NKHook6](https://github.com/TDToolbox/NKHook6/), made by the creators of the mod manager, if you wish to have an easier experience making mods. 3 |

4 | 5 | 6 |

7 | 8 | ## How to use in your project 9 | - Click "Clone or download," and then "Open in Visual Studio" (if available) or "Download ZIP" if the aforementioned option is not available. 10 | - Look to the Examples folder and/or the Wiki to learn how to use this API from here! 11 | 12 | ## Credits 13 | Thanks to: 14 | - DerPopo for making [UABE](https://github.com/derpopo/uabe), which handles asset patching. 15 | - DisabledMallis and gurrenm4 for making [BTD6 Mod Manager](https://github.com/TDToolbox/BTD6-Mod-Manager), which handles mod injection. 16 | - djkaty for making [Il2CppInspector](https://github.com/djkaty/Il2CppInspector), which is the backbone of this API. 17 | - Perfare for making [AssetStudio](https://github.com/Perfare/AssetStudio) and [Il2CppDumper](https://github.com/Perfare/Il2CppDumper). 18 | - NinjaKiwi for making the [B](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense.html)[l](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense-2.html)[o](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense-3.html)[o](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense-4.html)[n](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense-4-Expansion.html)[s](https://ninjakiwi.com/Games/Tower-Defense/Bloons-Tower-Defense-5.html) [T](https://store.steampowered.com/app/306020/Bloons_TD_5/)[D](https://store.steampowered.com/app/960090/Bloons_TD_6/) series of games. 19 | -------------------------------------------------------------------------------- /Examples/Speedhack/main.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #include "pch.hpp" 5 | 6 | using namespace app; 7 | 8 | // Injected code entry point 9 | void Run() 10 | { 11 | AllocConsole(); 12 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 13 | freopen_s((FILE**)stdin, "CONIN$", "r", stdin); 14 | 15 | std::cout << "Initializing..." << std::endl; 16 | 17 | size_t size = 0; 18 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 19 | 20 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 21 | 22 | if (assembly == nullptr) 23 | { 24 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 25 | return; 26 | } 27 | 28 | int speed = 10; 29 | std::cout << "What speed do you want? (Default: 10): "; 30 | try 31 | { 32 | std::cin >> speed; 33 | } 34 | catch (std::exception) {} 35 | 36 | float speedF = static_cast(speed); 37 | 38 | while (true) 39 | { 40 | Il2CppClass* timeClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Utils", "TimeManager"); 41 | if (timeClass != NULL) 42 | { 43 | FieldInfo* fastForwardInfo = il2cpp_class_get_field_from_name(timeClass, "compromisedFastFowardRate"); 44 | int compromisedFastForwardRate = 0; 45 | il2cpp_field_static_get_value(fastForwardInfo, &compromisedFastForwardRate); 46 | if (compromisedFastForwardRate != speed) 47 | { 48 | FieldInfo* maxStepsInfo = il2cpp_class_get_field_from_name(timeClass, "maxSimulationStepsPerUpdate"); 49 | il2cpp_field_static_set_value(fastForwardInfo, &speed); 50 | il2cpp_field_static_set_value(maxStepsInfo, &speedF); 51 | std::cout << "Game speed set from 3 -> " << std::to_string(speed) << std::endl; 52 | } // if compromisedFastFowardRate is not speed, that means it is likely unchanged, so patch 53 | } 54 | else 55 | { 56 | std::cout << "Could not find TimeManager! That's odd. Should've been able to." << std::endl; 57 | } 58 | Sleep(500); 59 | } // wanna do this every 0.5 second, that should be good enough. i'm too lazy to do events 60 | } -------------------------------------------------------------------------------- /SharedPCH/SharedPCH.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(SolutionDir)Outputs\Intermediate\$(Platform)\$(Configuration)\ 6 | $(SharedPchDir)Shared.pch 7 | $(SharedPchDir)vc$(PlatformToolsetVersion).pdb 8 | $(SharedPchDir)vc$(PlatformToolsetVersion).idb 9 | $(SolutionDir)Outputs\$(ProjectName)\$(Platform)\$(Configuration)\ 10 | $(SolutionDir)Outputs\Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ 11 | 12 | 13 | $(ProjDirOut) 14 | $(ProjDirIntOut) 15 | 16 | 17 | 18 | $(SolutionDir)SharedPCH;%(AdditionalIncludeDirectories) 19 | Use 20 | pch.hpp 21 | $(SharedPCH) 22 | 23 | 24 | if EXIST "$(SharedPDB)" xcopy /Y /F "$(SharedPDB)" "$(IntDIr)" 25 | if EXIST "$(SharedIDB)" xcopy /Y /F "$(SharedIDB)" "$(IntDIr)" 26 | 27 | 28 | 29 | 30 | $(SharedPCHDir) 31 | 32 | 33 | $(SharedPCH) 34 | 35 | 36 | $(SharedPdb) 37 | 38 | 39 | $(SharedIdb) 40 | 41 | 42 | $(ProjDirOut) 43 | 44 | 45 | $(ProjDirIntOut) 46 | 47 | 48 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Examples/RichPresence/include/discord-rpc/include/discord_rpc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // clang-format off 5 | 6 | #if defined(DISCORD_DYNAMIC_LIB) 7 | # if defined(_WIN32) 8 | # if defined(DISCORD_BUILDING_SDK) 9 | # define DISCORD_EXPORT __declspec(dllexport) 10 | # else 11 | # define DISCORD_EXPORT __declspec(dllimport) 12 | # endif 13 | # else 14 | # define DISCORD_EXPORT __attribute__((visibility("default"))) 15 | # endif 16 | #else 17 | # define DISCORD_EXPORT 18 | #endif 19 | 20 | // clang-format on 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct DiscordRichPresence { 27 | const char* state; /* max 128 bytes */ 28 | const char* details; /* max 128 bytes */ 29 | int64_t startTimestamp; 30 | int64_t endTimestamp; 31 | const char* largeImageKey; /* max 32 bytes */ 32 | const char* largeImageText; /* max 128 bytes */ 33 | const char* smallImageKey; /* max 32 bytes */ 34 | const char* smallImageText; /* max 128 bytes */ 35 | const char* partyId; /* max 128 bytes */ 36 | int partySize; 37 | int partyMax; 38 | const char* matchSecret; /* max 128 bytes */ 39 | const char* joinSecret; /* max 128 bytes */ 40 | const char* spectateSecret; /* max 128 bytes */ 41 | int8_t instance; 42 | } DiscordRichPresence; 43 | 44 | typedef struct DiscordUser { 45 | const char* userId; 46 | const char* username; 47 | const char* discriminator; 48 | const char* avatar; 49 | } DiscordUser; 50 | 51 | typedef struct DiscordEventHandlers { 52 | void (*ready)(const DiscordUser* request); 53 | void (*disconnected)(int errorCode, const char* message); 54 | void (*errored)(int errorCode, const char* message); 55 | void (*joinGame)(const char* joinSecret); 56 | void (*spectateGame)(const char* spectateSecret); 57 | void (*joinRequest)(const DiscordUser* request); 58 | } DiscordEventHandlers; 59 | 60 | #define DISCORD_REPLY_NO 0 61 | #define DISCORD_REPLY_YES 1 62 | #define DISCORD_REPLY_IGNORE 2 63 | 64 | DISCORD_EXPORT void Discord_Initialize(const char* applicationId, 65 | DiscordEventHandlers* handlers, 66 | int autoRegister, 67 | const char* optionalSteamId); 68 | DISCORD_EXPORT void Discord_Shutdown(void); 69 | 70 | /* checks for incoming messages, dispatches callbacks */ 71 | DISCORD_EXPORT void Discord_RunCallbacks(void); 72 | 73 | /* If you disable the lib starting its own io thread, you'll need to call this from your own */ 74 | #ifdef DISCORD_DISABLE_IO_THREAD 75 | DISCORD_EXPORT void Discord_UpdateConnection(void); 76 | #endif 77 | 78 | DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); 79 | DISCORD_EXPORT void Discord_ClearPresence(void); 80 | 81 | DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); 82 | 83 | DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers); 84 | 85 | #ifdef __cplusplus 86 | } /* extern "C" */ 87 | #endif 88 | -------------------------------------------------------------------------------- /Examples/TestDLL/main.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #include "pch.hpp" 5 | #include 6 | 7 | void makeHypersonic(GameModel* gmdl, const std::string& where) { 8 | 9 | try { 10 | size_t size = 0; 11 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 12 | 13 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 14 | 15 | if (assembly == nullptr) 16 | { 17 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 18 | return; 19 | } 20 | 21 | 22 | Il2CppClass* ShoptowersClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity.UI_New.InGame.RightMenu", "ShopMenu"); 23 | FieldInfo* shoptowersfield = il2cpp_class_get_field_from_name(ShoptowersClass, "instance"); 24 | const MethodInfo* _method12 = il2cpp_class_get_method_from_name(ShoptowersClass, "CreateTowerButton", 3);//TowerPurchaseButton *, ShopMenu_CreateTowerButton, (ShopMenu * __this, TowerModel * model, int32_t buttonIndex, bool showTowerCounts, MethodInfo * method)); 25 | TowerPurchaseButton* (*createbutton)(ShopMenu*, TowerModel*, int32_t, bool, MethodInfo*) = (TowerPurchaseButton * (*)(ShopMenu*, TowerModel*, int32_t, bool, MethodInfo*)) _method12->methodPointer; 26 | ShopMenu* sm = 0; 27 | il2cpp_field_static_get_value(shoptowersfield, &sm); 28 | 29 | std::cout << "Current button count: " << sm->fields.buttonCount << std::endl; 30 | 31 | sm->fields.buttonCount++; 32 | TowerPurchaseButton* eee = createbutton(sm, (TowerModel*)gmdl->fields.towerSet->vector[0], sm->fields.buttonCount - 1, false, (MethodInfo*)_method12); 33 | } 34 | catch (Il2CppExceptionWrapper e) { 35 | std::wcout << L"Il2cppException occurred:" << (wchar_t*)(e.ex->message->chars) << std::endl; 36 | } 37 | 38 | 39 | } 40 | 41 | 42 | using namespace app; 43 | // Injected code entry point 44 | void Run() 45 | { 46 | AllocConsole(); 47 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 48 | 49 | Il2CppThread* thread = il2cpp_thread_attach(il2cpp_domain_get()); 50 | 51 | std::cout << "Initializing..." << std::endl; 52 | 53 | size_t size = 0; 54 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 55 | 56 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 57 | 58 | if (assembly == nullptr) 59 | { 60 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 61 | return; 62 | } 63 | 64 | // do in-game patches (will need to patch InGame if user is currently in-game, just patching Game will do nothing in that case) 65 | Il2CppClass* inGameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity.UI_New.InGame", "InGame"); 66 | FieldInfo* inGameInstanceInfo = il2cpp_class_get_field_from_name(inGameClass, "instance"); 67 | InGame* inGameInstAddr = 0; 68 | il2cpp_field_static_get_value(inGameInstanceInfo, &inGameInstAddr); 69 | 70 | if (inGameInstAddr != NULL) 71 | { 72 | InGame* inGameInstance = (InGame*)inGameInstAddr; 73 | makeHypersonic(inGameInstance->fields.bridge->fields.simulation->fields.model, "in-game"); 74 | } 75 | // game patches 76 | Il2CppClass* gameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity", "Game"); 77 | FieldInfo* gameInstanceInfo = il2cpp_class_get_field_from_name(gameClass, "instance"); 78 | Game* gameInstAddr = 0; 79 | il2cpp_field_static_get_value(gameInstanceInfo, &gameInstAddr); 80 | 81 | if (gameInstAddr == NULL) 82 | { 83 | std::cout << "Some error occurred when trying to access the game model." << std::endl; 84 | return; 85 | } 86 | 87 | Game* gameInstance = (Game*)gameInstAddr; 88 | makeHypersonic(gameInstance->fields.model, "game"); 89 | } -------------------------------------------------------------------------------- /Examples/HypersonicTowers/main.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #include "pch.hpp" 5 | 6 | using namespace app; 7 | 8 | void makeWeaponHypersonic(AttackModel* attack) { 9 | WeaponModel__Array* weaponsArr = attack->fields.weapons; 10 | WeaponModel** weapons = weaponsArr->vector; 11 | 12 | for (int k = 0; k < weaponsArr->max_length; ++k) 13 | { 14 | WeaponModel* weapon = weapons[k]; 15 | 16 | if (weapon != NULL) 17 | { 18 | weapon->fields.rate = 0.0f; 19 | weapon->fields.rateFrames = 0; 20 | } 21 | } 22 | } 23 | 24 | void makeTowerHypersonic(TowerModel* tmdl) { 25 | Model__Array* modelsArr = tmdl->fields.behaviors; 26 | Model** models = modelsArr->vector; 27 | if (models != NULL) 28 | { 29 | for (int i = 0; i < modelsArr->max_length; ++i) 30 | { 31 | Model* model = models[i]; 32 | if (model != NULL && model->fields.name != NULL) 33 | { 34 | 35 | std::wstring name = BTD6API::StringUtils::toWideString(model->fields.name); 36 | 37 | // This hero works differently to literally everything else in the game. 38 | if (name.find(L"AbilityModel_UCAVAbility") != std::wstring::npos) { 39 | AbilityModel* ab = (AbilityModel*)model; 40 | 41 | for (int j = 0; j < ab->fields.behaviors->max_length; ++j) { 42 | Model* bm = ab->fields.behaviors->vector[j]; 43 | 44 | std::wstring modelName = BTD6API::StringUtils::toWideString(bm->fields.name); 45 | 46 | if (modelName.find(L"UCAVModel") != std::wstring::npos) { 47 | UCAVModel* mdl = (UCAVModel*)(bm); 48 | makeTowerHypersonic(mdl->fields.uavTowerModel); 49 | makeTowerHypersonic(mdl->fields.ucavTowerModel); 50 | } 51 | } 52 | } 53 | 54 | if (name.find(L"DroneSupportModel") != std::wstring::npos) { 55 | DroneSupportModel* dsm = (DroneSupportModel*)(model); 56 | makeTowerHypersonic(dsm->fields.droneModel); 57 | } 58 | 59 | if (name.find(L"AttackModel") != std::wstring::npos || name.find(L"AttackAirUnitModel") != std::wstring::npos) 60 | { 61 | AttackModel* attack = (AttackModel*)model; 62 | makeWeaponHypersonic(attack); 63 | } 64 | } 65 | } 66 | } 67 | } 68 | 69 | 70 | void makeHypersonic(GameModel* gmdl, const std::string& where) 71 | { 72 | TowerModel__Array* towersArr = gmdl->fields.towers; 73 | TowerModel** towers = towersArr->vector; 74 | 75 | for (int i = 0; i < towersArr->max_length; ++i) 76 | { 77 | if (towers[i]->fields.display != NULL) 78 | { 79 | makeTowerHypersonic(towers[i]); 80 | } 81 | } 82 | 83 | std::cout << "Made towers hypersonic (" << where << ")" << std::endl; 84 | } 85 | 86 | // Injected code entry point 87 | void Run() 88 | { 89 | AllocConsole(); 90 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 91 | 92 | std::cout << "Initializing..." << std::endl; 93 | 94 | size_t size = 0; 95 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 96 | 97 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 98 | 99 | if (assembly == nullptr) 100 | { 101 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 102 | return; 103 | } 104 | 105 | // do in-game patches (will need to patch InGame if user is currently in-game, just patching Game will do nothing in that case) 106 | Il2CppClass* inGameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity.UI_New.InGame", "InGame"); 107 | FieldInfo* inGameInstanceInfo = il2cpp_class_get_field_from_name(inGameClass, "instance"); 108 | InGame* inGameInstAddr = 0; 109 | il2cpp_field_static_get_value(inGameInstanceInfo, &inGameInstAddr); 110 | 111 | if (inGameInstAddr != NULL) 112 | { 113 | InGame* inGameInstance = (InGame*)inGameInstAddr; 114 | makeHypersonic(inGameInstance->fields.bridge->fields.simulation->fields.model, "in-game"); 115 | } 116 | // game patches 117 | Il2CppClass* gameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity", "Game"); 118 | FieldInfo* gameInstanceInfo = il2cpp_class_get_field_from_name(gameClass, "instance"); 119 | Game* gameInstAddr = 0; 120 | il2cpp_field_static_get_value(gameInstanceInfo, &gameInstAddr); 121 | 122 | if (gameInstAddr == NULL) 123 | { 124 | std::cout << "Some error occurred when trying to access the game model." << std::endl; 125 | return; 126 | } 127 | 128 | Game* gameInstance = (Game*)gameInstAddr; 129 | makeHypersonic(gameInstance->fields.model, "game"); 130 | } -------------------------------------------------------------------------------- /Examples/MasteryMode/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Bloon conversions (modifiers are respected): 3 | * Red -> Blue 4 | * Blue -> Green 5 | * Green -> Yellow 6 | * Yellow -> Pink 7 | * Pink -> White/Black (RNG) 8 | * White -> Purple 9 | * Black -> Lead 10 | * Purple -> Lead (fortified) 11 | * Lead -> Zebra 12 | * Zebra -> Rainbow 13 | * Rainbow -> Ceramic 14 | * Ceramic -> MOAB 15 | * MOAB -> BFB 16 | * BFB -> ZOMG 17 | * ZOMG -> DDT 18 | * DDT -> BAD 19 | * BAD -> Fortified BAD 20 | */ 21 | 22 | #include "pch.hpp" 23 | #include 24 | #include 25 | 26 | using namespace app; 27 | 28 | std::map promotionMap { 29 | {"Red", "Blue"}, 30 | {"RedCamo", "BlueCamo"}, 31 | {"RedRegrow", "BlueRegrow"}, 32 | {"RedRegrowCamo", "BlueRegrowCamo"}, 33 | {"Blue", "Green"}, 34 | {"BlueCamo", "GreenCamo"}, 35 | {"BlueRegrow", "GreenRegrow"}, 36 | {"BlueRegrowCamo", "GreenRegrowCamo"}, 37 | {"Green", "Yellow"}, 38 | {"GreenCamo", "YellowCamo"}, 39 | {"GreenRegrow", "YellowRegrow"}, 40 | {"GreenRegrowCamo", "YellowRegrowCamo"}, 41 | {"Yellow", "Pink"}, 42 | {"YellowCamo", "PinkCamo"}, 43 | {"YellowRegrow", "PinkRegrow"}, 44 | {"YellowRegrowCamo", "PinkRegrowCamo"}, 45 | {"White", "Purple"}, 46 | {"WhiteCamo", "PurpleCamo"}, 47 | {"WhiteRegrow", "PurpleRegrow"}, 48 | {"WhiteRegrowCamo", "PurpleRegrowCamo"}, 49 | {"Black", "Lead"}, 50 | {"BlackCamo", "LeadCamo"}, 51 | {"BlackRegrow", "LeadRegrow"}, 52 | {"BlackRegrowCamo", "LeadRegrowCamo"}, 53 | {"Purple", "LeadFortified"}, 54 | {"PurpleCamo", "LeadFortifiedCamo"}, 55 | {"PurpleRegrow", "LeadRegrowFortified"}, 56 | {"PurpleRegrowCamo", "LeadRegrowFortifiedCamo"}, 57 | {"Lead", "Zebra"}, 58 | {"LeadCamo", "ZebraCamo"}, 59 | {"LeadRegrow", "ZebraRegrow"}, 60 | {"LeadRegrowCamo", "ZebraRegrowCamo"}, 61 | {"Zebra", "Rainbow"}, 62 | {"ZebraCamo", "RainbowCamo"}, 63 | {"ZebraRegrow", "RainbowRegrow"}, 64 | {"ZebraRegrowCamo", "RainbowRegrowCamo"}, 65 | {"Rainbow", "Ceramic"}, 66 | {"RainbowCamo", "CeramicCamo"}, 67 | {"RainbowRegrow", "CeramicRegrow"}, 68 | {"RainbowRegrowCamo", "CeramicRegrowCamo"}, 69 | {"Ceramic", "Moab"}, 70 | {"CeramicCamo", "Moab"}, 71 | {"CeramicRegrow", "Moab"}, 72 | {"CeramicRegrowCamo", "Moab"}, 73 | {"CeramicFortified", "MoabFortified"}, 74 | {"CeramicFortifiedCamo", "MoabFortified"}, 75 | {"CeramicRegrowFortified", "MoabFortified"}, 76 | {"CeramicRegrowFortifiedCamo", "MoabFortified"}, 77 | {"Moab", "Bfb"}, 78 | {"MoabFortified", "BfbFortified"}, 79 | {"Bfb", "Zomg"}, 80 | {"BfbFortified", "ZomgFortified"}, 81 | {"Zomg", "Ddt"}, 82 | {"ZomgFortified", "DdtFortified"}, 83 | {"DdtCamo", "Bad"}, 84 | {"DdtFortifiedCamo", "Bad"}, 85 | {"Bad", "BadFortified"} 86 | }; // surely there's a better way to do this.. 87 | 88 | // Set the name of your log file here 89 | extern const LPCWSTR LOG_FILE = L"il2cpp-log.txt"; 90 | 91 | std::string promoteBloon(std::string bloon) 92 | { 93 | if (bloon.find("Pink") != std::string::npos) 94 | { 95 | std::string mod = ""; 96 | if (bloon != "Pink") 97 | mod = bloon.substr(4, bloon.size() - 4); 98 | 99 | std::random_device r; 100 | std::uniform_int_distribution uniform_dist(1, 2); 101 | if (uniform_dist(r) == 1) 102 | return "White" + mod; 103 | else 104 | return "Black" + mod; 105 | } 106 | 107 | std::string finalBloon = promotionMap[bloon]; 108 | if (finalBloon.empty()) 109 | return bloon; 110 | 111 | return finalBloon; 112 | } 113 | 114 | // Injected code entry point 115 | void Run() 116 | { 117 | AllocConsole(); 118 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 119 | 120 | std::cout << "Initializing..." << std::endl; 121 | 122 | size_t size = 0; 123 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 124 | 125 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 126 | 127 | if (assembly == nullptr) 128 | { 129 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 130 | return; 131 | } 132 | 133 | Il2CppClass* gameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity", "Game"); 134 | FieldInfo* instance = il2cpp_class_get_field_from_name(gameClass, "instance"); 135 | Game* gameInstAddr = 0; 136 | il2cpp_field_static_get_value(instance, &gameInstAddr); 137 | 138 | if (gameInstAddr == NULL) 139 | { 140 | std::cout << "Some error occurred when trying to access the game model." << std::endl; 141 | return; 142 | } 143 | 144 | Game* gameInstance = (Game*)(gameInstAddr); 145 | 146 | RoundSetModel__Array* roundSetsArr = gameInstance->fields.model->fields.roundSets; 147 | RoundSetModel** roundSets = roundSetsArr->vector; 148 | for (int i = 0; i < roundSetsArr->max_length; ++i) 149 | { 150 | RoundModel__Array* roundsArr = roundSets[i]->fields.rounds; 151 | RoundModel** rounds = roundsArr->vector; 152 | for (int j = 0; j < roundsArr->max_length; ++j) 153 | { 154 | std::cout << "Round" << std::to_string(j + 1) << ":" << std::endl; 155 | BloonGroupModel__Array* groupsArr = rounds[j]->fields.groups; 156 | BloonGroupModel** groups = groupsArr->vector; 157 | for (int k = 0; k < groupsArr->max_length; ++k) 158 | { 159 | std::cout << BTD6API::StringUtils::toString(groups[k]->fields.bloon) << " > "; 160 | groups[k]->fields.bloon = (String*)il2cpp_string_new(promoteBloon(BTD6API::StringUtils::toString(groups[k]->fields.bloon)).c_str()); 161 | std::cout << BTD6API::StringUtils::toString(groups[k]->fields.bloon) << std::endl; 162 | } 163 | std::cout << "\n\n\n"; 164 | } 165 | } 166 | std::cout << "Patched all default/alternate rounds!" << std::endl; 167 | } -------------------------------------------------------------------------------- /Examples/RichPresence/main.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #include "pch.hpp" 5 | #include 6 | #include 7 | 8 | using namespace app; 9 | 10 | static void updatePresence(int selectedCoopPlayerCount, int currentRound, int health, int cash, std::string selectedDifficulty, std::string selectedMap, std::string selectedMode) 11 | { 12 | std::string details = "Cruising around the menus", state = "", largeImageText = ""; 13 | std::regex pascalSplit("(\\B[A-Z]+?(?=[A-Z][^A-Z])|\\B[A-Z]+?(?=[^A-Z]))"); // ya ik std::regex cring 14 | std::regex removeSpecialChar("[$ & +, :; = ? @# | '<>.-^*()%!]"); 15 | 16 | DiscordRichPresence discordPresence; 17 | memset(&discordPresence, 0, sizeof(discordPresence)); 18 | if (!selectedDifficulty.empty() && !selectedMap.empty() && !selectedMode.empty()) 19 | { 20 | if (selectedMode == "Clicks") 21 | { 22 | selectedMode = "CHIMPS"; 23 | } // difficulty still has the old Clicks name, change to CHIMPS 24 | if (selectedMap == "Tutorial") 25 | { 26 | selectedMap = "MonkeyMeadow"; 27 | } // change Tutorial (Monkey Meadow's internal name) to MonkeyMeadow 28 | 29 | details = "Playing " + std::regex_replace(selectedMap, pascalSplit, " $1"); 30 | if (selectedCoopPlayerCount > 0) 31 | { 32 | details += " with " + std::to_string(selectedCoopPlayerCount - 1) + " other people"; 33 | } 34 | 35 | state = "Round " + std::to_string(currentRound + 1) + ", $" + std::to_string(cash) + ", " + std::to_string(health) + " Lives"; 36 | largeImageText = selectedDifficulty + ", " + std::regex_replace(selectedMode, pascalSplit, " $1"); 37 | 38 | transform(selectedMap.begin(), selectedMap.end(), selectedMap.begin(), ::tolower); // change selectedMap to lower so we can get image key 39 | discordPresence.largeImageKey = std::regex_replace("mapselect" + selectedMap + "button", removeSpecialChar, "_").c_str(); // the std::regex for this one replaces all special characters with _; this is the same regex discord uses for image keys 40 | discordPresence.smallImageKey = "logo"; 41 | } // if player if fully in-game, RP = large image of map (tooltip of difficulty), small image of btd6 logo, details = map, state = round, lives, and cash 42 | else 43 | { 44 | discordPresence.largeImageKey = "logo"; 45 | discordPresence.smallImageKey = ""; 46 | } // if the condition doesn't pass, RP = large image of btd6 logo, details will be "Cruising around the menus" 47 | 48 | discordPresence.details = details.c_str(); 49 | discordPresence.state = state.c_str(); 50 | discordPresence.largeImageText = largeImageText.c_str(); 51 | discordPresence.instance = 0; 52 | Discord_UpdatePresence(&discordPresence); 53 | } 54 | 55 | static void initDiscord() 56 | { 57 | DiscordEventHandlers handlers; 58 | memset(&handlers, 0, sizeof(handlers)); 59 | 60 | Discord_Initialize("465015294122000387", &handlers, 1, NULL); 61 | } 62 | 63 | // Injected code entry point 64 | void Run() 65 | { 66 | initDiscord(); 67 | 68 | std::cout << "Initializing..." << std::endl; 69 | 70 | size_t size = 0; 71 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 72 | 73 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 74 | 75 | if (assembly == nullptr) 76 | { 77 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 78 | return; 79 | } 80 | 81 | while (true) 82 | { 83 | Il2CppClass* inGameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity.UI_New.InGame", "InGame"); 84 | Il2CppClass* konfuzeClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Utils", "KonFuze"); 85 | FieldInfo* instance = il2cpp_class_get_field_from_name(inGameClass, "instance"); 86 | 87 | InGame* inGameInstAddr = 0; 88 | il2cpp_field_static_get_value(instance, &inGameInstAddr); 89 | if (inGameInstAddr != NULL) 90 | { 91 | InGame* inGame = (InGame*)(inGameInstAddr); 92 | Helpers_InGameData inGameData = inGame->fields.inGameData; 93 | Simulation* simulation = inGame->fields.bridge->fields.simulation; 94 | Spawner* spawner = simulation->fields.map->fields.spawner; 95 | if (spawner != NULL) 96 | { 97 | // parameters for rich presence 98 | Simulation_CashManager* cashManager = simulation->fields.cashManagers->fields.entries->vector[0].value; 99 | if (cashManager != NULL) 100 | { 101 | // get konfuze values (current round, health, cash) 102 | double cash = BTD6API::KonFuze::get_Value(assembly->image, cashManager->fields.cash); 103 | double currentRound = BTD6API::KonFuze::get_Value(assembly->image, spawner->fields.currentRound); 104 | double lives = BTD6API::KonFuze::get_Value(assembly->image, simulation->fields.health); 105 | // get in-game data 106 | int selectedCoopPlayerCount = inGameData.selectedCoopPlayerCount; 107 | std::string selectedDifficulty = BTD6API::StringUtils::toString(inGameData.selectedDifficulty); 108 | std::string selectedMap = BTD6API::StringUtils::toString(inGameData.selectedMap); 109 | std::string selectedMode = BTD6API::StringUtils::toString(inGameData.selectedMode); 110 | updatePresence(selectedCoopPlayerCount, currentRound, lives, cash, selectedDifficulty, selectedMap, selectedMode); 111 | } 112 | } 113 | } 114 | else 115 | { 116 | updatePresence(-1, -1, -1, -1, "", "", ""); 117 | } 118 | 119 | #ifdef DISCORD_DISABLE_IO_THREAD 120 | Discord_UpdateConnection(); 121 | #endif 122 | Discord_RunCallbacks(); 123 | 124 | Sleep(15000); 125 | } 126 | Discord_Shutdown(); 127 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /BTD6API.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestDLL", "Examples\TestDLL\TestDLL.vcxproj", "{0B177D49-8E6C-4128-BB68-F33BF814F321}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RichPresence", "Examples\RichPresence\RichPresence.vcxproj", "{8882E4EA-8840-4B1F-8615-214FCB674490}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Randomizer", "Examples\Randomizer\Randomizer.vcxproj", "{52AD30E9-406E-4E73-A9B7-D5C7FF816754}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Speedhack", "Examples\Speedhack\Speedhack.vcxproj", "{99C37048-3FF6-4706-AA06-F1727C3F5190}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HypersonicTowers", "Examples\HypersonicTowers\HypersonicTowers.vcxproj", "{6DCB521C-2640-4DF7-B816-9215B3DE2CD1}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MasteryMode", "Examples\MasteryMode\MasteryMode.vcxproj", "{89618F74-2503-4B4E-92A7-3434C00271EC}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SharedPCH", "SharedPCH\SharedPCH.vcxproj", "{567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}" 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "il2cpp", "il2cpp", "{84B7505F-48B0-4015-8FBB-D5B324B6EA7A}" 21 | ProjectSection(SolutionItems) = preProject 22 | il2cpp\il2cpp-api-functions-ptr.h = il2cpp\il2cpp-api-functions-ptr.h 23 | il2cpp\il2cpp-api-functions.h = il2cpp\il2cpp-api-functions.h 24 | il2cpp\il2cpp-extra.h = il2cpp\il2cpp-extra.h 25 | il2cpp\il2cpp-functions.h = il2cpp\il2cpp-functions.h 26 | il2cpp\il2cpp-init.h = il2cpp\il2cpp-init.h 27 | il2cpp\il2cpp-types-ptr.h = il2cpp\il2cpp-types-ptr.h 28 | il2cpp\il2cpp-types.h = il2cpp\il2cpp-types.h 29 | il2cpp\il2cpp-utils.hpp = il2cpp\il2cpp-utils.hpp 30 | EndProjectSection 31 | EndProject 32 | Global 33 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 34 | Debug|Any CPU = Debug|Any CPU 35 | Debug|x64 = Debug|x64 36 | Debug|x86 = Debug|x86 37 | Release|Any CPU = Release|Any CPU 38 | Release|x64 = Release|x64 39 | Release|x86 = Release|x86 40 | EndGlobalSection 41 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 42 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Debug|Any CPU.ActiveCfg = Debug|Win32 43 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Debug|x64.ActiveCfg = Debug|x64 44 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Debug|x64.Build.0 = Debug|x64 45 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Debug|x86.ActiveCfg = Debug|Win32 46 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Debug|x86.Build.0 = Debug|Win32 47 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Release|Any CPU.ActiveCfg = Release|Win32 48 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Release|x64.ActiveCfg = Release|x64 49 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Release|x64.Build.0 = Release|x64 50 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Release|x86.ActiveCfg = Release|Win32 51 | {0B177D49-8E6C-4128-BB68-F33BF814F321}.Release|x86.Build.0 = Release|Win32 52 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Debug|Any CPU.ActiveCfg = Debug|Win32 53 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Debug|x64.ActiveCfg = Debug|x64 54 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Debug|x64.Build.0 = Debug|x64 55 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Debug|x86.ActiveCfg = Debug|Win32 56 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Debug|x86.Build.0 = Debug|Win32 57 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Release|Any CPU.ActiveCfg = Release|Win32 58 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Release|x64.ActiveCfg = Release|x64 59 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Release|x64.Build.0 = Release|x64 60 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Release|x86.ActiveCfg = Release|Win32 61 | {8882E4EA-8840-4B1F-8615-214FCB674490}.Release|x86.Build.0 = Release|Win32 62 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Debug|Any CPU.ActiveCfg = Debug|Win32 63 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Debug|x64.ActiveCfg = Debug|x64 64 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Debug|x64.Build.0 = Debug|x64 65 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Debug|x86.ActiveCfg = Debug|Win32 66 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Debug|x86.Build.0 = Debug|Win32 67 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Release|Any CPU.ActiveCfg = Release|Win32 68 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Release|x64.ActiveCfg = Release|x64 69 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Release|x64.Build.0 = Release|x64 70 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Release|x86.ActiveCfg = Release|Win32 71 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754}.Release|x86.Build.0 = Release|Win32 72 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Debug|Any CPU.ActiveCfg = Debug|Win32 73 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Debug|x64.ActiveCfg = Debug|x64 74 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Debug|x64.Build.0 = Debug|x64 75 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Debug|x86.ActiveCfg = Debug|Win32 76 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Debug|x86.Build.0 = Debug|Win32 77 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Release|Any CPU.ActiveCfg = Release|Win32 78 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Release|x64.ActiveCfg = Release|x64 79 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Release|x64.Build.0 = Release|x64 80 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Release|x86.ActiveCfg = Release|Win32 81 | {99C37048-3FF6-4706-AA06-F1727C3F5190}.Release|x86.Build.0 = Release|Win32 82 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Debug|Any CPU.ActiveCfg = Debug|Win32 83 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Debug|x64.ActiveCfg = Debug|x64 84 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Debug|x64.Build.0 = Debug|x64 85 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Debug|x86.ActiveCfg = Debug|Win32 86 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Debug|x86.Build.0 = Debug|Win32 87 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Release|Any CPU.ActiveCfg = Release|Win32 88 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Release|x64.ActiveCfg = Release|x64 89 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Release|x64.Build.0 = Release|x64 90 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Release|x86.ActiveCfg = Release|Win32 91 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1}.Release|x86.Build.0 = Release|Win32 92 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Debug|Any CPU.ActiveCfg = Debug|Win32 93 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Debug|x64.ActiveCfg = Debug|x64 94 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Debug|x64.Build.0 = Debug|x64 95 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Debug|x86.ActiveCfg = Debug|Win32 96 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Debug|x86.Build.0 = Debug|Win32 97 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Release|Any CPU.ActiveCfg = Release|Win32 98 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Release|x64.ActiveCfg = Release|x64 99 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Release|x64.Build.0 = Release|x64 100 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Release|x86.ActiveCfg = Release|Win32 101 | {89618F74-2503-4B4E-92A7-3434C00271EC}.Release|x86.Build.0 = Release|Win32 102 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Debug|Any CPU.ActiveCfg = Debug|Win32 103 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Debug|x64.ActiveCfg = Debug|x64 104 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Debug|x64.Build.0 = Debug|x64 105 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Debug|x86.ActiveCfg = Debug|Win32 106 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Debug|x86.Build.0 = Debug|Win32 107 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Release|Any CPU.ActiveCfg = Release|Win32 108 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Release|x64.ActiveCfg = Release|x64 109 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Release|x64.Build.0 = Release|x64 110 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Release|x86.ActiveCfg = Release|Win32 111 | {567C4DC5-7F4A-48EC-8CE1-75D3F74B15C0}.Release|x86.Build.0 = Release|Win32 112 | EndGlobalSection 113 | GlobalSection(SolutionProperties) = preSolution 114 | HideSolutionNode = FALSE 115 | EndGlobalSection 116 | GlobalSection(ExtensibilityGlobals) = postSolution 117 | SolutionGuid = {8D091891-5E97-4A95-ACC5-FAF9E04EA49A} 118 | EndGlobalSection 119 | EndGlobal 120 | -------------------------------------------------------------------------------- /Examples/TestDLL/TestDLL.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {0B177D49-8E6C-4128-BB68-F33BF814F321} 25 | TestDLL 26 | 10.0 27 | 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | 34 | Unicode 35 | v142 36 | 37 | 38 | DynamicLibrary 39 | false 40 | 41 | true 42 | Unicode 43 | v142 44 | 45 | 46 | DynamicLibrary 47 | true 48 | 49 | Unicode 50 | v142 51 | 52 | 53 | DynamicLibrary 54 | false 55 | 56 | true 57 | Unicode 58 | v142 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | .btd6mod 88 | 89 | 90 | true 91 | 92 | 93 | false 94 | .btd6mod 95 | 96 | 97 | 98 | Level3 99 | true 100 | WIN32;_DEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 101 | true 102 | NotUsing 103 | 104 | 105 | Windows 106 | true 107 | false 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 117 | true 118 | NotUsing 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | false 126 | 127 | 128 | 129 | 130 | Level3 131 | true 132 | _DEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 133 | true 134 | NotUsing 135 | 136 | 137 | Windows 138 | true 139 | false 140 | 141 | 142 | 143 | 144 | Level3 145 | true 146 | true 147 | true 148 | NDEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 149 | true 150 | NotUsing 151 | pch.h 152 | 153 | 154 | Windows 155 | true 156 | true 157 | true 158 | false 159 | 160 | 161 | 162 | 163 | 164 | NotUsing 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /Examples/Speedhack/Speedhack.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {99C37048-3FF6-4706-AA06-F1727C3F5190} 25 | Speedhack 26 | 10.0 27 | 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | 34 | Unicode 35 | v142 36 | 37 | 38 | DynamicLibrary 39 | false 40 | 41 | true 42 | Unicode 43 | v142 44 | 45 | 46 | DynamicLibrary 47 | true 48 | 49 | Unicode 50 | v142 51 | 52 | 53 | DynamicLibrary 54 | false 55 | 56 | true 57 | Unicode 58 | v142 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | .btd6mod 88 | 89 | 90 | true 91 | 92 | 93 | false 94 | .btd6mod 95 | 96 | 97 | 98 | Level3 99 | true 100 | WIN32;_DEBUG;SPEEDHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 101 | true 102 | NotUsing 103 | 104 | 105 | Windows 106 | true 107 | false 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;SPEEDHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 117 | true 118 | NotUsing 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | false 126 | 127 | 128 | 129 | 130 | Level3 131 | true 132 | _DEBUG;SPEEDHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 133 | true 134 | NotUsing 135 | 136 | 137 | Windows 138 | true 139 | false 140 | 141 | 142 | 143 | 144 | Level3 145 | true 146 | true 147 | true 148 | NDEBUG;SPEEDHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 149 | true 150 | NotUsing 151 | pch.h 152 | 153 | 154 | Windows 155 | true 156 | true 157 | true 158 | false 159 | 160 | 161 | 162 | 163 | 164 | NotUsing 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /Examples/MasteryMode/MasteryMode.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {89618F74-2503-4B4E-92A7-3434C00271EC} 25 | MasteryMode 26 | 10.0 27 | 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | 34 | Unicode 35 | v142 36 | 37 | 38 | DynamicLibrary 39 | false 40 | 41 | true 42 | Unicode 43 | v142 44 | 45 | 46 | DynamicLibrary 47 | true 48 | 49 | Unicode 50 | v142 51 | 52 | 53 | DynamicLibrary 54 | false 55 | 56 | true 57 | Unicode 58 | v142 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | .btd6mod 88 | 89 | 90 | true 91 | 92 | 93 | false 94 | .btd6mod 95 | 96 | 97 | 98 | Level3 99 | true 100 | WIN32;_DEBUG;MASTERYMODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 101 | true 102 | NotUsing 103 | 104 | 105 | Windows 106 | true 107 | false 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;MASTERYMODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 117 | true 118 | NotUsing 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | false 126 | 127 | 128 | 129 | 130 | Level3 131 | true 132 | _DEBUG;MASTERYMODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 133 | true 134 | NotUsing 135 | 136 | 137 | Windows 138 | true 139 | false 140 | 141 | 142 | 143 | 144 | Level3 145 | true 146 | true 147 | true 148 | NDEBUG;MASTERYMODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 149 | true 150 | NotUsing 151 | pch.h 152 | 153 | 154 | Windows 155 | true 156 | true 157 | true 158 | false 159 | 160 | 161 | 162 | 163 | 164 | NotUsing 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /SharedPCH/SharedPCH.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 25 | SharedPCH 26 | 10.0 27 | 28 | 29 | 30 | StaticLibrary 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | StaticLibrary 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | StaticLibrary 44 | true 45 | v142 46 | Unicode 47 | 48 | 49 | StaticLibrary 50 | false 51 | v142 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | true 79 | $(SharedPCHDir) 80 | 81 | 82 | false 83 | $(SharedPCHDir) 84 | 85 | 86 | true 87 | $(SharedPCHDir) 88 | 89 | 90 | false 91 | $(SharedPCHDir) 92 | 93 | 94 | 95 | Level3 96 | true 97 | WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 98 | true 99 | Use 100 | pch.hpp 101 | $(SharedPch) 102 | 103 | 104 | 105 | 106 | true 107 | 108 | 109 | 110 | 111 | Level3 112 | true 113 | true 114 | true 115 | WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 116 | true 117 | Use 118 | pch.hpp 119 | $(SharedPch) 120 | 121 | 122 | 123 | 124 | true 125 | true 126 | true 127 | 128 | 129 | 130 | 131 | Level3 132 | true 133 | _DEBUG;_LIB;%(PreprocessorDefinitions) 134 | true 135 | Use 136 | pch.hpp 137 | $(SharedPch) 138 | 139 | 140 | 141 | 142 | true 143 | 144 | 145 | 146 | 147 | Level3 148 | true 149 | true 150 | true 151 | NDEBUG;_LIB;%(PreprocessorDefinitions) 152 | true 153 | Use 154 | pch.hpp 155 | $(SharedPch) 156 | 157 | 158 | 159 | 160 | true 161 | true 162 | true 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | Create 171 | Create 172 | Create 173 | Create 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /Examples/HypersonicTowers/HypersonicTowers.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {6DCB521C-2640-4DF7-B816-9215B3DE2CD1} 25 | HypersonicTowers 26 | 10.0 27 | 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | 34 | Unicode 35 | v142 36 | 37 | 38 | DynamicLibrary 39 | false 40 | 41 | true 42 | Unicode 43 | v142 44 | 45 | 46 | DynamicLibrary 47 | true 48 | 49 | Unicode 50 | v142 51 | 52 | 53 | DynamicLibrary 54 | false 55 | 56 | true 57 | Unicode 58 | v142 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | .btd6mod 88 | 89 | 90 | true 91 | 92 | 93 | false 94 | .btd6mod 95 | 96 | 97 | 98 | Level3 99 | true 100 | WIN32;_DEBUG;HYPERSONICTOWERS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 101 | true 102 | NotUsing 103 | 104 | 105 | Windows 106 | true 107 | false 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;HYPERSONICTOWERS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 117 | true 118 | NotUsing 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | false 126 | 127 | 128 | 129 | 130 | Level3 131 | true 132 | _DEBUG;HYPERSONICTOWERS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 133 | true 134 | NotUsing 135 | 136 | 137 | Windows 138 | true 139 | false 140 | 141 | 142 | 143 | 144 | Level3 145 | true 146 | true 147 | true 148 | NDEBUG;HYPERSONICTOWERS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 149 | true 150 | NotUsing 151 | pch.h 152 | 153 | 154 | Windows 155 | true 156 | true 157 | true 158 | false 159 | 160 | 161 | 162 | 163 | 164 | NotUsing 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /Examples/Randomizer/Randomizer.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {52AD30E9-406E-4E73-A9B7-D5C7FF816754} 25 | Randomizer 26 | 10.0 27 | Randomizer 28 | 29 | 30 | 31 | 32 | DynamicLibrary 33 | true 34 | 35 | Unicode 36 | v142 37 | 38 | 39 | DynamicLibrary 40 | false 41 | 42 | true 43 | Unicode 44 | v142 45 | 46 | 47 | DynamicLibrary 48 | true 49 | 50 | Unicode 51 | v142 52 | 53 | 54 | DynamicLibrary 55 | false 56 | 57 | true 58 | Unicode 59 | v142 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | true 85 | 86 | 87 | false 88 | .btd6mod 89 | 90 | 91 | true 92 | 93 | 94 | false 95 | .btd6mod 96 | 97 | 98 | 99 | Level3 100 | true 101 | WIN32;_DEBUG;SPEEDYBLOONS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 102 | true 103 | NotUsing 104 | 105 | 106 | Windows 107 | true 108 | false 109 | 110 | 111 | 112 | 113 | Level3 114 | true 115 | true 116 | true 117 | WIN32;NDEBUG;SPEEDYBLOONS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 118 | true 119 | NotUsing 120 | 121 | 122 | Windows 123 | true 124 | true 125 | true 126 | false 127 | 128 | 129 | 130 | 131 | Level3 132 | true 133 | _DEBUG;SPEEDYBLOONS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 134 | true 135 | NotUsing 136 | 137 | 138 | Windows 139 | true 140 | false 141 | 142 | 143 | 144 | 145 | Level3 146 | true 147 | true 148 | true 149 | NDEBUG;SPEEDYBLOONS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 150 | true 151 | NotUsing 152 | pch.h 153 | 154 | 155 | Windows 156 | true 157 | true 158 | true 159 | false 160 | 161 | 162 | 163 | 164 | 165 | NotUsing 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /Examples/RichPresence/RichPresence.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | Win32Proj 24 | {8882E4EA-8840-4B1F-8615-214FCB674490} 25 | RichPresence 26 | 10.0 27 | 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | 34 | Unicode 35 | v142 36 | 37 | 38 | DynamicLibrary 39 | false 40 | 41 | true 42 | Unicode 43 | v142 44 | 45 | 46 | DynamicLibrary 47 | true 48 | 49 | Unicode 50 | v142 51 | 52 | 53 | DynamicLibrary 54 | false 55 | 56 | true 57 | Unicode 58 | v142 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | .btd6mod 88 | 89 | 90 | true 91 | 92 | 93 | false 94 | .btd6mod 95 | 96 | 97 | 98 | Level3 99 | true 100 | WIN32;_DEBUG;RICHPRESENCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 101 | true 102 | NotUsing 103 | include\discord-rpc\include;$(SolutionDir)SharedPCH 104 | 105 | 106 | Windows 107 | true 108 | false 109 | 110 | 111 | 112 | 113 | Level3 114 | true 115 | true 116 | true 117 | WIN32;NDEBUG;RICHPRESENCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 118 | true 119 | NotUsing 120 | include\discord-rpc\include;$(SolutionDir)SharedPCH 121 | 122 | 123 | Windows 124 | true 125 | true 126 | true 127 | false 128 | 129 | 130 | 131 | 132 | Level3 133 | true 134 | _DEBUG;RICHPRESENCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 135 | true 136 | NotUsing 137 | include\discord-rpc\include;$(SolutionDir)SharedPCH 138 | 139 | 140 | Windows 141 | true 142 | false 143 | 144 | 145 | 146 | 147 | Level3 148 | true 149 | true 150 | true 151 | NDEBUG;RICHPRESENCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 152 | true 153 | NotUsing 154 | pch.h 155 | include\discord-rpc\include;$(SolutionDir)SharedPCH 156 | 157 | 158 | Windows 159 | true 160 | true 161 | true 162 | false 163 | include\discord-rpc\lib 164 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;discord-rpc.lib;%(AdditionalDependencies) 165 | 166 | 167 | 168 | 169 | 170 | NotUsing 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | {567c4dc5-7f4a-48ec-8ce1-75d3f74b15c0} 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /Examples/Randomizer/main.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #include "pch.hpp" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace app; 11 | 12 | // 13 | // Randomizer mod 14 | // Randomizes Bloon speeds 15 | // 16 | 17 | int64_t g_seed = 0; 18 | 19 | enum DistType : uint8_t { 20 | RANDOM_UNIFORM = 0, 21 | RANDOM_NORMAL = 1 22 | }; 23 | 24 | enum OpType : uint8_t { 25 | OP_SET = 0, 26 | OP_MULTIPLY = 1, 27 | OP_ADD = 2 28 | }; 29 | 30 | template 31 | struct RandBounds { 32 | T min; 33 | T max; 34 | }; 35 | 36 | template 37 | struct RandStuff { 38 | std::default_random_engine generator; 39 | std::uniform_real_distribution udist; 40 | std::normal_distribution ndist; 41 | }; 42 | 43 | template 44 | struct Opt { 45 | bool isEnabled; 46 | DistType t; 47 | RandBounds bounds; 48 | OpType op_t; 49 | 50 | T clampVal(T val, T min_clamp, T max_clamp) { 51 | if (val < min_clamp) { 52 | std::cout << "Clamping " << val << " to " << min_clamp << std::endl; 53 | val = min_clamp; 54 | } 55 | if (val > max_clamp) { 56 | std::cout << "Clamping " << val << " to " << max_clamp << std::endl; 57 | val = max_clamp; 58 | } 59 | return val; 60 | } 61 | 62 | #pragma region Prompts 63 | void promptRandomization(const char* s) { 64 | std::string strOpt = ""; 65 | std::cout << "Do you want to Randomize " << s << " ? (Y/N)" << std::endl; 66 | std::cin >> strOpt; 67 | if (strOpt == "Y" || strOpt == "y") { 68 | std::cout << "Randomizing " << s << " Bloon Speeds!" << std::endl; 69 | isEnabled = true; 70 | return; 71 | } 72 | isEnabled = false; 73 | } 74 | 75 | void promptBounds(T min_clamp = 0, T max_clamp = std::numeric_limits::max()) { 76 | std::string min; 77 | std::string max; 78 | if (t == RANDOM_UNIFORM) { 79 | std::cout << "What do you want the min and max of the distrubtion to be?" << std::endl; 80 | std::cout << "Enter a minimum value" << std::endl; 81 | } 82 | else if (t == RANDOM_NORMAL) { 83 | std::cout << "What do you want the mean and sigma of the distrubtion to be?" << std::endl; 84 | std::cout << "Enter the Mean value" << std::endl; 85 | } 86 | 87 | for (;;) { 88 | std::cin >> min; 89 | try { 90 | if (sizeof(T) == 8) { 91 | // stod is probably bad, but it works 92 | double tempval = std::stod(min); 93 | bounds.min = static_cast(tempval); 94 | } 95 | else if (sizeof(T) == 4) { 96 | float tempval = std::stof(min); 97 | bounds.min = static_cast(tempval); 98 | } 99 | else { 100 | std::cout << "Invalid size!" << std::endl; 101 | } 102 | 103 | bounds.min = clampVal(bounds.min, min_clamp, max_clamp); 104 | break; 105 | } 106 | catch (std::exception e) { 107 | std::cout << "Please enter a valid number" << std::endl; 108 | continue; 109 | } 110 | } 111 | 112 | if (t == RANDOM_UNIFORM) { 113 | std::cout << "Enter a maxmimum value" << std::endl; 114 | } 115 | else if (t == RANDOM_NORMAL) { 116 | std::cout << "Enter the standard deviation" << std::endl; 117 | } 118 | 119 | for (;;) { 120 | std::cin >> max; 121 | try { 122 | if (sizeof(T) == 8) { 123 | // stod is probably bad, but it works 124 | double tempval = std::stod(max); 125 | bounds.max = static_cast(tempval); 126 | } 127 | else if (sizeof(T) == 4) { 128 | float tempval = std::stof(max); 129 | bounds.max = static_cast(tempval); 130 | } 131 | else { 132 | std::cout << "Invalid size!" << std::endl; 133 | } 134 | bounds.max = clampVal(bounds.max, min_clamp, max_clamp); 135 | break; 136 | } 137 | catch (std::exception e) { 138 | std::cout << "Please enter a valid number" << std::endl; 139 | continue; 140 | } 141 | } 142 | 143 | } 144 | 145 | void promptDistribution() { 146 | std::cout << "How do you want your random values to be distributed?" << std::endl; 147 | std::cout << "Default: (1) Uniform Distribution" << std::endl; 148 | std::cout << "(1) Uniform Distribution" << std::endl; 149 | std::cout << "(2) Normal Distribution" << std::endl; 150 | 151 | std::string strDist; 152 | 153 | for (;;) { 154 | int64_t temp_val; 155 | std::getline(std::cin, strDist); 156 | if (strDist == "") { 157 | std::cout << "Empty distribution entered, using default" << std::endl; 158 | t = RANDOM_UNIFORM; 159 | break; 160 | } 161 | try { 162 | temp_val = std::stoll(strDist); 163 | if (temp_val < 1 || temp_val > 2) { 164 | throw std::exception(); 165 | } 166 | t = (DistType)(temp_val - 1); 167 | break; 168 | } 169 | catch (std::exception e) { 170 | std::cout << "Please enter a valid distribution" << std::endl; 171 | continue; 172 | } 173 | } 174 | } 175 | 176 | void promptOp() { 177 | std::cout << "What operator do you want to have applied to your random values?" << std::endl; 178 | std::cout << "Default: (1) Set" << std::endl; 179 | std::cout << "(1) Set (speed = r). R of 5 means speed of 5" << std::endl; 180 | std::cout << "(2) Multiplied (speed *= r) If R=5 and speed=2, then output is 10" << std::endl; 181 | std::cout << "(3) Add (speed += r) If R=5 and speed=2, then output is 7 (Supports negatives!)" << std::endl; 182 | 183 | std::string strOp; 184 | 185 | for (;;) { 186 | int64_t temp_val; 187 | // WHy 2???? 188 | std::getline(std::cin, strOp); 189 | std::getline(std::cin, strOp); 190 | if (strOp == "") { 191 | std::cout << "Empty option entered, using default" << std::endl; 192 | op_t = OP_SET; 193 | break; 194 | } 195 | try { 196 | temp_val = std::stoll(strOp); 197 | if (temp_val < 1 || temp_val > 3) { 198 | std::cout << "Please enter a valid value" << std::endl; 199 | continue; 200 | } 201 | op_t = (OpType)(temp_val - 1); 202 | break; 203 | } 204 | catch (std::exception e) { 205 | std::cout << "Please enter a valid value" << std::endl; 206 | continue; 207 | } 208 | } 209 | } 210 | #pragma endregion 211 | 212 | T doOp(T& a, T b) { 213 | switch (op_t) { 214 | case OP_SET: 215 | a = b; 216 | break; 217 | case OP_MULTIPLY: 218 | return a *= b; 219 | break; 220 | case OP_ADD: 221 | return a += b; 222 | break; 223 | default: 224 | std::cout << "Oophsie Whoopsie when choosing operator."; 225 | return 0; 226 | } 227 | } 228 | 229 | RandStuff* r; 230 | 231 | Opt() { r = new RandStuff; r->generator = std::default_random_engine(g_seed); }; 232 | ~Opt() { delete r; } 233 | 234 | T GetRand(T min_clamp = 0, T max_clamp = std::numeric_limits::max()) { 235 | if (t == RANDOM_UNIFORM) { 236 | r->udist = std::uniform_real_distribution(bounds.min, bounds.max); 237 | T val = r->udist(r->generator); 238 | return clampVal(val, min_clamp, max_clamp); 239 | } 240 | else if (t == RANDOM_NORMAL) { 241 | r->ndist = std::normal_distribution(bounds.min, bounds.max); 242 | T val = r->ndist(r->generator); 243 | return clampVal(val, min_clamp, max_clamp); 244 | } 245 | else { 246 | throw std::exception("Get Rand has invalid type!"); 247 | } 248 | } 249 | }; 250 | 251 | struct Options { 252 | size_t seed; 253 | 254 | Opt BloonSpeeds; 255 | Opt FireRate; 256 | 257 | Options* fromString(std::string s) { 258 | if (s.length() % 2 != 0) { 259 | std::cout << "Error! String was not valid" << std::endl; 260 | } 261 | 262 | Options* ret = new Options; 263 | 264 | for (auto i = 0; i < s.length(); i += 2) { 265 | reinterpret_cast(ret)[i] = static_cast(std::stoi(std::string("" + s[i]))); 266 | reinterpret_cast(ret)[i + 1] = static_cast(std::stoi(std::string("" + s[i + 1]))); 267 | } 268 | 269 | return ret; 270 | } 271 | 272 | std::string toString(Options* opt) { 273 | std::stringstream ss; 274 | ss << std::hex; 275 | 276 | for (auto i = 0; i < sizeof(Options); ++i) { 277 | ss << std::setw(2) << std::setfill('0') << (int)(reinterpret_cast(opt))[i]; 278 | } 279 | 280 | return ss.str(); 281 | } 282 | }; 283 | 284 | const float BLOON_MIN_SPEED = 0.05; 285 | 286 | void RandomizeBloonSpeeds(GameModel* gmdl, Options& opt) { 287 | opt.BloonSpeeds.promptOp(); 288 | opt.BloonSpeeds.promptDistribution(); 289 | opt.BloonSpeeds.promptBounds(); 290 | 291 | BloonModel__Array* bloonModelArr = gmdl->fields.bloons; 292 | BloonModel** bloonModels = bloonModelArr->vector; 293 | 294 | for (int i = 0; i < bloonModelArr->max_length; ++i) 295 | { 296 | if (bloonModels[i] != NULL) 297 | { 298 | if (bloonModels[i]->fields.display != NULL) { 299 | float oldSpeed = bloonModels[i]->fields.speed; 300 | opt.BloonSpeeds.doOp(bloonModels[i]->fields.speed, opt.BloonSpeeds.GetRand(BLOON_MIN_SPEED)); 301 | //wchar_t* display = (wchar_t*)(&bloonModels[i]->fields.display->fields.m_firstChar); 302 | // This is broken for some reason 303 | std::wcout << "Speed was: " << oldSpeed << ", Speed now is: " << bloonModels[i]->fields.speed << std::endl; 304 | } 305 | } 306 | } 307 | 308 | std::cout << "Speedy Bloons sucesfully changed bloons speed!" << std::endl; 309 | } 310 | 311 | // 312 | // Randomize stuff yoinked from hypersonic 313 | // 314 | 315 | void RandomizeWeaponRate(AttackModel* attack, Options& opt) { 316 | WeaponModel__Array* weaponsArr = attack->fields.weapons; 317 | WeaponModel** weapons = weaponsArr->vector; 318 | 319 | for (int k = 0; k < weaponsArr->max_length; ++k) 320 | { 321 | WeaponModel* weapon = weapons[k]; 322 | 323 | if (weapon != NULL) 324 | { 325 | float oldSpeed = weapon->fields.rate; 326 | opt.FireRate.doOp(weapon->fields.rate, opt.FireRate.GetRand()); 327 | 328 | // std::wcout << "Speed was: " << oldSpeed << ", Speed now is: " << weapon->fields.rate << std::endl; 329 | } 330 | } 331 | } 332 | 333 | void RandomizeTowerRate(TowerModel* tmdl, Options& opt) { 334 | Model__Array* modelsArr = tmdl->fields.behaviors; 335 | Model** models = modelsArr->vector; 336 | if (models != NULL) 337 | { 338 | for (int i = 0; i < modelsArr->max_length; ++i) 339 | { 340 | Model* model = models[i]; 341 | if (model != NULL && model->fields.name != NULL) 342 | { 343 | 344 | std::wstring name = BTD6API::StringUtils::toWideString(model->fields.name); 345 | 346 | // This hero works differently to literally everything else in the game. 347 | if (name.find(L"AbilityModel_UCAVAbility") != std::wstring::npos) { 348 | AbilityModel* ab = (AbilityModel*)model; 349 | 350 | for (int j = 0; j < ab->fields.behaviors->max_length; ++j) { 351 | Model* bm = ab->fields.behaviors->vector[j]; 352 | 353 | std::wstring modelName = BTD6API::StringUtils::toWideString(bm->fields.name); 354 | 355 | if (modelName.find(L"UCAVModel") != std::wstring::npos) { 356 | UCAVModel* mdl = (UCAVModel*)(bm); 357 | RandomizeTowerRate(mdl->fields.uavTowerModel, opt); 358 | RandomizeTowerRate(mdl->fields.ucavTowerModel, opt); 359 | } 360 | } 361 | } 362 | 363 | if (name.find(L"DroneSupportModel") != std::wstring::npos) { 364 | DroneSupportModel* dsm = (DroneSupportModel*)(model); 365 | RandomizeTowerRate(dsm->fields.droneModel, opt); 366 | } 367 | 368 | if (name.find(L"AttackModel") != std::wstring::npos || name.find(L"AttackAirUnitModel") != std::wstring::npos) 369 | { 370 | AttackModel* attack = (AttackModel*)model; 371 | RandomizeWeaponRate(attack, opt); 372 | } 373 | } 374 | } 375 | } 376 | } 377 | 378 | void RandomizeTowerRate(GameModel* gmdl, Options& opt) { 379 | opt.FireRate.promptOp(); 380 | opt.FireRate.promptDistribution(); 381 | opt.FireRate.promptBounds(); 382 | 383 | TowerModel__Array* towersArr = gmdl->fields.towers; 384 | TowerModel** towers = towersArr->vector; 385 | 386 | for (int i = 0; i < towersArr->max_length; ++i) 387 | { 388 | if (towers[i]->fields.display != NULL) 389 | { 390 | RandomizeTowerRate(towers[i], opt); 391 | } 392 | } 393 | } 394 | 395 | 396 | void RandomizeGameModel(GameModel* gmdl, const std::string& where) 397 | { 398 | std::cout << "Randomizer Initialized!" << std::endl; 399 | std::cout << "Using (" << where << ")" << "model" << std::endl; 400 | 401 | std::string strSeed; 402 | 403 | std::cout << "Please enter a seed (" << 404 | std::numeric_limits::min() << " - " << 405 | std::numeric_limits::max() << ")" << std::endl; 406 | 407 | for (;;) { 408 | std::getline(std::cin, strSeed); 409 | if (strSeed == "") { 410 | std::cout << "Empty seed entered, using system time!" << std::endl; 411 | g_seed = std::chrono::system_clock::now().time_since_epoch().count(); 412 | break; 413 | } 414 | try { 415 | g_seed = std::stoll(strSeed); 416 | break; 417 | } 418 | catch (std::exception e) { 419 | std::cout << "Please enter a valid seed" << std::endl; 420 | continue; 421 | } 422 | } 423 | 424 | std::cout << "Seed is: " << g_seed << std::endl; 425 | 426 | Options opt = Options(); 427 | opt.BloonSpeeds.promptRandomization("Bloon Speeds"); 428 | if (opt.BloonSpeeds.isEnabled) { 429 | RandomizeBloonSpeeds(gmdl, opt); 430 | } 431 | 432 | opt.FireRate.promptRandomization("Fire rates"); 433 | if (opt.FireRate.isEnabled) { 434 | RandomizeTowerRate(gmdl, opt); 435 | } 436 | 437 | std::cout << "Randomizing Bloon Speeds!" << g_seed << std::endl; 438 | 439 | //std::cout << "funny1" << sizeof(Options) << std::endl; 440 | //std::cout << "funny2: " << opt.toString(&opt) << std::endl; 441 | 442 | } 443 | 444 | // Injected code entry point 445 | void Run() 446 | { 447 | AllocConsole(); 448 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 449 | freopen_s((FILE**)stdin, "CONIN$", "r", stdin); 450 | 451 | std::cout << "Initializing Randomizer!" << std::endl; 452 | 453 | size_t size = 0; 454 | const Il2CppAssembly** assemblies = il2cpp_domain_get_assemblies(nullptr, &size); 455 | 456 | const Il2CppAssembly* assembly = BTD6API::Assembly::get(assemblies, "Assembly-CSharp", size); 457 | 458 | if (assembly == nullptr) 459 | { 460 | std::cout << "Error: Assembly-CSharp not found." << std::endl; 461 | return; 462 | } 463 | 464 | // do in-game patches (will need to patch InGame if user is currently in-game, just patching Game will do nothing in that case) 465 | Il2CppClass* inGameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity.UI_New.InGame", "InGame"); 466 | FieldInfo* inGameInstanceInfo = il2cpp_class_get_field_from_name(inGameClass, "instance"); 467 | InGame* inGameInstAddr = 0; 468 | il2cpp_field_static_get_value(inGameInstanceInfo, &inGameInstAddr); 469 | 470 | if (inGameInstAddr != NULL) 471 | { 472 | InGame* inGameInstance = (InGame*)inGameInstAddr; 473 | RandomizeGameModel(inGameInstance->fields.bridge->fields.simulation->fields.model, "in-game"); 474 | } 475 | // game patches 476 | Il2CppClass* gameClass = il2cpp_class_from_name(assembly->image, "Assets.Scripts.Unity", "Game"); 477 | FieldInfo* gameInstanceInfo = il2cpp_class_get_field_from_name(gameClass, "instance"); 478 | Game* gameInstAddr = 0; 479 | il2cpp_field_static_get_value(gameInstanceInfo, &gameInstAddr); 480 | 481 | if (gameInstAddr == NULL) 482 | { 483 | std::cout << "Some error occurred when trying to access the game model." << std::endl; 484 | return; 485 | } 486 | 487 | Game* gameInstance = (Game*)gameInstAddr; 488 | RandomizeGameModel(gameInstance->fields.model, "game"); 489 | 490 | //std::cout << "Randomizer Randomier succesfully!" << std::endl; 491 | 492 | } --------------------------------------------------------------------------------