For DualGambatte, it's the same principle. Controller 1 is the first game boy, and Controller 2 is the second.
E: Just tested, DualGambatte only recognizes the first two games in the XML generated by the Multi Disk Bundler. So really there's no reason to have max be anything higher than 20.
Though now I want to see how this behaves with the Apple][.
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
As far as I am aware, the most disks that the Apple II used, is eight. The most I think ANY game could use, in theory, is Monster Rancher. As it allows, in theory, infinite Discs.
When TAS does Quake 1, SDA will declare war.
The Prince doth arrive he doth please.
Joined: 11/13/2006
Posts: 2823
Location: Northern California
http://pastebin.com/0xR8kVkH
I don't know how specific this script is to Aria of Sorrow, but it was written years ago for VBA and I'm having serious trouble converting it to LuaHawk. Could someone point me in the right direction or, maybe, if you'll be so kind,try converting it for me because I have no clue what I'm doing?
EDIT: http://pastebin.com/wKHX37Zn <--- Thanks Anty-Lemon <3
TASvideos Admin and acting Senior Judge 💙 Currently unable to dedicate a lot of time to the site, taking care of family.
Now infrequently posting on Bluesky
Iirc Bizhawk's default memory domain is WRAM, which starts at 0x02000000. Though that script in particular accesses ROM, so a simple subtraction doesn't work
while the script is running and I manually change the screen size? It seems to only takes the value when I run the script, rather than inside the loop every frame.
Are you sure this code is inside the loop? I use something similar and it definitely is updated every frame (and can be updated even when the emulator is paused).
memory.usememorydomain("EWRAM")
gui.DrawNew("native")
client.setwindowsize(2) --Sets size so that everything fits
client.SetGameExtraPadding(0, 0, 0, 20)
local peppermints = 0x3DE9 --6%+ total
local bottles = 0x3E11 --3% total
local brassHeart = 0x3E13 --6% total
local events = 0x3EA2 --17% total
local candyBox = 0x4730 --1% total
local keyItems = 0x4731 --11% total
local toys = 0x4732 --12% total
local toys2 = 0x4733 -- 10% total
local waterguns = 0x4734 --16% total
local gear = 0x4735 --12% total + 3% at gear+1
local characters = {'DJ','Chowder','Jenny'}
local water = {0x37D0,0x37D2,0x37D4} --Water supply
local water2 = {0x3DF6,0x3DF8,0x3DFA} --Water capacity; only updates when gun is upgrade via chest
--Checks the bit of 'mem' at position 'pos' and returns 'value' if it's 1
function addFlags(mem,pos,value)
if bit.check(mem,pos) then return value
else return 0 end
end
function percent()
local percent = 0
--Checks if the player has the peppermints
percent = memory.read_s8(peppermints) + percent
--Check if the player has all 3 bottles (1% each)
percent = addFlags(memory.read_s8(bottles),0,1) + percent --All Bottles are 1%
percent = addFlags(memory.read_s8(bottles),1,2) + percent --But getting the 2nd bottle makes the value for the above 0
--Check if the player has a brass heart (2% each)
percent = memory.read_s8(brassHeart) * 2 + percent
--Check if the player has the Candy box (1%)
percent = addFlags(memory.read_s8(candyBox),1,1) + percent
--Checks if the player has the following: Fuse (3%), Dynamite (3%), Elevator Gear (3%), Walkie-Talkie (1%), Flashlight (1%)
percent = addFlags(memory.read_s8(keyItems),3,1) + percent --Flashlight
percent = addFlags(memory.read_s8(keyItems),4,1) + percent --Walkie-Talkie
percent = addFlags(memory.read_s8(keyItems),5,3) + percent --Elevator Gear
percent = addFlags(memory.read_s8(keyItems),6,3) + percent --Dynamite
percent = addFlags(memory.read_s8(keyItems),7,3) + percent --Fuse
--Checks if the player has the following: Rover's bone (2%), RC Car (2%), Chicken doll (2%), Boomerang (2%), Chowder's basketball (2%), Skull's action figure (2%)
percent = addFlags(memory.read_s8(toys),2,2) + percent --Skull's action figure
percent = addFlags(memory.read_s8(toys),3,2) + percent --Chowder's basketball
percent = addFlags(memory.read_s8(toys),4,2) + percent --Boomerang
percent = addFlags(memory.read_s8(toys),5,2) + percent --Chicken doll
percent = addFlags(memory.read_s8(toys),6,2) + percent --RC Car
percent = addFlags(memory.read_s8(toys),7,2) + percent --Rover's bone
--Checks if the player has the following: Watergun ugrade (DJ 1, 1%), ?? (1%), Wendy the Dancing Walrus doll (1%), Jenny's wagon (2%), Tricycle (2%), Penguin doll (2%), Bone's kite (2%)
percent = addFlags(memory.read_s8(toys2),0,2) + percent --Bone's kite
percent = addFlags(memory.read_s8(toys2),1,2) + percent --Penguin doll
percent = addFlags(memory.read_s8(toys2),2,2) + percent --Tricycle
percent = addFlags(memory.read_s8(toys2),3,2) + percent --Jenny's wagon
percent = addFlags(memory.read_s8(toys2),4,1) + percent --Wendy the Dancing Walrus doll
percent = addFlags(memory.read_s8(toys2),5,0) + percent --Doombringer unlocked; placeholder for this script
percent = addFlags(memory.read_s8(toys2),7,1) + percent --Watergun upgrade for DJ
--Checks if the player has the following: Watergun ugrade (Jenny 1, 2%), Watergun ugrade (Jenny 2, 2%), Watergun ugrade (Jenny 3, 2%), Watergun upgrade (Chowder 1, 2%), Watergun upgrade (Chowder 2, 2%), Watergun upgrade (Chowder 3, 2%), Watergun ugrade (DJ 2, 2%), Watergun ugrade (DJ 3, 2%)
percent = addFlags(memory.read_s8(waterguns),0,2) + percent --Watergun upgrade for DJ
percent = addFlags(memory.read_s8(waterguns),1,2) + percent --Watergun upgrade for DJ
percent = addFlags(memory.read_s8(waterguns),2,2) + percent --Watergun upgrade for Chowder
percent = addFlags(memory.read_s8(waterguns),3,2) + percent --Watergun upgrade for Chowder
percent = addFlags(memory.read_s8(waterguns),4,2) + percent --Watergun upgrade for Chowder
percent = addFlags(memory.read_s8(waterguns),5,2) + percent --Watergun upgrade for Jenny
percent = addFlags(memory.read_s8(waterguns),6,2) + percent --Watergun upgrade for Jenny
percent = addFlags(memory.read_s8(waterguns),7,2) + percent --Watergun upgrade for Jenny
--Checks if the player has the following: Trash can (1%), Slingshot upgrade (3%), Slingshot (1%), Cold Syrup (1%), Water balloon upgrade (3%), Water balloon (1%), Brass Key (1%)
percent = addFlags(memory.read_s8(gear),0,1) + percent --Camera
percent = addFlags(memory.read_s8(gear),1,1) + percent --Brass Key
percent = addFlags(memory.read_s8(gear),2,1) + percent --Water balloon
percent = addFlags(memory.read_s8(gear),3,3) + percent --Water balloon upgrade
percent = addFlags(memory.read_s8(gear),4,1) + percent --Cold Syrup
percent = addFlags(memory.read_s8(gear),5,1) + percent --Slingshot
percent = addFlags(memory.read_s8(gear),6,3) + percent --Slingshot upgrade
percent = addFlags(memory.read_s8(gear),7,1) + percent --Trash Can
percent = addFlags(memory.read_s8(gear+1),0,3) + percent --Camera upgrade
--Checks the story events done
if memory.read_s8(events) > 14 then percent = percent + 1 end
if memory.read_s8(events) > 18 then percent = percent + 1 end
if memory.read_s8(events) > 24 then percent = percent + 1 end
if memory.read_s8(events) > 30 then percent = percent + 2 end
if memory.read_s8(events) > 32 then percent = percent + 1 end
if memory.read_s8(events) > 37 then percent = percent + 2 end
if memory.read_s8(events) > 41 then percent = percent + 1 end
if memory.read_s8(events) > 45 then percent = percent + 1 end
if memory.read_s8(events) > 50 then percent = percent + 2 end
if memory.read_s8(events) > 54 then percent = percent + 3 end
if memory.read_s8(events) > 57 then percent = percent + 1 end
if memory.read_s8(events) > 62 then percent = percent + 1 end
gui.text(0, client.screenheight()-42, 'Percent: '..percent)
end
function miscflags()
local y = client.screenheight()-10
gui.text(0, y-18, 'Flags: ')
--Checks if the player has obtained the Camera flash at least once
if bit.check(memory.read_s8(candyBox),7) then gui.drawRectangle(0, y, 4, 10, 'WHITE', 'WHITE') end
--Checks if the player has obtained candy at least once
if bit.check(memory.read_s8(candyBox),2) then gui.drawRectangle(5, y, 4, 10, 'RED', 'RED') end
--Checks if the player has obtained soda at least once
if bit.check(memory.read_s8(candyBox),3) then gui.drawRectangle(10, y, 4, 10, 'GREEN', 'GREEN') end
--Checks if the player has obtained marbles at least once
if bit.check(memory.read_s8(candyBox),6) then gui.drawRectangle(15, y, 4, 10, 'BLUE', 'BLUE') end
--Checks if the player has obtained water at least once
if bit.check(memory.read_s8(keyItems),0) then gui.drawRectangle(20, y, 4, 10, 'AQUA', 'AQUA') end
--Checks if the player has obtained water bottle at least once
if bit.check(memory.read_s8(gear+1),1) then gui.drawRectangle(25, y, 4, 10, 'DARKCYAN', 'DARKCYAN') end
--Checks if the player has unlocked the Toys tab
if bit.check(memory.read_s8(keyItems),2) then gui.drawRectangle(30, y, 4, 10, 'DARKKHAKI', 'DARKKHAKI') end
end
function displaypos()
local x = (memory.read_u32_le(0xF9D8)+30720)/65536.0 --Adds 30720 for actual X
local y = (memory.read_u32_le(0xF9DC)+20480)/65536.0 --Adds 20480 for actual Y
gui.text(0, 60, 'X: '..string.format('%.5f',x) ..' Y: '..string.format('%.5f',y))
local char = memory.read_s8(0x3DE8)
if char < 3 then -- just in case
local supply = memory.read_s16_le(water[char+1]) --Char uses 0,1,2 but lua arrays are 1,2,3
local capacity = memory.read_s16_le(water2[char+1])
gui.text(0, 75, characters[char+1]..'('..supply..'/'..capacity..')')
end
end
while true do
percent()
miscflags()
displaypos()
emu.frameadvance()
end
At function "miscflags", for some odd reason, not only is "y" not updating, but the rectangles don't update. If I changed it to text (for example:)
function miscflags()
local y = client.screenheight()-10
gui.text(0, y-18, 'Flags: ')
--Checks if the player has obtained the Camera flash at least once
if bit.check(memory.read_s8(candyBox),7) then gui.text(0,0,'TESTING') end
--Checks if the player has obtained candy at least once
if bit.check(memory.read_s8(candyBox),2) then gui.drawRectangle(5, y, 4, 10, 'RED', 'RED') end
--Checks if the player has obtained soda at least once
if bit.check(memory.read_s8(candyBox),3) then gui.drawRectangle(10, y, 4, 10, 'GREEN', 'GREEN') end
--Checks if the player has obtained marbles at least once
if bit.check(memory.read_s8(candyBox),6) then gui.drawRectangle(15, y, 4, 10, 'BLUE', 'BLUE') end
--Checks if the player has obtained water at least once
if bit.check(memory.read_s8(keyItems),0) then gui.drawRectangle(20, y, 4, 10, 'AQUA', 'AQUA') end
--Checks if the player has obtained water bottle at least once
if bit.check(memory.read_s8(gear+1),1) then gui.drawRectangle(25, y, 4, 10, 'DARKCYAN', 'DARKCYAN') end
--Checks if the player has unlocked the Toys tab
if bit.check(memory.read_s8(keyItems),2) then gui.drawRectangle(30, y, 4, 10, 'DARKKHAKI', 'DARKKHAKI') end
end
gui.text(0,0,'TESTING') actually works, but the rectangles still won't update, nor will y.
Edit: Stopping the script clears the text, but not the rectangles. Is that intended?
You're using GBA core, alright? I'm testing on it and the position of the text is indeed changing if I resize the window. This script shows the actual value changing.
Language: lua
while true do
local height =client.screenheight()
gui.text(10, 40, height)
emu.frameadvance()
end
However, the functions that use the native surface (all but gui.text) don't care about the screen size, but about the buffer size: client.bufferheight() and client.bufferwidth().
You should probably be aware of those two issues[1, 2], that were only fixed after the latest release.
Joined: 4/17/2010
Posts: 11495
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
Hint:
Language: lua
--== Shortcuts ==--
local rb = memory.read_u8
local rw = memory.read_u16_be
local rws = memory.read_s16_be
local rl = memory.read_u32_be
local box = gui.drawBox
local text = gui.drawText
local line = gui.drawLine
local AND = bit.band
local SHIFT= bit.lshift
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 4/17/2010
Posts: 11495
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
Whatever. That was just the particular one I needed in that particular script. And it is basically an example.
I used it to make Gens code compatible, but its (and fceux') library uses SHIFT() with positive and negative values, while bizhawk's one uses 2 different functions.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Sorry for asking, but when I try something like
gui.text(0, 30, '\226\131\151')
but it gives me â and uses only \226. How would I make it use the arrow?
Using
gui.text(0, 30, '\20D7')
gui.text(0, 30, '\8407')
or
gui.text(0, 30, '\\u20D7')
doesn't seem to work.
Joined: 4/17/2010
Posts: 11495
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
gui.text uses a bitmap font, and there's a limited amount of characters that the generator used for it supports for Currier.
http://www.angelcode.com/products/bmfont/
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Lua escapes "\ddd" sequences byte by byte (see llex.c in the lua source for reference), however, you can simply do gui.text(0, 30, "⃗") in Lua (yes, the arrow is in there).
Anyways, feos already mentioned why it still wouldn't work in Bizhawk.
Additional information:
Bizhawk still uses Lua 5.1, however, since Lua 5.3 you can either escape a UTF-8 character by using "\u{20D7}" or you can use utf8.char(0x20D7).
Warning: Might glitch to creditsI will finish this ACE soon as possible
(or will I?)
Resource file is commented out as I'm not confident in requiring it yet. Issue I'm having is the script isn't drawing either way. It's intended for use with Pokemon Red, Blue, and Yellow. It's not throwing any errors, though, so I'm not sure how to trace what's going wrong here.
E: I think I figured it out - I was displaying white text on a white background >.<
E2: Oh joy things breaking because overly sensitive laptop touchpad. I need another pair of eyes, it's still not drawing.
Language: lua
--require res/RBY-Arrays.lua
domain = "System Bus"
repoint = 0
foeCR = 0
foeMV = {}
foeML = {}
inBattle = false
function initPointers()
game = memory.readbyte(0x013C)
if game == 0x59 then
repoint = 1
end
foeHP = 0xCFE7 - repoint
foeCR = 0xD007 - repoint
foeMV = {0xCFED - repoint, 0xCFEE - repoint, 0xCFEF - repoint, 0xCFF0 - repoint}
foeML = {"Dummy","Dummy","Dummy","Dummy"}
end
function isInBattle()
result = false
pointer = 0xD057 - repoint
test = memory.read_u8(pointer)
if test ~= 0 then
result = true
end
return result
end
function isNotTrainer()
result = true
pointer = 0xD057 - repoint
test = memory.read_u8(pointer)
if test > 1 then
result = false
end
return result
end
function drawCatch(value)
x = 20
y = 10
gui.drawText(x,y,value,"Green","Green")
end
function drawLife(value)
x = 20
y = 25
gui.drawText(x,y,value,"Red","Red")
end
function drawMoveset()
x = 50
base_y = 40
for i=1,4 do
new_Y = base_y + (15 * (i - 1))
text = foeML[i]
gui.drawText(x,new_Y,text,"Blue","Blue")
end
end
function updateCatchRate()
numerator = memory.read_u8(foeCR)
percentage = math.floor((numerator / 256) * 100)
drawCatch(percentage)
end
function updateStats()
value = memory.read_s16_le(foeHP)
drawLife(value)
end
function updateMoveset()
for i=1,4 do
index = memory.readbyte(foeMV[i])
foeML[i] = index
-- foeML[i] = moveList[index]
end
drawMoveset()
end
function core()
if (isInBattle()==true) then
if (isNotTrainer()==true) then
updateCatchRate()
end
updateStats()
updateMoveset()
else
gui.clearGraphics()
end
end
gui.DrawNew("native")
memory.usememorydomain(domain)
initPointers()
while true do
core()
emu.frameadvance()
end
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
meanwhile gui.foo is still being a butt for me, so as a workaround I'm using a form to show the data...
Eeeeexcept it doesn't update on the fly - leaving form commands within the main loop led to major slowdown which is bad for my purposes. On the plus side, I'm learning how to forms.
Language: lua
require "RBY-Arrays.lua"
infobox = forms.newform(360,360,"Pokegear Version 1")
forms.button(infobox,"Update Values",core,250,250)
domain = "System Bus"
repoint = 0
foeCR = 0
foeMV = {}
foeML = {}
mapID = 0
inBattle = false
foeHP = 0
function initPointers()
game = memory.readbyte(0x013C)
if game == 0x59 then
repoint = 1
end
foeHP = 0xCFE7 - repoint
foeCR = 0xD007 - repoint
foeMV = {0xCFED - repoint, 0xCFEE - repoint, 0xCFEF - repoint, 0xCFF0 - repoint}
foeML = {"Dummy","Dummy","Dummy","Dummy"}
mapID = 0xD35E - repoint
end
function isInBattle()
result = false
pointer = 0xD057 - repoint
test = memory.read_u8(pointer)
if test ~= 0 then
result = true
end
return result
end
function isNotTrainer()
result = true
pointer = 0xD057 - repoint
test = memory.read_u8(pointer)
if test > 1 then
result = false
end
return result
end
function updateCatchRate()
numerator = memory.read_u8(foeCR)
x = 20
y = 20
out = "Catch Rate: " .. numerator
forms.label(infobox,out,x,y)
end
function updateStats()
hpcur = memory.read_s16_le(foeHP)
x = 20
y = 50
out = "Foe Current HP: " .. hpcur
forms.label(infobox,out,x,y)
end
function updateMoveset()
for i=1,4 do
index = memory.readbyte(foeMV[i])
-- foeML[i] = index
foeML[i] = moveList[index]
end
x = 50
base_y = 80
for i=1,4 do
new_Y = base_y + (22 * (i - 1))
text = foeML[i]
forms.label(infobox,text,x,new_Y)
end
end
function core()
inBattle = isInBattle()
if (inBattle == true) then
updateCatchRate()
updateStats()
updateMoveset()
else
thisMap = memory.read_u8(mapID)
mapName = thisMap
-- mapName = mapsByID[thisMap]
gui.addmessage(mapName)
end
end
memory.usememorydomain(domain)
initPointers()
while true do
emu.frameadvance()
end
Joined: 4/17/2010
Posts: 11495
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
The refresh button?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.