From 72e2f7130e9cdd7983ab650241845ce333a844a3 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Fri, 17 Jan 2025 19:28:11 +1000 Subject: [PATCH] shader_recompiler: Add stubs for CSM/FCSM flow test conditions Add stub implementations for previously unhandled flow test conditions in the shader recompiler's IR emitter. These conditions were previously throwing "Not Implemented" exceptions when encountered. The following flow test cases are now stubbed: - FCSM_TR (Fragment Shader Coarse/Fine Mode Test and Reject) - CSM_TA (Coarse/Fine Mode Test Accept) - CSM_TR (Coarse/Fine Mode Test and Reject) - CSM_MX (Coarse/Fine Mode Maximum) - FCSM_TA (Fragment Shader Coarse/Fine Mode Test Accept) - FCSM_MX (Fragment Shader Coarse/Fine Mode Maximum) Currently these stubs: 1. Return false (ir.Imm1(false)) as a placeholder value 2. Log a warning message indicating the stub 3. Allow shaders using these conditions to compile rather than fail This is a step toward proper implementation of coarse/fine mode shader operations. The stubs prevent crashes while making it clear which code paths need full implementation. Technical notes: - Removed the previous FCSM_TR implementation that used flag operations - Added consistent warning messages for tracking stub usage - Kept within the existing GetFlowTest switch statement structure --- dist/languages/ar.ts | 4 +- dist/languages/ca.ts | 4 +- dist/languages/cs.ts | 4 +- dist/languages/da.ts | 4 +- dist/languages/de.ts | 4 +- dist/languages/el.ts | 4 +- dist/languages/es.ts | 4 +- dist/languages/fr.ts | 4 +- dist/languages/hu.ts | 4 +- dist/languages/id.ts | 4 +- dist/languages/it.ts | 4 +- dist/languages/ja_JP.ts | 4 +- dist/languages/ko_KR.ts | 4 +- dist/languages/nb.ts | 4 +- dist/languages/nl.ts | 4 +- dist/languages/pl.ts | 4 +- dist/languages/pt_BR.ts | 4 +- dist/languages/pt_PT.ts | 4 +- dist/languages/ru_RU.ts | 6 +- dist/languages/sv.ts | 4 +- dist/languages/tr_TR.ts | 4 +- dist/languages/uk.ts | 4 +- dist/languages/vi.ts | 4 +- dist/languages/vi_VN.ts | 4 +- dist/languages/zh_CN.ts | 8 +- dist/languages/zh_TW.ts | 6 +- .../yuzu_emu/fragments/EmulationFragment.kt | 111 +++++++++--------- .../frontend/ir/ir_emitter.cpp | 10 ++ src/yuzu/configuration/shared_translation.cpp | 2 +- src/yuzu/main.cpp | 2 +- 30 files changed, 126 insertions(+), 111 deletions(-) diff --git a/dist/languages/ar.ts b/dist/languages/ar.ts index a2eeec0c3f..6731392464 100644 --- a/dist/languages/ar.ts +++ b/dist/languages/ar.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6076,7 +6076,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet Mii تحرير التطبيق الصغير diff --git a/dist/languages/ca.ts b/dist/languages/ca.ts index 439611b83c..1fd093c562 100644 --- a/dist/languages/ca.ts +++ b/dist/languages/ca.ts @@ -407,7 +407,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6113,7 +6113,7 @@ Si us plau, utilitzi aquesta funció només per a instal·lar actualitzacions i - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/cs.ts b/dist/languages/cs.ts index 40859a8e03..470d83a008 100644 --- a/dist/languages/cs.ts +++ b/dist/languages/cs.ts @@ -407,7 +407,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6097,7 +6097,7 @@ Tuto funkci prosím používejte pouze k instalaci aktualizací a DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/da.ts b/dist/languages/da.ts index 6df7d761c8..27109baffb 100644 --- a/dist/languages/da.ts +++ b/dist/languages/da.ts @@ -409,7 +409,7 @@ Dette vil bandlyse både vedkommendes forum-brugernavn og IP-adresse. - Mii Edit + Mii Editor @@ -6103,7 +6103,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/de.ts b/dist/languages/de.ts index 9de3752149..b881023718 100644 --- a/dist/languages/de.ts +++ b/dist/languages/de.ts @@ -408,7 +408,7 @@ Dies würde deren Forum-Benutzernamen und deren IP-Adresse sperren. - Mii Edit + Mii Editor @@ -6123,7 +6123,7 @@ Bitte nutze diese Funktion nur zum Installieren von Updates und DLC. - Mii Edit Applet + Mii Editor Applet Mii-Edit-Applet diff --git a/dist/languages/el.ts b/dist/languages/el.ts index 0c3555193a..f81b7120ff 100644 --- a/dist/languages/el.ts +++ b/dist/languages/el.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6099,7 +6099,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/es.ts b/dist/languages/es.ts index 0210e9daef..42cfcfd206 100644 --- a/dist/languages/es.ts +++ b/dist/languages/es.ts @@ -409,7 +409,7 @@ Esto banearía su nombre del foro y su dirección IP. - Mii Edit + Mii Editor Editor de Mii @@ -6169,7 +6169,7 @@ Por favor, utiliza esta función sólo para instalar actualizaciones y DLCs. - Mii Edit Applet + Mii Editor Applet Applet de Editor de Mii diff --git a/dist/languages/fr.ts b/dist/languages/fr.ts index e12f0ea5a2..daaf0d1991 100644 --- a/dist/languages/fr.ts +++ b/dist/languages/fr.ts @@ -410,7 +410,7 @@ Cela bannirait à la fois son nom d'utilisateur du forum et son adresse IP. - Mii Edit + Mii Editor Édition de Mii @@ -6164,7 +6164,7 @@ Veuillez n'utiliser cette fonctionnalité que pour installer des mises à j - Mii Edit Applet + Mii Editor Applet Applet de l'éditeur Mii diff --git a/dist/languages/hu.ts b/dist/languages/hu.ts index aae92871e0..9525a65764 100644 --- a/dist/languages/hu.ts +++ b/dist/languages/hu.ts @@ -409,7 +409,7 @@ Ez kitiltaná a fórum felhasználóneve és az IP címe alapján. - Mii Edit + Mii Editor Mii szerkesztés @@ -6138,7 +6138,7 @@ Kérjük, csak frissítések és DLC-k telepítéséhez használd ezt a funkció - Mii Edit Applet + Mii Editor Applet Mii szerkesztő applet diff --git a/dist/languages/id.ts b/dist/languages/id.ts index 011755ae24..1ea131d262 100644 --- a/dist/languages/id.ts +++ b/dist/languages/id.ts @@ -409,7 +409,7 @@ Ini akan melarang nama pengguna forum mereka dan alamat IP mereka. - Mii Edit + Mii Editor Ubah Mii @@ -6156,7 +6156,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/it.ts b/dist/languages/it.ts index 5784edd2ee..fd051674c6 100644 --- a/dist/languages/it.ts +++ b/dist/languages/it.ts @@ -409,7 +409,7 @@ Questo bannerà sia il suo nome utente del forum che il suo indirizzo IP. - Mii Edit + Mii Editor @@ -6132,7 +6132,7 @@ Configurazione > Web. - Mii Edit Applet + Mii Editor Applet Editor dei Mii diff --git a/dist/languages/ja_JP.ts b/dist/languages/ja_JP.ts index 95e07a8e12..40d2475790 100644 --- a/dist/languages/ja_JP.ts +++ b/dist/languages/ja_JP.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6118,7 +6118,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet Mii 編集アプレット diff --git a/dist/languages/ko_KR.ts b/dist/languages/ko_KR.ts index 2d47613e26..68f6c31c28 100644 --- a/dist/languages/ko_KR.ts +++ b/dist/languages/ko_KR.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6117,7 +6117,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/nb.ts b/dist/languages/nb.ts index c15ac26523..c09f5d6e09 100644 --- a/dist/languages/nb.ts +++ b/dist/languages/nb.ts @@ -409,7 +409,7 @@ Dette vil bannlyse både deres forum brukernavn og deres IP adresse. - Mii Edit + Mii Editor @@ -6122,7 +6122,7 @@ Bruk kun denne funksjonen til å installere oppdateringer og DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/nl.ts b/dist/languages/nl.ts index c8f4edd267..cd51cf54d5 100644 --- a/dist/languages/nl.ts +++ b/dist/languages/nl.ts @@ -409,7 +409,7 @@ Dit zou zowel hun forum gebruikersnaam als hun IP-adres verbannen. - Mii Edit + Mii Editor @@ -6110,7 +6110,7 @@ Gebruik deze functie alleen om updates en DLC te installeren. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/pl.ts b/dist/languages/pl.ts index 225fca1b8f..a805d8fba2 100644 --- a/dist/languages/pl.ts +++ b/dist/languages/pl.ts @@ -409,7 +409,7 @@ To zbanuje jego/jej nick na forum, oraz jego/jej adres IP. - Mii Edit + Mii Editor @@ -6113,7 +6113,7 @@ Proszę, używaj tej funkcji tylko do instalowania łatek i DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/pt_BR.ts b/dist/languages/pt_BR.ts index 512fb1740a..e58aa7a488 100644 --- a/dist/languages/pt_BR.ts +++ b/dist/languages/pt_BR.ts @@ -409,7 +409,7 @@ Isto banirá tanto o nome de usuário do fórum como o endereço IP. - Mii Edit + Mii Editor Editar Mii @@ -6173,7 +6173,7 @@ Por favor, use esse recurso apenas para instalar atualizações e DLCs. - Mii Edit Applet + Mii Editor Applet Miniaplicativo Editor de Mii diff --git a/dist/languages/pt_PT.ts b/dist/languages/pt_PT.ts index bb1ede3e95..2b0bac4275 100644 --- a/dist/languages/pt_PT.ts +++ b/dist/languages/pt_PT.ts @@ -409,7 +409,7 @@ Isto banirá tanto o nome de usuário do fórum como o endereço IP. - Mii Edit + Mii Editor Editar Mii @@ -6156,7 +6156,7 @@ Por favor, use esse recurso apenas para instalar atualizações e DLC. - Mii Edit Applet + Mii Editor Applet Applet Editor de Miis diff --git a/dist/languages/ru_RU.ts b/dist/languages/ru_RU.ts index 6ff10d24de..930fc171cc 100644 --- a/dist/languages/ru_RU.ts +++ b/dist/languages/ru_RU.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor Mii редактор @@ -6167,8 +6167,8 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet - Mii Edit Applet + Mii Editor Applet + Mii Editor Applet diff --git a/dist/languages/sv.ts b/dist/languages/sv.ts index c9deade9b2..81b1cf6c47 100644 --- a/dist/languages/sv.ts +++ b/dist/languages/sv.ts @@ -409,7 +409,7 @@ Detta kommer bannlysa både dennes användarnamn på forum samt IP-adress. - Mii Edit + Mii Editor @@ -6092,7 +6092,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/tr_TR.ts b/dist/languages/tr_TR.ts index b3e7eb0cea..48d8922220 100644 --- a/dist/languages/tr_TR.ts +++ b/dist/languages/tr_TR.ts @@ -409,7 +409,7 @@ Bu işlem onların hem forum kullanıcı adını hem de IP adresini banlar. - Mii Edit + Mii Editor @@ -6114,7 +6114,7 @@ Lütfen bu özelliği sadece güncelleme ve DLC yüklemek için kullanın. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/uk.ts b/dist/languages/uk.ts index 082027cd7b..7ca1599b01 100644 --- a/dist/languages/uk.ts +++ b/dist/languages/uk.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6126,7 +6126,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/vi.ts b/dist/languages/vi.ts index 9b5a448a21..6db092c478 100644 --- a/dist/languages/vi.ts +++ b/dist/languages/vi.ts @@ -409,7 +409,7 @@ Việc này sẽ ban tên người dùng trên diễn đàn và IP của họ lu - Mii Edit + Mii Editor @@ -6119,7 +6119,7 @@ Vui lòng, chỉ sử dụng tính năng này để cài đặt các bản cập - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/vi_VN.ts b/dist/languages/vi_VN.ts index 1df3541375..7cec06dca1 100644 --- a/dist/languages/vi_VN.ts +++ b/dist/languages/vi_VN.ts @@ -409,7 +409,7 @@ This would ban both their forum username and their IP address. - Mii Edit + Mii Editor @@ -6119,7 +6119,7 @@ Vui lòng, chỉ sử dụng tính năng này để cài các bản cập nhật - Mii Edit Applet + Mii Editor Applet diff --git a/dist/languages/zh_CN.ts b/dist/languages/zh_CN.ts index 0b82f20b38..7b868eb715 100644 --- a/dist/languages/zh_CN.ts +++ b/dist/languages/zh_CN.ts @@ -409,8 +409,8 @@ This would ban both their forum username and their IP address. - Mii Edit - Mii Edit + Mii Editor + Mii Editor @@ -6167,8 +6167,8 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet - Mii Edit 小程序 + Mii Editor Applet + Mii Editor 小程序 diff --git a/dist/languages/zh_TW.ts b/dist/languages/zh_TW.ts index 41b3e3b39b..b60bba23e4 100644 --- a/dist/languages/zh_TW.ts +++ b/dist/languages/zh_TW.ts @@ -409,8 +409,8 @@ This would ban both their forum username and their IP address. - Mii Edit - Mii Edit + Mii Editor + Mii Editor @@ -6163,7 +6163,7 @@ Please, only use this feature to install updates and DLC. - Mii Edit Applet + Mii Editor Applet Mii 編輯器小程式 diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt index 913b1d826e..e80a089b32 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt @@ -10,6 +10,7 @@ import android.content.DialogInterface import android.content.pm.ActivityInfo import android.content.res.Configuration import android.net.Uri +import android.os.BatteryManager import android.os.Bundle import android.os.Handler import android.os.Looper @@ -521,59 +522,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { if (emulationViewModel.emulationStarted.value && !emulationViewModel.isEmulationStopping.value ) { - val thermalStatus = when (powerManager.currentThermalStatus) { - PowerManager.THERMAL_STATUS_LIGHT -> 0.25f - PowerManager.THERMAL_STATUS_MODERATE -> 0.5f - PowerManager.THERMAL_STATUS_SEVERE -> 0.75f - PowerManager.THERMAL_STATUS_CRITICAL, - PowerManager.THERMAL_STATUS_EMERGENCY, - PowerManager.THERMAL_STATUS_SHUTDOWN -> 1.0f - else -> 0f - } - - // Get temperature from battery thermal sensor - val temperature = try { - val process = Runtime.getRuntime().exec("cat /sys/class/power_supply/battery/temp") - val reader = process.inputStream.bufferedReader() - val temp = reader.readLine().toFloat() / 10f // Convert from decidegrees to degrees - reader.close() - temp - } catch (e: Exception) { - 0f - } - - // Convert to Fahrenheit - val fahrenheit = (temperature * 9f / 5f) + 32f - - if (_binding != null) { - // Color interpolation based on temperature (green at 30°C, red at 45°C) - val normalizedTemp = ((temperature - 30f) / 15f).coerceIn(0f, 1f) - val red = (normalizedTemp * 255).toInt() - val green = ((1f - normalizedTemp) * 255).toInt() - val color = android.graphics.Color.rgb(red, green, 0) - - // Create a modern progress bar using block elements - val progressBarLength = 12 - val filledBars = (thermalStatus * progressBarLength).toInt() - val progressBar = buildString { - append("│") // Left border - repeat(filledBars) { append("█") } - repeat(progressBarLength - filledBars) { append("░") } - append("│") // Right border - - // Add percentage - append(" ") - append(String.format("%3d%%", (thermalStatus * 100).toInt())) - } - - binding.showThermalsText.setTextColor(color) - binding.showThermalsText.text = String.format( - "%s\n%.1f°C • %.1f°F", - progressBar, - temperature, - fahrenheit - ) - } + val temperature = getBatteryTemperature(requireContext()) + updateThermalOverlay(temperature) thermalStatsUpdateHandler.postDelayed(thermalStatsUpdater!!, 1000) } } @@ -585,6 +535,53 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { } } + private fun updateThermalOverlay(temperature: Float) { + if (BooleanSetting.SHOW_THERMAL_OVERLAY.getBoolean() && + emulationViewModel.emulationStarted.value && + !emulationViewModel.isEmulationStopping.value + ) { + // Get thermal status + val thermalStatus = when (powerManager.currentThermalStatus) { + PowerManager.THERMAL_STATUS_LIGHT -> 0.25f + PowerManager.THERMAL_STATUS_MODERATE -> 0.5f + PowerManager.THERMAL_STATUS_SEVERE -> 0.75f + PowerManager.THERMAL_STATUS_CRITICAL, + PowerManager.THERMAL_STATUS_EMERGENCY, + PowerManager.THERMAL_STATUS_SHUTDOWN -> 1.0f + else -> 0f + } + + // Convert to Fahrenheit for additional info + val fahrenheit = (temperature * 9f / 5f) + 32f + + // Create progress bar using block elements + val progressBarLength = 12 + val filledBars = (thermalStatus * progressBarLength).toInt() + val progressBar = buildString { + append("│") // Left border + repeat(filledBars) { append("█") } + repeat(progressBarLength - filledBars) { append("░") } + append("│") // Right border + append(" ") + append(String.format("%3d%%", (thermalStatus * 100).toInt())) + } + + // Color interpolation based on temperature (green at 30°C, red at 45°C) + val normalizedTemp = ((temperature - 30f) / 15f).coerceIn(0f, 1f) + val red = (normalizedTemp * 255).toInt() + val green = ((1f - normalizedTemp) * 255).toInt() + val color = android.graphics.Color.rgb(red, green, 0) + + binding.showThermalsText.setTextColor(color) + binding.showThermalsText.text = String.format( + "%s\n%.1f°C • %.1f°F", + progressBar, + temperature, + fahrenheit + ) + } + } + @SuppressLint("SourceLockedOrientationActivity") private fun updateOrientation() { emulationActivity?.let { @@ -1085,4 +1082,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { private val perfStatsUpdateHandler = Handler(Looper.myLooper()!!) private val thermalStatsUpdateHandler = Handler(Looper.myLooper()!!) } + + private fun getBatteryTemperature(context: Context): Float { + val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager + // Get temperature in tenths of a degree Celsius + val temperature = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_TEMPERATURE) + // Convert to degrees Celsius + return temperature / 10.0f + } } diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index e1e46cb81c..30e3a57b32 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp @@ -264,10 +264,20 @@ static U1 GetFlowTest(IREmitter& ir, FlowTest flow_test) { LOG_WARNING(Shader, "(STUBBED) FCSM_TR"); return ir.Imm1(false); case FlowTest::CSM_TA: + LOG_WARNING(Shader, "(STUBBED) CSM_TA"); + return ir.Imm1(false); case FlowTest::CSM_TR: + LOG_WARNING(Shader, "(STUBBED) CSM_TR"); + return ir.Imm1(false); case FlowTest::CSM_MX: + LOG_WARNING(Shader, "(STUBBED) CSM_MX"); + return ir.Imm1(false); case FlowTest::FCSM_TA: + LOG_WARNING(Shader, "(STUBBED) FCSM_TA"); + return ir.Imm1(false); case FlowTest::FCSM_MX: + LOG_WARNING(Shader, "(STUBBED) FCSM_MX"); + return ir.Imm1(false); default: throw NotImplementedException("Flow test {}", flow_test); } diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index cf1cc9529c..a4fcd818d2 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -34,7 +34,7 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { INSERT(Settings, net_connect_applet_mode, tr("Net connect"), QStringLiteral()); INSERT(Settings, player_select_applet_mode, tr("Player select"), QStringLiteral()); INSERT(Settings, swkbd_applet_mode, tr("Software keyboard"), QStringLiteral()); - INSERT(Settings, mii_edit_applet_mode, tr("Mii Edit"), QStringLiteral()); + INSERT(Settings, mii_edit_applet_mode, tr("Mii Editor"), QStringLiteral()); INSERT(Settings, web_applet_mode, tr("Online web"), QStringLiteral()); INSERT(Settings, shop_applet_mode, tr("Shop"), QStringLiteral()); INSERT(Settings, photo_viewer_applet_mode, tr("Photo viewer"), QStringLiteral()); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2bc6d1b365..415863021d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -4429,7 +4429,7 @@ void GMainWindow::OnMiiEdit() { auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program); if (!mii_applet_nca) { - QMessageBox::warning(this, tr("Mii Edit Applet"), + QMessageBox::warning(this, tr("Mii Editor Applet"), tr("Mii editor is not available. Please reinstall firmware.")); return; }