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

Support zero-prefixed switch names #29

Merged
merged 2 commits into from
Jan 5, 2023
Merged

Support zero-prefixed switch names #29

merged 2 commits into from
Jan 5, 2023

Conversation

freezy
Copy link
Member

@freezy freezy commented Oct 17, 2022

This PR adds support for switch names that are prefixed with 0. It goes up to 1000, e.g. a switch named 001 will correctly be relayed to PinMAME as 1, or 099 as 99. But it won't work for let's say 0001, in this case we'll do a normal lookup, and print an error if the ROM doesn't have a switch alias named 0001.

The implementation is somewhat hacky. We just add zero-prefixed references to the lookup tables when registering the strings and keep the rest of the code "simple". We could also have added another int-based lookup table that would work for any number. @jsm174 let me know if you prefer the latter.

See also freezy/VisualPinball.Engine#430 for the same feature for coils.

This PR also adds a new s_spawn_ball event that adds a ball on the playfield for debugging.

@jsm174
Copy link
Contributor

jsm174 commented Oct 17, 2022

The implementation is somewhat hacky. We just add zero-prefixed references to the lookup tables when registering the strings and keep the rest of the code "simple". We could also have added another int-based lookup table that would work for any number. @jsm174 let me know if you prefer the latter.

Looks good! I would probably prefer the later just to be cleaner and less hacky.

@freezy freezy merged commit 6728f4e into master Jan 5, 2023
@freezy freezy deleted the fix/switch-names branch January 5, 2023 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants