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()