├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── help.md │ └── idea.md └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── README_vi-vn.md ├── README_zh-Hans.md ├── README_zh-Hant.md ├── akebi-gc.sln ├── cheat-base ├── cheat-base.vcxproj ├── cheat-base.vcxproj.filters ├── framework │ ├── framework.h │ ├── pch.cpp │ └── pch.h ├── src │ └── cheat-base │ │ ├── HookManager.h │ │ ├── Hotkey.cpp │ │ ├── Hotkey.h │ │ ├── ISerializable.h │ │ ├── Logger.cpp │ │ ├── Logger.h │ │ ├── Patch.cpp │ │ ├── Patch.h │ │ ├── PatternScanner.cpp │ │ ├── PatternScanner.h │ │ ├── PipeTransfer.cpp │ │ ├── PipeTransfer.h │ │ ├── ResourceLoader.cpp │ │ ├── ResourceLoader.h │ │ ├── Translator.cpp │ │ ├── Translator.h │ │ ├── cheat │ │ ├── CheatManagerBase.cpp │ │ ├── CheatManagerBase.h │ │ ├── Feature.h │ │ ├── fields │ │ │ ├── NamedHotkey.cpp │ │ │ ├── NamedHotkey.h │ │ │ ├── TranslatedHotkey.cpp │ │ │ └── TranslatedHotkey.h │ │ └── misc │ │ │ ├── Language.cpp │ │ │ ├── Language.h │ │ │ ├── Settings.cpp │ │ │ └── Settings.h │ │ ├── config │ │ ├── Config.cpp │ │ ├── Config.h │ │ ├── Field.h │ │ ├── converters.h │ │ ├── fields │ │ │ ├── Enum.h │ │ │ └── Toggle.h │ │ └── internal │ │ │ ├── FieldBase.h │ │ │ ├── FieldEntry.h │ │ │ └── FieldSerialize.h │ │ ├── events │ │ ├── event.hpp │ │ ├── handlers │ │ │ ├── abstracteventhandler.hpp │ │ │ ├── eventhandlerptr.h │ │ │ ├── functoreventhandler.hpp │ │ │ ├── handlercast.hpp │ │ │ ├── helpers │ │ │ │ ├── innerholder.hpp │ │ │ │ └── objectsaver.hpp │ │ │ └── methodeventhandler.hpp │ │ ├── helpers │ │ │ └── is_equatable.hpp │ │ └── joins │ │ │ ├── abstracteventjoin.cpp │ │ │ ├── abstracteventjoin.h │ │ │ ├── eventjoinwrapper.cpp │ │ │ ├── eventjoinwrapper.h │ │ │ ├── eventjoinwrapper.hpp │ │ │ ├── handlereventjoin.h │ │ │ └── handlereventjoin.hpp │ │ ├── globals.cpp │ │ ├── globals.h │ │ ├── inject │ │ ├── load-library.cpp │ │ ├── load-library.h │ │ ├── manual-map.cpp │ │ └── manual-map.h │ │ ├── render │ │ ├── ImageLoader.cpp │ │ ├── ImageLoader.h │ │ ├── backend │ │ │ ├── dx11-hook.cpp │ │ │ ├── dx11-hook.h │ │ │ ├── dx12-hook.cpp │ │ │ └── dx12-hook.h │ │ ├── gui-util.cpp │ │ ├── gui-util.h │ │ ├── renderer.cpp │ │ └── renderer.h │ │ ├── thread-safe.h │ │ ├── util.cpp │ │ └── util.h └── vendor │ ├── detours │ ├── detours-x64.lib │ ├── detours-x86.lib │ ├── detours.h │ └── detver.h │ └── imgui-notify-v2 │ ├── fa_solid_900.h │ ├── font_awesome_5.h │ └── imgui_notify.h ├── cheat-library ├── cheat-library.vcxproj ├── cheat-library.vcxproj.filters ├── res │ ├── MiSans-Regular.ttf │ ├── NotoSansSC-Medium.otf │ ├── Ruda-Bold.ttf │ ├── Ruda-ExtraBold.ttf │ ├── anim │ │ └── akebi_bounce.gif │ ├── ascension_materials.json │ ├── assembly_checksum.json │ ├── icons │ │ ├── AphotiumOre.png │ │ ├── BlazingAxeMitachurl.png │ │ ├── CoralButterfly.png │ │ ├── CracklingAxeMitachurl.png │ │ ├── DamagedStoneSlate.png │ │ ├── DoNotPublish.png │ │ ├── ElectroAbyssMage.png │ │ ├── ElectroWhopperflower.png │ │ ├── EnergyPoint.png │ │ ├── FrostarmLawachurl.png │ │ ├── GlimmeringBeaconCannotTeleport.png │ │ ├── HarpastumChest.png │ │ ├── HydroAbyssMage.png │ │ ├── LightGuidingCeremony.png │ │ ├── Mural.png │ │ ├── MysteriousConch.png │ │ ├── Ochimusha.png │ │ ├── PaintedWall.png │ │ ├── PyroAbyssMage.png │ │ ├── PyroWhopperflower.png │ │ ├── RockShieldwallMitachurl.png │ │ ├── SentouTrial.png │ │ ├── StatueoftheVassals.png │ │ ├── ThunderhelmLawachurl.png │ │ ├── TokoyoLegume.png │ │ └── WoodenShieldwallMitachurl.png │ ├── iconsHD │ │ ├── Alhaitham.png │ │ ├── TulaytullahsRemembrance.png │ │ └── Wanderer.png │ ├── languages.json │ ├── res.rc │ ├── resource.h │ ├── scripts │ │ ├── icon_downloader.py │ │ ├── icon_resizer.py │ │ ├── load_map_data.py │ │ ├── map_api.txt │ │ ├── saved_offsets.json │ │ └── saved_offsets_to_static.py │ ├── signatures.json │ ├── ubuntu_bold.ttf │ └── warnings │ │ ├── AR.png │ │ ├── EN.png │ │ ├── JA.png │ │ ├── MY.png │ │ ├── PH.png │ │ ├── PT.png │ │ ├── RU.png │ │ ├── VN.png │ │ ├── ZHCN.png │ │ └── ZHTW.png └── src │ ├── appdata │ ├── MiHoYoMtrSdk-functions.h │ ├── Telemetry-functions.h │ ├── ZfGameBrowser-functions.h │ ├── il2cpp-api-functions-2.h │ ├── il2cpp-api-functions-ptr.h │ ├── il2cpp-api-functions.h │ ├── il2cpp-functions.h │ ├── il2cpp-metadata-version.h │ ├── il2cpp-types-ptr.h │ ├── il2cpp-types.h │ └── il2cpp-unityplayer-functions.h │ ├── framework │ ├── dllmain.cpp │ ├── helpers.cpp │ ├── helpers.h │ ├── il2cpp-appdata.h │ ├── il2cpp-init.cpp │ ├── il2cpp-init.h │ ├── pch-il2cpp.cpp │ └── pch-il2cpp.h │ └── user │ ├── cheat │ ├── GenshinCM.cpp │ ├── GenshinCM.h │ ├── ILPatternScanner.cpp │ ├── ILPatternScanner.h │ ├── cheat.cpp │ ├── cheat.h │ ├── debugger.cpp │ ├── debugger.h │ ├── events.cpp │ ├── events.h │ ├── game │ │ ├── AdvancedFilter.h │ │ ├── util.cpp │ │ ├── util.h │ │ └── xxHash.hpp │ ├── misc │ │ ├── About.cpp │ │ ├── About.h │ │ ├── BlockWindSeed.cpp │ │ ├── BlockWindSeed.h │ │ ├── Debug.cpp │ │ ├── Debug.h │ │ ├── Hotkeys.cpp │ │ ├── Hotkeys.h │ │ ├── ProtectionBypass.cpp │ │ ├── ProtectionBypass.h │ │ ├── RSAPatch.cpp │ │ ├── RSAPatch.h │ │ └── sniffer │ │ │ ├── PacketSniffer.cpp │ │ │ ├── PacketSniffer.h │ │ │ └── pipe │ │ │ ├── PipeClient.cpp │ │ │ ├── PipeClient.h │ │ │ ├── PipeIO.cpp │ │ │ ├── PipeIO.h │ │ │ └── messages │ │ │ ├── PipeMessage.cpp │ │ │ ├── PipeMessage.h │ │ │ ├── PipeModifyData.cpp │ │ │ ├── PipeModifyData.h │ │ │ ├── PipePacketData.cpp │ │ │ └── PipePacketData.h │ ├── native.cpp │ ├── native.h │ ├── player │ │ ├── NoCD.cpp │ │ └── NoCD.h │ ├── visuals │ │ ├── Browser.cpp │ │ ├── Browser.h │ │ ├── CameraZoom.cpp │ │ ├── CameraZoom.h │ │ ├── EnablePeeking.cpp │ │ ├── EnablePeeking.h │ │ ├── FPSUnlock.cpp │ │ ├── FPSUnlock.h │ │ ├── FreeCamera.cpp │ │ ├── FreeCamera.h │ │ ├── HideUI.cpp │ │ ├── HideUI.h │ │ ├── NoFog.cpp │ │ ├── NoFog.h │ │ ├── PaimonFollow.cpp │ │ ├── PaimonFollow.h │ │ ├── ProfileChanger.cpp │ │ ├── ProfileChanger.h │ │ ├── ShowChestIndicator.cpp │ │ ├── ShowChestIndicator.h │ │ ├── TextureChanger.cpp │ │ └── TextureChanger.h │ └── world │ │ ├── DialogSkip.cpp │ │ ├── DialogSkip.h │ │ ├── DumbEnemies.cpp │ │ ├── DumbEnemies.h │ │ ├── ElementalSight.cpp │ │ ├── ElementalSight.h │ │ ├── FakeTime.h │ │ ├── GameSpeed.cpp │ │ ├── GameSpeed.h │ │ ├── MusicEvent.cpp │ │ ├── MusicEvent.h │ │ ├── OpenTeamImmediately.cpp │ │ ├── OpenTeamImmediately.h │ │ ├── SkipEnhanceAnimation.cpp │ │ └── SkipEnhanceAnimation.h │ ├── main.cpp │ └── main.h └── injector ├── akebi.ico ├── akebi.png ├── injector.rc ├── injector.vcxproj ├── injector.vcxproj.filters ├── resource.h └── src ├── injector.cpp ├── injector.h ├── main.cpp ├── util.cpp └── util.h /.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 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug feedback 3 | about: Submit a bug feedback to us. 4 | title: "[Bug]" 5 | labels: Bug 6 | --- 7 | 8 | 9 | 10 | ## Bug 11 | 12 | Please enter a clear and accurate description of this bug here. 13 | 14 | ## How to reproduce this bug 15 | 16 | Steps to reproduce this bug: 17 | 1. xx 18 | 2. xxxx 19 | 3. xxxxxx 20 | 4. xxxxxxxx 21 | 22 | ## Expectation 23 | 24 | Give a brief description of what you expect. 25 | 26 | ## Screenshot/Video 27 | 28 | If possible, please attach your screenshot or video here. You can use Ctrl + V to paste the picture directly. 29 | 30 | ## Your device information 31 | 32 | - System information: 33 | 34 | - Version: 35 | 36 | ## Additional information 37 | 38 | You can enter additional information about this bug here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/help.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ask for help 3 | about: Ask us for help about Akebi. 4 | title: "[Help]" 5 | labels: "Help Wanted" 6 | --- 7 | 8 | 9 | 10 | ## Describe the problem 11 | 12 | Please fill in here a clear and accurate description of the problem you are experiencing. 13 | 14 | ## How to reproduce this problem 15 | 16 | Steps to reproduce this issue: 17 | 1. xx 18 | 2. xxxx 19 | 3. xxxxxx 20 | 4. xxxxxxxx 21 | 22 | ## Help you need 23 | 24 | Please fill in the help you need here. 25 | 26 | ## Screenshot/Video 27 | 28 | If possible, please attach your screenshot or video here. You can use Ctrl + V to paste the picture directly. 29 | 30 | ## Your device information 31 | 32 | - System information: 33 | 34 | - Version: 35 | 36 | ## Additional information 37 | 38 | Here you can enter additional information about the help you need. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/idea.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Suggestion 3 | about: Submit your suggestion to us. 4 | title: "[Suggestion]" 5 | labels: Suggestion 6 | --- 7 | 8 | 9 | 10 | ## Describe the suggestion 11 | 12 | Please enter a clear and precise description of this proposal here. 13 | 14 | ## How does this suggestion work 15 | 16 | Work steps: 17 | 1. xx 18 | 2. xxxx 19 | 3. xxxxxx 20 | 4. xxxxxxxx 21 | 22 | ## Related technologies 23 | 24 | If you are able, you can provide some technical assistance here. 25 | 26 | ## Screenshot/Video 27 | 28 | If possible, please attach your screenshot or video here. You can use Ctrl + V to paste the picture directly. 29 | 30 | ## Additional information 31 | 32 | You can enter additional information about this suggestion here. 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | branches: [ Star ] 6 | 7 | env: 8 | SOLUTION_FILE_PATH: ./akebi-gc.sln 9 | BUILD_CONFIGURATION: Release 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | build: 16 | runs-on: windows-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | with: 21 | submodules: recursive 22 | 23 | - name: Install MSBuild 24 | uses: microsoft/setup-msbuild@v1.0.2 25 | 26 | # Optional, because current solution is executing custom command line after finishing build 27 | # Repo does not affected 28 | # Using hardcoded path and string 29 | - name: Remove Custom Build Steps 30 | shell: bash 31 | run: | 32 | curl -o CustomBuildStepsDisabler.exe https://raw.githubusercontent.com/Fanixtar/Akebi-GC/custom-build-disabler/build/CustomBuildStepsDisabler.exe 33 | ./CustomBuildStepsDisabler.exe 34 | 35 | - name: Build Akebi-GC solution 36 | working-directory: ./ 37 | run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} 38 | 39 | - name: Removing unused files 40 | shell: bash 41 | run: | 42 | rm -rf ./bin/Release-x64/obj 43 | rm -rf ./bin/Release-x64/*.pdb 44 | 45 | - name: Upload Akebi-GC latest artifact 46 | uses: actions/upload-artifact@v3.1.0 47 | with: 48 | name: Akebi-GC-release 49 | path: ./bin/Release-x64/* 50 | if-no-files-found: error 51 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cheat-base/vendor/simpleIni"] 2 | path = cheat-base/vendor/simpleIni 3 | url = https://github.com/brofield/simpleini.git 4 | [submodule "cheat-base/vendor/fmt"] 5 | path = cheat-base/vendor/fmt 6 | url = https://github.com/fmtlib/fmt.git 7 | [submodule "cheat-base/vendor/magic_enum"] 8 | path = cheat-base/vendor/magic_enum 9 | url = https://github.com/Neargye/magic_enum.git 10 | [submodule "cheat-library/vendor/json"] 11 | path = cheat-base/vendor/json 12 | url = https://github.com/nlohmann/json.git 13 | [submodule "cheat-base/vendor/stb"] 14 | path = cheat-base/vendor/stb 15 | url = https://github.com/nothings/stb.git 16 | [submodule "cheat-base/vendor/imgui"] 17 | path = cheat-base/vendor/imgui 18 | url = https://github.com/CallowBlack/imgui-brightness-fix.git 19 | [submodule "cheat-base/vendor/WinReg"] 20 | path = cheat-base/vendor/WinReg 21 | url = https://github.com/GiovanniDicanio/WinReg.git 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Akebi-SC-unofficial- 2 | 练手自用,基于akebi3.3更新 3 | 4 | 功能: 5 | 6 | 全局加速 7 | 8 | 反和谐 9 | 10 | 帧率解锁 11 | 12 | 视场修改 13 | 14 | 隐藏界面 15 | 16 | 自由视角 17 | 18 | Shit cheat based on akebi3.3 src 19 | 20 | features: 21 | 22 | GameSpeed 23 | 24 | peeking 25 | 26 | fps unlock 27 | 28 | fov changer 29 | 30 | hide ui 31 | 32 | free camera 33 | 34 | 35 | # 如何使用? 36 | 37 | 克隆仓库并编译 38 | 39 | 从 https://github.com/Z4ee/StarRail-ACE-B 克隆并编译,将得到的star_rail.dll与此项目编译得到的CLibrary.dll以及injector.exe放在同一目录 40 | 41 | 启动 42 | 43 | **编译不了是你的问题** 44 | 45 | -------------------------------------------------------------------------------- /cheat-base/framework/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | -------------------------------------------------------------------------------- /cheat-base/framework/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch.h" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. 6 | -------------------------------------------------------------------------------- /cheat-base/framework/pch.h: -------------------------------------------------------------------------------- 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 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // add headers that you want to pre-compile here 11 | #include "framework.h" 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include 49 | #endif //PCH_H 50 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/HookManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define CALL_ORIGIN(function, ...) \ 7 | HookManager::call(function, __func__, __VA_ARGS__) 8 | 9 | class HookManager 10 | { 11 | public: 12 | template 13 | static void install(Fn func, Fn handler) 14 | { 15 | enable(func, handler); 16 | holderMap[reinterpret_cast(handler)] = reinterpret_cast(func); 17 | } 18 | 19 | template 20 | static Fn getOrigin(Fn handler, const char* callerName = nullptr) noexcept 21 | { 22 | if (holderMap.count(reinterpret_cast(handler)) == 0) { 23 | LOG_WARNING("Origin not found for handler: %s. Maybe racing bug.", callerName == nullptr ? "" : callerName); 24 | return nullptr; 25 | } 26 | return reinterpret_cast(holderMap[reinterpret_cast(handler)]); 27 | } 28 | 29 | template 30 | static void detach(Fn handler) noexcept 31 | { 32 | disable(handler); 33 | holderMap.erase(reinterpret_cast(handler)); 34 | } 35 | 36 | // I don't know why 37 | #ifdef _WIN64 38 | 39 | template 40 | static RType call(RType(*handler)(Params...), const char* callerName = nullptr, Params... params) 41 | { 42 | auto origin = getOrigin(handler, callerName); 43 | if (origin != nullptr) 44 | return origin(params...); 45 | 46 | return RType(); 47 | } 48 | 49 | #else 50 | 51 | template 52 | static RType call(RType(__cdecl *handler)(Params...), const char* callerName = nullptr, Params... params) 53 | { 54 | auto origin = getOrigin(handler, callerName); 55 | if (origin != nullptr) 56 | return origin(params...); 57 | 58 | return RType(); 59 | } 60 | 61 | template 62 | static RType call(RType(__stdcall *handler)(Params...), const char* callerName = nullptr, Params... params) 63 | { 64 | auto origin = getOrigin(handler, callerName); 65 | if (origin != nullptr) 66 | return origin(params...); 67 | 68 | return RType(); 69 | } 70 | 71 | #endif 72 | 73 | static void detachAll() noexcept 74 | { 75 | for (const auto &[key, value] : holderMap) 76 | { 77 | disable(key); 78 | } 79 | holderMap.clear(); 80 | } 81 | 82 | private: 83 | inline static std::map holderMap{}; 84 | 85 | template 86 | static void disable(Fn handler) 87 | { 88 | Fn origin = getOrigin(handler); 89 | DetourTransactionBegin(); 90 | DetourUpdateThread(GetCurrentThread()); 91 | DetourDetach(&(PVOID&)origin, handler); 92 | DetourTransactionCommit(); 93 | } 94 | 95 | template 96 | static void enable(Fn& func, Fn handler) 97 | { 98 | DetourTransactionBegin(); 99 | DetourUpdateThread(GetCurrentThread()); 100 | DetourAttach(&(PVOID&)func, handler); 101 | DetourTransactionCommit(); 102 | } 103 | }; 104 | 105 | 106 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Hotkey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | class Hotkey 9 | { 10 | public: 11 | 12 | Hotkey(); 13 | Hotkey(const Hotkey& other); 14 | Hotkey(short key); 15 | Hotkey(std::vector keys); 16 | ~Hotkey(); 17 | 18 | Hotkey& operator=(Hotkey& hotkey) noexcept; 19 | Hotkey& operator=(Hotkey&& hotkey) noexcept; 20 | 21 | bool operator== (const Hotkey& c2) const; 22 | bool operator!= (const Hotkey& c2) const; 23 | bool operator-(const Hotkey& c2); 24 | 25 | bool IsPressed() const; 26 | bool IsPressed(short keyDown) const; 27 | bool IsReleased() const; 28 | 29 | bool IsEmpty() const; 30 | 31 | std::vector GetKeys() const; 32 | 33 | operator std::string() const; 34 | 35 | static Hotkey GetPressedHotkey(); 36 | 37 | IEvent<>& PressedEvent; 38 | private: 39 | TEvent<> m_PressedEvent; 40 | std::unordered_set m_Keys; 41 | 42 | void OnKeyUp(short key, bool& canceled); 43 | }; -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/ISerializable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ISerializable 6 | { 7 | public: 8 | virtual void to_json(nlohmann::json& j) const = 0; 9 | virtual void from_json(const nlohmann::json& j) = 0; 10 | }; 11 | 12 | inline void to_json(nlohmann::json& j, const ISerializable& ser) 13 | { 14 | ser.to_json(j); 15 | } 16 | 17 | inline void from_json(const nlohmann::json& j, ISerializable& ser) 18 | { 19 | ser.from_json(j); 20 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #define EXTLOG(level, fmt, ...) Logger::Log(level, __FILE__, __LINE__, fmt, __VA_ARGS__) 7 | #define LOG_CRIT(fmt, ...) EXTLOG(Logger::Level::Critical, fmt, __VA_ARGS__) 8 | #define LOG_ERROR(fmt, ...) EXTLOG(Logger::Level::Error, fmt, __VA_ARGS__) 9 | #define LOG_WARNING(fmt, ...) EXTLOG(Logger::Level::Warning, fmt, __VA_ARGS__) 10 | #define LOG_INFO(fmt, ...) EXTLOG(Logger::Level::Info, fmt, __VA_ARGS__) 11 | #define LOG_DEBUG(fmt, ...) EXTLOG(Logger::Level::Debug, fmt, __VA_ARGS__) 12 | #define LOG_TRACE(fmt, ...) EXTLOG(Logger::Level::Trace, fmt, __VA_ARGS__) 13 | 14 | class Logger 15 | { 16 | public: 17 | enum class Level 18 | { 19 | None, 20 | Critical, 21 | Error, 22 | Warning, 23 | Info, 24 | Debug, 25 | Trace 26 | }; 27 | 28 | enum class LoggerType 29 | { 30 | Any, 31 | ConsoleLogger, 32 | FileLogger 33 | }; 34 | 35 | static void SetLevel(Level level, LoggerType type = LoggerType::Any); 36 | static Level GetLevel(LoggerType type); 37 | 38 | static void Log(Level logLevel, const char* filename, int line, const char* fmt, ...); 39 | 40 | static void PrepareFileLogging(std::string directory); 41 | 42 | static inline TEvent LogEvent; 43 | 44 | private: 45 | static Level s_FileLogLevel; 46 | static Level s_ConsoleLogLevel; 47 | 48 | static std::mutex _mutex; 49 | 50 | static std::string directory; 51 | static std::string logfilepath; 52 | }; -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Patch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Patch.h" 3 | 4 | #include 5 | 6 | bool Patch::Install(uint64_t address, std::vector value) 7 | { 8 | if (patches.count(address) > 0) 9 | { 10 | LOG_ERROR("Failed to install patch: patch already installed."); 11 | return false; 12 | } 13 | 14 | auto oldValue = WriteMemory(address, value); 15 | if (oldValue == nullptr) 16 | return false; 17 | 18 | patches[address] = oldValue; 19 | return true; 20 | } 21 | 22 | bool Patch::Restore(uint64_t address) 23 | { 24 | if (patches.count(address) == 0) 25 | { 26 | LOG_ERROR("Failed to restore patch: not found patch to target address 0x%016X", address); 27 | return false; 28 | } 29 | 30 | auto restoreValue = patches[address]; 31 | auto oldValue = WriteMemory(address, *restoreValue); 32 | if (oldValue == nullptr) 33 | return false; 34 | 35 | patches.erase(address); 36 | delete restoreValue; 37 | delete oldValue; 38 | 39 | return true; 40 | } 41 | 42 | std::vector* Patch::WriteMemory(uint64_t address, std::vector value) 43 | { 44 | MEMORY_BASIC_INFORMATION information{}; 45 | auto size = VirtualQuery(reinterpret_cast(address), &information, sizeof(information)); 46 | if (size < sizeof(information)) 47 | { 48 | LOG_LAST_ERROR("Failed to get page information"); 49 | return nullptr; 50 | } 51 | 52 | if (information.State != MEM_COMMIT) 53 | { 54 | LOG_ERROR("Page at target address isn't MEM_COMMIT (0x%016X)", address); 55 | return nullptr; 56 | } 57 | 58 | 59 | DWORD oldProtection = -1; 60 | if ((information.AllocationProtect & PAGE_READWRITE) == 0 && (information.AllocationProtect & PAGE_EXECUTE_READWRITE) == 0) 61 | { 62 | if (VirtualProtect(reinterpret_cast(address), value.size(), PAGE_EXECUTE_READWRITE, &oldProtection) == FALSE) 63 | { 64 | LOG_LAST_ERROR("Failed to change page protection"); 65 | return nullptr; 66 | } 67 | } 68 | 69 | auto oldValue = new std::vector(value.size()); 70 | auto errorCode = memcpy_s(oldValue->data(), value.size(), reinterpret_cast(address), value.size()); 71 | if (errorCode != 0) 72 | { 73 | LOG_ERROR("Failed to get origin value from memory at 0x%016X. Error code: %d", address, errorCode); 74 | delete oldValue; 75 | return nullptr; 76 | } 77 | 78 | errorCode = memcpy_s(reinterpret_cast(address), value.size(), value.data(), value.size()); 79 | if (errorCode != 0) 80 | { 81 | LOG_ERROR("Failed to rewrite target memory at 0x%016X. Error code: %d", address, errorCode); 82 | delete oldValue; 83 | return nullptr; 84 | } 85 | 86 | if (oldProtection != -1) 87 | { 88 | DWORD temp = 0; 89 | if (VirtualProtect(reinterpret_cast(address), value.size(), oldProtection, &temp) == FALSE) 90 | { 91 | LOG_LAST_ERROR("Failed to restore page protection"); 92 | } 93 | } 94 | return oldValue; 95 | } 96 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Patch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define OPatch(offset, value) Patch::Install(il2cppi_get_base_address() + offset, value) 7 | #define OUnpatch(offset) Patch::Restore(il2cppi_get_base_address() + offset) 8 | #define TogglePatch(field, targetField, offset, patchBytes) if (field == &targetField) { if (targetField.GetValue()) OPatch(offset, patchBytes); else OUnpatch(offset); return; } 9 | 10 | class Patch 11 | { 12 | public: 13 | 14 | // Installing patch to target address. 15 | // In detail: replaces memory in target address with specified in 'value' 16 | // saves old memory for future restore 17 | // Return true if successfull. 18 | static bool Install(uint64_t address, std::vector value); 19 | 20 | // Restoring old memory in this address, if it was patched. 21 | // Return true if successfull. 22 | static bool Restore(uint64_t address); 23 | 24 | private: 25 | 26 | inline static std::map*> patches{}; 27 | 28 | static std::vector* WriteMemory(uint64_t address, std::vector value); 29 | 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/PipeTransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "PipeTransfer.h" 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | PipeTransfer::PipeTransfer(const std::string& name) 10 | { 11 | std::stringstream ss; 12 | ss << "\\\\.\\pipe\\" << name; 13 | this->m_Name = ss.str(); 14 | this->m_Pipe = 0; 15 | } 16 | 17 | PipeTransfer::~PipeTransfer() 18 | { 19 | Close(); 20 | } 21 | 22 | bool PipeTransfer::Create() 23 | { 24 | Close(); 25 | m_Pipe = CreateNamedPipe(m_Name.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 256 * 1024, 16, INFINITE, NULL); 26 | return IsPipeOpened(); 27 | } 28 | 29 | void PipeTransfer::Close() 30 | { 31 | if (m_Pipe) 32 | CloseHandle(m_Pipe); 33 | } 34 | 35 | bool PipeTransfer::IsPipeOpened() 36 | { 37 | return m_Pipe && m_Pipe != INVALID_HANDLE_VALUE; 38 | } 39 | 40 | bool PipeTransfer::Connect() 41 | { 42 | if (IsPipeOpened()) 43 | CloseHandle(m_Pipe); 44 | 45 | m_Pipe = CreateFile(m_Name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 46 | 47 | return IsPipeOpened(); 48 | } 49 | 50 | bool PipeTransfer::WaitForConnection() 51 | { 52 | return ConnectNamedPipe(m_Pipe, nullptr) || GetLastError() == ERROR_PIPE_CONNECTED; 53 | } 54 | 55 | void PipeTransfer::ReadBytes(void* buffer, size_t size) 56 | { 57 | if (size == 0 || !IsPipeOpened()) return; 58 | 59 | DWORD readCount = 0; 60 | auto result = ReadFile(m_Pipe, buffer, static_cast(size), &readCount, nullptr); 61 | if (!result || static_cast(readCount) < size) 62 | { 63 | LOG_LAST_ERROR("Failed read from pipe."); 64 | CloseHandle(m_Pipe); 65 | m_Pipe = 0; 66 | } 67 | } 68 | 69 | void PipeTransfer::WriteBytes(void* buffer, size_t size) 70 | { 71 | if (size == 0 || !IsPipeOpened()) return; 72 | 73 | DWORD writenCount = 0; 74 | auto result = WriteFile(m_Pipe, buffer, static_cast(size), &writenCount, nullptr); 75 | if (!result || static_cast(writenCount) < size) 76 | { 77 | LOG_LAST_ERROR("Failed write to pipe."); 78 | CloseHandle(m_Pipe); 79 | m_Pipe = 0; 80 | } 81 | } 82 | 83 | void PipeTransfer::ReadObject(PipeSerializedObject& object) 84 | { 85 | object.Read(this); 86 | } 87 | 88 | void PipeTransfer::WriteObject(PipeSerializedObject& object) 89 | { 90 | object.Write(this); 91 | } 92 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/PipeTransfer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | typedef unsigned char byte; 7 | 8 | class PipeTransfer; 9 | class PipeSerializedObject 10 | { 11 | public: 12 | virtual ~PipeSerializedObject() = default; 13 | virtual void Write(PipeTransfer* transfer) = 0; 14 | virtual void Read(PipeTransfer* transfer) = 0; 15 | }; 16 | 17 | class PipeTransfer 18 | { 19 | public: 20 | PipeTransfer(const std::string& name); 21 | ~PipeTransfer(); 22 | 23 | bool Create(); 24 | void Close(); 25 | bool Connect(); 26 | bool WaitForConnection(); 27 | bool IsPipeOpened(); 28 | 29 | void ReadBytes(void* buffer, size_t size); 30 | void WriteBytes(void* buffer, size_t size); 31 | 32 | void ReadObject(PipeSerializedObject& object); 33 | void WriteObject(PipeSerializedObject& object); 34 | 35 | template 36 | void Read(T& value) 37 | { 38 | ReadBytes(&value, sizeof(T)); 39 | } 40 | 41 | template 42 | void Write(const T& val) 43 | { 44 | WriteBytes(const_cast(&val), sizeof(T)); 45 | } 46 | 47 | template<> 48 | void Read(std::vector& vector) 49 | { 50 | size_t size; Read(size); 51 | vector.clear(); 52 | vector.resize(size); 53 | ReadBytes(vector.data(), size); 54 | } 55 | 56 | template<> 57 | void Write(const std::vector& value) 58 | { 59 | Write(value.size()); 60 | WriteBytes(const_cast(value.data()), value.size()); 61 | } 62 | 63 | template<> 64 | void Read(std::string& value) 65 | { 66 | size_t size; Read(size); 67 | value.clear(); 68 | value.resize(size); 69 | ReadBytes(value.data(), size); 70 | } 71 | 72 | template<> 73 | void Write(const std::string& value) 74 | { 75 | Write(value.length()); 76 | WriteBytes(const_cast(value.data()), value.length()); 77 | } 78 | 79 | private: 80 | 81 | std::string m_Name; 82 | HANDLE m_Pipe; 83 | }; 84 | 85 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/ResourceLoader.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "ResourceLoader.h" 3 | #include "util.h" 4 | 5 | std::string ResourceLoader::Load(const char* name, const char* type) 6 | { 7 | LPBYTE pData = nullptr; 8 | DWORD size = 0; 9 | if (!LoadEx(name, type, pData, size)) 10 | { 11 | LOG_LAST_ERROR("Failed to load resource %s", name); 12 | return {}; 13 | } 14 | 15 | return std::string(reinterpret_cast(pData), size); 16 | } 17 | 18 | std::string ResourceLoader::Load(int resID, const char* type) 19 | { 20 | return ResourceLoader::Load(MAKEINTRESOURCE(resID), type); 21 | } 22 | 23 | bool ResourceLoader::LoadEx(const char* name, const char* type, LPBYTE& pDest, DWORD& size) 24 | { 25 | if (s_Handle == nullptr) 26 | return false; 27 | 28 | HRSRC hResource = FindResource(s_Handle, name, type); 29 | if (hResource) { 30 | HGLOBAL hGlob = LoadResource(s_Handle, hResource); 31 | if (hGlob) { 32 | size = SizeofResource(s_Handle, hResource); 33 | pDest = static_cast(LockResource(hGlob)); 34 | if (size > 0 && pDest) 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | bool ResourceLoader::LoadEx(int resId, const char* type, LPBYTE& pDest, DWORD& size) 42 | { 43 | return ResourceLoader::LoadEx(MAKEINTRESOURCE(resId), type, pDest, size); 44 | } 45 | 46 | void ResourceLoader::SetModuleHandle(HMODULE handle) 47 | { 48 | s_Handle = handle; 49 | } 50 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/ResourceLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class ResourceLoader 3 | { 4 | public: 5 | static std::string Load(const char* name, const char* type); 6 | static std::string Load(int resID, const char* type); 7 | 8 | static bool LoadEx(const char* name, const char* type, LPBYTE& pDest, DWORD& size); 9 | static bool LoadEx(int resId, const char* type, LPBYTE& pDest, DWORD& size); 10 | 11 | static void SetModuleHandle(HMODULE handle); 12 | 13 | private: 14 | inline static HMODULE s_Handle = nullptr; 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Translator.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Translator.h" 3 | 4 | void Translator::Init(const std::filesystem::path& templatePath) 5 | { 6 | std::ifstream ifs(templatePath.wstring(), std::ios::binary | std::ios::in); 7 | std::string content((std::istreambuf_iterator(ifs)), 8 | (std::istreambuf_iterator())); 9 | 10 | Init(content); 11 | } 12 | 13 | void Translator::Init(const std::string& content) 14 | { 15 | Init(nlohmann::json::parse(content)); 16 | } 17 | 18 | void Translator::Init(const nlohmann::json& json) 19 | { 20 | _languages.clear(); 21 | _languagesInfo = json; 22 | 23 | for (auto& [key, value] : _languagesInfo.items()) 24 | _languages.push_back(key); 25 | 26 | _languages.emplace_back("default"); 27 | } 28 | 29 | std::string Translator::RuntimeTranslate(const std::string& origin) 30 | { 31 | return FindTranslationString(origin); 32 | } 33 | 34 | void Translator::SetDefaultPseudo(const std::string& pseudo) 35 | { 36 | _defaultLanguagePseudo = pseudo; 37 | } 38 | 39 | void Translator::SetDefaultFontName(const std::string& fontName) 40 | { 41 | _defaultFontName = fontName; 42 | } 43 | 44 | const std::string& Translator::GetCurrentFontName() 45 | { 46 | return _currentFont; 47 | } 48 | 49 | const std::string& Translator::GetCurrentLanguage() 50 | { 51 | return _currentLanguage; 52 | } 53 | 54 | const std::vector& Translator::GetLanguages() 55 | { 56 | return _languages; 57 | } 58 | 59 | const std::string Translator::GetLanguagePseudo(const std::string& language) 60 | { 61 | if (language == "default") 62 | return _defaultLanguagePseudo; 63 | 64 | if (!_languagesInfo.contains(language)) 65 | return ""; 66 | 67 | return _languagesInfo[language]["pseudo"]; 68 | } 69 | 70 | void Translator::SetLanguage(const std::string& language) 71 | { 72 | if (language == _currentLanguage) 73 | return; 74 | 75 | if (language == "default") 76 | { 77 | _translations.clear(); 78 | _currentLanguage = language; 79 | _currentFont = _defaultFontName; 80 | NotifyUpdate(); 81 | return; 82 | } 83 | 84 | if (!_languagesInfo.contains(language)) 85 | return; 86 | 87 | _translations.clear(); 88 | 89 | auto& translates = _languagesInfo[language]["translates"]; 90 | for (auto& [key, value] : translates.items()) 91 | _translations[key] = value; 92 | 93 | _currentLanguage = language; 94 | _currentFont = _languagesInfo[language]["font"]; 95 | NotifyUpdate(); 96 | } 97 | 98 | std::string Translator::FindTranslationString(const std::string& origin) 99 | { 100 | #ifdef _DEBUG 101 | if (!_debugOrigins.contains(origin)) 102 | _debugOrigins.insert(origin); 103 | #endif 104 | 105 | if (_currentLanguage == "default") 106 | return origin; 107 | 108 | auto it = _translations.find(origin); 109 | if (it == _translations.end()) 110 | return origin; 111 | 112 | return it->second; 113 | } 114 | 115 | void Translator::NotifyUpdate() 116 | { 117 | for (auto& updateFlag : _updateFlags) 118 | updateFlag = true; 119 | 120 | _languageChangedEvent(); 121 | } 122 | 123 | #ifdef _DEBUG 124 | nlohmann::json Translator::DumpTranslateConfigTemplate() 125 | { 126 | nlohmann::json languages = _languagesInfo; 127 | 128 | for (auto& [name, info] : languages.items()) 129 | { 130 | nlohmann::json tempInfo = info; 131 | 132 | auto translates = info["translates"]; 133 | auto& translatesOrigin = info["translates"]; 134 | for (auto& [origin, translated] : translates.items()) 135 | { 136 | if (_debugOrigins.contains(origin)) 137 | continue; 138 | 139 | translatesOrigin.erase(origin); 140 | translatesOrigin[fmt::format("!DEL {}", origin)] = translated; 141 | } 142 | 143 | for (auto& origin : _debugOrigins) 144 | { 145 | if (!translatesOrigin.contains(origin)) 146 | translatesOrigin[origin] = origin; 147 | } 148 | } 149 | return languages; 150 | } 151 | #endif 152 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/Translator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #define _TR(ORIGIN) Translator::Translate(ORIGIN) 10 | 11 | class Translator 12 | { 13 | public: 14 | static void Init(const std::filesystem::path& templatePath); 15 | static void Init(const std::string& content); 16 | static void Init(const nlohmann::json& json); 17 | 18 | template 19 | static const char* Translate(const std::string& origin) 20 | { 21 | static std::atomic* updateFlag = &_updateFlags.emplace_back(true); 22 | static std::string translated = origin; 23 | if (*updateFlag) 24 | { 25 | translated = FindTranslationString(origin); 26 | *updateFlag = false; 27 | } 28 | return translated.c_str(); 29 | } 30 | 31 | static std::string RuntimeTranslate(const std::string& origin); 32 | 33 | static void SetDefaultPseudo(const std::string& pseudo); 34 | static void SetDefaultFontName(const std::string& fontName); 35 | 36 | static const std::string& GetCurrentFontName(); 37 | static const std::string& GetCurrentLanguage(); 38 | static const std::vector& GetLanguages(); 39 | static const std::string GetLanguagePseudo(const std::string& translationName); 40 | static void SetLanguage(const std::string& language); 41 | 42 | #ifdef _DEBUG 43 | static nlohmann::json DumpTranslateConfigTemplate(); 44 | #endif 45 | 46 | private: 47 | static std::string FindTranslationString(const std::string& origin); 48 | static void NotifyUpdate(); 49 | 50 | inline static std::list> _updateFlags; 51 | inline static std::unordered_map _translations; 52 | 53 | inline static std::vector _languages; 54 | inline static std::string _currentLanguage = "default"; 55 | inline static std::string _defaultLanguagePseudo = "English | EN"; 56 | inline static std::string _defaultFontName = "DefaultFont"; 57 | 58 | inline static std::string _currentFont = _defaultFontName; 59 | inline static nlohmann::json _languagesInfo; 60 | 61 | #ifdef _DEBUG 62 | inline static std::unordered_set _debugOrigins; 63 | #endif 64 | 65 | static inline TEvent<> _languageChangedEvent; 66 | 67 | public: 68 | static inline IEvent<>& LanguageChangedEvent = _languageChangedEvent; 69 | }; 70 | 71 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/CheatManagerBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace cheat 14 | { 15 | class CheatManagerBase 16 | { 17 | public: 18 | virtual ~CheatManagerBase() = default; 19 | 20 | static bool IsMenuShowed(); 21 | 22 | //static CheatManagerBase& GetInstance(); 23 | CheatManagerBase(CheatManagerBase const&) = delete; 24 | void operator=(CheatManagerBase const&) = delete; 25 | 26 | void AddFeature(Feature* feature); 27 | void AddFeatures(std::vector features); 28 | 29 | void SetModuleOrder(std::vector moduleOrder); 30 | 31 | void OnKeyUp(short key, bool& cancelled); 32 | void OnWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool& cancelled); 33 | void OnRender(); 34 | 35 | void Init(renderer::DXVersion dxVersion = renderer::DXVersion::D3D11); 36 | 37 | virtual void CursorSetVisibility(bool visibility) = 0; 38 | virtual bool CursorGetVisibility() = 0; 39 | 40 | protected: 41 | config::Field f_ModuleListWidth; 42 | config::Field f_SelectedModule; 43 | const std::string* m_SelectedSection; 44 | 45 | std::vector m_Features; 46 | std::vector m_ModuleOrder; 47 | std::map>> m_FeatureMap; 48 | 49 | inline static bool s_IsMenuShowed = false; 50 | bool m_IsBlockingInput; 51 | bool m_IsPrevCursorActive; 52 | bool m_IsProfileConfigurationShowed; 53 | 54 | explicit CheatManagerBase(); 55 | 56 | void DrawExternal() const; 57 | 58 | void DrawMenu(); 59 | void DrawMenuSection(const std::string& sectionName, const std::vector& features, bool needGroup) const; 60 | 61 | virtual void DrawProfileGlobalActivities(); 62 | virtual void DrawProfileEntryActivities(const std::string&profileName); 63 | virtual void DrawProfileEntry(const std::string& profileName); 64 | virtual void DrawProfileTableHeader(); 65 | virtual int GetProfileTableColumnCount(); 66 | virtual void DrawProfileConfiguration(); 67 | virtual void DrawProfileLine(); 68 | 69 | virtual void DrawStatus() const; 70 | virtual void DrawInfo(); 71 | void DrawFps(); 72 | void DrawWarning(); 73 | static void DrawNotifications(); 74 | void PushFeature(Feature* feature); 75 | void CheckToggles(short key) const; 76 | 77 | std::string GetModuleRepr(const std::string& name); 78 | void DrawSectionSelection(const std::string& name, const std::string& translatedName, std::string*& currentModule, std::string& targetModule, size_t index); 79 | void ToggleMenuShow(); 80 | }; 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/Feature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define TRANSLATED_GROUP_INFO(GROUP_NAME, MODULE_NAME) \ 6 | static FeatureGUIInfo info { \ 7 | GROUP_NAME, \ 8 | {}, \ 9 | \ 10 | MODULE_NAME, \ 11 | {} \ 12 | }; \ 13 | \ 14 | info.groupRepr = _TR(GROUP_NAME); \ 15 | info.moduleRepr = _TR(MODULE_NAME); 16 | 17 | #define TRANSLATED_MODULE_INFO(MODULE_NAME)\ 18 | static FeatureGUIInfo info { \ 19 | {}, \ 20 | {}, \ 21 | \ 22 | MODULE_NAME, \ 23 | {} \ 24 | }; \ 25 | \ 26 | info.moduleRepr = _TR(MODULE_NAME); 27 | 28 | 29 | namespace cheat 30 | { 31 | 32 | struct FeatureGUIInfo 33 | { 34 | std::string groupKey; 35 | std::string groupRepr; 36 | 37 | std::string moduleKey; 38 | std::string moduleRepr; 39 | }; 40 | 41 | class Feature 42 | { 43 | public: 44 | // GUI handlers 45 | virtual const FeatureGUIInfo& GetGUIInfo() const = 0; 46 | 47 | virtual void DrawMain() = 0; 48 | 49 | virtual bool NeedStatusDraw() const { return false; }; 50 | virtual void DrawStatus() { }; 51 | 52 | virtual bool NeedInfoDraw() const { return false; }; 53 | virtual void DrawInfo() { }; 54 | 55 | virtual void DrawExternal() { }; 56 | 57 | protected: 58 | virtual ~Feature() = default; 59 | }; 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/fields/NamedHotkey.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "NamedHotkey.h" 3 | 4 | namespace cheat 5 | { 6 | NamedHotkey::NamedHotkey(const std::string& name, bool enabled) 7 | : m_Name(name), config::Toggle(enabled) 8 | { } 9 | 10 | NamedHotkey::NamedHotkey(const std::string& name, const Hotkey& hotkey) 11 | : m_Name(name), config::Toggle(hotkey) 12 | { } 13 | 14 | std::string NamedHotkey::name() 15 | { 16 | return m_Name; 17 | } 18 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/fields/NamedHotkey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat 6 | { 7 | class NamedHotkey : public config::Toggle 8 | { 9 | public: 10 | NamedHotkey(const std::string& name, bool enabled); 11 | NamedHotkey(const std::string& name, const Hotkey& hotkey); 12 | 13 | virtual std::string name(); 14 | 15 | private: 16 | std::string m_Name; 17 | }; 18 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/fields/TranslatedHotkey.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "TranslatedHotkey.h" 3 | 4 | #include 5 | 6 | namespace cheat 7 | { 8 | TranslatedHotkey::TranslatedHotkey(const std::string& name, bool enabled) 9 | : NamedHotkey(name, enabled) {} 10 | 11 | TranslatedHotkey::TranslatedHotkey(const std::string& name, const Hotkey& hotkey) 12 | : NamedHotkey(name, hotkey) {} 13 | 14 | std::string TranslatedHotkey::name() 15 | { 16 | return Translator::RuntimeTranslate(NamedHotkey::name()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/fields/TranslatedHotkey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat 6 | { 7 | class TranslatedHotkey : public NamedHotkey 8 | { 9 | public: 10 | TranslatedHotkey(const std::string& name, bool enabled); 11 | TranslatedHotkey(const std::string& name, const Hotkey& hotkey); 12 | 13 | std::string name() final; 14 | }; 15 | } 16 | 17 | namespace config { 18 | template<> 19 | class Field : public internal::FieldBase 20 | { 21 | public: 22 | using base = internal::FieldBase; 23 | using base::operator=; 24 | using base::base; 25 | 26 | operator bool() const 27 | { 28 | return base::value().enabled(); 29 | } 30 | }; 31 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/misc/Language.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Language.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace cheat::feature 14 | { 15 | Language::Language() : Feature(), 16 | NF(f_Language, "Settings::Language", "default") 17 | { 18 | Translator::SetLanguage(f_Language); 19 | } 20 | 21 | const FeatureGUIInfo& Language::GetGUIInfo() const 22 | { 23 | TRANSLATED_MODULE_INFO("Settings"); 24 | return info; 25 | } 26 | 27 | void Language::DrawMain() 28 | { 29 | if (ImGui::BeginCombo(_TR("Language"), Translator::GetLanguagePseudo(f_Language).c_str())) 30 | { 31 | for (auto& language : Translator::GetLanguages()) 32 | { 33 | bool is_selected = (language == f_Language.value()); 34 | if (ImGui::Selectable(Translator::GetLanguagePseudo(language).c_str(), is_selected)) 35 | { 36 | f_Language = language; 37 | Translator::SetLanguage(language); 38 | } 39 | 40 | if (is_selected) 41 | ImGui::SetItemDefaultFocus(); 42 | } 43 | ImGui::EndCombo(); 44 | } 45 | 46 | #ifdef _DEBUG 47 | if (ImGui::Button("Dump translates")) 48 | { 49 | auto filepath = util::GetCurrentPath() / "languages.json"; 50 | std::ofstream ofile(filepath); 51 | ofile << Translator::DumpTranslateConfigTemplate().dump(4); 52 | } 53 | #endif 54 | } 55 | 56 | Language& Language::GetInstance() 57 | { 58 | static Language instance; 59 | return instance; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/misc/Language.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class Language : public Feature 9 | { 10 | public: 11 | config::Field f_Language; 12 | 13 | static Language& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | private: 19 | Language(); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/misc/Settings.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-base/src/cheat-base/cheat/misc/Settings.cpp -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/cheat/misc/Settings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | 9 | class Settings : public Feature 10 | { 11 | public: 12 | config::Field f_MenuKey; 13 | config::Field f_HotkeysEnabled; 14 | 15 | config::Field f_StatusMove; 16 | config::Field f_StatusShow; 17 | 18 | config::Field f_InfoMove; 19 | config::Field f_InfoShow; 20 | 21 | config::Field f_FpsShow; 22 | config::Field f_FpsMove; 23 | 24 | config::Field f_NotificationsShow; 25 | config::Field f_NotificationsDelay; 26 | 27 | config::Field f_ConsoleLogging; 28 | config::Field f_FileLogging; 29 | 30 | config::Field f_FastExitEnable; 31 | config::Field f_HotkeyExit; 32 | 33 | config::Field f_FontSize; 34 | config::Field f_ShowStyleEditor; 35 | std::filesystem::path themesDir; 36 | config::Field f_DefaultTheme; 37 | 38 | config::Field f_InitializationDelay; 39 | 40 | static Settings& GetInstance(); 41 | 42 | void InitializationDelayLoad(); 43 | void WriteInitializationDelay(uint32_t delay); 44 | 45 | const FeatureGUIInfo& GetGUIInfo() const override; 46 | void DrawMain() override; 47 | void Init(); 48 | 49 | private: 50 | struct Theme { 51 | std::map colors; 52 | std::map styles; 53 | }; 54 | std::map m_Themes; 55 | void ThemeImport(std::filesystem::directory_entry file); 56 | void ThemeExport(std::string name, bool replace = false); 57 | void ApplyTheme(std::string name); 58 | std::string cma; 59 | std::string ae_Name; 60 | std::string DllPath; 61 | bool ADll; 62 | 63 | void OnExitKeyPressed(); 64 | Settings(); 65 | }; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/Config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Field.h" 4 | #include 5 | #include 6 | #include 7 | 8 | #include "fields/Toggle.h" 9 | #include "fields/Enum.h" 10 | 11 | #define SNFEX(field, name, section, defaultValue, shared) config::CreateField(name, section, shared, defaultValue) 12 | #define SNFB(field, section, defaultValue, shared) SNFEX(field, config::internal::FixFieldName(#field), section, defaultValue, shared) 13 | #define SNF(field, section, defaultValue) SNFB(field, section, defaultValue, false) 14 | 15 | #define NFEX(field, name, section, defaultValue, shared) field##(SNFEX(field, name, section, defaultValue, shared)) 16 | #define NFEXUP(field, name, section, shared, ...) field##(config::CreateField(name, section, shared, __VA_ARGS__)) 17 | 18 | #define NFB(field, section, defaultValue, shared) NFEX(field, config::internal::FixFieldName(#field), section, defaultValue, shared) 19 | #define NFS(field, section, defaultValue) NFB(field, section, defaultValue, true) 20 | #define NF(field, section, defaultValue) NFB(field, section, defaultValue, false) 21 | 22 | #define NFPB(field, section, shared, ...) NFEXUP(field, config::internal::FixFieldName(#field), section, shared, __VA_ARGS__) 23 | #define NFPS(field, section, ...) NFPB(field, section, true, __VA_ARGS__) 24 | #define NFP(field, section, ...) NFPB(field, section, false, __VA_ARGS__) 25 | 26 | namespace config 27 | { 28 | namespace internal 29 | { 30 | template 31 | std::vector s_Fields; 32 | 33 | void AddField(std::shared_ptr field); 34 | 35 | inline std::string FixFieldName(const std::string& fieldName) 36 | { 37 | if (fieldName.substr(1, 1) == "_") 38 | return fieldName.substr(2); 39 | return fieldName; 40 | } 41 | } 42 | 43 | template 44 | Field CreateField(const std::string& name, const std::string& section, bool multiProfile, Args... args) 45 | { 46 | auto newField = Field(name, section, T(args...), multiProfile); 47 | internal::s_Fields>.push_back(newField); 48 | internal::AddField(newField.entry()); 49 | return newField; 50 | } 51 | 52 | template 53 | std::vector>& GetFields() 54 | { 55 | return internal::s_Fields>; 56 | } 57 | 58 | void Initialize(const std::string& filePath); 59 | void SetupUpdate(TEvent<>*); 60 | 61 | void Refresh(); 62 | void Save(); 63 | 64 | void CreateProfile(const std::string& profileName, bool moveAfterCreate = true); 65 | void RemoveProfile(const std::string& profileName); 66 | void RenameProfile(const std::string& oldProfileName, const std::string& newProfileName); 67 | void ChangeProfile(const std::string& profileName); 68 | void DuplicateProfile(const std::string& profileName); 69 | std::vector const& GetProfiles(); 70 | std::string const& CurrentProfileName(); 71 | 72 | extern TEvent<> ProfileChanged; 73 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/Field.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "internal/FieldSerialize.h" 4 | #include "internal/FieldBase.h" 5 | namespace config 6 | { 7 | template 8 | class Field : public internal::FieldBase 9 | { 10 | public: 11 | using base = internal::FieldBase; 12 | using base::operator=; 13 | using base::base; 14 | }; 15 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/converters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace config::converters 8 | { 9 | 10 | template 11 | inline nlohmann::json ToJson(const T& value) 12 | { 13 | return nlohmann::json(value); 14 | } 15 | 16 | template 17 | inline void FromJson(T& value, const nlohmann::json& jObject) 18 | { 19 | jObject.get_to(value); 20 | } 21 | 22 | // Here is storing all simple converters json<->class 23 | 24 | // ImColor 25 | template<> 26 | inline nlohmann::json ToJson(const ImColor& value) 27 | { 28 | return nlohmann::json((ImU32)value); 29 | } 30 | 31 | template<> 32 | inline void FromJson(ImColor& value, const nlohmann::json& jObject) 33 | { 34 | value = { (ImU32)jObject }; 35 | } 36 | 37 | // Hotkey 38 | template<> 39 | inline nlohmann::json ToJson(const Hotkey& value) 40 | { 41 | auto keys = value.GetKeys(); 42 | if (keys.empty()) 43 | return {}; 44 | 45 | if (keys.size() == 1) 46 | return keys[0]; 47 | 48 | return nlohmann::json(value.GetKeys()); 49 | } 50 | 51 | template<> 52 | inline void FromJson(Hotkey& value, const nlohmann::json& jObject) 53 | { 54 | if (jObject.is_null() || jObject.empty()) 55 | return; 56 | 57 | if (jObject.is_number()) 58 | { 59 | value = { jObject.get() }; 60 | return; 61 | } 62 | 63 | value = { jObject.get>() }; 64 | } 65 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/fields/Enum.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace config 6 | { 7 | 8 | template 9 | class Enum 10 | { 11 | public: 12 | Enum() 13 | { 14 | static_assert(std::is_enum::value, "Must be an enum type"); 15 | m_Value = T(); 16 | } 17 | 18 | Enum(T enumValue) 19 | { 20 | static_assert(std::is_enum::value, "Must be an enum type"); 21 | m_Value = enumValue; 22 | } 23 | 24 | inline T value() const 25 | { 26 | return m_Value; 27 | } 28 | 29 | inline T* pointer() const 30 | { 31 | return const_cast(&m_Value); 32 | } 33 | 34 | inline operator T() 35 | { 36 | return value(); 37 | } 38 | 39 | inline T* operator&() 40 | { 41 | return pointer(); 42 | } 43 | 44 | inline uint32_t raw() const 45 | { 46 | return static_cast(m_Value); 47 | } 48 | 49 | inline Enum& operator=(const T& other) 50 | { 51 | static_assert(std::is_enum::value, "Must be an enum type"); 52 | m_Value = other; 53 | return *this; 54 | } 55 | 56 | inline Enum& operator=(const uint32_t& other) 57 | { 58 | m_Value = static_cast(other); 59 | return *this; 60 | } 61 | 62 | private: 63 | T m_Value; 64 | }; 65 | 66 | 67 | //// Okay, close your eyes and don't look at this mess. (Please) 68 | //template 69 | //class Field> : public internal::FieldBase> 70 | //{ 71 | //public: 72 | // using base = internal::FieldBase>; 73 | // using base::operator=; 74 | // using base::base; 75 | 76 | // operator T() const 77 | // { 78 | // return base::value(); 79 | // } 80 | //}; 81 | } 82 | 83 | namespace nlohmann 84 | { 85 | template 86 | struct adl_serializer> { 87 | static void to_json(json& j, const config::Enum& enumValue) 88 | { 89 | j = { 90 | { "name", magic_enum::enum_name(enumValue.value()) }, 91 | { "value", enumValue.raw() } 92 | }; 93 | } 94 | 95 | static void from_json(const json& j, config::Enum& value) 96 | { 97 | value = j["value"].get(); 98 | } 99 | }; 100 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/fields/Toggle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace config 8 | { 9 | template 10 | class Toggle : public ISerializable 11 | { 12 | public: 13 | 14 | bool enabled() const 15 | { 16 | return m_Enabled; 17 | } 18 | 19 | const T& value() const 20 | { 21 | return m_Value; 22 | } 23 | 24 | T& value() 25 | { 26 | return m_Value; 27 | } 28 | 29 | void set_enabled(bool enable, bool notify = true) 30 | { 31 | m_Enabled = enable; 32 | 33 | if (notify) 34 | OnEnableChange(this); 35 | } 36 | 37 | void set_value(const T& val) 38 | { 39 | m_Value = val; 40 | } 41 | 42 | void to_json(nlohmann::json& j) const override 43 | { 44 | j = { 45 | { "toggled", m_Enabled }, 46 | { "value", config::converters::ToJson(m_Value) } 47 | }; 48 | } 49 | 50 | void from_json(const nlohmann::json& j) override 51 | { 52 | if (j.is_boolean()) 53 | { 54 | m_Enabled = j; 55 | m_Value = {}; 56 | return; 57 | } 58 | 59 | m_Enabled = j["toggled"].get(); 60 | config::converters::FromJson(m_Value, j["value"]); 61 | } 62 | 63 | explicit Toggle(const T& val) : m_Enabled(false), m_Value(val), OnEnableChange() { } 64 | 65 | explicit Toggle(bool enable) : m_Enabled(enable), m_Value(), OnEnableChange() { } 66 | 67 | explicit Toggle() : m_Enabled(false), m_Value(), OnEnableChange() { } 68 | 69 | inline operator bool() 70 | { 71 | return m_Enabled; 72 | } 73 | 74 | inline bool operator==(const Toggle& rhs) 75 | { 76 | return rhs.m_Enabled == m_Enabled && rhs.m_Value == m_Value; 77 | } 78 | 79 | TEvent*> OnEnableChange; 80 | 81 | private: 82 | bool m_Enabled; 83 | T m_Value; 84 | }; 85 | 86 | // Okay, close your eyes and don't look at this mess. (Please) 87 | template 88 | class Field> : public internal::FieldBase> 89 | { 90 | public: 91 | using base = internal::FieldBase>; 92 | using base::operator=; 93 | using base::base; 94 | 95 | operator bool() const 96 | { 97 | return base::value().enabled(); 98 | } 99 | 100 | operator T&() const 101 | { 102 | return base::value().value(); 103 | } 104 | }; 105 | } 106 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/internal/FieldEntry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace config::internal 7 | { 8 | class FieldEntry 9 | { 10 | public: 11 | FieldEntry(const std::string& name, const std::string& sectionName, bool multiProfile = false) 12 | : m_Name(name), m_Section(sectionName), m_MultiProfile(multiProfile), m_Container(nullptr) {} 13 | 14 | TEvent ChangedEvent; 15 | TEvent MovedEvent; 16 | TEvent RepositionEvent; 17 | 18 | inline virtual void FireChanged() 19 | { 20 | ChangedEvent(this); 21 | } 22 | 23 | virtual nlohmann::json ToJson() = 0; 24 | virtual void FromJson(const nlohmann::json& value) = 0; 25 | virtual void Reset() = 0; 26 | 27 | inline bool IsShared() const 28 | { 29 | return m_MultiProfile; 30 | } 31 | 32 | inline std::string GetName() const 33 | { 34 | return m_Name; 35 | } 36 | 37 | inline std::string GetSection() const 38 | { 39 | return m_Section; 40 | } 41 | 42 | inline nlohmann::json* GetContainer() const 43 | { 44 | return m_Container; 45 | } 46 | 47 | inline void Reposition(const std::string& newSection, bool shared = false) 48 | { 49 | std::string oldSection = m_Section; 50 | bool oldMultiProfile = m_MultiProfile; 51 | 52 | m_Section = newSection; 53 | m_MultiProfile = shared; 54 | 55 | RepositionEvent(this, newSection, shared); 56 | } 57 | 58 | inline void Move(const std::string& newSection, bool shared = false) 59 | { 60 | std::string oldSection = m_Section; 61 | bool oldMultiProfile = m_MultiProfile; 62 | 63 | m_Section = newSection; 64 | m_MultiProfile = shared; 65 | 66 | MovedEvent(this, oldSection, oldMultiProfile); 67 | } 68 | 69 | inline void SetContainer(nlohmann::json* newContainer) 70 | { 71 | m_Container = nullptr; 72 | } 73 | 74 | protected: 75 | std::string m_Name; 76 | std::string m_Section; 77 | bool m_MultiProfile; 78 | 79 | nlohmann::json* m_Container; 80 | }; 81 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/config/internal/FieldSerialize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FieldEntry.h" 4 | #include 5 | 6 | namespace config::internal 7 | { 8 | namespace CHECK 9 | { 10 | struct No {}; 11 | template No operator== (const T&, const Arg&); 12 | 13 | template 14 | struct EqualExists 15 | { 16 | enum { value = !std::is_same() == std::declval()), No>::value }; 17 | }; 18 | } 19 | 20 | template 21 | class FieldSerialize : public FieldEntry 22 | { 23 | public: 24 | FieldSerialize(const std::string& name, const std::string& sectionName, const T& defaultValue, bool multiProfile = false) : 25 | FieldEntry(name, sectionName, multiProfile), m_Value(defaultValue), m_DefaultValue(defaultValue) { } 26 | 27 | nlohmann::json ToJson() override 28 | { 29 | if constexpr (CHECK::EqualExists::value) 30 | { 31 | if (m_Value == m_DefaultValue) 32 | return {}; 33 | } 34 | 35 | return converters::ToJson(m_Value); 36 | } 37 | 38 | void FromJson(const nlohmann::json& jObject) override 39 | { 40 | if (jObject.empty()) 41 | { 42 | m_Value = m_DefaultValue; 43 | return; 44 | } 45 | 46 | converters::FromJson(m_Value, jObject); 47 | } 48 | 49 | void Reset() override 50 | { 51 | m_Value = m_DefaultValue; 52 | } 53 | 54 | T m_Value; 55 | T m_DefaultValue; 56 | }; 57 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/handlers/abstracteventhandler.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "eventhandlerptr.h" 4 | 5 | 6 | namespace events::handlers 7 | { 8 | template 9 | class AbstractEventHandler 10 | { 11 | using MyType = AbstractEventHandler; 12 | 13 | public: 14 | 15 | virtual ~AbstractEventHandler() {} 16 | 17 | virtual void call(TParams... params) = 0; 18 | 19 | bool operator==(const MyType& other) const noexcept 20 | { 21 | return isEquals(other); 22 | } 23 | bool operator!=(const MyType& other) const noexcept 24 | { 25 | return !(*this == other); 26 | } 27 | 28 | protected: 29 | 30 | AbstractEventHandler() {} 31 | 32 | virtual bool isEquals(const MyType& other) const noexcept = 0; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/handlers/eventhandlerptr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | namespace events::handlers 7 | { 8 | template class AbstractEventHandler; 9 | 10 | template 11 | using TEventHandlerPtr = std::shared_ptr>; 12 | } 13 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/handlers/handlercast.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "eventhandlerptr.h" 5 | 6 | 7 | namespace events::handlers 8 | { 9 | template 10 | struct HandlerCast 11 | { 12 | template 13 | static constexpr TEventHandlerPtr cast(TSome& some) 14 | { 15 | return static_cast>(some); 16 | } 17 | }; 18 | 19 | template 20 | struct HandlerCast> 21 | { 22 | template 23 | static constexpr TEventHandlerPtr cast(std::shared_ptr some) 24 | { 25 | return HandlerCast::template cast(*some); 26 | } 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/handlers/helpers/innerholder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "objectsaver.hpp" 4 | 5 | 6 | namespace events::handlers 7 | { 8 | template 9 | struct AbstractInnerHolder 10 | { 11 | virtual ~AbstractInnerHolder() {} 12 | 13 | virtual inline TBase& get() = 0; 14 | inline const TBase& get() const 15 | { 16 | return const_cast&>(*this).get(); 17 | } 18 | }; 19 | 20 | 21 | template 22 | struct TInnerHolder : public AbstractInnerHolder 23 | { 24 | using TInnerObject = typename ObjectSaver::TObject; 25 | 26 | TInnerHolder(TInner _inner) : 27 | AbstractInnerHolder(), 28 | inner(std::forward(_inner)) 29 | { } 30 | 31 | virtual inline TBase& get() override 32 | { 33 | return static_cast(inner); 34 | } 35 | 36 | TInnerObject inner; 37 | }; 38 | 39 | 40 | template 41 | AbstractInnerHolder& createInnerHolder(TArgInner&& inner) 42 | { 43 | using TAssignInner = decltype(inner); 44 | return *new TInnerHolder(std::forward(inner)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/handlers/helpers/objectsaver.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace events::handlers 5 | { 6 | template 7 | struct ObjectSaver; 8 | 9 | template 10 | struct ObjectSaver 11 | { 12 | using TObject = LValue&; 13 | }; 14 | 15 | template 16 | struct ObjectSaver 17 | { 18 | using TObject = RValue; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/helpers/is_equatable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | template 7 | class is_equatable 8 | { 9 | private: 10 | 11 | template 12 | static constexpr std::true_type exists( decltype( std::declval() == std::declval() )* = nullptr ) noexcept; 13 | 14 | template 15 | static constexpr std::false_type exists( ... ) noexcept; 16 | 17 | public: 18 | 19 | static constexpr bool value = decltype( exists( nullptr ) )::value; 20 | }; 21 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/abstracteventjoin.cpp: -------------------------------------------------------------------------------- 1 | #include "abstracteventjoin.h" 2 | 3 | 4 | namespace events::joins 5 | { 6 | AbstractEventJoin::AbstractEventJoin() {} 7 | 8 | AbstractEventJoin::~AbstractEventJoin() {} 9 | } 10 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/abstracteventjoin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace events::joins 5 | { 6 | class AbstractEventJoin 7 | { 8 | public: 9 | 10 | virtual ~AbstractEventJoin(); 11 | 12 | virtual bool isJoined() const = 0; 13 | virtual bool join() = 0; 14 | virtual bool unjoin() = 0; 15 | 16 | protected: 17 | 18 | AbstractEventJoin(); 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/eventjoinwrapper.cpp: -------------------------------------------------------------------------------- 1 | #include "eventjoinwrapper.h" 2 | 3 | #include 4 | #include "abstracteventjoin.h" 5 | 6 | 7 | namespace events::joins 8 | { 9 | constexpr EventJoinWrapper::EventJoinWrapper() noexcept : 10 | m_eventJoin( nullptr ) 11 | { } 12 | 13 | EventJoinWrapper::EventJoinWrapper( EventJoinWrapper&& other ) noexcept : 14 | m_eventJoin( std::move( other.m_eventJoin ) ) 15 | { } 16 | 17 | EventJoinWrapper::EventJoinWrapper( EventJoinWrapper& other ) noexcept : 18 | m_eventJoin( other.m_eventJoin ) 19 | { } 20 | 21 | EventJoinWrapper& EventJoinWrapper::operator=( EventJoinWrapper&& other ) noexcept 22 | { 23 | m_eventJoin = std::move( other.m_eventJoin ); 24 | 25 | return *this; 26 | } 27 | 28 | EventJoinWrapper& EventJoinWrapper::operator=( const EventJoinWrapper& other ) noexcept 29 | { 30 | m_eventJoin = other.m_eventJoin; 31 | 32 | return *this; 33 | } 34 | 35 | 36 | EventJoinWrapper::operator bool() const 37 | { 38 | return isJoined(); 39 | } 40 | 41 | 42 | bool EventJoinWrapper::isAssigned() const 43 | { 44 | return ( m_eventJoin != nullptr ); 45 | } 46 | 47 | 48 | bool EventJoinWrapper::isJoined() const 49 | { 50 | return ( m_eventJoin != nullptr && m_eventJoin->isJoined() ); 51 | } 52 | 53 | bool EventJoinWrapper::join() 54 | { 55 | return ( m_eventJoin != nullptr ? m_eventJoin->join() : false ); 56 | } 57 | 58 | bool EventJoinWrapper::unjoin() 59 | { 60 | return ( m_eventJoin != nullptr ? m_eventJoin->unjoin() : false ); 61 | } 62 | } // events 63 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/eventjoinwrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../handlers/eventhandlerptr.h" 5 | 6 | 7 | template class IEvent; 8 | 9 | namespace events::joins 10 | { 11 | class AbstractEventJoin; 12 | 13 | class EventJoinWrapper 14 | { 15 | public: 16 | 17 | template 18 | inline EventJoinWrapper(IEvent& _event, TSome&& handler); 19 | 20 | constexpr EventJoinWrapper() noexcept; 21 | EventJoinWrapper(EventJoinWrapper&& other) noexcept; 22 | EventJoinWrapper(EventJoinWrapper& other) noexcept; 23 | 24 | EventJoinWrapper& operator=(EventJoinWrapper&& other) noexcept; 25 | EventJoinWrapper& operator=(const EventJoinWrapper& other) noexcept; 26 | 27 | operator bool() const; 28 | 29 | bool isAssigned() const; 30 | 31 | bool isJoined() const; 32 | bool join(); 33 | bool unjoin(); 34 | 35 | private: 36 | 37 | std::shared_ptr m_eventJoin; 38 | }; 39 | } 40 | 41 | namespace events 42 | { 43 | using EventJoin = joins::EventJoinWrapper; 44 | } 45 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/eventjoinwrapper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "eventjoinwrapper.h" 4 | #include "handlereventjoin.h" 5 | #include "../handlers/handlercast.hpp" 6 | 7 | 8 | namespace events::joins 9 | { 10 | template 11 | EventJoinWrapper::EventJoinWrapper( IEvent& _event, TSome&& handler ) : 12 | m_eventJoin( std::make_shared>( _event, ::events::handlers::HandlerCast::template cast( handler ) ) ) 13 | { } 14 | } 15 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/handlereventjoin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "abstracteventjoin.h" 4 | #include "../handlers/eventhandlerptr.h" 5 | 6 | 7 | template class IEvent; 8 | 9 | namespace events::joins 10 | { 11 | template 12 | class HandlerEventJoin : public AbstractEventJoin 13 | { 14 | public: 15 | 16 | HandlerEventJoin(IEvent& _event, ::events::handlers::TEventHandlerPtr handler) : 17 | AbstractEventJoin(), 18 | m_event(_event), 19 | m_handler(handler) 20 | { } 21 | 22 | virtual inline bool isJoined() const override; 23 | virtual inline bool join() override; 24 | virtual inline bool unjoin() override; 25 | 26 | private: 27 | 28 | IEvent& m_event; 29 | ::events::handlers::TEventHandlerPtr m_handler; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/events/joins/handlereventjoin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "handlereventjoin.h" 4 | #include "../event.hpp" 5 | 6 | 7 | namespace events::joins 8 | { 9 | template 10 | bool HandlerEventJoin::isJoined() const 11 | { 12 | return m_event.isHandlerAdded(m_handler); 13 | } 14 | 15 | template 16 | bool HandlerEventJoin::join() 17 | { 18 | return m_event.addHandler(m_handler); 19 | } 20 | 21 | template 22 | bool HandlerEventJoin::unjoin() 23 | { 24 | return m_event.removeHandler(m_handler); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/globals.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "globals.h" 4 | 5 | namespace events 6 | { 7 | TCancelableEvent KeyUpEvent{}; 8 | TCancelableEvent WndProcEvent {}; 9 | TEvent<> RenderEvent {}; 10 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace events 8 | { 9 | extern TCancelableEvent KeyUpEvent; 10 | extern TCancelableEvent WndProcEvent; 11 | extern TEvent<> RenderEvent; 12 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/inject/load-library.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "load-library.h" 3 | #include 4 | 5 | #if defined(DISABLE_OUTPUT) 6 | #define ILog(data, ...) 7 | #define IPrintError(text, ...) 8 | #else 9 | #define ILog(text, ...) printf(text, __VA_ARGS__) 10 | #define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl 11 | #endif 12 | 13 | bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath) 14 | { 15 | HMODULE hKernel = GetModuleHandle("kernel32.dll"); 16 | if (hKernel == NULL) 17 | { 18 | ILogError("[DLL Injection] Failed to get kernel32.dll module address.\n"); 19 | return false; 20 | } 21 | 22 | LPVOID pLoadLibrary = (LPVOID)GetProcAddress(hKernel, "LoadLibraryA"); 23 | if (pLoadLibrary == NULL) { 24 | ILogError("[DLL Injection] Failed to get LoadLibraryA address.\n"); 25 | return false; 26 | } 27 | 28 | LPVOID pDLLPath = VirtualAllocEx(hProc, NULL, strlen(dllpath.c_str()) + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); 29 | if (pDLLPath == NULL) { 30 | ILogError("[DLL Injection] Failed to allocate memory for DLLPath in target process.\n"); 31 | return false; 32 | } 33 | 34 | // Write the string name of our DLL in the memory allocated 35 | BOOL writeResult = WriteProcessMemory(hProc, pDLLPath, dllpath.c_str(), strlen(dllpath.c_str()), NULL); 36 | if (writeResult == FALSE) { 37 | ILogError("[DLL Injection] Failed to write remote process memory.\n"); 38 | return false; 39 | } 40 | 41 | // Load our DLL by calling loadlibrary in the other process and passing our dll name 42 | HANDLE hThread = CreateRemoteThread(hProc, NULL, NULL, (LPTHREAD_START_ROUTINE)pLoadLibrary, (LPVOID)pDLLPath, NULL, NULL); 43 | if (hThread == NULL) { 44 | ILogError("[DLL Injection] Failed to create remote thread.\n"); 45 | VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE); 46 | return false; 47 | } 48 | 49 | // Waiting for thread end and release unnecessary data. 50 | if (WaitForSingleObject(hThread, 2000) == WAIT_OBJECT_0) 51 | { 52 | // ILog("[DLL Injection] Remote thread ended successfully.\n"); 53 | VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE); 54 | } 55 | 56 | CloseHandle(hThread); 57 | 58 | ILog("[DLL Injection] Successfully LoadLibraryA injection.\n"); 59 | return true; 60 | } -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/inject/load-library.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath); -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/inject/manual-map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | bool ManualMapDLL(HANDLE hProc, const std::string& filepath); 4 | bool ManualMapDLL(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader = false, bool ClearNonNeededSections = false, bool AdjustProtections = true, bool SEHExceptionSupport = false, DWORD fdwReason = DLL_PROCESS_ATTACH); -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/render/ImageLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | class ImageLoader 12 | { 13 | public: 14 | struct ImageData 15 | { 16 | ImTextureID textureID; 17 | ImVec2 size; 18 | }; 19 | 20 | struct GIFData 21 | { 22 | std::vector textureIDs; 23 | std::vector frame_delays; //show current frame for i*(1/100) of a sec 24 | std::vector size; 25 | uint32_t current_frame = 0; 26 | std::chrono::system_clock::time_point current_time = std::chrono::system_clock::now(); 27 | std::chrono::system_clock::time_point previous_time = std::chrono::system_clock::now(); 28 | 29 | uint32_t get_next_frame_index() 30 | { 31 | current_frame = (++current_frame) % textureIDs.size(); 32 | return current_frame; 33 | } 34 | 35 | bool is_next_frame() 36 | { 37 | current_time = std::chrono::system_clock::now(); 38 | std::chrono::duration elapsed_time = current_time - previous_time; 39 | if (elapsed_time.count() >= (frame_delays[current_frame])) 40 | { 41 | previous_time = current_time; 42 | return true; 43 | } 44 | return false; 45 | } 46 | 47 | ImTextureID get_next_frame() 48 | { 49 | return textureIDs[get_next_frame_index()]; 50 | } 51 | 52 | ImTextureID get_current_frame() 53 | { 54 | return textureIDs[current_frame]; 55 | } 56 | 57 | void render(ImVec2 size) 58 | { 59 | if (is_next_frame()) 60 | { 61 | ImGui::Image((void*)get_next_frame(), size); 62 | } 63 | else 64 | { 65 | ImGui::Image((void*)get_current_frame(), size); 66 | } 67 | } 68 | }; 69 | 70 | static std::optional GetImage(const std::string& imageName, const char* imageType = "PNG"); 71 | static std::optional GetGIF(const std::string& imageName); 72 | 73 | private: 74 | inline static std::map s_Textures {}; 75 | inline static std::map s_GIFS {}; 76 | }; -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/render/backend/dx11-hook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace backend 12 | { 13 | void InitializeDX11Hooks(); 14 | 15 | // Thanks to https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#example-for-directx11-users 16 | bool LoadTextureFromMemory(LPBYTE image_data, int image_width, int image_height, ID3D11ShaderResourceView** out_srv, int* out_width, int* out_height); 17 | 18 | class DX11Events 19 | { 20 | public: 21 | inline static TEvent RenderEvent{}; 22 | inline static TEvent InitializeEvent{}; 23 | inline static TEvent<> FailedEvent{}; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/render/backend/dx12-hook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace backend 11 | { 12 | void InitializeDX12Hooks(); 13 | 14 | // Thanks to https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#example-for-directx11-users 15 | bool LoadTextureFromMemory(LPBYTE image_data, int image_width, int image_height, D3D12_CPU_DESCRIPTOR_HANDLE srv_cpu_handle, 16 | ID3D12Resource** out_tex_resource, int* out_width, int* out_height); 17 | 18 | class DX12Events 19 | { 20 | public: 21 | inline static TEvent<> PreRenderEvent{}; 22 | inline static TEvent PostRenderEvent{}; 23 | inline static TEvent InitializeEvent{}; 24 | }; 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/render/renderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace renderer 7 | { 8 | enum class DXVersion 9 | { 10 | D3D9, 11 | D3D10, 12 | D3D11, 13 | D3D12 14 | }; 15 | 16 | class IFont 17 | { 18 | public: 19 | virtual ~IFont() = default; 20 | virtual std::string GetName() const = 0; 21 | virtual ImFont* AddImGuiFont(float fontSize, ImFontConfig* fontConfig) = 0; 22 | }; 23 | 24 | class Font : public IFont 25 | { 26 | public: 27 | enum FONT_RANGE : uint32_t 28 | { 29 | FONT_RANGE_NONE = 0, 30 | FONT_RANGE_DEFAULT = 1, 31 | FONT_RANGE_CHINESE_FULL = 1 << 1, 32 | FONT_RANGE_CHINESE_SIMPLIFIED = 1 << 2, 33 | FONT_RANGE_CYRILLIC = 1 << 3, 34 | FONT_RANGE_JAPANESE = 1 << 4, 35 | FONT_RANGE_KOREAN = 1 << 5, 36 | FONT_RANGE_THAI = 1 << 6, 37 | FONT_RANGE_VIETNAMESE = 1 << 7 38 | }; 39 | 40 | public: 41 | Font(const std::string& name, LPBYTE pData, DWORD dDataSize, FONT_RANGE ranges); 42 | Font(const std::string& name, LPBYTE pData, DWORD dDataSize, const ImWchar* ranges); 43 | 44 | std::string GetName() const override; 45 | ImFont* AddImGuiFont(float fontSize, ImFontConfig* fontConfig) override; 46 | 47 | inline LPBYTE GetData() const; 48 | inline DWORD GetSize() const; 49 | inline const ImWchar* GetGlyphRanges() const; 50 | 51 | // Fix Chinese missing characters 52 | const ImWchar* GetGlyphRangesChineseFull(); 53 | 54 | void AddRange(FONT_RANGE ranges); 55 | void AddRange(const ImWchar* ranges); 56 | 57 | static std::shared_ptr LoadFontFromResource(int resourceId, const char* resourceType, const std::string& fontName, FONT_RANGE ranges); 58 | static std::shared_ptr LoadFontFromResource(int resourceId, const char* resourceType, const std::string& fontName, const ImWchar* ranges); 59 | 60 | private: 61 | std::string m_Name; 62 | LPBYTE m_Data; 63 | DWORD m_DataSize; 64 | ImWchar* m_Ranges; 65 | }; 66 | 67 | class FontComposit : public IFont 68 | { 69 | public: 70 | FontComposit(const std::string& name, const std::initializer_list& fonts); 71 | FontComposit(const std::string& name, const std::vector& fonts); 72 | 73 | std::string GetName() const override; 74 | ImFont* AddImGuiFont(float fontSize, ImFontConfig* fontConfig) override; 75 | 76 | private: 77 | std::string m_Name; 78 | std::vector m_Fonts; 79 | }; 80 | 81 | void Init(DXVersion version = DXVersion::D3D11); 82 | 83 | // Font system 84 | void AddFont(std::shared_ptr font); 85 | 86 | void SetDefaultFont(const std::string& fontName); 87 | ImFont* GetDefaultImGuiFont(); 88 | std::string GetDefaultFontName(); 89 | 90 | void SetDefaultFontSize(float fontSize); 91 | float GetDefaultFontSize(); 92 | 93 | // Font token system 94 | using FontToken = uint32_t; 95 | FontToken CreateFontToken(const std::string& fontName, float fontSize); 96 | bool DestroyFontToken(FontToken token); 97 | 98 | void SetTokenFontSize(FontToken token, float size); 99 | float GetTokenFontSize(FontToken token); 100 | 101 | void SetTokenFont(FontToken token, const std::string& fontName); 102 | std::string GetTokenFontName(FontToken token); 103 | 104 | ImFont* GetTokenFont(FontToken token); 105 | 106 | // Input lock 107 | void SetInputLock(void* id, bool value); 108 | void AddInputLocker(void* id); 109 | void RemoveInputLocker(void* id); 110 | bool IsInputLocked(); 111 | } 112 | -------------------------------------------------------------------------------- /cheat-base/src/cheat-base/thread-safe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | template 8 | class SafeQueue 9 | { 10 | public: 11 | SafeQueue() = default; 12 | SafeQueue(const SafeQueue&) = delete; 13 | SafeQueue& operator=(const SafeQueue&) = delete; 14 | 15 | SafeQueue(SafeQueue&& other) { 16 | std::lock_guard lock(mutex_); 17 | queue_ = std::move(other.queue_); 18 | } 19 | 20 | virtual ~SafeQueue() { } 21 | 22 | size_t size() const { 23 | std::lock_guard lock(mutex_); 24 | return queue_.size(); 25 | } 26 | 27 | std::optional pop() 28 | { 29 | std::lock_guard lock(mutex_); 30 | if (queue_.empty()) { 31 | return {}; 32 | } 33 | T tmp = queue_.front(); 34 | queue_.pop(); 35 | return tmp; 36 | } 37 | 38 | void push(const T& item) { 39 | std::lock_guard lock(mutex_); 40 | queue_.push(item); 41 | } 42 | 43 | private: 44 | std::queue queue_; 45 | mutable std::mutex mutex_; 46 | 47 | bool empty() const { 48 | return queue_.empty(); 49 | } 50 | }; 51 | 52 | template 53 | class SafeValue 54 | { 55 | public: 56 | SafeValue(T initValue) : value(initValue) {} 57 | 58 | SafeValue(const SafeValue&) = delete; 59 | SafeValue& operator=(const SafeValue&) = delete; 60 | 61 | T GetValue() const 62 | { 63 | std::lock_guard lock(mutex_); 64 | return value; 65 | } 66 | 67 | void SetValue(const T& newValue) 68 | { 69 | std::lock_guard lock(mutex_); 70 | value = newValue; 71 | } 72 | 73 | SafeValue& operator=(const T& newValue) 74 | { 75 | SetValue(newValue); 76 | return *this; 77 | } 78 | 79 | operator T() const 80 | { 81 | return GetValue(); 82 | } 83 | 84 | private: 85 | T value; 86 | mutable std::mutex mutex_; 87 | }; -------------------------------------------------------------------------------- /cheat-base/vendor/detours/detours-x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-base/vendor/detours/detours-x64.lib -------------------------------------------------------------------------------- /cheat-base/vendor/detours/detours-x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-base/vendor/detours/detours-x86.lib -------------------------------------------------------------------------------- /cheat-base/vendor/detours/detver.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Common version parameters. 4 | // 5 | // Microsoft Research Detours Package, Version 4.0.1 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | 10 | #define _USING_V110_SDK71_ 1 11 | #include "winver.h" 12 | #if 0 13 | #include 14 | #include 15 | #else 16 | #ifndef DETOURS_STRINGIFY 17 | #define DETOURS_STRINGIFY_(x) #x 18 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x) 19 | #endif 20 | 21 | #define VER_FILEFLAGSMASK 0x3fL 22 | #define VER_FILEFLAGS 0x0L 23 | #define VER_FILEOS 0x00040004L 24 | #define VER_FILETYPE 0x00000002L 25 | #define VER_FILESUBTYPE 0x00000000L 26 | #endif 27 | #define VER_DETOURS_BITS DETOURS_STRINGIFY(DETOURS_BITS) 28 | -------------------------------------------------------------------------------- /cheat-library/res/MiSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/MiSans-Regular.ttf -------------------------------------------------------------------------------- /cheat-library/res/NotoSansSC-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/NotoSansSC-Medium.otf -------------------------------------------------------------------------------- /cheat-library/res/Ruda-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/Ruda-Bold.ttf -------------------------------------------------------------------------------- /cheat-library/res/Ruda-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/Ruda-ExtraBold.ttf -------------------------------------------------------------------------------- /cheat-library/res/anim/akebi_bounce.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/anim/akebi_bounce.gif -------------------------------------------------------------------------------- /cheat-library/res/assembly_checksum.json: -------------------------------------------------------------------------------- 1 | { 2 | "china": { 3 | "game_version": "CNRELWin1.0.5", 4 | "modules": { 5 | "UnityPlayer.dll": { 6 | "checksum": 7660094679754433412, 7 | "timestamp": 0 8 | }, 9 | "GameAssembly.dll": { 10 | "checksum": 9848421818992720704, 11 | "timestamp": 0 12 | } 13 | }, 14 | "checksum": "114514" 15 | }, 16 | "global": { 17 | "game_version": "OSRELWin1.0.5", 18 | "modules": { 19 | "UnityPlayer.dll": { 20 | "checksum": 7660094679754433412, 21 | "timestamp": 0 22 | }, 23 | "GameAssembly.dll": { 24 | "checksum": 9848421818992720704, 25 | "timestamp": 0 26 | } 27 | }, 28 | "checksum": "114514" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cheat-library/res/icons/AphotiumOre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/AphotiumOre.png -------------------------------------------------------------------------------- /cheat-library/res/icons/BlazingAxeMitachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/BlazingAxeMitachurl.png -------------------------------------------------------------------------------- /cheat-library/res/icons/CoralButterfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/CoralButterfly.png -------------------------------------------------------------------------------- /cheat-library/res/icons/CracklingAxeMitachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/CracklingAxeMitachurl.png -------------------------------------------------------------------------------- /cheat-library/res/icons/DamagedStoneSlate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/DamagedStoneSlate.png -------------------------------------------------------------------------------- /cheat-library/res/icons/DoNotPublish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/DoNotPublish.png -------------------------------------------------------------------------------- /cheat-library/res/icons/ElectroAbyssMage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/ElectroAbyssMage.png -------------------------------------------------------------------------------- /cheat-library/res/icons/ElectroWhopperflower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/ElectroWhopperflower.png -------------------------------------------------------------------------------- /cheat-library/res/icons/EnergyPoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/EnergyPoint.png -------------------------------------------------------------------------------- /cheat-library/res/icons/FrostarmLawachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/FrostarmLawachurl.png -------------------------------------------------------------------------------- /cheat-library/res/icons/GlimmeringBeaconCannotTeleport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/GlimmeringBeaconCannotTeleport.png -------------------------------------------------------------------------------- /cheat-library/res/icons/HarpastumChest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/HarpastumChest.png -------------------------------------------------------------------------------- /cheat-library/res/icons/HydroAbyssMage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/HydroAbyssMage.png -------------------------------------------------------------------------------- /cheat-library/res/icons/LightGuidingCeremony.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/LightGuidingCeremony.png -------------------------------------------------------------------------------- /cheat-library/res/icons/Mural.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/Mural.png -------------------------------------------------------------------------------- /cheat-library/res/icons/MysteriousConch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/MysteriousConch.png -------------------------------------------------------------------------------- /cheat-library/res/icons/Ochimusha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/Ochimusha.png -------------------------------------------------------------------------------- /cheat-library/res/icons/PaintedWall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/PaintedWall.png -------------------------------------------------------------------------------- /cheat-library/res/icons/PyroAbyssMage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/PyroAbyssMage.png -------------------------------------------------------------------------------- /cheat-library/res/icons/PyroWhopperflower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/PyroWhopperflower.png -------------------------------------------------------------------------------- /cheat-library/res/icons/RockShieldwallMitachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/RockShieldwallMitachurl.png -------------------------------------------------------------------------------- /cheat-library/res/icons/SentouTrial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/SentouTrial.png -------------------------------------------------------------------------------- /cheat-library/res/icons/StatueoftheVassals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/StatueoftheVassals.png -------------------------------------------------------------------------------- /cheat-library/res/icons/ThunderhelmLawachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/ThunderhelmLawachurl.png -------------------------------------------------------------------------------- /cheat-library/res/icons/TokoyoLegume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/TokoyoLegume.png -------------------------------------------------------------------------------- /cheat-library/res/icons/WoodenShieldwallMitachurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/icons/WoodenShieldwallMitachurl.png -------------------------------------------------------------------------------- /cheat-library/res/iconsHD/Alhaitham.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/iconsHD/Alhaitham.png -------------------------------------------------------------------------------- /cheat-library/res/iconsHD/TulaytullahsRemembrance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/iconsHD/TulaytullahsRemembrance.png -------------------------------------------------------------------------------- /cheat-library/res/iconsHD/Wanderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/iconsHD/Wanderer.png -------------------------------------------------------------------------------- /cheat-library/res/res.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // RCDATA 51 | // 52 | 53 | IMGUI_FONT RCDATA "Ruda-Bold.ttf" 54 | 55 | R_LANGUAGES RCDATA "languages.json" 56 | 57 | IMGUI_FONT_BOLD RCDATA "Ruda-ExtraBold.ttf" 58 | 59 | SIGNATURES RCDATA "signatures.json" 60 | 61 | ASSEMBLYCHECKSUMS RCDATA "assembly_checksum.json" 62 | 63 | ASCENSIONMATERIALSDATA RCDATA "ascension_materials.json" 64 | 65 | IMGUI_FONT_CHINESE RCDATA "MiSans-Regular.ttf" 66 | 67 | IMGUI_FONT_CYRILLIC RCDATA "ubuntu_bold.ttf" 68 | 69 | 70 | 71 | ///////////////////////////////////////////////////////////////////////////// 72 | // 73 | // GIF 74 | // 75 | 76 | ANIM_AKEBIBOUNCE GIF "anim\\akebi_bounce.gif" 77 | 78 | #pragma region "Warning" 79 | ArabicW PNG "warnings\\AR.png" 80 | ZHCN PNG "warnings\\ZHCN.png" 81 | ZHTW PNG "warnings\\ZHTW.png" 82 | FilipinoW PNG "warnings\\PH.png" 83 | JapaneseW PNG "warnings\\JA.png" 84 | MalayW PNG "warnings\\MY.png" 85 | PortugueseW PNG "warnings\\PT.png" 86 | RussianW PNG "warnings\\RU.png" 87 | VietnameseW PNG "warnings\\VN.png" 88 | EnglishW PNG "warnings\\EN.png" 89 | #pragma endregion 90 | 91 | #endif // English (United States) resources 92 | ///////////////////////////////////////////////////////////////////////////// 93 | 94 | 95 | 96 | #ifndef APSTUDIO_INVOKED 97 | ///////////////////////////////////////////////////////////////////////////// 98 | // 99 | // Generated from the TEXTINCLUDE 3 resource. 100 | // 101 | 102 | 103 | ///////////////////////////////////////////////////////////////////////////// 104 | #endif // not APSTUDIO_INVOKED 105 | -------------------------------------------------------------------------------- /cheat-library/res/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by res.rc 4 | // 5 | #define AssemblyChecksum 4 6 | #define IDR_RCDATA1 101 7 | #define IDR_RCDATA2 102 8 | #define IDB_PNG1 105 9 | #define IDB_PNG2 106 10 | #define IDB_ANEMOCULUS 106 11 | #define IDR_RCDATA3 107 12 | #define IDR_RCDATA4 110 13 | 14 | #define IMGUI_FONT 201 15 | #define IMGUI_FONT_CHINESE 202 16 | #define IMGUI_FONT_CYRILLIC 203 17 | 18 | #define R_LANGUAGES 301 19 | 20 | // Next default values for new objects 21 | // 22 | #ifdef APSTUDIO_INVOKED 23 | #ifndef APSTUDIO_READONLY_SYMBOLS 24 | #define _APS_NEXT_RESOURCE_VALUE 112 25 | #define _APS_NEXT_COMMAND_VALUE 40001 26 | #define _APS_NEXT_CONTROL_VALUE 1001 27 | #define _APS_NEXT_SYMED_VALUE 101 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /cheat-library/res/scripts/icon_downloader.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | import os 4 | 5 | # Note: This does not fetch all icons from all the jsons 6 | # Manually configure it to fetch what's only needed 7 | json_file = 'some_json_file.json' #'../ascension_materials.json' 8 | raw_data = open(json_file) 9 | json_data = json.load(raw_data) 10 | 11 | hd_folder = 'some_download_folder' #'../iconsHD' 12 | file_type = '.png' 13 | 14 | if not(os.path.exists(hd_folder)): 15 | os.makedirs(hd_folder) 16 | 17 | # For Json Structures { "main" : {"id":{info}, "id":{info}, "id":{info} } } 18 | mainKey = 'character' 19 | for id, info in json_data[mainKey].items(): 20 | file_name = info['clear_name'] 21 | if 'icon' in info: 22 | with open(f"{hd_folder}/{file_name}{file_type}", "wb") as img_file: 23 | img_file.write(requests.get(info['icon']).content) 24 | 25 | # For Json Structures { "main" : [ {info}, {info}, {info} ] } 26 | # mainKey = 'character_types' 27 | # for info in json_data[mainKey]: 28 | # file_name = info['name'] 29 | # if 'icon' in info: 30 | # with open(f"{hd_folder}/{file_name}{file_type}", "wb") as img_file: 31 | # img_file.write(requests.get(info['icon']).content) 32 | -------------------------------------------------------------------------------- /cheat-library/res/scripts/icon_resizer.py: -------------------------------------------------------------------------------- 1 | import os, glob 2 | from PIL import Image 3 | 4 | hd_path = 'some_large_imgs_folder_path' #'../iconsHD' 5 | sd_path = 'some_folder_for_scaled_down_imgs' #'../icons' 6 | 7 | if not os.path.exists(sd_path): 8 | os.makedirs(sd_path) 9 | 10 | # Resize icon based on width and maintain aspect ratio 11 | basewidth = 30 12 | for filename in glob.glob(f'{hd_path}/*.png'): # Recursive scan the folder path of HD Icons 13 | img = Image.open(filename) 14 | wpercent = (basewidth/float(img.size[0])) 15 | hsize = int((float(img.size[1])*float(wpercent))) 16 | img = img.resize((basewidth,hsize), Image.Resampling.LANCZOS) 17 | # Save resized images with existing filename to sd_path folder 18 | img.save(os.path.join(sd_path, os.path.basename(filename))) -------------------------------------------------------------------------------- /cheat-library/res/scripts/map_api.txt: -------------------------------------------------------------------------------- 1 | map_undeground_mines https://sg-public-api-static.hoyolab.com/common/map_user/ys_obc/v1/map/point/list?map_id=9&app_sn=ys_obc&lang=en-us 2 | map_enkanomiya https://sg-public-api-static.hoyolab.com/common/map_user/ys_obc/v1/map/point/list?map_id=7&app_sn=ys_obc&lang=en-us 3 | map_teyvat https://sg-public-api-static.hoyolab.com/common/map_user/ys_obc/v1/map/point/list?map_id=2&app_sn=ys_obc&lang=en-us -------------------------------------------------------------------------------- /cheat-library/res/scripts/saved_offsets_to_static.py: -------------------------------------------------------------------------------- 1 | import json 2 | import re 3 | 4 | 5 | def update_checksums(file_name: str, modules: dict): 6 | 7 | checksums = { 8 | "game_version": input("Input version: "), 9 | "modules": {} 10 | } 11 | 12 | for moduleName, moduleData in modules.items(): 13 | checksums["modules"][moduleName] = moduleData["hash"] 14 | 15 | with open(file_name, "w") as file: 16 | json.dump(checksums, file, indent=2) 17 | 18 | 19 | def apply_offsets(file_name: str, pattern: re.Pattern[str], offsets: dict, reverse_order=False): 20 | with open(file_name) as file: 21 | lines = file.readlines() 22 | 23 | for i, line in enumerate(lines): 24 | m = pattern.match(line) 25 | if m is None: 26 | continue 27 | 28 | filtered_groups = (group for group in m.groups() if group is not None) 29 | if reverse_order: 30 | name, prev_offset = filtered_groups 31 | else: 32 | prev_offset, name = filtered_groups 33 | 34 | if name not in offsets: 35 | print(f"Not found offset for {name}") 36 | continue 37 | 38 | offset = offsets[name] 39 | if int(offset, 16) != 0: 40 | lines[i] = line.replace(prev_offset, f"{int(offset, 16):08X}") 41 | 42 | with open(file_name, "w") as file: 43 | file.writelines(lines) 44 | 45 | 46 | def process(): 47 | with open("saved_offsets.json") as saved_offsets_file: 48 | content = json.load(saved_offsets_file) 49 | 50 | api_pattern = re.compile(r"#define *([\w\d_]+)_ptr *0x([A-Fa-f\d]+)") 51 | apply_offsets("../../src/appdata/il2cpp-api-functions-ptr.h", api_pattern, content["apiFunctions"], True) 52 | 53 | typedef_pattern = re.compile(r"(?:DO_TYPEDEF\(|DO_SINGLETONEDEF\() *0x([A-Fa-f\d]+), *([\w\d_]+) *\);") 54 | apply_offsets("../../src/appdata/il2cpp-types-ptr.h", typedef_pattern, content["typeInfo"]) 55 | 56 | function_pattern = re.compile(r"DO_APP_FUNC *(?:\(|_METHODINFO\() *(?:0x|)([A-Fa-f\d]+)," 57 | r"(?:[^,]+, *([\w\d_]+), | *([\w\d_]+) *)") 58 | 59 | method_info_offsets: dict = content["methodInfo"] 60 | apply_offsets("../../src/appdata/il2cpp-functions.h", function_pattern, 61 | dict(content["moduleInfo"]["UserAssembly.dll"]["functions"], **method_info_offsets)) 62 | 63 | apply_offsets("../../src/appdata/il2cpp-unityplayer-functions.h", function_pattern, 64 | dict(content["moduleInfo"]["UnityPlayer.dll"]["functions"], **method_info_offsets)) 65 | 66 | update_checksums("../assembly_checksum.json", content["moduleInfo"]) 67 | 68 | 69 | if __name__ == "__main__": 70 | process() 71 | -------------------------------------------------------------------------------- /cheat-library/res/ubuntu_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/ubuntu_bold.ttf -------------------------------------------------------------------------------- /cheat-library/res/warnings/AR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/AR.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/EN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/EN.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/JA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/JA.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/MY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/MY.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/PH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/PH.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/PT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/PT.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/RU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/RU.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/VN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/VN.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/ZHCN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/ZHCN.png -------------------------------------------------------------------------------- /cheat-library/res/warnings/ZHTW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/cheat-library/res/warnings/ZHTW.png -------------------------------------------------------------------------------- /cheat-library/src/appdata/MiHoYoMtrSdk-functions.h: -------------------------------------------------------------------------------- 1 | using namespace hoyo_mtr_sdk; 2 | 3 | DO_APP_FUNC(0x00001240, 0x00001240, int64_t, PrintFn, (const char *fmt, ...)); 4 | DO_APP_FUNC(0x000255A0, 0x000255A0, int64_t, DumpSomethingFn, (void *a1, const char *fmt, ...)); 5 | DO_APP_FUNC(0x000254D0, 0x000254D0, int64_t, AnotherDumpFn, (void *a1, const char *fmt, ...)); 6 | DO_APP_FUNC(0x0002A4C0, 0x0002A4C0, int64_t, DumpRequestFn, (void *a1, void *a2)); -------------------------------------------------------------------------------- /cheat-library/src/appdata/Telemetry-functions.h: -------------------------------------------------------------------------------- 1 | using namespace game_telemetry; 2 | 3 | DO_APP_FUNC(0x00018C60, 0x00018C60, int64_t, HandleFetchResultFn, (void *a1, void *a2)); -------------------------------------------------------------------------------- /cheat-library/src/appdata/ZfGameBrowser-functions.h: -------------------------------------------------------------------------------- 1 | using namespace zf_game_browser; 2 | 3 | DO_APP_FUNC(void *, zfb_goToURL, (int64_t browserId, const char *url, bool force)); -------------------------------------------------------------------------------- /cheat-library/src/appdata/il2cpp-api-functions-2.h: -------------------------------------------------------------------------------- 1 | 2 | const Il2CppAssembly **il2cpp_domain_get_assemblies(const Il2CppDomain *domain, size_t *size); 3 | size_t il2cpp_image_get_class_count(const Il2CppImage *image); 4 | const char *il2cpp_image_get_name(const Il2CppImage *image); 5 | const char *il2cpp_image_get_filename(const Il2CppImage *image); 6 | const char *il2cpp_method_get_param_name(const MethodInfo *method, uint32_t index); 7 | uint32_t il2cpp_property_get_flags(PropertyInfo *prop); 8 | const MethodInfo *il2cpp_property_get_get_method(PropertyInfo *prop); 9 | const MethodInfo *il2cpp_property_get_set_method(PropertyInfo *prop); 10 | const char *il2cpp_property_get_name(PropertyInfo *prop); 11 | -------------------------------------------------------------------------------- /cheat-library/src/appdata/il2cpp-api-functions-ptr.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Target Unity version: 2019.4.21 - 2019.4.24 3 | 4 | // ****************************************************************************** 5 | // * IL2CPP API function pointers 6 | // ****************************************************************************** 7 | 8 | #define il2cpp_init_ptr 0x2C20700 9 | #define il2cpp_set_config_dir_ptr 0x2C20960 10 | #define il2cpp_set_data_dir_ptr 0x2C20980 11 | #define il2cpp_set_commandline_arguments_ptr 0x2C20940 12 | #define il2cpp_set_config_ptr 0x2C20950 13 | #define il2cpp_get_corlib_ptr 0x2C206B0 14 | #define il2cpp_free_ptr 0x2C36340 15 | #define il2cpp_array_new_ptr 0x2C20060 16 | #define il2cpp_assembly_get_image_ptr 0x2C200A0 17 | #define il2cpp_class_enum_basetype_ptr 0x2C200D0 18 | #define il2cpp_class_is_generic_ptr 0x2C202A0 19 | #define il2cpp_class_is_inflated_ptr 0x2C202B0 20 | #define il2cpp_class_is_subclass_of_ptr 0x2C202D0 21 | #define il2cpp_class_has_parent_ptr 0x2C20250 22 | #define il2cpp_class_from_name_ptr 0x2C200E0 23 | #define il2cpp_class_from_system_type_ptr 0x2C200F0 24 | #define il2cpp_class_get_fields_ptr 0x2C20170 25 | #define il2cpp_class_get_nested_types_ptr 0x2C201F0 26 | #define il2cpp_class_get_interfaces_ptr 0x2C201B0 27 | #define il2cpp_class_get_field_from_name_ptr 0x2C20160 28 | #define il2cpp_class_get_methods_ptr 0x2C201C0 29 | #define il2cpp_class_get_name_ptr 0x2C201D0 30 | #define il2cpp_class_get_namespace_ptr 0x2C201E0 31 | #define il2cpp_class_get_parent_ptr 0x2C20200 32 | #define il2cpp_class_is_valuetype_ptr 0x2D2E420 33 | #define il2cpp_class_get_flags_ptr 0x2C20180 34 | #define il2cpp_class_is_abstract_ptr 0x2C20270 35 | #define il2cpp_class_is_interface_ptr 0x2C202C0 36 | #define il2cpp_class_array_element_size_ptr 0x2C200C0 37 | #define il2cpp_class_from_type_ptr 0x2C20100 38 | #define il2cpp_class_get_type_ptr 0x2C20220 39 | #define il2cpp_class_is_enum_ptr 0x2C20290 40 | #define il2cpp_domain_get_ptr 0x2C20380 41 | #define il2cpp_domain_assembly_open_ptr 0x2C20370 42 | #define il2cpp_raise_exception_ptr 0x2C20880 43 | #define il2cpp_field_get_flags_ptr 0x2C203B0 44 | #define il2cpp_field_get_name_ptr 0x2C203C0 45 | #define il2cpp_field_get_parent_ptr 0x2C203E0 46 | #define il2cpp_field_get_offset_ptr 0x2C203D0 47 | #define il2cpp_field_get_type_ptr 0x2C203F0 48 | #define il2cpp_unity_liveness_calculation_from_statics_ptr 0x2C20C10 49 | #define il2cpp_method_get_return_type_ptr 0x2C20770 50 | #define il2cpp_method_get_name_ptr 0x2C20730 51 | #define il2cpp_method_is_generic_ptr 0x2C20790 52 | #define il2cpp_method_is_inflated_ptr 0x2C207A0 53 | #define il2cpp_method_is_instance_ptr 0x2C207B0 54 | #define il2cpp_method_get_param_count_ptr 0x2C20760 55 | #define il2cpp_method_get_param_ptr 0x2C20750 56 | #define il2cpp_method_get_class_ptr 0x2D2E730 57 | #define il2cpp_method_has_attribute_ptr 0x2C20780 58 | #define il2cpp_object_get_class_ptr 0x2C20830 59 | #define il2cpp_object_unbox_ptr 0x2D2E400 60 | #define il2cpp_value_box_ptr 0x2D2E340 61 | #define il2cpp_runtime_invoke_ptr 0x2C208D0 62 | #define il2cpp_runtime_unhandled_exception_policy_set_ptr 0x2C20930 63 | #define il2cpp_string_length_ptr 0x2C20A60 64 | #define il2cpp_string_chars_ptr 0x2C20A30 65 | #define il2cpp_thread_current_ptr 0x2C20AA0 66 | #define il2cpp_thread_attach_ptr 0x2C20A90 67 | #define il2cpp_type_get_type_ptr 0x2C20BA0 68 | #define il2cpp_type_get_class_or_element_class_ptr 0x2C20AD0 69 | #define il2cpp_type_get_name_ptr 0x2C20AE0 70 | #define il2cpp_debugger_set_agent_options_ptr 0x25B63E0 71 | -------------------------------------------------------------------------------- /cheat-library/src/appdata/il2cpp-metadata-version.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Target Unity version: 2019.4.21 - 2019.4.24 3 | 4 | #define __IL2CPP_METADATA_VERSION 245 5 | -------------------------------------------------------------------------------- /cheat-library/src/appdata/il2cpp-types-ptr.h: -------------------------------------------------------------------------------- 1 | // clang-format off 2 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 3 | // Target Unity version: 2017.4.15 - 2017.4.40 4 | 5 | // ****************************************************************************** 6 | // * IL2CPP application-specific type definition addresses 7 | // ****************************************************************************** 8 | 9 | DO_TYPEDEF(0x0A6A5A78, 0x0A5F1AF8, Int32); 10 | 11 | DO_TYPEDEF(0x0A6A5B90, 0x0A5F1C10, Byte); 12 | 13 | DO_TYPEDEF(0x0A6A6190, 0x0A5F2210, UInt32); 14 | 15 | 16 | /// DO_TYPEDEF(0x0C6F68F8, 0x0C6F7118, GameManager); 17 | 18 | 19 | DO_TYPEDEF(0x0A6D3810, 0x0A61F890, LCChestPlugin); 20 | 21 | 22 | DO_TYPEDEF(0x0A6BF250, 0x0A60B2D0, SceneTreeObject); 23 | 24 | 25 | DO_TYPEDEF(0x0A6D2A20, 0x0A61EAA0, MoleMole_ActorModifier); 26 | -------------------------------------------------------------------------------- /cheat-library/src/appdata/il2cpp-unityplayer-functions.h: -------------------------------------------------------------------------------- 1 | using namespace app; 2 | 3 | // CC B9 05 00 00 00 E9 ?? ?? ?? ?? 4 | DO_APP_FUNC(0x00BDDAD0, 0x00BDDAD0, Il2CppClass **, GetIl2Classes, ()); 5 | 6 | // !!! WARNING: PLEASE DO NOT HOOK UNITY PLAYER IT WILL MAKES CRC CHECK BROKEN!!! 7 | 8 | // DO_APP_FUNC(0x00C37DF0, 0x00C37DF0, app::Byte__Array*, Unity_RecordUserData, (int32_t nType)); 9 | // DO_APP_FUNC(0x0116A6E0, 0x0116A6E0, int, CrashReporter, (__int64 a1, __int64 a2, const char* a3)); 10 | // DO_APP_FUNC(0x00E40D90, 0x00E40D90, void, Animator_set_avatar, (Animator* __this, Avatar* value, MethodInfo* 11 | // method)); 12 | 13 | // DO_APP_FUNC(0x098EC140, Avatar*, Animator_get_avatar, (Animator* __this, MethodInfo* method)); -------------------------------------------------------------------------------- /cheat-library/src/framework/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // DLL entry point 3 | 4 | #define WIN32_LEAN_AND_MEAN 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | // DLL entry point 11 | BOOL WINAPI DllMain( HMODULE hModule, 12 | DWORD ul_reason_for_call, 13 | LPVOID lpReserved 14 | ) 15 | { 16 | switch (ul_reason_for_call) 17 | { 18 | case DLL_PROCESS_ATTACH: 19 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, new HMODULE(hModule), 0, NULL); 20 | break; 21 | case DLL_THREAD_ATTACH: 22 | case DLL_THREAD_DETACH: 23 | case DLL_PROCESS_DETACH: 24 | break; 25 | } 26 | return TRUE; 27 | } -------------------------------------------------------------------------------- /cheat-library/src/framework/helpers.cpp: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Helper functions 3 | 4 | #include "pch-il2cpp.h" 5 | #include "helpers.h" 6 | 7 | #define WIN32_LEAN_AND_MEAN 8 | 9 | #include 10 | #include 11 | 12 | 13 | // Helper function to get the module base address 14 | 15 | uintptr_t il2cpp_get_mono_base_address() 16 | { 17 | static HMODULE hMono = GetModuleHandle("mono.dll"); 18 | 19 | if (hMono != NULL) 20 | return (uintptr_t)hMono; 21 | 22 | HMODULE hModules[1024] = {}; 23 | 24 | DWORD cbNeeded = 0; 25 | BOOL result = EnumProcessModules(GetCurrentProcess(), hModules, sizeof(hModules), &cbNeeded); 26 | if (result == FALSE) 27 | return NULL; 28 | 29 | for (size_t i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) 30 | { 31 | if (hModules[i] == NULL) 32 | continue; 33 | 34 | if (GetProcAddress(hModules[i], "il2cpp_thread_attach") != NULL) 35 | return (uintptr_t)hModules[i]; 36 | } 37 | 38 | return 0; 39 | } 40 | 41 | uintptr_t il2cppi_get_base_address() { 42 | return (uintptr_t)GetModuleHandleW(L"GameAssembly.dll"); 43 | } 44 | 45 | uintptr_t il2cppi_get_unity_address() { 46 | return (uintptr_t)GetModuleHandleW(L"UnityPlayer.dll"); 47 | } 48 | 49 | // Helper function to open a new console window and redirect stdout there 50 | void il2cppi_new_console() { 51 | AllocConsole(); 52 | freopen_s((FILE**)stdin, "CONIN$", "r", stdin); 53 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 54 | freopen_s((FILE**)stderr, "CONOUT$", "w", stderr); 55 | SetConsoleOutputCP(CP_UTF8); 56 | } 57 | 58 | void il2cppi_close_console() { 59 | fclose(stdin); 60 | fclose(stdout); 61 | fclose(stderr); 62 | FreeConsole(); 63 | } 64 | 65 | #if _MSC_VER >= 1920 66 | // Helper function to convert Il2CppString to std::string 67 | std::string il2cppi_to_string(Il2CppString* str) { 68 | std::u16string u16(reinterpret_cast(str->chars)); 69 | return std::wstring_convert, char16_t>{}.to_bytes(u16); 70 | } 71 | 72 | std::string il2cppi_to_string(app::Vector vec) { 73 | return util::string_format("{ x = %f, y = %f, z = %f }", vec._x, vec._y, vec._z); 74 | } 75 | 76 | std::string il2cppi_to_string(app::Vector2 vec) { 77 | return util::string_format("{ x = %f, y = %f }", vec.x, vec.y); 78 | } 79 | 80 | std::string il2cppi_to_string(app::Vector3 vec) { 81 | return util::string_format("{ x = %f, y = %f, z = %f }", vec.x, vec.y, vec.z); 82 | } 83 | 84 | // Helper function to convert System.String to std::string 85 | std::string il2cppi_to_string(app::String* str) { 86 | if (str == nullptr) 87 | return std::string(""); 88 | return il2cppi_to_string(reinterpret_cast(str)); 89 | } 90 | 91 | app::String* string_to_il2cppi(std::string input) { 92 | return app::Marshal_PtrToStringAnsi((void*)input.c_str(), nullptr); 93 | } 94 | 95 | app::String* string_to_il2cppi(std::wstring input) { 96 | return app::Marshal_PtrToStringUni((void*)input.c_str(), nullptr); 97 | } 98 | 99 | std::string to_hex_string(app::Byte__Array* barray, int length) { 100 | if (barray == nullptr) 101 | return std::string(); 102 | 103 | std::stringstream stream; 104 | auto uarray = TO_UNI_ARRAY(barray, uint8_t); 105 | return util::to_hex_string(uarray->begin(), length); 106 | } 107 | 108 | #endif -------------------------------------------------------------------------------- /cheat-library/src/framework/il2cpp-appdata.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // IL2CPP application data 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | // Application-specific types 9 | #include "il2cpp-types.h" 10 | 11 | // IL2CPP APIs 12 | #define DO_API(OS_OFFSET, CN_OFFSET, RETURN_T, NAME, PARAMS) extern RETURN_T (*NAME) PARAMS 13 | #include "il2cpp-api-functions.h" 14 | #undef DO_API 15 | 16 | // Application-specific functions 17 | #define DO_APP_FUNC(OS_OFFSET, CN_OFFSET, RETURN_T, NAME, PARAMS) extern RETURN_T (*NAME) PARAMS 18 | #define DO_APP_FUNC_METHODINFO(OS_OFFSET, CN_OFFSET, NAME) extern struct MethodInfo ** NAME 19 | namespace app 20 | { 21 | #include "il2cpp-functions.h" 22 | #include "il2cpp-unityplayer-functions.h" 23 | } 24 | #undef DO_APP_FUNC 25 | #undef DO_APP_FUNC_METHODINFO 26 | 27 | // TypeInfo pointers 28 | #define DO_TYPEDEF(OS_OFFSET, CN_OFFSET, NAME) extern NAME ## __Class** NAME ## __TypeInfo 29 | #define DO_SINGLETONEDEF(OS_OFFSET, CN_OFFSET, NAME) extern Singleton_1__Class** NAME ## __TypeInfo 30 | namespace app 31 | { 32 | #include "il2cpp-types-ptr.h" 33 | } 34 | #undef DO_TYPEDEF 35 | #undef DO_SINGLETONEDEF -------------------------------------------------------------------------------- /cheat-library/src/framework/il2cpp-init.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // IL2CPP application initializer 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | enum class LGameVersion 9 | { 10 | NONE, 11 | GLOBAL, 12 | CHINA 13 | }; 14 | 15 | extern LGameVersion _gameVersion; 16 | 17 | // IL2CPP application initializer 18 | void init_il2cpp(); -------------------------------------------------------------------------------- /cheat-library/src/framework/pch-il2cpp.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch-il2cpp.h" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. -------------------------------------------------------------------------------- /cheat-library/src/framework/pch-il2cpp.h: -------------------------------------------------------------------------------- 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 | #ifndef PCH_IL2CPP_H 8 | #define PCH_IL2CPP_H 9 | 10 | // add headers that you want to pre-compile here 11 | #include "il2cpp-appdata.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include 54 | 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | #endif //PCH_IL2CPP_H -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/GenshinCM.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace cheat 6 | { 7 | namespace internal 8 | { 9 | struct AccountData 10 | { 11 | public: 12 | uint32_t userID; 13 | std::string nickName; 14 | 15 | AccountData() : userID(0), nickName() {} 16 | }; 17 | 18 | struct AccountConfig 19 | { 20 | public: 21 | 22 | std::unordered_map pseudos; 23 | std::unordered_map accounts; 24 | std::unordered_map id2Profiles; 25 | std::unordered_map> profiles2id; 26 | 27 | inline bool operator==(const AccountConfig& other) 28 | { 29 | return accounts.size() == other.accounts.size() && pseudos.size() == other.pseudos.size(); 30 | } 31 | 32 | AccountConfig() : pseudos(), accounts(), id2Profiles() { } 33 | }; 34 | 35 | NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(AccountData, nickName, userID) 36 | 37 | inline void to_json(nlohmann::json& nlohmann_json_j, const AccountConfig& nlohmann_json_t) 38 | { 39 | NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, accounts, pseudos, id2Profiles)) 40 | } 41 | 42 | inline void from_json(const nlohmann::json& nlohmann_json_j, AccountConfig& nlohmann_json_t) 43 | { 44 | NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, accounts, pseudos, id2Profiles)) 45 | 46 | for (auto& [userID, profileName] : nlohmann_json_t.id2Profiles) 47 | { 48 | auto& profileIDs = nlohmann_json_t.profiles2id[profileName]; 49 | profileIDs.insert(userID); 50 | } 51 | } 52 | 53 | } 54 | 55 | 56 | class GenshinCM : public CheatManagerBase 57 | { 58 | public: 59 | static GenshinCM& instance(); 60 | 61 | void CursorSetVisibility(bool visibility) final; 62 | bool CursorGetVisibility() final; 63 | 64 | protected: 65 | enum class ShowType 66 | { 67 | Pseudo, 68 | UserID, 69 | Nickname 70 | }; 71 | 72 | config::Field> f_ShowType; 73 | 74 | internal::AccountData m_CurrentAccount; 75 | config::Field f_AccConfig; 76 | 77 | GenshinCM(); 78 | 79 | bool IsAccountAttached(uint32_t userID, const std::string& profileName); 80 | std::string GetAccountDisplayName(uint32_t uid); 81 | 82 | void DetachAccount(uint32_t uid, const std::string& profileName); 83 | void AttachAccount(uint32_t uid, const std::string& profileName); 84 | 85 | void DrawProfileEntryActivities(const std::string& profileName) final; 86 | void DrawProfileEntry(const std::string& profileName) final; 87 | void DrawProfileTableHeader() final; 88 | int GetProfileTableColumnCount() final; 89 | void DrawAccountsList(const std::string& profileName); 90 | void DrawProfileConfiguration() final; 91 | void DrawProfileLine() final; 92 | void DrawPseudoRename(uint32_t userID); 93 | 94 | void OnAccountChanged(uint32_t userID); 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/cheat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace cheat 6 | { 7 | void Init(); 8 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/debugger.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum THREADINFOCLASS { ThreadHideFromDebugger = 0x11 }; 4 | 5 | typedef NTSTATUS(WINAPI* NtQueryInformationThread_t)(HANDLE, THREADINFOCLASS, PVOID, ULONG, LPVOID); 6 | typedef NTSTATUS(WINAPI* NtSetInformationThread_t)(HANDLE, THREADINFOCLASS, PVOID, ULONG); 7 | typedef void(WINAPI* DbgUiRemoteBreakin_t)(); 8 | 9 | NtQueryInformationThread_t fnNtQueryInformationThread = nullptr; 10 | NtSetInformationThread_t fnNtSetInformationThread = nullptr; 11 | DbgUiRemoteBreakin_t fnDbgUiRemoteBreakin = nullptr; 12 | 13 | static void RunVEH(); 14 | static void FindAPI(); 15 | static void DisableVMP(); 16 | static bool Patch_NtSetInformationThread(); 17 | static bool Patch_DbgUiRemoteBreakin(); 18 | 19 | static long WINAPI DebugHandler(PEXCEPTION_POINTERS exception); 20 | static void WINAPI DbgUiRemoteBreakin_Hook(); 21 | static NTSTATUS WINAPI NtSetInformationThread_Hook(HANDLE handle, THREADINFOCLASS infoClass, PVOID pValue, ULONG pSize); 22 | 23 | void DebuggerBypassPre() 24 | { 25 | #ifdef _DEBUG 26 | if (!Patch_NtSetInformationThread()) 27 | LOG_ERROR("Failed to patch NtSetInformationThread, so main thread will be hidden from debugger. ^("); 28 | #endif 29 | } 30 | 31 | void DebuggerBypassPost() 32 | { 33 | #ifdef _DEBUG 34 | if (!Patch_DbgUiRemoteBreakin()) 35 | LOG_ERROR("Failed to patch DbgUiRemoteBreakin, so when debugger will try to attach, game crash. ^("); 36 | 37 | RunVEH(); 38 | #endif 39 | //DisableVMP(); 40 | } 41 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/debugger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void DebuggerBypassPre(); // Phase before loading game library 4 | void DebuggerBypassPost(); // Phase after loading game library -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/events.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "events.h" 3 | 4 | namespace cheat::events 5 | { 6 | TEvent<> GameUpdateEvent{}; 7 | TEvent EntityAppearEvent{}; 8 | TEvent AccountChangedEvent{}; 9 | TEvent MoveSyncEvent{}; 10 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/events.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace cheat::events 7 | { 8 | extern TEvent<> GameUpdateEvent; 9 | extern TEvent EntityAppearEvent; 10 | extern TEvent AccountChangedEvent; 11 | extern TEvent MoveSyncEvent; 12 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/game/AdvancedFilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IEntityFilter.h" 4 | #include 5 | #include 6 | 7 | namespace cheat::game 8 | { 9 | namespace filter::mode { 10 | inline bool whitelist(const std::vector& names, cheat::game::Entity* entity) { 11 | const auto& name = entity->name(); 12 | bool name_found = std::any_of(names.cbegin(), names.cend(), 13 | [&name](const std::string& pattern) { return name.find(pattern) != std::string::npos; }); 14 | 15 | return name_found; 16 | } 17 | 18 | inline bool blacklist(const std::vector& names, cheat::game::Entity* entity) { 19 | bool name_not_found = !whitelist(names, entity); 20 | return name_not_found; 21 | } 22 | } 23 | 24 | template 25 | class AdvancedFilter : 26 | public IEntityFilter 27 | { 28 | public: 29 | AdvancedFilter(std::initializer_list types = {}, std::initializer_list names = {}) : m_Types(types), m_Names(names) {} 30 | AdvancedFilter(std::initializer_list types, const std::string& name) : AdvancedFilter(types, { name }) {} 31 | AdvancedFilter(const app::EntityType__Enum_1 type, std::initializer_list name) : AdvancedFilter({ type }, name) {} 32 | AdvancedFilter(const app::EntityType__Enum_1 type, const std::string& name) : AdvancedFilter({ type }, { name }) {} 33 | friend AdvancedFilter operator+(AdvancedFilter lFilter, const AdvancedFilter& rFilter); 34 | 35 | bool IsValid(Entity* entity) const override { 36 | if (entity == nullptr) 37 | return false; 38 | 39 | bool type_found = m_Types.size() == 0 || std::any_of(m_Types.cbegin(), m_Types.cend(), 40 | [entity](const app::EntityType__Enum_1& type) { return entity->type() == type; }); 41 | 42 | if (!type_found) 43 | return false; 44 | 45 | return m_Names.empty() || nameFilterFn(m_Names, entity); 46 | } 47 | 48 | private: 49 | std::vector m_Types; 50 | std::vector m_Names; 51 | }; 52 | 53 | 54 | template 55 | AdvancedFilter operator+(AdvancedFilter lFilter, const AdvancedFilter& rFilter) 56 | { 57 | lFilter.m_Names.insert(lFilter.m_Names.end(), rFilter.m_Names.begin(), rFilter.m_Names.end()); 58 | lFilter.m_Types.insert(lFilter.m_Types.end(), rFilter.m_Types.begin(), rFilter.m_Types.end()); 59 | return lFilter; 60 | } 61 | 62 | using WhitelistFilter = AdvancedFilter<&filter::mode::whitelist>; 63 | using BlacklistFilter = AdvancedFilter<&filter::mode::blacklist>; 64 | } 65 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/game/util.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "util.h" 3 | 4 | #include 5 | 6 | namespace cheat::game 7 | { 8 | std::vector GetUnlockedWaypoints(uint32_t targetSceneId) 9 | { 10 | return {}; 11 | } 12 | 13 | // Finding nearest unlocked waypoint to the position 14 | WaypointInfo FindNearestWaypoint(app::Vector3& position, uint32_t targetSceneId) 15 | { 16 | float minDistance = -1; 17 | WaypointInfo result{}; 18 | for (const auto& info : GetUnlockedWaypoints(targetSceneId)) { 19 | float distance = app::Vector3_Distance(position, info.position, nullptr); 20 | if (minDistance < 0 || distance < minDistance) 21 | { 22 | minDistance = distance; 23 | result = info; 24 | } 25 | } 26 | return result; 27 | } 28 | 29 | app::Vector3 GetWaypointPosition(uint32_t targetSceneId, uint32_t targetWaypointId) 30 | { 31 | return {}; 32 | } 33 | 34 | bool IsWaypointTeleportable(app::ConfigScenePoint* waypointConfig) 35 | { 36 | if (!waypointConfig) 37 | return false; 38 | auto get_pointType = (app::RealScenePointType__Enum(*)(app::ConfigScenePoint*, MethodInfo*))waypointConfig->klass->vtable.get_pointType.methodPtr; 39 | auto get_pointType_MethodInfo = (MethodInfo*)waypointConfig->klass->vtable.get_pointType.method; 40 | auto pointType = get_pointType(waypointConfig, get_pointType_MethodInfo); 41 | return pointType != app::RealScenePointType__Enum::VehicleSummonPoint && pointType != app::RealScenePointType__Enum::SceneBuildingPoint; 42 | } 43 | 44 | uint32_t GetCurrentPlayerSceneID() 45 | { 46 | return 0; 47 | } 48 | 49 | uint32_t GetCurrentMapSceneID() 50 | { 51 | return 0; 52 | } 53 | 54 | app::AccountDataItem* GetAccountData() 55 | { 56 | return nullptr; 57 | } 58 | 59 | bool IsInGame() 60 | { 61 | return true; 62 | } 63 | 64 | void ShowInGameNormalMessage(std::string content, app::Color bgColor, bool showBackground) 65 | { 66 | 67 | } 68 | 69 | void ShowInGameInfoMessage(std::string content, bool discardIfDuplicated, app::UIShowPriority__Enum priority) 70 | { 71 | 72 | } 73 | 74 | void ShowInGameGeneralDialog(std::string title, std::string content, app::GeneralDialogContext_GeneralDialogType__Enum dialogType, app::UIType__Enum uiType, app::UIShowPriority__Enum mode, bool showNormalCloseBtn, bool isToggleDialog) 75 | { 76 | //app::MoleMole_UIUtil_TryShowGeneralDialog(string_to_il2cppi(title), string_to_il2cppi(content), nullptr, uiType, nullptr, dialogType, mode, showNormalCloseBtn, isToggleDialog, false, nullptr); 77 | } 78 | 79 | void ShowInGameSimpleGeneralDialog(std::string title, std::string content) 80 | { 81 | 82 | } 83 | 84 | void ShowInGameNormalMessage(std::wstring content, app::Color bgColor, bool showBackground) 85 | { 86 | 87 | } 88 | 89 | void ShowInGameInfoMessage(std::wstring content, bool discardIfDuplicated, app::UIShowPriority__Enum priority) 90 | { 91 | 92 | } 93 | 94 | void ShowInGameGeneralDialog(std::wstring title, std::wstring content, app::GeneralDialogContext_GeneralDialogType__Enum dialogType, app::UIType__Enum uiType, app::UIShowPriority__Enum mode, bool showNormalCloseBtn, bool isToggleDialog) 95 | { 96 | //app::MoleMole_UIUtil_TryShowGeneralDialog(string_to_il2cppi(title), string_to_il2cppi(content), nullptr, uiType, nullptr, dialogType, mode, showNormalCloseBtn, isToggleDialog, false, nullptr); 97 | } 98 | 99 | void ShowInGameSimpleGeneralDialog(std::wstring title, std::wstring content) 100 | { 101 | 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/game/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace cheat::game 9 | { 10 | struct WaypointInfo 11 | { 12 | uint32_t sceneId = 0; 13 | uint32_t waypointId = 0; 14 | app::Vector3 position = {}; 15 | app::MapModule_ScenePointData* data = nullptr; 16 | }; 17 | 18 | WaypointInfo FindNearestWaypoint(app::Vector3& position, uint32_t targetId = 0); 19 | static std::vector GetUnlockedWaypoints(uint32_t targetId = 0); 20 | app::Vector3 GetWaypointPosition(uint32_t targetSceneId, uint32_t targetWaypointId); 21 | bool IsWaypointTeleportable(app::ConfigScenePoint* waypointConfig); 22 | uint32_t GetCurrentMapSceneID(); 23 | uint32_t GetCurrentPlayerSceneID(); 24 | 25 | //app::GadgetEntity* GetGadget(uint32_t runtimeID); 26 | //app::GadgetEntity* GetGadget(Entity* entity); 27 | //app::GadgetEntity* GetGadget(app::BaseEntity* entity); 28 | 29 | //game::Entity* FindNearestEntity(const IEntityFilter& filter); 30 | //game::Entity* FindNearestEntity(std::vector& entities); 31 | 32 | app::AccountDataItem* GetAccountData(); 33 | 34 | bool IsInGame(); 35 | 36 | void ShowInGameNormalMessage(std::string content, app::Color bgColor = app::Color(255,255,255,255), bool showBackground = false); 37 | void ShowInGameInfoMessage(std::string content, bool discardIfDuplicated = false, app::UIShowPriority__Enum priority = app::UIShowPriority__Enum::Normal); 38 | void ShowInGameGeneralDialog(std::string title, std::string content, app::GeneralDialogContext_GeneralDialogType__Enum dialogType = app::GeneralDialogContext_GeneralDialogType__Enum::DOUBLE_BUTTON, app::UIType__Enum uiType = app::UIType__Enum::Dialog, app::UIShowPriority__Enum mode = app::UIShowPriority__Enum::Normal, bool showNormalCloseBtn = true, bool isToggleDialog = false); 39 | void ShowInGameSimpleGeneralDialog(std::string title, std::string content); 40 | void ShowInGameNormalMessage(std::wstring content, app::Color bgColor = app::Color(255, 255, 255, 255), bool showBackground = false); 41 | void ShowInGameInfoMessage(std::wstring content, bool discardIfDuplicated = false, app::UIShowPriority__Enum priority = app::UIShowPriority__Enum::Normal); 42 | void ShowInGameGeneralDialog(std::wstring title, std::wstring content, app::GeneralDialogContext_GeneralDialogType__Enum dialogType = app::GeneralDialogContext_GeneralDialogType__Enum::DOUBLE_BUTTON, app::UIType__Enum uiType = app::UIType__Enum::Dialog, app::UIShowPriority__Enum mode = app::UIShowPriority__Enum::Normal, bool showNormalCloseBtn = true, bool isToggleDialog = false); 43 | void ShowInGameSimpleGeneralDialog(std::wstring title, std::wstring content); 44 | } 45 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/About.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class About : public Feature 9 | { 10 | public: 11 | static About& GetInstance(); 12 | 13 | const FeatureGUIInfo& GetGUIInfo() const override; 14 | void DrawMain() override; 15 | void OnGameUpdate(); 16 | void ShowInGameScamWarning(); 17 | std::pair GetScamWarningW(); 18 | bool show = true; 19 | bool m_IsScamWarningShowed = false; 20 | int width; 21 | int height; 22 | int width_picture; 23 | int height_picture; 24 | int timer; 25 | std::string lang; 26 | config::Field f_IsFirstTime; 27 | private: 28 | About(); 29 | }; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/BlockWindSeed.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "BlockWindSeed.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | static void PlayerModule_OnWindSeedClientNotify_Hook(app::MoleMole_PlayerModule* __this, app::Proto_WindSeedClientNotify* notify, MethodInfo* method); 10 | static void PlayerModule_OnReciveLuaShell_Hook(app::MoleMole_PlayerModule* __this, app::Proto_PlayerLuaShellNotify* playerLuaShellNotify, MethodInfo* method); 11 | 12 | BlockWindSeed::BlockWindSeed() : Feature(), 13 | NF(f_Enabled, "General::BlockWindSeed", false) 14 | { 15 | //HookManager::install(app::MoleMole_PlayerModule_OnWindSeedClientNotify, PlayerModule_OnWindSeedClientNotify_Hook); 16 | //HookManager::install(app::MoleMole_PlayerModule_OnReciveLuaShell, PlayerModule_OnReciveLuaShell_Hook); 17 | } 18 | 19 | const FeatureGUIInfo& BlockWindSeed::GetGUIInfo() const 20 | { 21 | TRANSLATED_MODULE_INFO("Settings"); 22 | return info; 23 | } 24 | 25 | void BlockWindSeed::DrawMain() 26 | { 27 | ConfigWidget(_TR("Block WindSeed"), f_Enabled, _TR("Blocks the WindSeed Packet which can cause RCE from malicious private servers. Only use it on private servers.")); 28 | } 29 | 30 | bool BlockWindSeed::NeedStatusDraw() const 31 | { 32 | return f_Enabled; 33 | } 34 | 35 | void BlockWindSeed::DrawStatus() 36 | { 37 | ImGui::Text(_TR("Block WindSeed")); 38 | } 39 | 40 | BlockWindSeed& BlockWindSeed::GetInstance() 41 | { 42 | static BlockWindSeed instance; 43 | return instance; 44 | } 45 | 46 | void PlayerModule_OnWindSeedClientNotify_Hook(app::MoleMole_PlayerModule* __this, app::Proto_WindSeedClientNotify* notify, MethodInfo* method) 47 | { 48 | BlockWindSeed& BlockWindSeed = BlockWindSeed::GetInstance(); 49 | if (BlockWindSeed.f_Enabled) 50 | { 51 | LOG_DEBUG("Server sent a WindSeedClientNotify packet!"); 52 | return; 53 | } 54 | 55 | CALL_ORIGIN(PlayerModule_OnWindSeedClientNotify_Hook, __this, notify, method); 56 | } 57 | 58 | void PlayerModule_OnReciveLuaShell_Hook(app::MoleMole_PlayerModule* __this, app::Proto_PlayerLuaShellNotify* playerLuaShellNotify, MethodInfo* method) 59 | { 60 | BlockWindSeed& BlockWindSeed = BlockWindSeed::GetInstance(); 61 | if (BlockWindSeed.f_Enabled) 62 | { 63 | LOG_DEBUG("Server sent a PlayerLuaShellNotify packet!"); 64 | return; 65 | } 66 | 67 | CALL_ORIGIN(PlayerModule_OnReciveLuaShell_Hook, __this, playerLuaShellNotify, method); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/BlockWindSeed.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace cheat::feature 9 | { 10 | class BlockWindSeed : public Feature 11 | { 12 | public: 13 | config::Field f_Enabled; 14 | 15 | static BlockWindSeed& GetInstance(); 16 | 17 | const FeatureGUIInfo& GetGUIInfo() const override; 18 | void DrawMain() override; 19 | 20 | virtual bool NeedStatusDraw() const override; 21 | void DrawStatus() override; 22 | 23 | private: 24 | BlockWindSeed(); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/Debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace cheat::feature 5 | { 6 | class Debug : public Feature 7 | { 8 | public: 9 | 10 | static Debug& GetInstance(); 11 | 12 | enum class TeleportCondition { 13 | Closest, 14 | Farthest 15 | }; 16 | 17 | enum class EntitySortCondition { 18 | RuntimeID = 0, 19 | Name, 20 | Distance 21 | }; 22 | 23 | const FeatureGUIInfo& GetGUIInfo() const override; 24 | void DrawMain() override; 25 | 26 | virtual bool NeedInfoDraw() const override; 27 | void DrawInfo() override; 28 | 29 | private: 30 | Debug(); 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/Hotkeys.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "Hotkeys.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace cheat::feature 9 | { 10 | Hotkeys::Hotkeys() : Feature() { } 11 | 12 | const FeatureGUIInfo& Hotkeys::GetGUIInfo() const 13 | { 14 | TRANSLATED_MODULE_INFO("Hotkeys"); 15 | return info; 16 | } 17 | 18 | void Hotkeys::DrawMain() 19 | { 20 | static std::string searchBuffer; 21 | ImGui::InputText(_TR("Search"), &searchBuffer); 22 | 23 | ImGui::BeginChild("Hotkeys"); 24 | 25 | std::unordered_map*>> sections; 26 | 27 | for (auto& field : config::GetFields()) 28 | { 29 | if (!searchBuffer.empty()) 30 | { 31 | auto name = field->name(); 32 | auto it = std::search( 33 | name.begin(), name.end(), 34 | searchBuffer.begin(), searchBuffer.end(), 35 | [](char ch1, char ch2) { return std::tolower(ch1) == std::tolower(ch2); } 36 | ); 37 | if (it == name.end()) 38 | continue; 39 | } 40 | 41 | sections[field.section()].push_back(&field); 42 | } 43 | 44 | std::vector*> singleLineSections; 45 | std::vector*>*> multiLineSections; 46 | for (auto& [section, fields] : sections) 47 | { 48 | if (fields.size() == 1) 49 | singleLineSections.push_back(fields[0]); 50 | else 51 | multiLineSections.push_back(&fields); 52 | } 53 | 54 | for (auto& field : singleLineSections) 55 | { 56 | ConfigWidget(field->value().name().c_str(), *field, nullptr, true); 57 | } 58 | 59 | for (auto& fields : multiLineSections) 60 | { 61 | if (ImGui::BeginGroupPanel((*fields)[0]->section().c_str(), true)) 62 | { 63 | for (auto& field : *fields) 64 | { 65 | ConfigWidget(field->value().name().c_str(), *field, nullptr, true); 66 | } 67 | } 68 | ImGui::EndGroupPanel(); 69 | } 70 | 71 | ImGui::EndChild(); 72 | } 73 | 74 | Hotkeys& Hotkeys::GetInstance() 75 | { 76 | static Hotkeys instance; 77 | return instance; 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/Hotkeys.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace cheat::feature 5 | { 6 | 7 | class Hotkeys : public Feature 8 | { 9 | public: 10 | static Hotkeys& GetInstance(); 11 | 12 | const FeatureGUIInfo& GetGUIInfo() const override; 13 | void DrawMain() override; 14 | 15 | private: 16 | Hotkeys(); 17 | }; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/ProtectionBypass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace cheat::feature 9 | { 10 | 11 | class ProtectionBypass : public Feature 12 | { 13 | public: 14 | config::Field f_Enabled; 15 | config::Field f_SpoofLuaShell; 16 | 17 | bool report_sent = false; 18 | 19 | static ProtectionBypass& GetInstance(); 20 | 21 | const FeatureGUIInfo& GetGUIInfo() const override; 22 | void DrawMain() override; 23 | 24 | app::Byte__Array* OnRecordUserData(int32_t nType); 25 | void OnReportLuaShell(void* __this, app::String* type, app::String* value, MethodInfo* method); 26 | 27 | void Init(); 28 | 29 | private: 30 | ProtectionBypass(); 31 | std::map m_CorrectSignatures; 32 | }; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/RSAPatch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "RSAPatch.h" 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | static void RSA_FromXmlString_Hook(app::RSA *__this, app::String *xmlString, MethodInfo *method); 8 | 9 | RSAPatch::RSAPatch() : Feature(), 10 | NFP(f_Enabled, "General::RSAPatch", "RSA Patch", false), 11 | NF(f_PublicKey, "General::RSAPatch", false), 12 | NF(f_PrivateKey, "General::RSAPatch", false) 13 | { 14 | HookManager::install(app::RSA_FromXmlString, RSA_FromXmlString_Hook); 15 | } 16 | 17 | const FeatureGUIInfo &RSAPatch::GetGUIInfo() const 18 | { 19 | TRANSLATED_GROUP_INFO("RSA Patch", "Settings"); 20 | return info; 21 | } 22 | 23 | void RSAPatch::DrawMain() 24 | { 25 | ConfigWidget(_TR("Enable RSA Patch"), f_Enabled, _TR("Runtime patcher. Only use it on private servers.")); 26 | ConfigWidget(_TR("Custom Public Key"), f_PublicKey, _TR("If disabled, use grasscutter's public RSA key.")); 27 | ConfigWidget(_TR("Custom Private Key"), f_PrivateKey, _TR("If disabled, don't patch private RSA key")); 28 | } 29 | 30 | bool RSAPatch::NeedStatusDraw() const 31 | { 32 | return f_Enabled->enabled(); 33 | } 34 | 35 | void RSAPatch::DrawStatus() 36 | { 37 | ImGui::Text(_TR("RSA Patch")); 38 | // to be done 39 | } 40 | 41 | RSAPatch &RSAPatch::GetInstance() 42 | { 43 | static RSAPatch instance; 44 | return instance; 45 | } 46 | 47 | static void RSA_FromXmlString_Hook(app::RSA *__this, app::String *xmlString, MethodInfo *method) 48 | { 49 | auto &rsaPatch = RSAPatch::GetInstance(); 50 | auto key = il2cppi_to_string(xmlString); 51 | 52 | if (rsaPatch.f_Enabled->enabled()) 53 | { 54 | app::String *public_key; 55 | app::String *private_key; 56 | 57 | if (rsaPatch.f_PublicKey->enabled()) 58 | public_key = string_to_il2cppi(rsaPatch.f_PublicKey->value()); 59 | else // Use Grasscutter Public key 60 | public_key = string_to_il2cppi("xbbx2m1feHyrQ7jP+8mtDF/pyYLrJWKWAdEv3wZrOtjOZzeLGPzsmkcgncgoRhX4dT+1itSMR9j9m0/OwsH2UoF6U32LxCOQWQD1AMgIZjAkJeJvFTrtn8fMQ1701CkbaLTVIjRMlTw8kNXvNA/A9UatoiDmi4TFG6mrxTKZpIcTInvPEpkK2A7Qsp1E4skFK8jmysy7uRhMaYHtPTsBvxP0zn3lhKB3W+HTqpneewXWHjCDfL7Nbby91jbz5EKPZXWLuhXIvR1Cu4tiruorwXJxmXaP1HQZonytECNU/UOzP6GNLdq0eFDE4b04Wjp396551G99YiFP2nqHVJ5OMQ==AQAB"); 61 | 62 | // Private key contains:

63 | // Public key contains: 64 | 65 | // Public key 66 | if ((key.rfind("15RBm/vARY0axYksImhsTicpv09OYfS4+wCvmE7") != std::string::npos || key.rfind("lCwdYrveozYYcKOSz4cjBfORvd6POZSxsM9JybW") != std::string::npos)) // 2nd time fn is called 67 | { 68 | memcpy(xmlString, public_key, public_key->fields.length * 2); 69 | LOG_INFO("Public Key Patched."); 70 | } 71 | 72 | // Private key: no need to patch on grasscutter 73 | if (rsaPatch.f_PrivateKey->enabled()) 74 | { 75 | private_key = string_to_il2cppi(rsaPatch.f_PrivateKey->value()); 76 | 77 | if (key.find("") != std::string::npos && key.rfind("") != std::string::npos) 78 | { 79 | memcpy(xmlString, private_key, private_key->fields.length * 2); 80 | LOG_INFO("Private Key Patched."); 81 | } 82 | } 83 | } 84 | CALL_ORIGIN(RSA_FromXmlString_Hook, __this, xmlString, method); 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/RSAPatch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | class RSAPatch : public Feature 8 | { 9 | public: 10 | config::Field f_Enabled; 11 | config::Field> f_PublicKey; 12 | config::Field> f_PrivateKey; 13 | 14 | static RSAPatch &GetInstance(); 15 | 16 | const FeatureGUIInfo &GetGUIInfo() const override; 17 | void DrawMain() override; 18 | 19 | virtual bool NeedStatusDraw() const override; 20 | void DrawStatus() override; 21 | 22 | private: 23 | RSAPatch(); 24 | }; 25 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.h: -------------------------------------------------------------------------------- 1 | // ReSharper disable All 2 | #pragma once 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include "pipe/messages/PipeModifyData.h" 11 | #include "pipe/messages/PipePacketData.h" 12 | #include "pipe/PipeClient.h" 13 | 14 | namespace cheat::feature 15 | { 16 | 17 | class PacketSniffer : public Feature 18 | { 19 | public: 20 | config::Field f_CaptureEnabled; 21 | config::Field f_ManipulationEnabled; 22 | config::Field f_PipeName; 23 | 24 | PipeClient client; 25 | 26 | static PacketSniffer& GetInstance(); 27 | 28 | const FeatureGUIInfo& GetGUIInfo() const override; 29 | void DrawMain() override; 30 | 31 | private: 32 | PacketSniffer(); 33 | 34 | bool ProcessModifiedData(app::KcpPacket_1*& packet); 35 | bool ParseRawPacketData(char* encryptedData, uint32_t length, PipePacketData& dataOut); 36 | static void EncryptXor(void* content, uint32_t length); 37 | static bool KcpClient_TryDequeueEvent_Hook(void* __this, app::ClientKcpEvent* evt, MethodInfo* method); 38 | static int32_t KcpNative_kcp_client_send_packet_Hook(void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method); 39 | 40 | bool OnPacketIO(app::KcpPacket_1*& packet, NetIODirection direction); 41 | }; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/PipeClient.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PipeClient.h" 3 | 4 | bool PipeClient::IsConnected() 5 | { 6 | if (m_Pipe == nullptr) 7 | return false; 8 | 9 | return m_Pipe->IsPipeOpened() || TryConnectToPipe(); 10 | } 11 | 12 | void PipeClient::SetConnectionDelay(uint32_t delay) 13 | { 14 | m_ConnectionDelay = delay; 15 | } 16 | 17 | uint32_t PipeClient::GetConnectionDelay() 18 | { 19 | return m_ConnectionDelay; 20 | } 21 | 22 | void PipeClient::Connect(const std::string& pipeName) 23 | { 24 | if (m_Pipe != nullptr) 25 | delete m_Pipe; 26 | 27 | m_Pipe = new PipeTransfer(pipeName); 28 | TryConnectToPipe(); 29 | } 30 | 31 | void PipeClient::Disconnect() 32 | { 33 | if (m_Pipe == nullptr) 34 | return; 35 | 36 | delete m_Pipe; 37 | } 38 | 39 | bool PipeClient::TryConnectToPipe() 40 | { 41 | if (m_Pipe == nullptr) 42 | return false; 43 | 44 | std::time_t currTime = std::time(0); 45 | if (m_NextTimeToConnect > currTime) 46 | return false; 47 | 48 | bool result = m_Pipe->Connect(); 49 | if (result) 50 | LOG_INFO("Connected to pipe successfully."); 51 | else 52 | m_NextTimeToConnect = currTime + 5; // delay in 5 sec 53 | return result; 54 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/PipeClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "PipeIO.h" 5 | 6 | class PipeClient : public PipeIO 7 | { 8 | public: 9 | PipeClient() : PipeIO(), m_ConnectionDelay(5), m_NextTimeToConnect(0) {} 10 | 11 | void SetConnectionDelay(uint32_t delay); 12 | uint32_t GetConnectionDelay(); 13 | 14 | bool IsConnected() final; 15 | void Connect(const std::string& pipeName); 16 | void Disconnect(); 17 | 18 | private: 19 | uint32_t m_ConnectionDelay; 20 | std::time_t m_NextTimeToConnect; 21 | 22 | bool TryConnectToPipe(); 23 | }; -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/PipeIO.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PipeIO.h" 3 | 4 | void PipeIO::Send(PipeMessage& data) 5 | { 6 | if (!IsConnected()) 7 | return; 8 | 9 | m_Pipe->WriteObject(data); 10 | } 11 | 12 | PipeMessage* PipeIO::ReceiveMessage() 13 | { 14 | if (!IsConnected()) 15 | return nullptr; 16 | 17 | PipeMessage header; 18 | m_Pipe->ReadObject(header); 19 | 20 | MessageIDs messageID = static_cast(header.packetID()); 21 | 22 | #define MESSAGE_CASE(mid, type)\ 23 | case mid: \ 24 | { \ 25 | auto data = new type(); \ 26 | m_Pipe->ReadObject(*data); \ 27 | data->SetMessage(header); \ 28 | CallHandlers(*data); \ 29 | return dynamic_cast(data); \ 30 | } 31 | 32 | switch (messageID) 33 | { 34 | MESSAGE_CASE(MessageIDs::PACKET_DATA, PipePacketData); 35 | MESSAGE_CASE(MessageIDs::MODIFY_DATA, PipeModifyData); 36 | default: 37 | break; 38 | } 39 | return nullptr; 40 | } 41 | 42 | void PipeIO::ProcessMessage() 43 | { 44 | auto message = ReceiveMessage(); 45 | delete message; 46 | } 47 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/PipeIO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "messages/PipeMessage.h" 3 | #include "messages/PipeModifyData.h" 4 | #include "messages/PipePacketData.h" 5 | 6 | #include 7 | #include 8 | 9 | 10 | enum class MessageIDs : uint32_t 11 | { 12 | NONE = 0, 13 | PACKET_DATA = 1, 14 | MODIFY_DATA = 2 15 | }; 16 | 17 | namespace internal 18 | { 19 | template struct message_to_id; 20 | template<> struct message_to_id : std::integral_constant(MessageIDs::PACKET_DATA)> {}; 21 | template<> struct message_to_id : std::integral_constant(MessageIDs::MODIFY_DATA)> {}; 22 | } 23 | 24 | class PipeIO 25 | { 26 | public: 27 | template 28 | using CallbackFunction = void(*)(const T& packetData); 29 | 30 | template 31 | void AddHandler(CallbackFunction callback) 32 | { 33 | static_assert(std::is_base_of::value, "Should be derived of MessageBase."); 34 | 35 | constexpr auto messageID = internal::message_to_id::value; 36 | 37 | m_Handlers.push_back({ 38 | messageID, 39 | reinterpret_cast(callback) 40 | }); 41 | } 42 | 43 | template 44 | TMessage CreateMessage(uint32_t reqID = 0, uint32_t seqID = 0) 45 | { 46 | static_assert(std::is_base_of::value, "Should be derived of MessageBase."); 47 | 48 | return TMessage(internal::message_to_id::value); 49 | } 50 | 51 | template 52 | std::optional WaitFor() 53 | { 54 | static_assert(std::is_base_of::value, "Should be derived of MessageBase."); 55 | 56 | if (!IsConnected()) 57 | return {}; 58 | 59 | while (true) 60 | { 61 | auto messagePtr = ReceiveMessage(); 62 | if (messagePtr == nullptr) 63 | return {}; 64 | 65 | if (internal::message_to_id::value != messagePtr->packetID()) 66 | { 67 | delete messagePtr; 68 | continue; 69 | } 70 | 71 | // Copying message 72 | TMessage message = *reinterpret_cast(messagePtr); 73 | delete messagePtr; 74 | 75 | return message; 76 | } 77 | } 78 | 79 | void Send(PipeMessage& data); 80 | 81 | PipeMessage* ReceiveMessage(); 82 | 83 | void ProcessMessage(); 84 | 85 | virtual bool IsConnected() = 0; 86 | 87 | protected: 88 | PipeIO() : m_Pipe(nullptr) {}; 89 | virtual ~PipeIO() = default; 90 | PipeTransfer* m_Pipe; 91 | 92 | private: 93 | using UniqueCallbackFunction = void(*)(const PipeMessage& pipeMessage); 94 | std::vector> m_Handlers; 95 | 96 | template 97 | void CallHandlers(const T& message) 98 | { 99 | for (auto& [id, handler] : m_Handlers) 100 | { 101 | if (id == internal::message_to_id::value) 102 | handler(message); 103 | } 104 | } 105 | 106 | public: 107 | PipeIO(PipeIO& other) = delete; 108 | PipeIO(PipeIO&& other) = delete; 109 | PipeIO& operator=(PipeIO& other) = delete; 110 | PipeIO& operator=(PipeIO&& other) = delete; 111 | }; -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipeMessage.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PipeMessage.h" 3 | 4 | PipeMessage::PipeMessage(uint32_t packetID) : 5 | m_PipePacketID(packetID), m_Timestamp(util::GetCurrentTimeMillisec()) 6 | { } 7 | 8 | PipeMessage::PipeMessage() : m_PipePacketID(0), m_Timestamp(0) 9 | { } 10 | 11 | uint32_t PipeMessage::packetID() const 12 | { 13 | return m_PipePacketID; 14 | } 15 | 16 | int64_t PipeMessage::timestamp() const 17 | { 18 | return m_Timestamp; 19 | } 20 | 21 | void PipeMessage::Write(PipeTransfer* transfer) 22 | { 23 | transfer->Write(m_PipePacketID); 24 | transfer->Write(util::GetCurrentTimeMillisec()); 25 | } 26 | 27 | void PipeMessage::Read(PipeTransfer* transfer) 28 | { 29 | transfer->Read(m_PipePacketID); 30 | transfer->Read(m_Timestamp); 31 | } 32 | 33 | void PipeMessage::SetMessage(const PipeMessage& other) 34 | { 35 | m_PipePacketID = other.m_PipePacketID; 36 | m_Timestamp = other.m_Timestamp; 37 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipeMessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class PipeMessage : public PipeSerializedObject 6 | { 7 | public: 8 | PipeMessage(); 9 | PipeMessage(uint32_t packetID); 10 | uint32_t packetID() const; 11 | int64_t timestamp() const; 12 | 13 | void SetMessage(const PipeMessage& other); 14 | void Write(PipeTransfer* transfer) override; 15 | void Read(PipeTransfer* transfer) override; 16 | 17 | private: 18 | 19 | uint32_t m_PipePacketID; 20 | int64_t m_Timestamp; 21 | }; -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipeModifyData.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PipeModifyData.h" 3 | 4 | PipeModifyData::PipeModifyData() : 5 | modifyType(ModifyType::Unchanged), head({}), content({}), messageID(0) 6 | { } 7 | 8 | void PipeModifyData::Write(PipeTransfer* transfer) 9 | { 10 | PipeMessage::Write(transfer); 11 | 12 | transfer->Write(modifyType); 13 | if (modifyType == ModifyType::Modified) 14 | { 15 | 16 | transfer->Write(messageID); 17 | transfer->Write(content); 18 | transfer->Write(head); 19 | } 20 | } 21 | 22 | void PipeModifyData::Read(PipeTransfer* transfer) 23 | { 24 | transfer->Read(modifyType); 25 | if (modifyType == ModifyType::Modified) 26 | { 27 | 28 | transfer->Read(messageID); 29 | transfer->Read(content); 30 | transfer->Read(head); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipeModifyData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "PipeMessage.h" 4 | 5 | enum class ModifyType 6 | { 7 | Unchanged, Blocked, Modified 8 | }; 9 | 10 | class PipeModifyData : public PipeMessage 11 | { 12 | public: 13 | using PipeMessage::PipeMessage; 14 | 15 | ModifyType modifyType; 16 | uint32_t messageID; 17 | std::vector head; 18 | std::vector content; 19 | 20 | PipeModifyData(); 21 | ~PipeModifyData() {} 22 | 23 | // Inherited via PipeSerializedObject 24 | virtual void Write(PipeTransfer* transfer) final; 25 | virtual void Read(PipeTransfer* transfer) final; 26 | }; -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipePacketData.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PipePacketData.h" 3 | 4 | void PipePacketData::Write(PipeTransfer* transfer) 5 | { 6 | PipeMessage::Write(transfer); 7 | 8 | transfer->Write(manipulationEnabled); 9 | transfer->Write(direction); 10 | transfer->Write(messageID); 11 | transfer->Write(head); 12 | transfer->Write(content); 13 | } 14 | 15 | void PipePacketData::Read(PipeTransfer* transfer) 16 | { 17 | transfer->Read(manipulationEnabled); 18 | transfer->Read(direction); 19 | transfer->Read(messageID); 20 | transfer->Read(head); 21 | transfer->Read(content); 22 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/misc/sniffer/pipe/messages/PipePacketData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "PipeMessage.h" 3 | 4 | enum class NetIODirection 5 | { 6 | Send, Receive 7 | }; 8 | 9 | class PipePacketData : public PipeMessage 10 | { 11 | public: 12 | using PipeMessage::PipeMessage; 13 | 14 | bool manipulationEnabled; 15 | 16 | NetIODirection direction; 17 | uint16_t messageID; 18 | std::vector head; 19 | std::vector content; 20 | 21 | // Inherited via PipeSerializedObject 22 | void Write(PipeTransfer* transfer) final; 23 | void Read(PipeTransfer* transfer) final; 24 | }; 25 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/native.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace util 3 | { 4 | bool CloseHandleByName(const wchar_t* name); 5 | } 6 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/player/NoCD.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | class NoCD : public Feature 8 | { 9 | public: 10 | config::Field f_AbilityReduce; 11 | config::Field f_TimerReduce; 12 | 13 | config::Field f_UtimateMaxEnergy; 14 | config::Field f_Sprint; 15 | config::Field f_InstantBow; 16 | 17 | static NoCD& GetInstance(); 18 | 19 | const FeatureGUIInfo& GetGUIInfo() const override; 20 | void DrawMain() override; 21 | 22 | virtual bool NeedStatusDraw() const override; 23 | void DrawStatus() override; 24 | 25 | private: 26 | NoCD(); 27 | }; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/Browser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | class Browser : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_planeWidth; 13 | config::Field f_planeHeight; 14 | 15 | static Browser& GetInstance(); 16 | const FeatureGUIInfo& GetGUIInfo() const override; 17 | void DrawMain() override; 18 | bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | SafeQueue toBeUpdate; 23 | SafeValue nextUpdate; 24 | int f_DelayUpdate = 20; 25 | void OnGameUpdate(); 26 | Browser(); 27 | }; 28 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/CameraZoom.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class CameraZoom : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_SetFov; 13 | config::Field f_FixedZoom; 14 | config::Field f_MaxZoom; 15 | config::Field f_MinZoom; 16 | config::Field f_ZoomSpeed; 17 | config::Field f_FovValue; 18 | 19 | static CameraZoom& GetInstance(); 20 | 21 | const FeatureGUIInfo& GetGUIInfo() const override; 22 | void DrawMain() override; 23 | 24 | virtual bool NeedStatusDraw() const override; 25 | void DrawStatus() override; 26 | 27 | private: 28 | CameraZoom(); 29 | }; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/EnablePeeking.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "EnablePeeking.h" 3 | 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | static void BaseShaderPropertyTransition_SetDitherAlphaValue_Hook(void* __this, float value, MethodInfo* method); 9 | 10 | EnablePeeking::EnablePeeking() : Feature(), 11 | NFP(f_Enabled, "Visuals::EnablePeeking", "Enable Peeking", false) 12 | { 13 | HookManager::install(app::BaseShaderPropertyTransition_SetDitherAlphaValue, BaseShaderPropertyTransition_SetDitherAlphaValue_Hook); 14 | } 15 | 16 | const FeatureGUIInfo& EnablePeeking::GetGUIInfo() const 17 | { 18 | TRANSLATED_MODULE_INFO("Visuals"); 19 | return info; 20 | } 21 | 22 | void EnablePeeking::DrawMain() 23 | { 24 | ConfigWidget(_TR("Enable Peeking"), f_Enabled, ";)"); 25 | } 26 | 27 | bool EnablePeeking::NeedStatusDraw() const 28 | { 29 | return f_Enabled->enabled(); 30 | } 31 | 32 | void EnablePeeking::DrawStatus() 33 | { 34 | ImGui::Text(_TR("Enable Peeking")); 35 | } 36 | 37 | EnablePeeking& EnablePeeking::GetInstance() 38 | { 39 | static EnablePeeking instance; 40 | return instance; 41 | } 42 | 43 | static void BaseShaderPropertyTransition_SetDitherAlphaValue_Hook(void* __this, float value, MethodInfo* method) 44 | { 45 | EnablePeeking& EnablePeeking = EnablePeeking::GetInstance(); 46 | if (EnablePeeking.f_Enabled->enabled()) 47 | value = 1; 48 | 49 | CALL_ORIGIN(BaseShaderPropertyTransition_SetDitherAlphaValue_Hook, __this, value, method); 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/EnablePeeking.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class EnablePeeking : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static EnablePeeking& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | EnablePeeking(); 23 | }; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/FPSUnlock.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "FPSUnlock.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | FPSUnlock::FPSUnlock() : Feature(), 10 | NF(f_Enabled, "Visuals::FPSUnlocker", false), 11 | NF(f_Fps, "Visuals::FPSUnlocker", 240), 12 | NF(f_Limit, "Visuals::FPSUnlocker", false), 13 | NF(f_FpsLimit, "Visuals::FPSUnlocker", 30) 14 | { 15 | events::GameUpdateEvent += MY_METHOD_HANDLER(FPSUnlock::OnGameUpdate); 16 | } 17 | 18 | const FeatureGUIInfo& FPSUnlock::GetGUIInfo() const 19 | { 20 | TRANSLATED_GROUP_INFO("FPS Unlock", "Visuals"); 21 | return info; 22 | } 23 | 24 | void FPSUnlock::DrawMain() 25 | { 26 | ConfigWidget("## Enabled", f_Enabled); ImGui::SameLine(); 27 | ConfigWidget(_TR("FPS"), f_Fps, 1, 30, 360, _TR("Unlocks higher framerate.")); 28 | if (f_Enabled) 29 | { 30 | ImGui::Indent(); 31 | ConfigWidget("##2", f_Limit); 32 | ImGui::SameLine(); 33 | ConfigWidget(_TR("FPS Limit"), f_FpsLimit, 1, 5, 360, _TR("Limit framerate while the game window isn't focused.\nThis won't work if the cheat menu is open or if you're in a loading screen.")); 34 | ImGui::Unindent(); 35 | } 36 | } 37 | 38 | bool FPSUnlock::NeedStatusDraw() const 39 | { 40 | return f_Enabled; 41 | } 42 | 43 | void FPSUnlock::DrawStatus() 44 | { 45 | ImGui::Text("%s [%d]", _TR("FPS Unlock"), f_Fps.value()); 46 | } 47 | 48 | FPSUnlock& FPSUnlock::GetInstance() 49 | { 50 | static FPSUnlock instance; 51 | return instance; 52 | } 53 | 54 | void FPSUnlock::OnGameUpdate() 55 | { 56 | static bool _lastEnabledStatus = false; 57 | static int _originFPS = 30; 58 | if (_lastEnabledStatus && !f_Enabled) 59 | { 60 | app::Application_set_targetFrameRate(_originFPS, nullptr); 61 | } 62 | else if (!_lastEnabledStatus && f_Enabled) 63 | { 64 | _originFPS = app::Application_get_targetFrameRate(nullptr); 65 | } 66 | _lastEnabledStatus = f_Enabled; 67 | 68 | if (f_Enabled) 69 | { 70 | if (!f_Limit) 71 | app::Application_set_targetFrameRate(f_Fps, nullptr); 72 | else if (f_Limit) 73 | { 74 | if (!app::Application_get_IsFocused(nullptr)) 75 | app::Application_set_targetFrameRate(f_FpsLimit, nullptr); 76 | else 77 | app::Application_set_targetFrameRate(f_Fps, nullptr); 78 | } 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/FPSUnlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class FPSUnlock : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_Fps; 13 | config::Field f_Limit; 14 | config::Field f_FpsLimit; 15 | 16 | static FPSUnlock& GetInstance(); 17 | 18 | const FeatureGUIInfo& GetGUIInfo() const override; 19 | void DrawMain() override; 20 | 21 | virtual bool NeedStatusDraw() const override; 22 | void DrawStatus() override; 23 | void OnGameUpdate(); 24 | 25 | private: 26 | FPSUnlock(); 27 | }; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/FreeCamera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | class FreeCamera : public Feature 8 | { 9 | public: 10 | config::Field f_Enabled; 11 | config::Field f_FreezeAnimation; 12 | config::Field f_SetAvatarInvisible; 13 | config::Field f_BlockInput; 14 | config::Field f_DamageOverlay; 15 | config::Field f_HpOverlay; 16 | config::Field f_Speed; 17 | config::Field f_LookSens; 18 | config::Field f_RollSpeed; 19 | config::Field f_FOVSpeed; 20 | config::Field f_FOV; 21 | config::Field f_MovSmoothing; 22 | config::Field f_LookSmoothing; 23 | config::Field f_RollSmoothing; 24 | config::Field f_FovSmoothing; 25 | config::Field f_Forward; 26 | config::Field f_Backward; 27 | config::Field f_Left; 28 | config::Field f_Right; 29 | config::Field f_Up; 30 | config::Field f_Down; 31 | config::Field f_IncFOV; 32 | config::Field f_DecFOV; 33 | config::Field f_LeftRoll; 34 | config::Field f_RightRoll; 35 | config::Field f_ResetRoll; 36 | 37 | static FreeCamera& GetInstance(); 38 | 39 | const FeatureGUIInfo& GetGUIInfo() const override; 40 | void DrawMain() override; 41 | 42 | bool NeedStatusDraw() const override; 43 | void DrawStatus() override; 44 | 45 | void OnGameUpdate(); 46 | 47 | private: 48 | FreeCamera(); 49 | }; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/HideUI.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "HideUI.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | app::GameObject* ui_camera{}; 10 | 11 | HideUI::HideUI() : Feature(), 12 | NFP(f_Enabled, "Visuals::HideUI", "Hide UI", false) 13 | { 14 | events::GameUpdateEvent += MY_METHOD_HANDLER(HideUI::OnGameUpdate); 15 | } 16 | 17 | const FeatureGUIInfo& HideUI::GetGUIInfo() const 18 | { 19 | 20 | TRANSLATED_GROUP_INFO("Hide UI", "Visuals"); 21 | return info; 22 | } 23 | 24 | void HideUI::DrawMain() 25 | { 26 | ConfigWidget(_TR("Hide UI"), f_Enabled, _TR("Hide in-game UI.\nWhen you switch to another scene (e.g. into Domains), turn off and re-enable this feature")); 27 | } 28 | 29 | bool HideUI::NeedStatusDraw() const 30 | { 31 | return f_Enabled->enabled(); 32 | } 33 | 34 | void HideUI::DrawStatus() 35 | { 36 | ImGui::Text(_TR("Hide UI")); 37 | } 38 | 39 | HideUI& HideUI::GetInstance() 40 | { 41 | static HideUI instance; 42 | return instance; 43 | } 44 | 45 | void HideUI::OnGameUpdate() 46 | { 47 | if (f_Enabled->enabled()) 48 | { 49 | if (ui_camera == nullptr) 50 | ui_camera = app::GameObject_Find(string_to_il2cppi("/UICamera"), nullptr); 51 | 52 | if (ui_camera->fields._.m_CachedPtr != nullptr) 53 | app::GameObject_SetActive(ui_camera, false, nullptr); 54 | } 55 | else 56 | { 57 | if (ui_camera) 58 | { 59 | if (ui_camera->fields._.m_CachedPtr != nullptr) 60 | app::GameObject_SetActive(ui_camera, true, nullptr); 61 | 62 | ui_camera = nullptr; 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/HideUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class HideUI : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static HideUI& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | void OnGameUpdate(); 21 | 22 | private: 23 | HideUI(); 24 | }; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/NoFog.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "NoFog.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | static bool _prevEnabledState = false; 10 | NoFog::NoFog() : Feature(), 11 | NFP(f_Enabled, "Visuals::NoFog", "No fog", false) 12 | { 13 | events::GameUpdateEvent += MY_METHOD_HANDLER(NoFog::OnGameUpdate); 14 | } 15 | 16 | const FeatureGUIInfo& NoFog::GetGUIInfo() const 17 | { 18 | TRANSLATED_GROUP_INFO("No fog", "Visuals"); 19 | return info; 20 | } 21 | 22 | void NoFog::DrawMain() 23 | { 24 | ConfigWidget(_TR("No fog"), f_Enabled, _TR("Removes the fog.")); 25 | } 26 | 27 | bool NoFog::NeedStatusDraw() const 28 | { 29 | return f_Enabled->enabled(); 30 | } 31 | 32 | void NoFog::DrawStatus() 33 | { 34 | ImGui::Text(_TR("No fog")); 35 | } 36 | 37 | NoFog& NoFog::GetInstance() 38 | { 39 | static NoFog instance; 40 | return instance; 41 | } 42 | 43 | void NoFog::OnGameUpdate() 44 | { 45 | if (_prevEnabledState != f_Enabled->enabled()) 46 | { 47 | app::RenderSettings_set_fog(!f_Enabled->enabled(), nullptr); 48 | _prevEnabledState = f_Enabled->enabled(); 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/NoFog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class NoFog : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static NoFog& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | 23 | void OnGameUpdate(); 24 | 25 | NoFog(); 26 | }; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/PaimonFollow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "PaimonFollow.h" 3 | #include 4 | #include 5 | 6 | 7 | namespace cheat::feature 8 | { 9 | namespace GameObject { 10 | app::GameObject* Paimon = nullptr; 11 | app::GameObject* ProfileLayer = nullptr; 12 | } 13 | 14 | PaimonFollow::PaimonFollow() : Feature(), 15 | NFP(f_Enabled, "Visuals::PaimonFollow", "Paimon follow", false) 16 | { 17 | events::GameUpdateEvent += MY_METHOD_HANDLER(PaimonFollow::OnGameUpdate); 18 | } 19 | 20 | const FeatureGUIInfo& PaimonFollow::GetGUIInfo() const 21 | { 22 | TRANSLATED_MODULE_INFO("Visuals"); 23 | return info; 24 | } 25 | 26 | void PaimonFollow::DrawMain() 27 | { 28 | ConfigWidget(_TR("Paimon Follow"), f_Enabled, _TR("To display paimon, turn on the function, open the profile (esc) and close it. \n" \ 29 | "If the paimon disappeared after teleportation, do not disable the function, open and close the profile.")); 30 | } 31 | 32 | bool PaimonFollow::NeedStatusDraw() const 33 | { 34 | return f_Enabled->enabled(); 35 | } 36 | 37 | void PaimonFollow::DrawStatus() 38 | { 39 | ImGui::Text(_TR("Paimon Follow")); 40 | } 41 | 42 | PaimonFollow& PaimonFollow::GetInstance() 43 | { 44 | static PaimonFollow instance; 45 | return instance; 46 | } 47 | 48 | void PaimonFollow::OnGameUpdate() 49 | { 50 | UPDATE_DELAY(100); 51 | 52 | if (f_Enabled->enabled()) 53 | { 54 | GameObject::Paimon = app::GameObject_Find(string_to_il2cppi("/EntityRoot/OtherGadgetRoot/NPC_Guide_Paimon(Clone)"), nullptr); 55 | if (GameObject::Paimon == nullptr) 56 | return; 57 | 58 | GameObject::ProfileLayer = app::GameObject_Find(string_to_il2cppi("/Canvas/Pages/PlayerProfilePage"), nullptr); 59 | if (GameObject::ProfileLayer == nullptr) 60 | return; 61 | 62 | if (GameObject::Paimon->fields._.m_CachedPtr != nullptr && GameObject::ProfileLayer->fields._.m_CachedPtr != nullptr) 63 | { 64 | auto ProfileOpen = app::GameObject_get_active(GameObject::ProfileLayer, nullptr); 65 | 66 | if (ProfileOpen) 67 | app::GameObject_set_active(GameObject::Paimon, false, nullptr); 68 | else 69 | app::GameObject_set_active(GameObject::Paimon, true, nullptr); 70 | } 71 | } 72 | else 73 | { 74 | GameObject::Paimon = nullptr; 75 | GameObject::ProfileLayer = nullptr; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/PaimonFollow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | class PaimonFollow : public Feature 8 | { 9 | public: 10 | config::Field f_Enabled; 11 | static PaimonFollow& GetInstance(); 12 | const FeatureGUIInfo& GetGUIInfo() const override; 13 | void DrawMain() override; 14 | 15 | virtual bool NeedStatusDraw() const override; 16 | void DrawStatus() override; 17 | private: 18 | 19 | void OnGameUpdate(); 20 | PaimonFollow(); 21 | }; 22 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/ProfileChanger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | class ProfileChanger : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field> f_UID; 13 | config::Field f_UIDWaterMarkPrefix; 14 | config::Field f_UIDsize; 15 | config::Field f_UIDpos_x; 16 | config::Field f_UIDpos_y; 17 | config::Field> f_NickName; 18 | config::Field> f_Level; 19 | config::Field f_Exp; 20 | config::Field f_CurExp; 21 | config::Field f_MaxExp; 22 | config::Field f_ExpBar; 23 | config::Field f_ExpBarValue; 24 | config::Field> f_WorldLevel; 25 | 26 | config::Field> f_Avatar; // Avatar png size 256x256 27 | config::Field> f_Card; // Card Name png size 840x400 28 | 29 | static ProfileChanger& GetInstance(); 30 | 31 | const FeatureGUIInfo& GetGUIInfo() const override; 32 | void DrawMain() override; 33 | 34 | bool NeedStatusDraw() const override; 35 | void DrawStatus() override; 36 | 37 | bool CheckFile(const std::string& name); 38 | 39 | private: 40 | SafeQueue toBeUpdate; 41 | SafeValue nextUpdate; 42 | int f_DelayUpdate = 100; 43 | 44 | void OnGameUpdate(); 45 | ProfileChanger(); 46 | 47 | }; 48 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/ShowChestIndicator.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "ShowChestIndicator.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | static bool IndicatorPlugin_DoCheck(app::LCIndicatorPlugin* __this, MethodInfo* method); 10 | 11 | ChestIndicator::ChestIndicator() : Feature(), 12 | NFP(f_Enabled, "Visuals::ChestIndicator", "Chest Indicator", false) 13 | { 14 | } 15 | 16 | const FeatureGUIInfo& ChestIndicator::GetGUIInfo() const 17 | { 18 | TRANSLATED_MODULE_INFO("Visuals"); 19 | return info; 20 | } 21 | 22 | void ChestIndicator::DrawMain() 23 | { 24 | ConfigWidget(_TR("Show Chest Indicator"), f_Enabled, _TR("Show chests, game mechanics.")); 25 | } 26 | 27 | bool ChestIndicator::NeedStatusDraw() const 28 | { 29 | return f_Enabled->enabled(); 30 | } 31 | 32 | void ChestIndicator::DrawStatus() 33 | { 34 | ImGui::Text(_TR("Chest Indicator")); 35 | } 36 | 37 | ChestIndicator& ChestIndicator::GetInstance() 38 | { 39 | static ChestIndicator instance; 40 | return instance; 41 | } 42 | 43 | static bool IndicatorPlugin_DoCheck(app::LCIndicatorPlugin* __this, MethodInfo* method) { 44 | ChestIndicator& chestIndicator = ChestIndicator::GetInstance(); 45 | if (chestIndicator.f_Enabled->enabled()) 46 | { 47 | if (__this->fields._dataItem != nullptr) 48 | { 49 | // Base Chest not found, try improve 50 | } 51 | } 52 | return CALL_ORIGIN(IndicatorPlugin_DoCheck, __this, method); 53 | } 54 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/ShowChestIndicator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | class ChestIndicator : public Feature 8 | { 9 | public: 10 | config::Field f_Enabled; 11 | 12 | static ChestIndicator& GetInstance(); 13 | 14 | const FeatureGUIInfo& GetGUIInfo() const override; 15 | void DrawMain() override; 16 | 17 | virtual bool NeedStatusDraw() const override; 18 | void DrawStatus() override; 19 | 20 | private: 21 | ChestIndicator(); 22 | }; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/visuals/TextureChanger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | class TextureChanger : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field> f_HeadPath; 13 | config::Field> f_BodyPath; 14 | config::Field> f_DressPath; 15 | config::Field> f_GliderPath; 16 | std::string ActiveHero = "NONE"; 17 | std::string ActiveGlider = "NONE"; 18 | bool ApplyTexture; 19 | 20 | static TextureChanger& GetInstance(); 21 | const FeatureGUIInfo& GetGUIInfo() const override; 22 | void DrawMain() override; 23 | bool NeedStatusDraw() const override; 24 | void DrawStatus() override; 25 | bool CheckFile(const std::string& name); 26 | private: 27 | SafeQueue toBeUpdate; 28 | SafeValue nextUpdate; 29 | int f_DelayUpdate = 15; 30 | 31 | void OnGameUpdate(); 32 | TextureChanger(); 33 | 34 | }; 35 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/DialogSkip.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class DialogSkip : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_ToggleHotkey; 13 | config::Field f_AutoSelectDialog; 14 | config::Field f_ExcludeImportant; 15 | config::Field f_FastDialog; 16 | config::Field f_CutsceneUSM; 17 | config::Field f_TimeSpeedup; 18 | 19 | static DialogSkip& GetInstance(); 20 | 21 | const FeatureGUIInfo& GetGUIInfo() const override; 22 | void DrawMain() override; 23 | 24 | virtual bool NeedStatusDraw() const override; 25 | void DrawStatus() override; 26 | 27 | void OnCutScenePageUpdate(app::InLevelCutScenePageContext* context); 28 | 29 | private: 30 | DialogSkip(); 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/DumbEnemies.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "DumbEnemies.h" 3 | 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | static void VCMonsterAIController_TryDoSkill_Hook(void* __this, uint32_t skillID, MethodInfo* method); 9 | 10 | DumbEnemies::DumbEnemies() : Feature(), 11 | NFP(f_Enabled, "DumbEnemies", "Dumb Enemies", false) 12 | { 13 | } 14 | 15 | const FeatureGUIInfo& DumbEnemies::GetGUIInfo() const 16 | { 17 | TRANSLATED_MODULE_INFO("World"); 18 | return info; 19 | } 20 | 21 | void DumbEnemies::DrawMain() 22 | { 23 | ConfigWidget(_TR("Dumb Enemies"), f_Enabled, _TR("Enemies don't attack or use abilities against player. \n" 24 | "May not work with some enemies or enemy abilities.")); 25 | } 26 | 27 | bool DumbEnemies::NeedStatusDraw() const 28 | { 29 | return f_Enabled->enabled(); 30 | } 31 | 32 | void DumbEnemies::DrawStatus() 33 | { 34 | ImGui::Text(_TR("Dumb Enemies")); 35 | } 36 | 37 | DumbEnemies& DumbEnemies::GetInstance() 38 | { 39 | static DumbEnemies instance; 40 | return instance; 41 | } 42 | 43 | // Raised when monster trying to do skill. Attack also is skill. 44 | // We just block if dumb mob enabled, so mob will not attack player. 45 | static void VCMonsterAIController_TryDoSkill_Hook(void* __this, uint32_t skillID, MethodInfo* method) 46 | { 47 | DumbEnemies& dumbEnemies = DumbEnemies::GetInstance(); 48 | if (dumbEnemies.f_Enabled->enabled()) 49 | return; 50 | CALL_ORIGIN(VCMonsterAIController_TryDoSkill_Hook, __this, skillID, method); 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/DumbEnemies.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class DumbEnemies : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static DumbEnemies& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | DumbEnemies(); 23 | }; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/ElementalSight.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "ElementalSight.h" 3 | 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | static void LevelSceneElementViewPlugin_Tick_Hook(app::LevelSceneElementViewPlugin* __this, float inDeltaTime, MethodInfo* method); 9 | 10 | ElementalSight::ElementalSight() : Feature(), 11 | NFP(f_Enabled, "ElementalSight", "Elemental Sight", false) 12 | { 13 | } 14 | 15 | const FeatureGUIInfo& ElementalSight::GetGUIInfo() const 16 | { 17 | TRANSLATED_MODULE_INFO("World"); 18 | return info; 19 | } 20 | 21 | void ElementalSight::DrawMain() 22 | { 23 | ConfigWidget(_TR("Permanent Elemental Sight"), f_Enabled, _TR("Elemental sight is kept on even when moving.\n" 24 | "To turn off, toggle off and use Elemental Sight again.")); 25 | } 26 | 27 | bool ElementalSight::NeedStatusDraw() const 28 | { 29 | return f_Enabled->enabled(); 30 | } 31 | 32 | void ElementalSight::DrawStatus() 33 | { 34 | ImGui::Text(_TR("Elemental Sight")); 35 | } 36 | 37 | ElementalSight& ElementalSight::GetInstance() 38 | { 39 | static ElementalSight instance; 40 | return instance; 41 | } 42 | 43 | static void LevelSceneElementViewPlugin_Tick_Hook(app::LevelSceneElementViewPlugin* __this, float inDeltaTime, MethodInfo* method) 44 | { 45 | ElementalSight& ElementalSight = ElementalSight::GetInstance(); 46 | if (ElementalSight.f_Enabled->enabled()) 47 | __this->fields._triggerElementView = true; 48 | CALL_ORIGIN(LevelSceneElementViewPlugin_Tick_Hook, __this, inDeltaTime, method); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/ElementalSight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class ElementalSight : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static ElementalSight& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | ElementalSight(); 23 | }; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/FakeTime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace cheat::feature 3 | { 4 | 5 | class FakeTime : public Feature 6 | { 7 | public: 8 | config::Field f_Enabled; 9 | config::Field f_Sync2Server; 10 | config::Field f_TimeHour; 11 | config::Field f_TimeMinute; 12 | 13 | static FakeTime& GetInstance(); 14 | void OnGameUpdate(); 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | virtual bool NeedStatusDraw() const override; 18 | void DrawStatus() override; 19 | private: 20 | static void LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method); 21 | float ConversionTime(); 22 | FakeTime(); 23 | }; 24 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/GameSpeed.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "GameSpeed.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace cheat::feature 8 | { 9 | GameSpeed::GameSpeed() : Feature(), 10 | NFP(f_Enabled, "GameSpeed", "Game Speed", false), 11 | NF(f_Hotkey, "GameSpeed", Hotkey(VK_CAPITAL)), 12 | NF(f_Speed, "GameSpeed", 5.0f) 13 | { 14 | events::GameUpdateEvent += MY_METHOD_HANDLER(GameSpeed::OnGameUpdate); 15 | } 16 | 17 | const FeatureGUIInfo& GameSpeed::GetGUIInfo() const 18 | { 19 | TRANSLATED_GROUP_INFO("Game Speed", "World"); 20 | return info; 21 | } 22 | 23 | void GameSpeed::DrawMain() 24 | { 25 | ConfigWidget(_TR("Enabled"), f_Enabled, _TR("Speeds up game with hotkey")); 26 | ConfigWidget(_TR("Hotkey"), f_Hotkey); 27 | ConfigWidget(_TR("Multiplier"), f_Speed, 1.0f, 0.0f, 20.0f, _TR("Set GameSpeed Multiplier\n" \ 28 | "Do NOT use this in the Open World, only use in menus/etc, VERY DANGEROUS!")); 29 | } 30 | 31 | bool GameSpeed::NeedStatusDraw() const 32 | { 33 | return f_Enabled->enabled(); 34 | } 35 | 36 | void GameSpeed::DrawStatus() 37 | { 38 | ImGui::Text(_TR("Game Speed")); 39 | } 40 | 41 | GameSpeed& GameSpeed::GetInstance() 42 | { 43 | static GameSpeed instance; 44 | return instance; 45 | } 46 | 47 | void GameSpeed::OnGameUpdate() 48 | { 49 | static bool isSpeed = false; 50 | float currentSpeed = app::Time_get_timeScale(nullptr); 51 | if (f_Enabled->enabled()) 52 | { 53 | SAFE_BEGIN(); 54 | if (f_Hotkey.value().IsPressed()) 55 | { 56 | if (currentSpeed == 1.0f) 57 | { 58 | app::Time_set_timeScale(f_Speed, nullptr); 59 | isSpeed = true; 60 | } 61 | } 62 | 63 | if (!f_Hotkey.value().IsPressed() && isSpeed) 64 | { 65 | if (currentSpeed != 1.0f) 66 | { 67 | app::Time_set_timeScale(1.0f, nullptr); 68 | isSpeed = false; 69 | } 70 | } 71 | SAFE_EEND(); 72 | } 73 | else 74 | { 75 | // Aditional check if user is still pressing key and they decide to disable the feature 76 | if (isSpeed) 77 | { 78 | if (currentSpeed != 1.0f) 79 | { 80 | app::Time_set_timeScale(1.0f, nullptr); 81 | isSpeed = false; 82 | } 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/GameSpeed.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class GameSpeed : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_Hotkey; 13 | config::Field f_Speed; 14 | 15 | static GameSpeed& GetInstance(); 16 | 17 | const FeatureGUIInfo& GetGUIInfo() const override; 18 | void DrawMain() override; 19 | 20 | virtual bool NeedStatusDraw() const override; 21 | void DrawStatus() override; 22 | 23 | void OnGameUpdate(); 24 | private: 25 | GameSpeed(); 26 | }; 27 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/MusicEvent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class MusicEvent : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | 13 | static MusicEvent& GetInstance(); 14 | 15 | const FeatureGUIInfo& GetGUIInfo() const override; 16 | void DrawMain() override; 17 | 18 | virtual bool NeedStatusDraw() const override; 19 | void DrawStatus() override; 20 | 21 | private: 22 | MusicEvent(); 23 | }; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/OpenTeamImmediately.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "OpenTeamImmediately.h" 3 | 4 | #include 5 | 6 | namespace cheat::feature 7 | { 8 | static bool MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook(app::InLevelMainPageContext_DoTeamCountDown_Iterator* __this, MethodInfo* method); 9 | static void MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook(void* __this, MethodInfo* method); 10 | static void MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook(void* __this, MethodInfo* method); 11 | 12 | 13 | OpenTeamImmediately::OpenTeamImmediately() : Feature(), 14 | NFP(f_Enabled, "OpenTeam", "Open Team Immediately", false), 15 | InLevelPlayerProfilePageContext(nullptr) 16 | { 17 | } 18 | 19 | const FeatureGUIInfo& OpenTeamImmediately::GetGUIInfo() const 20 | { 21 | TRANSLATED_MODULE_INFO("World"); 22 | return info; 23 | } 24 | 25 | void OpenTeamImmediately::DrawMain() 26 | { 27 | ConfigWidget(_TR("Open Team Immediately"), f_Enabled, _TR("Open team immediately without waiting for count down.")); 28 | } 29 | 30 | bool OpenTeamImmediately::NeedStatusDraw() const 31 | { 32 | return f_Enabled->enabled(); 33 | } 34 | 35 | void OpenTeamImmediately::DrawStatus() 36 | { 37 | ImGui::Text(_TR("OTI")); 38 | } 39 | 40 | OpenTeamImmediately& OpenTeamImmediately::GetInstance() 41 | { 42 | static OpenTeamImmediately instance; 43 | return instance; 44 | } 45 | 46 | static bool MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook(app::InLevelMainPageContext_DoTeamCountDown_Iterator* __this, MethodInfo* method) 47 | { 48 | auto& openTeamImmediately = OpenTeamImmediately::GetInstance(); 49 | 50 | // if paimon menu open, team ui will not open 51 | if (openTeamImmediately.f_Enabled->enabled() && !openTeamImmediately.InLevelPlayerProfilePageContext) 52 | { 53 | __this->fields._levelMainPageContext->fields._countDownTime = __this->fields._levelMainPageContext->fields.EnterCountDown + 1.f; 54 | } 55 | return CALL_ORIGIN(MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook, __this, method); 56 | } 57 | 58 | static void MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook(void* __this, MethodInfo* method) 59 | { 60 | auto& openTeamImmediately = OpenTeamImmediately::GetInstance(); 61 | openTeamImmediately.InLevelPlayerProfilePageContext = __this; 62 | CALL_ORIGIN(MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook, __this, method); 63 | } 64 | 65 | static void MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook(void* __this, MethodInfo* method) 66 | { 67 | auto& openTeamImmediately = OpenTeamImmediately::GetInstance(); 68 | CALL_ORIGIN(MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook, __this, method); 69 | openTeamImmediately.InLevelPlayerProfilePageContext = nullptr; 70 | } 71 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/OpenTeamImmediately.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cheat::feature 5 | { 6 | 7 | class OpenTeamImmediately : public Feature 8 | { 9 | public: 10 | config::Field f_Enabled; 11 | //MoleMole_InLevelPlayerProfilePageContext* 12 | void* InLevelPlayerProfilePageContext; 13 | 14 | static OpenTeamImmediately& GetInstance(); 15 | 16 | const FeatureGUIInfo& GetGUIInfo() const override; 17 | void DrawMain() override; 18 | 19 | virtual bool NeedStatusDraw() const override; 20 | void DrawStatus() override; 21 | 22 | private: 23 | OpenTeamImmediately(); 24 | }; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/SkipEnhanceAnimation.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "SkipEnhanceAnimation.h" 3 | 4 | #include "helpers.h" 5 | 6 | namespace cheat::feature 7 | { 8 | static void MoleMole_EquipLevelUpDialogContext_SetupView_Hook(app::MoleMole_EquipLevelUpDialogContext* __this, MethodInfo* method); 9 | static void MoleMole_EquipOverviewPageContext_PlayExpAddAnimation_Hook(/*MoleMole_EquipOverviewPageContext*/ void* __this, float startPer, float endPer, /*Action*/ void* callback, MethodInfo* method); 10 | static void MoleMole_EquipOverviewPageContext_PlayLevelUpSuccessShow_Hook(/*MoleMole_EquipOverviewPageContext*/ void* __this, /*Action*/ void* refreshViewAction, MethodInfo* method); 11 | 12 | static uint32_t substatRollLevels[] = { 5, 9, 13, 17, 21 }; // artifact levels from the field go from 1 to 21, so we do +1 13 | 14 | SkipEnhanceAnimation::SkipEnhanceAnimation() : Feature(), 15 | NF(f_Enabled, "SkipEnhanceAnimation", false), 16 | NF(f_ShowLevelUp, "SkipEnhanceAnimation", true) 17 | { 18 | } 19 | 20 | const FeatureGUIInfo& SkipEnhanceAnimation::GetGUIInfo() const 21 | { 22 | TRANSLATED_MODULE_INFO("World"); 23 | return info; 24 | } 25 | 26 | void SkipEnhanceAnimation::DrawMain() 27 | { 28 | ConfigWidget(_TR("Skip Enhance Animation"), f_Enabled, _TR("Skip weapon and artifact enhancement animation.")); 29 | if (f_Enabled) 30 | { 31 | ImGui::Indent(); 32 | ConfigWidget(_TR("Show Level-Up Dialog For Substat Rolls"), f_ShowLevelUp, 33 | _TR("Show level up dialog when artifacts roll substats\n" 34 | "(when hitting levels 4, 8, 12, 16, and 20).")); 35 | ImGui::Unindent(); 36 | } 37 | } 38 | 39 | bool SkipEnhanceAnimation::NeedStatusDraw() const 40 | { 41 | return f_Enabled; 42 | } 43 | 44 | void SkipEnhanceAnimation::DrawStatus() 45 | { 46 | ImGui::Text(_TR("Skip Enhance Animation")); 47 | } 48 | 49 | SkipEnhanceAnimation& SkipEnhanceAnimation::GetInstance() 50 | { 51 | static SkipEnhanceAnimation instance; 52 | return instance; 53 | } 54 | 55 | bool SkipEnhanceAnimation::ShouldShowLevelUpDialog(app::MoleMole_EquipLevelUpDialogContext* dialog) 56 | { 57 | auto& skipEnhaceAnimation = GetInstance(); 58 | if (skipEnhaceAnimation.f_ShowLevelUp) 59 | { 60 | if (dialog->fields._equipType == app::MoleMole_Config_ItemType__Enum::ITEM_RELIQUARY) 61 | { 62 | const uint32_t prevLvl = dialog->fields._prevLevel; 63 | const uint32_t currLvl = dialog->fields._currLevel; 64 | return std::any_of(std::begin(substatRollLevels), std::end(substatRollLevels), 65 | [prevLvl, currLvl](uint32_t level) { return prevLvl < level && level <= currLvl; }); 66 | } 67 | } 68 | return false; 69 | } 70 | 71 | void MoleMole_EquipLevelUpDialogContext_SetupView_Hook(app::MoleMole_EquipLevelUpDialogContext* __this, MethodInfo* method) 72 | { 73 | CALL_ORIGIN(MoleMole_EquipLevelUpDialogContext_SetupView_Hook, __this, method); 74 | 75 | auto& skipEnhaceAnimation = SkipEnhanceAnimation::GetInstance(); 76 | } 77 | 78 | void MoleMole_EquipOverviewPageContext_PlayExpAddAnimation_Hook(/*MoleMole_EquipOverviewPageContext*/ void* __this, float startPer, float endPer, /*Action*/ void* callback, MethodInfo* method) 79 | { 80 | auto& skipEnhaceAnimation = SkipEnhanceAnimation::GetInstance(); 81 | if (skipEnhaceAnimation.f_Enabled) 82 | return app::Action_Invoke(callback, method); 83 | 84 | CALL_ORIGIN(MoleMole_EquipOverviewPageContext_PlayExpAddAnimation_Hook, __this, startPer, endPer, callback, method); 85 | } 86 | 87 | void MoleMole_EquipOverviewPageContext_PlayLevelUpSuccessShow_Hook(/*MoleMole_EquipOverviewPageContext*/ void* __this, /*Action*/ void* refreshViewAction, MethodInfo* method) 88 | { 89 | auto& skipEnhaceAnimation = SkipEnhanceAnimation::GetInstance(); 90 | if (skipEnhaceAnimation.f_Enabled) 91 | return app::Action_Invoke(refreshViewAction, method); 92 | 93 | CALL_ORIGIN(MoleMole_EquipOverviewPageContext_PlayLevelUpSuccessShow_Hook, __this, refreshViewAction, method); 94 | } 95 | } -------------------------------------------------------------------------------- /cheat-library/src/user/cheat/world/SkipEnhanceAnimation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace cheat::feature 6 | { 7 | 8 | class SkipEnhanceAnimation : public Feature 9 | { 10 | public: 11 | config::Field f_Enabled; 12 | config::Field f_ShowLevelUp; 13 | 14 | static SkipEnhanceAnimation& GetInstance(); 15 | 16 | const FeatureGUIInfo& GetGUIInfo() const override; 17 | void DrawMain() override; 18 | 19 | virtual bool NeedStatusDraw() const override; 20 | void DrawStatus() override; 21 | 22 | bool ShouldShowLevelUpDialog(app::MoleMole_EquipLevelUpDialogContext* dialog); 23 | private: 24 | SkipEnhanceAnimation(); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /cheat-library/src/user/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch-il2cpp.h" 2 | #include "main.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | void Run(HMODULE* phModule) 15 | { 16 | ResourceLoader::SetModuleHandle(*phModule); 17 | util::SetCurrentPath(util::GetModulePath(*phModule)); 18 | 19 | // Init config 20 | config::Initialize((util::GetCurrentPath() / "cfg.json").string()); 21 | 22 | // Init logger 23 | auto& settings = cheat::feature::Settings::GetInstance(); 24 | if (settings.f_FileLogging) 25 | { 26 | Logger::PrepareFileLogging((util::GetCurrentPath() / "logs").string()); 27 | Logger::SetLevel(Logger::Level::Trace, Logger::LoggerType::FileLogger); 28 | } 29 | 30 | if (settings.f_ConsoleLogging) 31 | { 32 | Logger::SetLevel(Logger::Level::Debug, Logger::LoggerType::ConsoleLogger); 33 | il2cppi_new_console(); 34 | } 35 | 36 | DebuggerBypassPre(); 37 | 38 | while (GetModuleHandle("GameAssembly.dll") == nullptr) 39 | { 40 | LOG_DEBUG("GameAssembly.dll isn't initialized, waiting for 2 sec."); 41 | Sleep(2000); 42 | } 43 | 44 | #ifdef _DEBUG 45 | LOG_DEBUG("Waiting 10sec for loading game library."); 46 | Sleep(15000); 47 | #else 48 | uint32_t delay = settings.f_InitializationDelay.value(); 49 | LOG_DEBUG("Waiting %.3f sec for game to initialize.\n(If Genshin crashes after this line you might want to try longer delay in cfg.ini)", (float)delay/1000); 50 | Sleep(delay); 51 | #endif 52 | 53 | DebuggerBypassPost(); 54 | 55 | LOG_DEBUG("init il2cpp"); 56 | 57 | init_il2cpp(); 58 | 59 | LOG_DEBUG("init cheat"); 60 | 61 | cheat::Init(); 62 | 63 | LOG_DEBUG("Config path is at %s", (util::GetCurrentPath() / "cfg.json").string().c_str()); 64 | } -------------------------------------------------------------------------------- /cheat-library/src/user/main.h: -------------------------------------------------------------------------------- 1 | // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty 2 | // Custom injected code entry point 3 | 4 | #pragma once 5 | #include 6 | 7 | // Custom injected code entry point 8 | void Run(HMODULE* hModule); -------------------------------------------------------------------------------- /injector/akebi.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/injector/akebi.ico -------------------------------------------------------------------------------- /injector/akebi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/injector/akebi.png -------------------------------------------------------------------------------- /injector/injector.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | 5 | #include "resource.h" 6 | 7 | #define APSTUDIO_READONLY_SYMBOLS 8 | ///////////////////////////////////////////////////////////////////////////// 9 | // 10 | // Generated from the TEXTINCLUDE 2 resource. 11 | // 12 | #include "winres.h" 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | #undef APSTUDIO_READONLY_SYMBOLS 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | // Chinese (Simplified, Singapore) resources 19 | 20 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ZHI) 21 | LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE 22 | 23 | #ifdef APSTUDIO_INVOKED 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // TEXTINCLUDE 27 | // 28 | 29 | 1 TEXTINCLUDE 30 | BEGIN 31 | "resource.h\0" 32 | END 33 | 34 | 2 TEXTINCLUDE 35 | BEGIN 36 | "#include ""winres.h""\r\n" 37 | "\0" 38 | END 39 | 40 | 3 TEXTINCLUDE 41 | BEGIN 42 | "\r\n" 43 | "\0" 44 | END 45 | 46 | #endif // APSTUDIO_INVOKED 47 | 48 | #endif // Chinese (Simplified, Singapore) resources 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | 52 | ///////////////////////////////////////////////////////////////////////////// 53 | // English (United States) resources 54 | 55 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 56 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Icon 61 | // 62 | 63 | // Icon with lowest ID value placed first to ensure application icon 64 | // remains consistent on all systems. 65 | IDI_ICON1 ICON "akebi.ico" 66 | 67 | 68 | ///////////////////////////////////////////////////////////////////////////// 69 | // 70 | // PNG 71 | // 72 | 73 | IDB_PNG1 PNG "akebi.png" 74 | 75 | #endif // English (United States) resources 76 | ///////////////////////////////////////////////////////////////////////////// 77 | 78 | 79 | 80 | #ifndef APSTUDIO_INVOKED 81 | ///////////////////////////////////////////////////////////////////////////// 82 | // 83 | // Generated from the TEXTINCLUDE 3 resource. 84 | // 85 | 86 | 87 | ///////////////////////////////////////////////////////////////////////////// 88 | #endif // not APSTUDIO_INVOKED 89 | 90 | -------------------------------------------------------------------------------- /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 | {877f240b-91bb-46cf-8770-6df8379fa27a} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | 48 | 49 | Resource Files 50 | 51 | 52 | Resource Files 53 | 54 | 55 | -------------------------------------------------------------------------------- /injector/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by injector.rc 4 | // 5 | #define IDI_ICON1 101 6 | #define IDB_PNG1 102 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 103 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /injector/src/injector.cpp: -------------------------------------------------------------------------------- 1 | #include "injector.h" 2 | 3 | #include 4 | #include 5 | 6 | bool InjectDLL(HANDLE hProc, const std::string& filepath) 7 | { 8 | #ifdef MANUAL_MAP 9 | bool result = ManualMapDLL(hProc, filepath); 10 | #else 11 | bool result = LoadLibraryDLL(hProc, filepath); 12 | #endif 13 | return result; 14 | } -------------------------------------------------------------------------------- /injector/src/injector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "util.h" 9 | 10 | // #define MANUAL_MAP 11 | 12 | bool InjectDLL(HANDLE hProc, const std::string& filepath); -------------------------------------------------------------------------------- /injector/src/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NctimeAza/StarRail-Cheat/7b1271ff44b680350208b265555019655aa9320a/injector/src/main.cpp -------------------------------------------------------------------------------- /injector/src/util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int FindProcessId(const std::string& processName) 10 | { 11 | int pid = -1; 12 | 13 | HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 14 | PROCESSENTRY32 process; 15 | ZeroMemory(&process, sizeof(process)); 16 | process.dwSize = sizeof(process); 17 | 18 | if (Process32First(snapshot, &process)) 19 | { 20 | do 21 | { 22 | if (std::string(process.szExeFile) == processName) 23 | { 24 | pid = process.th32ProcessID; 25 | break; 26 | } 27 | } while (Process32Next(snapshot, &process)); 28 | } 29 | 30 | CloseHandle(snapshot); 31 | 32 | return pid; 33 | } 34 | 35 | void WaitForCloseProcess(const std::string& processName) 36 | { 37 | int pid = FindProcessId(processName); 38 | if (pid == -1) 39 | return; 40 | 41 | std::cout << "Found '" << processName << "' process. Waiting for closing..." << std::endl; 42 | 43 | #ifdef _DEBUG 44 | std::stringstream stream; 45 | stream << "taskkill /F /T /IM " << processName; 46 | int retval = system(stream.str().c_str()); 47 | 48 | std::cout << "Trying to kill process." << std::endl; 49 | #endif 50 | 51 | HANDLE hProc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); 52 | DWORD exitCode = 0; 53 | while (hProc && (GetExitCodeProcess(hProc, &exitCode), exitCode == STILL_ACTIVE)) { 54 | Sleep(1000); 55 | } 56 | 57 | if (hProc != NULL) 58 | CloseHandle(hProc); 59 | } -------------------------------------------------------------------------------- /injector/src/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | int FindProcessId(const std::string& processName); 8 | void WaitForCloseProcess(const std::string& processName); --------------------------------------------------------------------------------