diff options
Diffstat (limited to 'src')
5 files changed, 39 insertions, 65 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index 53aafa08c..06e59d1ac 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts | |||
| @@ -188,8 +188,15 @@ tasks.create<Delete>("ktlintReset") { | |||
| 188 | delete(File(buildDir.path + File.separator + "intermediates/ktLint")) | 188 | delete(File(buildDir.path + File.separator + "intermediates/ktLint")) |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | val showFormatHelp = { | ||
| 192 | logger.lifecycle( | ||
| 193 | "If this check fails, please try running \"gradlew ktlintFormat\" for automatic " + | ||
| 194 | "codestyle fixes" | ||
| 195 | ) | ||
| 196 | } | ||
| 197 | tasks.getByPath("ktlintKotlinScriptCheck").doFirst { showFormatHelp.invoke() } | ||
| 198 | tasks.getByPath("ktlintMainSourceSetCheck").doFirst { showFormatHelp.invoke() } | ||
| 191 | tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset") | 199 | tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset") |
| 192 | tasks.getByPath("preBuild").dependsOn("ktlintCheck") | ||
| 193 | 200 | ||
| 194 | ktlint { | 201 | ktlint { |
| 195 | version.set("0.47.1") | 202 | version.set("0.47.1") |
| @@ -228,71 +235,33 @@ dependencies { | |||
| 228 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") | 235 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") |
| 229 | } | 236 | } |
| 230 | 237 | ||
| 231 | fun getGitVersion(): String { | 238 | fun runGitCommand(command: List<String>): String { |
| 232 | var versionName = "0.0" | 239 | return try { |
| 233 | 240 | ProcessBuilder(command) | |
| 234 | try { | ||
| 235 | versionName = ProcessBuilder("git", "describe", "--always", "--long") | ||
| 236 | .directory(project.rootDir) | 241 | .directory(project.rootDir) |
| 237 | .redirectOutput(ProcessBuilder.Redirect.PIPE) | 242 | .redirectOutput(ProcessBuilder.Redirect.PIPE) |
| 238 | .redirectError(ProcessBuilder.Redirect.PIPE) | 243 | .redirectError(ProcessBuilder.Redirect.PIPE) |
| 239 | .start().inputStream.bufferedReader().use { it.readText() } | 244 | .start().inputStream.bufferedReader().use { it.readText() } |
| 240 | .trim() | 245 | .trim() |
| 241 | .replace(Regex("(-0)?-[^-]+$"), "") | ||
| 242 | } catch (e: Exception) { | 246 | } catch (e: Exception) { |
| 243 | logger.error("Cannot find git, defaulting to dummy version number") | 247 | logger.error("Cannot find git") |
| 248 | "" | ||
| 244 | } | 249 | } |
| 245 | |||
| 246 | if (System.getenv("GITHUB_ACTIONS") != null) { | ||
| 247 | val gitTag = System.getenv("GIT_TAG_NAME") | ||
| 248 | versionName = gitTag ?: versionName | ||
| 249 | } | ||
| 250 | |||
| 251 | return versionName | ||
| 252 | } | 250 | } |
| 253 | 251 | ||
| 254 | fun getGitHash(): String { | 252 | fun getGitVersion(): String { |
| 255 | try { | 253 | val versionName = if (System.getenv("GITHUB_ACTIONS") != null) { |
| 256 | val processBuilder = ProcessBuilder("git", "rev-parse", "--short", "HEAD") | 254 | val gitTag = System.getenv("GIT_TAG_NAME") ?: "" |
| 257 | processBuilder.directory(project.rootDir) | 255 | gitTag |
| 258 | val process = processBuilder.start() | 256 | } else { |
| 259 | val inputStream = process.inputStream | 257 | runGitCommand(listOf("git", "describe", "--always", "--long")) |
| 260 | val errorStream = process.errorStream | 258 | .replace(Regex("(-0)?-[^-]+$"), "") |
| 261 | process.waitFor() | ||
| 262 | |||
| 263 | return if (process.exitValue() == 0) { | ||
| 264 | inputStream.bufferedReader() | ||
| 265 | .use { it.readText().trim() } // return the value of gitHash | ||
| 266 | } else { | ||
| 267 | val errorMessage = errorStream.bufferedReader().use { it.readText().trim() } | ||
| 268 | logger.error("Error running git command: $errorMessage") | ||
| 269 | "dummy-hash" // return a dummy hash value in case of an error | ||
| 270 | } | ||
| 271 | } catch (e: Exception) { | ||
| 272 | logger.error("$e: Cannot find git, defaulting to dummy build hash") | ||
| 273 | return "dummy-hash" // return a dummy hash value in case of an error | ||
| 274 | } | 259 | } |
| 260 | return versionName.ifEmpty { "0.0" } | ||
| 275 | } | 261 | } |
| 276 | 262 | ||
| 277 | fun getBranch(): String { | 263 | fun getGitHash(): String = |
| 278 | try { | 264 | runGitCommand(listOf("git", "rev-parse", "--short", "HEAD")).ifEmpty { "dummy-hash" } |
| 279 | val processBuilder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD") | 265 | |
| 280 | processBuilder.directory(project.rootDir) | 266 | fun getBranch(): String = |
| 281 | val process = processBuilder.start() | 267 | runGitCommand(listOf("git", "rev-parse", "--abbrev-ref", "HEAD")).ifEmpty { "dummy-hash" } |
| 282 | val inputStream = process.inputStream | ||
| 283 | val errorStream = process.errorStream | ||
| 284 | process.waitFor() | ||
| 285 | |||
| 286 | return if (process.exitValue() == 0) { | ||
| 287 | inputStream.bufferedReader() | ||
| 288 | .use { it.readText().trim() } // return the value of gitHash | ||
| 289 | } else { | ||
| 290 | val errorMessage = errorStream.bufferedReader().use { it.readText().trim() } | ||
| 291 | logger.error("Error running git command: $errorMessage") | ||
| 292 | "dummy-hash" // return a dummy hash value in case of an error | ||
| 293 | } | ||
| 294 | } catch (e: Exception) { | ||
| 295 | logger.error("$e: Cannot find git, defaulting to dummy build hash") | ||
| 296 | return "dummy-hash" // return a dummy hash value in case of an error | ||
| 297 | } | ||
| 298 | } | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt index a1620fbb7..5b5f800c1 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt | |||
| @@ -76,8 +76,8 @@ class AboutFragment : Fragment() { | |||
| 76 | binding.root.findNavController().navigate(R.id.action_aboutFragment_to_licensesFragment) | 76 | binding.root.findNavController().navigate(R.id.action_aboutFragment_to_licensesFragment) |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | binding.textBuildHash.text = BuildConfig.GIT_HASH | 79 | binding.textVersionName.text = BuildConfig.VERSION_NAME |
| 80 | binding.buttonBuildHash.setOnClickListener { | 80 | binding.textVersionName.setOnClickListener { |
| 81 | val clipBoard = | 81 | val clipBoard = |
| 82 | requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager | 82 | requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager |
| 83 | val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH) | 83 | val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH) |
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml index a26ffbc73..655e49219 100644 --- a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml +++ b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml | |||
| @@ -147,7 +147,7 @@ | |||
| 147 | android:layout_marginHorizontal="20dp" /> | 147 | android:layout_marginHorizontal="20dp" /> |
| 148 | 148 | ||
| 149 | <LinearLayout | 149 | <LinearLayout |
| 150 | android:id="@+id/button_build_hash" | 150 | android:id="@+id/button_version_name" |
| 151 | android:layout_width="match_parent" | 151 | android:layout_width="match_parent" |
| 152 | android:layout_height="wrap_content" | 152 | android:layout_height="wrap_content" |
| 153 | android:background="?attr/selectableItemBackground" | 153 | android:background="?attr/selectableItemBackground" |
| @@ -164,7 +164,7 @@ | |||
| 164 | android:textAlignment="viewStart" /> | 164 | android:textAlignment="viewStart" /> |
| 165 | 165 | ||
| 166 | <com.google.android.material.textview.MaterialTextView | 166 | <com.google.android.material.textview.MaterialTextView |
| 167 | android:id="@+id/text_build_hash" | 167 | android:id="@+id/text_version_name" |
| 168 | style="@style/TextAppearance.Material3.BodyMedium" | 168 | style="@style/TextAppearance.Material3.BodyMedium" |
| 169 | android:layout_width="match_parent" | 169 | android:layout_width="match_parent" |
| 170 | android:layout_height="wrap_content" | 170 | android:layout_height="wrap_content" |
diff --git a/src/android/app/src/main/res/layout/fragment_about.xml b/src/android/app/src/main/res/layout/fragment_about.xml index a24f5230e..38090fa50 100644 --- a/src/android/app/src/main/res/layout/fragment_about.xml +++ b/src/android/app/src/main/res/layout/fragment_about.xml | |||
| @@ -148,7 +148,7 @@ | |||
| 148 | android:layout_marginHorizontal="20dp" /> | 148 | android:layout_marginHorizontal="20dp" /> |
| 149 | 149 | ||
| 150 | <LinearLayout | 150 | <LinearLayout |
| 151 | android:id="@+id/button_build_hash" | 151 | android:id="@+id/button_version_name" |
| 152 | android:layout_width="match_parent" | 152 | android:layout_width="match_parent" |
| 153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 154 | android:paddingVertical="16dp" | 154 | android:paddingVertical="16dp" |
| @@ -165,7 +165,7 @@ | |||
| 165 | android:text="@string/build" /> | 165 | android:text="@string/build" /> |
| 166 | 166 | ||
| 167 | <com.google.android.material.textview.MaterialTextView | 167 | <com.google.android.material.textview.MaterialTextView |
| 168 | android:id="@+id/text_build_hash" | 168 | android:id="@+id/text_version_name" |
| 169 | style="@style/TextAppearance.Material3.BodyMedium" | 169 | style="@style/TextAppearance.Material3.BodyMedium" |
| 170 | android:layout_width="match_parent" | 170 | android:layout_width="match_parent" |
| 171 | android:layout_height="wrap_content" | 171 | android:layout_height="wrap_content" |
diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp index 15edb23e0..8ef49387d 100644 --- a/src/core/hle/service/server_manager.cpp +++ b/src/core/hle/service/server_manager.cpp | |||
| @@ -256,8 +256,13 @@ Result ServerManager::WaitAndProcessImpl() { | |||
| 256 | 256 | ||
| 257 | // Wait for a signal. | 257 | // Wait for a signal. |
| 258 | s32 out_index{-1}; | 258 | s32 out_index{-1}; |
| 259 | R_TRY(Kernel::KSynchronizationObject::Wait(m_system.Kernel(), &out_index, wait_objs.data(), | 259 | R_TRY_CATCH(Kernel::KSynchronizationObject::Wait(m_system.Kernel(), &out_index, |
| 260 | num_objs, -1)); | 260 | wait_objs.data(), num_objs, -1)) { |
| 261 | R_CATCH(Kernel::ResultSessionClosed) { | ||
| 262 | // On session closed, index is updated and we don't want to return an error. | ||
| 263 | } | ||
| 264 | } | ||
| 265 | R_END_TRY_CATCH; | ||
| 261 | ASSERT(out_index >= 0 && out_index < num_objs); | 266 | ASSERT(out_index >= 0 && out_index < num_objs); |
| 262 | 267 | ||
| 263 | // Set the output index. | 268 | // Set the output index. |