summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt2
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt26
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt3
-rw-r--r--src/android/app/src/main/jni/native.cpp9
4 files changed, 30 insertions, 10 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
index f37875ffe..da98d4ef5 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
@@ -47,6 +47,7 @@ import org.yuzu.yuzu_emu.model.EmulationViewModel
47import org.yuzu.yuzu_emu.model.Game 47import org.yuzu.yuzu_emu.model.Game
48import org.yuzu.yuzu_emu.utils.ForegroundService 48import org.yuzu.yuzu_emu.utils.ForegroundService
49import org.yuzu.yuzu_emu.utils.InputHandler 49import org.yuzu.yuzu_emu.utils.InputHandler
50import org.yuzu.yuzu_emu.utils.Log
50import org.yuzu.yuzu_emu.utils.MemoryUtil 51import org.yuzu.yuzu_emu.utils.MemoryUtil
51import org.yuzu.yuzu_emu.utils.NfcReader 52import org.yuzu.yuzu_emu.utils.NfcReader
52import org.yuzu.yuzu_emu.utils.ThemeHelper 53import org.yuzu.yuzu_emu.utils.ThemeHelper
@@ -80,6 +81,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
80 } 81 }
81 82
82 override fun onCreate(savedInstanceState: Bundle?) { 83 override fun onCreate(savedInstanceState: Bundle?) {
84 Log.gameLaunched = true
83 ThemeHelper.setTheme(this) 85 ThemeHelper.setTheme(this)
84 86
85 super.onCreate(savedInstanceState) 87 super.onCreate(savedInstanceState)
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
index 6e19fc6c0..8ed4b482e 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
@@ -42,6 +42,7 @@ import org.yuzu.yuzu_emu.model.HomeViewModel
42import org.yuzu.yuzu_emu.ui.main.MainActivity 42import org.yuzu.yuzu_emu.ui.main.MainActivity
43import org.yuzu.yuzu_emu.utils.FileUtil 43import org.yuzu.yuzu_emu.utils.FileUtil
44import org.yuzu.yuzu_emu.utils.GpuDriverHelper 44import org.yuzu.yuzu_emu.utils.GpuDriverHelper
45import org.yuzu.yuzu_emu.utils.Log
45 46
46class HomeSettingsFragment : Fragment() { 47class HomeSettingsFragment : Fragment() {
47 private var _binding: FragmentHomeSettingsBinding? = null 48 private var _binding: FragmentHomeSettingsBinding? = null
@@ -312,19 +313,32 @@ class HomeSettingsFragment : Fragment() {
312 } 313 }
313 } 314 }
314 315
316 // Share the current log if we just returned from a game but share the old log
317 // if we just started the app and the old log exists.
315 private fun shareLog() { 318 private fun shareLog() {
316 val file = DocumentFile.fromSingleUri( 319 val currentLog = DocumentFile.fromSingleUri(
317 mainActivity, 320 mainActivity,
318 DocumentsContract.buildDocumentUri( 321 DocumentsContract.buildDocumentUri(
319 DocumentProvider.AUTHORITY, 322 DocumentProvider.AUTHORITY,
320 "${DocumentProvider.ROOT_ID}/log/yuzu_log.txt" 323 "${DocumentProvider.ROOT_ID}/log/yuzu_log.txt"
321 ) 324 )
322 )!! 325 )!!
323 if (file.exists()) { 326 val oldLog = DocumentFile.fromSingleUri(
324 val intent = Intent(Intent.ACTION_SEND) 327 mainActivity,
325 .setDataAndType(file.uri, FileUtil.TEXT_PLAIN) 328 DocumentsContract.buildDocumentUri(
326 .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) 329 DocumentProvider.AUTHORITY,
327 .putExtra(Intent.EXTRA_STREAM, file.uri) 330 "${DocumentProvider.ROOT_ID}/log/yuzu_log.txt.old.txt"
331 )
332 )!!
333
334 val intent = Intent(Intent.ACTION_SEND)
335 .setDataAndType(currentLog.uri, FileUtil.TEXT_PLAIN)
336 .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
337 if (!Log.gameLaunched && oldLog.exists()) {
338 intent.putExtra(Intent.EXTRA_STREAM, oldLog.uri)
339 startActivity(Intent.createChooser(intent, getText(R.string.share_log)))
340 } else if (currentLog.exists()) {
341 intent.putExtra(Intent.EXTRA_STREAM, currentLog.uri)
328 startActivity(Intent.createChooser(intent, getText(R.string.share_log))) 342 startActivity(Intent.createChooser(intent, getText(R.string.share_log)))
329 } else { 343 } else {
330 Toast.makeText( 344 Toast.makeText(
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
index 1d3c7dce3..fb682c344 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
@@ -4,6 +4,9 @@
4package org.yuzu.yuzu_emu.utils 4package org.yuzu.yuzu_emu.utils
5 5
6object Log { 6object Log {
7 // Tracks whether we should share the old log or the current log
8 var gameLaunched = false
9
7 external fun debug(message: String) 10 external fun debug(message: String)
8 11
9 external fun warning(message: String) 12 external fun warning(message: String)
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 0e458df38..294e41045 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -248,6 +248,11 @@ void EmulationSession::ConfigureFilesystemProvider(const std::string& filepath)
248} 248}
249 249
250void EmulationSession::InitializeSystem() { 250void EmulationSession::InitializeSystem() {
251 // Initialize logging system
252 Common::Log::Initialize();
253 Common::Log::SetColorConsoleBackendEnabled(true);
254 Common::Log::Start();
255
251 // Initialize filesystem. 256 // Initialize filesystem.
252 m_system.SetFilesystem(m_vfs); 257 m_system.SetFilesystem(m_vfs);
253 m_system.GetUserChannel().clear(); 258 m_system.GetUserChannel().clear();
@@ -462,10 +467,6 @@ void EmulationSession::OnEmulationStopped(Core::SystemResultStatus result) {
462} 467}
463 468
464static Core::SystemResultStatus RunEmulation(const std::string& filepath) { 469static Core::SystemResultStatus RunEmulation(const std::string& filepath) {
465 Common::Log::Initialize();
466 Common::Log::SetColorConsoleBackendEnabled(true);
467 Common::Log::Start();
468
469 MicroProfileOnThreadCreate("EmuThread"); 470 MicroProfileOnThreadCreate("EmuThread");
470 SCOPE_EXIT({ MicroProfileShutdown(); }); 471 SCOPE_EXIT({ MicroProfileShutdown(); });
471 472