1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

cellPhotoImport: fallback to extension if sub_type is unknown

This commit is contained in:
Megamouse 2022-08-02 01:02:30 +02:00
parent 4dec8d7925
commit c75b76ddf5

View File

@ -175,8 +175,8 @@ error_code select_photo(std::string dst_dir)
const std::string filename = info.path.substr(info.path.find_last_of(fs::delim) + 1); const std::string filename = info.path.substr(info.path.find_last_of(fs::delim) + 1);
const std::string title = info.get_metadata("title", filename); const std::string title = info.get_metadata("title", filename);
const std::string sub_type = fmt::to_lower(info.sub_type);
const std::string dst_path = dst_dir + "/" + filename; const std::string dst_path = dst_dir + "/" + filename;
std::string sub_type = info.sub_type;
strcpy_trunc(g_filedata->dstFileName, filename); strcpy_trunc(g_filedata->dstFileName, filename);
strcpy_trunc(g_filedata->photo_title, title); strcpy_trunc(g_filedata->photo_title, title);
@ -187,6 +187,20 @@ error_code select_photo(std::string dst_dir)
g_filedata->data_sub->width = info.width; g_filedata->data_sub->width = info.width;
g_filedata->data_sub->height = info.height; g_filedata->data_sub->height = info.height;
cellPhotoImportUtil.notice("Raw image data: filename='%s', title='%s', game='%s', sub_type='%s', width=%d, height=%d, orientation=%d ",
filename, title, Emu.GetTitle(), sub_type, info.width, info.height, info.orientation);
// Fallback to extension if necessary
if (sub_type.empty())
{
sub_type = get_file_extension(filename);
}
if (!sub_type.empty())
{
sub_type = fmt::to_lower(sub_type);
}
if (sub_type == "jpg" || sub_type == "jpeg") if (sub_type == "jpg" || sub_type == "jpeg")
{ {
g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_JPEG; g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_JPEG;
@ -234,7 +248,7 @@ error_code select_photo(std::string dst_dir)
break; break;
} }
cellPhotoImportUtil.notice("Media list dialog: selected entry '%s'. Copying to '%s'...", info.path, dst_path); cellPhotoImportUtil.notice("Media list dialog: Copying '%s' to '%s'...", info.path, dst_path);
if (!fs::copy_file(info.path, dst_path, false)) if (!fs::copy_file(info.path, dst_path, false))
{ {
@ -242,9 +256,6 @@ error_code select_photo(std::string dst_dir)
result = CELL_PHOTO_IMPORT_ERROR_COPY; result = CELL_PHOTO_IMPORT_ERROR_COPY;
} }
cellPhotoImportUtil.notice("Raw image data: filename='%s', title='%s', game='%s', sub_type='%s', width=%d, height=%d, orientation=%d ",
filename, title, Emu.GetTitle(), sub_type, info.width, info.height, info.orientation);
cellPhotoImportUtil.notice("Cell image data: dstFileName='%s', photo_title='%s', game_title='%s', format=%d, width=%d, height=%d, rotate=%d ", cellPhotoImportUtil.notice("Cell image data: dstFileName='%s', photo_title='%s', game_title='%s', format=%d, width=%d, height=%d, rotate=%d ",
g_filedata->dstFileName, g_filedata->photo_title, g_filedata->game_title, static_cast<s32>(g_filedata->data_sub->format), g_filedata->data_sub->width, g_filedata->data_sub->height, static_cast<s32>(g_filedata->data_sub->rotate)); g_filedata->dstFileName, g_filedata->photo_title, g_filedata->game_title, static_cast<s32>(g_filedata->data_sub->format), g_filedata->data_sub->width, g_filedata->data_sub->height, static_cast<s32>(g_filedata->data_sub->rotate));
} }