Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLE: use original filename for media exports #15548

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions rpcs3/Emu/Cell/Modules/cellMusicExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,16 @@ error_code cellMusicExportFromFile(vm::cptr<char> srcHddDir, vm::cptr<char> srcH
return { CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = param->title.get_ptr();
std::string filename;

if (filename.empty())
if (srcHddFile)
{
return { CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, "title empty" };
fmt::append(filename, "%s", srcHddFile.get_ptr());
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
if (filename.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down
29 changes: 12 additions & 17 deletions rpcs3/Emu/Cell/Modules/cellPhotoExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,11 @@ error_code cellPhotoRegistFromFile(vm::cptr<char> path, vm::cptr<char> photo_tit
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = photo_title.get_ptr();
const std::string filename = file_path.substr(file_path.find_last_of('/') + 1);

if (filename.empty())
{
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "title empty" };
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down Expand Up @@ -340,16 +335,16 @@ error_code cellPhotoExportFromFile(vm::cptr<char> srcHddDir, vm::cptr<char> srcH
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = param->photo_title.get_ptr();
std::string filename;

if (filename.empty())
if (srcHddFile)
{
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "title empty" };
fmt::append(filename, "%s", srcHddFile.get_ptr());
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
if (filename.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down Expand Up @@ -414,16 +409,16 @@ error_code cellPhotoExportFromFileWithCopy(vm::cptr<char> srcHddDir, vm::cptr<ch
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = param->photo_title.get_ptr();
std::string filename;

if (filename.empty())
if (srcHddFile)
{
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "title empty" };
fmt::append(filename, "%s", srcHddFile.get_ptr());
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
if (filename.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down
20 changes: 10 additions & 10 deletions rpcs3/Emu/Cell/Modules/cellVideoExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@ error_code cellVideoExportFromFileWithCopy(vm::cptr<char> srcHddDir, vm::cptr<ch
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = param->title.get_ptr();
std::string filename;

if (filename.empty())
if (srcHddFile)
{
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "title empty" };
fmt::append(filename, "%s", srcHddFile.get_ptr());
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
if (filename.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down Expand Up @@ -301,16 +301,16 @@ error_code cellVideoExportFromFile(vm::cptr<char> srcHddDir, vm::cptr<char> srcH
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, file_path };
}

std::string filename = param->title.get_ptr();
std::string filename;

if (filename.empty())
if (srcHddFile)
{
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "title empty" };
fmt::append(filename, "%s", srcHddFile.get_ptr());
}

if (const std::string extension = get_file_extension(file_path); !extension.empty())
if (filename.empty())
{
fmt::append(filename, ".%s", extension);
return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "filename empty" };
}

sysutil_register_cb([=](ppu_thread& ppu) -> s32
Expand Down