authorblues/bizhawk-shuffler-2

checkversion can return incorrect results on future versions

kalimag opened this issue · 0 comments

The checkversion method returns false if any component of the current version is lower than the required version. That means 2.7.0 is considered lower than 2.6.1, because 0 < 1.

Currently the only effect is that the INCOMPATIBLE_BIZHAWK_VERSION check does not warn about 2.7 incompatibility and a confusing/misleading warning about upgrading to MIN_BIZHAWK_VERSION is shown instead.

function checkversion(reqversion)
-- nil string means no requirements, so of course true
if reqversion == nil then return true end
local curr, reqd = {}, {}
for x in string.gmatch(client.getversion(), "%d+") do
table.insert(curr, tonumber(x))
end
for x in string.gmatch(reqversion, "%d+") do
table.insert(reqd, tonumber(x))
end
while #curr < #reqd do table.insert(curr, 0) end
for i=1,#reqd do
if curr[i]<reqd[i] then
return false
end
end
return true
end

Environment:

  • Bizhawk Version: 2.7