1 2
13 14
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 108
YoshiRulz wrote:
Darth_Marios wrote:
By the way, how to "convert" a code that start with 10xxxxxx? The cheat type says: 10aaaaaa dddd ;-16bit Increment [aaaaaa]=[aaaaaa]+dddd but i dont have any idea how a lua script would look about that...
Just based on what you've said, memory.write_u16_le(a, memory.read_u16_le(a) + d).
Thanks! (I'm still quite a noob with lua)
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
I'm trying to read cpu registers for Game Boy (A, B, C, D, E, H, L). The Bizhawk Lua Functions page says to use
emu.getregisters()
to get the register names, but it just returns an empty table. On Bizhawk 2.8.
YoshiRulz
Any
Editor, Emulator Coder
Joined: 8/30/2020
Posts: 97
Location: Sydney, Australia
MUGG wrote:
I'm trying to read cpu registers for Game Boy (A, B, C, D, E, H, L). The Bizhawk Lua Functions page says to use
emu.getregisters()
to get the register names, but it just returns an empty table. On Bizhawk 2.8.
CNR, all 3 cores implement registers. Do you have a rom loaded?
I contribute to BizHawk as Linux/cross-platform lead, testing and automation lead, and UI designer. This year, I'm experimenting with streaming BizHawk development on Twitch. nope Links to find me elsewhere and to some of my side projects are on my personal site. I will respond on Discord faster than to PMs on this site.
Hey look buddy, I'm an engineer. That means I solve problems. Not problems like "What is software," because that would fall within the purview of your conundrums of philosophy. I solve practical problems. For instance, how am I gonna stop some high-wattage thread-ripping monster of a CPU dead in its tracks? The answer: use code. And if that don't work? Use more code.
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
I would like to update my old luascript so it can run on newer Bizhawk.
while true do

--...

    if client.ispaused() then
		gui.DrawFinish()
		emu.yield()
	else
		emu.frameadvance()
	end
end
The emulator prints that gui.DrawFinish() is deprecated. This line was needed to update the screen while the emulator is paused. I couldn't find a replacement for this function. How should I change the code to achieve the desired effect (updating the screen while the emulator is paused)?
Emulator Coder, Judge, Experienced player (667)
Joined: 2/26/2020
Posts: 720
Location: California
Just don't include the line, drawing will still occur regardless.
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
The script in question is my Kirby & The Amazing Mirror luascript and I'm testing in Bizhawk 2.9.1 on the (U) or (J rev 1.1) version. First, I replaced all instances of table.getn(mytable) with #mytable to make it run in the first place. While the emulator is paused, I'm expecting to be able to navigate the little menu I have drawn on screen via my script by mouse-click. After removing the line gui.DrawFinish, this is not possible anymore, even on Bizhawk 2.9.1. The line works fine under Bizhawk 2.9.1, but the emulator would keep printing in the console that it's deprecated, slowing performance. I would be grateful for a replacement function or to be able to disable the console messages. I might look into other ways, such as lua canvas. Thank you.
Emulator Coder, Judge, Experienced player (667)
Joined: 2/26/2020
Posts: 720
Location: California
gui.drawFinish just does nothing in modern (since 2.5 iirc?) BizHawk versions (besides putting the deprecated message, which you can get rid of by just not calling that function). Drawing a surface "starts" whenever a draw commands happens in a new frame and "ends" once that frame ends and there was a start to begin with, more or less (the exact logic is complicated and also wouldn't work with multiple scripts). The latest dev builds anyways have simplified the behavior and might end up solving your issue?
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
Hmm, this is odd. I tested again with the removed line and now it works, mysteriously... Ok, the problem is solved. Thank you and sorry for the confusion.
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
I have run into a different issue. When event.onloadstate() is called, it seems client extra padding set via client.SetGameExtraPadding() resets to 0. I have found nothing in my script that could be causing this. As a work-around I refresh the extra padding, but it is annoying to see the window resize every time I load a state. The script in question: https://tasvideos.org/Forum/Topics/2095?CurrentPage=9&Highlight=530445#530445
Emulator Coder, Judge, Experienced player (667)
Joined: 2/26/2020
Posts: 720
Location: California
As far as I can tell there's nothing in BizHawk that could even be causing such behavior. Is the same behavior present in dev builds?
Editor, Expert player (2335)
Joined: 5/15/2007
Posts: 3887
Location: Germany
CasualPokePlayer wrote:
As far as I can tell there's nothing in BizHawk that could even be causing such behavior. Is the same behavior present in dev builds?
I'm not sure what to say. Because I reopened the emulator and the issue "fixed itself", once again. Maybe something is wrong about reloading luascripts. When making changes to a luascript, it seems the emulator has to be reopened and the script run from a fresh start, in order to fix obscure issues.
Site Admin, Skilled player (1247)
Joined: 4/17/2010
Posts: 11432
Location: RU
Clearing registered functions would have the same effect as closing the emu (right-click menu on lua console).
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.
1 2
13 14