Compare commits

..

4 commits

Author SHA1 Message Date
13d09e4aa0 SaveTool: prepare for the better import/export system. 2022-01-15 11:31:33 +01:00
ed0c4a73bb SaveTool: mark profiles as "legacy" in the manager.
I'll probably have to redesign that whole part of the UI anyway, so...
2022-01-15 11:31:06 +01:00
8102d1d83a SaveTool: improve the ShellExecuteW call. 2022-01-15 11:30:12 +01:00
9a9c08391a SaveTool: change how story progress is handled. 2022-01-15 11:01:11 +01:00
5 changed files with 29 additions and 5 deletions

View file

@ -22,7 +22,7 @@ struct StoryProgressPoint {
Int id; Int id;
const char* chapter; const char* chapter;
const char* point; const char* point;
const char* after = ""; const char* after = nullptr;
}; };
static const Corrade::Containers::Array<StoryProgressPoint> story_progress static const Corrade::Containers::Array<StoryProgressPoint> story_progress

View file

@ -95,6 +95,10 @@ SaveTool::SaveTool(const Arguments& arguments):
_backupsDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "backups"); _backupsDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "backups");
_stagingDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "staging"); _stagingDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "staging");
_armouryDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "armoury");
_armoursDir = Utility::Directory::join(_armouryDir, "armours");
_weaponsDir = Utility::Directory::join(_armouryDir, "weapons");
_stylesDir = Utility::Directory::join(_armouryDir, "styles");
if(!Utility::Directory::exists(_backupsDir)) { if(!Utility::Directory::exists(_backupsDir)) {
Utility::Directory::mkpath(_backupsDir); Utility::Directory::mkpath(_backupsDir);
@ -104,6 +108,22 @@ SaveTool::SaveTool(const Arguments& arguments):
Utility::Directory::mkpath(_stagingDir); Utility::Directory::mkpath(_stagingDir);
} }
if(!Utility::Directory::exists(_armouryDir)) {
Utility::Directory::mkpath(_armouryDir);
}
if(!Utility::Directory::exists(_armoursDir)) {
Utility::Directory::mkpath(_armoursDir);
}
if(!Utility::Directory::exists(_weaponsDir)) {
Utility::Directory::mkpath(_weaponsDir);
}
if(!Utility::Directory::exists(_stylesDir)) {
Utility::Directory::mkpath(_stylesDir);
}
if(!findGameDataDirectory()) { if(!findGameDataDirectory()) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", _lastError.c_str(), window()); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", _lastError.c_str(), window());
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -748,7 +768,7 @@ void SaveTool::drawTooltip(const char* text, Float wrap_pos) {
} }
void SaveTool::openUri(const std::string& uri) { void SaveTool::openUri(const std::string& uri) {
ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri).c_str(), nullptr, nullptr, SW_SHOW); ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri).c_str(), nullptr, nullptr, SW_SHOWDEFAULT);
} }
void SaveTool::checkGameState() { void SaveTool::checkGameState() {

View file

@ -212,6 +212,10 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
std::string _backupsDir; std::string _backupsDir;
std::string _stagingDir; std::string _stagingDir;
std::string _armouryDir;
std::string _armoursDir;
std::string _weaponsDir;
std::string _stylesDir;
enum class GameState : UnsignedByte { enum class GameState : UnsignedByte {
Unknown, NotRunning, Running Unknown, NotRunning, Running

View file

@ -188,7 +188,7 @@ void SaveTool::drawGeneralInfo() {
{ {
ImGui::TextUnformatted("Story progress:"); ImGui::TextUnformatted("Story progress:");
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.x / 4.0f); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.x / 4.0f);
if(std::strcmp(it->after, "") == 0) { if(!it->after) {
ImGui::TextWrapped("%s - %s", it->chapter, it->point); ImGui::TextWrapped("%s - %s", it->chapter, it->point);
} }
else { else {
@ -261,7 +261,7 @@ void SaveTool::drawGeneralInfo() {
} }
for(const auto& sp : story_progress) { for(const auto& sp : story_progress) {
if(ImGui::BeginMenu(sp.chapter)) { if(ImGui::BeginMenu(sp.chapter)) {
if(std::strcmp(sp.after, "") == 0) { if(!sp.after) {
if(ImGui::MenuItem(sp.point)) { if(ImGui::MenuItem(sp.point)) {
if(!_currentProfile->setStoryProgress(sp.id)) { if(!_currentProfile->setStoryProgress(sp.id)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",

View file

@ -90,7 +90,7 @@ void SaveTool::drawProfileManager() {
} }
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::TextUnformatted(_profileManager->profiles()[i].type() == ProfileType::Demo ? "Demo" : "Full"); ImGui::TextUnformatted(_profileManager->profiles()[i].type() == ProfileType::Demo ? "Demo (legacy)" : "Full (legacy)");
ImGui::TableSetColumnIndex(2); ImGui::TableSetColumnIndex(2);
if(ImGui::SmallButton(ICON_FA_FILE_ARCHIVE)) { if(ImGui::SmallButton(ICON_FA_FILE_ARCHIVE)) {