Run clang-format

This commit is contained in:
SachinVin 2020-06-13 13:11:03 +05:30 committed by xperia64
parent c568db81cf
commit bb355410e6
8 changed files with 59 additions and 47 deletions

View File

@ -51,12 +51,15 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
} }
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons = { 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_A, InputManager::N3DS_BUTTON_B,
InputManager::N3DS_BUTTON_Y, InputManager::N3DS_DPAD_UP, InputManager::N3DS_DPAD_DOWN, InputManager::N3DS_BUTTON_X, InputManager::N3DS_BUTTON_Y,
InputManager::N3DS_DPAD_LEFT, InputManager::N3DS_DPAD_RIGHT, InputManager::N3DS_TRIGGER_L, InputManager::N3DS_DPAD_UP, InputManager::N3DS_DPAD_DOWN,
InputManager::N3DS_TRIGGER_R, InputManager::N3DS_BUTTON_START, InputManager::N3DS_BUTTON_SELECT, 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_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{{ static const std::array<int, Settings::NativeAnalog::NumAnalogs> default_analogs{{
@ -116,7 +119,7 @@ void Config::ReadValues() {
Settings::values.shaders_accurate_mul = Settings::values.shaders_accurate_mul =
sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", false); sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", false);
Settings::values.use_asynchronous_gpu_emulation = 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.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
Settings::values.resolution_factor = Settings::values.resolution_factor =
static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1)); static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1));

View File

@ -64,7 +64,8 @@ std::u16string GetTitle(std::string physical_name) {
memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH)); memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH));
// Get the title from SMDH in UTF-16 format // 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; return title;
} }

View File

@ -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 // Audio stretching on Android is only useful with lower framerates, disable it when fullspeed
Core::TimingEventType* audio_stretching_event{}; Core::TimingEventType* audio_stretching_event{};
const s64 audio_stretching_ticks {msToCycles(500)}; const s64 audio_stretching_ticks{msToCycles(500)};
audio_stretching_event = system.CoreTiming().RegisterEvent( audio_stretching_event =
"AudioStretchingEvent", [&](u64, s64 cycles_late) { system.CoreTiming().RegisterEvent("AudioStretchingEvent", [&](u64, s64 cycles_late) {
if (Settings::values.enable_audio_stretching) { if (Settings::values.enable_audio_stretching) {
Core::DSP().EnableStretching(Core::System::GetInstance().GetAndResetPerfStats().emulation_speed < 0.95); 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); system.CoreTiming().ScheduleEvent(audio_stretching_ticks, audio_stretching_event);
// Start running emulation // Start running emulation
@ -339,7 +341,8 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadMoveEvent(JNIEnv* env,
x = std::clamp(x, -1.f, 1.f); x = std::clamp(x, -1.f, 1.f);
y = std::clamp(-y, -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; float r = x * x + y * y;
if (r > 1.0f) { if (r > 1.0f) {
r = std::sqrt(r); r = std::sqrt(r);
@ -358,9 +361,11 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadAxisEvent(JNIEnv* env,
} }
jboolean Java_org_citra_citra_1emu_NativeLibrary_onTouchEvent(JNIEnv* env, jboolean Java_org_citra_citra_1emu_NativeLibrary_onTouchEvent(JNIEnv* env,
[[maybe_unused]] jclass clazz, jfloat x, [[maybe_unused]] jclass clazz,
jfloat y, jboolean pressed) { jfloat x, jfloat y,
return static_cast<jboolean>(window->OnTouchEvent(static_cast<int>(x + 0.5), static_cast<int>(y + 0.5), pressed)); 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, void Java_org_citra_citra_1emu_NativeLibrary_onTouchMoved(JNIEnv* env,

View File

@ -117,26 +117,26 @@ void PrintMessageToLogcat(const Entry& entry) {
android_LogPriority android_log_priority; android_LogPriority android_log_priority;
switch (entry.log_level) { switch (entry.log_level) {
case Level::Trace: case Level::Trace:
android_log_priority = ANDROID_LOG_VERBOSE; android_log_priority = ANDROID_LOG_VERBOSE;
break; break;
case Level::Debug: case Level::Debug:
android_log_priority = ANDROID_LOG_DEBUG; android_log_priority = ANDROID_LOG_DEBUG;
break; break;
case Level::Info: case Level::Info:
android_log_priority = ANDROID_LOG_INFO; android_log_priority = ANDROID_LOG_INFO;
break; break;
case Level::Warning: case Level::Warning:
android_log_priority = ANDROID_LOG_WARN; android_log_priority = ANDROID_LOG_WARN;
break; break;
case Level::Error: case Level::Error:
android_log_priority = ANDROID_LOG_ERROR; android_log_priority = ANDROID_LOG_ERROR;
break; break;
case Level::Critical: case Level::Critical:
android_log_priority = ANDROID_LOG_FATAL; android_log_priority = ANDROID_LOG_FATAL;
break; break;
case Level::Count: case Level::Count:
UNREACHABLE(); UNREACHABLE();
} }
__android_log_print(android_log_priority, "CitraNative", "%s", str.c_str()); __android_log_print(android_log_priority, "CitraNative", "%s", str.c_str());
#endif #endif

View File

@ -2038,8 +2038,8 @@ void RasterizerOpenGL::SyncShadowTextureBias() {
} }
void RasterizerOpenGL::SyncAndUploadLUTsLF() { void RasterizerOpenGL::SyncAndUploadLUTsLF() {
constexpr std::size_t max_size = sizeof(GLvec2) * 256 * Pica::LightingRegs::NumLightingSampler + constexpr std::size_t max_size =
sizeof(GLvec2) * 128; // fog sizeof(GLvec2) * 256 * Pica::LightingRegs::NumLightingSampler + sizeof(GLvec2) * 128; // fog
if (!uniform_block_data.lighting_lut_dirty_any && !uniform_block_data.fog_lut_dirty) { if (!uniform_block_data.lighting_lut_dirty_any && !uniform_block_data.fog_lut_dirty) {
return; return;

View File

@ -517,7 +517,7 @@ private:
if (!sanitize_mul) { if (!sanitize_mul) {
// When accurate multiplication is OFF, NaN are not really handled. This is a // 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. // 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); SetDest(swizzle, dest_reg, fmt::format("(1.0 / {}.x)", src1), 4, 1);
break; break;
@ -527,7 +527,7 @@ private:
if (!sanitize_mul) { if (!sanitize_mul) {
// When accurate multiplication is OFF, NaN are not really handled. This is a // 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. // 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); SetDest(swizzle, dest_reg, fmt::format("inversesqrt({}.x)", src1), 4, 1);
break; break;

View File

@ -624,7 +624,9 @@ static void WriteTevStage(std::string& out, const PicaFSConfig& config, unsigned
AppendColorModifier(out, config, stage.color_modifier2, stage.color_source2, index_name); AppendColorModifier(out, config, stage.color_modifier2, stage.color_source2, index_name);
out += fmt::format(";\nvec3 color_results_{}_3 = ", index_name); out += fmt::format(";\nvec3 color_results_{}_3 = ", index_name);
AppendColorModifier(out, config, stage.color_modifier3, stage.color_source3, 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 // 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); out += fmt::format("vec3 color_output_{} = byteround(", index_name);

View File

@ -102,9 +102,10 @@ TextureDownloaderES::TextureDownloaderES(bool enable_depth_stencil) {
converter.lod_location = glGetUniformLocation(converter.program.handle, "lod"); 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 // xperia64: The depth stencil shader currently uses a GLES extension that is not supported
// Reportedly broken on Tegra devices and the Nexus 6P, so enabling it can be toggled // across all devices Reportedly broken on Tegra devices and the Nexus 6P, so enabling it can be
if(enable_depth_stencil) { // toggled
if (enable_depth_stencil) {
init_program(d24s8_r32ui_conversion_shader, ds_to_color_frag); init_program(d24s8_r32ui_conversion_shader, ds_to_color_frag);
} }