creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
MUGG wrote:
I will bugtrack the things you tell me to, but I will need to find the page where I can do it.
It's probably here: https://github.com/TASVideos/bizhawk/issues
Player (105)
Joined: 1/4/2013
Posts: 117
Location: Belgium
Hello everyone. I don't know if it's the right place to talk about this but... I've stared to make small patch that allows BizHawk to load kind of "External tool". In summary, I just created a brand new project on vs2015, add BizHawk.exe in project references, add a simple windows form make it implements a specfic interface and build the project. Then, I put the dll in a specific folder, run a compiled Bizhawk, open a ROM and it loads my custom winform. I thought about doing this while I wanted to create a window with lua scripting. We can do it but it's quite complicated (and there are some limitations). So if we could run compiled code, we should probably make more crazy stuff. What do you think about this? Could it be interesting? If so, how can I submit the patch to the project? PS: The patch has been really easy to make, it is a proof that the code is well thought (at the least for parts I see :p). Great job guys !
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
We're going to have something like this eventually. I think we're more interested in the crazy thing youre doing and what kind of snags you run into than your exact implementation so far, so please report your findings, in a separate thread if you wish.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Question regarding this Dual Gameboy and Dual Gambatte that I'm reading about in the about window and paths window. Is there a way within BizHawk to link between Gameboy/GBC games at present, or is that framework just there for future use?
Adventures in Lua When did I get a vest?
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
Pokota wrote:
Question regarding this Dual Gameboy and Dual Gambatte that I'm reading about in the about window and paths window. Is there a way within BizHawk to link between Gameboy/GBC games at present, or is that framework just there for future use?
It does work, as far as I am aware. I tested it against Pokemon Red and Pokemon Blue back when. There's even a command to disconnect the link, for whatever reason you want to.
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Oh good, it's not just prelaid infrastructure. Now to figure out how to make it work. Is it documented somewhere? The wiki is decidedly unhelpful in this respect.
Adventures in Lua When did I get a vest?
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
I have run into some kind of problem/bug with lua, I think... I have a script that saves stats and properties of Mario and Luigi into the objects Mario and Luigi (it does this on start-up and every frame inside a while true do loop). And I have objects MarioBefore and LuigiBefore that save the values from the frame before.
local Mario = {
Health    = memory.read_s16_le(0x4866),
HealthMax = memory.read_s16_le(0x486A),
BP        = memory.read_s16_le(0x486c), 
BPMax     = memory.read_s16_le(0x4870),
Pow       = memory.read_s16_le(0x4874),
Def       = memory.read_s16_le(0x487c),
Speed     = memory.read_s16_le(0x4878),
Hige      = memory.read_s16_le(0x4880),
Level     = memory.read_s8(0x4888),
Experience  = memory.read_s16_le(0x485c),
X         = memory.read_s24_le(0x6c14),
Y         = memory.read_s24_le(0x6c18),
Z         = memory.read_s24_le(0x6c1B),
Altitude  = memory.read_s24_le(0x6c20) 
}

local Luigi = {
Health    = memory.read_s16_le(0x48a2),
HealthMax = memory.read_s16_le(0x48a6),
BP        = memory.read_s16_le(0x48a8), 
BPMax     = memory.read_s16_le(0x48ac),
Pow       = memory.read_s16_le(0x48b0),
Def       = memory.read_s16_le(0x48b8),
Speed     = memory.read_s16_le(0x48b4),
Hige      = memory.read_s16_le(0x48bc),
Level     = memory.read_s8(0x48c4),
Experience  = memory.read_s16_le(0x4898),
X         = memory.read_s24_le(0x6fb0),
Y         = memory.read_s24_le(0x6fb4),
Z         = memory.read_s24_le(0x6fb8),
Altitude  = memory.read_s24_le(0x6fbB)
}

local MarioBefore = Mario
local LuigiBefore = Luigi

...

while true do


local Mario = {
Health    = memory.read_s16_le(0x4866),
HealthMax = memory.read_s16_le(0x486A),
BP        = memory.read_s16_le(0x486c), 
BPMax     = memory.read_s16_le(0x4870),
Pow       = memory.read_s16_le(0x4874),
Def       = memory.read_s16_le(0x487c),
Speed     = memory.read_s16_le(0x4878),
Hige      = memory.read_s16_le(0x4880),
Level     = memory.read_s8(0x4888),
Experience  = memory.read_s16_le(0x485c),
X         = memory.read_s24_le(0x6c14),
Y         = memory.read_s24_le(0x6c18),
Z         = memory.read_s24_le(0x6c1B),
Altitude  = memory.read_s24_le(0x6c20) 
}

local Luigi = {
Health    = memory.read_s16_le(0x48a2),
HealthMax = memory.read_s16_le(0x48a6),
BP        = memory.read_s16_le(0x48a8), 
BPMax     = memory.read_s16_le(0x48ac),
Pow       = memory.read_s16_le(0x48b0),
Def       = memory.read_s16_le(0x48b8),
Speed     = memory.read_s16_le(0x48b4),
Hige      = memory.read_s16_le(0x48bc),
Level     = memory.read_s8(0x48c4),
Experience  = memory.read_s16_le(0x4898),
X         = memory.read_s24_le(0x6fb0),
Y         = memory.read_s24_le(0x6fb4),
Z         = memory.read_s24_le(0x6fb8),
Altitude  = memory.read_s24_le(0x6fbB)
}

...

code that compares them

...

local MarioBefore = Mario
local LuigiBefore = Luigi

When I start the script, MarioBefore and LuigiBefore seem to have wrong values though. Log of MarioBefore: Notice that the very first frame has wrong values, but all subsequent frames are correct.
"Altitude": "1316368"
"BP": "2824"
"BPMax": "-31794"
"Def": "-5757"
"Experience": "-5085"
"Health": "-1533"
"HealthMax": "-5880"
"Hige": "2060"
"Level": "-64"
"Pow": "1359"
"Speed": "-13821"
"X": "1451906"
"Y": "-8248820"
"Z": "2760235"

"Altitude": "0"
"BP": "22"
"BPMax": "22"
"Def": "23"
"Experience": "444"
"Health": "5"
"HealthMax": "18"
"Hige": "13"
"Level": "7"
"Pow": "54"
"Speed": "27"
"X": "136448"
"Y": "151296"
"Z": "0"

"Altitude": "0"
"BP": "22"
"BPMax": "22"
"Def": "23"
"Experience": "444"
"Health": "5"
"HealthMax": "18"
"Hige": "13"
"Level": "7"
"Pow": "54"
"Speed": "27"
"X": "136448"
"Y": "151296"
"Z": "0"

"Altitude": "0"
"BP": "22"
"BPMax": "22"
"Def": "23"
"Experience": "444"
"Health": "5"
"HealthMax": "18"
"Hige": "13"
"Level": "7"
"Pow": "54"
"Speed": "27"
"X": "136448"
"Y": "151296"
"Z": "0"
How come MarioBefore has such wrong values even when I made sure to run MarioBefore=Mario before it even enters while true do territory?
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
MUGG wrote:
How come MarioBefore has such wrong values even when I made sure to run MarioBefore=Mario before it even enters while true do territory?
This happens because you need to create another table and copy the values, one by one.
Programming in Lua wrote:
You may think of a table as a dynamically allocated object; your program manipulates only references (or pointers) to them. Lua never does hidden copies or creation of new tables behind the scenes.
To copy a table, use the functions of this tutorial: http://lua-users.org/wiki/CopyTable
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
I actually found out it was an error in my script. Two actually.
X         = memory.read_s24_le(0x6c14),
Y         = memory.read_s24_le(0x6c18),
Z         = memory.read_s24_le(0x6c1B),
Altitude  = memory.read_s24_le(0x6c20) 
is supposed to be
X         = memory.read_u32_le(0x6c14),
Y         = memory.read_u32_le(0x6c18),
Z         = memory.read_u32_le(0x6c1C),
Altitude  = memory.read_u32_le(0x6c20) 
EDIT: What do these errors mean?
LuaInterface.LuaScriptException: 113

LuaInterface.LuaScriptException: Lua511.LuaCSFunction
When I reload my script there is a 5% chance such errors pop up and make me have to reopen the whole emu...
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
Script active problem: It looks like I found a bug for real this time.

print("Script is loaded")

event.onloadstate(function() 

print(emu.framecount())

end)


while true do


emu.frameadvance()
end
I'm on VBA-Next. When I run this code and load a state, it prints the framecount once, which is expected. But if I drag and drop the script into the lua console (as a habit to close and reopen the script - this being the only way you can do so in mGBA without crashing the emulator), it looks like subsequent loadstates will execute the print() command multiple times, even though the console says there is still only 1 script active. /// When the script is active and I drag and drop the file onto the console (which should close the script), the script still keeps going. If I drag and drop it again, it seemingly loads a 2nd instance of the script.
Script is loaded
16108
22136
16108
22136
16108
22136
16108
22136
Script is loaded
16108
16108
22136
22136
16108
16108
22136
22136
16108
16108
22136
22136
16108
16108
22136
22136
Script is loaded
16108
16108
16108
22136
22136
22136
16108
16108
16108
22136
22136
22136
Hex editor problem: One other error I found was in the hex editor, it seems the wrong character on the right is highlighted when clicking on a byte. http://i.imgur.com/hGHlej0.png Also, when I click on a character on the right, the character 3 spaces to the left gets selected instead of the character I clicked on. Both bugs have been reported as issues. Btw, I think a event.onloadstateimmediate() could be convenient (run code inside it before emulating the loaded frame). Is this possible? Or what alternative can I use?
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
There's a blank character in that line that's not getting written over - what character should 0x26 show up as?
Adventures in Lua When did I get a vest?
Editor, Expert player (2078)
Joined: 6/15/2005
Posts: 3282
According to ASCII tables, 0x26 is '&'. Which makes sense, since the ROM names are MARIO&LUIGIJA88J and MARIO&LUIGIUA88E, respectively. Edit: Same as https://github.com/TASVideos/BizHawk/issues/490 . Apparently it has been fixed in builds since Aug 31.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
I'm pretty sure your other bug's been fixed too
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
Questions
  • Lua client.SetGameExtraPadding() is in 1.11.1 or was it newly added in 1.11.2?
  • Can you record and play back controllers separately in TASStudio?
  • When is the next update after 1.11.2?
Post subject: BizHawk 1.11.2 released
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3574)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
1.11.2 is now Released! This is a big release for windows users, particularly those with poor openGL support. BizHawk can now be run in directx mode. For those without opengl , this is a huge speedup. (For others directx might perform better than opengl anyway) In addition, some big features for movie making including TAStudio branches, and SaveRam-anchored movie support. More details: http://tasvideos.org/Bizhawk/ReleaseHistory.html Windows Binary
It's hard to look this good. My TAS projects
Post subject: Re: BizHawk 1.11.2 released
Joined: 6/14/2014
Posts: 47
adelikat wrote:
1.11.2 is now Released! This is a big release for windows users, particularly those with poor openGL support. BizHawk can now be run in directx mode. For those without opengl , this is a huge speedup. (For others directx might perform better than opengl anyway) In addition, some big features for movie making including TAStudio branches, and SaveRam-anchored movie support. More details: http://tasvideos.org/Bizhawk/ReleaseHistory.html Windows Binary
Thanks, it works fine :)
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
1. Test it yourself 3. We dont have a calendar
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
zeromus wrote:
1. Test it yourself 3. We dont have a calendar
Your answer is completely useless to me. How am I, someone who isn't exactly an expert at Lua to begin with, supposed to know how to use that code because for all I know I could be using a wrong script and deem it on that when it doesn't work in any one Bizhawk release. And the release history doesn't list any previous dates so I can't easily find out what is the span of time until a next release can be expected. I have posted questions here for others to answer them, not so that others can make fun of me when I'm seeking advice.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Just discovered Basic Bot. Is there some way to get it "playing" indefinitely, similar to RNG Plays Pokemon, without setting it to call an invalid save state? It's doable by setting a non-existing save state, but I don't like clogging my message log with "Savestate not found" warnings. EDIT and it's not checking the values again every X frames on a failed loadstate, rather once it fails to load state it just checks every frame. Is that an intended failure or an unintended failure?
Adventures in Lua When did I get a vest?
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
client.SetGameExtraPadding() seems unusable to me, so I want to explain here why. I think I would have prefered a "client.SetGameExtraMargin()". http://i.imgur.com/25o20PR.png
Player (75)
Joined: 8/26/2015
Posts: 70
MUGG wrote:
zeromus wrote:
1. Test it yourself 3. We dont have a calendar
Your answer is completely useless to me. How am I, someone who isn't exactly an expert at Lua to begin with, supposed to know how to use that code because for all I know I could be using a wrong script and deem it on that when it doesn't work in any one Bizhawk release. And the release history doesn't list any previous dates so I can't easily find out what is the span of time until a next release can be expected. I have posted questions here for others to answer them, not so that others can make fun of me when I'm seeking advice.
I suspect it's because of the questions, one is given in the BizHawk documentation and another doesn't have a sensible answer: For 1, I answered you on IRC already, but suppose I should have put it here as well: Release History: that function was added in 1.11.2 For 2, no clue. For 3, Bizhawk doesn't have a release schedule. Take that as you will, but imo "when it's done" here is better than Valve Time(TM). As for when previous revisions were released, you could try checking the history of the Release History to find when version information was added. Even then, it's probably not that helpful: 1.11.0 was added to that page on the 15th of July; 1.11.1 was added on the 25th of July; then 1.11.2 was a far longer gap than those two.
Joined: 8/3/2009
Posts: 158
I have a couple of questions. 2) I have a question about the PSX SaveRAM before I turn it into a bug report. I haven't really paid much attention to SaveRAM because I always use save states. I can get .mcr save files from other sites, rename it to SaveRAM and bizhaw will recognize it without any issues whatsoever. However, if I try saving the game like I would on a real PSX, then the save is never created. I've tried starting a game without any SaveRAM present, and making a save, and the emu does not create the file. Not even after closing the emu. I also tried loading a SaveRAM with a save file already in it (gotten from gamefaqs or something), saving a game, and the same thing happens. As soon as I close the emu, the save is gone. I don't know if maybe there's an option I haven't turned on or something? And yes, I've checked the SaveRAM directory to see if the file is being created, but nothing appears. So is this a bug? Shouldn't the emu create the .SaveRAM as soon as you save a game like on a real PSX? Or at least create the file after the emu is closed? (First option is better though, in case there's a crash.) -------- SOLVED 1) I made this request some time ago: https://github.com/TASVideos/BizHawk/issues/495
When in windowed mode, it's easy to see when a save state is being used because the status bar on the bottom shows you. But when in full screen mode, there's no way to tell if the save slot you selected is used or not. So, if possible, I request for the messages to say something like "Slot 1 Selected (Used)" or "Slot 1 Selected (Full)" when picking a save slot.
Zeromus replied with "fixed" and closed the issue. But on the latest Bizhawk released, I don't see it? It could possibly be he didn't add it, or maybe it's something I have to turn on? Could someone point me in the right direction?
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11480
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Your #1 works in the latest release for me.
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: 8/3/2009
Posts: 158
feos wrote:
Your #1 works in the latest release for me.
Ah, crap, I see now. I was looking for "save state (Used)" and wasn't looking at "save state (empty)" :P By the way, I see the framebuffer screenshot option you made is intact in this new release. Zeromus said something about removing it (or maybe he just rewrote it?). Whatever the case is, I'm glad it's there.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
MUGG wrote:
zeromus wrote:
1. Test it yourself
Your answer is completely useless to me. How am I, someone who isn't exactly an expert at Lua to begin with, supposed to know how to use that code
You didn't ask how to use it. You asked whether it was there: tools > lua console > help > lua functions list.

1732748237