diff --git a/troposphere/haze/include/haze/file_system_proxy.hpp b/troposphere/haze/include/haze/file_system_proxy.hpp index 6f01d64d6..5550fb994 100644 --- a/troposphere/haze/include/haze/file_system_proxy.hpp +++ b/troposphere/haze/include/haze/file_system_proxy.hpp @@ -99,8 +99,8 @@ namespace haze { R_RETURN(this->ForwardResult(fsFsCreateDirectory, m_filesystem, path)); } - Result DeleteDirectory(const char* path) { - R_RETURN(this->ForwardResult(fsFsDeleteDirectory, m_filesystem, path)); + Result DeleteDirectoryRecursively(const char* path) { + R_RETURN(this->ForwardResult(fsFsDeleteDirectoryRecursively, m_filesystem, path)); } Result OpenDirectory(const char *path, u32 mode, FsDir *out_dir) { diff --git a/troposphere/haze/include/haze/ptp_data_builder.hpp b/troposphere/haze/include/haze/ptp_data_builder.hpp index 2ccaddd7a..cdaa7bf10 100644 --- a/troposphere/haze/include/haze/ptp_data_builder.hpp +++ b/troposphere/haze/include/haze/ptp_data_builder.hpp @@ -129,7 +129,7 @@ namespace haze { template Result AddString(const T *str) { - /* Use one less maximum string length for maximum length with null terminator. */ + /* Use one less than the maximum string length for maximum length with null terminator. */ const u8 len = static_cast(std::min(util::Strlen(str), PtpStringMaxLength - 1)); if (len > 0) { diff --git a/troposphere/haze/source/ptp_responder.cpp b/troposphere/haze/source/ptp_responder.cpp index 198759e18..814af8af0 100644 --- a/troposphere/haze/source/ptp_responder.cpp +++ b/troposphere/haze/source/ptp_responder.cpp @@ -62,7 +62,11 @@ namespace haze { constexpr const PtpEventCode SupportedEventCodes[] = { /* ... */}; constexpr const PtpDevicePropertyCode SupportedPropertyCodes[] = { /* ...*/ }; constexpr const PtpObjectFormatCode SupportedCaptureFormats[] = { /* ...*/ }; - constexpr const PtpObjectFormatCode SupportedPlaybackFormats[] = { /* ...*/ }; + + constexpr const PtpObjectFormatCode SupportedPlaybackFormats[] = { + PtpObjectFormatCode_Undefined, + PtpObjectFormatCode_Association, + }; constexpr const StorageId SupportedStorageIds[] = { StorageId_SdmcFs, @@ -592,8 +596,8 @@ namespace haze { /* Make a new object with the intended name. */ PtpNewObjectInfo new_object_info; - new_object_info.storage_id = StorageId_SdmcFs; - new_object_info.parent_object_id = parent_object; + new_object_info.storage_id = StorageId_SdmcFs; + new_object_info.parent_object_id = parent_object == storage_id ? 0 : parent_object; R_TRY(m_object_database.AddObjectId(parentobj->GetName(), g_filename_str, std::addressof(new_object_info.object_id), parentobj->GetObjectId())); @@ -605,7 +609,7 @@ namespace haze { R_UNLESS(fileobj != nullptr, haze::ResultGeneralFailure()); /* Create the object on the filesystem. */ - if (info.association_type == PtpAssociationType_GenericFolder) { + if (info.object_format == PtpObjectFormatCode_Association) { R_TRY(m_fs.CreateDirectory(fileobj->GetName())); m_send_object_id = 0; } else { @@ -685,7 +689,7 @@ namespace haze { /* Remove the object from the filesystem. */ if (entry_type == FsDirEntryType_Dir) { - R_TRY(m_fs.DeleteDirectory(fileobj->GetName())); + R_TRY(m_fs.DeleteDirectoryRecursively(fileobj->GetName())); } else { R_TRY(m_fs.DeleteFile(fileobj->GetName())); }