From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/citra/citra.cpp | 39 +++++++++++++++----------------- src/citra/config.cpp | 31 +++++++++++++------------ src/citra/config.h | 3 ++- src/citra/default_ini.h | 1 - src/citra/emu_window/emu_window_sdl2.cpp | 25 ++++++++++++-------- src/citra/emu_window/emu_window_sdl2.h | 5 ++-- src/citra/resource.h | 10 ++++---- 7 files changed, 60 insertions(+), 54 deletions(-) (limited to 'src/citra') diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 128b9a16d..7b387e258 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include -#include #include #include +#include +#include // This needs to be included before getopt.h because the latter #defines symbols used by it #include "common/microprofile.h" @@ -13,53 +13,51 @@ #ifdef _MSC_VER #include #else -#include #include +#include #endif #ifdef _WIN32 #include #endif -#include "common/logging/log.h" #include "common/logging/backend.h" #include "common/logging/filter.h" +#include "common/logging/log.h" #include "common/scm_rev.h" #include "common/scope_exit.h" #include "common/string_util.h" -#include "core/settings.h" -#include "core/system.h" #include "core/core.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" +#include "core/settings.h" +#include "core/system.h" #include "citra/config.h" #include "citra/emu_window/emu_window_sdl2.h" #include "video_core/video_core.h" - -static void PrintHelp(const char *argv0) -{ - std::cout << "Usage: " << argv0 << " [options] \n" +static void PrintHelp(const char* argv0) { + std::cout << "Usage: " << argv0 + << " [options] \n" "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n" "-h, --help Display this help and exit\n" "-v, --version Output version information and exit\n"; } -static void PrintVersion() -{ +static void PrintVersion() { std::cout << "Citra " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl; } /// Application entry point -int main(int argc, char **argv) { +int main(int argc, char** argv) { Config config; int option_index = 0; bool use_gdbstub = Settings::values.use_gdbstub; u32 gdb_port = static_cast(Settings::values.gdbstub_port); - char *endarg; + char* endarg; #ifdef _WIN32 int argc_w; auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); @@ -71,12 +69,10 @@ int main(int argc, char **argv) { #endif std::string boot_filename; - static struct option long_options[] = { - { "gdbport", required_argument, 0, 'g' }, - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'v' }, - { 0, 0, 0, 0 } - }; + static struct option long_options[] = {{"gdbport", required_argument, 0, 'g'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0}}; while (optind < argc) { char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index); @@ -86,7 +82,8 @@ int main(int argc, char **argv) { errno = 0; gdb_port = strtoul(optarg, &endarg, 0); use_gdbstub = true; - if (endarg == optarg) errno = EINVAL; + if (endarg == optarg) + errno = EINVAL; if (errno != 0) { perror("--gdbport"); exit(1); diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 1a09f0e55..77679bd88 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -45,15 +45,13 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { static const std::array defaults = { // directly mapped keys - SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, - SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_1, SDL_SCANCODE_2, - SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_B, - SDL_SCANCODE_T, SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, - SDL_SCANCODE_I, SDL_SCANCODE_K, SDL_SCANCODE_J, SDL_SCANCODE_L, + SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_Q, SDL_SCANCODE_W, + SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_B, SDL_SCANCODE_T, + SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_I, SDL_SCANCODE_K, SDL_SCANCODE_J, + SDL_SCANCODE_L, // indirectly mapped keys - 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, }; void Config::ReadValues() { @@ -62,7 +60,8 @@ void Config::ReadValues() { Settings::values.input_mappings[Settings::NativeInput::All[i]] = sdl2_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[i]); } - Settings::values.pad_circle_modifier_scale = (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5); + Settings::values.pad_circle_modifier_scale = + (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5); // Core Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true); @@ -71,19 +70,22 @@ void Config::ReadValues() { // Renderer Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); - Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); + Settings::values.use_scaled_resolution = + sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false); - Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); + Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); - Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); + Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); // Audio Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); - Settings::values.enable_audio_stretching = sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true); + Settings::values.enable_audio_stretching = + sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true); // Data Storage - Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); + Settings::values.use_virtual_sd = + sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); // System Settings::values.is_new_3ds = sdl2_config->GetBoolean("System", "is_new_3ds", false); @@ -94,7 +96,8 @@ void Config::ReadValues() { // Debugging Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false); - Settings::values.gdbstub_port = static_cast(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); + Settings::values.gdbstub_port = + static_cast(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); } void Config::Reload() { diff --git a/src/citra/config.h b/src/citra/config.h index 52a478146..8bd2b294b 100644 --- a/src/citra/config.h +++ b/src/citra/config.h @@ -13,8 +13,9 @@ class Config { std::unique_ptr sdl2_config; std::string sdl2_config_loc; - bool LoadINI(const std::string& default_contents="", bool retry=true); + bool LoadINI(const std::string& default_contents = "", bool retry = true); void ReadValues(); + public: Config(); diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 788174508..0b49e0230 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -104,5 +104,4 @@ log_filter = *:Info use_gdbstub=false gdbstub_port=24689 )"; - } diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index da12307b7..12f3e2c71 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp @@ -16,8 +16,8 @@ #include "common/scm_rev.h" #include "common/string_util.h" -#include "core/settings.h" #include "core/hle/service/hid/hid.h" +#include "core/settings.h" #include "citra/emu_window/emu_window_sdl2.h" @@ -40,9 +40,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { if (state == SDL_PRESSED) { - KeyMap::PressKey(*this, { key, keyboard_id }); + KeyMap::PressKey(*this, {key, keyboard_id}); } else if (state == SDL_RELEASED) { - KeyMap::ReleaseKey(*this, { key, keyboard_id }); + KeyMap::ReleaseKey(*this, {key, keyboard_id}); } } @@ -55,7 +55,8 @@ void EmuWindow_SDL2::OnResize() { SDL_GetWindowSize(render_window, &width, &height); - NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); + NotifyFramebufferLayoutChanged( + EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); } EmuWindow_SDL2::EmuWindow_SDL2() { @@ -80,12 +81,13 @@ EmuWindow_SDL2::EmuWindow_SDL2() { SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); - std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); - render_window = SDL_CreateWindow(window_title.c_str(), + std::string window_title = + Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); + render_window = SDL_CreateWindow( + window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, // x position SDL_WINDOWPOS_UNDEFINED, // y position - VideoCore::kScreenTopWidth, - VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, + VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); if (render_window == nullptr) { @@ -171,10 +173,13 @@ void EmuWindow_SDL2::DoneCurrent() { void EmuWindow_SDL2::ReloadSetKeymaps() { KeyMap::ClearKeyMapping(keyboard_id); for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { - KeyMap::SetKeyMapping({ Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id }, KeyMap::mapping_targets[i]); + KeyMap::SetKeyMapping( + {Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, + KeyMap::mapping_targets[i]); } } -void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { +void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest( + const std::pair& minimal_size) { SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); } diff --git a/src/citra/emu_window/emu_window_sdl2.h b/src/citra/emu_window/emu_window_sdl2.h index 77279f022..693dfb14b 100644 --- a/src/citra/emu_window/emu_window_sdl2.h +++ b/src/citra/emu_window/emu_window_sdl2.h @@ -47,7 +47,8 @@ private: void OnResize(); /// Called when a configuration change affects the minimal size of the window - void OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) override; + void + OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) override; /// Is the window still open? bool is_open = true; @@ -55,7 +56,7 @@ private: /// Internal SDL2 render window SDL_Window* render_window; - using SDL_GLContext = void *; + using SDL_GLContext = void*; /// The OpenGL context associated with the window SDL_GLContext gl_context; diff --git a/src/citra/resource.h b/src/citra/resource.h index 127896424..df8e459e4 100644 --- a/src/citra/resource.h +++ b/src/citra/resource.h @@ -2,15 +2,15 @@ // Microsoft Visual C++ generated include file. // Used by pcafe.rc // -#define IDI_ICON3 103 +#define IDI_ICON3 103 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 105 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3