I'll suggest a function like emu.quitscript(), to directly stop the script.
Currently, if you use multiple script(by using something like require'myscript'), you can't easily stop the script, despite using coroutine.yield() but this isn't a good pratice if the script already use coroutine for other means.
Also, sometime you need somekind of realtime timer to perform specific task, without doing a "busy-wait" function inside lua. At some point, I did a pcsx.suspend(int cycleToWait) function to suspend a lua script(without suspending the whole emulator) for a x number of cycle, but there's probably a better way to do this.
Emulator Coder, Site Developer, Site Owner, Expert player
(3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
BadPotato wrote:
I'll suggest a function like emu.quitscript(), to directly stop the script.
Currently, if you use multiple script(by using something like require'myscript'), you can't easily stop the script, despite using coroutine.yield() but this isn't a good pratice if the script already use coroutine for other means.
Based on this description, I'm not sure what you want built. You just want a script to be able to be in charge of stopping itself? couldn't existing the while loop do this?
Maybe I need an example of what you problem you are having.
Also, sometime you need somekind of realtime timer to perform specific task, without doing a "busy-wait" function inside lua. At some point, I did a pcsx.suspend(int cycleToWait) function to suspend a lua script(without suspending the whole emulator) for a x number of cycle, but there's probably a better way to do this.
In this example, what unit of time is a cycle? A cpu cycle from the core?
Based on this description, I'm not sure what you want built. You just want a script to be able to be in charge of stopping itself?
Yep, exactly. Just like when you press the stop button with your mouse. I did something like it here. Here's an example that might help you to test the case. Exiting the loop and reaching "end of file" does work, but it get horribly annoying when dealing with function binding(like some UI libraries).
In this example, what unit of time is a cycle? A cpu cycle from the core?
I guess it is, I don't know how the pcsxrr implementation is supposed to work. I just used the first thing that could be working to avoid a busy-wait function inside lua. My mindset was that using pcsx.suspend(500) could probably be about 500ms or less on some computer, depending on whether the emulator state is on emu.pause() or emu.unpause() when running a game. But as I said, I'm sure there's a better way to do this, maybe making a new function like event.setTimer(millisecond) and event.onTick() could be a great to do it? Thought, it might require an extra function like waitToNext() to get the same thing as pcsx.suspend.
edit: Now looking at the bizhawk function, it seem that emu.yield is very close of what could be required, but I don't think it can really be used to avoid busy-wait.
Emulator Coder, Site Developer, Site Owner, Expert player
(3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
BadPotato wrote:
Yep, exactly. Just like when you press the stop button with your mouse.
Aren't you already in control of this? Simply exit the script and it will turn off. I'm assuming you are in an infinite while loop. When you want to "stop" the script, break out of that loop. I don't think you need to tell the emulator to stop your script, from your script...
waitToNext() to get the same thing as pcsx.suspend.
seems like you are on the wrong path to even be considering needing this, sounds like the equivlant of fixing a javascript error with SetTimeOut() (a function that is almost always used as a hack rather than its intended functionality).
You shouldn't be thinking in terms of milliseconds, but rather definable events in the emulator. If you can give me a valid use case that I can't argue as another event, then I'll consider it. For instance, maybe you are really just wanting event.onpaint() to make sure on screen stuff is drawn even while paused between frames?
I don't think you need to tell the emulator to stop your script, from your script...
Yes, my request is merely useful for anyone that run multiple script with the same script and want to get an easy way out. But I understand, this isn't a high priority feature.
If you can give me a valid use case that I can't argue as another event, then I'll consider it. For instance, maybe you are really just wanting event.onpaint() to make sure on screen stuff is drawn even while paused between frames?
Basically, I just ask for a way to make lua idling properly.
Well, the downside of lua right now, is that you have to run an external process or task from lua and waiting for result, meanwhile on the lua side we can only busy-wait.
Example1: From a lua script, we run a python bot(or whatever language) and after some time, it output a new file as output.
Meanwhile, the lua script can either use a sleep function(freeze the whole emulator) or do a busy-wait function. Once in a while, we can read the file and if there no update, continue to loop.
Example2: From lua, we start an another Bizhawk instance(with the param arguments) and ask him to replay a movie, generated by the original lua script. Also, the other Bizhawk instance use an another lua script to notify the original emulator at the end of the movie. After the end of the movie, thne new Bizhawk instance notify the original Bizhawk instance using the TCP from the lua socket library.
Meanwhile, the lua script can either use a sleep function(freeze the whole emulator) or do busy wait. Once in a while, we can listen to the TCP and if there no update, continue to loop.
---
At some point, we can simply ask the emulator to re-render the current screen (available with gens), such as using gens.redraw() to avoid busy-wait within lua or re-loading the same savestate of the current frame over and over. So usually, this is rather inefficient, since these function shouldn't be used that way and might have some other unwanted effect on the emulator state(e.g. let's say we record a .AVI at the same time for archiving purpose, we might not want to use any redraw-like function).
Using gui.register() is probably what you mean, by using event.onpaint() , but then how can you get an external notification, if the emulator stay idle?
Anyway, I just hope you can see the relevance of the use case.
I think it's been brought up before, but how hard would it be to implement connecting/disconnecting a controller mid-TAS, in particular in SNES? It's needed for a big skip in Secret of Mana (you bring up a textbox with controller 3, disconnect controller 3, and now controllers 1/2 can go through the rest of the town without triggering an event that would normally prevent progress, because the textbox being open prevents it)
EDIT: Nevermind, it was already discussed here: http://tasvideos.org/forum/viewtopic.php?t=14330 and I see the situation is still the same as it was then (In particular, someone would have to convince byuu it's worth writing into the emulator XD)
On a sidenote, adding to Patashus comment:
As far as I'm aware, there is no way to use all 3 players in an SNES emulation. I tested it with Secret of Mana, but it did not work. I once had someone somehow involved in the development of BizHawk where I also mentioned it to him.
In the release notes I read, that in version 1.1.1 "SNESHawk - Hooked up controller 3 & 4"
But that was in 2012, so I assume there was no recent change to the 3+ player inputs on BizHawk for the SNES.
For those unaware: For the SNES you need to hook up and activate (!) a multitab device for the SNES tor recognize the 3rd and 4th player. There is specifically a switch on those multitab devices, where you can turn on or off those 'modes'.
--> It's probably not as simple like adding more controllers for other consoles
Edit: @Patashu, there are various small timesavers in Secret of Mana, but no actual big skip ^^
-> You can get past the guard in 2 other ways too
On a sidenote, adding to Patashus comment:
As far as I'm aware, there is no way to use all 3 players in an SNES emulation. I tested it with Secret of Mana, but it did not work. I once had someone somehow involved in the development of BizHawk where I also mentioned it to him.
In the release notes I read, that in version 1.1.1 "SNESHawk - Hooked up controller 3 & 4"
But that was in 2012, so I assume there was no recent change to the 3+ player inputs on BizHawk for the SNES.
For those unaware: For the SNES you need to hook up and activate (!) a multitab device for the SNES tor recognize the 3rd and 4th player. There is specifically a switch on those multitab devices, where you can turn on or off those 'modes'.
--> It's probably not as simple like adding more controllers for other consoles
Edit: @Patashu, there are various small timesavers in Secret of Mana, but no actual big skip ^^
-> You can get past the guard in 2 other ways too
Yeah, there are only 2 players supported in sneshawk. The "3 and 4" was a misunderstanding of a variable. What's actually emulated is 2 standard controllers plugged in; no multitaps at all.
I'm not sure, but has this issue been addressed for BizHawk yet? It seems to be affecting "Blues Brothers" for the NES, and I have no clue which version of emulators have the correct lag.
In neshawk right now it's 514 in order to pass a test, which must be dependent on it being on an odd CPU cycle, according to nesdevwiki. Anything dependent on this timing I would not trust until it's been fixed properly to depend on the even/odd state
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.
Can we expect compatibility for pal rom (N64) without sound problem in the near future?
I know that this is by far not the major problem to be solved in Bizhawk, but it will be very apreciated
I've downloaded and compiled lastest SVN (r6090) from here.
Since r6049 goyuken added the ability to select force dendy-mode region.
But i don't see where is this checkbox hidden.
Emulator Coder, Site Developer, Site Owner, Expert player
(3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
BizHawk 1.6.0 released
Due to googlecode's terrible decision to not allow binaries, we have moved to sourceforge to house our binaries. However, the code still resides in the usual googlecode location.
The big feature of this release is GenesisHawk! It uses the GenPlus-GX emulator for Genesis and Sega CD emulation. This emulator is much improved over gens in terms of accuracy and I highly recommended to the use GenPlus for TASing instead.
Of course there are tons of other fixes and features, so please read the Release notes
And the windows binary can be found here.