Skip to content

Commit

Permalink
HLE: use original filename for media exports
Browse files Browse the repository at this point in the history
No idea what's the real logic here.
I was just winging it with the title before.
It's most likely just meant for metadata.
  • Loading branch information
Megamouse committed May 4, 2024
1 parent f1ef3bd commit c4a688b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 32 deletions.
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

0 comments on commit c4a688b

Please sign in to comment.