FAQSGL programming related
BackForward
FAQ / SGL programming related

Peripheral / SMPC



I want to use a mouse.

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

A)
A structure called PerPoint is prepared. You can use this structure to get peripheral information for pointing devices such as mice.


How to get data for SATURN peripheral port 2?

Q)
I changed controller 1 to controller 2 and tried to work, but it didn't work.
How can it work with controller 2?

A)
The assignment of peripheral data in the SPG's Smpc_Peripheral structure is

0: SATURN port 1 or multi-tap 1 connected to port 1 |
5: Port 1 multi-tap No. 6 | (Reservation)
14: Port 1 multi-tap 15 15: SATURN port 2 or multi-tap 1 connected to port 2 |
19: Port 2 multi-tap No. 6 | (Reservation)
29: Port 2 multi-tap No. 15

Will be.

I would like to determine the type of connection peripheral.

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

A)
It is determined by referring to the structure member "id" of the variable Smpc_peripheral that SGL has. (Reference example: Smpc_peripheral [0] .id)
You can identify the type of connected device by looking at what values are in it.

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

PerAnalog:
 For racing controllers and mission sticks
PerPoint:
 For mouse
PerKeyBoard:
 For keyboard

Supplement 1
To determine the device, the following values are already defined in sl_def.h, so please refer to them.

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 "multi-controller" peripheral ID will be 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; / * Absolute value of Y-axis data * /
  Uint8 r; / * Absolute value of R-axis data * /
  Uint8 l; / * Absolute value of L-axis data * /
  Uint32 dummy2 [3]; / * Dummy 2 * /
} PerMultiControler;


How do you set the time information when saving?

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

A)
Time information can be obtained by referring to the variable Smpc_Status-> rtc of SGL. rtc is accessed as a SmpcDateTime structure.
This value is usually retained when the slInitSystem was last run.
If you want to get the latest time information, execute the slGetStatus () function and then refer to it again after 2 frames.
Use the BUP_SetDate () function to reflect the acquired time data in the save data.


The backup date is returned as a different value.

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

A)
The backup sample program in the SGL manual has a bug. The sample that comes with SGL that we are currently providing is a bugfix.
To explain the details of the bug, the day member is specified in Hex. (Actually, it must be BCD.)
Therefore, it is possible that you have registered 12 days more than you actually have.


BackForward
FAQSGL programming related
Copyright SEGA ENTERPRISES, LTD ,. 1997