Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubNESHawk #1439

Merged
merged 7 commits into from Jan 19, 2019

Conversation

Projects
None yet
4 participants
@alyosha-tas
Copy link
Contributor

commented Jan 10, 2019

SubNESHawk:

  • Subframe input using the underlying NESHawk core.
  • Selected by having SubNESHawk checkbox checked and using NESHawk core.
  • Can still use NESHawk as normal (by default)
  • Currently supports all NESHawk controllers
  • TAStudio, trace logger, hex editor, and RAM search supported
  • Encoding is supported with no extra work
  • FrameAdvance now returns bool (all cores except SubNESHawk always return true, so they behave as before.)
  • Existing NES menues used for controller selection and other graphics settings / tools
  • bk2 header (implemented but only reports correct value if saving at end of movie)

TODO / Future work:

  • maybe a toggle for subframe mode
  • subframe poll indicator
SubNESHawk
also Input register shift fix

# Conflicts:
#	BizHawk.Client.EmuHawk/MainForm.Designer.cs
#	BizHawk.Client.EmuHawk/MainForm.Events.cs
#	BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.IEmulator.cs
#	BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.IEmulator.cs
#	BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs
@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 10, 2019

SMB3 DMC glitch to credits verified to work as a test case, see:

http://tasvideos.org/forum/viewtopic.php?p=479842#479842

@nattthebear

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2019

Subframe movies won't have useful lengths as reported on the movie screen, and things like the PlatformFrameRates will have no value there. @adelikat is this important?

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2019

VBlank count can still be put into the header, along with calculated real-time length if needed. That's what VFR emulators have to do.

alyosha-tas added some commits Jan 12, 2019

SubNESHawk:
- Use NES settings for controllers / sync settings
- Clean up un-needed extra controller code
- Enable Menues
@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2019

Alright I enabled menues, use existing NES controllers, and cleaned up the code base

@YoshiRulz

This comment has been minimized.

Copy link
Member

commented Jan 12, 2019

Can't say it works as intended (because TAStudio), but SMB1 loads and is playable on Linux.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2019

@YoshiRulz cool thanks. I think this is a TAS only core so it kind of needs TAStudio, but at least none of the funny logic with sync settings and such broke it.

I fixed up all the relatively easy stuff.

Probably the only really necessary thing left to do is put VBlanks in the BK2, but I might need some help with that as I'm not following how everything moves through the movie code.

A nice-to-have sub frame poll indicator would be cool but I don't see an easy way to do it. Maybe can save that for future work.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2019

Ok, so I got VBlank count into the Bk2 movie header easy enough. But there is a catch. Unlike frame count, you don't know ahead of time how many VBlanks are in your movie until you run it. So, it will only report the correct value if you export the movie from the end.

I'm thinking of ways around this, but haven't gotten it worked out yet

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 12, 2019

Does it also go to movie savestates?

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2019

Yes it does .

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 12, 2019

Sensible people have final version of their movies stored as savestates, so this info shouldn't get lost forever.

Another trick would be to extend the movie format by an additional bit of the input string per frame, marking either VBlank or poll, allowing to count them separately.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

Unfortunately the count will be invalidated if returning to a previous state ad modifying it. In this case lag is the exact same as VBlank, so it shares the same issues. Probably there isn't much that can be done about it. you'll just have to verify that proper number of VBlanks is in the file.

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

Nothing is invalidated, you just parse the movie once and count the lines with those extra bits, exactly like you count lines to get framecount right now.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

Ah ok I get what you are saying . I guess that would be less likely to be wrong, sounds complicated though.

Maybe that can be for a future subneshawk 2.0 that includes a poll counter and other high end features

@nattthebear

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

There really shouldn't be lag frames in this for any reason other than trying to sledgehammer it into old bizhawk code. Once you're deciding to prompt for input every time it'd be needed, the obvious next step is to not prompt for input when it's not needed.

@nattthebear

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

mupen's handling of vblanks is probably the best idea (the idea, not its buggy execution)

The vblank count is stored in the movie, but since it could be wrong, the movie stops when either the input frame count end is reached or the vblank count end is reach. So falsifying your vblank count doesn't help you since mupen will just stop playing your movie.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

Lag Frames: Not really in the scope of what I wanted to do. There's a lot of extra stuff that could be done, but I don't want to go down the (probably very deep) rabbit hole of changing underlying movie functions.

VBlanks: That's a good idea too, I might look into it, but I'm honestly not that concerned since it's something easy to verify anyway.

@nattthebear

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2019

Lag Frames: Not really in the scope of what I wanted to do. There's a lot of extra stuff that could be done, but I don't want to go down the (probably very deep) rabbit hole of changing underlying movie functions.

I don't blame you, but the road to Bizhawk is paved with half baked ideas where we "just needed to get something in" and "it'll get cleaned up later."

We'll be gaining a very specialty core for one system with a bunch of bad UX around its use and a bunch of bad code around its use. Why?

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2019

Why? There's not really a good reason I guess. Over the years I've seen various people ask for this capability at various times, and I just happen to realize a way to do it. When I first started working on BizHawk I kind of expected it would be obsolete by now with a bunch of Mesen-like equivalents for various systems taking over. Needless to say that hasn't happened. So what we have here is better then nothing and at least a step in the right direction. I think it leaves a light enough footprint to be worth it.

Maybe it can inspire someone to go even further or we'll get some cool runs out of it. That's all I'm hoping for.

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2019

I forgot, what is there yet to be done properly right now?

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2019

I still want to add in a subframe reset option. But I'm still rolling over in my head exactly how to do it. And I'm not sure there is a test case for it.

Other then that, this basically works (as is evidenced in the thread with the successful SMB3 ACE test.)

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 16, 2019

Reset is more complicated since it can happen at any cycle (or only any instruction?). So you can't just record input for every poll and automatically be ready for a reset somewhere there. And you can't record at every instruction either, so reset coming from a movie should be scheduled in advance somehow.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

Yeah I can schedule for a reset at a certain cycle past the previous video frame edge pretty easily. It's not really a hurdle in itself. Maybe this weekend I will do it.

@vadosnaprimer

This comment has been minimized.

Copy link
Contributor

commented Jan 16, 2019

So you're not moving to just poll frames? Arguably, showing vblank as frames could be helpful as it represents the final image and sound, dunno if that's an issue when you only advance poll-wise.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

What you see now is basically the final version of what I have planned. Green frames = poll, red frames = video edge.

@alyosha-tas

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2019

Ok subframe resets are a go. Everything seems in working order and ready to merge.

@alyosha-tas alyosha-tas merged commit 9696a75 into master Jan 19, 2019

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@alyosha-tas alyosha-tas deleted the subneshawkfixattempt branch Jan 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.