forked from rodamaral/smw-tas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmw-tas.lua
34 lines (24 loc) · 990 Bytes
/
smw-tas.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local SCRIPTS_FOLDER
local ERROR_MESSAGE = "Your emulator is not supported"
if lsnes_features then -- lsnes emulator
SCRIPTS_FOLDER = "lsnes/scripts/"
-- run just one instance of smw-tas per Lua VM
assert(not SMW_TAS_RUNNING, "smw-tas is already running!\n" ..
"You can reset all the Lua Virtual Machine at Tools > Reset Lua VM")
SMW_TAS_RUNNING = true
local LUA_SCRIPT_FILENAME = load([==[return @@LUA_SCRIPT_FILENAME@@]==])()
GLOBAL_SMW_TAS_PARENT_DIR = LUA_SCRIPT_FILENAME:match("(.+)[/\\][^/\\+]") .. "/"
local file = assert(loadfile(GLOBAL_SMW_TAS_PARENT_DIR ..
SCRIPTS_FOLDER .. "smw-lsnes.lua"))
file()
elseif bizstring then -- BizHawk emulator
SCRIPTS_FOLDER = "bizhawk/scripts/"
local file = assert(loadfile(SCRIPTS_FOLDER .. "smw-bizhawk.lua"))
file()
elseif snes9x then -- Snes9x-rr emulator
SCRIPTS_FOLDER = "snes9x/scripts/"
local file = assert(loadfile(SCRIPTS_FOLDER .. "smw-snes9x.lua"))
file()
else
print(ERROR_MESSAGE)
end