From f360ece932f2f273db7fafb1778ff431b6488804 Mon Sep 17 00:00:00 2001 From: Jamiras <32680403+Jamiras@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:26:01 -0700 Subject: [PATCH] start moving non-UI code into helper library (#1261) --- .github/workflows/c-cpp.yml | 12 +- RA_Integration.sln | 138 ++++----- src/Exports.cpp | 2 +- src/RA_Core.cpp | 2 +- src/RA_Defs.cpp | 3 +- src/RA_Defs.h | 14 +- src/RA_Integration.vcxproj | 280 +++-------------- src/RA_Integration.vcxproj.filters | 32 +- src/api/ApiCall.cpp | 2 - src/api/UploadBadge.hh | 2 - src/api/impl/ConnectedServer.cpp | 3 +- src/api/impl/ServerBase.hh | 4 +- src/base.props | 135 +++++--- src/data/AsyncObject.hh | 2 +- src/data/DataModelBase.hh | 2 +- src/data/ModelCollectionBase.hh | 2 +- src/data/ModelPropertyContainer.hh | 6 +- src/data/NotifyTargetSet.hh | 4 +- src/data/context/ConsoleContext.cpp | 4 +- src/data/context/ConsoleContext.hh | 2 +- src/data/context/EmulatorContext.cpp | 4 +- src/data/context/EmulatorContext.hh | 1 - src/data/context/GameAssets.cpp | 2 +- src/data/context/GameContext.cpp | 4 +- src/data/context/SessionTracker.cpp | 4 +- src/data/context/UserContext.cpp | 2 +- src/data/models/AchievementModel.cpp | 2 +- src/data/models/AssetModelBase.hh | 3 +- src/data/models/CodeNoteModel.cpp | 3 +- src/data/models/TriggerValidation.cpp | 2 +- src/data/search/MemBlock.cpp | 2 +- src/devkit/RADevKit.vcxproj | 67 ++++ src/devkit/RADevKit.vcxproj.filters | 61 ++++ src/{ => devkit}/data/ModelProperty.cpp | 52 ++-- src/{ => devkit}/data/ModelProperty.hh | 17 +- src/{ => devkit}/services/ILogger.hh | 0 src/devkit/services/IMessageDispatcher.hh | 36 +++ src/{ => devkit}/services/ServiceLocator.hh | 2 +- src/devkit/util/Compat.hh | 31 ++ src/{ra_utility.h => devkit/util/EnumOps.hh} | 80 +---- src/devkit/util/GSL.cpp | 68 +++++ src/devkit/util/GSL.hh | 43 +++ src/{RA_Log.h => devkit/util/Log.hh} | 9 +- .../util/Strings.cpp} | 9 +- .../util/Strings.hh} | 36 ++- src/devkit/util/TypeCasts.hh | 80 +++++ .../util/TypeTraits.hh} | 20 +- src/pch.h | 33 +- src/ra_fwd.h | 118 ------- src/ra_math.h | 61 ---- src/rcheevos.vcxproj | 131 +------- src/rcheevos.vcxproj.filters | 3 + src/services/AchievementLogicSerializer.cpp | 2 +- src/services/AchievementLogicSerializer.hh | 2 - src/services/AchievementRuntime.cpp | 6 +- src/services/AchievementRuntime.hh | 10 +- src/services/AchievementRuntimeExports.cpp | 2 +- src/services/FrameEventQueue.cpp | 2 +- src/services/FrameEventQueue.hh | 4 +- src/services/GameIdentifier.cpp | 4 +- src/services/Initialization.cpp | 4 + src/services/PerformanceCounter.cpp | 2 +- src/services/Search/SearchImpl.cpp | 2 +- src/services/Search/SearchImpl_asciitext.hh | 2 +- src/services/Search/SearchImpl_bitcount.hh | 2 +- src/services/SearchResults.cpp | 2 +- src/services/impl/FileLocalStorage.cpp | 5 +- src/services/impl/FileTextReader.hh | 2 +- src/services/impl/FileTextWriter.hh | 3 +- src/services/impl/JsonFileConfiguration.cpp | 5 +- src/services/impl/MessageDispatcher.hh | 38 +++ src/services/impl/StringTextReader.hh | 2 +- src/services/impl/StringTextWriter.hh | 2 +- src/services/impl/ThreadPool.cpp | 2 +- src/services/impl/ThreadPool.hh | 4 +- src/services/impl/WindowsFileSystem.cpp | 4 +- src/services/impl/WindowsFileSystem.hh | 2 +- src/services/impl/WindowsHttpRequester.cpp | 4 +- src/services/impl/WindowsHttpRequester.hh | 2 +- src/ui/EditorTheme.hh | 4 +- src/ui/ImageReference.hh | 2 - src/ui/OverlayTheme.hh | 4 +- src/ui/Theme.cpp | 2 +- src/ui/ViewModelBase.hh | 4 +- src/ui/WindowViewModelBase.hh | 3 +- src/ui/drawing/gdi/ImageRepository.cpp | 1 + src/ui/drawing/gdi/ResourceRepository.hh | 2 +- src/ui/viewmodels/AssetEditorViewModel.cpp | 2 + src/ui/viewmodels/AssetListViewModel.cpp | 2 +- src/ui/viewmodels/AssetUploadViewModel.cpp | 2 +- .../BrokenAchievementsViewModel.cpp | 2 +- .../ChallengeIndicatorViewModel.cpp | 2 +- src/ui/viewmodels/CodeNotesViewModel.cpp | 2 +- src/ui/viewmodels/GameChecksumViewModel.cpp | 2 +- .../viewmodels/IntegrationMenuViewModel.cpp | 2 +- src/ui/viewmodels/LoginViewModel.cpp | 4 +- .../viewmodels/MemoryBookmarksViewModel.cpp | 2 +- src/ui/viewmodels/MemoryRegionsViewModel.cpp | 2 +- .../viewmodels/MemoryWatchListViewModel.cpp | 2 +- src/ui/viewmodels/MemoryWatchViewModel.cpp | 2 +- src/ui/viewmodels/NewAssetViewModel.cpp | 2 +- .../OverlayAchievementsPageViewModel.cpp | 2 +- .../OverlayFriendsPageViewModel.cpp | 2 +- .../OverlayLeaderboardsPageViewModel.cpp | 2 +- .../viewmodels/OverlayListPageViewModel.cpp | 4 +- src/ui/viewmodels/OverlayManager.cpp | 2 +- src/ui/viewmodels/OverlayManager.hh | 2 +- .../OverlayRecentGamesPageViewModel.cpp | 2 +- src/ui/viewmodels/OverlayViewModel.cpp | 3 +- src/ui/viewmodels/OverlayViewModel.hh | 2 +- src/ui/viewmodels/PointerFinderViewModel.cpp | 2 +- src/ui/viewmodels/PopupViewModelBase.cpp | 2 +- .../viewmodels/ProgressTrackerViewModel.cpp | 2 - .../RichPresenceMonitorViewModel.cpp | 2 +- src/ui/viewmodels/ScoreTrackerViewModel.cpp | 2 - src/ui/viewmodels/ScoreboardViewModel.cpp | 2 +- .../viewmodels/TriggerConditionViewModel.cpp | 2 +- .../viewmodels/TriggerConditionViewModel.hh | 8 +- src/ui/viewmodels/TriggerViewModel.cpp | 2 +- src/ui/viewmodels/UnknownGameViewModel.cpp | 2 +- src/ui/win32/AssetEditorDialog.cpp | 3 + src/ui/win32/AssetListDialog.cpp | 3 + src/ui/win32/BrokenAchievementsDialog.cpp | 2 + src/ui/win32/CodeNotesDialog.cpp | 4 +- src/ui/win32/Desktop.cpp | 2 +- src/ui/win32/DialogBase.cpp | 12 +- src/ui/win32/DialogBase.hh | 8 +- src/ui/win32/FileDialog.cpp | 2 +- src/ui/win32/MemoryBookmarksDialog.cpp | 3 + src/ui/win32/MemoryInspectorDialog.cpp | 3 + src/ui/win32/MemoryRegionsDialog.cpp | 4 +- src/ui/win32/MessageBoxDialog.cpp | 2 +- src/ui/win32/PointerFinderDialog.cpp | 4 +- src/ui/win32/PointerInspectorDialog.cpp | 4 +- src/ui/win32/ProgressDialog.cpp | 2 +- src/ui/win32/RichPresenceDialog.cpp | 4 +- src/ui/win32/bindings/ComboBoxBinding.hh | 2 +- .../bindings/GridAddressColumnBinding.cpp | 3 +- src/ui/win32/bindings/GridBinding.cpp | 2 +- src/ui/win32/bindings/GridBinding.hh | 4 +- .../bindings/GridLookupColumnBinding.cpp | 4 +- .../bindings/GridNumberColumnBinding.cpp | 3 +- .../win32/bindings/GridTextColumnBinding.cpp | 3 +- .../bindings/MemoryViewerControlBinding.cpp | 3 - .../win32/bindings/MultiLineGridBinding.cpp | 2 +- .../win32/bindings/NumericTextBoxBinding.hh | 2 +- src/ui/win32/bindings/WindowBinding.cpp | 2 +- tests/Exports_Tests.cpp | 2 +- tests/RA_Integration.Tests.vcxproj | 288 +++--------------- tests/RA_Integration.Tests.vcxproj.filters | 14 +- tests/RA_Interface.Tests.vcxproj | 271 ++-------------- tests/RA_Interface.Tests.vcxproj.filters | 3 + tests/RA_Interface_Tests.cpp | 4 +- tests/RA_UnitTestHelpers.h | 4 +- tests/base.props | 82 ----- tests/data/DataModelBase_Tests.cpp | 2 - tests/data/ModelPropertyContainer_Tests.cpp | 2 - tests/data/NotifyTargetSet_Tests.cpp | 2 - tests/data/context/GameAssets_Tests.cpp | 2 +- tests/data/models/AchievementModel_Tests.cpp | 4 +- tests/data/models/CodeNoteModel_Tests.cpp | 16 +- tests/data/models/RichPresenceModel_Tests.cpp | 4 +- tests/devkit/RADevKit.Tests.vcxproj.vcxproj | 66 ++++ .../RADevKit.Tests.vcxproj.vcxproj.filters | 30 ++ .../{ => devkit}/data/ModelProperty_Tests.cpp | 2 +- tests/devkit/testutil/CppUnitTest.hh | 18 ++ .../util/Strings_Tests.cpp} | 6 +- tests/mocks/MockAchievementRuntime.cpp | 30 +- tests/mocks/MockAchievementRuntime.hh | 8 +- tests/mocks/MockClock.hh | 4 +- tests/mocks/MockDesktop.hh | 2 +- tests/mocks/MockEmulatorContext.hh | 6 +- tests/mocks/MockGameContext.hh | 4 +- tests/mocks/MockImageRepository.hh | 2 +- tests/mocks/MockServer.hh | 6 +- tests/mocks/MockSurface.hh | 2 - .../AchievementRuntimeExports_Tests.cpp | 28 +- tests/services/AchievementRuntime_Tests.cpp | 73 ++--- tests/services/ServicesAsserts.hh | 2 +- tests/ui/ViewModelBase_Tests.cpp | 2 - tests/ui/ViewModelCollection_Tests.cpp | 2 - .../viewmodels/AssetEditorViewModel_Tests.cpp | 2 +- .../viewmodels/AssetListViewModel_Tests.cpp | 18 +- .../viewmodels/AssetUploadViewModel_Tests.cpp | 4 +- .../BrokenAchievementsViewModel_Tests.cpp | 2 +- .../IntegrationMenuViewModel_Tests.cpp | 4 +- .../MemoryBookmarksViewModel_Tests.cpp | 8 +- ...OverlayAchievementsPageViewModel_Tests.cpp | 2 +- ...OverlayLeaderboardsPageViewModel_Tests.cpp | 4 +- .../OverlayRecentGamesPageViewModel_Tests.cpp | 2 +- .../PointerInspectorViewModel_Tests.cpp | 1 + .../RichPresenceMonitorViewModel_Tests.cpp | 2 +- .../TriggerConditionViewModel_Tests.cpp | 8 +- .../ui/viewmodels/TriggerViewModel_Tests.cpp | 7 +- .../viewmodels/UnknownGameViewModel_Tests.cpp | 4 +- 195 files changed, 1250 insertions(+), 1760 deletions(-) create mode 100644 src/devkit/RADevKit.vcxproj create mode 100644 src/devkit/RADevKit.vcxproj.filters rename src/{ => devkit}/data/ModelProperty.cpp (56%) rename src/{ => devkit}/data/ModelProperty.hh (94%) rename src/{ => devkit}/services/ILogger.hh (100%) create mode 100644 src/devkit/services/IMessageDispatcher.hh rename src/{ => devkit}/services/ServiceLocator.hh (99%) create mode 100644 src/devkit/util/Compat.hh rename src/{ra_utility.h => devkit/util/EnumOps.hh} (58%) create mode 100644 src/devkit/util/GSL.cpp create mode 100644 src/devkit/util/GSL.hh rename src/{RA_Log.h => devkit/util/Log.hh} (88%) rename src/{RA_StringUtils.cpp => devkit/util/Strings.cpp} (98%) rename src/{RA_StringUtils.h => devkit/util/Strings.hh} (97%) create mode 100644 src/devkit/util/TypeCasts.hh rename src/{ra_type_traits.h => devkit/util/TypeTraits.hh} (92%) delete mode 100644 src/ra_fwd.h delete mode 100644 src/ra_math.h create mode 100644 src/services/impl/MessageDispatcher.hh delete mode 100644 tests/base.props create mode 100644 tests/devkit/RADevKit.Tests.vcxproj.vcxproj create mode 100644 tests/devkit/RADevKit.Tests.vcxproj.vcxproj.filters rename tests/{ => devkit}/data/ModelProperty_Tests.cpp (97%) create mode 100644 tests/devkit/testutil/CppUnitTest.hh rename tests/{RA_StringUtils_Tests.cpp => devkit/util/Strings_Tests.cpp} (99%) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 55a4587a..9dadbb6a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -44,11 +44,13 @@ jobs: uses: Malcolmnixon/Setup-VSTest@v4 - name: Build run: msbuild.exe -m RA_Integration.sln -p:Configuration=Release -p:Platform=Win32 + - name: Run lib Tests + run: vstest.console bin\Win32\Release\RADevKit.Tests.dll - name: Run DLL Tests - run: vstest.console bin\Win32\Release\tests\RA_Integration\RA_Integration.Tests.dll + run: vstest.console bin\Win32\Release\RA_Integration.Tests.dll - name: Run Interface Tests # requires the DLL to have been built - run: vstest.console bin\Win32\Release\tests\RA_Interface\RA_Interface.Tests.dll + run: vstest.console bin\Win32\Release\RA_Interface.Tests.dll Win64-Tests: runs-on: windows-latest @@ -63,10 +65,12 @@ jobs: uses: Malcolmnixon/Setup-VSTest@v4 - name: Build run: msbuild.exe -m RA_Integration.sln -p:Configuration=Release -p:Platform=x64 + - name: Run lib Tests + run: vstest.console bin\x64\Release\RADevKit.Tests.dll - name: Run DLL Tests - run: vstest.console bin\x64\Release\tests\RA_Integration\RA_Integration.Tests.dll + run: vstest.console bin\x64\Release\RA_Integration.Tests.dll - name: Run Interface Tests - run: vstest.console bin\x64\Release\tests\RA_Interface\RA_Interface.Tests.dll + run: vstest.console bin\x64\Release\RA_Interface.Tests.dll Win32-Analysis: runs-on: windows-latest diff --git a/RA_Integration.sln b/RA_Integration.sln index 5581c33e..ea493bbc 100644 --- a/RA_Integration.sln +++ b/RA_Integration.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RA_Integration", "src\RA_Integration.vcxproj", "{825CB292-F069-4B27-82CF-3417746ACDF3}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{264665A7-BA65-4F48-B565-6D97245E2B88}" ProjectSection(SolutionItems) = preProject .clang-format = .clang-format @@ -12,10 +10,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution src\ra_rules.ruleset = src\ra_rules.ruleset EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RA_Integration.Tests", "tests\RA_Integration.Tests.vcxproj", "{876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcheevos", "src\rcheevos.vcxproj", "{9D55EBE7-1392-4FA1-A9B9-F022F764CE35}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RADevKit", "src\devkit\RADevKit.vcxproj", "{8AE21D54-F905-44E1-90E5-D22E346BFF39}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RADevKit.Tests", "tests\devkit\RADevKit.Tests.vcxproj.vcxproj", "{6131C3D1-165E-4F39-A44C-94F01EAA03C5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RA_Integration", "src\RA_Integration.vcxproj", "{825CB292-F069-4B27-82CF-3417746ACDF3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RA_Integration.Tests", "tests\RA_Integration.Tests.vcxproj", "{876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RA_Interface.Tests", "tests\RA_Interface.Tests.vcxproj", "{F78C2C8B-55DD-4252-A38F-F4D252D14DF8}" EndProject Global @@ -26,62 +30,8 @@ Global Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 - Release-vista|Win32 = Release-vista|Win32 - Release-vista|x64 = Release-vista|x64 - ReleaseWithDebug|Win32 = ReleaseWithDebug|Win32 - ReleaseWithDebug|x64 = ReleaseWithDebug|x64 - Release-xp|Win32 = Release-xp|Win32 - Release-xp|x64 = Release-xp|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|Win32.ActiveCfg = Analysis|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|Win32.Build.0 = Analysis|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|x64.ActiveCfg = Analysis|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|x64.Build.0 = Analysis|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|Win32.ActiveCfg = Debug|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|Win32.Build.0 = Debug|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|x64.ActiveCfg = Debug|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|x64.Build.0 = Debug|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|Win32.ActiveCfg = Release|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|Win32.Build.0 = Release|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|x64.ActiveCfg = Release|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|x64.Build.0 = Release|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-vista|Win32.ActiveCfg = Release-vista|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-vista|Win32.Build.0 = Release-vista|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-vista|x64.ActiveCfg = Release-vista|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-vista|x64.Build.0 = Release-vista|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.ReleaseWithDebug|Win32.ActiveCfg = ReleaseWithDebug|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.ReleaseWithDebug|Win32.Build.0 = ReleaseWithDebug|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.ReleaseWithDebug|x64.ActiveCfg = ReleaseWithDebug|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.ReleaseWithDebug|x64.Build.0 = ReleaseWithDebug|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-xp|Win32.ActiveCfg = Release-xp|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-xp|Win32.Build.0 = Release-xp|Win32 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-xp|x64.ActiveCfg = Release-xp|x64 - {825CB292-F069-4B27-82CF-3417746ACDF3}.Release-xp|x64.Build.0 = Release-xp|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|Win32.ActiveCfg = Analysis|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|Win32.Build.0 = Analysis|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|x64.ActiveCfg = Analysis|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|x64.Build.0 = Analysis|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|Win32.ActiveCfg = Debug|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|Win32.Build.0 = Debug|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|x64.ActiveCfg = Debug|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|x64.Build.0 = Debug|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|Win32.ActiveCfg = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|Win32.Build.0 = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|x64.ActiveCfg = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|x64.Build.0 = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-vista|Win32.ActiveCfg = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-vista|Win32.Build.0 = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-vista|x64.ActiveCfg = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-vista|x64.Build.0 = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.ReleaseWithDebug|Win32.ActiveCfg = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.ReleaseWithDebug|Win32.Build.0 = Release|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.ReleaseWithDebug|x64.ActiveCfg = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.ReleaseWithDebug|x64.Build.0 = Release|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-xp|Win32.ActiveCfg = Release-xp|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-xp|Win32.Build.0 = Release-xp|Win32 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-xp|x64.ActiveCfg = Release-xp|x64 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release-xp|x64.Build.0 = Release-xp|x64 {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Analysis|Win32.ActiveCfg = Release|Win32 {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Analysis|Win32.Build.0 = Release|Win32 {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Analysis|x64.ActiveCfg = Release|x64 @@ -94,18 +44,54 @@ Global {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release|Win32.Build.0 = Release|Win32 {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release|x64.ActiveCfg = Release|x64 {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release|x64.Build.0 = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-vista|Win32.ActiveCfg = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-vista|Win32.Build.0 = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-vista|x64.ActiveCfg = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-vista|x64.Build.0 = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.ReleaseWithDebug|Win32.ActiveCfg = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.ReleaseWithDebug|Win32.Build.0 = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.ReleaseWithDebug|x64.ActiveCfg = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.ReleaseWithDebug|x64.Build.0 = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-xp|Win32.ActiveCfg = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-xp|Win32.Build.0 = Release|Win32 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-xp|x64.ActiveCfg = Release|x64 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35}.Release-xp|x64.Build.0 = Release|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Analysis|Win32.ActiveCfg = Analysis|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Analysis|Win32.Build.0 = Analysis|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Analysis|x64.ActiveCfg = Analysis|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Analysis|x64.Build.0 = Analysis|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Debug|Win32.ActiveCfg = Debug|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Debug|Win32.Build.0 = Debug|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Debug|x64.ActiveCfg = Debug|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Debug|x64.Build.0 = Debug|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Release|Win32.ActiveCfg = Release|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Release|Win32.Build.0 = Release|Win32 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Release|x64.ActiveCfg = Release|x64 + {8AE21D54-F905-44E1-90E5-D22E346BFF39}.Release|x64.Build.0 = Release|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Analysis|Win32.ActiveCfg = Analysis|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Analysis|Win32.Build.0 = Analysis|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Analysis|x64.ActiveCfg = Analysis|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Analysis|x64.Build.0 = Analysis|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Debug|Win32.ActiveCfg = Debug|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Debug|Win32.Build.0 = Debug|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Debug|x64.ActiveCfg = Debug|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Debug|x64.Build.0 = Debug|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Release|Win32.ActiveCfg = Release|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Release|Win32.Build.0 = Release|Win32 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Release|x64.ActiveCfg = Release|x64 + {6131C3D1-165E-4F39-A44C-94F01EAA03C5}.Release|x64.Build.0 = Release|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|Win32.ActiveCfg = Analysis|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|Win32.Build.0 = Analysis|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|x64.ActiveCfg = Analysis|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Analysis|x64.Build.0 = Analysis|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|Win32.ActiveCfg = Debug|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|Win32.Build.0 = Debug|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|x64.ActiveCfg = Debug|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Debug|x64.Build.0 = Debug|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|Win32.ActiveCfg = Release|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|Win32.Build.0 = Release|Win32 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|x64.ActiveCfg = Release|x64 + {825CB292-F069-4B27-82CF-3417746ACDF3}.Release|x64.Build.0 = Release|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|Win32.ActiveCfg = Analysis|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|Win32.Build.0 = Analysis|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|x64.ActiveCfg = Analysis|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Analysis|x64.Build.0 = Analysis|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|Win32.ActiveCfg = Debug|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|Win32.Build.0 = Debug|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|x64.ActiveCfg = Debug|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Debug|x64.Build.0 = Debug|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|Win32.ActiveCfg = Release|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|Win32.Build.0 = Release|Win32 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|x64.ActiveCfg = Release|x64 + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7}.Release|x64.Build.0 = Release|x64 {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Analysis|Win32.ActiveCfg = Release|Win32 {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Analysis|x64.ActiveCfg = Release|x64 {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Analysis|x64.Build.0 = Release|x64 @@ -117,18 +103,6 @@ Global {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release|Win32.Build.0 = Release|Win32 {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release|x64.ActiveCfg = Release|x64 {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release|x64.Build.0 = Release|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-vista|Win32.ActiveCfg = Release|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-vista|Win32.Build.0 = Release|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-vista|x64.ActiveCfg = Release|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-vista|x64.Build.0 = Release|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.ReleaseWithDebug|Win32.ActiveCfg = Release|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.ReleaseWithDebug|Win32.Build.0 = Release|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.ReleaseWithDebug|x64.ActiveCfg = Release|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.ReleaseWithDebug|x64.Build.0 = Release|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-xp|Win32.ActiveCfg = Release-xp|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-xp|Win32.Build.0 = Release-xp|Win32 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-xp|x64.ActiveCfg = Release-xp|x64 - {F78C2C8B-55DD-4252-A38F-F4D252D14DF8}.Release-xp|x64.Build.0 = Release-xp|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Exports.cpp b/src/Exports.cpp index 24f28a8e..6cac95c3 100644 --- a/src/Exports.cpp +++ b/src/Exports.cpp @@ -2,7 +2,7 @@ #include "RA_BuildVer.h" #include "RA_Defs.h" -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Resource.h" #include "api\IServer.hh" diff --git a/src/RA_Core.cpp b/src/RA_Core.cpp index 7482713c..5c7053f8 100644 --- a/src/RA_Core.cpp +++ b/src/RA_Core.cpp @@ -2,7 +2,7 @@ #include "Exports.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "data\context\SessionTracker.hh" diff --git a/src/RA_Defs.cpp b/src/RA_Defs.cpp index b94403ce..af4930f5 100644 --- a/src/RA_Defs.cpp +++ b/src/RA_Defs.cpp @@ -1,6 +1,7 @@ #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" +#include "services\ServiceLocator.hh" #include "data\context\EmulatorContext.hh" diff --git a/src/RA_Defs.h b/src/RA_Defs.h index fee7a4af..b4a4fd70 100644 --- a/src/RA_Defs.h +++ b/src/RA_Defs.h @@ -2,7 +2,7 @@ #define RA_DEFS_H #pragma once -#include "RA_StringUtils.h" +#include "util\Strings.hh" #if !(RA_EXPORTS || RA_UTEST) #include "windows_nodefines.h" @@ -26,7 +26,7 @@ // Version Information is integrated into tags #else -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Json.h" // RA-Only @@ -103,7 +103,7 @@ public: pLT ={ rect.left, rect.top }; pRB ={ rect.right, rect.bottom }; - HWND__* const restrict parentHwnd = ::GetParent(contentHwnd); + HWND__* const _RESTRICT parentHwnd = ::GetParent(contentHwnd); check = ::ScreenToClient(parentHwnd, &pLT); assert(check != 0); check = ::ScreenToClient(parentHwnd, &pRB); @@ -169,12 +169,4 @@ _NODISCARD std::string ByteAddressToString(_In_ ByteAddress nAddr); _NODISCARD ByteAddress ByteAddressFromString(_In_ const std::string& sByteAddress); } // namespace ra -#if _MBCS -_CONSTANT_VAR RA_MAX_PATH{ _MAX_PATH }; // multibyte max path -#elif _UNICODE -_CONSTANT_VAR RA_MAX_PATH{ 32767 }; // Unicode max path -#else -#error Unknown character set detected! -#endif /* _MBCS */ - #endif // !RA_DEFS_H diff --git a/src/RA_Integration.vcxproj b/src/RA_Integration.vcxproj index 4ba85862..d2742e22 100644 --- a/src/RA_Integration.vcxproj +++ b/src/RA_Integration.vcxproj @@ -17,30 +17,6 @@ Debug x64 - - Release-xp - Win32 - - - Release-xp - x64 - - - Release-vista - Win32 - - - Release-vista - x64 - - - ReleaseWithDebug - Win32 - - - ReleaseWithDebug - x64 - Release Win32 @@ -50,9 +26,54 @@ x64 + + + Designer + + + + RA_Integration + {825CB292-F069-4B27-82CF-3417746ACDF3} + RA_Integration + RA_Integration-x64 + ra + DynamicLibrary + 10.0 + v143 + Unicode + + + + + + + + + + RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions) + $(SolutionDir);$(RapidJSON_IncludeDir);%(AdditionalIncludeDirectories) + Use + pch.h + pch.h + + + "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION + + + + IF "$(LocalDebuggerWorkingDirectory)"=="" GOTO done + IF NOT EXIST $(LocalDebuggerWorkingDirectory) GOTO done + echo Copying $(Configuration) DLL to $(LocalDebuggerWorkingDirectory) + copy /y $(TargetPath) $(LocalDebuggerWorkingDirectory)\$(TargetFileName) + :done + + + + windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) + + - @@ -87,7 +108,6 @@ - @@ -216,7 +236,6 @@ - @@ -238,14 +257,11 @@ - - - @@ -413,213 +429,15 @@ _DEBUG;_WIN64;%(PreprocessorDefinitions) _WIN64;%(PreprocessorDefinitions) - _USING_V110_SDK71_;_WIN64;%(PreprocessorDefinitions) - _USING_V110_SDK71_;_WIN64;%(PreprocessorDefinitions) - - Designer - - - - - + + {8ae21d54-f905-44e1-90e5-d22e346bff39} + {9d55ebe7-1392-4fa1-a9b9-f022f764ce35} - - RA_Integration - {825CB292-F069-4B27-82CF-3417746ACDF3} - RA_Integration - RA_Integration-x64 - RA_Integration - DynamicLibrary - Unicode - - - - $(DefaultPlatformToolset) - - - true - - - v141_xp - true - - - v142 - true - - - true - - - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\ - - - NativeRecommendedRules.ruleset - false - - - ra_rules.ruleset - true - $(RapidJSON_IncludeDir);$(CAExcludePath) - - - false - - - false - - - false - - - false - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - true - EditAndContinue - false - false - true - false - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - true - false - Windows - - - _DEBUG;%(PreprocessorDefinitions) - - - - - Disabled - NDEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreaded - true - ProgramDatabase - false - false - true - true - true - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - false - false - Windows - - - NDEBUG;%(PreprocessorDefinitions) - - - - - - - - Full - true - true - NDEBUG;%(PreprocessorDefinitions) - MultiThreaded - true - ProgramDatabase - true - true - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - Windows - false - - - - - Full - true - true - NDEBUG;%(PreprocessorDefinitions) - MultiThreaded - true - ProgramDatabase - true - true - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - Windows - false - - - - - Full - true - true - NDEBUG;%(PreprocessorDefinitions) - MultiThreaded - true - ProgramDatabase - true - true - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - Windows - false - - - - - Full - true - true - ..\;%(AdditionalIncludeDirectories) - NDEBUG;%(PreprocessorDefinitions) - MultiThreaded - true - ProgramDatabase - true - true - UseFastLinkTimeCodeGeneration - - - windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - Windows - true - - - - \ No newline at end of file diff --git a/src/RA_Integration.vcxproj.filters b/src/RA_Integration.vcxproj.filters index ab33acb6..139d0c92 100644 --- a/src/RA_Integration.vcxproj.filters +++ b/src/RA_Integration.vcxproj.filters @@ -19,9 +19,6 @@ {3b94374b-a06e-4994-b6f8-3a2f5e215803} - - {cd433aa7-9c74-461e-ba0e-3ce327a59b7a} - {0badbd6c-a477-4f69-b999-f27b050c3a17} @@ -96,9 +93,6 @@ UI\Win32 - - Services - Services @@ -333,9 +327,6 @@ Data\Context - - Data - Data @@ -491,18 +482,12 @@ Services - - Helpers - Services Services\Impl - - Services - Services\Impl @@ -620,9 +605,6 @@ Interface - - Helpers - API @@ -926,9 +908,6 @@ Data - - Data - Data @@ -1124,6 +1103,9 @@ Data + + Services\Impl + @@ -1134,12 +1116,6 @@ - - Helpers - - - Helpers - - + \ No newline at end of file diff --git a/src/api/ApiCall.cpp b/src/api/ApiCall.cpp index 29db276c..f6e97f0a 100644 --- a/src/api/ApiCall.cpp +++ b/src/api/ApiCall.cpp @@ -1,7 +1,5 @@ #include "ApiCall.hh" -#include "ra_fwd.h" - #include "api\IServer.hh" #include "services\ServiceLocator.hh" diff --git a/src/api/UploadBadge.hh b/src/api/UploadBadge.hh index 081f6110..774b9fa8 100644 --- a/src/api/UploadBadge.hh +++ b/src/api/UploadBadge.hh @@ -4,8 +4,6 @@ #include "ApiCall.hh" -#include "ra_fwd.h" - namespace ra { namespace api { diff --git a/src/api/impl/ConnectedServer.cpp b/src/api/impl/ConnectedServer.cpp index 5a0c83f5..23e7426e 100644 --- a/src/api/impl/ConnectedServer.cpp +++ b/src/api/impl/ConnectedServer.cpp @@ -2,6 +2,7 @@ #include "DisconnectedServer.hh" #include "RA_Defs.h" +#include "util\Log.hh" #include "RA_md5factory.h" @@ -351,7 +352,7 @@ static bool ValidateResponse(int nResult, const rc_api_response_t& api_response, return true; } -static bool DoUpload(const std::string& sHost, const char* restrict sApiName, const char* restrict sRequestName, +static bool DoUpload(const std::string& sHost, const char* _RESTRICT sApiName, const char* _RESTRICT sRequestName, const std::wstring& sFilePath, ApiResponseBase& pResponse, rapidjson::Document& document) { const auto& pFileSystem = ra::services::ServiceLocator::Get(); diff --git a/src/api/impl/ServerBase.hh b/src/api/impl/ServerBase.hh index d3bc28e7..d8585cb8 100644 --- a/src/api/impl/ServerBase.hh +++ b/src/api/impl/ServerBase.hh @@ -4,7 +4,7 @@ #include "api/IServer.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include @@ -98,7 +98,7 @@ public: protected: template - inline typename TResponse UnsupportedApi(const char* const restrict apiName) const + inline typename TResponse UnsupportedApi(const char* const _RESTRICT apiName) const { static_assert(std::is_base_of::value, "TResponse must derive from ApiResponseBase"); diff --git a/src/base.props b/src/base.props index 61b5617b..e917c05f 100644 --- a/src/base.props +++ b/src/base.props @@ -1,19 +1,34 @@ - - $(SolutionDir) - $(RA_DIR)rapidjson\include\ - $(RA_DIR)rcheevos\include\ - $(RA_DIR)RAInterface - $(RA_DIR)src\ - $(RA_DIR)GSL\include\ - $(RA_DIR);$(RA_SourceDir);$(RAInterface_IncludePath);$(RapidJSON_IncludeDir);$(rcheevos_IncludePath);$(GSL_IncludeDir) - true + $(SolutionDir)rapidjson\include\ + $(SolutionDir)rcheevos\include\ + $(SolutionDir)RAInterface + $(SolutionDir)src\ + $(SolutionDir)src\devkit\ + $(SolutionDir)GSL\include\ + $(VCInstallDir)UnitTest\include\ + $(RA_DevKitSourceDir);$(RA_SourceDir);$(rcheevos_IncludePath);$(GSL_IncludePath) $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\ + $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + true + NativeRecommendedRules.ruleset + false + + + false + $(RA_SourceDir)\ra_rules.ruleset + true + $(RapidJSON_IncludeDir);$(CAExcludePath) + + + false + true + true @@ -22,42 +37,80 @@ + CompileAsCpp + stdcpp17 + true + Level4 + $(RA_IncludePath);%(AdditionalIncludeDirectories) true true - stdcpp17 - CompileAsCpp - $(RA_IncludePath) ProgramDatabase - Level4 - Use - pch.h - pch.h - _ARCH=$(PlatformArchitecture);RC_CLIENT_SUPPORTS_HASH;RA_EXPORTS;%(PreprocessorDefinitions) true true + Unicode + false - - "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - IF "$(LocalDebuggerWorkingDirectory)"=="" GOTO done - IF NOT EXIST $(LocalDebuggerWorkingDirectory) GOTO done - echo Copying $(Configuration) DLL to $(LocalDebuggerWorkingDirectory) - copy /y $(TargetPath) $(LocalDebuggerWorkingDirectory)\$(TargetFileName) - :done - - - $(LocalDebuggerWorkingDirectory)\$(TargetName).pdb + $(OutDir)\$(TargetName).pdb libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib + + + Disabled + _DEBUG;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + EditAndContinue + false + false + false + + + _DEBUG;%(PreprocessorDefinitions) + + + true + false + + + + + MaxSpeed + true + true + true + NDEBUG;%(PreprocessorDefinitions) + Default + MultiThreaded + + + true + true + false + + + + + Disabled + NDEBUG;%(PreprocessorDefinitions) + Default + MultiThreaded + false + false + true + true + true + + + false + false + + + NDEBUG;%(PreprocessorDefinitions) + + - - $(RA_DIR) - true - $(RapidJSON_IncludeDir) true @@ -74,17 +127,17 @@ $(RA_SourceDir) true - - $(GSL_IncludeDir) + + $(RA_DevKitSourceDir) + true + + + $(GSL_IncludePath) true $(RA_IncludePath) true - - $(XPDeprecationWarning) - true - diff --git a/src/data/AsyncObject.hh b/src/data/AsyncObject.hh index 5cbff230..1f53a13e 100644 --- a/src/data/AsyncObject.hh +++ b/src/data/AsyncObject.hh @@ -2,7 +2,7 @@ #define RA_DATA_ASYNCOBJECT_HH #pragma once -#include "ra_fwd.h" +#include "util\GSL.hh" namespace ra { namespace data { diff --git a/src/data/DataModelBase.hh b/src/data/DataModelBase.hh index 19d2f787..86e06545 100644 --- a/src/data/DataModelBase.hh +++ b/src/data/DataModelBase.hh @@ -30,7 +30,7 @@ public: void RemoveNotifyTarget(NotifyTarget& pTarget) noexcept { -#ifdef RA_UTEST +#ifdef DEBUG GSL_SUPPRESS_F6 Expects(!m_bDestructed); #endif m_vNotifyTargets.Remove(pTarget); diff --git a/src/data/ModelCollectionBase.hh b/src/data/ModelCollectionBase.hh index 082ef7bc..b7826416 100644 --- a/src/data/ModelCollectionBase.hh +++ b/src/data/ModelCollectionBase.hh @@ -4,7 +4,7 @@ #include "ModelBase.hh" -#include "ra_utility.h" +#include "util\TypeCasts.hh" namespace ra { namespace data { diff --git a/src/data/ModelPropertyContainer.hh b/src/data/ModelPropertyContainer.hh index f33b9754..888a8712 100644 --- a/src/data/ModelPropertyContainer.hh +++ b/src/data/ModelPropertyContainer.hh @@ -2,9 +2,7 @@ #define RA_DATA_MODEL_PROPERTY_CONTAINER_H #pragma once -#include "ra_fwd.h" - -#include "ModelProperty.hh" +#include "data\ModelProperty.hh" namespace ra { namespace data { @@ -14,7 +12,7 @@ class ModelPropertyContainer public: GSL_SUPPRESS_F6 ModelPropertyContainer() = default; -#ifdef RA_UTEST +#ifdef DEBUG virtual ~ModelPropertyContainer() noexcept { m_bDestructed = true; } diff --git a/src/data/NotifyTargetSet.hh b/src/data/NotifyTargetSet.hh index a02fa74d..fa675ca6 100644 --- a/src/data/NotifyTargetSet.hh +++ b/src/data/NotifyTargetSet.hh @@ -2,7 +2,7 @@ #define RA_DATA_NOTIFYTARGET_SET_H #pragma once -#include "ra_fwd.h" +#include "util\GSL.hh" namespace ra { namespace data { @@ -76,7 +76,7 @@ public: auto begin() const noexcept { return m_pBegin; } auto end() const noexcept { return m_pEnd; } - size_t size() const + size_t size() const noexcept { return m_pEnd.m_pCurrent - m_pBegin.m_pCurrent; } diff --git a/src/data/context/ConsoleContext.cpp b/src/data/context/ConsoleContext.cpp index d0e960c5..e0caaee8 100644 --- a/src/data/context/ConsoleContext.cpp +++ b/src/data/context/ConsoleContext.cpp @@ -1,7 +1,7 @@ #include "ConsoleContext.hh" -#include "RA_Log.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include diff --git a/src/data/context/ConsoleContext.hh b/src/data/context/ConsoleContext.hh index 96e19248..2e07494b 100644 --- a/src/data/context/ConsoleContext.hh +++ b/src/data/context/ConsoleContext.hh @@ -3,8 +3,8 @@ #pragma once #include "RAInterface\RA_Consoles.h" -#include "ra_fwd.h" #include "data\Types.hh" +#include "util\GSL.hh" #include diff --git a/src/data/context/EmulatorContext.cpp b/src/data/context/EmulatorContext.cpp index e3537444..d4bc267e 100644 --- a/src/data/context/EmulatorContext.cpp +++ b/src/data/context/EmulatorContext.cpp @@ -2,9 +2,9 @@ #include "Exports.hh" #include "RA_BuildVer.h" -#include "RA_Log.h" #include "RA_Resource.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "api\LatestClient.hh" diff --git a/src/data/context/EmulatorContext.hh b/src/data/context/EmulatorContext.hh index c5759e72..837e667b 100644 --- a/src/data/context/EmulatorContext.hh +++ b/src/data/context/EmulatorContext.hh @@ -5,7 +5,6 @@ #include "RAInterface\RA_Emulators.h" #include "data\Types.hh" -#include "ra_fwd.h" #include diff --git a/src/data/context/GameAssets.cpp b/src/data/context/GameAssets.cpp index 5ca493c5..ce5d5090 100644 --- a/src/data/context/GameAssets.cpp +++ b/src/data/context/GameAssets.cpp @@ -1,7 +1,7 @@ #include "GameAssets.hh" #include "Exports.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "GameContext.hh" diff --git a/src/data/context/GameContext.cpp b/src/data/context/GameContext.cpp index f9864407..0ec631d0 100644 --- a/src/data/context/GameContext.cpp +++ b/src/data/context/GameContext.cpp @@ -3,9 +3,9 @@ #include "Exports.hh" #include "RA_Defs.h" -#include "RA_Log.h" #include "RA_md5factory.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "data\context\ConsoleContext.hh" #include "data\context\EmulatorContext.hh" diff --git a/src/data/context/SessionTracker.cpp b/src/data/context/SessionTracker.cpp index c5ee2cb5..48ae824a 100644 --- a/src/data/context/SessionTracker.cpp +++ b/src/data/context/SessionTracker.cpp @@ -1,9 +1,9 @@ #include "SessionTracker.hh" #include "Exports.hh" -#include "RA_Log.h" #include "RA_md5factory.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "data\context\GameContext.hh" diff --git a/src/data/context/UserContext.cpp b/src/data/context/UserContext.cpp index 0ef39fcd..b9b9acfc 100644 --- a/src/data/context/UserContext.cpp +++ b/src/data/context/UserContext.cpp @@ -1,7 +1,7 @@ #include "UserContext.hh" #include "Exports.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\impl\DisconnectedServer.hh" diff --git a/src/data/models/AchievementModel.cpp b/src/data/models/AchievementModel.cpp index ad9185e1..76f39b43 100644 --- a/src/data/models/AchievementModel.cpp +++ b/src/data/models/AchievementModel.cpp @@ -1,6 +1,6 @@ #include "AchievementModel.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "data\context\GameContext.hh" diff --git a/src/data/models/AssetModelBase.hh b/src/data/models/AssetModelBase.hh index 958d14ee..15fa9bab 100644 --- a/src/data/models/AssetModelBase.hh +++ b/src/data/models/AssetModelBase.hh @@ -6,8 +6,7 @@ #include "data\DataModelBase.hh" -#include "RA_StringUtils.h" -#include "ra_utility.h" +#include "util\Strings.hh" namespace ra { namespace data { diff --git a/src/data/models/CodeNoteModel.cpp b/src/data/models/CodeNoteModel.cpp index 69608cda..7ddadb79 100644 --- a/src/data/models/CodeNoteModel.cpp +++ b/src/data/models/CodeNoteModel.cpp @@ -5,8 +5,7 @@ #include "services\ServiceLocator.hh" -#include "RA_StringUtils.h" -#include "ra_utility.h" +#include "util\Strings.hh" namespace ra { namespace data { diff --git a/src/data/models/TriggerValidation.cpp b/src/data/models/TriggerValidation.cpp index 1b909635..14ad3ec8 100644 --- a/src/data/models/TriggerValidation.cpp +++ b/src/data/models/TriggerValidation.cpp @@ -1,6 +1,6 @@ #include "TriggerValidation.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "RA_Defs.h" #include "data/context/ConsoleContext.hh" diff --git a/src/data/search/MemBlock.cpp b/src/data/search/MemBlock.cpp index 57c4c0b2..f5b1d710 100644 --- a/src/data/search/MemBlock.cpp +++ b/src/data/search/MemBlock.cpp @@ -1,6 +1,6 @@ #include "MemBlock.hh" -#include "ra_fwd.h" +#include "util\GSL.hh" namespace ra { namespace data { diff --git a/src/devkit/RADevKit.vcxproj b/src/devkit/RADevKit.vcxproj new file mode 100644 index 00000000..af825e3b --- /dev/null +++ b/src/devkit/RADevKit.vcxproj @@ -0,0 +1,67 @@ + + + + + Analysis + Win32 + + + Analysis + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + Designer + + + + RADevKit + {8AE21D54-F905-44E1-90E5-D22E346BFF39} + RADevKit + ra + StaticLibrary + 10.0 + v143 + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/devkit/RADevKit.vcxproj.filters b/src/devkit/RADevKit.vcxproj.filters new file mode 100644 index 00000000..4755e4c3 --- /dev/null +++ b/src/devkit/RADevKit.vcxproj.filters @@ -0,0 +1,61 @@ + + + + + + + + {b8643d27-258d-476b-854a-da94989facbf} + + + {a189cb4e-de59-400e-9d9b-f3d601b41605} + + + {f4590fbd-6bec-47dc-a679-380442fca29e} + + + + + data + + + services + + + services + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + + + + data + + + util + + + util + + + \ No newline at end of file diff --git a/src/data/ModelProperty.cpp b/src/devkit/data/ModelProperty.cpp similarity index 56% rename from src/data/ModelProperty.cpp rename to src/devkit/data/ModelProperty.cpp index 55dbaa0b..654b1ea6 100644 --- a/src/data/ModelProperty.cpp +++ b/src/devkit/data/ModelProperty.cpp @@ -1,6 +1,7 @@ #include "ModelProperty.hh" -#include "ra_fwd.h" +#include +#include namespace ra { namespace data { @@ -9,45 +10,50 @@ namespace data { // and therefore initialized in a sequential manner when the DLL is loaded. s_vProperties is a vector of _references_, // but you can't declare a vector of reference types, so it's implemented as a vector of pointers. Don't worry about // deleting the pointers, they should be pointing to the static ModelProperties, which aren't allocated. -int ModelPropertyBase::s_nNextKey = 1; -std::vector ModelPropertyBase::s_vProperties; +static int s_nNextKey = 1; +static std::unique_ptr> s_vProperties; _Use_decl_annotations_ ModelPropertyBase::ModelPropertyBase(const char* const sTypeName, const char* const sPropertyName) : - m_sTypeName{sTypeName}, - m_sPropertyName{sPropertyName} + m_sTypeName(sTypeName), + m_sPropertyName(sPropertyName) { // ASSERT: ModelProperties are static variables and constructed when the DLL is loaded. // We cannot reasonably use a mutex because it cannot be locked during static initialization in WinXP. - // ASSERT: The vector is implicitly sorted as new items are allocated higher keys and added to the end of the - // vector. - m_nKey = s_nNextKey++; - - if (s_vProperties.empty()) + // ASSERT: The vector is implicitly sorted as new items are allocated higher keys and + // added to the end of the vector. + if (s_vProperties == nullptr) { - s_vProperties.reserve(128); - - // If you encounter this exception, make sure ModelProperty.cpp appears before any files that use it in the - // vsproj file. The linker will initialize static objects in the order that they're linked, so any - // ModelProperty that gets initialized before the ModelPropertyBase class is initialized may be lost. - Expects(m_nKey == 1); + s_vProperties = std::make_unique>(); + s_vProperties->reserve(128); + s_nNextKey = 1; } - s_vProperties.push_back(this); + m_nKey = s_nNextKey++; + + s_vProperties->push_back(this); } ModelPropertyBase::~ModelPropertyBase() noexcept { - auto iter = std::find(s_vProperties.begin(), s_vProperties.end(), this); - if (iter != s_vProperties.end()) - s_vProperties.erase(iter); + if (!s_vProperties || s_vProperties->empty()) + return; + + auto iter = std::find(s_vProperties->begin(), s_vProperties->end(), this); + if (iter != s_vProperties->end()) + { + s_vProperties->erase(iter); + + if (s_vProperties->empty()) + s_nNextKey = 1; + } } const ModelPropertyBase* ModelPropertyBase::GetPropertyForKey(int nKey) { ModelPropertyBase search(nKey); - auto iter = std::lower_bound(s_vProperties.begin(), s_vProperties.end(), &search, - [](const ModelPropertyBase* restrict left, const ModelPropertyBase* restrict right) + auto iter = std::lower_bound(s_vProperties->begin(), s_vProperties->end(), &search, + [](const ModelPropertyBase* left, const ModelPropertyBase* right) { if (left == nullptr) return (right != nullptr); @@ -56,7 +62,7 @@ const ModelPropertyBase* ModelPropertyBase::GetPropertyForKey(int nKey) return left->GetKey() < right->GetKey(); }); - return (iter == s_vProperties.end() ? nullptr : *iter); + return (iter == s_vProperties->end() ? nullptr : *iter); } } // namespace data diff --git a/src/data/ModelProperty.hh b/src/devkit/data/ModelProperty.hh similarity index 94% rename from src/data/ModelProperty.hh rename to src/devkit/data/ModelProperty.hh index 2c500e07..de95aafe 100644 --- a/src/data/ModelProperty.hh +++ b/src/devkit/data/ModelProperty.hh @@ -2,7 +2,10 @@ #define RA_DATA_MODEL_PROPERTY_H #pragma once -#include "ra_fwd.h" +#include "util/Compat.hh" +#include "util/GSL.hh" + +#include namespace ra { namespace data { @@ -59,12 +62,9 @@ protected: explicit ModelPropertyBase(_In_ int nKey) noexcept { m_nKey = nKey; } // for binary search private: - int m_nKey{}; - const char* m_sTypeName{}; - const char* m_sPropertyName{}; - - static std::vector s_vProperties; - static int s_nNextKey; + int m_nKey = 0; + const char* m_sTypeName = nullptr; + const char* m_sPropertyName = nullptr; }; template @@ -74,7 +74,8 @@ public: explicit ModelProperty(const char* sTypeName, const char* sPropertyName, T tDefaultValue) : ModelPropertyBase(sTypeName, sPropertyName), m_tDefaultValue(tDefaultValue) - {} + { + } /// /// Gets the default value for the property. diff --git a/src/services/ILogger.hh b/src/devkit/services/ILogger.hh similarity index 100% rename from src/services/ILogger.hh rename to src/devkit/services/ILogger.hh diff --git a/src/devkit/services/IMessageDispatcher.hh b/src/devkit/services/IMessageDispatcher.hh new file mode 100644 index 00000000..bc7a5579 --- /dev/null +++ b/src/devkit/services/IMessageDispatcher.hh @@ -0,0 +1,36 @@ +#ifndef RA_SERVICES_IMESSAGE_DISPATCHER_HH +#define RA_SERVICES_IMESSAGE_DISPATCHER_HH +#pragma once + +#include + +namespace ra { +namespace services { + +class IMessageDispatcher +{ +public: + virtual ~IMessageDispatcher() noexcept = default; + IMessageDispatcher(const IMessageDispatcher&) noexcept = delete; + IMessageDispatcher& operator=(const IMessageDispatcher&) noexcept = delete; + IMessageDispatcher(IMessageDispatcher&&) noexcept = delete; + IMessageDispatcher& operator=(IMessageDispatcher&&) noexcept = delete; + + /// + /// Dispatches a message. + /// + virtual void ReportMessage(const std::wstring& sSummary, const std::wstring& sDetail) const = 0; + + /// + /// Dispatches an error message. + /// + virtual void ReportErrorMessage(const std::wstring& sSummary, const std::wstring& sDetail) const = 0; + +protected: + IMessageDispatcher() noexcept = default; +}; + +} // namespace services +} // namespace ra + +#endif // !RA_SERVICES_IMESSAGE_DISPATCHER_HH diff --git a/src/services/ServiceLocator.hh b/src/devkit/services/ServiceLocator.hh similarity index 99% rename from src/services/ServiceLocator.hh rename to src/devkit/services/ServiceLocator.hh index 8b6d4645..de327d72 100644 --- a/src/services/ServiceLocator.hh +++ b/src/devkit/services/ServiceLocator.hh @@ -5,7 +5,7 @@ #include "services\ILogger.hh" #ifndef NDEBUG -#include "RA_StringUtils.h" +#include "util\Strings.hh" #endif namespace ra { diff --git a/src/devkit/util/Compat.hh b/src/devkit/util/Compat.hh new file mode 100644 index 00000000..c213d775 --- /dev/null +++ b/src/devkit/util/Compat.hh @@ -0,0 +1,31 @@ +#ifndef RA_COMPAT_HH +#define RA_COMPAT_HH +#pragma once + +/* ===== function prototype macros ===== */ + +//#define _DEPRECATED [[deprecated]] +//#define _DEPRECATEDR(reason) [[deprecated(reason)]] +//#define _FALLTHROUGH [[fallthrough]] //; you need ';' at the end +#define _UNUSED [[maybe_unused]] +#define _CONSTANT_VAR inline constexpr auto +// +#define _CONSTANT_LOC constexpr auto // local vars can't be inline +#define _CONSTANT_FN _CONSTANT_VAR + +#ifndef __STDC_VERSION__ + #define __STDC_VERSION__ 0 +#endif /* !__STDC_VERSION__ */ + +#if __STDC_VERSION__ >= 199901L + /* "restrict" is a keyword */ + #define _RESTRICT restrict +#elif defined(__GNUC__) || defined(__clang__) + #define _RESTRICT __restrict__ +#elif defined(_MSC_VER) + #define _RESTRICT __restrict +#else + #define _RESTRICT restrict +#endif /* __STDC_VERSION__ >= 199901L */ + +#endif /* !RA_COMPAT_HH */ diff --git a/src/ra_utility.h b/src/devkit/util/EnumOps.hh similarity index 58% rename from src/ra_utility.h rename to src/devkit/util/EnumOps.hh index bf72b67b..c443cf42 100644 --- a/src/ra_utility.h +++ b/src/devkit/util/EnumOps.hh @@ -1,81 +1,13 @@ -#ifndef RA_UTILITY_H -#define RA_UTILITY_H +#ifndef RA_ENUM_OPS_H +#define RA_ENUM_OPS_H #pragma once -#include "ra_fwd.h" -#include "ra_type_traits.h" +#include "util\Compat.hh" +#include "util\TypeCasts.hh" +#include "util\TypeTraits.hh" -/* - For most of these functions you won't have to specify the template argument - as it will be auto-deduced unless stated otherwise. -*/ namespace ra { -template>> -_NODISCARD _CONSTANT_FN to_unsigned(_In_ SignedType st) noexcept -{ - return gsl::narrow_cast>(st); -} - -template>> -_NODISCARD _CONSTANT_FN to_signed(_In_ UnsignedType st) noexcept -{ - return gsl::narrow_cast>(st); -} - -template>> -_NODISCARD _CONSTANT_VAR etoi(_In_ Enum e) noexcept -{ - return static_cast>(e); -} - -template, - typename = std::enable_if_t && std::is_integral_v && - std::is_convertible_v>>> -_NODISCARD _CONSTANT_VAR itoe(_In_ Integral i) noexcept -{ - return static_cast(i); -} - - -// function alias templates for etoi (EnumToIntegral) and itoe (IntegralToEnum) -template _CONSTANT_VAR to_integral{etoi}; -template> _CONSTANT_VAR to_enum{itoe}; - -/// Calculates the size of any standard fstream. -/// The filename. -/// -/// The character type, it should be auto deduced if valid. Otherwise you'll -/// get an intellisense error. -/// -/// The size of the file stream. -template>> -_NODISCARD _CONSTANT_FN filesize(_In_ const std::basic_string& filename) noexcept -{ - using file_type = std::basic_fstream; - file_type file{filename, std::ios::in | std::ios::ate | std::ios::binary}; - return file.tellg(); -} // end function filesize - -/// Calculates the size of any standard fstream. -/// The filename. -/// -/// The character type, it should be auto deduced if valid. Otherwise you'll -/// get an intellisense error. -/// -/// The size of the file stream. -/// -/// This overload is provided as a safe-guard against unexpected lifetimes. -/// -template>> -_NODISCARD _CONSTANT_FN filesize(std::basic_string&& filename) noexcept -{ - using file_type = std::basic_fstream; - auto bstr{std::move(filename)}; - file_type file{bstr, std::ios::in | std::ios::ate | std::ios::binary}; - return file.tellg(); -} // end function filesize - // Don't depend on std::rel_ops for stuff here because it assumes each parameter // has the same type /// @@ -204,4 +136,4 @@ _CONSTANT_FN& operator-=(_Inout_ Enum& a, _In_ std::underlying_type_t b) n } // namespace ra -#endif // !RA_UTILITY_H +#endif // !RA_ENUM_OPS diff --git a/src/devkit/util/GSL.cpp b/src/devkit/util/GSL.cpp new file mode 100644 index 00000000..f26edbc2 --- /dev/null +++ b/src/devkit/util/GSL.cpp @@ -0,0 +1,68 @@ +#include "gsl.hh" + +#include "services\ILogger.hh" +#include "services\IMessageDispatcher.hh" +#include "services\ServiceLocator.hh" + +#include "util\Log.hh" +#include "util\Strings.hh" + +static inline constexpr const char* __gsl_filename(const char* const str) +{ + if (str == nullptr) + return str; + + if (str[0] == 's' && str[1] == 'r' && str[2] == 'c' && str[3] == '\\') + return str; + + const char* scan = str; + if (scan == nullptr) + return str; + + while (*scan != '\\') + { + if (!*scan) + return str; + scan++; + } + + return __gsl_filename(scan + 1); +} + +#ifdef NDEBUG + +void __gsl_contract_handler(const char* const file, unsigned int line) +{ + static char buffer[128]; + snprintf(buffer, sizeof(buffer), "Assertion failure at %s: %u", __gsl_filename(file), line); + + if (ra::services::ServiceLocator::Exists()) + { + RA_LOG_ERR(buffer); + } + + if (ra::services::ServiceLocator::Exists()) + { + ra::services::ServiceLocator::Get() + .ReportErrorMessage(L"Unexpected error", ra::Widen(buffer)); + } + + gsl::details::throw_exception(gsl::fail_fast(buffer)); +} + +#else + +void __gsl_contract_handler(const char* const file, unsigned int line, const char* const error) +{ + const char* const filename = __gsl_filename(file); + const auto sError = ra::StringPrintf("Assertion failure at %s: %d: %s", filename, line, error); + + if (ra::services::ServiceLocator::Exists()) + { + RA_LOG_ERR("%s", sError.c_str()); + } + + _wassert(ra::Widen(error).c_str(), ra::Widen(filename).c_str(), line); +} + +#endif diff --git a/src/devkit/util/GSL.hh b/src/devkit/util/GSL.hh new file mode 100644 index 00000000..c780490f --- /dev/null +++ b/src/devkit/util/GSL.hh @@ -0,0 +1,43 @@ +#ifndef RA_GSL_HH +#define RA_GSL_HH +#pragma once + +#define GSL_THROW_ON_CONTRACT_VIOLATION +#include + +// the default GSL Expects() macro throws an exception, which we don't try to catch anywhere. +// replace it with our custom handler, which will log and report the error before throwing it. +#ifndef RA_UTEST + #ifdef NDEBUG + extern void __gsl_contract_handler(const char* const file, unsigned int line); + #undef Expects + #define Expects(cond) (GSL_LIKELY(cond) ? static_cast(0) : __gsl_contract_handler(__FILE__, __LINE__)) + #else + extern void __gsl_contract_handler(const char* const file, unsigned int line, const char* const error); + #undef Expects + #define Expects(cond) (GSL_LIKELY(cond) ? static_cast(0) : __gsl_contract_handler(__FILE__, __LINE__, GSL_STRINGIFY(cond))) + #endif +#endif + +/* Use these for code analysis suppressions if needed */ +/* clang-format off */ +#define GSL_SUPPRESS_BOUNDS4 GSL_SUPPRESS(bounds.4) +#define GSL_SUPPRESS_C128 GSL_SUPPRESS(c.128) +#define GSL_SUPPRESS_CON3 GSL_SUPPRESS(con.3) +#define GSL_SUPPRESS_CON4 GSL_SUPPRESS(con.4) +#define GSL_SUPPRESS_ENUM3 GSL_SUPPRESS(enum.3) +#define GSL_SUPPRESS_ES47 GSL_SUPPRESS(es.47) +#define GSL_SUPPRESS_F4 GSL_SUPPRESS(f.4) +#define GSL_SUPPRESS_F6 GSL_SUPPRESS(f.6) +#define GSL_SUPPRESS_F23 GSL_SUPPRESS(f.23) +#define GSL_SUPPRESS_IO5 GSL_SUPPRESS(io.5) +#define GSL_SUPPRESS_R3 GSL_SUPPRESS(r.3) +#define GSL_SUPPRESS_R30 GSL_SUPPRESS(r.30) +#define GSL_SUPPRESS_R32 GSL_SUPPRESS(r.32) +#define GSL_SUPPRESS_TYPE1 GSL_SUPPRESS(type.1) +#define GSL_SUPPRESS_TYPE3 GSL_SUPPRESS(type.3) +#define GSL_SUPPRESS_TYPE4 GSL_SUPPRESS(type.4) +#define GSL_SUPPRESS_TYPE6 GSL_SUPPRESS(type.6) +/* clang-format on */ + +#endif /* !RA_GSL_HH */ diff --git a/src/RA_Log.h b/src/devkit/util/Log.hh similarity index 88% rename from src/RA_Log.h rename to src/devkit/util/Log.hh index 75fe3b55..abf694a6 100644 --- a/src/RA_Log.h +++ b/src/devkit/util/Log.hh @@ -1,5 +1,5 @@ -#ifndef RA_LOG_H -#define RA_LOG_H +#ifndef RA_LOG_HH +#define RA_LOG_HH #pragma once #include "services\ILogger.hh" @@ -10,9 +10,8 @@ #else -#include "RA_StringUtils.h" - #include "services\ServiceLocator.hh" +#include "util\Strings.hh" #define RA_LOG_LEVEL(lvl, ...) \ { \ @@ -27,4 +26,4 @@ #define RA_LOG_WARN(...) RA_LOG_LEVEL(ra::services::LogLevel::Warn, __VA_ARGS__) #define RA_LOG_ERR(...) RA_LOG_LEVEL(ra::services::LogLevel::Error, __VA_ARGS__) -#endif // !RA_LOG_H +#endif // !RA_LOG_HH diff --git a/src/RA_StringUtils.cpp b/src/devkit/util/Strings.cpp similarity index 98% rename from src/RA_StringUtils.cpp rename to src/devkit/util/Strings.cpp index bbd08a68..d52b9427 100644 --- a/src/RA_StringUtils.cpp +++ b/src/devkit/util/Strings.cpp @@ -1,4 +1,11 @@ -#include "RA_StringUtils.h" +#include "Strings.hh" + +#include "TypeCasts.hh" + +// TODO: not rely on Windows API +// for ::MultiByteToWideChar and ::WideCharToMultiByte +#define WIN32_LEAN_AND_MEAN +#include namespace ra { diff --git a/src/RA_StringUtils.h b/src/devkit/util/Strings.hh similarity index 97% rename from src/RA_StringUtils.h rename to src/devkit/util/Strings.hh index 785a01b1..4150fb2b 100644 --- a/src/RA_StringUtils.h +++ b/src/devkit/util/Strings.hh @@ -1,8 +1,16 @@ -#ifndef RA_STRINGUTILS_H -#define RA_STRINGUTILS_H +#ifndef RA_STRINGS_HH +#define RA_STRINGS_HH #pragma once -#include "ra_utility.h" +#include "Compat.hh" +#include "GSL.hh" +#include "TypeCasts.hh" +#include "TypeTraits.hh" + +#include +#include +#include +#include namespace ra { @@ -382,7 +390,7 @@ public: } template>, typename T, typename... Ts> - void AppendPrintf(const CharT* const restrict pFormat, const T& restrict value, Ts&&... args) + void AppendPrintf(const CharT* const _RESTRICT pFormat, const T& _RESTRICT value, Ts&&... args) { auto* pScan = pFormat; Expects(pScan != nullptr); @@ -497,11 +505,11 @@ private: public: explicit PendingString(std::string&& arg) noexcept : String{std::move(arg)}, DataType{Type::String} {} explicit PendingString(std::wstring&& arg) noexcept : WString{std::move(arg)}, DataType{Type::WString} {} - explicit PendingString(_In_z_ const char* const restrict ptr, std::size_t len) noexcept : + explicit PendingString(_In_z_ const char* const _RESTRICT ptr, std::size_t len) noexcept : Ref{std::string_view{ptr, len}}, DataType{Type::CharRef} {} - explicit PendingString(_In_z_ const wchar_t* const restrict ptr, std::size_t len) noexcept : + explicit PendingString(_In_z_ const wchar_t* const _RESTRICT ptr, std::size_t len) noexcept : Ref{std::wstring_view{ptr, len}}, DataType{Type::WCharRef} {} @@ -574,7 +582,7 @@ std::wstring BuildWString(Ts&&... args) /// Constructs a from a format string and parameters /// template>, typename... Ts> -_NODISCARD inline auto StringPrintf(_In_z_ _Printf_format_string_ const CharT* const __restrict sFormat, Ts&&... args) +_NODISCARD inline auto StringPrintf(_In_z_ _Printf_format_string_ const CharT* const _RESTRICT sFormat, Ts&&... args) { Expects(sFormat != nullptr); @@ -768,7 +776,7 @@ GSL_SUPPRESS_F6 _NODISCARD bool StringStartsWith(_In_ const std::basic_string template>> GSL_SUPPRESS_F6 _NODISCARD bool StringStartsWith(_In_ const std::basic_string& sString, - _In_ const CharT* restrict sMatch) noexcept + _In_ const CharT* _RESTRICT sMatch) noexcept { const auto sMatchLen = tcslen_s(sMatch); if (sMatchLen > sString.length()) @@ -781,8 +789,8 @@ GSL_SUPPRESS_F6 _NODISCARD bool StringStartsWith(_In_ const std::basic_string starts with . /// template>> -GSL_SUPPRESS_F6 _NODISCARD bool StringStartsWith(_In_ const CharT* restrict sString, - _In_ const CharT* restrict sMatch) noexcept +GSL_SUPPRESS_F6 _NODISCARD bool StringStartsWith(_In_ const CharT* _RESTRICT sString, + _In_ const CharT* _RESTRICT sMatch) noexcept { const auto sMatchLen = tcslen_s(sMatch); if (sMatchLen > tcslen_s(sString)) @@ -809,7 +817,7 @@ GSL_SUPPRESS_F6 _NODISCARD bool StringEndsWith(_In_ const std::basic_string template>> GSL_SUPPRESS_F6 _NODISCARD bool StringEndsWith(_In_ const std::basic_string& sString, - _In_ const CharT* restrict sMatch) noexcept + _In_ const CharT* _RESTRICT sMatch) noexcept { const auto sMatchLen = tcslen_s(sMatch); if (sMatchLen > sString.length()) @@ -822,8 +830,8 @@ GSL_SUPPRESS_F6 _NODISCARD bool StringEndsWith(_In_ const std::basic_string ends with . /// template>> -GSL_SUPPRESS_F6 _NODISCARD bool StringEndsWith(_In_ const CharT* restrict sString, - _In_ const CharT* restrict sMatch) noexcept +GSL_SUPPRESS_F6 _NODISCARD bool StringEndsWith(_In_ const CharT* _RESTRICT sString, + _In_ const CharT* _RESTRICT sMatch) noexcept { const auto sMatchLen = tcslen_s(sMatch); const auto sStringLen = tcslen_s(sString); @@ -875,4 +883,4 @@ std::string Base64(const std::string& sString); #define NativeStrType std::string #endif -#endif // !RA_STRINGUTILS_H +#endif // !RA_STRINGS_HH diff --git a/src/devkit/util/TypeCasts.hh b/src/devkit/util/TypeCasts.hh new file mode 100644 index 00000000..5603d3ad --- /dev/null +++ b/src/devkit/util/TypeCasts.hh @@ -0,0 +1,80 @@ +#ifndef RA_TYPE_CASTS_HH +#define RA_TYPE_CASTS_HH +#pragma once + +#include "TypeTraits.hh" + +/* + For most of these functions you won't have to specify the template argument + as it will be auto-deduced unless stated otherwise. +*/ +namespace ra { + +/* to_unsigned - convert a signed value to an unsigned value */ +template>> +_NODISCARD _CONSTANT_FN to_unsigned(_In_ SignedType st) noexcept +{ + return gsl::narrow_cast>(st); +} + +/* to_signed - convert an unsigned value to a signed value */ +template>> +_NODISCARD _CONSTANT_FN to_signed(_In_ UnsignedType st) noexcept +{ + return gsl::narrow_cast>(st); +} + +/* etoi - convert an enum to an int */ +template>> +_NODISCARD _CONSTANT_VAR etoi(_In_ Enum e) noexcept +{ + return static_cast>(e); +} + +/* itoe - convert an int to an enum */ +template, + typename = std::enable_if_t && std::is_integral_v && + std::is_convertible_v>>> +_NODISCARD _CONSTANT_VAR itoe(_In_ Integral i) noexcept +{ + return static_cast(i); +} + +/* ftol - convert a float to a long */ +template>> +_NODISCARD inline auto ftol(_In_ FloatingPoint fp) noexcept +{ + return std::lround(fp); +} + +/* ftoi - convert a float to an int */ +template>> +_NODISCARD inline int ftoi(_In_ FloatingPoint fp) noexcept +{ + return std::lround(fp); +} + +/* ftoll - convert a float to a long long */ +template>> +_NODISCARD inline auto ftoll(_In_ FloatingPoint fp) noexcept +{ + return std::llround(fp); +} + +/* ftoul - convert a float to an unsigned long */ +template>> +_NODISCARD inline auto ftoul(_In_ FloatingPoint fp) noexcept +{ + return to_unsigned(std::lround(fp)); +} + +/* ftoull - convert a float to an unsigned long long */ +template>> +_NODISCARD inline auto ftoull(_In_ FloatingPoint fp) noexcept +{ + return to_unsigned(std::llround(fp)); +} + +} // namespace ra + +#endif // !RA_TYPE_CASTS_H diff --git a/src/ra_type_traits.h b/src/devkit/util/TypeTraits.hh similarity index 92% rename from src/ra_type_traits.h rename to src/devkit/util/TypeTraits.hh index e3828dae..cecbba50 100644 --- a/src/ra_type_traits.h +++ b/src/devkit/util/TypeTraits.hh @@ -1,20 +1,10 @@ -#ifndef RA_TYPE_TRAITS_H -#define RA_TYPE_TRAITS_H +#ifndef RA_TYPE_TRAITS_HH +#define RA_TYPE_TRAITS_HH #pragma once -#if _HAS_CXX17 -#ifndef _CONSTANT_VAR -#define _CONSTANT_VAR inline constexpr auto -#endif // !_CONSTANT_VAR -#else -#ifndef _CONSTANT_VAR -#define _CONSTANT_VAR constexpr auto -#endif // !_CONSTANT_VAR -#endif // _HAS_CXX17 +#include "Compat.hh" -#ifndef _CONSTANT_FN -#define _CONSTANT_FN _CONSTANT_VAR -#endif // !_CONSTANT_FN +#include namespace ra { namespace detail { @@ -157,4 +147,4 @@ _CONSTANT_VAR is_literal_type_v{detail::is_literal_type::value}; } // namespace ra -#endif // !RA_TYPE_TRAITS_H +#endif // !RA_TYPE_TRAITS_HH diff --git a/src/pch.h b/src/pch.h index 6437cf96..6e310bb3 100644 --- a/src/pch.h +++ b/src/pch.h @@ -89,19 +89,30 @@ #pragma warning(pop) -#if RA_UTEST -#include -#pragma warning(push) -#pragma warning(disable : ALL_CPPCORECHECK_WARNINGS) -#include "CppUnitTest.h" -#pragma warning(pop) -#endif /* RA_UTEST */ - /* rcheevos stuff */ #pragma warning(push) -#pragma warning(disable : 4201) // nameless struct -#include -#pragma warning(pop) + #pragma warning(disable : 4201) // nameless struct + #include #pragma warning(pop) +#pragma warning(pop) + +#if RA_UTEST + #include + #pragma warning(push) + #pragma warning(disable : ALL_CPPCORECHECK_WARNINGS ALL_CODE_ANALYSIS_WARNINGS) + #include "CppUnitTest.h" + #pragma warning(pop) + + /* This has to be globally disabled in the unit tests because it occurs in the + * macros provided by the framework (i.e. TEST_METHOD). + */ + #pragma warning(disable: 26477) /* Use 'nullptr' rather than 0 or NULL (es.47). */ + + /* TODO: update all the failures related to these messages in the unit tests */ + #pragma warning(disable: 26429) /* Symbol is never tested for nullness, it can be marked as not_null (f.23). */ + #pragma warning(disable: 26462) /* X is assigned only once, mark it as a pointer to const (con.4). */ + +#endif /* RA_UTEST */ + #endif /* !PCH_H */ diff --git a/src/ra_fwd.h b/src/ra_fwd.h deleted file mode 100644 index 3d7a6434..00000000 --- a/src/ra_fwd.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef RA_FWD_H -#define RA_FWD_H -#pragma once - -#define _NORETURN \ - [[noreturn]] /*only used on functions that 100% fail (like functions that solely throw or std::terminate) */ - -/* Maybe an extra check just in-case */ -#if _HAS_CXX17 -#define _DEPRECATED [[deprecated]] -#define _DEPRECATEDR(reason) [[deprecated(reason)]] -#define _FALLTHROUGH [[fallthrough]] //; you need ';' at the end -#define _UNUSED [[maybe_unused]] -#define _CONSTANT_VAR inline constexpr auto -#else -#define _NODISCARD _Check_return_ -#define _DEPRECATED __declspec(deprecated) -#define _DEPRECATEDR(reason) _CRT_DEPRECATE_TEXT(reason) -#define _FALLTHROUGH __fallthrough //; you need ';' at the end -#define _UNUSED -#define _CONSTANT_VAR constexpr auto -#endif // _HAS_CXX17 - -#define _CONSTANT_LOC constexpr auto // local vars can't be inline -#define _CONSTANT_FN _CONSTANT_VAR - -#ifndef __STDC_VERSION__ -#define __STDC_VERSION__ 0 -#endif /* !__STDC_VERSION__ */ - -#if __STDC_VERSION__ >= 199901L -/* "restrict" is a keyword */ -#elif defined(__GNUC__) || defined(__clang__) -#define restrict __restrict__ -#elif defined(_MSC_VER) -#define restrict __restrict -#else -#define restrict -#endif /* __STDC_VERSION__ >= 199901L */ - -/* Use these for code analysis suppressions if needed */ -/* clang-format off */ -#define GSL_SUPPRESS_BOUNDS4 GSL_SUPPRESS(bounds.4) -#define GSL_SUPPRESS_C128 GSL_SUPPRESS(c.128) -#define GSL_SUPPRESS_CON3 GSL_SUPPRESS(con.3) -#define GSL_SUPPRESS_CON4 GSL_SUPPRESS(con.4) -#define GSL_SUPPRESS_ENUM3 GSL_SUPPRESS(enum.3) -#define GSL_SUPPRESS_ES47 GSL_SUPPRESS(es.47) -#define GSL_SUPPRESS_F4 GSL_SUPPRESS(f.4) -#define GSL_SUPPRESS_F6 GSL_SUPPRESS(f.6) -#define GSL_SUPPRESS_F23 GSL_SUPPRESS(f.23) -#define GSL_SUPPRESS_IO5 GSL_SUPPRESS(io.5) -#define GSL_SUPPRESS_R3 GSL_SUPPRESS(r.3) -#define GSL_SUPPRESS_R30 GSL_SUPPRESS(r.30) -#define GSL_SUPPRESS_R32 GSL_SUPPRESS(r.32) -#define GSL_SUPPRESS_TYPE1 GSL_SUPPRESS(type.1) -#define GSL_SUPPRESS_TYPE3 GSL_SUPPRESS(type.3) -#define GSL_SUPPRESS_TYPE6 GSL_SUPPRESS(type.6) -/* clang-format on */ - -#ifndef _TCHAR_DEFINED -#if _MBCS -using TCHAR = char; -#elif _UNICODE -using TCHAR = wchar_t; -#else -#error Unknown character set detected, only MultiByte and Unicode are supported! -#endif /* _MBCS */ -#define _TCHAR_DEFINED -#endif /* !_TCHAR_DEFINED */ - -#ifndef _WINDEF_ -struct HBITMAP__; -struct HDC__; -struct HPEN__; -struct HBRUSH__; -struct HWND__; -struct HINSTANCE__; - -using HBITMAP = HBITMAP__*; -using HDC = HDC__*; -using HPEN = HPEN__*; -using HBRUSH = HBRUSH__*; - -using HWND = HWND__*; -using HINSTANCE = HINSTANCE__*; -using HMODULE = HINSTANCE__*; - -struct tagRECT; -struct tagSIZE; -using RECT = tagRECT; -using SIZE = tagSIZE; - -using BOOL = int; -using BYTE = unsigned char; -using DWORD = unsigned long; -using HGDIOBJ = void*; -using LPVOID = void*; -using WORD = unsigned short; -#endif // !_WINDEF_ - -#ifndef _WINNT_ -using HANDLE = void*; -using LPCTSTR = const TCHAR*; -using LPTSTR = TCHAR*; -#endif // !_WINNT_ - -namespace ra { - -#ifdef UNICODE -using tstring = std::wstring; -#else -using tstring = std::string; -#endif - -} /* namespace ra */ - -#endif /* !RA_FWD_H */ diff --git a/src/ra_math.h b/src/ra_math.h deleted file mode 100644 index 6b50a586..00000000 --- a/src/ra_math.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef RA_MATH_H -#define RA_MATH_H -#pragma once - -#include "ra_utility.h" - -namespace ra { - -/// Casts into a . -/// A valid arithmetic type. -/// The number to be converted. -/// -/// The return type depends on the size of . If it's 8 bytes, it will -/// double, if it's anything less it will be float. long double is not considered as it is currently -/// the same as double size-wise. -/// -template>> -_NODISCARD _CONSTANT_FN to_floating(_In_ Arithmetic a) noexcept -{ - if constexpr (is_same_size_v) return static_cast(a); - if constexpr (has_smaller_size_than_v) return static_cast(a); -} - -template>> -_NODISCARD inline auto ftol(_In_ FloatingPoint fp) noexcept -{ - return std::lround(fp); -} - -template>> -_NODISCARD inline int ftoi(_In_ FloatingPoint fp) noexcept -{ - return std::lround(fp); -} - -template>> -_NODISCARD inline auto ftoll(_In_ FloatingPoint fp) noexcept -{ - return std::llround(fp); -} - -template>> -_NODISCARD inline auto ftoul(_In_ FloatingPoint fp) noexcept -{ - return to_unsigned(std::lround(fp)); -} - -template>> -_NODISCARD inline auto ftoull(_In_ FloatingPoint fp) noexcept -{ - return to_unsigned(std::llround(fp)); -} - -template>> -_NODISCARD _CONSTANT_FN sqr(_In_ Arithmetic a) noexcept -{ - return (a*a); -} -} /* namespace ra */ - -#endif /* !RA_MATH_H */ diff --git a/src/rcheevos.vcxproj b/src/rcheevos.vcxproj index f2a8cd35..a9f77b56 100644 --- a/src/rcheevos.vcxproj +++ b/src/rcheevos.vcxproj @@ -18,143 +18,46 @@ x64 + + + Designer + + - 15.0 - {9D55EBE7-1392-4FA1-A9B9-F022F764CE35} - Win32Proj - RAIntegrationRcheevos rcheevos + {9D55EBE7-1392-4FA1-A9B9-F022F764CE35} + rcheevos + rcheevos StaticLibrary + 10.0 v143 - - v142 - - - v141 - - - true - - - false - - - - - + - - - rcheevos - $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - - - true - - + - MaxSpeed - true - true - WIN32;RC_CLIENT_SUPPORTS_HASH;NDEBUG;_LIB;%(PreprocessorDefinitions) + RC_CLIENT_SUPPORTS_HASH;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)rcheevos\include;%(AdditionalIncludeDirectories) false - true Level3 - MultiThreaded + - - Windows - true - true - true - - true - - - MaxSpeed - true - true - WIN32;RC_CLIENT_SUPPORTS_HASH;NDEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)rcheevos\include;%(AdditionalIncludeDirectories) - false - true - Level3 - MultiThreaded - 6001;6308 - - - Windows - true - true - true - - - - true - - - - - Disabled - WIN32;RC_CLIENT_SUPPORTS_HASH;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)rcheevos\include;%(AdditionalIncludeDirectories) - false - MultiThreadedDebug - true - Level3 - - - Windows - true - - - - - - - Disabled - WIN32;RC_CLIENT_SUPPORTS_HASH;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)rcheevos\include;%(AdditionalIncludeDirectories) - false - MultiThreadedDebug - true - Level3 - 6001;6308 - - - Windows - true - - - - - - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + @@ -181,9 +84,7 @@ - - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + @@ -195,6 +96,4 @@ - - \ No newline at end of file diff --git a/src/rcheevos.vcxproj.filters b/src/rcheevos.vcxproj.filters index 49c0a604..d2c69e45 100644 --- a/src/rcheevos.vcxproj.filters +++ b/src/rcheevos.vcxproj.filters @@ -123,4 +123,7 @@ + + + \ No newline at end of file diff --git a/src/services/AchievementLogicSerializer.cpp b/src/services/AchievementLogicSerializer.cpp index bcb5c1a2..7595e5d6 100644 --- a/src/services/AchievementLogicSerializer.cpp +++ b/src/services/AchievementLogicSerializer.cpp @@ -1,7 +1,7 @@ #include "AchievementLogicSerializer.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\ConsoleContext.hh" diff --git a/src/services/AchievementLogicSerializer.hh b/src/services/AchievementLogicSerializer.hh index da477f40..5803f136 100644 --- a/src/services/AchievementLogicSerializer.hh +++ b/src/services/AchievementLogicSerializer.hh @@ -2,8 +2,6 @@ #define RA_ACHIEVEMENT_LOGIC_SERIALIZER_HH #pragma once -#include "ra_fwd.h" - #include "data\Types.hh" #include "data\models\CodeNoteModel.hh" diff --git a/src/services/AchievementRuntime.cpp b/src/services/AchievementRuntime.cpp index 8d937f62..5c57a70c 100644 --- a/src/services/AchievementRuntime.cpp +++ b/src/services/AchievementRuntime.cpp @@ -3,9 +3,11 @@ #include "AchievementRuntimeExports.hh" #include "Exports.hh" #include "RA_Defs.h" -#include "RA_Log.h" +#include "RA_Json.h" #include "RA_Resource.h" -#include "RA_StringUtils.h" +#include "util\EnumOps.hh" +#include "util\Log.hh" +#include "util\Strings.hh" #include "RA_md5factory.h" diff --git a/src/services/AchievementRuntime.hh b/src/services/AchievementRuntime.hh index 6baaf043..dd6ecc19 100644 --- a/src/services/AchievementRuntime.hh +++ b/src/services/AchievementRuntime.hh @@ -2,8 +2,6 @@ #define RA_SERVICES_ACHIEVEMENT_RUNTIME_HH #pragma once -#include "ra_fwd.h" - #include "data\Types.hh" #include "data\context\EmulatorContext.hh" #include "data\models\AchievementModel.hh" @@ -68,11 +66,9 @@ public: static std::string GetAchievementBadge(const rc_client_achievement_t& pAchievement); - void GetSubsets(std::vector>& vSubsets) const; - void RaiseClientEvent(rc_client_achievement_info_t& pAchievement, uint32_t nEventType) const noexcept; - void UpdateActiveAchievements(); + void UpdateActiveAchievements() noexcept(false); void UpdateActiveLeaderboards() noexcept; /// @@ -124,7 +120,7 @@ public: /// /// The buffer to read from. /// true if the achievement HitCounts were modified, false if not. - bool LoadProgressFromBuffer(const uint8_t* pBuffer); + bool LoadProgressFromBuffer(const uint8_t* pBuffer) noexcept(false); /// /// Writes HitCount data for active achievements to a save state file. @@ -142,7 +138,7 @@ public: /// nBufferSize - in which case the caller should allocate the specified amount /// and call again. /// - int SaveProgressToBuffer(uint8_t* pBuffer, int nBufferSize) const; + int SaveProgressToBuffer(uint8_t* pBuffer, int nBufferSize) const noexcept(false); /// /// Gets whether achievement processing is temporarily suspended. diff --git a/src/services/AchievementRuntimeExports.cpp b/src/services/AchievementRuntimeExports.cpp index 93a7aaf7..f5ac01d5 100644 --- a/src/services/AchievementRuntimeExports.cpp +++ b/src/services/AchievementRuntimeExports.cpp @@ -1,7 +1,7 @@ #include "AchievementRuntime.hh" #include "Exports.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Resource.h" #include "data\context\ConsoleContext.hh" diff --git a/src/services/FrameEventQueue.cpp b/src/services/FrameEventQueue.cpp index d7e9ee4e..7e0e8df1 100644 --- a/src/services/FrameEventQueue.cpp +++ b/src/services/FrameEventQueue.cpp @@ -1,7 +1,7 @@ #include "FrameEventQueue.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui\viewmodels\MessageBoxViewModel.hh" #include "ui\viewmodels\WindowManager.hh" diff --git a/src/services/FrameEventQueue.hh b/src/services/FrameEventQueue.hh index 5539bb2f..ff1b48b9 100644 --- a/src/services/FrameEventQueue.hh +++ b/src/services/FrameEventQueue.hh @@ -2,10 +2,10 @@ #define RA_SERVICES_FRAME_EVENT_QUEUE_HH #pragma once -#include "ra_fwd.h" - #include "data\Types.hh" +#include "util\GSL.hh" + namespace ra { namespace services { diff --git a/src/services/GameIdentifier.cpp b/src/services/GameIdentifier.cpp index 1ec7a00b..9a008939 100644 --- a/src/services/GameIdentifier.cpp +++ b/src/services/GameIdentifier.cpp @@ -1,7 +1,7 @@ #include "GameIdentifier.hh" -#include "RA_Log.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include diff --git a/src/services/Initialization.cpp b/src/services/Initialization.cpp index 6fcbccb0..2d880977 100644 --- a/src/services/Initialization.cpp +++ b/src/services/Initialization.cpp @@ -16,6 +16,7 @@ #include "services\impl\Clock.hh" #include "services\impl\FileLocalStorage.hh" #include "services\impl\JsonFileConfiguration.hh" +#include "services\impl\MessageDispatcher.hh" #include "services\impl\ThreadPool.hh" #include "services\impl\WindowsAudioSystem.hh" #include "services\impl\WindowsClipboard.hh" @@ -111,6 +112,9 @@ void Initialization::RegisterServices(EmulatorID nEmulatorId, const char* sClien auto pDesktop = std::make_unique(); ra::services::ServiceLocator::Provide(std::move(pDesktop)); + auto pMessageDispatcher = std::make_unique(); + ra::services::ServiceLocator::Provide(std::move(pMessageDispatcher)); + auto pEmulatorContext = std::make_unique(); pEmulatorContext->Initialize(nEmulatorId, sClientName); sClientName = pEmulatorContext->GetClientName().c_str(); diff --git a/src/services/PerformanceCounter.cpp b/src/services/PerformanceCounter.cpp index 2489fa55..d9487253 100644 --- a/src/services/PerformanceCounter.cpp +++ b/src/services/PerformanceCounter.cpp @@ -2,7 +2,7 @@ #ifdef PERFORMANCE_COUNTERS -#include "RA_Log.h" +#include "util\Log.hh" #include "IClock.hh" diff --git a/src/services/Search/SearchImpl.cpp b/src/services/Search/SearchImpl.cpp index b1f220c7..ba4e9213 100644 --- a/src/services/Search/SearchImpl.cpp +++ b/src/services/Search/SearchImpl.cpp @@ -1,6 +1,6 @@ #include "SearchImpl.hh" -#include "ra_utility.h" +#include "util\TypeCasts.hh" #include diff --git a/src/services/Search/SearchImpl_asciitext.hh b/src/services/Search/SearchImpl_asciitext.hh index 76192bf0..7cf2ba14 100644 --- a/src/services/Search/SearchImpl_asciitext.hh +++ b/src/services/Search/SearchImpl_asciitext.hh @@ -4,7 +4,7 @@ #include "SearchImpl.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/Search/SearchImpl_bitcount.hh b/src/services/Search/SearchImpl_bitcount.hh index fe61da77..2d1697d0 100644 --- a/src/services/Search/SearchImpl_bitcount.hh +++ b/src/services/Search/SearchImpl_bitcount.hh @@ -4,7 +4,7 @@ #include "SearchImpl.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/SearchResults.cpp b/src/services/SearchResults.cpp index cc3a7812..187ba431 100644 --- a/src/services/SearchResults.cpp +++ b/src/services/SearchResults.cpp @@ -1,7 +1,7 @@ #include "SearchResults.h" #include "RA_Defs.h" -#include "ra_utility.h" +#include "util\Log.hh" #include "data\context\EmulatorContext.hh" diff --git a/src/services/impl/FileLocalStorage.cpp b/src/services/impl/FileLocalStorage.cpp index fd81e550..be22b135 100644 --- a/src/services/impl/FileLocalStorage.cpp +++ b/src/services/impl/FileLocalStorage.cpp @@ -1,9 +1,8 @@ #include "FileLocalStorage.hh" -#include "ra_fwd.h" #include "RA_Json.h" -#include "RA_Log.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "services\IClock.hh" #include "services\IFileSystem.hh" diff --git a/src/services/impl/FileTextReader.hh b/src/services/impl/FileTextReader.hh index ff4127cc..deb6486b 100644 --- a/src/services/impl/FileTextReader.hh +++ b/src/services/impl/FileTextReader.hh @@ -4,7 +4,7 @@ #include "services\TextReader.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/impl/FileTextWriter.hh b/src/services/impl/FileTextWriter.hh index df9e09b9..716ab46e 100644 --- a/src/services/impl/FileTextWriter.hh +++ b/src/services/impl/FileTextWriter.hh @@ -4,8 +4,7 @@ #include "services\TextWriter.hh" -#include "RA_StringUtils.h" -#include "ra_utility.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/impl/JsonFileConfiguration.cpp b/src/services/impl/JsonFileConfiguration.cpp index 7575dc00..ae6f6ae3 100644 --- a/src/services/impl/JsonFileConfiguration.cpp +++ b/src/services/impl/JsonFileConfiguration.cpp @@ -1,9 +1,8 @@ #include "JsonFileConfiguration.hh" #include "RA_Json.h" -#include "RA_Log.h" -#include "RA_StringUtils.h" -#include "ra_utility.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "services\IFileSystem.hh" #include "services\ServiceLocator.hh" diff --git a/src/services/impl/MessageDispatcher.hh b/src/services/impl/MessageDispatcher.hh new file mode 100644 index 00000000..c474516c --- /dev/null +++ b/src/services/impl/MessageDispatcher.hh @@ -0,0 +1,38 @@ +#ifndef RA_SERVICES_MESSAGE_DISPATCHER_HH +#define RA_SERVICES_MESSAGE_DISPATCHER_HH +#pragma once + +#include "services\IMessageDispatcher.hh" + +#include "ui\viewmodels\MessageBoxViewModel.hh" + +namespace ra { +namespace services { +namespace impl { + +class MessageDispatcher : public IMessageDispatcher +{ +public: + /// + /// Dispatches a message. + /// + void ReportMessage(const std::wstring& sSummary, const std::wstring& sDetail) const override + { + ra::ui::viewmodels::MessageBoxViewModel::ShowMessage(sSummary, sDetail); + } + + /// + /// Dispatches an error message. + /// + void ReportErrorMessage(const std::wstring& sSummary, const std::wstring& sDetail) const override + { + ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(sSummary, sDetail); + } + +}; + +} // namespace impl +} // namespace services +} // namespace ra + +#endif // !RA_SERVICES_MESSAGE_DISPATCHER_HH diff --git a/src/services/impl/StringTextReader.hh b/src/services/impl/StringTextReader.hh index dd96b915..21fca995 100644 --- a/src/services/impl/StringTextReader.hh +++ b/src/services/impl/StringTextReader.hh @@ -4,7 +4,7 @@ #include "services\TextReader.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/impl/StringTextWriter.hh b/src/services/impl/StringTextWriter.hh index 83d78f6b..6070f23b 100644 --- a/src/services/impl/StringTextWriter.hh +++ b/src/services/impl/StringTextWriter.hh @@ -4,7 +4,7 @@ #include "services\TextWriter.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/services/impl/ThreadPool.cpp b/src/services/impl/ThreadPool.cpp index 7923b931..abb305fc 100644 --- a/src/services/impl/ThreadPool.cpp +++ b/src/services/impl/ThreadPool.cpp @@ -1,6 +1,6 @@ #include "ThreadPool.hh" -#include "RA_Log.h" +#include "util\Log.hh" namespace ra { namespace services { diff --git a/src/services/impl/ThreadPool.hh b/src/services/impl/ThreadPool.hh index a18e6596..153c5df7 100644 --- a/src/services/impl/ThreadPool.hh +++ b/src/services/impl/ThreadPool.hh @@ -2,12 +2,12 @@ #define RA_SERVICES_THREADPOOL_HH #pragma once -#include "ra_fwd.h" - #include "services\IClock.hh" #include "services\IThreadPool.hh" #include "services\ServiceLocator.hh" +#include "util\GSL.hh" + namespace ra { namespace services { namespace impl { diff --git a/src/services/impl/WindowsFileSystem.cpp b/src/services/impl/WindowsFileSystem.cpp index b23d3085..2fae69b3 100644 --- a/src/services/impl/WindowsFileSystem.cpp +++ b/src/services/impl/WindowsFileSystem.cpp @@ -1,7 +1,7 @@ #include "WindowsFileSystem.hh" -#include "RA_Log.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "services\impl\FileTextReader.hh" #include "services\impl\FileTextWriter.hh" diff --git a/src/services/impl/WindowsFileSystem.hh b/src/services/impl/WindowsFileSystem.hh index ed87efcc..134d49cf 100644 --- a/src/services/impl/WindowsFileSystem.hh +++ b/src/services/impl/WindowsFileSystem.hh @@ -2,7 +2,7 @@ #define RA_SERVICES_WIN32_FILESYSTEM_HH #pragma once -#include "ra_fwd.h" +#include "util\GSL.hh" #include "services\IFileSystem.hh" diff --git a/src/services/impl/WindowsHttpRequester.cpp b/src/services/impl/WindowsHttpRequester.cpp index 25950d71..105964b8 100644 --- a/src/services/impl/WindowsHttpRequester.cpp +++ b/src/services/impl/WindowsHttpRequester.cpp @@ -2,8 +2,8 @@ #include "RA_Defs.h" -#include "RA_Log.h" -#include "RA_StringUtils.h" +#include "util\Log.hh" +#include "util\Strings.hh" #include "services\impl\StringTextWriter.hh" diff --git a/src/services/impl/WindowsHttpRequester.hh b/src/services/impl/WindowsHttpRequester.hh index 2b64b2d0..ea5c909c 100644 --- a/src/services/impl/WindowsHttpRequester.hh +++ b/src/services/impl/WindowsHttpRequester.hh @@ -4,7 +4,7 @@ #include "services\IHttpRequester.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace services { diff --git a/src/ui/EditorTheme.hh b/src/ui/EditorTheme.hh index 4a249c41..ae06a62f 100644 --- a/src/ui/EditorTheme.hh +++ b/src/ui/EditorTheme.hh @@ -2,9 +2,9 @@ #define RA_UI_EDITOR_THEME_H #pragma once -#include "ra_fwd.h" +#include "util\GSL.hh" -#include "ui/Types.hh" +#include "ui\Types.hh" namespace ra { namespace ui { diff --git a/src/ui/ImageReference.hh b/src/ui/ImageReference.hh index 29238065..cefbfaed 100644 --- a/src/ui/ImageReference.hh +++ b/src/ui/ImageReference.hh @@ -2,8 +2,6 @@ #define RA_UI_IMAGEREPOSITORY_H #pragma once -#include "ra_fwd.h" - #include "data\NotifyTargetSet.hh" #include "services\ServiceLocator.hh" diff --git a/src/ui/OverlayTheme.hh b/src/ui/OverlayTheme.hh index 58adf6d2..0d11a66e 100644 --- a/src/ui/OverlayTheme.hh +++ b/src/ui/OverlayTheme.hh @@ -2,9 +2,9 @@ #define RA_UI_OVERLAY_THEME_H #pragma once -#include "ra_fwd.h" +#include "util\GSL.hh" -#include "ui/Types.hh" +#include "ui\Types.hh" namespace ra { namespace ui { diff --git a/src/ui/Theme.cpp b/src/ui/Theme.cpp index 789d9815..72ad458d 100644 --- a/src/ui/Theme.cpp +++ b/src/ui/Theme.cpp @@ -2,7 +2,7 @@ #include "OverlayTheme.hh" #include "RA_Json.h" -#include "RA_Log.h" +#include "util\Log.hh" #include "services\IFileSystem.hh" #include "services\ServiceLocator.hh" diff --git a/src/ui/ViewModelBase.hh b/src/ui/ViewModelBase.hh index faa35ebf..dc8feedb 100644 --- a/src/ui/ViewModelBase.hh +++ b/src/ui/ViewModelBase.hh @@ -2,8 +2,6 @@ #define RA_UI_VIEW_MODEL_BASE_H #pragma once -#include "ra_fwd.h" - #include "data\ModelBase.hh" #include "data\NotifyTargetSet.hh" @@ -36,7 +34,7 @@ public: void RemoveNotifyTarget(NotifyTarget& pTarget) noexcept { -#ifdef RA_UTEST +#ifdef DEBUG GSL_SUPPRESS_F6 Expects(!m_bDestructed); #endif m_vNotifyTargets.Remove(pTarget); diff --git a/src/ui/WindowViewModelBase.hh b/src/ui/WindowViewModelBase.hh index d3a916b4..92cbc871 100644 --- a/src/ui/WindowViewModelBase.hh +++ b/src/ui/WindowViewModelBase.hh @@ -4,7 +4,8 @@ #include "Types.hh" #include "ViewModelBase.hh" -#include "ra_utility.h" + +#include "util\TypeCasts.hh" namespace ra { namespace ui { diff --git a/src/ui/drawing/gdi/ImageRepository.cpp b/src/ui/drawing/gdi/ImageRepository.cpp index e8c7d5ee..bdbf6fbb 100644 --- a/src/ui/drawing/gdi/ImageRepository.cpp +++ b/src/ui/drawing/gdi/ImageRepository.cpp @@ -4,6 +4,7 @@ #include "RA_Defs.h" #include "RA_md5factory.h" +#include "util\Log.hh" #include "data\context\GameContext.hh" diff --git a/src/ui/drawing/gdi/ResourceRepository.hh b/src/ui/drawing/gdi/ResourceRepository.hh index f82fae87..a0d69d79 100644 --- a/src/ui/drawing/gdi/ResourceRepository.hh +++ b/src/ui/drawing/gdi/ResourceRepository.hh @@ -4,7 +4,7 @@ #include "ui\Types.hh" -#include "ra_utility.h" +#include "util\EnumOps.hh" namespace ra { namespace ui { diff --git a/src/ui/viewmodels/AssetEditorViewModel.cpp b/src/ui/viewmodels/AssetEditorViewModel.cpp index 13750ae6..0568f4de 100644 --- a/src/ui/viewmodels/AssetEditorViewModel.cpp +++ b/src/ui/viewmodels/AssetEditorViewModel.cpp @@ -13,6 +13,8 @@ #include "ui\viewmodels\FileDialogViewModel.hh" #include "ui\viewmodels\MessageBoxViewModel.hh" +#include "util\EnumOps.hh" + #include namespace ra { diff --git a/src/ui/viewmodels/AssetListViewModel.cpp b/src/ui/viewmodels/AssetListViewModel.cpp index dc06fb07..1593d227 100644 --- a/src/ui/viewmodels/AssetListViewModel.cpp +++ b/src/ui/viewmodels/AssetListViewModel.cpp @@ -21,7 +21,7 @@ #include "Exports.hh" #include "RA_BuildVer.h" -#include "RA_Log.h" +#include "util\Log.hh" namespace ra { namespace ui { diff --git a/src/ui/viewmodels/AssetUploadViewModel.cpp b/src/ui/viewmodels/AssetUploadViewModel.cpp index dcb60dc4..81a3c768 100644 --- a/src/ui/viewmodels/AssetUploadViewModel.cpp +++ b/src/ui/viewmodels/AssetUploadViewModel.cpp @@ -14,7 +14,7 @@ #include "ui\viewmodels\MessageBoxViewModel.hh" #include "RA_Defs.h" -#include "RA_Log.h" +#include "util\Log.hh" #include diff --git a/src/ui/viewmodels/BrokenAchievementsViewModel.cpp b/src/ui/viewmodels/BrokenAchievementsViewModel.cpp index 15f03e76..6c51237a 100644 --- a/src/ui/viewmodels/BrokenAchievementsViewModel.cpp +++ b/src/ui/viewmodels/BrokenAchievementsViewModel.cpp @@ -1,6 +1,6 @@ #include "BrokenAchievementsViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\SubmitTicket.hh" diff --git a/src/ui/viewmodels/ChallengeIndicatorViewModel.cpp b/src/ui/viewmodels/ChallengeIndicatorViewModel.cpp index 8c698c53..f7faa208 100644 --- a/src/ui/viewmodels/ChallengeIndicatorViewModel.cpp +++ b/src/ui/viewmodels/ChallengeIndicatorViewModel.cpp @@ -1,6 +1,6 @@ #include "ChallengeIndicatorViewModel.hh" -#include "ra_math.h" +#include "util\TypeCasts.hh" #include "ui\OverlayTheme.hh" #include "ui\viewmodels\OverlayManager.hh" diff --git a/src/ui/viewmodels/CodeNotesViewModel.cpp b/src/ui/viewmodels/CodeNotesViewModel.cpp index 5d81ec02..79012dd8 100644 --- a/src/ui/viewmodels/CodeNotesViewModel.cpp +++ b/src/ui/viewmodels/CodeNotesViewModel.cpp @@ -1,7 +1,7 @@ #include "CodeNotesViewModel.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameContext.hh" diff --git a/src/ui/viewmodels/GameChecksumViewModel.cpp b/src/ui/viewmodels/GameChecksumViewModel.cpp index 0951b615..4adcd9de 100644 --- a/src/ui/viewmodels/GameChecksumViewModel.cpp +++ b/src/ui/viewmodels/GameChecksumViewModel.cpp @@ -1,6 +1,6 @@ #include "GameChecksumViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameContext.hh" diff --git a/src/ui/viewmodels/IntegrationMenuViewModel.cpp b/src/ui/viewmodels/IntegrationMenuViewModel.cpp index 6b00c643..7bce7103 100644 --- a/src/ui/viewmodels/IntegrationMenuViewModel.cpp +++ b/src/ui/viewmodels/IntegrationMenuViewModel.cpp @@ -1,6 +1,6 @@ #include "IntegrationMenuViewModel.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Resource.h" #include "data/context/ConsoleContext.hh" diff --git a/src/ui/viewmodels/LoginViewModel.cpp b/src/ui/viewmodels/LoginViewModel.cpp index 420a23b9..a210ff5e 100644 --- a/src/ui/viewmodels/LoginViewModel.cpp +++ b/src/ui/viewmodels/LoginViewModel.cpp @@ -1,8 +1,8 @@ #include "LoginViewModel.hh" #include "Exports.hh" -#include "RA_Interface.h" -#include "RA_StringUtils.h" +#include "RAInterface\RA_Interface.h" +#include "util\Strings.hh" #include "api\impl\ConnectedServer.hh" diff --git a/src/ui/viewmodels/MemoryBookmarksViewModel.cpp b/src/ui/viewmodels/MemoryBookmarksViewModel.cpp index d687fa7b..b6e3a0a4 100644 --- a/src/ui/viewmodels/MemoryBookmarksViewModel.cpp +++ b/src/ui/viewmodels/MemoryBookmarksViewModel.cpp @@ -2,7 +2,7 @@ #include "RA_Defs.h" #include "RA_Json.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\Types.hh" #include "data\context\EmulatorContext.hh" diff --git a/src/ui/viewmodels/MemoryRegionsViewModel.cpp b/src/ui/viewmodels/MemoryRegionsViewModel.cpp index bcbe4446..2e71e7c5 100644 --- a/src/ui/viewmodels/MemoryRegionsViewModel.cpp +++ b/src/ui/viewmodels/MemoryRegionsViewModel.cpp @@ -1,7 +1,7 @@ #include "MemoryRegionsViewModel.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\ConsoleContext.hh" diff --git a/src/ui/viewmodels/MemoryWatchListViewModel.cpp b/src/ui/viewmodels/MemoryWatchListViewModel.cpp index 763628a4..7310270e 100644 --- a/src/ui/viewmodels/MemoryWatchListViewModel.cpp +++ b/src/ui/viewmodels/MemoryWatchListViewModel.cpp @@ -2,7 +2,7 @@ #include "RA_Defs.h" #include "RA_Json.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\Types.hh" #include "data\context\EmulatorContext.hh" diff --git a/src/ui/viewmodels/MemoryWatchViewModel.cpp b/src/ui/viewmodels/MemoryWatchViewModel.cpp index 4da2417e..15d4e060 100644 --- a/src/ui/viewmodels/MemoryWatchViewModel.cpp +++ b/src/ui/viewmodels/MemoryWatchViewModel.cpp @@ -2,7 +2,7 @@ #include "RA_Defs.h" #include "RA_Json.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\Types.hh" #include "data\context\ConsoleContext.hh" diff --git a/src/ui/viewmodels/NewAssetViewModel.cpp b/src/ui/viewmodels/NewAssetViewModel.cpp index fe78d3f1..54566b34 100644 --- a/src/ui/viewmodels/NewAssetViewModel.cpp +++ b/src/ui/viewmodels/NewAssetViewModel.cpp @@ -1,6 +1,6 @@ #include "NewAssetViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameContext.hh" diff --git a/src/ui/viewmodels/OverlayAchievementsPageViewModel.cpp b/src/ui/viewmodels/OverlayAchievementsPageViewModel.cpp index c9d10b78..13216d31 100644 --- a/src/ui/viewmodels/OverlayAchievementsPageViewModel.cpp +++ b/src/ui/viewmodels/OverlayAchievementsPageViewModel.cpp @@ -1,6 +1,6 @@ #include "OverlayAchievementsPageViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\FetchAchievementInfo.hh" diff --git a/src/ui/viewmodels/OverlayFriendsPageViewModel.cpp b/src/ui/viewmodels/OverlayFriendsPageViewModel.cpp index 41f8e233..78d77b59 100644 --- a/src/ui/viewmodels/OverlayFriendsPageViewModel.cpp +++ b/src/ui/viewmodels/OverlayFriendsPageViewModel.cpp @@ -1,6 +1,6 @@ #include "OverlayFriendsPageViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\FetchUserFriends.hh" diff --git a/src/ui/viewmodels/OverlayLeaderboardsPageViewModel.cpp b/src/ui/viewmodels/OverlayLeaderboardsPageViewModel.cpp index 33755d57..a0e79d5e 100644 --- a/src/ui/viewmodels/OverlayLeaderboardsPageViewModel.cpp +++ b/src/ui/viewmodels/OverlayLeaderboardsPageViewModel.cpp @@ -1,6 +1,6 @@ #include "OverlayLeaderboardsPageViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\FetchLeaderboardInfo.hh" diff --git a/src/ui/viewmodels/OverlayListPageViewModel.cpp b/src/ui/viewmodels/OverlayListPageViewModel.cpp index 310449cd..c871a779 100644 --- a/src/ui/viewmodels/OverlayListPageViewModel.cpp +++ b/src/ui/viewmodels/OverlayListPageViewModel.cpp @@ -1,7 +1,7 @@ #include "OverlayListPageViewModel.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" +#include "util\TypeCasts.hh" #include "services\IThreadPool.hh" diff --git a/src/ui/viewmodels/OverlayManager.cpp b/src/ui/viewmodels/OverlayManager.cpp index 7adbf114..46d86f1c 100644 --- a/src/ui/viewmodels/OverlayManager.cpp +++ b/src/ui/viewmodels/OverlayManager.cpp @@ -1,6 +1,6 @@ #include "OverlayManager.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "services\IClock.hh" #include "services\IConfiguration.hh" diff --git a/src/ui/viewmodels/OverlayManager.hh b/src/ui/viewmodels/OverlayManager.hh index 6f1c8dbb..452d10d7 100644 --- a/src/ui/viewmodels/OverlayManager.hh +++ b/src/ui/viewmodels/OverlayManager.hh @@ -1,7 +1,7 @@ #ifndef RA_UI_OVERLAY_MANAGER_H #define RA_UI_OVERLAY_MANAGER_H -#include "RA_Interface.h" +#include "RAInterface\RA_Interface.h" #include "OverlayViewModel.hh" #include "ChallengeIndicatorViewModel.hh" diff --git a/src/ui/viewmodels/OverlayRecentGamesPageViewModel.cpp b/src/ui/viewmodels/OverlayRecentGamesPageViewModel.cpp index 92df6f1d..88c7c53d 100644 --- a/src/ui/viewmodels/OverlayRecentGamesPageViewModel.cpp +++ b/src/ui/viewmodels/OverlayRecentGamesPageViewModel.cpp @@ -1,6 +1,6 @@ #include "OverlayRecentGamesPageViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\impl\OfflineServer.hh" diff --git a/src/ui/viewmodels/OverlayViewModel.cpp b/src/ui/viewmodels/OverlayViewModel.cpp index 1ca96540..fbafdb91 100644 --- a/src/ui/viewmodels/OverlayViewModel.cpp +++ b/src/ui/viewmodels/OverlayViewModel.cpp @@ -1,7 +1,6 @@ #include "OverlayViewModel.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\EmulatorContext.hh" #include "data\context\UserContext.hh" diff --git a/src/ui/viewmodels/OverlayViewModel.hh b/src/ui/viewmodels/OverlayViewModel.hh index 24c6384c..30229328 100644 --- a/src/ui/viewmodels/OverlayViewModel.hh +++ b/src/ui/viewmodels/OverlayViewModel.hh @@ -3,7 +3,7 @@ #include "PopupViewModelBase.hh" -#include "RA_Interface.h" +#include "RAInterface\RA_Interface.h" namespace ra { namespace ui { diff --git a/src/ui/viewmodels/PointerFinderViewModel.cpp b/src/ui/viewmodels/PointerFinderViewModel.cpp index 74d3fe32..95934736 100644 --- a/src/ui/viewmodels/PointerFinderViewModel.cpp +++ b/src/ui/viewmodels/PointerFinderViewModel.cpp @@ -1,7 +1,7 @@ #include "PointerFinderViewModel.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data/context/EmulatorContext.hh" #include "data/context/GameContext.hh" diff --git a/src/ui/viewmodels/PopupViewModelBase.cpp b/src/ui/viewmodels/PopupViewModelBase.cpp index c1c12e39..583a661f 100644 --- a/src/ui/viewmodels/PopupViewModelBase.cpp +++ b/src/ui/viewmodels/PopupViewModelBase.cpp @@ -1,6 +1,6 @@ #include "PopupViewModelBase.hh" -#include "ra_math.h" +#include "util\TypeCasts.hh" #include "services\IConfiguration.hh" diff --git a/src/ui/viewmodels/ProgressTrackerViewModel.cpp b/src/ui/viewmodels/ProgressTrackerViewModel.cpp index 9d76df79..b4293341 100644 --- a/src/ui/viewmodels/ProgressTrackerViewModel.cpp +++ b/src/ui/viewmodels/ProgressTrackerViewModel.cpp @@ -1,7 +1,5 @@ #include "ProgressTrackerViewModel.hh" -#include "ra_math.h" - #include "ui\OverlayTheme.hh" #include "ui\viewmodels\OverlayManager.hh" diff --git a/src/ui/viewmodels/RichPresenceMonitorViewModel.cpp b/src/ui/viewmodels/RichPresenceMonitorViewModel.cpp index f6f791e6..98b39d47 100644 --- a/src/ui/viewmodels/RichPresenceMonitorViewModel.cpp +++ b/src/ui/viewmodels/RichPresenceMonitorViewModel.cpp @@ -1,6 +1,6 @@ #include "RichPresenceMonitorViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameContext.hh" diff --git a/src/ui/viewmodels/ScoreTrackerViewModel.cpp b/src/ui/viewmodels/ScoreTrackerViewModel.cpp index 3d2b98d4..c34af9af 100644 --- a/src/ui/viewmodels/ScoreTrackerViewModel.cpp +++ b/src/ui/viewmodels/ScoreTrackerViewModel.cpp @@ -1,7 +1,5 @@ #include "ScoreTrackerViewModel.hh" -#include "ra_math.h" - #include "ui\OverlayTheme.hh" #include "ui\viewmodels\OverlayManager.hh" diff --git a/src/ui/viewmodels/ScoreboardViewModel.cpp b/src/ui/viewmodels/ScoreboardViewModel.cpp index 96c52fc8..64d6d78f 100644 --- a/src/ui/viewmodels/ScoreboardViewModel.cpp +++ b/src/ui/viewmodels/ScoreboardViewModel.cpp @@ -1,6 +1,6 @@ #include "ScoreboardViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui\OverlayTheme.hh" diff --git a/src/ui/viewmodels/TriggerConditionViewModel.cpp b/src/ui/viewmodels/TriggerConditionViewModel.cpp index 8cee3bf3..82e1fd92 100644 --- a/src/ui/viewmodels/TriggerConditionViewModel.cpp +++ b/src/ui/viewmodels/TriggerConditionViewModel.cpp @@ -1,7 +1,7 @@ #include "TriggerConditionViewModel.hh" #include "RA_Defs.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameContext.hh" #include "data\models\TriggerValidation.hh" diff --git a/src/ui/viewmodels/TriggerConditionViewModel.hh b/src/ui/viewmodels/TriggerConditionViewModel.hh index f950c8c2..3da58f16 100644 --- a/src/ui/viewmodels/TriggerConditionViewModel.hh +++ b/src/ui/viewmodels/TriggerConditionViewModel.hh @@ -2,14 +2,14 @@ #define RA_UI_TRIGGERCONDITIONVIEWMODEL_H #pragma once -#include "ui\ViewModelBase.hh" -#include "ui\Types.hh" - #include "data\Types.hh" #include "services\AchievementLogicSerializer.hh" -#include "ra_utility.h" +#include "ui\ViewModelBase.hh" +#include "ui\Types.hh" + +#include "util\TypeCasts.hh" struct rc_condition_t; diff --git a/src/ui/viewmodels/TriggerViewModel.cpp b/src/ui/viewmodels/TriggerViewModel.cpp index bbdf0e03..c654ec97 100644 --- a/src/ui/viewmodels/TriggerViewModel.cpp +++ b/src/ui/viewmodels/TriggerViewModel.cpp @@ -4,7 +4,7 @@ #include #include -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\models\TriggerValidation.hh" diff --git a/src/ui/viewmodels/UnknownGameViewModel.cpp b/src/ui/viewmodels/UnknownGameViewModel.cpp index f523193e..3637d12c 100644 --- a/src/ui/viewmodels/UnknownGameViewModel.cpp +++ b/src/ui/viewmodels/UnknownGameViewModel.cpp @@ -1,6 +1,6 @@ #include "UnknownGameViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\FetchGamesList.hh" #include "api\SubmitNewTitle.hh" diff --git a/src/ui/win32/AssetEditorDialog.cpp b/src/ui/win32/AssetEditorDialog.cpp index 9759eb20..41c46ffa 100644 --- a/src/ui/win32/AssetEditorDialog.cpp +++ b/src/ui/win32/AssetEditorDialog.cpp @@ -16,6 +16,9 @@ #include "ui\win32\bindings\GridNumberColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::data::models::AssetModelBase; using ra::data::models::AchievementModel; using ra::ui::viewmodels::AssetEditorViewModel; diff --git a/src/ui/win32/AssetListDialog.cpp b/src/ui/win32/AssetListDialog.cpp index 9eac77e5..d0689054 100644 --- a/src/ui/win32/AssetListDialog.cpp +++ b/src/ui/win32/AssetListDialog.cpp @@ -11,6 +11,9 @@ #include "ui\win32\bindings\GridNumberColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::data::models::AssetModelBase; using ra::ui::viewmodels::AssetListViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/BrokenAchievementsDialog.cpp b/src/ui/win32/BrokenAchievementsDialog.cpp index 2fc0f077..41774aa7 100644 --- a/src/ui/win32/BrokenAchievementsDialog.cpp +++ b/src/ui/win32/BrokenAchievementsDialog.cpp @@ -8,6 +8,8 @@ #include "ui\win32\bindings\GridCheckBoxColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" + using ra::ui::viewmodels::BrokenAchievementsViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/CodeNotesDialog.cpp b/src/ui/win32/CodeNotesDialog.cpp index eeeb752d..41b925b8 100644 --- a/src/ui/win32/CodeNotesDialog.cpp +++ b/src/ui/win32/CodeNotesDialog.cpp @@ -1,6 +1,5 @@ #include "CodeNotesDialog.hh" -#include "RA_Log.h" #include "RA_Resource.h" #include "ui\IDesktop.hh" @@ -10,6 +9,9 @@ #include "ui\win32\bindings\GridAddressColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::CodeNotesViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/Desktop.cpp b/src/ui/win32/Desktop.cpp index e4f266ad..6f6ceaf4 100644 --- a/src/ui/win32/Desktop.cpp +++ b/src/ui/win32/Desktop.cpp @@ -28,7 +28,7 @@ #include "ui/win32/bindings/ControlBinding.hh" #include "ui/win32/bindings/MemoryViewerControlBinding.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include diff --git a/src/ui/win32/DialogBase.cpp b/src/ui/win32/DialogBase.cpp index dd6942f0..0f0f71a8 100644 --- a/src/ui/win32/DialogBase.cpp +++ b/src/ui/win32/DialogBase.cpp @@ -5,9 +5,9 @@ #include "ui\win32\bindings\NumericUpDownBinding.hh" #include "ui\win32\bindings\WindowBinding.hh" -#include "RA_Core.h" // g_RAMainWnd, g_hThisDLLInst +#include "util\EnumOps.hh" -#include "ra_utility.h" +#include "RA_Core.h" // g_RAMainWnd, g_hThisDLLInst #define WM_QUEUED_ACTION WM_USER + 1 @@ -72,8 +72,8 @@ void DialogBase::Destroy() noexcept } } -_Use_decl_annotations_ HWND DialogBase::CreateDialogWindow(const TCHAR* restrict sResourceId, - IDialogPresenter* const restrict pDialogPresenter) noexcept +_Use_decl_annotations_ HWND DialogBase::CreateDialogWindow(const TCHAR* _RESTRICT sResourceId, + IDialogPresenter* const _RESTRICT pDialogPresenter) noexcept { GSL_SUPPRESS_TYPE1 m_hWnd = ::CreateDialogParam(g_hThisDLLInst, sResourceId, g_RAMainWnd, StaticDialogProc, reinterpret_cast(this)); if (m_hWnd) @@ -107,8 +107,8 @@ static INT_PTR CALLBACK StaticModalDialogProc(HWND hDlg, UINT uMsg, WPARAM wPara return result; } -_Use_decl_annotations_ void DialogBase::CreateModalWindow(const TCHAR* restrict sResourceId, - IDialogPresenter* const restrict pDialogPresenter, +_Use_decl_annotations_ void DialogBase::CreateModalWindow(const TCHAR* _RESTRICT sResourceId, + IDialogPresenter* const _RESTRICT pDialogPresenter, HWND hParentWnd) noexcept { m_pDialogPresenter = pDialogPresenter; diff --git a/src/ui/win32/DialogBase.hh b/src/ui/win32/DialogBase.hh index 63825aa3..7c1203d3 100644 --- a/src/ui/win32/DialogBase.hh +++ b/src/ui/win32/DialogBase.hh @@ -29,8 +29,8 @@ public: /// The resource identifier defining the dialog. /// Callback to call when the dialog is closed. /// Handle of the window. - _NODISCARD HWND CreateDialogWindow(_In_ const TCHAR* restrict sResourceId, - _In_ IDialogPresenter* const restrict pDialogPresenter) noexcept; + _NODISCARD HWND CreateDialogWindow(_In_ const TCHAR* _RESTRICT sResourceId, + _In_ IDialogPresenter* const _RESTRICT pDialogPresenter) noexcept; /// /// Creates the dialog window and does not return until the window is closed. @@ -38,8 +38,8 @@ public: /// The resource identifier defining the dialog. /// Callback to call when the dialog is closed. /// Window to use as the parent of the modal window. - void CreateModalWindow(_In_ const TCHAR* restrict sResourceId, - _In_ IDialogPresenter* const restrict pDialogPresenter, HWND hParentWnd) noexcept; + void CreateModalWindow(_In_ const TCHAR* _RESTRICT sResourceId, + _In_ IDialogPresenter* const _RESTRICT pDialogPresenter, HWND hParentWnd) noexcept; /// /// Gets the for the dialog. diff --git a/src/ui/win32/FileDialog.cpp b/src/ui/win32/FileDialog.cpp index 336e9e34..b36e097e 100644 --- a/src/ui/win32/FileDialog.cpp +++ b/src/ui/win32/FileDialog.cpp @@ -1,6 +1,6 @@ #include "FileDialog.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "services/ServiceLocator.hh" diff --git a/src/ui/win32/MemoryBookmarksDialog.cpp b/src/ui/win32/MemoryBookmarksDialog.cpp index 7361c5ab..33fb16fb 100644 --- a/src/ui/win32/MemoryBookmarksDialog.cpp +++ b/src/ui/win32/MemoryBookmarksDialog.cpp @@ -14,6 +14,9 @@ #include "ui\win32\bindings\GridNumberColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::MemoryBookmarksViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/MemoryInspectorDialog.cpp b/src/ui/win32/MemoryInspectorDialog.cpp index 809273ba..ebf6b4a4 100644 --- a/src/ui/win32/MemoryInspectorDialog.cpp +++ b/src/ui/win32/MemoryInspectorDialog.cpp @@ -10,6 +10,9 @@ #include "ui\win32\bindings\GridNumberColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::MemoryInspectorViewModel; using ra::ui::viewmodels::MemorySearchViewModel; using ra::ui::viewmodels::MemoryViewerViewModel; diff --git a/src/ui/win32/MemoryRegionsDialog.cpp b/src/ui/win32/MemoryRegionsDialog.cpp index efbfd9d6..cbb3e630 100644 --- a/src/ui/win32/MemoryRegionsDialog.cpp +++ b/src/ui/win32/MemoryRegionsDialog.cpp @@ -1,6 +1,5 @@ #include "MemoryRegionsDialog.hh" -#include "RA_Log.h" #include "RA_Resource.h" #include "ui\IDesktop.hh" @@ -10,6 +9,9 @@ #include "ui\win32\bindings\GridAddressColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::MemoryRegionsViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/MessageBoxDialog.cpp b/src/ui/win32/MessageBoxDialog.cpp index e32f4c03..e2a8b7af 100644 --- a/src/ui/win32/MessageBoxDialog.cpp +++ b/src/ui/win32/MessageBoxDialog.cpp @@ -1,6 +1,6 @@ #include "MessageBoxDialog.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "services/ServiceLocator.hh" diff --git a/src/ui/win32/PointerFinderDialog.cpp b/src/ui/win32/PointerFinderDialog.cpp index 28def20c..ade08da4 100644 --- a/src/ui/win32/PointerFinderDialog.cpp +++ b/src/ui/win32/PointerFinderDialog.cpp @@ -1,13 +1,15 @@ #include "PointerFinderDialog.hh" #include "RA_Defs.h" -#include "RA_Log.h" #include "RA_Resource.h" #include "ui/viewmodels/WindowManager.hh" #include "ui/win32/bindings/GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::PointerFinderViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/PointerInspectorDialog.cpp b/src/ui/win32/PointerInspectorDialog.cpp index 0da2777c..58e96cf4 100644 --- a/src/ui/win32/PointerInspectorDialog.cpp +++ b/src/ui/win32/PointerInspectorDialog.cpp @@ -1,7 +1,6 @@ #include "PointerInspectorDialog.hh" #include "RA_Defs.h" -#include "RA_Log.h" #include "RA_Resource.h" #include "ui\viewmodels\WindowManager.hh" @@ -13,6 +12,9 @@ #include "ui\win32\bindings\GridNumberColumnBinding.hh" #include "ui\win32\bindings\GridTextColumnBinding.hh" +#include "util\EnumOps.hh" +#include "util\Log.hh" + using ra::ui::viewmodels::PointerInspectorViewModel; using ra::ui::win32::bindings::GridColumnBinding; diff --git a/src/ui/win32/ProgressDialog.cpp b/src/ui/win32/ProgressDialog.cpp index e30ed1f9..028398aa 100644 --- a/src/ui/win32/ProgressDialog.cpp +++ b/src/ui/win32/ProgressDialog.cpp @@ -1,6 +1,6 @@ #include "ProgressDialog.hh" -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Resource.h" using ra::ui::viewmodels::ProgressViewModel; diff --git a/src/ui/win32/RichPresenceDialog.cpp b/src/ui/win32/RichPresenceDialog.cpp index e966c20a..af99a2cc 100644 --- a/src/ui/win32/RichPresenceDialog.cpp +++ b/src/ui/win32/RichPresenceDialog.cpp @@ -1,8 +1,10 @@ #include "RichPresenceDialog.hh" -#include "RA_Log.h" #include "RA_Resource.h" +#include "util\EnumOps.hh" +#include "util\Log.hh" + namespace ra { namespace ui { namespace win32 { diff --git a/src/ui/win32/bindings/ComboBoxBinding.hh b/src/ui/win32/bindings/ComboBoxBinding.hh index b7b5eebd..d0a45069 100644 --- a/src/ui/win32/bindings/ComboBoxBinding.hh +++ b/src/ui/win32/bindings/ComboBoxBinding.hh @@ -4,7 +4,7 @@ #include "ControlBinding.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui\ViewModelCollection.hh" #include "ui\viewmodels\LookupItemViewModel.hh" diff --git a/src/ui/win32/bindings/GridAddressColumnBinding.cpp b/src/ui/win32/bindings/GridAddressColumnBinding.cpp index e18666ef..326b8d13 100644 --- a/src/ui/win32/bindings/GridAddressColumnBinding.cpp +++ b/src/ui/win32/bindings/GridAddressColumnBinding.cpp @@ -2,8 +2,7 @@ #include "GridBinding.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui/viewmodels/WindowManager.hh" diff --git a/src/ui/win32/bindings/GridBinding.cpp b/src/ui/win32/bindings/GridBinding.cpp index 51a54441..668fe80a 100644 --- a/src/ui/win32/bindings/GridBinding.cpp +++ b/src/ui/win32/bindings/GridBinding.cpp @@ -1,6 +1,6 @@ #include "GridBinding.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "GridCheckBoxColumnBinding.hh" #include "GridTextColumnBinding.hh" diff --git a/src/ui/win32/bindings/GridBinding.hh b/src/ui/win32/bindings/GridBinding.hh index 7df9eaca..aeff625e 100644 --- a/src/ui/win32/bindings/GridBinding.hh +++ b/src/ui/win32/bindings/GridBinding.hh @@ -145,14 +145,14 @@ private: HWND m_hTooltip = nullptr; int m_nTooltipLocation = 0; - ra::tstring m_sTooltip; + std::wstring m_sTooltip; const IntModelProperty* m_pRowColorProperty = nullptr; const IntModelProperty* m_pScrollOffsetProperty = nullptr; const IntModelProperty* m_pScrollMaximumProperty = nullptr; const IntModelProperty* m_pVisibleItemCountProperty = nullptr; - ra::tstring m_sDispInfo; + std::wstring m_sDispInfo; std::function m_fUpdateSelectedItems = nullptr; std::function m_fSetSelectedItemValues = nullptr; diff --git a/src/ui/win32/bindings/GridLookupColumnBinding.cpp b/src/ui/win32/bindings/GridLookupColumnBinding.cpp index d6e0af6a..347561df 100644 --- a/src/ui/win32/bindings/GridLookupColumnBinding.cpp +++ b/src/ui/win32/bindings/GridLookupColumnBinding.cpp @@ -2,8 +2,8 @@ #include "GridBinding.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" +#include "util\TypeCasts.hh" #include "ui\viewmodels\MessageBoxViewModel.hh" diff --git a/src/ui/win32/bindings/GridNumberColumnBinding.cpp b/src/ui/win32/bindings/GridNumberColumnBinding.cpp index 67e7c396..ff180064 100644 --- a/src/ui/win32/bindings/GridNumberColumnBinding.cpp +++ b/src/ui/win32/bindings/GridNumberColumnBinding.cpp @@ -2,8 +2,7 @@ #include "GridBinding.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui\viewmodels\MessageBoxViewModel.hh" diff --git a/src/ui/win32/bindings/GridTextColumnBinding.cpp b/src/ui/win32/bindings/GridTextColumnBinding.cpp index 7fe1d8f6..3a7f4b89 100644 --- a/src/ui/win32/bindings/GridTextColumnBinding.cpp +++ b/src/ui/win32/bindings/GridTextColumnBinding.cpp @@ -2,8 +2,7 @@ #include "GridBinding.hh" -#include "ra_math.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "ui\viewmodels\MessageBoxViewModel.hh" diff --git a/src/ui/win32/bindings/MemoryViewerControlBinding.cpp b/src/ui/win32/bindings/MemoryViewerControlBinding.cpp index 48ab1296..0c0b0361 100644 --- a/src/ui/win32/bindings/MemoryViewerControlBinding.cpp +++ b/src/ui/win32/bindings/MemoryViewerControlBinding.cpp @@ -1,8 +1,5 @@ #include "MemoryViewerControlBinding.hh" -#include "ra_fwd.h" -#include "ra_utility.h" - #include "ui/EditorTheme.hh" #include "ui/drawing/gdi/GDISurface.hh" diff --git a/src/ui/win32/bindings/MultiLineGridBinding.cpp b/src/ui/win32/bindings/MultiLineGridBinding.cpp index 7b822314..2d8aa681 100644 --- a/src/ui/win32/bindings/MultiLineGridBinding.cpp +++ b/src/ui/win32/bindings/MultiLineGridBinding.cpp @@ -3,7 +3,7 @@ #include "GridCheckBoxColumnBinding.hh" #include "GridTextColumnBinding.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace ui { diff --git a/src/ui/win32/bindings/NumericTextBoxBinding.hh b/src/ui/win32/bindings/NumericTextBoxBinding.hh index e26c4812..0a9dd111 100644 --- a/src/ui/win32/bindings/NumericTextBoxBinding.hh +++ b/src/ui/win32/bindings/NumericTextBoxBinding.hh @@ -6,7 +6,7 @@ #include "ui\viewmodels\MessageBoxViewModel.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace ui { diff --git a/src/ui/win32/bindings/WindowBinding.cpp b/src/ui/win32/bindings/WindowBinding.cpp index 843467ee..9a399e0d 100644 --- a/src/ui/win32/bindings/WindowBinding.cpp +++ b/src/ui/win32/bindings/WindowBinding.cpp @@ -1,7 +1,7 @@ #include "WindowBinding.hh" #include "RA_Core.h" -#include "RA_Log.h" +#include "util\Log.hh" #include "RA_Resource.h" #include "data\ModelProperty.hh" diff --git a/tests/Exports_Tests.cpp b/tests/Exports_Tests.cpp index 54dea17d..fbc4f131 100644 --- a/tests/Exports_Tests.cpp +++ b/tests/Exports_Tests.cpp @@ -3,7 +3,7 @@ #include "Exports.hh" #include "RA_BuildVer.h" -#include "RA_Emulators.h" +#include "RAInterface\RA_Emulators.h" #include "RA_Resource.h" #include "tests\mocks\MockAchievementRuntime.hh" diff --git a/tests/RA_Integration.Tests.vcxproj b/tests/RA_Integration.Tests.vcxproj index c35056c2..f0a63767 100644 --- a/tests/RA_Integration.Tests.vcxproj +++ b/tests/RA_Integration.Tests.vcxproj @@ -17,14 +17,6 @@ Debug x64 - - Release-xp - Win32 - - - Release-xp - x64 - Release Win32 @@ -34,248 +26,52 @@ x64 - - 15.0 - {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7} - Win32Proj - RA_IntegrationTests - NativeUnitTestProject - 10.0 - DynamicLibrary - Unicode - false - v143 - - - v142 - - - v141 - - - + Designer + + RA_Integration.Tests + {876DEBDF-C7C8-4713-8CEF-EBDEE65306A7} + ra.tests + NativeUnitTestProject + DynamicLibrary + 10.0 + v143 + Unicode + + + + + + + + + + RC_CLIENT_SUPPORTS_HASH;RA_UTEST;%(PreprocessorDefinitions) + $(SolutionDir);$(RapidJSON_IncludeDir);%(AdditionalIncludeDirectories) + Use + pch.h + pch.h + + + windowscodecs.lib;winmm.lib;Winhttp.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) + + + + {8ae21d54-f905-44e1-90e5-d22e346bff39} + + + {825cb292-f069-4b27-82cf-3417746acdf3} + {9d55ebe7-1392-4fa1-a9b9-f022f764ce35} - - true - - - true - - - false - true - - - false - v141_xp - true - - - - - - - - - - - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\tests\RA_Integration\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\tests\RA_Integration\ - - - true - - - true - ..\src\ra_rules.ruleset - true - $(RapidJSON_IncludeDir);$(CAExcludePath) - - - false - - - false - - - - Disabled - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - true - 4201 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - true - 4201 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;RA_ANALYSIS;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - 4201 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;RA_ANALYSIS;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - 4201 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - MaxSpeed - true - true - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - MaxSpeed - true - true - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;RA_V141_XP;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - MaxSpeed - true - true - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - MaxSpeed - true - true - $(RA_IncludePath);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;RA_V141_XP;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - @@ -302,19 +98,11 @@ - Create - Create - Create - Create - Create - Create - Create - Create + Create - @@ -382,7 +170,6 @@ - @@ -405,7 +192,6 @@ - @@ -479,6 +265,4 @@ - - \ No newline at end of file diff --git a/tests/RA_Integration.Tests.vcxproj.filters b/tests/RA_Integration.Tests.vcxproj.filters index 756b6feb..f181d804 100644 --- a/tests/RA_Integration.Tests.vcxproj.filters +++ b/tests/RA_Integration.Tests.vcxproj.filters @@ -57,9 +57,6 @@ Code - - Code - Tests\Services @@ -183,9 +180,6 @@ Code - - Tests\Services - Tests\Interface @@ -336,18 +330,12 @@ Tests\Data\Context - - Tests\Data - Tests\Data Code - - Code - Tests\Data @@ -518,7 +506,7 @@ - + diff --git a/tests/RA_Interface.Tests.vcxproj b/tests/RA_Interface.Tests.vcxproj index 5ef67292..6c827239 100644 --- a/tests/RA_Interface.Tests.vcxproj +++ b/tests/RA_Interface.Tests.vcxproj @@ -9,14 +9,6 @@ Debug x64 - - Release-xp - Win32 - - - Release-xp - x64 - Release Win32 @@ -26,36 +18,22 @@ x64 + + + Designer + + - 15.0 + RA_Interface.Tests {F78C2C8B-55DD-4252-A38F-F4D252D14DF8} - Win32Proj - RA_InterfaceTests + ra.tests NativeUnitTestProject - 10.0 DynamicLibrary - MultiByte - false + 10.0 v143 - - - v142 - - - v141 + Unicode - - true - - - false - true - - - false - true - @@ -63,237 +41,24 @@ + - - - $(SolutionDir)bin\$(Platform)\$(Configuration)\tests\RA_Interface\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\tests\RA_Interface\ - - - true - - - false - - - false - - + - Disabled - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - true - 4201 - NotUsing + RA_UTEST;%(PreprocessorDefinitions) Level3 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) + Winhttp.lib;%(AdditionalDependencies) - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - false - true - 4201 - NotUsing - Level3 - - - - - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - DebugFull - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) - - - - - NotUsing - Level3 - Disabled - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - RA_UTEST;_DEBUG;%(PreprocessorDefinitions) - true - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - NotUsing - Level3 - - - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Disabled - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - NotUsing - Level3 - - - - - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - MaxSpeed - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - NotUsing - Level3 - - - - - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) - - - - - MaxSpeed - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - WIN32;RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - MultiThreaded - 4201 - NotUsing - Level3 - - - - - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;Winhttp.lib;%(AdditionalDependencies) - - - - - Level3 - NotUsing - Disabled - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - - - - - Level3 - NotUsing - Disabled - true - true - $(VCInstallDir)UnitTest\include\;$(SolutionDir)src\;%(AdditionalIncludeDirectories) - RA_UTEST;NDEBUG;%(PreprocessorDefinitions) - true - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - if not exist "$(SolutionDir)src\RA_BuildVer.h" "$(SolutionDir)RAInterface\MakeBuildVer.bat" "$(SolutionDir)src\RA_BuildVer.h" RAIntegration RA_INTEGRATION - + + + {825cb292-f069-4b27-82cf-3417746acdf3} + + - - \ No newline at end of file diff --git a/tests/RA_Interface.Tests.vcxproj.filters b/tests/RA_Interface.Tests.vcxproj.filters index e8b93832..be599946 100644 --- a/tests/RA_Interface.Tests.vcxproj.filters +++ b/tests/RA_Interface.Tests.vcxproj.filters @@ -3,4 +3,7 @@ + + + \ No newline at end of file diff --git a/tests/RA_Interface_Tests.cpp b/tests/RA_Interface_Tests.cpp index c8140449..cb294325 100644 --- a/tests/RA_Interface_Tests.cpp +++ b/tests/RA_Interface_Tests.cpp @@ -27,11 +27,11 @@ static std::wstring GetIntegrationPath(const wchar_t* sFilename) // - bin/release/RA_Integration.dll // - bin/release/tests/RA_Interface.tests.dll - wchar_t sBuffer[2048]; + wchar_t sBuffer[2048] = L""; HMODULE hm; if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - (LPCSTR)&GetIntegrationPath, &hm)) + (LPCWSTR)&GetIntegrationPath, &hm)) { swprintf_s(sBuffer, sizeof(sBuffer) / sizeof(sBuffer[0]), L"GetModuleHandle failed with error %d", GetLastError()); Assert::Fail(sBuffer); diff --git a/tests/RA_UnitTestHelpers.h b/tests/RA_UnitTestHelpers.h index 681954af..cb10439d 100644 --- a/tests/RA_UnitTestHelpers.h +++ b/tests/RA_UnitTestHelpers.h @@ -2,9 +2,7 @@ #define RA_UNITTESTHELPERS_H #pragma once -#include "ra_utility.h" - -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\Types.hh" diff --git a/tests/base.props b/tests/base.props deleted file mode 100644 index 1b92111c..00000000 --- a/tests/base.props +++ /dev/null @@ -1,82 +0,0 @@ - - - - - $(VCInstallDir)UnitTest\include\ - $(SolutionDir) - $(RA_DIR)rapidjson\include\ - $(RA_DIR)rcheevos\include\ - $(RA_DIR)RAInterface - $(RA_DIR)src\ - $(RA_DIR)GSL\include\ - $(RA_DIR)lua\ - $(RA_DIR);$(RA_SourceDir);$(RAInterface_IncludePath);$(RapidJSON_IncludeDir);$(rcheevos_IncludePath);$(Lua_Dir);$(MSTest_IncludePath);$(GSL_IncludeDir) - false - - - $(SolutionDir)bin\$(Configuration)\ - $(SolutionDir)obj\$(Configuration)\ - - - - Guard - - - - - true - true - stdcpp17 - CompileAsCpp - $(RA_IncludePath) - ProgramDatabase - RA_UTEST;RA_EXPORTS;RC_CLIENT_SUPPORTS_HASH;RC_DISABLE_LUA;%(PreprocessorDefinitions) - Use - pch.h - pch.h - true - Level4 - - - $(OutDir)\$(TargetName).pdb - - - - - $(RA_DIR) - true - - - $(RapidJSON_IncludeDir) - true - - - $(rcheevos_IncludePath) - true - - - $(RAInterface_IncludePath) - true - - - $(RA_SourceDir) - true - - - $(GSL_IncludeDir) - true - - - $(Lua_Dir) - true - - - $(RA_IncludePath) - true - - - $(XPDeprecationWarning) - true - - - diff --git a/tests/data/DataModelBase_Tests.cpp b/tests/data/DataModelBase_Tests.cpp index ef091cb5..04d59710 100644 --- a/tests/data/DataModelBase_Tests.cpp +++ b/tests/data/DataModelBase_Tests.cpp @@ -1,7 +1,5 @@ #include "data\DataModelBase.hh" -#include "ra_fwd.h" - using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace ra { diff --git a/tests/data/ModelPropertyContainer_Tests.cpp b/tests/data/ModelPropertyContainer_Tests.cpp index daa79677..df03153d 100644 --- a/tests/data/ModelPropertyContainer_Tests.cpp +++ b/tests/data/ModelPropertyContainer_Tests.cpp @@ -1,7 +1,5 @@ #include "data\ModelPropertyContainer.hh" -#include "ra_fwd.h" - using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace ra { diff --git a/tests/data/NotifyTargetSet_Tests.cpp b/tests/data/NotifyTargetSet_Tests.cpp index 46999dc5..5df33bb7 100644 --- a/tests/data/NotifyTargetSet_Tests.cpp +++ b/tests/data/NotifyTargetSet_Tests.cpp @@ -1,7 +1,5 @@ #include "data\NotifyTargetSet.hh" -#include "ra_fwd.h" - using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace ra { diff --git a/tests/data/context/GameAssets_Tests.cpp b/tests/data/context/GameAssets_Tests.cpp index 8f334b0a..a2fd33fb 100644 --- a/tests/data/context/GameAssets_Tests.cpp +++ b/tests/data/context/GameAssets_Tests.cpp @@ -35,7 +35,7 @@ public: GameAssetsHarness() noexcept { GSL_SUPPRESS_F6 mockGameContext.SetGameTitle(L"GameName"); - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); } void SaveAllAssets() diff --git a/tests/data/models/AchievementModel_Tests.cpp b/tests/data/models/AchievementModel_Tests.cpp index 81cdf8ae..785c7e92 100644 --- a/tests/data/models/AchievementModel_Tests.cpp +++ b/tests/data/models/AchievementModel_Tests.cpp @@ -27,9 +27,9 @@ private: class AchievementModelHarness : public AchievementModel { public: - AchievementModelHarness() + AchievementModelHarness() noexcept { - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); } ra::data::context::mocks::MockGameContext mockGameContext; diff --git a/tests/data/models/CodeNoteModel_Tests.cpp b/tests/data/models/CodeNoteModel_Tests.cpp index 607cbb4c..a618cd09 100644 --- a/tests/data/models/CodeNoteModel_Tests.cpp +++ b/tests/data/models/CodeNoteModel_Tests.cpp @@ -639,10 +639,10 @@ public: CodeNoteModelHarness note; note.mockConsoleContext.AddMemoryRegion(0, 0x7F, ra::data::context::ConsoleContext::AddressType::SystemRAM, 0x80000000); std::array memory{}; - memory[0x04] = 0x10; // pointer@0x04 = 0x80000010 - memory[0x07] = 0x80; - memory[0x14] = 0x20; // pointer@0x14 = 0x80000020 - memory[0x17] = 0x80; + memory.at(0x04) = 0x10; // pointer@0x04 = 0x80000010 + memory.at(0x07) = 0x80; + memory.at(0x14) = 0x20; // pointer@0x14 = 0x80000020 + memory.at(0x17) = 0x80; note.mockEmulatorContext.MockMemory(memory); const std::wstring sNote = L"[32-bit pointer] root\r\n" @@ -669,10 +669,10 @@ public: CodeNoteModelHarness note; note.mockConsoleContext.AddMemoryRegion(0, 0x7F, ra::data::context::ConsoleContext::AddressType::SystemRAM, 0x80000000); std::array memory{}; - memory[0x04] = 0x10; // pointer@0x04 = 0x80000010 - memory[0x07] = 0x80; - memory[0x08] = 0x20; // pointer@0x08 = 0x80000020 - memory[0x0B] = 0x80; + memory.at(0x04) = 0x10; // pointer@0x04 = 0x80000010 + memory.at(0x07) = 0x80; + memory.at(0x08) = 0x20; // pointer@0x08 = 0x80000020 + memory.at(0x0B) = 0x80; note.mockEmulatorContext.MockMemory(memory); const std::wstring sNote = L"[32-bit pointer] root\r\n" diff --git a/tests/data/models/RichPresenceModel_Tests.cpp b/tests/data/models/RichPresenceModel_Tests.cpp index 25004268..6dee4954 100644 --- a/tests/data/models/RichPresenceModel_Tests.cpp +++ b/tests/data/models/RichPresenceModel_Tests.cpp @@ -25,9 +25,9 @@ private: class RichPresenceModelHarness : public RichPresenceModel { public: - RichPresenceModelHarness() + RichPresenceModelHarness() noexcept { - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); } ra::data::context::mocks::MockGameContext mockGameContext; diff --git a/tests/devkit/RADevKit.Tests.vcxproj.vcxproj b/tests/devkit/RADevKit.Tests.vcxproj.vcxproj new file mode 100644 index 00000000..f9c06520 --- /dev/null +++ b/tests/devkit/RADevKit.Tests.vcxproj.vcxproj @@ -0,0 +1,66 @@ + + + + + Analysis + Win32 + + + Analysis + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + Designer + + + + RADevKit.Tests + {6131C3D1-165E-4F39-A44C-94F01EAA03C5} + ra.test + NativeUnitTestProject + DynamicLibrary + 10.0 + v143 + Unicode + + + + + + + + + + $(SolutionDir)\tests\devkit\;$(MSTest_IncludePath);%(AdditionalIncludeDirectories) + + + + + {8ae21d54-f905-44e1-90e5-d22e346bff39} + + + + + + + + + \ No newline at end of file diff --git a/tests/devkit/RADevKit.Tests.vcxproj.vcxproj.filters b/tests/devkit/RADevKit.Tests.vcxproj.vcxproj.filters new file mode 100644 index 00000000..8bed0429 --- /dev/null +++ b/tests/devkit/RADevKit.Tests.vcxproj.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + data + + + util + + + + + + + + {0cb6f498-4743-4a0c-b6c2-4fce3894f5ae} + + + {55d31de8-4310-47c3-acda-ee70373135ce} + + + {0704504a-6093-4bb9-99a9-f5ea8c402401} + + + + + testutil + + + \ No newline at end of file diff --git a/tests/data/ModelProperty_Tests.cpp b/tests/devkit/data/ModelProperty_Tests.cpp similarity index 97% rename from tests/data/ModelProperty_Tests.cpp rename to tests/devkit/data/ModelProperty_Tests.cpp index 7011b277..489da586 100644 --- a/tests/data/ModelProperty_Tests.cpp +++ b/tests/devkit/data/ModelProperty_Tests.cpp @@ -1,6 +1,6 @@ #include "data\ModelProperty.hh" -using namespace Microsoft::VisualStudio::CppUnitTestFramework; +#include "testutil\CppUnitTest.hh" namespace ra { namespace data { diff --git a/tests/devkit/testutil/CppUnitTest.hh b/tests/devkit/testutil/CppUnitTest.hh new file mode 100644 index 00000000..090ff7c8 --- /dev/null +++ b/tests/devkit/testutil/CppUnitTest.hh @@ -0,0 +1,18 @@ +#ifndef RA_CPP_UNIT_TEST_HH +#define RA_CPP_UNIT_TEST_HH + +/* completely suppress everything inside the CppUnitTest.h file */ +#include +#pragma warning(push) +#pragma warning(disable: ALL_CPPCORECHECK_WARNINGS ALL_CODE_ANALYSIS_WARNINGS) +#include +#pragma warning(pop) + +/* This has to be globally disabled in the unit tests because it occurs in the + * macros provided by the framework (i.e. TEST_METHOD). + */ +#pragma warning(disable: 26477) /* Use 'nullptr' rather than 0 or NULL (es.47). */ + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +#endif RA_CPP_UNIT_TEST_HH diff --git a/tests/RA_StringUtils_Tests.cpp b/tests/devkit/util/Strings_Tests.cpp similarity index 99% rename from tests/RA_StringUtils_Tests.cpp rename to tests/devkit/util/Strings_Tests.cpp index 94bad312..227b39f7 100644 --- a/tests/RA_StringUtils_Tests.cpp +++ b/tests/devkit/util/Strings_Tests.cpp @@ -1,8 +1,6 @@ -#include "RA_Defs.h" +#include "util\Strings.hh" -#include "RA_UnitTestHelpers.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; +#include "testutil\CppUnitTest.hh" namespace ra { diff --git a/tests/mocks/MockAchievementRuntime.cpp b/tests/mocks/MockAchievementRuntime.cpp index 7cbe3f0f..33d1c5c9 100644 --- a/tests/mocks/MockAchievementRuntime.cpp +++ b/tests/mocks/MockAchievementRuntime.cpp @@ -5,7 +5,7 @@ #include "services\ServiceLocator.hh" #include "CppUnitTest.h" -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "data\context\GameAssets.hh" @@ -16,7 +16,7 @@ namespace ra { namespace services { namespace mocks { -void MockAchievementRuntime::OnBeforeResponse(const std::string& sRequestParams, std::function&& fHandler) +void MockAchievementRuntime::OnBeforeResponse(const std::string& sRequestParams, const std::function&& fHandler) { for (auto& pResponse : m_vResponses) { @@ -44,7 +44,7 @@ void MockAchievementRuntime::MockUser(const std::string& sUsername, const std::s void MockAchievementRuntime::MockGame() { - rc_client_game_info_t* game = (rc_client_game_info_t*)calloc(1, sizeof(rc_client_game_info_t)); + rc_client_game_info_t* game = static_cast(calloc(1, sizeof(rc_client_game_info_t))); Expects(game != nullptr); rc_buffer_init(&game->buffer); rc_runtime_init(&game->runtime); @@ -65,7 +65,7 @@ void MockAchievementRuntime::MockGame() } } -static rc_client_subset_info_t* GetSubset(rc_client_game_info_t* game, uint32_t subset_id, const char* name) +static rc_client_subset_info_t* GetSubset(rc_client_game_info_t* game, uint32_t subset_id, const char* name) noexcept { rc_client_subset_info_t* subset = game->subsets, **next = &game->subsets; for (; subset; subset = subset->next) @@ -76,7 +76,7 @@ static rc_client_subset_info_t* GetSubset(rc_client_game_info_t* game, uint32_t next = &subset->next; } - subset = (rc_client_subset_info_t*)rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t)); + subset = static_cast(rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t))); memset(subset, 0, sizeof(*subset)); subset->public_.id = subset_id; strcpy_s(subset->public_.badge_name, sizeof(subset->public_.badge_name), game->public_.badge_name); @@ -106,8 +106,8 @@ static rc_client_achievement_info_t* AddAchievement(rc_client_game_info_t* game, if (subset->public_.num_achievements % 8 == 0) { const uint32_t new_count = subset->public_.num_achievements + 8; - rc_client_achievement_info_t* new_achievements = (rc_client_achievement_info_t*)rc_buffer_alloc( - &game->buffer, sizeof(rc_client_achievement_info_t) * new_count); + rc_client_achievement_info_t* new_achievements = static_cast(rc_buffer_alloc( + &game->buffer, sizeof(rc_client_achievement_info_t) * new_count)); if (subset->public_.num_achievements > 0) { @@ -176,7 +176,7 @@ rc_client_achievement_info_t* MockAchievementRuntime::MockAchievementWithTrigger rc_client_game_info_t* game = GetClient()->game; rc_client_achievement_info_t* achievement = AddAchievement(game, GetCoreSubset(game), nId, sTitle); - achievement->trigger = (rc_trigger_t*)rc_buffer_alloc(&game->buffer, sizeof(rc_trigger_t)); + achievement->trigger = static_cast(rc_buffer_alloc(&game->buffer, sizeof(rc_trigger_t))); memset(achievement->trigger, 0, sizeof(*achievement->trigger)); achievement->trigger->state = RC_TRIGGER_STATE_ACTIVE; @@ -190,7 +190,7 @@ rc_client_achievement_info_t* MockAchievementRuntime::ActivateAchievement(uint32 m_mAchievementDefinitions[nId] = sTrigger; - auto nSize = rc_trigger_size(sTrigger.c_str()); + const auto nSize = rc_trigger_size(sTrigger.c_str()); if (nSize > 0) { void* trigger_buffer = rc_buffer_alloc(&game->buffer, nSize); @@ -201,7 +201,7 @@ rc_client_achievement_info_t* MockAchievementRuntime::ActivateAchievement(uint32 return achievement; } -void MockAchievementRuntime::UnlockAchievement(rc_client_achievement_info_t* pAchievement, int nMode) +void MockAchievementRuntime::UnlockAchievement(rc_client_achievement_info_t* pAchievement, int nMode) noexcept { pAchievement->public_.unlocked |= nMode; @@ -242,14 +242,14 @@ rc_client_achievement_info_t* MockAchievementRuntime::MockLocalAchievement(uint3 return AddAchievement(game, GetLocalSubset(game), nId, sTitle); } -static rc_client_leaderboard_info_t* AddLeaderboard(rc_client_t* client, rc_client_game_info_t* game, +static rc_client_leaderboard_info_t* AddLeaderboard(const rc_client_t* client, rc_client_game_info_t* game, rc_client_subset_info_t* subset, uint32_t nId, const char* sTitle) { if (subset->public_.num_leaderboards % 8 == 0) { const uint32_t new_count = subset->public_.num_leaderboards + 8; - rc_client_leaderboard_info_t* new_leaderboards = (rc_client_leaderboard_info_t*)rc_buffer_alloc( - &game->buffer, sizeof(rc_client_leaderboard_info_t) * new_count); + rc_client_leaderboard_info_t* new_leaderboards = static_cast(rc_buffer_alloc( + &game->buffer, sizeof(rc_client_leaderboard_info_t) * new_count)); if (subset->public_.num_leaderboards > 0) { @@ -294,7 +294,7 @@ rc_client_leaderboard_info_t* MockAchievementRuntime::MockLeaderboardWithLboard( rc_client_game_info_t* game = GetClient()->game; rc_client_leaderboard_info_t* leaderboard = AddLeaderboard(GetClient(), game, GetCoreSubset(game), nId, sTitle); - leaderboard->lboard = (rc_lboard_t*)rc_buffer_alloc(&game->buffer, sizeof(rc_lboard_t)); + leaderboard->lboard = static_cast(rc_buffer_alloc(&game->buffer, sizeof(rc_lboard_t))); memset(leaderboard->lboard, 0, sizeof(*leaderboard->lboard)); leaderboard->lboard->state = static_cast( rc_client_get_hardcore_enabled(GetClient()) ? RC_LBOARD_STATE_ACTIVE : RC_LBOARD_STATE_INACTIVE); @@ -315,7 +315,7 @@ rc_client_leaderboard_info_t* MockAchievementRuntime::ActivateLeaderboard(uint32 m_mLeaderboardDefinitions[nId] = sDefinition; - auto nSize = rc_lboard_size(sDefinition.c_str()); + const auto nSize = rc_lboard_size(sDefinition.c_str()); void* trigger_buffer = rc_buffer_alloc(&game->buffer, nSize); leaderboard->lboard = rc_parse_lboard(trigger_buffer, sDefinition.c_str(), nullptr, 0); leaderboard->public_.state = RC_CLIENT_LEADERBOARD_STATE_ACTIVE; diff --git a/tests/mocks/MockAchievementRuntime.hh b/tests/mocks/MockAchievementRuntime.hh index 21426a82..584c7576 100644 --- a/tests/mocks/MockAchievementRuntime.hh +++ b/tests/mocks/MockAchievementRuntime.hh @@ -37,7 +37,7 @@ public: pResponse.nHttpStatus = 200; } - void OnBeforeResponse(const std::string& sRequestParams, std::function&& fHandler); + void OnBeforeResponse(const std::string& sRequestParams, const std::function&& fHandler); void MockUser(const std::string& sUsername, const std::string& sApiToken); @@ -52,7 +52,7 @@ public: rc_client_achievement_info_t* MockSubsetAchievement(uint32_t nSubsetId, uint32_t nId, const char* sTitle = nullptr); rc_client_achievement_info_t* ActivateAchievement(uint32_t nId, const std::string& sTrigger); - void UnlockAchievement(rc_client_achievement_info_t* pAchievement, int nMode); + void UnlockAchievement(rc_client_achievement_info_t* pAchievement, int nMode) noexcept; rc_client_leaderboard_info_t* MockLeaderboard(uint32_t nId, const char* sTitle = nullptr); rc_client_leaderboard_info_t* MockLeaderboardWithLboard(uint32_t nId, const char* sTitle = nullptr); @@ -64,8 +64,8 @@ public: void AssertNoPendingRequests() const; - std::map& GetAchievementDefinitions() { return m_mAchievementDefinitions; } - std::map& GetLeaderboardDefinitions() { return m_mLeaderboardDefinitions; } + std::map& GetAchievementDefinitions() noexcept { return m_mAchievementDefinitions; } + std::map& GetLeaderboardDefinitions() noexcept { return m_mLeaderboardDefinitions; } private: static void MockServerCall(const rc_api_request_t* pRequest, rc_client_server_callback_t fCallback, diff --git a/tests/mocks/MockClock.hh b/tests/mocks/MockClock.hh index 55fc09f2..f2146739 100644 --- a/tests/mocks/MockClock.hh +++ b/tests/mocks/MockClock.hh @@ -2,11 +2,11 @@ #define RA_SERVICES_MOCK_CLOCK_HH #pragma once -#include "ra_fwd.h" - #include "services\IClock.hh" #include "services\ServiceLocator.hh" +#include "util\GSL.hh" + namespace ra { namespace services { namespace mocks { diff --git a/tests/mocks/MockDesktop.hh b/tests/mocks/MockDesktop.hh index 60992158..56c3fa07 100644 --- a/tests/mocks/MockDesktop.hh +++ b/tests/mocks/MockDesktop.hh @@ -94,7 +94,7 @@ public: bool IsDebuggerPresent() const noexcept override { return m_bDebuggerPresent; } void SetDebuggerPresent(bool bValue) noexcept { m_bDebuggerPresent = bValue; } - bool IsOnUIThread() const override { return true; } + bool IsOnUIThread() const noexcept override { return true; } void InvokeOnUIThread(std::function fAction) const override { fAction(); } private: diff --git a/tests/mocks/MockEmulatorContext.hh b/tests/mocks/MockEmulatorContext.hh index 613fcbb5..3198d45d 100644 --- a/tests/mocks/MockEmulatorContext.hh +++ b/tests/mocks/MockEmulatorContext.hh @@ -107,7 +107,7 @@ public: { m_mMemoryValues[nAddress] = nValue; - if (nAddress + 4 > m_nTotalMemorySize) + if (gsl::narrow_cast(nAddress) + 4 > m_nTotalMemorySize) { const size_t nNewMemorySize = gsl::narrow_cast(nAddress) + 4; ClearMemoryBlocks(); @@ -130,7 +130,7 @@ public: bool IsMemoryInsecure() const noexcept override { return m_bMemoryInsecure; } private: - static uint8_t ReadMemoryHelper(uint32_t nAddress) noexcept + static uint8_t ReadMemoryHelper(uint32_t nAddress) { const auto* mockEmulator = dynamic_cast(&ra::services::ServiceLocator::Get()); @@ -166,7 +166,7 @@ private: return mockEmulator->m_pMemory.at(nAddress); } - static void WriteMemoryHelper(uint32_t nAddress, uint8_t nValue) noexcept + static void WriteMemoryHelper(uint32_t nAddress, uint8_t nValue) { auto* mockEmulator = dynamic_cast(&ra::services::ServiceLocator::GetMutable()); diff --git a/tests/mocks/MockGameContext.hh b/tests/mocks/MockGameContext.hh index aeabdff2..2d32b64c 100644 --- a/tests/mocks/MockGameContext.hh +++ b/tests/mocks/MockGameContext.hh @@ -32,7 +32,7 @@ public: /// /// Sets the unique identifier of the currently loaded game. /// - void SetGameId(unsigned int nGameId) noexcept + void SetGameId(unsigned int nGameId) { m_nGameId = m_nActiveGameId = nGameId; @@ -99,6 +99,7 @@ public: auto* pCodeNotes = dynamic_cast(Assets().FindCodeNotes()); if (pCodeNotes) { + GSL_SUPPRESS_TYPE3 auto* pNote = const_cast(pCodeNotes->FindCodeNoteModel(nAddress, false)); if (pNote && pNote->IsPointer()) { @@ -143,6 +144,7 @@ public: return true; } + GSL_SUPPRESS_C128 void InitializeFromAchievementRuntime(); void MockSubset(uint32_t nSubsetId, const std::string& sName, SubsetType nType = SubsetType::Bonus) diff --git a/tests/mocks/MockImageRepository.hh b/tests/mocks/MockImageRepository.hh index d8052bee..74e5ae0b 100644 --- a/tests/mocks/MockImageRepository.hh +++ b/tests/mocks/MockImageRepository.hh @@ -4,7 +4,7 @@ #include "ui\ImageReference.hh" -#include "RA_StringUtils.h" +#include "util\Strings.hh" namespace ra { namespace ui { diff --git a/tests/mocks/MockServer.hh b/tests/mocks/MockServer.hh index 9cc8d802..6252af85 100644 --- a/tests/mocks/MockServer.hh +++ b/tests/mocks/MockServer.hh @@ -2,7 +2,7 @@ #define RA_SERVICES_MOCK_SERVER_HH #pragma once -#include "RA_StringUtils.h" +#include "util\Strings.hh" #include "api\IServer.hh" #include "services\ServiceLocator.hh" @@ -32,7 +32,7 @@ public: { m_mHandlers.insert_or_assign( std::string(TApi::Name()), - [fHandler = std::move(fHandler)](const void* restrict pRequest, void* restrict pResponse) + [fHandler = std::move(fHandler)](const void* _RESTRICT pRequest, void* _RESTRICT pResponse) { const auto* pTRequest = static_cast(pRequest); auto* pTResponse = static_cast(pResponse); @@ -158,7 +158,7 @@ protected: } private: - std::unordered_map> m_mHandlers; + std::unordered_map> m_mHandlers; ra::services::ServiceLocator::ServiceOverride m_Override; }; diff --git a/tests/mocks/MockSurface.hh b/tests/mocks/MockSurface.hh index e0df477f..413233bd 100644 --- a/tests/mocks/MockSurface.hh +++ b/tests/mocks/MockSurface.hh @@ -2,8 +2,6 @@ #define RA_SERVICES_MOCK_SURFACE_HH #pragma once -#include "ra_fwd.h" - #include "ui\drawing\ISurface.hh" namespace ra { diff --git a/tests/services/AchievementRuntimeExports_Tests.cpp b/tests/services/AchievementRuntimeExports_Tests.cpp index 3d3f28b9..0af51894 100644 --- a/tests/services/AchievementRuntimeExports_Tests.cpp +++ b/tests/services/AchievementRuntimeExports_Tests.cpp @@ -50,18 +50,23 @@ public: ResetExternalRcheevosClient(); } + AchievementRuntimeExportsHarness(const AchievementRuntimeExportsHarness&) noexcept = delete; + AchievementRuntimeExportsHarness& operator=(const AchievementRuntimeExportsHarness&) noexcept = delete; + AchievementRuntimeExportsHarness(AchievementRuntimeExportsHarness&&) noexcept = delete; + AchievementRuntimeExportsHarness& operator=(AchievementRuntimeExportsHarness&&) noexcept = delete; + ra::data::context::mocks::MockEmulatorContext mockEmulatorContext; ra::data::context::mocks::MockUserContext mockUserContext; ra::services::mocks::MockConfiguration mockConfiguration; - void InitializeEventHandler() + void InitializeEventHandler() noexcept { s_pRuntimeHarness = this; _Rcheevos_SetRAIntegrationEventHandler(&m_pExternalClient, DispatchRAIntegrationEvent); } - void InitializeClientEventHandler() + void InitializeClientEventHandler() noexcept { s_pRuntimeHarness = this; @@ -108,13 +113,13 @@ public: Assert::Fail(ra::StringPrintf(L"MENUITEM check changed event not seen for %d", nMenuItemId).c_str()); } - void ResetSeenEvents() + void ResetSeenEvents() noexcept { m_nEventsSeen = 0; m_vMenuItemsChanged.clear(); } - void InitializeMemoryFunctions() + void InitializeMemoryFunctions() noexcept { s_pRuntimeHarness = this; @@ -180,12 +185,14 @@ private: return nBytesAvailable; } + GSL_SUPPRESS_CON3 static void DispatchWriteMemory(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client) { Assert::AreEqual((void*)&s_pRuntimeHarness->m_pExternalClient, (void*)client); - if (s_pRuntimeHarness->m_vMockMemory.size() < address + num_bytes + 1) - s_pRuntimeHarness->m_vMockMemory.resize(address + num_bytes + 1); + const auto nNextAddress = gsl::narrow_cast(address + num_bytes + 1); + if (s_pRuntimeHarness->m_vMockMemory.size() < nNextAddress) + s_pRuntimeHarness->m_vMockMemory.resize(nNextAddress); memcpy(&s_pRuntimeHarness->m_vMockMemory.at(address), buffer, num_bytes); } @@ -229,7 +236,8 @@ private: Assert::AreEqual({0}, pItem->checked); }; - static void AssertV1Exports(rc_client_external_t& pClient) + GSL_SUPPRESS_TYPE4 + static void AssertV1Exports(const rc_client_external_t& pClient) { Assert::IsNotNull((void*)pClient.destroy, L"destory not set"); @@ -289,13 +297,15 @@ private: Assert::IsNotNull((void*)pClient.deserialize_progress, L"deserialize_progress not set"); } - static void AssertV2Exports(rc_client_external_t & pClient) + GSL_SUPPRESS_TYPE4 + static void AssertV2Exports(const rc_client_external_t & pClient) { Assert::IsNotNull((void*)pClient.add_game_hash, L"add_game_hash not set"); Assert::IsNotNull((void*)pClient.load_unknown_game, L"load_unknown_game not set"); } - static void AssertV3Exports(rc_client_external_t & pClient) + GSL_SUPPRESS_TYPE4 + static void AssertV3Exports(const rc_client_external_t & pClient) { Assert::IsNotNull((void*)pClient.get_user_info_v3, L"get_user_info_v3 not set"); Assert::IsNotNull((void*)pClient.get_game_info_v3, L"get_game_info_v3 not set"); diff --git a/tests/services/AchievementRuntime_Tests.cpp b/tests/services/AchievementRuntime_Tests.cpp index c64224a0..d1e176f7 100644 --- a/tests/services/AchievementRuntime_Tests.cpp +++ b/tests/services/AchievementRuntime_Tests.cpp @@ -70,7 +70,7 @@ public: void MockGame() { - rc_client_game_info_t* game = (rc_client_game_info_t*)calloc(1, sizeof(rc_client_game_info_t)); + rc_client_game_info_t* game = static_cast(calloc(1, sizeof(rc_client_game_info_t))); Expects(game != nullptr); rc_buffer_init(&game->buffer); rc_runtime_init(&game->runtime); @@ -80,7 +80,7 @@ public: game->public_.badge_name = "012345"; game->public_.title = "Game Title"; - auto* core_subset = (rc_client_subset_info_t*)rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t)); + auto* core_subset = static_cast(rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t))); memset(core_subset, 0, sizeof(*core_subset)); core_subset->public_.id = game->public_.id; core_subset->public_.title = game->public_.title; @@ -93,9 +93,9 @@ public: GetClient()->game = game; } - void ResetEvents() { m_vEvents.clear(); } + void ResetEvents() noexcept { m_vEvents.clear(); } - size_t GetEventCount() const { return m_vEvents.size(); } + size_t GetEventCount() const noexcept { return m_vEvents.size(); } void AssertEvent(uint32_t nType, uint32_t nRecordId = 0) { @@ -142,12 +142,12 @@ public: Assert::Fail(ra::StringPrintf(L"Event %u not found.", nType).c_str()); } - void RaiseEvent(const rc_client_event_t& event) + void RaiseEvent(const rc_client_event_t& event) noexcept { m_fRealEventHandler(&event, GetClient()); } - void ProcessCapturedEvents() + void ProcessCapturedEvents() noexcept { for (const auto& pEvent : m_vEvents) RaiseEvent(pEvent); @@ -178,7 +178,7 @@ public: auto* game = GetClient()->game; auto* ach = AddAchievement(game, pSubset, nId, ra::StringPrintf("Ach%u", nId).c_str()); - auto nSize = rc_trigger_size(sTrigger.c_str()); + const auto nSize = rc_trigger_size(sTrigger.c_str()); void* trigger_buffer = rc_buffer_alloc(&game->buffer, nSize); ach->trigger = rc_parse_trigger(trigger_buffer, sTrigger.c_str(), nullptr, 0); ActivateAchievement(ach); @@ -186,13 +186,13 @@ public: return ach; } - void ActivateAchievement(rc_client_achievement_info_t* pAchievement) + void ActivateAchievement(rc_client_achievement_info_t* pAchievement) noexcept { pAchievement->public_.state = RC_CLIENT_ACHIEVEMENT_STATE_ACTIVE; pAchievement->trigger->state = RC_TRIGGER_STATE_WAITING; } - void DeactivateAchievement(rc_client_achievement_info_t* pAchievement) + void DeactivateAchievement(rc_client_achievement_info_t* pAchievement) noexcept { pAchievement->public_.state = RC_CLIENT_ACHIEVEMENT_STATE_INACTIVE; pAchievement->trigger->state = RC_TRIGGER_STATE_INACTIVE; @@ -237,7 +237,7 @@ public: rc_client_game_info_t* game = GetClient()->game; auto* lboard = AddLeaderboard(game, GetCoreSubset(game), nId, ra::StringPrintf("Leaderboard%u", nId).c_str()); - auto nSize = rc_lboard_size(sDefinition.c_str()); + const auto nSize = rc_lboard_size(sDefinition.c_str()); void* lboard_buffer = rc_buffer_alloc(&game->buffer, nSize); lboard->lboard = rc_parse_lboard(lboard_buffer, sDefinition.c_str(), nullptr, 0); ActivateLeaderboard(lboard); @@ -250,7 +250,7 @@ public: rc_client_game_info_t* game = GetClient()->game; auto* lboard = AddLeaderboard(game, GetLocalSubset(game), nId, ra::StringPrintf("Leaderboard%u", nId).c_str()); - auto nSize = rc_lboard_size(sDefinition.c_str()); + const auto nSize = rc_lboard_size(sDefinition.c_str()); void* lboard_buffer = rc_buffer_alloc(&game->buffer, nSize); lboard->lboard = rc_parse_lboard(lboard_buffer, sDefinition.c_str(), nullptr, 0); ActivateLeaderboard(lboard); @@ -258,13 +258,13 @@ public: return lboard; } - void ActivateLeaderboard(rc_client_leaderboard_info_t* pLeaderboard) + void ActivateLeaderboard(rc_client_leaderboard_info_t* pLeaderboard) noexcept { pLeaderboard->public_.state = RC_CLIENT_LEADERBOARD_STATE_ACTIVE; pLeaderboard->lboard->state = RC_LBOARD_STATE_ACTIVE; } - void DeactivateLeaderboard(rc_client_leaderboard_info_t* pLeaderboard) + void DeactivateLeaderboard(rc_client_leaderboard_info_t* pLeaderboard) noexcept { pLeaderboard->public_.state = RC_CLIENT_LEADERBOARD_STATE_INACTIVE; pLeaderboard->lboard->state = RC_LBOARD_STATE_INACTIVE; @@ -296,10 +296,10 @@ public: return mockGameContext.Assets().FindLeaderboard(pLeaderboard->public_.id); } - void SyncToRuntime() + void SyncToRuntime() noexcept { // toggling hardcore will reset the runtime with appropriately active achievements - bool bHardcoreEnabled = rc_client_get_hardcore_enabled(GetClient()); + const bool bHardcoreEnabled = rc_client_get_hardcore_enabled(GetClient()); rc_client_set_hardcore_enabled(GetClient(), !bHardcoreEnabled); rc_client_set_hardcore_enabled(GetClient(), bHardcoreEnabled); @@ -335,6 +335,7 @@ public: } } + GSL_SUPPRESS_TYPE1 void SaveProgressToString(std::string& sBuffer) { const size_t nSize = SaveProgressToBuffer(reinterpret_cast(sBuffer.data()), gsl::narrow_cast(sBuffer.size())); @@ -345,6 +346,7 @@ public: } } + GSL_SUPPRESS_TYPE1 bool LoadProgressFromString(const std::string& sBuffer) { return LoadProgressFromBuffer(reinterpret_cast(sBuffer.data())); @@ -365,6 +367,7 @@ public: } private: + GSL_SUPPRESS_CON3 static void CaptureEventHandler(const rc_client_event_t* pEvent, rc_client_t* pClient) { auto* harness = static_cast(rc_client_get_userdata(pClient)); @@ -374,7 +377,7 @@ private: std::vector m_vEvents; - static rc_client_subset_info_t* GetSubset(rc_client_game_info_t* game, uint32_t subset_id, const char* name) + static rc_client_subset_info_t* GetSubset(rc_client_game_info_t* game, uint32_t subset_id, const char* name) noexcept { rc_client_subset_info_t *subset = game->subsets, **next = &game->subsets; for (; subset; subset = subset->next) @@ -385,7 +388,7 @@ private: next = &subset->next; } - subset = (rc_client_subset_info_t*)rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t)); + subset = static_cast(rc_buffer_alloc(&game->buffer, sizeof(rc_client_subset_info_t))); memset(subset, 0, sizeof(*subset)); subset->public_.id = subset_id; strcpy_s(subset->public_.badge_name, sizeof(subset->public_.badge_name), game->public_.badge_name); @@ -397,12 +400,12 @@ private: return subset; } - static rc_client_subset_info_t* GetCoreSubset(rc_client_game_info_t* game) + static rc_client_subset_info_t* GetCoreSubset(rc_client_game_info_t* game) noexcept { return GetSubset(game, game->public_.id, game->public_.title); } - static rc_client_subset_info_t* GetLocalSubset(rc_client_game_info_t* game) + static rc_client_subset_info_t* GetLocalSubset(rc_client_game_info_t* game) noexcept { return GetSubset(game, ra::data::context::GameAssets::LocalSubsetId, "Local"); } @@ -413,8 +416,8 @@ private: if (subset->public_.num_achievements % 8 == 0) { const uint32_t new_count = subset->public_.num_achievements + 8; - rc_client_achievement_info_t* new_achievements = (rc_client_achievement_info_t*)rc_buffer_alloc( - &game->buffer, sizeof(rc_client_achievement_info_t) * new_count); + rc_client_achievement_info_t* new_achievements = static_cast(rc_buffer_alloc( + &game->buffer, sizeof(rc_client_achievement_info_t) * new_count)); if (subset->public_.num_achievements > 0) { @@ -455,8 +458,8 @@ private: if (subset->public_.num_leaderboards % 8 == 0) { const uint32_t new_count = subset->public_.num_leaderboards + 8; - rc_client_leaderboard_info_t* new_leaderboards = (rc_client_leaderboard_info_t*)rc_buffer_alloc( - &game->buffer, sizeof(rc_client_leaderboard_info_t) * new_count); + rc_client_leaderboard_info_t* new_leaderboards = static_cast(rc_buffer_alloc( + &game->buffer, sizeof(rc_client_leaderboard_info_t) * new_count)); if (subset->public_.num_leaderboards > 0) { @@ -621,7 +624,7 @@ public: auto vmNewAchievement = std::make_unique(); vmNewAchievement->Attach(*pAchievement, ra::data::models::AssetCategory::Core, "0xH0000=1"); vmNewAchievement->SetSubsetID(1U); - auto& vmAchievement = reinterpret_cast(runtime.mockGameContext.Assets().Append(std::move(vmNewAchievement))); + const auto& vmAchievement = reinterpret_cast(runtime.mockGameContext.Assets().Append(std::move(vmNewAchievement))); // SyncAssets should generate a new core subset with the merged achievement runtime.SyncAssets(); @@ -867,7 +870,7 @@ public: } */ - static rc_condition_t* GetCondition(AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond) noexcept + static rc_condition_t* GetCondition(const AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond) noexcept { rc_trigger_t* pTrigger = harness.GetAchievementTrigger(nId); rc_condset_t* pCondset = pTrigger->requirement; @@ -888,14 +891,14 @@ public: return pCondition; } - static void SetConditionHitCount(AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond, int nHits) + static void SetConditionHitCount(const AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond, int nHits) { rc_condition_t* pCond = GetCondition(harness, nId, nGroup, nCond); Assert::IsNotNull(pCond); pCond->current_hits = ra::to_unsigned(nHits); } - static void AssertConditionHitCount(AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond, int nHits) + static void AssertConditionHitCount(const AchievementRuntimeHarness& harness, ra::AchievementID nId, int nGroup, int nCond, int nHits) { const rc_condition_t* pCond = GetCondition(harness, nId, nGroup, nCond); Assert::IsNotNull(pCond); @@ -3610,7 +3613,7 @@ public: Assert::AreEqual({16}, server_response->body_length); Assert::AreEqual(200, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3641,7 +3644,7 @@ public: Assert::AreEqual({36}, server_response->body_length); Assert::AreEqual(200, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3671,7 +3674,7 @@ public: Assert::AreEqual({77}, server_response->body_length); Assert::AreEqual(404, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3705,7 +3708,7 @@ public: Assert::AreEqual({38}, server_response->body_length); Assert::AreEqual(200, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3740,7 +3743,7 @@ public: Assert::AreEqual({77}, server_response->body_length); Assert::AreEqual(404, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3772,7 +3775,7 @@ public: Assert::AreEqual({77}, server_response->body_length); Assert::AreEqual(404, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3801,7 +3804,7 @@ public: Assert::AreEqual({16}, server_response->body_length); Assert::AreEqual(200, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); @@ -3830,7 +3833,7 @@ public: Assert::AreEqual({16}, server_response->body_length); Assert::AreEqual(200, server_response->http_status_code); - *((bool*)callback_data) = true; + *(static_cast(callback_data)) = true; }; runtime.GetClient()->callbacks.server_call(&pRequest, fCallback, &bCallbackCalled, runtime.GetClient()); diff --git a/tests/services/ServicesAsserts.hh b/tests/services/ServicesAsserts.hh index e3929ebd..4208d508 100644 --- a/tests/services/ServicesAsserts.hh +++ b/tests/services/ServicesAsserts.hh @@ -2,7 +2,7 @@ #define RA_UNITTEST_SERVICESHELPERS_H #pragma once -#include "ra_utility.h" +#include "util\TypeCasts.hh" #include "services\Http.hh" diff --git a/tests/ui/ViewModelBase_Tests.cpp b/tests/ui/ViewModelBase_Tests.cpp index 270b8fde..7e6c33aa 100644 --- a/tests/ui/ViewModelBase_Tests.cpp +++ b/tests/ui/ViewModelBase_Tests.cpp @@ -1,7 +1,5 @@ #include "ui\ViewModelBase.hh" -#include "ra_fwd.h" - using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace ra { diff --git a/tests/ui/ViewModelCollection_Tests.cpp b/tests/ui/ViewModelCollection_Tests.cpp index 77fa5d8b..911acb65 100644 --- a/tests/ui/ViewModelCollection_Tests.cpp +++ b/tests/ui/ViewModelCollection_Tests.cpp @@ -1,7 +1,5 @@ #include "ui\ViewModelCollection.hh" -#include "ra_fwd.h" - #include "..\RA_UnitTestHelpers.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp b/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp index 3c2c8180..07a34f73 100644 --- a/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp +++ b/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp @@ -49,7 +49,7 @@ private: // DoFrame tests expect the dialog to be visible GSL_SUPPRESS_F6 SetIsVisible(true); - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); } ~AssetEditorViewModelHarness() diff --git a/tests/ui/viewmodels/AssetListViewModel_Tests.cpp b/tests/ui/viewmodels/AssetListViewModel_Tests.cpp index 12eea0ac..e8b55ecf 100644 --- a/tests/ui/viewmodels/AssetListViewModel_Tests.cpp +++ b/tests/ui/viewmodels/AssetListViewModel_Tests.cpp @@ -176,7 +176,7 @@ private: AssetListViewModelHarness() noexcept { - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); GSL_SUPPRESS_F6 InitializeNotifyTargets(); } @@ -402,14 +402,14 @@ private: } private: - void EnsureCoreSubset() const + void EnsureCoreSubset() const noexcept { auto* pGame = mockRuntime.GetClient()->game; if (!pGame->subsets) { // populate a minimal core subset just to prevent a null reference error auto* pSubset = - (rc_client_subset_info_t*)rc_buffer_alloc(&pGame->buffer, sizeof(rc_client_subset_info_t)); + static_cast(rc_buffer_alloc(&pGame->buffer, sizeof(rc_client_subset_info_t))); memset(pSubset, 0, sizeof(*pSubset)); pSubset->public_.id = mockGameContext.ActiveGameId(); pSubset->public_.title = pGame->public_.title; @@ -628,9 +628,9 @@ private: class MockAchievementModel : public ra::data::models::AchievementModel { public: - MockAchievementModel() + MockAchievementModel() noexcept { - m_pInfo = std::make_unique(); + GSL_SUPPRESS_F6 m_pInfo = std::make_unique(); memset(m_pInfo.get(), 0, sizeof(rc_client_achievement_info_t)); } @@ -3359,12 +3359,14 @@ public: // both achievements should be loaded in the runtime auto* pClient = vmAssetList.mockRuntime.GetClient(); - auto* pAch1 = (rc_client_achievement_info_t*)rc_client_get_achievement_info(pClient, 111000001U); + GSL_SUPPRESS_TYPE1 + auto* pAch1 = reinterpret_cast(rc_client_get_achievement_info(pClient, 111000001U)); Expects(pAch1 != nullptr); Assert::IsNull(pAch1->trigger); // trigger not set until activated Assert::AreEqual({0}, pAch1->public_.points); - auto* pAch2 = (rc_client_achievement_info_t*)rc_client_get_achievement_info(pClient, 111000002U); + GSL_SUPPRESS_TYPE1 + auto* pAch2 = reinterpret_cast(rc_client_get_achievement_info(pClient, 111000002U)); Expects(pAch2 != nullptr); Assert::IsNull(pAch2->trigger); Assert::AreEqual({0}, pAch2->public_.points); @@ -4563,7 +4565,7 @@ public: return DialogResult::Yes; }); - const ra::ByteAddress nAddress = 0x02; + constexpr ra::ByteAddress nAddress = 0x02; vmAssetList.mockWindowManager.MemoryInspector.SetCurrentAddress(nAddress); vmAssetList.mockWindowManager.MemoryInspector.SetCurrentAddressNote(L"foo"); Assert::IsTrue(vmAssetList.mockWindowManager.MemoryInspector.IsNoteUncommitted()); diff --git a/tests/ui/viewmodels/AssetUploadViewModel_Tests.cpp b/tests/ui/viewmodels/AssetUploadViewModel_Tests.cpp index d519153d..79bbf846 100644 --- a/tests/ui/viewmodels/AssetUploadViewModel_Tests.cpp +++ b/tests/ui/viewmodels/AssetUploadViewModel_Tests.cpp @@ -36,9 +36,9 @@ private: class AssetUploadViewModelHarness : public AssetUploadViewModel { public: - AssetUploadViewModelHarness() + AssetUploadViewModelHarness() noexcept { - mockGameContext.SetGameId(GameId); + GSL_SUPPRESS_F6 mockGameContext.SetGameId(GameId); } static constexpr unsigned GameId = 22U; diff --git a/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp b/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp index d2afbfd4..d505cae9 100644 --- a/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp +++ b/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp @@ -33,7 +33,7 @@ private: BrokenAchievementsViewModelHarness() noexcept { GSL_SUPPRESS_F6 mockWindowManager.AssetList.InitializeNotifyTargets(); - mockConfiguration.SetHostUrl("http://host"); + GSL_SUPPRESS_F6 mockConfiguration.SetHostUrl("http://host"); } void MockAchievements() diff --git a/tests/ui/viewmodels/IntegrationMenuViewModel_Tests.cpp b/tests/ui/viewmodels/IntegrationMenuViewModel_Tests.cpp index 3f215436..bba51ffa 100644 --- a/tests/ui/viewmodels/IntegrationMenuViewModel_Tests.cpp +++ b/tests/ui/viewmodels/IntegrationMenuViewModel_Tests.cpp @@ -55,9 +55,9 @@ private: ra::ui::mocks::MockDesktop mockDesktop; ra::ui::viewmodels::mocks::MockWindowManager mockWindowManager; - IntegrationMenuViewModelHarness() + IntegrationMenuViewModelHarness() noexcept { - mockAchievementRuntime.MockGame(); + GSL_SUPPRESS_F6 mockAchievementRuntime.MockGame(); } void BuildMenu() diff --git a/tests/ui/viewmodels/MemoryBookmarksViewModel_Tests.cpp b/tests/ui/viewmodels/MemoryBookmarksViewModel_Tests.cpp index 4ee2aa25..334feda9 100644 --- a/tests/ui/viewmodels/MemoryBookmarksViewModel_Tests.cpp +++ b/tests/ui/viewmodels/MemoryBookmarksViewModel_Tests.cpp @@ -1218,7 +1218,7 @@ public: bookmarks.AddBookmark(4, MemSize::SixteenBit); bookmarks.AddBookmark(5, MemSize::EightBit); - auto& bookmark1 = *bookmarks.GetBookmark(0); + const auto& bookmark1 = *bookmarks.GetBookmark(0); Assert::AreEqual(std::wstring(L"04030201"), bookmark1.GetCurrentValue()); Assert::AreEqual(std::wstring(L"00000000"), bookmark1.GetPreviousValue()); Assert::AreEqual(0U, bookmark1.GetChanges()); @@ -1229,7 +1229,7 @@ public: Assert::AreEqual(0U, bookmark2.GetChanges()); bookmark2.SetBehavior(MemoryBookmarksViewModel::BookmarkBehavior::Frozen); // OnEditMemory should ignore frozen bookmarks - auto& bookmark3 = *bookmarks.GetBookmark(2); + const auto& bookmark3 = *bookmarks.GetBookmark(2); Assert::AreEqual(std::wstring(L"0403"), bookmark3.GetCurrentValue()); Assert::AreEqual(std::wstring(L"0000"), bookmark3.GetPreviousValue()); Assert::AreEqual(0U, bookmark3.GetChanges()); @@ -1245,12 +1245,12 @@ public: return DialogResult::None; }); - auto& bookmark4b = *bookmarks.GetBookmark(4); + const auto& bookmark4b = *bookmarks.GetBookmark(4); Assert::AreEqual(std::wstring(L"0504"), bookmark4b.GetCurrentValue()); Assert::AreEqual(std::wstring(L"0000"), bookmark4b.GetPreviousValue()); Assert::AreEqual(0U, bookmark4b.GetChanges()); - auto& bookmark5 = *bookmarks.GetBookmark(5); + const auto& bookmark5 = *bookmarks.GetBookmark(5); Assert::AreEqual(std::wstring(L"05"), bookmark5.GetCurrentValue()); Assert::AreEqual(std::wstring(L"00"), bookmark5.GetPreviousValue()); Assert::AreEqual(0U, bookmark5.GetChanges()); diff --git a/tests/ui/viewmodels/OverlayAchievementsPageViewModel_Tests.cpp b/tests/ui/viewmodels/OverlayAchievementsPageViewModel_Tests.cpp index 3a917c53..55a4fcc7 100644 --- a/tests/ui/viewmodels/OverlayAchievementsPageViewModel_Tests.cpp +++ b/tests/ui/viewmodels/OverlayAchievementsPageViewModel_Tests.cpp @@ -49,7 +49,7 @@ private: { GSL_SUPPRESS_F6 mockWindowManager.AssetList.InitializeNotifyTargets(); - mockGameContext.SetGameTitle(L"Game Title"); + GSL_SUPPRESS_F6 mockGameContext.SetGameTitle(L"Game Title"); } ItemViewModel* GetItem(gsl::index nIndex) { return m_vItems.GetItemAt(nIndex); } diff --git a/tests/ui/viewmodels/OverlayLeaderboardsPageViewModel_Tests.cpp b/tests/ui/viewmodels/OverlayLeaderboardsPageViewModel_Tests.cpp index 8352b52d..7bf963b9 100644 --- a/tests/ui/viewmodels/OverlayLeaderboardsPageViewModel_Tests.cpp +++ b/tests/ui/viewmodels/OverlayLeaderboardsPageViewModel_Tests.cpp @@ -34,9 +34,9 @@ private: ra::ui::viewmodels::mocks::MockOverlayManager mockOverlayManager; ra::ui::viewmodels::mocks::MockWindowManager mockWindowManager; - OverlayLeaderboardsPageViewModelHarness() + OverlayLeaderboardsPageViewModelHarness() noexcept { - mockGameContext.SetGameTitle(L"Game Title"); + GSL_SUPPRESS_F6 mockGameContext.SetGameTitle(L"Game Title"); } ItemViewModel* GetItem(gsl::index nIndex) { return m_vItems.GetItemAt(nIndex); } diff --git a/tests/ui/viewmodels/OverlayRecentGamesPageViewModel_Tests.cpp b/tests/ui/viewmodels/OverlayRecentGamesPageViewModel_Tests.cpp index f7476b73..3b17ee09 100644 --- a/tests/ui/viewmodels/OverlayRecentGamesPageViewModel_Tests.cpp +++ b/tests/ui/viewmodels/OverlayRecentGamesPageViewModel_Tests.cpp @@ -158,7 +158,7 @@ public: gamesPage.mockSessions.MockSession(3U, 1234567890U, std::chrono::seconds(5000)); bool bHttpRequesterCalled = false; - ra::services::mocks::MockHttpRequester mockHttp([&bHttpRequesterCalled](const ra::services::Http::Request&) { + ra::services::mocks::MockHttpRequester mockHttp([&bHttpRequesterCalled](const ra::services::Http::Request&) noexcept { bHttpRequesterCalled = true; return ra::services::Http::Response(); }); diff --git a/tests/ui/viewmodels/PointerInspectorViewModel_Tests.cpp b/tests/ui/viewmodels/PointerInspectorViewModel_Tests.cpp index 143ca2ea..96af48c8 100644 --- a/tests/ui/viewmodels/PointerInspectorViewModel_Tests.cpp +++ b/tests/ui/viewmodels/PointerInspectorViewModel_Tests.cpp @@ -65,6 +65,7 @@ private: PointerInspectorViewModelHarness(PointerInspectorViewModelHarness&&) noexcept = delete; PointerInspectorViewModelHarness& operator=(PointerInspectorViewModelHarness&&) noexcept = delete; + GSL_SUPPRESS_C128 void DoFrame() { mockGameContext.DoFrame(); // ensure note pointers get updated diff --git a/tests/ui/viewmodels/RichPresenceMonitorViewModel_Tests.cpp b/tests/ui/viewmodels/RichPresenceMonitorViewModel_Tests.cpp index a7ea42ac..d9b7d8f4 100644 --- a/tests/ui/viewmodels/RichPresenceMonitorViewModel_Tests.cpp +++ b/tests/ui/viewmodels/RichPresenceMonitorViewModel_Tests.cpp @@ -27,7 +27,7 @@ TEST_CLASS(RichPresenceMonitorViewModel_Tests) public: RichPresenceMonitorViewModelHarness() noexcept { - mockRuntime.MockGame(); + GSL_SUPPRESS_F6 mockRuntime.MockGame(); GSL_SUPPRESS_F6 InitializeNotifyTargets(); } diff --git a/tests/ui/viewmodels/TriggerConditionViewModel_Tests.cpp b/tests/ui/viewmodels/TriggerConditionViewModel_Tests.cpp index f624bf39..e01214d4 100644 --- a/tests/ui/viewmodels/TriggerConditionViewModel_Tests.cpp +++ b/tests/ui/viewmodels/TriggerConditionViewModel_Tests.cpp @@ -1527,7 +1527,7 @@ public: vmTrigger.EnsureVisible(6, 4); // scroll to end const int nScrollOffset = vmTrigger.GetScrollOffset(); - const auto* pCondition7 = vmTrigger.Conditions().GetItemAt(6 - nScrollOffset); + const auto* pCondition7 = vmTrigger.Conditions().GetItemAt(6 - gsl::narrow_cast(nScrollOffset)); Expects(pCondition7 != nullptr); Assert::IsFalse(pCondition7->IsIndirect()); Assert::AreEqual(std::wstring(L"0x00392ec0 (recall)\r\n2: $0xb65ba9 -> 0x00392ec0"), @@ -1536,7 +1536,7 @@ public: Assert::AreEqual(std::wstring(L""), pCondition7->GetTooltip(TriggerConditionViewModel::TargetTypeProperty)); Assert::AreEqual(std::wstring(L"0x2222\r\n[No code note]"), pCondition7->GetTooltip(TriggerConditionViewModel::TargetValueProperty)); - const auto* pCondition8 = vmTrigger.Conditions().GetItemAt(7 - nScrollOffset); + const auto* pCondition8 = vmTrigger.Conditions().GetItemAt(7 - gsl::narrow_cast(nScrollOffset)); Expects(pCondition8 != nullptr); Assert::IsTrue(pCondition8->IsIndirect()); Assert::AreEqual(std::wstring(L""), pCondition8->GetTooltip(TriggerConditionViewModel::SourceTypeProperty)); @@ -1545,7 +1545,7 @@ public: Assert::AreEqual(std::wstring(L""), pCondition8->GetTooltip(TriggerConditionViewModel::TargetTypeProperty)); Assert::AreEqual(std::wstring(L""), pCondition8->GetTooltip(TriggerConditionViewModel::TargetValueProperty)); - const auto* pCondition9 = vmTrigger.Conditions().GetItemAt(8 - nScrollOffset); + const auto* pCondition9 = vmTrigger.Conditions().GetItemAt(8 - gsl::narrow_cast(nScrollOffset)); Expects(pCondition9 != nullptr); Assert::IsFalse(pCondition9->IsIndirect()); Assert::AreEqual(std::wstring(L"0x00000000 (recall)\r\n8: $0xe60589 -> 0x00000000"), @@ -1555,7 +1555,7 @@ public: Assert::AreEqual(std::wstring(L"0x2222\r\n[No code note]"), pCondition9->GetTooltip(TriggerConditionViewModel::TargetValueProperty)); - const auto* pCondition10 = vmTrigger.Conditions().GetItemAt(9 - nScrollOffset); + const auto* pCondition10 = vmTrigger.Conditions().GetItemAt(9 - gsl::narrow_cast(nScrollOffset)); Expects(pCondition8 != nullptr); Assert::IsTrue(pCondition10->IsIndirect()); Assert::AreEqual(std::wstring(L""), pCondition10->GetTooltip(TriggerConditionViewModel::SourceTypeProperty)); diff --git a/tests/ui/viewmodels/TriggerViewModel_Tests.cpp b/tests/ui/viewmodels/TriggerViewModel_Tests.cpp index 49ad72f1..ccbf3903 100644 --- a/tests/ui/viewmodels/TriggerViewModel_Tests.cpp +++ b/tests/ui/viewmodels/TriggerViewModel_Tests.cpp @@ -43,16 +43,11 @@ private: mockEmulatorContext.MockMemory(pMemory, nMemorySize); } - const std::set& GetSelectedItems() const + const std::set& GetSelectedItems() const noexcept { return m_vSelectedConditions; } - int GetScrollOffset() const - { - return GetValue(ScrollOffsetProperty); - } - void SetScrollOffset(int nOffset) { SetValue(ScrollOffsetProperty, nOffset); diff --git a/tests/ui/viewmodels/UnknownGameViewModel_Tests.cpp b/tests/ui/viewmodels/UnknownGameViewModel_Tests.cpp index 55efa55e..6d5fc1f8 100644 --- a/tests/ui/viewmodels/UnknownGameViewModel_Tests.cpp +++ b/tests/ui/viewmodels/UnknownGameViewModel_Tests.cpp @@ -38,9 +38,9 @@ private: ra::services::mocks::MockLocalStorage mockLocalStorage; ra::ui::mocks::MockDesktop mockDesktop; - UnknownGameViewModelHarness() + UnknownGameViewModelHarness() noexcept { - mockUserContext.Initialize("User", "ApiToken"); + GSL_SUPPRESS_F6 mockUserContext.Initialize("User", "ApiToken"); } void MockGameTitles()