clang-format

master
MerryMage 2018-01-16 18:05:21 +07:00
parent 153205edbb
commit e35644c005
25 changed files with 54 additions and 63 deletions

@ -39,7 +39,8 @@ public:
Run(1); Run(1);
} }
virtual void MapBackingMemory(VAddr address, size_t size, u8* memory, Kernel::VMAPermission perms) {} virtual void MapBackingMemory(VAddr address, size_t size, u8* memory,
Kernel::VMAPermission perms) {}
/// Clear all instruction cache /// Clear all instruction cache
virtual void ClearInstructionCache() = 0; virtual void ClearInstructionCache() = 0;

@ -19,7 +19,6 @@ constexpr size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32);
// TODO(yuriks): These will probably go away once translation is implemented inside the kernel. // TODO(yuriks): These will probably go away once translation is implemented inside the kernel.
constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS; constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS;
enum class ControlCommand : u32 { enum class ControlCommand : u32 {
ConvertSessionToDomain = 0, ConvertSessionToDomain = 0,
ConvertDomainToSession = 1, ConvertDomainToSession = 1,
@ -81,13 +80,13 @@ struct BufferDescriptorX {
u32_le address_bits_0_31; u32_le address_bits_0_31;
u32_le Counter() const { u32_le Counter() const {
u32_le counter{ counter_bits_0_5 }; u32_le counter{counter_bits_0_5};
counter |= counter_bits_9_11 << 9; counter |= counter_bits_9_11 << 9;
return counter; return counter;
} }
VAddr Address() const { VAddr Address() const {
VAddr address{ address_bits_0_31 }; VAddr address{address_bits_0_31};
address |= static_cast<VAddr>(address_bits_32_35) << 32; address |= static_cast<VAddr>(address_bits_32_35) << 32;
address |= static_cast<VAddr>(address_bits_36_38) << 36; address |= static_cast<VAddr>(address_bits_36_38) << 36;
return address; return address;
@ -107,14 +106,14 @@ struct BufferDescriptorABW {
}; };
VAddr Address() const { VAddr Address() const {
VAddr address{ address_bits_0_31 }; VAddr address{address_bits_0_31};
address |= static_cast<VAddr>(address_bits_32_35) << 32; address |= static_cast<VAddr>(address_bits_32_35) << 32;
address |= static_cast<VAddr>(address_bits_36_38) << 36; address |= static_cast<VAddr>(address_bits_36_38) << 36;
return address; return address;
} }
u64 Size() const { u64 Size() const {
u64 size{ size_bits_0_31 }; u64 size{size_bits_0_31};
size |= static_cast<u64>(size_bits_32_35) << 32; size |= static_cast<u64>(size_bits_32_35) << 32;
return size; return size;
} }
@ -130,7 +129,7 @@ struct BufferDescriptorC {
}; };
VAddr Address() const { VAddr Address() const {
VAddr address{ address_bits_0_31 }; VAddr address{address_bits_0_31};
address |= static_cast<VAddr>(address_bits_32_47) << 32; address |= static_cast<VAddr>(address_bits_32_47) << 32;
return address; return address;
} }

@ -151,13 +151,13 @@ public:
return domain != nullptr; return domain != nullptr;
} }
template<typename T> template <typename T>
SharedPtr<T> GetCopyObject(size_t index) { SharedPtr<T> GetCopyObject(size_t index) {
ASSERT(index < copy_objects.size()); ASSERT(index < copy_objects.size());
return DynamicObjectCast<T>(copy_objects[index]); return DynamicObjectCast<T>(copy_objects[index]);
} }
template<typename T> template <typename T>
SharedPtr<T> GetMoveObject(size_t index) { SharedPtr<T> GetMoveObject(size_t index) {
ASSERT(index < move_objects.size()); ASSERT(index < move_objects.size());
return DynamicObjectCast<T>(move_objects[index]); return DynamicObjectCast<T>(move_objects[index]);

@ -105,7 +105,6 @@ public:
UNREACHABLE(); UNREACHABLE();
} }
public: public:
static unsigned int next_object_id; static unsigned int next_object_id;

@ -95,10 +95,8 @@ MemoryRegionInfo* GetMemoryRegion(MemoryRegion region) {
} }
} }
void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) { void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {}
}
void MapSharedPages(VMManager& address_space) { void MapSharedPages(VMManager& address_space) {}
}
} // namespace Kernel } // namespace Kernel

@ -255,8 +255,7 @@ 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 LockMutex(Handle holding_thread_handle, VAddr mutex_addr, static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr,
Handle requesting_thread_handle) { Handle requesting_thread_handle) {
LOG_TRACE(Kernel_SVC, LOG_TRACE(Kernel_SVC, "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, "
"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);
@ -522,8 +521,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().PrepareReschedule();
LOG_TRACE(Kernel_SVC, LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
"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);

@ -6,9 +6,9 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/core.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/vm_manager.h" #include "core/hle/kernel/vm_manager.h"
#include "core/core.h"
#include "core/memory.h" #include "core/memory.h"
#include "core/memory_setup.h" #include "core/memory_setup.h"
#include "core/mmio.h" #include "core/mmio.h"
@ -86,7 +86,8 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
VirtualMemoryArea& final_vma = vma_handle->second; VirtualMemoryArea& final_vma = vma_handle->second;
ASSERT(final_vma.size == size); ASSERT(final_vma.size == size);
Core::CPU().MapBackingMemory(target, size, block->data() + offset, VMAPermission::ReadWriteExecute); Core::CPU().MapBackingMemory(target, size, block->data() + offset,
VMAPermission::ReadWriteExecute);
final_vma.type = VMAType::AllocatedMemoryBlock; final_vma.type = VMAType::AllocatedMemoryBlock;
final_vma.permissions = VMAPermission::ReadWrite; final_vma.permissions = VMAPermission::ReadWrite;

@ -15,8 +15,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
APM::APM() : ServiceFramework("apm") { APM::APM() : ServiceFramework("apm") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00000000, nullptr, "OpenSession"}, {0x00000000, nullptr, "OpenSession"}, {0x00000001, nullptr, "GetPerformanceMode"},
{0x00000001, nullptr, "GetPerformanceMode"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }

@ -26,6 +26,7 @@ public:
VAddr GetObjectAddress(u32 handle) const; VAddr GetObjectAddress(u32 handle) const;
u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override;
private: private:
// Represents an nvmap object. // Represents an nvmap object.
struct Object { struct Object {

@ -48,9 +48,9 @@ struct Elf64_Sym {
}; };
static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size.");
void Linker::WriteRelocations(std::vector<u8>& program_image, void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols,
const std::vector<Symbol>& symbols, u64 relocation_offset, u64 relocation_offset, u64 size, bool is_jump_relocation,
u64 size, bool is_jump_relocation, VAddr load_base) { VAddr load_base) {
for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) {
Elf64_Rela rela; Elf64_Rela rela;
std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela));
@ -90,8 +90,7 @@ void Linker::WriteRelocations(std::vector<u8>& program_image,
} }
} }
void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base) {
VAddr load_base) {
std::map<u64, u64> dynamic; std::map<u64, u64> dynamic;
while (dynamic_section_offset < program_image.size()) { while (dynamic_section_offset < program_image.size()) {
Elf64_Dyn dyn; Elf64_Dyn dyn;
@ -141,8 +140,7 @@ void Linker::ResolveImports() {
const auto& search = exports.find(import.first); const auto& search = exports.find(import.first);
if (search != exports.end()) { if (search != exports.end()) {
Memory::Write64(import.second.ea, search->second + import.second.addend); Memory::Write64(import.second.ea, search->second + import.second.addend);
} } else {
else {
LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str()); LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str());
} }
} }

@ -157,7 +157,8 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
// Load NSO modules // Load NSO modules
VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR}; VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR};
for (const auto& module : {"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) { for (const auto& module :
{"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) {
const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module; const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module;
const VAddr load_addr = next_load_addr; const VAddr load_addr = next_load_addr;
next_load_addr = LoadNso(path, load_addr); next_load_addr = LoadNso(path, load_addr);

@ -18,8 +18,7 @@ namespace Loader {
class AppLoader_NSO final : public AppLoader, Linker { class AppLoader_NSO final : public AppLoader, Linker {
public: public:
AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath) AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath)
: AppLoader(std::move(file)), filepath(std::move(filepath)) { : AppLoader(std::move(file)), filepath(std::move(filepath)) {}
}
/** /**
* Returns the type of the file * Returns the type of the file

@ -61,7 +61,8 @@ private:
// Loads framebuffer from emulated memory into the display information structure // Loads framebuffer from emulated memory into the display information structure
void LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info, ScreenInfo& screen_info); void LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info, ScreenInfo& screen_info);
// Fills active OpenGL texture with the given RGBA color. // Fills active OpenGL texture with the given RGBA color.
void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, const TextureInfo& texture); void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
const TextureInfo& texture);
EmuWindow* render_window; ///< Handle to render window EmuWindow* render_window; ///< Handle to render window

@ -9,7 +9,7 @@
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
ui->setupUi(this); ui->setupUi(this);
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg( ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc)); Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
} }
AboutDialog::~AboutDialog() {} AboutDialog::~AboutDialog() {}

@ -18,10 +18,10 @@ Config::Config() {
} }
const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = {
Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q, Qt::Key_W, Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q,
Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T, Qt::Key_H, Qt::Key_G, Qt::Key_W, Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T,
Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J, Qt::Key_I, Qt::Key_L, Qt::Key_H, Qt::Key_G, Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J,
Qt::Key_K, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V, Qt::Key_I, Qt::Key_L, Qt::Key_K, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V,
}; };
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{{

@ -6,7 +6,6 @@
#include "ui_configure_debug.h" #include "ui_configure_debug.h"
#include "yuzu/configuration/configure_debug.h" #include "yuzu/configuration/configure_debug.h"
ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
ui->setupUi(this); ui->setupUi(this);
this->setConfiguration(); this->setConfiguration();

@ -7,7 +7,6 @@
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h" #include "yuzu/configuration/configure_dialog.h"
ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) { ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {
ui->setupUi(this); ui->setupUi(this);
this->setConfiguration(); this->setConfiguration();

@ -8,7 +8,6 @@
#include "yuzu/configuration/configure_system.h" #include "yuzu/configuration/configure_system.h"
#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,
}}; }};

@ -8,7 +8,6 @@
#include "yuzu/debugger/registers.h" #include "yuzu/debugger/registers.h"
#include "yuzu/util/util.h" #include "yuzu/util/util.h"
RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) { RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {
cpu_regs_ui.setupUi(this); cpu_regs_ui.setupUi(this);

@ -9,8 +9,8 @@
#include <QRunnable> #include <QRunnable>
#include <QStandardItem> #include <QStandardItem>
#include <QString> #include <QString>
#include "yuzu/util/util.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "yuzu/util/util.h"
/** /**
* Gets the default icon (for games without valid SMDH) * Gets the default icon (for games without valid SMDH)

@ -122,7 +122,8 @@ void GMainWindow::InitializeWidgets() {
statusBar()->addPermanentWidget(message_label, 1); statusBar()->addPermanentWidget(message_label, 1);
emu_speed_label = new QLabel(); emu_speed_label = new QLabel();
emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " emu_speed_label->setToolTip(
tr("Current emulation speed. Values higher or lower than 100% "
"indicate emulation is running faster or slower than a Switch.")); "indicate emulation is running faster or slower than a Switch."));
game_fps_label = new QLabel(); game_fps_label = new QLabel();
game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. " game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
@ -185,8 +186,8 @@ void GMainWindow::InitializeRecentFileMenuActions() {
void GMainWindow::InitializeHotkeys() { void GMainWindow::InitializeHotkeys() {
RegisterHotkey("Main Window", "Load File", QKeySequence::Open); RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
RegisterHotkey("Main Window", "Start Emulation"); RegisterHotkey("Main Window", "Start Emulation");
RegisterHotkey( "Main Window", "Fullscreen", QKeySequence::FullScreen ); RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen);
RegisterHotkey( "Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut ); RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);
LoadHotkeys(); LoadHotkeys();
connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this,

@ -31,8 +31,8 @@
#include <cstdlib> #include <cstdlib>
#include <QLineEdit> #include <QLineEdit>
#include <QRegExpValidator> #include <QRegExpValidator>
#include "yuzu/util/spinbox.h"
#include "common/assert.h" #include "common/assert.h"
#include "yuzu/util/spinbox.h"
CSpinBox::CSpinBox(QWidget* parent) CSpinBox::CSpinBox(QWidget* parent)
: QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) { : QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) {

@ -37,7 +37,6 @@
#include "yuzu_cmd/config.h" #include "yuzu_cmd/config.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h"
static void PrintHelp(const char* argv0) { static void PrintHelp(const char* argv0) {
std::cout << "Usage: " << argv0 std::cout << "Usage: " << argv0
<< " [options] <filename>\n" << " [options] <filename>\n"