Compare commits

..

No commits in common. "04d2ab9dc7c5e42daa56c56dbe4165d81a181942" and "fd9f9e5e36e108e2d0f16e779be47c6fe7135134" have entirely different histories.

41 changed files with 102 additions and 117 deletions

View file

@ -13,7 +13,7 @@ launch `MassBuilderSaveTool-<version>.exe`.
1. Install the 64-bit (`x86_64`) version of [MSYS2](https://www.msys2.org/) in its default path (`C:\msys64`), and 1. Install the 64-bit (`x86_64`) version of [MSYS2](https://www.msys2.org/) in its default path (`C:\msys64`), and
update it fully. update it fully.
2. Run `pacman -S git mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-zlib`. 2. Run `pacman -S git mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja`.
3. In a `URCT64` shell, type `git clone https://github.com/williamjcm/MassBuilderSaveTool`. 3. In a `URCT64` shell, type `git clone https://github.com/williamjcm/MassBuilderSaveTool`.
4. Type `cd MassBuilderSaveTool && git submodule init && git submodule update && mkdir build && cd build`. 4. Type `cd MassBuilderSaveTool && git submodule init && git submodule update && mkdir build && cd build`.
5. Type `cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..` 5. Type `cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..`

View file

@ -38,8 +38,8 @@
#include <efsw/efsw.hpp> #include <efsw/efsw.hpp>
#include "../Managers/Mass.h" #include "../ProfileManager/ProfileManager.h"
#include "../Managers/Profile.h" #include "../MassManager/MassManager.h"
#include "../ToastQueue/ToastQueue.h" #include "../ToastQueue/ToastQueue.h"
#include "../UpdateChecker/UpdateChecker.h" #include "../UpdateChecker/UpdateChecker.h"
@ -236,10 +236,10 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
SDL_TimerID _gameCheckTimerId = 0; SDL_TimerID _gameCheckTimerId = 0;
Containers::Pointer<Managers::Profile> _profileManager; Containers::Pointer<ProfileManager> _profileManager;
GameObjects::Profile* _currentProfile = nullptr; GameObjects::Profile* _currentProfile = nullptr;
Containers::Pointer<Managers::Mass> _massManager; Containers::Pointer<MassManager> _massManager;
GameObjects::Mass* _currentMass = nullptr; GameObjects::Mass* _currentMass = nullptr;
GameObjects::Weapon* _currentWeapon = nullptr; GameObjects::Weapon* _currentWeapon = nullptr;

View file

@ -25,8 +25,8 @@
#include "../Configuration/Configuration.h" #include "../Configuration/Configuration.h"
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/LastMissionId.h" #include "../Maps/LastMissionId.h"
#include "../GameData/StoryProgress.h" #include "../Maps/StoryProgress.h"
#include "Application.h" #include "Application.h"

View file

@ -21,10 +21,9 @@
#include "../Configuration/Configuration.h" #include "../Configuration/Configuration.h"
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/Accessories.h" #include "../Maps/Accessories.h"
#define STYLENAMES_DEFINITION #define STYLENAMES_DEFINITION
#include "../GameData/StyleNames.h" #include "../Maps/StyleNames.h"
#include "../ImportExport/Export.h"
#include "Application.h" #include "Application.h"

View file

@ -15,8 +15,9 @@
// 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 "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/ArmourSets.h"
#include "../GameData/StyleNames.h" #include "../Maps/ArmourSets.h"
#include "../Maps/StyleNames.h"
#include "Application.h" #include "Application.h"

View file

@ -15,7 +15,7 @@
// 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 "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/StyleNames.h" #include "../Maps/StyleNames.h"
#include "Application.h" #include "Application.h"

View file

@ -16,8 +16,8 @@
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/StyleNames.h" #include "../Maps/StyleNames.h"
#include "../GameData/WeaponParts.h" #include "../Maps/WeaponParts.h"
#include "Application.h" #include "Application.h"

View file

@ -157,41 +157,42 @@ add_executable(MassBuilderSaveTool
Application/Application_UpdateChecker.cpp Application/Application_UpdateChecker.cpp
Configuration/Configuration.h Configuration/Configuration.h
Configuration/Configuration.cpp Configuration/Configuration.cpp
GameData/Accessories.h ProfileManager/ProfileManager.h
GameData/ArmourSets.h ProfileManager/ProfileManager.cpp
GameData/LastMissionId.h Profile/Profile.h
GameData/ResourceIDs.h Profile/Profile.cpp
GameData/StoryProgress.h Profile/PropertyNames.h
GameData/StyleNames.h Profile/ResourceIDs.h
GameData/WeaponParts.h MassManager/MassManager.h
GameObjects/Accessory.h MassManager/MassManager.cpp
GameObjects/ArmourPart.h Mass/Accessory.h
GameObjects/BulletLauncherAttachment.h Mass/ArmourPart.h
GameObjects/CustomStyle.h Mass/BulletLauncherAttachment.h
GameObjects/Decal.h Mass/CustomStyle.h
GameObjects/Joints.h Mass/Decal.h
GameObjects/Mass.h Mass/Joints.h
GameObjects/Mass.cpp Mass/Mass.h
GameObjects/Mass_Frame.cpp Mass/Mass.cpp
GameObjects/Mass_Armour.cpp Mass/Mass_Frame.cpp
GameObjects/Mass_Weapons.cpp Mass/Mass_Armour.cpp
GameObjects/Mass_Styles.cpp Mass/Mass_Weapons.cpp
GameObjects/Mass_DecalsAccessories.cpp Mass/Mass_Styles.cpp
GameObjects/PropertyNames.h Mass/Mass_DecalsAccessories.cpp
GameObjects/Profile.h Mass/PropertyNames.h
GameObjects/Profile.cpp Mass/Weapon.h
GameObjects/Weapon.h Mass/Weapon.cpp
GameObjects/Weapon.cpp Mass/WeaponPart.h
GameObjects/WeaponPart.h Maps/Accessories.h
Managers/Mass.h Maps/ArmourSets.h
Managers/Mass.cpp
Managers/Profile.h
Managers/Profile.cpp
Maps/ArmourSlots.hpp Maps/ArmourSlots.hpp
Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherAttachmentStyles.hpp
Maps/BulletLauncherSockets.hpp Maps/BulletLauncherSockets.hpp
Maps/DamageTypes.hpp Maps/DamageTypes.hpp
Maps/EffectColourModes.hpp Maps/EffectColourModes.hpp
Maps/LastMissionId.h
Maps/StoryProgress.h
Maps/StyleNames.h
Maps/WeaponParts.h
Maps/WeaponTypes.hpp Maps/WeaponTypes.hpp
ToastQueue/ToastQueue.h ToastQueue/ToastQueue.h
ToastQueue/ToastQueue.cpp ToastQueue/ToastQueue.cpp

View file

@ -18,7 +18,7 @@
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../GameObjects/CustomStyle.h" #include "../Mass/CustomStyle.h"
using namespace Corrade; using namespace Corrade;

View file

@ -18,7 +18,7 @@
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../GameObjects/CustomStyle.h" #include "../Mass/CustomStyle.h"
using namespace Corrade; using namespace Corrade;

View file

@ -1,32 +1,5 @@
#pragma once #pragma once
// MassBuilderSaveTool
// Copyright (C) 2021-2024 Guillaume Jacquemin
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Profile stuff
#define PROFILE_NAME "CompanyName"
#define PROFILE_ACTIVE_FRAME_SLOT "ActiveFrameSlot"
#define PROFILE_CREDITS "Credit"
#define PROFILE_STORY_PROGRESS "StoryProgress"
#define PROFILE_LAST_MISSION_ID "LastMissionID"
#define PROFILE_MATERIAL "ResourceMaterial"
#define PROFILE_QUARK_DATA "ResourceQuarkData"
#define PROFILE_ACCOUNT "Account"
// Basic MASS stuff
#define MASS_UNIT_DATA "UnitData" #define MASS_UNIT_DATA "UnitData"
#define MASS_NAME "Name_45_A037C5D54E53456407BDF091344529BB" #define MASS_NAME "Name_45_A037C5D54E53456407BDF091344529BB"
#define MASS_ACCOUNT "Account" #define MASS_ACCOUNT "Account"

View file

@ -21,13 +21,13 @@
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
#include "Mass.h" #include "MassManager.h"
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst { namespace Managers { namespace mbst {
Mass::Mass(Containers::StringView save_path, Containers::StringView account, bool demo, MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo,
Containers::StringView staging_dir): Containers::StringView staging_dir):
_saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir}
{ {
@ -42,17 +42,17 @@ Mass::Mass(Containers::StringView save_path, Containers::StringView account, boo
} }
Containers::StringView Containers::StringView
Mass::lastError() { MassManager::lastError() {
return _lastError; return _lastError;
} }
GameObjects::Mass& GameObjects::Mass&
Mass::hangar(std::int32_t hangar) { MassManager::hangar(std::int32_t hangar) {
return _hangars[hangar]; return _hangars[hangar];
} }
void void
Mass::refreshHangar(std::int32_t hangar) { MassManager::refreshHangar(std::int32_t hangar) {
if(hangar < 0 || hangar >= 32) { if(hangar < 0 || hangar >= 32) {
_lastError = "Hangar index out of range."; _lastError = "Hangar index out of range.";
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -66,7 +66,7 @@ Mass::refreshHangar(std::int32_t hangar) {
} }
bool bool
Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) { MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
if(hangar < 0 || hangar >= 32) { if(hangar < 0 || hangar >= 32) {
_lastError = "Hangar index out of range."; _lastError = "Hangar index out of range.";
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -109,7 +109,7 @@ Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
} }
bool bool
Mass::exportMass(std::int32_t hangar) { MassManager::exportMass(std::int32_t hangar) {
if(hangar < 0 || hangar >= 32) { if(hangar < 0 || hangar >= 32) {
_lastError = "Hangar index out of range."_s; _lastError = "Hangar index out of range."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -136,7 +136,7 @@ Mass::exportMass(std::int32_t hangar) {
} }
bool bool
Mass::moveMass(std::int32_t source, std::int32_t destination) { MassManager::moveMass(std::int32_t source, std::int32_t destination) {
if(source < 0 || source >= 32) { if(source < 0 || source >= 32) {
_lastError = "Source hangar index out of range."_s; _lastError = "Source hangar index out of range."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -174,7 +174,7 @@ Mass::moveMass(std::int32_t source, std::int32_t destination) {
} }
bool bool
Mass::deleteMass(std::int32_t hangar) { MassManager::deleteMass(std::int32_t hangar) {
if(hangar < 0 || hangar >= 32) { if(hangar < 0 || hangar >= 32) {
_lastError = "Hangar index out of range."_s; _lastError = "Hangar index out of range."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -191,12 +191,12 @@ Mass::deleteMass(std::int32_t hangar) {
} }
const std::map<Containers::String, Containers::String>& const std::map<Containers::String, Containers::String>&
Mass::stagedMasses() { MassManager::stagedMasses() {
return _stagedMasses; return _stagedMasses;
} }
void void
Mass::refreshStagedMasses() { MassManager::refreshStagedMasses() {
_stagedMasses.clear(); _stagedMasses.clear();
using Utility::Path::ListFlag; using Utility::Path::ListFlag;
@ -229,7 +229,7 @@ Mass::refreshStagedMasses() {
} }
void void
Mass::refreshStagedMass(Containers::StringView filename) { MassManager::refreshStagedMass(Containers::StringView filename) {
LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename);
bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename)); bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename));
@ -250,7 +250,7 @@ Mass::refreshStagedMass(Containers::StringView filename) {
} }
bool bool
Mass::deleteStagedMass(Containers::StringView filename) { MassManager::deleteStagedMass(Containers::StringView filename) {
if(_stagedMasses.find(filename) == _stagedMasses.cend()) { if(_stagedMasses.find(filename) == _stagedMasses.cend()) {
_lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s; _lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -266,4 +266,4 @@ Mass::deleteStagedMass(Containers::StringView filename) {
return true; return true;
} }
}} }

View file

@ -22,15 +22,15 @@
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../GameObjects/Mass.h" #include "../Mass/Mass.h"
using namespace Corrade; using namespace Corrade;
namespace mbst { namespace Managers { namespace mbst {
class Mass { class MassManager {
public: public:
Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
auto lastError() -> Containers::StringView; auto lastError() -> Containers::StringView;
@ -63,4 +63,4 @@ class Mass {
std::map<Containers::String, Containers::String> _stagedMasses; std::map<Containers::String, Containers::String> _stagedMasses;
}; };
}} }

View file

@ -21,9 +21,10 @@
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../GameData/ResourceIDs.h"
#include "../Gvas/File.h" #include "../Gvas/File.h"
#include "ResourceIDs.h"
using namespace Corrade; using namespace Corrade;
namespace mbst { namespace GameObjects { namespace mbst { namespace GameObjects {

View file

@ -0,0 +1,10 @@
#pragma once
#define PROFILE_NAME "CompanyName"
#define PROFILE_ACTIVE_FRAME_SLOT "ActiveFrameSlot"
#define PROFILE_CREDITS "Credit"
#define PROFILE_STORY_PROGRESS "StoryProgress"
#define PROFILE_LAST_MISSION_ID "LastMissionID"
#define PROFILE_MATERIAL "ResourceMaterial"
#define PROFILE_QUARK_DATA "ResourceQuarkData"
#define PROFILE_ACCOUNT "Account"

View file

@ -29,13 +29,13 @@
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
#include "Profile.h" #include "ProfileManager.h"
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst { namespace Managers { namespace mbst {
Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_dir): ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir):
_saveDirectory{save_dir}, _saveDirectory{save_dir},
_backupsDirectory{backup_dir} _backupsDirectory{backup_dir}
{ {
@ -43,22 +43,22 @@ Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_
} }
bool bool
Profile::ready() const { ProfileManager::ready() const {
return _ready; return _ready;
} }
Containers::StringView Containers::StringView
Profile::lastError() { ProfileManager::lastError() {
return _lastError; return _lastError;
} }
Containers::ArrayView<GameObjects::Profile> Containers::ArrayView<GameObjects::Profile>
Profile::profiles() { ProfileManager::profiles() {
return _profiles; return _profiles;
} }
bool bool
Profile::refreshProfiles() { ProfileManager::refreshProfiles() {
LOG_INFO("Refreshing profiles."); LOG_INFO("Refreshing profiles.");
_profiles = Containers::Array<GameObjects::Profile>{}; _profiles = Containers::Array<GameObjects::Profile>{};
@ -100,12 +100,12 @@ Profile::refreshProfiles() {
} }
GameObjects::Profile* GameObjects::Profile*
Profile::getProfile(std::size_t index) { ProfileManager::getProfile(std::size_t index) {
return index <= _profiles.size() ? &(_profiles[index]) : nullptr; return index <= _profiles.size() ? &(_profiles[index]) : nullptr;
} }
bool bool
Profile::deleteProfile(std::size_t index, bool delete_builds) { ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) { if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) {
_lastError = Utility::format("Couldn't delete {} (filename: {}).", _lastError = Utility::format("Couldn't delete {} (filename: {}).",
_profiles[index].companyName(), _profiles[index].companyName(),
@ -136,7 +136,7 @@ Profile::deleteProfile(std::size_t index, bool delete_builds) {
} }
bool bool
Profile::backupProfile(std::size_t index, bool backup_builds) { ProfileManager::backupProfile(std::size_t index, bool backup_builds) {
std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::tm* time = std::localtime(&timestamp); std::tm* time = std::localtime(&timestamp);
auto& profile = _profiles[index]; auto& profile = _profiles[index];
@ -213,12 +213,12 @@ Profile::backupProfile(std::size_t index, bool backup_builds) {
} }
Containers::ArrayView<Backup> Containers::ArrayView<Backup>
Profile::backups() { ProfileManager::backups() {
return _backups; return _backups;
} }
void void
Profile::refreshBackups() { ProfileManager::refreshBackups() {
_backups = Containers::Array<Backup>{}; _backups = Containers::Array<Backup>{};
using Utility::Path::ListFlag; using Utility::Path::ListFlag;
@ -303,7 +303,7 @@ Profile::refreshBackups() {
} }
bool bool
Profile::deleteBackup(std::size_t index) { ProfileManager::deleteBackup(std::size_t index) {
if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) { if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) {
_lastError = "Couldn't delete " + _backups[index].filename; _lastError = "Couldn't delete " + _backups[index].filename;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
@ -321,7 +321,7 @@ Profile::deleteBackup(std::size_t index) {
} }
bool bool
Profile::restoreBackup(std::size_t index) { ProfileManager::restoreBackup(std::size_t index) {
const Backup& backup = _backups[index]; const Backup& backup = _backups[index];
auto error_format = "Extraction of file {} failed: {}"_s; auto error_format = "Extraction of file {} failed: {}"_s;
@ -380,4 +380,4 @@ Profile::restoreBackup(std::size_t index) {
return true; return true;
} }
}} }

View file

@ -23,11 +23,11 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include "../GameObjects/Profile.h" #include "../Profile/Profile.h"
using namespace Corrade; using namespace Corrade;
namespace mbst { namespace Managers { namespace mbst {
struct Backup { struct Backup {
Containers::String filename; Containers::String filename;
@ -44,9 +44,9 @@ struct Backup {
Containers::Array<Containers::String> includedFiles; Containers::Array<Containers::String> includedFiles;
}; };
class Profile { class ProfileManager {
public: public:
explicit Profile(Containers::StringView save_dir, Containers::StringView backup_dir); explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir);
auto ready() const -> bool; auto ready() const -> bool;
auto lastError() -> Containers::StringView; auto lastError() -> Containers::StringView;
@ -75,4 +75,4 @@ class Profile {
Containers::Array<Backup> _backups; Containers::Array<Backup> _backups;
}; };
}} }