Compare commits

...

8 Commits

9 changed files with 63 additions and 19 deletions

View File

@ -11,4 +11,16 @@
/>
</dependentAssembly>
</dependency>
</assembly>
<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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,45 +14,67 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "SaveTool/SaveTool.h"
#ifndef SAVETOOL_DEBUG_BUILD
#include <fstream>
#endif
#include <SDL_messagebox.h>
#include <cpuid.h>
#include <errhandlingapi.h>
#include <synchapi.h>
#include <winerror.h>
#include "SaveTool/SaveTool.h"
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};
Utility::Debug d{&output};
Utility::Warning w{&output};
Utility::Error e{&output};
#else
#else
Utility::Warning w{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");
if(!mutex_handle) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app",
"There was an error initialising the mutex.",nullptr);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
"There was an error initialising the single-instance checker.",nullptr);
return EXIT_FAILURE;
}
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);
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});
Int result = app.exec();