Compare commits
1 commit
52865ec3dd
...
90ebe14fc6
Author | SHA1 | Date | |
---|---|---|---|
90ebe14fc6 |
15 changed files with 67 additions and 76 deletions
|
@ -224,7 +224,7 @@ set(YUZU_TZDB_PATH "" CACHE STRING "Path to a pre-downloaded timezone database")
|
|||
|
||||
cmake_dependent_option(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "LINUX" OFF)
|
||||
|
||||
cmake_dependent_option(YUZU_USE_BUNDLED_MOLTENVK "Download bundled MoltenVK lib" ON "APPLE" OFF)
|
||||
cmake_dependent_option(YUZU_APPLE_USE_BUNDLED_MONTENVK "Download bundled MoltenVK lib" ON "APPLE" OFF)
|
||||
|
||||
option(YUZU_DISABLE_LLVM "Disable LLVM (useful for CI)" OFF)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Notes:
|
|||
* Currently, build fails without this
|
||||
- `YUZU_USE_FASTER_LD` (ON) Check if a faster linker is available
|
||||
* Only available on UNIX
|
||||
- `YUZU_USE_BUNDLED_MOLTENVK` (ON, macOS only) Download bundled MoltenVK lib)
|
||||
- `YUZU_APPLE_USE_BUNDLED_MONTENVK` (ON, macOS only) Download bundled MoltenVK lib)
|
||||
- `YUZU_TZDB_PATH` (string) Path to a pre-downloaded timezone database (useful for nixOS)
|
||||
- `ENABLE_OPENSSL` (ON for Linux and *BSD) Enable OpenSSL backend for the ssl service
|
||||
* Always enabled if the web service is enabled
|
||||
|
|
|
@ -39,17 +39,9 @@ namespace Common::Log {
|
|||
|
||||
namespace {
|
||||
|
||||
/// @brief Trims up to and including the last of ../, ..\, src/, src\ in a string
|
||||
/// do not be fooled this isn't generating new strings on .rodata :)
|
||||
constexpr const char* TrimSourcePath(std::string_view source) {
|
||||
const auto rfind = [source](const std::string_view match) {
|
||||
return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size());
|
||||
};
|
||||
auto idx = (std::max)({rfind("src/"), rfind("src\\"), rfind("../"), rfind("..\\")});
|
||||
return source.data() + idx;
|
||||
}
|
||||
|
||||
/// @brief Interface for logging backends.
|
||||
/**
|
||||
* Interface for logging backends.
|
||||
*/
|
||||
class Backend {
|
||||
public:
|
||||
virtual ~Backend() = default;
|
||||
|
@ -61,7 +53,9 @@ public:
|
|||
virtual void Flush() = 0;
|
||||
};
|
||||
|
||||
/// @brief Backend that writes to stderr and with color
|
||||
/**
|
||||
* Backend that writes to stderr and with color
|
||||
*/
|
||||
class ColorConsoleBackend final : public Backend {
|
||||
public:
|
||||
explicit ColorConsoleBackend() = default;
|
||||
|
@ -90,7 +84,9 @@ private:
|
|||
std::atomic_bool enabled{false};
|
||||
};
|
||||
|
||||
/// @brief Backend that writes to a file passed into the constructor
|
||||
/**
|
||||
* Backend that writes to a file passed into the constructor
|
||||
*/
|
||||
class FileBackend final : public Backend {
|
||||
public:
|
||||
explicit FileBackend(const std::filesystem::path& filename) {
|
||||
|
@ -252,14 +248,13 @@ public:
|
|||
color_console_backend.SetEnabled(enabled);
|
||||
}
|
||||
|
||||
bool CanPushEntry(Class log_class, Level log_level) const noexcept {
|
||||
return filter.CheckMessage(log_class, log_level);
|
||||
}
|
||||
|
||||
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
||||
const char* function, std::string&& message) noexcept {
|
||||
const char* function, std::string&& message) {
|
||||
if (!filter.CheckMessage(log_class, log_level)) {
|
||||
return;
|
||||
}
|
||||
message_queue.EmplaceWait(
|
||||
CreateEntry(log_class, log_level, TrimSourcePath(filename), line_num, function, std::move(message)));
|
||||
CreateEntry(log_class, log_level, filename, line_num, function, std::move(message)));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -373,9 +368,8 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
|||
unsigned int line_num, const char* function, fmt::string_view format,
|
||||
const fmt::format_args& args) {
|
||||
if (!initialization_in_progress_suppress_logging) {
|
||||
auto& instance = Impl::Instance();
|
||||
if (instance.CanPushEntry(log_class, log_level))
|
||||
instance.PushEntry(log_class, log_level, filename, line_num, function, fmt::vformat(format, args));
|
||||
Impl::Instance().PushEntry(log_class, log_level, filename, line_num, function,
|
||||
fmt::vformat(format, args));
|
||||
}
|
||||
}
|
||||
} // namespace Common::Log
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -12,20 +9,22 @@ namespace Common::Log {
|
|||
namespace {
|
||||
template <typename It>
|
||||
Level GetLevelByName(const It begin, const It end) {
|
||||
for (u32 i = 0; i < u32(Level::Count); ++i) {
|
||||
const char* level_name = GetLevelName(Level(i));
|
||||
if (Common::ComparePartialString(begin, end, level_name))
|
||||
return Level(i);
|
||||
for (u8 i = 0; i < static_cast<u8>(Level::Count); ++i) {
|
||||
const char* level_name = GetLevelName(static_cast<Level>(i));
|
||||
if (Common::ComparePartialString(begin, end, level_name)) {
|
||||
return static_cast<Level>(i);
|
||||
}
|
||||
}
|
||||
return Level::Count;
|
||||
}
|
||||
|
||||
template <typename It>
|
||||
Class GetClassByName(const It begin, const It end) {
|
||||
for (u32 i = 0; i < u32(Class::Count); ++i) {
|
||||
const char* level_name = GetLogClassName(Class(i));
|
||||
if (Common::ComparePartialString(begin, end, level_name))
|
||||
return Class(i);
|
||||
for (u8 i = 0; i < static_cast<u8>(Class::Count); ++i) {
|
||||
const char* level_name = GetLogClassName(static_cast<Class>(i));
|
||||
if (Common::ComparePartialString(begin, end, level_name)) {
|
||||
return static_cast<Class>(i);
|
||||
}
|
||||
}
|
||||
return Class::Count;
|
||||
}
|
||||
|
@ -230,12 +229,13 @@ void Filter::ParseFilterString(std::string_view filter_view) {
|
|||
}
|
||||
|
||||
bool Filter::CheckMessage(Class log_class, Level level) const {
|
||||
return u8(level) >= u8(class_levels[std::size_t(log_class)]);
|
||||
return static_cast<u8>(level) >=
|
||||
static_cast<u8>(class_levels[static_cast<std::size_t>(log_class)]);
|
||||
}
|
||||
|
||||
bool Filter::IsDebug() const {
|
||||
return std::any_of(class_levels.begin(), class_levels.end(), [](const Level& l) {
|
||||
return u8(l) <= u8(Level::Debug);
|
||||
return static_cast<u8>(l) <= static_cast<u8>(Level::Debug);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,15 @@
|
|||
|
||||
namespace Common::Log {
|
||||
|
||||
// trims up to and including the last of ../, ..\, src/, src\ in a string
|
||||
constexpr const char* TrimSourcePath(std::string_view source) {
|
||||
const auto rfind = [source](const std::string_view match) {
|
||||
return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size());
|
||||
};
|
||||
auto idx = (std::max)({rfind("src/"), rfind("src\\"), rfind("../"), rfind("..\\")});
|
||||
return source.data() + idx;
|
||||
}
|
||||
|
||||
/// Logs a message to the global logger, using fmt
|
||||
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
||||
unsigned int line_num, const char* function, fmt::string_view format,
|
||||
|
@ -33,7 +42,7 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
|
|||
#ifdef _DEBUG
|
||||
#define LOG_TRACE(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Trace, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_TRACE(log_class, fmt, ...) (void(0))
|
||||
|
@ -41,21 +50,21 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
|
|||
|
||||
#define LOG_DEBUG(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
#define LOG_INFO(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
#define LOG_WARNING(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
#define LOG_ERROR(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
#define LOG_CRITICAL(log_class, ...) \
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||
__VA_ARGS__)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
|
||||
#define IS_DEV_BUILD @IS_DEV_BUILD@
|
||||
#define COMPILER_ID "@CXX_COMPILER@"
|
||||
#define BUILD_AUTO_UPDATE_WEBSITE "@BUILD_AUTO_UPDATE_WEBSITE@"
|
||||
#define BUILD_AUTO_UPDATE_WEBISTE "@BUILD_AUTO_UPDATE_WEBISTE@"
|
||||
#define BUILD_AUTO_UPDATE_API "@BUILD_AUTO_UPDATE_API@"
|
||||
#define BUILD_AUTO_UPDATE_REPO "@BUILD_AUTO_UPDATE_REPO@"
|
||||
|
||||
|
@ -37,7 +37,7 @@ constexpr const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
|
|||
constexpr const char g_compiler_id[] = COMPILER_ID;
|
||||
constexpr const bool g_is_dev_build = IS_DEV_BUILD;
|
||||
|
||||
constexpr const char g_build_auto_update_website[] = BUILD_AUTO_UPDATE_WEBSITE;
|
||||
constexpr const char g_build_auto_update_website[] = BUILD_AUTO_UPDATE_WEBISTE;
|
||||
constexpr const char g_build_auto_update_api[] = BUILD_AUTO_UPDATE_API;
|
||||
constexpr const char g_build_auto_update_repo[] = BUILD_AUTO_UPDATE_REPO;
|
||||
|
||||
|
|
|
@ -135,8 +135,8 @@ NvResult nvhost_nvdec_common::GetSyncpoint(IoctlGetSyncpoint& params) {
|
|||
}
|
||||
|
||||
NvResult nvhost_nvdec_common::GetWaitbase(IoctlGetWaitbase& params) {
|
||||
LOG_DEBUG(Service_NVDRV, "called WAITBASE");
|
||||
params.value = 0;
|
||||
LOG_CRITICAL(Service_NVDRV, "called WAITBASE");
|
||||
params.value = 0; // Seems to be hard coded at 0
|
||||
return NvResult::Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -289,7 +286,7 @@ Result CheckOpenSSLErrors() {
|
|||
msg.append(data);
|
||||
}
|
||||
Common::Log::FmtLogMessage(Common::Log::Class::Service_SSL, Common::Log::Level::Error,
|
||||
file, line, func, "OpenSSL: {}",
|
||||
Common::Log::TrimSourcePath(file), line, func, "OpenSSL: {}",
|
||||
msg);
|
||||
}
|
||||
return ResultInternalError;
|
||||
|
|
|
@ -38,10 +38,6 @@ void Decoder::Decode() {
|
|||
// Receive output frames from decoder.
|
||||
auto frame = decode_api.ReceiveFrame();
|
||||
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsInterlaced()) {
|
||||
auto [luma_top, luma_bottom, chroma_top, chroma_bottom] = GetInterlacedOffsets();
|
||||
auto frame_copy = frame;
|
||||
|
|
|
@ -233,7 +233,7 @@ bool DecoderContext::OpenContext(const Decoder& decoder) {
|
|||
}
|
||||
|
||||
bool DecoderContext::SendPacket(const Packet& packet) {
|
||||
if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
|
||||
if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0 && ret != AVERROR_EOF) {
|
||||
LOG_ERROR(HW_GPU, "avcodec_send_packet error: {}", AVError(ret));
|
||||
return false;
|
||||
}
|
||||
|
@ -242,31 +242,31 @@ bool DecoderContext::SendPacket(const Packet& packet) {
|
|||
}
|
||||
|
||||
std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
|
||||
auto ReceiveImpl = [&](AVFrame* frame) -> int {
|
||||
const int ret = avcodec_receive_frame(m_codec_context, frame);
|
||||
if (ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
|
||||
auto ReceiveImpl = [&](AVFrame* frame) -> bool {
|
||||
if (const int ret = avcodec_receive_frame(m_codec_context, frame); ret < 0 && ret != AVERROR_EOF) {
|
||||
LOG_ERROR(HW_GPU, "avcodec_receive_frame error: {}", AVError(ret));
|
||||
return false;
|
||||
}
|
||||
return ret;
|
||||
return true;
|
||||
};
|
||||
|
||||
std::shared_ptr<Frame> intermediate_frame = std::make_shared<Frame>();
|
||||
if (ReceiveImpl(intermediate_frame->GetFrame()) < 0) {
|
||||
if (!ReceiveImpl(intermediate_frame->GetFrame())) {
|
||||
return {};
|
||||
}
|
||||
|
||||
m_final_frame = std::make_shared<Frame>();
|
||||
m_temp_frame = std::make_shared<Frame>();
|
||||
if (m_codec_context->hw_device_ctx) {
|
||||
m_final_frame->SetFormat(PreferredGpuFormat);
|
||||
if (const int ret = av_hwframe_transfer_data(m_final_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
|
||||
m_temp_frame->SetFormat(PreferredGpuFormat);
|
||||
if (int ret = av_hwframe_transfer_data(m_temp_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
|
||||
LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
|
||||
return {};
|
||||
}
|
||||
} else {
|
||||
m_final_frame = std::move(intermediate_frame);
|
||||
m_temp_frame = std::move(intermediate_frame);
|
||||
}
|
||||
|
||||
return std::move(m_final_frame);
|
||||
return std::move(m_temp_frame);
|
||||
}
|
||||
|
||||
void DecodeApi::Reset() {
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
private:
|
||||
const Decoder& m_decoder;
|
||||
AVCodecContext* m_codec_context{};
|
||||
std::shared_ptr<Frame> m_final_frame{};
|
||||
std::shared_ptr<Frame> m_temp_frame{};
|
||||
bool m_decode_order{};
|
||||
};
|
||||
|
||||
|
|
|
@ -146,11 +146,6 @@ void Vic::Execute() {
|
|||
}
|
||||
|
||||
auto frame = frame_queue.GetFrame(nvdec_id, luma_offset);
|
||||
|
||||
if (!frame) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!frame.get()) {
|
||||
LOG_ERROR(HW_GPU, "Vic {} failed to get frame with offset {:#X}", id, luma_offset);
|
||||
continue;
|
||||
|
|
|
@ -366,7 +366,7 @@ if (APPLE)
|
|||
set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE TRUE)
|
||||
set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
|
||||
if (YUZU_USE_BUNDLED_MOLTENVK)
|
||||
if (YUZU_APPLE_USE_BUNDLED_MONTENVK)
|
||||
set(MOLTENVK_PLATFORM "macOS")
|
||||
set(MOLTENVK_VERSION "v1.3.0")
|
||||
download_moltenvk(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
|
||||
|
|
|
@ -4204,8 +4204,8 @@ void GMainWindow::OnEmulatorUpdateAvailable() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version, std::string_view gpu_vendor) {
|
||||
static const std::string build_id = std::string{Common::g_build_id};
|
||||
void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
|
||||
std::string_view gpu_vendor) {
|
||||
static const std::string yuzu_title = fmt::format("{} | {} | {}",
|
||||
std::string{Common::g_build_name},
|
||||
std::string{Common::g_build_version},
|
||||
|
|
|
@ -58,7 +58,7 @@ std::optional<std::string> UpdateChecker::GetResponse(std::string url, std::stri
|
|||
|
||||
std::optional<std::string> UpdateChecker::GetLatestRelease(bool include_prereleases)
|
||||
{
|
||||
const auto update_check_url = std::string{Common::g_build_auto_update_api};
|
||||
constexpr auto update_check_url = std::string{Common::g_build_auto_update_api};
|
||||
std::string update_check_path = fmt::format("/repos/{}", std::string{Common::g_build_auto_update_repo});
|
||||
try {
|
||||
if (include_prereleases) { // This can return either a prerelease or a stable release,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue