Japanese
FAQSGL programming related
BackForward
FAQ/SGL programming related

Peripherals/SMPC



I want to use a mouse.

Q)
I want to use a mouse with SGL, but I couldn't find a pointing device data type, like the digital device data type.
What should I do if I want to use a mouse with SGL?

A)
A structure called PerPoint is provided. Using this structure, you can obtain peripheral information about a pointing device such as a mouse.


How to get SATURN peripheral port 2 data?

Q)
I tried changing controller 1 to controller 2, but it didn't work.
How can I make it work with controller 2 as well?

A)
Assignment of peripheral data in SGL's Smpc_Peripheral structure is as follows:

0 :SATURN port 1 or multi-tap 1 connected to port 1
|
5: Port 1 multi-tap number 6
|   (Reservation)
14: Port 1 multi-tap number 15

15: SATURN port 2 or multi tap 1 connected to port 2
|
19: Port 2 multi-tap number 6
|   (Reservation)
29: Port 2 multi-tap number 15

It will be.

I would like to determine the type of connected peripheral.

Q)
I would like to determine the type of connected peripheral.

A)
Determine by referring to the structure member "id" of the SGL variable Smpc_peripheral. (Reference example: Smpc_peripheral[0].id)
You can determine the type of connected device by checking the value here.

Peripheral data itself is referenced with the same variable regardless of the device type. For non-digital devices, please cast and use according to the type.

PerAnalog:
 For racing controller, mission stick
PerPoint:
 for mouse
PerKeyBoard:
 for keyboard

Supplement 1
To identify the device, please refer to the following values defined in sl_def.h.

PER_ID_StnPad          0x02  /* Saturn standard pad */
PER_ID_StnLacing       0x13  /* Saturn Racing Controller */
PER_ID_StnAnalog       0x15  /* Saturn analog joystick */
PER_ID_StnKeyBoard     0x34  /* Saturn keyboard */
PER_ID_MD3BtnPad       0xe1  /* Mega Drive 3 Button Pad */
PER_ID_MD6BtnPad       0xe2  /* Mega Drive 6 Button Pad */
PER_ID_ShuttleMouse    0xe3  /* Shuttle Mouse */
PER_ID_NotConnect      0xff  /* Not connected */

Supplement 2
The peripheral ID of "Multi-controller" is 0x16.
To use it, prepare the following structure:

typedef struct {       /* marcon */
  Uint8 id;            /* Peripheral ID */
  Uint8 ext;           /* Extended data size */
  Uint16 data;         /* Button current data */
  Uint16 push;         /* Button press data */
  Uint16 pull;         /* Button pull data */
  Uint8 x;             /* X-axis data absolute value */
  Uint8 y;             /* Y-axis data absolute value */
  Uint8 r;             /* R-axis data absolute value */
  Uint8 l;             /* L axis data absolute value */
  Uint32 dummy2[3];    /* dummy2 */
} PerMultiControler;


How do I set the time information when saving?

Q)
How do I set the time information when saving?

A)
The time information is stored in the SGL variable Smpc_Status-> Obtain it by referencing rtc. Access rtc as a SmpcDateTime structure.
This value usually retains the value from the last time slInitSystem was executed.
If you want to get the latest time information, execute the slGetStatus() function and refer to it again two frames later.
To reflect the acquired time data in the save data, use the BUP_SetDate() function.


The backup date is returned as a different value.

Q)
If you compress time data with BUP_SetDate() and expand it with BUP_GetDate(), the time data will change depending on the data.
Please tell me the cause.

A)
There is a bug in the backup sample program in the SGL manual. The samples attached to the SGL currently provided are bug-fixed versions.
To explain the specifics of the bug, the day member specification is set using Hex. (Actually, it has to be BCD.)
Therefore, you may have registered 12 days more than you actually do.


BackForward
FAQSGL programming related
Copyright SEGA ENTERPRISES, LTD. 1997