Mac Binary Release - Page 10

Mac Binary Release

Discuss everything related to compiling and running Spring on Mac OS X.

Moderator: Moderators

User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

icd-> PMed
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Post by el_matarife »

elio wrote: The lease wont let me >< (till wireless gets to this area, which will hopefully not be much longer). but pause an resume for every 45 seconds? maybe if the upload speed was any better…
http://nulldigital.net/blog/view.php?id=41 ICMP tunneling. If someone around here can set you up a proxy you'll be good to go.
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

elio wrote:Have you properly applied the patches?
No, I hadn't. Sorry about giving feeback when I didn't have my end figured out.

The AI errors disapeared, and the build lists for units are now complete. It's basically functional, so I'm really impressed. Still no buildpicks, that's the only problem I'm having.

Edit: Progress! I've got the AI's up and running now as well.
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

could you post infolog.txt?
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

ICMP tunneling.

Worth giving a try? not sure how reliable it is..
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

elio wrote:could you post infolog.txt?
Below, with Verbose set to 9, but it doesn't look like there is much useful in it. (Ignore the ***, that's my edit.)
[code]Using read-write data directory: /Users/***/Desktop/Spring/SpringRTS.app/data/
Using script GlobalAI test (KAI-0.22.dylib)
Map: SmallDivide.smf
Mod: "Expand and Exterminate v 0.173" from Expand_and_Exterminate_v_0.173.sd7
Loading step `Opening map file' took 0.185 seconds
Loading step `Creating surface normals' took 0.033 seconds
Loading step `Loading detail textures' took 0.09 seconds
Loading step `Creating overhead texture' took 0.01 seconds
Loading step `Creating ground shading' took 0.037 seconds
Loading step `Loading tile file' took 0.367 seconds
Loading step `Reading tiles' took 0.007 seconds
Loading step `Reading tile map' took 0.152 seconds
Number of damage types: 15
Loading step `Creating projectile texture' took 0.368 seconds
Loading step `Loading units and weapons' took 9.96 seconds
Loading step `Initializing map features' took 0.047 seconds
Loading step `Generating trees' took 0.732 seconds
Loading step `Parsing unit icons' took 0.04 seconds
Loading step `Creating unit textures' took 0.293 seconds
Loading step `Reading estimate path costs' took 0.028 seconds
Loading step `Reading estimate path costs' took 0.006 seconds
Spring 0.74b3+
Player joined as 0
/Users/***/Desktop/Spring/SpringRTS.app/data/AI/Bot-libs/KAI-0.22.dylib has C++ interface
AI has enabled cheating.
GlobalAI1: KAI Metal Class by Krogothe
GlobalAI1: Metal Spots loaded from file
GlobalAI1: Metal Spots Found 5000
GlobalAI1: UnitTable loaded in 0.005308s
GlobalAI1: UnitTable 2 loaded in 0.021394 sec
GlobalAI1: KAI v0.22 loaded!
GlobalAI1: Time Taken to create chokepoints: 0.030085
User exited
Path cache hits 0 0%
Path cache hits 0 0%[/code]
Last edited by Erom on 26 Mar 2007, 04:10, edited 1 time in total.
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

try turning LUAGui to 1 in the prefs file.
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

Doesn't fix it, but it does produce some more useful errors. Here's the relevant bit:

Code: Select all

Loading step `Creating unit textures' took 0.295 seconds
Loading step `Reading estimate path costs' took 0.027 seconds
Loading step `Reading estimate path costs' took 0.006 seconds
Spring 0.74b3+
Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
LuaUI: bound F11 to the widget selector
LuaUI: bound CTRL+F11 to tweak mode
LuaUI v0.2
error = 2, gui.lua, LuaUI/widgets.lua:460: attempt to call a table value
Player  joined as 0
/Users/***/Desktop/Spring/SpringRTS.app/data/AI/Bot-libs/KAI-0.22.dylib has C++ interface
AI has enabled cheating.
GlobalAI1: KAI Metal Class by Krogothe
GlobalAI1: Metal Spots loaded from file
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

replace widgets.lua with this.

Code: Select all

function pwl() -- ???  (print widget list)
  for k,v in ipairs(widgetHandler.widgets) do
    print(k, v.whInfo.layer, v.whInfo.name)
  end
end


include("keysym.h.lua")
include("utils.lua")
include("system.lua")
include("savetable.lua")
include("opengl.h.lua")


local gl = Spring.Draw

local ORDER_FILENAME     = LUAUI_DIRNAME .. 'Config/widget_order.lua'
local CONFIG_FILENAME    = LUAUI_DIRNAME .. 'Config/widget_data.lua'
local WIDGET_DIRNAME     = LUAUI_DIRNAME .. 'Widgets/'
local MOD_WIDGET_DIRNAME = MODUI_DIRNAME .. 'Widgets/'

local SELECTOR_BASENAME = 'selector.lua'


--------------------------------------------------------------------------------

-- install bindings for TweakMode and the Widget Selector

Spring.SendCommands({
  "unbindkeyset  Any+f11",
  "unbindkeyset Ctrl+f11",
  "bind    f11  luaui selector",
  "bind  C+f11  luaui tweakgui",
  "echo LuaUI: bound F11 to the widget selector",
  "echo LuaUI: bound CTRL+F11 to tweak mode"
})


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  the widgetHandler object
--

widgetHandler = {
  widgets = {},

  configData = {},
  orderList = {},

  knownWidgets = {},
  knownCount = 0,
  knownChanged = true,

  commands = {},

  mouseOwner = nil,
  ownedButton = 0,
  
  tweakMode = false,

  xViewSize    = 1,
  yViewSize    = 1,
  xViewSizeOld = 1,
  yViewSizeOld = 1,
}


-- these call-ins are set to 'nil' if not used

local flexCallIns = {
  'UnitCreated',
  'UnitFinished',
  'UnitFromFactory',
  'UnitDestroyed',
  'UnitTaken',
  'UnitGiven',
  'UnitEnteredRadar',
  'UnitEnteredLos',
  'UnitLeftRadar',
  'UnitLeftLos',
}

local callInLists = {
  'Shutdown',
  'Update',
  'TextCommand',
  'CommandNotify',
  'AddConsoleLine',
  'ViewResize',
  'DrawWorld',
  'DrawScreen',
  'KeyPress',
  'KeyRelease',
  'MousePress',
  'IsAbove',
  'GetTooltip',
  'GroupChanged',
  'CommandsChanged',
  'TweakMousePress',
  'TweakIsAbove',
  'TweakGetTooltip',

-- these use mouseOwner instead of lists
--  'MouseMove',
--  'MouseRelease',
--  'TweakKeyPress',
--  'TweakKeyRelease',
--  'TweakMouseMove',
--  'TweakMouseRelease',

-- uses the DrawScreenList
--  'TweakDrawScreen',
}

-- append the flex call-ins
for _,uci in ipairs(flexCallIns) do
  table.insert(callInLists, uci)
end


-- initialize the call-in lists
do
  for _,listname in ipairs(callInLists) do
    widgetHandler[listname..'List'] = {}
  end
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  Reverse integer iterator for drawing
--

local function rev_iter(t, key)
  if (key <= 1) then
    return nil
  else
    local nkey = key - 1
    return nkey, t[nkey]
  end
end

local function ripairs(t)
  return rev_iter, t, (1 + table.getn(t))
end


--------------------------------------------------------------------------------

function widgetHandler:LoadOrderList()
  local chunk, err = loadfile(ORDER_FILENAME)
  if (chunk == nil) then
    return {}
  else
    local tmp = {}
    setfenv(chunk, tmp)
    self.orderList = chunk()
  end
end


function widgetHandler:SaveOrderList()
  -- update the current order
  for i,w in pairs((self.widgets)) do
    self.orderList[w.whInfo.name] = i
  end
  table.save(self.orderList, ORDER_FILENAME,
             '-- Widget Order List  (0 disables a widget)')
end


--------------------------------------------------------------------------------

function widgetHandler:LoadConfigData()
  local chunk, err = loadfile(CONFIG_FILENAME)
  if (chunk == nil) then
    return {}
  else
    local tmp = {}
    setfenv(chunk, tmp)
    self.configData = chunk()
  end
end


function widgetHandler:SaveConfigData()
  self:LoadConfigData()
  for _,w in ipairs(self.widgets) do
    if (w.GetConfigData) then
      self.configData[w.whInfo.name] = w:GetConfigData()
    end
  end
  table.save(self.configData, CONFIG_FILENAME, '-- Widget Custom Data')
end


function widgetHandler:SendConfigData()
  self:LoadConfigData()
  for _,w in ipairs(self.widgets) do
    local data = self.configData[w.whInfo.name]
    if (w.SetConfigData and data) then
      w:SetConfigData(data)
    end
  end
end


--------------------------------------------------------------------------------

function widgetHandler:Initialize()
  self:LoadOrderList()
  self:LoadConfigData()
  
  local widgetFiles = Spring.GetDirList(WIDGET_DIRNAME, "*.lua")
  table.sort(widgetFiles)

  -- add mod widgets
--[[
  if (Spring.GetConfigInt("LuaUI", 1) > 1) then
    local modWidgetFiles = Spring.GetDirListVFS(MOD_WIDGET_DIRNAME)
    table.sort(modWidgetFiles)
    for _,fn in ipairs(modWidgetFiles) do
      if (string.find(fn, ".lua", -4, true)) then
        table.insert(widgetFiles, fn)
      end
    end
  end
--]]
  
  local unsortedWidgets = {}

  -- stuff the widgets into unsortedWidgets
  for k,wf in ipairs(widgetFiles) do
    local widget = self:LoadWidget(wf)
    if (widget) then
      table.insert(unsortedWidgets, widget)
    end
  end
  
  -- sort the widgets  
  table.sort(unsortedWidgets, function(w1, w2)
    local l1 = w1.whInfo.layer
    local l2 = w2.whInfo.layer
    if (l1 ~= l2) then
      return (l1 < l2)
    end
    local n1 = w1.whInfo.name
    local n2 = w2.whInfo.name
    local o1 = self.orderList[n1]
    local o2 = self.orderList[n2]
    if (o1 ~= o2) then
      return (o1 < o2)
    else
      return (n1 < n2)
    end
  end)

  -- add the widgets  
  for _,w in ipairs(unsortedWidgets) do
    widgetHandler:InsertWidget(w)

    local name = w.whInfo.name
    local basename = w.whInfo.basename
    print(string.format("Loaded widget:  %-18s  <%s>", name, basename))
  end

  -- save the active widgets, and their ordering
  self:SaveOrderList()
  self:SaveConfigData()
end


function widgetHandler:LoadWidget(filename)
  local basename = Basename(filename)
  local chunk, err = loadfile(filename)
  if (chunk == nil) then
    print('Failed to load: ' .. basename .. '  (' .. err .. ')')
    return nil
  end

  local widget = widgetHandler:NewWidget()

  -- special access for the widget selector
  if (basename == SELECTOR_BASENAME) then
    widget.widgetHandler = self
  end
  
  setfenv(chunk, widget)
  local success, err = pcall(chunk)
  if (not success) then
    print('Failed to load: ' .. basename .. '  (' .. err .. ')')
    return nil
  end

  self:FinalizeWidget(widget, filename, basename)
  local name = widget.whInfo.name
  if (basename == SELECTOR_BASENAME) then
    self.orderList[name] = 1  --  always enabled
  end

  err = self:ValidateWidget(widget)
  if (err) then
    print('Failed to load: ' .. basename .. '  (' .. err .. ')')
    return nil
  end

  local knownInfo = self.knownWidgets[name]
  if (knownInfo) then
    if (knownInfo.active) then
      print('Failed to load: ' .. basename .. '  (duplicate name)')
      return nil
    end
  else
    -- create a knownInfo table
    knownInfo = {}
    knownInfo.desc     = widget.whInfo.desc
    knownInfo.author   = widget.whInfo.author
    knownInfo.basename = widget.whInfo.basename
    knownInfo.filename = widget.whInfo.filename
    self.knownWidgets[name] = knownInfo
    self.knownCount = self.knownCount + 1
    self.knownChanged = true
  end
  knownInfo.active = true

  local info  = widget.GetInfo and widget:GetInfo()
  local order = self.orderList[name]
  if (((order ~= nil) and (order > 0)) or
      ((order == nil) and ((info == nil) or info.enabled))) then
    -- this will be an active widget
    if (order == nil) then
      self.orderList[name] = 12345  -- back of the pack
    else
      self.orderList[name] = order
    end
  else
    self.orderList[name] = 0
    self.knownWidgets[name].active = false
    return nil
  end

  -- load the config data  
  local config = self.configData[name]
  if (widget.SetConfigData and config) then
    widget:SetConfigData(config)
  end
    
  return widget
end


function widgetHandler:NewWidget()
  local widget = {}
  -- load the system calls into the widget table
  for k,v in pairs(System) do
    widget[k] = v
  end
  widget.widget = widget
  -- wrapped calls (closures)
  widget.widgetHandler = {}
  local wh = widget.widgetHandler
  local self = self
  widget.include  = function (f) include(f, widget) end
  wh.ForceLayout  = function (_) self:ForceLayout() end
  wh.RaiseWidget  = function (_) self:RaiseWidget(widget) end
  wh.LowerWidget  = function (_) self:LowerWidget(widget) end
  wh.RemoveWidget = function (_) self:RemoveWidget(widget) end
  wh.GetCommands  = function (_) return self.commands end
  wh.InTweakMode  = function (_) return self.tweakMode end
  wh.GetViewSizes = function (_) return self:GetViewSizes() end
  wh.GetHourTimer = function (_) return self:GetHourTimer() end
  wh.IsMouseOwner = function (_) return (self.mouseOwner == widget) end
  wh.DisownMouse  = function (_)
    if (self.mouseOwner == widget) then
      self.mouseOwner = nil
    end
  end
  wh.ConfigLayoutHandler = function(_, d) self:ConfigLayoutHandler(d) end
  return widget
end


function widgetHandler:FinalizeWidget(widget, filename, basename)
  local wi = {}

  wi.filename = filename
  wi.basename = basename
  if (widget.GetInfo == nil) then
    wi.name  = basename
    wi.layer = 0
  else
    local info = widget:GetInfo()
    wi.name      = info.name    or basename
    wi.layer     = info.layer   or 0
    wi.desc      = info.desc    or ""
    wi.author    = info.author  or ""
    wi.license   = info.license or ""
    wi.enabled   = info.enabled or false
  end

  widget.whInfo = {}  --  a proxy table
  local mt = {
    __index = wi,
    __newindex = function() error("whInfo tables are read-only") end,
    __metatable = "protected"
  }
  setmetatable(widget.whInfo, mt)
end


function widgetHandler:ValidateWidget(widget)
  if (widget.GetTooltip and not widget.IsAbove) then
    return "Widget has GetTooltip() but not IsAbove()"
  end
  if (widget.TweakGetTooltip and not widget.TweakIsAbove) then
    return "Widget has TweakGetTooltip() but not TweakIsAbove()"
  end
  return nil
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function widgetHandler:InsertWidget(widget)
  if (widget == nil) then
    return
  end
  local function Insert(t, f, w)
    if (f) then
      local layer = w.whInfo.layer
      local index = 1
      for i,v in ipairs(t) do
        if (v == w) then
          return -- already in the table
        end
        if (layer >= v.whInfo.layer) then
          index = i + 1
        end
      end
      table.insert(t, index, w)
    end
  end
  Insert(self.widgets, true, widget)
  for _,listname in pairs(callInLists) do
    Insert(self[listname..'List'], widget[listname], widget)
  end
  self:UpdateCallIns()
  if (widget.Initialize) then
    widget:Initialize()
  end
end


function widgetHandler:RemoveWidget(widget)
  if (widget == nil) then
    return
  end
  local name = widget.whInfo.name
  if (widget.GetConfigData) then
    self.configData[name] = widget:GetConfigData()
  end
  self.knownWidgets[name].active = false
  if (widget.Shutdown) then
    widget:Shutdown()
  end
  local function Remove(t, w)
    for k,v in ipairs(t) do
      if (v == w) then
        table.remove(t, k)
        -- break
      end
    end
  end
  Remove(self.widgets, widget)
  for _,listname in pairs(callInLists) do
    Remove(self[listname..'List'], widget)
  end
  self:UpdateCallIns()
end


function widgetHandler:UpdateCallIns()
  for _,name in ipairs(flexCallIns) do
    local listName = name .. 'List'
    if (table.getn(self[listName]) > 0) then
      local selffunc = self[name]
      _G[name] = function(...)
        return selffunc(self, unpack(arg))
      end
      print('UpdateCallIns() using '..name)
    else
      _G[name] = nil
      print('UpdateCallIns()  nil  '..name)
    end
  end
end


function widgetHandler:EnableWidget(name)
  local ki = self.knownWidgets[name]
  if (not ki) then
    Echo("EnableWidget(), could not find widget: " .. tostring(name))
    return
  end
  if (not ki.active) then
    print('Loading:  '..ki.filename)
    local order = widgetHandler.orderList[name]
    if (not order or (order <= 0)) then
      self.orderList[name] = 1
    end
    local w = self:LoadWidget(ki.filename)
    if (not w) then return -1 end
    self:InsertWidget(w)
    self:SaveOrderList()
  end
end
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

No joy.

Code: Select all

Spring 0.74b3+
Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
LuaUI: bound F11 to the widget selector
LuaUI: bound CTRL+F11 to tweak mode
LuaUI v0.2
error = 2, Call_LayoutButtons, LuaUI/layout.lua:62: attempt to call method 'CommandsChanged' (a nil value)
error = 2, Call_Shutdown, LuaUI/main.lua:189: attempt to call method 'Shutdown' (a nil value)
Player  joined as 0
PS- Thanks for the continued effort. You rock.
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

Code: Select all


function widgetHandler:DisableWidget(name)
  local ki = self.knownWidgets[name]
  if (not ki) then
    Echo("DisableWidget(), could not find widget: " .. tostring(name))
    return
  end
  if (ki.active) then
    local w = self:FindWidget(name)
    if (not w) then return -1 end
    print('Removed:  '..ki.filename)
    self:RemoveWidget(w)     -- deactivate
    self.orderList[name] = 0 -- disable
    self:SaveOrderList()
  end
end


function widgetHandler:ToggleWidget(name)
  local ki = self.knownWidgets[name]
  if (not ki) then
    Echo("ToggleWidget(), could not find widget: " .. tostring(name))
    return
  end
  if (ki.active) then
    self:DisableWidget(name)
  else
    self:EnableWidget(name)
  end
end


--------------------------------------------------------------------------------

local function FindWidgetIndex(t, w)
  for k,v in ipairs(t) do
    if (v == w) then
      return k
    end
  end
  return nil
end


local function FindLowestIndex(t, i, layer)
  for x = (i - 1), 1, -1 do
    if (t[x].whInfo.layer < layer) then
      return x + 1
    end
  end
  return 1
end


function widgetHandler:RaiseWidget(widget)
  if (widget == nil) then
    return
  end
  local function Raise(t, f, w)
    if (f == nil) then return end
    local i = FindWidgetIndex(t, w)
    if (i == nil) then return end
    local n = FindLowestIndex(t, i, w.whInfo.layer)
    if (n and (n < i)) then
      table.remove(t, i)
      table.insert(t, n, w)
    end
  end
  Raise(self.widgets, true, widget)
  for _,listname in pairs(callInLists) do
    Raise(self[listname..'List'], widget[listname], widget)
  end
end


local function FindHighestIndex(t, i, layer)
  local ts = table.getn(t)
  for x = (i + 1),ts do
    if (t[x].whInfo.layer > layer) then
      return (x - 1)
    end
  end
  return (ts + 1)
end


function widgetHandler:LowerWidget(widget)
  if (widget == nil) then
    return
  end
  local function Lower(t, f, w)
    if (f == nil) then return end
    local i = FindWidgetIndex(t, w)
    if (i == nil) then return end
    local n = FindHighestIndex(t, i, w.whInfo.layer)
    if (n and (n > i)) then
      table.insert(t, n, w)
      table.remove(t, i)
    end
  end
  Lower(self.widgets, true, widget)
  for _,listname in pairs(callInLists) do
    Lower(self[listname..'List'], widget[listname], widget)
  end
end


function widgetHandler:FindWidget(name)
  if (type(name) ~= 'string') then
    return nil
  end
  for k,v in ipairs(self.widgets) do
    if (name == v.whInfo.name) then
      return v,k
    end
  end
  return nil
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  Helper facilities
--

local hourTimer = 0


function widgetHandler:GetHourTimer()
  return hourTimer
end


function widgetHandler:GetViewSizes()
  return self.xViewSize, self.yViewSize
end


function widgetHandler:ForceLayout()
  forceLayout = true  --  in main.lua
end


function widgetHandler:ConfigLayoutHandler(data)
  ConfigLayoutHandler(data)
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  The call-in distribution routines
--

function widgetHandler:Shutdown()
  self:SaveOrderList()
  self:SaveConfigData()
  for _,w in ipairs(self.ShutdownList) do
    w:Shutdown()
  end
  return
end

function widgetHandler:Update()
  local deltaTime = Spring.GetLastUpdateSeconds()  
  -- update the hour timer
  hourTimer = math.mod(hourTimer + deltaTime, 3600.0)
  for _,w in ipairs(self.UpdateList) do
    w:Update(deltaTime)
  end
  return
end


function widgetHandler:ConfigureLayout(command)
  if (command == 'tweakgui') then
    self.tweakMode = true
    Echo("LuaUI TweakMode: ON")
    return true
  elseif (command == 'reconf') then
    self:SendConfigData()
    return true
  elseif (command == 'selector') then
    for _,w in ipairs(self.widgets) do
      if (w.whInfo.basename == SELECTOR_BASENAME) then
        return true  -- there can only be one
      end
    end
    local sw = self:LoadWidget(LUAUI_DIRNAME .. SELECTOR_BASENAME)
    self:InsertWidget(sw)
    self:RaiseWidget(sw)
    return true
  elseif (string.find(command, 'togglewidget') == 1) then
    self:ToggleWidget(string.sub(command, 14))
    return true
  elseif (string.find(command, 'enablewidget') == 1) then
    self:EnableWidget(string.sub(command, 14))
    return true
  elseif (string.find(command, 'disablewidget') == 1) then
    self:DisableWidget(string.sub(command, 15))
    return true
  end

  for _,w in ipairs(self.TextCommandList) do
    if (w:TextCommand(command)) then
      return true
    end
  end
  return false
end


function widgetHandler:CommandNotify(id, params, options)
  for _,w in ipairs(self.CommandNotifyList) do
    if (w:CommandNotify(id, params, options)) then
      return true
    end
  end
  return false
end


function widgetHandler:AddConsoleLine(msg, priority)
  for _,w in ipairs(self.AddConsoleLineList) do
    w:AddConsoleLine(msg, priority)
  end
  return
end


function widgetHandler:GroupChanged(groupID)
  for _,w in ipairs(self.GroupChangedList) do
    w:GroupChanged(groupID)
  end
  return
end


function widgetHandler:CommandsChanged()
  for _,w in ipairs(self.CommandsChangedList) do
    w:CommandsChanged()
  end
  return
end


--------------------------------------------------------------------------------
--
--  Drawing call-ins
--

-- generates ViewResize() calls for the widgets
function widgetHandler:SetViewSize(vsx, vsy)
  self.xViewSize = vsx
  self.yViewSize = vsy
  if ((self.xViewSizeOld ~= vsx) or
      (self.yViewSizeOld ~= vsy)) then
    widgetHandler:ViewResize(vsx, vsy)
    self.xViewSizeOld = vsx
    self.yViewSizeOld = vsy
  end
end


function widgetHandler:ViewResize(vsx, vsy)
  for _,w in ipairs(self.ViewResizeList) do
    w:ViewResize(vsx, vsy)
  end
  return
end


function widgetHandler:DrawWorldItems()
  for _,w in ripairs(self.DrawWorldList) do
    w:DrawWorld()
  end
  return
end


function widgetHandler:DrawScreenItems()
  if (self.tweakMode) then
    gl.Color(0, 0, 0, 0.5)
    local sx, sy = self.xViewSize, self.yViewSize
    gl.Shape(GL_QUADS, {
      {v = {  0,  0 }}, {v = { sx,  0 }}, {v = { sx, sy }}, {v = {  0, sy }}
    })
    gl.Color(1, 1, 1)
  end
  for _,w in ripairs(self.DrawScreenList) do
    w:DrawScreen()
    if (self.tweakMode and w.TweakDrawScreen) then
      w:TweakDrawScreen()
    end
  end
end


--------------------------------------------------------------------------------
--
--  Keyboard call-ins
--

function widgetHandler:KeyPress(key, mods, isRepeat)

  if (self.tweakMode) then
    local mo = self.mouseOwner
    if (mo and mo.TweakKeyPress) then
      mo:TweakKeyPress(key, mods, isRepeat)
    end
    return true
  end
  for _,w in ipairs(self.KeyPressList) do
    if (w:KeyPress(key, mods, isRepeat)) then
      return true
    end
  end
  return false
end


function widgetHandler:KeyRelease(key, mods)
  if (self.tweakMode) then
    local mo = self.mouseOwner
    if (mo and mo.TweakKeyRelease) then
      mo:TweakKeyRelease(key, mods)
    elseif (key == KEYSYMS.ESCAPE) then
      Echo("LuaUI TweakMode: OFF")
      self.tweakMode = false
    end
    return true
  end
  for _,w in ipairs(self.KeyReleaseList) do
    if (w:KeyRelease(key, mods)) then
      return true
    end
  end
  return false
end


--------------------------------------------------------------------------------
--
--  Mouse call-ins
--

-- local helper (not a real call-in)
function widgetHandler:WidgetAt(x, y)
  if (not self.tweakMode) then
    for _,w in ipairs(self.IsAboveList) do
      if (w:IsAbove(x, y)) then
        return w
      end
    end
  else
    for _,w in ipairs(self.TweakIsAboveList) do
      if (w:TweakIsAbove(x, y)) then
        return w
      end
    end
  end
  return nil
end


function widgetHandler:MousePress(x, y, button)
  local mo = self.mouseOwner
  if (not self.tweakMode) then
    for _,w in ipairs(self.MousePressList) do
      if (w:MousePress(x, y, button)) then
        self.mouseOwner = w
        return true
      end
    end
    return false
  else
    if (mo) then
      mo:TweakMousePress(x, y, button)
      return true  --  already have an active press
    end
    for _,w in ipairs(self.TweakMousePressList) do
      if (w:TweakMousePress(x, y, button)) then
        self.mouseOwner = w
        return true
      end
    end
    return true  --  always grab the mouse
  end
end


function widgetHandler:MouseMove(x, y, dx, dy, button)
  local mo = self.mouseOwner
  if (not self.tweakMode) then
    if (mo and mo.MouseMove) then
      return mo:MouseMove(x, y, dx, dy, button)
    end
  else
    if (mo and mo.TweakMouseMove) then
      mo:TweakMouseMove(x, y, dx, dy, button)
    end
    return true
  end
end


function widgetHandler:MouseRelease(x, y, button)
  local mo = self.mouseOwner
  self.mouseOwner = nil
  if (not self.tweakMode) then
    if (mo and mo.MouseRelease) then
      return mo:MouseRelease(x, y, button)
    end
    return -1
  else
    if (mo and mo.TweakMouseRelease) then
      mo:TweakMouseRelease(x, y, button)
    end
    return -1
  end
end


function widgetHandler:IsAbove(x, y)
  if (self.tweakMode) then
    return true
  end
  return (widgetHandler:WidgetAt(x, y) ~= nil)
end


function widgetHandler:GetTooltip(x, y)
  if (not self.tweakMode) then
    for _,w in ipairs(self.GetTooltipList) do
      if (w:IsAbove(x, y)) then
        local tip = w:GetTooltip(x, y)
        if (string.len(tip) > 0) then
          return tip
        end
      end
    end
    return ""
  else
    for _,w in ipairs(self.TweakGetTooltipList) do
      if (w:TweakIsAbove(x, y)) then
        local tip = w:TweakGetTooltip(x, y)
        if (string.len(tip) > 0) then
          return tip
        end
      end
    end
    return "Tweak Mode  --  hit ESCAPE to cancel"
  end
end


--------------------------------------------------------------------------------
--
--  Unit call-ins
--

function widgetHandler:UnitCreated(unitID, unitDefID, unitTeam)
  for _,w in ipairs(self.UnitCreatedList) do
    w:UnitCreated(unitID, unitDefID, unitTeam)
  end
  return
end


function widgetHandler:UnitFinished(unitID, unitDefID, unitTeam)
  for _,w in ipairs(self.UnitFinishedList) do
    w:UnitFinished(unitID, unitDefID, unitTeam)
  end
  return
end


function widgetHandler:UnitFromFactory(unitID, unitDefID, unitTeam,
                                       factID, factDefID, userOrders)
  for _,w in ipairs(self.UnitFromFactoryList) do
    w:UnitFromFactory(unitID, unitDefID, unitTeam,
                      factID, factDefID, userOrders)
  end
  return
end


function widgetHandler:UnitDestroyed(unitID, unitDefID, unitTeam)
  for _,w in ipairs(self.UnitDestroyedList) do
    w:UnitDestroyed(unitID, unitDefID, unitTeam)
  end
  return
end


function widgetHandler:UnitTaken(unitID, unitDefID, unitTeam, newTeam)
  for _,w in ipairs(self.UnitTakenList) do
    w:UnitTaken(unitID, unitDefID, unitTeam, newTeam)
  end
  return
end


function widgetHandler:UnitGiven(unitID, unitDefID, unitTeam, oldTeam)
  for _,w in ipairs(self.UnitGivenList) do
    w:UnitGiven(unitID, unitDefID, unitTeam, oldTeam)
  end
  return
end


function widgetHandler:UnitEnteredRadar(unitID, unitTeam)
  for _,w in ipairs(self.UnitEnteredRadarList) do
    w:UnitEnteredRadar(unitID, unitTeam)
  end
  return
end


function widgetHandler:UnitEnteredLos(unitID, unitDefID, unitTeam)
  for _,w in ipairs(self.UnitEnteredLosList) do
    w:UnitEnteredLos(unitID, unitDefID, unitTeam)
  end
  return
end


function widgetHandler:UnitLeftRadar(unitID, unitTeam)
  for _,w in ipairs(self.UnitLeftRadarList) do
    w:UnitLeftRadar(unitID, unitTeam)
  end
  return
end


function widgetHandler:UnitLeftLos(unitID, unitDefID, unitTeam)
  for _,w in ipairs(self.UnitLeftLosList) do
    w:UnitLeftLos(unitID, unitDefID, unitTeam)
  end
  return
end
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

that's all in the one file
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

Lua works now! Although the build pics still don't load. Screenshots to better explain included.

Infolog snip:

Code: Select all

Spring 0.74b3+
Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
LuaUI: bound F11 to the widget selector
LuaUI: bound CTRL+F11 to tweak mode
LuaUI v0.2
Player  joined as 0
Looks ok to me.

Screenshot: (The eyes widget loads!)
Image
Tested with more than one mod/map, ect. of course.
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

what mods have you tried?
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

EEv173 and Xtape. I tried Nanoblobs but that crashes to desktop as soon as the game loads.

Here's a weird thing, though - there is one buildpic that loads in xtape - the freedom fighter. IIRC that one image was hardcoded into the spring core once upon a time. Could the problem be due to some difference in the file paths inside the mod archives?

Also, AAI fails and returns the following error when I run it:

Code: Select all

AAI 0.761 running mod XTAPE.sd7
 
ERROR: loading starting units - could not find unit arm_commander
Mod config file arm_commander contains erroneous keyword core_commander
[/quote]
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

are you sure it's all patched right, those have all been know to run fine...
User avatar
desertlynx
Posts: 23
Joined: 26 Jul 2006, 09:46

Post by desertlynx »

I hate to tell you, but I'd have to say that the error's that Erom is getting is exactly the same as I have.

I've been rather busier than usual recently and hadn't had a chance to keep testing. But the problem Erom is having gave me an idea.
Because I have patched my spring copy several times over, probably completely destroyed the AI and made a general mess of things I was hesitant to point out a few issues I was having on the MacIntel.

I copied the SpringRTS directory from the Macintel (which was the latest version) and ran it on the PPC g5. the results were that the buildpic problem and the loadscreen issue that Erom describes did not occur.

Rather there was only the usual funny glitches from (I believed it was adjurned) the Nvidia card.
So, from my coding simpleton's perspective it looks like a ppc/intel processor related issue.


Apart from that, I'm sorry about your internet. Unfortunately the DSL I'm using at the moment is being shaped to 64k and I'm in the middle of a Churn. however, that'll be done soon and I'll be back up to the usual speed. let me know if there's anything I can do to help (because of geographical location, Northern NSW).

screenshot of startup issues
Image
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

That looks a lot like what I get too. Also, I've seen the bitmaps for the trees flash up there for a second, and the minimap symbols for the units. So I think it's just displaying all the images as it loads them or something.

Either way, it's not a huge deal. The only gameplay-affecting thing so far that I can find is the buildpicks. Which I discovered something new about:

Image

This is under Xtape, there are a few other images that load in the upper tech tree. From the looks of it, it looks like things that are modified from the OTA stuff load. (I do have the OTA stuff, so it isn't that that is missing).

On the other hand, nothing in EE loads and that has nothing to do with OTA...
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

I've looked at the file types in XTA to see why some work and some don't, and haven't found anything so far. DXT1 or DXT3 doesn't seem to matter. Neither does size, or compression (both 1:8 and 1:4 have examples that work and don't work).

I'll keep poking around, but I'm leaving on vacation tomorrow so it might be a while till I get back to this.

Edit: Yeah, I've been through the whole mod archive and I can't see any reason why those couple of pictures would work while most dont. I guess it's the lua stuff still then...
User avatar
elio
Posts: 133
Joined: 29 Dec 2006, 06:44

Post by elio »

Thanks both for your feedback.


I'll try step through the code to see if it's compiling oddly for intel, but it's very much identical, and calls apple core libs to decide if there's anything different (such as endian)

Maybe there's some minor corruption within how some of the files are compressed? Could be related to DevIL... Anyhow, I'll have a look and see if anything can be found.


Just as a note there a build I made sunday, probably still in transit to Melbourne that should be up soon. Not sure it'll address these issues, but it'll be up to date patch wise.

Again, thank you very much for your feedback, it's what helps!
Post Reply

Return to “Mac OS X”