8 #define SCREENLIST(w, h) ((h) | (w) << 16)
9 #define JOYPOS(pos, min, max) (((((float)(pos) - (float)(min)) * 2.0) / ((float)(max) - (float)(min) + 1.0)) - 1.0)
32 static int driver_init(
char *title,
int w,
int h,
int depth_arg,
int refresh_rate,
int flags)
34 int depth =
MAX(8, depth_arg);
46 if (!XVideoSetMode(w, h, depth == 32 ? 24 : depth, refresh_rate))
115 while (XVideoListModes(&vm, depth, 0, &p)) {
117 new_modes = realloc(modes,
sizeof(
int) * num);
124 modes[num - 1] =
SCREENLIST(vm.width, vm.height);
162 void fb_hScreenInfo(ssize_t *width, ssize_t *height, ssize_t *depth, ssize_t *refresh)
167 vm = XVideoGetMode();
172 *refresh = vm.refresh;
176 FBCALL int fb_GfxGetJoystick(
int id, ssize_t *buttons,
float *a1,
float *a2,
float *a3,
float *a4,
float *a5,
float *a6,
float *a7,
float *a8)
181 *a1 = *a2 = *a3 = *a4 = *a5 = *a6 = *a7 = *a8 = -1000.0;
183 if ((
id < 0) || (
id >= 4) || (!g_Pads[
id].hPresent))
193 *buttons = !!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_A] |
194 (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_B] << 1) |
195 (!!g_Pads[
id].CurrentButtons.ucAnalogButtons[XPAD_X] << 2) |
196 (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_Y] << 3) |
197 (!!g_Pads[
id].CurrentButtons.ucAnalogButtons[XPAD_BLACK] << 4) |
198 (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_WHITE] << 5) |
199 (!!(g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_START) << 6) |
200 (!!(g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_BACK) << 7) |
201 (!!(g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_LEFT_THUMB) << 8) |
202 (!!(g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_RIGHT_THUMB) << 9);
204 *a1 =
JOYPOS(g_Pads[
id].sLThumbX, -32768, 32767);
205 *a2 = -
JOYPOS(g_Pads[
id].sLThumbY, -32768, 32767);
206 *a3 =
JOYPOS(g_Pads[
id].sRThumbX, -32768, 32767);
207 *a4 = -
JOYPOS(g_Pads[
id].sRThumbY, -32768, 32767);
208 *a5 = (
JOYPOS(g_Pads[
id].CurrentButtons.ucAnalogButtons[XPAD_LEFT_TRIGGER], 0, 255) + 1.0) / 2.0;
209 *a6 = (
JOYPOS(g_Pads[
id].CurrentButtons.ucAnalogButtons[XPAD_RIGHT_TRIGGER], 0, 255) + 1.0) / 2.0;
211 if (g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_DPAD_RIGHT)
213 else if (g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_DPAD_LEFT)
218 if (g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_DPAD_DOWN)
220 else if (g_Pads[
id].CurrentButtons.usDigitalButtons & XPAD_DPAD_UP)