diff --git a/troposphere/haze/include/haze/common.hpp b/troposphere/haze/include/haze/common.hpp index b0f1f6b12..5ebaf5861 100644 --- a/troposphere/haze/include/haze/common.hpp +++ b/troposphere/haze/include/haze/common.hpp @@ -42,6 +42,6 @@ namespace haze { using Result = ::ams::Result; - static constexpr size_t UsbBulkPacketBufferSize = 1_MB; + static constexpr u32 UsbBulkPacketBufferSize = 1_MB; } diff --git a/troposphere/haze/include/haze/ptp.hpp b/troposphere/haze/include/haze/ptp.hpp index 6d7a76e15..2a9f18fc7 100644 --- a/troposphere/haze/include/haze/ptp.hpp +++ b/troposphere/haze/include/haze/ptp.hpp @@ -20,9 +20,9 @@ namespace haze { - constexpr inline size_t PtpUsbBulkHighSpeedMaxPacketLength = 0x200; - constexpr inline size_t PtpUsbBulkHeaderLength = 2 * sizeof(u32) + 2 * sizeof(u16); - constexpr inline size_t PtpStringMaxLength = 255; + constexpr inline u32 PtpUsbBulkHighSpeedMaxPacketLength = 0x200; + constexpr inline u32 PtpUsbBulkHeaderLength = 2 * sizeof(u32) + 2 * sizeof(u16); + constexpr inline u32 PtpStringMaxLength = 255; enum PtpUsbBulkContainerType : u16 { PtpUsbBulkContainerType_Undefined = 0, diff --git a/troposphere/haze/include/haze/ptp_data_builder.hpp b/troposphere/haze/include/haze/ptp_data_builder.hpp index 46498c8d2..6e1baa064 100644 --- a/troposphere/haze/include/haze/ptp_data_builder.hpp +++ b/troposphere/haze/include/haze/ptp_data_builder.hpp @@ -24,8 +24,8 @@ namespace haze { class PtpDataBuilder final { private: AsyncUsbServer *m_server; - size_t m_transmitted_size; - size_t m_offset; + u32 m_transmitted_size; + u32 m_offset; u8 *m_data; bool m_disabled; private: @@ -110,7 +110,7 @@ namespace haze { HAZE_ASSERT(m_offset == 0 && m_transmitted_size == 0); /* Declare how many bytes the data will require to write. */ - size_t data_size = 0; + u32 data_size = 0; { /* Temporarily disable writing to calculate the size.*/ m_disabled = true; diff --git a/troposphere/haze/include/haze/ptp_data_parser.hpp b/troposphere/haze/include/haze/ptp_data_parser.hpp index 2ae23b84b..f151f237a 100644 --- a/troposphere/haze/include/haze/ptp_data_parser.hpp +++ b/troposphere/haze/include/haze/ptp_data_parser.hpp @@ -56,7 +56,7 @@ namespace haze { } } - Result ReadBuffer(u8 *buffer, size_t count, size_t *out_read_count) { + Result ReadBuffer(u8 *buffer, u32 count, u32 *out_read_count) { *out_read_count = 0; while (count > 0) { @@ -80,7 +80,7 @@ namespace haze { template Result Read(T *out_t) { - size_t read_count; + u32 read_count; u8 bytes[sizeof(T)]; R_TRY(this->ReadBuffer(bytes, sizeof(T), std::addressof(read_count))); diff --git a/troposphere/haze/include/haze/usb_session.hpp b/troposphere/haze/include/haze/usb_session.hpp index b1c91f012..dacd83d49 100644 --- a/troposphere/haze/include/haze/usb_session.hpp +++ b/troposphere/haze/include/haze/usb_session.hpp @@ -41,7 +41,7 @@ namespace haze { bool GetConfigured() const; Event *GetCompletionEvent(UsbSessionEndpoint ep) const; - Result TransferAsync(UsbSessionEndpoint ep, void *buffer, size_t size, u32 *out_urb_id); + Result TransferAsync(UsbSessionEndpoint ep, void *buffer, u32 size, u32 *out_urb_id); Result GetTransferResult(UsbSessionEndpoint ep, u32 urb_id, u32 *out_transferred_size); Result SetZeroLengthTermination(bool enable); }; diff --git a/troposphere/haze/source/ptp_object_heap.cpp b/troposphere/haze/source/ptp_object_heap.cpp index 4a62ab217..2157b59c5 100644 --- a/troposphere/haze/source/ptp_object_heap.cpp +++ b/troposphere/haze/source/ptp_object_heap.cpp @@ -25,19 +25,18 @@ namespace haze { } void PtpObjectHeap::Initialize() { - size_t mem_used = 0; - /* If we're already initialized, skip re-initialization. */ if (m_heap_block_size != 0) { return; } /* Estimate how much memory we can reserve. */ + size_t mem_used = 0; HAZE_R_ABORT_UNLESS(svcGetInfo(std::addressof(mem_used), InfoType_UsedMemorySize, svc::CurrentProcess, 0)); HAZE_ASSERT(mem_used > LibnxReservedMemorySize); mem_used -= LibnxReservedMemorySize; - /* Take the rest for ourselves. */ + /* Calculate size of blocks. */ m_heap_block_size = mem_used / NumHeapBlocks; HAZE_ASSERT(m_heap_block_size > 0); diff --git a/troposphere/haze/source/ptp_responder.cpp b/troposphere/haze/source/ptp_responder.cpp index b800af792..c009f3e57 100644 --- a/troposphere/haze/source/ptp_responder.cpp +++ b/troposphere/haze/source/ptp_responder.cpp @@ -595,7 +595,7 @@ namespace haze { s64 offset = 0; while (true) { /* Get the next batch. */ - size_t bytes_read; + u64 bytes_read; R_TRY(m_fs.ReadFile(std::addressof(file), offset, g_fs_buffer, FsBufferSize, FsReadOption_None, std::addressof(bytes_read))); offset += bytes_read; @@ -726,7 +726,7 @@ namespace haze { /* Begin writing to the filesystem. */ while (true) { /* Read as many bytes as we can. */ - size_t bytes_received; + u32 bytes_received; const Result read_res = dp.ReadBuffer(g_fs_buffer, FsBufferSize, std::addressof(bytes_received)); /* Write to the file. */ diff --git a/troposphere/haze/source/usb_session.cpp b/troposphere/haze/source/usb_session.cpp index 57538abae..c9a6abdc2 100644 --- a/troposphere/haze/source/usb_session.cpp +++ b/troposphere/haze/source/usb_session.cpp @@ -233,7 +233,7 @@ namespace haze { return std::addressof(m_endpoints[ep]->CompletionEvent); } - Result UsbSession::TransferAsync(UsbSessionEndpoint ep, void *buffer, size_t size, u32 *out_urb_id) { + Result UsbSession::TransferAsync(UsbSessionEndpoint ep, void *buffer, u32 size, u32 *out_urb_id) { R_RETURN(usbDsEndpoint_PostBufferAsync(m_endpoints[ep], buffer, size, out_urb_id)); }