diff --git a/troposphere/haze/include/haze.hpp b/troposphere/haze/include/haze.hpp index 7eaa1cf16..1d72415f1 100644 --- a/troposphere/haze/include/haze.hpp +++ b/troposphere/haze/include/haze.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/troposphere/haze/include/haze/event_reactor.hpp b/troposphere/haze/include/haze/event_reactor.hpp index 4b4ab2372..3968c2a59 100644 --- a/troposphere/haze/include/haze/event_reactor.hpp +++ b/troposphere/haze/include/haze/event_reactor.hpp @@ -42,7 +42,7 @@ namespace haze { public: template Result WaitFor(s32 *out_arg_waiter, Args &&... arg_waiters) { - const Waiter arg_waiter_array[] = {arg_waiters...}; + const Waiter arg_waiter_array[] = { arg_waiters... }; return this->WaitForImpl(out_arg_waiter, sizeof...(Args), arg_waiter_array); } private: diff --git a/troposphere/haze/include/haze/filesystem_proxy.hpp b/troposphere/haze/include/haze/file_system_proxy.hpp similarity index 82% rename from troposphere/haze/include/haze/filesystem_proxy.hpp rename to troposphere/haze/include/haze/file_system_proxy.hpp index 3e16d400d..24650d175 100644 --- a/troposphere/haze/include/haze/filesystem_proxy.hpp +++ b/troposphere/haze/include/haze/file_system_proxy.hpp @@ -20,12 +20,12 @@ namespace haze { - class FilesystemProxy final { + class FileSystemProxy final { private: EventReactor *m_reactor; FsFileSystem *m_filesystem; public: - constexpr explicit FilesystemProxy() : m_reactor(), m_filesystem() { /* ... */ } + constexpr explicit FileSystemProxy() : m_reactor(), m_filesystem() { /* ... */ } void Initialize(EventReactor *reactor, FsFileSystem *fs) { HAZE_ASSERT(fs != nullptr); @@ -41,10 +41,13 @@ namespace haze { private: template Result ForwardResult(F func, Args &&... args) { - Result rc = func(std::forward(args)...); + /* Perform the method call, collecting its result. */ + const Result rc = func(std::forward(args)...); + /* If the event loop was stopped, return that here. */ R_UNLESS(!m_reactor->GetStopRequested(), haze::ResultStopRequested()); + /* Otherwise, return the call result. */ R_RETURN(rc); } public: @@ -72,23 +75,23 @@ namespace haze { R_RETURN(this->ForwardResult(fsFsOpenFile, m_filesystem, path, mode, out_file)); } - Result FileGetSize(FsFile *file, s64 *out_size) { + Result GetSizeFile(FsFile *file, s64 *out_size) { R_RETURN(this->ForwardResult(fsFileGetSize, file, out_size)); } - Result FileSetSize(FsFile *file, s64 size) { + Result SetSizeFile(FsFile *file, s64 size) { R_RETURN(this->ForwardResult(fsFileSetSize, file, size)); } - Result FileRead(FsFile *file, s64 off, void *buf, u64 read_size, u32 option, u64 *out_bytes_read) { + Result ReadFile(FsFile *file, s64 off, void *buf, u64 read_size, u32 option, u64 *out_bytes_read) { R_RETURN(this->ForwardResult(fsFileRead, file, off, buf, read_size, option, out_bytes_read)); } - Result FileWrite(FsFile *file, s64 off, const void *buf, u64 write_size, u32 option) { + Result WriteFile(FsFile *file, s64 off, const void *buf, u64 write_size, u32 option) { R_RETURN(this->ForwardResult(fsFileWrite, file, off, buf, write_size, option)); } - void FileClose(FsFile *file) { + void CloseFile(FsFile *file) { fsFileClose(file); } @@ -104,15 +107,15 @@ namespace haze { R_RETURN(this->ForwardResult(fsFsOpenDirectory, m_filesystem, path, mode, out_dir)); } - Result DirectoryRead(FsDir *d, s64 *out_total_entries, size_t max_entries, FsDirectoryEntry *buf) { + Result ReadDirectory(FsDir *d, s64 *out_total_entries, size_t max_entries, FsDirectoryEntry *buf) { R_RETURN(this->ForwardResult(fsDirRead, d, out_total_entries, max_entries, buf)); } - Result DirectoryGetEntryCount(FsDir *d, s64 *out_count) { + Result GetEntryCountDirectory(FsDir *d, s64 *out_count) { R_RETURN(this->ForwardResult(fsDirGetEntryCount, d, out_count)); } - void DirectoryClose(FsDir *d) { + void CloseDirectory(FsDir *d) { fsDirClose(d); } }; diff --git a/troposphere/haze/include/haze/ptp.hpp b/troposphere/haze/include/haze/ptp.hpp index d32ae5b2e..ff441316e 100644 --- a/troposphere/haze/include/haze/ptp.hpp +++ b/troposphere/haze/include/haze/ptp.hpp @@ -20,230 +20,230 @@ namespace haze { - constexpr size_t PtpUsbBulkHighSpeedMaxPacketLength = 0x200; - constexpr size_t PtpUsbBulkHeaderLength = 2 * sizeof(uint32_t) + 2 * sizeof(uint16_t); - constexpr size_t PtpStringMaxLength = 255; + constexpr inline size_t PtpUsbBulkHighSpeedMaxPacketLength = 0x200; + constexpr inline size_t PtpUsbBulkHeaderLength = 2 * sizeof(u32) + 2 * sizeof(u16); + constexpr inline size_t PtpStringMaxLength = 255; enum PtpUsbBulkContainerType : u16 { PtpUsbBulkContainerType_Undefined = 0, - PtpUsbBulkContainerType_Command = 1, - PtpUsbBulkContainerType_Data = 2, - PtpUsbBulkContainerType_Response = 3, - PtpUsbBulkContainerType_Event = 4, + PtpUsbBulkContainerType_Command = 1, + PtpUsbBulkContainerType_Data = 2, + PtpUsbBulkContainerType_Response = 3, + PtpUsbBulkContainerType_Event = 4, }; enum PtpOperationCode : u16 { - PtpOperationCode_Undefined = 0x1000, - PtpOperationCode_GetDeviceInfo = 0x1001, - PtpOperationCode_OpenSession = 0x1002, - PtpOperationCode_CloseSession = 0x1003, - PtpOperationCode_GetStorageIds = 0x1004, - PtpOperationCode_GetStorageInfo = 0x1005, - PtpOperationCode_GetNumObjects = 0x1006, - PtpOperationCode_GetObjectHandles = 0x1007, - PtpOperationCode_GetObjectInfo = 0x1008, - PtpOperationCode_GetObject = 0x1009, - PtpOperationCode_GetThumb = 0x100A, - PtpOperationCode_DeleteObject = 0x100B, - PtpOperationCode_SendObjectInfo = 0x100C, - PtpOperationCode_SendObject = 0x100D, - PtpOperationCode_InitiateCapture = 0x100E, - PtpOperationCode_FormatStore = 0x100F, - PtpOperationCode_ResetDevice = 0x1010, - PtpOperationCode_SelfTest = 0x1011, - PtpOperationCode_SetObjectProtection = 0x1012, - PtpOperationCode_PowerDown = 0x1013, - PtpOperationCode_GetDevicePropDesc = 0x1014, - PtpOperationCode_GetDevicePropValue = 0x1015, - PtpOperationCode_SetDevicePropValue = 0x1016, - PtpOperationCode_ResetDevicePropValue = 0x1017, - PtpOperationCode_TerminateOpenCapture = 0x1018, - PtpOperationCode_MoveObject = 0x1019, - PtpOperationCode_CopyObject = 0x101A, - PtpOperationCode_GetPartialObject = 0x101B, - PtpOperationCode_InitiateOpenCapture = 0x101C, - PtpOperationCode_StartEnumHandles = 0x101D, - PtpOperationCode_EnumHandles = 0x101E, - PtpOperationCode_StopEnumHandles = 0x101F, - PtpOperationCode_GetVendorExtensionMaps = 0x1020, - PtpOperationCode_GetVendorDeviceInfo = 0x1021, - PtpOperationCode_GetResizedImageObject = 0x1022, - PtpOperationCode_GetFilesystemManifest = 0x1023, - PtpOperationCode_GetStreamInfo = 0x1024, - PtpOperationCode_GetStream = 0x1025, - PtpOperationCode_MtpGetObjectPropsSupported = 0x9801, - PtpOperationCode_MtpGetObjectPropDesc = 0x9802, - PtpOperationCode_MtpGetObjectPropValue = 0x9803, - PtpOperationCode_MtpSetObjectPropValue = 0x9804, - PtpOperationCode_MtpGetObjPropList = 0x9805, - PtpOperationCode_MtpSetObjPropList = 0x9806, + PtpOperationCode_Undefined = 0x1000, + PtpOperationCode_GetDeviceInfo = 0x1001, + PtpOperationCode_OpenSession = 0x1002, + PtpOperationCode_CloseSession = 0x1003, + PtpOperationCode_GetStorageIds = 0x1004, + PtpOperationCode_GetStorageInfo = 0x1005, + PtpOperationCode_GetNumObjects = 0x1006, + PtpOperationCode_GetObjectHandles = 0x1007, + PtpOperationCode_GetObjectInfo = 0x1008, + PtpOperationCode_GetObject = 0x1009, + PtpOperationCode_GetThumb = 0x100a, + PtpOperationCode_DeleteObject = 0x100b, + PtpOperationCode_SendObjectInfo = 0x100c, + PtpOperationCode_SendObject = 0x100d, + PtpOperationCode_InitiateCapture = 0x100e, + PtpOperationCode_FormatStore = 0x100f, + PtpOperationCode_ResetDevice = 0x1010, + PtpOperationCode_SelfTest = 0x1011, + PtpOperationCode_SetObjectProtection = 0x1012, + PtpOperationCode_PowerDown = 0x1013, + PtpOperationCode_GetDevicePropDesc = 0x1014, + PtpOperationCode_GetDevicePropValue = 0x1015, + PtpOperationCode_SetDevicePropValue = 0x1016, + PtpOperationCode_ResetDevicePropValue = 0x1017, + PtpOperationCode_TerminateOpenCapture = 0x1018, + PtpOperationCode_MoveObject = 0x1019, + PtpOperationCode_CopyObject = 0x101a, + PtpOperationCode_GetPartialObject = 0x101b, + PtpOperationCode_InitiateOpenCapture = 0x101c, + PtpOperationCode_StartEnumHandles = 0x101d, + PtpOperationCode_EnumHandles = 0x101e, + PtpOperationCode_StopEnumHandles = 0x101f, + PtpOperationCode_GetVendorExtensionMaps = 0x1020, + PtpOperationCode_GetVendorDeviceInfo = 0x1021, + PtpOperationCode_GetResizedImageObject = 0x1022, + PtpOperationCode_GetFilesystemManifest = 0x1023, + PtpOperationCode_GetStreamInfo = 0x1024, + PtpOperationCode_GetStream = 0x1025, + PtpOperationCode_MtpGetObjectPropsSupported = 0x9801, + PtpOperationCode_MtpGetObjectPropDesc = 0x9802, + PtpOperationCode_MtpGetObjectPropValue = 0x9803, + PtpOperationCode_MtpSetObjectPropValue = 0x9804, + PtpOperationCode_MtpGetObjPropList = 0x9805, + PtpOperationCode_MtpSetObjPropList = 0x9806, PtpOperationCode_MtpGetInterdependendPropdesc = 0x9807, - PtpOperationCode_MtpSendObjectPropList = 0x9808, - PtpOperationCode_MtpGetObjectReferences = 0x9810, - PtpOperationCode_MtpSetObjectReferences = 0x9811, - PtpOperationCode_MtpUpdateDeviceFirmware = 0x9812, - PtpOperationCode_MtpSkip = 0x9820, + PtpOperationCode_MtpSendObjectPropList = 0x9808, + PtpOperationCode_MtpGetObjectReferences = 0x9810, + PtpOperationCode_MtpSetObjectReferences = 0x9811, + PtpOperationCode_MtpUpdateDeviceFirmware = 0x9812, + PtpOperationCode_MtpSkip = 0x9820, }; enum PtpResponseCode : u16 { - PtpResponseCode_Undefined = 0x2000, - PtpResponseCode_Ok = 0x2001, - PtpResponseCode_GeneralError = 0x2002, - PtpResponseCode_SessionNotOpen = 0x2003, - PtpResponseCode_InvalidTransactionId = 0x2004, - PtpResponseCode_OperationNotSupported = 0x2005, - PtpResponseCode_ParameterNotSupported = 0x2006, - PtpResponseCode_IncompleteTransfer = 0x2007, - PtpResponseCode_InvalidStorageId = 0x2008, - PtpResponseCode_InvalidObjectHandle = 0x2009, - PtpResponseCode_DevicePropNotSupported = 0x200A, - PtpResponseCode_InvalidObjectFormatCode = 0x200B, - PtpResponseCode_StoreFull = 0x200C, - PtpResponseCode_ObjectWriteProtected = 0x200D, - PtpResponseCode_StoreReadOnly = 0x200E, - PtpResponseCode_AccessDenied = 0x200F, - PtpResponseCode_NoThumbnailPresent = 0x2010, - PtpResponseCode_SelfTestFailed = 0x2011, - PtpResponseCode_PartialDeletion = 0x2012, - PtpResponseCode_StoreNotAvailable = 0x2013, - PtpResponseCode_SpecificationByFormatUnsupported = 0x2014, - PtpResponseCode_NoValidObjectInfo = 0x2015, - PtpResponseCode_InvalidCodeFormat = 0x2016, - PtpResponseCode_UnknownVendorCode = 0x2017, - PtpResponseCode_CaptureAlreadyTerminated = 0x2018, - PtpResponseCode_DeviceBusy = 0x2019, - PtpResponseCode_InvalidParentObject = 0x201A, - PtpResponseCode_InvalidDevicePropFormat = 0x201B, - PtpResponseCode_InvalidDevicePropValue = 0x201C, - PtpResponseCode_InvalidParameter = 0x201D, - PtpResponseCode_SessionAlreadyOpened = 0x201E, - PtpResponseCode_TransactionCanceled = 0x201F, + PtpResponseCode_Undefined = 0x2000, + PtpResponseCode_Ok = 0x2001, + PtpResponseCode_GeneralError = 0x2002, + PtpResponseCode_SessionNotOpen = 0x2003, + PtpResponseCode_InvalidTransactionId = 0x2004, + PtpResponseCode_OperationNotSupported = 0x2005, + PtpResponseCode_ParameterNotSupported = 0x2006, + PtpResponseCode_IncompleteTransfer = 0x2007, + PtpResponseCode_InvalidStorageId = 0x2008, + PtpResponseCode_InvalidObjectHandle = 0x2009, + PtpResponseCode_DevicePropNotSupported = 0x200a, + PtpResponseCode_InvalidObjectFormatCode = 0x200b, + PtpResponseCode_StoreFull = 0x200c, + PtpResponseCode_ObjectWriteProtected = 0x200d, + PtpResponseCode_StoreReadOnly = 0x200e, + PtpResponseCode_AccessDenied = 0x200f, + PtpResponseCode_NoThumbnailPresent = 0x2010, + PtpResponseCode_SelfTestFailed = 0x2011, + PtpResponseCode_PartialDeletion = 0x2012, + PtpResponseCode_StoreNotAvailable = 0x2013, + PtpResponseCode_SpecificationByFormatUnsupported = 0x2014, + PtpResponseCode_NoValidObjectInfo = 0x2015, + PtpResponseCode_InvalidCodeFormat = 0x2016, + PtpResponseCode_UnknownVendorCode = 0x2017, + PtpResponseCode_CaptureAlreadyTerminated = 0x2018, + PtpResponseCode_DeviceBusy = 0x2019, + PtpResponseCode_InvalidParentObject = 0x201a, + PtpResponseCode_InvalidDevicePropFormat = 0x201b, + PtpResponseCode_InvalidDevicePropValue = 0x201c, + PtpResponseCode_InvalidParameter = 0x201d, + PtpResponseCode_SessionAlreadyOpened = 0x201e, + PtpResponseCode_TransactionCanceled = 0x201f, PtpResponseCode_SpecificationOfDestinationUnsupported = 0x2020, - PtpResponseCode_InvalidEnumHandle = 0x2021, - PtpResponseCode_NoStreamEnabled = 0x2022, - PtpResponseCode_InvalidDataSet = 0x2023, - PtpResponseCode_MtpUndefined = 0xA800, - PtpResponseCode_MtpInvalid_ObjectPropCode = 0xA801, - PtpResponseCode_MtpInvalid_ObjectProp_Format = 0xA802, - PtpResponseCode_MtpInvalid_ObjectProp_Value = 0xA803, - PtpResponseCode_MtpInvalid_ObjectReference = 0xA804, - PtpResponseCode_MtpInvalid_Dataset = 0xA806, - PtpResponseCode_MtpSpecification_By_Group_Unsupported = 0xA807, - PtpResponseCode_MtpSpecification_By_Depth_Unsupported = 0xA808, - PtpResponseCode_MtpObject_Too_Large = 0xA809, - PtpResponseCode_MtpObjectProp_Not_Supported = 0xA80A, + PtpResponseCode_InvalidEnumHandle = 0x2021, + PtpResponseCode_NoStreamEnabled = 0x2022, + PtpResponseCode_InvalidDataSet = 0x2023, + PtpResponseCode_MtpUndefined = 0xa800, + PtpResponseCode_MtpInvalid_ObjectPropCode = 0xa801, + PtpResponseCode_MtpInvalid_ObjectProp_Format = 0xa802, + PtpResponseCode_MtpInvalid_ObjectProp_Value = 0xa803, + PtpResponseCode_MtpInvalid_ObjectReference = 0xa804, + PtpResponseCode_MtpInvalid_Dataset = 0xa806, + PtpResponseCode_MtpSpecification_By_Group_Unsupported = 0xa807, + PtpResponseCode_MtpSpecification_By_Depth_Unsupported = 0xa808, + PtpResponseCode_MtpObject_Too_Large = 0xa809, + PtpResponseCode_MtpObjectProp_Not_Supported = 0xa80A, }; enum PtpEventCode : u16 { - PtpEventCode_Undefined = 0x4000, - PtpEventCode_CancelTransaction = 0x4001, - PtpEventCode_ObjectAdded = 0x4002, - PtpEventCode_ObjectRemoved = 0x4003, - PtpEventCode_StoreAdded = 0x4004, - PtpEventCode_StoreRemoved = 0x4005, - PtpEventCode_DevicePropChanged = 0x4006, - PtpEventCode_ObjectInfoChanged = 0x4007, - PtpEventCode_DeviceInfoChanged = 0x4008, + PtpEventCode_Undefined = 0x4000, + PtpEventCode_CancelTransaction = 0x4001, + PtpEventCode_ObjectAdded = 0x4002, + PtpEventCode_ObjectRemoved = 0x4003, + PtpEventCode_StoreAdded = 0x4004, + PtpEventCode_StoreRemoved = 0x4005, + PtpEventCode_DevicePropChanged = 0x4006, + PtpEventCode_ObjectInfoChanged = 0x4007, + PtpEventCode_DeviceInfoChanged = 0x4008, PtpEventCode_RequestObjectTransfer = 0x4009, - PtpEventCode_StoreFull = 0x400A, - PtpEventCode_DeviceReset = 0x400B, - PtpEventCode_StorageInfoChanged = 0x400C, - PtpEventCode_CaptureComplete = 0x400D, - PtpEventCode_UnreportedStatus = 0x400E, + PtpEventCode_StoreFull = 0x400a, + PtpEventCode_DeviceReset = 0x400b, + PtpEventCode_StorageInfoChanged = 0x400c, + PtpEventCode_CaptureComplete = 0x400d, + PtpEventCode_UnreportedStatus = 0x400e, }; enum PtpDevicePropertyCode : u16 { - PtpDevicePropertyCode_Undefined = 0x5000, - PtpDevicePropertyCode_BatteryLevel = 0x5001, - PtpDevicePropertyCode_FunctionalMode = 0x5002, - PtpDevicePropertyCode_ImageSize = 0x5003, - PtpDevicePropertyCode_CompressionSetting = 0x5004, - PtpDevicePropertyCode_WhiteBalance = 0x5005, - PtpDevicePropertyCode_RgbGain = 0x5006, - PtpDevicePropertyCode_FNumber = 0x5007, - PtpDevicePropertyCode_FocalLength = 0x5008, - PtpDevicePropertyCode_FocusDistance = 0x5009, - PtpDevicePropertyCode_FocusMode = 0x500A, - PtpDevicePropertyCode_ExposureMeteringMode = 0x500B, - PtpDevicePropertyCode_FlashMode = 0x500C, - PtpDevicePropertyCode_ExposureTime = 0x500D, - PtpDevicePropertyCode_ExposureProgramMode = 0x500E, - PtpDevicePropertyCode_ExposureIndex = 0x500F, + PtpDevicePropertyCode_Undefined = 0x5000, + PtpDevicePropertyCode_BatteryLevel = 0x5001, + PtpDevicePropertyCode_FunctionalMode = 0x5002, + PtpDevicePropertyCode_ImageSize = 0x5003, + PtpDevicePropertyCode_CompressionSetting = 0x5004, + PtpDevicePropertyCode_WhiteBalance = 0x5005, + PtpDevicePropertyCode_RgbGain = 0x5006, + PtpDevicePropertyCode_FNumber = 0x5007, + PtpDevicePropertyCode_FocalLength = 0x5008, + PtpDevicePropertyCode_FocusDistance = 0x5009, + PtpDevicePropertyCode_FocusMode = 0x500a, + PtpDevicePropertyCode_ExposureMeteringMode = 0x500b, + PtpDevicePropertyCode_FlashMode = 0x500c, + PtpDevicePropertyCode_ExposureTime = 0x500d, + PtpDevicePropertyCode_ExposureProgramMode = 0x500e, + PtpDevicePropertyCode_ExposureIndex = 0x500f, PtpDevicePropertyCode_ExposureBiasCompensation = 0x5010, - PtpDevicePropertyCode_DateTime = 0x5011, - PtpDevicePropertyCode_CaptureDelay = 0x5012, - PtpDevicePropertyCode_StillCaptureMode = 0x5013, - PtpDevicePropertyCode_Contrast = 0x5014, - PtpDevicePropertyCode_Sharpness = 0x5015, - PtpDevicePropertyCode_DigitalZoom = 0x5016, - PtpDevicePropertyCode_EffectMode = 0x5017, - PtpDevicePropertyCode_BurstNumber = 0x5018, - PtpDevicePropertyCode_BurstInterval = 0x5019, - PtpDevicePropertyCode_TimelapseNumber = 0x501A, - PtpDevicePropertyCode_TimelapseInterval = 0x501B, - PtpDevicePropertyCode_FocusMeteringMode = 0x501C, - PtpDevicePropertyCode_UploadUrl = 0x501D, - PtpDevicePropertyCode_Artist = 0x501E, - PtpDevicePropertyCode_CopyrightInfo = 0x501F, - PtpDevicePropertyCode_SupportedStreams = 0x5020, - PtpDevicePropertyCode_EnabledStreams = 0x5021, - PtpDevicePropertyCode_VideoFormat = 0x5022, - PtpDevicePropertyCode_VideoResolution = 0x5023, - PtpDevicePropertyCode_VideoQuality = 0x5024, - PtpDevicePropertyCode_VideoFrameRate = 0x5025, - PtpDevicePropertyCode_VideoContrast = 0x5026, - PtpDevicePropertyCode_VideoBrightness = 0x5027, - PtpDevicePropertyCode_AudioFormat = 0x5028, - PtpDevicePropertyCode_AudioBitrate = 0x5029, - PtpDevicePropertyCode_AudioSamplingRate = 0x502A, - PtpDevicePropertyCode_AudioBitPerSample = 0x502B, - PtpDevicePropertyCode_AudioVolume = 0x502C, + PtpDevicePropertyCode_DateTime = 0x5011, + PtpDevicePropertyCode_CaptureDelay = 0x5012, + PtpDevicePropertyCode_StillCaptureMode = 0x5013, + PtpDevicePropertyCode_Contrast = 0x5014, + PtpDevicePropertyCode_Sharpness = 0x5015, + PtpDevicePropertyCode_DigitalZoom = 0x5016, + PtpDevicePropertyCode_EffectMode = 0x5017, + PtpDevicePropertyCode_BurstNumber = 0x5018, + PtpDevicePropertyCode_BurstInterval = 0x5019, + PtpDevicePropertyCode_TimelapseNumber = 0x501a, + PtpDevicePropertyCode_TimelapseInterval = 0x501b, + PtpDevicePropertyCode_FocusMeteringMode = 0x501c, + PtpDevicePropertyCode_UploadUrl = 0x501d, + PtpDevicePropertyCode_Artist = 0x501e, + PtpDevicePropertyCode_CopyrightInfo = 0x501f, + PtpDevicePropertyCode_SupportedStreams = 0x5020, + PtpDevicePropertyCode_EnabledStreams = 0x5021, + PtpDevicePropertyCode_VideoFormat = 0x5022, + PtpDevicePropertyCode_VideoResolution = 0x5023, + PtpDevicePropertyCode_VideoQuality = 0x5024, + PtpDevicePropertyCode_VideoFrameRate = 0x5025, + PtpDevicePropertyCode_VideoContrast = 0x5026, + PtpDevicePropertyCode_VideoBrightness = 0x5027, + PtpDevicePropertyCode_AudioFormat = 0x5028, + PtpDevicePropertyCode_AudioBitrate = 0x5029, + PtpDevicePropertyCode_AudioSamplingRate = 0x502a, + PtpDevicePropertyCode_AudioBitPerSample = 0x502b, + PtpDevicePropertyCode_AudioVolume = 0x502c, }; enum PtpObjectFormatCode : u16 { - PtpObjectFormatCode_Undefined = 0x3000, - PtpObjectFormatCode_Association = 0x3001, - PtpObjectFormatCode_Defined = 0x3800, - PtpObjectFormatCode_MtpMediaCard = 0xB211, + PtpObjectFormatCode_Undefined = 0x3000, + PtpObjectFormatCode_Association = 0x3001, + PtpObjectFormatCode_Defined = 0x3800, + PtpObjectFormatCode_MtpMediaCard = 0xb211, }; enum PtpAssociationType : u16 { - PtpAssociationType_Undefined = 0x0, + PtpAssociationType_Undefined = 0x0, PtpAssociationType_GenericFolder = 0x1, }; enum PtpGetObjectHandles : u32 { PtpGetObjectHandles_AllFormats = 0x0, - PtpGetObjectHandles_AllAssocs = 0x0, + PtpGetObjectHandles_AllAssocs = 0x0, PtpGetObjectHandles_AllStorage = 0xffffffff, PtpGetObjectHandles_RootParent = 0xffffffff, }; enum PtpStorageType : u16 { - PtpStorageType_Undefined = 0x0000, - PtpStorageType_FixedRom = 0x0001, + PtpStorageType_Undefined = 0x0000, + PtpStorageType_FixedRom = 0x0001, PtpStorageType_RemovableRom = 0x0002, - PtpStorageType_FixedRam = 0x0003, + PtpStorageType_FixedRam = 0x0003, PtpStorageType_RemovableRam = 0x0004, }; enum PtpFilesystemType : u16 { - PtpFilesystemType_Undefined = 0x0000, - PtpFilesystemType_GenericFlat = 0x0001, + PtpFilesystemType_Undefined = 0x0000, + PtpFilesystemType_GenericFlat = 0x0001, PtpFilesystemType_GenericHierarchical = 0x0002, - PtpFilesystemType_Dcf = 0x0003, + PtpFilesystemType_Dcf = 0x0003, }; enum PtpAccessCapability : u16 { - PtpAccessCapability_ReadWrite = 0x0000, - PtpAccessCapability_ReadOnly = 0x0001, + PtpAccessCapability_ReadWrite = 0x0000, + PtpAccessCapability_ReadOnly = 0x0001, PtpAccessCapability_ReadOnlyWithObjectDeletion = 0x0002, }; enum PtpProtectionStatus : u16 { - PtpProtectionStatus_NoProtection = 0x0000, - PtpProtectionStatus_ReadOnly = 0x0001, - PtpProtectionStatus_MtpReadOnlyData = 0x8002, + PtpProtectionStatus_NoProtection = 0x0000, + PtpProtectionStatus_ReadOnly = 0x0001, + PtpProtectionStatus_MtpReadOnlyData = 0x8002, PtpProtectionStatus_MtpNonTransferableData = 0x8003, }; @@ -252,16 +252,16 @@ namespace haze { }; struct PtpUsbBulkContainer { - uint32_t length; - uint16_t type; - uint16_t code; - uint32_t trans_id; + u32 length; + u16 type; + u16 code; + u32 trans_id; }; static_assert(sizeof(PtpUsbBulkContainer) == PtpUsbBulkHeaderLength); struct PtpNewObjectInfo { - uint32_t storage_id; - uint32_t parent_object_id; - uint32_t object_id; + u32 storage_id; + u32 parent_object_id; + u32 object_id; }; } diff --git a/troposphere/haze/include/haze/ptp_responder.hpp b/troposphere/haze/include/haze/ptp_responder.hpp index b78c9cdbb..f38494430 100644 --- a/troposphere/haze/include/haze/ptp_responder.hpp +++ b/troposphere/haze/include/haze/ptp_responder.hpp @@ -27,7 +27,7 @@ namespace haze { class PtpResponder final { private: AsyncUsbServer m_usb_server; - FilesystemProxy m_fs; + FileSystemProxy m_fs; PtpUsbBulkContainer m_request_header; PtpObjectHeap *m_object_heap; u32 m_send_object_id; diff --git a/troposphere/haze/source/ptp_responder.cpp b/troposphere/haze/source/ptp_responder.cpp index 8cf8d0999..d29dc3b5d 100644 --- a/troposphere/haze/source/ptp_responder.cpp +++ b/troposphere/haze/source/ptp_responder.cpp @@ -383,11 +383,11 @@ namespace haze { R_TRY(m_fs.OpenDirectory(fileobj->GetName(), FsDirOpenMode_ReadDirs | FsDirOpenMode_ReadFiles, std::addressof(dir))); /* Ensure we maintain a clean state on exit. */ - ON_SCOPE_EXIT { m_fs.DirectoryClose(std::addressof(dir)); }; + ON_SCOPE_EXIT { m_fs.CloseDirectory(std::addressof(dir)); }; /* Count how many entries are in the directory. */ s64 entry_count = 0; - R_TRY(m_fs.DirectoryGetEntryCount(std::addressof(dir), std::addressof(entry_count))); + R_TRY(m_fs.GetEntryCountDirectory(std::addressof(dir), std::addressof(entry_count))); /* Begin writing. */ R_TRY(db.AddDataHeader(m_request_header, sizeof(u32) + (entry_count * sizeof(u32)))); @@ -398,7 +398,7 @@ namespace haze { while (true) { /* Get the next batch. */ s64 read_count = 0; - R_TRY(m_fs.DirectoryRead(std::addressof(dir), std::addressof(read_count), DirectoryReadSize, s_dir_entries)); + R_TRY(m_fs.ReadDirectory(std::addressof(dir), std::addressof(read_count), DirectoryReadSize, s_dir_entries)); /* Write to output. */ for (s64 i = 0; i < read_count; i++) { @@ -450,9 +450,9 @@ namespace haze { R_TRY(m_fs.OpenFile(fileobj->GetName(), FsOpenMode_Read, std::addressof(file))); /* Ensure we maintain a clean state on exit. */ - ON_SCOPE_EXIT { m_fs.FileClose(std::addressof(file)); }; + ON_SCOPE_EXIT { m_fs.CloseFile(std::addressof(file)); }; - R_TRY(m_fs.FileGetSize(std::addressof(file), std::addressof(size))); + R_TRY(m_fs.GetSizeFile(std::addressof(file), std::addressof(size))); } object_info.filename = std::strrchr(fileobj->GetName(), '/') + 1; @@ -512,11 +512,11 @@ namespace haze { R_TRY(m_fs.OpenFile(fileobj->GetName(), FsOpenMode_Read, std::addressof(file))); /* Ensure we maintain a clean state on exit. */ - ON_SCOPE_EXIT { m_fs.FileClose(std::addressof(file)); }; + ON_SCOPE_EXIT { m_fs.CloseFile(std::addressof(file)); }; /* Get the file's size. */ s64 size = 0, offset = 0; - R_TRY(m_fs.FileGetSize(std::addressof(file), std::addressof(size))); + R_TRY(m_fs.GetSizeFile(std::addressof(file), std::addressof(size))); /* Send the header and file size. */ R_TRY(db.AddDataHeader(m_request_header, size)); @@ -524,7 +524,7 @@ namespace haze { while (true) { /* Get the next batch. */ size_t bytes_read; - R_TRY(m_fs.FileRead(std::addressof(file), offset, s_fs_buffer, FsBufferSize, FsReadOption_None, std::addressof(bytes_read))); + R_TRY(m_fs.ReadFile(std::addressof(file), offset, s_fs_buffer, FsBufferSize, FsReadOption_None, std::addressof(bytes_read))); offset += bytes_read; @@ -640,11 +640,11 @@ namespace haze { R_TRY(m_fs.OpenFile(fileobj->GetName(), FsOpenMode_Write | FsOpenMode_Append, std::addressof(file))); /* Ensure we maintain a clean state on exit. */ - ON_SCOPE_EXIT { m_fs.FileClose(std::addressof(file)); }; + ON_SCOPE_EXIT { m_fs.CloseFile(std::addressof(file)); }; /* Truncate the file after locking for write. */ s64 offset = 0; - R_TRY(m_fs.FileSetSize(std::addressof(file), 0)); + R_TRY(m_fs.SetSizeFile(std::addressof(file), 0)); /* Begin writing. */ while (true) { @@ -653,7 +653,7 @@ namespace haze { Result rc = dp.ReadBuffer(s_fs_buffer, FsBufferSize, std::addressof(bytes_received)); /* Write to the file. */ - R_TRY(m_fs.FileWrite(std::addressof(file), offset, s_fs_buffer, bytes_received, 0)); + R_TRY(m_fs.WriteFile(std::addressof(file), offset, s_fs_buffer, bytes_received, 0)); offset += bytes_received;