diff --git a/.gitmodules b/.gitmodules index dd61965b..4ea2e256 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "app/libraries/opus"] path = app/libraries/opus url = https://github.com/xiph/opus +[submodule "app/libraries/boost"] + path = app/libraries/boost + url = https://github.com/boostorg/boost.git diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 813a03b5..4243facf 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -171,7 +171,7 @@ - - + diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 239b0862..d7a124c7 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -68,8 +68,12 @@ include_directories(libraries/perfetto/sdk) add_library(perfetto STATIC libraries/perfetto/sdk/perfetto.cc) target_compile_options(perfetto PRIVATE -Wno-everything) -include_directories(${source_DIR}/skyline) +# Boost +set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_MULTITHREADED ON) +add_subdirectory("libraries/boost") +# Skyline add_library(skyline SHARED ${source_DIR}/emu_jni.cpp ${source_DIR}/loader_jni.cpp @@ -224,6 +228,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/prepo/IPrepoService.cpp ${source_DIR}/skyline/services/mmnv/IRequest.cpp ) +target_include_directories(skyline PRIVATE ${source_DIR}/skyline) # target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense -target_link_libraries(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedcrypto opus) -target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field) +target_link_libraries(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedcrypto opus Boost::container) +target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field -Wno-dangling-else) diff --git a/app/libraries/boost b/app/libraries/boost new file mode 160000 index 00000000..42379669 --- /dev/null +++ b/app/libraries/boost @@ -0,0 +1 @@ +Subproject commit 4237966924d69ea5c875d5c2072fc0804f15b4b5 diff --git a/app/src/main/cpp/skyline/common.h b/app/src/main/cpp/skyline/common.h index a14e2169..dbb10152 100644 --- a/app/src/main/cpp/skyline/common.h +++ b/app/src/main/cpp/skyline/common.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include #include #define FORCE_INLINE __attribute__((always_inline)) // NOLINT(cppcoreguidelines-macro-usage) diff --git a/app/src/main/cpp/skyline/gpu/presentation_engine.cpp b/app/src/main/cpp/skyline/gpu/presentation_engine.cpp index 61605c11..281b6528 100644 --- a/app/src/main/cpp/skyline/gpu/presentation_engine.cpp +++ b/app/src/main/cpp/skyline/gpu/presentation_engine.cpp @@ -279,7 +279,7 @@ namespace skyline::gpu { if (frameTimestamp) { i64 now{static_cast(util::GetTimeNs())}; - auto sampleWeight{swapInterval ? constant::NsInSecond / (refreshCycleDuration * swapInterval) : 10}; //!< The weight of each sample in calculating the average, we arbitrarily average 10 samples for unlocked FPS + i64 sampleWeight{static_cast(swapInterval ? constant::NsInSecond / (refreshCycleDuration * swapInterval) : 10)}; //!< The weight of each sample in calculating the average, we arbitrarily average 10 samples for unlocked FPS auto weightedAverage{[](auto weight, auto previousAverage, auto current) { return (((weight - 1) * previousAverage) + current) / weight; @@ -293,13 +293,13 @@ namespace skyline::gpu { averageFrametimeDeviationNs = weightedAverage(sampleWeight, averageFrametimeDeviationNs, currentFrametimeDeviation); AverageFrametimeDeviationMs = static_cast(averageFrametimeDeviationNs) / constant::NsInMillisecond; - Fps = std::round(static_cast(constant::NsInSecond) / averageFrametimeNs); + Fps = static_cast(std::round(static_cast(constant::NsInSecond) / static_cast(averageFrametimeNs))); TRACE_EVENT_INSTANT("gpu", "Present", presentationTrack, "FrameTimeNs", now - frameTimestamp, "Fps", Fps); frameTimestamp = now; } else { - frameTimestamp = util::GetTimeNs(); + frameTimestamp = static_cast(util::GetTimeNs()); } } diff --git a/app/src/main/cpp/skyline/kernel/ipc.h b/app/src/main/cpp/skyline/kernel/ipc.h index 21248e8d..55ce65a9 100644 --- a/app/src/main/cpp/skyline/kernel/ipc.h +++ b/app/src/main/cpp/skyline/kernel/ipc.h @@ -198,11 +198,11 @@ namespace skyline { PayloadHeader *payload{}; u8 *cmdArg{}; //!< A pointer to the data payload u64 cmdArgSz{}; //!< The size of the data payload - std::vector copyHandles; //!< The handles that should be copied from the server to the client process (The difference is just to match application expectations, there is no real difference b/w copying and moving handles) - std::vector moveHandles; //!< The handles that should be moved from the server to the client process rather than copied - std::vector domainObjects; - std::vector> inputBuf; - std::vector> outputBuf; + boost::container::small_vector copyHandles; //!< The handles that should be copied from the server to the client process (The difference is just to match application expectations, there is no real difference b/w copying and moving handles) + boost::container::small_vector moveHandles; //!< The handles that should be moved from the server to the client process rather than copied + boost::container::small_vector domainObjects; + boost::container::small_vector, 3> inputBuf; + boost::container::small_vector, 3> outputBuf; IpcRequest(bool isDomain, const DeviceState &state); @@ -251,9 +251,9 @@ namespace skyline { public: Result errorCode{}; //!< The error code to respond with, it's 0 (Success) by default - std::vector copyHandles; - std::vector moveHandles; - std::vector domainObjects; + boost::container::small_vector copyHandles; + boost::container::small_vector moveHandles; + boost::container::small_vector domainObjects; IpcResponse(const DeviceState &state); diff --git a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp index 8f3b2199..f1983057 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp +++ b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp @@ -98,7 +98,7 @@ namespace skyline::service::hosbinder { std::scoped_lock lock(mutex); // We don't need a loop here since the consumer is blocking and instantly frees all buffers - // If a valid slot is not found on the first iteration then it would be stuck in an infloop + // If a valid slot is not found on the first iteration then it would be stuck in an infinite loop // As a result of this, we simply warn and return InvalidOperation to the guest auto buffer{queue.end()}; size_t dequeuedSlotCount{}; @@ -114,7 +114,7 @@ namespace skyline::service::hosbinder { } if (buffer != queue.end()) { - slot = std::distance(queue.begin(), buffer); + slot = static_cast(std::distance(queue.begin(), buffer)); } else if (async) { return AndroidStatus::WouldBlock; } else if (dequeuedSlotCount == queue.size()) { diff --git a/app/src/main/cpp/skyline/services/lm/ILogger.cpp b/app/src/main/cpp/skyline/services/lm/ILogger.cpp index 88ab58fd..34c5f01a 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogger.cpp +++ b/app/src/main/cpp/skyline/services/lm/ILogger.cpp @@ -112,8 +112,11 @@ namespace skyline::service::lm { message << logMessage.thread << ':'; if (logMessage.time) message << logMessage.time << "s:"; - if (!logMessage.message.empty()) + if (!logMessage.message.empty()) { + if (logMessage.message.ends_with('\n')) + logMessage.message.remove_suffix(1); message << ' ' << logMessage.message; + } if (logMessage.dropCount) message << " (Dropped Messages: " << logMessage.time << ')';