From 6eeaf58316a5fd3263bdf09b676204dfeda2fe14 Mon Sep 17 00:00:00 2001 From: Apllify Date: Fri, 19 Jan 2024 17:05:14 +0100 Subject: [PATCH 1/5] Added openGL togglable --- src/config.lua | 1 + src/main.lua | 1 + src/scenes/mainmenu.lua | 3 ++- src/scenes/options.lua | 20 ++++++++++++++++++++ src/utils.lua | 13 +++++++++++-- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/config.lua b/src/config.lua index 350254e..c1b771f 100644 --- a/src/config.lua +++ b/src/config.lua @@ -130,6 +130,7 @@ function config.load() default(data, "loennInstalledVersion", "") default(data, "updateModsOnStartup", "none") + default(data, "useOpenGL", 2) default(data, "extradata", {}) end diff --git a/src/main.lua b/src/main.lua index ed3328d..50e2595 100644 --- a/src/main.lua +++ b/src/main.lua @@ -37,6 +37,7 @@ local canvas local drawstats = {} + local function logDump() while true do local logLine = logChannel:pop() diff --git a/src/scenes/mainmenu.lua b/src/scenes/mainmenu.lua index 6a8cde8..3edfc83 100644 --- a/src/scenes/mainmenu.lua +++ b/src/scenes/mainmenu.lua @@ -466,7 +466,7 @@ local root = uie.row({ buttonBig("mainmenu/berry", "Manage Installed Mods", "modlist", true):with(uiu.fillWidth), uie.row({}):with(uiu.fillWidth):as("mapeditor"), buttonBig("cogwheel", updater.available and "Options & Updates" or "Options", "options"):with(uiu.fillWidth):with(utils.important(32, function() return updater.latest end)), - -- button("cogwheel", "[DEBUG] Scene List", "scenelist"):with(uiu.fillWidth), + button("cogwheel", "[DEBUG] Scene List", "scenelist"):with(uiu.fillWidth), }):with({ clip = false }):with(uiu.fillWidth(true)):with(uiu.fillHeight):as("mainlist"), @@ -525,6 +525,7 @@ scene.launchrow = uie.row({ modupdater.updateAllMods(nil, true) end):with(uiu.fillWidth(2.5 + 32 + 2 + 4)):with(uiu.at(0, 0)), buttonBig("mainmenu/celeste", "Celeste", function() + local opengl = config.useOpenGL == "enabled" utils.launch(nil, true, true) end):with(uiu.fillWidth(2.5 + 32 + 2 + 4)):with(uiu.at(2.5 - 32 - 2, 0)), buttonBig("cogwheel", "", "everest"):with({ diff --git a/src/scenes/options.lua b/src/scenes/options.lua index ca040e0..9efee93 100644 --- a/src/scenes/options.lua +++ b/src/scenes/options.lua @@ -86,6 +86,11 @@ local updateModsOnStartupOptions = { { text = "Disabled (Default)", data = "none" } } +local useOpenGLOptions = { + { text = "Enabled", data = "enabled" }, + { text = "Disabled (Default)", data = "disabled" } +} + local extradatas = { { text = "Noto Sans CJK (~50 MB)", info = "Chinese, Japanese, Korean font files.", path = "olympus-extra-cjk.zip", url = "https://0x0a.de/olympus-extra/olympus-extra-cjk.zip" } } @@ -297,6 +302,8 @@ local root = uie.column({ }):with(uiu.fillWidth) }):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(4 / optioncount, 0)), + + }):with(uiu.fillWidth), uie.group({}), @@ -350,6 +357,19 @@ local root = uie.column({ }):with(uiu.fillWidth) }):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(3 / optioncount, 0)), + uie.column({ + uie.label("Use OpenGL"), + uie.dropdown(useOpenGLOptions, function(self, value) + print(value) + config.useOpenGL = value + config.save() + end):with({ + placeholder = "???", + selectedData = config.useOpenGL + }):with(uiu.fillWidth) + }):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(4 / optioncount, 0)), + + }):with(uiu.fillWidth), uie.group({}), diff --git a/src/utils.lua b/src/utils.lua index 3c0b873..1c74d0f 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -323,6 +323,7 @@ end local launching = {} +--add opengl argument here ? function utils.launch(path, vanilla, notify, force) local key = string.format("%s | %s", path, vanilla and "vanilla" or "everest") if launching[key] then @@ -333,8 +334,10 @@ function utils.launch(path, vanilla, notify, force) end launching[key] = threader.routine(function() + + local config = require("config") + if not path then - local config = require("config") if config then path = config.installs[config.install].path end @@ -348,7 +351,13 @@ function utils.launch(path, vanilla, notify, force) local alert = require("alert") notify = notify and require("notify") or alert - local launch = sharp.launch(path, vanilla and "--vanilla" or "", (force or not notify) and true or false) + local opengl = false + if config then + opengl = config.useOpenGL == "enabled" + end + + local flags = "--console " .. (vanilla and "--vanilla " or "") .. (opengl and "--graphics OpenGL " or "") + local launch = sharp.launch(path, flags, (force or not notify) and true or false) local container if vanilla then From adfd9885550f1430f3cfbf519be6403b04bf39df Mon Sep 17 00:00:00 2001 From: Apllify Date: Fri, 19 Jan 2024 17:07:38 +0100 Subject: [PATCH 2/5] Removed debug code --- src/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.lua b/src/utils.lua index 1c74d0f..053fb99 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -356,7 +356,7 @@ function utils.launch(path, vanilla, notify, force) opengl = config.useOpenGL == "enabled" end - local flags = "--console " .. (vanilla and "--vanilla " or "") .. (opengl and "--graphics OpenGL " or "") + local flags = (vanilla and "--vanilla " or "") .. (opengl and "--graphics OpenGL " or "") local launch = sharp.launch(path, flags, (force or not notify) and true or false) local container From 85a8580e183e8808ee439ad01352634d1fb2bdbf Mon Sep 17 00:00:00 2001 From: Apllify Date: Fri, 19 Jan 2024 17:15:11 +0100 Subject: [PATCH 3/5] Fix default value --- src/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.lua b/src/config.lua index c1b771f..bd8e31f 100644 --- a/src/config.lua +++ b/src/config.lua @@ -130,7 +130,7 @@ function config.load() default(data, "loennInstalledVersion", "") default(data, "updateModsOnStartup", "none") - default(data, "useOpenGL", 2) + default(data, "useOpenGL", "disabled") default(data, "extradata", {}) end From c316fe4eb282a4540ee1fa9d972017c67516f289 Mon Sep 17 00:00:00 2001 From: Apllify Date: Fri, 19 Jan 2024 17:17:39 +0100 Subject: [PATCH 4/5] Cleanup --- src/main.lua | 1 - src/scenes/mainmenu.lua | 3 +-- src/utils.lua | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.lua b/src/main.lua index 50e2595..ed3328d 100644 --- a/src/main.lua +++ b/src/main.lua @@ -37,7 +37,6 @@ local canvas local drawstats = {} - local function logDump() while true do local logLine = logChannel:pop() diff --git a/src/scenes/mainmenu.lua b/src/scenes/mainmenu.lua index 3edfc83..6a8cde8 100644 --- a/src/scenes/mainmenu.lua +++ b/src/scenes/mainmenu.lua @@ -466,7 +466,7 @@ local root = uie.row({ buttonBig("mainmenu/berry", "Manage Installed Mods", "modlist", true):with(uiu.fillWidth), uie.row({}):with(uiu.fillWidth):as("mapeditor"), buttonBig("cogwheel", updater.available and "Options & Updates" or "Options", "options"):with(uiu.fillWidth):with(utils.important(32, function() return updater.latest end)), - button("cogwheel", "[DEBUG] Scene List", "scenelist"):with(uiu.fillWidth), + -- button("cogwheel", "[DEBUG] Scene List", "scenelist"):with(uiu.fillWidth), }):with({ clip = false }):with(uiu.fillWidth(true)):with(uiu.fillHeight):as("mainlist"), @@ -525,7 +525,6 @@ scene.launchrow = uie.row({ modupdater.updateAllMods(nil, true) end):with(uiu.fillWidth(2.5 + 32 + 2 + 4)):with(uiu.at(0, 0)), buttonBig("mainmenu/celeste", "Celeste", function() - local opengl = config.useOpenGL == "enabled" utils.launch(nil, true, true) end):with(uiu.fillWidth(2.5 + 32 + 2 + 4)):with(uiu.at(2.5 - 32 - 2, 0)), buttonBig("cogwheel", "", "everest"):with({ diff --git a/src/utils.lua b/src/utils.lua index 053fb99..e2a83ca 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -323,7 +323,7 @@ end local launching = {} ---add opengl argument here ? + function utils.launch(path, vanilla, notify, force) local key = string.format("%s | %s", path, vanilla and "vanilla" or "everest") if launching[key] then From 91ce7ccb2ef5dcde1c1138fd79be4ddd41ed16de Mon Sep 17 00:00:00 2001 From: Apllify <34395526+Apllify@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:35:54 +0100 Subject: [PATCH 5/5] Remove debug print statement --- src/scenes/options.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scenes/options.lua b/src/scenes/options.lua index 9efee93..b26f36a 100644 --- a/src/scenes/options.lua +++ b/src/scenes/options.lua @@ -360,7 +360,6 @@ local root = uie.column({ uie.column({ uie.label("Use OpenGL"), uie.dropdown(useOpenGLOptions, function(self, value) - print(value) config.useOpenGL = value config.save() end):with({