diff --git a/libraries/libstratosphere/include/stratosphere/diag.hpp b/libraries/libstratosphere/include/stratosphere/diag.hpp index 176fa7098..14bc88113 100644 --- a/libraries/libstratosphere/include/stratosphere/diag.hpp +++ b/libraries/libstratosphere/include/stratosphere/diag.hpp @@ -15,7 +15,4 @@ */ #pragma once -#include #include -#include -#include diff --git a/libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_log.hpp b/libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_log.hpp similarity index 93% rename from libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_log.hpp rename to libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_log.hpp index 649c9abbf..eb34785fc 100644 --- a/libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_log.hpp +++ b/libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_log.hpp @@ -16,7 +16,7 @@ #pragma once #include -namespace ams::diag::detail { +namespace ams::diag::impl { void LogImpl(const LogMetaData &log_metadata, const char *fmt, ...) __attribute__((format(printf, 2, 3))); void VLogImpl(const LogMetaData &log_metadata, const char *fmt, std::va_list vl); @@ -31,7 +31,7 @@ namespace ams::diag::detail { }, \ .log_severity = ::ams::diag::LogSeverity_Info \ }; \ - ::ams::diag::detail::LogImpl(log_metadata, fmt, __VA_ARGS__); \ + ::ams::diag::impl::LogImpl(log_metadata, fmt, __VA_ARGS__); \ }) } diff --git a/libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_string.hpp b/libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_string.hpp similarity index 88% rename from libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_string.hpp rename to libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_string.hpp index 156c72fd9..e735bbd10 100644 --- a/libraries/libstratosphere/include/stratosphere/diag/detail/diag_detail_string.hpp +++ b/libraries/libstratosphere/include/stratosphere/diag/impl/diag_impl_string.hpp @@ -16,9 +16,9 @@ #pragma once #include -namespace ams::diag::detail { +namespace ams::diag::impl { void PrintDebugString(const char *str, size_t len); - ssize_t GetValidSizeAsUtf8String(const char *str, size_t len); + int GetValidSizeAsUtf8String(const char *str, int len); } diff --git a/libraries/libstratosphere/include/stratosphere/lm.hpp b/libraries/libstratosphere/include/stratosphere/lm.hpp index 219501638..9d006a236 100644 --- a/libraries/libstratosphere/include/stratosphere/lm.hpp +++ b/libraries/libstratosphere/include/stratosphere/lm.hpp @@ -17,5 +17,5 @@ #pragma once #include #include -#include -#include +#include +#include diff --git a/libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_packet_transmitter.hpp b/libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_packet_transmitter.hpp similarity index 98% rename from libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_packet_transmitter.hpp rename to libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_packet_transmitter.hpp index 0bc2af38c..885e6619c 100644 --- a/libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_packet_transmitter.hpp +++ b/libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_packet_transmitter.hpp @@ -14,9 +14,9 @@ * along with this program. If not, see . */ #pragma once -#include +#include -namespace ams::lm::detail { +namespace ams::lm::impl { class LogPacketTransmitterBase { NON_COPYABLE(LogPacketTransmitterBase); diff --git a/libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_types.hpp b/libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_types.hpp similarity index 99% rename from libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_types.hpp rename to libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_types.hpp index 715c6560e..2ead240e9 100644 --- a/libraries/libstratosphere/include/stratosphere/lm/detail/lm_detail_log_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/lm/impl/lm_impl_log_types.hpp @@ -16,7 +16,7 @@ #pragma once #include -namespace ams::lm::detail { +namespace ams::lm::impl { enum LogPacketFlags { LogPacketFlags_Head = (1 << 0), diff --git a/libraries/libstratosphere/source/diag/diag_log_observer.cpp b/libraries/libstratosphere/source/diag/diag_log_observer.cpp index 353cb09d4..12ac0bd4b 100644 --- a/libraries/libstratosphere/source/diag/diag_log_observer.cpp +++ b/libraries/libstratosphere/source/diag/diag_log_observer.cpp @@ -14,10 +14,11 @@ * along with this program. If not, see . */ #include +#include namespace ams::diag { - namespace detail { + namespace impl { extern LogObserverHolder g_default_log_observer; extern LogObserverHolder *g_log_observer_list_head; @@ -36,9 +37,9 @@ namespace ams::diag { void RegisterLogObserver(LogObserverHolder *observer_holder) { AMS_ASSERT(!observer_holder->is_registered); - if (detail::g_log_observer_list_head) { + if (impl::g_log_observer_list_head) { /* Find the last registered observer and append this one. */ - auto observer = detail::g_log_observer_list_head; + auto observer = impl::g_log_observer_list_head; LogObserverHolder *observer_parent = nullptr; do { observer_parent = observer; @@ -48,7 +49,7 @@ namespace ams::diag { } else { /* There are no observers yet, this will be the first one. */ - detail::g_log_observer_list_head = observer_holder; + impl::g_log_observer_list_head = observer_holder; } observer_holder->is_registered = true; observer_holder->next = nullptr; @@ -57,13 +58,13 @@ namespace ams::diag { void UnregisterLogObserver(LogObserverHolder *observer_holder) { AMS_ASSERT(observer_holder->is_registered); - if (observer_holder == detail::g_log_observer_list_head) { + if (observer_holder == impl::g_log_observer_list_head) { /* Move the next item to be the list head. */ - detail::g_log_observer_list_head = observer_holder->next; + impl::g_log_observer_list_head = observer_holder->next; } else { /* Find this observer's parent observer and move the following observer, removing the observer. */ - auto observer = detail::g_log_observer_list_head; + auto observer = impl::g_log_observer_list_head; while (observer) { auto observer_parent = observer; observer = observer->next; @@ -77,13 +78,13 @@ namespace ams::diag { } void ResetDefaultLogObserver() { - ReplaceDefaultLogObserver(detail::DefaultLogObserver); + ReplaceDefaultLogObserver(impl::DefaultLogObserver); } void ReplaceDefaultLogObserver(LogFunction log_function) { - UnregisterLogObserver(std::addressof(detail::g_default_log_observer)); - InitializeLogObserverHolder(std::addressof(detail::g_default_log_observer), log_function, nullptr); - RegisterLogObserver(std::addressof(detail::g_default_log_observer)); + UnregisterLogObserver(std::addressof(impl::g_default_log_observer)); + InitializeLogObserverHolder(std::addressof(impl::g_default_log_observer), log_function, nullptr); + RegisterLogObserver(std::addressof(impl::g_default_log_observer)); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/diag/detail/diag_detail_default_log_observer.cpp b/libraries/libstratosphere/source/diag/impl/diag_impl_default_log_observer.cpp similarity index 95% rename from libraries/libstratosphere/source/diag/detail/diag_detail_default_log_observer.cpp rename to libraries/libstratosphere/source/diag/impl/diag_impl_default_log_observer.cpp index e6e5af72e..01ebf37c6 100644 --- a/libraries/libstratosphere/source/diag/detail/diag_detail_default_log_observer.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_impl_default_log_observer.cpp @@ -14,8 +14,9 @@ * along with this program. If not, see . */ #include +#include -namespace ams::diag::detail { +namespace ams::diag::impl { namespace { @@ -68,7 +69,7 @@ namespace ams::diag::detail { const auto max_buffer_size = sizeof(g_default_log_observer_text_buffer) - used_buffer_space - (color_type != nullptr ? std::strlen(color_type) - 1 : 0); - const auto log_text_size = std::min(max_buffer_size, log_body.text_length); + auto log_text_size = std::min(max_buffer_size, log_body.text_length); if (log_body.text_length && (log_body.text[log_body.text_length - 1] == '\n')) { /* If the last character is a newline character, skip it. */ log_text_size--; diff --git a/libraries/libstratosphere/source/diag/detail/diag_detail_log.cpp b/libraries/libstratosphere/source/diag/impl/diag_impl_log.cpp similarity index 91% rename from libraries/libstratosphere/source/diag/detail/diag_detail_log.cpp rename to libraries/libstratosphere/source/diag/impl/diag_impl_log.cpp index b337c0b02..44f80d164 100644 --- a/libraries/libstratosphere/source/diag/detail/diag_detail_log.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_impl_log.cpp @@ -14,8 +14,11 @@ * along with this program. If not, see . */ #include +#include +#include +#include -namespace ams::diag::detail { +namespace ams::diag::impl { namespace { @@ -36,7 +39,7 @@ namespace ams::diag::detail { break; } - auto copy_len = std::min(static_cast(chars_len), static_cast(print_data->print_str_end - print_data->print_str_cur)); + const auto copy_len = std::min(static_cast(chars_len), static_cast(print_data->print_str_end - print_data->print_str_cur)); std::memcpy(print_data->print_str_cur, chars, copy_len); chars_len -= copy_len; chars += copy_len; @@ -47,7 +50,7 @@ namespace ams::diag::detail { } if (!print_data->log_metadata.use_default_locale_charset) { const auto cur_print_str_len = static_cast(print_data->print_str_cur - print_data->print_str_start); - auto actual_print_str_len = GetValidSizeAsUtf8String(print_data->print_str_start, cur_print_str_len); + const auto actual_print_str_len = GetValidSizeAsUtf8String(print_data->print_str_start, cur_print_str_len); if (actual_print_str_len < cur_print_str_len) { auto print_str_cur_end = print_data->print_str_start + actual_print_str_len; *print_str_cur_end = '\0'; diff --git a/libraries/libstratosphere/source/diag/detail/diag_detail_string.cpp b/libraries/libstratosphere/source/diag/impl/diag_impl_string.cpp similarity index 82% rename from libraries/libstratosphere/source/diag/detail/diag_detail_string.cpp rename to libraries/libstratosphere/source/diag/impl/diag_impl_string.cpp index 93b1ceebe..75b9e9629 100644 --- a/libraries/libstratosphere/source/diag/detail/diag_detail_string.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_impl_string.cpp @@ -15,21 +15,21 @@ */ #include -namespace ams::diag::detail { +namespace ams::diag::impl { void PrintDebugString(const char *str, size_t len) { AMS_ASSERT(str && len); svc::OutputDebugString(str, len); } - ssize_t GetValidSizeAsUtf8String(const char *str, size_t len) { + int GetValidSizeAsUtf8String(const char *str, int len) { AMS_ABORT_UNLESS(str != nullptr); if (len == 0) { return 0; } - auto str_nul_end = str + len; - auto str_end = str + len - 1; + const char *str_nul_end = str + len; + const char *str_end = str + len - 1; char some_c = '\0'; do { @@ -39,9 +39,9 @@ namespace ams::diag::detail { some_c = *str_end--; } while ((some_c & 0xC0) == 0x80); - size_t tmp_len = 0; + int tmp_len = 0; if (!(some_c & 0x80)) { - tmp_len = static_cast(str_nul_end - (str_end + 1)); + tmp_len = static_cast(str_nul_end - (str_end + 1)); if (tmp_len < 1) { return len; } @@ -53,7 +53,7 @@ namespace ams::diag::detail { if ((some_c & 0xE0) == 0xC0) { - tmp_len = static_cast(str_nul_end - (str_end + 1)); + tmp_len = static_cast(str_nul_end - (str_end + 1)); if (tmp_len >= 2) { if (tmp_len == 2) { return len; @@ -66,7 +66,7 @@ namespace ams::diag::detail { if ((some_c & 0xF8) != 0xF0) { return -1; } - tmp_len = static_cast(str_nul_end - (str_end + 1)); + tmp_len = static_cast(str_nul_end - (str_end + 1)); if (tmp_len < 4) { if (tmp_len < len) { return len - tmp_len; @@ -79,7 +79,7 @@ namespace ams::diag::detail { } return 1; } - tmp_len = static_cast(str_nul_end - (str_end + 1)); + tmp_len = static_cast(str_nul_end - (str_end + 1)); if (tmp_len >= 3) { if (tmp_len == 3) { return len; diff --git a/libraries/libstratosphere/source/lm/detail/lm_detail_log_observer.cpp b/libraries/libstratosphere/source/lm/impl/lm_impl_log_observer.cpp similarity index 94% rename from libraries/libstratosphere/source/lm/detail/lm_detail_log_observer.cpp rename to libraries/libstratosphere/source/lm/impl/lm_impl_log_observer.cpp index c359cea5a..3b7432db5 100644 --- a/libraries/libstratosphere/source/lm/detail/lm_detail_log_observer.cpp +++ b/libraries/libstratosphere/source/lm/impl/lm_impl_log_observer.cpp @@ -15,14 +15,14 @@ */ #include -namespace ams::lm::detail { +namespace ams::lm::impl { namespace { os::SdkMutex g_log_observer_lock; u8 g_packet_transmitter_buffer[0x400]; - bool LogPacketTransmitterFlushFunction(const void *log_data, size_t log_data_size) { + bool LogPacketTransmitterFlushFunction(const u8 *log_data, size_t log_data_size) { /* TODO: libnx bindings. */ return true; } @@ -80,7 +80,7 @@ namespace ams::lm::detail { /* const char *process_name; size_t process_name_len; - diag::detail::GetProcessNamePointer(std::addressof(process_name), std::addressof(process_name_len)); + diag::impl::GetProcessNamePointer(std::addressof(process_name), std::addressof(process_name_len)); packet_transmitter.PushProcessName(process_name, process_name_len); */ } diff --git a/libraries/libstratosphere/source/lm/detail/lm_detail_log_packet_transmitter.cpp b/libraries/libstratosphere/source/lm/impl/lm_impl_log_packet_transmitter.cpp similarity index 91% rename from libraries/libstratosphere/source/lm/detail/lm_detail_log_packet_transmitter.cpp rename to libraries/libstratosphere/source/lm/impl/lm_impl_log_packet_transmitter.cpp index c75ee18c7..a8eefa42b 100644 --- a/libraries/libstratosphere/source/lm/detail/lm_detail_log_packet_transmitter.cpp +++ b/libraries/libstratosphere/source/lm/impl/lm_impl_log_packet_transmitter.cpp @@ -1,6 +1,7 @@ #include +#include -namespace ams::lm::detail { +namespace ams::lm::impl { LogPacketTransmitterBase::LogPacketTransmitterBase(void *log_buffer, size_t log_buffer_size, LogPacketTransmitterBase::FlushFunction flush_func, u8 severity, u8 verbosity, u64 process_id, bool head, bool tail) { AMS_ABORT_UNLESS(log_buffer != nullptr); @@ -8,10 +9,10 @@ namespace ams::lm::detail { AMS_ABORT_UNLESS(flush_func != nullptr); this->header = reinterpret_cast(log_buffer); - this->log_buffer_start = log_buffer; - this->log_buffer_end = log_buffer + log_buffer_size; - this->log_buffer_payload_start = log_buffer + sizeof(LogPacketHeader); - this->log_buffer_payload_current = log_buffer + sizeof(LogPacketHeader); + this->log_buffer_start = reinterpret_cast(log_buffer); + this->log_buffer_end = this->log_buffer_start + log_buffer_size; + this->log_buffer_payload_start = this->log_buffer_start + sizeof(LogPacketHeader); + this->log_buffer_payload_current = this->log_buffer_start + sizeof(LogPacketHeader); this->is_tail = tail; this->flush_function = flush_func; this->header->SetProcessId(process_id); @@ -83,7 +84,7 @@ namespace ams::lm::detail { size_t data_chunk_size = 0; if (is_string) { auto tmp_chunk_size = cur_pushable_size; - auto utf8_size = diag::detail::GetValidSizeAsUtf8String(reinterpret_cast(data_cur), tmp_chunk_size); + auto utf8_size = diag::impl::GetValidSizeAsUtf8String(reinterpret_cast(data_cur), tmp_chunk_size); if (utf8_size >= 0) { tmp_chunk_size = static_cast(utf8_size); } diff --git a/libraries/libstratosphere/source/lm/lm_api.cpp b/libraries/libstratosphere/source/lm/lm_api.cpp index 181dc4481..a9b60881e 100644 --- a/libraries/libstratosphere/source/lm/lm_api.cpp +++ b/libraries/libstratosphere/source/lm/lm_api.cpp @@ -14,10 +14,11 @@ * along with this program. If not, see . */ #include +#include namespace ams::lm { - namespace detail { + namespace impl { void LogManagerLogObserver(const diag::LogMetaData &log_metadata, const diag::LogBody &log_body, void *user_data); @@ -36,7 +37,7 @@ namespace ams::lm { /* R_ABORT_UNLESS(lmInitialize()); */ /* Log by default via LogManager. */ - diag::ReplaceDefaultLogObserver(detail::LogManagerLogObserver); + diag::ReplaceDefaultLogObserver(impl::LogManagerLogObserver); g_initialized = true; } diff --git a/stratosphere/lm/source/impl/lm_custom_sink_buffer.cpp b/stratosphere/lm/source/impl/lm_custom_sink_buffer.cpp index ab39e837c..c140e6330 100644 --- a/stratosphere/lm/source/impl/lm_custom_sink_buffer.cpp +++ b/stratosphere/lm/source/impl/lm_custom_sink_buffer.cpp @@ -66,7 +66,7 @@ namespace ams::lm::impl { return std::addressof(custom_sink_buffer); } - void WriteLogToCustomSink(const detail::LogPacketHeader *log_packet_header, size_t log_packet_size, u64 unk_param) { + void WriteLogToCustomSink(const impl::LogPacketHeader *log_packet_header, size_t log_packet_size, u64 unk_param) { /* Process ID value is set earlier, so it's guaranteed to be valid. */ if (log_packet_header->GetProcessId() != g_sink_buffer_current_process_id) { /* We're starting to log from a different process, so we need first a head packet. */ @@ -82,11 +82,11 @@ namespace ams::lm::impl { } } - auto log_payload_start = reinterpret_cast(log_packet_header) + sizeof(detail::LogPacketHeader); + auto log_payload_start = reinterpret_cast(log_packet_header) + sizeof(impl::LogPacketHeader); auto log_payload_cur = log_payload_start; /* No need to check packet header's payload size, since it has already been validated. */ - auto log_payload_size = log_packet_size - sizeof(detail::LogPacketHeader); + auto log_payload_size = log_packet_size - sizeof(impl::LogPacketHeader); if (logging_in_same_thread && (g_sink_buffer_remaining_size > 0)) { auto log_remaining_size = log_payload_size; if (log_payload_size >= g_sink_buffer_remaining_size) { @@ -105,8 +105,8 @@ namespace ams::lm::impl { if (log_payload_size) { auto log_payload_end = log_payload_start + log_payload_size; while (true) { - const auto chunk_key = static_cast(PopUleb128(std::addressof(log_payload_cur), log_payload_end)); - const auto chunk_is_text_log = chunk_key == detail::LogDataChunkKey_TextLog; + const auto chunk_key = static_cast(PopUleb128(std::addressof(log_payload_cur), log_payload_end)); + const auto chunk_is_text_log = chunk_key == impl::LogDataChunkKey_TextLog; const auto chunk_size = PopUleb128(std::addressof(log_payload_cur), log_payload_end); auto left_payload_size = static_cast(log_payload_end - log_payload_cur); if (chunk_size >= left_payload_size) { diff --git a/stratosphere/lm/source/impl/lm_custom_sink_buffer.hpp b/stratosphere/lm/source/impl/lm_custom_sink_buffer.hpp index ae8907503..56252759b 100644 --- a/stratosphere/lm/source/impl/lm_custom_sink_buffer.hpp +++ b/stratosphere/lm/source/impl/lm_custom_sink_buffer.hpp @@ -46,7 +46,7 @@ namespace ams::lm::impl { CustomSinkBuffer *GetCustomSinkBuffer(); - void WriteLogToCustomSink(const detail::LogPacketHeader *log_packet_header, size_t log_packet_size, u64 unk_param); + void WriteLogToCustomSink(const impl::LogPacketHeader *log_packet_header, size_t log_packet_size, u64 unk_param); size_t ReadLogFromCustomSink(void *out_log_data, size_t data_size, u64 *out_packet_drop_count); } \ No newline at end of file diff --git a/stratosphere/lm/source/impl/lm_event_log_transmitter.cpp b/stratosphere/lm/source/impl/lm_event_log_transmitter.cpp index 53ee9feca..1c7fb3516 100644 --- a/stratosphere/lm/source/impl/lm_event_log_transmitter.cpp +++ b/stratosphere/lm/source/impl/lm_event_log_transmitter.cpp @@ -14,9 +14,9 @@ namespace ams::lm::impl { bool EventLogTransmitter::SendLogSessionBeginPacket(u64 process_id) { /* ------------ Log buffer size: packet header (0x18) + chunk header (0x2) + LogSessionBegin dummy value (0x1) = 0x1B */ - constexpr auto log_buffer_size = sizeof(detail::LogPacketHeader) + 2 + sizeof(u8); + constexpr auto log_buffer_size = sizeof(impl::LogPacketHeader) + 2 + sizeof(u8); u8 log_buffer[log_buffer_size] = {}; - detail::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, process_id, true, true); + impl::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, process_id, true, true); log_packet_transmitter.PushLogSessionBegin(); const auto ok = log_packet_transmitter.Flush(true); @@ -28,9 +28,9 @@ namespace ams::lm::impl { bool EventLogTransmitter::SendLogSessionEndPacket(u64 process_id) { /* ------------ Log buffer size: packet header (0x18) + chunk header (0x2) + LogSessionEnd dummy value (0x1) = 0x1B */ - constexpr auto log_buffer_size = sizeof(detail::LogPacketHeader) + 2 + sizeof(u8); + constexpr auto log_buffer_size = sizeof(impl::LogPacketHeader) + 2 + sizeof(u8); u8 log_buffer[log_buffer_size] = {}; - detail::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, process_id, true, true); + impl::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, process_id, true, true); log_packet_transmitter.PushLogSessionEnd(); const auto ok = log_packet_transmitter.Flush(true); @@ -46,9 +46,9 @@ namespace ams::lm::impl { /* Only send the log packet if there were any dropped packets. */ if (this->log_packet_drop_count > 0) { /* ------------ Log buffer size: packet header (0x18) + chunk header (0x2) + log packet drop count (0x8) = 0x22 */ - constexpr auto log_buffer_size = sizeof(detail::LogPacketHeader) + 2 + sizeof(this->log_packet_drop_count); + constexpr auto log_buffer_size = sizeof(impl::LogPacketHeader) + 2 + sizeof(this->log_packet_drop_count); u8 log_buffer[log_buffer_size] = {}; - detail::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, 0, true, true); + impl::LogPacketTransmitter log_packet_transmitter(log_buffer, log_buffer_size, this->flush_func, diag::LogSeverity_Info, false, 0, true, true); log_packet_transmitter.PushLogPacketDropCount(this->log_packet_drop_count); const auto ok = log_packet_transmitter.Flush(true); diff --git a/stratosphere/lm/source/impl/lm_event_log_transmitter.hpp b/stratosphere/lm/source/impl/lm_event_log_transmitter.hpp index 06dcb343c..1f08449fb 100644 --- a/stratosphere/lm/source/impl/lm_event_log_transmitter.hpp +++ b/stratosphere/lm/source/impl/lm_event_log_transmitter.hpp @@ -22,11 +22,11 @@ namespace ams::lm::impl { NON_COPYABLE(EventLogTransmitter); NON_MOVEABLE(EventLogTransmitter); private: - detail::LogPacketTransmitter::FlushFunction flush_func; + impl::LogPacketTransmitter::FlushFunction flush_func; u64 log_packet_drop_count; os::SdkMutex log_packet_drop_count_lock; public: - EventLogTransmitter(detail::LogPacketTransmitter::FlushFunction flush_func) : flush_func(flush_func), log_packet_drop_count(0), log_packet_drop_count_lock() {} + EventLogTransmitter(impl::LogPacketTransmitter::FlushFunction flush_func) : flush_func(flush_func), log_packet_drop_count(0), log_packet_drop_count_lock() {} bool SendLogSessionBeginPacket(u64 process_id); bool SendLogSessionEndPacket(u64 process_id); diff --git a/stratosphere/lm/source/impl/lm_log_buffer.cpp b/stratosphere/lm/source/impl/lm_log_buffer.cpp index 709750b1c..d60fc2e52 100644 --- a/stratosphere/lm/source/impl/lm_log_buffer.cpp +++ b/stratosphere/lm/source/impl/lm_log_buffer.cpp @@ -27,15 +27,15 @@ namespace ams::lm::impl { return ok; } - inline bool ModifyUserSystemClockInfoImpl(detail::LogDataChunkKey chunk_key, u8 *log_payload_data, size_t log_payload_size, time::PosixTime &time_ref) { - if(chunk_key == detail::LogDataChunkKey_UserSystemClock) { + inline bool ModifyUserSystemClockInfoImpl(impl::LogDataChunkKey chunk_key, u8 *log_payload_data, size_t log_payload_size, time::PosixTime &time_ref) { + if(chunk_key == impl::LogDataChunkKey_UserSystemClock) { /* TODO: properly implement this...? */ reinterpret_cast(log_payload_data)->value += time_ref.value; } return true; } - bool ModifyUserSystemClockInfo(detail::LogPacketHeader *packet_header, void *log_payload_data, size_t log_payload_size, time::PosixTime &time_ref) { + bool ModifyUserSystemClockInfo(impl::LogPacketHeader *packet_header, void *log_payload_data, size_t log_payload_size, time::PosixTime &time_ref) { if (!packet_header->IsHead()) { /* Only modify this field on head packets. */ return true; @@ -51,7 +51,7 @@ namespace ams::lm::impl { auto payload_end = payload_start + log_payload_size; /* Read chunk key and size. */ - const auto chunk_key = static_cast(PopUleb128(const_cast(std::addressof(payload_cur)), const_cast(payload_end))); + const auto chunk_key = static_cast(PopUleb128(const_cast(std::addressof(payload_cur)), const_cast(payload_end))); if (payload_cur >= payload_end) { return false; } @@ -71,18 +71,18 @@ namespace ams::lm::impl { } /* Iterate (for potential multiple packets?) and change the UserSystemClock for each value. */ - auto packet_header = reinterpret_cast(log_data); + auto packet_header = reinterpret_cast(log_data); auto data_start = reinterpret_cast(log_data); auto data_cur = data_start; auto data_end = data_start + log_data_size; auto cur_packet_header = packet_header; - while (static_cast(data_end - data_start) >= sizeof(detail::LogPacketHeader)) { + while (static_cast(data_end - data_start) >= sizeof(impl::LogPacketHeader)) { auto payload_size = cur_packet_header->GetPayloadSize(); if ((static_cast(data_end - data_cur) < payload_size) || !ModifyUserSystemClockInfo(cur_packet_header, data_cur, static_cast(payload_size), time_ref)) { break; } - cur_packet_header = reinterpret_cast(data_cur + payload_size); + cur_packet_header = reinterpret_cast(data_cur + payload_size); if ((data_cur + payload_size) >= data_end) { return true; } diff --git a/stratosphere/lm/source/impl/lm_sd_card_logging.cpp b/stratosphere/lm/source/impl/lm_sd_card_logging.cpp index ea31707e1..5634f70fb 100644 --- a/stratosphere/lm/source/impl/lm_sd_card_logging.cpp +++ b/stratosphere/lm/source/impl/lm_sd_card_logging.cpp @@ -147,7 +147,7 @@ namespace ams::lm::impl { ON_SCOPE_EXIT { fs::CloseFile(log_file_h); }; /* 8-byte binary log header, current version is 1. */ - const detail::BinaryLogHeader bin_log_header = { detail::BinaryLogHeader::Magic, 1 }; + const impl::BinaryLogHeader bin_log_header = { impl::BinaryLogHeader::Magic, 1 }; if (R_SUCCEEDED(fs::WriteFile(log_file_h, 0, std::addressof(bin_log_header), sizeof(bin_log_header), fs::WriteOption::Flush))) { this->log_file_offset = sizeof(bin_log_header); return true; diff --git a/stratosphere/lm/source/lm_log_service.cpp b/stratosphere/lm/source/lm_log_service.cpp index cfb99365b..301156820 100644 --- a/stratosphere/lm/source/lm_log_service.cpp +++ b/stratosphere/lm/source/lm_log_service.cpp @@ -42,10 +42,10 @@ namespace ams::lm { } void Logger::Log(const sf::InAutoSelectBuffer &log_buffer) { - auto log_packet_header = (detail::LogPacketHeader*)log_buffer.GetPointer(); + auto log_packet_header = (impl::LogPacketHeader*)log_buffer.GetPointer(); /* Don't log anything if payload size isn't correct. */ - if ((log_packet_header->GetPayloadSize() + sizeof(detail::LogPacketHeader)) != log_buffer.GetSize()) { + if ((log_packet_header->GetPayloadSize() + sizeof(impl::LogPacketHeader)) != log_buffer.GetSize()) { return; } @@ -66,7 +66,7 @@ namespace ams::lm { if (g_is_logging_to_custom_sink) { /* Log to custom sink if enabled. */ - impl::WriteLogToCustomSink(const_cast(log_packet_header), log_buffer.GetSize(), 0); + impl::WriteLogToCustomSink(const_cast(log_packet_header), log_buffer.GetSize(), 0); } }