1
0
Fork 0
forked from suyu/suyu

Merge pull request #117 from jroweboy/clang-format

Clang format as a build target
This commit is contained in:
bunnei 2018-01-20 19:12:21 -05:00 committed by GitHub
commit 557b2496d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 275 additions and 122 deletions

View file

@ -6,8 +6,12 @@ matrix:
dist: trusty dist: trusty
addons: addons:
apt: apt:
sources:
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- sourceline: 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main'
packages: packages:
- clang-format-3.9 - clang-format-6.0
script: "./.travis/clang-format/script.sh" script: "./.travis/clang-format/script.sh"
- os: linux - os: linux
env: NAME="linux build" env: NAME="linux build"

View file

@ -7,7 +7,7 @@ if grep -nr '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis*
fi fi
# Default clang-format points to default 3.5 version one # Default clang-format points to default 3.5 version one
CLANG_FORMAT=clang-format-3.9 CLANG_FORMAT=clang-format-6.0
$CLANG_FORMAT --version $CLANG_FORMAT --version
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then

View file

@ -3,14 +3,17 @@ cmake_minimum_required(VERSION 3.6)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
include(DownloadExternals) include(DownloadExternals)
include(CMakeDependentOption)
project(yuzu) project(yuzu)
# Set bundled sdl2/qt as dependent options.
# OFF by default, but if ENABLE_SDL2 and MSVC are true then ON
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF) CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
option(ENABLE_QT "Enable the Qt frontend" ON) option(ENABLE_QT "Enable the Qt frontend" ON)
option(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_SDL2;MSVC" OFF)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit) if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
message(STATUS "Copying pre-commit hook") message(STATUS "Copying pre-commit hook")
@ -319,6 +322,53 @@ if (UNIX OR MINGW)
endif() endif()
endif() endif()
# Setup a custom clang-format target (if clang-format can be found) that will run
# against all the src files. This should be used before making a pull request.
# =======================================================================
set(CLANG_FORMAT_POSTFIX "-6.0")
find_program(CLANG_FORMAT
NAMES clang-format${CLANG_FORMAT_POSTFIX}
clang-format
PATHS ${CMAKE_BINARY_DIR}/externals)
# if find_program doesn't find it, try to download from externals
if (NOT CLANG_FORMAT)
if (WIN32)
message(STATUS "Clang format not found! Downloading...")
set(CLANG_FORMAT "${CMAKE_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
file(DOWNLOAD
https://github.com/yuzu-emu/ext-windows-bin/raw/master/clang-format${CLANG_FORMAT_POSTFIX}.exe
"${CLANG_FORMAT}" SHOW_PROGRESS
STATUS DOWNLOAD_SUCCESS)
if (NOT DOWNLOAD_SUCCESS EQUAL 0)
message(WARNING "Could not download clang format! Disabling the clang format target")
file(REMOVE ${CLANG_FORMAT})
unset(CLANG_FORMAT)
endif()
else()
message(WARNING "Clang format not found! Disabling the clang format target")
endif()
endif()
if (CLANG_FORMAT)
set(SRCS ${CMAKE_SOURCE_DIR}/src)
set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
if (WIN32)
add_custom_target(clang-format
COMMAND powershell.exe -Command "${CLANG_FORMAT} -i @(Get-ChildItem -Recurse ${SRCS}/* -Include \'*.h\', \'*.cpp\')"
COMMENT ${CCOMMENT})
elseif(MINGW)
add_custom_target(clang-format
COMMAND find `cygpath -u ${SRCS}` -iname *.h -o -iname *.cpp | xargs `cygpath -u ${CLANG_FORMAT}` -i
COMMENT ${CCOMMENT})
else()
add_custom_target(clang-format
COMMAND find ${SRCS} -iname *.h -o -iname *.cpp | xargs ${CLANG_FORMAT} -i
COMMENT ${CCOMMENT})
endif()
unset(SRCS)
unset(CCOMMENT)
endif()
# Include source code # Include source code
# =================== # ===================

View file

@ -5,7 +5,16 @@
If you believe you have a valid issue report, please post text or a screenshot from the log (the console window that opens alongside yuzu) and build version (hex string visible in the titlebar and zip filename), as well as your hardware and software information if applicable. If you believe you have a valid issue report, please post text or a screenshot from the log (the console window that opens alongside yuzu) and build version (hex string visible in the titlebar and zip filename), as well as your hardware and software information if applicable.
# Contributing # Contributing
yuzu is a brand new project, so we have a great opportunity to keep things clean and well organized early on. As such, coding style is very important when making commits. We run clang-format on our CI to check the code. Please use it to format your code when contributing. However, it doesn't cover all the rules below. Some of them aren't very strict rules since we want to be flexible and we understand that under certain circumstances some of them can be counterproductive. Just try to follow as many of them as possible: yuzu is a brand new project, so we have a great opportunity to keep things clean and well organized early on. As such, coding style is very important when making commits. We run clang-format on our CI to check the code. Please use it to format your code when contributing. However, it doesn't cover all the rules below. Some of them aren't very strict rules since we want to be flexible and we understand that under certain circumstances some of them can be counterproductive. Just try to follow as many of them as possible.
# Using clang format (version 6.0)
When generating the native build script for your toolset, cmake will try to find the correct version of clang format (or will download it on windows). Before running cmake, please install clang format version 6.0 for your platform as follows:
* Windows: do nothing; cmake will download a pre built binary for MSVC and MINGW. MSVC users can additionally install a clang format Visual Studio extension to add features like format on save.
* OSX: run `brew install clang-format`.
* Linux: use your package manager to get an appropriate binary.
If clang format is found, then cmake will add a custom build target that can be run at any time to run clang format against *all* source files and update the formatting in them. This should be used before making a pull request so that the reviewers can spend more time reviewing the code instead of having to worry about minor style violations. On MSVC, you can run clang format by building the clang-format project in the solution. On OSX, you can either use the Makefile target `make clang-format` or by building the clang-format target in XCode. For Makefile builds, you can use the clang-format target with `make clang-format`
### General Rules ### General Rules
* A lot of code was taken from other projects (e.g. Citra, Dolphin, PPSSPP, Gekko). In general, when editing other people's code, follow the style of the module you're in (or better yet, fix the style if it drastically differs from our guide). * A lot of code was taken from other projects (e.g. Citra, Dolphin, PPSSPP, Gekko). In general, when editing other people's code, follow the style of the module you're in (or better yet, fix the style if it drastically differs from our guide).

View file

@ -236,7 +236,7 @@ public:
IntTy m_val; IntTy m_val;
}; };
} // Common } // namespace Common
typedef Common::BitSet<u8> BitSet8; typedef Common::BitSet<u8> BitSet8;
typedef Common::BitSet<u16> BitSet16; typedef Common::BitSet<u16> BitSet16;

View file

@ -607,7 +607,8 @@ public:
u32 cookie = arbitraryNumber; u32 cookie = arbitraryNumber;
Do(cookie); Do(cookie);
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). " LOG_ERROR(Common,
"After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). "
"Aborting savestate load...", "Aborting savestate load...",
prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
SetError(ERROR_FAILURE); SetError(ERROR_FAILURE);

View file

@ -256,4 +256,4 @@ inline void EncodeX24S8(u8 stencil, u8* bytes) {
bytes[3] = stencil; bytes[3] = stencil;
} }
} // namespace } // namespace Color

View file

@ -873,8 +873,7 @@ bool IOFile::Flush() {
} }
bool IOFile::Resize(u64 size) { bool IOFile::Resize(u64 size) {
if (!IsOpen() || if (!IsOpen() || 0 !=
0 !=
#ifdef _WIN32 #ifdef _WIN32
// ector: _chsize sucks, not 64-bit safe // ector: _chsize sucks, not 64-bit safe
// F|RES: changed to _chsize_s. i think it is 64-bit safe // F|RES: changed to _chsize_s. i think it is 64-bit safe
@ -889,4 +888,4 @@ bool IOFile::Resize(u64 size) {
return m_good; return m_good;
} }
} // namespace } // namespace FileUtil

View file

@ -253,7 +253,7 @@ private:
bool m_good = true; bool m_good = true;
}; };
} // namespace } // namespace FileUtil
// To deal with Windows being dumb at unicode: // To deal with Windows being dumb at unicode:
template <typename T> template <typename T>

View file

@ -132,4 +132,4 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned
PrintColoredMessage(entry); PrintColoredMessage(entry);
} }
} } // namespace Log

View file

@ -47,4 +47,4 @@ Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsign
const char* function, const char* format, va_list args); const char* function, const char* format, va_list args);
void SetFilter(Filter* filter); void SetFilter(Filter* filter);
} } // namespace Log

View file

@ -94,4 +94,4 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
bool Filter::CheckMessage(Class log_class, Level level) const { bool Filter::CheckMessage(Class log_class, Level level) const {
return static_cast<u8>(level) >= static_cast<u8>(class_levels[static_cast<size_t>(log_class)]); return static_cast<u8>(level) >= static_cast<u8>(class_levels[static_cast<size_t>(log_class)]);
} }
} } // namespace Log

View file

@ -50,4 +50,4 @@ public:
private: private:
std::array<Level, (size_t)Class::Count> class_levels; std::array<Level, (size_t)Class::Count> class_levels;
}; };
} } // namespace Log

View file

@ -129,4 +129,4 @@ void PrintColoredMessage(const Entry& entry) {
#undef ESC #undef ESC
#endif #endif
} }
} } // namespace Log

View file

@ -28,4 +28,4 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len);
void PrintMessage(const Entry& entry); void PrintMessage(const Entry& entry);
/// Prints the same message as `PrintMessage`, but colored acoording to the severity level. /// Prints the same message as `PrintMessage`, but colored acoording to the severity level.
void PrintColoredMessage(const Entry& entry); void PrintColoredMessage(const Entry& entry);
} } // namespace Log

View file

@ -40,7 +40,8 @@ void* AllocateExecutableMemory(size_t size, bool low) {
if (low && (!map_hint)) if (low && (!map_hint))
map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */ map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */
#endif #endif
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE
#if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) #if defined(ARCHITECTURE_X64) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0) | (low ? MAP_32BIT : 0)
#endif #endif

View file

@ -46,4 +46,4 @@ inline Quaternion<float> MakeQuaternion(const Math::Vec3<float>& axis, float ang
return {axis * std::sin(angle / 2), std::cos(angle / 2)}; return {axis * std::sin(angle / 2), std::cos(angle / 2)};
} }
} // namspace Math } // namespace Math

View file

@ -12,4 +12,4 @@ extern const char g_scm_desc[];
extern const char g_build_name[]; extern const char g_build_name[];
extern const char g_build_date[]; extern const char g_build_date[];
} // namespace } // namespace Common

View file

@ -22,7 +22,7 @@ template <typename Func>
ScopeExitHelper<Func> ScopeExit(Func&& func) { ScopeExitHelper<Func> ScopeExit(Func&& func) {
return ScopeExitHelper<Func>(std::move(func)); return ScopeExitHelper<Func>(std::move(func));
} }
} } // namespace detail
/** /**
* This macro allows you to conveniently specify a block of code that will run on scope exit. Handy * This macro allows you to conveniently specify a block of code that will run on scope exit. Handy

View file

@ -462,4 +462,4 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_l
return std::string(buffer, len); return std::string(buffer, len);
} }
} } // namespace Common

View file

@ -134,4 +134,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) {
* NUL-terminated then the string ends at max_len characters. * NUL-terminated then the string ends at max_len characters.
*/ */
std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len); std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len);
} } // namespace Common

View file

@ -158,4 +158,4 @@ private:
std::array<Queue, NUM_QUEUES> queues; std::array<Queue, NUM_QUEUES> queues;
}; };
} // namespace } // namespace Common

View file

@ -60,20 +60,41 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9;
const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({
// GPRs // GPRs
Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::r8, Xbyak::util::r9, Xbyak::util::r10, Xbyak::util::rcx,
Xbyak::util::rdx,
Xbyak::util::r8,
Xbyak::util::r9,
Xbyak::util::r10,
Xbyak::util::r11, Xbyak::util::r11,
// XMMs // XMMs
Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, Xbyak::util::xmm0,
Xbyak::util::xmm1,
Xbyak::util::xmm2,
Xbyak::util::xmm3,
Xbyak::util::xmm4,
Xbyak::util::xmm5, Xbyak::util::xmm5,
}); });
const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({
// GPRs // GPRs
Xbyak::util::rbx, Xbyak::util::rsi, Xbyak::util::rdi, Xbyak::util::rbp, Xbyak::util::r12, Xbyak::util::rbx,
Xbyak::util::r13, Xbyak::util::r14, Xbyak::util::r15, Xbyak::util::rsi,
Xbyak::util::rdi,
Xbyak::util::rbp,
Xbyak::util::r12,
Xbyak::util::r13,
Xbyak::util::r14,
Xbyak::util::r15,
// XMMs // XMMs
Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, Xbyak::util::xmm10, Xbyak::util::xmm6,
Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, Xbyak::util::xmm14, Xbyak::util::xmm7,
Xbyak::util::xmm8,
Xbyak::util::xmm9,
Xbyak::util::xmm10,
Xbyak::util::xmm11,
Xbyak::util::xmm12,
Xbyak::util::xmm13,
Xbyak::util::xmm14,
Xbyak::util::xmm15, Xbyak::util::xmm15,
}); });
@ -90,18 +111,40 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx;
const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({
// GPRs // GPRs
Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::rdi, Xbyak::util::rsi, Xbyak::util::r8, Xbyak::util::rcx,
Xbyak::util::r9, Xbyak::util::r10, Xbyak::util::r11, Xbyak::util::rdx,
Xbyak::util::rdi,
Xbyak::util::rsi,
Xbyak::util::r8,
Xbyak::util::r9,
Xbyak::util::r10,
Xbyak::util::r11,
// XMMs // XMMs
Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, Xbyak::util::xmm0,
Xbyak::util::xmm5, Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, Xbyak::util::xmm1,
Xbyak::util::xmm10, Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, Xbyak::util::xmm2,
Xbyak::util::xmm14, Xbyak::util::xmm15, Xbyak::util::xmm3,
Xbyak::util::xmm4,
Xbyak::util::xmm5,
Xbyak::util::xmm6,
Xbyak::util::xmm7,
Xbyak::util::xmm8,
Xbyak::util::xmm9,
Xbyak::util::xmm10,
Xbyak::util::xmm11,
Xbyak::util::xmm12,
Xbyak::util::xmm13,
Xbyak::util::xmm14,
Xbyak::util::xmm15,
}); });
const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({
// GPRs // GPRs
Xbyak::util::rbx, Xbyak::util::rbp, Xbyak::util::r12, Xbyak::util::r13, Xbyak::util::r14, Xbyak::util::rbx,
Xbyak::util::rbp,
Xbyak::util::r12,
Xbyak::util::r13,
Xbyak::util::r14,
Xbyak::util::r15, Xbyak::util::r15,
}); });

View file

@ -119,4 +119,4 @@ std::vector<u8> Path::AsBinary() const {
return {}; return {};
} }
} }
} } // namespace FileSys

View file

@ -91,4 +91,4 @@ bool GetCpuStepFlag();
* @param is_step * @param is_step
*/ */
void SetCpuStepFlag(bool is_step); void SetCpuStepFlag(bool is_step);
} } // namespace GDBStub

View file

@ -28,4 +28,4 @@ void Init() {
config_mem.firm_ctr_sdk_ver = 0x0000F297; config_mem.firm_ctr_sdk_ver = 0x0000F297;
} }
} // namespace } // namespace ConfigMem

View file

@ -53,4 +53,4 @@ extern ConfigMemDef config_mem;
void Init(); void Init();
} // namespace } // namespace ConfigMem

View file

@ -57,4 +57,4 @@ private:
~AddressArbiter() override; ~AddressArbiter() override;
}; };
} // namespace FileSys } // namespace Kernel

View file

@ -39,4 +39,4 @@ ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() {
return MakeResult(std::get<SharedPtr<ClientSession>>(sessions)); return MakeResult(std::get<SharedPtr<ClientSession>>(sessions));
} }
} // namespace } // namespace Kernel

View file

@ -47,4 +47,4 @@ private:
~ClientPort() override; ~ClientPort() override;
}; };
} // namespace } // namespace Kernel

View file

@ -48,4 +48,4 @@ ResultCode ClientSession::SendSyncRequest(SharedPtr<Thread> thread) {
return server->HandleSyncRequest(std::move(thread)); return server->HandleSyncRequest(std::move(thread));
} }
} // namespace } // namespace Kernel

View file

@ -45,4 +45,4 @@ private:
~ClientSession() override; ~ClientSession() override;
}; };
} // namespace } // namespace Kernel

View file

@ -4,8 +4,8 @@
#pragma once #pragma once
#include <queue>
#include <string> #include <string>
#include <queue>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"

View file

@ -52,4 +52,4 @@ void Event::WakeupAllWaitingThreads() {
signaled = false; signaled = false;
} }
} // namespace } // namespace Kernel

View file

@ -49,4 +49,4 @@ private:
~Event() override; ~Event() override;
}; };
} // namespace } // namespace Kernel

View file

@ -104,4 +104,4 @@ void HandleTable::Clear() {
next_free_slot = 0; next_free_slot = 0;
} }
} // namespace } // namespace Kernel

View file

@ -130,4 +130,4 @@ private:
extern HandleTable g_handle_table; extern HandleTable g_handle_table;
} // namespace } // namespace Kernel

View file

@ -99,8 +99,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
data_payload_offset = rp.GetCurrentOffset(); data_payload_offset = rp.GetCurrentOffset();
if (domain_message_header && if (domain_message_header && domain_message_header->command ==
domain_message_header->command ==
IPC::DomainMessageHeader::CommandType::CloseVirtualHandle) { IPC::DomainMessageHeader::CommandType::CloseVirtualHandle) {
// CloseVirtualHandle command does not have SFC* or any data // CloseVirtualHandle command does not have SFC* or any data
return; return;

View file

@ -151,4 +151,4 @@ void ResourceLimitsInit() {
void ResourceLimitsShutdown() {} void ResourceLimitsShutdown() {}
} // namespace } // namespace Kernel

View file

@ -123,4 +123,4 @@ void ResourceLimitsInit();
// Destroys the resource limits // Destroys the resource limits
void ResourceLimitsShutdown(); void ResourceLimitsShutdown();
} // namespace } // namespace Kernel

View file

@ -50,4 +50,4 @@ std::tuple<SharedPtr<ServerPort>, SharedPtr<ClientPort>> ServerPort::CreatePortP
return std::make_tuple(std::move(server_port), std::move(client_port)); return std::make_tuple(std::move(server_port), std::move(client_port));
} }
} // namespace } // namespace Kernel

View file

@ -72,4 +72,4 @@ private:
~ServerPort() override; ~ServerPort() override;
}; };
} // namespace } // namespace Kernel

View file

@ -113,4 +113,4 @@ private:
* in the command buffer. * in the command buffer.
*/ */
ResultCode TranslateHLERequest(ServerSession* server_session); ResultCode TranslateHLERequest(ServerSession* server_session);
} } // namespace Kernel

View file

@ -9,4 +9,4 @@ namespace Kernel {
Session::Session() {} Session::Session() {}
Session::~Session() {} Session::~Session() {}
} } // namespace Kernel

View file

@ -24,4 +24,4 @@ public:
ServerSession* server = nullptr; ///< The server endpoint of the session. ServerSession* server = nullptr; ///< The server endpoint of the session.
SharedPtr<ClientPort> port; ///< The port that this session is associated with (optional). SharedPtr<ClientPort> port; ///< The port that this session is associated with (optional).
}; };
} } // namespace Kernel

View file

@ -129,4 +129,4 @@ private:
~SharedMemory() override; ~SharedMemory() override;
}; };
} // namespace } // namespace Kernel

View file

@ -255,7 +255,8 @@ static ResultCode CancelSynchronization(Handle thread_handle) {
/// Attempts to locks a mutex, creating it if it does not already exist /// Attempts to locks a mutex, creating it if it does not already exist
static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr,
Handle requesting_thread_handle) { Handle requesting_thread_handle) {
LOG_TRACE(Kernel_SVC, "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " LOG_TRACE(Kernel_SVC,
"called holding_thread_handle=0x%08X, mutex_addr=0x%llx, "
"requesting_current_thread_handle=0x%08X", "requesting_current_thread_handle=0x%08X",
holding_thread_handle, mutex_addr, requesting_thread_handle); holding_thread_handle, mutex_addr, requesting_thread_handle);
@ -546,7 +547,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().PrepareReschedule();
LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " LOG_TRACE(Kernel_SVC,
"called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
"threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X",
entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle);

View file

@ -111,4 +111,4 @@ void TimersInit() {
void TimersShutdown() {} void TimersShutdown() {}
} // namespace } // namespace Kernel

View file

@ -76,4 +76,4 @@ void TimersInit();
/// Tears down the timer variables /// Tears down the timer variables
void TimersShutdown(); void TimersShutdown();
} // namespace } // namespace Kernel

View file

@ -222,7 +222,8 @@ public:
explicit IStorageAccessor(std::vector<u8> buffer) explicit IStorageAccessor(std::vector<u8> buffer)
: ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) { : ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IStorageAccessor::GetSize, "GetSize"}, {11, &IStorageAccessor::Read, "Read"}, {0, &IStorageAccessor::GetSize, "GetSize"},
{11, &IStorageAccessor::Read, "Read"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }

View file

@ -51,7 +51,8 @@ private:
APM::APM() : ServiceFramework("apm") { APM::APM() : ServiceFramework("apm") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00000000, &APM::OpenSession, "OpenSession"}, {0x00000001, nullptr, "GetPerformanceMode"}, {0x00000000, &APM::OpenSession, "OpenSession"},
{0x00000001, nullptr, "GetPerformanceMode"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }

View file

@ -7,8 +7,8 @@
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
#include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h"
#include "core/hle/service/nvdrv/devices/nvmap.h" #include "core/hle/service/nvdrv/devices/nvmap.h"
#include "core/hle/service/nvdrv/nvdrv.h"
#include "core/hle/service/nvdrv/interface.h" #include "core/hle/service/nvdrv/interface.h"
#include "core/hle/service/nvdrv/nvdrv.h"
namespace Service { namespace Service {
namespace Nvidia { namespace Nvidia {

View file

@ -21,7 +21,7 @@ class ClientPort;
class ServerPort; class ServerPort;
class ServerSession; class ServerSession;
class HLERequestContext; class HLERequestContext;
} } // namespace Kernel
namespace Service { namespace Service {
@ -189,4 +189,4 @@ extern std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_
/// Adds a port to the named port table /// Adds a port to the named port table
void AddNamedPort(std::string name, Kernel::SharedPtr<Kernel::ClientPort> port); void AddNamedPort(std::string name, Kernel::SharedPtr<Kernel::ClientPort> port);
} // namespace } // namespace Service

View file

@ -82,4 +82,4 @@ void Init() {
CoreTiming::ScheduleEvent(0, update_time_event); CoreTiming::ScheduleEvent(0, update_time_event);
} }
} // namespace } // namespace SharedPage

View file

@ -66,4 +66,4 @@ extern SharedPageDef shared_page;
void Init(); void Init();
} // namespace } // namespace SharedPage

View file

@ -91,4 +91,4 @@ void Shutdown() {
LCD::Shutdown(); LCD::Shutdown();
LOG_DEBUG(HW, "shutdown OK"); LOG_DEBUG(HW, "shutdown OK");
} }
} } // namespace HW

View file

@ -47,4 +47,4 @@ void Init();
/// Shutdown hardware /// Shutdown hardware
void Shutdown(); void Shutdown();
} // namespace } // namespace HW

View file

@ -64,4 +64,4 @@ void Shutdown() {
LOG_DEBUG(HW_LCD, "shutdown OK"); LOG_DEBUG(HW_LCD, "shutdown OK");
} }
} // namespace } // namespace LCD

View file

@ -83,4 +83,4 @@ void Init();
/// Shutdown hardware /// Shutdown hardware
void Shutdown(); void Shutdown();
} // namespace } // namespace LCD

View file

@ -323,7 +323,8 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
} }
if (codeset_segment->size != 0) { if (codeset_segment->size != 0) {
LOG_ERROR(Loader, "ELF has more than one segment of the same type. Skipping extra " LOG_ERROR(Loader,
"ELF has more than one segment of the same type. Skipping extra "
"segment (id %i)", "segment (id %i)",
i); i);
continue; continue;

View file

@ -29,4 +29,4 @@ void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target);
void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MMIORegionPointer mmio_handler); void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MMIORegionPointer mmio_handler);
void UnmapRegion(PageTable& page_table, VAddr base, u64 size); void UnmapRegion(PageTable& page_table, VAddr base, u64 size);
} } // namespace Memory

View file

@ -35,4 +35,4 @@ public:
}; };
using MMIORegionPointer = std::shared_ptr<MMIORegion>; using MMIORegionPointer = std::shared_ptr<MMIORegion>;
}; }; // namespace Memory

View file

@ -100,7 +100,8 @@ enum Values {
}; };
static const std::array<const char*, NumAnalogs> mapping = {{ static const std::array<const char*, NumAnalogs> mapping = {{
"lstick", "rstick", "lstick",
"rstick",
}}; }};
} // namespace NativeAnalog } // namespace NativeAnalog

View file

@ -97,4 +97,4 @@ struct CTStreamElement {
}; };
#pragma pack() #pragma pack()
} } // namespace CiTrace

View file

@ -205,4 +205,4 @@ template void Recorder::RegisterWritten(u32, u8);
template void Recorder::RegisterWritten(u32, u16); template void Recorder::RegisterWritten(u32, u16);
template void Recorder::RegisterWritten(u32, u32); template void Recorder::RegisterWritten(u32, u32);
template void Recorder::RegisterWritten(u32, u64); template void Recorder::RegisterWritten(u32, u64);
} } // namespace CiTrace

View file

@ -84,4 +84,4 @@ private:
std::unordered_map<boost::crc_32_type::value_type /*hash*/, u32 /*file_offset*/> memory_regions; std::unordered_map<boost::crc_32_type::value_type /*hash*/, u32 /*file_offset*/> memory_regions;
}; };
} // namespace } // namespace CiTrace

View file

@ -52,7 +52,8 @@ MotionEmu* GetMotionEmu() {
std::string GenerateKeyboardParam(int key_code) { std::string GenerateKeyboardParam(int key_code) {
Common::ParamPackage param{ Common::ParamPackage param{
{"engine", "keyboard"}, {"code", std::to_string(key_code)}, {"engine", "keyboard"},
{"code", std::to_string(key_code)},
}; };
return param.Serialize(); return param.Serialize();
} }

View file

@ -10,7 +10,9 @@ namespace Common {
TEST_CASE("ParamPackage", "[common]") { TEST_CASE("ParamPackage", "[common]") {
ParamPackage original{ ParamPackage original{
{"abc", "xyz"}, {"def", "42"}, {"jkl", "$$:1:$2$,3"}, {"abc", "xyz"},
{"def", "42"},
{"jkl", "$$:1:$2$,3"},
}; };
original.Set("ghi", 3.14f); original.Set("ghi", 3.14f);
ParamPackage copy(original.Serialize()); ParamPackage copy(original.Serialize());

View file

@ -16,4 +16,4 @@ namespace GLShader {
*/ */
GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader); GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader);
} // namespace } // namespace GLShader

View file

@ -49,4 +49,4 @@ static inline u32 GetMortonOffset(u32 x, u32 y, u32 bytes_per_pixel) {
return (i + offset) * bytes_per_pixel; return (i + offset) * bytes_per_pixel;
} }
} // namespace } // namespace VideoCore

View file

@ -39,4 +39,4 @@ void Shutdown() {
LOG_DEBUG(Render, "shutdown OK"); LOG_DEBUG(Render, "shutdown OK");
} }
} // namespace } // namespace VideoCore

View file

@ -31,4 +31,4 @@ bool Init(EmuWindow* emu_window);
/// Shutdown the video core /// Shutdown the video core
void Shutdown(); void Shutdown();
} // namespace } // namespace VideoCore

View file

@ -26,10 +26,18 @@ const std::array<int, Settings::NativeButton::NumButtons> Config::default_button
const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{
{ {
Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, Qt::Key_E, Qt::Key_Up,
Qt::Key_Down,
Qt::Key_Left,
Qt::Key_Right,
Qt::Key_E,
}, },
{ {
Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L, Qt::Key_R, Qt::Key_I,
Qt::Key_K,
Qt::Key_J,
Qt::Key_L,
Qt::Key_R,
}, },
}}; }};

View file

@ -14,7 +14,11 @@
const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM> const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM>
ConfigureInput::analog_sub_buttons{{ ConfigureInput::analog_sub_buttons{{
"up", "down", "left", "right", "modifier", "up",
"down",
"left",
"right",
"modifier",
}}; }};
static QString getKeyName(int key_code) { static QString getKeyName(int key_code) {
@ -36,7 +40,8 @@ static void SetAnalogButton(const Common::ParamPackage& input_param,
Common::ParamPackage& analog_param, const std::string& button_name) { Common::ParamPackage& analog_param, const std::string& button_name) {
if (analog_param.Get("engine", "") != "analog_from_button") { if (analog_param.Get("engine", "") != "analog_from_button") {
analog_param = { analog_param = {
{"engine", "analog_from_button"}, {"modifier_scale", "0.5"}, {"engine", "analog_from_button"},
{"modifier_scale", "0.5"},
}; };
} }
analog_param.Set(button_name, input_param.Serialize()); analog_param.Set(button_name, input_param.Serialize());
@ -107,11 +112,17 @@ ConfigureInput::ConfigureInput(QWidget* parent)
analog_map_buttons = {{ analog_map_buttons = {{
{ {
ui->buttonLStickUp, ui->buttonLStickDown, ui->buttonLStickLeft, ui->buttonLStickRight, ui->buttonLStickUp,
ui->buttonLStickDown,
ui->buttonLStickLeft,
ui->buttonLStickRight,
ui->buttonLStickMod, ui->buttonLStickMod,
}, },
{ {
ui->buttonRStickUp, ui->buttonRStickDown, ui->buttonRStickLeft, ui->buttonRStickRight, ui->buttonRStickUp,
ui->buttonRStickDown,
ui->buttonRStickLeft,
ui->buttonRStickRight,
ui->buttonRStickMod, ui->buttonRStickMod,
}, },
}}; }};

View file

@ -9,7 +9,18 @@
#include "yuzu/ui_settings.h" #include "yuzu/ui_settings.h"
static const std::array<int, 12> days_in_month = {{ static const std::array<int, 12> days_in_month = {{
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31,
}}; }};
ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {

View file

@ -20,7 +20,7 @@ class Mutex;
class ConditionVariable; class ConditionVariable;
class Thread; class Thread;
class Timer; class Timer;
} } // namespace Kernel
class WaitTreeThread; class WaitTreeThread;

View file

@ -50,4 +50,4 @@ struct Values {
}; };
extern Values values; extern Values values;
} } // namespace UISettings

View file

@ -49,10 +49,18 @@ static const std::array<int, Settings::NativeButton::NumButtons> default_buttons
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs{{ static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs{{
{ {
SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_D, SDL_SCANCODE_UP,
SDL_SCANCODE_DOWN,
SDL_SCANCODE_LEFT,
SDL_SCANCODE_RIGHT,
SDL_SCANCODE_D,
}, },
{ {
SDL_SCANCODE_I, SDL_SCANCODE_K, SDL_SCANCODE_J, SDL_SCANCODE_L, SDL_SCANCODE_D, SDL_SCANCODE_I,
SDL_SCANCODE_K,
SDL_SCANCODE_J,
SDL_SCANCODE_L,
SDL_SCANCODE_D,
}, },
}}; }};