summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/CMakeLists.txt1
-rw-r--r--src/common/common_paths.h6
-rw-r--r--src/common/file_util.cpp68
-rw-r--r--src/common/file_util.h27
-rw-r--r--src/common/synchronized_wrapper.h85
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp4
-rw-r--r--src/core/hle/service/ns/pl_u.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp30
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h8
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp2
-rw-r--r--src/core/telemetry_session.cpp6
-rw-r--r--src/video_core/engines/fermi_2d.cpp6
-rw-r--r--src/video_core/engines/fermi_2d.h6
-rw-r--r--src/video_core/engines/maxwell_3d.h6
-rw-r--r--src/video_core/engines/maxwell_compute.h6
-rw-r--r--src/video_core/engines/maxwell_dma.h6
-rw-r--r--src/video_core/engines/shader_bytecode.h12
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.h6
-rw-r--r--src/video_core/textures/decoders.cpp6
-rw-r--r--src/video_core/textures/decoders.h6
-rw-r--r--src/video_core/textures/texture.h6
-rw-r--r--src/yuzu/configuration/config.cpp2
-rw-r--r--src/yuzu/configuration/configure_debug.cpp2
-rw-r--r--src/yuzu/main.cpp18
-rw-r--r--src/yuzu_cmd/config.cpp2
-rw-r--r--src/yuzu_cmd/yuzu.cpp21
27 files changed, 143 insertions, 213 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index f49a31612..d5d4f6f82 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -63,7 +63,6 @@ add_library(common STATIC
string_util.cpp
string_util.h
swap.h
- synchronized_wrapper.h
telemetry.cpp
telemetry.h
thread.cpp
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 9bf3efaf2..6799a357a 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -26,7 +26,7 @@
#define USA_DIR "USA"
#define JAP_DIR "JAP"
-// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
+// Subdirs in the User dir returned by GetUserPath(UserPath::UserDir)
#define CONFIG_DIR "config"
#define CACHE_DIR "cache"
#define SDMC_DIR "sdmc"
@@ -35,11 +35,11 @@
#define LOG_DIR "log"
// Filenames
-// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
+// Files in the directory returned by GetUserPath(UserPath::ConfigDir)
#define EMU_CONFIG "emu.ini"
#define DEBUGGER_CONFIG "debugger.ini"
#define LOGGER_CONFIG "logger.ini"
-// Files in the directory returned by GetUserPath(D_LOGS_IDX)
+// Files in the directory returned by GetUserPath(UserPath::LogDir)
#define LOG_FILE "yuzu_log.txt"
// Sys files
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index efcf58ca6..d8163a4a8 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <sstream>
+#include <unordered_map>
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_paths.h"
@@ -681,67 +682,68 @@ std::string GetSysDirectory() {
// Returns a string with a yuzu data dir or file in the user's home
// directory. To be used in "multi-user" mode (that is, installed).
-const std::string& GetUserPath(const unsigned int DirIDX, const std::string& newPath) {
- static std::string paths[NUM_PATH_INDICES];
+const std::string& GetUserPath(UserPath path, const std::string& new_path) {
+ static std::unordered_map<UserPath, std::string> paths;
+ auto& user_path = paths[UserPath::UserDir];
// Set up all paths and files on the first run
- if (paths[D_USER_IDX].empty()) {
+ if (user_path.empty()) {
#ifdef _WIN32
- paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
- if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
- paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
+ user_path = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
+ if (!FileUtil::IsDirectory(user_path)) {
+ user_path = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
} else {
LOG_INFO(Common_Filesystem, "Using the local user directory");
}
- paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
- paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
+ paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP);
+ paths.emplace(UserPath::CacheDir, user_path + CACHE_DIR DIR_SEP);
#else
if (FileUtil::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) {
- paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
- paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
- paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
+ user_path = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
+ paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP);
+ paths.emplace(UserPath::CacheDir, user_path + CACHE_DIR DIR_SEP);
} else {
std::string data_dir = GetUserDirectory("XDG_DATA_HOME");
std::string config_dir = GetUserDirectory("XDG_CONFIG_HOME");
std::string cache_dir = GetUserDirectory("XDG_CACHE_HOME");
- paths[D_USER_IDX] = data_dir + DIR_SEP EMU_DATA_DIR DIR_SEP;
- paths[D_CONFIG_IDX] = config_dir + DIR_SEP EMU_DATA_DIR DIR_SEP;
- paths[D_CACHE_IDX] = cache_dir + DIR_SEP EMU_DATA_DIR DIR_SEP;
+ user_path = data_dir + DIR_SEP EMU_DATA_DIR DIR_SEP;
+ paths.emplace(UserPath::ConfigDir, config_dir + DIR_SEP EMU_DATA_DIR DIR_SEP);
+ paths.emplace(UserPath::CacheDir, cache_dir + DIR_SEP EMU_DATA_DIR DIR_SEP);
}
#endif
- paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
- paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
- paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
+ paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP);
+ paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP);
+ paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP);
// TODO: Put the logs in a better location for each OS
- paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP;
+ paths.emplace(UserPath::LogDir, user_path + LOG_DIR DIR_SEP);
}
- if (!newPath.empty()) {
- if (!FileUtil::IsDirectory(newPath)) {
- LOG_ERROR(Common_Filesystem, "Invalid path specified {}", newPath);
- return paths[DirIDX];
+ if (!new_path.empty()) {
+ if (!FileUtil::IsDirectory(new_path)) {
+ LOG_ERROR(Common_Filesystem, "Invalid path specified {}", new_path);
+ return paths[path];
} else {
- paths[DirIDX] = newPath;
+ paths[path] = new_path;
}
- switch (DirIDX) {
- case D_ROOT_IDX:
- paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
+ switch (path) {
+ case UserPath::RootDir:
+ user_path = paths[UserPath::RootDir] + DIR_SEP;
break;
- case D_USER_IDX:
- paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
- paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
- paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
- paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
- paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
+ case UserPath::UserDir:
+ user_path = paths[UserPath::RootDir] + DIR_SEP;
+ paths[UserPath::ConfigDir] = user_path + CONFIG_DIR DIR_SEP;
+ paths[UserPath::CacheDir] = user_path + CACHE_DIR DIR_SEP;
+ paths[UserPath::SDMCDir] = user_path + SDMC_DIR DIR_SEP;
+ paths[UserPath::NANDDir] = user_path + NAND_DIR DIR_SEP;
break;
}
}
- return paths[DirIDX];
+ return paths[path];
}
size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) {
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 1f38b1560..ff01bf0ff 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -16,21 +16,20 @@
#include "common/string_util.h"
#endif
-// User directory indices for GetUserPath
-enum {
- D_USER_IDX,
- D_ROOT_IDX,
- D_CONFIG_IDX,
- D_CACHE_IDX,
- D_SDMC_IDX,
- D_NAND_IDX,
- D_SYSDATA_IDX,
- D_LOGS_IDX,
- NUM_PATH_INDICES
-};
-
namespace FileUtil {
+// User paths for GetUserPath
+enum class UserPath {
+ CacheDir,
+ ConfigDir,
+ LogDir,
+ NANDDir,
+ RootDir,
+ SDMCDir,
+ SysDataDir,
+ UserDir,
+};
+
// FileSystem tree node/
struct FSTEntry {
bool isDirectory;
@@ -123,7 +122,7 @@ bool SetCurrentDir(const std::string& directory);
// Returns a pointer to a string with a yuzu data dir in the user's home
// directory. To be used in "multi-user" mode (that is, installed).
-const std::string& GetUserPath(const unsigned int DirIDX, const std::string& newPath = "");
+const std::string& GetUserPath(UserPath path, const std::string& new_path = "");
// Returns the path to where the sys file are
std::string GetSysDirectory();
diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h
deleted file mode 100644
index 4a1984c46..000000000
--- a/src/common/synchronized_wrapper.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <algorithm>
-#include <mutex>
-
-namespace Common {
-
-template <typename T>
-class SynchronizedWrapper;
-
-/**
- * Synchronized reference, that keeps a SynchronizedWrapper's mutex locked during its lifetime. This
- * greatly reduces the chance that someone will access the wrapped resource without locking the
- * mutex.
- */
-template <typename T>
-class SynchronizedRef {
-public:
- SynchronizedRef(SynchronizedWrapper<T>& wrapper) : wrapper(&wrapper) {
- wrapper.mutex.lock();
- }
-
- SynchronizedRef(SynchronizedRef&) = delete;
- SynchronizedRef(SynchronizedRef&& o) : wrapper(o.wrapper) {
- o.wrapper = nullptr;
- }
-
- ~SynchronizedRef() {
- if (wrapper)
- wrapper->mutex.unlock();
- }
-
- SynchronizedRef& operator=(SynchronizedRef&) = delete;
- SynchronizedRef& operator=(SynchronizedRef&& o) {
- std::swap(wrapper, o.wrapper);
- return *this;
- }
-
- T& operator*() {
- return wrapper->data;
- }
- const T& operator*() const {
- return wrapper->data;
- }
-
- T* operator->() {
- return &wrapper->data;
- }
- const T* operator->() const {
- return &wrapper->data;
- }
-
-private:
- SynchronizedWrapper<T>* wrapper;
-};
-
-/**
- * Wraps an object, only allowing access to it via a locking reference wrapper. Good to ensure no
- * one forgets to lock a mutex before acessing an object. To access the wrapped object construct a
- * SyncronizedRef on this wrapper. Inspired by Rust's Mutex type
- * (http://doc.rust-lang.org/std/sync/struct.Mutex.html).
- */
-template <typename T>
-class SynchronizedWrapper {
-public:
- template <typename... Args>
- SynchronizedWrapper(Args&&... args) : data(std::forward<Args>(args)...) {}
-
- SynchronizedRef<T> Lock() {
- return {*this};
- }
-
-private:
- template <typename U>
- friend class SynchronizedRef;
-
- std::mutex mutex;
- T data;
-};
-
-} // namespace Common
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index dffcdfbaf..671e0b8d0 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -272,9 +272,9 @@ void RegisterFileSystems() {
sdmc_factory = nullptr;
auto nand_directory = std::make_shared<FileSys::RealVfsDirectory>(
- FileUtil::GetUserPath(D_NAND_IDX), FileSys::Mode::Write);
+ FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), FileSys::Mode::Write);
auto sd_directory = std::make_shared<FileSys::RealVfsDirectory>(
- FileUtil::GetUserPath(D_SDMC_IDX), FileSys::Mode::Write);
+ FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), FileSys::Mode::Write);
auto savedata = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
save_data_factory = std::move(savedata);
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index 691b1d106..bad27894a 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -42,7 +42,7 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
RegisterHandlers(functions);
// Attempt to load shared font data from disk
- const std::string filepath{FileUtil::GetUserPath(D_SYSDATA_IDX) + SHARED_FONT};
+ const std::string filepath{FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir) + SHARED_FONT};
FileUtil::CreateFullPath(filepath); // Create path if not already created
FileUtil::IOFile file(filepath, "rb");
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
index 8de870596..126782573 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
@@ -42,6 +42,9 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u
if (command.cmd == NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO) {
return SubmitGPFIFO(input, output);
}
+ if (command.cmd == NVGPU_IOCTL_CHANNEL_KICKOFF_PB) {
+ return KickoffPB(input, output);
+ }
}
UNIMPLEMENTED_MSG("Unimplemented ioctl");
@@ -127,14 +130,37 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
IoctlSubmitGpfifo params{};
std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo));
LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",
- params.gpfifo, params.num_entries, params.flags);
+ params.address, params.num_entries, params.flags);
auto entries = std::vector<IoctlGpfifoEntry>();
entries.resize(params.num_entries);
std::memcpy(&entries[0], &input.data()[sizeof(IoctlSubmitGpfifo)],
params.num_entries * sizeof(IoctlGpfifoEntry));
for (auto entry : entries) {
- VAddr va_addr = entry.Address();
+ Tegra::GPUVAddr va_addr = entry.Address();
+ Core::System::GetInstance().GPU().ProcessCommandList(va_addr, entry.sz);
+ }
+ params.fence_out.id = 0;
+ params.fence_out.value = 0;
+ std::memcpy(output.data(), &params, output.size());
+ return 0;
+}
+
+u32 nvhost_gpu::KickoffPB(const std::vector<u8>& input, std::vector<u8>& output) {
+ if (input.size() < sizeof(IoctlSubmitGpfifo)) {
+ UNIMPLEMENTED();
+ }
+ IoctlSubmitGpfifo params{};
+ std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo));
+ LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",
+ params.address, params.num_entries, params.flags);
+
+ std::vector<IoctlGpfifoEntry> entries(params.num_entries);
+ Memory::ReadBlock(params.address, entries.data(),
+ params.num_entries * sizeof(IoctlGpfifoEntry));
+
+ for (auto entry : entries) {
+ Tegra::GPUVAddr va_addr = entry.Address();
Core::System::GetInstance().GPU().ProcessCommandList(va_addr, entry.sz);
}
params.fence_out.id = 0;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
index c9f6b9b6a..aa8df2e6e 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
@@ -15,6 +15,7 @@ namespace Service::Nvidia::Devices {
class nvmap;
constexpr u32 NVGPU_IOCTL_MAGIC('H');
constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8);
+constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b);
class nvhost_gpu final : public nvdevice {
public:
@@ -158,14 +159,14 @@ private:
BitField<31, 1, u32_le> unk2;
};
- VAddr Address() const {
- return (static_cast<VAddr>(gpu_va_hi) << 32) | entry0;
+ Tegra::GPUVAddr Address() const {
+ return (static_cast<Tegra::GPUVAddr>(gpu_va_hi) << 32) | entry0;
}
};
static_assert(sizeof(IoctlGpfifoEntry) == 8, "IoctlGpfifoEntry is incorrect size");
struct IoctlSubmitGpfifo {
- u64_le gpfifo; // (ignored) pointer to gpfifo fence structs
+ u64_le address; // pointer to gpfifo entry structs
u32_le num_entries; // number of fence objects being submitted
u32_le flags;
IoctlFence fence_out; // returned new fence object for others to wait on
@@ -193,6 +194,7 @@ private:
u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output);
u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output);
u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output);
+ u32 KickoffPB(const std::vector<u8>& input, std::vector<u8>& output);
u32 GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output);
u32 ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output);
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index b10efd5c9..1b497b814 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -101,7 +101,7 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
{8, &NVDRV::SetClientPID, "SetClientPID"},
{9, nullptr, "DumpGraphicsMemoryInfo"},
{10, nullptr, "InitializeDevtools"},
- {11, nullptr, "Ioctl2"},
+ {11, &NVDRV::Ioctl, "Ioctl2"},
{12, nullptr, "Ioctl3"},
{13, &NVDRV::FinishInitialize, "FinishInitialize"},
};
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index b9a603df3..69aa7a7be 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -37,7 +37,8 @@ static u64 GenerateTelemetryId() {
u64 GetTelemetryId() {
u64 telemetry_id{};
- static const std::string& filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
+ static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) +
+ "telemetry_id"};
if (FileUtil::Exists(filename)) {
FileUtil::IOFile file(filename, "rb");
@@ -61,7 +62,8 @@ u64 GetTelemetryId() {
u64 RegenerateTelemetryId() {
const u64 new_telemetry_id{GenerateTelemetryId()};
- static const std::string& filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
+ static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) +
+ "telemetry_id"};
FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) {
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 34053e393..ea1555c5d 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -6,8 +6,7 @@
#include "video_core/engines/fermi_2d.h"
#include "video_core/textures/decoders.h"
-namespace Tegra {
-namespace Engines {
+namespace Tegra::Engines {
Fermi2D::Fermi2D(MemoryManager& memory_manager) : memory_manager(memory_manager) {}
@@ -69,5 +68,4 @@ void Fermi2D::HandleSurfaceCopy() {
}
}
-} // namespace Engines
-} // namespace Tegra
+} // namespace Tegra::Engines
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h
index 70667cb94..dcf9ef8b9 100644
--- a/src/video_core/engines/fermi_2d.h
+++ b/src/video_core/engines/fermi_2d.h
@@ -12,8 +12,7 @@
#include "video_core/gpu.h"
#include "video_core/memory_manager.h"
-namespace Tegra {
-namespace Engines {
+namespace Tegra::Engines {
#define FERMI2D_REG_INDEX(field_name) \
(offsetof(Tegra::Engines::Fermi2D::Regs, field_name) / sizeof(u32))
@@ -110,5 +109,4 @@ ASSERT_REG_POSITION(operation, 0xAB);
ASSERT_REG_POSITION(trigger, 0xB5);
#undef ASSERT_REG_POSITION
-} // namespace Engines
-} // namespace Tegra
+} // namespace Tegra::Engines
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 91b077005..dbd106c53 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -17,8 +17,7 @@
#include "video_core/memory_manager.h"
#include "video_core/textures/texture.h"
-namespace Tegra {
-namespace Engines {
+namespace Tegra::Engines {
#define MAXWELL3D_REG_INDEX(field_name) \
(offsetof(Tegra::Engines::Maxwell3D::Regs, field_name) / sizeof(u32))
@@ -898,5 +897,4 @@ ASSERT_REG_POSITION(tex_info_buffers.size[0], 0xD2F);
#undef ASSERT_REG_POSITION
-} // namespace Engines
-} // namespace Tegra
+} // namespace Tegra::Engines
diff --git a/src/video_core/engines/maxwell_compute.h b/src/video_core/engines/maxwell_compute.h
index 7262e1bcb..2b3e4ced6 100644
--- a/src/video_core/engines/maxwell_compute.h
+++ b/src/video_core/engines/maxwell_compute.h
@@ -6,8 +6,7 @@
#include "common/common_types.h"
-namespace Tegra {
-namespace Engines {
+namespace Tegra::Engines {
class MaxwellCompute final {
public:
@@ -18,5 +17,4 @@ public:
void WriteReg(u32 method, u32 value);
};
-} // namespace Engines
-} // namespace Tegra
+} // namespace Tegra::Engines
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 905749bde..7882f16e0 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -12,8 +12,7 @@
#include "video_core/gpu.h"
#include "video_core/memory_manager.h"
-namespace Tegra {
-namespace Engines {
+namespace Tegra::Engines {
class MaxwellDMA final {
public:
@@ -151,5 +150,4 @@ ASSERT_REG_POSITION(src_params, 0x1CA);
#undef ASSERT_REG_POSITION
-} // namespace Engines
-} // namespace Tegra
+} // namespace Tegra::Engines
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 65fa1495f..939a71022 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -15,8 +15,7 @@
#include "common/bit_field.h"
#include "common/common_types.h"
-namespace Tegra {
-namespace Shader {
+namespace Tegra::Shader {
struct Register {
/// Number of registers
@@ -109,8 +108,7 @@ union Sampler {
u64 value{};
};
-} // namespace Shader
-} // namespace Tegra
+} // namespace Tegra::Shader
namespace std {
@@ -127,8 +125,7 @@ struct make_unsigned<Tegra::Shader::Register> {
} // namespace std
-namespace Tegra {
-namespace Shader {
+namespace Tegra::Shader {
enum class Pred : u64 {
UnusedIndex = 0x7,
@@ -784,5 +781,4 @@ private:
}
};
-} // namespace Shader
-} // namespace Tegra
+} // namespace Tegra::Shader
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index a1ac18a71..b48d30466 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -12,8 +12,7 @@
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_decompiler.h"
-namespace GLShader {
-namespace Decompiler {
+namespace GLShader::Decompiler {
using Tegra::Shader::Attribute;
using Tegra::Shader::Instruction;
@@ -1845,5 +1844,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
return boost::none;
}
-} // namespace Decompiler
-} // namespace GLShader
+} // namespace GLShader::Decompiler
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.h b/src/video_core/renderer_opengl/gl_shader_decompiler.h
index 7610dad3a..df6769462 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.h
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.h
@@ -12,8 +12,7 @@
#include "video_core/engines/maxwell_3d.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
-namespace GLShader {
-namespace Decompiler {
+namespace GLShader::Decompiler {
using Tegra::Engines::Maxwell3D;
@@ -23,5 +22,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
Maxwell3D::Regs::ShaderStage stage,
const std::string& suffix);
-} // namespace Decompiler
-} // namespace GLShader
+} // namespace GLShader::Decompiler
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index a3684a195..a3e67d105 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -10,8 +10,7 @@
#include "video_core/textures/decoders.h"
#include "video_core/textures/texture.h"
-namespace Tegra {
-namespace Texture {
+namespace Tegra::Texture {
/**
* Calculates the offset of an (x, y) position within a swizzled texture.
@@ -186,5 +185,4 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
return rgba_data;
}
-} // namespace Texture
-} // namespace Tegra
+} // namespace Tegra::Texture
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h
index 2b088c077..73a4924d1 100644
--- a/src/video_core/textures/decoders.h
+++ b/src/video_core/textures/decoders.h
@@ -8,8 +8,7 @@
#include "common/common_types.h"
#include "video_core/textures/texture.h"
-namespace Tegra {
-namespace Texture {
+namespace Tegra::Texture {
/**
* Unswizzles a swizzled texture without changing its format.
@@ -33,5 +32,4 @@ void CopySwizzledData(u32 width, u32 height, u32 bytes_per_pixel, u32 out_bytes_
std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width,
u32 height);
-} // namespace Texture
-} // namespace Tegra
+} // namespace Tegra::Texture
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index a17eaf19d..d1c755033 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -10,8 +10,7 @@
#include "common/common_types.h"
#include "video_core/memory_manager.h"
-namespace Tegra {
-namespace Texture {
+namespace Tegra::Texture {
enum class TextureFormat : u32 {
R32_G32_B32_A32 = 0x01,
@@ -260,5 +259,4 @@ struct FullTextureInfo {
/// Returns the number of bytes per pixel of the input texture format.
u32 BytesPerPixel(TextureFormat format);
-} // namespace Texture
-} // namespace Tegra
+} // namespace Tegra::Texture
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 62754a1a9..98969fe10 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -10,7 +10,7 @@
Config::Config() {
// TODO: Don't hardcode the path; let the frontend decide where to put the config files.
- qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini";
+ qt_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini";
FileUtil::CreateFullPath(qt_config_loc);
qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index 241db4ae3..5e66239ff 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -19,7 +19,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
ui->setupUi(this);
this->setConfiguration();
connect(ui->open_log_button, &QPushButton::pressed, []() {
- QString path = QString::fromStdString(FileUtil::GetUserPath(D_LOGS_IDX));
+ QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});
}
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 16812e077..16a95bb19 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -909,6 +909,16 @@ void GMainWindow::UpdateUITheme() {
#undef main
#endif
+static void InitializeLogging() {
+ Log::Filter log_filter;
+ log_filter.ParseFilterString(Settings::values.log_filter);
+ Log::SetGlobalFilter(log_filter);
+
+ const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
+ FileUtil::CreateFullPath(log_dir);
+ Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
+}
+
int main(int argc, char* argv[]) {
MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT({ MicroProfileShutdown(); });
@@ -927,13 +937,7 @@ int main(int argc, char* argv[]) {
GMainWindow main_window;
// After settings have been loaded by GMainWindow, apply the filter
- Log::Filter log_filter;
- log_filter.ParseFilterString(Settings::values.log_filter);
- Log::SetGlobalFilter(log_filter);
- FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
- Log::AddBackend(
- std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
-
+ InitializeLogging();
main_window.show();
return app.exec();
}
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 723e8b4cc..cea1a5e62 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -15,7 +15,7 @@
Config::Config() {
// TODO: Don't hardcode the path; let the frontend decide where to put the config files.
- sdl2_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "sdl2-config.ini";
+ sdl2_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "sdl2-config.ini";
sdl2_config = std::make_unique<INIReader>(sdl2_config_loc);
Reload();
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 24db1065a..b5392c499 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -56,6 +56,18 @@ static void PrintVersion() {
std::cout << "yuzu " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;
}
+static void InitializeLogging() {
+ Log::Filter log_filter(Log::Level::Debug);
+ log_filter.ParseFilterString(Settings::values.log_filter);
+ Log::SetGlobalFilter(log_filter);
+
+ Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
+
+ const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
+ FileUtil::CreateFullPath(log_dir);
+ Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
+}
+
/// Application entry point
int main(int argc, char** argv) {
Config config;
@@ -124,14 +136,7 @@ int main(int argc, char** argv) {
LocalFree(argv_w);
#endif
- Log::Filter log_filter(Log::Level::Debug);
- log_filter.ParseFilterString(Settings::values.log_filter);
- Log::SetGlobalFilter(log_filter);
-
- Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
- FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
- Log::AddBackend(
- std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
+ InitializeLogging();
MicroProfileOnThreadCreate("EmuThread");
SCOPE_EXIT({ MicroProfileShutdown(); });