├── LICENSE ├── README.md ├── Star-Rail-GC.sln ├── Star-Rail-GC.vcxproj ├── Star-Rail-GC.vcxproj.filters ├── Star-Rail-GC.vcxproj.user ├── game.h ├── globals.cpp ├── globals.h ├── hooks.cpp ├── hooks.h ├── injector ├── injector.vcxproj ├── injector.vcxproj.filters ├── injector.vcxproj.user └── main.cpp ├── main.cpp ├── main.h ├── menu.cpp ├── menu.h ├── minhook.h ├── minhook.lib ├── typedef.h └── utils.h /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 rajapipis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Need to find New offset/base address 2 | 3 | # Star-rail-menu-mod 4 | A star rail menu mod for windows,credits by z4ee..thank you z4ee..This repository provides code for a simple cheat for the game Honkai Star Rail 5 | 6 | if you got banned then make a issue,if you have solution then give solution in issue,discussions or discord 7 | # Link Discord 8 |

9 | 10 |

11 | Discord: https://discord.gg/YYtWam5e6g 12 | 13 | # Screenshot 14 | 15 | 16 | ![cmd cit](https://github.com/rajapipis/Star-rail-menu-mod/assets/133135016/fd69b25b-154c-4cb0-8b55-1f9a7aa0ab4a) 17 | -------------------------------------------------------------------------------- /Star-Rail-GC.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33530.505 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "star_rail", "Star-Rail-GC.vcxproj", "{C18A2025-BBDF-427E-A186-303C11582DDC}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "injector", "injector\injector.vcxproj", "{749B125B-AD11-4240-9585-B6063F160CE8}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Debug|x64.ActiveCfg = Release|x64 19 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Debug|x64.Build.0 = Release|x64 20 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Debug|x86.ActiveCfg = Release|x64 21 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Debug|x86.Build.0 = Release|x64 22 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Release|x64.ActiveCfg = Release|x64 23 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Release|x64.Build.0 = Release|x64 24 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Release|x86.ActiveCfg = Release|x64 25 | {C18A2025-BBDF-427E-A186-303C11582DDC}.Release|x86.Build.0 = Release|x64 26 | {749B125B-AD11-4240-9585-B6063F160CE8}.Debug|x64.ActiveCfg = Debug|x64 27 | {749B125B-AD11-4240-9585-B6063F160CE8}.Debug|x64.Build.0 = Debug|x64 28 | {749B125B-AD11-4240-9585-B6063F160CE8}.Debug|x86.ActiveCfg = Debug|Win32 29 | {749B125B-AD11-4240-9585-B6063F160CE8}.Debug|x86.Build.0 = Debug|Win32 30 | {749B125B-AD11-4240-9585-B6063F160CE8}.Release|x64.ActiveCfg = Release|x64 31 | {749B125B-AD11-4240-9585-B6063F160CE8}.Release|x64.Build.0 = Release|x64 32 | {749B125B-AD11-4240-9585-B6063F160CE8}.Release|x86.ActiveCfg = Release|Win32 33 | {749B125B-AD11-4240-9585-B6063F160CE8}.Release|x86.Build.0 = Release|Win32 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(ExtensibilityGlobals) = postSolution 39 | SolutionGuid = {12A74FD8-6428-4C01-9FD9-443F96C2F96A} 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /Star-Rail-GC.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Release 6 | x64 7 | 8 | 9 | 10 | 16.0 11 | Win32Proj 12 | {c18a2025-bbdf-427e-a186-303c11582ddc} 13 | StarRailGC 14 | 10.0 15 | star_rail 16 | 17 | 18 | 19 | DynamicLibrary 20 | false 21 | v143 22 | true 23 | Unicode 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Level3 37 | true 38 | true 39 | true 40 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 41 | true 42 | %(AdditionalIncludeDirectories) 43 | 44 | 45 | Console 46 | true 47 | true 48 | true 49 | minhook.lib;%(AdditionalDependencies) 50 | %(AdditionalLibraryDirectories) 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Star-Rail-GC.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Исходные файлы 12 | 13 | 14 | Исходные файлы 15 | 16 | 17 | Исходные файлы 18 | 19 | 20 | Исходные файлы 21 | 22 | 23 | 24 | 25 | Исходные файлы 26 | 27 | 28 | Исходные файлы 29 | 30 | 31 | Исходные файлы 32 | 33 | 34 | Исходные файлы 35 | 36 | 37 | Исходные файлы 38 | 39 | 40 | Исходные файлы 41 | 42 | 43 | Исходные файлы 44 | 45 | 46 | -------------------------------------------------------------------------------- /Star-Rail-GC.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef enum GamePhase 4 | { 5 | RPG_LOGIN = 7, 6 | RPG_WORLD = 12, 7 | RPG_BATTLE = 15, 8 | }; -------------------------------------------------------------------------------- /globals.cpp: -------------------------------------------------------------------------------- 1 | #include "globals.h" 2 | 3 | namespace globals { 4 | bool speedhack = 0; 5 | bool peeking = 0; 6 | bool blind = 0; 7 | bool fps_unlock = 0; 8 | bool auto_battle = 0; 9 | bool auto_dialogue = 0; 10 | } 11 | -------------------------------------------------------------------------------- /globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace globals { 4 | extern bool speedhack; 5 | extern bool peeking; 6 | extern bool blind; 7 | extern bool fps_unlock; 8 | extern bool auto_battle; 9 | extern bool auto_dialogue; 10 | } 11 | -------------------------------------------------------------------------------- /hooks.cpp: -------------------------------------------------------------------------------- 1 | #include "minhook.h" 2 | #include "hooks.h" 3 | #include "menu.h" 4 | #include "utils.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typedef.h" 11 | #include "globals.h" 12 | 13 | namespace hooks { 14 | bool create_hook(HookData& data, uintptr_t GameAssembly); 15 | 16 | namespace anti_cheat { 17 | HANDLE WINAPI h_CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) 18 | { 19 | if (memcmp(lpFileName, L"\\\\.\\ACE-BASE", 24) == 0) { 20 | wprintf(L"Thread (%i) attempting to communicate with anti-cheat driver -> %s\n", GetCurrentThreadId(), lpFileName); 21 | 22 | SuspendThread(GetCurrentThread()); // 200iq bypass for memory protection 23 | } 24 | 25 | return p_CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); 26 | } 27 | } 28 | 29 | namespace game { 30 | int current_phase = 0; 31 | 32 | int get_currect_phase() { 33 | return current_phase; 34 | } 35 | 36 | __int64 __fastcall h_setcurrentphase(__int64 a1, int a2, __int64 a3, char a4) { 37 | current_phase = a2; 38 | 39 | return o_setcurrentphase(a1, a2, a3, a4); 40 | } 41 | 42 | char __fastcall h_setautobattleflag(__int64 a1, unsigned __int8 a2) { 43 | return o_setautobattleflag(a1, a2); 44 | } 45 | 46 | __int64 __fastcall h_isautobattle(__int64 a1) { 47 | auto ret = o_isautobattle(a1); 48 | 49 | if (!ret && globals::auto_battle) { 50 | h_setautobattleflag(a1, 1); 51 | } 52 | 53 | return ret; 54 | } 55 | } 56 | 57 | std::vector v_hooks{ 58 | {"setcurrentphase", 0x5B9E130, &game::h_setcurrentphase, &o_setcurrentphase}, 59 | {"isautobattle", 0x512F580, &game::h_isautobattle, &o_isautobattle}, 60 | {"setautobattleflag", 0x5130040,&game::h_setautobattleflag,&o_setautobattleflag}, 61 | }; 62 | 63 | void init() { 64 | 65 | 66 | if (MH_Initialize() != MH_OK) 67 | { 68 | puts("Error initializing MinHook library"); 69 | 70 | return; 71 | } 72 | 73 | if (MH_CreateHookApiEx(L"kernelbase", "CreateFileW", &anti_cheat::h_CreateFileW, reinterpret_cast(&p_CreateFileW), reinterpret_cast(&t_CreateFileW)) != MH_OK) 74 | { 75 | puts("Error creating hook for CreateFileW function"); 76 | 77 | return; 78 | } 79 | 80 | if (MH_EnableHook(t_CreateFileW) != MH_OK) 81 | { 82 | puts("Error enabling hook for CreateFileW function"); 83 | 84 | return; 85 | } 86 | 87 | puts("waiting game module.."); 88 | 89 | uintptr_t base_address = 0; 90 | 91 | while (!base_address) base_address = reinterpret_cast(GetModuleHandleA("gameassembly.dll")); 92 | 93 | // mega deadcode 94 | 95 | if (utils::read(base_address + v_hooks[0].rva) != 0x48) { 96 | v_hooks[0].rva = 0x5B9DFD0; 97 | } 98 | 99 | puts("hooks setup.."); 100 | 101 | for (auto& hook : v_hooks) { 102 | if (!create_hook(hook, base_address)) { 103 | return; 104 | } 105 | } 106 | 107 | puts("hooks successfully created!"); 108 | 109 | menu::menu(); 110 | 111 | return; 112 | } 113 | 114 | bool create_hook(HookData& data, uintptr_t GameAssembly) { 115 | 116 | auto address = reinterpret_cast(GameAssembly + data.rva); 117 | 118 | 119 | if (MH_CreateHook(address, data.hook, reinterpret_cast(data.original)) != MH_OK) { 120 | printf("Error creating hook for %s\n", data.name.c_str()); 121 | return false; 122 | } 123 | 124 | if (MH_EnableHook(address) != MH_OK) { 125 | printf("Error enabling hook for %s function\n", data.name.c_str()); 126 | return false; 127 | } 128 | 129 | return true; 130 | } 131 | } -------------------------------------------------------------------------------- /hooks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace hooks { 5 | namespace game { 6 | int get_currect_phase(); 7 | } 8 | 9 | void init(); 10 | } -------------------------------------------------------------------------------- /injector/injector.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 | {749b125b-ad11-4240-9585-b6063f160ce8} 25 | injector 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 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 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | 84 | 85 | 86 | 87 | Level3 88 | true 89 | true 90 | true 91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | stdcpp20 122 | 123 | 124 | Console 125 | true 126 | true 127 | true 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /injector/injector.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;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 | -------------------------------------------------------------------------------- /injector/injector.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /injector/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #define _CRT_SECURE_NO_WARNINGS 8 | namespace fs = std::filesystem; 9 | 10 | namespace util 11 | { 12 | void log(const char* fmt, std::string args) 13 | { 14 | printf("[star railer] "); 15 | printf(fmt, args); 16 | } 17 | 18 | void logdialog(const char* fmt) 19 | { 20 | const char* errordialogformat = "CS.LAMLMFNDPHJ.HAFGEFPIKFK(\"%s\",\"star railer\")"; 21 | char errordialogtext[256]; 22 | snprintf(errordialogtext, sizeof(errordialogtext), errordialogformat, fmt); 23 | printf(errordialogtext); 24 | } 25 | } 26 | 27 | bool InjectStandard(HANDLE hTarget, const std::string& dllPath) 28 | { 29 | LPVOID loadlib = GetProcAddress(GetModuleHandle(L"kernel32"), "LoadLibraryA"); 30 | 31 | if (loadlib == nullptr) 32 | { 33 | std::cout << "Failed to get LoadLibraryA address. GetLastError(): " << GetLastError() << "\n"; 34 | return false; 35 | } 36 | 37 | LPVOID dllPathAddr = VirtualAllocEx(hTarget, NULL, dllPath.size() + 1, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); 38 | 39 | if (dllPathAddr == nullptr) 40 | { 41 | std::cout << "Failed allocating memory in the target process. GetLastError(): " << GetLastError() << "\n"; 42 | return false; 43 | } 44 | 45 | if (!WriteProcessMemory(hTarget, dllPathAddr, dllPath.c_str(), dllPath.size() + 1, NULL)) 46 | { 47 | std::cout << "Failed writing to process. GetLastError(): " << GetLastError() << "\n"; 48 | VirtualFreeEx(hTarget, dllPathAddr, 0, MEM_RELEASE); // Free memory on failure 49 | return false; 50 | } 51 | 52 | HANDLE hThread = CreateRemoteThread(hTarget, NULL, NULL, (LPTHREAD_START_ROUTINE)loadlib, dllPathAddr, NULL, NULL); 53 | 54 | if (hThread == nullptr) 55 | { 56 | std::cout << "Failed to create a thread in the target process. GetLastError(): " << GetLastError() << "\n"; 57 | VirtualFreeEx(hTarget, dllPathAddr, 0, MEM_RELEASE); // Free memory on failure 58 | return false; 59 | } 60 | 61 | WaitForSingleObject(hThread, INFINITE); 62 | 63 | DWORD exit_code = 0; 64 | GetExitCodeThread(hThread, &exit_code); 65 | 66 | VirtualFreeEx(hTarget, dllPathAddr, 0, MEM_RELEASE); 67 | CloseHandle(hThread); 68 | 69 | if (exit_code == 0) 70 | { 71 | std::cout << "LoadLibrary failed.\n"; 72 | return false; 73 | } 74 | return true; 75 | } 76 | 77 | 78 | std::optional read_whole_file(const fs::path& file) 79 | try 80 | { 81 | std::stringstream buf; 82 | std::ifstream ifs(file); 83 | if (!ifs.is_open()) 84 | return std::nullopt; 85 | ifs.exceptions(std::ios::failbit); 86 | buf << ifs.rdbuf(); 87 | return buf.str(); 88 | } 89 | catch (const std::ios::failure&) 90 | { 91 | return std::nullopt; 92 | } 93 | 94 | std::optional this_dir() 95 | { 96 | HMODULE mod = NULL; 97 | TCHAR path[MAX_PATH]{}; 98 | if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)&this_dir, &mod)) 99 | { 100 | printf("GetModuleHandleEx failed (%i)\n", GetLastError()); 101 | return std::nullopt; 102 | } 103 | 104 | if (!GetModuleFileName(mod, path, MAX_PATH)) 105 | { 106 | printf("GetModuleFileName failed (%i)\n", GetLastError()); 107 | return std::nullopt; 108 | } 109 | 110 | return fs::path(path).remove_filename(); 111 | } 112 | 113 | int main() 114 | { 115 | auto current_dir = this_dir(); 116 | if (!current_dir) 117 | return 0; 118 | 119 | auto dll_path = current_dir.value() / "star_rail.dll"; 120 | if (!fs::is_regular_file(dll_path)) 121 | { 122 | std::cout << "DLL not found" << std::endl; 123 | system("pause"); 124 | return 0; 125 | } 126 | 127 | std::string exe_path; 128 | auto settings_path = current_dir.value() / "settings.txt"; 129 | 130 | if (!fs::is_regular_file(settings_path)) 131 | { 132 | std::ofstream settings_file("settings.txt", std::ios_base::app); 133 | if (!settings_file) 134 | { 135 | std::cout << "Error: Unable to create settings file." << std::endl; 136 | return 1; 137 | } 138 | 139 | settings_file << exe_path << std::endl; 140 | settings_file.close(); 141 | } 142 | 143 | auto settings = read_whole_file(settings_path); 144 | if (!settings) 145 | { 146 | std::cout << "Failed reading settings.txt" << std::endl; 147 | system("pause"); 148 | return 0; 149 | } 150 | 151 | std::getline(std::stringstream(settings.value()), exe_path); 152 | 153 | if (!fs::is_regular_file(exe_path)) 154 | { 155 | std::cout << "File path in settings.txt invalid" << std::endl; 156 | std::cout << "Please select your Game Executable" << std::endl; 157 | 158 | OPENFILENAMEA ofn{}; 159 | char szFile[260]{}; 160 | ZeroMemory(&ofn, sizeof(ofn)); 161 | ofn.lStructSize = sizeof(ofn); 162 | ofn.lpstrFile = szFile; 163 | ofn.lpstrFile[0] = '\0'; 164 | ofn.hwndOwner = NULL; 165 | ofn.nMaxFile = sizeof(szFile); 166 | ofn.lpstrFilter = "Executable Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; 167 | ofn.nFilterIndex = 1; 168 | ofn.lpstrTitle = "Select Executable File"; 169 | ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; 170 | 171 | if (!GetOpenFileNameA(&ofn)) 172 | { 173 | std::cout << "Error: Unable to open file dialog." << std::endl; 174 | return 1; 175 | } 176 | 177 | exe_path = ofn.lpstrFile; 178 | 179 | std::ofstream settings_file("settings.txt", std::ios_base::out); 180 | if (!settings_file) 181 | { 182 | std::cout << "Error: Unable to open settings file." << std::endl; 183 | return 1; 184 | } 185 | 186 | settings_file << exe_path << std::endl; 187 | settings_file.close(); 188 | } 189 | 190 | PROCESS_INFORMATION proc_info{}; 191 | STARTUPINFOA startup_info{}; 192 | CreateProcessA(exe_path.c_str(), NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup_info, &proc_info); 193 | 194 | if (InjectStandard(proc_info.hProcess, dll_path.string())) 195 | { 196 | std::cout << "LoadLibrary Success!" << std::endl; 197 | } 198 | else 199 | { 200 | std::cout << "LoadLibrary Failed!" << std::endl; 201 | } 202 | 203 | ResumeThread(proc_info.hThread); 204 | CloseHandle(proc_info.hThread); 205 | CloseHandle(proc_info.hProcess); 206 | 207 | return 0; 208 | } 209 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | BOOL DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 4 | { 5 | if (fdwReason == DLL_PROCESS_ATTACH) { 6 | 7 | auto base_address = reinterpret_cast(GetModuleHandleA("starrailbase.dll")); //version 1.0.5 8 | 9 | utils::write(base_address + 0xFCDC0, 0xCCC3C031); 10 | utils::write(base_address + 0xF9940, 0xC3); 11 | utils::write(base_address + 0x1BCBA0, 0xFEEB); 12 | 13 | AllocConsole(); 14 | 15 | FILE* file_out; 16 | FILE* file_in; 17 | 18 | errno_t err_out = freopen_s(&file_out, "CONOUT$", "w", stdout); 19 | errno_t err_in = freopen_s(&file_in, "CONIN$", "r", stdin); 20 | 21 | if (err_out == 0 || err_in == 0) { 22 | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)hooks::init, 0, 0, 0); 23 | } 24 | } 25 | 26 | return TRUE; 27 | } 28 | -------------------------------------------------------------------------------- /main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "hooks.h" 7 | #include "utils.h" -------------------------------------------------------------------------------- /menu.cpp: -------------------------------------------------------------------------------- 1 | #include "menu.h" 2 | #include "hooks.h" 3 | 4 | #include 5 | #include 6 | 7 | #include "utils.h" 8 | 9 | #include "game.h" 10 | 11 | #include "globals.h" 12 | 13 | using namespace globals; 14 | 15 | 16 | namespace menu { 17 | 18 | static float speed = 1.f; 19 | static HWND window = 0; 20 | __int64 game_assembly = 0; 21 | __int64 unity_player = 0; 22 | 23 | void set_speed_global(float speed) { 24 | utils::write(utils::read<__int64>(unity_player + 0x1D21D78) + 0xFC, speed); 25 | } 26 | 27 | void set_speed_battle(float speed) { 28 | utils::write(utils::read<__int64>(utils::read<__int64>(game_assembly + 0x8CAA6A0) + 0xC0) + 0x1DC, speed); 29 | } 30 | 31 | void set_speed(float speed) { 32 | if (auto_dialogue) {//new 2 33 | set_speed_battle(1.f); 34 | set_speed_global(10.f); 35 | } 36 | else if (hooks::game::get_currect_phase() == RPG_BATTLE) { 37 | set_speed_battle(5.f);//sus 38 | set_speed_global(1.f); 39 | } 40 | else { 41 | set_speed_global(speed); 42 | set_speed_battle(1.f); 43 | } 44 | } 45 | 46 | void mega_beep(bool is) { 47 | if (is) { 48 | Beep(800, 500); 49 | } 50 | else { 51 | Beep(600, 500); 52 | } 53 | } 54 | 55 | 56 | void cheat_thread() { 57 | 58 | while (!game_assembly) game_assembly = reinterpret_cast(GetModuleHandleA("gameassembly.dll")); 59 | while (!unity_player) unity_player = reinterpret_cast(GetModuleHandleA("unityplayer.dll")); 60 | 61 | 62 | do 63 | { 64 | 65 | if (GetAsyncKeyState(VK_F1) && 1) { 66 | speedhack = !speedhack; 67 | 68 | mega_beep(speedhack); 69 | } 70 | else if (GetAsyncKeyState(VK_F2) && 1) { 71 | peeking = !peeking; 72 | 73 | mega_beep(peeking); 74 | } 75 | else if (GetAsyncKeyState(VK_F3) && 1) { 76 | fps_unlock = !fps_unlock; 77 | 78 | mega_beep(fps_unlock); 79 | } 80 | else if (GetAsyncKeyState(VK_F4) && 1) { 81 | auto_battle = !auto_battle; 82 | 83 | mega_beep(auto_battle); 84 | } 85 | else if (GetAsyncKeyState(VK_OEM_3) && 1) { 86 | blind = !blind; 87 | 88 | mega_beep(blind); 89 | } 90 | 91 | if (speedhack) { 92 | set_speed(speed); 93 | } 94 | else { 95 | set_speed(1.f); 96 | } 97 | 98 | if (peeking) { 99 | utils::write(game_assembly + 0x51292C0, 0xC3); 100 | } 101 | else { 102 | utils::write(game_assembly + 0x51292C0, 0x40); 103 | } 104 | 105 | if (fps_unlock) { 106 | utils::write(unity_player + 0x1C4E000, 540); 107 | } 108 | else { 109 | utils::write(unity_player + 0x1C4E000, 60); 110 | } 111 | 112 | if (blind) { 113 | utils::write(game_assembly + 0x5800F40, 0xC3); 114 | } 115 | else { 116 | utils::write(game_assembly + 0x5800F40, 0x40); 117 | } 118 | 119 | if (GetAsyncKeyState(VK_CAPITAL)) { 120 | 121 | auto_dialogue = 1;//new 2 122 | 123 | if (GetForegroundWindow() == window) { 124 | keybd_event(VK_SPACE, 0, 0, 0); 125 | Sleep(20);//100 new2 126 | keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0); 127 | 128 | } 129 | } 130 | else { 131 | auto_dialogue = 0; 132 | } 133 | 134 | Sleep(16);//sus//new 2 135 | 136 | } while (true); 137 | 138 | } 139 | 140 | void menu() { 141 | 142 | while (!window) window = FindWindowA("UnityWndClass", NULL);//new 2 143 | 144 | Sleep(15000); 145 | 146 | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)cheat_thread, 0, 0, 0); 147 | 148 | puts("enable speedhack | hotkey: F1"); 149 | puts("enable peeking (: | hotkey: F2"); 150 | puts("enable fps unlock | hotkey: F3"); 151 | puts("enable auto battle unlock | hotkey: F4"); 152 | puts("enable blind enemies | hotkey: ~"); 153 | puts("enable auto dialog | hotkey: Capslock"); 154 | 155 | while (true) 156 | { 157 | printf("currect speed value: %f\nchange to: ", speed); 158 | 159 | scanf_s("%f", &speed); 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /menu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace menu { 4 | void menu(); 5 | } -------------------------------------------------------------------------------- /minhook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) 32 | #error MinHook supports only x86 and x64 systems. 33 | #endif 34 | 35 | #include 36 | 37 | // MinHook Error Codes. 38 | typedef enum MH_STATUS 39 | { 40 | // Unknown error. Should not be returned. 41 | MH_UNKNOWN = -1, 42 | 43 | // Successful. 44 | MH_OK = 0, 45 | 46 | // MinHook is already initialized. 47 | MH_ERROR_ALREADY_INITIALIZED, 48 | 49 | // MinHook is not initialized yet, or already uninitialized. 50 | MH_ERROR_NOT_INITIALIZED, 51 | 52 | // The hook for the specified target function is already created. 53 | MH_ERROR_ALREADY_CREATED, 54 | 55 | // The hook for the specified target function is not created yet. 56 | MH_ERROR_NOT_CREATED, 57 | 58 | // The hook for the specified target function is already enabled. 59 | MH_ERROR_ENABLED, 60 | 61 | // The hook for the specified target function is not enabled yet, or already 62 | // disabled. 63 | MH_ERROR_DISABLED, 64 | 65 | // The specified pointer is invalid. It points the address of non-allocated 66 | // and/or non-executable region. 67 | MH_ERROR_NOT_EXECUTABLE, 68 | 69 | // The specified target function cannot be hooked. 70 | MH_ERROR_UNSUPPORTED_FUNCTION, 71 | 72 | // Failed to allocate memory. 73 | MH_ERROR_MEMORY_ALLOC, 74 | 75 | // Failed to change the memory protection. 76 | MH_ERROR_MEMORY_PROTECT, 77 | 78 | // The specified module is not loaded. 79 | MH_ERROR_MODULE_NOT_FOUND, 80 | 81 | // The specified function is not found. 82 | MH_ERROR_FUNCTION_NOT_FOUND 83 | } 84 | MH_STATUS; 85 | 86 | // Can be passed as a parameter to MH_EnableHook, MH_DisableHook, 87 | // MH_QueueEnableHook or MH_QueueDisableHook. 88 | #define MH_ALL_HOOKS NULL 89 | 90 | #ifdef __cplusplus 91 | extern "C" { 92 | #endif 93 | 94 | // Initialize the MinHook library. You must call this function EXACTLY ONCE 95 | // at the beginning of your program. 96 | MH_STATUS WINAPI MH_Initialize(VOID); 97 | 98 | // Uninitialize the MinHook library. You must call this function EXACTLY 99 | // ONCE at the end of your program. 100 | MH_STATUS WINAPI MH_Uninitialize(VOID); 101 | 102 | // Creates a Hook for the specified target function, in disabled state. 103 | // Parameters: 104 | // pTarget [in] A pointer to the target function, which will be 105 | // overridden by the detour function. 106 | // pDetour [in] A pointer to the detour function, which will override 107 | // the target function. 108 | // ppOriginal [out] A pointer to the trampoline function, which will be 109 | // used to call the original target function. 110 | // This parameter can be NULL. 111 | MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); 112 | 113 | // Creates a Hook for the specified API function, in disabled state. 114 | // Parameters: 115 | // pszModule [in] A pointer to the loaded module name which contains the 116 | // target function. 117 | // pszTarget [in] A pointer to the target function name, which will be 118 | // overridden by the detour function. 119 | // pDetour [in] A pointer to the detour function, which will override 120 | // the target function. 121 | // ppOriginal [out] A pointer to the trampoline function, which will be 122 | // used to call the original target function. 123 | // This parameter can be NULL. 124 | MH_STATUS WINAPI MH_CreateHookApi( 125 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); 126 | 127 | // Creates a Hook for the specified API function, in disabled state. 128 | // Parameters: 129 | // pszModule [in] A pointer to the loaded module name which contains the 130 | // target function. 131 | // pszTarget [in] A pointer to the target function name, which will be 132 | // overridden by the detour function. 133 | // pDetour [in] A pointer to the detour function, which will override 134 | // the target function. 135 | // ppOriginal [out] A pointer to the trampoline function, which will be 136 | // used to call the original target function. 137 | // This parameter can be NULL. 138 | // ppTarget [out] A pointer to the target function, which will be used 139 | // with other functions. 140 | // This parameter can be NULL. 141 | MH_STATUS WINAPI MH_CreateHookApiEx( 142 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); 143 | 144 | // Removes an already created hook. 145 | // Parameters: 146 | // pTarget [in] A pointer to the target function. 147 | MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); 148 | 149 | // Enables an already created hook. 150 | // Parameters: 151 | // pTarget [in] A pointer to the target function. 152 | // If this parameter is MH_ALL_HOOKS, all created hooks are 153 | // enabled in one go. 154 | MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); 155 | 156 | // Disables an already created hook. 157 | // Parameters: 158 | // pTarget [in] A pointer to the target function. 159 | // If this parameter is MH_ALL_HOOKS, all created hooks are 160 | // disabled in one go. 161 | MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); 162 | 163 | // Queues to enable an already created hook. 164 | // Parameters: 165 | // pTarget [in] A pointer to the target function. 166 | // If this parameter is MH_ALL_HOOKS, all created hooks are 167 | // queued to be enabled. 168 | MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); 169 | 170 | // Queues to disable an already created hook. 171 | // Parameters: 172 | // pTarget [in] A pointer to the target function. 173 | // If this parameter is MH_ALL_HOOKS, all created hooks are 174 | // queued to be disabled. 175 | MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); 176 | 177 | // Applies all queued changes in one go. 178 | MH_STATUS WINAPI MH_ApplyQueued(VOID); 179 | 180 | // Translates the MH_STATUS to its name as a string. 181 | const char * WINAPI MH_StatusToString(MH_STATUS status); 182 | 183 | #ifdef __cplusplus 184 | } 185 | #endif 186 | 187 | -------------------------------------------------------------------------------- /minhook.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajapipis/StarRail-Menu-Mod/25b2da9d4c0034b5b55a7d31e8c374048f144c10/minhook.lib -------------------------------------------------------------------------------- /typedef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct HookData { 4 | std::string name; 5 | DWORD rva; 6 | 7 | void* hook; 8 | void* original; 9 | }; 10 | 11 | typedef __int64(__fastcall* LEAVECURRENTPHASE)(__int64 a1, __int64 a2); 12 | LEAVECURRENTPHASE o_leavecurrentphase = nullptr; 13 | 14 | typedef __int64(__fastcall* SETCURRENTPHASE)(__int64 a1, int a2, __int64 a3, char a4); 15 | SETCURRENTPHASE o_setcurrentphase = nullptr; 16 | 17 | typedef HANDLE(WINAPI* CREATE_FILE_W)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); 18 | CREATE_FILE_W p_CreateFileW = nullptr; 19 | CREATE_FILE_W t_CreateFileW; 20 | 21 | typedef __int64(__fastcall* ISAUTOBATTLE)(__int64 a1); 22 | ISAUTOBATTLE o_isautobattle = nullptr; 23 | 24 | typedef char(__fastcall* SETAUTOBATTLEFLAG)(__int64 a1, unsigned __int8 a2); 25 | SETAUTOBATTLEFLAG o_setautobattleflag = nullptr; -------------------------------------------------------------------------------- /utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace utils { 6 | template 7 | void write(uintptr_t address, T value) { 8 | DWORD oldProtection; 9 | VirtualProtect(reinterpret_cast(address), sizeof(T), PAGE_EXECUTE_READWRITE, &oldProtection); 10 | *reinterpret_cast(address) = value; 11 | VirtualProtect(reinterpret_cast(address), sizeof(T), oldProtection, &oldProtection); 12 | } 13 | 14 | template 15 | K read(uintptr_t address) { 16 | return *reinterpret_cast(address); 17 | } 18 | } --------------------------------------------------------------------------------