Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
SachinVin authored and xperia64 committed Jan 10, 2021
1 parent 52718e0 commit 23f6af3
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 48 deletions.
15 changes: 9 additions & 6 deletions src/android/app/src/main/jni/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
}

static const std::array<int, Settings::NativeButton::NumButtons> default_buttons = {
InputManager::N3DS_BUTTON_A, InputManager::N3DS_BUTTON_B, InputManager::N3DS_BUTTON_X,
InputManager::N3DS_BUTTON_Y, InputManager::N3DS_DPAD_UP, InputManager::N3DS_DPAD_DOWN,
InputManager::N3DS_DPAD_LEFT, InputManager::N3DS_DPAD_RIGHT, InputManager::N3DS_TRIGGER_L,
InputManager::N3DS_TRIGGER_R, InputManager::N3DS_BUTTON_START, InputManager::N3DS_BUTTON_SELECT,
InputManager::N3DS_BUTTON_A, InputManager::N3DS_BUTTON_B,
InputManager::N3DS_BUTTON_X, InputManager::N3DS_BUTTON_Y,
InputManager::N3DS_DPAD_UP, InputManager::N3DS_DPAD_DOWN,
InputManager::N3DS_DPAD_LEFT, InputManager::N3DS_DPAD_RIGHT,
InputManager::N3DS_TRIGGER_L, InputManager::N3DS_TRIGGER_R,
InputManager::N3DS_BUTTON_START, InputManager::N3DS_BUTTON_SELECT,
InputManager::N3DS_BUTTON_DEBUG, InputManager::N3DS_BUTTON_GPIO14,
InputManager::N3DS_BUTTON_ZL, InputManager::N3DS_BUTTON_ZR, InputManager::N3DS_BUTTON_HOME,
InputManager::N3DS_BUTTON_ZL, InputManager::N3DS_BUTTON_ZR,
InputManager::N3DS_BUTTON_HOME,
};

static const std::array<int, Settings::NativeAnalog::NumAnalogs> default_analogs{{
Expand Down Expand Up @@ -116,7 +119,7 @@ void Config::ReadValues() {
Settings::values.shaders_accurate_mul =
sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", false);
Settings::values.use_asynchronous_gpu_emulation =
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", true);
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", true);
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
Settings::values.resolution_factor =
static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1));
Expand Down
3 changes: 2 additions & 1 deletion src/android/app/src/main/jni/game_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ std::u16string GetTitle(std::string physical_name) {
memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH));

// Get the title from SMDH in UTF-16 format
std::u16string title{reinterpret_cast<char16_t*>(smdh.titles[static_cast<int>(language)].long_title.data())};
std::u16string title{
reinterpret_cast<char16_t*>(smdh.titles[static_cast<int>(language)].long_title.data())};

return title;
}
Expand Down
29 changes: 17 additions & 12 deletions src/android/app/src/main/jni/native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,17 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {

// Audio stretching on Android is only useful with lower framerates, disable it when fullspeed
Core::TimingEventType* audio_stretching_event{};
const s64 audio_stretching_ticks {msToCycles(500)};
audio_stretching_event = system.CoreTiming().RegisterEvent(
"AudioStretchingEvent", [&](u64, s64 cycles_late) {
if (Settings::values.enable_audio_stretching) {
Core::DSP().EnableStretching(Core::System::GetInstance().GetAndResetPerfStats().emulation_speed < 0.95);
}
const s64 audio_stretching_ticks{msToCycles(500)};
audio_stretching_event =
system.CoreTiming().RegisterEvent("AudioStretchingEvent", [&](u64, s64 cycles_late) {
if (Settings::values.enable_audio_stretching) {
Core::DSP().EnableStretching(
Core::System::GetInstance().GetAndResetPerfStats().emulation_speed < 0.95);
}

system.CoreTiming().ScheduleEvent(audio_stretching_ticks - cycles_late, audio_stretching_event);
});
system.CoreTiming().ScheduleEvent(audio_stretching_ticks - cycles_late,
audio_stretching_event);
});
system.CoreTiming().ScheduleEvent(audio_stretching_ticks, audio_stretching_event);

// Start running emulation
Expand Down Expand Up @@ -339,7 +341,8 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadMoveEvent(JNIEnv* env,
x = std::clamp(x, -1.f, 1.f);
y = std::clamp(-y, -1.f, 1.f);

// Clamp the input to a circle (while touch input is already clamped in the frontend, gamepad is unknown)
// Clamp the input to a circle (while touch input is already clamped in the frontend, gamepad is
// unknown)
float r = x * x + y * y;
if (r > 1.0f) {
r = std::sqrt(r);
Expand All @@ -358,9 +361,11 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadAxisEvent(JNIEnv* env,
}

jboolean Java_org_citra_citra_1emu_NativeLibrary_onTouchEvent(JNIEnv* env,
[[maybe_unused]] jclass clazz, jfloat x,
jfloat y, jboolean pressed) {
return static_cast<jboolean>(window->OnTouchEvent(static_cast<int>(x + 0.5), static_cast<int>(y + 0.5), pressed));
[[maybe_unused]] jclass clazz,
jfloat x, jfloat y,
jboolean pressed) {
return static_cast<jboolean>(
window->OnTouchEvent(static_cast<int>(x + 0.5), static_cast<int>(y + 0.5), pressed));
}

void Java_org_citra_citra_1emu_NativeLibrary_onTouchMoved(JNIEnv* env,
Expand Down
40 changes: 20 additions & 20 deletions src/common/logging/text_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,26 @@ void PrintMessageToLogcat(const Entry& entry) {

android_LogPriority android_log_priority;
switch (entry.log_level) {
case Level::Trace:
android_log_priority = ANDROID_LOG_VERBOSE;
break;
case Level::Debug:
android_log_priority = ANDROID_LOG_DEBUG;
break;
case Level::Info:
android_log_priority = ANDROID_LOG_INFO;
break;
case Level::Warning:
android_log_priority = ANDROID_LOG_WARN;
break;
case Level::Error:
android_log_priority = ANDROID_LOG_ERROR;
break;
case Level::Critical:
android_log_priority = ANDROID_LOG_FATAL;
break;
case Level::Count:
UNREACHABLE();
case Level::Trace:
android_log_priority = ANDROID_LOG_VERBOSE;
break;
case Level::Debug:
android_log_priority = ANDROID_LOG_DEBUG;
break;
case Level::Info:
android_log_priority = ANDROID_LOG_INFO;
break;
case Level::Warning:
android_log_priority = ANDROID_LOG_WARN;
break;
case Level::Error:
android_log_priority = ANDROID_LOG_ERROR;
break;
case Level::Critical:
android_log_priority = ANDROID_LOG_FATAL;
break;
case Level::Count:
UNREACHABLE();
}
__android_log_print(android_log_priority, "CitraNative", "%s", str.c_str());
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/video_core/renderer_opengl/gl_rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2038,8 +2038,8 @@ void RasterizerOpenGL::SyncShadowTextureBias() {
}

void RasterizerOpenGL::SyncAndUploadLUTsLF() {
constexpr std::size_t max_size = sizeof(GLvec2) * 256 * Pica::LightingRegs::NumLightingSampler +
sizeof(GLvec2) * 128; // fog
constexpr std::size_t max_size =
sizeof(GLvec2) * 256 * Pica::LightingRegs::NumLightingSampler + sizeof(GLvec2) * 128; // fog

if (!uniform_block_data.lighting_lut_dirty_any && !uniform_block_data.fog_lut_dirty) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static constexpr std::array<void (*)(u32, u32, u8*, PAddr, PAddr, PAddr), 18> gl

// Allocate an uninitialized texture of appropriate size and format for the surface
void AllocateSurfaceTexture(GLuint texture, const FormatTuple& format_tuple, u32 width,
u32 height) {
u32 height) {
OpenGLState cur_state = OpenGLState::GetCurState();

// Keep track of previous texture bindings
Expand Down
4 changes: 2 additions & 2 deletions src/video_core/renderer_opengl/gl_shader_decompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class GLSLGenerator {
if (!sanitize_mul) {
// When accurate multiplication is OFF, NaN are not really handled. This is a
// workaround to cheaply avoid NaN. Fixes graphical issues in Ocarina of Time.
shader.AddLine("if (" + src1 + ".x != 0.0)");
shader.AddLine("if ({}.x != 0.0)", src1);
}
SetDest(swizzle, dest_reg, fmt::format("(1.0 / {}.x)", src1), 4, 1);
break;
Expand All @@ -527,7 +527,7 @@ class GLSLGenerator {
if (!sanitize_mul) {
// When accurate multiplication is OFF, NaN are not really handled. This is a
// workaround to cheaply avoid NaN. Fixes graphical issues in Ocarina of Time.
shader.AddLine("if (" + src1 + ".x > 0.0)");
shader.AddLine("if ({}.x > 0.0)", src1);
}
SetDest(swizzle, dest_reg, fmt::format("inversesqrt({}.x)", src1), 4, 1);
break;
Expand Down
4 changes: 3 additions & 1 deletion src/video_core/renderer_opengl/gl_shader_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ static void WriteTevStage(std::string& out, const PicaFSConfig& config, unsigned
AppendColorModifier(out, config, stage.color_modifier2, stage.color_source2, index_name);
out += fmt::format(";\nvec3 color_results_{}_3 = ", index_name);
AppendColorModifier(out, config, stage.color_modifier3, stage.color_source3, index_name);
out += fmt::format(";\nvec3 color_results_{}[3] = vec3[3](color_results_{}_1, color_results_{}_2, color_results_{}_3);\n", index_name, index_name, index_name, index_name);
out += fmt::format(";\nvec3 color_results_{}[3] = vec3[3](color_results_{}_1, "
"color_results_{}_2, color_results_{}_3);\n",
index_name, index_name, index_name, index_name);

// Round the output of each TEV stage to maintain the PICA's 8 bits of precision
out += fmt::format("vec3 color_output_{} = byteround(", index_name);
Expand Down
7 changes: 4 additions & 3 deletions src/video_core/renderer_opengl/texture_downloader_es.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ TextureDownloaderES::TextureDownloaderES(bool enable_depth_stencil) {
converter.lod_location = glGetUniformLocation(converter.program.handle, "lod");
};

// xperia64: The depth stencil shader currently uses a GLES extension that is not supported across all devices
// Reportedly broken on Tegra devices and the Nexus 6P, so enabling it can be toggled
if(enable_depth_stencil) {
// xperia64: The depth stencil shader currently uses a GLES extension that is not supported
// across all devices Reportedly broken on Tegra devices and the Nexus 6P, so enabling it can be
// toggled
if (enable_depth_stencil) {
init_program(d24s8_r32ui_conversion_shader, ds_to_color_frag);
}

Expand Down

0 comments on commit 23f6af3

Please sign in to comment.