Skip to content

Commit

Permalink
Fixed brawl causing a blue error screen on game load.
Browse files Browse the repository at this point in the history
Fix a regression where multiple addresses assigned to the same name would always use the last assigned addresses value. (Caused low polling rates in Brawl)
Bump version to 1.6.1
  • Loading branch information
bkacjios committed Nov 25, 2020
1 parent 76a21e5 commit ca17fdb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion release.iss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

[Setup]
#define AppName "M'Overlay"
#define AppVersion "1.6.0"
#define AppVersion "1.6.1"
AppName={#AppName}
AppId={#AppName}
AppVersion={#AppVersion}
Expand Down
15 changes: 10 additions & 5 deletions source/modules/memory/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ local TYPES_READ = {
["sbyte"] = memory.readByte,
["byte"] = memory.readUByte,
["short"] = memory.readShort,
["int"] = memory.readInt,

["u8"] = memory.readUByte,
["s8"] = memory.readByte,
Expand Down Expand Up @@ -225,12 +226,14 @@ function memory.newvalue(addr, offset, struct, name)
assert(type(addr) == "number", "argument #1 'address' must be a number")
assert(TYPES_READ[struct.type] ~= nil, "unhandled type: " .. struct.type)

name = name or struct.name or ""
name = name or struct.name or addr

local init = struct.init or NULL

-- create/get a new value cache based off of the value name
local tbl, key = memory.cacheValue(memory.values, name, struct.init or NULL)
local tbl, key = memory.cacheValue(memory.values, name, init)

--log.debug("[MEMORY] VALUE CREATED %08X + %X %q", addr, offset, name)
log.debug("[MEMORY] VALUE CREATED %08X + %X %q", addr, offset, name)

return setmetatable({
name = name,
Expand All @@ -244,6 +247,7 @@ function memory.newvalue(addr, offset, struct, name)
-- Setup the cache
cache = tbl,
cache_key = key,
cache_value = init,

debug = struct.debug,
}, ADDRESS)
Expand All @@ -257,8 +261,9 @@ function ADDRESS:update()
local value, orig = self.read(self.address + self.offset)

-- Check if there has been a value change
if self.cache[self.cache_key] ~= value then
self.cache[self.cache_key] = value
if self.cache_value ~= value then
self.cache_value = value
self.cache[self.cache_key] = self.cache_value

if self.debug then
local numValue = tonumber(orig) or tonumber(value) or (value and 1 or 0)
Expand Down

0 comments on commit ca17fdb

Please sign in to comment.