From 77400b1d788e8be046567672082a34e90d70ff8f Mon Sep 17 00:00:00 2001 From: redsti Date: Sat, 22 Aug 2026 13:56:35 +0100 Subject: [PATCH] restart using love.event.restart --- bbp/utils.lua | 5 +++++ lovely/restart-game.toml | 32 -------------------------------- states/Mods.lua | 6 +++--- 3 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 lovely/restart-game.toml diff --git a/bbp/utils.lua b/bbp/utils.lua index ac40502..35eb60f 100644 --- a/bbp/utils.lua +++ b/bbp/utils.lua @@ -208,4 +208,9 @@ function utils.setRestartRequired() cs._restartRequired = true end +function utils.restart() + lovely.reload_patches() + love.event.restart() +end + return utils diff --git a/lovely/restart-game.toml b/lovely/restart-game.toml deleted file mode 100644 index 2f09c9a..0000000 --- a/lovely/restart-game.toml +++ /dev/null @@ -1,32 +0,0 @@ -[manifest] -version = "1.0.0" -dump_lua = true -priority = 2147483647 - -[[patches]] -[patches.pattern] -target = "main.lua" -pattern = """ -function love.update(d) -""" -position = "after" -payload = ''' -if BBP_doRestart then - local launchArgs = table.concat(arg, " ") - local osName = love.system.getOS() - local command - - if osName == "Windows" then - command = "start beatblock.exe " .. launchArgs - elseif osName == "OS X" then - command = "open beatblock.app " .. launchArgs .. " &" - else -- assume Linux - command = "./beatblock " .. launchArgs .. " &" - end - - love.window.close() - os.execute(command) - love.event.quit() -end -''' -match_indent = true diff --git a/states/Mods.lua b/states/Mods.lua index 54cde9d..538ce9a 100644 --- a/states/Mods.lua +++ b/states/Mods.lua @@ -481,7 +481,7 @@ st:setFgDraw(function(self) imgui.Separator() if imgui.Button("Yes") then - BBP_doRestart = true + bbp.utils.restart() end imgui.SameLine() @@ -503,7 +503,7 @@ st:setFgDraw(function(self) imgui.Separator() if imgui.Button("Yes, restart now") then - BBP_doRestart = true + bbp.utils.restart() end imgui.SameLine() @@ -525,7 +525,7 @@ st:setFgDraw(function(self) imgui.Separator() if imgui.Button("Yes, restart now") then - BBP_doRestart = true + bbp.utils.restart() end imgui.SameLine()