Super Scope support added, some other changes#276
Merged
alekmaul merged 1 commit intoalekmaul:developfrom Apr 9, 2024
Merged
Conversation
Contributor
Author
|
I forgot to delete a consoleMesenBreakpoint(), but it's done. |
What has been done:
- Super Scope code is usable and available now, comes with example mini game.
- Some minor changes to mouse support, now we can also use detectMouse() function to set snes_mouse automatically. Example was updated to display this function. MouseSpeedChange funciton was renamed to mouseSpeedChange(). My bad ^^
- Pad folder name was changed to "input"
- input folder inside old pad folder was renamed to "controller", as well as other assets
- pad.h was renamed to input.h, and every reference to that file inside other files
- input name folder was changed to "controller", as well as assets inside
- Some minor tabs
P.D. Sorry for the big change! I think that input is a more suitable name, now that we have more controlling devices in addition to pad controllers.
***SUPER SCOPE USAGE***
first, we might use detectSuperScope() on boot to detect Super Scope presence. Other way is to force detection by populating snes_sscope to 1 manually, but we dont need to do that if we call this function. We need to call this function everytime Scope gets disconnected from the system, a usefull way to do it is inside this conditional:
```
if (snes_sscope == false)
{
detectSuperScope();
// some other code you might need in your program, like displaying warning messages and stopping your game.
}
```
Here is a brief explanation of every variable we might be using:
```
extern u16 scope_holddelay; /*! \brief Hold delay. */
extern u16 scope_repdelay; /*! \brief Repeat rate. */
extern u16 scope_shothraw; /*! \brief Horizontal shot position, not adjusted. */
extern u16 scope_shotvraw; /*! \brief Vertical shot position, not adjusted. */
extern u16 scope_shoth; /*! \brief Horizontal shot position, adjusted for aim. */
extern u16 scope_shotv; /*! \brief Vertical shot position, adjusted for aim. */
extern u16 scope_centerh; /*! \brief 0x0000 is the center of the screen, positive values go to bottom right. */
extern u16 scope_centerv; /*! \brief 0x0000 is the center of the screen, positive values go to bottom right. */
extern u16 scope_down; /*! \brief flags that are currently true.*/
extern u16 scope_now; /*! \brief flags that have become true this frame.*/
extern u16 scope_held; /*! \brief flagsthat have been true for a certain length of time.*/
extern u16 scope_last; /*! \brief flags that were true on the previous frame.*/
extern u16 scope_sinceshot; /*! \brief Number of frames elapsed since last shot was fired.*/
```
for scope_down, scope_now, scope_held, scope_last, we need to mask our bits with this usefull bits:
```
typedef enum SUPERSCOPE_BITS
{
SSC_FIRE = BIT(15), //!< superscope FIRE button.
SSC_CURSOR = BIT(14), //!< superscope CURSOR button.
SSC_PAUSE = BIT(12), //!< superscope PAUSE button.
SSC_TURBO = BIT(13), //!< superscope TURBO flag.
SSC_OFFSCREEN = BIT(9), //!< superscope OFFSCREEN flag.
SSC_NOISE = BIT(8), //!< superscope NOISE flag.
} SUPERSCOPE_BITS;
```
And that's most of it. You can look inside the example file to have an idea of how you can program Super Scope games.
***MOUSE USAGE UPDATE***
Same as Super Scope, mouse uses detectMouse() to populate snes_mouse to 1, so It can be called at boot and like this:
```
if (snes_mouse == false)
{
detectMouse();
// some other code you might need in your program, like displaying warning messages and stopping your game.
}
```
Co-Authored-By: alekmaul <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What has been done:
P.D. Sorry for the big change! I think that input is a more suitable name, now that we have more controlling devices in addition to pad controllers.
SUPER SCOPE USAGE
first, we might use detectSuperScope() on boot to detect Super Scope presence. Other way is to force detection by populating snes_sscope to 1 manually, but we dont need to do that if we call this function. We need to call this function everytime Scope gets disconnected from the system, a usefull way to do it is inside this conditional:
Here is a brief explanation of every variable we might be using:
for scope_down, scope_now, scope_held, scope_last, we need to mask our bits with this usefull bits:
And that's most of it. You can look inside the example file to have an idea of how you can program Super Scope games.
MOUSE USAGE UPDATE
Same as Super Scope, mouse uses detectMouse() to populate snes_mouse to 1, so It can be called at boot and like this: