cellScreenshot: update filenames
This commit is contained in:
@@ -33,18 +33,12 @@ std::string screenshot_info::get_overlay_path() const
|
|||||||
|
|
||||||
std::string screenshot_info::get_photo_title() const
|
std::string screenshot_info::get_photo_title() const
|
||||||
{
|
{
|
||||||
std::string photo = photo_title;
|
return photo_title.empty() ? Emu.GetTitle() : photo_title;
|
||||||
if (photo.empty())
|
|
||||||
photo = Emu.GetTitle();
|
|
||||||
return photo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string screenshot_info::get_game_title() const
|
std::string screenshot_info::get_game_title() const
|
||||||
{
|
{
|
||||||
std::string game = game_title;
|
return game_title.empty() ? Emu.GetTitle() : game_title;
|
||||||
if (game.empty())
|
|
||||||
game = Emu.GetTitle();
|
|
||||||
return game;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string screenshot_info::get_game_comment() const
|
std::string screenshot_info::get_game_comment() const
|
||||||
@@ -52,15 +46,17 @@ std::string screenshot_info::get_game_comment() const
|
|||||||
return game_comment;
|
return game_comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string screenshot_info::get_screenshot_path(const std::string& date_path) const
|
std::string screenshot_info::get_screenshot_path(s32 year, s32 month, s32 day, s32 hour, s32 minute, s32 second) const
|
||||||
{
|
{
|
||||||
u32 counter = 0;
|
u32 counter = 0;
|
||||||
std::string path = vfs::get("/dev_hdd0/photo/" + date_path + "/" + get_photo_title());
|
const std::string path = vfs::get(fmt::format("/dev_hdd0/photo/%04d/%02d/%02d/%s %02d-%02d-%04d %02d-%02d-%02d",
|
||||||
std::string suffix = ".png";
|
year, month, day, get_photo_title(), day, month, year, hour, minute, second));
|
||||||
|
constexpr std::string_view extension = ".png";
|
||||||
|
std::string suffix = std::string(extension);
|
||||||
|
|
||||||
while (!Emu.IsStopped() && fs::is_file(path + suffix))
|
while (!Emu.IsStopped() && fs::is_file(path + suffix))
|
||||||
{
|
{
|
||||||
suffix = fmt::format("_%d.png", ++counter);
|
suffix = fmt::format(" %d%s", ++counter, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path + suffix;
|
return path + suffix;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ struct screenshot_info
|
|||||||
std::string get_photo_title() const;
|
std::string get_photo_title() const;
|
||||||
std::string get_game_title() const;
|
std::string get_game_title() const;
|
||||||
std::string get_game_comment() const;
|
std::string get_game_comment() const;
|
||||||
std::string get_screenshot_path(const std::string& date_path) const;
|
std::string get_screenshot_path(s32 year, s32 month, s32 day, s32 hour, s32 minute, s32 second) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct screenshot_manager : public screenshot_info
|
struct screenshot_manager : public screenshot_info
|
||||||
|
|||||||
@@ -1040,7 +1040,9 @@ void gs_frame::take_screenshot(std::vector<u8>&& data, u32 sshot_width, u32 ssho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string cell_sshot_filename = manager.get_screenshot_path(date_time.toString("yyyy/MM/dd").toStdString());
|
const QDate date = date_time.date();
|
||||||
|
const QTime time = date_time.time();
|
||||||
|
const std::string cell_sshot_filename = manager.get_screenshot_path(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second());
|
||||||
const std::string cell_sshot_dir = fs::get_parent_dir(cell_sshot_filename);
|
const std::string cell_sshot_dir = fs::get_parent_dir(cell_sshot_filename);
|
||||||
|
|
||||||
screenshot_log.notice("Saving cell screenshot to %s", cell_sshot_filename);
|
screenshot_log.notice("Saving cell screenshot to %s", cell_sshot_filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user