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

Super Scope support added, some other changes #276

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

DigiDwrf
Copy link
Contributor

@DigiDwrf DigiDwrf commented Apr 8, 2024

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.
}

@DigiDwrf
Copy link
Contributor Author

DigiDwrf commented Apr 8, 2024

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 <alekmaul@portabledev.com>
@alekmaul alekmaul merged commit 7123743 into alekmaul:develop Apr 9, 2024
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