Compare commits

..

8 commits

9 changed files with 63 additions and 19 deletions

View file

@ -11,4 +11,16 @@
/> />
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>
<asmv3:application>
<asmv3:windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
UTF-8
</activeCodePage>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
true/pm</dpiAware> <!-- legacy -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
permonitorv2,permonitor
</dpiAwareness> <!-- falls back to pm if pmv2 is not available -->
</asmv3:windowsSettings>
</asmv3:application>
</assembly> </assembly>

View file

@ -27,6 +27,8 @@
#include <Magnum/ImGuiIntegration/Integration.h> #include <Magnum/ImGuiIntegration/Integration.h>
#include <Magnum/ImGuiIntegration/Context.hpp> #include <Magnum/ImGuiIntegration/Context.hpp>
#include <SDL.h>
#include <curl/curl.h> #include <curl/curl.h>
#include <shellapi.h> #include <shellapi.h>

View file

@ -27,7 +27,7 @@
#include <Magnum/Platform/Sdl2Application.h> #include <Magnum/Platform/Sdl2Application.h>
#include <Magnum/ImGuiIntegration/Context.h> #include <Magnum/ImGuiIntegration/Context.h>
#include <SDL.h> #include <SDL_timer.h>
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>

View file

@ -17,6 +17,8 @@
#include <Corrade/Utility/String.h> #include <Corrade/Utility/String.h>
#include <Corrade/Utility/Unicode.h> #include <Corrade/Utility/Unicode.h>
#include <SDL_events.h>
#include <fileapi.h> #include <fileapi.h>
#include <handleapi.h> #include <handleapi.h>

View file

@ -19,6 +19,9 @@
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include <Corrade/Utility/Unicode.h> #include <Corrade/Utility/Unicode.h>
#include <SDL_events.h>
#include <SDL_messagebox.h>
#include <shlobj.h> #include <shlobj.h>
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"

View file

@ -14,20 +14,19 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "SaveTool.h"
#include <algorithm> #include <algorithm>
#include <Corrade/Containers/Reference.h>
#include <Corrade/Utility/Format.h> #include <Corrade/Utility/Format.h>
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include <Corrade/Utility/String.h>
#include <SDL_messagebox.h>
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../Maps/LastMissionId.h" #include "../Maps/LastMissionId.h"
#include "../Maps/StoryProgress.h" #include "../Maps/StoryProgress.h"
#include "SaveTool.h"
void SaveTool::drawManager() { void SaveTool::drawManager() {
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y},

View file

@ -14,12 +14,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "SaveTool.h"
#include <Magnum/ImGuiIntegration/Integration.h> #include <Magnum/ImGuiIntegration/Integration.h>
#include <SDL_messagebox.h>
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "SaveTool.h"
extern const ImVec2 center_pivot; extern const ImVec2 center_pivot;
void SaveTool::drawProfileManager() { void SaveTool::drawProfileManager() {

View file

@ -16,6 +16,8 @@
#include <Corrade/Utility/Format.h> #include <Corrade/Utility/Format.h>
#include <SDL_events.h>
#include <curl/curl.h> #include <curl/curl.h>
#include "SaveTool.h" #include "SaveTool.h"

View file

@ -14,45 +14,67 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "SaveTool/SaveTool.h"
#ifndef SAVETOOL_DEBUG_BUILD #ifndef SAVETOOL_DEBUG_BUILD
#include <fstream> #include <fstream>
#endif #endif
#include <SDL_messagebox.h>
#include <cpuid.h>
#include <errhandlingapi.h> #include <errhandlingapi.h>
#include <synchapi.h> #include <synchapi.h>
#include <winerror.h> #include <winerror.h>
#include "SaveTool/SaveTool.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
#ifndef SAVETOOL_DEBUG_BUILD auto str = std::setlocale(LC_ALL, ".utf-8");
if(str && !Containers::StringView{str}.hasSuffix(".utf8")) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
"Your system doesn't support UTF-8.", nullptr);
return EXIT_FAILURE;
}
#ifndef SAVETOOL_DEBUG_BUILD
std::ofstream output{"SaveToolLog.txt", std::ios::trunc|std::ios::out}; std::ofstream output{"SaveToolLog.txt", std::ios::trunc|std::ios::out};
Utility::Debug d{&output}; Utility::Debug d{&output};
Utility::Warning w{&output}; Utility::Warning w{&output};
Utility::Error e{&output}; Utility::Error e{&output};
#else #else
Utility::Warning w{Utility::Debug::defaultOutput()}; Utility::Warning w{Utility::Debug::defaultOutput()};
Utility::Error e{Utility::Debug::defaultOutput()}; Utility::Error e{Utility::Debug::defaultOutput()};
#endif #endif
Utility::Debug{} << "===M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION "==="; Utility::Debug{} << "M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION;
auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool"); auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool");
if(!mutex_handle) { if(!mutex_handle) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
"There was an error initialising the mutex.",nullptr); "There was an error initialising the single-instance checker.",nullptr);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if(GetLastError() == ERROR_ALREADY_EXISTS) { if(GetLastError() == ERROR_ALREADY_EXISTS) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
"There can be only one running instance of the application.",nullptr); "There can be only one running instance of the application.",nullptr);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
Utility::Debug{} << "===Initialising OpenGL renderer==="; std::uint32_t brand[12];
if (!__get_cpuid_max(0x80000004, nullptr)) {
Utility::Warning{} << "Warning: CPUID features not supported. Can't get the current processor's model.";
}
else {
__get_cpuid(0x80000002, brand+0x0, brand+0x1, brand+0x2, brand+0x3);
__get_cpuid(0x80000003, brand+0x4, brand+0x5, brand+0x6, brand+0x7);
__get_cpuid(0x80000004, brand+0x8, brand+0x9, brand+0xa, brand+0xb);
Utility::Debug{} << "Processor:" << Containers::arrayCast<const char>(brand).data();
}
SaveTool app({argc, argv}); SaveTool app({argc, argv});
Int result = app.exec(); Int result = app.exec();