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 = {
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{{
@ -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));

View File

@ -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;
}

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
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
@ -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);
@ -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,

View File

@ -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

View File

@ -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;

View File

@ -517,7 +517,7 @@ private:
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;
@ -527,7 +527,7 @@ private:
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;

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);
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);

View File

@ -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);
}