├── .gitattributes ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── build.bat ├── configure.bat ├── dist.bat ├── exclude_files.txt ├── exclude_files_2.txt ├── external └── CMakeLists.txt ├── screenshots ├── darkest_dungeon_opengl32_with_google.jpg ├── darksouls3_dx11_with_google.jpg └── ffxiv_dx11_with_act_skin.png └── src ├── CMakeLists.txt ├── cef ├── CMakeLists.txt ├── Resource.rc ├── Resource.rc.in ├── overlay.cpp ├── overlay_proc.cpp ├── resource.h └── version.h.in ├── loader ├── CMakeLists.txt ├── Resource.rc ├── Resource.rc.in ├── loader.cpp ├── resource.h ├── version.h └── version.h.in ├── overlay.def ├── rev.py ├── revision.bat ├── setdirty.bat ├── tag ├── tag.in └── version.in /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.c text 4 | *.cpp text 5 | *.h text 6 | *.hpp text 7 | *.lua text 8 | *.json text 9 | CMakeLists.txt text 10 | *.cmake text 11 | *.sln text eol=crlf 12 | 13 | *.png binary 14 | *.jpg binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/bin/* 2 | **/build/* 3 | **/lib/* 4 | *.7z 5 | *.aps 6 | *.orig 7 | *.pdb 8 | *.user 9 | *.user** 10 | /test/config.bat 11 | bin/* 12 | build/* 13 | dist/* 14 | dist_cef/* 15 | lib/* 16 | prebuilt/* 17 | src/version 18 | textures/out/* 19 | /src/cef/version.h 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/jsoncpp"] 2 | path = external/jsoncpp 3 | url = https://github.com/open-source-parsers/jsoncpp.git 4 | ignore = dirty 5 | [submodule "external/reshade"] 6 | path = external/reshade 7 | url = https://github.com/ZCube/reshade 8 | [submodule "external/boost"] 9 | path = external/boost 10 | url = https://github.com/ZCube/boost-cmake.git 11 | [submodule "external/zlib"] 12 | path = external/zlib 13 | url = https://github.com/madler/zlib.git 14 | ignore = dirty 15 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.0) 2 | 3 | project(CEFOverlayEngine C CXX) 4 | 5 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 6 | 7 | ADD_DEFINITIONS( 8 | -DBOOST_ALL_NO_LIB 9 | -D_CRT_SECURE_NO_WARNINGS 10 | -D_WIN32_WINNT=0x0601 11 | -DWIN32_LEAN_AND_MEAN 12 | -DUNICODE 13 | -D_UNICODE 14 | -DNOMINMAX 15 | ) 16 | 17 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 18 | set(address_model "64") 19 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 20 | set(address_model "32") 21 | endif() 22 | 23 | include_directories( 24 | ${CMAKE_BINARY_DIR}/external/zlib 25 | zlib 26 | ) 27 | 28 | ADD_SUBDIRECTORY(prebuilt) 29 | 30 | LINK_DIRECTORIES( 31 | prebuilt/cef/${address_model}/ 32 | prebuilt/${address_model} 33 | prebuilt/${address_model}/third_party 34 | prebuilt/${address_model}/third_party/icu 35 | ) 36 | ADD_SUBDIRECTORY(external) 37 | ADD_SUBDIRECTORY(src) 38 | 39 | IF(MSVC) 40 | OPTION(USE_STATIC_RUNTIME_LIBRARY "Use Static Runtime Library" ON) 41 | OPTION(USE_LINK_TIME_OPTIMIZATION "Use Link Time Optimization" ON) 42 | 43 | IF(USE_STATIC_RUNTIME_LIBRARY) 44 | message(STATUS "- MSVC: Use Static Runtime Library") 45 | ENDIF(USE_STATIC_RUNTIME_LIBRARY) 46 | foreach (flag_var 47 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE 48 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO 49 | CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE 50 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) 51 | 52 | set(_PARAM "") 53 | IF(USE_STATIC_RUNTIME_LIBRARY) 54 | string(FIND "${${flag_var}}" "/MT" _TESTVAR) 55 | if(${_TESTVAR} EQUAL "-1") 56 | string(FIND "${${flag_var}}" "/MD" _TESTVAR) 57 | if(${_TESTVAR} EQUAL "-1") 58 | set(_PARAM "${_PARAM} /MT ") 59 | else() 60 | string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") 61 | ENDIF() 62 | ENDIF() 63 | ENDIF() 64 | 65 | string(FIND "${${flag_var}}" "/MP" _TESTVAR) 66 | if(${_TESTVAR} EQUAL "-1") 67 | set(_PARAM "${_PARAM} /MP") 68 | endif() 69 | if(_PARAM) 70 | set(${flag_var} "${${flag_var}} ${_PARAM}" CACHE STRING "" FORCE) 71 | ENDIF() 72 | 73 | endforeach() 74 | 75 | IF(USE_LINK_TIME_OPTIMIZATION) 76 | foreach (flag_var 77 | CMAKE_EXE_LINKER_FLAGS_RELEASE 78 | CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO 79 | CMAKE_SHARED_LINKER_FLAGS_RELEASE 80 | CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO 81 | CMAKE_MODULE_LINKER_FLAGS_RELEASE 82 | CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO) 83 | string(FIND "${${flag_var}}" "/LTCG" _TESTVAR) 84 | if(${_TESTVAR} EQUAL "-1") 85 | set(${flag_var} "${${flag_var}} /LTCG") 86 | endif() 87 | endforeach() 88 | foreach (flag_var 89 | CMAKE_EXE_LINKER_FLAGS 90 | CMAKE_SHARED_LINKER_FLAGS 91 | CMAKE_MODULE_LINKER_FLAGS 92 | CMAKE_EXE_LINKER_FLAGS_DEBUG 93 | CMAKE_SHARED_LINKER_FLAGS_DEBUG 94 | CMAKE_MODULE_LINKER_FLAGS_DEBUG) 95 | string(FIND "${${flag_var}}" "/LTCG" _TESTVAR) 96 | if(NOT ${_TESTVAR} EQUAL "-1") 97 | string(REPLACE "/LTCG" " " temp "${${flag_var}}") 98 | set(${flag_var} "${temp}") 99 | endif() 100 | string(FIND "${${flag_var}}" "/INCREMENTAL" _TESTVAR) 101 | if(${_TESTVAR} EQUAL "-1") 102 | set(${flag_var} "${${flag_var}} /INCREMENTAL") 103 | endif() 104 | endforeach() 105 | foreach (flag_var 106 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE 107 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO 108 | CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE 109 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) 110 | string(REPLACE "${${flag_var}}" "${${flag_var}} /GL" ${flag_var} "${${flag_var}}") 111 | endforeach() 112 | ELSEIF(USE_LINK_TIME_OPTIMIZATION) 113 | foreach (flag_var 114 | CMAKE_EXE_LINKER_FLAGS_RELEASE 115 | CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO 116 | CMAKE_SHARED_LINKER_FLAGS_RELEASE 117 | CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO 118 | CMAKE_MODULE_LINKER_FLAGS_RELEASE 119 | CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO 120 | CMAKE_EXE_LINKER_FLAGS 121 | CMAKE_SHARED_LINKER_FLAGS 122 | CMAKE_MODULE_LINKER_FLAGS 123 | CMAKE_EXE_LINKER_FLAGS_DEBUG 124 | CMAKE_SHARED_LINKER_FLAGS_DEBUG 125 | CMAKE_MODULE_LINKER_FLAGS_DEBUG) 126 | string(FIND "${${flag_var}}" "/INCREMENTAL" _TESTVAR) 127 | if(${_TESTVAR} EQUAL "-1") 128 | set(${flag_var} "${${flag_var}} /INCREMENTAL") 129 | endif() 130 | endforeach() 131 | ENDIF(USE_LINK_TIME_OPTIMIZATION) 132 | foreach (flag_var 133 | CMAKE_EXE_LINKER_FLAGS_RELEASE 134 | CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO 135 | CMAKE_SHARED_LINKER_FLAGS_RELEASE 136 | CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO 137 | CMAKE_MODULE_LINKER_FLAGS_RELEASE 138 | CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO 139 | CMAKE_EXE_LINKER_FLAGS 140 | CMAKE_SHARED_LINKER_FLAGS 141 | CMAKE_MODULE_LINKER_FLAGS 142 | CMAKE_EXE_LINKER_FLAGS_DEBUG 143 | CMAKE_SHARED_LINKER_FLAGS_DEBUG 144 | CMAKE_MODULE_LINKER_FLAGS_DEBUG) 145 | set(${flag_var} "${${flag_var}}" CACHE STRING "" FORCE) 146 | endforeach() 147 | ENDIF() 148 | 149 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | All files, except 2 | external/* 3 | prebuilt/* 4 | 5 | BSD 3-Clause License 6 | 7 | Copyright (c) 2017, ZCube (zcube@zcube.kr) 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | * Neither the name of the copyright holder nor the names of its 21 | contributors may be used to endorse or promote products derived from 22 | this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CEFOverlayEngine 2 | 3 | ## Interface 4 | Button or Key | Description 5 | -------- | ---- 6 | Shift + F3 | Show/Hide 7 | Ctrl + Alt + Shift | Click-through. 8 | 9 | ## Screenshots (in FullScreen Mode) 10 | FFXIV (DX11) with ACT SKIN(miniparseGlowIcon) 11 | ![N|Solid](https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/master/screenshots/ffxiv_dx11_with_act_skin.png) 12 | 13 | Darkest Dungeon (OpenGL) 14 | ![N|Solid](https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/master/screenshots/darkest_dungeon_opengl32_with_google.jpg) 15 | 16 | DarkSouls3 (DX11) 17 | ![N|Solid](https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/master/screenshots/darksouls3_dx11_with_google.jpg) 18 | 19 | ## Used Libraries 20 | Library | Description 21 | ------- | ----------- 22 | [Boost](https://boost.org) | Boost Library (ASIO, filesystem) 23 | [ImGui](https://github.com/ocornut/imgui) | Dear ImGui 24 | [JsonCPP](https://github.com/open-source-parsers/jsoncpp) | Json Library 25 | [Reshade](https://github.com/crosire/reshade) | Used as overlay injector 26 | 27 | NO WARRANTY. ANY USE OF THE SOFTWARE IS ENTIRELY AT YOUR OWN RISK. 28 | 29 | 30 | ## Note ## 31 | 32 | This repository is no longer maintained. 33 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETLOCAL 3 | 4 | set _ROOT=%CD% 5 | pushd external\reshade 6 | CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" 7 | msbuild ReShade.sln /property:Configuration=Release "/property:Platform=32-bit" 8 | msbuild ReShade.sln /property:Configuration=Release "/property:Platform=64-bit" 9 | popd 10 | 11 | if not exist build\64 mkdir build\64 12 | pushd build\64 13 | cmake --build . --config Release 14 | popd 15 | 16 | if not exist build\32 mkdir build\32 17 | pushd build\32 18 | cmake --build . --config Release 19 | popd 20 | 21 | ENDLOCAL 22 | -------------------------------------------------------------------------------- /configure.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETLOCAL 3 | CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" 4 | set _ROOT=%CD% 5 | 6 | pushd prebuilt 7 | py -3 init_prebuilt.py 8 | popd 9 | 10 | if not exist build\64 mkdir build\64 11 | pushd build\64 12 | cmake -G "Visual Studio 15 2017 Win64" %_ROOT% ^ 13 | "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=%_ROOT%/bin/64" ^ 14 | "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=%_ROOT%/lib/64" ^ 15 | "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=%_ROOT%/bin/64" 16 | popd 17 | 18 | if not exist build\32 mkdir build\32 19 | pushd build\32 20 | cmake -G "Visual Studio 15 2017" %_ROOT% ^ 21 | "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=%_ROOT%/bin/32" ^ 22 | "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=%_ROOT%/lib/32" ^ 23 | "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=%_ROOT%/bin/32" 24 | popd 25 | 26 | ENDLOCAL 27 | -------------------------------------------------------------------------------- /dist.bat: -------------------------------------------------------------------------------- 1 | mkdir dist\module\32 2 | xcopy /hrkys /exclude:exclude_files_2.txt bin\32\Release\mod_loader*.* dist\module\mod_loader_32.* 3 | xcopy /hrkys /exclude:exclude_files_2.txt bin\32\Release\CefOverlay.* dist\module\32\overlay_mod.* 4 | xcopy /hrkys external\reshade\bin\Win32\Release\ReShade32.dll dist\module\d3d9.* 5 | 6 | mkdir dist\module\64 7 | xcopy /hrkys /exclude:exclude_files_2.txt bin\64\Release\mod_loader*.* dist\module\mod_loader_64.* 8 | xcopy /hrkys /exclude:exclude_files_2.txt bin\64\Release\CefOverlay.* dist\module\64\overlay_mod.* 9 | xcopy /hrkys external\reshade\bin\x64\Release\ReShade64.dll dist\module\dxgi.* 10 | 11 | mkdir dist\runtime\32 12 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\32\Resources\* dist\runtime\32 13 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\32\Release\* dist\runtime\32 14 | 15 | mkdir dist\runtime\64 16 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\64\Resources\* dist\runtime\64 17 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\64\Release\* dist\runtime\64 18 | 19 | mkdir dist\with_runtime\32 20 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\32\Resources\* dist\with_runtime\32 21 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\32\Release\* dist\with_runtime\32 22 | xcopy /hrkys /exclude:exclude_files_2.txt bin\32\Release\mod_loader*.* dist\with_runtime\mod_loader_32.* 23 | xcopy /hrkys /exclude:exclude_files_2.txt bin\32\Release\CefOverlay.* dist\with_runtime\32\overlay_mod.* 24 | xcopy /hrkys external\reshade\bin\Win32\Release\ReShade32.dll dist\with_runtime\d3d9.* 25 | 26 | mkdir dist\with_runtime\64 27 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\64\Resources\* dist\with_runtime\64 28 | xcopy /hrkys /exclude:exclude_files_2.txt prebuilt\cef\64\Release\* dist\with_runtime\64 29 | xcopy /hrkys /exclude:exclude_files_2.txt bin\64\Release\mod_loader*.* dist\with_runtime\mod_loader_64.* 30 | xcopy /hrkys /exclude:exclude_files_2.txt bin\64\Release\CefOverlay.* dist\with_runtime\64\overlay_mod.* 31 | xcopy /hrkys external\reshade\bin\x64\Release\ReShade64.dll dist\with_runtime\dxgi.* 32 | -------------------------------------------------------------------------------- /exclude_files.txt: -------------------------------------------------------------------------------- 1 | .git\ 2 | .gitignore\ 3 | .gitmodules\ 4 | .gif\ 5 | api-ms-win 6 | -------------------------------------------------------------------------------- /exclude_files_2.txt: -------------------------------------------------------------------------------- 1 | .ilk 2 | .pdb 3 | .exp 4 | .lib 5 | .exe 6 | -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(BUILD_SHARED_LIBS OFF CACHE STRING "" FORCE) 2 | SET(BUILD_STATIC_LIBS ON CACHE STRING "" FORCE) 3 | 4 | include_directories( 5 | ${CMAKE_BUILD_DIR}/external/zlib 6 | zlib 7 | ) 8 | 9 | ADD_SUBDIRECTORY(zlib) 10 | ADD_SUBDIRECTORY(boost) 11 | 12 | # for /MT /MD setting.... 13 | # global setting is not working. 14 | # TODO : check. 15 | # ADD_SUBDIRECTORY(jsoncpp) 16 | include_directories( 17 | jsoncpp/include 18 | ) 19 | 20 | ADD_LIBRARY(jsoncpp_lib_static STATIC 21 | jsoncpp/src/lib_json/json_tool.h 22 | jsoncpp/src/lib_json/json_reader.cpp 23 | jsoncpp/src/lib_json/json_valueiterator.inl 24 | jsoncpp/src/lib_json/json_value.cpp 25 | jsoncpp/src/lib_json/json_writer.cpp 26 | ) 27 | 28 | set_target_properties (zlib PROPERTIES FOLDER external/zlib) 29 | set_target_properties (zlibstatic PROPERTIES FOLDER external/zlib) 30 | set_target_properties (example PROPERTIES FOLDER external/zlib) 31 | set_target_properties (minigzip PROPERTIES FOLDER external/zlib) 32 | set_target_properties (boost PROPERTIES FOLDER external) 33 | set_target_properties (jsoncpp_lib_static PROPERTIES FOLDER external) 34 | -------------------------------------------------------------------------------- /screenshots/darkest_dungeon_opengl32_with_google.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/d08006ca4ad926e0182ca0e69f00fa24939a6451/screenshots/darkest_dungeon_opengl32_with_google.jpg -------------------------------------------------------------------------------- /screenshots/darksouls3_dx11_with_google.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/d08006ca4ad926e0182ca0e69f00fa24939a6451/screenshots/darksouls3_dx11_with_google.jpg -------------------------------------------------------------------------------- /screenshots/ffxiv_dx11_with_act_skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/d08006ca4ad926e0182ca0e69f00fa24939a6451/screenshots/ffxiv_dx11_with_act_skin.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES( 2 | ../external/jsoncpp/include 3 | ../external/boost 4 | ../external 5 | ) 6 | 7 | ADD_SUBDIRECTORY(cef) 8 | ADD_SUBDIRECTORY(loader) 9 | 10 | -------------------------------------------------------------------------------- /src/cef/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(IMGUI_DIRECTORY ${CMAKE_HOME_DIRECTORY}/external/reshade/deps/imgui) 2 | SET(STB_DIRECTORY ${CMAKE_HOME_DIRECTORY}/external/reshade/deps/stb) 3 | SET(CEF_DIRECTORY 4 | ${CMAKE_HOME_DIRECTORY}/prebuilt/cef/${address_model}/include 5 | ${CMAKE_HOME_DIRECTORY}/prebuilt/cef/${address_model} 6 | ) 7 | 8 | INCLUDE_DIRECTORIES( 9 | ${IMGUI_DIRECTORY} 10 | ${STB_DIRECTORY} 11 | ${CEF_DIRECTORY} 12 | ) 13 | 14 | 15 | IF(USE_SSL) 16 | ADD_DEFINITIONS( 17 | -DUSE_SSL 18 | ) 19 | ENDIF(USE_SSL) 20 | 21 | ADD_LIBRARY(CefOverlay 22 | SHARED 23 | ${IMGUI_DIRECTORY}/imconfig.h 24 | ${IMGUI_DIRECTORY}/imgui.cpp 25 | ${IMGUI_DIRECTORY}/imgui.h 26 | ${IMGUI_DIRECTORY}/imgui_draw.cpp 27 | ${IMGUI_DIRECTORY}/imgui_internal.h 28 | ${IMGUI_DIRECTORY}/stb_rect_pack.h 29 | ${IMGUI_DIRECTORY}/stb_textedit.h 30 | ${IMGUI_DIRECTORY}/stb_truetype.h 31 | overlay.cpp 32 | ../overlay.def 33 | Resource.rc 34 | resource.h 35 | version.h 36 | ) 37 | 38 | TARGET_LINK_LIBRARIES(CefOverlay 39 | jsoncpp_lib_static 40 | boost 41 | libcef 42 | libcef_dll_wrapper 43 | ) 44 | 45 | ADD_EXECUTABLE(CefOverlayProc 46 | WIN32 47 | ${IMGUI_DIRECTORY}/imconfig.h 48 | ${IMGUI_DIRECTORY}/imgui.cpp 49 | ${IMGUI_DIRECTORY}/imgui.h 50 | ${IMGUI_DIRECTORY}/imgui_draw.cpp 51 | ${IMGUI_DIRECTORY}/imgui_internal.h 52 | ${IMGUI_DIRECTORY}/stb_rect_pack.h 53 | ${IMGUI_DIRECTORY}/stb_textedit.h 54 | ${IMGUI_DIRECTORY}/stb_truetype.h 55 | overlay_proc.cpp 56 | Resource.rc 57 | resource.h 58 | version.h 59 | ) 60 | 61 | TARGET_LINK_LIBRARIES(CefOverlayProc 62 | jsoncpp_lib_static 63 | boost 64 | libcef 65 | libcef_dll_wrapper 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /src/cef/Resource.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 | 17 | #if !defined(AFX_RESOURCE_DLL) 18 | LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 19 | 20 | #ifdef APSTUDIO_INVOKED 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // TEXTINCLUDE 24 | // 25 | 26 | 1 TEXTINCLUDE 27 | BEGIN 28 | "resource.h\0" 29 | END 30 | 31 | 2 TEXTINCLUDE 32 | BEGIN 33 | "#include ""winres.h""\r\n" 34 | "\0" 35 | END 36 | 37 | 3 TEXTINCLUDE 38 | BEGIN 39 | "\r\n" 40 | "\0" 41 | END 42 | 43 | #endif // APSTUDIO_INVOKED 44 | 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // 48 | // Icon 49 | // 50 | 51 | // Icon with lowest ID value placed first to ensure application icon 52 | // remains consistent on all systems. 53 | 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Version 58 | // 59 | 60 | VS_VERSION_INFO VERSIONINFO 61 | FILEVERSION 0,0,1,1 62 | PRODUCTVERSION 0,0,1,1 63 | FILEFLAGSMASK 0x3fL 64 | #ifdef _DEBUG 65 | FILEFLAGS 0x1L 66 | #else 67 | FILEFLAGS 0x0L 68 | #endif 69 | FILEOS 0x40004L 70 | FILETYPE 0x1L 71 | FILESUBTYPE 0x0L 72 | BEGIN 73 | BLOCK "StringFileInfo" 74 | BEGIN 75 | BLOCK "040004b0" 76 | BEGIN 77 | VALUE "CompanyName", "ZCube.Kr" 78 | VALUE "FileDescription", "ACTWebSocket Overlay" 79 | VALUE "FileVersion", "0,0,1,1" 80 | VALUE "InternalName", "ACTWebSocket Overlay" 81 | VALUE "LegalCopyright", "Copyright (C) 2017" 82 | VALUE "OriginalFilename", "ACTWebSocketOverlay.dll" 83 | VALUE "ProductName", "OverlayProc" 84 | VALUE "ProductVersion", "0.0.1.1-ge36ab15" 85 | END 86 | END 87 | BLOCK "VarFileInfo" 88 | BEGIN 89 | VALUE "Translation", 0x400, 1200 90 | END 91 | END 92 | 93 | #endif // Korean (Korea) resources 94 | ///////////////////////////////////////////////////////////////////////////// 95 | 96 | 97 | 98 | #ifndef APSTUDIO_INVOKED 99 | ///////////////////////////////////////////////////////////////////////////// 100 | // 101 | // Generated from the TEXTINCLUDE 3 resource. 102 | // 103 | 104 | 105 | ///////////////////////////////////////////////////////////////////////////// 106 | #endif // not APSTUDIO_INVOKED 107 | 108 | -------------------------------------------------------------------------------- /src/cef/Resource.rc.in: -------------------------------------------------------------------------------- 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 | 17 | #if !defined(AFX_RESOURCE_DLL) 18 | LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 19 | 20 | #ifdef APSTUDIO_INVOKED 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // TEXTINCLUDE 24 | // 25 | 26 | 1 TEXTINCLUDE 27 | BEGIN 28 | "resource.h\0" 29 | END 30 | 31 | 2 TEXTINCLUDE 32 | BEGIN 33 | "#include ""winres.h""\r\n" 34 | "\0" 35 | END 36 | 37 | 3 TEXTINCLUDE 38 | BEGIN 39 | "\r\n" 40 | "\0" 41 | END 42 | 43 | #endif // APSTUDIO_INVOKED 44 | 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // 48 | // Icon 49 | // 50 | 51 | // Icon with lowest ID value placed first to ensure application icon 52 | // remains consistent on all systems. 53 | 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Version 58 | // 59 | 60 | VS_VERSION_INFO VERSIONINFO 61 | FILEVERSION @VERSION_SHORT_WITH_COMMA@ 62 | PRODUCTVERSION @VERSION_SHORT_WITH_COMMA@ 63 | FILEFLAGSMASK 0x3fL 64 | #ifdef _DEBUG 65 | FILEFLAGS 0x1L 66 | #else 67 | FILEFLAGS 0x0L 68 | #endif 69 | FILEOS 0x40004L 70 | FILETYPE 0x1L 71 | FILESUBTYPE 0x0L 72 | BEGIN 73 | BLOCK "StringFileInfo" 74 | BEGIN 75 | BLOCK "040004b0" 76 | BEGIN 77 | VALUE "CompanyName", "ZCube.Kr" 78 | VALUE "FileDescription", "ACTWebSocket Overlay" 79 | VALUE "FileVersion", "@VERSION_SHORT_WITH_COMMA@" 80 | VALUE "InternalName", "ACTWebSocket Overlay" 81 | VALUE "LegalCopyright", "Copyright (C) 2017" 82 | VALUE "OriginalFilename", "ACTWebSocketOverlay.dll" 83 | VALUE "ProductName", "OverlayProc" 84 | VALUE "ProductVersion", "@VERSION_LONG@" 85 | END 86 | END 87 | BLOCK "VarFileInfo" 88 | BEGIN 89 | VALUE "Translation", 0x400, 1200 90 | END 91 | END 92 | 93 | #endif // Korean (Korea) resources 94 | ///////////////////////////////////////////////////////////////////////////// 95 | 96 | 97 | 98 | #ifndef APSTUDIO_INVOKED 99 | ///////////////////////////////////////////////////////////////////////////// 100 | // 101 | // Generated from the TEXTINCLUDE 3 resource. 102 | // 103 | 104 | 105 | ///////////////////////////////////////////////////////////////////////////// 106 | #endif // not APSTUDIO_INVOKED 107 | 108 | -------------------------------------------------------------------------------- /src/cef/overlay.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include "version.h" 42 | #include 43 | #include "imgui_internal.h" 44 | #define STB_IMAGE_IMPLEMENTATION 45 | #include 46 | 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | 67 | #include 68 | #define STR2UTF8(s) (CW2A(CA2W(s), CP_UTF8)) 69 | 70 | static std::recursive_mutex mutex; 71 | static bool initialized = false; 72 | 73 | static void* overlay_texture = nullptr; 74 | 75 | static HMODULE modul = nullptr; 76 | boost::uuids::uuid tag = boost::uuids::random_generator()(); 77 | 78 | // custom scheme has problem with websocket connection. 79 | //class ClientSchemeHandler : public CefResourceHandler { 80 | //public: 81 | // boost::filesystem::path dir; 82 | // ClientSchemeHandler() : offset_(0) { 83 | // WCHAR modulepath[MAX_PATH] = {}; 84 | // GetModuleFileNameW(NULL, modulepath, MAX_PATH); 85 | // dir = modulepath; 86 | // dir = dir.parent_path(); 87 | // } 88 | // 89 | // bool ProcessRequest(CefRefPtr request, 90 | // CefRefPtr callback) OVERRIDE { 91 | // CEF_REQUIRE_IO_THREAD(); 92 | // 93 | // bool handled = false; 94 | // 95 | // std::string url = request->GetURL(); 96 | // CefURLParts parts; 97 | // CefParseURL(url, parts); 98 | // std::wstring path = CefString(&parts.path); 99 | // if(!path.empty()) path = path.substr(1); 100 | // boost::filesystem::path m; 101 | // m = dir / boost::filesystem::path(path); 102 | // boost::filesystem::path& p = boost::filesystem::relative(m, dir); 103 | // if (boost::algorithm::starts_with(p.string(), "..")) 104 | // { 105 | // // invalid path 106 | // handled = false; 107 | // } 108 | // else 109 | // { 110 | // std::string extension = m.extension().string(); 111 | // if (boost::filesystem::exists(m)) 112 | // { 113 | // std::ifstream t(m.wstring(), std::ios::binary); 114 | // data_.assign((std::istreambuf_iterator(t)), 115 | // std::istreambuf_iterator()); 116 | // handled = true; 117 | // if (!extension.empty()) extension = extension.substr(1); 118 | // mime_type_ = CefGetMimeType(extension); 119 | // if (mime_type_.empty()) 120 | // { 121 | // mime_type_ = "text/html"; 122 | // } 123 | // } 124 | // } 125 | // 126 | // if (handled) { 127 | // // Indicate that the headers are available. 128 | // callback->Continue(); 129 | // return true; 130 | // } 131 | // 132 | // return false; 133 | // } 134 | // 135 | // void GetResponseHeaders(CefRefPtr response, 136 | // int64& response_length, 137 | // CefString& redirectUrl) OVERRIDE { 138 | // CEF_REQUIRE_IO_THREAD(); 139 | // 140 | // DCHECK(!data_.empty()); 141 | // 142 | // response->SetMimeType(mime_type_); 143 | // response->SetStatus(200); 144 | // 145 | // // Set the resulting response length. 146 | // response_length = data_.length(); 147 | // } 148 | // 149 | // void Cancel() OVERRIDE { CEF_REQUIRE_IO_THREAD(); } 150 | // 151 | // bool ReadResponse(void* data_out, 152 | // int bytes_to_read, 153 | // int& bytes_read, 154 | // CefRefPtr callback) OVERRIDE { 155 | // CEF_REQUIRE_IO_THREAD(); 156 | // 157 | // bool has_data = false; 158 | // bytes_read = 0; 159 | // 160 | // if (offset_ < data_.length()) { 161 | // // Copy the next block of data into the buffer. 162 | // int transfer_size = 163 | // std::min(bytes_to_read, static_cast(data_.length() - offset_)); 164 | // memcpy(data_out, data_.c_str() + offset_, transfer_size); 165 | // offset_ += transfer_size; 166 | // 167 | // bytes_read = transfer_size; 168 | // has_data = true; 169 | // } 170 | // 171 | // return has_data; 172 | // } 173 | // 174 | //private: 175 | // std::string data_; 176 | // std::string mime_type_; 177 | // size_t offset_; 178 | // 179 | // IMPLEMENT_REFCOUNTING(ClientSchemeHandler); 180 | // DISALLOW_COPY_AND_ASSIGN(ClientSchemeHandler); 181 | //}; 182 | // 183 | //// Implementation of the factory for creating scheme handlers. 184 | //class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory { 185 | //public: 186 | // ClientSchemeHandlerFactory() {} 187 | // 188 | // // Return a new scheme handler instance to handle the request. 189 | // CefRefPtr Create(CefRefPtr browser, 190 | // CefRefPtr frame, 191 | // const CefString& scheme_name, 192 | // CefRefPtr request) OVERRIDE { 193 | // CEF_REQUIRE_IO_THREAD(); 194 | // return new ClientSchemeHandler(); 195 | // } 196 | // 197 | //private: 198 | // IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory); 199 | // DISALLOW_COPY_AND_ASSIGN(ClientSchemeHandlerFactory); 200 | //}; 201 | // 202 | //void RegisterSchemeHandlerFactory() { 203 | // CefRegisterSchemeHandlerFactory("resource", "", new ClientSchemeHandlerFactory()); 204 | //} 205 | 206 | class MyApp : public CefApp 207 | { 208 | public: 209 | IMPLEMENT_REFCOUNTING(MyApp); 210 | 211 | class ProcessHandler : public CefRenderProcessHandler 212 | { 213 | public: 214 | IMPLEMENT_REFCOUNTING(ProcessHandler); 215 | public: 216 | virtual bool OnProcessMessageReceived(CefRefPtr browser, 217 | CefProcessId source_process, 218 | CefRefPtr message) { 219 | return false; 220 | } 221 | }; 222 | virtual CefRefPtr GetRenderProcessHandler() { 223 | return CefRefPtr(new ProcessHandler()); 224 | } 225 | virtual void OnBeforeCommandLineProcessing( 226 | const CefString& process_type, 227 | CefRefPtr command_line) { 228 | std::vector args; 229 | command_line->GetArguments(args); 230 | if (args.size() == 0) 231 | { 232 | command_line->AppendArgument("dummy"); 233 | } 234 | for (auto a : args) 235 | { 236 | std::cout << a.ToString().c_str() << std::endl; 237 | } 238 | //--disable-gpu --disable-gpu-compositing --enable-begin-frame-scheduling 239 | command_line->AppendArgument("--disable-gpu"); 240 | command_line->AppendArgument("--disable-gpu-compositing"); 241 | command_line->AppendArgument("--enable-begin-frame-scheduling"); 242 | command_line->AppendSwitch("--disable-gpu"); 243 | command_line->AppendSwitch("--disable-gpu-compositing"); 244 | command_line->AppendSwitch("--enable-begin-frame-scheduling"); 245 | { 246 | std::vector args; 247 | command_line->GetArguments(args); 248 | for (auto a : args) 249 | { 250 | std::cout << a.ToString().c_str() << std::endl; 251 | } 252 | } 253 | } 254 | }; 255 | 256 | class CefThread 257 | { 258 | public: 259 | std::recursive_mutex mutex; 260 | std::shared_ptr thread; 261 | class Texture 262 | { 263 | public: 264 | std::vector data; 265 | int width; 266 | int height; 267 | int stride; 268 | int channels = 4; 269 | }; 270 | 271 | 272 | 273 | 274 | class RenderHandler : public CefRenderHandler 275 | { 276 | public: 277 | std::recursive_mutex mutex; 278 | std::shared_ptr texture; 279 | int screen_width = -1; 280 | int screen_height = -1; 281 | RenderHandler() 282 | { 283 | texture.reset(new Texture()); 284 | texture->width = 1024; 285 | texture->height = 1024; 286 | if (texture->data.size() < texture->width * texture->height * 4) 287 | { 288 | texture->data.resize(texture->width * texture->height * 4); 289 | } 290 | texture->stride = texture->width * 4; 291 | Resize(1024, 1024); 292 | } 293 | 294 | 295 | void Resize(int width, int height) 296 | { 297 | screen_width = std::min(width, 1024); 298 | screen_height = std::min(height, 1024);; 299 | } 300 | ~RenderHandler() 301 | { 302 | } 303 | 304 | public: 305 | std::vector rects; 306 | virtual bool GetViewRect(CefRefPtr browser, CefRect &rect) 307 | { 308 | std::lock_guard s(mutex); 309 | rect.Set(0, 0, screen_width, screen_height); 310 | return true; 311 | } 312 | virtual bool GetRootScreenRect(CefRefPtr browser, CefRect &rect) 313 | { 314 | std::lock_guard s(mutex); 315 | rect.Set(0, 0, screen_width, screen_height); 316 | return true; 317 | } 318 | virtual void OnPaint(CefRefPtr browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height) 319 | { 320 | auto view = CefBrowserView::GetForBrowser(browser); 321 | if (view) 322 | { 323 | view->SetSize(CefSize(screen_width, screen_height)); 324 | } 325 | std::lock_guard s(mutex); 326 | if (texture) 327 | { 328 | { 329 | for (int i = 0; i < dirtyRects.size(); ++i) { 330 | auto& r = dirtyRects.at(i); 331 | RECT r_ = RECT{ r.x, r.y,r.x + r.width - 1, r.y + r.height - 1 }; 332 | bool exists = false; 333 | for (int j = 0; j < rects.size(); ++j) 334 | { 335 | auto& r2 = rects[j]; 336 | if (r2.left == r_.left && 337 | r2.right == r_.right && 338 | r2.top == r_.top && 339 | r2.bottom == r_.bottom) 340 | { 341 | exists = true; 342 | } 343 | } 344 | if (!exists) 345 | { 346 | rects.push_back(r_); 347 | } 348 | } 349 | } 350 | //{ 351 | // rects.clear(); 352 | // rects.push_back(RECT{ 0,0,screen_width - 1,screen_height - 1 }); 353 | //} 354 | for (int i = 0; i < dirtyRects.size(); ++i) { 355 | int bx = dirtyRects.at(i).x; 356 | int by = dirtyRects.at(i).y; 357 | bx = std::max(std::min(bx, std::min(screen_width, width) - 1), 0); 358 | by = std::max(std::min(by, std::min(screen_height, height) - 1), 0); 359 | int ex = std::min(bx + dirtyRects.at(i).width , std::min(screen_width, width)-1); 360 | int ey = std::min(by + dirtyRects.at(i).height, std::min(screen_height, height)-1); 361 | 362 | for (int y = by; y <= ey; ++y) { 363 | LPBYTE data = ((LPBYTE)texture->data.data() + (bx * 4) + texture->stride * y); 364 | LPBYTE p = (LPBYTE)buffer + (width * 4) * y + (bx * 4); 365 | memcpy(data, p, 4 * (ex - bx + 1)); 366 | //memset(data, rand() % 255, 4 * (ex - bx)); 367 | } 368 | } 369 | //memset(texture->data.data(), rand() % 255, screen_width * 4 * screen_height); 370 | } 371 | } 372 | // CefBase interface 373 | public: 374 | IMPLEMENT_REFCOUNTING(RenderHandler); 375 | 376 | }; 377 | 378 | class BrowserClient : public CefClient 379 | { 380 | public: 381 | BrowserClient(RenderHandler *renderHandler) 382 | : m_renderHandler(renderHandler) 383 | { 384 | ; 385 | } 386 | 387 | bool OnProcessMessageReceived( 388 | CefRefPtr browser, 389 | CefProcessId source_process, 390 | CefRefPtr message) { 391 | const std::string& message_name = message->GetName(); 392 | if (message_name == "my_message") { 393 | return true; 394 | } 395 | return false; 396 | } 397 | virtual CefRefPtr GetRenderHandler() { 398 | return m_renderHandler; 399 | } 400 | 401 | CefRefPtr m_renderHandler; 402 | 403 | IMPLEMENT_REFCOUNTING(BrowserClient); 404 | }; 405 | 406 | CefRefPtr browser; 407 | CefRefPtr browserClient = nullptr; 408 | CefRefPtr renderHandler = nullptr; 409 | CefBrowserSettings browserSettings; 410 | CefRefPtr runner; 411 | 412 | bool initialized = false; 413 | void Init() 414 | { 415 | std::lock_guard s(mutex); 416 | if (initialized) 417 | return; 418 | initialized = true; 419 | thread.reset(new std::thread([this]() { 420 | { 421 | std::lock_guard s(mutex); 422 | CefMainArgs args(modul); 423 | CefSettings settings; 424 | WCHAR modulepath[MAX_PATH] = {}; 425 | GetModuleFileNameW(NULL, modulepath, MAX_PATH); 426 | boost::filesystem::path m = modulepath; 427 | 428 | CefRefPtr app(new MyApp); 429 | //runner = CefTaskRunner::GetForCurrentThread(); 430 | 431 | boost::filesystem::path json_path = m.parent_path() / "cefoverlay.json"; 432 | Json::Reader r; 433 | Json::Value setting; 434 | 435 | std::string url = "http://google.com/"; 436 | { 437 | std::ifstream fin(json_path.wstring().c_str()); 438 | if (fin.is_open()) 439 | { 440 | Json::Reader r; 441 | if (r.parse(fin, setting)) 442 | { 443 | if (setting["URL"].isString()) 444 | { 445 | url = setting["URL"].asString(); 446 | } 447 | } 448 | } 449 | } 450 | 451 | setting["URL"] = url; 452 | 453 | //if (boost::filesystem::exists(json_path)) 454 | { 455 | std::ofstream fout(json_path.wstring().c_str()); 456 | if (fout.is_open()) 457 | { 458 | Json::StyledWriter w; 459 | fout << w.write(setting); 460 | fout.close(); 461 | } 462 | } 463 | bool b = boost::filesystem::exists(m.parent_path() / "CefOverlayProc.exe"); 464 | CefString(&settings.browser_subprocess_path).FromWString((m.parent_path() / "CefOverlayProc.exe").wstring()); 465 | CefString(&settings.cache_path).FromWString((m.parent_path() / "LocalCache").wstring()); 466 | 467 | 468 | settings.single_process = true; 469 | settings.remote_debugging_port = 9998; 470 | settings.external_message_pump = true; 471 | settings.no_sandbox = true; 472 | settings.windowless_rendering_enabled = true; 473 | int result = CefInitialize(args, settings, app.get(), nullptr); 474 | //RegisterSchemeHandlerFactory(); 475 | if (browser == nullptr) 476 | { 477 | renderHandler = new RenderHandler(); 478 | CefWindowInfo window_info; 479 | std::size_t windowHandle = 0; 480 | window_info.SetAsWindowless(NULL); 481 | browserClient = new BrowserClient(renderHandler); 482 | browserSettings.windowless_frame_rate = 30.0f; 483 | browserSettings.javascript_open_windows = cef_state_t::STATE_DISABLED; 484 | browserSettings.javascript_close_windows = cef_state_t::STATE_DISABLED; 485 | browserSettings.web_security = cef_state_t::STATE_DISABLED; 486 | //browser = CefBrowserHost::CreateBrowserSync(window_info, browserClient, "https://haeruhaeru.github.io/mopimopi/index.html?HOST_PORT=ws://localhost:10501/", browserSettings, nullptr); 487 | //browser = CefBrowserHost::CreateBrowserSync(window_info, browserClient, "http://127.0.0.1:10501/OverlaySkin/OverlayPlugin-themes-master/miniparseGlowIcon.html", browserSettings, nullptr); 488 | browser = CefBrowserHost::CreateBrowserSync(window_info, browserClient, url, browserSettings, nullptr); 489 | //browser->Cr 490 | if(browser->GetMainFrame()) 491 | browser->GetMainFrame()->ExecuteJavaScript((std::wstring(L"var overlayWindowId= \"") + boost::uuids::to_wstring(tag) + L"\";").c_str(), L"", 0); 492 | } 493 | } 494 | //while (initialized) 495 | { 496 | CefRunMessageLoop(); 497 | //CefDoMessageLoopWork(); 498 | //Sleep(1000 / browserSettings.windowless_frame_rate); 499 | } 500 | { 501 | std::lock_guard s(mutex); 502 | //if(browser) 503 | // browser->Release(); 504 | //if (browserClient) 505 | // browserClient->Release(); 506 | //if(renderHandler) 507 | // renderHandler->Release(); 508 | browser->GetHost()->CloseBrowser(true); 509 | } 510 | })); 511 | } 512 | 513 | virtual ~CefThread() 514 | { 515 | } 516 | 517 | void Update(int width, int height) 518 | { 519 | std::lock_guard s(mutex); 520 | if (browser && browserClient && renderHandler) 521 | { 522 | //auto handle = browser->GetHost()->WasResized(); 523 | if (width != renderHandler->screen_width || 524 | height != renderHandler->screen_height) 525 | { 526 | renderHandler->Resize(width, height); 527 | browser->GetHost()->WasResized(); 528 | } 529 | } 530 | } 531 | 532 | void Uninit() 533 | { 534 | std::lock_guard s(mutex); 535 | if (!initialized) 536 | return; 537 | //initialized = false; 538 | } 539 | 540 | }; 541 | 542 | std::shared_ptr cefthread; 543 | std::unordered_map > threads; 544 | extern "C" int ModInit(ImGuiContext* context) 545 | { 546 | boost::unique_lock l(mutex); 547 | try { 548 | ImGui::SetCurrentContext(context); 549 | if (threads.empty()) //!threads[context]) 550 | { 551 | threads[context].reset(new CefThread); 552 | 553 | auto& cefthread = threads[context]; 554 | ::cefthread = cefthread; 555 | cefthread->Init(); 556 | } 557 | //Sleep(1000); 558 | //auto procMessage = CefProcessMessage::Create("createFrame"); 559 | //auto argumentList = procMessage->GetArgumentList(); 560 | ////cefthread->browser->GetIdentifier() 561 | ////argumentList->SetSize(2); 562 | ////argumentList->SetString(0, frameName.c_str()); 563 | ////argumentList->SetString(1, frameURL.c_str()); 564 | //cefthread->browser->SendProcessMessage(PID_RENDERER, procMessage); 565 | } 566 | catch (std::exception& e) 567 | { 568 | std::cerr << e.what() << std::endl; 569 | } 570 | return 0; 571 | } 572 | 573 | extern "C" int ModUnInit(ImGuiContext* context) 574 | { 575 | boost::unique_lock l(mutex); 576 | ImGui::SetCurrentContext(context); 577 | { 578 | //if (threads[context]) 579 | //{ 580 | // auto& cefthread = threads[context]; 581 | // std::cerr << cefthread->thread->joinable() << std::endl; 582 | // boost::unique_lock l(mutex); 583 | // if (cefthread && cefthread->browser && cefthread->browser->GetHost()) 584 | // { 585 | // cefthread->initialized = false; 586 | // if (cefthread->thread) 587 | // { 588 | // bool gotit = false; 589 | 590 | // CefPostTask(TID_UI, base::Bind(&CefQuitMessageLoop)); 591 | // std::cerr << cefthread->thread->joinable() << std::endl; 592 | // cefthread->thread->join(); 593 | // cefthread->thread.reset(); 594 | // } 595 | // //cefthread->browser; 596 | // //cefthread->browserClient; 597 | // //cefthread->renderHandler; 598 | // } 599 | // //CefPostTask(TID_UI, base::Bind(&CefShutdown)); 600 | // cefthread.reset(); 601 | // ::cefthread.reset(); 602 | // //CefPostTask(TID_UI, base::Bind(&CefShutdown)); 603 | //} 604 | //CefShutdown(); 605 | } 606 | 607 | return 0; 608 | } 609 | 610 | extern "C" void ModTextureData(int index, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) 611 | { 612 | boost::unique_lock l(mutex); 613 | assert(out_pixels != nullptr && out_width != nullptr && out_height != nullptr); 614 | //return; 615 | //if (threads[context]) 616 | { 617 | //auto& cefthread = threads[context]; 618 | if (cefthread && cefthread->renderHandler && cefthread->renderHandler->texture) 619 | { 620 | boost::unique_lock l2(cefthread->renderHandler->mutex); 621 | auto& tex = cefthread->renderHandler->texture; 622 | *out_pixels = tex->data.data(); 623 | *out_width = tex->width; 624 | *out_height = tex->height; 625 | if (out_bytes_per_pixel) 626 | *out_bytes_per_pixel = 4; 627 | } 628 | else 629 | { 630 | *out_pixels = nullptr; 631 | *out_width = 0; 632 | *out_height = 0; 633 | if (out_bytes_per_pixel) 634 | *out_bytes_per_pixel = 4; 635 | } 636 | } 637 | } 638 | 639 | extern "C" void ModSetTexture(int index, void* texture) 640 | { 641 | boost::unique_lock l(mutex); 642 | 643 | overlay_texture = texture; 644 | if (texture == nullptr) 645 | { 646 | } 647 | } 648 | 649 | extern "C" bool ModGetTextureDirtyRect(int index, int dindex, RECT* rect) 650 | { 651 | boost::unique_lock l(mutex); 652 | if (index != 0) 653 | return false; 654 | if (!(cefthread && cefthread->renderHandler)) 655 | return false; 656 | { 657 | boost::unique_lock l2(cefthread->renderHandler->mutex); 658 | if (dindex == -1) 659 | { 660 | if (cefthread->renderHandler->rects.size() && rect) 661 | { 662 | rect->left = 0; 663 | rect->top = 0; 664 | rect->right = cefthread->renderHandler->screen_width - 1; 665 | rect->bottom = cefthread->renderHandler->screen_height - 1; 666 | } 667 | return true; 668 | } 669 | if (cefthread->renderHandler->rects.size() <= dindex) 670 | return false; 671 | 672 | if (rect) 673 | *rect = cefthread->renderHandler->rects[dindex]; 674 | } 675 | return true; 676 | } 677 | 678 | extern "C" int ModTextureBegin() 679 | { 680 | mutex.lock(); 681 | //boost::unique_lock l(mutex); 682 | //std::copy(cefthread->renderHandler->rects.begin(), cefthread->renderHandler->rects.end(), std::back_inserter(cefthread->renderHandler->rects_copy)); 683 | return 1; // texture Size and lock 684 | } 685 | 686 | extern "C" void ModTextureEnd() 687 | { 688 | //boost::unique_lock l(mutex); 689 | if (cefthread && cefthread->renderHandler) 690 | { 691 | boost::unique_lock l2(cefthread->renderHandler->mutex); 692 | cefthread->renderHandler->rects.clear(); 693 | } 694 | mutex.unlock(); 695 | } 696 | 697 | int mouse_modifiers = 0; 698 | 699 | extern "C" int ModRender(ImGuiContext* context) 700 | { 701 | boost::unique_lock l(mutex); 702 | try { 703 | bool move_key_pressed = GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_MENU); 704 | //bool use_input = movable || show_preferences || move_key_pressed; 705 | bool use_input = move_key_pressed; 706 | 707 | ImGui::SetCurrentContext(context); 708 | static ImGuiContext* c = context; 709 | ImGui::Begin("Test", nullptr, ImVec2(300,300),0.0f, ImGuiWindowFlags_NoTitleBar | (use_input ? NULL : ImGuiWindowFlags_NoInputs)); 710 | ImVec2 size = ImGui::GetWindowSize(); 711 | bool resize = false; 712 | if (size.x > 1024) 713 | { 714 | resize = true; 715 | size.x = 1024; 716 | } 717 | if (size.y > 1024) 718 | { 719 | resize = true; 720 | size.y = 1024; 721 | } 722 | if (resize) 723 | { 724 | ImGui::SetWindowSize(size, ImGuiSetCond_Always); 725 | } 726 | cefthread->Update(size.x, size.y); 727 | 728 | auto& io = ImGui::GetIO(); 729 | int modifiers = 0; 730 | if (io.KeyShift) 731 | modifiers |= EVENTFLAG_SHIFT_DOWN; 732 | if (io.KeyCtrl) 733 | modifiers |= EVENTFLAG_CONTROL_DOWN; 734 | if (io.KeyAlt) 735 | modifiers |= EVENTFLAG_ALT_DOWN; 736 | if (io.MouseDown[0]) 737 | modifiers |= EVENTFLAG_LEFT_MOUSE_BUTTON; 738 | if (io.MouseDown[1]) 739 | modifiers |= EVENTFLAG_RIGHT_MOUSE_BUTTON; 740 | if (io.MouseDown[2]) 741 | modifiers |= EVENTFLAG_MIDDLE_MOUSE_BUTTON; 742 | 743 | if (use_input) 744 | { 745 | ImVec2 pos = ImGui::GetWindowPos(); 746 | CefMouseEvent me; 747 | me.modifiers = modifiers; 748 | me.x = io.MousePos.x - pos.x; 749 | me.y = io.MousePos.y - pos.y; 750 | // scroll disable 751 | ImGui::SetScrollY(0); 752 | ImGui::SetScrollX(0); 753 | 754 | if (cefthread && cefthread->browser && cefthread->browser->GetHost()) 755 | { 756 | auto host = cefthread->browser->GetHost(); 757 | host->SendMouseWheelEvent(me, 0, io.MouseWheel * 20); 758 | 759 | host->SendMouseMoveEvent(me, !ImGui::IsItemHovered()); 760 | if (ImGui::IsItemHovered()) 761 | { 762 | if (!(mouse_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) && (modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)) 763 | { 764 | host->SendMouseClickEvent(me, MBT_LEFT, false, 1); 765 | } 766 | if (!(mouse_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) && (modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)) 767 | { 768 | host->SendMouseClickEvent(me, MBT_RIGHT, false, 1); 769 | } 770 | if (!(mouse_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) && (modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)) 771 | { 772 | host->SendMouseClickEvent(me, MBT_MIDDLE, false, 1); 773 | } 774 | 775 | if (mouse_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON && !(modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)) 776 | { 777 | host->SendMouseClickEvent(me, MBT_LEFT, true, 1); 778 | } 779 | if (mouse_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON && !(modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)) 780 | { 781 | host->SendMouseClickEvent(me, MBT_RIGHT, true, 1); 782 | } 783 | if (mouse_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON && !(modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)) 784 | { 785 | host->SendMouseClickEvent(me, MBT_MIDDLE, true, 1); 786 | } 787 | } 788 | } 789 | } 790 | mouse_modifiers = modifiers; 791 | //cefthread->browser->GetHost()->SendMouseClickEvent(me, !ImGui::IsItemHovered()); 792 | //cefthread->browser->GetHost()->SendMouseClickEvent(CefMouseEvent{ io.MousePos.x, io.MousePos.y, }) 793 | //cefthread->browser->GetHost()->SendMouseClickEvent(); 794 | //cefthread->browser->GetHost()->SendMouseMoveEvent(); 795 | //ImGui::GetIO().MousePos; 796 | ImGui::GetStyle().WindowPadding = ImVec2(0, 0); 797 | ImGui::GetStyle().ScrollbarSize = 0; 798 | 799 | { 800 | auto &io = ImGui::GetIO(); 801 | if (!use_input) 802 | { 803 | io.WantCaptureMouse = false; 804 | } 805 | io.WantCaptureKeyboard = false; 806 | } 807 | if(overlay_texture) 808 | ImGui::Image(overlay_texture, size, ImVec2(0, 0), ImVec2(size.x/1024.0f, size.y/1024.0f)); 809 | ImGui::End(); 810 | } 811 | catch (std::exception& e) 812 | { 813 | std::cerr << e.what() << std::endl; 814 | } 815 | return 0; 816 | } 817 | 818 | extern "C" bool ModMenu(bool* show) 819 | { 820 | return true; 821 | } 822 | 823 | extern "C" bool ModUpdateFont(ImGuiContext* context) 824 | { 825 | return false; 826 | } 827 | 828 | void PostTaskQuit(bool* got_it) { 829 | *got_it = true; 830 | CefQuitMessageLoop(); 831 | } 832 | 833 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpReserved) 834 | { 835 | modul = hModule; 836 | switch (fdwReason) 837 | { 838 | case DLL_PROCESS_ATTACH: 839 | break; 840 | case DLL_PROCESS_DETACH: 841 | break; 842 | case DLL_THREAD_ATTACH: 843 | break; 844 | case DLL_THREAD_DETACH: 845 | break; 846 | } 847 | return TRUE; 848 | } 849 | -------------------------------------------------------------------------------- /src/cef/overlay_proc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "version.h" 25 | #include 26 | #include "imgui_internal.h" 27 | #define STB_IMAGE_IMPLEMENTATION 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include 48 | 49 | class MyApp : public CefApp 50 | { 51 | public: 52 | IMPLEMENT_REFCOUNTING(MyApp); 53 | 54 | virtual void OnBeforeCommandLineProcessing( 55 | const CefString& process_type, 56 | CefRefPtr command_line) { 57 | std::vector args; 58 | command_line->GetArguments(args); 59 | if (args.size() == 0) 60 | { 61 | command_line->AppendArgument("dummy"); 62 | } 63 | for (auto a : args) 64 | { 65 | std::cout << a.ToString().c_str() << std::endl; 66 | } 67 | //--disable-gpu --disable-gpu-compositing --enable-begin-frame-scheduling 68 | command_line->AppendArgument("--disable-gpu"); 69 | command_line->AppendArgument("--disable-gpu-compositing"); 70 | command_line->AppendArgument("--enable-begin-frame-scheduling"); 71 | command_line->AppendSwitch("--disable-gpu"); 72 | command_line->AppendSwitch("--disable-gpu-compositing"); 73 | command_line->AppendSwitch("--enable-begin-frame-scheduling"); 74 | { 75 | std::vector args; 76 | command_line->GetArguments(args); 77 | for (auto a : args) 78 | { 79 | std::cout << a.ToString().c_str() << std::endl; 80 | } 81 | } 82 | } 83 | }; 84 | 85 | int WINAPI WinMain(HINSTANCE hInstance, 86 | HINSTANCE hPrevInstance, 87 | LPSTR lpCmdLine, 88 | int nCmdShow) 89 | { 90 | // Structure for passing command-line arguments. 91 | // The definition of this structure is platform-specific. 92 | CefMainArgs main_args(hInstance); 93 | //CefMainArgs main_args(GetModuleHandle(NULL)); 94 | 95 | // Optional implementation of the CefApp interface. 96 | CefRefPtr app(new MyApp); 97 | 98 | // Execute the sub-process logic. This will block until the sub-process should exit. 99 | return CefExecuteProcess(main_args, app.get(), nullptr); 100 | } 101 | 102 | int main(int argc, char**argv) 103 | { 104 | // Structure for passing command-line arguments. 105 | // The definition of this structure is platform-specific. 106 | CefMainArgs main_args(GetModuleHandle(NULL)); 107 | 108 | // Optional implementation of the CefApp interface. 109 | CefRefPtr app(new MyApp); 110 | 111 | // Execute the sub-process logic. This will block until the sub-process should exit. 112 | return CefExecuteProcess(main_args, app.get(), nullptr); 113 | } -------------------------------------------------------------------------------- /src/cef/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/d08006ca4ad926e0182ca0e69f00fa24939a6451/src/cef/resource.h -------------------------------------------------------------------------------- /src/cef/version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #pragma once 7 | #define VERSION_SHORT_STRING "@VERSION_SHORT@" 8 | #define VERSION_LONG_STRING "@VERSION_LONG@" 9 | -------------------------------------------------------------------------------- /src/loader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(loader 2 | SHARED 3 | loader.cpp 4 | ../overlay.def 5 | Resource.rc 6 | resource.h 7 | version.h 8 | ) 9 | 10 | set_target_properties(loader PROPERTIES OUTPUT_NAME "mod_loader_${address_model}") 11 | -------------------------------------------------------------------------------- /src/loader/Resource.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 | 17 | #if !defined(AFX_RESOURCE_DLL) 18 | LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 19 | 20 | #ifdef APSTUDIO_INVOKED 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // TEXTINCLUDE 24 | // 25 | 26 | 1 TEXTINCLUDE 27 | BEGIN 28 | "resource.h\0" 29 | END 30 | 31 | 2 TEXTINCLUDE 32 | BEGIN 33 | "#include ""winres.h""\r\n" 34 | "\0" 35 | END 36 | 37 | 3 TEXTINCLUDE 38 | BEGIN 39 | "\r\n" 40 | "\0" 41 | END 42 | 43 | #endif // APSTUDIO_INVOKED 44 | 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // 48 | // Icon 49 | // 50 | 51 | // Icon with lowest ID value placed first to ensure application icon 52 | // remains consistent on all systems. 53 | 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Version 58 | // 59 | 60 | VS_VERSION_INFO VERSIONINFO 61 | FILEVERSION 0,0,1,1 62 | PRODUCTVERSION 0,0,1,1 63 | FILEFLAGSMASK 0x3fL 64 | #ifdef _DEBUG 65 | FILEFLAGS 0x1L 66 | #else 67 | FILEFLAGS 0x0L 68 | #endif 69 | FILEOS 0x40004L 70 | FILETYPE 0x1L 71 | FILESUBTYPE 0x0L 72 | BEGIN 73 | BLOCK "StringFileInfo" 74 | BEGIN 75 | BLOCK "040004b0" 76 | BEGIN 77 | VALUE "CompanyName", "ZCube.Kr" 78 | VALUE "FileDescription", "ACTWebSocket Overlay" 79 | VALUE "FileVersion", "0,0,1,1" 80 | VALUE "InternalName", "ACTWebSocket Overlay" 81 | VALUE "LegalCopyright", "Copyright (C) 2017" 82 | VALUE "OriginalFilename", "ACTWebSocketOverlay.dll" 83 | VALUE "ProductName", "OverlayProc" 84 | VALUE "ProductVersion", "0.0.1.1-ge36ab15" 85 | END 86 | END 87 | BLOCK "VarFileInfo" 88 | BEGIN 89 | VALUE "Translation", 0x400, 1200 90 | END 91 | END 92 | 93 | #endif // Korean (Korea) resources 94 | ///////////////////////////////////////////////////////////////////////////// 95 | 96 | 97 | 98 | #ifndef APSTUDIO_INVOKED 99 | ///////////////////////////////////////////////////////////////////////////// 100 | // 101 | // Generated from the TEXTINCLUDE 3 resource. 102 | // 103 | 104 | 105 | ///////////////////////////////////////////////////////////////////////////// 106 | #endif // not APSTUDIO_INVOKED 107 | 108 | -------------------------------------------------------------------------------- /src/loader/Resource.rc.in: -------------------------------------------------------------------------------- 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 | 17 | #if !defined(AFX_RESOURCE_DLL) 18 | LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 19 | 20 | #ifdef APSTUDIO_INVOKED 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // TEXTINCLUDE 24 | // 25 | 26 | 1 TEXTINCLUDE 27 | BEGIN 28 | "resource.h\0" 29 | END 30 | 31 | 2 TEXTINCLUDE 32 | BEGIN 33 | "#include ""winres.h""\r\n" 34 | "\0" 35 | END 36 | 37 | 3 TEXTINCLUDE 38 | BEGIN 39 | "\r\n" 40 | "\0" 41 | END 42 | 43 | #endif // APSTUDIO_INVOKED 44 | 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // 48 | // Icon 49 | // 50 | 51 | // Icon with lowest ID value placed first to ensure application icon 52 | // remains consistent on all systems. 53 | 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Version 58 | // 59 | 60 | VS_VERSION_INFO VERSIONINFO 61 | FILEVERSION @VERSION_SHORT_WITH_COMMA@ 62 | PRODUCTVERSION @VERSION_SHORT_WITH_COMMA@ 63 | FILEFLAGSMASK 0x3fL 64 | #ifdef _DEBUG 65 | FILEFLAGS 0x1L 66 | #else 67 | FILEFLAGS 0x0L 68 | #endif 69 | FILEOS 0x40004L 70 | FILETYPE 0x1L 71 | FILESUBTYPE 0x0L 72 | BEGIN 73 | BLOCK "StringFileInfo" 74 | BEGIN 75 | BLOCK "040004b0" 76 | BEGIN 77 | VALUE "CompanyName", "ZCube.Kr" 78 | VALUE "FileDescription", "ACTWebSocket Overlay" 79 | VALUE "FileVersion", "@VERSION_SHORT_WITH_COMMA@" 80 | VALUE "InternalName", "ACTWebSocket Overlay" 81 | VALUE "LegalCopyright", "Copyright (C) 2017" 82 | VALUE "OriginalFilename", "ACTWebSocketOverlay.dll" 83 | VALUE "ProductName", "OverlayProc" 84 | VALUE "ProductVersion", "@VERSION_LONG@" 85 | END 86 | END 87 | BLOCK "VarFileInfo" 88 | BEGIN 89 | VALUE "Translation", 0x400, 1200 90 | END 91 | END 92 | 93 | #endif // Korean (Korea) resources 94 | ///////////////////////////////////////////////////////////////////////////// 95 | 96 | 97 | 98 | #ifndef APSTUDIO_INVOKED 99 | ///////////////////////////////////////////////////////////////////////////// 100 | // 101 | // Generated from the TEXTINCLUDE 3 resource. 102 | // 103 | 104 | 105 | ///////////////////////////////////////////////////////////////////////////// 106 | #endif // not APSTUDIO_INVOKED 107 | 108 | -------------------------------------------------------------------------------- /src/loader/loader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #include "version.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | struct ImGuiContext; 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | #include 16 | typedef int(*TModUnInit)(ImGuiContext* context); 17 | typedef int(*TModRender)(ImGuiContext* context); 18 | typedef int(*TModInit)(ImGuiContext* context); 19 | typedef void(*TModTextureData)(int index, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel); 20 | typedef bool(*TModGetTextureDirtyRect)(int index, int dindex, RECT* rect); 21 | typedef void(*TModSetTexture)(int index, void* texture); 22 | typedef int(*TModTextureBegin)(); 23 | typedef void(*TModTextureEnd)(); 24 | typedef bool(*TModUpdateFont)(ImGuiContext* context); 25 | typedef bool(*TModMenu)(bool* show); 26 | 27 | TModUnInit modUnInit = nullptr; 28 | TModRender modRender = nullptr; 29 | TModInit modInit = nullptr; 30 | TModTextureData modTextureData = nullptr; 31 | TModGetTextureDirtyRect modGetTextureDirtyRect = nullptr; 32 | TModSetTexture modSetTexture = nullptr; 33 | TModTextureBegin modTextureBegin = nullptr; 34 | TModTextureEnd modTextureEnd = nullptr; 35 | TModUpdateFont modUpdateFont = nullptr; 36 | TModMenu modMenu = nullptr; 37 | HMODULE mod = nullptr; 38 | std::mutex m; 39 | ///////////////////////////////////////////////////////////////////////////////// 40 | 41 | 42 | extern "C" int ModInit(ImGuiContext* context) 43 | { 44 | m.lock(); 45 | if (!mod) 46 | { 47 | using namespace std::experimental; 48 | wchar_t result[MAX_PATH] = { 0, }; 49 | GetModuleFileNameW(NULL, result, MAX_PATH); 50 | filesystem::path m = result; 51 | m.replace_extension(""); 52 | #ifdef _WIN64 53 | filesystem::path s = m.parent_path() / L"64"; 54 | #else 55 | filesystem::path s = m.parent_path() / L"32"; 56 | #endif 57 | char* names[] = { 58 | "chrome_elf.dll", 59 | "libcef.dll", 60 | nullptr 61 | }; 62 | for (int i = 0; names[i]; ++i) 63 | { 64 | HMODULE ha = LoadLibraryW((s / names[i]).c_str()); 65 | } 66 | mod = LoadLibraryW((s / L"overlay_mod.dll").wstring().c_str()); 67 | if (mod) 68 | { 69 | modInit = (TModInit)GetProcAddress(mod, "ModInit"); 70 | modRender = (TModRender)GetProcAddress(mod, "ModRender"); 71 | modUnInit = (TModUnInit)GetProcAddress(mod, "ModUnInit"); 72 | modTextureData = (TModTextureData)GetProcAddress(mod, "ModTextureData"); 73 | modSetTexture = (TModSetTexture)GetProcAddress(mod, "ModSetTexture"); 74 | modGetTextureDirtyRect = (TModGetTextureDirtyRect)GetProcAddress(mod, "ModGetTextureDirtyRect"); 75 | modTextureBegin = (TModTextureBegin)GetProcAddress(mod, "ModTextureBegin"); 76 | modTextureEnd = (TModTextureEnd)GetProcAddress(mod, "ModTextureEnd"); 77 | modUpdateFont = (TModUpdateFont)GetProcAddress(mod, "ModUpdateFont"); 78 | modMenu = (TModMenu)GetProcAddress(mod, "ModMenu"); 79 | } 80 | } 81 | m.unlock(); 82 | if (modInit) 83 | return modInit(context); 84 | return 0; 85 | } 86 | 87 | extern "C" int ModUnInit(ImGuiContext* context) 88 | { 89 | if (modUnInit) 90 | return modUnInit(context); 91 | } 92 | 93 | 94 | extern "C" void ModTextureData(int index, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) 95 | { 96 | if (modTextureData) 97 | modTextureData(index, out_pixels, out_width, out_height, out_bytes_per_pixel); 98 | } 99 | 100 | extern "C" void ModSetTexture(int index, void* texture) 101 | { 102 | if (modSetTexture) 103 | { 104 | modSetTexture(index, texture); 105 | } 106 | } 107 | 108 | extern "C" bool ModGetTextureDirtyRect(int index, int dindex, RECT* rect) 109 | { 110 | if (modGetTextureDirtyRect) 111 | return modGetTextureDirtyRect(index, dindex, rect); 112 | return false; 113 | } 114 | 115 | extern "C" int ModTextureBegin() 116 | { 117 | if (modTextureBegin) 118 | return modTextureBegin(); 119 | return 0; 120 | } 121 | 122 | extern "C" void ModTextureEnd() 123 | { 124 | if (modTextureEnd) 125 | modTextureEnd(); 126 | } 127 | 128 | extern "C" int ModRender(ImGuiContext* context) 129 | { 130 | if (modRender) 131 | return modRender(context); 132 | return 0; 133 | } 134 | 135 | extern "C" bool ModMenu(bool* show) 136 | { 137 | if (modMenu) 138 | return modMenu(show); 139 | return false; 140 | } 141 | 142 | extern "C" bool ModUpdateFont(ImGuiContext* context) 143 | { 144 | if (modUpdateFont) 145 | return modUpdateFont(context); 146 | return false; 147 | } 148 | 149 | -------------------------------------------------------------------------------- /src/loader/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZCube/CEFOverlayEngine/d08006ca4ad926e0182ca0e69f00fa24939a6451/src/loader/resource.h -------------------------------------------------------------------------------- /src/loader/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #pragma once 7 | #define VERSION_SHORT_STRING "0.0.1.1" 8 | #define VERSION_LONG_STRING "0.0.1.1-ge36ab15" 9 | -------------------------------------------------------------------------------- /src/loader/version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is subject to the terms and conditions defined in 3 | * file 'LICENSE', which is part of this source code package. 4 | */ 5 | 6 | #pragma once 7 | #define VERSION_SHORT_STRING "@VERSION_SHORT@" 8 | #define VERSION_LONG_STRING "@VERSION_LONG@" 9 | -------------------------------------------------------------------------------- /src/overlay.def: -------------------------------------------------------------------------------- 1 | LIBRARY ActWebSocketImguiOverlay 2 | EXPORTS 3 | ModInit @1 4 | ModRender @2 5 | ModUnInit @3 6 | ModTextureData @4 7 | ModSetTexture @5 8 | ModMenu @6 9 | ModUpdateFont @7 10 | ModGetTextureDirtyRect @8 11 | ModTextureBegin @9 12 | ModTextureEnd @10 13 | -------------------------------------------------------------------------------- /src/rev.py: -------------------------------------------------------------------------------- 1 | from subprocess import check_output 2 | import re 3 | import glob 4 | import sys 5 | 6 | dev = False 7 | 8 | if len(sys.argv) > 1: 9 | dev = True 10 | 11 | out = check_output(["git", "describe", "--long"]).replace('-', '.', 1).replace("\r","").replace("\n","") 12 | arr = out.split(".") 13 | var = arr[0:-1] 14 | if len(var) < 3: 15 | var = var + ['0'] * (3 - len(arr)) 16 | 17 | if dev: 18 | vars = var + [arr[-1].split('-')[0]] 19 | varl = var + [arr[-1].split('-')[0]+'-'+sys.argv[1]] 20 | else: 21 | vars = var + [arr[-1].split('-')[0]] 22 | varl = var + [arr[-1]] 23 | 24 | def tagOnly(): 25 | return ".".join(var[0:3]) 26 | 27 | def tagOnlyWithComma(): 28 | return ".".join(var[0:3]) 29 | 30 | def longVersion(): 31 | return ".".join(varl) 32 | 33 | def longVersionWithComma(): 34 | return ",".join(varl) 35 | 36 | def shortVersion(): 37 | return ".".join(vars) 38 | 39 | def shortVersionWithComma(): 40 | return ",".join(vars) 41 | 42 | print(tagOnly()) 43 | print(longVersion()) 44 | print(longVersionWithComma()) 45 | print(shortVersion()) 46 | print(shortVersionWithComma()) 47 | 48 | files = glob.glob("**/*.in") + glob.glob("*.in") 49 | for f in files: 50 | print(f[:-3]) 51 | with open(f, 'rb') as infile, open(f[:-3], 'wb') as outfile: 52 | ctx = infile.read() 53 | ctx = ctx.replace("@VERSION_TAG@", tagOnly()) 54 | ctx = ctx.replace("@VERSION_TAG_WITH_COMMA@", tagOnlyWithComma()) 55 | ctx = ctx.replace("@VERSION_SHORT@", shortVersion()) 56 | ctx = ctx.replace("@VERSION_SHORT_WITH_COMMA@", shortVersionWithComma()) 57 | ctx = ctx.replace("@VERSION_LONG@", longVersion()) 58 | ctx = ctx.replace("@VERSION_LONG_WITH_COMMA@", longVersionWithComma()) 59 | outfile.write(ctx) 60 | -------------------------------------------------------------------------------- /src/revision.bat: -------------------------------------------------------------------------------- 1 | rev.py -------------------------------------------------------------------------------- /src/setdirty.bat: -------------------------------------------------------------------------------- 1 | rev.py dev -------------------------------------------------------------------------------- /src/tag: -------------------------------------------------------------------------------- 1 | 0.0.1 -------------------------------------------------------------------------------- /src/tag.in: -------------------------------------------------------------------------------- 1 | @VERSION_TAG@ -------------------------------------------------------------------------------- /src/version.in: -------------------------------------------------------------------------------- 1 | @VERSION_SHORT@ --------------------------------------------------------------------------------