Compare commits

..

13 commits

8 changed files with 78 additions and 62 deletions

View file

@ -125,8 +125,7 @@ auto MassManager::exportMass(int hangar) -> bool {
return false;
}
if(_hangars[hangar].state() == MassState::Empty ||
_hangars[hangar].state() == MassState::Invalid) {
if(_hangars[hangar].state() != MassState::Valid) {
_lastError = Utility::formatString("There is no valid data to export in hangar {:.2d}", hangar + 1);
return false;
}

View file

@ -16,72 +16,72 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
constexpr char company_name_locator[] = "CompanyName\0\x0c\0\0\0StrProperty";
constexpr char active_slot_locator[] = "ActiveFrameSlot\0\x0c\0\0\0IntProperty";
constexpr char credits_locator[] = "Credit\0\x0c\0\0\0IntProperty";
constexpr char story_progress_locator[] = "StoryProgress\0\x0c\0\0\0IntProperty";
constexpr char last_mission_id_locator[] = "LastMissionID\0\x0c\0\0\0IntProperty";
constexpr char company_name_locator[] = "CompanyName\0\f\0\0\0StrProperty";
constexpr char active_slot_locator[] = "ActiveFrameSlot\0\f\0\0\0IntProperty";
constexpr char credits_locator[] = "Credit\0\f\0\0\0IntProperty";
constexpr char story_progress_locator[] = "StoryProgress\0\f\0\0\0IntProperty";
constexpr char last_mission_id_locator[] = "LastMissionID\0\f\0\0\0IntProperty";
constexpr char verse_steel_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x00\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x00\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char undinium_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x01\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x01\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char necrium_alloy_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x02\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x02\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char lunarite_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x03\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x03\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char asterite_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x04\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x04\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char ednil_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0a\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0a\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char nuflalt_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0b\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0b\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char aurelene_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0c\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\f\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char soldus_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0d\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0d\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char synthesized_n_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0e\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x0e\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char alcarbonite_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x14\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x14\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char keriphene_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x15\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x15\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char nitinol_cm_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x16\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x16\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char quarkium_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x17\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x17\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char alterene_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x18\x35\x0c\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\x18\x35\f\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char mixed_composition_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa0\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa0\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char void_residue_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa1\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa1\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char muscular_construction_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa2\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa2\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char mineral_exoskeletology_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa3\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa3\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";
constexpr char carbonized_skin_locator[] =
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\x0c\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa4\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\x0c\0\0\0IntProperty";
"ID_4_AAE08F17428E229EC7A2209F51081A21\0\f\0\0\0IntProperty\0\x04\0\0\0\0\0\0\0\0\xa4\xbb\x0d\0,\0\0\0"
"Quantity_3_560F09B5485C365D3041888910019CE3\0\f\0\0\0IntProperty";

View file

@ -150,7 +150,7 @@ class Profile {
std::string _steamId;
bool _valid = false;
std::string _lastError = "";
std::string _lastError;
std::string _companyName;

View file

@ -226,6 +226,7 @@ void SaveTool::initEvent(SDL_Event& event) {
_mbManager.get());
if(_gameCheckTimerId == 0) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", SDL_GetError(), window());
exit(EXIT_FAILURE);
}
break;
case MbManagerFailure:
@ -409,7 +410,7 @@ void SaveTool::drawDisclaimer() {
ImGui::Bullet();
ImGui::SameLine();
ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version 0.6.5. It may or may not work with other versions of the game.");
ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version 0.7.6. It may or may not work with other versions of the game.");
ImGui::PopTextWrapPos();

View file

@ -106,21 +106,22 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
template<typename Functor, typename... Args>
auto drawUnsafeWidget(Functor func, Args... args) -> bool {
if(!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) {
GameState game_state = _mbManager->gameState();
if(!_unsafeMode && game_state != GameState::NotRunning) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
}
bool result = func(std::forward<Args>(args)...);
if(!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) {
if(!_unsafeMode && game_state != GameState::NotRunning) {
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
return result;
} // Obviously, should only be used with ImGui widgets that return a bool.
// Also, should be called with a lambda if there are any default arguments, like ImGui::Button(), etc...
// Also, func should be a lambda if there are any default arguments, like ImGui::Button(), etc...
void drawUnsafeText(const char* text, ...); // Alternative to the above, for ImGui::Text*() variants.

View file

@ -27,7 +27,7 @@
#include "../Maps/LastMissionId.h"
#include "../Maps/StoryProgress.h"
static const std::string empty_str = "";
static const std::string empty_str;
void SaveTool::drawManager() {
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
@ -161,8 +161,10 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
ImGuiInputTextFlags_CallbackCharFilter,
callback, nullptr);
ImGui::SameLine();
if((!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) ||
!(len >= 6 && len <= 32) || !(name_view[0] != ' ' && name_view[len - 1] != ' '))
GameState game_state = _mbManager->gameState();
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
@ -173,8 +175,9 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
ImGui::CloseCurrentPopup();
}
if((!_unsafeMode && _mbManager->gameState() != GameState::NotRunning) ||
!(len >= 6 && len <= 32) || !(name_view[0] != ' ' && name_view[len - 1] != ' '))
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
@ -248,7 +251,7 @@ void SaveTool::drawGeneralInfo() {
credits = _currentProfile->credits();
ImGui::OpenPopup("int_edit");
}
if(drawIntEditPopup(&credits, 2000000)) {
if(drawIntEditPopup(&credits, 20000000)) {
if(!_currentProfile->setCredits(credits)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
_currentProfile->lastError().c_str(), window());
@ -303,7 +306,7 @@ void SaveTool::drawResearchInventory() {
ImGui::TableSetColumnIndex(0); \
ImGui::TextUnformatted(name); \
ImGui::TableSetColumnIndex(1); \
ImGui::TextDisabled("Unavailable as of M.A.S.S. Builder version 0.6.5");
ImGui::TextDisabled("Unavailable as of M.A.S.S. Builder version 0.7.6");
#define matRow(name, var, getter, setter) \
ImGui::TableNextRow(); \
@ -314,12 +317,12 @@ void SaveTool::drawResearchInventory() {
drawUnsafeText("%i", _currentProfile->getter()); \
ImGui::TableSetColumnIndex(2); \
ImGui::PushID(#setter); \
static Int var = _currentProfile->getter(); \
static Int var = _currentProfile->getter(); \
if(drawUnsafeWidget([]{ return ImGui::SmallButton(ICON_FA_EDIT); })) { \
(var) = _currentProfile->getter(); \
ImGui::OpenPopup("int_edit"); \
} \
if(drawIntEditPopup(&(var), 10000)) { \
if(drawIntEditPopup(&(var), 9999)) { \
if(!_currentProfile->set##setter((var))) { \
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", \
_currentProfile->lastError().c_str(), window()); \

View file

@ -98,7 +98,7 @@ void SaveTool::drawProfileManager() {
ImGui::OpenPopup(backup_popup_id);
}
ImGui::SameLine(0.0f, 2.0f);
if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) {
if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_TRASH_ALT)) {
profile_index = i;
ImGui::OpenPopup(delete_popup_id);
}

View file

@ -41,6 +41,18 @@ void SaveTool::drawMainMenu() {
ImGui::EndMenu();
}
if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open manager directory")) {
if(ImGui::MenuItem(ICON_FA_EXCHANGE_ALT " Staging area", nullptr, false, _massManager != nullptr)) {
openUri(Utility::Directory::toNativeSeparators(_massManager->stagingAreaDirectory()));
}
if(ImGui::MenuItem(ICON_FA_FILE_ARCHIVE " Profile backups", nullptr, false, _profileManager != nullptr)) {
openUri(Utility::Directory::toNativeSeparators(_profileManager->backupsDirectory()));
}
ImGui::EndMenu();
}
ImGui::Separator();
if(ImGui::MenuItem(ICON_FA_SIGN_OUT_ALT " Quit##QuitMenuItem")) {