-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.lua
48 lines (43 loc) · 1.53 KB
/
start.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
local paths = require('configuration/paths')
local play = require(paths['configuration']['play'])
-- ## ### ### ### ### ##
-- ## Check category ##
-- ## ### ### ### ### ##
local currentCategory = play['currentCategory']
if not currentCategory then
console.clear()
console.log('>>> The value of "currentCategory" has to be set in "configuration/play.lua" <<<')
end
-- ## ### ### ### ### ### ### ##
-- ## Load a savestate (file) ##
-- ## ### ### ### ### ### ### ##
local savestates = require(paths['configuration']['savestate'])
if savestates[currentCategory] ~= nil then
savestate.load(table.concat({ paths['folder']['savestate'], savestates[currentCategory] }, '/'))
end
-- ## ### ### ### ### ### ### ##
-- ## Load a savestate (slot) ##
-- ## ### ### ### ### ### ### ##
local loadSlot = play['loadSlot']
if loadSlot ~= nil then
savestate.loadslot(loadSlot)
end
-- ## ### ### ### ### ### ### ##
-- ## Configure subscribers ##
-- ## ### ### ### ### ### ### ##
local subscriberBizHawk = require(paths['subscriber']['bizhawk']).subscribe()
local subscriberOverlay = require(paths['subscriber']['overlay']).subscribe()
local subscriberScreenshot = require(paths['subscriber']['screenshot']).subscribe()
local pubSub = require('mediator')()
pubSub:subscribe({ 'frame.current' }, function(fc)
subscriberOverlay(fc)
subscriberScreenshot(fc)
subscriberBizHawk(fc)
end)
-- ## ### ### ### ### ##
-- ## Infinite loop ##
-- ## ### ### ### ### ##
while true do
pubSub:publish({ 'frame.current' }, emu.framecount())
emu.frameadvance()
end