Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@
[submodule "externals/openal-soft"]
path = externals/openal-soft
url = https://github.com/shadexternals/openal-soft.git
[submodule "externals/spdlog"]
path = externals/spdlog
url = https://github.com/gabime/spdlog
shallow = true
branch = v1.x
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,9 @@ set(DEV_TOOLS src/core/devtools/layer.cpp
src/core/devtools/widget/text_editor.h
)

set(COMMON src/common/logging/backend.cpp
src/common/logging/backend.h
src/common/logging/filter.cpp
src/common/logging/filter.h
src/common/logging/formatter.h
src/common/logging/log_entry.h
set(COMMON src/common/logging/classes.h
src/common/logging/log.cpp
src/common/logging/log.h
src/common/logging/text_formatter.cpp
src/common/logging/text_formatter.h
src/common/logging/types.h
src/common/aes.h
src/common/alignment.h
src/common/arch.h
Expand Down Expand Up @@ -1113,6 +1106,7 @@ set(EMULATOR src/emulator.cpp
src/emulator.h
src/sdl_window.h
src/sdl_window.cpp
src/shadps4_app.h
)

if(NOT ENABLE_TESTS)
Expand All @@ -1127,17 +1121,13 @@ add_executable(shadps4
${VIDEO_CORE}
${EMULATOR}
src/main.cpp
src/emulator.cpp
src/emulator.h
src/sdl_window.h
src/sdl_window.cpp
)

create_target_directory_groups(shadps4)

target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 SDL3_mixer::SDL3_mixer pugixml::pugixml)
target_link_libraries(shadps4 PRIVATE stb::headers libusb::usb lfreist-hwinfo::hwinfo nlohmann_json::nlohmann_json miniz::miniz fdk-aac CLI11::CLI11 OpenAL::OpenAL Cpp_Httplib)
target_link_libraries(shadps4 PRIVATE stb::headers libusb::usb lfreist-hwinfo::hwinfo nlohmann_json::nlohmann_json miniz::miniz fdk-aac CLI11::CLI11 OpenAL::OpenAL Cpp_Httplib spdlog::spdlog)

target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
Expand Down
41 changes: 25 additions & 16 deletions documents/Debugging/Debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,39 @@ You can configure the emulator by editing the `config.toml` file found in the `u
<details>
<summary>Some configuration entries worth changing</summary>

- `[General]`

- `logType`: Configures logging synchronization (`sync`/`async`)
- By default, the emulator logs messages asynchronously for better performance. Some log messages may end up being received out-of-order.
- It can be beneficial to set this to `sync` in order for the log to accurately maintain message order, at the cost of performance.
- When communicating about issues with games and the log messages aren't clear due to potentially confusing order, set this to `sync` and send that log as well.
- `logFilter`: Sets the logging category for various logging classes.
- Format: `<class>:<level> ...`
- Multiple classes can be set by separating them with a space. (example: `Render:Warning Debug:Critical Lib.Pad:Error`)
- `[Log]`
- `sync`: Log synchronously (`true`/`false`)
- By default `true`, the emulator logs messages synchronously to respect the order.
- It can be beneficial to set this to `false` for better performance.
- When communicating about issues with games and the log messages aren't clear due to potentially confusing order, set this to `true` and send that log instead.
- `filter`: Sets the logging category for various logging classes.
- Format: `<class>=<level>,...`
- Multiple classes can be set by separating them with a comma. (example: `Render=warning,Debug=critical,Lib.Pad=error`)
- Sub-classes can be specified in the same format as seen in the console/log (such as `Core.Linker`).
- All classes and sub-classes can be set by specifying a `*` symbol. (example: `Kernel.*:Critical`)
- Valid log levels: `Trace, Debug, Info, Warning, Error, Critical` - in this order, setting a level silences all levels preceding it and logs every level after it.
- Valid log levels: `trace, debug, info, warning, error, critical` - in this order, setting a level silences all levels preceding it and logs every level after it.
- Examples:
- If the log is being spammed with messages coming from Lib.Pad, you can use `Lib.Pad:Critical` to only log critical-level messages.
- If you'd like to mute everything, but still want to receive messages from Vulkan rendering: `*:Critical Render.Vulkan:Info`
- `isIdenticalLogGrouped`: Group same logs in one line with a counter (`true`/`false`)
- By default, the emulator will not rewrite the same line, and instead add a counter.
- If the log is being spammed with messages coming from Lib.Pad, you can use `Lib.Pad=critical` to only log critical-level messages.
- If you'd like to mute everything, but still want to receive messages from Vulkan rendering: `off,Render.Vulkan=info` (if you want critical at least `critical,Render.Vulkan=info`)
- this option is evaluated after the environment variable `SPDLOG_LEVEL` but before the command line argument (their syntax are `SPDLOG_LEVEL="..."`, `"SPDLOG_LEVEL=..."` respectively)
- `skipDuplicate`: Skip same lines with a `Skipped N duplicate messages..` message (`true`/`false`)
- By default, the emulator will skip same lines for `maxSkipDuration` milliseconds.
- `append`: Append log to the existing file (`true`/`false`)
- By default, the emulator will overwrite the log file. (it can also be by-passed with CLI `--log-append`)
- `separate`: Write log to `log/{GAME ID}.log` instead of `log/shad_log.txt` (`true`/`false`)
- By default, the emulator use `log/shad_log.txt`.
- `maxSkipDuration`: Amount of time in which identical lines will not be logged (milliseconds).
- By default, 5'000 milliseconds.
- `sizeLimit`: Size limit for log files (bytes).
- By default, 100 MB.
- `type`: Choose between `wincolor` (WriteConsole*) and `msvc` (OutputDebugString*) - only for Windows.
- By default, `wincolor`.

- `Fullscreen`: Display the game in a full screen borderless window.

- `[GPU]`
- `dumpShaders`: Dump shaders that are loaded by the emulator. Dump path: `../user/shader/dumps`
- `nullGpu`: Disables rendering.
- `screenWidth` and `screenHeight`: Configures the game window width and height.
- `Fullscreen`: Display the game in a full screen borderless window.

- `[Vulkan]`
- `validation`-related settings: Use when debugging Vulkan.
Expand Down
5 changes: 5 additions & 0 deletions externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,8 @@ endif()
add_library(Cpp_Httplib INTERFACE)
target_include_directories(Cpp_Httplib INTERFACE cpp-httplib/)

# spdlog
set(SPDLOG_NO_EXCEPTIONS ON)
set(SPDLOG_FMT_EXTERNAL ON)
set(SPDLOG_DISABLE_DEFAULT_LOGGER ON)
add_subdirectory(spdlog EXCLUDE_FROM_ALL SYSTEM)
1 change: 1 addition & 0 deletions externals/spdlog
Submodule spdlog added at 45b67e
8 changes: 3 additions & 5 deletions src/common/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "common/arch.h"
#include "common/assert.h"
#include "common/logging/backend.h"
#include "common/logging/log.h"

#if defined(ARCH_X86_64)
#define Crash() __asm__ __volatile__("int $3")
Expand All @@ -14,14 +14,12 @@
#endif

void assert_fail_impl() {
Common::Log::Stop();
std::fflush(stdout);
Common::Log::Shutdown();
Crash();
}

[[noreturn]] void unreachable_impl() {
Common::Log::Stop();
std::fflush(stdout);
Common::Log::Shutdown();
Crash();
throw std::runtime_error("Unreachable code");
}
Expand Down
Loading