MiSTerFPGA autofire updates testing request

This is the main shmups forum. Chat about shmups in here - keep it on-topic please!
Post Reply
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

MiSTerFPGA autofire updates testing request

Post by deepthaw »

I've been working on some quality of life improvements for how MiSTerFPGA handles autofire, and would appreciate some testing/feedback. For those who haven't used autofire on MiSTer before, you toggle it by:

hold the button you want to enable/disable autofire for, and press the menu/osd button on your controller.
while holding left or right, press menu/osd to decrease/increase the autofire rate.
you (should not be able to) cannot set autofire on joystick/dpad directions.
autofire is not saved after exiting a core.

The changes include:
* Autofire rates are now explicitly set in hz rather than millseconds.
* Default autofire rates are 7.5/15/20/30hz
* Custom autofire rates can be set in mister.ini (globally or per-core)
* The UI will now display which buttons have autofire enabled when you enable/disable it for any button (no more wondering what button you just accidentally turned autofire on for)

I rewrote a large chunk of the autofire handling so I could use more testers making sure I didn't break anything, and I'm especially curious to see if my timings are close to hardware-based autofire.

You can download the test file at https://drive.proton.me/urls/V6KGYNWYD8#fEz2gymQ0jnj

Rename existing /media/fat/MiSTer to MiSTer.bak or similar, place the linked on there and rename it to MiSTer. To revert to your original MiSTer main, delete that file and rename the old one back to MiSTer.

Uncomment and add the appropriate lines to mister.ini for custom rates. If you don't, it'll still work fine and just default to 7.5/15/20/30hz.

; Custom autofire rates (in hertz). up to six allowed.
; Assumes a video refresh rate of 60hz then attempts to scale to the actual refresh rate
;autofire_rates=7.5,15,20,30
; default rate when autofire is initially enabled.
;autofire_rate_default=15

I'd love to be able to implement per-button autofire rates, but that's something to look at in the future if we can figure out an intuitive way to implement it.

(If there's a more appropriate board to post this to, please move it there.)

*edit* screwed up the url, should be good now.
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

I've uploaded a new build for testing. Grab your favorite shmup on MiSTer that is picky about autofire and let me know how it works.

* Defaults to three autofire rates. 10/20/30hz. Hold button and press OSD/MENU to cycle through them. (edit it's 7.5/15/20/30 it's late)
* Autofire rates can be assigned per button.
* Custom rates can be defined in mister.ini.
* Displays name of button toggled when enabling autofire.
* Attempts to match vsync rate of game for "frame on/frame off" autofire. Quick and dirty testing shows 99.88% accuracy.

Sorgelig seems to feel he can expose actual vsync from the FPGA to the HPS which means we could get perfect frame-synched autofire. Here's hoping that works out.

Rename the existing /media/fat/MiSTer on your sdcard to MiSTer.bak and replace with this one. Rename MiSTer.bak to MiSTer when you want to revert to a stable version.

https://drive.proton.me/urls/T8VD1MT4NR#SpK6dd2FxI9h
User avatar
BareKnuckleRoo
Posts: 6944
Joined: Mon Oct 03, 2011 4:01 am
Location: Southern Ontario

Re: MiSTerFPGA autofire updates testing request

Post by BareKnuckleRoo »

deepthaw wrote: Sun Nov 16, 2025 2:52 amyou (should not be able to) cannot set autofire on joystick/dpad directions.
There's one game I can think of where autofire on a joystick direction is actually a thing you'll see in some Japanese arcades, specifically Varth has a bomb refill system where rapidly moving the stick around increases the rate at which bombs refill. A 30 hz button that mashes down on the stick every other frame to exploit this is not unheard of, but I don't know if this is in demand for people playing on a MiSTer or how easy it'd be to setup.

Some games have an exploit where being able to input two opposite directions let's you do weird things, like in Donpachi as Type B against the final boss, but this isn't possible except on a hitbox type setup or with fancy joystick wiring to a button just for this exploit, so you won't really see this even in arcades.
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

BareKnuckleRoo wrote: Tue Nov 18, 2025 6:37 pm
deepthaw wrote: Sun Nov 16, 2025 2:52 amyou (should not be able to) cannot set autofire on joystick/dpad directions.
There's one game I can think of where autofire on a joystick direction is actually a thing you'll see in some Japanese arcades, specifically Varth has a bomb refill system where rapidly moving the stick around increases the rate at which bombs refill. A 30 hz button that mashes down on the stick every other frame to exploit this is not unheard of, but I don't know if this is in demand for people playing on a MiSTer or how easy it'd be to setup.

Some games have an exploit where being able to input two opposite directions let's you do weird things, like in Donpachi as Type B against the final boss, but this isn't possible except on a hitbox type setup or with fancy joystick wiring to a button just for this exploit, so you won't really see this even in arcades.
I assume the reason it excludes directions from autofire is that you enable autofire by holding a button, then pressing the menu button. People would accidentally enable autofire on a direction rather than opening the OSD way more often than they wanted actual autofire on the joystick. The current system (which this would replace) also uses left or right + menu to decrease/increase the global autofire rate, but it probably did that specifically because you couldn't enable autofire on directions.

Re: The opposite directions. You can assign alternate buttons in MiSTer (it asks if you want to after you finish assigning them normally) and I think you could assign an alternate for directions and then do both at once. I believe it also doesn't make any attempt to prevent you from pressing opposing directions via analog + dpad if your controller has both.
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

Latest revision: https://drive.proton.me/urls/R4B4FT5H5G#YDCMy2KCEySB

Improved timings and reduced cpu load.
Best core to stress test is PSX, since it changes refresh rates and hits the HPS for CD access a lot.

Jitter (how far autofire is from the exact refresh rate) has a standard deviation of about 2.5% (.42ms) for consoles that do a lot of CD access/streaming, 0.5% (.09ms) for everything else (arcade, cartridge games, etc.)
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

I got off my butt and updated this again. A recent change to the framework allows the input side of MiSTer to get frame counts from the core itself which should be as accurate as possible for vsync based autofire. Not all cores have been updated to support that yet so it still falls back to a software timer (although that timer has been extremely accurate in my testing.)

https://drive.proton.me/urls/284T9MNF9G#uJM2EA8vcHMh

This touches parts of the input stack that haven't been touched in a while, so if anybody is using a JAMMA setup or MiSTercade or something similar that isn't just a basic USB controller, I'd greatly appreciate testing of this - I don't have any of those setups and while I don't *think* this should break them, I'd rather not risk it. It's been the main reason I haven't submitted this as a PR yet.

To enable custom autofire rates add a line like this to mister.ini:

autofire_rates=7.5,15,20,30

Or if you wanna be crazy, you can do:
autofire_rates=15,20,0b000111

that custom entry at the end would give you three frames on, three frames off similar to how retroarch and (I think) MAME let you configure it.
User avatar
jehu
Posts: 532
Joined: Tue Oct 05, 2021 3:15 am
Location: Space Bomber 1-3

Re: MiSTerFPGA autofire updates testing request

Post by jehu »

I’ve been enjoying the fruits of your labor in silence at home, and I thought it would be better to pop in and express my gratitude. Such a nice feature - thank you!
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

jehu wrote: Mon Jan 19, 2026 3:29 pm I’ve been enjoying the fruits of your labor in silence at home, and I thought it would be better to pop in and express my gratitude. Such a nice feature - thank you!
Glad to hear it! I'm about to submit my PR to add all these features into MiSTer officially so let's hope it all passes muster there.
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

After a heavy refactor and optimization, this is going to be my final release candidate for testing. I've not been able to find any bugs and nobody has reported any to me, so this will be the code I submit to MiSTer for final approval. Finally MiSTer will have autofire settings similar to what MAME and Retroarch already offer.

https://drive.proton.me/urls/NSCA84RA3R#hzbfdIlqknWo
User avatar
BareKnuckleRoo
Posts: 6944
Joined: Mon Oct 03, 2011 4:01 am
Location: Southern Ontario

Re: MiSTerFPGA autofire updates testing request

Post by BareKnuckleRoo »

Very nice!
deepthaw
Posts: 17
Joined: Thu Jun 11, 2020 7:49 pm

Re: MiSTerFPGA autofire updates testing request

Post by deepthaw »

This has been accepted into MiSTer main and is now available via the unstable nightly builds. This is the last time I’ll spam everybody until the next release build of MiSTer hits and I’ll re-post how to set it up with more advanced options like frame patterns/etc.
Post Reply