Binary files /tmp/1JRkMNh3LD/libcef-desura-291/.git/index and /tmp/fsEgCo4tHA/libcef-desura-291/.git/index differ diff -Nru libcef-desura-291/.git/logs/HEAD libcef-desura-291/.git/logs/HEAD --- libcef-desura-291/.git/logs/HEAD 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.git/logs/HEAD 2013-10-17 18:16:33.000000000 +0000 @@ -1 +1 @@ -0000000000000000000000000000000000000000 8c2117a433892870bb1c12c58e7828e8021187b2 Tomasz Makarewicz 1381130294 +0200 clone: from https://github.com/desura/Desurium.git +0000000000000000000000000000000000000000 3ffd2d87055f15bdad2498950df565ea48fa4179 Tomasz Makarewicz 1382033793 +0200 clone: from https://github.com/desura/Desurium.git diff -Nru libcef-desura-291/.git/logs/refs/heads/master libcef-desura-291/.git/logs/refs/heads/master --- libcef-desura-291/.git/logs/refs/heads/master 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.git/logs/refs/heads/master 2013-10-17 18:16:33.000000000 +0000 @@ -1 +1 @@ -0000000000000000000000000000000000000000 8c2117a433892870bb1c12c58e7828e8021187b2 Tomasz Makarewicz 1381130294 +0200 clone: from https://github.com/desura/Desurium.git +0000000000000000000000000000000000000000 3ffd2d87055f15bdad2498950df565ea48fa4179 Tomasz Makarewicz 1382033793 +0200 clone: from https://github.com/desura/Desurium.git Binary files /tmp/1JRkMNh3LD/libcef-desura-291/.git/objects/pack/pack-d2df331674f7144b65e5a9a08238a63b1634316a.idx and /tmp/fsEgCo4tHA/libcef-desura-291/.git/objects/pack/pack-d2df331674f7144b65e5a9a08238a63b1634316a.idx differ Binary files /tmp/1JRkMNh3LD/libcef-desura-291/.git/objects/pack/pack-d2df331674f7144b65e5a9a08238a63b1634316a.pack and /tmp/fsEgCo4tHA/libcef-desura-291/.git/objects/pack/pack-d2df331674f7144b65e5a9a08238a63b1634316a.pack differ Binary files /tmp/1JRkMNh3LD/libcef-desura-291/.git/objects/pack/pack-dc08ccf9024274ce596e3d7a67ed7625d7012354.idx and /tmp/fsEgCo4tHA/libcef-desura-291/.git/objects/pack/pack-dc08ccf9024274ce596e3d7a67ed7625d7012354.idx differ Binary files /tmp/1JRkMNh3LD/libcef-desura-291/.git/objects/pack/pack-dc08ccf9024274ce596e3d7a67ed7625d7012354.pack and /tmp/fsEgCo4tHA/libcef-desura-291/.git/objects/pack/pack-dc08ccf9024274ce596e3d7a67ed7625d7012354.pack differ diff -Nru libcef-desura-291/.git/packed-refs libcef-desura-291/.git/packed-refs --- libcef-desura-291/.git/packed-refs 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.git/packed-refs 2013-10-17 18:16:33.000000000 +0000 @@ -1,7 +1,7 @@ # pack-refs with: peeled -eef1ae126a5df09c0b623e0a1289646a9dee6f9b refs/remotes/origin/0.8 +200ddc97992014eeca79ae9c997ff5c38a97a569 refs/remotes/origin/0.8 6841b1b89d5a88601b984f1395e5658f9feb2a3c refs/remotes/origin/gh-pages -8c2117a433892870bb1c12c58e7828e8021187b2 refs/remotes/origin/master +3ffd2d87055f15bdad2498950df565ea48fa4179 refs/remotes/origin/master edea75c70a3faa170f091f03856336cb520d1f7d refs/remotes/origin/repo_move 14039ef3e1536a8b67fcb6ade7a58b9a962fce93 refs/tags/0.8.0_rc1 f5397feb026889f07b85725a350ba384cc627373 refs/tags/0.8.0_rc10 diff -Nru libcef-desura-291/.git/refs/heads/master libcef-desura-291/.git/refs/heads/master --- libcef-desura-291/.git/refs/heads/master 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.git/refs/heads/master 2013-10-17 18:16:33.000000000 +0000 @@ -1 +1 @@ -8c2117a433892870bb1c12c58e7828e8021187b2 +3ffd2d87055f15bdad2498950df565ea48fa4179 diff -Nru libcef-desura-291/.gitignore libcef-desura-291/.gitignore --- libcef-desura-291/.gitignore 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.gitignore 2013-10-17 18:16:33.000000000 +0000 @@ -3,16 +3,11 @@ CMakeCache.txt CMakeFiles/ Makefile -build/ -build_cef/ -build_package/ +build*/ +!build_out/ install/ ceflibs/ - -distro/archlinux/* -!distro/archlinux/git/PKGBUILD -!distro/archlinux/release/cef/PKGBUILD -!distro/archlinux/release/desurium/PKGBUID +bin/ # some qt-creator stuff qtcreator-build/ diff -Nru libcef-desura-291/.travis.yml libcef-desura-291/.travis.yml --- libcef-desura-291/.travis.yml 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/.travis.yml 2013-10-17 18:16:33.000000000 +0000 @@ -1,8 +1,10 @@ language: cpp -compiler: gcc +compiler: + - gcc + - clang before_install: - sudo apt-get update - - sudo apt-get install gcc-multilib libnotify-dev libv8-dev libboost-dev libboost-date-time-dev libboost-filesystem-dev libboost-thread-dev libboost-system-dev libboost-test-dev + - sudo apt-get install gcc-multilib libnotify-dev libv8-dev libboost1.48-dev libboost-date-time1.48-dev libboost-filesystem1.48-dev libboost-thread1.48-dev libboost-system1.48-dev libboost-test1.48-dev libgtest-dev - wget "http://ppa.launchpad.net/fransschreuder1/usbpicprog-stable/ubuntu/pool/main/w/wxwidgets2.9/libwxgtk2.9-dev_2.9.3-1_amd64.deb" - wget "http://ppa.launchpad.net/fransschreuder1/usbpicprog-stable/ubuntu/pool/main/w/wxwidgets2.9/wx2.9-headers_2.9.3-1_amd64.deb" - wget "http://ppa.launchpad.net/fransschreuder1/usbpicprog-stable/ubuntu/pool/main/w/wxwidgets2.9/libwxgtk2.9-0_2.9.3-1_amd64.deb" @@ -17,7 +19,7 @@ - mkdir build - cd build script: - - cmake .. -DBUILD_CEF=off -DWITH_ARES=off -DDEBUG=on -DFORCE_BUNDLED_WXGTK=off + - cmake .. -DBUILD_CEF=off -DWITH_ARES=off -DDEBUG=on -DFORCE_BUNDLED_WXGTK=off -DWITH_GTEST=ON -DBUILD_TESTS=ON - make -j4 - ctest --output-on-failure . notifications: @@ -30,3 +32,4 @@ - "Latest commit: %{compare_url}" on_success: change on_failure: change + skip_join: true diff -Nru libcef-desura-291/CHANGELOG libcef-desura-291/CHANGELOG --- libcef-desura-291/CHANGELOG 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/CHANGELOG 2013-10-17 18:16:33.000000000 +0000 @@ -4,16 +4,22 @@ rc1: ---- * fixed: cmake: build on windows (https://github.com/desura/Desurium/issues/106) + * fixed: create alternative to MFC (Microsoft Foundation Classes) (https://github.com/desura/Desurium/issues/376) * fixed: move to tinyxml-2 (https://github.com/desura/Desurium/issues/491) * fixed: util/OS: some functions not implemented on windows (https://github.com/desura/Desurium/issues/583) * fixed: Debugging is hard. (https://github.com/desura/Desurium/issues/585) * fixed: cmake/v8: move away from svn and update to newer v8 version (https://github.com/desura/Desurium/pull/590) + * fixed: Multiple MCF upload Issue (https://github.com/desura/Desurium/issues/609) + * added: Add option to disable news popup (https://github.com/desura/Desurium/issues/628) + * fixed: boost causes desura to crash due to boost bug 6320 (https://github.com/desura/Desurium/issues/639) + * fixed: Desura fails to save settings on login (like auto login) (https://github.com/desura/Desurium/issues/640) version 0.8.0: -------------- rc11: ----- + * fixed: Breadcrumbs are positioned too high (https://github.com/desura/Desurium/issues/213) * fixed: fail to compile third_party/sqlite on Linux (https://github.com/desura/Desurium/issues/406) * fixed: Checkbox not disabled and reacts to enter together with Login button in login-window (https://github.com/desura/Desurium/issues/476) * fixed: where should archvies for building desurium be stored? (https://github.com/desura/Desurium/issues/544) diff -Nru libcef-desura-291/CMakeLists.txt libcef-desura-291/CMakeLists.txt --- libcef-desura-291/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/CMakeLists.txt 2013-10-17 18:16:33.000000000 +0000 @@ -19,6 +19,7 @@ # # BREAKPAD_URL URL to breakdpad archive, should be rev. 850 # CEF_URL URL to cef archive, should be rev. 291 +# CEF_BIN_URL URL to cef bin files for windows # CHROMIUM_URL URL to chromium archive, has to be 15.0.876.0 # CURL_URL URL to curl archive # DEPOT_TOOLS_URL URL to depot_tools archive @@ -104,7 +105,11 @@ if(DEBUG) set(CMAKE_BUILD_TYPE Debug) else() - set(CMAKE_BUILD_TYPE Release) + if(OFFICIAL_BUILD) + set(CMAKE_BUILD_TYPE RelWithDebInfo) + else() + set(CMAKE_BUILD_TYPE Release) + endif() endif() ############################################################################### @@ -126,24 +131,6 @@ # find all packages which are needed ############################################################################### -macro(CopyTargetFiles target) - -get_property(target_loc TARGET ${target} PROPERTY LOCATION) - -message(WARNING, ${target_loc}) - -if (${target_loc} MATCHES ".*exe") - add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${target_loc}" "${CMAKE_OUTPUT}") -endif() - -if (${target_loc} MATCHES ".*dll") - add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_OUTPUT}/bin/.") - add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${target_loc}" "${CMAKE_OUTPUT}/bin/.") -endif() - -endmacro(CopyTargetFiles) - - if(NOT WIN32) set(REQUIRED_ON_UNIX REQUIRED) endif() @@ -155,16 +142,16 @@ if(BUILD_TESTS) set(Boost_ADDITION_LIBS ${Boost_ADDITION_LIBS} unit_test_framework) endif() - + set(Boost_USE_MULTITHREADED ON) if(WIN32) set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_RUNTIME OFF) endif() find_package(Boost COMPONENTS date_time filesystem thread system ${Boost_ADDITION_LIBS}) - + if(NOT WITH_ARES) - find_package(CURL ${REQUIRED_IF_OPTION}) + find_package(CURL 7.19.1 ${REQUIRED_IF_OPTION}) endif() if(NOT WIN32) @@ -189,21 +176,17 @@ if(NOT FORCE_BUNDLED_WXGTK) find_package(wxWidgets 2.9 COMPONENTS richtext ${REQUIRED_IF_OPTION}) endif() + + if(WITH_GTEST) + find_package(GTest ${REQUIRED_IF_OPTION}) + add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY -DWITH_GTEST) + endif() endif() find_package(PythonInterp REQUIRED) if(WIN32) find_package(PythonLibs REQUIRED) - # only define this if MFC was found - # VC express and mingw doesn't provide MFC, but other versions of VC do - find_package(MFC) - if(MFC_FOUND) - set(CMAKE_MFC_FLAG 2) - add_definitions(-DMFC_FOUND -DDONT_INCLUDE_WINH -D_AFXDLL) - # Visual Studio 9 needs this - add_definitions(-D_BIND_TO_CURRENT_CRT_VERSION -D_BIND_TO_CURRENT_MFC_VERSION) - endif() endif() find_package(Patch REQUIRED) @@ -214,86 +197,42 @@ set(PATCH_SCRIPT_PATH ${CMAKE_SCRIPT_PATH}/patch.sh) endif() +if(WIN32) + find_package(NMake REQUIRED) +endif() + ############################################################################### # SVN, HTTP stuff ############################################################################### -if(WIN32) - set(BOOST_URL_DEFAULT "http://downloads.sourceforge.net/project/boost/boost/1.51.0/boost_1_51_0.zip") - set(BOOST_URL ${BOOST_URL_DEFAULT} - CACHE STRING "URL to boost archive") - if(BOOST_URL STREQUAL BOOST_URL_DEFAULT) - set(BOOST_MD5 ee8112e48088b05c248d68329cd5d908) +macro(SetupDownloadUrl name url md5) + set(${name}_URL_DEFAULT "${url}") + set(${name}_URL ${${name}_URL_DEFAULT} CACHE STRING "URL to get ${name} archive") + if(${name}_URL STREQUAL ${name}_URL_DEFAULT) + set(${name}_MD5 ${md5} CACHE STRING "Md5 for ${name} archive") else() - unset(BOOST_MD5) + unset(${name}_MD5) endif() -endif() - -set(BREAKPAD_URL_DEFAULT "http://sourceforge.net/projects/desurium/files/breakpad-850-r1.zip/download") -set(BREAKPAD_URL ${BREAKPAD_URL_DEFAULT} - CACHE STRING "URL to breakpad") -if(BREAKPAD_URL STREQUAL BREAKPAD_URL_DEFAULT) - set(BREAKPAD_MD5 b0061a854df1a0d285edc74c5ac37c42) -else() - unset(BREAKPAD_MD5) -endif() +endmacro() - -set(CEF_URL_DEFAULT "http://sourceforge.net/projects/desurium/files/cef-291.tar.gz/download") -set(CEF_URL ${CEF_URL_DEFAULT} - CACHE STRING "URL to cef, has to be revision 291") -if(CEF_URL STREQUAL CEF_URL_DEFAULT) - set(CEF_MD5 97e925e33f2d48cd50172247dbe40f30) -else() - unset(CEF_MD5) +if(WIN32) + SetupDownloadUrl(BOOST "http://downloads.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.zip" c618e030fd4882e4dbacf54baf824544) + SetupDownloadUrl(CEF_BIN "https://s3-us-west-2.amazonaws.com/lecs.desura.lindenlab.com/cef_bin.zip" c9c0379579d9d26557ca8f4b42f937f2) + SetupDownloadUrl(DESURA_EXTRA_BIN "https://s3-us-west-2.amazonaws.com/lecs.desura.lindenlab.com/desura_extra_bin.zip" fdb2a4dd704a90e5174c64d3eaf8392b) endif() -set(CHROMIUM_URL_DEFAULT "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-15.0.876.0.tar.bz2") -set(CHROMIUM_URL ${CHROMIUM_URL_DEFAULT} - CACHE STRING "URL to chromium, has to be 15.0.876.0") -if(CHROMIUM_URL STREQUAL CHROMIUM_URL_DEFAULT) - set(CHROMIUM_MD5 22c8e1db4d1c4b474c600dffbb5fdd0c) -else() - unset(CHROMIUM_MD5) -endif() +SetupDownloadUrl(BREAKPAD "http://sourceforge.net/projects/desurium/files/breakpad-850-r1.zip/download" b0061a854df1a0d285edc74c5ac37c42) +SetupDownloadUrl(CEF "http://sourceforge.net/projects/desurium/files/cef-291.tar.gz/download" 97e925e33f2d48cd50172247dbe40f30) +SetupDownloadUrl(CHROMIUM "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-15.0.876.0.tar.bz2" 22c8e1db4d1c4b474c600dffbb5fdd0c) if(WIN32 OR NOT CURL_FOUND) - set(CURL_URL_DEFAULT http://curl.haxx.se/download/curl-7.32.0.tar.bz2) - set(CURL_URL ${CURL_URL_DEFAULT} - CACHE STRING "URL to curl archive") - if(CURL_URL STREQUAL CURL_URL_DEFAULT) - set(CURL_MD5 30d04b0a8c43c6770039d1bf033dfe79) - else() - unset(CURL_MD5) - endif() -endif() - -set(DEPOT_TOOLS_URL_DEFAULT "http://sourceforge.net/projects/desurium/files/depot_tools-r1.zip/download") -set(DEPOT_TOOLS_URL ${DEPOT_TOOLS_URL_DEFAULT} - CACHE STRING "URL to depot_tools") -if(DEPOT_TOOLS_URL STREQUAL DEPOT_TOOLS_URL_DEFAULT) - set(DEPOT_TOOLS_MD5 a27266b8d2388c4dc51645d1159dd0de) -else() - unset(DEPOT_TOOLS_MD5) -endif() - -set(V8_URL_DEFAULT https://commondatastorage.googleapis.com/chromium-browser-official/v8-3.18.5.14.tar.bz2) -set(V8_URL ${V8_URL_DEFAULT} - CACHE STRING "URL to v8 archive") -if(V8_URL STREQUAL V8_URL_DEFAULT) - set(V8_MD5 657802ea63c89190fd510ee1a2a719bf) -else() - unset(V8_MD5) + SetupDownloadUrl(CURL "http://curl.haxx.se/download/curl-7.32.0.tar.bz2" 30d04b0a8c43c6770039d1bf033dfe79) endif() -set(WXWIDGET_URL_DEFAULT http://garr.dl.sourceforge.net/project/wxwindows/2.9.3/wxWidgets-2.9.3.tar.bz2) -set(WXWIDGET_URL ${WXWIDGET_URL_DEFAULT} - CACHE STRING "URL to wxWidget 2.9.3 archive") -if(WXWIDGET_URL STREQUAL WXWIDGET_URL_DEFAULT) - set(WXWIDGET_MD5 6b6003713289ea4d3cd9b49c5db5b721) -else() - unset(WXWIDGET_MD5) -endif() +SetupDownloadUrl(DEPOT_TOOLS "http://sourceforge.net/projects/desurium/files/depot_tools-r1.zip/download" a27266b8d2388c4dc51645d1159dd0de) +SetupDownloadUrl(GTEST "https://googletest.googlecode.com/files/gtest-1.7.0.zip" 2d6ec8ccdf5c46b05ba54a9fd1d130d7) +SetupDownloadUrl(WXWIDGET "http://garr.dl.sourceforge.net/project/wxwindows/2.9.3/wxWidgets-2.9.3.tar.bz2" 6b6003713289ea4d3cd9b49c5db5b721) +SetupDownloadUrl(V8 "https://commondatastorage.googleapis.com/chromium-browser-official/v8-3.18.5.14.tar.bz2" 657802ea63c89190fd510ee1a2a719bf) ############################################################################### # build some externel projects @@ -316,9 +255,17 @@ include(BuildCURL) endif() + if(NOT GTEST_FOUND AND WITH_GTEST) + include(BuildGTest) + endif() + if(NOT V8_FOUND) include(Buildv8) endif() + + if(WIN32) + include(BuildDesuraExtraBin) + endif() endif() include(BuildCEF) @@ -350,6 +297,11 @@ if(WITH_FLASH AND NOT WIN32) add_subdirectory(third_party/npwrapper) endif() + + if(WIN32) + add_subdirectory(third_party/desura_extra) + endif() + ############################################################################### # build desura ############################################################################### diff -Nru libcef-desura-291/README.md libcef-desura-291/README.md --- libcef-desura-291/README.md 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/README.md 2013-10-17 18:16:33.000000000 +0000 @@ -83,20 +83,38 @@ Download and install: * Svn http://www.sliksvn.com/en/download or http://tortoisesvn.net/downloads.html - * Msvc 2008 Professional or higher + * Msvc 2012 or higher * Python 2.7 http://www.python.org/getit/ * CMake 2.8 http://www.cmake.org/ - * Patch either from msysGit or http://gnuwin32.sourceforge.net/packages/patch.htm (please use Complete package, except sources) + * Patch either from msysGit or git bash * Windows DirectX 9 SDK for the CEF build https://www.microsoft.com/en-us/download/details.aspx?id=6812 Note: Make sure you add svn and python to your environment PATH +## Command line build: + Open a 32bit cmd.exe with env vars set up by vc or other scripts (so we have a full build environment) and run: ./build_desura.bat wait + +## Visual studio build: + +Open a 32bit cmd.exe with env vars set up by vc or other scripts (so we have a full build environment) and run: + + ./build_desura_vis.bat + +* Set BUILD_ALL as startup project +* In properties for BUILD_ALL set debugging options: + * Command to source code dir + "\build_out\desura.exe" + * Working Directory to source code dir + "\build_out" +* Build ThirdParty folder first (race condition some times if you dont +* Build BUILD_ALL + +Should be able to run and debug Desura now. + Special notes for advanced users ===================== diff -Nru libcef-desura-291/build_desura_vis.bat libcef-desura-291/build_desura_vis.bat --- libcef-desura-291/build_desura_vis.bat 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/build_desura_vis.bat 2013-10-17 18:16:33.000000000 +0000 @@ -0,0 +1,8 @@ +IF NOT EXIST build_vis ( + mkdir build_vis +) + +cd build_vis +cmake .. -DCMAKE_INSTALL_PREFIX=../install_vis -G "Visual Studio 10" -DBUILD_CEF=OFF -DDEBUG=ON -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DDEBUG_V8=ON +start Desura.sln +cd .. \ No newline at end of file diff -Nru libcef-desura-291/build_out/CMakeLists.txt libcef-desura-291/build_out/CMakeLists.txt --- libcef-desura-291/build_out/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/build_out/CMakeLists.txt 2013-10-17 18:16:33.000000000 +0000 @@ -4,22 +4,11 @@ # / ############################################################################### -install(DIRECTORY - ${DATA}/bindings - ${DATA}/language - ${DATA}/scripts - DESTINATION ${DATA_INSTALL_DIR} -) - -install(FILES ${DATA}/ca-bundle_lin.crt - DESTINATION ${DATA_INSTALL_DIR} - RENAME ca-bundle.crt -) - -install(FILES ${DATA}/cef_data_lin.pak - DESTINATION ${DATA_INSTALL_DIR} - RENAME cef_data.pak -) +install_data_directories("" ${DATA}/bindings) +install_data_directories("" ${DATA}/language) +install_data_directories("" ${DATA}/scripts) +install_data_files("" "${DATA}/ca-bundle_lin.crt") +install_data_files("" "${DATA}/cef_data_lin.pak") ############################################################################### # /themes/default @@ -27,15 +16,9 @@ set(DT ${DATA}/themes/default) -install(DIRECTORY ${DT}/css - ${DT}/html - DESTINATION ${DATA_INSTALL_DIR}/themes/default -) - -install(FILES ${DT}/preview.jpg - ${DT}/theme.xml - DESTINATION ${DATA_INSTALL_DIR}/themes/default -) +install_data_directories("themes/default" "${DT}/css") +install_data_directories("themes/default" "${DT}/html") +install_data_files("themes/default" ${DT}/preview.jpg ${DT}/theme.xml) ############################################################################### # /themes/default/js @@ -48,15 +31,14 @@ ${JS}/functions_win.js ${JS}/settings_lin.js ${JS}/settings_win.js) -install(FILES ${JS_SCRIPTS} - DESTINATION ${DATA_INSTALL_DIR}/themes/default/js) +install_data_files("themes/default/js" ${JS_SCRIPTS}) if(WIN32) - install(FILES ${JS}/functions_win.js DESTINATION ${DATA_INSTALL_DIR}/themes/default/js RENAME functions.js) - install(FILES ${JS}/settings_win.js DESTINATION ${DATA_INSTALL_DIR}/themes/default/js RENAME settings.js) + install_data_files("themes/default/js" ${JS}/functions_win.js) + install_data_files("themes/default/js" ${JS}/settings_win.js) else() - install(FILES ${JS}/functions_lin.js DESTINATION ${DATA_INSTALL_DIR}/themes/default/js RENAME functions.js) - install(FILES ${JS}/settings_lin.js DESTINATION ${DATA_INSTALL_DIR}/themes/default/js RENAME settings.js) + install_data_files("themes/default/js" ${JS}/functions_lin.js) + install_data_files("themes/default/js" ${JS}/settings_lin.js) endif() ############################################################################### @@ -65,9 +47,7 @@ set(IMG ${DT}/images) -install(DIRECTORY ${IMG}/html - DESTINATION ${DATA_INSTALL_DIR}/themes/default/images -) +install_data_directories("themes/default/images" ${IMG}/html) ############################################################################### # /themes/default/images/app @@ -76,22 +56,9 @@ set(APP ${IMG}/app) file(GLOB IMAGES ${APP}/*.png) -install(FILES ${IMAGES} - DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app -) +install_data_files("themes/default/images/app" ${IMAGES}) if(NOT WIN32) - install(FILES util.sh - DESTINATION ${DATA_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - ) - - install(FILES findlib.sh - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - ) -endif() \ No newline at end of file + install_internal_tool_script(util.sh) + install_internal_tool_script(findlib.sh) +endif() diff -Nru libcef-desura-291/build_out/data/language/english.xml libcef-desura-291/build_out/data/language/english.xml --- libcef-desura-291/build_out/data/language/english.xml 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/build_out/data/language/english.xml 2013-10-17 18:16:33.000000000 +0000 @@ -406,6 +406,7 @@ Enter a CD key or giftcode to activate a game on your account Version Exit + Unit Tests Bandwidth Monitor Shows the bandwidth monitor diff -Nru libcef-desura-291/build_out/data/themes/default/theme.xml libcef-desura-291/build_out/data/themes/default/theme.xml --- libcef-desura-291/build_out/data/themes/default/theme.xml 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/build_out/data/themes/default/theme.xml 2013-10-17 18:16:33.000000000 +0000 @@ -278,7 +278,10 @@ chat_profile.png chat_profile_hover.png - chat_profile_nonactive.png + chat_profile_nonactive.png + + test_good.png + test_bad.png diff -Nru libcef-desura-291/cmake/modules/BuildBoost.cmake libcef-desura-291/cmake/modules/BuildBoost.cmake --- libcef-desura-291/cmake/modules/BuildBoost.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildBoost.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -8,37 +8,50 @@ set(BOOST_EXTRA_BUILD_OPTS "") endif() +set(BOOST_BJAM_LIBS_STATIC --with-chrono --with-filesystem --with-thread --with-system) +set(BOOST_BJAM_LIBS ${BOOST_BJAM_LIBS_STATIC} --with-date_time --with-test) + +if (WIN32 AND NOT MINGW) + if (MSVC10) + set(TOOLSET_MSVC_VER --toolset=msvc-10.0) + elseif (MSVC11) + set(TOOLSET_MSVC_VER --toolset=msvc-11.0) + elseif (MSVC12) + set(TOOLSET_MSVC_VER --toolset=msvc-12.0) + endif() +endif() + if(DEBUG) -ExternalProject_Add( - boost - URL "${BOOST_URL}" - URL_MD5 ${BOOST_MD5} - UPDATE_COMMAND "" - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${CONFIGURE_COMMAND} ${BOOST_EXTRA_BUILD_OPTS} - BUILD_COMMAND ${BJAM_BINARY} --layout=system --with-date_time --with-filesystem - --with-thread --with-system --with-test variant=debug link=static - threading=multi runtime-link=shared - INSTALL_COMMAND "" -) + ExternalProject_Add( + boost + URL "${BOOST_URL}" + URL_MD5 ${BOOST_MD5} + UPDATE_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} ${BOOST_EXTRA_BUILD_OPTS} + BUILD_COMMAND ${BJAM_BINARY} ${BOOST_BJAM_LIBS} --layout=tagged variant=debug link=static + threading=multi runtime-link=shared ${TOOLSET_MSVC_VER} + INSTALL_COMMAND "" + ) + set(BOOST_LIB_ADD_STRING "mt-gd") else() -ExternalProject_Add( - boost - URL "${BOOST_URL}" - URL_MD5 ${BOOST_MD5} - UPDATE_COMMAND "" - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${CONFIGURE_COMMAND} ${BOOST_EXTRA_BUILD_OPTS} - BUILD_COMMAND ${BJAM_BINARY} --layout=system --with-date_time --with-filesystem - --with-thread --with-system --with-test variant=release link=static - threading=multi runtime-link=shared - INSTALL_COMMAND "" -) + ExternalProject_Add( + boost + URL "${BOOST_URL}" + URL_MD5 ${BOOST_MD5} + UPDATE_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} ${BOOST_EXTRA_BUILD_OPTS} + BUILD_COMMAND ${BJAM_BINARY} ${BOOST_BJAM_LIBS} --layout=tagged variant=release link=static + threading=multi runtime-link=shared ${TOOLSET_MSVC_VER} + INSTALL_COMMAND "" + ) + set(BOOST_LIB_ADD_STRING "mt") endif() ExternalProject_Get_Property( - boost - source_dir + boost + source_dir ) set(Boost_DIR ${source_dir}) @@ -51,16 +64,54 @@ set(BOOST_SUFFIX lib) endif() -set(Boost_CHRONO_LIBRARY "${Boost_LIBRARY_DIR}/libboost_chrono${BAS}.${BOOST_SUFFIX}") -set(Boost_DATE_TIME_LIBRARY "${Boost_LIBRARY_DIR}/libboost_date_time${BAS}.${BOOST_SUFFIX}") -set(Boost_FILESYSTEM_LIBRARY "${Boost_LIBRARY_DIR}/libboost_filesystem${BAS}.${BOOST_SUFFIX}") -set(Boost_PRG_EXEC_MONITOR_LIBRARY "${Boost_LIBRARY_DIR}/libboost_prg_exec_monitor${BAS}.${BOOST_SUFFIX}") -set(Boost_SYSTEM_LIBRARY "${Boost_LIBRARY_DIR}/libboost_system${BAS}.${BOOST_SUFFIX}") -set(Boost_TEST_EXEC_MONITOR_LIBRARY "${Boost_LIBRARY_DIR}/libboost_test_exec_monitor${BAS}.${BOOST_SUFFIX}") -set(Boost_THREAD_LIBRARY "${Boost_LIBRARY_DIR}/libboost_thread${BAS}.${BOOST_SUFFIX}") -set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_LIBRARY_DIR}/libboost_unit_test_framework${BAS}.${BOOST_SUFFIX}") - -set(Boost_LIBRARIES "${Boost_DATE_TIME_LIBRARY};${Boost_FILESYSTEM_LIBRARY};${Boost_SYSTEM_LIBRARY};${Boost_THREAD_LIBRARY};${Boost_PRG_EXEC_MONITOR_LIBRARY};${Boost_TEST_EXEC_MONITOR_LIBRARY};${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}") - - -SET_PROPERTY(TARGET boost PROPERTY FOLDER "ThirdParty") \ No newline at end of file +set(Boost_CHRONO_LIBRARY "${Boost_LIBRARY_DIR}/libboost_chrono-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_DATE_TIME_LIBRARY "${Boost_LIBRARY_DIR}/libboost_date_time-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_FILESYSTEM_LIBRARY "${Boost_LIBRARY_DIR}/libboost_filesystem-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_PRG_EXEC_MONITOR_LIBRARY "${Boost_LIBRARY_DIR}/libboost_prg_exec_monitor-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_SYSTEM_LIBRARY "${Boost_LIBRARY_DIR}/libboost_system-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_TEST_EXEC_MONITOR_LIBRARY "${Boost_LIBRARY_DIR}/libboost_test_exec_monitor-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_THREAD_LIBRARY "${Boost_LIBRARY_DIR}/libboost_thread-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_LIBRARY_DIR}/libboost_unit_test_framework-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") + +set_property(TARGET boost PROPERTY FOLDER "ThirdParty") + +if (WIN32) + if(DEBUG) + ExternalProject_Add( + boost_s + UPDATE_COMMAND "" + DOWNLOAD_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND ${BJAM_BINARY} ${BOOST_BJAM_LIBS_STATIC} --layout=tagged + variant=debug link=static threading=multi runtime-link=static ${TOOLSET_MSVC_VER} + INSTALL_COMMAND "" + SOURCE_DIR "${source_dir}" + ) + set(BOOST_LIB_ADD_STRING "mt-sgd") + else() + ExternalProject_Add( + boost_s + UPDATE_COMMAND "" + DOWNLOAD_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND ${BJAM_BINARY} ${BOOST_BJAM_LIBS_STATIC} --layout=tagged + variant=release link=static threading=multi runtime-link=static ${TOOLSET_MSVC_VER} + INSTALL_COMMAND "" + SOURCE_DIR "${source_dir}" + ) + set(BOOST_LIB_ADD_STRING "mt-s") + endif() + + add_dependencies(boost_s boost) + + set(Boost_LIBRARY_DIR_S ${Boost_DIR_S}/stage/lib) + + set_property(TARGET boost_s PROPERTY FOLDER "ThirdParty") + + set(Boost_CHRONO_LIBRARY_S "${Boost_LIBRARY_DIR}/libboost_chrono-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") + set(Boost_FILESYSTEM_LIBRARY_S "${Boost_LIBRARY_DIR}/libboost_filesystem-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") + set(Boost_SYSTEM_LIBRARY_S "${Boost_LIBRARY_DIR}/libboost_system-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") + set(Boost_THREAD_LIBRARY_S "${Boost_LIBRARY_DIR}/libboost_thread-${BOOST_LIB_ADD_STRING}.${BOOST_SUFFIX}") +endif() diff -Nru libcef-desura-291/cmake/modules/BuildCEF.cmake libcef-desura-291/cmake/modules/BuildCEF.cmake --- libcef-desura-291/cmake/modules/BuildCEF.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildCEF.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -244,10 +244,7 @@ add_dependencies(cef chromium) add_dependencies(cef fetch_cef) - install(FILES ${CEF_LIBRARIES} - DESTINATION ${LIB_INSTALL_DIR}) - install(FILES ${CEF_FFMPEG_LIB} - DESTINATION ${CEF_MEDIA_DIR}) + install_external_library(cef ${CEF_LIBRARIES} ${CEF_FFMPEG_LIB}) SET_PROPERTY(TARGET cef PROPERTY FOLDER "ThirdParty") else(BUILD_CEF) @@ -269,6 +266,34 @@ set(CEF_SOURCE_DIR ${source_dir}) set(CEF_INCLUDE_DIRS "${CEF_SOURCE_DIR}") - SET_PROPERTY(TARGET fetch_cef PROPERTY FOLDER "ThirdParty") + SET_PROPERTY(TARGET fetch_cef PROPERTY FOLDER "ThirdParty") + + if(WIN32) + ExternalProject_Add( + fetch_cef_bin + URL "${CEF_BIN_URL}" + URL_MD5 ${CEF_BIN_MD5} + UPDATE_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) + + ExternalProject_Get_Property( + fetch_cef_bin + source_dir + ) + + install_external_library(fetch_cef_bin + ${source_dir}/avcodec-53.dll + ${source_dir}/avformat-53.dll + ${source_dir}/avutil-51.dll + ${source_dir}/cef_desura.dll + ${source_dir}/gcswf32.dll + ${source_dir}/icudt.dll + ${source_dir}/plugin.vch + ${source_dir}/zlibwapi.dll) + endif() endif() diff -Nru libcef-desura-291/cmake/modules/BuildCURL.cmake libcef-desura-291/cmake/modules/BuildCURL.cmake --- libcef-desura-291/cmake/modules/BuildCURL.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildCURL.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -30,7 +30,7 @@ custom_build DEPENDEES configure DEPENDERS build - COMMAND nmake /f Makefile.vc MODE=dll DEBUG=${CURL_DEBUG} GEN_PDB=no USE_SSPI=yes USE_IPV6=no USE_IDN=no ENABLE_WINSSL=yes MACHINE=x86 + COMMAND ${NMAKE_EXECUTABLE} /f Makefile.vc MODE=dll DEBUG=${CURL_DEBUG} GEN_PDB=no ENABLE_SSPI=yes ENABLE_IPV6=no ENABLE_IDN=no ENABLE_WINSSL=yes MACHINE=x86 ENABLE_SPNEGO=no WORKING_DIRECTORY /winbuild ) @@ -38,11 +38,43 @@ curl source_dir ) + if(DEBUG) - set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-vc-x86-debug-dll-spnego-winssl) + set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-vc-x86-debug-dll-sspi-winssl) else() - set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-vc-x86-release-dll-spnego-winssl) + set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-vc-x86-release-dll-sspi-winssl) endif() + + + ExternalProject_Add( + curl_s + URL ${CURL_URL} + URL_MD5 ${CURL_MD5} + UPDATE_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) + ExternalProject_Add_Step( + curl_s + custom_build + DEPENDEES configure + DEPENDERS build + COMMAND ${NMAKE_EXECUTABLE} /f Makefile.vc MODE=static RTLIBCFG=static DEBUG=${CURL_DEBUG} GEN_PDB=no ENABLE_SSPI=yes ENABLE_IPV6=no ENABLE_IDN=no ENABLE_WINSSL=yes MACHINE=x86 ENABLE_SPNEGO=no + WORKING_DIRECTORY /winbuild + ) + + ExternalProject_Get_Property( + curl_s + source_dir + ) + + if(DEBUG) + set(CURL_INSTALL_DIR_S ${source_dir}/builds/libcurl-vc-x86-debug-static-sspi-winssl) + else() + set(CURL_INSTALL_DIR_S ${source_dir}/builds/libcurl-vc-x86-release-static-sspi-winssl) + endif() else() find_package(OpenSSL REQUIRED) set(CURL_INSTALL_DIR ${CMAKE_EXTERNAL_BINARY_DIR}/curl) @@ -69,13 +101,19 @@ set(CURL_LIBRARY_DIR ${CURL_INSTALL_DIR}/lib) set(CURL_INCLUDE_DIRS ${CURL_INSTALL_DIR}/include) +set(CURL_BIN_DIRS_S ${CURL_INSTALL_DIR_S}/bin) +set(CURL_LIBRARY_DIR_S ${CURL_INSTALL_DIR_S}/lib) +set(CURL_INCLUDE_DIRS_S ${CURL_INSTALL_DIR_S}/include) + if(WIN32 AND NOT MINGW) if(DEBUG) list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl_debug.lib") - install(FILES "${CURL_BIN_DIRS}/libcurl_debug.dll" DESTINATION ${LIB_INSTALL_DIR}) + list(APPEND CURL_LIBRARIES_S "${CURL_LIBRARY_DIR_S}/libcurl_a_debug.lib") + install_external_library(curl "${CURL_BIN_DIRS}/libcurl_debug.dll") else() list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl.lib") - install(FILES "${CURL_BIN_DIRS}/libcurl.dll" DESTINATION ${LIB_INSTALL_DIR}) + list(APPEND CURL_LIBRARIES_S "${CURL_LIBRARY_DIR_S}/libcurl_a.lib") + install_external_library(curl "${CURL_BIN_DIRS}/libcurl.dll") endif() else() list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl.a") @@ -90,6 +128,3 @@ if(WITH_ARES) list(APPEND CURL_LIBRARIES ${CARES_LIBRARIES}) endif() - - -SET_PROPERTY(TARGET curl PROPERTY FOLDER "ThirdParty") diff -Nru libcef-desura-291/cmake/modules/BuildDesuraExtraBin.cmake libcef-desura-291/cmake/modules/BuildDesuraExtraBin.cmake --- libcef-desura-291/cmake/modules/BuildDesuraExtraBin.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildDesuraExtraBin.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -0,0 +1,21 @@ +ExternalProject_Add( + desura_extra_bin + URL "${DESURA_EXTRA_BIN}" + URL_MD5 ${DESURA_EXTRA_BIN} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +ExternalProject_Get_Property( + desura_extra_bin + source_dir +) + +install_external_library(desura_extra_bin + "${source_dir}/Blank_GDF.dll" + "${source_dir}/courgette_desura.dll" + "${source_dir}/dbghelp-desura.dll" + "${source_dir}/Desura_GDF.dll" + "${source_dir}/FreeImage.dll" + "${source_dir}/GameuxInstallHelper.dll") diff -Nru libcef-desura-291/cmake/modules/BuildGTest.cmake libcef-desura-291/cmake/modules/BuildGTest.cmake --- libcef-desura-291/cmake/modules/BuildGTest.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildGTest.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -0,0 +1,34 @@ +if(MSVC11) + set(ADD_CXX_FLAGS "/D_VARIADIC_MAX=10") +endif() + +ExternalProject_Add( + gtest + URL "${GTEST_URL}" + URL_MD5 ${GTEST_MD5} + CMAKE_ARGS -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=${ADD_CXX_FLAGS} + BUILD_IN_SOURCE 1 + INSTALL_COMMAND "" +) + +ExternalProject_Get_Property( + gtest + source_dir +) + +set(GTEST_INCLUDE_DIRS "${source_dir}/include") +if(WIN32) + set(GTEST_LIBRARIES "${source_dir}/gtest.lib") + # currently we don't need them, but we should keep it here + # set(GTEST_MAIN_LIBRARIES "${source_dir}/gtest_main.lib") + set(GTEST_INSTALL_LIBS "${source_dir}/gtest.dll") +else() + set(GTEST_LIBRARIES "${source_dir}/libgtest.so") + # currently we don't need them, but we should keep it here + # set(GTEST_MAIN_LIBRARIES "${source_dir}/libgtest_main.so") + set(GTEST_INSTALL_LIBS "${source_dir}/libgtest.so") +endif() + +set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) + +install_external_library(gtest ${GTEST_INSTALL_LIBS}) diff -Nru libcef-desura-291/cmake/modules/BuildGoogleBreakpad.cmake libcef-desura-291/cmake/modules/BuildGoogleBreakpad.cmake --- libcef-desura-291/cmake/modules/BuildGoogleBreakpad.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildGoogleBreakpad.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -33,6 +33,33 @@ WORKING_DIRECTORY COMMAND cmake -DVCXPROJ_PATH=/src/client/windows/handler/exception_handler.vcxproj -P ${CMAKE_SCRIPT_PATH}/breakpad_VS_patch.cmake ) + + ExternalProject_Add( + breakpad_s + URL ${BREAKPAD_URL} + URL_MD5 ${BREAKPAD_MD5} + UPDATE_COMMAND "" + PATCH_COMMAND ${PATCH_SCRIPT_PATH} ${CMAKE_PATCH_DIR}/breakpad.patch + CONFIGURE_COMMAND ${PYTHON_EXECUTABLE} ../breakpad_s/src/tools/gyp/gyp ../breakpad_s/src/client/windows/breakpad_client.gyp + BUILD_COMMAND msbuild /src/client/windows/handler/exception_handler.vcxproj /nologo /t:rebuild /m:2 /property:Configuration=${CONFIGURATION_TYPE} + INSTALL_COMMAND "" + ) + ExternalProject_Add_Step( + breakpad_s + update_project_files + DEPENDEES configure + DEPENDERS build + COMMAND vcupgrade /src/client/windows/handler/exception_handler.vcproj + ) + + ExternalProject_Get_Property( + breakpad_s + source_dir + ) + set(BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR_S ${source_dir}/src) + set(BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR_S ${source_dir}/src/client/windows/handler/${CONFIGURATION_TYPE}/lib) + set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES_S "${BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR_S}/exception_handler.lib") + set_property(TARGET breakpad_s PROPERTY FOLDER "ThirdParty") else() ExternalProject_Add( breakpad diff -Nru libcef-desura-291/cmake/modules/Buildv8.cmake libcef-desura-291/cmake/modules/Buildv8.cmake --- libcef-desura-291/cmake/modules/Buildv8.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/Buildv8.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -55,12 +55,10 @@ if(WIN32) if(DEBUG_V8) set(V8_LIBRARIES "${V8_INSTALL_DIR}/build/Debug/lib/v8.lib") - install(FILES "${V8_INSTALL_DIR}/build/Debug/v8.dll" - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(v8 "${V8_INSTALL_DIR}/build/Debug/v8.dll") else() set(V8_LIBRARIES "${V8_INSTALL_DIR}/build/Release/lib/v8.lib") - install(FILES "${V8_INSTALL_DIR}/build/Release/v8.dll" - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(v8 "${V8_INSTALL_DIR}/build/Release/v8.dll") endif() else() if(DEBUG_V8) @@ -68,9 +66,5 @@ else() set(V8_LIBRARIES "${V8_INSTALL_DIR}/out/out/Release/lib.target/libv8.so") endif() - install(FILES ${V8_LIBRARIES} - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(v8 "${V8_LIBRARIES}") endif() - - -SET_PROPERTY(TARGET v8 PROPERTY FOLDER "ThirdParty") diff -Nru libcef-desura-291/cmake/modules/BuildwxWidgets.cmake libcef-desura-291/cmake/modules/BuildwxWidgets.cmake --- libcef-desura-291/cmake/modules/BuildwxWidgets.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/BuildwxWidgets.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -9,16 +9,14 @@ BUILD_COMMAND "" INSTALL_COMMAND "" ) - - message(STATUS "${DEBUG}") - + if(DEBUG) ExternalProject_Add_Step( wxWidget-2-9 custom_build DEPENDEES configure DEPENDERS build - COMMAND nmake /nologo -f makefile.vc BUILD=debug MONOLITHIC=1 VENDOR=desura DEBUG_INFO=1 SHARED=1 RUNTIME_LIBS=dynamic + COMMAND ${NMAKE_EXECUTABLE} /nologo -f makefile.vc BUILD=debug MONOLITHIC=1 VENDOR=desura DEBUG_INFO=1 SHARED=1 RUNTIME_LIBS=dynamic WORKING_DIRECTORY /build/msw ) else() @@ -27,7 +25,7 @@ custom_build DEPENDEES configure DEPENDERS build - COMMAND nmake /nologo -f makefile.vc BUILD=release MONOLITHIC=1 VENDOR=desura DEBUG_INFO=1 SHARED=1 RUNTIME_LIBS=dynamic + COMMAND ${NMAKE_EXECUTABLE} /nologo -f makefile.vc BUILD=release MONOLITHIC=1 VENDOR=desura DEBUG_INFO=1 SHARED=1 RUNTIME_LIBS=dynamic WORKING_DIRECTORY /build/msw ) endif() @@ -43,13 +41,11 @@ if(DEBUG) set(wxWidgets_INCLUDE_DIRS ${wxWidgets_INSTALL_DIR}/include ${wxWidgets_INSTALL_DIR}/include/msvc) set(wxWidgets_LIBRARIES ${wxWidgets_LIBRARY_DIRS}/wxmsw29ud.lib) - install(FILES ${wxWidgets_LIBRARY_DIRS}/wxmsw293ud_vc_desura.dll - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(wxWidget-2-9 "${wxWidgets_LIBRARY_DIRS}/wxmsw293ud_vc_desura.dll") else() set(wxWidgets_INCLUDE_DIRS ${wxWidgets_INSTALL_DIR}/include ${wxWidgets_INSTALL_DIR}/include/msvc) set(wxWidgets_LIBRARIES ${wxWidgets_LIBRARY_DIRS}/wxmsw29u.lib) - install(FILES ${wxWidgets_LIBRARY_DIRS}/wxmsw293u_vc_desura.dll - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(wxWidget-2-9 "${wxWidgets_LIBRARY_DIRS}/wxmsw293u_vc_desura.dll") endif() else() @@ -61,7 +57,7 @@ else() set(WX_SETUP_INCLUDE_SUB "gtk2-unicode-2.9-desura") set(WX_SETUP_INCLUDE_SUB_DEBUG ${WX_SETUP_INCLUDE_SUB}) - set(WX_LIB_NAME "libwx_gtk2u_desura-2.9.so.3.0.0") + set(WX_LIB_NAME "libwx_gtk2u_desura-2.9.so.3") set(WX_LIB_NAME_DEBUG ${WX_LIB_NAME}) endif() @@ -80,7 +76,7 @@ BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ./configure --enable-shared --enable-unicode ${CONFIGURE_DEBUG} - --enable-monolithic --with-flavour=desura --enable-threads --with-opengl=no --disable-palette + --enable-monolithic --with-flavour=desura --enable-threads --with-opengl=no --disable-palette2 --disable-joystick --disable-mediactrl --prefix=${wxWidgets_INSTALL_DIR} --enable-permissive ) @@ -88,18 +84,14 @@ if(DEBUG_EXTERNAL) set(wxWidgets_INCLUDE_DIRS ${wxWidgets_INSTALL_DIR}/include/wx-2.9-desura ${wxWidgets_LIBRARY_DIRS}/wx/include/${WX_SETUP_INCLUDE_SUB_DEBUG}) set(wxWidgets_LIBRARIES "${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME_DEBUG}") - install(FILES ${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME} - RENAME libwx_gtk2u_desura-2.9.so.3 - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(wxWidget-2-9 ${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME}) else() set(wxWidgets_INCLUDE_DIRS ${wxWidgets_INSTALL_DIR}/include/wx-2.9-desura ${wxWidgets_LIBRARY_DIRS}/wx/include/${WX_SETUP_INCLUDE_SUB}) set(wxWidgets_LIBRARIES "${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME}") - install(FILES ${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME} - RENAME libwx_gtk2u_desura-2.9.so.3 - DESTINATION ${LIB_INSTALL_DIR}) + install_external_library(wxWidget-2-9 ${wxWidgets_LIBRARY_DIRS}/${WX_LIB_NAME}) endif() set(wxWidgets_BIN_DIR ${wxWidgets_INSTALL_DIR}/bin) set(wxWidgets_CONFIG_EXECUTABLE ${wxWidgets_BIN_DIR}/wx-config) + set_property(TARGET wxWidget-2-9 PROPERTY FOLDER "ThirdParty") endif() -SET_PROPERTY(TARGET wxWidget-2-9 PROPERTY FOLDER "ThirdParty") diff -Nru libcef-desura-291/cmake/modules/CheckOptions.cmake libcef-desura-291/cmake/modules/CheckOptions.cmake --- libcef-desura-291/cmake/modules/CheckOptions.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/CheckOptions.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -6,7 +6,8 @@ if(NOT BUILD_ONLY_CEF) option(BUILD_TESTS "Build various unit tests." ON) - if(BUILD_TESTS) + option(WITH_GTEST "Add GTest support" OFF) + if(BUILD_TESTS OR WITH_GTEST) include(CTest) enable_testing() endif() @@ -19,6 +20,7 @@ if(OFFICIAL_BUILD) set(BRANDING "branding_desura" CACHE STRING "The branding to use for Desura.") + add_definitions(-DDESURA_OFFICIAL_BUILD) else() set(BRANDING "branding_desurium" CACHE STRING "The branding to use for Desura.") diff -Nru libcef-desura-291/cmake/modules/FindNMake.cmake libcef-desura-291/cmake/modules/FindNMake.cmake --- libcef-desura-291/cmake/modules/FindNMake.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/cmake/modules/FindNMake.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -0,0 +1,13 @@ +# - Find nmake executable +# +# NMAKE_EXECUTABLE - where to find nmake/jom +# NMAKE_FOUND - True if nmake is found. + +find_program(NMAKE_EXECUTABLE + NAMES nmake.exe +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(nmake REQUIRED_VARS NMAKE_EXECUTABLE) + +mark_as_advanced(NMAKE_EXECUTABLE) diff -Nru libcef-desura-291/cmake/modules/SetInstallPaths.cmake libcef-desura-291/cmake/modules/SetInstallPaths.cmake --- libcef-desura-291/cmake/modules/SetInstallPaths.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/SetInstallPaths.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -1,7 +1,7 @@ if(UNIX) set(DEFAULT_INSTALL_DIR "/usr/local") elseif(WIN32) - set(DEFAULT_INSTALL_DIR "") + set(DEFAULT_INSTALL_DIR "install") endif() if(MINGW OR WIN32) @@ -10,22 +10,23 @@ set(SYSTEM_ROOT_DIR "/") endif() -if(WIN32) - set(DEFAULT_RUNTIME_LIB_DIR "") -else() - set(DEFAULT_RUNTIME_LIB_DIR "lib") -endif() - set(CMAKE_INSTALL_PREFIX ${DEFAULT_INSTALL_DIR} CACHE STRING "Desura Install Prefix") -set(BINDIR "" - CACHE STRING "Desura Bin Install Dir") -set(RUNTIME_LIBDIR ${DEFAULT_RUNTIME_LIB_DIR} - CACHE STRING "Desura Lib Dir") -set(DATADIR "" - CACHE STRING "Desura Data Install Dir") -set(DESKTOPDIR "/usr/share/applications" - CACHE STRING "Desktop installation directory") + +if(WIN32) + set(BINDIR "") + set(RUNTIME_LIBDIR "bin") + set(DATADIR "data") +else() + set(BINDIR "" + CACHE STRING "Desura Bin Install Dir") + set(RUNTIME_LIBDIR "lib" + CACHE STRING "Desura Lib Dir") + set(DATADIR "" + CACHE STRING "Desura Data Install Dir") + set(DESKTOPDIR "/usr/share/applications" + CACHE STRING "Desktop installation directory") +endif() # set variables used by cmake if(IS_ABSOLUTE ${BINDIR}) @@ -49,12 +50,17 @@ set(DATA_INSOURCE_DIR ${DATADIR}/desura) else() set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${DATADIR}) - file(RELATIVE_PATH DATA_INSOURCE_DIR ${LIB_INSTALL_DIR} ${DATA_INSTALL_DIR}) + if(WIN32) + file(RELATIVE_PATH DATA_INSOURCE_DIR ${BIN_INSTALL_DIR} ${DATA_INSTALL_DIR}) + else() + file(RELATIVE_PATH DATA_INSOURCE_DIR ${LIB_INSTALL_DIR} ${DATA_INSTALL_DIR}) + endif() endif() -if(IS_ABSOLUTE ${DESKTOPDIR}) - set(DESKTOP_INSTALL_DIR ${DESKTOPDIR}) -else() - message(FATAL_ERROR "DESKTOPDIR has to be absolute, anything else doesn't make sense") +if(UNIX AND NOT APPLE) + if(IS_ABSOLUTE ${DESKTOPDIR}) + set(DESKTOP_INSTALL_DIR ${DESKTOPDIR}) + else() + message(FATAL_ERROR "DESKTOPDIR has to be absolute, anything else doesn't make sense") + endif() endif() - diff -Nru libcef-desura-291/cmake/modules/macros.cmake libcef-desura-291/cmake/modules/macros.cmake --- libcef-desura-291/cmake/modules/macros.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/modules/macros.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -1,3 +1,34 @@ +function(add_copy_target_file_step target target_loc) + get_filename_component(target_name "${target_loc}" NAME) + + if(${target_name} MATCHES ".*\\.exe") + if(NOT IS_ABSOLUTE ${BINDIR}) + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${BINDIR}") + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${target_loc}" "${CMAKE_BINARY_DIR}/${BINDIR}/${target_name}") + endif() + elseif(${target_name} MATCHES ".*\\.dll" OR ${target_name} MATCHES ".*\\.so" OR ${target_name} MATCHES ".*\\.dylib" OR ${target_name} MATCHES ".*\\.sh") + if(NOT IS_ABSOLUTE ${RUNTIME_LIBDIR}) + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${RUNTIME_LIBDIR}") + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${target_loc}" "${CMAKE_BINARY_DIR}/${RUNTIME_LIBDIR}/${target_name}") + endif() + elseif(${target_name} MATCHES ".*\\.lib" OR ${target_name} MATCHES ".*\\.a") + # this is a placeholder for desurium API and import libs, also the static preloader for games + else() + # handle UNIX executeables here + # get the extension first + get_filename_component(target_ext ${target_name} EXT) + if("${target_ext}" STREQUAL "") + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${RUNTIME_LIBDIR}") + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${target_loc}" "${CMAKE_BINARY_DIR}/${RUNTIME_LIBDIR}/${target_name}") + endif() + endif() +endfunction() + +function(add_copy_target_step target) + get_target_property(target_loc ${target} LOCATION) + add_copy_target_file_step(${target} ${target_loc}) +endfunction() + macro(add_compiler_flags) set(flags_list "") parse_arguments(ARG "" "C;CXX;DEBUG;RELEASE" ${ARGN}) @@ -28,9 +59,11 @@ endforeach() if(NOT ARG_C AND NOT ARG_CXX OR ARG_C) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flags_list}") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flags_list}") endif() if(NOT ARG_C AND NOT ARG_CXX OR ARG_CXX) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flags_list}") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flags_list}") endif() endif() endmacro() @@ -109,15 +142,134 @@ endif() endmacro() +function(add_gtest_test binaryname arg) + if(WITH_GTEST) + add_test(NAME ${binaryname}_gtest COMMAND "${CMAKE_BINARY_DIR}/${BINDIR}/${binaryname}" ${arg}) + endif() +endfunction() + +function(__internal_install_binary target category create_wrapper) + add_copy_target_step(${target}) + set_property(TARGET ${target} PROPERTY FOLDER "${category}") + + if(WIN32) + install(TARGETS ${target} + RUNTIME DESTINATION "${BIN_INSTALL_DIR}") + else() + install(TARGETS ${target} + RUNTIME DESTINATION "${LIB_INSTALL_DIR}") + if(create_wrapper) + # install script to launch binary + set(CURRENT_TARGET "${target}") + configure_file("${CMAKE_SCRIPT_PATH}/run.sh" "${CMAKE_BINARY_DIR}/${CURRENT_TARGET}" @ONLY) + install(FILES "${CMAKE_BINARY_DIR}/${CURRENT_TARGET}" + DESTINATION "${BIN_INSTALL_DIR}" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) + endif() + endif() +endfunction() + function(install_executable target) - set(CURRENT_TARGET "${target}") - install(TARGETS "${CURRENT_TARGET}" - DESTINATION "${LIB_INSTALL_DIR}") - - configure_file("${CMAKE_SCRIPT_PATH}/run.sh" "${CMAKE_GEN_SRC_DIR}/build_out/${CURRENT_TARGET}" @ONLY) - install(FILES "${CMAKE_GEN_SRC_DIR}/build_out/${CURRENT_TARGET}" - DESTINATION "${BIN_INSTALL_DIR}" + __internal_install_binary(${target} "Executable" TRUE) +endfunction() + +function(install_tool target) + __internal_install_binary(${target} "Tools" TRUE) +endfunction() + +function(install_internal_tool target) + __internal_install_binary(${target} "Tools" FALSE) +endfunction() + +function(install_internal_tool_script file) + install(FILES ${file} + DESTINATION ${LIB_INSTALL_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE) + WORLD_READ WORLD_EXECUTE + ) endfunction() + +function(install_external_library target) + foreach(file ${ARGN}) + install(CODE "get_filename_component(resolved_file \"${file}\" REALPATH)\n get_filename_component(file_name \"${file}\" NAME)\n file(INSTALL DESTINATION ${LIB_INSTALL_DIR} TYPE FILE RENAME \${file_name} FILES \"\${resolved_file}\" )") + set_property(TARGET ${target} PROPERTY FOLDER "ThirdParty") + add_copy_target_file_step(${target} "${file}") + endforeach() +endfunction() + +function(install_third_party_library target) + install(TARGETS ${target} DESTINATION ${LIB_INSTALL_DIR}) + set_property(TARGET ${target} PROPERTY FOLDER "ThirdParty") + add_copy_target_step(${target}) +endfunction() + +function(install_library target) + # dlls are runtime targets, import libs are archive, but we don't need them + install(TARGETS "${target}" + RUNTIME DESTINATION "${LIB_INSTALL_DIR}" + LIBRARY DESTINATION "${LIB_INSTALL_DIR}") + add_copy_target_step(${target}) + set_property(TARGET ${target} PROPERTY FOLDER "Shared") +endfunction() + +macro(generate_current_data_copy_target target) + file(RELATIVE_PATH __rel_current_dir "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + set(${target} "internal_data_copy_${__rel_current_dir}") +endmacro() + +function(__create__data_copy_target) + generate_current_data_copy_target(target) + if(NOT TARGET ${target}) + add_custom_target(${target} ALL) + endif() +endfunction() + +function(add_copy_data_file_step file new_name path) + if(NOT IS_ABSOLUTE "${DATADIR}") + generate_current_data_copy_target(target) + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "${CMAKE_BINARY_DIR}/${DATADIR}/${path}/${new_name}" COMMENT "copy ${file} to ${DATADIR}/${path}/${new_name}") + endif() +endfunction() + +function(install_data_files target_path) + __create__data_copy_target() + foreach(file ${ARGN}) + get_filename_component(file_name "${file}" NAME) + set(new_name "${file_name}") + # remove _win and _lin stuff + if("${file_name}" MATCHES ".*_[wl]in.*") + string(REGEX REPLACE "_[wl]in" "" new_name "${file_name}") + endif() + add_copy_data_file_step("${file}" "${new_name}" "${target_path}") + install(FILES "${file}" RENAME "${new_name}" DESTINATION "${DATA_INSTALL_DIR}/${target_path}") + endforeach() +endfunction() + +function(install_data_directories target_path) + __create__data_copy_target() + foreach(dir ${ARGN}) + get_filename_component(target_dir_name "${dir}" NAME) + file(GLOB_RECURSE files "${dir}" "${dir}/*") + foreach(file ${files}) + get_filename_component(file_name "${file}" NAME) + file(RELATIVE_PATH rel_file "${dir}" "${file}") + get_filename_component(rel_path "${rel_file}" PATH) + add_copy_data_file_step("${file}" "${file_name}" "${target_path}/${target_dir_name}/${rel_path}") + endforeach() + install(DIRECTORY ${dir} + DESTINATION "${DATA_INSTALL_DIR}/${target_path}") + endforeach() +endfunction() + +macro(LinkWithGTest target) + if(WITH_GTEST) + if(MSVC11) + add_definitions(-D_VARIADIC_MAX=10) + endif() + include_directories(${GTEST_INCLUDE_DIRS}) + target_link_libraries(${target} ${GTEST_LIBRARIES}) + endif() +endmacro() diff -Nru libcef-desura-291/cmake/patches/cef.patch libcef-desura-291/cmake/patches/cef.patch --- libcef-desura-291/cmake/patches/cef.patch 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/patches/cef.patch 2013-10-17 18:16:33.000000000 +0000 @@ -5068,7 +5068,7 @@ +#ifdef OS_LINUX + // Load only the libraries we want Desura to use -+ media::InitializeMediaLibrary(FilePath("./cefmedia/")); ++ media::InitializeMediaLibrary(FilePath("./")); + WebKit::WebRuntimeFeatures::enableMediaPlayer(true); +#else // Load libraries for media and enable the media player. diff -Nru libcef-desura-291/cmake/platform/win32/platform.cmake libcef-desura-291/cmake/platform/win32/platform.cmake --- libcef-desura-291/cmake/platform/win32/platform.cmake 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/platform/win32/platform.cmake 2013-10-17 18:16:33.000000000 +0000 @@ -22,6 +22,11 @@ /ignore:4221) add_compiler_flags(/wd4996 /MP) +# jom needs /FS msvc12 for parralel builds +if(MSVC12) + add_compiler_flags(/FS) +endif() + set(WIN_TARGET 0x0502) # Windows XP SP2 set(WIN_SDK_MIN 0x0600) # Windows Vista set(WIN_IE_VERSION 0x0603) # IE 6 SP2 @@ -36,3 +41,19 @@ set(64BIT FALSE) message("-- detected 32bit") endif() + +macro(SetSharedRuntime target) + if(DEBUG) + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MDd") + else() + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MD") + endif() +endmacro() + +macro(SetStaticRuntime target) + if(DEBUG) + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MTd") + else() + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MT") + endif() +endmacro() diff -Nru libcef-desura-291/cmake/scripts/Patch.bat libcef-desura-291/cmake/scripts/Patch.bat --- libcef-desura-291/cmake/scripts/Patch.bat 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/scripts/Patch.bat 2013-10-17 18:16:33.000000000 +0000 @@ -1,5 +1,7 @@ -"@PATCH_EXECUTABLE@" -p0 -N -i %1 -REM if we hit one means the patch is all ready applied -IF ["%errorlevel%"]==["1"] ( - SET errorlevel=0 -) \ No newline at end of file +@echo off +REM try a revert first +"@PATCH_EXECUTABLE@" -R --dry-run -p0 -N -i %1 +if errorlevel 1 ( + "@PATCH_EXECUTABLE@" -p0 -N -i %1 +) +REM else we are lucky, patch was already applied and we can ignore everything diff -Nru libcef-desura-291/cmake/scripts/run.sh libcef-desura-291/cmake/scripts/run.sh --- libcef-desura-291/cmake/scripts/run.sh 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/cmake/scripts/run.sh 2013-10-17 18:16:33.000000000 +0000 @@ -12,11 +12,11 @@ export LD_LIBRARY_PATH="@RUNTIME_LIB_INSOURCE_DIR@/" # also add our runtime lib directory to path export PATH="$LD_LIBRARY_PATH:$PATH" - @RUNTIME_LIB_INSOURCE_DIR@/@CURRENT_TARGET@ $@ + $DESURA_DEBUGGERS @RUNTIME_LIB_INSOURCE_DIR@/@CURRENT_TARGET@ $@ else export LD_LIBRARY_PATH="$DIR/@RUNTIME_LIB_INSOURCE_DIR@/" # also add our runtime lib directory to path export PATH="$LD_LIBRARY_PATH:$PATH" - $DIR/@RUNTIME_LIB_INSOURCE_DIR@/@CURRENT_TARGET@ $@ + $DESURA_DEBUGGERS $DIR/@RUNTIME_LIB_INSOURCE_DIR@/@CURRENT_TARGET@ $@ fi diff -Nru libcef-desura-291/debian/changelog libcef-desura-291/debian/changelog --- libcef-desura-291/debian/changelog 2013-10-07 16:18:56.000000000 +0000 +++ libcef-desura-291/debian/changelog 2013-10-17 18:17:25.000000000 +0000 @@ -1,5 +1,5 @@ -libcef-desura (1:291-makson1~saucy2) saucy; urgency=low +libcef-desura (1:291-makson2~saucy1) saucy; urgency=low * New Upstream Release - -- Tomasz Makarewicz Mon, 07 Oct 2013 09:26:55 +0200 + -- Tomasz Makarewicz Thu, 17 Oct 2013 20:17:14 +0200 diff -Nru libcef-desura-291/debian/changelog~ libcef-desura-291/debian/changelog~ --- libcef-desura-291/debian/changelog~ 2013-10-07 07:27:06.000000000 +0000 +++ libcef-desura-291/debian/changelog~ 2013-08-24 12:40:23.000000000 +0000 @@ -1,5 +1,5 @@ -libcef-desura (1:291-makson1~saucy1) saucy; urgency=low +libcef-desura (1:291-makson1~precise1) precise; urgency=low * New Upstream Release - -- Tomasz Makarewicz Mon, 07 Oct 2013 09:26:55 +0200 + -- Tomasz Makarewicz Sat, 24 Aug 2013 14:38:34 +0200 diff -Nru libcef-desura-291/debian/copyright libcef-desura-291/debian/copyright --- libcef-desura-291/debian/copyright 2013-10-07 07:27:24.000000000 +0000 +++ libcef-desura-291/debian/copyright 2013-10-17 18:17:48.000000000 +0000 @@ -1,5 +1,5 @@ This package was debianised by Tomasz Makarewicz on -Mon, 07 Oct 2013 09:26:55 +0200 +Thu, 17 Oct 2013 20:17:14 +0200 It was downloaded from: diff -Nru libcef-desura-291/src/CMakeLists.txt libcef-desura-291/src/CMakeLists.txt --- libcef-desura-291/src/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/CMakeLists.txt 2013-10-17 18:16:33.000000000 +0000 @@ -14,32 +14,29 @@ set(BRANDING_DIR ${BIN_INCLUDE_DIR}/branding) set(APP ${BRANDING_DIR}/data/themes/default/images/app) -install(FILES ${BRANDING_DIR}/data/desura_lin.png - DESTINATION ${DATA_INSTALL_DIR} - RENAME desura.png -) -install(FILES ${BRANDING_DIR}/data/themes/default/images/html/default/logo.png - DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/html/default/) -install(FILES ${APP}/about_logo.png - ${APP}/icon_download.png - ${APP}/signin_banner.png - DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app/ -) - -if(WIN32) - install(FILES ${APP}/menu_button_hover_win.png RENAME menu_button_hover.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) - install(FILES ${APP}/menu_button_nonactive_win.png RENAME menu_button_nonactive.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) - install(FILES ${APP}/menu_button_win.png RENAME menu_button.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) +install_data_files("" ${BRANDING_DIR}/data/desura_lin.png) +install_data_files("" ${BRANDING_DIR}/data/desura_win.ico) +install_data_files(themes/default/images/html/default ${BRANDING_DIR}/data/themes/default/images/html/default/logo.png) +install_data_files(themes/default/images/app ${APP}/about_logo.png ${APP}/icon_download.png ${APP}/signin_banner.png) + +if(WIN32) + install_data_files(themes/default/images/app ${APP}/menu_button_hover_win.png) + install_data_files(themes/default/images/app ${APP}/menu_button_nonactive_win.png) + install_data_files(themes/default/images/app ${APP}/menu_button_win.png) else() - install(FILES ${APP}/menu_button_hover_lin.png RENAME menu_button_hover.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) - install(FILES ${APP}/menu_button_nonactive_lin.png RENAME menu_button_nonactive.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) - install(FILES ${APP}/menu_button_lin.png RENAME menu_button.png DESTINATION ${DATA_INSTALL_DIR}/themes/default/images/app) + install_data_files(themes/default/images/app ${APP}/menu_button_hover_lin.png) + install_data_files(themes/default/images/app ${APP}/menu_button_nonactive_lin.png) + install_data_files(themes/default/images/app ${APP}/menu_button_lin.png) endif() ############################################################################### # do final steps for setting up the desura build environment ############################################################################### +if (WIN32) + set(DESURA_EXE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/executable/bootloader_win/code) +endif() + set(GLOBAL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) set(COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/common) @@ -76,8 +73,12 @@ add_subdirectory(static/scriptengine) add_subdirectory(static/umcf) add_subdirectory(static/util) + if(WIN32) add_subdirectory(static/util_bootloader) + if(OFFICIAL_BUILD) + add_subdirectory(static/util_bootloader_official) + endif() endif() add_subdirectory(static/util_fs) add_subdirectory(static/util_thread) @@ -108,6 +109,7 @@ add_subdirectory(executable/service_win) add_subdirectory(executable/toolhelper) add_subdirectory(executable/utilhelper) + add_subdirectory(executable/dumpgen_win) else() add_subdirectory(executable/bootloader_lin) add_subdirectory(executable/crashdlg_lin) @@ -228,3 +230,7 @@ add_dependencies(scriptcore v8) add_dependencies(scriptengine v8) endif() + +if(NOT GTEST_FOUND AND WITH_GTEST) + add_dependencies(uicore gtest) +endif() diff -Nru libcef-desura-291/src/common/CMakeLists.txt libcef-desura-291/src/common/CMakeLists.txt --- libcef-desura-291/src/common/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/common/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -11,5 +11,8 @@ target_link_libraries(gcJSBase util ) +if(WIN32) + SetSharedRuntime(gcJSBase) +endif() -SET_PROPERTY(TARGET gcJSBase PROPERTY FOLDER "Common") \ No newline at end of file +SET_PROPERTY(TARGET gcJSBase PROPERTY FOLDER "Common") diff -Nru libcef-desura-291/src/executable/bittest/CMakeLists.txt libcef-desura-291/src/executable/bittest/CMakeLists.txt --- libcef-desura-291/src/executable/bittest/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bittest/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -8,5 +8,4 @@ add_executable(desura_bittest ${Sources}) -install(TARGETS desura_bittest - DESTINATION "${LIB_INSTALL_DIR}") +install_internal_tool(desura_bittest) diff -Nru libcef-desura-291/src/executable/bootloader_lin/CMakeLists.txt libcef-desura-291/src/executable/bootloader_lin/CMakeLists.txt --- libcef-desura-291/src/executable/bootloader_lin/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_lin/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -22,4 +22,4 @@ ) install_executable(desura) - +add_gtest_test(desura --unittests) diff -Nru libcef-desura-291/src/executable/bootloader_lin/code/DesuraMain.cpp libcef-desura-291/src/executable/bootloader_lin/code/DesuraMain.cpp --- libcef-desura-291/src/executable/bootloader_lin/code/DesuraMain.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_lin/code/DesuraMain.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -141,13 +141,16 @@ return -1; bool usingGDB = false; - +#ifdef WITH_GTEST + bool runGtest = false; +#endif + #ifdef DESURA_OFFICAL_BUILD bool forceUpdate = false; bool skipUpdate = false; bool testDownload = false; bool testInstall = false; -#endif +#endif for (int x=0; xrunUnitTests(m_Argc, m_Argv); + } +#endif + if (!m_pUICore->singleInstantCheck()) { sendArgs(); return 0; } - + #ifndef DEBUG if (!loadCrashHelper()) return -1; #endif m_pUICore->disableSingleInstanceLock(); - + if (usingGDB) { ERROR_OUTPUT("Running with GDB -- Not setting up dump handler"); @@ -223,7 +238,7 @@ m_MDumpHandle.showMessageBox(true); m_MDumpHandle.setCrashCallback(&MainApp::onCrash); } - + return m_pUICore->initWxWidgets(m_Argc, m_Argv); } @@ -301,7 +316,7 @@ if (!path) { fprintf(stderr, "on crash path is null!"); - return; + return false; } else { diff -Nru libcef-desura-291/src/executable/bootloader_win/CMakeLists.txt libcef-desura-291/src/executable/bootloader_win/CMakeLists.txt --- libcef-desura-291/src/executable/bootloader_win/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -4,19 +4,13 @@ ${COMMON_INCLUDE_DIRS}/service_pipe ${IPC_PIPE_INCLUDE_DIRS} ${TINYXML_INCLUDEDIR} + ${UTIL_BOOTLOADER_OFFICIAL_INCLUDE_DIRS} + ${UTIL_BOOTLOADER_INCLUDE_DIRS} ) configure_file(RES/desura_exe.rc ${RC_DIR}/desura_exe.rc @ONLY) -file(GLOB Sources code/AppUpdateInstall.cpp - code/Log.cpp - code/UpdateFunctions.cpp - ${RC_DIR}/desura_exe.rc) - -if(MFC_FOUND) - file(GLOB AdditionalSources code/DesuraMain.cpp) -else() - file(GLOB AdditionalSources code/DesuraMainMingw.cpp) -endif() +file(GLOB Sources code/*.cpp ${RC_DIR}/desura_exe.rc) + set(Sources "${Sources};${AdditionalSources}") add_definitions(-D_WINDOWS @@ -27,21 +21,23 @@ -DNO_UTIL_FS ) -set(CMAKE_MFC_FLAG 2) #this should really be 1 + +if (OFFICIAL_BUILD) + set(OFFICIAL_DEP "util_bootloader_official_s") + add_definitions(-DDESURA_OFFICAL_BUILD) +endif() add_executable(desura WIN32 ${Sources} ${SERVICE_PIPE_IPCUPDATEMAIN}) target_link_libraries(desura - ipc_pipe - threads - util - util_bootloader + ipc_pipe_s + threads_s + util_s + util_bootloader_s + mdump_s + ${OFFICIAL_DEP} comctl32 - mdump ) -install(TARGETS desura - DESTINATION "${BIN_INSTALL_DIR}") +SetStaticRuntime(desura) -CopyTargetFiles(desura) - -SET_PROPERTY(TARGET desura PROPERTY FOLDER "Executable") \ No newline at end of file +install_executable(desura) diff -Nru libcef-desura-291/src/executable/bootloader_win/RES/desura_exe.rc libcef-desura-291/src/executable/bootloader_win/RES/desura_exe.rc --- libcef-desura-291/src/executable/bootloader_win/RES/desura_exe.rc 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/RES/desura_exe.rc 2013-10-17 18:16:34.000000000 +0000 @@ -1,59 +1,54 @@ // Microsoft Visual C++ generated resource script. // -#include "resource.h" +//#include "resource.h" -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) -#include "afxres.h" +#ifdef DESURA_OFFICAL_BUILD +#include "resource.h" #endif -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS +#include "Winuser.h" ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources -#if (!defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)) && !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 +//#ifdef _WIN32 +// LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +// #pragma code_page(1252) +//#endif //_WIN32 -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""RES\\desura_exe.rc\0" - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END +#ifdef APSTUDIO_INVOKED + ///////////////////////////////////////////////////////////////////////////// + // + // TEXTINCLUDE + // + + 1 TEXTINCLUDE + BEGIN + //"resource.h\0" + END + + 2 TEXTINCLUDE + BEGIN + "#include ""afxres.h""\0" + END + + 3 TEXTINCLUDE + BEGIN + "#include ""RES\\desura_exe.rc\0" + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" + END #endif // APSTUDIO_INVOKED @@ -83,6 +78,8 @@ // Dialog // +#ifdef DESURA_OFFICAL_BUILD + IDD_UPDATEFORM_DIALOG DIALOGEX 0, 0, 276, 135 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX EXSTYLE WS_EX_APPWINDOW @@ -100,35 +97,33 @@ IDB_BITMAP1 BITMAP "@BRANDING_DIR@/spash.bmp" IDB_BITMAP2 BITMAP "loadingbar.bmp" +#endif + ///////////////////////////////////////////////////////////////////////////// // // RT_MANIFEST // IDR_RT_MANIFEST1 RT_MANIFEST "rt_manif.bin" -#endif // English (U.S.) resources + ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#pragma code_page(1252) -#include "@BRANDING_DIR@/desura_exe.rc2" // non-Microsoft Visual C++ edited resources -#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) -#include "afxres.rc" // Standard components -#endif -#endif -///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// + // + // Generated from the TEXTINCLUDE 3 resource. + // + #define _AFX_NO_SPLITTER_RESOURCES + #define _AFX_NO_OLE_RESOURCES + #define _AFX_NO_TRACKER_RESOURCES + #define _AFX_NO_PROPERTY_RESOURCES + + LANGUAGE 9, 1 + #pragma code_page(1252) + #include "@BRANDING_DIR@/desura_exe.rc2" // non-Microsoft Visual C++ edited resources + + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff -Nru libcef-desura-291/src/executable/bootloader_win/RES/resource.h libcef-desura-291/src/executable/bootloader_win/RES/resource.h --- libcef-desura-291/src/executable/bootloader_win/RES/resource.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/RES/resource.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by desura_exe.rc -// -#define IDI_ICON 1 -#define IDD_UPDATEFORM_DIALOG 102 -#define IDR_RT_MANIFEST1 129 -#define IDB_BITMAP1 134 -#define IDB_BITMAP2 135 -#define IDB_BITMAP3 136 -#define IDC_PROGRESS1 1000 -#define IDC_BUTTON1 1001 -#define IDC_STATIC1 1002 -#define IDC_SPLASH 1002 -#define IDC_PROGRESS 1003 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 138 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff -Nru libcef-desura-291/src/executable/bootloader_win/code/DesuraMain.cpp libcef-desura-291/src/executable/bootloader_win/code/DesuraMain.cpp --- libcef-desura-291/src/executable/bootloader_win/code/DesuraMain.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/code/DesuraMain.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -16,14 +16,11 @@ along with this program. If not, see */ -#include "stdafx.h" - #include "Common.h" - -#include "resource.h" +#include "DesuraWinApp.h" #include "UtilBootloader.h" -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD #include "AppUpdateInstall.h" extern UINT DownloadFilesForTest(); @@ -92,16 +89,14 @@ NULL }; -class BootLoader : public CWinApp +class BootLoader : public Desurium::CDesuraWinApp { public: BootLoader(); ~BootLoader(); - BOOL InitInstance(); - int ExitInstance(); - BOOL PreTranslateMessage(MSG *msg); - BOOL OnIdle(LONG lCount); + void InitInstance() override; + int ExitInstance() override; MiniDumpGenerator m_MDumpHandle; @@ -142,7 +137,7 @@ { m_MDumpHandle.showMessageBox(true); - AfxEnableMemoryTracking(FALSE); + //AfxEnableMemoryTracking(FALSE); InitCommonControls(); hasAdminRights = false; @@ -158,7 +153,7 @@ delete [] g_szArgs; } -BOOL BootLoader::InitInstance() +void BootLoader::InitInstance() { BootLoaderUtil::CMDArgs args(m_lpCmdLine); @@ -166,9 +161,8 @@ BootLoaderUtil::WaitForDebugger(); BootLoaderUtil::SetCurrentDir(); - CWinApp::InitInstance(); -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD CheckForBadUninstaller(); #endif @@ -180,22 +174,22 @@ a.replace(pos, 8, ""); BootLoaderUtil::Restart(a.c_str(), false); - return FALSE; + return; } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD if (args.hasArg("testinstall")) { m_bRetCode = true; m_iRetCode = InstallFilesForTest(); - return FALSE; + return; } if (args.hasArg("testdownload")) { m_bRetCode = true; m_iRetCode = DownloadFilesForTest(); - return FALSE; + return; } #endif @@ -210,33 +204,33 @@ //need to wait for service to start Sleep(15*1000); BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD #ifdef DEBUG if (args.hasArg("debugupdater")) { INT_PTR nResponse = DisplayUpdateWindow(-1); - return FALSE; + return; } if (args.hasArg("debuginstall")) { McfUpdate(); - return FALSE; + return; } if (args.hasArg("debugdownload")) { FullUpdate(); - return FALSE; + return; } if (args.hasArg("debugcheck")) { CheckInstall(); - return FALSE; + return; } #endif #endif @@ -252,7 +246,7 @@ if (osid == WINDOWS_PRE2000) { ::MessageBox(NULL, PRODUCT_NAME " needs Windows XP or better to run.", PRODUCT_NAME " Error: Old Windows", MB_OK); - return FALSE; + return; } else if (osid == WINDOWS_XP || osid == WINDOWS_XP64) { @@ -274,7 +268,7 @@ if (BootLoaderUtil::CheckForOtherInstances(m_hInstance)) { sendArgs(); - return FALSE; + return; } else { @@ -287,24 +281,24 @@ { a.replace(pos+9, 9, "remove"); BootLoaderUtil::RestartAsNormal(a.c_str()); - return FALSE; + return; } } } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD if (args.hasArg("forceupdate")) { if (!hasAdminRights) { restartAsAdmin(UPDATE_FORCED); - return FALSE; + return; } else { FullUpdate(); BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } } #endif @@ -323,7 +317,7 @@ Log("Updating from MCF.\n"); McfUpdate(); BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } else if (nu == UPDATE_SERVICE_PATH) { @@ -339,7 +333,7 @@ if (!hasAdminRights) { restartAsAdmin(nu); - return FALSE; + return; } else if (nu == UPDATE_SERVICE_LOCATION || nu == UPDATE_SERVICE_HASH) { @@ -351,35 +345,37 @@ if (FixServiceDisabled()) BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } else { Log("Full update [%s].\n", g_UpdateReasons[nu]); FullUpdate(); BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } } if (hasAdminRights && !(osid == WINDOWS_XP || osid == WINDOWS_XP64)) { BootLoaderUtil::RestartAsNormal("-wait"); - return FALSE; + return; } #endif loadUICore(); if (!m_pUICore) - return FALSE; + return; - bool res = m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); - - if (res) - m_pMainWnd = new BootLoaderUtil::CDummyWindow(m_pUICore->getHWND()); + if (args.hasArg("unittests")) + { + m_iRetCode = m_pUICore->runUnitTests(args.getArgc(), const_cast(args.getArgv())); + m_bRetCode = true; + return; + } - return res?TRUE:FALSE; + m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); } void BootLoader::restartAsAdmin(int needupdate) @@ -418,9 +414,7 @@ int BootLoader::ExitInstance() { - delete m_pMainWnd; - - int ret = CWinApp::ExitInstance(); + int ret = 0; if (m_pUICore) m_pUICore->exitApp(&ret); @@ -443,39 +437,22 @@ return ret; } -// Override this to provide wxWidgets message loop compatibility -BOOL BootLoader::PreTranslateMessage(MSG *msg) -{ - if (m_pUICore && m_pUICore->preTranslateMessage(msg) ) - return TRUE; - - return CWinApp::PreTranslateMessage(msg); -} - -BOOL BootLoader::OnIdle(LONG lCount) -{ - if (m_pUICore) - return m_pUICore->onIdle(); - - return FALSE; -} - void BootLoader::preReadImages() { - BootLoaderUtil::PreReadImage(".\\uicore.dll"); - BootLoaderUtil::PreReadImage(".\\webcore.dll"); - BootLoaderUtil::PreReadImage(".\\usercore.dll"); - BootLoaderUtil::PreReadImage(".\\mcfcore.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\uicore.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\webcore.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\usercore.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\mcfcore.dll"); #ifdef DEBUG - BootLoaderUtil::PreReadImage(".\\wxmsw290ud_vc_desura.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\wxmsw293ud_vc_desura.dll"); #else - BootLoaderUtil::PreReadImage(".\\wxmsw290u_vc_desura.dll"); + BootLoaderUtil::PreReadImage(".\\bin\\wxmsw293u_vc_desura.dll"); #endif } void BootLoader::loadUICore() { - if (!BootLoaderUtil::SetDllDir(".")) + if (!BootLoaderUtil::SetDllDir(".\\bin")) { ::MessageBox(NULL, "Failed to set the DLL path to the bin folder.", PRODUCT_NAME ": ERROR!", MB_OK); exit(-100); diff -Nru libcef-desura-291/src/executable/bootloader_win/code/DesuraMainMingw.cpp libcef-desura-291/src/executable/bootloader_win/code/DesuraMainMingw.cpp --- libcef-desura-291/src/executable/bootloader_win/code/DesuraMainMingw.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/code/DesuraMainMingw.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2012 Karol Herbst - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include - -#include - -#include - -#include "SharedObjectLoader.h" -#include "UICoreI.h" -#include "UtilBootloader.h" - -class BootLoader -{ -public: - BootLoader(int argc, char** argv); - BOOL InitInstance(); - -protected: -// bool sendArgs(); - void loadUICore(); - -// void restartAsAdmin(int needupdate); - void preReadImages(); - -private: - SharedObjectLoader m_hUICore; - UICoreI* m_pUICore; - - bool m_bRetCode; - int m_iRetCode; - bool hasAdminRights; - - int argc; - char** argv; -}; - -BootLoader::BootLoader(int argc, char** argv) -: argc(argc), argv(argv){}; - -BOOL BootLoader::InitInstance() -{ - // TODO: parse arguments - unsigned int osid = BootLoaderUtil::GetOSId(); - // TODO: implement os checks, arguments, admin mode, etc... - - loadUICore(); - - if (!m_pUICore) - return FALSE; - - bool res = m_pUICore->initWxWidgets(GetModuleHandle(NULL), 0, argc, argv); - - /*if (res) - m_pMainWnd = new BootLoaderUtil::CDummyWindow(m_pUICore->getHWND()); - - return res?TRUE:FALSE;*/ - return TRUE; -} - -void BootLoader::preReadImages() -{ -#ifdef DEBUG - BootLoaderUtil::PreReadImage(".\\bin\\uicore-d.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\webcore-d.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\usercore-d.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\mcfcore-d.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\wxmsw293ud_gcc_custom.dll"); -#else - BootLoaderUtil::PreReadImage(".\\bin\\uicore.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\webcore.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\usercore.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\mcfcore.dll"); - BootLoaderUtil::PreReadImage(".\\bin\\wxmsw293u_gcc_custom.dll"); -#endif -} - -void BootLoader::loadUICore() -{ - if (!BootLoaderUtil::SetDllDir(".\\bin")) - { - ::MessageBox(NULL, "Failed to set the DLL path to the bin folder.", PRODUCT_NAME ": ERROR!", MB_OK); - exit(-100); - } - - preReadImages(); - -#ifdef DEBUG - const char* dllname = "libuicore-d.dll"; -#else - const char* dllname = "libuicore.dll"; -#endif - - if (!m_hUICore.load(dllname)) - { - DWORD err = GetLastError(); - std::cout << std::hex << HRESULT_FROM_WIN32(err) << std::endl; - ::MessageBox(NULL, "Failed to load uicore.dll", PRODUCT_NAME ": ERROR!", MB_OK); - exit(-200); - } - - UICoreFP UICoreGetInterface = m_hUICore.getFunction("GetInterface"); - - if (!UICoreGetInterface) - { - ::MessageBox(NULL, "Failed to load wxWidgets mappings in uicore.dll", PRODUCT_NAME ": ERROR!", MB_OK); - exit(-500); - } - - m_pUICore = UICoreGetInterface(); - - char version[100] = {0}; - _snprintf_s(version, 100, _TRUNCATE, "%d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILDNO, VERSION_EXTEND); - - m_pUICore->setDesuraVersion(version); - //m_pUICore->setRestartFunction(&UiCoreRestart); - //m_pUICore->setCrashDumpSettings(&SetDumpArgs); - //m_pUICore->setCrashDumpLevel(&SetDumpLevel); -} - -int main(int argc, char** argv) -{ - BootLoader bootloader(argc, argv); - bootloader.InitInstance(); -} diff -Nru libcef-desura-291/src/executable/bootloader_win/code/UpdateFunctions.cpp libcef-desura-291/src/executable/bootloader_win/code/UpdateFunctions.cpp --- libcef-desura-291/src/executable/bootloader_win/code/UpdateFunctions.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/bootloader_win/code/UpdateFunctions.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -34,7 +34,7 @@ void SetRegValues(); void InstallService(); -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD int NeedUpdateNonGpl(); #endif @@ -69,7 +69,7 @@ return false; } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD extern FILE* g_pUpdateLog; #endif @@ -117,7 +117,7 @@ Safe::snprintf(regname, 255, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\%s\\Start", SERVICE_NAME); int res = UTIL::WIN::getRegValueInt(regname, true); -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD if (g_pUpdateLog) fprintf(g_pUpdateLog, "Status: %d\n", res); #endif @@ -130,7 +130,7 @@ int NeedUpdate() { -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD int res = NeedUpdateNonGpl(); if (res != UPDATE_NONE) @@ -326,5 +326,7 @@ return true; } +#ifndef DESURA_OFFICAL_BUILD void McfUpdate() {} void FullUpdate() {} +#endif diff -Nru libcef-desura-291/src/executable/crashdlg_lin/CMakeLists.txt libcef-desura-291/src/executable/crashdlg_lin/CMakeLists.txt --- libcef-desura-291/src/executable/crashdlg_lin/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/crashdlg_lin/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -13,5 +13,4 @@ ${SQLITE_LIBRARIES} ) -install(TARGETS crashdlg - DESTINATION "${LIB_INSTALL_DIR}") +install_internal_tool(crashdlg) diff -Nru libcef-desura-291/src/executable/desura_browserhost/CMakeLists.txt libcef-desura-291/src/executable/desura_browserhost/CMakeLists.txt --- libcef-desura-291/src/executable/desura_browserhost/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/desura_browserhost/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -27,8 +27,8 @@ wintrust ) -install(TARGETS desura_browserhost - DESTINATION "${BIN_INSTALL_DIR}") +if(WIN32) + SetSharedRuntime(desura_browserhost) +endif() -CopyTargetFiles(desura_browserhost) -SET_PROPERTY(TARGET desura_browserhost PROPERTY FOLDER "Executable") \ No newline at end of file +install_executable(desura_browserhost) diff -Nru libcef-desura-291/src/executable/desura_browserhost/RES/desura_browserhost.rc libcef-desura-291/src/executable/desura_browserhost/RES/desura_browserhost.rc --- libcef-desura-291/src/executable/desura_browserhost/RES/desura_browserhost.rc 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/desura_browserhost/RES/desura_browserhost.rc 2013-10-17 18:16:34.000000000 +0000 @@ -2,23 +2,7 @@ // #include "resource.h" -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 +#include "Winuser.h" #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -63,9 +47,6 @@ // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ICON ICON "@BRANDING_DIR@/desura.ico" - - -#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -84,7 +65,6 @@ LANGUAGE 9, 1 #pragma code_page(1252) #include "@BRANDING_DIR@/desura_browserhost.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components #endif ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff -Nru libcef-desura-291/src/executable/dumpgen_win/CMakeLists.txt libcef-desura-291/src/executable/dumpgen_win/CMakeLists.txt --- libcef-desura-291/src/executable/dumpgen_win/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,24 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/code + ${CMAKE_CURRENT_SOURCE_DIR}/RES + ${UTIL_BOOTLOADER_INCLUDE_DIRS} + ${COMMON_INCLUDE_DIRS} + ${UTIL_INCLUDE_DIRS} +) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RES/dumpgen.rc ${RC_DIR}/dumpgen.rc @ONLY) +file(GLOB Sources code/*.cpp ${RC_DIR}/dumpgen.rc) + +add_definitions(-D_WINDOWS -DDONTUSE_PCH) +add_executable(dumpgen WIN32 ${Sources}) + +target_link_libraries(dumpgen + util_bootloader_s + util_s + mdump_s + comctl32 + ${OFFICIAL_DEP} +) +SetStaticRuntime(dumpgen) + +install_tool(dumpgen) diff -Nru libcef-desura-291/src/executable/dumpgen_win/RES/dumpgen.rc libcef-desura-291/src/executable/dumpgen_win/RES/dumpgen.rc --- libcef-desura-291/src/executable/dumpgen_win/RES/dumpgen.rc 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/RES/dumpgen.rc 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,95 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" +#include "Winuser.h" +#include "winres.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "@BRANDING_DIR@/desura.ico" +IDI_ICONSMALL ICON "@BRANDING_DIR@/desura_16.ico" +IDI_ICONNORMAL ICON "@BRANDING_DIR@/desura.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,0,0 + PRODUCTVERSION 0,0,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Desura Pty Ltd" + VALUE "FileDescription", "Desura Crash Dump Generator" + VALUE "InternalName", "dumpgen" + VALUE "LegalCopyright", "(C) Copyright Desura Pty Ltd" + VALUE "OriginalFilename", "dumpgen.exe" + VALUE "ProductName", "Desura" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 260, 60 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Desura Crash" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Restart Desura",IDOK,50,42,65,15 + PUSHBUTTON "Force Update",IDYES,120,42,65,15 + PUSHBUTTON "Exit",IDCANCEL,190,42,65,15 + LTEXT "An error has occurred that is preventing Desura from running correctly. Restarting Desura should allow you to continue, otherwise you can clean your Desura install by forcing an update.",IDC_STATIC,7,7,245,31 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// diff -Nru libcef-desura-291/src/executable/dumpgen_win/RES/extra.manifest libcef-desura-291/src/executable/dumpgen_win/RES/extra.manifest --- libcef-desura-291/src/executable/dumpgen_win/RES/extra.manifest 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/RES/extra.manifest 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + Binary files /tmp/1JRkMNh3LD/libcef-desura-291/src/executable/dumpgen_win/RES/resource.h and /tmp/fsEgCo4tHA/libcef-desura-291/src/executable/dumpgen_win/RES/resource.h differ diff -Nru libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.cpp libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.cpp --- libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,33 @@ +// CrashAleart.cpp : implementation file +// + +#include "CrashAlert.h" + +using namespace Desurium; + + +// CrashAleart +CrashAlert::CrashAlert() + : CDesuraDialog(IDD_DIALOG1) +{ + m_hIcon = LoadIcon(IDI_ICON1); +} + +CrashAlert::~CrashAlert() +{ +} + +bool CrashAlert::OnInitDialog() +{ + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + return true; +} + +void CrashAlert::OnCommand(HWND hWnd, int nId) +{ + EndDialog(nId); +} diff -Nru libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.h libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.h --- libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/code/CrashAlert.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,46 @@ +///////////// Copyright © 2010 DesuraNet. All rights reserved. ///////////// +// +// Project : dumpgen +// File : CrashAlert.h +// Description : +// [TODO: Write the purpose of CrashAlert.h.] +// +// Created On: 9/24/2010 7:37:23 PM +// Created By: +//////////////////////////////////////////////////////////////////////////// + +#ifndef DESURA_CRASHALERT_H +#define DESURA_CRASHALERT_H +#ifdef _WIN32 +#pragma once +#endif + +#include "Resource.h" +#include "DesuraWnd.h" + +// CrashAlert frame + +class CrashAlert : public Desurium::CDesuraDialog +{ +public: + CrashAlert(); + virtual ~CrashAlert(); + +protected: + void OnCommand(HWND hWnd, int nId) override; + bool OnInitDialog() override; + +private: + HICON m_hIcon; + +public: + void OnBnClickedYes(); +}; + +#endif //DESURA_CRASHALERT_H + + + + + + diff -Nru libcef-desura-291/src/executable/dumpgen_win/code/main.cpp libcef-desura-291/src/executable/dumpgen_win/code/main.cpp --- libcef-desura-291/src/executable/dumpgen_win/code/main.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/code/main.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,157 @@ +///////////// Copyright © 2008 Mark Chandler. All rights reserved. ///////////// +// +// Project : desura +// File : main.cpp +// Description : +// [Write the purpose of main.cpp.] +// +// Created On: 8/5/2008 9:51:48 PM +// Created By: Mark Chandler +///////////////////////////////////////////////////////////////////////////////// + +#include "Common.h" + +#include "windows.h" +#include "resource.h" + +#include "UtilBootloader.h" +#include "util\UtilWindows.h" +#include "MiniDumpGenerator.h" + +#include "SharedObjectLoader.h" +#include "UICoreI.h" + +#include + +#include "DesuraWinApp.h" + + +void ProcessDump(const char* commandLine); + +class BootLoader : public Desurium::CDesuraWinApp +{ +public: + BootLoader(); + ~BootLoader(); + + void InitInstance() override; + int ExitInstance() override; + +protected: + bool sendArgs(); + void loadUICore(); + + void restartAsAdmin(int needupdate); + +private: + SharedObjectLoader m_hUICore; + UICoreI* m_pUICore; + + MiniDumpGenerator m_MDumpHandle; +}; + +BootLoader theApp; + + + +BootLoader::BootLoader() +{ + BootLoaderUtil::InitCommonControls(); + +#if 0 + WaitForDebugger(); +#endif + + m_pUICore = NULL; +} + +BootLoader::~BootLoader() +{ +} + +void BootLoader::InitInstance() +{ + BootLoaderUtil::SetCurrentDir(); + + if (!BootLoaderUtil::SetDllDir(".\\bin")) + { + ::MessageBox(NULL, "Failed to set the dll path to the bin folder.", "Desura: ERROR!", MB_OK); + exit(-100); + } + + if (strstr(m_lpCmdLine,"-crashreport")!=NULL) + { + ProcessDump(m_lpCmdLine); + return; + } + +#ifndef DEBUG + bool hasAdminRights = false; + unsigned int osid = BootLoaderUtil::GetOSId(); + + if (osid == WINDOWS_PRE2000) + { + ::MessageBox(NULL, "Desura needs Windows xp or better to run.", "Desura Error: Old Windows", MB_OK); + return; + } + else if (osid == WINDOWS_XP || osid == WINDOWS_XP64) + { + hasAdminRights = true; + } + + if (strstr(m_lpCmdLine,"-admin")!=NULL) + { + hasAdminRights = true; + } + + if (!hasAdminRights) + { + BootLoaderUtil::RestartAsAdmin("-admin"); + return; + } +#endif + + loadUICore(); + + if (!m_pUICore) + return; + + char** argv = new char*[1]; + argv[0] = "-crashdump"; + + m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, 1, argv); + + delete [] argv; +} + +int BootLoader::ExitInstance() +{ + int ret = 0; + + if (m_pUICore) + m_pUICore->exitApp(&ret); + + return ret; +} + +void BootLoader::loadUICore() +{ + const char* dllname = "utilcore.dll"; + + if (!m_hUICore.load(dllname)) + { + DWORD err = GetLastError(); + ::MessageBox(NULL, "Failed to load utilcore.dll", "Desura: ERROR!", MB_OK); + exit(-200); + } + + UICoreFP UICoreGetInterface = m_hUICore.getFunction("GetInterface"); + + if (!UICoreGetInterface) + { + ::MessageBox(NULL, "Failed to load wxWidgets mappings in utilcore.dll", "Desura: ERROR!", MB_OK); + exit(-500); + } + + m_pUICore = UICoreGetInterface(); +} \ No newline at end of file diff -Nru libcef-desura-291/src/executable/dumpgen_win/code/processDump.cpp libcef-desura-291/src/executable/dumpgen_win/code/processDump.cpp --- libcef-desura-291/src/executable/dumpgen_win/code/processDump.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/executable/dumpgen_win/code/processDump.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,230 @@ +///////////// Copyright © 2010 DesuraNet. All rights reserved. ///////////// +// +// Project : dumpgen +// File : processDump.cpp +// Description : +// [TODO: Write the purpose of processDump.cpp.] +// +// Created On: 9/24/2010 7:11:54 PM +// Created By: +//////////////////////////////////////////////////////////////////////////// +#include "Common.h" + +#include + +#include "CrashAlert.h" +#include "SharedObjectLoader.h" + +#include + +#include "UtilBootloader.h" + +#ifdef WIN32 +#include +#include +#endif + +#include "DesuraWnd.h" + +using namespace Desurium; + +UINT __stdcall UploadDump(void* dumpInfo); + +bool RestartDesura(const char* args); +void GetBuildBranch(int &build, int &branch); +void GetString(const char* str, const char* input, char* out, size_t outSize); + +typedef bool (*UploadCrashFn)(const char* path, const char* user, int build, int branch); + +class DumpInfo +{ +public: + DumpInfo(const char* file, const char* user, volatile bool &complete) : m_szComplete(complete) + { + m_szFile = file; + m_szUser = user; + } + + const char* m_szFile; + const char* m_szUser; + volatile bool &m_szComplete; +}; + +void TerminateDesura() +{ + unsigned long aProcesses[1024], cbNeeded, cProcesses; + if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) + return; + + unsigned long curPID = GetCurrentProcessId(); + + cProcesses = cbNeeded / sizeof(unsigned long); + for (unsigned int i = 0; i < cProcesses; i++) + { + if(aProcesses[i] == 0) + continue; + + if (aProcesses[i] == curPID) + continue; + + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_TERMINATE, 0, aProcesses[i]); + + if (!hProcess) + continue; + + char buffer[50] = {0}; + GetModuleBaseName(hProcess, 0, buffer, 50); + + if(strcmp("desura.exe", buffer)==0) + { + TerminateProcess(hProcess, 0); + CloseHandle(hProcess); + + break; + } + else + { + CloseHandle(hProcess); + } + } +} + + +void ProcessDump(const char* m_lpCmdLine) +{ +//#ifdef DEBUG +// BootLoaderUtil::WaitForDebugger(); +//#endif + + BootLoaderUtil::CMDArgs args(m_lpCmdLine); + + volatile bool uploadComplete = false; + char file[255] = {0}; + char user[255] = {0}; + + bool msgbox = args.hasArg("msgbox"); + bool upload = (args.hasArg("noupload") == false); + + if (args.hasArg("file")) + args.getString("file", file, 255); + + if (args.hasArg("user")) + args.getString("user", user, 255); + + if (file[0] && upload) + { + DumpInfo *di = new DumpInfo(file, user, uploadComplete); + CDesuraWnd::BeginThread(&UploadDump, (void*)di); + } + else + { + uploadComplete = true; + } + + if (msgbox) + { + CrashAlert ca; + int res = ca.DoModal(); + + TerminateDesura(); + + if (res == IDOK) //restart + { + RestartDesura(""); + } + else if (res == IDYES) //force update + { + RestartDesura("-forceupdate"); + } + } + + while (uploadComplete == false) + Sleep(500); +} + +UINT __stdcall UploadDump(void* dumpInfo) +{ + int build = 0; + int branch = 0; + + GetBuildBranch(build, branch); + + DumpInfo* di = static_cast(dumpInfo); + + SharedObjectLoader sol; + + const char* modualName = "crashuploader.dll"; + + if (!sol.load(modualName)) + { + di->m_szComplete = true; + return -1; + } + + UploadCrashFn uploadCrash = sol.getFunction("UploadCrash"); + + if (uploadCrash == NULL) + { + di->m_szComplete = true; + return -2; + } + + if (!uploadCrash(di->m_szFile, di->m_szUser, build, branch)) + { + di->m_szComplete = true; + return -3; + } + + di->m_szComplete = true; + return 0; +} + +bool RestartDesura(const char* args) +{ + char exePath[255]; + GetModuleFileName(NULL, exePath, 255); + + size_t exePathLen = strlen(exePath); + for (size_t x=exePathLen; x>0; x--) + { + if (exePath[x] == '\\') + break; + else + exePath[x] = '\0'; + } + + PROCESS_INFORMATION ProcInfo = {0}; + STARTUPINFO StartupInfo = {0}; + + char launchArg[512]; + const char* exeName = "desura.exe"; + + _snprintf_s(launchArg, 512, _TRUNCATE, "%s %s", exeName, args?args:""); + BOOL res = CreateProcess(NULL, launchArg, NULL, NULL, false, NORMAL_PRIORITY_CLASS, NULL, exePath, &StartupInfo, &ProcInfo); + + CloseHandle(ProcInfo.hProcess); + CloseHandle(ProcInfo.hThread); + + return res?true:false; +} + +void GetBuildBranch(int &build, int &branch) +{ + char lszValue[255]; + + DWORD dwType=REG_SZ; + DWORD dwSize=255; + HKEY hk; + + DWORD err1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Desura\\DesuraApp", 0, KEY_QUERY_VALUE, &hk); + + lszValue[0] = 0; + DWORD err2 = RegQueryValueEx(hk, "appid", NULL, &dwType,(LPBYTE)&lszValue, &dwSize); + branch = atoi(lszValue); + + lszValue[0] = 0; + DWORD err3 = RegQueryValueEx(hk, "appver", NULL, &dwType,(LPBYTE)&lszValue, &dwSize); + build = atoi(lszValue); + + RegCloseKey(hk); +} diff -Nru libcef-desura-291/src/executable/service_win/CMakeLists.txt libcef-desura-291/src/executable/service_win/CMakeLists.txt --- libcef-desura-291/src/executable/service_win/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/service_win/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -15,8 +15,8 @@ wintrust ) -install(TARGETS desura_service - DESTINATION "${BIN_INSTALL_DIR}") +if(WIN32) + SetSharedRuntime(desura_service) +endif() -CopyTargetFiles(desura_service) -SET_PROPERTY(TARGET desura_service PROPERTY FOLDER "Executable") \ No newline at end of file +install_executable(desura_service) diff -Nru libcef-desura-291/src/executable/service_win/RES/service_exe.rc libcef-desura-291/src/executable/service_win/RES/service_exe.rc --- libcef-desura-291/src/executable/service_win/RES/service_exe.rc 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/service_win/RES/service_exe.rc 2013-10-17 18:16:34.000000000 +0000 @@ -2,19 +2,8 @@ // #include "resource.h" -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS +#include "Winuser.h" -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) @@ -52,7 +41,6 @@ // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ICON1 ICON "@BRANDING_DIR@/desura.ico" -#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -65,4 +53,3 @@ #include "@BRANDING_DIR@/desura_service.rc2" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff -Nru libcef-desura-291/src/executable/service_win/code/ServiceMain.cpp libcef-desura-291/src/executable/service_win/code/ServiceMain.cpp --- libcef-desura-291/src/executable/service_win/code/ServiceMain.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/service_win/code/ServiceMain.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -74,9 +74,9 @@ DeleteFile("desura_service_old.exe"); DeleteFile("desura_old.exe"); -#if !defined(DEBUG) && defined(DESURA_OFFICAL_BUILD) +#if !defined(DEBUG) && defined(DESURA_OFFICIAL_BUILD) char message[255] = {0}; - if (ValidateCert(L".\\servicecore.dll", message, 255) != ERROR_SUCCESS) + if (ValidateCert(L".\\bin\\servicecore.dll", message, 255) != ERROR_SUCCESS) { log("Failed cert check on servicecore.dll: "); log(message); @@ -156,4 +156,4 @@ fprintf(m_Fh, "%s", msg); printf("%s", msg); -} \ No newline at end of file +} diff -Nru libcef-desura-291/src/executable/toolhelper/CMakeLists.txt libcef-desura-291/src/executable/toolhelper/CMakeLists.txt --- libcef-desura-291/src/executable/toolhelper/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/toolhelper/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,5 +1,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/RES + ${UTIL_BOOTLOADER_INCLUDE_DIRS} ) configure_file(RES/toolhelper.rc ${RC_DIR}/toolhelper.rc @ONLY) @@ -10,12 +11,10 @@ add_executable(toolhelper WIN32 ${Sources}) target_link_libraries(toolhelper - mdump - util_bootloader + mdump_s + util_bootloader_s + Comctl32 ) -install(TARGETS toolhelper - DESTINATION "${BIN_INSTALL_DIR}") - -CopyTargetFiles(toolhelper) -SET_PROPERTY(TARGET toolhelper PROPERTY FOLDER "Executable") \ No newline at end of file +install_executable(toolhelper) +SetStaticRuntime(toolhelper) Binary files /tmp/1JRkMNh3LD/libcef-desura-291/src/executable/toolhelper/RES/toolhelper.rc and /tmp/fsEgCo4tHA/libcef-desura-291/src/executable/toolhelper/RES/toolhelper.rc differ diff -Nru libcef-desura-291/src/executable/toolhelper/code/main.cpp libcef-desura-291/src/executable/toolhelper/code/main.cpp --- libcef-desura-291/src/executable/toolhelper/code/main.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/toolhelper/code/main.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -20,26 +20,24 @@ #include "stdafx.h" #include "Common.h" -#include "resource.h" - #include "UtilBootloader.h" #include "MiniDumpGenerator.h" +#include "Commctrl.h" + #include "SharedObjectLoader.h" #include "UICoreI.h" #include +#include "DesuraWinApp.h" - -class BootLoader : public CWinApp +class BootLoader : public Desurium::CDesuraWinApp { public: BootLoader(); ~BootLoader(); - BOOL InitInstance(); + void InitInstance(); int ExitInstance(); - BOOL PreTranslateMessage(MSG *msg); - BOOL OnIdle(LONG lCount); protected: bool sendArgs(); @@ -60,10 +58,7 @@ BootLoader::BootLoader() { - AfxEnableMemoryTracking(FALSE); - InitCommonControls(); - #if 0 WaitForDebugger(); #endif @@ -75,37 +70,28 @@ { } -BOOL BootLoader::InitInstance() +void BootLoader::InitInstance() { - CWinApp::InitInstance(); - if (BootLoaderUtil::GetOSId() == WINDOWS_PRE2000) { ::MessageBox(NULL, PRODUCT_NAME " needs Windows XP or better to run.", PRODUCT_NAME " Error: Old Windows", MB_OK); - return FALSE; + return; } loadUICore(); if (!m_pUICore) - return FALSE; + return; BootLoaderUtil::CMDArgs args(m_lpCmdLine); args.addValue("-toolhelper"); - bool res = m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); - - if (res) - m_pMainWnd = new BootLoaderUtil::CDummyWindow(m_pUICore->getHWND()); - - return res?TRUE:FALSE; + m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); } int BootLoader::ExitInstance() { - delete m_pMainWnd; - - int ret = CWinApp::ExitInstance(); + int ret=0; if (m_pUICore) m_pUICore->exitApp(&ret); @@ -113,23 +99,6 @@ return ret; } -// Override this to provide wxWidgets message loop compatibility -BOOL BootLoader::PreTranslateMessage(MSG *msg) -{ - if (m_pUICore && m_pUICore->preTranslateMessage(msg) ) - return TRUE; - - return CWinApp::PreTranslateMessage(msg); -} - -BOOL BootLoader::OnIdle(LONG lCount) -{ - if (m_pUICore) - return m_pUICore->onIdle(); - - return FALSE; -} - void BootLoader::loadUICore() { BootLoaderUtil::SetCurrentDir(); diff -Nru libcef-desura-291/src/executable/toolhelper/code/stdafx.h libcef-desura-291/src/executable/toolhelper/code/stdafx.h --- libcef-desura-291/src/executable/toolhelper/code/stdafx.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/toolhelper/code/stdafx.h 2013-10-17 18:16:34.000000000 +0000 @@ -31,61 +31,4 @@ #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC core and standard components -#include // MFC extensions - - - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC support for Internet Explorer 4 Common Controls -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff -Nru libcef-desura-291/src/executable/utilhelper/CMakeLists.txt libcef-desura-291/src/executable/utilhelper/CMakeLists.txt --- libcef-desura-291/src/executable/utilhelper/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/utilhelper/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,5 +1,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/RES + ${UTIL_BOOTLOADER_INCLUDE_DIRS} ) configure_file(RES/repair.rc ${RC_DIR}/repair.rc @ONLY) @@ -17,12 +18,10 @@ add_executable(utilhelper WIN32 ${Sources}) target_link_libraries(utilhelper - mdump - util_bootloader + mdump_s + util_bootloader_s + Comctl32 ) -install(TARGETS utilhelper - DESTINATION "${BIN_INSTALL_DIR}") - -CopyTargetFiles(utilhelper) -SET_PROPERTY(TARGET utilhelper PROPERTY FOLDER "Executable") \ No newline at end of file +install_executable(utilhelper) +SetStaticRuntime(utilhelper) Binary files /tmp/1JRkMNh3LD/libcef-desura-291/src/executable/utilhelper/RES/repair.rc and /tmp/fsEgCo4tHA/libcef-desura-291/src/executable/utilhelper/RES/repair.rc differ diff -Nru libcef-desura-291/src/executable/utilhelper/code/main.cpp libcef-desura-291/src/executable/utilhelper/code/main.cpp --- libcef-desura-291/src/executable/utilhelper/code/main.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/utilhelper/code/main.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -19,7 +19,8 @@ #include "stdafx.h" #include "Common.h" -#include "resource.h" + +#include "Commctrl.h" #include "UtilBootloader.h" #include "MiniDumpGenerator.h" @@ -27,19 +28,17 @@ #include "SharedObjectLoader.h" #include "UICoreI.h" #include - +#include "DesuraWinApp.h" #include -class BootLoader : public CWinApp +class BootLoader : public Desurium::CDesuraWinApp { public: BootLoader(); ~BootLoader(); - BOOL InitInstance(); + void InitInstance(); int ExitInstance(); - BOOL PreTranslateMessage(MSG *msg); - BOOL OnIdle(LONG lCount); protected: bool sendArgs(); @@ -62,7 +61,6 @@ { m_MDumpHandle.showMessageBox(true); - AfxEnableMemoryTracking(FALSE); InitCommonControls(); #if 0 @@ -76,15 +74,14 @@ { } -BOOL BootLoader::InitInstance() +void BootLoader::InitInstance() { BootLoaderUtil::CMDArgs args(m_lpCmdLine); - CWinApp::InitInstance(); if (BootLoaderUtil::GetOSId() == WINDOWS_PRE2000) { ::MessageBox(NULL, PRODUCT_NAME " needs Windows XP or better to run.", PRODUCT_NAME " Error: Old Windows", MB_OK); - return FALSE; + return; } if (args.hasArg("wait")) @@ -99,21 +96,14 @@ loadUICore(); if (!m_pUICore) - return FALSE; - - bool res = m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); - - if (res) - m_pMainWnd = new BootLoaderUtil::CDummyWindow(m_pUICore->getHWND()); + return; - return res?TRUE:FALSE; + m_pUICore->initWxWidgets(m_hInstance, m_nCmdShow, args.getArgc(), const_cast(args.getArgv())); } int BootLoader::ExitInstance() { - delete m_pMainWnd; - - int ret = CWinApp::ExitInstance(); + int ret=0; if (m_pUICore) m_pUICore->exitApp(&ret); @@ -121,23 +111,6 @@ return ret; } -// Override this to provide wxWidgets message loop compatibility -BOOL BootLoader::PreTranslateMessage(MSG *msg) -{ - if (m_pUICore && m_pUICore->preTranslateMessage(msg) ) - return TRUE; - - return CWinApp::PreTranslateMessage(msg); -} - -BOOL BootLoader::OnIdle(LONG lCount) -{ - if (m_pUICore) - return m_pUICore->onIdle(); - - return FALSE; -} - void BootLoader::loadUICore() { #ifndef DEBUG diff -Nru libcef-desura-291/src/executable/utilhelper/code/stdafx.h libcef-desura-291/src/executable/utilhelper/code/stdafx.h --- libcef-desura-291/src/executable/utilhelper/code/stdafx.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/executable/utilhelper/code/stdafx.h 2013-10-17 18:16:34.000000000 +0000 @@ -29,62 +29,3 @@ #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC core and standard components -#include // MFC extensions - - - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC support for Internet Explorer 4 Common Controls -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff -Nru libcef-desura-291/src/include/MainAppI.h libcef-desura-291/src/include/MainAppI.h --- libcef-desura-291/src/include/MainAppI.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/MainAppI.h 2013-10-17 18:16:34.000000000 +0000 @@ -138,6 +138,8 @@ virtual wxWindow* getTopLevelWindow()=0; virtual void newAccountLogin(const char* username, const char* cookie)=0; + + virtual void showUnitTest(){} }; diff -Nru libcef-desura-291/src/include/UICoreI.h libcef-desura-291/src/include/UICoreI.h --- libcef-desura-291/src/include/UICoreI.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/UICoreI.h 2013-10-17 18:16:34.000000000 +0000 @@ -103,6 +103,9 @@ //! Sets the crash dump level callback //! virtual void setCrashDumpLevel(DumpLevelFP dlfp)=0; + + //runs all unit tests + virtual int runUnitTests(int argc, char** argv) = 0; }; typedef UICoreI* (*UICoreFP)(); diff -Nru libcef-desura-291/src/include/UtilBootloader.h libcef-desura-291/src/include/UtilBootloader.h --- libcef-desura-291/src/include/UtilBootloader.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/UtilBootloader.h 2013-10-17 18:16:34.000000000 +0000 @@ -26,16 +26,10 @@ #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif -#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) -#ifdef _WIN32 -#include -#endif -#else + #ifdef _WIN32 #include #endif -#endif - #include @@ -43,17 +37,6 @@ { class CMDArgInternal; -#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) -#ifdef _WIN32 - class CDummyWindow : public CWnd - { - public: - CDummyWindow(HWND hWnd); - ~CDummyWindow(); - }; -#endif -#endif - unsigned int GetOSId(); void SetCurrentDir(); diff -Nru libcef-desura-291/src/include/util/UtilOs.h libcef-desura-291/src/include/util/UtilOs.h --- libcef-desura-291/src/include/util/UtilOs.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/util/UtilOs.h 2013-10-17 18:16:34.000000000 +0000 @@ -121,10 +121,12 @@ gcString getAbsPath(const gcString& path); +#ifndef WIN32 //! Gets the folder for runtime lib loading //! gcString getRuntimeLibPath(); - +#endif + gcString getRelativePath(const gcString &path); } } diff -Nru libcef-desura-291/src/include/wx_controls/gcCustomFrame.h libcef-desura-291/src/include/wx_controls/gcCustomFrame.h --- libcef-desura-291/src/include/wx_controls/gcCustomFrame.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/gcCustomFrame.h 2013-10-17 18:16:34.000000000 +0000 @@ -23,7 +23,6 @@ #endif #include -#include "gcCustomFrameImpl.h" #include "gcManagers.h" extern wxWindow* GetMainWindow(wxWindow* p); @@ -39,12 +38,10 @@ class gcCustomFrame : public T, public FrameIcon { public: - gcCustomFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : T(), m_pCustomFrame(NULL) - { -#ifdef NIX - m_uiTitleHeight = 0; -#endif - + gcCustomFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) + : T() + , m_uiTitleHeight(0) + { this->Create(parent, id, title, pos, size + wxSize(16, 38), style); #ifdef WIN32 @@ -68,154 +65,15 @@ this->Refresh(true); } - ~gcCustomFrame() - { - delete m_pCustomFrame; - } - - virtual bool Destroy() - { -#ifdef WIN32 - if (m_pCustomFrame) - { - m_pCustomFrame->destroy(); - m_pCustomFrame->onActiveEvent -= delegate(&onActiveEvent); - } -#endif - - return T::Destroy(); - } - - void init(gcCustomFrameImpl* custFrame) - { -#ifdef WIN32 - m_pCustomFrame = custFrame; - - if (m_pCustomFrame) - m_pCustomFrame->onActiveEvent += delegate(&onActiveEvent); - -#else - if (custFrame) - custFrame->destroy(); -#endif - this->Layout(); - } - virtual void loadFrame(long style) { applyTheme(); -#ifdef WIN32 - if (!getCustomFrame()) - init(new gcCustomFrameImpl(this, this, style)); -#endif - } - - gcCustomFrameImpl* getCustomFrame() - { - return m_pCustomFrame; - } - - virtual void DoGetClientSize(int *width, int *height) const - { -#ifdef WIN32 - if (m_pCustomFrame) - m_pCustomFrame->DoGetClientSize(width, height); - else -#endif - T::DoGetClientSize(width, height); - } - - virtual wxPoint GetClientAreaOrigin() const - { -#ifdef WIN32 - if (m_pCustomFrame) - return m_pCustomFrame->GetClientAreaOrigin(); -#endif - return T::GetClientAreaOrigin(); - } - -#ifdef WIN32 - virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) - { - bool processed = false; - WXLRESULT res = 0; - - if (m_pCustomFrame) - res = m_pCustomFrame->PreMSWWindowProc(message, wParam, lParam, processed); - - if (processed) - return res; - - res = T::MSWWindowProc(message, wParam, lParam); - - if (!m_pCustomFrame) - return res; - - return m_pCustomFrame->PostMSWWindowProc(message, wParam, lParam, res); - } -#endif - - virtual void SetTitle(const wxString &title) - { -#ifdef WIN32 - if (m_pCustomFrame) - m_pCustomFrame->invalidatePaint(); -#endif - return T::SetTitle(title); - } - - virtual bool IsMaximized() const - { -#ifdef WIN32 - if (m_pCustomFrame) - return m_pCustomFrame->isMaximized(); -#endif - return T::IsMaximized(); - } - - virtual void Maximize(bool state) - { -#ifdef WIN32 - if (m_pCustomFrame) - m_pCustomFrame->maximize(state); - else -#endif - T::Maximize(state); - } - - virtual void Iconize(bool state) - { -#ifdef WIN32 - if (m_pCustomFrame) - m_pCustomFrame->minimize(state); -#endif - T::Iconize(state); - } - - virtual void Restore() - { -#ifdef WIN32 - if (m_pCustomFrame) - m_pCustomFrame->restore(); -#endif - T::Restore(); } virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) { -#ifdef WIN32 - if (m_pCustomFrame) - { - if (width != -1) - width += 16; - - if (height != -1) - height += 38; - } -#else if (height != -1) height += m_uiTitleHeight; -#endif T::DoSetSize(x, y, width, height, sizeFlags); } @@ -223,12 +81,7 @@ virtual wxSize DoGetBestSize() const { wxSize size = T::DoGetBestSize(); -#ifdef WIN32 - if (m_pCustomFrame) - size += wxSize(16,38); -#else size += wxSize(0, m_uiTitleHeight); -#endif return size; } @@ -236,17 +89,6 @@ { T::DoGetSize(width, height); -#ifdef WIN32 - //Due to a bug with pointers this never worked and since it does now it messes with things - //if (m_pCustomFrame) - //{ - // if (width) - // *width -= 16; - // - // if (height) - // *height -= 38; - //} -#else if (height) { *height -= m_uiTitleHeight; @@ -254,7 +96,6 @@ if (*height < 0) *height = 0; } -#endif } virtual wxSize GetFullSize() @@ -264,7 +105,6 @@ return wxSize(w,h); } - void setIcon(const char* path) { if (!path) @@ -302,9 +142,6 @@ void setFrameIcon(wxIcon icon) { m_FrameIcon = icon; - - if (m_pCustomFrame) - m_pCustomFrame->invalidatePaint(); } void applyTheme() @@ -334,22 +171,6 @@ this->SetPosition(wxPoint(fin.x, fin.y)); } - bool isResizing() - { - if (!m_pCustomFrame) - return false; - - return m_pCustomFrame->isResizing(); - } - - bool isActive() - { - if (m_pCustomFrame) - return m_pCustomFrame->isActive(); - - return true; - } - bool setSavedWindowPos(int x, int y, int w, int h) { if (UTIL::OS::isPointOnScreen(x+8, y+30)) @@ -361,15 +182,10 @@ return false; } - Event onActiveEvent; private: -#ifdef NIX uint32 m_uiTitleHeight; -#endif - - gcCustomFrameImpl* m_pCustomFrame; wxIcon m_FrameIcon; }; diff -Nru libcef-desura-291/src/include/wx_controls/gcCustomFrameButtons.h libcef-desura-291/src/include/wx_controls/gcCustomFrameButtons.h --- libcef-desura-291/src/include/wx_controls/gcCustomFrameButtons.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/gcCustomFrameButtons.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_GCCUSTOMFRAMEBUTTONS_H -#define DESURA_GCCUSTOMFRAMEBUTTONS_H -#ifdef _WIN32 -#pragma once -#endif - -#include -#include "gcImageHandle.h" - -//! Top frame buttons that handle close, min and max for the custom window frame -class CustomFrameButtons -{ -public: - CustomFrameButtons(wxWindow* pParent, wxTopLevelWindow* pFrame, int style, const char* imgActive, const char* imgNonActive); - - bool onMouseMove(); - bool onMouseDown(); - bool onMouseUp(); - bool onMouseDoubleClick(); - - void generateButtons(wxDC* dc); - wxRect getRect(); - - virtual void invalidateBitmap(); - virtual void calcBorders(int dw, int yoff); - - bool isActive(); - void setActive(bool state); - -protected: - int32 isWithingButtons(uint8 action); - - virtual void clearBg(wxDC* dc); - - gcImageHandle m_imgBorder; - gcImageHandle m_imgBorderNA; - - wxPoint m_ButtonPos; - -private: - std::vector m_ButtonRect; - std::vector m_iButtonState; - - bool m_bActive; - bool m_bButtonBitMapValid; - int32 m_iMouseDown; - - wxBitmap m_ButtonBitMap; - wxWindow* m_pParent; - wxTopLevelWindow* m_pFrame; -}; - -#endif //DESURA_GCCUSTOMFRAMEBUTTONS_H diff -Nru libcef-desura-291/src/include/wx_controls/gcCustomFrameImpl.h libcef-desura-291/src/include/wx_controls/gcCustomFrameImpl.h --- libcef-desura-291/src/include/wx_controls/gcCustomFrameImpl.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/gcCustomFrameImpl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_GCCUSTOMFRAMEIMPL_H -#define DESURA_GCCUSTOMFRAMEIMPL_H -#ifdef _WIN32 -#pragma once -#endif - -#include - -#include "gcImageHandle.h" - -#include "gcCustomFrameButtons.h" -#include "gcCustomFrameResize.h" -#include "gcCustomFrameMove.h" - -class gcFrame; -class gcImageButton; -class FrameIcon; - -enum MOUSE_ACTION -{ - MOUSE_MOVE, - MOUSE_LDOWN, - MOUSE_LUP, -}; - -enum BORDER_DIR -{ - NORTH = 0, - NEAST, - EAST, - SEAST, - SOUTH, - SWEST, - WEST, - NWEST, - BORDER_DIR_MAX, -}; - -//! Custom frame implementation -class gcCustomFrameImpl -{ -public: - gcCustomFrameImpl(wxTopLevelWindow* parent, FrameIcon* frameIcon, long style); - ~gcCustomFrameImpl(); - - virtual void DoGetClientSize(int *width, int *height) const; - virtual wxPoint GetClientAreaOrigin() const; - - void setTitleHeight(unsigned int height); - void showTitle(bool state); - - bool isResizing(); - - virtual void invalidatePaint() - { - m_bBGBitMapValid = false; - m_pParent->Refresh(false); - } - - bool isActive() const - { - return m_bActive; - } - - bool isMaximized() const - { - return m_bIsMaximized; - } - - virtual void maximize(bool state); - virtual void minimize(bool state); - virtual void restore(); - -#ifdef WIN32 - virtual WXLRESULT PreMSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam, bool &processed); - virtual WXLRESULT PostMSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam, WXLRESULT res); -#endif - - - Event onActiveEvent; - - - void destroy(); - -protected: - wxRegion generateBorderRegion(); - - virtual void onPaintNC(wxNcPaintEvent& event); - virtual void onPaintBG( wxEraseEvent& event ); - virtual void onPaint(wxPaintEvent& event); - virtual void onResize(wxSizeEvent& event); - - virtual void onLeftDClick( wxMouseEvent& event ); - virtual void onLeftMouseDown( wxMouseEvent& event ); - virtual void onLeftMouseUp( wxMouseEvent& event ); - virtual void onRightMouseDown(wxMouseEvent& event); - virtual void onMouseMove( wxMouseEvent& event ); - - virtual void onBlur(wxFocusEvent& event); - virtual void onMouseCaptureLost(wxMouseCaptureLostEvent &event); - - virtual void calcBorders(); - - virtual void doPaintBorder(wxDC* dc); - virtual void generateTitle(wxDC* dc); - virtual void generateBorder(wxDC* dc); - virtual void setFrameRegion(); - - wxRect getWindowsBorderRect() const; - - virtual void doMaximize(); - virtual void doRestore(); - - wxRect m_RestorSize; - bool m_bIsMaximized; - - - std::vector m_FrameBorder; - - wxRect m_TitleAreaRect; - wxRect m_TitleBorder; - wxRect m_ClientArea; - wxRect m_PaintClientArea; - wxRect m_IconRect; - - bool m_bShowTitle; - bool m_bMaxEnabled; - bool m_bMinEnabled; - bool m_bActive; - - unsigned int m_iTitleHeight; - - wxTopLevelWindow* m_pParent; - FrameIcon* m_pFrameIcon; - - bool m_bValidRegion; - bool m_bBGBitMapValid; - bool m_bDisableSetRegion; - bool m_bWasLastMaximised; - - wxSize m_LastSize; - - - - - gcImageHandle m_imgBorder; - gcImageHandle m_imgBorderNA; - - CustomFrameButtons *m_pCFButtons; - CustomFrameResize* m_pCFResize; - CustomFrameMove* m_pCFMove; - - wxBitmap m_BorderBitmap; -}; - - - - - - - - -#endif //DESURA_GCCUSTOMFRAMEIMPL_H diff -Nru libcef-desura-291/src/include/wx_controls/gcCustomFrameMove.h libcef-desura-291/src/include/wx_controls/gcCustomFrameMove.h --- libcef-desura-291/src/include/wx_controls/gcCustomFrameMove.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/gcCustomFrameMove.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_GCCUSTOMFRAMEMOVE_H -#define DESURA_GCCUSTOMFRAMEMOVE_H -#ifdef _WIN32 -#pragma once -#endif - -#include - -//! Move handler for the custom window frame -class CustomFrameMove -{ -public: - CustomFrameMove(wxTopLevelWindow* pParent); - - bool onMouseMove(); - bool onMouseDown(bool canResize); - bool onMouseUp(); - - bool isDragging() - { - return m_bMouseDrag; - } - - void calcBorders(wxRect title, wxRect frame); - -private: - bool m_bMouseDrag; - - wxPoint m_StartPos; - wxPoint m_StartDrag; - wxTopLevelWindow* m_pParent; - - wxRect m_TitleBorder; - wxRect m_FrameBorder; -}; - -#endif //DESURA_GCCUSTOMFRAMEMOVE_H diff -Nru libcef-desura-291/src/include/wx_controls/gcCustomFrameResize.h libcef-desura-291/src/include/wx_controls/gcCustomFrameResize.h --- libcef-desura-291/src/include/wx_controls/gcCustomFrameResize.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/gcCustomFrameResize.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_GCCUSTOMFRAMERESIZE_H -#define DESURA_GCCUSTOMFRAMERESIZE_H -#ifdef _WIN32 -#pragma once -#endif - -#include - -//! Resize handler for the custom window frame -class CustomFrameResize -{ -public: - CustomFrameResize(wxTopLevelWindow* pParent, bool enabled); - - bool onMouseMove(); - bool onMouseDown(); - bool onMouseUp(); - - bool isResizing() - { - return (m_iResizeDir != -1); - } - - bool canResize() - { - return m_bResizeEnabled; - } - - void reset() - { - m_pParent->SetCursor(wxCURSOR_ARROW); - m_MouseCursor = wxCURSOR_ARROW; - m_iResizeDir = -1; - } - - void calcBorders(std::vector &vFrameBorder); - -protected: - void processMouseMove(); - void processResize(); - -private: - int32 m_MouseCursor; - - bool m_bResizeEnabled; - int32 m_iResizeDir; - - wxTopLevelWindow* m_pParent; - - wxPoint m_StartPos; - wxPoint m_StartResize; - wxPoint m_WindowPos; - wxSize m_WindowSize; - - std::vector m_FrameBorder; -}; - -#endif //DESURA_GCCUSTOMFRAMERESIZE_H diff -Nru libcef-desura-291/src/include/wx_controls/wxEventDelegate.h libcef-desura-291/src/include/wx_controls/wxEventDelegate.h --- libcef-desura-291/src/include/wx_controls/wxEventDelegate.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/include/wx_controls/wxEventDelegate.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_WXEVENTDELEGATE_H -#define DESURA_WXEVENTDELEGATE_H -#ifdef _WIN32 -#pragma once -#endif - -#ifdef WIN32 - #include "MainFormCustomFrame.h" -#else - #include "../../shared/uicore/code/MainFormCustomFrame.h" -#endif - -template -class wxEventDelegate : public T -{ -public: - wxEventDelegate(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) : T(parent, id, label, pos, size, style) - { - m_pMainCustFrame = NULL; - } - - wxEventDelegate(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) : T(parent, id, pos, size, style) - { - m_pMainCustFrame = NULL; - } - - wxEventDelegate(wxWindow *parent, const wxString& label, const wxSize& size = wxDefaultSize) : T(parent, label.c_str(), size) - { - m_pMainCustFrame = NULL; - } - - virtual void regCustomFrame(gcMainCustomFrameImpl* mcf) - { - m_pMainCustFrame = mcf; - } - - //! Returns true if handled - virtual bool handleEvent(wxMouseEvent &event) - { - if (!m_pMainCustFrame) - return false; - - return m_pMainCustFrame->handleEvent(this, event); - } - -private: - gcMainCustomFrameImpl* m_pMainCustFrame; -}; - - -template -class wxEventDelegateWrapper : public wxEventDelegate -{ -public: - wxEventDelegateWrapper(wxWindow *parent, const char* image, const wxSize& size = wxDefaultSize) : wxEventDelegate(parent, image, size) - { - initEDW(); - } - - - wxEventDelegateWrapper( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0 ) : wxEventDelegate(parent, id, pos, size, style) - { - initEDW(); - } - -private: - void onMouseEvent( wxMouseEvent& event ) - { - wxEventDelegate::handleEvent(event); - } - - void initEDW() - { - this->Bind( wxEVT_LEFT_DCLICK, &wxEventDelegateWrapper::onMouseEvent, this); - this->Bind( wxEVT_MOTION, &wxEventDelegateWrapper::onMouseEvent, this); - this->Bind( wxEVT_LEFT_DOWN, &wxEventDelegateWrapper::onMouseEvent, this); - this->Bind( wxEVT_LEFT_UP, &wxEventDelegateWrapper::onMouseEvent, this); - } -}; - - -#endif //DESURA_WXEVENTDELEGATE_H diff -Nru libcef-desura-291/src/shared/crashuploader/CMakeLists.txt libcef-desura-291/src/shared/crashuploader/CMakeLists.txt --- libcef-desura-291/src/shared/crashuploader/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/crashuploader/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -25,7 +25,8 @@ ${PLATFORM_LIBRARIES} ) -install(TARGETS crashuploader - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(crashuploader) -SET_PROPERTY(TARGET crashuploader PROPERTY FOLDER "Shared") \ No newline at end of file +if(WIN32) + SetSharedRuntime(crashuploader) +endif() + +install_library(crashuploader) diff -Nru libcef-desura-291/src/shared/mcfcore/CMakeLists.txt libcef-desura-291/src/shared/mcfcore/CMakeLists.txt --- libcef-desura-291/src/shared/mcfcore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/mcfcore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -40,9 +40,8 @@ ${CMAKE_THREAD_LIBS_INIT} ) -install(TARGETS mcfcore - DESTINATION "${LIB_INSTALL_DIR}") +if(WIN32) + SetSharedRuntime(mcfcore) +endif() -CopyTargetFiles(mcfcore) - -SET_PROPERTY(TARGET mcfcore PROPERTY FOLDER "Shared") \ No newline at end of file +install_library(mcfcore) diff -Nru libcef-desura-291/src/shared/scriptcore/CMakeLists.txt libcef-desura-291/src/shared/scriptcore/CMakeLists.txt --- libcef-desura-291/src/shared/scriptcore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/scriptcore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -22,7 +22,8 @@ ${WINDOWS_LIBRARIES} ) -install(TARGETS scriptcore - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(scriptcore) -SET_PROPERTY(TARGET scriptcore PROPERTY FOLDER "Shared") \ No newline at end of file +if(WIN32) + SetSharedRuntime(scriptcore) +endif() + +install_library(scriptcore) diff -Nru libcef-desura-291/src/shared/servicecore/CMakeLists.txt libcef-desura-291/src/shared/servicecore/CMakeLists.txt --- libcef-desura-291/src/shared/servicecore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/servicecore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -50,7 +50,8 @@ ${PLATFORM_LIBRARIES} ) -install(TARGETS servicecore - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(servicecore) -SET_PROPERTY(TARGET servicecore PROPERTY FOLDER "Shared") \ No newline at end of file +if(WIN32) + SetSharedRuntime(servicecore) +endif() + +install_library(servicecore) diff -Nru libcef-desura-291/src/shared/servicecore/code/InstallScriptRunTime.cpp libcef-desura-291/src/shared/servicecore/code/InstallScriptRunTime.cpp --- libcef-desura-291/src/shared/servicecore/code/InstallScriptRunTime.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/servicecore/code/InstallScriptRunTime.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -168,10 +168,10 @@ protected: bool loadDll() { -#if !defined(DEBUG) && defined(DESURA_OFFICAL_BUILD) +#if !defined(DEBUG) && defined(DESURA_OFFICIAL_BUILD) #ifdef WIN32 char message[255] = {0}; - if (UTIL::WIN::validateCert(L".\\scriptcore.dll", message, 255) != ERROR_SUCCESS) + if (UTIL::WIN::validateCert(L".\\bin\\scriptcore.dll", message, 255) != ERROR_SUCCESS) { Warning(gcString("Cert validation failed on scriptcore.dll: {0}\n", message)); return false; diff -Nru libcef-desura-291/src/shared/servicecore/code/McfInit.cpp libcef-desura-291/src/shared/servicecore/code/McfInit.cpp --- libcef-desura-291/src/shared/servicecore/code/McfInit.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/servicecore/code/McfInit.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -36,9 +36,9 @@ { bool res = false; -#if defined(WIN32) && !defined(DEBUG) && defined(DESURA_OFFICAL_BUILD) +#if defined(WIN32) && !defined(DEBUG) && defined(DESURA_OFFICIAL_BUILD) char message[255] = {0}; - if (UTIL::WIN::validateCert(L".\\mcfcore.dll", message, 255) != ERROR_SUCCESS) + if (UTIL::WIN::validateCert(L".\\bin\\mcfcore.dll", message, 255) != ERROR_SUCCESS) { Warning(gcString("Cert validation failed on mcfcore.dll: {0}\n", message)); exit(-1); @@ -120,4 +120,4 @@ delFactory(p, name); } -} \ No newline at end of file +} diff -Nru libcef-desura-291/src/shared/servicecore/code/UpdateShortcuts.cpp libcef-desura-291/src/shared/servicecore/code/UpdateShortcuts.cpp --- libcef-desura-291/src/shared/servicecore/code/UpdateShortcuts.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/servicecore/code/UpdateShortcuts.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -59,7 +59,7 @@ UTIL::WIN::createShortCut(gcWString(spOne).c_str(), exe.c_str(), wd.c_str(), "", false); } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD if (UTIL::FS::isValidFile(spTwo) || force) { UTIL::FS::delFile(spTwo); diff -Nru libcef-desura-291/src/shared/uicore/CMakeLists.txt libcef-desura-291/src/shared/uicore/CMakeLists.txt --- libcef-desura-291/src/shared/uicore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -33,7 +33,6 @@ code/DStripMenuControls.cpp code/EulaForm.cpp code/ExeSelectForm.cpp - code/FrameButtons.cpp code/GameDiscForm.cpp code/gcImgLoader.cpp code/gcJSBinding.cpp @@ -83,8 +82,6 @@ code/MainApp_internal.cpp code/MainApp_wildcards.cpp code/MainForm.cpp - code/MainFormCustomFrame.cpp - code/MainFormLeftBorder.cpp code/MainMenuButton.cpp code/Managers.cpp code/MenuFiller.cpp @@ -134,6 +131,10 @@ file(GLOB PlattformSources) endif() +if(WITH_GTEST) + file(GLOB Gtest_Sources code/gcUnitTestPage.cpp) +endif() + add_definitions(-DUI_HIDE_MODS -DENABLE_SEARCH) if(WIN32) add_definitions(-D_WINDOWS @@ -151,7 +152,7 @@ use_unicode_here() endif() -add_library(uicore SHARED ${Sources} ${PlattformSources} ${BROWSER_PIPE_SPOURCES}) +add_library(uicore SHARED ${Sources} ${PlattformSources} ${Gtest_Sources} ${BROWSER_PIPE_SPOURCES}) target_link_libraries(uicore gcJSBase @@ -173,7 +174,9 @@ ${WINDOWS_LIBRARIES} ) -install(TARGETS uicore - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(uicore) -SET_PROPERTY(TARGET uicore PROPERTY FOLDER "Shared") +if(WIN32) + SetSharedRuntime(uicore) +endif() + +LinkWithGTest(uicore) +install_library(uicore) diff -Nru libcef-desura-291/src/shared/uicore/code/AboutForm.cpp libcef-desura-291/src/shared/uicore/code/AboutForm.cpp --- libcef-desura-291/src/shared/uicore/code/AboutForm.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/AboutForm.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -29,7 +29,7 @@ static const int ABOUT_FORM_WIDTH = 295; static const int ABOUT_FORM_HEIGHT = 412; #else - #ifdef DESURA_OFFICAL_BUILD + #ifdef DESURA_OFFICIAL_BUILD static const int ABOUT_FORM_WIDTH = 287; static const int ABOUT_FORM_HEIGHT = 462; #else diff -Nru libcef-desura-291/src/shared/uicore/code/AboutPageDev.cpp libcef-desura-291/src/shared/uicore/code/AboutPageDev.cpp --- libcef-desura-291/src/shared/uicore/code/AboutPageDev.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/AboutPageDev.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -24,7 +24,7 @@ {"Application Lead", "Mark Chandler", "Angry Drawf"}, {"Website Lead", "Scott Reismanis", "Slave Driver"}, {"Interface Design", "Joshua Collie", ""}, - #ifdef DESURA_OFFICAL_BUILD + #ifdef DESURA_OFFICIAL_BUILD {"Logo && Typography", "Tim Wilden", ""}, #else {"Logo && Typography", "notshi", ""}, diff -Nru libcef-desura-291/src/shared/uicore/code/AboutPageMain.cpp libcef-desura-291/src/shared/uicore/code/AboutPageMain.cpp --- libcef-desura-291/src/shared/uicore/code/AboutPageMain.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/AboutPageMain.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -67,11 +67,11 @@ } int offsetY = 0; -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD gcWString copy("\u00A9 {0} Desura Pty Ltd. All rights reserved. \nDesura is a trademark of Desura Pty Ltd.", reduced[2]); offsetY = 50; #else - gcWString copy("Desurium is open source software GPL v3. \nGet source from: http://github.com/lodle/Desurium"); + gcWString copy("Desurium is open source software GPL v3. \nGet source from: http://github.com/desura/Desurium"); offsetY = 85; #endif diff -Nru libcef-desura-291/src/shared/uicore/code/DStripMenuControls.cpp libcef-desura-291/src/shared/uicore/code/DStripMenuControls.cpp --- libcef-desura-291/src/shared/uicore/code/DStripMenuControls.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/DStripMenuControls.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -23,7 +23,8 @@ CVar gc_buttontol("gc_butMouseTol", "16", CFLAG_USER); -DStripMenuButton::DStripMenuButton(wxWindow *parent, const char* label, wxSize size) : wxEventDelegate(parent, gcWString(label).c_str(), size) +DStripMenuButton::DStripMenuButton(wxWindow *parent, const char* label, wxSize size) + : StripMenuButton(parent, gcWString(label).c_str(), size) { init("#menu_bg", "#menu_overlay"); m_bMouseDown = false; @@ -41,68 +42,3 @@ this->invalidatePaint(); } - -bool DStripMenuButton::handleEvent(wxMouseEvent& event) -{ - wxPoint mouse = wxGetMousePosition()-GetScreenPosition(); - - if (event.GetEventType() == wxEVT_MOTION) - { - if (m_bMouseDown) - { - if (!m_IgnoreRect.Contains(mouse)) - { - wxMouseEvent fakeEvent; - fakeEvent.SetEventType(wxEVT_LEFT_DOWN); - fakeEvent.SetEventObject(event.GetEventObject()); - - wxEventDelegate::handleEvent(fakeEvent); - wxEventDelegate::handleEvent(event); - m_bMouseDown = false; - } - else - { - return true; - } - } - else - { - return wxEventDelegate::handleEvent(event); - } - } - else if (event.GetEventType() == wxEVT_LEFT_DOWN) - { - uint32 is = gc_buttontol.getInt(); - - m_bMouseDown = true; - - wxPoint startPos = mouse; - startPos.x -= is/2; - startPos.y -= is/2; - - wxRect mouseRect(startPos, wxSize(is,is)); - - //need to take 6 of for drag border - wxSize size = GetSize(); - size.y -= 6; - wxRect curRect(wxPoint(0,6), size); - - m_IgnoreRect = curRect.Intersect(mouseRect); - - return true; - } - else if (event.GetEventType() == wxEVT_LEFT_UP) - { - if (!m_bMouseDown) - { - return wxEventDelegate::handleEvent(event); - } - else - { - m_bMouseDown = false; - return false; - } - } - - return wxEventDelegate::handleEvent(event); -} diff -Nru libcef-desura-291/src/shared/uicore/code/DStripMenuControls.h libcef-desura-291/src/shared/uicore/code/DStripMenuControls.h --- libcef-desura-291/src/shared/uicore/code/DStripMenuControls.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/DStripMenuControls.h 2013-10-17 18:16:34.000000000 +0000 @@ -23,18 +23,15 @@ #endif #include "wx_controls/gcControls.h" -#include "wx_controls/wxEventDelegate.h" #include "StripMenuButton.h" #include "MenuSeperator.h" -class DStripMenuButton : public wxEventDelegate +class DStripMenuButton : public StripMenuButton { public: DStripMenuButton(wxWindow *parent, const char* label, wxSize size = wxDefaultSize); void setActive(bool state); - virtual bool handleEvent(wxMouseEvent& event); - private: wxRect m_IgnoreRect; bool m_bMouseDown; @@ -43,10 +40,11 @@ wxColor m_NonActiveColor; }; -class DMenuSeperator : public wxEventDelegateWrapper +class DMenuSeperator : public MenuSeperator { public: - DMenuSeperator(wxWindow *parent, const wxSize &size = wxDefaultSize) : wxEventDelegateWrapper(parent, "#menu_separator", size) + DMenuSeperator(wxWindow *parent, const wxSize &size = wxDefaultSize) + : MenuSeperator(parent, "#menu_separator", size) { } diff -Nru libcef-desura-291/src/shared/uicore/code/DesuraControl.cpp libcef-desura-291/src/shared/uicore/code/DesuraControl.cpp --- libcef-desura-291/src/shared/uicore/code/DesuraControl.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/DesuraControl.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -31,21 +31,15 @@ #include "ButtonStrip.h" #include "MenuFiller.h" -#include "MainFormCustomFrame.h" -#include "MainFormLeftBorder.h" - #include "BaseToolBarControl.h" -#include "FrameButtons.h" - -#include "wx_controls/wxEventDelegate.h" #include "managers/CVar.h" extern CVar gc_lastavatar; -class DesuraMenuFiller : public wxEventDelegateWrapper +class DesuraMenuFiller : public MenuFiller { public: - DesuraMenuFiller(wxWindow *parent) : wxEventDelegateWrapper(parent, "#menu_bg", wxSize(25,38)) + DesuraMenuFiller(wxWindow *parent) : MenuFiller(parent, "#menu_bg", wxSize(25,38)) { } @@ -67,7 +61,6 @@ DesuraControl::DesuraControl(gcFrame* parent, bool offline) : gcPanel(parent) { - m_pMainCustomFrame = NULL; m_iIndex = -1; m_bDownloadingUpdate = false; m_uiUpdateProgress = 0; @@ -82,7 +75,7 @@ m_pMainMenuButton = new MainMenuButton(this, offline); - m_pAvatar = new wxEventDelegateWrapper( this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ), wxTAB_TRAVERSAL ); + m_pAvatar = new gcImageButton( this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ), wxTAB_TRAVERSAL ); #ifdef WIN32 m_pAvatar->SetCursor(wxCURSOR_HAND); @@ -104,28 +97,16 @@ m_pUsernameBox = new UsernameBox(this, offline?"Offline":GetUserCore()->getUserName()); m_pMenuStrip = new MenuStrip(this); -#ifdef WIN32 - m_pFrameButtons = new FrameButtons(this, parent); - m_pLeftBorder = new MainFormLeftBorder(this); -#endif -#ifdef WIN32 - m_sizerContent = new wxFlexGridSizer( 1, 2, 0, 0 ); - m_sizerContent->AddGrowableCol( 1 ); -#else m_sizerContent = new wxFlexGridSizer( 1, 1, 0, 0 ); m_sizerContent->AddGrowableCol( 0 ); -#endif m_sizerContent->AddGrowableRow( 0 ); m_sizerContent->SetFlexibleDirection( wxBOTH ); m_sizerContent->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); wxFlexGridSizer* fgSizer3; -#ifdef WIN32 - fgSizer3 = new wxFlexGridSizer( 1, 5, 0, 0 ); -#else + fgSizer3 = new wxFlexGridSizer( 1, 4, 0, 0 ); -#endif fgSizer3->AddGrowableCol( 2 ); fgSizer3->SetFlexibleDirection( wxBOTH ); @@ -135,10 +116,6 @@ fgSizer3->Add( m_pMenuStrip, 1, wxEXPAND, 5 ); // main buttons across the top fgSizer3->Add( m_pFiller, 1, wxEXPAND, 5 ); -#ifdef WIN32 - fgSizer3->Add( m_pFrameButtons, 1, wxEXPAND, 5 ); -#endif - m_sizerHeader = new wxBoxSizer( wxVERTICAL ); @@ -229,35 +206,15 @@ onResize(sEvent); } -void DesuraControl::regCustomFrame(gcMainCustomFrameImpl* mcf) -{ - m_pAvatar->regCustomFrame(mcf); - m_pUsernameBox->regCustomFrame(mcf); - m_pMenuStrip->regCustomFrame(mcf); -#ifdef WIN32 - m_pLeftBorder->regCustomFrame(mcf); - m_pFrameButtons->regCustomFrame(mcf); -#endif - m_pFiller->regCustomFrame(mcf); - m_pMainCustomFrame = mcf; -} - void DesuraControl::onActiveToggle(bool &state) { this->Freeze(); m_pMainMenuButton->onActiveToggle(state); -#ifdef WIN32 - m_pLeftBorder->onActiveToggle(state); -#endif m_pFiller->onActiveToggle(state); m_pUsernameBox->onActiveToggle(state); m_pMenuStrip->onActiveToggle(state); -#ifdef WIN32 - m_pFrameButtons->onActiveToggle(state); - m_pLeftBorder->onActiveToggle(state); -#endif if (m_iIndex != UNKNOWN_ITEM && m_iIndex < m_vTabInfo.size()) { @@ -338,9 +295,6 @@ if (reset) m_vTabInfo[index]->page->reset(); -#ifdef WIN32 - m_sizerContent->Add(m_pLeftBorder, 1, wxEXPAND, 0); -#endif m_sizerContent->Add( m_vTabInfo[index]->page, 1, wxEXPAND|wxBOTTOM, 1 ); m_sizerHeader->Add( m_vTabInfo[index]->header, 1, wxEXPAND|wxBOTTOM, 1 ); @@ -352,10 +306,6 @@ void DesuraControl::showLeftBorder(bool state) { -#ifdef WIN32 - m_pLeftBorder->Show(state); - m_pFrameButtons->changeMaxButton(!state); -#endif Layout(); } diff -Nru libcef-desura-291/src/shared/uicore/code/DesuraControl.h libcef-desura-291/src/shared/uicore/code/DesuraControl.h --- libcef-desura-291/src/shared/uicore/code/DesuraControl.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/DesuraControl.h 2013-10-17 18:16:34.000000000 +0000 @@ -24,7 +24,6 @@ #include "wx_controls/gcControls.h" #include "MainAppI.h" -#include "wx_controls/wxEventDelegate.h" class baseTabPage; class MainMenuButton; @@ -62,10 +61,6 @@ void setActivePage(PAGE index, bool reset = false); void setActivePage_ID(int32 id); - - - void regCustomFrame(gcMainCustomFrameImpl* mcf); - void showLeftBorder(bool state); void refreshSearch(); @@ -83,7 +78,7 @@ DesuraMenuFiller *m_pFiller; FrameButtons* m_pFrameButtons; - wxEventDelegateWrapper *m_pAvatar; + gcImageButton *m_pAvatar; void unloadSearch(baseTabPage* page); void loadSearch(baseTabPage* page); @@ -109,9 +104,6 @@ uint32 m_uiUpdateProgress; - MainFormLeftBorder* m_pLeftBorder; - gcMainCustomFrameImpl* m_pMainCustomFrame; - DECLARE_EVENT_TABLE(); }; diff -Nru libcef-desura-291/src/shared/uicore/code/FrameButtons.cpp libcef-desura-291/src/shared/uicore/code/FrameButtons.cpp --- libcef-desura-291/src/shared/uicore/code/FrameButtons.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/FrameButtons.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "FrameButtons.h" -#include "MainApp.h" - - - -FrameButtons::FrameButtons(wxWindow *parent, gcFrame* controler) - : gcFlickerFreePaint>(parent), CustomFrameButtons(this, controler, wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX, "#menu_bg", "#menu_bg_nonactive") -{ - SetMinSize(getRect().GetSize()); - - Bind( wxEVT_LEFT_DCLICK, &FrameButtons::onMouseDClick, this); - Bind( wxEVT_MOTION, &FrameButtons::onMouseMotion, this); - Bind( wxEVT_LEFT_DOWN, &FrameButtons::onMouseLDown, this); - Bind( wxEVT_LEFT_UP, &FrameButtons::onMouseLUp, this); - Bind( wxEVT_MOUSE_CAPTURE_LOST, &FrameButtons::onMouseCaptureLost, this); - - calcBorders(getRect().GetSize().GetWidth(), 0); -} - -FrameButtons::~FrameButtons() -{ -} - -void FrameButtons::calcBorders(int wb, int yoff) -{ - CustomFrameButtons::calcBorders(wb, yoff); - m_ButtonPos.y = 0; -} - -void FrameButtons::onActiveToggle(bool state) -{ - setActive(state); - invalidatePaint(); -} - -void FrameButtons::changeMaxButton(bool isMaxed) -{ - invalidateBitmap(); -} - -void FrameButtons::onMouseCaptureLost(wxMouseCaptureLostEvent &event) -{ - if (HasCapture()) - ReleaseMouse(); - - onMouseUp(); -} - -void FrameButtons::onMouseDClick( wxMouseEvent& event ) -{ - onMouseDoubleClick(); -} - -void FrameButtons::onMouseMotion( wxMouseEvent& event ) -{ - onMouseMove(); -} - -void FrameButtons::onMouseLDown( wxMouseEvent& event ) -{ - onMouseDown(); -} - -void FrameButtons::onMouseLUp( wxMouseEvent& event ) -{ - onMouseUp(); -} - -void FrameButtons::doPaint(wxDC* dc) -{ - drawBg(dc); - generateButtons(dc); -} - -void FrameButtons::clearBg(wxDC* dc) -{ - drawBg(dc); -} - -void FrameButtons::drawBg(wxDC* dc) -{ - wxSize sz = GetSize(); - - uint32 w = sz.GetWidth(); - uint32 h = sz.GetHeight(); - - wxBitmap borderBMP = isActive()?m_imgBorder->Copy():m_imgBorderNA->Copy(); - wxBitmap temp(w, h); - gcImage::tileImg(temp, borderBMP); - - dc->DrawBitmap(temp, wxPoint(0,0), true); -} - -void FrameButtons::invalidatePaint() -{ - CustomFrameButtons::invalidateBitmap(); - gcFlickerFreePaint>::invalidatePaint(); -} - -void FrameButtons::invalidateBitmap() -{ - CustomFrameButtons::invalidateBitmap(); - gcFlickerFreePaint>::invalidatePaint(); -} \ No newline at end of file diff -Nru libcef-desura-291/src/shared/uicore/code/FrameButtons.h libcef-desura-291/src/shared/uicore/code/FrameButtons.h --- libcef-desura-291/src/shared/uicore/code/FrameButtons.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/FrameButtons.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_FRAMEBUTTONS_H -#define DESURA_FRAMEBUTTONS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "wx_controls/gcControls.h" -#include "wx_controls/gcImageHandle.h" -#include "wx_controls/wxEventDelegate.h" -#include "wx_controls/gcCustomFrameButtons.h" - -#include "wx_controls/gcFlickerFreePaint.h" - -class FrameButton; - -class FrameButtons : public gcFlickerFreePaint>, private CustomFrameButtons -{ -public: - FrameButtons(wxWindow *parent, gcFrame* controler); - ~FrameButtons(); - - void changeMaxButton(bool isMaxed); - - virtual void invalidatePaint(); - virtual void invalidateBitmap(); - - virtual void calcBorders(int wb, int yoff); - - void onActiveToggle(bool state); - -protected: - void onMouseDClick( wxMouseEvent& event ); - void onMouseMotion( wxMouseEvent& event ); - void onMouseLDown( wxMouseEvent& event ); - void onMouseLUp( wxMouseEvent& event ); - void onMouseCaptureLost(wxMouseCaptureLostEvent &event); - - void drawBg(wxDC* dc); - void doPaint(wxDC* dc); - virtual void clearBg(wxDC* dc); - -}; - -#endif //DESURA_FRAMEBUTTONS_H diff -Nru libcef-desura-291/src/shared/uicore/code/HtmlToolBarControl.cpp libcef-desura-291/src/shared/uicore/code/HtmlToolBarControl.cpp --- libcef-desura-291/src/shared/uicore/code/HtmlToolBarControl.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/HtmlToolBarControl.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -22,7 +22,8 @@ #include "CrumbInfo.h" #include "SearchControl.h" -HtmlToolBarControl::HtmlToolBarControl(wxWindow* parent) : BaseToolBarControl(parent) +HtmlToolBarControl::HtmlToolBarControl(wxWindow* parent) + : BaseToolBarControl(parent) { m_butBack = new gcImageButton( this, BUTTON_BACK, wxDefaultPosition, wxSize( 19,19 ), 0 ); m_butBack->setDefaultImage(("#browser_back")); @@ -79,7 +80,7 @@ fgSizer1->Add( m_butFoward, 0, wxTOP|wxBOTTOM, 4 ); fgSizer1->Add( 3, 0, 1, 0, 4 ); fgSizer1->Add( m_butHome, 0, wxTOP|wxBOTTOM, 4 ); - fgSizer1->Add( m_pBreadCrumb, 0, wxTOP|wxBOTTOM|wxEXPAND, 4 ); + fgSizer1->Add( m_pBreadCrumb, 0, wxTOP|wxBOTTOM, 4 ); fgSizer1->Add( m_dispLoading, 1, wxTOP|wxBOTTOM, 4 ); fgSizer1->Add( m_butStop, 1, wxTOP|wxBOTTOM, 4 ); fgSizer1->Add( m_butRefresh, 0, wxTOP|wxBOTTOM, 4 ); @@ -166,6 +167,8 @@ CrumbInfo* info = new CrumbInfo(wname.c_str(), wurl.c_str(), 0); info->crumbId = m_pBreadCrumb->addItem(name, (uint32)m_vCrumbList.size()-1); m_vCrumbList.push_back(info); + + this->Layout(); } void HtmlToolBarControl::clearCrumbs() @@ -173,6 +176,8 @@ m_pBreadCrumb->clear(); safe_delete(m_vCrumbList); m_vCrumbList.clear(); + + this->Layout(); } const wchar_t* HtmlToolBarControl::getCrumbUrl(int32 id) diff -Nru libcef-desura-291/src/shared/uicore/code/LoginForm.cpp libcef-desura-291/src/shared/uicore/code/LoginForm.cpp --- libcef-desura-291/src/shared/uicore/code/LoginForm.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/LoginForm.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -730,6 +730,7 @@ gc_lastusername.setValue((const char*)dastr.c_str()); } + SaveCVars(); Show(false); MainApp* temp = dynamic_cast(GetParent()); diff -Nru libcef-desura-291/src/shared/uicore/code/MainApp.cpp libcef-desura-291/src/shared/uicore/code/MainApp.cpp --- libcef-desura-291/src/shared/uicore/code/MainApp.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainApp.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -42,6 +42,10 @@ #include "InternalLink.h" #include "DesuraServiceError.h" +#ifdef WITH_GTEST +#include "gcUnitTestPage.h" +#endif + extern void DeleteCookies(); extern void SetCookies(); @@ -200,7 +204,9 @@ m_pOfflineDialog = NULL; m_pInternalLink = NULL; - +#ifdef WITH_GTEST + m_UnitTestForm = NULL; +#endif onLoginAcceptedEvent += guiDelegate(this, &MainApp::onLoginAcceptedCB); onInternalLinkEvent += guiDelegate(this, &MainApp::onInternalLink); onInternalLinkStrEvent += guiDelegate(this, &MainApp::onInternalStrLink); @@ -210,9 +216,15 @@ MainApp::~MainApp() { if (m_pOfflineDialog) - { m_pOfflineDialog->EndModal(0); + +#ifdef WITH_GTEST + if (m_UnitTestForm) + { + m_UnitTestForm->canClose(); + m_UnitTestForm->Close(); } +#endif safe_delete(m_vNewsItems); safe_delete(m_pInternalLink); @@ -662,6 +674,10 @@ void MainApp::showLogin(bool skipAutoLogin) { +#ifdef DEBUG + showUnitTest(); +#endif + if (!m_wxLoginForm) m_wxLoginForm = new LoginForm(this); @@ -782,3 +798,13 @@ if (!m_bLoggedIn && m_iMode != MODE_OFFLINE && m_wxLoginForm) m_wxLoginForm->newAccountLogin(username, cookie); } + +void MainApp::showUnitTest() +{ +#ifdef WITH_GTEST + if (!m_UnitTestForm) + m_UnitTestForm = new gcUnitTestForm(this); + + m_UnitTestForm->postShowEvent(); +#endif +} diff -Nru libcef-desura-291/src/shared/uicore/code/MainApp.h libcef-desura-291/src/shared/uicore/code/MainApp.h --- libcef-desura-291/src/shared/uicore/code/MainApp.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainApp.h 2013-10-17 18:16:34.000000000 +0000 @@ -84,6 +84,7 @@ class InternalLink; class TaskBarIcon; +class gcUnitTestForm; class MainApp : public MainAppI { @@ -131,6 +132,8 @@ virtual void newAccountLogin(const char* username, const char* cookie); + void showUnitTest(); + protected: void showLogin(bool skipAutoLogin = false); void showOffline(); @@ -193,6 +196,10 @@ gcString m_szDesuraCache; +#ifdef WITH_GTEST + gcUnitTestForm* m_UnitTestForm; +#endif + LoginForm* m_wxLoginForm; MainForm* m_wxMainForm; TaskBarIcon* m_wxTBIcon; diff -Nru libcef-desura-291/src/shared/uicore/code/MainForm.cpp libcef-desura-291/src/shared/uicore/code/MainForm.cpp --- libcef-desura-291/src/shared/uicore/code/MainForm.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainForm.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -24,9 +24,6 @@ #include "MainApp.h" #include "Color.h" -#include "MainFormCustomFrame.h" -#include "MainFormLeftBorder.h" - #include "HtmlTabPage.h" #include "ItemTabPage.h" #include "AboutForm.h" @@ -34,7 +31,6 @@ #include "Managers.h" #include "DesuraControl.h" - #include @@ -198,14 +194,6 @@ void MainForm::loadFrame(long style) { - if (!getCustomFrame()) - { - gcMainCustomFrameImpl* mcf = new gcMainCustomFrameImpl(this, this, style); - - m_pDesuraControl->regCustomFrame(mcf); - init(mcf); - } - #ifdef NIX Raise(); #endif @@ -311,6 +299,10 @@ ShowLogForm(true); break; + case DESURA_wxUnitTest: + g_pMainApp->showUnitTest(); + break; + case DESURA_wxSettings: g_pMainApp->handleInternalLink(0, ACTION_SHOWSETTINGS); break; diff -Nru libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.cpp libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.cpp --- libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "MainFormCustomFrame.h" - -#include "Managers.h" - -#ifdef NIX -#include -#endif - -gcMainCustomFrameImpl::gcMainCustomFrameImpl(wxTopLevelWindow* parent, FrameIcon* frameIcon, long style) : gcCustomFrameImpl(parent, frameIcon, style) -{ - m_imgMainBorder = GetGCThemeManager()->getImageHandle("#main_header_border"); - m_imgMainBorderNA = GetGCThemeManager()->getImageHandle("#main_header_border_nonactive"); - m_pLastEventHandler = NULL; - - setTitleHeight(0); - showTitle(false); - - m_bMenuHover = false; - safe_delete(m_pCFButtons); -} - -gcMainCustomFrameImpl::~gcMainCustomFrameImpl() -{ -} - -bool gcMainCustomFrameImpl::handleEvent(wxEvtHandler *obj, wxMouseEvent &event) -{ - if (!event.GetEventObject()) - return false; - - if (event.GetEventType() == wxEVT_LEFT_DCLICK) - { - onLeftDClick(event); - } - else if (event.GetEventType() == wxEVT_MOTION) - { - onMouseMove(event); - } - else if (event.GetEventType() == wxEVT_LEFT_DOWN) - { - onLeftMouseDown(event); - m_pLastEventHandler = obj; - } - else if (event.GetEventType() == wxEVT_LEFT_UP) - { - onLeftMouseUp(event); - } - else if (event.GetEventType() == wxEVT_RIGHT_DOWN) - { - onRightMouseDown(event); - } - - bool skipped = event.GetSkipped(); - event.Skip(false); - - return !skipped; -} - -void gcMainCustomFrameImpl::onLeftMouseUp(wxMouseEvent& event) -{ - gcCustomFrameImpl::onLeftMouseUp(event); - - if (event.GetSkipped()) - { - wxObject *obj = event.GetEventObject(); - - //Normally event is due to CaptureMouse so make sure if a control gave us the mouse down we give it mouse up - if (obj == m_pParent && m_pLastEventHandler) - m_pLastEventHandler->AddPendingEvent(event); - } - - m_pLastEventHandler = NULL; -} - -void gcMainCustomFrameImpl::calcBorders() -{ - gcCustomFrameImpl::calcBorders(); - m_TitleBorder.SetHeight(40); - m_pCFMove->calcBorders(m_TitleBorder, m_TitleAreaRect); -} - -void gcMainCustomFrameImpl::generateBorder(wxDC* dc) -{ - wxRect wbr = getWindowsBorderRect(); - - if (!m_imgMainBorder->IsOk() || m_pParent->IsMaximized()) - { - gcCustomFrameImpl::generateBorder(dc); - return; - } - - int ih = m_imgMainBorder->GetSize().GetHeight(); - int iw = m_imgMainBorder->GetSize().GetWidth(); - - wxImage borderImg = isActive()?m_imgMainBorder->Scale(iw, ih):m_imgMainBorderNA->Scale(iw, ih); - wxBitmap borderBMPR(borderImg); - - int w = wbr.GetWidth() + wbr.GetLeft() - borderBMPR.GetWidth(); - wxRect imgRect(wxPoint(w, wbr.GetTop()), borderBMPR.GetSize()); - - wxRegion region = generateBorderRegion(); - region.Subtract(imgRect); - - dc->DestroyClippingRegion(); - dc->SetDeviceClippingRegion(region); - - gcCustomFrameImpl::generateBorder(dc); - - dc->DestroyClippingRegion(); - - dc->DrawBitmap(borderBMPR, imgRect.GetTopLeft(), true); -} - -void gcMainCustomFrameImpl::generateTitle(wxDC* dc) -{ -} - -void gcMainCustomFrameImpl::DoGetClientSize(int *width, int *height) const -{ - gcCustomFrameImpl::DoGetClientSize(width, height); - - if (isMaximized() == false) - *width += 5; //missing left border - - *height += 7; //missing top border -} - -wxPoint gcMainCustomFrameImpl::GetClientAreaOrigin() const -{ - if (isMaximized()) - return wxPoint(0,0); - - return wxPoint(1,1); -} - -void gcMainCustomFrameImpl::setMenuHover(bool state) -{ - m_bMenuHover = state; - m_pParent->Refresh(false); -} - -wxRect gcMainCustomFrameImpl::getClientAreaRect() -{ - wxRect wbr = getWindowsBorderRect(); - wxRect cr = m_pParent->GetClientRect(); - - return wxRect(wbr.GetTopLeft(), cr.GetSize()); -} - -void gcMainCustomFrameImpl::onPaintNC(wxNcPaintEvent& event) -{ - wxWindowDC dc(m_pParent); - - wxSize pSize = m_pParent->GetSize(); - - wxRect ca = getClientAreaRect(); - ca.x += 1; - ca.y += 1; - ca.width -= 1; - ca.height -= 1; - - wxRegion region(wxRect(wxPoint(0,0), pSize)); - region.Subtract(ca); - - if (!m_BorderBitmap.IsOk() || m_BorderBitmap.GetSize() != pSize) - m_BorderBitmap = wxBitmap(pSize); - - wxMemoryDC tmpDC(m_BorderBitmap); - tmpDC.DestroyClippingRegion(); - tmpDC.SetDeviceClippingRegion(region); - - doPaintBorder(&tmpDC); - tmpDC.SelectObject(wxNullBitmap); - - dc.DestroyClippingRegion(); - dc.SetDeviceClippingRegion(region); - - dc.DrawBitmap(m_BorderBitmap, wxPoint(0,0), true); -} - -void gcMainCustomFrameImpl::onPaintBG( wxEraseEvent& event ) -{ - wxDC* dc = event.GetDC(); - - wxRect ca = getClientAreaRect(); - wxColor col = m_pParent->GetBackgroundColour(); - - ca.x += 1; - ca.y += 1; - ca.width -= 1; - ca.height -= 1; - - dc->DestroyClippingRegion(); - dc->SetDeviceClippingRegion(ca); - - dc->SetPen(wxPen(col)); - dc->SetBrush(wxBrush(col)); - dc->DrawRectangle(ca); - - dc->DestroyClippingRegion(); - - - //wxSize pSize = m_pParent->GetSize(); - //wxBitmap tmp(pSize); - - //wxMemoryDC tmpDC(tmp); - //tmpDC.DestroyClippingRegion(); - //tmpDC.SetDeviceClippingRegion(ca); - //tmpDC.SetPen(wxPen(col)); - //tmpDC.SetBrush(wxBrush(col)); - //tmpDC.DrawRectangle(ca); - //tmpDC.SelectObject(wxNullBitmap); - - //tmp.SaveFile("bg_paint.bmp", wxBitmapType::wxBITMAP_TYPE_BMP); - - wxNcPaintEvent ncE; - onPaintNC(ncE); - - m_pParent->Refresh(false); -} - -void gcMainCustomFrameImpl::doMaximize() -{ - if (m_bIsMaximized) - return; - - m_bIsMaximized = true; - m_RestorSize = m_pParent->GetRect(); - -#ifdef WIN32 - MONITORINFO mi = { sizeof(mi) }; - - HWND hwnd = (HWND)m_pParent->GetHWND(); - - WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) }; - GetWindowPlacement(hwnd, &g_wpPrev); - GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi); - wxRect wbr = getWindowsBorderRect(); - - wxPoint pos = wxPoint(mi.rcWork.left, mi.rcWork.top) - wbr.GetTopLeft(); - wxSize size = wxSize(mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top); -#else - gint posX; - gint posY; - gint winW; - gint winH; - gdk_window_get_position(GDK_WINDOW(m_pParent->GetHandle()), &posX, &posY); - gdk_window_get_size(GDK_DRAWABLE(m_pParent->GetHandle()), &winW, &winH); - - wxRect wbr = getWindowsBorderRect(); - - wxPoint pos = wxPoint((int)posX, (int)posY) - wbr.GetTopLeft(); - wxSize size = wxSize((int)winW, (int)winH); -#endif - - m_pParent->SetSize(wxRect(pos, size)); - - if (m_pCFButtons) - m_pCFButtons->invalidateBitmap(); - - calcBorders(); - setFrameRegion(); - m_pParent->Refresh(true); -} diff -Nru libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.h libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.h --- libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainFormCustomFrame.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_MAINFORMCUSTOMFRAME_H -#define DESURA_MAINFORMCUSTOMFRAME_H -#ifdef _WIN32 -#pragma once -#endif - -#include "wx_controls/gcCustomFrameImpl.h" - - -class gcMainCustomFrameImpl : public gcCustomFrameImpl -{ -public: - gcMainCustomFrameImpl(wxTopLevelWindow* parent, FrameIcon* frameIcon, long style); - ~gcMainCustomFrameImpl(); - - virtual void DoGetClientSize(int *width, int *height) const; - virtual wxPoint GetClientAreaOrigin() const; - - bool handleEvent(wxEvtHandler *obj, wxMouseEvent &event); - void setMenuHover(bool state); - -protected: - virtual void calcBorders(); - virtual void generateBorder(wxDC* dc); - virtual void generateTitle(wxDC* dc); - - virtual void onLeftMouseUp(wxMouseEvent& event); - - virtual void onPaintBG( wxEraseEvent& event ); - virtual void onPaintNC(wxNcPaintEvent& event); - - wxRect getClientAreaRect(); - - virtual void doMaximize(); - -private: - std::vector m_vControlList; - - bool m_bMenuHover; - - gcImageHandle m_imgMainBorder; - gcImageHandle m_imgMainBorderNA; - - wxEvtHandler* m_pLastEventHandler; -}; - -#endif //DESURA_MAINFORMCUSTOMFRAME_H diff -Nru libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.cpp libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.cpp --- libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "MainFormLeftBorder.h" - -#include "wx_controls/gcManagers.h" - -MainFormLeftBorder::MainFormLeftBorder(wxWindow* parent) : wxEventDelegateWrapper>(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0) -{ - m_imgBorder = GetGCThemeManager()->getImageHandle("#main_border"); - - this->SetMinSize(wxSize(5,-1)); - this->SetMaxSize(wxSize(5,-1)); -} - -void MainFormLeftBorder::onActiveToggle(bool state) -{ - m_imgBorder = GetGCThemeManager()->getImageHandle(state?"#main_border":"#main_border_nonactive"); - invalidatePaint(); -} - -void MainFormLeftBorder::doPaint(wxDC* dc) -{ - dc->SetBackground(wxBrush(wxColor(0,0,0),wxBRUSHSTYLE_SOLID)); - dc->Clear(); - - int w = GetSize().GetWidth(); - int h = GetSize().GetHeight(); - - int iw = m_imgBorder->GetSize().GetWidth(); - int ih = m_imgBorder->GetSize().GetHeight(); - - wxImage borderImg = m_imgBorder->Scale(iw, ih); - - SpriteRectI *imgRect = GetGCThemeManager()->getSpriteRect("main_border", "west"); - - wxBitmap borderBMP(GetGCThemeManager()->getSprite(borderImg, "main_border", "west").ConvertToImage().GetSubImage(wxRect(1,0,imgRect->getW()-1,imgRect->getH()))); - wxBitmap borderBMPTarg(w,h); - - wxColor c(255,0,255); - gcImage::tileImg(borderBMPTarg, borderBMP, &c, gcImage::VERT); - dc->DrawBitmap(borderBMPTarg, 0, 0, true); -} diff -Nru libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.h libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.h --- libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainFormLeftBorder.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#ifndef DESURA_MAINFORMLEFTBORDER_H -#define DESURA_MAINFORMLEFTBORDER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "wx_controls/gcPanel.h" -#include "wx_controls/wxEventDelegate.h" -#include "wx_controls/gcFlickerFreePaint.h" - -class MainFormLeftBorder : public wxEventDelegateWrapper> -{ -public: - MainFormLeftBorder(wxWindow* parent); - void onActiveToggle(bool state); - -protected: - virtual void doPaint(wxDC* dc); - -private: - gcImageHandle m_imgBorder; -}; - -#endif //DESURA_MAINFORMLEFTBORDER_H diff -Nru libcef-desura-291/src/shared/uicore/code/MainMenuButton.cpp libcef-desura-291/src/shared/uicore/code/MainMenuButton.cpp --- libcef-desura-291/src/shared/uicore/code/MainMenuButton.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainMenuButton.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -19,7 +19,6 @@ #include "Common.h" #include "MainMenuButton.h" #include -#include "MainFormCustomFrame.h" #include @@ -103,7 +102,7 @@ m_historyMenu->Append(DESURA_wxPurchase, Managers::GetString(L"#MENU_PURCHASE"), Managers::GetString(L"#MENU_PURCHASE_TOOLTIP")); m_historyMenu->Append(DESURA_wxCart, Managers::GetString(L"#MENU_CART"), Managers::GetString(L"#MENU_CART_TOOLTIP")); -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD m_historyMenu->Append(DESURA_wxChangeLog, Managers::GetString(L"#MENU_CHANGELOG"), Managers::GetString(L"#MENU_CHANGELOG_TOOLTIP")); #endif @@ -121,6 +120,11 @@ m_mainMenu->Append(-1, Managers::GetString(L"#MENU_TOOLS"), m_toolMenu); m_mainMenu->AppendSeparator(); +#if defined(DEBUG) && defined(WITH_GTEST) + m_mainMenu->Append(DESURA_wxUnitTest, Managers::GetString(L"#MENU_UNITTEST")); + m_mainMenu->AppendSeparator(); +#endif + m_mainMenu->Append(DESURA_wxExit, Managers::GetString(L"#MENU_EXIT"), Managers::GetString(L"#MENU_EXIT_TOOLTIP")); if (offline) @@ -135,7 +139,7 @@ m_historyMenu->Enable(DESURA_wxGifts, false); m_historyMenu->Enable(DESURA_wxPurchase, false); m_historyMenu->Enable(DESURA_wxCart, false); -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD m_historyMenu->Enable(DESURA_wxChangeLog, false); #endif diff -Nru libcef-desura-291/src/shared/uicore/code/MainMenuButton.h libcef-desura-291/src/shared/uicore/code/MainMenuButton.h --- libcef-desura-291/src/shared/uicore/code/MainMenuButton.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MainMenuButton.h 2013-10-17 18:16:34.000000000 +0000 @@ -35,7 +35,6 @@ #include #include "BaseMenuButton.h" -#include "wx_controls/wxEventDelegate.h" #include "wx_controls/gcCustomMenu.h" enum @@ -62,6 +61,7 @@ DESURA_wxPurchase, DESURA_wxGifts, DESURA_wxActivateGame, + DESURA_wxUnitTest, }; class gcMainCustomFrameImpl; diff -Nru libcef-desura-291/src/shared/uicore/code/MenuStrip.cpp libcef-desura-291/src/shared/uicore/code/MenuStrip.cpp --- libcef-desura-291/src/shared/uicore/code/MenuStrip.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MenuStrip.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -18,7 +18,6 @@ #include "Common.h" #include "MenuStrip.h" -#include "MainFormCustomFrame.h" #include "DStripMenuControls.h" @@ -53,22 +52,6 @@ } } -void MenuStrip::regCustomFrame(gcMainCustomFrameImpl* mcf) -{ - for (size_t x=0; x(m_vButtons[x]->getButton()); - - if (smb) - smb->regCustomFrame(mcf); - - DMenuSeperator* ms = dynamic_cast(m_vButtons[x]->getButton()); - - if (ms) - ms->regCustomFrame(mcf); - } -} - void MenuStrip::setSelected(uint32 count) { uint32 index = count*2 + 1; diff -Nru libcef-desura-291/src/shared/uicore/code/MenuStrip.h libcef-desura-291/src/shared/uicore/code/MenuStrip.h --- libcef-desura-291/src/shared/uicore/code/MenuStrip.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/MenuStrip.h 2013-10-17 18:16:34.000000000 +0000 @@ -23,7 +23,6 @@ #endif #include "wx_controls/gcControls.h" -#include "wx_controls/wxEventDelegate.h" @@ -42,8 +41,6 @@ void setSelected(uint32 count); int32 addButton(const char* name); - void regCustomFrame(gcMainCustomFrameImpl* mcf); - void onActiveToggle(bool state); protected: diff -Nru libcef-desura-291/src/shared/uicore/code/UICoreEntry.cpp libcef-desura-291/src/shared/uicore/code/UICoreEntry.cpp --- libcef-desura-291/src/shared/uicore/code/UICoreEntry.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/UICoreEntry.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -25,6 +25,10 @@ #include #include +#ifdef WITH_GTEST + #include +#endif + extern "C" CEXPORT UICoreI* GetInterface(); #ifdef NIX @@ -251,6 +255,16 @@ } #endif + int runUnitTests(int argc, char** argv) + { +#ifdef WITH_GTEST + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +#else + return 0; +#endif + } + private: DumpSettingsFP m_pDumpSettings; DumpLevelFP m_pDumpLevel; diff -Nru libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.cpp libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.cpp --- libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,318 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + + +#include "Common.h" +#include "gcUnitTestPage.h" + +#include +#include +#include "managers/CVar.h" + +using namespace testing; + +CVar g_bAssertOnFailure("unittest_assertonfailure", "true"); +CVar g_bRunOnStartup("unittest_runonstartup", "true"); +CVar g_strUnitTestFilter("unittest_filter", "*"); + +class gcUnitTestWatcher : public EmptyTestEventListener +{ +public: + void OnTestIterationStart(const UnitTest& unit_test, int iteration) + { + onStartEvent(); + } + + void OnTestIterationEnd(const UnitTest& unit_test, int iteration) + { + onEndEvent(); + } + + void OnTestStart(const TestInfo& test_info) + { + m_szLastTest = gcString("{0}/{1}", test_info.test_case_name(), test_info.name()); + onTestStartEvent(m_szLastTest); + } + + void OnTestPartResult(const TestPartResult& test_part_result) + { + if (test_part_result.failed() && g_bAssertOnFailure.getBool()) + wxASSERT(FALSE); + } + + void OnTestEnd(const TestInfo& test_info) + { + std::pair res = std::make_pair(m_szLastTest, test_info.result()->Passed()); + std::pair end = std::make_pair(m_szLastTest, (uint64)test_info.result()->elapsed_time()); + + onTestResultEvent(res); + onTestEndEnd(end); + } + + gcString m_szLastTest; + + EventV onStartEvent; + EventV onEndEvent; + + Event onTestStartEvent; + Event> onTestResultEvent; + Event> onTestEndEnd; +}; + +class CUnitTestThread : public Thread::BaseThread +{ +public: + CUnitTestThread() + : BaseThread("UnitTestThread") + { + + } + + void run() + { + m_strFilter = g_strUnitTestFilter.getString(); + + GTEST_FLAG(filter) = m_strFilter; + RUN_ALL_TESTS(); + GTEST_FLAG(filter) = '\0'; + } + + gcString m_strFilter; +}; + + +static gcUnitTestWatcher* SetupTestWatcher() +{ + gcUnitTestWatcher* pWatcher = new gcUnitTestWatcher(); + + TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); + listeners.Append(pWatcher); + + int argc = 0; + InitGoogleTest(&argc, (char**)NULL); + + return pWatcher; +} + +static gcUnitTestWatcher *g_pTestWatcher = SetupTestWatcher(); + +gcUnitTestForm::gcUnitTestForm(wxWindow* parent) + : gcDialog(parent, wxID_ANY, wxT("Unit Tests Results"), wxDefaultPosition, wxSize(500, 354), wxCAPTION | wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) + , m_pThread(NULL) + , m_ImageList(16, 16) + , m_bShouldClose(false) +{ + showEvent += guiDelegate(this, &gcUnitTestForm::onShow); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &gcUnitTestForm::onButtonClicked, this); + Bind(wxEVT_CLOSE_WINDOW, &gcUnitTestForm::OnClose, this); + + this->SetSizeHints(wxDefaultSize, wxDefaultSize); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer(4, 1, 0, 0); + fgSizer1->AddGrowableCol(0); + fgSizer1->AddGrowableRow(2); + fgSizer1->SetFlexibleDirection(wxBOTH); + fgSizer1->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); + + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer(wxHORIZONTAL); + + m_cbAssertOnError = new wxCheckBox(this, wxID_ANY, wxT("Assert On Error"), wxDefaultPosition, wxDefaultSize, 0); + m_cbAssertOnError->SetValue(true); + bSizer2->Add(m_cbAssertOnError, 0, wxALL, 5); + + m_cbRunOnStartup = new wxCheckBox(this, wxID_ANY, wxT("Run On Startup"), wxDefaultPosition, wxDefaultSize, 0); + m_cbRunOnStartup->SetValue(true); + bSizer2->Add(m_cbRunOnStartup, 0, wxALL, 5); + + fgSizer1->Add(bSizer2, 1, wxEXPAND, 5); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer(wxHORIZONTAL); + + m_staticText1 = new wxStaticText(this, wxID_ANY, wxT("Filter:"), wxDefaultPosition, wxDefaultSize, 0); + m_staticText1->Wrap(-1); + bSizer1->Add(m_staticText1, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxLEFT, 5); + + m_textCtrl1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); + bSizer1->Add(m_textCtrl1, 1, wxEXPAND | wxALL, 5); + + m_butRun = new wxButton(this, wxID_ANY, wxT("Run"), wxDefaultPosition, wxDefaultSize, 0); + bSizer1->Add(m_butRun, 0, wxTOP | wxBOTTOM | wxRIGHT, 5); + + fgSizer1->Add(bSizer1, 1, wxEXPAND, 5); + + m_lcUnitTests = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SORT_ASCENDING); + fgSizer1->Add(m_lcUnitTests, 1, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5); + + m_butClose = new wxButton(this, wxID_ANY, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0); + fgSizer1->Add(m_butClose, 0, wxALIGN_RIGHT | wxBOTTOM | wxRIGHT | wxLEFT, 5); + + this->SetSizer(fgSizer1); + this->Layout(); + + this->Centre(wxBOTH); + + m_cbRunOnStartup->SetValue(g_bRunOnStartup.getBool()); + m_cbAssertOnError->SetValue(g_bAssertOnFailure.getBool()); + + m_textCtrl1->SetValue(g_strUnitTestFilter.getString()); + + m_cbRunOnStartup->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &gcUnitTestForm::OnRunOnStartupClicked, this); + m_cbAssertOnError->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &gcUnitTestForm::OnAssertOnErrorClicked, this); + m_textCtrl1->Bind(wxEVT_COMMAND_TEXT_UPDATED, &gcUnitTestForm::OnTextChanged, this); + + + m_icoTestGood = GetGCThemeManager()->getImageHandle("#test_good"); + m_icoTestBad = GetGCThemeManager()->getImageHandle("#test_bad"); + + m_ImageList.Add(wxBitmap(m_icoTestBad.getImg()->Scale(16, 16))); + m_ImageList.Add(wxBitmap(m_icoTestGood.getImg()->Scale(16, 16))); + + m_lcUnitTests->SetImageList(&m_ImageList, wxIMAGE_LIST_NORMAL); + m_lcUnitTests->SetImageList(&m_ImageList, wxIMAGE_LIST_SMALL); + + g_pTestWatcher->onStartEvent += guiDelegate(this, &gcUnitTestForm::onStart); + g_pTestWatcher->onEndEvent += guiDelegate(this, &gcUnitTestForm::onEnd); + + g_pTestWatcher->onTestStartEvent += guiDelegate(this, &gcUnitTestForm::onTestStart); + g_pTestWatcher->onTestResultEvent += guiDelegate(this, &gcUnitTestForm::onTestResult); + g_pTestWatcher->onTestEndEnd += guiDelegate(this, &gcUnitTestForm::onTestEnd); + + if (g_bRunOnStartup.getBool()) + runTests(); +} + +gcUnitTestForm::~gcUnitTestForm() +{ + g_pTestWatcher->onStartEvent -= guiDelegate(this, &gcUnitTestForm::onStart); + g_pTestWatcher->onEndEvent -= guiDelegate(this, &gcUnitTestForm::onEnd); + + g_pTestWatcher->onTestStartEvent -= guiDelegate(this, &gcUnitTestForm::onTestStart); + g_pTestWatcher->onTestResultEvent -= guiDelegate(this, &gcUnitTestForm::onTestResult); + g_pTestWatcher->onTestEndEnd -= guiDelegate(this, &gcUnitTestForm::onTestEnd); + + if (m_pThread) + m_pThread->stop(); + + delete m_pThread; +} + +void gcUnitTestForm::onButtonClicked(wxCommandEvent& event) +{ + if (event.GetId() == m_butRun->GetId()) + { + runTests(); + } + else + { + Show(false); + } +} + +void gcUnitTestForm::runTests() +{ + m_butRun->Enable(false); + + if (m_pThread) + m_pThread->stop(); + + delete m_pThread; + + m_pThread = new CUnitTestThread(); + m_pThread->start(); +} + +void gcUnitTestForm::onStart() +{ + m_lcUnitTests->ClearAll(); + + m_lcUnitTests->InsertColumn(0, "", 0, 25); + m_lcUnitTests->InsertColumn(1, "Test Name", 0, 375); + m_lcUnitTests->InsertColumn(2, "Run Time"); + + m_mTestIndex.clear(); +} + +void gcUnitTestForm::onEnd() +{ + m_butRun->Enable(true); +} + +void gcUnitTestForm::onTestStart(gcString &strTest) +{ + m_mTestIndex[strTest] = m_lcUnitTests->InsertItem(-1, ""); + m_lcUnitTests->SetItem(m_mTestIndex[strTest], 1, strTest); +} + +void gcUnitTestForm::onTestResult(std::pair &result) +{ + m_lcUnitTests->SetItem(m_mTestIndex[result.first], 0, "", result.second); +} + +void gcUnitTestForm::onTestEnd(std::pair &time) +{ + m_lcUnitTests->SetItem(m_mTestIndex[time.first], 2, gcString("{0}", time.second)); +} + +void gcUnitTestForm::OnRunOnStartupClicked(wxCommandEvent& event) +{ + g_bRunOnStartup.setValue(m_cbRunOnStartup->IsChecked()); +} + +void gcUnitTestForm::OnAssertOnErrorClicked(wxCommandEvent& event) +{ + g_bAssertOnFailure.setValue(m_cbAssertOnError->IsChecked()); +} + +void gcUnitTestForm::OnTextChanged(wxCommandEvent& event) +{ + g_strUnitTestFilter.setValue((const char*)m_textCtrl1->GetValue()); +} + +void gcUnitTestForm::OnClose(wxCloseEvent& event) +{ + if (!m_bShouldClose) + { + event.Veto(); + Show(false); + } + else + { + event.Skip(); + } +} + +void gcUnitTestForm::canClose() +{ + m_bShouldClose = true; +} + +void gcUnitTestForm::onShow(uint32&) +{ + Show(true); + Raise(); +} + +void gcUnitTestForm::postShowEvent() +{ + uint32 res; + showEvent(res); +} diff -Nru libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.h libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.h --- libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/shared/uicore/code/gcUnitTestPage.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,82 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + + +#ifndef DESURA_UNITTEST_FORM_H +#define DESURA_UNITTEST_FORM_H +#ifdef _WIN32 +#pragma once +#endif + +#include +#include "wx_controls/gcControls.h" + +class wxListCtrl; +class CUnitTestThread; + +class gcUnitTestForm : public gcDialog +{ +public: + gcUnitTestForm(wxWindow* parent); + ~gcUnitTestForm(); + + void canClose(); + void postShowEvent(); + +protected: + void onShow(uint32&); + + void onStart(); + void onEnd(); + + void onTestStart(gcString &strTest); + void onTestResult(std::pair &result); + void onTestEnd(std::pair &time); + + void runTests(); + + void onButtonClicked(wxCommandEvent& event); + + void OnRunOnStartupClicked(wxCommandEvent& event); + void OnAssertOnErrorClicked(wxCommandEvent& event); + void OnTextChanged(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + +private: + wxCheckBox* m_cbAssertOnError; + wxCheckBox* m_cbRunOnStartup; + wxStaticText* m_staticText1; + wxTextCtrl* m_textCtrl1; + wxButton* m_butRun; + wxListCtrl* m_lcUnitTests; + wxButton* m_butClose; + + wxImageList m_ImageList; + CUnitTestThread *m_pThread; + + gcImageHandle m_icoTestGood; + gcImageHandle m_icoTestBad; + + std::map m_mTestIndex; + + bool m_bShouldClose; + Event showEvent; +}; + + +#endif \ No newline at end of file diff -Nru libcef-desura-291/src/shared/usercore/CMakeLists.txt libcef-desura-291/src/shared/usercore/CMakeLists.txt --- libcef-desura-291/src/shared/usercore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/usercore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -123,7 +123,9 @@ ${WINDOWS_LIBRARIES} ) -install(TARGETS usercore - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(usercore) -SET_PROPERTY(TARGET usercore PROPERTY FOLDER "Shared") +if(WIN32) + SetSharedRuntime(usercore) +endif() + +LinkWithGTest(usercore) +install_library(usercore) diff -Nru libcef-desura-291/src/shared/usercore/code/ToolInfo.cpp libcef-desura-291/src/shared/usercore/code/ToolInfo.cpp --- libcef-desura-291/src/shared/usercore/code/ToolInfo.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/usercore/code/ToolInfo.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -26,108 +26,105 @@ #define X_CONSTANT 0x7FFFFFFF -int getOperatorOrder(std::string curOp) -{ - if (curOp == "<" || curOp == "<=" || curOp == ">" || curOp == ">=") - return 6; - - if (curOp == "==" || curOp == "!=") - return 7; - - if (curOp == "&&") - return 11; - - if (curOp == "||") - return 12; - - return 20; -} - -int32 getOpereatorCount(std::string curOp) -{ - if (curOp == "==" || curOp == "!=" || curOp == ">" || curOp == "<" || curOp == ">=" || curOp == "<=") - return 2; - - return 0; -} - - class OutValI { public: - virtual bool isOperand()=0; + virtual bool isOperand() = 0; virtual ~OutValI(){} }; -class Operand : public OutValI +namespace { -public: - Operand(int val) + int getOperatorOrder(std::string curOp) { - m_iVal = val; - } + if (curOp == "<" || curOp == "<=" || curOp == ">" || curOp == ">=") + return 6; - virtual bool isOperand() - { - return true; - } + if (curOp == "==" || curOp == "!=") + return 7; - virtual int getOperand() - { - return m_iVal; - } + if (curOp == "&&") + return 11; -private: - int32 m_iVal; -}; + if (curOp == "||") + return 12; -class Operator : public OutValI -{ -public: - Operator(std::string val) - : m_szVal(val) - {} + return 20; + } - virtual bool isOperand() + int32 getOpereatorCount(std::string curOp) { - return false; + if (curOp == "==" || curOp == "!=" || curOp == ">" || curOp == "<" || curOp == ">=" || curOp == "<=") + return 2; + + return 0; } - virtual std::string& getOperator() + class Operand : public OutValI { - return m_szVal; - } + public: + Operand(int val) + { + m_iVal = val; + } -private: - std::string m_szVal; -}; + virtual bool isOperand() + { + return true; + } -bool processStack(std::deque &vOutStack, std::deque &valStack, std::deque &opStack) -{ - size_t c = getOpereatorCount(opStack.back()); + virtual int getOperand() + { + return m_iVal; + } - if (c > valStack.size()) - return false; + private: + int32 m_iVal; + }; + + class Operator : public OutValI + { + public: + Operator(std::string val) + : m_szVal(val) + {} - while (c > 0) - { - vOutStack.push_back(new Operand(valStack.back())); - valStack.pop_back(); - c--; - } + virtual bool isOperand() + { + return false; + } - vOutStack.push_back(new Operator(opStack.back())); - opStack.pop_back(); + virtual std::string& getOperator() + { + return m_szVal; + } - return true; -} + private: + std::string m_szVal; + }; + bool processStack(std::deque &vOutStack, std::deque &valStack, std::deque &opStack) + { + size_t c = getOpereatorCount(opStack.back()); + if (c > valStack.size()) + return false; + while (c > 0) + { + vOutStack.push_back(new Operand(valStack.back())); + valStack.pop_back(); + c--; + } + vOutStack.push_back(new Operator(opStack.back())); + opStack.pop_back(); -namespace UserCore -{ + return true; + } +} + +using namespace UserCore; ToolInfo::ToolInfo(DesuraId id) : m_ToolId(id), @@ -411,7 +408,7 @@ std::deque opStack; bool lastWasDigit = false; - //bool lastWasAlpha = false; unused variable + bool lastWasNeg = false; while (it != m_szResult.end()) { @@ -437,15 +434,28 @@ opStack.pop_back(); } + else if (c == '-') + { + lastWasNeg = true; + } else if (isdigit(c)) { int val = c - 48; - - if (lastWasDigit) + + if (lastWasDigit && !lastWasNeg) { - val = valStack.back()*10 + val; + if (valStack.back() > 0) + val = valStack.back() * 10 + val; + else + val = valStack.back() * 10 - val; + valStack.pop_back(); } + else if (lastWasNeg) + { + val = val*-1; + lastWasNeg = false; + } valStack.push_back(val); } @@ -465,7 +475,7 @@ ++it; c = *it; } - while (it != m_szResult.end() && !isdigit(c) && !isalpha(c) && c != '(' && c != ')'); + while (it != m_szResult.end() && !isdigit(c) && !isalpha(c) && c != '(' && c != ')' && c != '-'); --it; c = *it; @@ -480,8 +490,10 @@ opStack.push_back(val); } - //lastWasAlpha = isalpha(c) || c == '(' || c == ')'; - lastWasDigit = isdigit(c)?true:false; + lastWasDigit = isdigit(c) || c == '-'; + + if (!lastWasDigit) + lastWasNeg = false; ++it; } @@ -602,7 +614,7 @@ } } - if (!stack.empty()) + if (stack.size() > 1) Warning(gcString("To many items left on stack after results calc for tool {0}.", getName())); if (stack.empty()) @@ -616,4 +628,162 @@ return m_szResult.c_str(); } +#ifdef WITH_GTEST + +#include + +namespace UnitTest +{ + class ToolInfoFixture : public ::testing::TestWithParam + { + public: + ToolInfoFixture() + : m_ToolInfo(DesuraId()) + { + + } + + void SetupResult(const gcString &szRes) + { + m_ToolInfo.m_szResult = szRes; + } + + UserCore::ToolInfo m_ToolInfo; + }; + + INSTANTIATE_TEST_CASE_P(ReturnValues, + ToolInfoFixture, + ::testing::Values(-1000, -1, 0, 1, 1000)); + + TEST_P(ToolInfoFixture, ResultTest_Empty) + { + SetupResult(""); + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(GetParam())); + } + + TEST_P(ToolInfoFixture, ResultTest_Exact_Zero) + { + SetupResult("0"); + + if (GetParam() == 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(GetParam())); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(GetParam())); + } + + TEST_P(ToolInfoFixture, ResultTest_EqualZero) + { + SetupResult("X==0"); + + if (GetParam() == 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(GetParam())); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(GetParam())); + } + + TEST_P(ToolInfoFixture, ResultTest_NotEqualZero) + { + SetupResult("X!=0"); + + if (GetParam() != 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(GetParam())); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(GetParam())); + } + + TEST_P(ToolInfoFixture, ResultTest_Exact_NonZero) + { + SetupResult("1000"); + + if (GetParam() == 1000) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(GetParam())); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(GetParam())); + } + + TEST_P(ToolInfoFixture, ResultTest_Exact_ZeroOr1) + { + int nParam = GetParam(); + + SetupResult("X == 0 || X == 1"); + + if (nParam == 0 || nParam == 1) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_GreaterThanZero) + { + int nParam = GetParam(); + + SetupResult("X > 0"); + + if (nParam > 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_GreaterThanOrEqualZero) + { + int nParam = GetParam(); + + SetupResult("X >= 0"); + + if (nParam >= 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_LessThanZero) + { + int nParam = GetParam(); + + SetupResult("X < 0"); + + if (nParam < 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_LessThanOrEqualZero) + { + int nParam = GetParam(); + + SetupResult("X <= 0"); + + if (nParam <= 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_LessThanOrGreaterThanZero) + { + int nParam = GetParam(); + + SetupResult("X < 0 || X > 0"); + + if (nParam < 0 || nParam > 0) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } + + TEST_P(ToolInfoFixture, ResultTest_LessThan1AndGreaterThanNeg1) + { + int nParam = GetParam(); + + SetupResult("(X > -1) && (X < 1)"); + + if ((nParam > -1) && (nParam < 1)) + ASSERT_TRUE(m_ToolInfo.checkExpectedResult(nParam)); + else + ASSERT_FALSE(m_ToolInfo.checkExpectedResult(nParam)); + } } + +#endif diff -Nru libcef-desura-291/src/shared/usercore/code/ToolInfo.h libcef-desura-291/src/shared/usercore/code/ToolInfo.h --- libcef-desura-291/src/shared/usercore/code/ToolInfo.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/usercore/code/ToolInfo.h 2013-10-17 18:16:34.000000000 +0000 @@ -33,6 +33,11 @@ class sqlite3_connection; } +namespace UnitTest +{ + class ToolInfoFixture; +} + namespace UserCore { @@ -71,6 +76,8 @@ #endif protected: + friend class UnitTest::ToolInfoFixture; + enum TOOL_FLAGS { TF_NONE = 0, @@ -85,6 +92,7 @@ virtual void saveToDb(sqlite3x::sqlite3_connection* db); friend class ToolManager; + friend class UnitTest::ToolInfoFixture; virtual bool checkExePath(const char* path, bool quick = false); diff -Nru libcef-desura-291/src/shared/usercore/code/UserTasks.cpp libcef-desura-291/src/shared/usercore/code/UserTasks.cpp --- libcef-desura-291/src/shared/usercore/code/UserTasks.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/usercore/code/UserTasks.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -362,7 +362,7 @@ tinyxml2::XMLDocument doc; - if (!doc.LoadFile(m_vFileList[x].getFullPath().c_str())) + if (doc.LoadFile(m_vFileList[x].getFullPath().c_str()) != tinyxml2::XML_NO_ERROR) continue; tinyxml2::XMLElement* root = doc.FirstChildElement("game"); diff -Nru libcef-desura-291/src/shared/utilcore/CMakeLists.txt libcef-desura-291/src/shared/utilcore/CMakeLists.txt --- libcef-desura-291/src/shared/utilcore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/utilcore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -59,7 +59,8 @@ ${WINDOWS_LIBRARIES} ) -install(TARGETS utilcore - DESTINATION "${LIB_INSTALL_DIR}") -CopyTargetFiles(utilcore) -SET_PROPERTY(TARGET utilcore PROPERTY FOLDER "Shared") \ No newline at end of file +if(WIN32) + SetSharedRuntime(utilcore) +endif() + +install_library(utilcore) diff -Nru libcef-desura-291/src/shared/utilcore/code/UtilCoreEntry.cpp libcef-desura-291/src/shared/utilcore/code/UtilCoreEntry.cpp --- libcef-desura-291/src/shared/utilcore/code/UtilCoreEntry.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/utilcore/code/UtilCoreEntry.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -151,6 +151,11 @@ m_iExitCode = exitCode; } + int runUnitTests(int argc, char** argv) + { + return -1; + } + private: bool m_bExitCodeSet; int32 m_iExitCode; diff -Nru libcef-desura-291/src/shared/webcore/CMakeLists.txt libcef-desura-291/src/shared/webcore/CMakeLists.txt --- libcef-desura-291/src/shared/webcore/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/shared/webcore/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -5,10 +5,19 @@ ${SQLITE3X_INCLUDE_DIRS} ) -file(GLOB Sources code/*.cpp) +file(GLOB Sources + code/ImageCache.cpp + code/ImageCache.h + code/Log.cpp + code/Log.h + code/WebCore.cpp + code/WebCore_External.cpp + code/WebCore.h + code/WebCore_Internal.cpp + code/WebCoreMain.cpp +) if(WIN32) - set(WINDOWS_LIBRARIES ) if(NOT MINGW) set(WINDOWS_LIBRARIES ${WINDOWS_LIBRARIES} crypt32 dnsapi rpcrt4 wininet winmm ws2_32) else() @@ -18,21 +27,21 @@ add_library(webcore SHARED ${Sources}) target_link_libraries(webcore - threads - util - util_fs - util_web - ${BZIP2_LIBRARIES} - ${CURL_LIBRARIES} - ${TINYXML_LIBRARIES} - ${SQLITE3X_LIBRARIES} - ${Boost_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} + threads + util + util_fs + util_web + ${BZIP2_LIBRARIES} + ${CURL_LIBRARIES} + ${TINYXML_LIBRARIES} + ${SQLITE3X_LIBRARIES} + ${Boost_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ) -install(TARGETS webcore - DESTINATION "${LIB_INSTALL_DIR}") +if(WIN32) + SetSharedRuntime(webcore) +endif() -CopyTargetFiles(webcore) -SET_PROPERTY(TARGET webcore PROPERTY FOLDER "Shared") \ No newline at end of file +install_library(webcore) diff -Nru libcef-desura-291/src/static/ipc_pipe/CMakeLists.txt libcef-desura-291/src/static/ipc_pipe/CMakeLists.txt --- libcef-desura-291/src/static/ipc_pipe/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/ipc_pipe/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -30,4 +30,21 @@ ${TINYXML_LIBRARIES} ) -SET_PROPERTY(TARGET ipc_pipe PROPERTY FOLDER "Static") \ No newline at end of file +if(WIN32) + SetSharedRuntime(ipc_pipe) +endif() + +SET_PROPERTY(TARGET ipc_pipe PROPERTY FOLDER "Static") + +if (WIN32) + add_library(ipc_pipe_s STATIC ${Sources} ${PlattformSources}) + + target_link_libraries(ipc_pipe_s + threads_s + util_s + ${TINYXML_LIBRARIES_S} + ) + + SET_PROPERTY(TARGET ipc_pipe_s PROPERTY FOLDER "Static") + SetStaticRuntime(ipc_pipe_s) +endif() diff -Nru libcef-desura-291/src/static/managers/CMakeLists.txt libcef-desura-291/src/static/managers/CMakeLists.txt --- libcef-desura-291/src/static/managers/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/managers/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -19,6 +19,9 @@ ${SQLITE3X_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) +if(WIN32) + SetSharedRuntime(managers) +endif() include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/code @@ -33,5 +36,9 @@ ${wxWidgets_LIBRARIES} ) +if(WIN32) + SetSharedRuntime(managers_window) +endif() + SET_PROPERTY(TARGET managers PROPERTY FOLDER "Static") SET_PROPERTY(TARGET managers_window PROPERTY FOLDER "Static") diff -Nru libcef-desura-291/src/static/managers/code/CVarManager.cpp libcef-desura-291/src/static/managers/code/CVarManager.cpp --- libcef-desura-291/src/static/managers/code/CVarManager.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/managers/code/CVarManager.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -119,15 +119,35 @@ void CVarManager::loadUser(CVar* var) { + loadCVarFromDb(var, "SELECT value FROM cvaruser WHERE name=? AND user=?;", gcString("{0}", m_uiUserId)); +} + +void CVarManager::loadWinUser(CVar* var) +{ + loadCVarFromDb(var, "SELECT value FROM cvarwin WHERE name=? AND user=?;", getWinUser()); +} + +void CVarManager::loadNormal(CVar* var) +{ + loadCVarFromDb(var, "SELECT value FROM cvar WHERE name=?;", ""); +} + +void CVarManager::loadCVarFromDb(CVar *var, const char* szSql, gcString strExtra) +{ try { sqlite3x::sqlite3_connection db(m_szCVarDb.c_str()); - sqlite3x::sqlite3_command cmd(db, "SELECT value FROM cvaruser WHERE user=? AND name=?;"); - cmd.bind(1, (int)m_uiUserId); - cmd.bind(2, var->getName()); + sqlite3x::sqlite3_command cmd(db, szSql); + cmd.bind(1, var->getName()); + cmd.bind(2, strExtra); + + sqlite3x::sqlite3_reader reader = cmd.executereader(); - std::string value = cmd.executestring(); - var->setValueOveride(value.c_str()); + if (reader.read()) + { + std::string value = reader.getstring(0); + var->setValueOveride(value.c_str()); + } } catch (std::exception &) { @@ -144,40 +164,7 @@ return username; } -void CVarManager::loadWinUser(CVar* var) -{ - try - { - sqlite3x::sqlite3_connection db(m_szCVarDb.c_str()); - sqlite3x::sqlite3_command cmd(db, "SELECT value FROM cvarwin WHERE user=? AND name=?;"); - - cmd.bind(1, getWinUser()); - cmd.bind(2, var->getName()); - - std::string value = cmd.executestring(); - var->setValueOveride(value.c_str()); - } - catch (std::exception &) - { - } -} - -void CVarManager::loadNormal(CVar* var) -{ - try - { - sqlite3x::sqlite3_connection db(m_szCVarDb.c_str()); - sqlite3x::sqlite3_command cmd(db, "SELECT value FROM cvar WHERE name=?;"); - cmd.bind(1, var->getName()); - - std::string value = cmd.executestring(); - var->setValueOveride(value.c_str()); - } - catch (std::exception &) - { - } -} diff -Nru libcef-desura-291/src/static/managers/code/CVarManager.h libcef-desura-291/src/static/managers/code/CVarManager.h --- libcef-desura-291/src/static/managers/code/CVarManager.h 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/managers/code/CVarManager.h 2013-10-17 18:16:34.000000000 +0000 @@ -84,6 +84,8 @@ std::wstring getWinUser(); + void loadCVarFromDb(CVar *var, const char* szSql, gcString strExtra); + private: uint32 m_uiUserId; gcString m_szCVarDb; diff -Nru libcef-desura-291/src/static/managers/code/LanguageManager.cpp libcef-desura-291/src/static/managers/code/LanguageManager.cpp --- libcef-desura-291/src/static/managers/code/LanguageManager.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/managers/code/LanguageManager.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -92,7 +92,7 @@ this->addItem( temp ); } -#ifdef DESURA_OFFICAL_BUILD +#ifdef DESURA_OFFICIAL_BUILD temp->ustr = val; #else std::vector res; diff -Nru libcef-desura-291/src/static/mdump/CMakeLists.txt libcef-desura-291/src/static/mdump/CMakeLists.txt --- libcef-desura-291/src/static/mdump/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/mdump/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,6 +1,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR} + ${BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR_S} ) if(WIN32) @@ -16,4 +17,19 @@ ${WINDOWS_LIBS} ) -SET_PROPERTY(TARGET mdump PROPERTY FOLDER "Static") \ No newline at end of file +if(WIN32) + SetSharedRuntime(mdump) +endif() + +SET_PROPERTY(TARGET mdump PROPERTY FOLDER "Static") + +if (WIN32) + add_library(mdump_s STATIC ${Sources}) + target_link_libraries(mdump_s + ${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES_S} + ${WINDOWS_LIBS} + ) + + SET_PROPERTY(TARGET mdump_s PROPERTY FOLDER "Static") + SetStaticRuntime(mdump_s) +endif() \ No newline at end of file diff -Nru libcef-desura-291/src/static/mdump/code/MiniDumpGenerator_win.cpp libcef-desura-291/src/static/mdump/code/MiniDumpGenerator_win.cpp --- libcef-desura-291/src/static/mdump/code/MiniDumpGenerator_win.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/mdump/code/MiniDumpGenerator_win.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -59,7 +59,7 @@ { m_szUser = 0; -#ifndef DESURA_OFFICAL_BUILD +#ifndef DESURA_OFFICIAL_BUILD m_bNoUpload = true; #else m_bNoUpload = false; diff -Nru libcef-desura-291/src/static/scriptengine/CMakeLists.txt libcef-desura-291/src/static/scriptengine/CMakeLists.txt --- libcef-desura-291/src/static/scriptengine/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/scriptengine/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -20,4 +20,8 @@ ${V8_LIBRARIES} ) +if(WIN32) + SetSharedRuntime(scriptengine) +endif() + SET_PROPERTY(TARGET scriptengine PROPERTY FOLDER "Static") \ No newline at end of file diff -Nru libcef-desura-291/src/static/umcf/CMakeLists.txt libcef-desura-291/src/static/umcf/CMakeLists.txt --- libcef-desura-291/src/static/umcf/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/umcf/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -10,4 +10,19 @@ ${BZIP2_LIBRARIES} ) -SET_PROPERTY(TARGET umcf PROPERTY FOLDER "Static") \ No newline at end of file +if(WIN32) + SetSharedRuntime(umcf) +endif() + +SET_PROPERTY(TARGET umcf PROPERTY FOLDER "Static") + +if(WIN32) + add_library(umcf_s STATIC ${Sources}) + + target_link_libraries(umcf_s + ${BZIP2_LIBRARIES_S} + ) + + SET_PROPERTY(TARGET umcf_s PROPERTY FOLDER "Static") + SetStaticRuntime(umcf_s) +endif() diff -Nru libcef-desura-291/src/static/umcf/code/UMcf.cpp libcef-desura-291/src/static/umcf/code/UMcf.cpp --- libcef-desura-291/src/static/umcf/code/UMcf.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/umcf/code/UMcf.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -345,8 +345,9 @@ void UMcf::loadFromFile(const wchar_t* file) { tinyxml2::XMLDocument doc; + gcString strFile(file); - if (doc.LoadFile(gcString(file).c_str())) + if (doc.LoadFile(strFile.c_str()) == tinyxml2::XML_NO_ERROR) parseUpdateXml(doc); } diff -Nru libcef-desura-291/src/static/util/CMakeLists.txt libcef-desura-291/src/static/util/CMakeLists.txt --- libcef-desura-291/src/static/util/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -4,6 +4,7 @@ ${Boost_INCLUDE_DIR} ${BZIP2_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS_S} ${SQLITE3X_INCLUDE_DIRS} ) @@ -72,7 +73,6 @@ endif() add_library(util STATIC ${Sources} ${PlattformSources}) - target_link_libraries(util ${BZIP2_LIBRARIES} ${SQLITE3X_LIBRARIES} @@ -81,5 +81,25 @@ ${PLATFORM_LIBRARIES} ) +if(WIN32) + SetSharedRuntime(util) + SetSharedRuntime(util_web) +endif() + SET_PROPERTY(TARGET util PROPERTY FOLDER "Static") -SET_PROPERTY(TARGET util_web PROPERTY FOLDER "Static") \ No newline at end of file +SET_PROPERTY(TARGET util_web PROPERTY FOLDER "Static") + +if (WIN32) + add_library(util_s STATIC ${Sources} ${PlattformSources}) + + target_link_libraries(util_s + ${BZIP2_LIBRARIES_S} + ${SQLITE3X_LIBRARIES_S} + ${Boost_FILESYSTEM_LIBRARY_S} + ${Boost_SYSTEM_LIBRARY_S} + ${PLATFORM_LIBRARIES} + ) + + SET_PROPERTY(TARGET util_s PROPERTY FOLDER "Static") + SetStaticRuntime(util_s) +endif() diff -Nru libcef-desura-291/src/static/util/code/UtilOs_cmake.cpp.inc libcef-desura-291/src/static/util/code/UtilOs_cmake.cpp.inc --- libcef-desura-291/src/static/util/code/UtilOs_cmake.cpp.inc 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util/code/UtilOs_cmake.cpp.inc 2013-10-17 18:16:34.000000000 +0000 @@ -30,9 +30,13 @@ std::wstring getDataPath(std::wstring extra) { +#ifdef WIN32 + path dataDir = L".\\data"; +#else path dataDir = L"@DATA_INSOURCE_DIR@"; - - // we need this for windows, where all files are relativ in the desura application folder or for local Linux +#endif + + // we need this for windows, where all files are relative in the desura application folder or for local Linux // installations (if you want to move it around your Document directory) if (dataDir.is_relative()) dataDir = getCurrentDir() / dataDir; @@ -42,12 +46,6 @@ gcString getRuntimeLibPath() { -// path runtimeLibDir = L"@RUNTIME_LIB_INSOURCE_DIR@/"; - -// if (runtimeLibDir.is_relative()) -// runtimeLibDir = getCurrentDir() / runtimeLibDir; - - //return runtimeLibDir.string(); return getCurrentDir() + L"/"; } diff -Nru libcef-desura-291/src/static/util_bootloader/CMakeLists.txt libcef-desura-291/src/static/util_bootloader/CMakeLists.txt --- libcef-desura-291/src/static/util_bootloader/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -2,7 +2,7 @@ ${CMAKE_CURRENT_SOURCE_DIR} ) -file(GLOB Sources code/*.cpp code/third_party/*.cpp) +file(GLOB Sources code/*.cpp code/win32/*.cpp code/third_party/*.cpp) add_library(util_bootloader STATIC ${Sources}) @@ -11,4 +11,22 @@ wintrust ) -SET_PROPERTY(TARGET util_bootloader PROPERTY FOLDER "Static") \ No newline at end of file +if(WIN32) + SetSharedRuntime(util_bootloader) +endif() + +SET_PROPERTY(TARGET util_bootloader PROPERTY FOLDER "Static") + +if (WIN32) + add_library(util_bootloader_s STATIC ${Sources}) + + target_link_libraries(util_bootloader_s + Psapi + wintrust + ) + + SET_PROPERTY(TARGET util_bootloader_s PROPERTY FOLDER "Static") + SetStaticRuntime(util_bootloader_s) +endif() + +set(UTIL_BOOTLOADER_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/code/win32" PARENT_SCOPE) diff -Nru libcef-desura-291/src/static/util_bootloader/code/UtilBootloader.cpp libcef-desura-291/src/static/util_bootloader/code/UtilBootloader.cpp --- libcef-desura-291/src/static/util_bootloader/code/UtilBootloader.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/code/UtilBootloader.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -55,25 +55,6 @@ namespace BootLoaderUtil { - -#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) - -CDummyWindow::CDummyWindow(HWND hWnd) -{ - Attach(hWnd); -} - -// Don't let the CWnd destructor delete the HWND -CDummyWindow::~CDummyWindow() -{ - Detach(); -} - -#endif - - - - bool IsExeRunning(char* pName) { unsigned long aProcesses[1024], cbNeeded, cProcesses; diff -Nru libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.cpp libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.cpp --- libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,74 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2013 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "DesuraWinApp.h" +#include "DesuraWnd.h" +#include + +#include + +using namespace Desurium; + + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + CDesuraWnd::SetInstanceHandle(hInstance); + + CDesuraWinApp& app = CDesuraWinApp::GetApp(); + + app.Init(hInstance, nCmdShow, lpCmdLine); + + app.InitInstance(); + return app.ExitInstance(); +} + + +CDesuraWinApp* CDesuraWinApp::gs_pWinApp = NULL; + + +CDesuraWinApp::CDesuraWinApp() + : m_hInstance(NULL) + , m_nCmdShow(0) + , m_lpCmdLine(NULL) +{ + gs_pWinApp = this; +} + +CDesuraWinApp::~CDesuraWinApp() +{ + if (gs_pWinApp == this) + gs_pWinApp = NULL; +} + +void CDesuraWinApp::Init(HINSTANCE hInstance, int nCmdShow, const char* lpCmdLine) +{ + m_hInstance = hInstance; + m_nCmdShow = nCmdShow; + m_lpCmdLine = lpCmdLine; +} + +CDesuraWinApp& CDesuraWinApp::GetApp() +{ + if (!gs_pWinApp) + { + assert(false); + abort(); + } + + return *gs_pWinApp; +} diff -Nru libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.h libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.h --- libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWinApp.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,49 @@ +#pragma once + +/* +Desura is the leading indie game distribution platform +Copyright (C) 2013 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include + +namespace Desurium +{ + + class CDesuraWinApp + { + public: + CDesuraWinApp(); + ~CDesuraWinApp(); + + virtual void InitInstance()=0; + virtual int ExitInstance()=0; + + static CDesuraWinApp& GetApp(); + + void Init(HINSTANCE hInstance, int nCmdShow, const char* lpCmdLine); + + protected: + HINSTANCE m_hInstance; + int m_nCmdShow; + const char* m_lpCmdLine; + + private: + static CDesuraWinApp* gs_pWinApp; + }; + + +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.cpp libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.cpp --- libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,313 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2013 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "DesuraWnd.h" + + +using namespace Desurium; + + + +CBitmap::CBitmap() +: m_hBitmap(NULL) +{ +} + +CBitmap::~CBitmap() +{ + if (m_hBitmap) + DeleteObject(m_hBitmap); +} + +void CBitmap::LoadBitmap(int nResourceId) +{ + if (m_hBitmap) + DeleteObject(m_hBitmap); + + m_hBitmap = ::LoadBitmap(CDesuraWnd::GetInstanceHandle(), MAKEINTRESOURCE(nResourceId)); +} + +void CBitmap::CreateCompatibleBitmap(CDC &dc, int w, int h) +{ + if (m_hBitmap) + DeleteObject(m_hBitmap); + + m_hBitmap = ::CreateCompatibleBitmap(dc, w, h); +} + +int CBitmap::GetBitmap(BITMAP *pBitmap) +{ + return GetObject(m_hBitmap, sizeof(BITMAP), pBitmap); +} + + + + + + +CDC::CDC() + : m_hDC(NULL) +{ +} + +CDC::CDC(HDC hdc) + : m_hDC(hdc) +{ +} + +CDC::~CDC() +{ + if (m_hDC) + DeleteDC(m_hDC); +} + +void CDC::SetBkMode(int nMode) +{ + assert(m_hDC); + ::SetBkMode(m_hDC, nMode); +} + +void CDC::SetTextColor(COLORREF nColor) +{ + assert(m_hDC); + ::SetTextColor(m_hDC, nColor); +} + +void CDC::CreateCompatibleDC(CDC* pDC) +{ + if (m_hDC) + DeleteDC(m_hDC); + + m_hDC = ::CreateCompatibleDC(*pDC); + + int nError = GetLastError(); + assert(m_hDC); +} + +HGDIOBJ CDC::SelectObject(CBitmap* pBitmap) +{ + assert(m_hDC); + return ::SelectObject(m_hDC, *pBitmap); +} + +HGDIOBJ CDC::SelectObject(HGDIOBJ pObject) +{ + assert(m_hDC); + return ::SelectObject(m_hDC, pObject); +} + +CFont* CDC::SelectObject(CFont* pFont) +{ + assert(m_hDC); + return NULL; +} + +void CDC::StretchBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC, + int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop) +{ + assert(m_hDC); + ::StretchBlt(m_hDC, x, y, nWidth, nHeight, *pSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop); +} + +void CDC::BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC, + int xSrc, int ySrc, DWORD dwRop) +{ + assert(m_hDC); + ::BitBlt(m_hDC, x, y, nWidth, nHeight, *pSrcDC, xSrc, ySrc, dwRop); +} + +CSize CDC::GetOutputTextExtent(const char* szText, int nSize) +{ + assert(m_hDC); + + SIZE size; + ::GetTextExtentPoint32(m_hDC, szText, nSize, &size); + + return CSize(size); +} + +bool CDC::TextOut(int x, int y, const char* szText, int nSize) +{ + assert(m_hDC); + return ::TextOut(m_hDC, x, y, szText, nSize); +} + + + +CPaintDC::CPaintDC(CDesuraWnd* pWnd) + : CDC(::BeginPaint(pWnd->GetSafeHwnd(), &m_lpPaint)) + , m_pWnd(pWnd) +{ + +} + +CPaintDC::~CPaintDC() +{ + ::EndPaint(m_pWnd->GetSafeHwnd(), &m_lpPaint); +} + + + + +CDesuraWnd::CDesuraWnd(bool bHookEvents) + : m_bHookEvents(bHookEvents) + , m_pParent(NULL) +{ +} + +bool CDesuraWnd::Create(const char* szClassName, const char*, DWORD dwStyl, const CRect& rect, CDesuraWnd *pParent, UINT nID) +{ + m_pParent = pParent; + + m_hWND = ::CreateWindow(szClassName, "", dwStyl | WS_CHILD | WS_VISIBLE, rect.left, rect.top, rect.width(), rect.height(), pParent->GetSafeHwnd(), NULL, GetInstanceHandle(), 0); + ::SetWindowLong(m_hWND, GWL_ID, nID); + + return m_hWND != NULL; +} + +bool CDesuraWnd::Create(CDesuraWnd *pParent, const CRect& rect, UINT nID, DWORD dwStyle) +{ + assert(false); + m_pParent = pParent; + return false; +} + +bool CDesuraWnd::RegisterWindowClass() +{ + return false; +} + +CDesuraWnd* CDesuraWnd::GetParent() +{ + return m_pParent; +} + +HCURSOR CDesuraWnd::LoadStandardCursor(const char* szResourceId) +{ + return ::LoadCursor(NULL, szResourceId); +} + +bool CDesuraWnd::RegisterClass(WNDCLASS *pClass) +{ + return ::RegisterClass(pClass); +} + +HINSTANCE CDesuraWnd::gs_hInstance = NULL; + +void CDesuraWnd::SetInstanceHandle(HINSTANCE hInstance) +{ + gs_hInstance = hInstance; +} + +HINSTANCE CDesuraWnd::GetInstanceHandle() +{ + assert(gs_hInstance); + return gs_hInstance; +} + +void CDesuraWnd::BeginThread(ThreadFn funct, void* pData) +{ + CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)funct, pData, 0, NULL); +} + +void CDesuraWnd::OnPaint() +{ + assert(false); +} + +bool CDesuraWnd::OnEraseBkgnd() +{ + assert(false); + return false; +} + +void CDesuraWnd::OnMouseMove(UINT nFlags, CPoint point) +{ + assert(false); +} + +void CDesuraWnd::OnLButtonUp(UINT nFlags, CPoint point) +{ + assert(false); +} + +void CDesuraWnd::OnLButtonDown(UINT nFlags, CPoint point) +{ + assert(false); +} + +void CDesuraWnd::OnMouseLeave() +{ + assert(false); +} + + + +CDesuraDialog* CDesuraDialog::gs_pCurrentDialog = NULL; + + +CDesuraDialog::CDesuraDialog(int nResourceId) + : CDesuraWnd(false) + , m_nResourceId(nResourceId) +{ +} + +INT_PTR CDesuraDialog::DoModal() +{ + gs_pCurrentDialog = this; + INT_PTR nRes = ::DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(m_nResourceId), NULL, &CDesuraDialog::WinProc, (LPARAM)SW_SHOW); + + DWORD err = GetLastError(); + + return nRes; +} + +void CDesuraDialog::EndDialog(int nResult) +{ + gs_pCurrentDialog = NULL; + ::EndDialog(GetSafeHwnd(), nResult); +} + +void CDesuraDialog::SetIcon(HICON hIcon, bool bSmall) +{ + +} + +INT_PTR CDesuraDialog::WinProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + if (message == WM_INITDIALOG) + gs_pCurrentDialog->SetHwnd(hDlg); + + switch (message) + { + case WM_INITDIALOG: + gs_pCurrentDialog->OnInitDialog(); + return TRUE; + + case WM_COMMAND: + if (lParam) + gs_pCurrentDialog->OnCommand((HWND)lParam, HIWORD(wParam)); + break; + + case WM_CLOSE: + gs_pCurrentDialog->EndDialog(LOWORD(wParam)); + break; + } + + return FALSE; +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.h libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.h --- libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader/code/win32/DesuraWnd.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,302 @@ +#pragma once + +/* +Desura is the leading indie game distribution platform +Copyright (C) 2013 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include +#include + +namespace Desurium +{ + class CSize : public SIZE + { + public: + CSize() + { + cx = 0; + cy = 0; + } + + CSize(SIZE &size) + { + cx = size.cx; + cy = size.cy; + } + }; + + class CPoint : public POINT + { + public: + CPoint() + { + x = 0; + y = 0; + } + + CPoint(int x, int y) + { + this->x = x; + this->y = y; + } + + CPoint operator-(const CPoint& point) const + { + return CPoint(this->x - point.x, this->y - point.y); + } + }; + + class CRect : public RECT + { + public: + CRect() + { + left = 0; + top = 0; + right = 0; + bottom = 0; + } + + CRect(int x, int y, int w, int h) + { + left = x; + top = y; + right = x + w; + bottom = y + h; + } + + bool PtInRect(const CPoint& point) const + { + return point.x > left && point.x < right && point.y > top && point.y < bottom; + } + + int width() const + { + return right-left; + } + + int height() const + { + return bottom - top; + } + }; + + class CDesuraWnd; + class CDC; + + class CBitmap + { + public: + CBitmap(); + ~CBitmap(); + + void LoadBitmap(int nResourceId); + void CreateCompatibleBitmap(CDC &dc, int w, int h); + int GetBitmap(BITMAP *pBitmap); + + operator HGDIOBJ () + { + return m_hBitmap; + } + + private: + HBITMAP m_hBitmap; + }; + + class CFont + { + public: + void CreatePointFont(int nSize, const char* szName) + { + + } + }; + + + class CDC + { + public: + CDC(); + CDC(HDC hdc); + ~CDC(); + + void SetBkMode(int nMode); + void SetTextColor(COLORREF nColor); + void CreateCompatibleDC(CDC* pDC); + + HGDIOBJ SelectObject(CBitmap* pBitmap); + HGDIOBJ SelectObject(HGDIOBJ pObject); + CFont* SelectObject(CFont* pFont); + + void StretchBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop); + void BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop); + + CSize GetOutputTextExtent(const char* szText, int nSize); + bool TextOut(int x, int y, const char* szText, int nSize); + + operator HDC () + { + return m_hDC; + } + + private: + HDC m_hDC; + }; + + class CPaintDC : public CDC + { + public: + CPaintDC(CDesuraWnd* pWnd); + ~CPaintDC(); + + private: + CDesuraWnd *m_pWnd; + PAINTSTRUCT m_lpPaint; + }; + + + + + typedef UINT (__stdcall *ThreadFn)(void*); + + class CDesuraWnd + { + public: + CDesuraWnd(bool bHookEvents); + + virtual bool Create(const char* szClassName, const char*, DWORD dwStyl, const CRect& rect, CDesuraWnd *pParent, UINT nID); + virtual bool Create(CDesuraWnd *pParent, const CRect& rect, UINT nID, DWORD dwStyle = WS_VISIBLE); + virtual bool RegisterWindowClass(); + + BOOL RedrawWindow(const RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags) + { + assert(m_hWND); + return ::RedrawWindow(m_hWND, lprcUpdate, hrgnUpdate, flags); + } + + int SetWindowRgn(HRGN hRgn, BOOL bRedraw) + { + assert(m_hWND); + return ::SetWindowRgn(m_hWND, hRgn, bRedraw); + } + + HICON LoadIcon(int nResourceId) + { + return ::LoadIcon(GetInstanceHandle(), MAKEINTRESOURCE(nResourceId)); + } + + HWND SetCapture() + { + assert(m_hWND); + return ::SetCapture(m_hWND); + } + + void ReleaseCapture() + { + assert(m_hWND); + ::ReleaseCapture(); + } + + BOOL SetWindowPos(int x, int y, int cx, int cy, UINT uFlags) + { + assert(m_hWND); + return ::SetWindowPos(m_hWND, NULL, x, y, cx, cy, uFlags); + } + + void ClientToScreen(CPoint &point) + { + assert(m_hWND); + ::ClientToScreen(m_hWND, &point); + } + + void GetClientRect(CRect &rect) + { + assert(m_hWND); + ::GetClientRect(m_hWND, &rect); + } + + HWND GetSafeHwnd() + { + return m_hWND; + } + + HDC GetDC() + { + assert(m_hWND); + return ::GetDC(m_hWND); + } + + CDesuraWnd* GetParent(); + + HCURSOR LoadStandardCursor(const char* szResourceId); + + bool RegisterClass(WNDCLASS *pClass); + + static void SetInstanceHandle(HINSTANCE hInstance); + static HINSTANCE GetInstanceHandle(); + static void BeginThread(ThreadFn funct, void* pData); + + protected: + virtual void OnPaint(); + virtual bool OnEraseBkgnd(); + virtual void OnMouseMove(UINT nFlags, CPoint point); + virtual void OnLButtonUp(UINT nFlags, CPoint point); + virtual void OnLButtonDown(UINT nFlags, CPoint point); + virtual void OnMouseLeave(); + + void SetHwnd(HWND hWnd) + { + m_hWND = hWnd; + } + + private: + bool m_bHookEvents; + HWND m_hWND; + + static HINSTANCE gs_hInstance; + + CDesuraWnd *m_pParent; + }; + + + class CDesuraDialog : public CDesuraWnd + { + public: + CDesuraDialog(int nResourceId); + + virtual bool OnInitDialog()=0; + + virtual INT_PTR DoModal(); + virtual void EndDialog(int nResult); + + virtual void OnCommand(HWND hWnd, int nId) + { + } + + protected: + void SetIcon(HICON hIcon, bool bSmall); + + static INT_PTR CALLBACK WinProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + private: + static CDesuraDialog* gs_pCurrentDialog; + + int m_nResourceId; + }; + + +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader_official/CMakeLists.txt libcef-desura-291/src/static/util_bootloader_official/CMakeLists.txt --- libcef-desura-291/src/static/util_bootloader_official/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,28 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/RES + ${DESURA_EXE_INCLUDE_DIR} + ${UTIL_BOOTLOADER_INCLUDE_DIRS} +) + +file(GLOB Sources code/*.cpp) +add_library(util_bootloader_official_s STATIC ${Sources}) +SET_PROPERTY(TARGET util_bootloader_official_s PROPERTY FOLDER "Static") + +if (WIN32) + target_link_libraries(util_bootloader_official_s + umcf_s + util_web_s + ${TINYXML_LIBRARIES_S} + ) + + SetStaticRuntime(util_bootloader_official_s) +else() + target_link_libraries(util_bootloader_official_s + umcf + util_web + ${TINYXML_LIBRARIES} + ) +endif() + +SET(UTIL_BOOTLOADER_OFFICIAL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/code ${CMAKE_CURRENT_SOURCE_DIR}/RES PARENT_SCOPE) \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader_official/RES/desura_exe.rc libcef-desura-291/src/static/util_bootloader_official/RES/desura_exe.rc --- libcef-desura-291/src/static/util_bootloader_official/RES/desura_exe.rc 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/RES/desura_exe.rc 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,134 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) +#include "afxres.h" +#endif +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if (!defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)) && !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""RES\\desura_exe.rc\0" + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON "@BRANDING_DIR@/desura.ico" +IDI_ICONSMALL ICON "@BRANDING_DIR@/desura_16.ico" +IDI_ICONSMALL_1 ICON "@BRANDING_DIR@/desura_16_1.ico" +IDI_ICONSMALL_2 ICON "@BRANDING_DIR@/desura_16_2.ico" +IDI_ICONSMALL_3 ICON "@BRANDING_DIR@/desura_16_3.ico" +IDI_ICONSMALL_4 ICON "@BRANDING_DIR@/desura_16_4.ico" +IDI_ICONSMALL_5 ICON "@BRANDING_DIR@/desura_16_5.ico" +IDI_ICONSMALL_6 ICON "@BRANDING_DIR@/desura_16_6.ico" +IDI_ICONSMALL_7 ICON "@BRANDING_DIR@/desura_16_7.ico" +IDI_ICONSMALL_8 ICON "@BRANDING_DIR@/desura_16_8.ico" +IDI_ICONSMALL_9 ICON "@BRANDING_DIR@/desura_16_9.ico" +IDI_ICONSMALL_P ICON "@BRANDING_DIR@/desura_16_plus.ico" +IDI_ICONNORMAL ICON "@BRANDING_DIR@/desura.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_UPDATEFORM_DIALOG DIALOGEX 0, 0, 276, 135 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX +EXSTYLE WS_EX_APPWINDOW +CAPTION "Desura Updater" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP "@BRANDING_DIR@/spash.bmp" +IDB_BITMAP2 BITMAP "loadingbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +IDR_RT_MANIFEST1 RT_MANIFEST "rt_manif.bin" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "@BRANDING_DIR@/desura_exe.rc2" // non-Microsoft Visual C++ edited resources +#if !defined(DONT_INCLUDE_AFXWIN) && defined(MFC_FOUND) +#include "afxres.rc" // Standard components +#endif +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -Nru libcef-desura-291/src/static/util_bootloader_official/RES/extra.manifest libcef-desura-291/src/static/util_bootloader_official/RES/extra.manifest --- libcef-desura-291/src/static/util_bootloader_official/RES/extra.manifest 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/RES/extra.manifest 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libcef-desura-291/src/static/util_bootloader_official/RES/resource.h libcef-desura-291/src/static/util_bootloader_official/RES/resource.h --- libcef-desura-291/src/static/util_bootloader_official/RES/resource.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/RES/resource.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by desura_exe.rc +// +#define IDI_ICON 1 +#define IDD_UPDATEFORM_DIALOG 102 +#define IDR_RT_MANIFEST1 129 +#define IDB_BITMAP1 134 +#define IDB_BITMAP2 135 +#define IDB_BITMAP3 136 +#define IDC_PROGRESS1 1000 +#define IDC_BUTTON1 1001 +#define IDC_STATIC1 1002 +#define IDC_SPLASH 1002 +#define IDC_PROGRESS 1003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 138 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff -Nru libcef-desura-291/src/static/util_bootloader_official/RES/rt_manif.bin libcef-desura-291/src/static/util_bootloader_official/RES/rt_manif.bin --- libcef-desura-291/src/static/util_bootloader_official/RES/rt_manif.bin 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/RES/rt_manif.bin 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,22 @@ + + + + Desura + + + + + + diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.cpp libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,321 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +// DesuraProgress.cpp : implementation file +// + +#include +#include "DesuraProgress.h" +#include "resource.h" + +#define MIN( a, b) (a)>(b)?(b):(a) +#define MAX( a, b) (a)>(b)?(a):(b) + +#define DPROGRESS_CLASSNAME "MFCDesuraProgress" // Window class name + +// these macros are standard now (Win98) but some older headers don't have them +#ifndef GET_X_LPARAM +#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) +#endif // GET_X_LPARAM + +using namespace Desurium; + +DesuraProgress* DesuraProgress::gs_pDesuraProgress = NULL; + +DesuraProgress::DesuraProgress() + : CDesuraWnd(true) +{ + gs_pDesuraProgress = this; + + m_iProg = 0; + m_iTotal = 0; + m_vDone[0] = 0; + m_vDone[1] = 0; + m_vDone[2] = 0; + m_iMode = MODE_STARTUP; + m_bMouseOver= false; + + m_pBackgroundImage = new CBitmap(); + m_pBackgroundImage->LoadBitmap(IDB_BITMAP1); + + m_pLoadingBar = new CBitmap(); + m_pLoadingBar->LoadBitmap(IDB_BITMAP2); + + m_bDragging = false; + + RegisterWindowClass(); +} + +DesuraProgress::~DesuraProgress() +{ + gs_pDesuraProgress = NULL; + + delete m_pBackgroundImage; + m_pBackgroundImage = NULL; + + delete m_pLoadingBar; + m_pLoadingBar = NULL; +} + +void DesuraProgress::setDone(int done) +{ + m_vDone[0] = m_vDone[1]; + m_vDone[1] = m_vDone[2]; + m_vDone[2] = done; +} + +int DesuraProgress::getDone() +{ + return (m_vDone[0]+m_vDone[1]+m_vDone[2])/3; +} + + +bool DesuraProgress::RegisterWindowClass() +{ + WNDCLASS wndcls; + HINSTANCE hInst = GetInstanceHandle(); + + if (!(::GetClassInfo(hInst, DPROGRESS_CLASSNAME, &wndcls))) + { + // otherwise we need to register a new class + + wndcls.style = CS_HREDRAW | CS_VREDRAW|CS_DBLCLKS; + wndcls.lpfnWndProc = &DesuraProgress::WinProc; + wndcls.cbClsExtra = wndcls.cbWndExtra = 0; + wndcls.hInstance = hInst; + wndcls.hIcon = NULL; + wndcls.hCursor = LoadStandardCursor(IDC_ARROW); + wndcls.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); + wndcls.lpszMenuName = NULL; + wndcls.lpszClassName = DPROGRESS_CLASSNAME; + + if (!RegisterClass(&wndcls)) + return false; + } + + return true; +} + +LRESULT DesuraProgress::WinProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_PAINT: + gs_pDesuraProgress->OnPaint(); + return 0; + + case WM_ERASEBKGND: + gs_pDesuraProgress->OnEraseBkgnd(); + return 1; + + case WM_MOUSEMOVE: + gs_pDesuraProgress->OnMouseMove(wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + return 0; + + case WM_MOUSELEAVE: + gs_pDesuraProgress->OnMouseLeave(); + return 0; + + case WM_LBUTTONDOWN: + gs_pDesuraProgress->OnLButtonDown(wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + return 0; + + case WM_LBUTTONUP: + gs_pDesuraProgress->OnLButtonUp(wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + return 0; + } + + return ::DefWindowProc(hDlg, message, wParam, lParam); +} + +bool DesuraProgress::Create(CDesuraWnd* pParentWnd, const CRect& rect, UINT nID, DWORD dwStyle /*=WS_VISIBLE*/) +{ + return __super::Create(DPROGRESS_CLASSNAME, "Abcd", dwStyle, rect, pParentWnd, nID); +} + +void DesuraProgress::OnLButtonUp(UINT nFlags, CPoint point) +{ + m_bDragging = false; + ReleaseCapture(); +} + +void DesuraProgress::OnLButtonDown(UINT nFlags, CPoint point) +{ + CRect rect = getCancelRect(); + if (rect.PtInRect(point)) + { + exit(1); + } + else + { + m_bDragging = true; + m_StartPoint = point; + SetCapture(); + } +} + +void DesuraProgress::OnMouseLeave() +{ + bool old = m_bMouseOver; + m_bMouseOver = false; + if (old != m_bMouseOver) + this->refresh(); +} + +void DesuraProgress::OnMouseMove(UINT nFlags, CPoint point) +{ + bool old = m_bMouseOver; + + CRect rect = getCancelRect(); + m_bMouseOver = rect.PtInRect(point); + + if (old != m_bMouseOver) + refresh(); + + if (m_bDragging) + { + CPoint pos = point - m_StartPoint; + ClientToScreen(pos); + GetParent()->SetWindowPos(pos.x-4, pos.y-26, 0, 0, SWP_NOSIZE); + } +} + + +CRect DesuraProgress::getCancelRect() +{ + return CRect(280, 168, 100, 26); +} + + +void DesuraProgress::OnPaint() +{ + CPaintDC dc(this); + + CRect size; + GetClientRect(size); + + int w = size.right-size.left; + int h = size.bottom-size.top; + + + CBitmap bmp; + bmp.CreateCompatibleBitmap(dc, w, h); + + CDC memDC; + memDC.CreateCompatibleDC(&dc); + HGDIOBJ pOldBitmap = memDC.SelectObject(&bmp); + //memDC.FillSolidRect(0,0,w, h, RGB(34,34,34)); + + { + CDC cdc; + BITMAP bmap; + + cdc.CreateCompatibleDC(&dc); + HGDIOBJ pOldBitmap = cdc.SelectObject(m_pBackgroundImage); + m_pBackgroundImage->GetBitmap(&bmap); + + memDC.StretchBlt(0, 0, w, h, &cdc, 0, 0, bmap.bmWidth, bmap.bmHeight, SRCCOPY); + cdc.SelectObject(pOldBitmap); + } + + + COLORREF clr = RGB(103,103,103); + int y1 = 108; + int x1 = 38; + + //progress box + { + CDC cdc; + BITMAP bmap; + + cdc.CreateCompatibleDC(&dc); + HGDIOBJ pOldBitmap = cdc.SelectObject(m_pLoadingBar); + m_pLoadingBar->GetBitmap(&bmap); + + int bw = bmap.bmWidth *m_iProg/100; + + + memDC.BitBlt(x1, y1, bw, bmap.bmHeight, &cdc, bmap.bmWidth - bw, 0, SRCCOPY); + cdc.SelectObject(pOldBitmap); + } + + + CFont Font2; + Font2.CreatePointFont(80, "MS Shell Dlg"); + + memDC.SelectObject(&Font2); + memDC.SetBkMode(TRANSPARENT); + memDC.SetTextColor(clr); + + + int tx = 430; + int ty = 10; + char progress[255] = {0}; + const char* process = NULL; + + if (m_iMode == MODE_STARTUP) + { + progress[0] = 0; + process = "Initialising"; + } + else + { + process = (m_iMode == MODE_DOWNLOADING)?"Downloading":"Installing"; + + if (m_iTotal == 0) + _snprintf_s(progress, 255, _TRUNCATE, "%0d%%", m_iProg); + else + _snprintf_s(progress, 255, _TRUNCATE, "%.2f/%.2f MiB", getDone()/1024.0/1024.0, m_iTotal/1024.0/1024.0); + } + + CSize tsize = memDC.GetOutputTextExtent(progress, strlen(progress)); + CSize psize = memDC.GetOutputTextExtent(process, strlen(process)); + CSize csize = memDC.GetOutputTextExtent("Cancel", 6); + + tx = 148 + (107-tsize.cx)/2; + ty = 171 + (21-csize.cy)/2; + + memDC.TextOut(tx, ty, progress, strlen(progress)); + + + tx = 32 + (106-psize.cx)/2; + ty = 171 + (21-csize.cy)/2; + + memDC.TextOut(tx, ty, process, strlen(process)); + + if (m_bMouseOver) + memDC.SetTextColor(RGB(33,138,244)); + + + tx = 307 + (75-csize.cx)/2; + ty = 171 + (21-csize.cy)/2; + + memDC.TextOut(tx, ty, "Cancel", 6); + + dc.BitBlt(0, 0, w, h, &memDC, 0, 0, SRCCOPY); + memDC.SelectObject(pOldBitmap); +} + +bool DesuraProgress::OnEraseBkgnd() +{ + return true; +} + + + diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.h libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.h --- libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/DesuraProgress.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,85 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#pragma once + +#include "DesuraWnd.h" + +// DesuraProgress + +enum +{ + MODE_STARTUP, + MODE_DOWNLOADING, + MODE_INSTALLING, +}; + + +class DesuraProgress : public Desurium::CDesuraWnd +{ +public: + DesuraProgress(); + virtual ~DesuraProgress(); + + bool Create(Desurium::CDesuraWnd *pParent, const Desurium::CRect& rect, UINT nID, DWORD dwStyle = WS_VISIBLE) override; + + void setTotal(int total){m_iTotal=total;} + void setDone(int done); + int getDone(); + void setProgress(int prog){m_iProg = prog;refresh();} + void setMode(int mode){m_iMode = mode; m_iProg = 0;refresh();} + + void refresh() + { + RedrawWindow(0, 0, RDW_INTERNALPAINT|RDW_NOERASE|RDW_UPDATENOW|RDW_INVALIDATE); + } + +protected: + + bool RegisterWindowClass(); + + void OnPaint() override; + bool OnEraseBkgnd() override; + void OnMouseMove(UINT nFlags, Desurium::CPoint point) override; + void OnLButtonUp(UINT nFlags, Desurium::CPoint point) override; + void OnLButtonDown(UINT nFlags, Desurium::CPoint point) override; + void OnMouseLeave() override; + + Desurium::CRect getCancelRect(); + + static LRESULT CALLBACK WinProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + +private: + int m_iTotal; + int m_iProg; + int m_iMode; + bool m_bMouseOver; + + int m_vDone[3]; + + Desurium::CBitmap *m_pBackgroundImage; + Desurium::CBitmap *m_pLoadingBar; + + bool m_bDragging; + Desurium::CPoint m_StartPoint; + + static DesuraProgress* gs_pDesuraProgress; +}; + + diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/InstallFiles.cpp libcef-desura-291/src/static/util_bootloader_official/code/InstallFiles.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/InstallFiles.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/InstallFiles.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,189 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "stdafx.h" +#define UTILWEB_INCLUDE + +#include "Common.h" +#include "UMcfEx.h" + +#include "UpdateMFCForm.h" +#include "AppUpdateInstall.h" + +#include +#include "updateFunctions.h" +#include + + + +static int DispUpdateError(UpdateForm* temp, gcException &e) +{ + char msg[255]; + Safe::snprintf(msg, 255, "Failed to update Desura: %s [%d.%d]", e.getErrMsg(), e.getErrId(), e.getSecErrId()); + ::MessageBox(temp->GetSafeHwnd(), msg, "Desura: ERROR", MB_OK); + + exit(-2); + return e.getErrId(); +} + + +UINT DownloadAndInstallMCF(UpdateForm* temp) +{ + UMcfEx *updateMcf = new UMcfEx(); + updateMcf->onProgressEvent += delegate(temp, &UpdateForm::onProgressN); + updateMcf->onDownloadProgressEvent += delegate(temp, &UpdateForm::onProgressD); + + DeleteFile(UPDATEXML); + + std::wstring path = UTIL::OS::getAppDataPath(L"dumps\0\0"); + + SHFILEOPSTRUCTW lpFileOp; + lpFileOp.wFunc = FO_DELETE; + lpFileOp.pFrom = path.c_str(); + lpFileOp.pTo = NULL; + lpFileOp.hwnd = NULL; + lpFileOp.fFlags = (FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR); + SHFileOperationW(&lpFileOp); + +#ifndef DEBUG + temp->getProgressControl()->setMode(MODE_DOWNLOADING); + + try + { + updateMcf->getUpdateInfo(true); + } + catch (gcException &e) + { + return DispUpdateError(temp, e); + } + catch (...) + { + ::MessageBox(temp->GetSafeHwnd(), "Failed to get update info.", "Desura: ERROR", MB_OK); + return 1; + } + + if (!updateMcf->checkMcf()) + { + char msg[255]; + Safe::snprintf(msg, 255, "Failed to update Desura: %s", updateMcf->getLastError()); + ::MessageBox(temp->GetSafeHwnd(), msg, "Desura: ERROR", MB_OK); + + exit(-3); + return 1; + } + + try + { + updateMcf->setFile(UPDATEFILE_W); + updateMcf->downloadMcf(); + + temp->getProgressControl()->setMode(MODE_INSTALLING); + + updateMcf->install(L".\\"); + } + catch (gcException &e) + { + return DispUpdateError(temp, e); + } + +#ifndef DEBUG + try + { + updateMcf->setRegValues(); + } + catch (gcException &e) + { + return DispUpdateError(temp, e); + } +#endif + + updateMcf->deleteMcf(); + safe_delete(updateMcf); + +#else + updateMcf->setFile(UPDATEFILE_W); + updateMcf->parseMCF(); + updateMcf->install(L".\\test\\"); +#endif + + return 0; +} + + + +UINT DownloadFilesForTest() +{ + UMcfEx updateMcf; + DeleteFile(UPDATEXML); + + try + { + updateMcf.getUpdateInfo(true); + + if (!updateMcf.checkMcf()) + return -2; + + updateMcf.setFile(UPDATEFILE_W); + updateMcf.downloadMcf(); + updateMcf.install(L".\\"); + } + catch (gcException &e) + { + return e.getErrId(); + } + catch (...) + { + return -1; + } + + return 0; +} + +UINT InstallFilesForTest() +{ + UMcf updateMcf; + + try + { + updateMcf.setFile(UPDATEFILE_W); + + if (updateMcf.parseMCF() != 0) + return -1; + + updateMcf.isValidInstaller(); + + AppUpdateInstall aui(NULL, true); + int res = aui.run(); + + if (res != 0) + return res; + + if (!updateMcf.checkFiles()) + return -2; + } + catch (gcException &e) + { + return e.getErrId(); + } + catch (...) + { + return -3; + } + + return 0; +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.cpp libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,180 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "StdAfx.h" +#include "Common.h" +#include "UMcfEx.h" + + +UMcfEx::UMcfEx() +{ + m_szLastError = NULL; + m_uiLevel = 0; +} + +UMcfEx::~UMcfEx() +{ + safe_delete(m_szLastError); +} + +//Downloads update info from web +void UMcfEx::getUpdateInfo(bool saveXml) +{ + HttpHandle wc(PRIMUPDATE); + wc->getWeb(); + + if (wc->getDataSize() == 0) + { + ::MessageBox(NULL, "Failed to get update data.\n\nDesura webserver might be down or you are not connected to the internet.", "Desura: ERROR", MB_OK); + exit(-1); + } + + tinyxml2::XMLDocument doc; + doc.Parse(const_cast(wc->getData()), wc->getDataSize()); + + parseUpdateXml(doc); + + if (m_pFileList.size() == 0) + { + ::MessageBox(NULL, "Failed to get update files.\n\nEther Desura download server is down or the update xml feed is bad.", "Desura: ERROR", MB_OK); + exit(-1); + } + + if (saveXml) + doc.SaveFile(UPDATEXML); +} + +void UMcfEx::downloadMcf() +{ + uint32 prog = 0; + onProgressEvent(prog); + + if (m_szUrl == "") + { + ::MessageBox(NULL, "Invalid Download URL.", "Desura: Error", MB_OK); + exit(-1); + } + + if (m_szFile == L"") + { + ::MessageBox(NULL, "Invalid MCF file path.", "Desura: Error", MB_OK); + exit(-1); + } + + HttpHandle wc(m_szUrl.c_str()); + wc->setOutFile(gcString(m_szFile).c_str()); + wc->getProgressEvent() += delegate((UMcf*)this, &UMcf::updateAllCB); + + try + { + wc->getWebToFile(); + } + catch (gcException &e) + { + char msg[255]; + _snprintf_s(msg, 255, _TRUNCATE, "Failed to download Desura Files. \n\n%s [%d.%d]", e.getErrMsg(), e.getErrId(), e.getSecErrId()); + ::MessageBox(NULL, msg, "Desura: Error", MB_OK); + exit(-1); + } + + m_sHeader->setBuild(MCFBuild::BuildFromInt(m_iAppBuild)); + m_sHeader->setId(m_iAppId); +} + +void UMcfEx::deleteMcf() +{ + if (m_szFile == L"") + return; + + DeleteFileW(m_szFile.c_str()); +} + +uint32 UMcfEx::progressUpdate(Prog_s *info, uint32 other) +{ + uint32 prog = UMcf::progressUpdate(info, other); + + if (m_uiLevel == 0) + { + return prog; + } + else if (m_uiLevel == 1 && prog != 0) + { + return prog*9/10; + } + else if (m_uiLevel == 3) + { + if (prog != 0) + return 90 + prog/10; + else + return 90; + } + + return 0; +} + +bool UMcfEx::checkMcf() +{ + HttpHandle wc(m_szUrl.c_str()); + wc->setDownloadRange(0, 5); + + try + { + wc->getWeb(); + } + catch (gcException &e) + { + Safe::strcpy(&m_szLastError, e.getErrMsg(), 255); + return false; + } + + if (wc->getDataSize() == 0) + { + Safe::strcpy(&m_szLastError, "Failed to download file from web.", 255); + return false; + } + else if (strncmp(wc->getData(), "LMCF", 4)==0) + { + return true; + } + else + { + //check to see if we had a http error + wc->cleanUp(); + wc->setDownloadRange(0, 1000); + wc->getWeb(); + + const char* title =strstr(wc->getData(), ""); + + if (title) + { + const char *start = title+7; + const char *end = strstr(start, ""); + + size_t len = end - start; + safe_delete(m_szLastError); + + m_szLastError = new char[len+1]; + strncpy_s(m_szLastError, len+1, start, len); + m_szLastError[len]='\0'; + return false; + } + } + + Safe::strcpy(&m_szLastError, "Unknown Error.", 255); + return false; +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.h libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.h --- libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/UMcfEx.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,53 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef DESURA_UMCF_EX_H +#define DESURA_UMCF_EX_H +#ifdef _WIN32 +#pragma once +#endif + +#include "umcf/UMcf.h" + +class UMcfEx : public UMcf +{ +public: + UMcfEx(); + ~UMcfEx(); + + //Downloads update info from web + void getUpdateInfo(bool save = false); + + //downloads the MCF ready to install. + void downloadMcf(); + bool checkMcf(); + void deleteMcf(); + + const char* getLastError(){return m_szLastError;} + + void setProgLevel(uint8 level){m_uiLevel = level;} + +protected: + uint32 progressUpdate(Prog_s *info, uint32 other=0); + +private: + uint8 m_uiLevel; + char* m_szLastError; +}; + +#endif //DESURA_UMCF_EX_H diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/UpdateFunctionsNonGpl.cpp libcef-desura-291/src/static/util_bootloader_official/code/UpdateFunctionsNonGpl.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/UpdateFunctionsNonGpl.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/UpdateFunctionsNonGpl.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,273 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + + +#include "windows.h" +#include "ShlObj.h" +#include "Common.h" +#include "UpdateFunctions.h" +#include "umcf/UMcf.h" + +INT_PTR DisplayUpdateWindow(int updateType); + +bool CheckCert() +{ +#ifndef DESURA_OFFICAL_BUILD + return false; +#endif + + wchar_t exePath[255]; + GetModuleFileNameW(NULL, exePath, 255); + + size_t exePathLen = Safe::wcslen(exePath, 255); + for (size_t x=exePathLen; x>0; x--) + { + if (exePath[x] == '\\') + break; + else + exePath[x] = '\0'; + } + + wchar_t *modules[] = + { + L"desura.exe", + L"desura_service.exe", + L"bin\\uicore.dll", + L"bin\\usercore.dll", + L"bin\\webcore.dll", + L"bin\\mcfcore.dll", + L"bin\\servicecore_c.dll", + }; + + char *moduleName[] = + { + "desura.exe", + "desura_service.exe", + "uicore.dll", + "usercore.dll", + "webcore.dll", + "mcfcore.dll", + "servicecore_c.dll", + }; + + bool allGood = true; + char msgMsg[1024]; + + char* curPos = msgMsg; + size_t curSize = 1024; + + Safe::snprintf(curPos, curSize, "There has been an error validating the Digital Signature for:\n"); + + curPos+= 62; + curSize+= 62; + + for (size_t x=0; x<6; x++) + { + wchar_t path[255]; + + gcString mod(modules[x]); + Safe::snwprintf(path, 255, L"%s\\%s", exePath, modules[x]); + + uint32 res = UTIL::WIN::validateCert(path); + + if (res == TRUST_E_NOSIGNATURE) + { + size_t size = strlen(moduleName[x]); + Safe::snprintf(curPos, curSize, "\t%s\n", moduleName[x]); + curPos += size+2; + curSize -= size+2; + allGood = false; + } + } + + if (allGood) + return false; + + Safe::snprintf(curPos, curSize, "\n" + "It is adviseable to do a full update instead of proceding as\n" + "you might be running unoffical code.\n" + "\n" + "Do you want to do a full update now?"); + + + LONG res = ::MessageBoxA(NULL, msgMsg, "Desura Error: Certificate Error", MB_YESNOCANCEL|MB_ICONSTOP); + + if (res == IDCANCEL) + exit(200); + + return (res == IDYES); +} + +int NeedUpdateNonGpl() +{ + std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W); + + if (!FileExists(UPDATEXML_W)) + { + return UPDATE_XML; + } + else + { + if (FileExists(path.c_str()) && CheckUpdate(path.c_str())) + return UPDATE_MCF; + + if (!CheckInstall()) + return UPDATE_FILES; + } + + if (CheckCert()) + return UPDATE_CERT; + + return UPDATE_NONE; +} + +bool CheckUpdate(const wchar_t* path) +{ + UMcf updateMcf; + updateMcf.setFile(path); + + return (updateMcf.parseMCF() == UMCF_OK && updateMcf.isValidInstaller()); +} + +bool CheckInstall() +{ + UMcf updateMcf; + updateMcf.loadFromFile(UPDATEXML_W); + + return updateMcf.checkFiles(); +} + +//with full updates we should have admin rights +void FullUpdate() +{ + DeleteFileW(L"desura_old.exe"); + DeleteFileW(L"desura_service_old.exe"); + + std::wstring updateFile = UTIL::OS::getAppDataPath(UPDATEFILE_W); + DeleteFileW(updateFile.c_str()); + + if (DisplayUpdateWindow(UPDATE_FILES) == 2) + exit(0); + +#ifndef DEBUG + try + { + SetRegValues(); + InstallService(); + ServiceUpdate(false); + } + catch (gcException &e) + { + char msg[255]; + Safe::snprintf(msg, 255, "Failed to Update Desura: %s [%d.%d]", e.getErrMsg(), e.getErrId(), e.getSecErrId()); + ::MessageBox(NULL, msg, "Desura Critical Error", MB_OK); + + exit(-4); + } +#endif +} + +void McfUpdate() +{ + DisplayUpdateWindow(UPDATE_MCF); +} + + +void CheckForBadUninstaller() +{ + char exePath[255]; + GetModuleFileName(NULL, exePath, 255); + + size_t exePathLen = strlen(exePath); + for (size_t x=exePathLen; x>0; x--) + { + char c = exePath[x]; + + exePath[x] = '\0'; + exePathLen = x; + + if (c == '\\') + break; + } + + char * folder = exePath; + + for (size_t x=exePathLen; x>0; x--) + { + if (exePath[x] == '\\') + { + folder = &exePath[x+1]; + break; + } + } + + if (strcmp(folder, "Desura") != 0) + DeleteFile("Desura_Uninstall.exe"); +} + + +FILE* g_pUpdateLog = NULL; + +void InitUpdateLog() +{ + if (g_pUpdateLog) + return; + + char path[MAX_PATH]; + SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, path); + + char file[255]; + + _snprintf_s(file, 255, "%s\\Desura", path); + CreateDirectory(file, NULL); + + _snprintf_s(file, 255, "%s\\Desura\\DesuraApp", path); + CreateDirectory(file, NULL); + + _snprintf_s(file, 255, "%s\\Desura\\DesuraApp\\update_log.txt", path); + fopen_s(&g_pUpdateLog, file, "a"); +} + +void StopUpdateLog() +{ + if (!g_pUpdateLog) + return; + + fclose(g_pUpdateLog); +} + +void Log(const char* format, ...) +{ + if (!g_pUpdateLog) + return; + + time_t rawtime; + struct tm timeinfo; + char buffer[255]; + + time(&rawtime); + localtime_s(&timeinfo, &rawtime); + + strftime(buffer, 255, "%c:", &timeinfo); + fprintf(g_pUpdateLog, buffer); + + va_list args; + va_start(args, format); + vfprintf(g_pUpdateLog, format, args); + va_end(args); +} \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.cpp libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,217 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "stdafx.h" +#define UTILWEB_INCLUDE + +#include "Common.h" +#include "UMcfEx.h" + +#include "UpdateMFCForm.h" +#include "AppUpdateInstall.h" + +#include +#include "UpdateFunctions.h" +#include + +using namespace Desurium; + +INT_PTR DisplayUpdateWindow(int updateType) +{ + UpdateForm dlg(updateType); + return dlg.DoModal(); +} + +UINT __stdcall InstallFilesThread(void *form); +UINT __stdcall InstallMcfThread(void *form); + + + +UpdateForm::UpdateForm(int updateType) + : Desurium::CDesuraDialog(IDD_UPDATEFORM_DIALOG) +{ + m_bInit = false; + m_hIcon = LoadIcon(IDI_ICON); + m_Progress = new DesuraProgress(); + m_updateType = updateType; +} + +UpdateForm::~UpdateForm() +{ +} + + +bool UpdateForm::OnInitDialog() +{ + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + CRect prect(0,0,414,218); + BOOL res = m_Progress->Create(this, prect, IDC_PROGRESS, WS_VISIBLE|WS_CHILD); + + m_bInit = true; + + + RECT clientRect; + DWORD dwStyle = ::GetWindowLong((HWND)GetSafeHwnd(), GWL_STYLE); + DWORD dwExStyle = ::GetWindowLong((HWND)GetSafeHwnd(), GWL_EXSTYLE); + ::GetClientRect((HWND)GetSafeHwnd(), &clientRect); + ::AdjustWindowRectEx(&clientRect, dwStyle, ::GetMenu((HWND)GetSafeHwnd()) != NULL, dwExStyle); + + clientRect.top *= -1; + clientRect.left *= -1; + + int w = clientRect.right - clientRect.left;// - clientRect.left; + int h = clientRect.bottom - clientRect.top;// - clientRect.left; + + HRGN region = CreateRoundRectRgn(clientRect.left, clientRect.top, clientRect.right, clientRect.bottom+clientRect.top-clientRect.left, 5, 5); + SetWindowRgn(region, true); + + return TRUE; +} + +INT_PTR UpdateForm::DoModal() +{ + if (m_updateType != -1) + { + if (m_updateType == UPDATE_MCF) + UpdateMcf(); + else + UpdateFiles(); + } + + return CDesuraDialog::DoModal(); +} + + +void UpdateForm::UpdateFiles() +{ + BeginThread(InstallFilesThread, (void*)this); +} + +void UpdateForm::UpdateMcf() +{ + BeginThread(InstallMcfThread, (void*)this); +} + +void UpdateForm::onProgressN(unsigned int& prog) +{ + m_Progress->setProgress(prog); + m_Progress->refresh(); +} + +void UpdateForm::onProgressD(Prog_s& info) +{ + uint64 done = (uint32)info.dlnow; //+= (uint64)size; + uint32 per = 0; + + if (done > 0) + per = (uint32)(done*100/info.dltotal); + + m_Progress->setProgress(per); + m_Progress->setDone((int)info.dlnow); + m_Progress->setTotal((int)info.dltotal); + m_Progress->refresh(); +} + + + +bool FileExists(const wchar_t* fileName); + + +UINT DownloadAndInstallMCF(UpdateForm* temp); + +//this should only be called if an update is needed. +UINT __stdcall InstallFilesThread(void *form) +{ + UpdateForm* temp = static_cast(form); + + if (!temp) + { + ::MessageBox(NULL, "Failed to find update form!", "Desura: ERROR", MB_OK); + exit(-1); + } + + while (!temp->isInit()) + gcSleep(500); + + if (FileExists(L"update_lock.txt")) + { + DWORD ret = ::MessageBox(temp->GetSafeHwnd(), "It looks like Desura tried to update and failed. Want to try again?", "Desura", MB_YESNO); + DeleteFileW(L"update_lock.txt"); + + if (ret == IDNO) + { + temp->EndDialog(2); + return 2; + } + } + + FILE* fh = Safe::fopen("update_lock.txt", "wb"); + + if (fh) + fclose(fh); + + + UINT res = DownloadAndInstallMCF(temp); + + + DeleteFile("update_lock.txt"); + + temp->EndDialog(res); + return res; +} + +//this should only be called if an update is needed. +UINT __stdcall InstallMcfThread(void *form) +{ + int res = 0; + UpdateForm* temp = static_cast(form); + + if (!temp) + { + ::MessageBox(NULL, "Failed to find update form!", "Desura: ERROR", MB_OK); + return 1; + } + + while (!temp->isInit()) + gcSleep(500); + + temp->getProgressControl()->setMode(MODE_INSTALLING); + + AppUpdateInstall aui(temp); + res = aui.run(); + + if (res != 0) + { + char msg[255] ={0}; + _snprintf_s(msg, 255, "Failed to install update [%d]!", res); + ::MessageBox(temp->GetSafeHwnd(), msg, "Desura: ERROR", MB_OK); + + std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W); + DeleteFileW(path.c_str()); + + return 1; + } + + temp->EndDialog(res); + + return 0; +} diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.h libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.h --- libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.h 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/UpdateMFCForm.h 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,80 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef DESURA_UPDATEFORM_H +#define DESURA_UPDATEFORM_H +#ifdef _WIN32 +#pragma once +#endif + +#include "Resource.h" +#include "DesuraWnd.h" +#include "DesuraProgress.h" +#include "AppUpdateInstall.h" + +#ifndef UTILWEB_INCLUDE + +typedef struct +{ + double dltotal; + double dlnow; + double ultotal; + double ulnow; + bool abort; +} Prog_s; + +#endif + + + +class UpdateForm : public Desurium::CDesuraDialog, public ProgressReportI +{ +public: + UpdateForm(int updateType); + ~UpdateForm(); + + INT_PTR DoModal(); + + bool isInit(){return m_bInit;} + void onProgressN(unsigned int& prog); + void onProgressD(Prog_s& p); + + DesuraProgress* getProgressControl(){return m_Progress;} + + virtual void reportProgress(uint32 prog) + { + m_Progress->setProgress(prog); + } + +protected: + void UpdateMcf(); + void UpdateFiles(); + + virtual bool OnInitDialog(); + +private: + HICON m_hIcon; + DesuraProgress *m_Progress; + + bool m_bInit; + int m_updateType; +}; + + + +#endif //DESURA_UPDATEFORM_H diff -Nru libcef-desura-291/src/static/util_bootloader_official/code/stdafx.cpp libcef-desura-291/src/static/util_bootloader_official/code/stdafx.cpp --- libcef-desura-291/src/static/util_bootloader_official/code/stdafx.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/src/static/util_bootloader_official/code/stdafx.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,25 @@ +/* +Desura is the leading indie game distribution platform +Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + + +// stdafx.cpp : source file that includes just the standard includes +// mcf_testapp2.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + + + diff -Nru libcef-desura-291/src/static/util_fs/CMakeLists.txt libcef-desura-291/src/static/util_fs/CMakeLists.txt --- libcef-desura-291/src/static/util_fs/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util_fs/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -19,4 +19,8 @@ ${Boost_SYSTEM_LIBRARY} ) +if(WIN32) + SetSharedRuntime(util_fs) +endif() + SET_PROPERTY(TARGET util_fs PROPERTY FOLDER "Static") \ No newline at end of file diff -Nru libcef-desura-291/src/static/util_fs/code/UtilFs.cpp libcef-desura-291/src/static/util_fs/code/UtilFs.cpp --- libcef-desura-291/src/static/util_fs/code/UtilFs.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util_fs/code/UtilFs.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -27,6 +27,24 @@ namespace bf = boost::filesystem; +#ifdef WIN32 + +#include "boost/filesystem/path.hpp" +// fix for https://svn.boost.org/trac/boost/ticket/6320 + +class BoostFSCrashFix +{ +public: + BoostFSCrashFix() + { + boost::filesystem::path::imbue(std::locale("")); + } +}; + +static BoostFSCrashFix gs_BoostFSFix; + +#endif + namespace UTIL { namespace MISC diff -Nru libcef-desura-291/src/static/util_thread/CMakeLists.txt libcef-desura-291/src/static/util_thread/CMakeLists.txt --- libcef-desura-291/src/static/util_thread/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/util_thread/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,6 +1,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIR} + ${Boost_INCLUDE_DIR_S} ) file(GLOB Sources code/*.cpp) @@ -17,4 +18,21 @@ ${PLATFORM_LIBRARIES} ) -SET_PROPERTY(TARGET threads PROPERTY FOLDER "Static") \ No newline at end of file +if(WIN32) + SetSharedRuntime(threads) +endif() + +SET_PROPERTY(TARGET threads PROPERTY FOLDER "Static") + +if (WIN32) + add_library(threads_s STATIC ${Sources}) + + target_link_libraries(threads_s + ${Boost_SYSTEM_LIBRARY_S} + ${Boost_THREAD_LIBRARY_S} + ${Boost_CHRONO_LIBRARY_S} + ) + + SET_PROPERTY(TARGET threads_s PROPERTY FOLDER "Static") + SetStaticRuntime(threads_s) +endif() \ No newline at end of file diff -Nru libcef-desura-291/src/static/wx_controls/CMakeLists.txt libcef-desura-291/src/static/wx_controls/CMakeLists.txt --- libcef-desura-291/src/static/wx_controls/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -21,4 +21,8 @@ ${wxWidgets_LIBRARIES} ) +if(WIN32) + SetSharedRuntime(wx_controls) +endif() + SET_PROPERTY(TARGET wx_controls PROPERTY FOLDER "Static") \ No newline at end of file diff -Nru libcef-desura-291/src/static/wx_controls/code/gcCustomFrameButtons.cpp libcef-desura-291/src/static/wx_controls/code/gcCustomFrameButtons.cpp --- libcef-desura-291/src/static/wx_controls/code/gcCustomFrameButtons.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/code/gcCustomFrameButtons.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "gcCustomFrameButtons.h" - -#include -#include "gcImageHandle.h" - -#include "gcCustomFrameImpl.h" -#include "gcThemeManager.h" - -enum -{ - BUTTON_CLOSE = 0, - BUTTON_MAX, - BUTTON_MIN, - BUTTON_RESTORE, -}; - -const char* g_szImageNames[] = -{ - "#main_close", - "#main_max", - "#main_min", - "#main_restore", -}; - -enum -{ - BSTATE_NORMAL = 0, - BSTATE_HOVER, - BSTATE_FOCUSE, - BSTATE_DISABLED, -}; - -const char* g_szSpriteNames[] = -{ - "normal", - "hover", - "focus", - "disabled", -}; - - -CustomFrameButtons::CustomFrameButtons(wxWindow* parent, wxTopLevelWindow* pFrame, int style, const char* imgActive, const char* imgNonActive) -{ - m_pParent = parent; - m_pFrame = pFrame; - - m_iMouseDown = 0; - m_ButtonRect.resize(3); - m_iButtonState.resize(3); - m_bButtonBitMapValid = false; - m_bActive = true; - - m_ButtonBitMap = wxBitmap(106,22); - - m_iButtonState[BUTTON_CLOSE] = BSTATE_NORMAL; - m_iButtonState[BUTTON_MAX] = BSTATE_NORMAL; - m_iButtonState[BUTTON_MIN] = BSTATE_NORMAL; - - m_ButtonRect[BUTTON_MIN] = wxRect(wxPoint(0,0), wxSize(30,22)); - m_ButtonRect[BUTTON_MAX] = wxRect(wxPoint(30,0), wxSize(28,22)); - m_ButtonRect[BUTTON_CLOSE] = wxRect(wxPoint(58,0), wxSize(48,22)); - - if (!(style & wxCLOSE_BOX)) - m_iButtonState[BUTTON_CLOSE] = BSTATE_DISABLED; - - if (!(style & wxMAXIMIZE_BOX)) - m_iButtonState[BUTTON_MAX] = BSTATE_DISABLED; - - if (!(style & wxMINIMIZE_BOX)) - m_iButtonState[BUTTON_MIN] = BSTATE_DISABLED; - - m_imgBorder = GetGCThemeManager()->getImageHandle(imgActive); - m_imgBorderNA = GetGCThemeManager()->getImageHandle(imgNonActive); -} - -void CustomFrameButtons::setActive(bool state) -{ - m_bActive = state; - invalidateBitmap(); -} - -bool CustomFrameButtons::isActive() -{ - return m_bActive; -} - -void CustomFrameButtons::invalidateBitmap() -{ - m_bButtonBitMapValid = false; - m_pParent->RefreshRect(getRect(), false); -} - -wxRect CustomFrameButtons::getRect() -{ - return wxRect(m_ButtonPos, m_ButtonBitMap.GetSize()); -} - -void CustomFrameButtons::clearBg(wxDC* dc) -{ - int ih = m_imgBorder->GetSize().GetHeight(); - int iw = m_imgBorder->GetSize().GetWidth(); - - wxImage borderImg = isActive()?m_imgBorder->Scale(iw, ih):m_imgBorderNA->Scale(iw, ih); - - wxBitmap borderBMP = GetGCThemeManager()->getSprite(borderImg, "main_border", "fill"); - wxBitmap borderBMPTarg(m_ButtonBitMap.GetSize()); - - gcImage::tileImg(borderBMPTarg, borderBMP, 0, gcImage::BOTH); - dc->DrawBitmap(borderBMPTarg, wxPoint(0,0), true); -} - -void CustomFrameButtons::generateButtons(wxDC* dc) -{ - if (!m_bButtonBitMapValid) - { - wxMemoryDC tmpDC(m_ButtonBitMap); - clearBg(&tmpDC); - - for (size_t x=BUTTON_CLOSE; x<=BUTTON_MIN; x++) - { - int butId = x; - - if (butId == BUTTON_MAX && m_pFrame->IsMaximized() && !(m_iButtonState[BUTTON_MAX] == BSTATE_DISABLED)) - butId = BUTTON_RESTORE; - - gcString imgName = g_szImageNames[butId]; - - if (!isActive()) - imgName += "_nonactive"; - - gcImageHandle imgBut = GetGCThemeManager()->getImageHandle(imgName.c_str()); - wxImage buttonImage(imgBut->Copy()); - - wxBitmap temp = GetGCThemeManager()->getSprite(buttonImage, "main_button", g_szSpriteNames[m_iButtonState[x]]); - - if (temp.IsOk()) - tmpDC.DrawBitmap(temp, m_ButtonRect[x].GetTopLeft(), true); - } - - tmpDC.SelectObject(wxNullBitmap); - m_bButtonBitMapValid=true; - } - - dc->DrawBitmap(m_ButtonBitMap, m_ButtonPos, true); -} - - -int32 CustomFrameButtons::isWithingButtons(uint8 action) -{ - wxPoint wpos = m_pParent->GetScreenPosition(); - wxPoint mpos = wxGetMousePosition(); - wxPoint mousePos = mpos-wpos; - - int butId = -1; - bool valid = true; - - for (size_t x=BUTTON_CLOSE; x<=BUTTON_MIN; x++) - { - wxRect rect = m_ButtonRect[x]; - rect.SetPosition(rect.GetPosition() + m_ButtonPos); - - if (rect.Contains(mousePos)) - { - butId = x; - break; - } - } - - if (butId != -1) - { - int state = m_iButtonState[butId]; - - if (state != BSTATE_DISABLED) - { - int targetState; - - switch (action) - { - case MOUSE_LDOWN: - targetState = BSTATE_FOCUSE; - break; - - case MOUSE_MOVE: - if (m_iMouseDown) - { - if (m_iMouseDown == butId+1) - targetState = BSTATE_FOCUSE; - else - targetState = BSTATE_NORMAL; - break; - } - - case MOUSE_LUP: - default: - targetState = BSTATE_HOVER; - break; - } - - if (state != targetState) - { - m_iButtonState[butId] = targetState; - valid = false; - } - } - } - - for (size_t x=BUTTON_CLOSE; x<=BUTTON_MIN; x++) - { -#ifdef WIN32 - if (x == butId) -#else - if (x == (uint64)butId) -#endif - continue; - - if (m_iButtonState[x] != BSTATE_NORMAL && m_iButtonState[x] != BSTATE_DISABLED) - { - m_iButtonState[x] = BSTATE_NORMAL; - valid = false; - } - } - - if (!valid) - invalidateBitmap(); - - return butId+1; -} - - -void CustomFrameButtons::calcBorders(int wb, int yoff) -{ - int butw = 0; - - for (size_t x=BUTTON_CLOSE; x<=BUTTON_MIN; x++) - butw += m_ButtonRect[x].GetWidth(); - - m_ButtonPos = wxPoint(wb-butw, yoff+1); -} - -bool CustomFrameButtons::onMouseMove() -{ - if (isWithingButtons(MOUSE_MOVE)) - { - if (!m_pParent->HasCapture()) - m_pParent->CaptureMouse(); - - return true; - } - else - { - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - } - - return false; -} - -bool CustomFrameButtons::onMouseDown() -{ - int mouse = isWithingButtons(MOUSE_LDOWN); - - if (mouse) - m_iMouseDown = mouse; - - return mouse?true:false; -} - -bool CustomFrameButtons::onMouseUp() -{ - int oldmouse = m_iMouseDown; - int mouse = isWithingButtons(MOUSE_LUP); - - m_iMouseDown = 0; - - if (mouse) - { - if (oldmouse != mouse) - return false; - - if (mouse-1 == BUTTON_CLOSE && m_iButtonState[BUTTON_CLOSE] != BSTATE_DISABLED) - { - m_pFrame->Close(); - } - else if (mouse-1 == BUTTON_MAX && m_iButtonState[BUTTON_MAX] != BSTATE_DISABLED) - { - bool isMaxed = m_pFrame->IsMaximized(); - m_pFrame->Maximize(!isMaxed); - - m_bButtonBitMapValid = false; - m_iButtonState[BUTTON_MAX] = BSTATE_NORMAL; - } - else if (mouse-1 == BUTTON_MIN && m_iButtonState[BUTTON_MIN] != BSTATE_DISABLED) - { -#ifdef WIN32 - ::SendMessageA((HWND)m_pFrame->GetHWND(), WM_SYSCOMMAND, SC_MINIMIZE, 0); -#endif - } - - return true; - } - - return false; -} - -bool CustomFrameButtons::onMouseDoubleClick() -{ - if (isWithingButtons(MOUSE_MOVE)) - { - m_bButtonBitMapValid = false; - return true; - } - - return false; -} diff -Nru libcef-desura-291/src/static/wx_controls/code/gcCustomFrameImpl.cpp libcef-desura-291/src/static/wx_controls/code/gcCustomFrameImpl.cpp --- libcef-desura-291/src/static/wx_controls/code/gcCustomFrameImpl.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/code/gcCustomFrameImpl.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,854 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "gcCustomFrame.h" -#include "gcCustomFrameImpl.h" - -const char* g_szBorderNames[] = -{ - "north", - "neast", - "east", - "seast", - "south", - "swest", - "west", - "nwest", -}; - -enum -{ - SC_CUSTOM_MIN = 90001, - SC_CUSTOM_MAX, - SC_CUSTOM_RESTORE, -}; - -#define BORDER_SIZE 6 -#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN()) - -gcCustomFrameImpl::gcCustomFrameImpl(wxTopLevelWindow* parent, FrameIcon* frameIcon, long style) -{ - m_pCFButtons = new CustomFrameButtons(parent, parent, style, "#main_border", "#main_border_nonactive"); - m_pCFResize = new CustomFrameResize(parent, (style & wxRESIZE_BORDER)?true:false); - m_pCFMove = new CustomFrameMove(parent); - - m_FrameBorder.resize(8); - - m_bDisableSetRegion = false; - m_bActive = false; - m_bBGBitMapValid= false; - m_bShowTitle = true; - m_bIsMaximized = false; - m_bWasLastMaximised = false; - -#ifdef WIN32 - m_iTitleHeight = 22; -#else - m_iTitleHeight = 0; -#endif - - m_pParent = parent; - m_pFrameIcon = frameIcon; - - m_bMaxEnabled = (style & wxMAXIMIZE_BOX)?true:false; - m_bMinEnabled = (style & wxMINIMIZE_BOX)?true:false; - - m_LastSize = m_pParent->GetSize(); - - calcBorders(); - - m_imgBorder = GetGCThemeManager()->getImageHandle("#main_border"); - m_imgBorderNA = GetGCThemeManager()->getImageHandle("#main_border_nonactive"); - - m_pParent->Bind(wxEVT_LEFT_DCLICK, &gcCustomFrameImpl::onLeftDClick, this); - m_pParent->Bind(wxEVT_MOTION, &gcCustomFrameImpl::onMouseMove, this); - m_pParent->Bind(wxEVT_LEFT_DOWN, &gcCustomFrameImpl::onLeftMouseDown, this); - m_pParent->Bind(wxEVT_LEFT_UP, &gcCustomFrameImpl::onLeftMouseUp, this); - m_pParent->Bind(wxEVT_RIGHT_DOWN, &gcCustomFrameImpl::onRightMouseDown, this); - m_pParent->Bind(wxEVT_SIZE, &gcCustomFrameImpl::onResize, this); - - //m_pParent->Bind(wxEVT_PAINT, &gcCustomFrameImpl::onPaint, this); - m_pParent->Bind(wxEVT_NC_PAINT, &gcCustomFrameImpl::onPaintNC, this); - m_pParent->Bind(wxEVT_ERASE_BACKGROUND, &gcCustomFrameImpl::onPaintBG, this); - - m_pParent->Bind(wxEVT_KILL_FOCUS, &gcCustomFrameImpl::onBlur, this); - m_pParent->Bind(wxEVT_MOUSE_CAPTURE_LOST, &gcCustomFrameImpl::onMouseCaptureLost, this); - - - setFrameRegion(); - m_pParent->Layout(); - m_pParent->Refresh(); - -#ifdef WIN32 - HMENU menu = GetSystemMenu((HWND)m_pParent->GetHWND(), FALSE); - - RemoveMenu(menu, SC_RESTORE, MF_BYCOMMAND); - RemoveMenu(menu, SC_MAXIMIZE, MF_BYCOMMAND); - RemoveMenu(menu, SC_MINIMIZE, MF_BYCOMMAND); - RemoveMenu(menu, SC_MOVE, MF_BYCOMMAND); - RemoveMenu(menu, SC_SIZE, MF_BYCOMMAND); - - InsertMenu(menu, 0, MF_BYPOSITION, SC_CUSTOM_RESTORE, L"Restore"); - InsertMenu(menu, 1, MF_BYPOSITION, SC_CUSTOM_MIN, L"Minimize"); - InsertMenu(menu, 2, MF_BYPOSITION, SC_CUSTOM_MAX, L"Maximize"); - - - MENUITEMINFO mif; - - memset(&mif, 0, sizeof(MENUITEMINFO)); - mif.cbSize = sizeof(MENUITEMINFO); - - mif.fMask = MIIM_BITMAP; - - - mif.hbmpItem = HBMMENU_POPUP_RESTORE; - SetMenuItemInfo(menu, SC_CUSTOM_RESTORE, FALSE, &mif); - - mif.hbmpItem = HBMMENU_POPUP_MINIMIZE; - SetMenuItemInfo(menu, SC_CUSTOM_MIN, FALSE, &mif); - - mif.hbmpItem = HBMMENU_POPUP_MAXIMIZE; - SetMenuItemInfo(menu, SC_CUSTOM_MAX, FALSE, &mif); - - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_GRAYED); - - if (!m_bMaxEnabled) - EnableMenuItem(menu, SC_CUSTOM_MAX, MF_GRAYED); - - if (!m_bMinEnabled) - EnableMenuItem(menu, SC_CUSTOM_MIN, MF_GRAYED); -#endif -} - -gcCustomFrameImpl::~gcCustomFrameImpl() -{ - // Unbind Events - m_pParent->Unbind( wxEVT_LEFT_DCLICK, &gcCustomFrameImpl::onLeftDClick, this); - m_pParent->Unbind( wxEVT_MOTION, &gcCustomFrameImpl::onMouseMove, this); - m_pParent->Unbind( wxEVT_LEFT_DOWN, &gcCustomFrameImpl::onLeftMouseDown, this); - m_pParent->Unbind( wxEVT_LEFT_UP, &gcCustomFrameImpl::onLeftMouseUp, this); - m_pParent->Unbind( wxEVT_PAINT, &gcCustomFrameImpl::onPaint, this); - m_pParent->Unbind( wxEVT_SIZE, &gcCustomFrameImpl::onResize, this); - m_pParent->Unbind( wxEVT_ERASE_BACKGROUND, &gcCustomFrameImpl::onPaintBG, this); - - m_pParent->Unbind( wxEVT_KILL_FOCUS, &gcCustomFrameImpl::onBlur, this); - m_pParent->Unbind( wxEVT_MOUSE_CAPTURE_LOST, &gcCustomFrameImpl::onMouseCaptureLost, this); - - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - - safe_delete(m_pCFButtons); - safe_delete(m_pCFMove); - safe_delete(m_pCFResize); -} - -void gcCustomFrameImpl::destroy() -{ -} - -bool gcCustomFrameImpl::isResizing() -{ - return m_pCFResize->isResizing(); -} - -#ifdef WIN32 -WXLRESULT gcCustomFrameImpl::PreMSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam, bool &processed) -{ - if (message == WM_NCACTIVATE) - { - m_bActive = wParam?true:false; - - if (m_pCFButtons) - m_pCFButtons->setActive(m_bActive); - - m_pParent->Refresh(false); - - bool state = m_bActive; - onActiveEvent(state); - } - else if (message == WM_SYSCOMMAND || message == WM_COMMAND) - { - if (wParam == SC_MINIMIZE || wParam == SC_MAXIMIZE || wParam == SC_CUSTOM_MIN || wParam == SC_CUSTOM_MAX) - { - m_bDisableSetRegion = true; - } - else if (wParam == SC_RESTORE || wParam == SC_CUSTOM_RESTORE) - { - m_bDisableSetRegion = false; - } - - if (wParam == SC_MAXIMIZE || wParam == SC_CUSTOM_MAX) - { - m_pParent->Maximize(true); - processed = true; - } - else if (wParam == SC_RESTORE || wParam == SC_CUSTOM_RESTORE) - { - if (m_bWasLastMaximised) - { - m_bWasLastMaximised = false; - m_pParent->Restore(); - m_pParent->SetSize(m_RestorSize); - m_pParent->Maximize(true); - } - else if (m_pParent->IsMaximized()) - { - m_pParent->Maximize(false); - } - else - { - m_pParent->Restore(); - } - - processed = true; - } - else if (wParam == SC_MINIMIZE || wParam == SC_CUSTOM_MIN) - { - m_pParent->Iconize(); - processed = true; - } - else if (wParam == SC_CLOSE) - { - m_pParent->Close(); - processed = true; - } - } - else if (message == WM_WINDOWPOSCHANGING) - { - WINDOWPOS* pos = (WINDOWPOS*)lParam; - - if (pos && (pos->flags & SWP_NOSIZE) == 0) - { - calcBorders(); - wxSize newSize(pos->cx, pos->cy); - - //issues when maxing and mining if we setframe during them - if (newSize != wxSize(0,0) && newSize != m_LastSize && !m_bDisableSetRegion) - { - setFrameRegion(); - m_LastSize = newSize; - } - } - } - else if (message == WM_SIZE) - { - if (wParam == SIZE_MINIMIZED && m_bIsMaximized) - { - m_bWasLastMaximised = true; - m_bIsMaximized = false; - m_pParent->SetSize(m_LastSize); - } - else if (wParam == SIZE_MAXIMIZED) - { - m_bIsMaximized = true; - } - } - - return 0; -} - -WXLRESULT gcCustomFrameImpl::PostMSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam, WXLRESULT res) -{ - if (message == WM_SIZE && wParam == SIZE_RESTORED) - { - m_pParent->Layout(); - } - - return res; -} -#endif - -void gcCustomFrameImpl::setTitleHeight(unsigned int height) -{ - if (height<1) - height = 1; - - m_iTitleHeight = height; - m_pParent->Refresh(); -} - -void gcCustomFrameImpl::showTitle(bool state) -{ - m_bShowTitle = state; - m_pParent->Refresh(); -} - -//Some reason wxWidgets draws a 1px border around the top and left sides. Increase client area by one and reduce th client area offset - - -wxRect gcCustomFrameImpl::getWindowsBorderRect() const -{ - // SetWindowRgn expects the region to be in coordinants - // relative to the window, not the client area. Figure - // out the offset, if any. -#ifdef WIN32 - RECT rect; - DWORD dwStyle = ::GetWindowLong((HWND)m_pParent->GetHWND(), GWL_STYLE); - DWORD dwExStyle = ::GetWindowLong((HWND)m_pParent->GetHWND(), GWL_EXSTYLE); - ::GetClientRect((HWND)m_pParent->GetHWND(), &rect); - ::AdjustWindowRectEx(&rect, dwStyle, ::GetMenu((HWND)m_pParent->GetHWND()) != NULL, dwExStyle); - - int x=rect.left*-1; - int y=rect.top*-1; - - int w = rect.right+rect.left; - int h = rect.bottom+rect.left;//+ (y-x)-1; - - wxPoint point = m_pParent->GetPosition(); - - return wxRect(wxPoint(x, y), wxSize(w, h)); -#else - return wxRect(wxPoint(0,0), wxSize(800, 600)); -#endif -} - - -void gcCustomFrameImpl::DoGetClientSize(int *width, int *height) const -{ - *width = m_ClientArea.GetWidth(); - *height = m_ClientArea.GetHeight(); -} - -wxPoint gcCustomFrameImpl::GetClientAreaOrigin() const -{ - return m_PaintClientArea.GetTopLeft(); -} - -void gcCustomFrameImpl::restore() -{ -#ifdef WIN32 - HMENU menu = GetSystemMenu((HWND)m_pParent->GetHWND(), FALSE); - - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_GRAYED); - - if (m_bMaxEnabled) - EnableMenuItem(menu, SC_CUSTOM_MAX, MF_ENABLED); - - if (m_bMinEnabled) - EnableMenuItem(menu, SC_CUSTOM_MIN, MF_ENABLED); -#endif -} - -void gcCustomFrameImpl::maximize(bool state) -{ -#ifdef WIN32 - if (!m_bMaxEnabled) - return; - - if (state == m_bIsMaximized) - return; - - if (m_pParent->IsIconized()) - m_pParent->Iconize(false); - - if (m_bIsMaximized) - { - doRestore(); - } - else - { - doMaximize(); - } - - HMENU menu = GetSystemMenu((HWND)m_pParent->GetHWND(), FALSE); - - if (state) - { - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_ENABLED); - EnableMenuItem(menu, SC_CUSTOM_MAX, MF_GRAYED); - } - else - { - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_GRAYED); - EnableMenuItem(menu, SC_CUSTOM_MAX, MF_ENABLED); - } - - m_bIsMaximized = state; - - m_pParent->Layout(); -#endif -} - -void gcCustomFrameImpl::minimize(bool state) -{ -#ifdef WIN32 - if (!m_bMinEnabled) - return; - - HMENU menu = GetSystemMenu((HWND)m_pParent->GetHWND(), FALSE); - - if (state) - { - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_ENABLED); - EnableMenuItem(menu, SC_CUSTOM_MIN, MF_GRAYED); - } - else - { - EnableMenuItem(menu, SC_CUSTOM_RESTORE, MF_GRAYED); - EnableMenuItem(menu, SC_CUSTOM_MIN, MF_ENABLED); - } -#endif -} - -void gcCustomFrameImpl::doRestore() -{ - if (!m_bIsMaximized) - return; - - m_bIsMaximized = false; - - m_pParent->SetSize(m_RestorSize); - m_pParent->Layout(); - - m_RestorSize = wxRect(); -} - -void gcCustomFrameImpl::doMaximize() -{ - if (m_bIsMaximized) - return; - - m_bIsMaximized = true; - m_RestorSize = m_pParent->GetRect(); - - -#ifdef WIN32 - MONITORINFO mi = { sizeof(mi) }; - - HWND hwnd = (HWND)m_pParent->GetHWND(); - - WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) }; - GetWindowPlacement(hwnd, &g_wpPrev); - GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi); - - wxRect wbr = getWindowsBorderRect(); - - wxPoint pos = wxPoint(mi.rcWork.left, mi.rcWork.top) - wbr.GetTopLeft(); - wxSize size = wxSize(mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top); - - m_pParent->SetSize(wxRect(pos, size)); -#endif - if (m_pCFButtons) - m_pCFButtons->invalidateBitmap(); - - calcBorders(); - setFrameRegion(); - m_pParent->Refresh(true); -} - -void gcCustomFrameImpl::onResize( wxSizeEvent& event ) -{ - m_bBGBitMapValid = false; - - setFrameRegion(); - - m_pParent->Layout(); - m_pParent->Refresh(); - - event.Skip(); -} - - -wxRegion gcCustomFrameImpl::generateBorderRegion() -{ - wxRect butRect; - - if (m_pCFButtons) - butRect = m_pCFButtons->getRect(); - - wxRegion bRegion; - - for (int x=0; xgetRect(); - - dc->DestroyClippingRegion(); - dc->SetDeviceClippingRegion(generateBorderRegion()); - - generateBorder(dc); - - wxRegion tRegion(m_TitleBorder); - tRegion.Subtract(butRect); - - dc->DestroyClippingRegion(); - dc->SetDeviceClippingRegion(tRegion); - - generateTitle(dc); - - dc->DestroyClippingRegion(); - - if (m_pCFButtons) - { - dc->SetDeviceClippingRegion(wxRegion(butRect)); - m_pCFButtons->generateButtons(dc); - dc->DestroyClippingRegion(); - } - - m_bBGBitMapValid = true; -} - -void gcCustomFrameImpl::onPaintNC(wxNcPaintEvent& event) -{ - wxWindowDC dc(m_pParent); - - wxRect pRect = m_pParent->GetRect(); - wxSize pSize = pRect.GetSize(); - - if (!m_BorderBitmap.IsOk() || m_BorderBitmap.GetSize() != pSize) - m_BorderBitmap = wxBitmap(pSize); - - wxMemoryDC tmpDC(m_BorderBitmap); - doPaintBorder(&tmpDC); - tmpDC.SelectObject(wxNullBitmap); - - wxRegion region(wxRect(wxPoint(0,0), pSize)); - region.Subtract(m_ClientArea); - - dc.DestroyClippingRegion(); - dc.SetDeviceClippingRegion(region); - dc.DrawBitmap(m_BorderBitmap, wxPoint(0,0), true); -} - -void gcCustomFrameImpl::onPaintBG( wxEraseEvent& event ) -{ - wxDC* dc = event.GetDC(); - - dc->DestroyClippingRegion(); - dc->SetDeviceClippingRegion(m_PaintClientArea); - - dc->SetPen(wxPen(m_pParent->GetBackgroundColour())); - dc->SetBrush(wxBrush(m_pParent->GetBackgroundColour())); - dc->DrawRectangle(m_PaintClientArea); - - dc->DestroyClippingRegion(); - - wxNcPaintEvent ncE; - onPaintNC(ncE); -} - -void gcCustomFrameImpl::onPaint(wxPaintEvent& event) -{ - //wxPaintDC dc(m_pParent); - - //if (m_pParent->IsMaximized()) - //{ - // dc.SetPen(wxPen(*wxCYAN)); - // dc.SetBrush(wxBrush(*wxCYAN)); - //} - //else - //{ - // dc.SetPen(wxPen(*wxGREEN)); - // dc.SetBrush(wxBrush(*wxGREEN)); - //} - - //dc.DrawRectangle(wxPoint(0,0), m_pParent->GetSize()); -} - - - - -void gcCustomFrameImpl::generateBorder(wxDC* dc) -{ - if (m_pParent->IsMaximized()) - return; - - int ih = m_imgBorder->GetSize().GetHeight(); - int iw = m_imgBorder->GetSize().GetWidth(); - - wxImage borderImg = m_bActive?m_imgBorder->Scale(iw, ih):m_imgBorderNA->Scale(iw, ih); - - //dc->SetBrush(wxBrush(*wxRED)); - //dc->SetPen(wxPen(*wxRED)); - - for (int x=0; xgetSprite(borderImg, "main_border", g_szBorderNames[x]); - wxBitmap borderBMPTarg(m_FrameBorder[x].GetSize()); - - if (!borderBMP.IsOk()) - continue; - - if (x == NORTH || x == SOUTH) - { - wxColor c(255,0,255); - gcImage::tileImg(borderBMPTarg, borderBMP, &c); - } - else if (x == WEST || x == EAST) - { - wxColor c(255,0,255); - gcImage::tileImg(borderBMPTarg, borderBMP, &c, gcImage::VERT); - } - else - { - borderBMPTarg = wxBitmap(borderBMP.ConvertToImage().Scale(m_FrameBorder[x].GetWidth(), m_FrameBorder[x].GetHeight())); - } - - if (borderBMPTarg.IsOk()) - dc->DrawBitmap(borderBMPTarg, m_FrameBorder[x].GetPosition(), true); - } -} - -void gcCustomFrameImpl::generateTitle(wxDC *dc) -{ - if (!m_bShowTitle) - return; - - //dc->SetBrush(wxBrush(*wxBLUE)); - //dc->SetPen(wxPen(*wxBLUE)); - //dc->DrawRectangle(m_TitleBorder); - - int ih = m_imgBorder->GetSize().GetHeight(); - int iw = m_imgBorder->GetSize().GetWidth(); - - wxImage borderImg = m_bActive?m_imgBorder->Scale(iw, ih):m_imgBorderNA->Scale(iw, ih); - wxBitmap borderBMP = GetGCThemeManager()->getSprite(borderImg, "main_border", "fill"); - wxBitmap borderBMPTarg(m_TitleBorder.GetSize()); - - gcImage::tileImg(borderBMPTarg, borderBMP, 0, gcImage::BOTH); - - if (borderBMPTarg.IsOk()) - dc->DrawBitmap(borderBMPTarg, m_TitleBorder.GetPosition(), true); - - if (m_pFrameIcon) - { - wxIcon icon = m_pFrameIcon->getFrameIcon(); - - if (icon.IsOk()) - dc->DrawIcon(icon, m_IconRect.GetTopLeft().x, m_IconRect.GetTopLeft().y); - } - - wxString title = m_pParent->GetTitle(); - - if (title.size() > 0) - { - wxFont font = dc->GetFont(); - font.SetWeight(wxFONTWEIGHT_LIGHT); - - dc->SetFont(font); - dc->SetTextForeground(m_pParent->GetForegroundColour()); - - wxSize tsize = dc->GetTextExtent(title); - - int tx = m_IconRect.GetTopLeft().x+m_IconRect.GetSize().x+5; - int ty = m_IconRect.GetTopLeft().y + (m_IconRect.GetSize().y-tsize.GetHeight())/2; - - dc->DrawText(title, tx, ty); - } -} - -void gcCustomFrameImpl::setFrameRegion() -{ - wxRect wbr = getWindowsBorderRect(); - wxPoint br = wbr.GetBottomRight(); - - br.x += 2; - br.y += 2; - - wxRegion region; - -#ifdef WIN32 - if (m_pParent->IsMaximized()) - { - region = CreateRectRgn(wbr.x, wbr.y, br.x, br.y); - } - else - { - region = CreateRoundRectRgn(wbr.x, wbr.y, br.x, br.y, 5, 5); - } - - // Windows takes ownership of the region, so - // we'll have to make a copy of the region to give to it. - - DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL); - RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; - ::GetRegionData(GetHrgnOf(region), noBytes, rgnData); - HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData); - delete[] (char*) rgnData; - - // Now call the shape API with the new region. - ::SetWindowRgn((HWND)m_pParent->GetHWND(), hrgn, FALSE); -#endif -} - -void gcCustomFrameImpl::onLeftDClick( wxMouseEvent& event ) -{ - wxPoint pos = wxGetMousePosition()-m_pParent->GetPosition(); - - if (m_pCFButtons && m_pCFButtons->onMouseDoubleClick()) - { - event.Skip(); - return; - } - - if (m_bMaxEnabled && m_TitleBorder.Contains(pos)) - { - bool isMaxed = m_pParent->IsMaximized(); - m_pParent->Maximize(!isMaxed); - } - else - { - event.Skip(); - } -} - -void gcCustomFrameImpl::onMouseCaptureLost(wxMouseCaptureLostEvent &event) -{ - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - - wxMouseEvent mouseEvent; - - onLeftMouseUp(mouseEvent); - -} - -void gcCustomFrameImpl::onBlur(wxFocusEvent& event) -{ - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - - event.Skip(); -} - - -void gcCustomFrameImpl::onMouseMove( wxMouseEvent& event ) -{ - if (m_pCFMove->isDragging()) - { - if (m_pCFMove->onMouseMove()) - { - m_pCFResize->reset(); - } - } - else if (m_pCFResize->isResizing()) - { - m_pCFResize->onMouseMove(); - } - else - { - if (m_pCFButtons && m_pCFButtons->onMouseMove()) - { - m_pCFResize->reset(); - } - else if (m_pCFMove->onMouseMove()) - { - m_pCFResize->reset(); - - if (m_pCFButtons) - m_pCFButtons->invalidateBitmap(); - } - else if (m_pCFResize->onMouseMove()) - { - } - } - - event.Skip(); -} - -void gcCustomFrameImpl::onRightMouseDown(wxMouseEvent& event) -{ - wxPoint pos = wxGetMousePosition()-m_pParent->GetPosition(); - - if (m_TitleBorder.Contains(pos)) - { -#ifdef WIN32 - wxPoint mousePos = wxGetMousePosition(); - HMENU menu = GetSystemMenu((HWND)m_pParent->GetHWND(), FALSE); - TrackPopupMenu(menu, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, mousePos.x, mousePos.y, 0, (HWND)m_pParent->GetHWND(), NULL); -#endif - } - else - { - event.Skip(); - } -} - -void gcCustomFrameImpl::onLeftMouseDown( wxMouseEvent& event ) -{ - if ((m_pCFButtons && m_pCFButtons->onMouseDown()) || m_pCFMove->onMouseDown(m_pCFResize->canResize()) || m_pCFResize->onMouseDown()) - event.Skip(); -} - -void gcCustomFrameImpl::onLeftMouseUp( wxMouseEvent& event ) -{ - if ((m_pCFButtons && m_pCFButtons->onMouseUp()) || m_pCFMove->onMouseUp() || m_pCFResize->onMouseUp()) - event.Skip(); -} - -void gcCustomFrameImpl::calcBorders() -{ - wxRect wbr = getWindowsBorderRect(); - - int borderSize = BORDER_SIZE; - int titleHeight = m_iTitleHeight + borderSize; - - if (m_pParent->IsMaximized()) - borderSize = 0; - - int x = wbr.x; - int y = wbr.y; - - int w = wbr.width; - int h = wbr.height; - - int wb = w - borderSize; - int hb = h - borderSize; - int w2b = w - borderSize*2; - int h2b = h - borderSize*2; - - m_PaintClientArea = wxRect(borderSize, titleHeight, w2b+x, h-titleHeight-borderSize+y); - m_ClientArea = wxRect(x+borderSize, y+titleHeight, w2b, h-titleHeight-borderSize); - m_TitleAreaRect = wxRect(x+0, y+0, w, titleHeight); - m_TitleBorder = wxRect(x+borderSize, y+borderSize, w2b, titleHeight-borderSize); - - m_FrameBorder[NORTH] = wxRect(x+borderSize, y+0, w2b, borderSize); - m_FrameBorder[NEAST] = wxRect(x+wb, y+0, borderSize, borderSize); - m_FrameBorder[EAST] = wxRect(x+wb, y+borderSize, borderSize, h2b); - m_FrameBorder[SEAST] = wxRect(x+wb, y+hb, borderSize, borderSize); - - m_FrameBorder[SOUTH] = wxRect(x+borderSize, y+hb, w2b, borderSize); - m_FrameBorder[SWEST] = wxRect(x+0, y+hb, borderSize, borderSize); - m_FrameBorder[WEST] = wxRect(x+0, y+borderSize, borderSize, h2b); - m_FrameBorder[NWEST] = wxRect(x+0, y+0, borderSize, borderSize); - - int iSize = 16; - int iIndenet = (titleHeight-iSize)/2; - m_IconRect = wxRect(x+borderSize, y+iIndenet, iSize, iSize); - - if (m_pCFButtons) - m_pCFButtons->calcBorders(wb+x, y); - - m_pCFResize->calcBorders(m_FrameBorder); - m_pCFMove->calcBorders(m_TitleBorder, m_TitleAreaRect); -} diff -Nru libcef-desura-291/src/static/wx_controls/code/gcCustomFrameMove.cpp libcef-desura-291/src/static/wx_controls/code/gcCustomFrameMove.cpp --- libcef-desura-291/src/static/wx_controls/code/gcCustomFrameMove.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/code/gcCustomFrameMove.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "gcCustomFrameMove.h" -#include "gcCustomFrameImpl.h" - -CustomFrameMove::CustomFrameMove(wxTopLevelWindow* pParent) -{ - m_bMouseDrag = false; - m_pParent = pParent; -} - - -bool CustomFrameMove::onMouseUp() -{ - if (!m_bMouseDrag) - return false; - - m_bMouseDrag = false; - - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - - return true; -} - -bool CustomFrameMove::onMouseDown(bool canResize) -{ - wxPoint pos = wxGetMousePosition()-m_pParent->GetScreenPosition(); - - if (m_TitleBorder.Contains(pos) || (!canResize && m_FrameBorder.Contains(pos))) - { - m_bMouseDrag = true; - m_StartDrag = pos; - m_StartPos = wxGetMousePosition(); - - if (!m_pParent->HasCapture()) - m_pParent->CaptureMouse(); - - return true; - } - - return false; -} - -bool CustomFrameMove::onMouseMove() -{ - if (!m_bMouseDrag) - return false; - - wxPoint oPos = wxGetMousePosition()-m_pParent->GetScreenPosition(); - - if (oPos == m_StartDrag) - return false; - - wxPoint pos = wxGetMousePosition(); - - if (m_pParent->IsMaximized()) - { - m_pParent->Maximize(false); - wxRect rect = m_pParent->GetRect(); - - m_StartDrag.x = rect.width/2; - } - - m_pParent->SetPosition(pos-m_StartDrag); - return true; -} - -void CustomFrameMove::calcBorders(wxRect title, wxRect frame) -{ - m_TitleBorder = title; - m_FrameBorder = frame; -} \ No newline at end of file diff -Nru libcef-desura-291/src/static/wx_controls/code/gcCustomFrameResize.cpp libcef-desura-291/src/static/wx_controls/code/gcCustomFrameResize.cpp --- libcef-desura-291/src/static/wx_controls/code/gcCustomFrameResize.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/code/gcCustomFrameResize.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,211 +0,0 @@ -/* -Desura is the leading indie game distribution platform -Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -#include "Common.h" -#include "gcCustomFrameResize.h" -#include "gcCustomFrameImpl.h" - -CustomFrameResize::CustomFrameResize(wxTopLevelWindow* pParent, bool enabled) -{ - m_pParent = pParent; - m_bResizeEnabled = enabled; - - m_MouseCursor = wxCURSOR_ARROW; - m_iResizeDir = -1; -} - -void CustomFrameResize::processMouseMove() -{ - wxPoint pos = wxGetMousePosition()-m_pParent->GetPosition(); - - bool stillIn = false; - for (size_t x=0; xSetCursor(wxCURSOR_ARROW); - m_MouseCursor = wxCURSOR_ARROW; - - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - } - else - { - if (!m_pParent->HasCapture()) - m_pParent->CaptureMouse(); - - m_pParent->SetCursor(m_MouseCursor); - } -} - -void CustomFrameResize::processResize() -{ - wxPoint pos = wxGetMousePosition()-m_pParent->GetPosition(); - - wxPoint windowPos = m_WindowPos; - wxSize windowSize = m_WindowSize; - - wxPoint winPosDiff = m_WindowPos - m_pParent->GetPosition(); - wxPoint diff = pos - m_StartResize - winPosDiff; - - switch (m_iResizeDir) - { - case NORTH: - case SOUTH: - diff.x=0; - break; - - case EAST: - case WEST: - diff.y=0; - break; - } - - wxSize minSize = m_pParent->GetMinSize(); - - if (m_iResizeDir == WEST || m_iResizeDir == SWEST || m_iResizeDir == NWEST) - { - if (windowSize.x + diff.x*-1 < minSize.x) - diff.x = windowSize.x - minSize.x; - - windowPos.x += diff.x; - diff.x *= -1; - } - - if (m_iResizeDir == NWEST || m_iResizeDir == NORTH || m_iResizeDir == NEAST) - { - if (windowSize.y + diff.y*-1 < minSize.y) - diff.y = windowSize.y - minSize.y; - - windowPos.y += diff.y; - diff.y *= -1; - } - - windowSize.x += diff.x; - windowSize.y += diff.y; - - if (windowSize.x < minSize.x) - windowSize.x = minSize.x; - - if (windowSize.y < minSize.y) - windowSize.y = minSize.y; - -#ifdef WIN32 - ::MoveWindow((HWND)m_pParent->GetHWND(), windowPos.x, windowPos.y, windowSize.x, windowSize.y,false); - m_pParent->Refresh(false); - ::RedrawWindow((HWND)m_pParent->GetHWND(), NULL, NULL, RDW_FRAME|RDW_INVALIDATE|RDW_NOERASE|RDW_ERASENOW); -#endif - //m_pParent->SetSize(wxRect(windowPos, windowSize)); -} - -bool CustomFrameResize::onMouseMove() -{ - if (!m_bResizeEnabled) - return false; - - if (m_iResizeDir != -1) - processResize(); - else - processMouseMove(); - - return true; -} - -bool CustomFrameResize::onMouseDown() -{ - if (!m_bResizeEnabled || m_iResizeDir != -1) - return false; - - wxPoint pos = wxGetMousePosition()-m_pParent->GetPosition(); - - for (size_t x=0; xGetPosition(); - m_WindowSize = m_pParent->GetSize(); - - m_pParent->CaptureMouse(); - } - - return true; -} - -bool CustomFrameResize::onMouseUp() -{ - if (!m_bResizeEnabled || m_iResizeDir == -1) - return false; - - m_iResizeDir = -1; - - //post an event so that the form knows its final size - wxSizeEvent se; - se.SetEventObject(m_pParent); - m_pParent->GetEventHandler()->AddPendingEvent(se); - - if (m_pParent->HasCapture()) - m_pParent->ReleaseMouse(); - - - return (m_StartPos == wxGetMousePosition()); -} - -void CustomFrameResize::calcBorders(std::vector &vFrameBorder) -{ - m_FrameBorder = vFrameBorder; -} diff -Nru libcef-desura-291/src/static/wx_controls/code/gcFrame.cpp libcef-desura-291/src/static/wx_controls/code/gcFrame.cpp --- libcef-desura-291/src/static/wx_controls/code/gcFrame.cpp 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/static/wx_controls/code/gcFrame.cpp 2013-10-17 18:16:34.000000000 +0000 @@ -24,7 +24,6 @@ extern ITaskbarList3* g_pITBL3; #endif -#include "gcCustomFrameImpl.h" #include "managers/CVar.h" #include "managers/Managers.h" diff -Nru libcef-desura-291/src/tools/mcf_extract/CMakeLists.txt libcef-desura-291/src/tools/mcf_extract/CMakeLists.txt --- libcef-desura-291/src/tools/mcf_extract/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_extract/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -14,7 +14,8 @@ ${LINUX_LIBRARIES} ) -install_executable(mcf_extract) +if(WIN32) + SetSharedRuntime(mcf_extract) +endif() -CopyTargetFiles(mcf_extract) -SET_PROPERTY(TARGET mcf_extract PROPERTY FOLDER "Tools") \ No newline at end of file +install_tool(mcf_extract) diff -Nru libcef-desura-291/src/tools/mcf_upload_cli/CMakeLists.txt libcef-desura-291/src/tools/mcf_upload_cli/CMakeLists.txt --- libcef-desura-291/src/tools/mcf_upload_cli/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_upload_cli/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -15,6 +15,8 @@ ${CURL_LIBRARIES} ) -install_executable(mcf_upload_cli) -CopyTargetFiles(mcf_upload_cli) -SET_PROPERTY(TARGET mcf_upload_cli PROPERTY FOLDER "Tools") \ No newline at end of file +if(WIN32) + SetSharedRuntime(mcf_upload_cli) +endif() + +install_tool(mcf_upload_cli) diff -Nru libcef-desura-291/src/tools/mcf_util/CMakeLists.txt libcef-desura-291/src/tools/mcf_util/CMakeLists.txt --- libcef-desura-291/src/tools/mcf_util/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_util/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -26,7 +26,8 @@ ${PLATFORM_LIBRARIES} ) -install_executable(mcf_util) +if(WIN32) + SetSharedRuntime(mcf_util) +endif() -CopyTargetFiles(mcf_util) -SET_PROPERTY(TARGET mcf_util PROPERTY FOLDER "Tools") \ No newline at end of file +install_tool(mcf_util) diff -Nru libcef-desura-291/src/tools/mcf_util/cpyfiles_release.bat libcef-desura-291/src/tools/mcf_util/cpyfiles_release.bat --- libcef-desura-291/src/tools/mcf_util/cpyfiles_release.bat 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_util/cpyfiles_release.bat 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -cd - -echo ------------------------------- -echo copying mcf_util.exe -copy .\Release\mcf_util.exe ..\..\..\tools\mcf_util\mcf_util.exe diff -Nru libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj --- libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ - - - - - Debug - Win32 - - - Release_Static - Win32 - - - Release - Win32 - - - - {C0A24CB1-608B-4C9D-B983-E71BC9ED83A5} - mcf_util - Win32Proj - - - - Application - NotSet - true - v100 - - - Application - NotSet - true - v100 - - - Application - NotSet - v100 - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(ProjectDir)\build\$(Configuration)\ - $(Configuration)\ - true - $(ProjectDir)\build\$(Configuration)\ - $(ProjectDir)\build\$(Configuration)\ - $(Configuration)\ - $(Configuration)\ - false - false - AllRules.ruleset - - - AllRules.ruleset - AllRules.ruleset - - - - - - - - Disabled - .\code;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - util_fs-d.lib;umcf-d.lib;util-d.lib;tinyxml-d.lib;%(AdditionalDependencies) - ../../../libs/Debug;%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX86 - LIBCMTD - - - cd -copy $(SolutionDir)\bin\mcfcore-d.dll .\build\Debug\mcfcore-d.dll - - - - - .\code;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - util_fs.lib;umcf.lib;util.lib;tinyxml.lib;%(AdditionalDependencies) - true - Console - true - true - false - - - MachineX86 - - - cd -copy .\build\Release\mcf_util.exe ..\..\..\tools\mcf_util\mcf_util.exe - copy files - - - - - .\code;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - ..\..\libs\Release\util_fs.lib;%(AdditionalDependencies) - true - Console - true - true - false - - - MachineX86 - - - $(ProjectDir)\cpyfiles_release.bat - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.filters libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.filters --- libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.filters 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ - - - - - - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - - - {9ab998d5-3dab-4cc8-b477-6b57fff338f2} - - - \ No newline at end of file diff -Nru libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.user libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.user --- libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.user 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/src/tools/mcf_util/mcf_util.vcxproj.user 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - - - -x D:\4082.mcf D:\4082 - - - D:\desura_nongpl\build_out\debug_win\bin - WindowsLocalDebugger - - \ No newline at end of file diff -Nru libcef-desura-291/third_party/bzip2/CMakeLists.txt libcef-desura-291/third_party/bzip2/CMakeLists.txt --- libcef-desura-291/third_party/bzip2/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/bzip2/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,17 +1,38 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/code ) set(BZIP2_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/ PARENT_SCOPE) -file(GLOB Headers ./include/*.h) -file(GLOB Sources ./code/*.c) +file(GLOB Headers ${BZIP2_INCLUDE_DIR}/bzlib.h) +file(GLOB Sources + ./code/blocksort.c + ./code/bzip2.c + ./code/bzip2recover.c + ./code/bzlib.c + ./code/bzlib_private.h + ./code/compress.c + ./code/crctable.c + ./code/decompress.c + ./code/huffman.c + ./code/randtable.c +) -add_library(bzip2 STATIC ${Sources}) -target_link_libraries(bzip2 +add_library(bzip2 STATIC ${Sources} ${Headers}) + target_link_libraries(bzip2 ) set(BZIP2_LIBRARIES bzip2 PARENT_SCOPE) +set_property(TARGET bzip2 PROPERTY FOLDER "ThirdParty") + +if (WIN32) + add_library(bzip2_s STATIC ${Sources} ${Headers}) + target_link_libraries(bzip2_s) + + set(BZIP2_LIBRARIES_S bzip2_s PARENT_SCOPE) + SET_PROPERTY(TARGET bzip2_s PROPERTY FOLDER "ThirdParty") -SET_PROPERTY(TARGET bzip2 PROPERTY FOLDER "ThirdParty") \ No newline at end of file + SetStaticRuntime(bzip2_s) +endif() diff -Nru libcef-desura-291/third_party/bzip2/bzip2.sln libcef-desura-291/third_party/bzip2/bzip2.sln --- libcef-desura-291/third_party/bzip2/bzip2.sln 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/bzip2/bzip2.sln 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "bzip2.vcxproj", "{B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release_Static|Win32 = Release_Static|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Debug|Win32.Build.0 = Debug|Win32 - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Release_Static|Win32.ActiveCfg = Release_Static|Win32 - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Release_Static|Win32.Build.0 = Release_Static|Win32 - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Release|Win32.ActiveCfg = Release|Win32 - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff -Nru libcef-desura-291/third_party/bzip2/bzip2.vcxproj libcef-desura-291/third_party/bzip2/bzip2.vcxproj --- libcef-desura-291/third_party/bzip2/bzip2.vcxproj 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/bzip2/bzip2.vcxproj 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Release_Static - Win32 - - - Release - Win32 - - - - - - - - - - - - - - - - - - - - - - {B3B6F4AC-7E78-4E84-A128-6EDAB3D86762} - Win32Proj - bzip2 - - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - - - - - $(ProjectDir)\build\$(Configuration)\ - $(ProjectName)-d - - - $(ProjectDir)\build\$(Configuration)\ - - - $(ProjectDir)\build\$(Configuration)\ - $(ProjectName)-s - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - ./code;./include;%(AdditionalIncludeDirectories) - $(OutDir)$(ProjectName)-d.pdb - - - Windows - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ./code;./include;%(AdditionalIncludeDirectories) - $(OutDir)$(ProjectName).pdb - - - Windows - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ./code;./include;%(AdditionalIncludeDirectories) - $(OutDir)$(ProjectName)-s.pdb - MultiThreaded - - - Windows - true - true - true - - - - - - \ No newline at end of file diff -Nru libcef-desura-291/third_party/bzip2/bzip2.vcxproj.filters libcef-desura-291/third_party/bzip2/bzip2.vcxproj.filters --- libcef-desura-291/third_party/bzip2/bzip2.vcxproj.filters 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/bzip2/bzip2.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - \ No newline at end of file diff -Nru libcef-desura-291/third_party/desura_extra/CMakeLists.txt libcef-desura-291/third_party/desura_extra/CMakeLists.txt --- libcef-desura-291/third_party/desura_extra/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libcef-desura-291/third_party/desura_extra/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -0,0 +1,18 @@ +ExternalProject_Add( + fetch_desura_extra_bin + URL "${DESURA_EXTRA_BIN_URL}" + URL_MD5 ${DESURA_EXTRA_BIN_MD5} + UPDATE_COMMAND "" + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +ExternalProject_Get_Property( + fetch_desura_extra_bin + source_dir +) + +add_custom_command(TARGET fetch_desura_extra_bin POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_dir}\\." "${CMAKE_OUTPUT}\\bin\\.") +SET_PROPERTY(TARGET fetch_desura_extra_bin PROPERTY FOLDER "ThirdParty") diff -Nru libcef-desura-291/third_party/sqlite/CMakeLists.txt libcef-desura-291/third_party/sqlite/CMakeLists.txt --- libcef-desura-291/third_party/sqlite/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/sqlite/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -4,20 +4,27 @@ set(SQLITE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/ PARENT_SCOPE) -file(GLOB Headers ./include/*.h) -file(GLOB Sources ./code/*.c ./include/*.h) +file(GLOB Headers + ${SQLITE_INCLUDE_DIR}/sqlite3.h + ${SQLITE_INCLUDE_DIR}/sqlite3ext.h +) + +file(GLOB Sources + ./code/sqlite3.c + ./code/sqlite3ext.c +) if(WIN32) - add_definitions(/D_LIB /DSQLITE_THREADSAFE) + add_definitions(-D_LIB -DSQLITE_THREADSAFE) else() - set(LINUX_LIBRARIES dl pthread) + set(LINUX_LIBRARIES dl ${CMAKE_THREAD_LIBS_INIT}) endif() -add_library(sqlite STATIC ${Sources}) +add_library(sqlite STATIC ${Sources} ${Headers}) target_link_libraries(sqlite ${LINUX_LIBRARIES} ) set(SQLITE_LIBRARIES sqlite PARENT_SCOPE) -SET_PROPERTY(TARGET sqlite PROPERTY FOLDER "ThirdParty") \ No newline at end of file +set_property(TARGET sqlite PROPERTY FOLDER "ThirdParty") diff -Nru libcef-desura-291/third_party/sqlite3x/CMakeLists.txt libcef-desura-291/third_party/sqlite3x/CMakeLists.txt --- libcef-desura-291/third_party/sqlite3x/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/sqlite3x/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -4,19 +4,32 @@ ${SQLITE_INCLUDE_DIR} ) -set(SQLITE3X_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include/ PARENT_SCOPE) +set(SQLITE3X_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE) -file(GLOB Sqlite3xHeaders ./include/*.hpp) -file(GLOB Sqlite3xSources ./code/*.cpp ./include/*.hpp) +file(GLOB Sqlite3xHeaders ${SQLITE3X_INCLUDE_DIRS}/sqlite3x.hpp) +file(GLOB Sqlite3xSources + ./code/sqlite3x_command.cpp + ./code/sqlite3x_connection.cpp + ./code/sqlite3x_exception.cpp + ./code/sqlite3x_reader.cpp + ./code/sqlite3x_transaction.cpp +) if(WIN32) - add_definitions(/D_LIB /DSQLITE_THREADSAFE) + add_definitions(-D_LIB -DSQLITE_THREADSAFE) endif() -add_library(sqlite3x STATIC ${Sqlite3xSources}) -target_link_libraries(sqlite3x - ${SQLITE_LIBRARIES} -) +add_library(sqlite3x STATIC ${Sqlite3xSources} ${Sqlite3xHeaders}) +target_link_libraries(sqlite3x ${SQLITE_LIBRARIES}) set(SQLITE3X_LIBRARIES sqlite3x PARENT_SCOPE) -SET_PROPERTY(TARGET sqlite3x PROPERTY FOLDER "ThirdParty") \ No newline at end of file +set_property(TARGET sqlite3x PROPERTY FOLDER "ThirdParty") + +if (WIN32) + add_library(sqlite3x_s STATIC ${Sqlite3xSources} ${Sqlite3xHeaders}) + target_link_libraries(sqlite3x_s ${SQLITE_LIBRARIES_S}) + set(SQLITE3X_LIBRARIES_S sqlite3x_s PARENT_SCOPE) + + SET_PROPERTY(TARGET sqlite3x_s PROPERTY FOLDER "ThirdParty") + SetStaticRuntime(sqlite3x_s) +endif() diff -Nru libcef-desura-291/third_party/tinyxml2/CMakeLists.txt libcef-desura-291/third_party/tinyxml2/CMakeLists.txt --- libcef-desura-291/third_party/tinyxml2/CMakeLists.txt 2013-10-07 07:18:14.000000000 +0000 +++ libcef-desura-291/third_party/tinyxml2/CMakeLists.txt 2013-10-17 18:16:34.000000000 +0000 @@ -1,7 +1,15 @@ add_definitions(-D_LIB) -add_library(tinyxml2 STATIC tinyxml2.cpp) +add_library(tinyxml2 STATIC tinyxml2.cpp tinyxml2.h) set(TINYXML_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) set(TINYXML_LIBRARIES tinyxml2 PARENT_SCOPE) -SET_PROPERTY(TARGET tinyxml2 PROPERTY FOLDER "ThirdParty") \ No newline at end of file +set_property(TARGET tinyxml2 PROPERTY FOLDER "ThirdParty") + +if (WIN32) + add_library(tinyxml2_s STATIC tinyxml2.cpp tinyxml2.h) + SET_PROPERTY(TARGET tinyxml2_s PROPERTY FOLDER "ThirdParty") + SetStaticRuntime(tinyxml2_s) + + set(TINYXML_LIBRARIES_S tinyxml2_s PARENT_SCOPE) +endif()