Merge pull request #2707 from lewri/remove_debugger

Remove obsolete remote debugger code
This commit is contained in:
Stephen E. Baker
2024-11-02 19:31:47 -04:00
committed by GitHub
10 changed files with 4 additions and 94 deletions

View File

@@ -73,14 +73,6 @@ end
-- Load standard library extensions
corsixth.require("utility")
-- A DBGp debugger can debug this file if you start a CorsixTH DBGp client & connect
-- it to a running server, using this CorsixTH startup arg: -debugger
for _, arg in ipairs({...}) do
if arg:match("^%-%-connect%-lua%-dbgp") then
dofile("run_debugger")()
end
end
-- Check Lua version
local support = list_to_set({"Lua 5.1", "Lua 5.2", "Lua 5.3", "Lua 5.4"})
if not support[_VERSION] then

View File

@@ -23,7 +23,6 @@ local rnc = require("rnc")
local lfs = require("lfs")
local TH = require("TH")
local SDL = require("sdl")
local runDebugger = corsixth.require("run_debugger")
-- Increment each time a savegame break would occur
-- and add compatibility code in afterLoad functions
@@ -70,12 +69,6 @@ function App:App()
self.window_active_status = false -- whether window is in focus, set after App:init
end
--! Starts a Lua DBGp client & connects it to a DBGp server.
--!return error_message (String) Returns an error message or nil.
function App:connectDebugger()
return runDebugger()
end
function App:setCommandLine(...)
self.command_line = { ... }
for _, arg in ipairs(self.command_line) do

View File

@@ -129,12 +129,6 @@ local config_defaults = {
audio_buffer_size = 2048,
theme_hospital_install = [[X:\ThemeHospital\hospital]],
debug = false,
DBGp_client_idehost = nil,
DBGp_client_ideport = nil,
DBGp_client_idekey = nil,
DBGp_client_transport = nil,
DBGp_client_platform = nil,
DBGp_client_workingdir = nil,
track_fps = false,
zoom_speed = 80,
scroll_speed = 2,
@@ -500,17 +494,6 @@ audio_music = nil -- [[X:\ThemeHospital\Music]]
--]=] .. '\n' ..
'debug_falling = ' .. tostring(config_values.debug_falling) .. '\n' .. [=[
-- Optional settings for CorsixTH's Lua DBGp client. Default settings are
-- nil values, platform & working dir will be autodetected if nil.
-- https://wiki.eclipse.org/LDT/User_Area/User_Guides/User_Guide_1.2#Attach_session
--]=] .. '\n' ..
'idehost = ' .. tostring(config_values.DBGp_client_idehost) .. '\n' ..
'ideport = ' .. tostring(config_values.DBGp_client_ideport) .. '\n' ..
'idekey = ' .. tostring(config_values.DBGp_client_idekey) .. '\n' ..
'transport = ' .. tostring(config_values.DBGp_client_transport) .. '\n' ..
'platform = ' .. tostring(config_values.DBGp_platform) .. '\n' ..
'workingdir = ' .. tostring(config_values.DBGp_workingdir) .. '\n' .. [=[
-- If set to true, the FPS, Lua memory usage, and entity count will be shown
-- in the dynamic information bar. Note that setting this to true also turns
-- off the FPS limiter, causing much higher CPU utilisation, but resulting in
@@ -587,7 +570,6 @@ local hotkeys_defaults = {
global_exitApp = {"alt", "f4"},
global_resetApp = {"shift", "f10"},
global_releaseMouse = {"ctrl", "f10"},
global_connectDebugger = {"ctrl", "c"},
global_showLuaConsole = "f12",
global_runDebugScript = {"shift", "d"},
global_screenshot = {"ctrl", "s"},
@@ -729,7 +711,6 @@ if hotkeys_needs_rewrite and TheApp then
'global_exitApp = ' .. hotkeys_values.global_exitApp .. '\n' ..
'global_resetApp = ' .. hotkeys_values.global_resetApp .. '\n' ..
'global_releaseMouse = ' .. hotkeys_values.global_releaseMouse .. '\n' ..
'global_connectDebugger = ' .. hotkeys_values.global_connectDebugger .. '\n' ..
'global_showLuaConsole = ' .. hotkeys_values.global_showLuaConsole .. '\n' ..
'global_runDebugScript = ' .. hotkeys_values.global_runDebugScript .. '\n' ..
'global_screenshot = ' .. hotkeys_values.global_screenshot .. '\n' ..

View File

@@ -1,10 +1,6 @@
---
-- Calling "execute script" while CorsixTH is running will execute the latest
-- code in this script so you don't need to restart CorsixTH.
--
-- This script's execution key command and the key commands for the debug console
-- & connecting a Lua DBGp server can be used anywhere at any time in CorsixTH
-- when debug mode is enabled.
-- This file can be executed with the RUN DEBUG SCRIPT menu option or hotkey.
-- Each time the script is run the latest version will be loaded from disk.
--
-- Like with the console you can reference clicked humanoids with the underscore
-- global variable so for example: _:die() will make a clicked patient die.
@@ -12,4 +8,6 @@
-- The run time App class instance can be referenced with its global variable
-- "TheApp", with it you can reference other run time class instances like:
-- TheApp.world
--
-- Add your code below.
---

View File

@@ -820,7 +820,6 @@ function UIMenuBar:makeGameMenu(app)
if self.ui.app.config.debug then
self:addMenu(_S.menu.debug, UIMenu() -- Debug
:appendMenu(_S.menu_debug.jump_to_level, levels_menu)
:appendItem(_S.menu_debug.connect_debugger:format(hotkey_value_label("global_connectDebugger", hotkeys)), function() self.ui:connectDebugger() end)
:appendCheckItem(_S.menu_debug.limit_camera, true, limit_camera, nil, function() return self.ui.limit_to_visible_diamond end)
:appendCheckItem(_S.menu_debug.disable_salary_raise, false, disable_salary_raise, nil, function() return self.ui.app.world.debug_disable_salary_raise end)
:appendCheckItem(_S.menu_debug.allow_blocking_off_areas, false, allowBlockingAreas, nil, function() return self.ui.app.config.allow_blocking_off_areas end)

View File

@@ -454,7 +454,6 @@ function UIHotkeyAssign:UIHotkeyAssign(ui, mode)
sections = {{
title = _S.hotkey_window.panel_debugKeys,
keys = {
"global_connectDebugger",
"global_showLuaConsole",
"global_runDebugScript",
"ingame_showCheatWindow",

View File

@@ -1,31 +0,0 @@
---
-- This script is responsible for starting a DBGp client for CorsixTH's
-- Lua scripts and then connecting this to a running DBGp server.
--
-- It does this in the function it returns.
---
local function run()
print("NOTE: While CorsixTH is connected to an IDE's debugger server,")
print("text will be printed in its output console instead of here.")
if not pcall(require, "socket") then
print("Can't connect debugger: LuaSocket is not available.")
return "Can't connect debugger: LuaSocket is not available."
end
local config = select(2, corsixth.require("config_finder"))
local connect = dofile("debugger")
local successful, error_message = pcall(connect, config.DBGp_client_idehost,
config.DBGp_client_ideport,
config.DBGp_client_idekey,
config.DBGp_client_transport,
config.DBGp_client_platform,
config.DBGp_client_workingdir)
if not successful then
print("\nCan't connect DBGp client:\n" .. error_message .. "\n")
return "Failed to connect debugger, error printed in console."
end
end
return run

View File

@@ -224,13 +224,6 @@ function UI:setupGlobalKeyHandlers()
self:addOrRemoveDebugModeKeyHandlers()
end
function UI:connectDebugger()
local error_message = TheApp:connectDebugger()
if error_message then
self:addWindow(UIInformation(self, {error_message}))
end
end
-- Used for everything except music and announcements
function UI:playSound(name, played_callback, played_callback_delay)
if self.app.config.play_sounds then
@@ -1071,11 +1064,9 @@ function UI:getCursorPosition(window)
end
function UI:addOrRemoveDebugModeKeyHandlers()
self:removeKeyHandler("global_connectDebugger", self)
self:removeKeyHandler("global_showLuaConsole", self)
self:removeKeyHandler("global_runDebugScript", self)
if self.app.config.debug then
self:addKeyHandler("global_connectDebugger", self, self.connectDebugger)
self:addKeyHandler("global_showLuaConsole", self, self.showLuaConsole)
self:addKeyHandler("global_runDebugScript", self, self.runDebugScript)
end

View File

@@ -40,7 +40,6 @@ Briefly:
-- CorsixTH.exe Optional Startup Arguments
------------------------------------------------------------------------------
--connect-lua-dbgp : Before App.lua is executed connect a Lua DBGp client & to a Lua DBGp server.
--interpreter=... : loadfile(...) instead of CorsixTH.lua.
--config-file=... : Makes CorsixTH use the specified config file.
--bitmap-dir=... : Makes CorsixTH use the specified bitmap directory.

View File

@@ -303,17 +303,6 @@ debug = false
--
debug_falling = false
-- Optional settings for CorsixTH's Lua DBGp client. Default settings are
-- nil values, platform & working dir will be autodetected if nil.
-- https://wiki.eclipse.org/LDT/User_Area/User_Guides/User_Guide_1.2#Attach_session
--
idehost = nil
ideport = nil
idekey = nil
transport = nil
platform = nil
workingdir = nil
-- If set to true, the FPS, Lua memory usage, and entity count will be shown
-- in the dynamic information bar. Note that setting this to true also turns
-- off the FPS limiter, causing much higher CPU utilisation, but resulting in