diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7564ea9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Attach", + "type": "cppvsdbg", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 5913ec8..fb83477 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,63 @@ "filesystem": "cpp", "xlocale": "cpp", "xstring": "cpp", - "xutility": "cpp" + "xutility": "cpp", + "ostream": "cpp", + "algorithm": "cpp", + "array": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "forward_list": "cpp", + "fstream": "cpp", + "functional": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "new": "cpp", + "numeric": "cpp", + "ratio": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "utility": "cpp", + "valarray": "cpp", + "vector": "cpp", + "xfacet": "cpp", + "xfunctional": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xmemory0": "cpp", + "xstddef": "cpp", + "xtr1common": "cpp", + "xtree": "cpp" } } \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e7965b0..06e55dd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,10 +116,10 @@ include_directories( # Compile definitions ################################################################################ target_compile_definitions(${PROJECT_NAME} PRIVATE - "$<$:" + "$<$:" "_NDEBUG" ">" - "$<$:" + "$<$:" "_DEBUG" ">" "_CRT_SECURE_NO_WARNINGS;" @@ -141,12 +141,12 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE ################################################################################ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE - $<$: + $<$: /O2; /Oi; /Gy > - $<$: + $<$: /Od > /std:c++latest; @@ -197,13 +197,15 @@ if(MSVC) ) source_file_compile_options(external/imgui/imgui_widgets.cpp ${FILE_CL_OPTIONS}) target_link_options(${PROJECT_NAME} PRIVATE - $<$: + $<$: /SAFESEH:NO; /OPT:REF; /LTCG; /OPT:ICF > - /DEBUG:FULL; + $<$: + /DEBUG:FULL; + > /SUBSYSTEM:WINDOWS ) endif() @@ -215,8 +217,8 @@ add_custom_command_if( TARGET ${PROJECT_NAME} PRE_BUILD COMMANDS - COMMAND $ taskkill /f /fi "imagename eq gta_sa.exe" - COMMAND $ taskkill /f /fi "imagename eq gta_sa.exe" + COMMAND $ taskkill /f /fi "imagename eq gta_sa.exe" + COMMAND $ taskkill /f /fi "imagename eq gta_sa.exe" ) ################################################################################ diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 30a28ec..a148b31 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -51,11 +51,11 @@ CheatMenu::CheatMenu() Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f); Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f); srand(CTimer::m_snTimeInMilliseconds); + }; Events::processScriptsEvent += [this] { - if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive && CTimer::m_snTimeInMilliseconds - Globals::last_key_timer > 250) { if (Ui::HotKeyPressed(hotkey::menu_open)) diff --git a/src/Hook.cpp b/src/Hook.cpp index ca14608..96bc9cb 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -68,12 +68,10 @@ HRESULT Hook::PresentDx9(IDirect3DDevice9 *pDevice, RECT* pSourceRect, RECT* pDe ImGui::EndFrame(); ImGui::Render(); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); - } else { Globals::init_done = true; - ImGui::CreateContext(); ImGuiStyle& style = ImGui::GetStyle(); @@ -189,19 +187,23 @@ Hook::Hook() { if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success) { - assert(kiero::bind(16, (void**)&oReset9, ResetDx9) == kiero::Status::Success); - assert(kiero::bind(17, (void**)&oPresent9, PresentDx9) == kiero::Status::Success); - Globals::renderer = Render_DirectX9; - - flog << "Successfully hooked dx9 device." << std::endl; + if (kiero::bind(16, (void**)&oReset9, ResetDx9) == kiero::Status::Success + && kiero::bind(17, (void**)&oPresent9, PresentDx9) == kiero::Status::Success) + { + Globals::renderer = Render_DirectX9; + flog << "Successfully hooked dx9 device." << std::endl; + } } else { // gtaRenderHook if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success) { - kiero::bind(8, (void**)&oPresent11, PresentDx11); - Globals::renderer = Render_DirectX11; + if (kiero::bind(8, (void**)&oPresent11, PresentDx11) == kiero::Status::Success) + { + Globals::renderer = Render_DirectX11; + flog << "Successfully hooked dx11 device." << std::endl; + } flog << "Successfully hooked dx11 device." << std::endl; } diff --git a/src/Ped.cpp b/src/Ped.cpp index 59ed83d..3f77819 100644 --- a/src/Ped.cpp +++ b/src/Ped.cpp @@ -49,7 +49,6 @@ Ped::~Ped() } } - void Ped::SpawnPed(std::string& model) { if (spawn_ped::list.size() == SPAWN_PED_LIMIT)