diff --git a/GW2Radial.sln b/GW2Radial.sln index 915017f..80d3e40 100644 --- a/GW2Radial.sln +++ b/GW2Radial.sln @@ -22,40 +22,66 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzma", "GW2Radial\ziplib\So EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "GW2Radial\ziplib\Source\ZipLib\extlibs\zlib\zlib.vcxproj", "{BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ZipLib Dependencies", "ZipLib Dependencies", "{C74AC87C-FD77-4C5E-BAB9-4B6713418B58}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{C74AC87C-FD77-4C5E-BAB9-4B6713418B58}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "GW2Radial\tinyxml2\tinyxml2\tinyxml2.vcxproj", "{D1C528B6-AA02-4D29-9D61-DC08E317A70D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Debug|x64.ActiveCfg = Debug|x64 {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Debug|x64.Build.0 = Debug|x64 + {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Debug|x86.ActiveCfg = Debug|x64 + {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Debug|x86.Build.0 = Debug|x64 {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Release|x64.ActiveCfg = Release|x64 {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Release|x64.Build.0 = Release|x64 + {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Release|x86.ActiveCfg = Release|x64 + {7EFE6DCC-544A-4116-9EF2-13C0431356E6}.Release|x86.Build.0 = Release|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.ActiveCfg = Debug|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.Build.0 = Debug|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.ActiveCfg = Debug|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.Build.0 = Debug|Win32 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.ActiveCfg = Release|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.Build.0 = Release|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x86.ActiveCfg = Release|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x86.Build.0 = Release|Win32 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.ActiveCfg = Debug|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.Build.0 = Debug|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.ActiveCfg = Debug|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.Build.0 = Debug|Win32 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.ActiveCfg = Release|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.Build.0 = Release|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.ActiveCfg = Release|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.Build.0 = Release|Win32 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.ActiveCfg = Debug|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.Build.0 = Debug|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.ActiveCfg = Debug|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.Build.0 = Debug|Win32 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.ActiveCfg = Release|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.Build.0 = Release|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.ActiveCfg = Release|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.Build.0 = Release|Win32 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.ActiveCfg = Debug|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.Build.0 = Debug|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.ActiveCfg = Debug|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.Build.0 = Debug|Win32 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.ActiveCfg = Release|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.Build.0 = Release|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.ActiveCfg = Release|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.Build.0 = Release|Win32 {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|x64.ActiveCfg = Debug-Lib|x64 {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|x64.Build.0 = Debug-Lib|x64 + {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|x86.ActiveCfg = Debug-Dll|Win32 + {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|x86.Build.0 = Debug-Dll|Win32 {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|x64.ActiveCfg = Release-Lib|x64 {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|x64.Build.0 = Release-Lib|x64 + {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|x86.ActiveCfg = Release-Dll|Win32 + {D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|x86.Build.0 = Release-Dll|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -65,6 +91,7 @@ Global {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71} = {C74AC87C-FD77-4C5E-BAB9-4B6713418B58} {7EAD1358-3E72-4FB6-A212-25D462B5C1E9} = {C74AC87C-FD77-4C5E-BAB9-4B6713418B58} {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D} = {C74AC87C-FD77-4C5E-BAB9-4B6713418B58} + {D1C528B6-AA02-4D29-9D61-DC08E317A70D} = {C74AC87C-FD77-4C5E-BAB9-4B6713418B58} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {10A8C694-9C19-4823-8500-325C3B6AEF44} diff --git a/GW2Radial/GW2Radial.vcxproj b/GW2Radial/GW2Radial.vcxproj index ee6d6d2..07fa603 100644 --- a/GW2Radial/GW2Radial.vcxproj +++ b/GW2Radial/GW2Radial.vcxproj @@ -64,9 +64,9 @@ Level3 Disabled - D3D_DEBUG_INFO;_DEBUG;GW2Radial_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SHADERS_DIR=LR"sd($(ProjectDir)shaders\)sd";$(GitHubDefs);%(PreprocessorDefinitions) + D3D_DEBUG_INFO;_DEBUG;GW2Radial_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SHADERS_DIR=LR"sd($(ProjectDir)shaders\)sd";_WIN32_WINNT=0x0600;$(GitHubDefs);%(PreprocessorDefinitions) true - MultiThreadedDebugDLL + MultiThreadedDebug stdcpplatest true @@ -106,9 +106,9 @@ git describe --always --dirty --match "NOT A TAG" >> "$(ProjectDir)include MaxSpeed true true - NDEBUG;GW2Radial_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SHADERS_DIR=LR"sd($(ProjectDir)shaders\)sd";$(GitHubDefs);%(PreprocessorDefinitions) + NDEBUG;GW2Radial_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SHADERS_DIR=LR"sd($(ProjectDir)shaders\)sd";_WIN32_WINNT=0x0600;$(GitHubDefs);%(PreprocessorDefinitions) true - MultiThreadedDLL + MultiThreaded stdcpplatest true diff --git a/GW2Radial/d3d9_wrapper b/GW2Radial/d3d9_wrapper index b5d33b1..b69b163 160000 --- a/GW2Radial/d3d9_wrapper +++ b/GW2Radial/d3d9_wrapper @@ -1 +1 @@ -Subproject commit b5d33b14a2ad4386ca3b881325f6eb7c31b2bf82 +Subproject commit b69b16375b62a9455d62a13f04a6ce3a6b2889e3 diff --git a/GW2Radial/include/Core.h b/GW2Radial/include/Core.h index 757d0b2..ad40a94 100644 --- a/GW2Radial/include/Core.h +++ b/GW2Radial/include/Core.h @@ -93,7 +93,7 @@ class Core : public Singleton ImGuiContext* imguiContext_ = nullptr; - using GetDpiForWindow_t = decltype(::GetDpiForWindow)*; + using GetDpiForWindow_t = UINT (WINAPI *)(HWND hwnd); HMODULE user32_ = 0; GetDpiForWindow_t getDpiForWindow_ = nullptr; diff --git a/GW2Radial/src/CustomWheel.cpp b/GW2Radial/src/CustomWheel.cpp index eb8c5e8..eea1e9f 100644 --- a/GW2Radial/src/CustomWheel.cpp +++ b/GW2Radial/src/CustomWheel.cpp @@ -288,9 +288,8 @@ std::unique_ptr CustomWheelsManager::BuildWheel(const std::filesystem::pa void CustomWheelsManager::Reload(ID3D11Device* dev) { { - APTTYPE a; - APTTYPEQUALIFIER b; - if(CoGetApartmentType(&a, &b) == CO_E_NOTINITIALIZED) { + ULONG_PTR contextToken; + if(CoGetContextToken(&contextToken) == CO_E_NOTINITIALIZED) { HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); if (hr != S_FALSE && hr != RPC_E_CHANGED_MODE && FAILED(hr)) CriticalMessageBox(L"Could not initialize COM library: error code 0x%X.", hr); diff --git a/GW2Radial/src/Main.cpp b/GW2Radial/src/Main.cpp index b1ce157..739b8d4 100644 --- a/GW2Radial/src/Main.cpp +++ b/GW2Radial/src/Main.cpp @@ -14,8 +14,8 @@ gw2al_addon_dsc gAddonDsc = { L"gw2radial", L"Radial menu overlay to select mount, novelty and more on fly", 2, - 1, - 1, + 2, + 0, gAddonDeps }; diff --git a/GW2Radial/src/Utility.cpp b/GW2Radial/src/Utility.cpp index 2fe8edc..5c0f1b7 100644 --- a/GW2Radial/src/Utility.cpp +++ b/GW2Radial/src/Utility.cpp @@ -111,6 +111,10 @@ std::filesystem::path GetGameFolder() std::wstring exeFolder; SplitFilename(exeFullPath, &exeFolder, nullptr); +#if _DEBUG + Log::i().Print(Severity::Debug, L"Game folder path: {}", exeFolder.c_str()); +#endif + return exeFolder; } @@ -123,9 +127,18 @@ std::optional GetDocumentsFolder() std::filesystem::path documentsGW2 = myDocuments; documentsGW2 /= L"GUILD WARS 2"; +#if _DEBUG + Log::i().Print(Severity::Debug, L"Documents folder path: {}", documentsGW2.c_str()); +#endif + if (std::filesystem::is_directory(documentsGW2)) return documentsGW2; + if (SUCCEEDED(SHCreateDirectoryExW(nullptr, documentsGW2.c_str(), nullptr))) + return documentsGW2; + + Log::i().Print(Severity::Warn, L"Could not open or create documents folder '{}'.", documentsGW2.wstring()); + return std::nullopt; } @@ -133,6 +146,10 @@ std::optional GetAddonFolder() { auto folder = (GetGameFolder() / "addons/gw2radial").make_preferred(); +#if _DEBUG + Log::i().Print(Severity::Debug, L"Addons folder path: {}", folder.c_str()); +#endif + if (std::filesystem::is_directory(folder)) return folder; diff --git a/GW2Radial/tinyxml2 b/GW2Radial/tinyxml2 index ff8ce53..9e3fdac 160000 --- a/GW2Radial/tinyxml2 +++ b/GW2Radial/tinyxml2 @@ -1 +1 @@ -Subproject commit ff8ce53c6dd787503b46e16966a8f7402ef5b771 +Subproject commit 9e3fdacfdbd2cf011d78aeb85f96b3d65c99b0fc diff --git a/GW2Radial/ziplib b/GW2Radial/ziplib index a7ba79a..54fc073 160000 --- a/GW2Radial/ziplib +++ b/GW2Radial/ziplib @@ -1 +1 @@ -Subproject commit a7ba79adbe9b12a5175f49da6e0a64863d610b5e +Subproject commit 54fc073443bf1e6a8491e33b93fa446fccae5b50 diff --git a/readme.md b/readme.md index 7333d52..73ec3c2 100644 --- a/readme.md +++ b/readme.md @@ -27,8 +27,9 @@ An [*ArenaNET-approvedTM*](https://www.reddit.com/r/Guildwars2/commen - Run the game! ### Manual Installation +- Install the [addon loader](https://github.com/gw2-addon-loader/loader-core) and [d3d wrapper](https://github.com/gw2-addon-loader/d3d9_wrapper). - Download and extract the archive ``gw2radial.zip`` found in the [latest release](https://github.com/Friendly0Fire/GW2Radial/releases/latest). -- Rename ``gw2addon_gw2radial.dll`` to ``d3d9.dll`` and place it in your bin64 directory (default path: ``C:\Program Files\Guild Wars 2\bin64``). +- Place ``gw2addon_gw2radial.dll`` in your addons folder inside a new folder named `gw2radial` (with the default game install path, this would be ``C:\Program Files\Guild Wars 2\addons\gw2radial``). - Run the game! If everything was setup properly, you should be greeted by a prompt on your first launch. ## Usage @@ -53,38 +54,19 @@ Please refer to the readme in the `custom_examples` folder for more information ### Q: I want to thank you in some way, how do I do that? -A: I do this for fun/because I wanted this to exist, but if you really want to, feel free to send me mail in game to my account ``FriendlyFire.6275`` and toss a few gold my way or just say hi! +A: I do this for fun/because I wanted this to exist, but if you really want to, feel free to send me mail in game to my account ``FriendlyFire.6275`` and toss a few gold or mats my way or just say hi! -### Q: I'm having a crash on launch (maybe mentioning "Coherent DLL"), what do? +### Q: The addon won't load or crashes. -A: There seems to be a lot of potential reasons for this particular crash. [BGDM's website](https://web.archive.org/web/20200409062402/http://gw2bgdm.blogspot.com/p/faq.html#2.5) lists quite a few. I'd especially recommend making sure you have the very latest [VC++ Redist](https://go.microsoft.com/fwlink/?LinkId=746572). Please also ensure that your graphics card drivers are up-to-date. +A: There can be a lot of reasons for this. Try the following debugging steps: -The crash may also be related to the Windows 10 Ransomware Protection system; you can add `Gw2-64.exe` and `CoherentUI_Host.exe` to the exception list following [these instructions](https://www.windowscentral.com/how-allow-blocked-apps-ransomware-protection-windows-10-october-2018-update) (thanks @Myster-Marz for the tip). +1. Look in your Guild Wars 2 installation folder for a file named ``gw2radial.log``. +2. If it exists, look inside the log file for details on what might be going wrong. If you cannot find anything, also look if there are files of the format ``gw2radial_*.dmp``. If those exist, the addon is loading but crashing at some point. Zip up the files and provide upload them somewhere safe, then open an issue. +3. If it does not exist, look for a file named ``gw2al_log.txt``. +4. If it does not exist, your addon loader is not installed correctly. Head over to the [addon loader](https://github.com/gw2-addon-loader/loader-core) project for support. +5. Inside the log file, look for the line "Loaded gw2radial". If it is not present, the addon loader cannot load the addon correctly. Make sure you have installed the [d3d wrapper](https://github.com/gw2-addon-loader/d3d9_wrapper) addon and look at the other log messages for information on what might be going wrong. -### Q: The addon doesn't seem to be loading at all, what's wrong? - -A: There can be a few reasons for this, but the most common one is that you're using a special shortcut which skips the login prompt and boots the game directly. In this specific circumstance, you must put the addon's ``d3d9.dll`` directly next to the game's ``Gw2-64.exe`` (default path: ``C:\Program Files\Guild Wars 2``). - -### Q: The game crashes with an error message mentioning "RivaTuner Statistics Server/RTSS", what's that? - -A: RivaTuner Statistics Server is a component of some GPU management software such as MSI Afterburner which displays some information overlaid on top of games, such as FPS, temperatures, clocks, etc. Unfortunately, RTSS works in such a way that it breaks this addon, and as a result you must disable RTSS before launching the game. Fortunately, you do not have to uninstall RTSS or MSI Afterburner, simply shutting down the server (which can be done from the notification area located on the right side of the taskbar) before launching the game is sufficient. ![Shutting down RTSS](https://i.imgur.com/O9t9qZq.png) - -### Q: I want to load up ArcDPS/GW2Hook/something else which also needs to be called ``d3d9.dll``, how do I load both? - -A: You have three options: the first option is to use the GW2 Addon Loader through the [GW2 Addon Manager](https://github.com/gw2-addon-loader/GW2-Addon-Manager), **which is the recommended approach**. - -Otherwise, either the other thing you want to run supports *chainloading* this, in which case you should look up the documentation for that plugin (e.g. ArcDPS supports chainloading by renaming this plugin to ``d3d9_chainload.dll``), or you can make this plugin chainload something else by renaming that other plugin to ``d3d9_mchain.dll``. - -The most common use case would be combining ArcDPS, GW2Hook and this. For this instance, I heavily recommend setting things up as follows: -- ArcDPS is named ``d3d9.dll``. -- GW2Radial is named ``d3d9_chainload.dll``. -- GW2Hook is named ``ReShade64.dll``. - -*N.B. If your Windows options hide file extensions (which is the default, you can confirm by looking at whether the game's file name is "Gw2-64.exe" or just "Gw2-64") leave out the ".dll" part of the file names (i.e. use "d3d9", "d3d9_chainload" and "ReShade64" respectively). - -This should allow all addons to load properly. Note that there is special code present within GW2Radial to load GW2Hook properly, but this could break unexpectedly if GW2Hook/Reshade changes. - -Finally, note that combining addons is largely unsupported. I will attempt to keep ArcDPS and d912pxy compatible with this, but that is the most I am able to do in a reasonable amount of time. +If all else fails, please open an issue. ### Q: What is the "show in center" keybind used for? @@ -94,7 +76,7 @@ Unfortunately, I can't make this automatic (i.e. switching to that mode when Act ### Q: Can you make it so selecting a mount while already mounted will directly swap to the new mount? -No. I talked with GW2 staff about this and they've decided that the can of worms it could potentially open is not worth it. Unfortunately, you'll need to select the new mount you want to use twice, once to unmount and then again to remount. This will not change unless ArenaNet's policy on addons changes. +No. I talked with ArenaNet devs about this and they've decided that the can of worms it could potentially open is not worth it. Unfortunately, you'll need to separately unmount then select the new mount you want to use. This will not change unless ArenaNet's policy on addons changes. ### Q: Can I use this code for my project?