Attempt to fix some Windows issues
This commit is contained in:
parent
75ae2d8ae7
commit
ae28a6110b
4 changed files with 27 additions and 8 deletions
|
@ -16,7 +16,7 @@ See [YouTube](https://www.youtube.com/watch?v=Q69_wmEkp-k) for an example run.
|
|||
3. Load the DKC2 ROM: `File -> Load -> ROM...`
|
||||
4. Load the `neat-donk.lua` script: `Tools -> Run Lua script...`
|
||||
5. You may also want to turn off sound since it may get annoying. `Configure -> Sounds enabled`
|
||||
6. Look at config.lua for some settings you can change. Not all have been tested, but you should be able to change the number on the `_M.Filename =` line to get a different state file from the `_M.State` list. Also note the `Threads =` line. Change this to 1 to prevent multiple instances of lsnes from getting launched at once. If you use more than 1 thread, you may also want to launch `lsnes` using xpra to manage the windows, with the `xpra-run.sh` script.
|
||||
6. Look at config.lua for some settings you can change. Not all have been tested, but you should be able to change the number on the `_M.Filename =` line to get a different state file from the `_M.State` list. Also note the `Threads =` line. Change this to 1 to prevent multiple instances of lsnes from getting launched at once. If you use more than 1 thread, you may also want to launch `lsnes` using xpra to manage the windows, with the `xpra-run.sh` script. Currently Windows does not support multiple threads.
|
||||
|
||||
If you want a better idea of what's going on with the tile and sprite calculations you may want to load `donkutil.lua`. It will mark the tiles with their offsets on the screen, give a crosshair with tile measurements (every 32 pixels), and list information about the sprites (you can use the 1 and 2 keys above the letter keys to page through them). Sprites labeled in green are considered "good", red is "bad", normal color is neutral. Solid red means that it's the active sprite in the info viewer.
|
||||
|
||||
|
|
14
pool.lua
14
pool.lua
|
@ -1,16 +1,18 @@
|
|||
local base = string.gsub(@@LUA_SCRIPT_FILENAME@@, "(.*[/\\])(.*)", "%1")
|
||||
|
||||
local config = dofile(base.."/config.lua")
|
||||
local util = dofile(base.."/util.lua")
|
||||
local serpent = dofile(base.."/serpent.lua")
|
||||
local libDeflate = dofile(base.."/LibDeflate.lua")
|
||||
|
||||
local hasThreads = not util.isWin and config.NeatConfig.Threads > 1
|
||||
local Runner = nil
|
||||
if config.NeatConfig.Threads > 1 then
|
||||
if hasThreads then
|
||||
Runner = dofile(base.."/runner-wrapper.lua")
|
||||
else
|
||||
Runner = dofile(base.."/runner.lua")
|
||||
end
|
||||
|
||||
local serpent = dofile(base.."/serpent.lua")
|
||||
local libDeflate = dofile(base.."/LibDeflate.lua")
|
||||
|
||||
local Inputs = config.InputSize+1
|
||||
local Outputs = #config.ButtonNames
|
||||
|
||||
|
@ -683,7 +685,7 @@ local function mainLoop(currentSpecies)
|
|||
end
|
||||
|
||||
local slice = pool.species[currentSpecies]
|
||||
if config.NeatConfig.Threads > 1 then
|
||||
if hasThreads then
|
||||
slice = {}
|
||||
for i=currentSpecies, currentSpecies + config.NeatConfig.Threads - 1, 1 do
|
||||
if pool.species[i] == nil then
|
||||
|
@ -701,7 +703,7 @@ local function mainLoop(currentSpecies)
|
|||
-- Genome callback
|
||||
end,
|
||||
function()
|
||||
if config.NeatConfig.Threads > 1 then
|
||||
if hasThreads then
|
||||
finished = finished + 1
|
||||
if finished ~= #slice then
|
||||
return
|
||||
|
|
|
@ -116,9 +116,16 @@ return function()
|
|||
|
||||
message(_M, hostProcess)
|
||||
|
||||
local settingsDir = nil
|
||||
if isWin then
|
||||
settingsDir = tempDir.."/donk_runner_settings_"..i
|
||||
util.mkdir(settingsDir)
|
||||
end
|
||||
|
||||
local envs = {
|
||||
RUNNER_INPUT_FILE = inputFileName,
|
||||
RUNNER_OUTPUT_FILE = outputFileName,
|
||||
APPDATA = settingsDir,
|
||||
}
|
||||
|
||||
local waiter = util.waitForChange(outputFileName)
|
||||
|
@ -136,7 +143,7 @@ return function()
|
|||
table.insert(waiters, outputPrefix..i)
|
||||
end
|
||||
|
||||
local waiter = util.waitForChange(waiters, nil, tmpFileName.."output_*")
|
||||
local waiter = util.waitForChange(waiters, nil, tmpFileName.."_output_*")
|
||||
|
||||
message(_M, 'Setting up child processes')
|
||||
|
||||
|
|
10
util.lua
10
util.lua
|
@ -42,6 +42,16 @@ function _M.doCmd(...)
|
|||
return _M.scrapeCmd('*a', ...)
|
||||
end
|
||||
|
||||
--- Create a directory
|
||||
--- @return string dir The directory to create
|
||||
function _M.mkdir(dir)
|
||||
if _M.isWin then
|
||||
return _M.doCmd('if not exist "'..dir..'" mkdir "'..dir..'"')
|
||||
else
|
||||
return _M.doCmd("mkdir '"..dir.."'")
|
||||
end
|
||||
end
|
||||
|
||||
--- Run a command and get the output
|
||||
--- @param formats table|string|number List or single io.read() specifier
|
||||
--- @return table table List of results based on read specifiers
|
||||
|
|
Loading…
Add table
Reference in a new issue