Merge pull request #7 from mathiasbynens/memory

Name in-game time addresses
This commit is contained in:
kyle 2015-04-09 23:56:10 -07:00
commit c40f5900dc
3 changed files with 20 additions and 19 deletions

View File

@ -210,8 +210,8 @@ while true do
end
if STREAMING_MODE then
local newSecs = memory.raw(0x1A44)
if newSecs ~= oldSecs and (newSecs > 0 or memory.raw(0x1A45) > 0) then
local newSecs = memory.value("time", "seconds")
if newSecs ~= oldSecs and (newSecs > 0 or memory.value("time", "frames") > 0) then
bridge.time(utils.elapsedTime())
oldSecs = newSecs
end

View File

@ -41,10 +41,15 @@ local memoryNames = {
},
game = {
map = 0x135E,
frames = 0x1A45,
battle = 0x1057,
textbox = 0x0FC4,
},
time = {
hours = 0x1A41,
minutes = 0x1A43,
seconds = 0x1A44,
frames = 0x1A45,
},
shop = {
transaction_amount = 0x0F96,
},

View File

@ -67,9 +67,9 @@ end
-- TIME
function utils.igt()
local secs = memory.raw(0x1A44)
local mins = memory.raw(0x1A43)
local hours = memory.raw(0x1A41)
local secs = memory.value("time", "seconds")
local mins = memory.value("time", "minutes")
local hours = memory.value("time", "hours")
return secs + mins * 60 + hours * 3600
end
@ -93,22 +93,18 @@ function utils.timeSince(prevTime)
end
function utils.elapsedTime()
local secs = memory.raw(0x1A44)
if secs < 10 then
secs = "0"..secs
end
local mins = memory.raw(0x1A43)
if mins < 10 then
mins = "0"..mins
end
return memory.raw(0x1A41)..":"..mins..":"..secs
local secs = memory.value("time", "seconds")
local mins = memory.value("time", "minutes")
local hours = memory.value("time", "hours")
return hours..":"..clockSegment(mins)..":"..clockSegment(secs)
end
function utils.frames()
local totalFrames = memory.raw(0x1A41) * 60
totalFrames = (totalFrames + memory.raw(0x1A43)) * 60
totalFrames = (totalFrames + memory.raw(0x1A44)) * 60
return totalFrames + memory.raw(0x1A45)
local totalFrames = memory.value("time", "hours") * 60
totalFrames = (totalFrames + memory.value("time", "minutes")) * 60
totalFrames = (totalFrames + memory.value("time", "seconds")) * 60
totalFrames = totalFrames + memory.value("time", "frames")
return totalFrames
end
return utils