diff --git a/troposphere/haze/icon.jpg b/troposphere/haze/icon.jpg
index c23abe907..6c64f740e 100644
Binary files a/troposphere/haze/icon.jpg and b/troposphere/haze/icon.jpg differ
diff --git a/troposphere/haze/icon.svg b/troposphere/haze/icon.svg
index c8c2f6247..e1478a7e3 100644
--- a/troposphere/haze/icon.svg
+++ b/troposphere/haze/icon.svg
@@ -1,2 +1,2 @@
-
+
diff --git a/troposphere/haze/include/haze/async_usb_server.hpp b/troposphere/haze/include/haze/async_usb_server.hpp
index af62fd666..7283d6574 100644
--- a/troposphere/haze/include/haze/async_usb_server.hpp
+++ b/troposphere/haze/include/haze/async_usb_server.hpp
@@ -23,16 +23,13 @@ namespace haze {
class AsyncUsbServer final {
private:
EventReactor *m_reactor;
-
public:
constexpr explicit AsyncUsbServer() : m_reactor() { /* ... */ }
Result Initialize(const UsbCommsInterfaceInfo *interface_info, u16 id_vendor, u16 id_product, EventReactor *reactor);
void Finalize();
-
private:
Result TransferPacketImpl(bool read, void *page, u32 size, u32 *out_size_transferred) const;
-
public:
Result ReadPacket(void *page, u32 size, u32 *out_size_transferred) const {
return this->TransferPacketImpl(true, page, size, out_size_transferred);
diff --git a/troposphere/haze/include/haze/console_main_loop.hpp b/troposphere/haze/include/haze/console_main_loop.hpp
index 99de59382..e4e72142a 100644
--- a/troposphere/haze/include/haze/console_main_loop.hpp
+++ b/troposphere/haze/include/haze/console_main_loop.hpp
@@ -23,7 +23,7 @@ namespace haze {
class ConsoleMainLoop : public EventConsumer {
private:
static constexpr size_t FrameDelayNs = 33333333;
-
+ private:
EventReactor *m_reactor;
PtpObjectHeap *m_object_heap;
@@ -36,7 +36,6 @@ namespace haze {
u32 m_last_heap_used;
u32 m_last_heap_total;
bool m_is_applet_mode;
-
private:
static void Run(void *arg) {
static_cast(arg)->Run();
@@ -49,11 +48,14 @@ namespace haze {
Waiter cancel_waiter = waiterForUEvent(std::addressof(m_cancel_event));
Result rc = waitObjects(std::addressof(idx), std::addressof(cancel_waiter), 1, FrameDelayNs);
- if (R_SUCCEEDED(rc)) break;
- if (svc::ResultTimedOut::Includes(rc)) ueventSignal(std::addressof(m_event));
+ if (R_SUCCEEDED(rc)) {
+ break;
+ }
+ if (svc::ResultTimedOut::Includes(rc)) {
+ ueventSignal(std::addressof(m_event));
+ }
}
}
-
public:
explicit ConsoleMainLoop() : m_reactor(), m_pad(), m_thread(), m_event(), m_cancel_event(), m_last_heap_used(), m_last_heap_total(), m_is_applet_mode() { /* ... */ }
@@ -110,12 +112,12 @@ namespace haze {
m_last_heap_total = heap_total;
const char *used_unit = "B";
- if (heap_used > 1024) { heap_used >>= 10; used_unit = "KiB"; }
- if (heap_used > 1024) { heap_used >>= 10; used_unit = "MiB"; }
+ if (heap_used >= 1024) { heap_used >>= 10; used_unit = "KiB"; }
+ if (heap_used >= 1024) { heap_used >>= 10; used_unit = "MiB"; }
const char *total_unit = "B";
- if (heap_total > 1024) { heap_total >>= 10; total_unit = "KiB"; }
- if (heap_total > 1024) { heap_total >>= 10; total_unit = "MiB"; }
+ if (heap_total >= 1024) { heap_total >>= 10; total_unit = "KiB"; }
+ if (heap_total >= 1024) { heap_total >>= 10; total_unit = "MiB"; }
consoleClear();
printf("USB File Transfer\n\n");
diff --git a/troposphere/haze/include/haze/event_reactor.hpp b/troposphere/haze/include/haze/event_reactor.hpp
index 5f762133a..890982fe4 100644
--- a/troposphere/haze/include/haze/event_reactor.hpp
+++ b/troposphere/haze/include/haze/event_reactor.hpp
@@ -29,7 +29,6 @@ namespace haze {
private:
EventConsumer *m_consumers[MAX_WAIT_OBJECTS];
Waiter m_waiters[MAX_WAIT_OBJECTS];
-
s32 m_num_wait_objects;
bool m_stop_requested;
diff --git a/troposphere/haze/include/haze/filesystem_proxy.hpp b/troposphere/haze/include/haze/filesystem_proxy.hpp
index 3fce92ad2..3e16d400d 100644
--- a/troposphere/haze/include/haze/filesystem_proxy.hpp
+++ b/troposphere/haze/include/haze/filesystem_proxy.hpp
@@ -24,7 +24,6 @@ namespace haze {
private:
EventReactor *m_reactor;
FsFileSystem *m_filesystem;
-
public:
constexpr explicit FilesystemProxy() : m_reactor(), m_filesystem() { /* ... */ }
@@ -39,7 +38,6 @@ namespace haze {
m_reactor = nullptr;
m_filesystem = nullptr;
}
-
private:
template
Result ForwardResult(F func, Args &&... args) {
@@ -49,7 +47,6 @@ namespace haze {
R_RETURN(rc);
}
-
public:
Result GetTotalSpace(const char *path, s64 *out) {
R_RETURN(this->ForwardResult(fsFsGetTotalSpace, m_filesystem, path, out));
diff --git a/troposphere/haze/include/haze/ptp_data_builder.hpp b/troposphere/haze/include/haze/ptp_data_builder.hpp
index 972eda42b..2e9d8dceb 100644
--- a/troposphere/haze/include/haze/ptp_data_builder.hpp
+++ b/troposphere/haze/include/haze/ptp_data_builder.hpp
@@ -28,7 +28,6 @@ namespace haze {
size_t m_offset;
u8 *m_data;
bool m_disabled;
-
private:
template
constexpr static size_t Strlen(const T *str) {
@@ -50,7 +49,6 @@ namespace haze {
R_RETURN(m_server->WritePacket(m_data, m_offset));
}
}
-
public:
constexpr explicit PtpDataBuilder(void *data, AsyncUsbServer *server) : m_server(server), m_transmitted_size(), m_offset(), m_data(static_cast(data)), m_disabled() { /* ... */ }
diff --git a/troposphere/haze/include/haze/ptp_data_parser.hpp b/troposphere/haze/include/haze/ptp_data_parser.hpp
index a642fefdd..d862cc785 100644
--- a/troposphere/haze/include/haze/ptp_data_parser.hpp
+++ b/troposphere/haze/include/haze/ptp_data_parser.hpp
@@ -28,7 +28,6 @@ namespace haze {
u32 m_offset;
u8 *m_data;
bool m_eos;
-
private:
Result Flush() {
R_UNLESS(!m_eos, haze::ResultEndOfTransmission());
@@ -40,7 +39,6 @@ namespace haze {
R_RETURN(m_server->ReadPacket(m_data, haze::UsbBulkPacketBufferSize, std::addressof(m_received_size)));
}
-
public:
constexpr explicit PtpDataParser(void *data, AsyncUsbServer *server) : m_server(server), m_received_size(), m_offset(), m_data(static_cast(data)), m_eos() { /* ... */ }
diff --git a/troposphere/haze/include/haze/ptp_object_database.hpp b/troposphere/haze/include/haze/ptp_object_database.hpp
index af8511b87..59ff26d6e 100644
--- a/troposphere/haze/include/haze/ptp_object_database.hpp
+++ b/troposphere/haze/include/haze/ptp_object_database.hpp
@@ -70,7 +70,6 @@ namespace haze {
}
};
};
-
private:
using ObjectNameToIdTreeTraits = util::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<&ObjectNode::m_object_name_to_id_node>;
using ObjectNameToIdTree = ObjectNameToIdTreeTraits::TreeType;
@@ -82,13 +81,11 @@ namespace haze {
ObjectNameToIdTree m_name_to_object_id;
ObjectIdToNameTree m_object_id_to_name;
u32 m_next_object_id;
-
public:
constexpr explicit PtpObjectDatabase() : m_object_heap(), m_name_to_object_id(), m_object_id_to_name(), m_next_object_id() { /* ... */ }
void Initialize(PtpObjectHeap *object_heap);
void Finalize();
-
public:
/* Object database API. */
Result AddObjectId(const char *parent_name, const char *name, u32 *out_object_id, u32 parent_id, u32 desired_object_id = 0);
diff --git a/troposphere/haze/include/haze/ptp_object_heap.hpp b/troposphere/haze/include/haze/ptp_object_heap.hpp
index 826893d59..fda104ef0 100644
--- a/troposphere/haze/include/haze/ptp_object_heap.hpp
+++ b/troposphere/haze/include/haze/ptp_object_heap.hpp
@@ -24,18 +24,16 @@ namespace haze {
class PtpObjectHeap {
private:
static constexpr size_t NumHeapBlocks = 2;
-
+ private:
void *m_heap_blocks[NumHeapBlocks];
void *m_next_address;
u32 m_heap_block_size;
u32 m_current_heap_block;
-
public:
constexpr explicit PtpObjectHeap() : m_heap_blocks(), m_next_address(), m_heap_block_size(), m_current_heap_block() { /* ... */ }
void Initialize();
void Finalize();
-
public:
constexpr size_t GetSizeTotal() const {
return m_heap_block_size * NumHeapBlocks;
@@ -44,7 +42,6 @@ namespace haze {
constexpr size_t GetSizeUsed() const {
return (m_heap_block_size * m_current_heap_block) + this->GetNextAddress() - this->GetFirstAddress();
}
-
private:
constexpr u8 *GetNextAddress() const { return static_cast(m_next_address); }
constexpr u8 *GetFirstAddress() const { return static_cast(m_heap_blocks[m_current_heap_block]); }
@@ -58,8 +55,12 @@ namespace haze {
}
constexpr bool AllocationIsSatisfyable(size_t n) const {
- if (this->GetNextAddress() + n < this->GetNextAddress()) return false;
- if (this->GetNextAddress() + n > this->GetCurrentBlockEnd()) return false;
+ if (this->GetNextAddress() + n < this->GetNextAddress()) {
+ return false;
+ }
+ if (this->GetNextAddress() + n > this->GetCurrentBlockEnd()) {
+ return false;
+ }
return true;
}
@@ -80,17 +81,20 @@ namespace haze {
return result;
}
-
public:
template
constexpr T *Allocate(size_t n) {
- if (n + 7 < n) return nullptr;
+ if (n + 7 < n) {
+ return nullptr;
+ }
/* Round up the amount to a multiple of 8. */
n = (n + 7) & ~7ull;
/* Check if the allocation is possible. */
- if (!this->AllocationIsPossible(n)) return nullptr;
+ if (!this->AllocationIsPossible(n)) {
+ return nullptr;
+ }
/* If the allocation is not satisfyable now, we might be able to satisfy it on the next block. */
/* However, if the next block would be empty, we won't be able to satisfy the request. */
diff --git a/troposphere/haze/include/haze/ptp_responder.hpp b/troposphere/haze/include/haze/ptp_responder.hpp
index 79effa4d3..ecbc8e0ad 100644
--- a/troposphere/haze/include/haze/ptp_responder.hpp
+++ b/troposphere/haze/include/haze/ptp_responder.hpp
@@ -32,7 +32,6 @@ namespace haze {
PtpObjectHeap *m_object_heap;
u32 m_send_object_id;
bool m_session_open;
-
PtpObjectDatabase m_object_database;
public:
diff --git a/troposphere/haze/include/haze/usb_session.hpp b/troposphere/haze/include/haze/usb_session.hpp
index 55f414b1b..5796304ad 100644
--- a/troposphere/haze/include/haze/usb_session.hpp
+++ b/troposphere/haze/include/haze/usb_session.hpp
@@ -30,11 +30,9 @@ namespace haze {
private:
UsbDsInterface *m_interface;
UsbDsEndpoint *m_endpoints[UsbSessionEndpoint_Count];
-
private:
Result Initialize1x(const UsbCommsInterfaceInfo *info);
Result Initialize5x(const UsbCommsInterfaceInfo *info);
-
public:
constexpr explicit UsbSession() : m_interface(), m_endpoints() { /* ... */ }
diff --git a/troposphere/haze/source/ptp_object_database.cpp b/troposphere/haze/source/ptp_object_database.cpp
index 2f8a7f284..847f661d3 100644
--- a/troposphere/haze/source/ptp_object_database.cpp
+++ b/troposphere/haze/source/ptp_object_database.cpp
@@ -60,7 +60,9 @@ namespace haze {
/* Check if an object with this name already exists. If it does, we can just return it here. */
auto it = m_name_to_object_id.find_key(node->m_name);
if (it != m_name_to_object_id.end()) {
- if (out_object_id) *out_object_id = it->GetObjectId();
+ if (out_object_id) {
+ *out_object_id = it->GetObjectId();
+ }
R_SUCCEED();
}
@@ -74,7 +76,9 @@ namespace haze {
m_object_id_to_name.insert(*node);
/* Set output. */
- if (out_object_id) *out_object_id = node->GetObjectId();
+ if (out_object_id) {
+ *out_object_id = node->GetObjectId();
+ }
/* We succeeded. */
R_SUCCEED();
@@ -83,7 +87,9 @@ namespace haze {
void PtpObjectDatabase::RemoveObjectId(u32 object_id) {
/* Find in forward mapping. */
auto it = m_object_id_to_name.find_key(object_id);
- if (it == m_object_id_to_name.end()) return;
+ if (it == m_object_id_to_name.end()) {
+ return;
+ }
/* Free the node. */
ObjectNode *node = std::addressof(*it);
@@ -95,7 +101,9 @@ namespace haze {
PtpObjectDatabase::ObjectNode *PtpObjectDatabase::GetObject(u32 object_id) {
/* Find in forward mapping. */
auto it = m_object_id_to_name.find_key(object_id);
- if (it == m_object_id_to_name.end()) return nullptr;
+ if (it == m_object_id_to_name.end()) {
+ return nullptr;
+ }
return std::addressof(*it);
}
diff --git a/troposphere/haze/source/ptp_object_heap.cpp b/troposphere/haze/source/ptp_object_heap.cpp
index fd2f20966..eadde042e 100644
--- a/troposphere/haze/source/ptp_object_heap.cpp
+++ b/troposphere/haze/source/ptp_object_heap.cpp
@@ -28,7 +28,9 @@ namespace haze {
size_t mem_used = 0;
/* Skip re-initialization if we are currently initialized. */
- if (m_heap_block_size != 0) return;
+ if (m_heap_block_size != 0) {
+ return;
+ }
/* Estimate how much memory we can reserve. */
HAZE_R_ABORT_UNLESS(svcGetInfo(std::addressof(mem_used), InfoType_UsedMemorySize, CUR_PROCESS_HANDLE, 0));
@@ -50,7 +52,9 @@ namespace haze {
}
void PtpObjectHeap::Finalize() {
- if (m_heap_block_size == 0) return;
+ if (m_heap_block_size == 0) {
+ return;
+ }
/* Tear down the heap, allowing a subsequent call to Initialize() if desired. */
for (size_t i = 0; i < NumHeapBlocks; i++) {