diff --git a/LuaMenu/configs/gameConfig/evorts/mainConfig.lua b/LuaMenu/configs/gameConfig/evorts/mainConfig.lua index e0b0d2613..9bda5cc91 100644 --- a/LuaMenu/configs/gameConfig/evorts/mainConfig.lua +++ b/LuaMenu/configs/gameConfig/evorts/mainConfig.lua @@ -33,7 +33,7 @@ local externalFuncAndData = { --_defaultGameArchiveName = "??", fill this in. _defaultGameRapidTag = "evo:stable", -- Do not read directly editor = "rapid://sb-evo:test", - --editor = "SpringBoard EVO $VERSION", + --editor = "SpringBoard EVO $VERSION", mapWhitelist = mapWhitelist, aiBlacklist = aiBlacklist, settingsConfig = settingsConfig, @@ -45,10 +45,13 @@ local externalFuncAndData = { rankFunction = rankFunction, headingLarge = headingLarge, headingSmall = headingSmall, + taskbarTitle = "Evolution RTS", + taskbarTitleShort = "Evo RTS", taskbarIcon = taskbarIcon, background = background, minimapOverridePath = minimapOverridePath, minimapThumbnailPath = minimapThumbnailPath, + ignoreServerVersion = true, } function externalFuncAndData.CheckAvailability() diff --git a/LuaMenu/configs/gameConfig/evortsdev/mainConfig.lua b/LuaMenu/configs/gameConfig/evortsdev/mainConfig.lua index fe085832a..3e833d4b4 100644 --- a/LuaMenu/configs/gameConfig/evortsdev/mainConfig.lua +++ b/LuaMenu/configs/gameConfig/evortsdev/mainConfig.lua @@ -1,4 +1,4 @@ -local zkBaseConfig = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/evorts/mainConfig.lua") +local evoBaseConfig = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/evorts/mainConfig.lua") local shortname = "evortsdev" local skirmishDefault = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/skirmishDefault.lua") @@ -7,10 +7,12 @@ local skirmishDefault = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. s -- Getters --------------------------------------------------------------------------------- -zkBaseConfig.dirName = "evortsdev" -zkBaseConfig.name = "EvoRTS Dev" -zkBaseConfig._defaultGameArchiveName = "Evolution RTS - $VERSION" -zkBaseConfig._defaultGameRapidTag = nil -zkBaseConfig.skirmishDefault = skirmishDefault +evoBaseConfig.dirName = "evortsdev" +evoBaseConfig.name = "EvoRTS Dev" +evoBaseConfig.taskbarTitle = "Evolution RTS Dev" +evoBaseConfig.taskbarTitleShort = "Evo RTS Dev" +evoBaseConfig._defaultGameArchiveName = "Evolution RTS - $VERSION" +evoBaseConfig._defaultGameRapidTag = nil +evoBaseConfig.skirmishDefault = skirmishDefault -return zkBaseConfig +return evoBaseConfig diff --git a/LuaMenu/configs/gameConfig/zk/mainConfig.lua b/LuaMenu/configs/gameConfig/zk/mainConfig.lua index 5b845f412..bf87d3ebf 100644 --- a/LuaMenu/configs/gameConfig/zk/mainConfig.lua +++ b/LuaMenu/configs/gameConfig/zk/mainConfig.lua @@ -81,17 +81,20 @@ local externalFuncAndData = { headingLarge = headingLarge, headingSmall = headingSmall, subheadings = subheadings, + taskbarTitle = "Zero-K", + taskbarTitleShort = "Zero-K", taskbarIcon = taskbarIcon, background = background, minimapOverridePath = minimapOverridePath, minimapThumbnailPath = minimapThumbnailPath, gameUnitInformation = gameUnitInformation, - link_reportPlayer = link_reportPlayer, - link_userPage = link_userPage, + link_reportPlayer = link_reportPlayer, + link_userPage = link_userPage, link_homePage = link_homePage, link_replays = link_replays, link_maps = link_maps, link_particularMapPage = link_particularMapPage, + ignoreServerVersion = false, } function externalFuncAndData.CheckAvailability() diff --git a/LuaMenu/configs/gameConfig/zkdev/mainConfig.lua b/LuaMenu/configs/gameConfig/zkdev/mainConfig.lua index cc23d3645..177dc1e8b 100644 --- a/LuaMenu/configs/gameConfig/zkdev/mainConfig.lua +++ b/LuaMenu/configs/gameConfig/zkdev/mainConfig.lua @@ -10,6 +10,8 @@ local skirmishDefault = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. s zkBaseConfig.dirName = "zkdev" zkBaseConfig.name = "Zero-K Dev" +zkBaseConfig.taskbarTitle = "Zero-K Dev" +zkBaseConfig.taskbarTitleShort = "Zero-K Dev" zkBaseConfig._defaultGameArchiveName = "Zero-K $VERSION" zkBaseConfig._defaultGameRapidTag = nil zkBaseConfig.singleplayerConfig = singleplayerConfig diff --git a/LuaMenu/widgets/api_download_handler.lua b/LuaMenu/widgets/api_download_handler.lua index 46a84d3dc..10ce2be38 100644 --- a/LuaMenu/widgets/api_download_handler.lua +++ b/LuaMenu/widgets/api_download_handler.lua @@ -92,13 +92,13 @@ end local function DownloadQueueUpdate() requestUpdate = false - + if #downloadQueue == 0 then CallListeners("DownloadQueueUpdate", downloadQueue, removedDownloads) return end table.sort(downloadQueue, DownloadSortFunc) - + local front = downloadQueue[1] if not front.active then if USE_WRAPPER_DOWNLOAD and WG.WrapperLoopback then @@ -109,7 +109,7 @@ local function DownloadQueueUpdate() end front.active = true end - + CallListeners("DownloadQueueUpdate", downloadQueue, removedDownloads) end @@ -156,13 +156,13 @@ local function RemoveDownload(name, fileType, putInRemoveList, removalType) if not index then return false end - + if removalType == "success" then CallListeners("DownloadFinished", downloadQueue[index].id, name, fileType) else CallListeners("DownloadFailed", downloadQueue[index].id, removalType, name, fileType) end - + if putInRemoveList then downloadQueue[index].removalType = removalType removedDownloads[#removedDownloads + 1] = downloadQueue[index] @@ -182,11 +182,11 @@ function externalFunctions.QueueDownload(name, fileType, priority) if priority == -1 then priority = topPriority + 1 end - + if topPriority < priority then topPriority = priority end - + local index = GetDownloadIndex(downloadQueue, name, fileType) if index then local data = downloadQueue[index] @@ -196,7 +196,7 @@ function externalFunctions.QueueDownload(name, fileType, priority) end return end - + downloadCount = downloadCount + 1 downloadQueue[#downloadQueue + 1] = { name = name, @@ -213,7 +213,7 @@ function externalFunctions.SetDownloadTopPriority(name, fileType) if not index then return end - + topPriority = topPriority + 1 downloadQueue[index].priority = topPriority requestUpdate = true @@ -225,15 +225,15 @@ function externalFunctions.CancelDownload(name, fileType) if not index then return false end - + if downloadQueue[index].active then WG.WrapperLoopback.AbortDownload(name, typeMap[fileType]) return end - + downloadQueue[index].removalType = "cancel" removedDownloads[#removedDownloads + 1] = downloadQueue[index] - + downloadQueue[index] = downloadQueue[#downloadQueue] downloadQueue[#downloadQueue] = nil requestUpdate = true @@ -244,7 +244,7 @@ function externalFunctions.RetryDownload(name, fileType) if not index then return false end - + externalFunctions.QueueDownload(name, fileType, removedDownloads[index].priority) removedDownloads[index] = removedDownloads[#removedDownloads] removedDownloads[#removedDownloads] = nil @@ -257,7 +257,7 @@ function externalFunctions.RemoveRemovedDownload(name, fileType) if not index then return false end - + removedDownloads[index] = removedDownloads[#removedDownloads] removedDownloads[#removedDownloads] = nil requestUpdate = true @@ -286,7 +286,7 @@ function wrapperFunctions.DownloadFinished(name, fileType, success, aborted) end RemoveDownload(name, fileType, true, (aborted and "cancel") or (success and "success") or "fail") end - + --Chotify:Post({ -- title = "Download " .. ((success and "Finished") or "Failed"), -- body = (name or "???") .. " of type " .. (fileType or "???"), @@ -298,7 +298,7 @@ function wrapperFunctions.DownloadFileProgress(name, fileType, progress, seconds if not index then return end - + totalLength = (tonumber(totalLength or 0) or 0)/1023^2 CallListeners("DownloadProgress", downloadQueue[index].id, totalLength*math.min(1, (tonumber(progress or 0) or 0)/100), totalLength, name) end @@ -318,8 +318,7 @@ function widget:DownloadProgress(downloadID, downloaded, total) if not index then return end - - CallListeners("DownloadProgress", downloadQueue[index].id, downloaded, total) + CallListeners("DownloadProgress", downloadQueue[index].id, downloaded, total, downloadQueue[index].name) end function widget:DownloadStarted(downloadID) @@ -328,7 +327,7 @@ function widget:DownloadStarted(downloadID) return end local data = downloadQueue[index] - + CallListeners("DownloadStarted", data.id, data.name, data.fileType) end @@ -338,7 +337,7 @@ function widget:DownloadFinished(downloadID) return end local data = downloadQueue[index] - + RemoveDownload(data.name, data.fileType, true, "success") end @@ -348,7 +347,7 @@ function widget:DownloadFailed(downloadID, errorID) return end local data = downloadQueue[index] - + RemoveDownload(data.name, data.fileType, true, "fail") end @@ -379,7 +378,7 @@ local function GetRequiredDownloads() externalFunctions.MaybeDownloadArchive(campaignStartMaps[i], "map", 1.5) end end - + local skirmishPages = Configuration.gameConfig and Configuration.gameConfig.skirmishSetupData and Configuration.gameConfig.skirmishSetupData.pages if skirmishPages then for i = 1, #skirmishPages do @@ -398,7 +397,7 @@ WG.DownloadHandler = externalFunctions function widget:Initialize() CHOBBY_DIR = LUA_DIRNAME .. "widgets/chobby/" VFS.Include(LUA_DIRNAME .. "widgets/chobby/headers/exports.lua", nil, VFS.RAW_FIRST) - + WG.DownloadWrapperInterface = wrapperFunctions WG.Delay(GetRequiredDownloads, 1) end diff --git a/LuaMenu/widgets/chobby/components/ai_list_window.lua b/LuaMenu/widgets/chobby/components/ai_list_window.lua index 10462395a..a6eecb790 100644 --- a/LuaMenu/widgets/chobby/components/ai_list_window.lua +++ b/LuaMenu/widgets/chobby/components/ai_list_window.lua @@ -94,6 +94,10 @@ function AiListWindow:AddAi(displayName, shortName, version) while found do found = false aiName = displayName .. " (" .. tostring(counter) .. ")" + -- Ubserver AI names cannot include whitespace + if WG.Server.protocol == "spring" then + aiName = aiName:gsub(" ", "") + end for _, userName in pairs(self.lobby.battleAis) do if aiName == userName then found = true diff --git a/LuaMenu/widgets/chobby/core.lua b/LuaMenu/widgets/chobby/core.lua index cddd7a650..253044b0f 100644 --- a/LuaMenu/widgets/chobby/core.lua +++ b/LuaMenu/widgets/chobby/core.lua @@ -81,7 +81,7 @@ function Chobby:_Initialize() WG.Delay(function() lobby:AddListener("OnSuggestedEngineVersion", function(listener, engineName) - if engineName and not WG.Chobby.Configuration:IsValidEngineVersion(engineName) then + if engineName and not WG.Chobby.Configuration.gameConfig.ignoreServerVersion and not WG.Chobby.Configuration:IsValidEngineVersion(engineName) then WG.Chobby.InformationPopup("Wrong Spring engine version. The required version is '" .. engineName .. "', your version is '" .. Spring.Utilities.GetEngineVersion() .. "'.\n\nRestart the game to get the correct version.", 480, 248) end end diff --git a/LuaMenu/widgets/gui_battle_room_window.lua b/LuaMenu/widgets/gui_battle_room_window.lua index 74b0b17e2..e78b802c9 100644 --- a/LuaMenu/widgets/gui_battle_room_window.lua +++ b/LuaMenu/widgets/gui_battle_room_window.lua @@ -451,7 +451,7 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs local downloader = WG.Chobby.Downloader(false, downloaderPos, 8, nil, nil, nil, OnDownloaderVisibility) leftOffset = leftOffset + 120 - + -- Example downloads --MaybeDownloadArchive("Titan-v2", "map") --MaybeDownloadArchive("tinyskirmishredux1.1", "map") @@ -479,7 +479,7 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs lblHaveMap:SetPos(nil, offset) end externalFunctions.UpdateBattleMode(battle.disallowCustomTeams) - + function externalFunctions.SetHaveGame(newHaveGame) if newHaveGame then imHaveGame.file = IMG_READY @@ -1258,7 +1258,7 @@ local function InitializeSetupPage(subPanel, screenHeight, pageConfig, nextPage, buttonHeight = 56 buttonFont = 4 end - + subPanel:SetVisibility(not prevPage) local lblBattleTitle = Label:New { @@ -1318,7 +1318,7 @@ local function InitializeSetupPage(subPanel, screenHeight, pageConfig, nextPage, }, parent = subPanel, } - + if prevPage then Button:New { x = "5%", @@ -1337,7 +1337,7 @@ local function InitializeSetupPage(subPanel, screenHeight, pageConfig, nextPage, parent = subPanel, } end - + for i = 1, #pageConfig.options do local x, y, right, height, caption, tooltip if pageConfig.minimap then @@ -1416,7 +1416,7 @@ local function SetupEasySetupPanel(mainWindow, standardSubPanel, setupData) local _, screenHeight = Spring.GetWindowGeometry() local panelOffset = math.max(8, math.min(60, ((screenHeight - 768)*0.16 + 8))) - + local pages = {} for i = 1, #pageConfigs do pages[i] = Control:New { @@ -1428,7 +1428,7 @@ local function SetupEasySetupPanel(mainWindow, standardSubPanel, setupData) parent = mainWindow, } end - + for i = 1, #pages do InitializeSetupPage(pages[i], screenHeight, pageConfigs[i], pages[i + 1], pages[i - 1], selectedOptions, ApplyFunction) end @@ -1587,7 +1587,13 @@ local function InitializeControls(battleID, oldLobby, topPoportion, setupData) return end if Configuration:IsValidEngineVersion(battle.engineVersion) then - battleTitle = i18n(Configuration.battleTypeToName[battle.battleMode]) .. ": " .. tostring(battle.title) + local battleTypeName = Configuration.battleTypeToName[battle.battleMode] + if battleTypeName then + battleTitle = i18n(battleTypeName) .. ": " .. tostring(battle.title) + else + battleTitle = tostring(battle.title) + end + local truncatedTitle = StringUtilities.GetTruncatedStringWithDotDot(battleTitle, lblBattleTitle.font, lblBattleTitle.width) lblBattleTitle:SetCaption(truncatedTitle) else @@ -1925,7 +1931,7 @@ function widget:Initialize() UpdateArchiveStatus(true) end WG.DownloadHandler.AddListener("DownloadFinished", downloadFinished) - + WG.BattleRoomWindow = BattleRoomWindow end diff --git a/LuaMenu/widgets/gui_chili_lobby.lua b/LuaMenu/widgets/gui_chili_lobby.lua index b5751fb70..e67b2f2d7 100644 --- a/LuaMenu/widgets/gui_chili_lobby.lua +++ b/LuaMenu/widgets/gui_chili_lobby.lua @@ -81,7 +81,11 @@ function widget:Initialize() Chobby.lobbyInterfaceHolder = lobbyInterfaceHolder Chobby.interfaceRoot = interfaceRoot - Spring.SetWMCaption("Zero-K", "Zero-K") + local taskbarTitle = Chobby.Configuration.gameConfig.taskbarTitle + local taskbarTitleShort = Chobby.Configuration.gameConfig.taskbarTitleShort or taskbarTitle + if taskbarTitle then + Spring.SetWMCaption(taskbarTitle, taskbarTitleShort) + end local taskbarIcon = Chobby.Configuration.gameConfig.taskbarIcon if taskbarIcon then Spring.SetWMIcon(taskbarIcon) @@ -95,6 +99,11 @@ function widget:Initialize() local function onConfigurationChange(listener, key, value) if key == "gameConfigName" then + local taskbarTitle = Chobby.Configuration.gameConfig.taskbarTitle + local taskbarTitleShort = Chobby.Configuration.gameConfig.taskbarTitleShort or taskbarTitle + if taskbarTitle then + Spring.SetWMCaption(taskbarTitle, taskbarTitleShort) + end local taskbarIcon = Chobby.Configuration.gameConfig.taskbarIcon if taskbarIcon then Spring.SetWMIcon(taskbarIcon) diff --git a/libs/liblobby/lobby/interface.lua b/libs/liblobby/lobby/interface.lua index ddb5629df..0576ae422 100644 --- a/libs/liblobby/lobby/interface.lua +++ b/libs/liblobby/lobby/interface.lua @@ -222,6 +222,7 @@ function Interface:SayBattleEx(message) end function Interface:AddAi(aiName, aiLib, allyNumber, version) + aiName = aiName:gsub(" ", "") local battleStatusString = tostring( 2 + lshift(allyNumber, 2) + @@ -529,9 +530,16 @@ end Interface.commands["LEFTBATTLE"] = Interface._OnLeftBattle Interface.commandPattern["LEFTBATTLE"] = "(%d+)%s+(%S+)" -function Interface:_OnUpdateBattleInfo(battleID, spectatorCount, locked, mapHash, mapName, engineVersion, runningSince, gameName, battleMode) +function Interface:_OnUpdateBattleInfo(battleID, spectatorCount, locked, mapHash, mapName) battleID = tonumber(battleID) - self:super("_OnUpdateBattleInfo", battleID, spectatorCount, locked, mapHash, mapName, engineVersion, runningSince, gameName, battleMode) + + local battleInfo = { + passworded = (locked == "1"), + mapName = mapName, + spectatorCount = tonumber(spectatorCount) + } + + self:super("_OnUpdateBattleInfo", battleID, battleInfo) end Interface.commands["UPDATEBATTLEINFO"] = Interface._OnUpdateBattleInfo Interface.commandPattern["UPDATEBATTLEINFO"] = "(%d+)%s+(%S+)%s+(%S+)%s+(%S+)%s+([^\t]+)" @@ -552,10 +560,10 @@ end Interface.commands["CLIENTBATTLESTATUS"] = Interface._OnClientBattleStatus Interface.commandPattern["CLIENTBATTLESTATUS"] = "(%S+)%s+(%S+)%s+(%S+)" -function Interface:_OnAddBot(battleID, name, owner, foobar, battleStatus, teamColor, aiDll) +function Interface:_OnAddBot(battleID, name, owner, battleStatus, teamColor, aiDll) battleID = tonumber(battleID) -- local ai, dll = unpack(explode("\t", aiDll))) - Spring.Echo(battleID, name, owner, foobar, battleStatus, teamColor, aiDll) + Spring.Echo(battleID, name, owner, battleStatus, teamColor, aiDll) Spring.Echo(battleStatus) battleStatus = tonumber(battleStatus) Spring.Echo(battleStatus) @@ -571,7 +579,7 @@ function Interface:_OnAddBot(battleID, name, owner, foobar, battleStatus, teamCo self:_OnAddAi(battleID, name, status) end Interface.commands["ADDBOT"] = Interface._OnAddBot -Interface.commandPattern["ADDBOT"] = "(%d+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)" +Interface.commandPattern["ADDBOT"] = "(%d+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)" function Interface:_OnRemoveBot(battleID, name) battleID = tonumber(battleID)