From c8d6f786c5f82c050efd21aba6a669e8bef69633 Mon Sep 17 00:00:00 2001
From: Emmanuel Hansen <emmausssss@gmail.com>
Date: Sun, 2 Jul 2023 18:54:12 +0000
Subject: [PATCH] add option to enable debug logs

---
 src/LibRyujinx/JniExportedMethods.cs | 6 +++---
 src/LibRyujinx/LibRyujinx.cs         | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/LibRyujinx/JniExportedMethods.cs b/src/LibRyujinx/JniExportedMethods.cs
index c27e488f1..d64760fed 100644
--- a/src/LibRyujinx/JniExportedMethods.cs
+++ b/src/LibRyujinx/JniExportedMethods.cs
@@ -40,13 +40,13 @@ namespace LibRyujinx
         }
 
         [UnmanagedCallersOnly(EntryPoint = "Java_org_ryujinx_android_RyujinxNative_initialize")]
-        public static JBoolean JniInitialize(JEnvRef jEnv, JObjectLocalRef jObj, JStringLocalRef jpath)
+        public static JBoolean JniInitialize(JEnvRef jEnv, JObjectLocalRef jObj, JStringLocalRef jpath, JBoolean enableDebugLogs)
         {
             var path = GetString(jEnv, jpath);
 
             Ryujinx.Common.SystemInfo.SystemInfo.IsBionic = true;
 
-            var init = Initialize(path);
+            var init = Initialize(path, enableDebugLogs);
 
             AudioDriver = new OboeHardwareDeviceDriver();
 
@@ -376,7 +376,7 @@ namespace LibRyujinx
         {
             var safeHandle = new SafeFileHandle(descriptor, false);
 
-            return new FileStream(safeHandle, FileAccess.Read);
+            return new FileStream(safeHandle, FileAccess.ReadWrite);
         }
     }
 
diff --git a/src/LibRyujinx/LibRyujinx.cs b/src/LibRyujinx/LibRyujinx.cs
index f9e3c7604..4f0a049f7 100644
--- a/src/LibRyujinx/LibRyujinx.cs
+++ b/src/LibRyujinx/LibRyujinx.cs
@@ -57,7 +57,7 @@ namespace LibRyujinx
             return res;
         }
 
-        public static bool Initialize(string? basePath)
+        public static bool Initialize(string? basePath, bool enableDebugLogs = false)
         {
             if (SwitchDevice != null)
             {
@@ -73,7 +73,7 @@ namespace LibRyujinx
 
                 SwitchDevice = new SwitchDevice();
 
-                Logger.SetEnable(LogLevel.Debug, false);
+                Logger.SetEnable(LogLevel.Debug, enableDebugLogs);
                 Logger.SetEnable(LogLevel.Stub, false);
                 Logger.SetEnable(LogLevel.Info, true);
                 Logger.SetEnable(LogLevel.Warning, true);