From 04d53c811bf402f78e6ac3f68598285514961610 Mon Sep 17 00:00:00 2001 From: AgustinSRG <41982624+AgustinSRG@users.noreply.github.com> Date: Sat, 18 Jun 2022 11:43:11 +0200 Subject: [PATCH] Support for MC 1.19 --- src/minecraft/mc_common.cpp | 17 +++++++++++++---- src/minecraft/mc_common.h | 3 ++- src/wx/main_window.cpp | 21 +++++++++++++-------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/minecraft/mc_common.cpp b/src/minecraft/mc_common.cpp index 31e824c..2891900 100644 --- a/src/minecraft/mc_common.cpp +++ b/src/minecraft/mc_common.cpp @@ -1,15 +1,15 @@ /* * This file is part of ImageToMapMC project - * + * * Copyright (c) 2021 Agustin San Roman - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. @@ -66,6 +66,11 @@ minecraft::McVersion minecraft::getVersionFromText(std::string versionStr) return McVersion::MC_1_18; } + if (versionStr.substr(0, 4).compare("1.19") == 0) + { + return McVersion::MC_1_19; + } + if (versionStr.compare("last") == 0) { return MC_LAST_VERSION; @@ -92,6 +97,8 @@ std::string minecraft::versionToString(minecraft::McVersion version) return std::string("1.17.1"); case McVersion::MC_1_18: return std::string("1.18.2"); + case McVersion::MC_1_19: + return std::string("1.19"); default: return std::string("???"); } @@ -115,6 +122,8 @@ int minecraft::versionToDataVersion(minecraft::McVersion version) return 2730; case McVersion::MC_1_18: return 2975; + case McVersion::MC_1_19: + return 3105; default: return 1343; } @@ -135,7 +144,7 @@ std::string minecraft::getMinecraftFolderLocation() else { std::wstring resultStr(res); - char * resStr = new char[resultStr.length() * 2 + 1]; + char *resStr = new char[resultStr.length() * 2 + 1]; int bytesW = WideCharToMultiByte(CP_UTF8, 0, res, resultStr.length(), resStr, resultStr.length() * 2 + 1, NULL, NULL); resStr[bytesW] = '\0'; diff --git a/src/minecraft/mc_common.h b/src/minecraft/mc_common.h index cec7768..3ea40e5 100644 --- a/src/minecraft/mc_common.h +++ b/src/minecraft/mc_common.h @@ -23,7 +23,7 @@ #pragma once -#define MC_LAST_VERSION (minecraft::McVersion::MC_1_18) +#define MC_LAST_VERSION (minecraft::McVersion::MC_1_19) #include @@ -44,6 +44,7 @@ namespace minecraft MC_1_16 = 16, MC_1_17 = 17, MC_1_18 = 18, + MC_1_19 = 19, }; /** diff --git a/src/wx/main_window.cpp b/src/wx/main_window.cpp index df66cb6..d2c2bc7 100644 --- a/src/wx/main_window.cpp +++ b/src/wx/main_window.cpp @@ -236,7 +236,8 @@ MainWindow::MainWindow() : wxFrame(NULL, wxID_ANY, string("Minecraft Map Art Too // Version wxMenu *menuVersion = new wxMenu(); - menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_18), "&1.18.2", "Version: 1.18.2")->Check(true); + menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_19), "&1.19", "Version: 1.19")->Check(true); + menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_18), "&1.18.2", "Version: 1.18.2"); menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_17), "&1.17.1", "Version: 1.17.1"); menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_16), "&1.16.5", "Version: 1.16.5"); menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_15), "&1.15.2", "Version: 1.15.2"); @@ -1033,30 +1034,34 @@ void MainWindow::updateMenuBarRadios() GetMenuBar()->GetMenu(6)->GetMenuItems()[4]->Check(false); GetMenuBar()->GetMenu(6)->GetMenuItems()[5]->Check(false); GetMenuBar()->GetMenu(6)->GetMenuItems()[6]->Check(false); + GetMenuBar()->GetMenu(6)->GetMenuItems()[7]->Check(false); switch (project.version) { - case McVersion::MC_1_18: + case McVersion::MC_1_19: GetMenuBar()->GetMenu(6)->GetMenuItems()[0]->Check(true); break; - case McVersion::MC_1_17: + case McVersion::MC_1_18: GetMenuBar()->GetMenu(6)->GetMenuItems()[1]->Check(true); break; - case McVersion::MC_1_16: + case McVersion::MC_1_17: GetMenuBar()->GetMenu(6)->GetMenuItems()[2]->Check(true); break; - case McVersion::MC_1_15: + case McVersion::MC_1_16: GetMenuBar()->GetMenu(6)->GetMenuItems()[3]->Check(true); break; - case McVersion::MC_1_14: + case McVersion::MC_1_15: GetMenuBar()->GetMenu(6)->GetMenuItems()[4]->Check(true); break; - case McVersion::MC_1_13: + case McVersion::MC_1_14: GetMenuBar()->GetMenu(6)->GetMenuItems()[5]->Check(true); break; - default: + case McVersion::MC_1_13: GetMenuBar()->GetMenu(6)->GetMenuItems()[6]->Check(true); break; + default: + GetMenuBar()->GetMenu(6)->GetMenuItems()[7]->Check(true); + break; } }