*** empty log message ***
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40320
This commit is contained in:
parent
75baede7db
commit
a437e285ca
6 changed files with 275 additions and 157 deletions
49
README.MiNT
49
README.MiNT
|
@ -45,7 +45,7 @@ III. Enjoy! :)
|
||||||
==============================================================================
|
==============================================================================
|
||||||
IV. What is supported:
|
IV. What is supported:
|
||||||
|
|
||||||
Keyboard (GEMDOS, BIOS, Ikbd)
|
Keyboard (GEMDOS, BIOS, GEM, Ikbd)
|
||||||
Mouse (XBIOS, GEM, Ikbd)
|
Mouse (XBIOS, GEM, Ikbd)
|
||||||
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
|
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
|
||||||
Timer (VBL vector)
|
Timer (VBL vector)
|
||||||
|
@ -61,7 +61,10 @@ Video Kbd Mouse Timer Jstick Joypads
|
||||||
xbios ikbd ikbd vbl ikbd hardware
|
xbios ikbd ikbd vbl ikbd hardware
|
||||||
xbios gemdos xbios vbl xbios hardware
|
xbios gemdos xbios vbl xbios hardware
|
||||||
xbios bios xbios vbl xbios hardware
|
xbios bios xbios vbl xbios hardware
|
||||||
gem gem gem vbl xbios hardware
|
gem gem gem(*) vbl xbios hardware
|
||||||
|
|
||||||
|
(*) GEM does not report relative mouse motion, so xbios mouse driver is used
|
||||||
|
to report this type event.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
V. Environment variables:
|
V. Environment variables:
|
||||||
|
@ -108,6 +111,48 @@ SDL_JOYSTICK_ATARI:
|
||||||
Lightpen and analog paddle are 2 buttons, 2 axis controllers. The 2
|
Lightpen and analog paddle are 2 buttons, 2 axis controllers. The 2
|
||||||
buttons are those affected to 1 button joysticks on the same port.
|
buttons are those affected to 1 button joysticks on the same port.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
VI. More informations about drivers:
|
||||||
|
|
||||||
|
Xbios video:
|
||||||
|
Video chip is detected using the _VDO cookie.
|
||||||
|
Screen enhancers are not supported, but could be if you know how to
|
||||||
|
use them.
|
||||||
|
|
||||||
|
ST, STE, Mega ST, Mega STE:
|
||||||
|
320x200x4 bits, shades of grey, available only for the purpose
|
||||||
|
of testing SDL.
|
||||||
|
TT:
|
||||||
|
320x480x8 and 320x240x8 (software double-lined mode).
|
||||||
|
Falcon:
|
||||||
|
All modes supported by the current monitor (RVB or VGA).
|
||||||
|
Clones and any machine with monochrome monitor:
|
||||||
|
Not supported.
|
||||||
|
|
||||||
|
Gem video:
|
||||||
|
Automatically used if xbios not available.
|
||||||
|
|
||||||
|
All machines:
|
||||||
|
Only the current resolution, if 8 bits or higher depth.
|
||||||
|
|
||||||
|
IKBD keyboard, mouse and joystick driver:
|
||||||
|
Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
|
||||||
|
|
||||||
|
Hades has an IKBD, but xbios is not available for video, so IKBD
|
||||||
|
driver is disabled.
|
||||||
|
|
||||||
|
Gemdos and bios keyboard driver:
|
||||||
|
Available on all machines.
|
||||||
|
|
||||||
|
Mouse and joystick xbios driver:
|
||||||
|
Available on all machines (I think).
|
||||||
|
|
||||||
|
Joypad driver:
|
||||||
|
Available if _MCH cookie is STE or Falcon.
|
||||||
|
|
||||||
|
VBL timer driver:
|
||||||
|
Available all machines (I think).
|
||||||
|
|
||||||
--
|
--
|
||||||
Patrice Mandin <pmandin@caramail.com>
|
Patrice Mandin <pmandin@caramail.com>
|
||||||
http://membres.lycos.fr/pmandin/
|
http://membres.lycos.fr/pmandin/
|
||||||
|
|
|
@ -43,7 +43,8 @@ static char rcsid =
|
||||||
#include "SDL_events_c.h"
|
#include "SDL_events_c.h"
|
||||||
#include "SDL_gemvideo.h"
|
#include "SDL_gemvideo.h"
|
||||||
#include "SDL_gemevents_c.h"
|
#include "SDL_gemevents_c.h"
|
||||||
#include "../ataricommon/SDL_atarikeys.h" /* for keyboard scancodes */
|
#include "SDL_atarikeys.h" /* for keyboard scancodes */
|
||||||
|
#include "SDL_xbiosinterrupt_s.h"
|
||||||
|
|
||||||
/* Defines */
|
/* Defines */
|
||||||
|
|
||||||
|
@ -55,8 +56,6 @@ static unsigned char gem_currentkeyboard[ATARIBIOS_MAXKEYS];
|
||||||
static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS];
|
static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS];
|
||||||
static unsigned char gem_currentascii[ATARIBIOS_MAXKEYS];
|
static unsigned char gem_currentascii[ATARIBIOS_MAXKEYS];
|
||||||
|
|
||||||
static short prevmousex, prevmousey, prevmouseb;
|
|
||||||
|
|
||||||
/* The translation tables from a console scancode to a SDL keysym */
|
/* The translation tables from a console scancode to a SDL keysym */
|
||||||
static SDLKey keymap[ATARIBIOS_MAXKEYS];
|
static SDLKey keymap[ATARIBIOS_MAXKEYS];
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ static SDLKey keymap[ATARIBIOS_MAXKEYS];
|
||||||
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
|
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
|
||||||
static int do_messages(_THIS, short *message);
|
static int do_messages(_THIS, short *message);
|
||||||
static void do_keyboard(short kc, short ks);
|
static void do_keyboard(short kc, short ks);
|
||||||
static void do_mouse(_THIS, short mx, short my, short mb);
|
static void do_mouse(_THIS, short mx, short my, short mb, short ks);
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
|
@ -124,22 +123,23 @@ void GEM_InitOSKeymap(_THIS)
|
||||||
keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
|
keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
|
||||||
|
|
||||||
/* Mouse init */
|
/* Mouse init */
|
||||||
prevmousex = prevmousey = prevmouseb = 0;
|
|
||||||
GEM_mouse_relative = SDL_FALSE;
|
GEM_mouse_relative = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEM_PumpEvents(_THIS)
|
void GEM_PumpEvents(_THIS)
|
||||||
{
|
{
|
||||||
short mx, my, mb, dummy;
|
short mousex, mousey, mouseb, dummy;
|
||||||
|
short kstate, prevkc, prevks;
|
||||||
int i;
|
int i;
|
||||||
SDL_keysym keysym;
|
SDL_keysym keysym;
|
||||||
|
|
||||||
memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
|
memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
|
||||||
|
prevkc = prevks = 0;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int quit, resultat;
|
int quit, resultat;
|
||||||
short buffer[8], kc, ks;
|
short buffer[8], kc;
|
||||||
|
|
||||||
quit = 0;
|
quit = 0;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void GEM_PumpEvents(_THIS)
|
||||||
0,0,0,0,0,
|
0,0,0,0,0,
|
||||||
buffer,
|
buffer,
|
||||||
10,
|
10,
|
||||||
&dummy,&dummy,&dummy,&ks,&kc,&dummy
|
&dummy,&dummy,&dummy,&kstate,&kc,&dummy
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Message event ? */
|
/* Message event ? */
|
||||||
|
@ -158,10 +158,14 @@ void GEM_PumpEvents(_THIS)
|
||||||
quit = do_messages(this, buffer);
|
quit = do_messages(this, buffer);
|
||||||
|
|
||||||
/* Keyboard event ? */
|
/* Keyboard event ? */
|
||||||
if (resultat & MU_KEYBD)
|
if (resultat & MU_KEYBD) {
|
||||||
do_keyboard(kc,ks);
|
if ((prevkc != kc) || (prevks != kstate)) {
|
||||||
else
|
do_keyboard(kc,kstate);
|
||||||
do_keyboard(0,0);
|
} else {
|
||||||
|
/* Avoid looping, if repeating same key */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Timer event ? */
|
/* Timer event ? */
|
||||||
if ((resultat & MU_TIMER) || quit)
|
if ((resultat & MU_TIMER) || quit)
|
||||||
|
@ -169,10 +173,10 @@ void GEM_PumpEvents(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update mouse */
|
/* Update mouse */
|
||||||
graf_mkstate(&mx, &my, &mb, &dummy);
|
graf_mkstate(&mousex, &mousey, &mouseb, &kstate);
|
||||||
do_mouse(this, mx, my, mb);
|
do_mouse(this, mousex, mousey, mouseb, kstate);
|
||||||
|
|
||||||
/* Now generates keyboard events */
|
/* Now generate keyboard events */
|
||||||
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
|
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
|
||||||
/* Key pressed ? */
|
/* Key pressed ? */
|
||||||
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
|
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
|
||||||
|
@ -259,7 +263,6 @@ static int do_messages(_THIS, short *message)
|
||||||
static void do_keyboard(short kc, short ks)
|
static void do_keyboard(short kc, short ks)
|
||||||
{
|
{
|
||||||
int scancode, asciicode;
|
int scancode, asciicode;
|
||||||
short dummy;
|
|
||||||
|
|
||||||
if (kc) {
|
if (kc) {
|
||||||
scancode=(kc>>8) & 127;
|
scancode=(kc>>8) & 127;
|
||||||
|
@ -269,9 +272,6 @@ static void do_keyboard(short kc, short ks)
|
||||||
gem_currentascii[scancode]=asciicode;
|
gem_currentascii[scancode]=asciicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ks)
|
|
||||||
graf_mkstate(&dummy, &dummy, &dummy, &ks);
|
|
||||||
|
|
||||||
/* Read special keys */
|
/* Read special keys */
|
||||||
if (ks & K_RSHIFT)
|
if (ks & K_RSHIFT)
|
||||||
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
|
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
|
||||||
|
@ -283,16 +283,15 @@ static void do_keyboard(short kc, short ks)
|
||||||
gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF;
|
gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_mouse(_THIS, short mx, short my, short mb)
|
static void do_mouse(_THIS, short mx, short my, short mb, short ks)
|
||||||
{
|
{
|
||||||
|
static short prevmousex=0, prevmousey=0, prevmouseb=0;
|
||||||
|
|
||||||
/* Mouse motion ? */
|
/* Mouse motion ? */
|
||||||
if ((prevmousex!=mx) || (prevmousey!=my)) {
|
if ((prevmousex!=mx) || (prevmousey!=my)) {
|
||||||
if (GEM_mouse_relative) {
|
if (GEM_mouse_relative) {
|
||||||
short wind_pxy[8];
|
SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
|
||||||
|
SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
|
||||||
wind_get(GEM_handle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3]);
|
|
||||||
|
|
||||||
SDL_PrivateMouseMotion(0, 1, mx-wind_pxy[0], my-wind_pxy[1]);
|
|
||||||
} else {
|
} else {
|
||||||
SDL_PrivateMouseMotion(0, 1, mx, my);
|
SDL_PrivateMouseMotion(0, 1, mx, my);
|
||||||
}
|
}
|
||||||
|
@ -304,19 +303,29 @@ static void do_mouse(_THIS, short mx, short my, short mb)
|
||||||
if (prevmouseb!=mb) {
|
if (prevmouseb!=mb) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0;i<3;i++) {
|
for (i=0;i<2;i++) {
|
||||||
int curbutton, prevbutton;
|
int curbutton, prevbutton;
|
||||||
|
|
||||||
curbutton = mb & (1<<i);
|
curbutton = mb & (1<<i);
|
||||||
prevbutton = prevmouseb & (1<<i);
|
prevbutton = prevmouseb & (1<<i);
|
||||||
|
|
||||||
if (curbutton & !prevbutton) {
|
if (curbutton && !prevbutton) {
|
||||||
SDL_PrivateMouseButton(SDL_PRESSED, i, 0, 0);
|
SDL_PrivateMouseButton(SDL_PRESSED, i+1, 0, 0);
|
||||||
}
|
}
|
||||||
if (!curbutton & prevbutton) {
|
if (!curbutton && prevbutton) {
|
||||||
SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0);
|
SDL_PrivateMouseButton(SDL_RELEASED, i+1, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevmouseb = mb;
|
prevmouseb = mb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read special keys */
|
||||||
|
if (ks & K_RSHIFT)
|
||||||
|
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
|
||||||
|
if (ks & K_LSHIFT)
|
||||||
|
gem_currentkeyboard[SCANCODE_LEFTSHIFT]=0xFF;
|
||||||
|
if (ks & K_CTRL)
|
||||||
|
gem_currentkeyboard[SCANCODE_LEFTCONTROL]=0xFF;
|
||||||
|
if (ks & K_ALT)
|
||||||
|
gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,21 +136,26 @@ int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
|
void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
|
||||||
{
|
{
|
||||||
|
/* This seems to work only on AES 3.4 (Falcon) */
|
||||||
|
|
||||||
EVNTREC warpevent;
|
EVNTREC warpevent;
|
||||||
|
|
||||||
warpevent.ap_event = APPEVNT_MOUSE;
|
warpevent.ap_event = APPEVNT_MOUSE;
|
||||||
warpevent.ap_value = (y << 16) | x;
|
warpevent.ap_value = (x << 16) | y;
|
||||||
|
|
||||||
appl_tplay(&warpevent, 1, 1000);
|
appl_tplay(&warpevent, 1, 1000);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GEM_CheckMouseMode(_THIS)
|
void GEM_CheckMouseMode(_THIS)
|
||||||
{
|
{
|
||||||
/* If the mouse is hidden and input is grabbed, we use relative mode */
|
/* If the mouse is hidden and input is grabbed, we use relative mode */
|
||||||
if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
|
if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
|
||||||
(this->input_grab != SDL_GRAB_OFF) ) {
|
(this->input_grab != SDL_GRAB_OFF) &&
|
||||||
|
(SDL_GetAppState() & SDL_APPACTIVE) ) {
|
||||||
GEM_mouse_relative = SDL_TRUE;
|
GEM_mouse_relative = SDL_TRUE;
|
||||||
} else {
|
} else {
|
||||||
GEM_mouse_relative = SDL_FALSE;
|
GEM_mouse_relative = SDL_FALSE;
|
||||||
|
|
|
@ -32,6 +32,7 @@ extern void GEM_FreeWMCursor(_THIS, WMcursor *cursor);
|
||||||
extern WMcursor *GEM_CreateWMCursor(_THIS,
|
extern WMcursor *GEM_CreateWMCursor(_THIS,
|
||||||
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
||||||
extern int GEM_ShowWMCursor(_THIS, WMcursor *cursor);
|
extern int GEM_ShowWMCursor(_THIS, WMcursor *cursor);
|
||||||
|
#if 0
|
||||||
extern void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
|
extern void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
|
||||||
extern void GEM_CheckMouseModeNoLock(_THIS);
|
#endif
|
||||||
extern void GEM_CheckMouseMode(_THIS);
|
extern void GEM_CheckMouseMode(_THIS);
|
||||||
|
|
|
@ -51,6 +51,7 @@ static char rcsid =
|
||||||
#include "SDL_sysvideo.h"
|
#include "SDL_sysvideo.h"
|
||||||
#include "SDL_pixels_c.h"
|
#include "SDL_pixels_c.h"
|
||||||
#include "SDL_events_c.h"
|
#include "SDL_events_c.h"
|
||||||
|
#include "SDL_cursor_c.h"
|
||||||
|
|
||||||
#include "SDL_ataric2p_s.h"
|
#include "SDL_ataric2p_s.h"
|
||||||
#include "SDL_ataric2p060_c.h"
|
#include "SDL_ataric2p060_c.h"
|
||||||
|
@ -95,6 +96,9 @@ static int GEM_ToggleFullScreen(_THIS, int on);
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
static void GEM_FreeBuffers(_THIS);
|
static void GEM_FreeBuffers(_THIS);
|
||||||
|
static void GEM_ClearScreen(_THIS);
|
||||||
|
static void GEM_LockScreen(_THIS);
|
||||||
|
static void GEM_UnlockScreen(_THIS);
|
||||||
static void refresh_window(_THIS, int winhandle, short *rect);
|
static void refresh_window(_THIS, int winhandle, short *rect);
|
||||||
|
|
||||||
/* GEM driver bootstrap functions */
|
/* GEM driver bootstrap functions */
|
||||||
|
@ -174,11 +178,11 @@ static SDL_VideoDevice *GEM_CreateDevice(int devindex)
|
||||||
device->FreeWMCursor = GEM_FreeWMCursor;
|
device->FreeWMCursor = GEM_FreeWMCursor;
|
||||||
device->CreateWMCursor = GEM_CreateWMCursor;
|
device->CreateWMCursor = GEM_CreateWMCursor;
|
||||||
device->ShowWMCursor = GEM_ShowWMCursor;
|
device->ShowWMCursor = GEM_ShowWMCursor;
|
||||||
device->WarpWMCursor = GEM_WarpWMCursor;
|
device->WarpWMCursor = NULL /*GEM_WarpWMCursor*/;
|
||||||
device->CheckMouseMode = GEM_CheckMouseMode;
|
device->CheckMouseMode = GEM_CheckMouseMode;
|
||||||
|
|
||||||
/* Joystick */
|
/* Joystick + Mouse relative motion */
|
||||||
SDL_AtariXbios_InstallVectors(ATARI_XBIOS_JOYSTICKEVENTS);
|
SDL_AtariXbios_InstallVectors(ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS);
|
||||||
|
|
||||||
device->free = GEM_DeleteDevice;
|
device->free = GEM_DeleteDevice;
|
||||||
|
|
||||||
|
@ -314,7 +318,7 @@ static void VDI_ReadExtInfo(_THIS, short *work_out)
|
||||||
tmp_p = (Uint16 *)&work_out[16];
|
tmp_p = (Uint16 *)&work_out[16];
|
||||||
|
|
||||||
for (i=0;i<256;i++) {
|
for (i=0;i<256;i++) {
|
||||||
vdi_index[i] = *tmp_p++;
|
vdi_index[*tmp_p++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -352,11 +356,11 @@ static void VDI_ReadExtInfo(_THIS, short *work_out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove lower green bits for Intel endian screen */
|
/* Remove lower green bits for Intel endian screen */
|
||||||
if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) {
|
if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) {
|
||||||
VDI_greenmask &= ~(7<<13);
|
VDI_greenmask &= ~(7<<13);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VDI_CLUT_NONE:
|
case VDI_CLUT_NONE:
|
||||||
|
@ -474,7 +478,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||||
VDI_screen = NULL;
|
VDI_screen = NULL;
|
||||||
VDI_ReadExtInfo(this, work_out);
|
VDI_ReadExtInfo(this, work_out);
|
||||||
if (VDI_screen == NULL) {
|
if (VDI_screen == NULL) {
|
||||||
VDI_pitch = VDI_w * ((VDI_bpp)>>3);
|
VDI_pitch = VDI_w * VDI_pixelsize;
|
||||||
VDI_format = VDI_FORMAT_UNKNOWN;
|
VDI_format = VDI_FORMAT_UNKNOWN;
|
||||||
VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
|
VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
|
||||||
}
|
}
|
||||||
|
@ -539,6 +543,56 @@ static void GEM_FreeBuffers(_THIS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GEM_ClearScreen(_THIS)
|
||||||
|
{
|
||||||
|
short rgb[3]={0,0,0};
|
||||||
|
short oldrgb[3];
|
||||||
|
short pxy[4];
|
||||||
|
|
||||||
|
v_hide_c(VDI_handle);
|
||||||
|
|
||||||
|
vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
|
||||||
|
vs_color(VDI_handle, vdi_index[0], rgb);
|
||||||
|
|
||||||
|
pxy[0] = pxy[1] = 0;
|
||||||
|
pxy[2] = VDI_w - 1;
|
||||||
|
pxy[3] = VDI_h - 1;
|
||||||
|
vsf_color(VDI_handle,0);
|
||||||
|
vsf_interior(VDI_handle,1);
|
||||||
|
vsf_perimeter(VDI_handle,0);
|
||||||
|
v_bar(VDI_handle,pxy);
|
||||||
|
|
||||||
|
vs_color(VDI_handle, vdi_index[0], oldrgb);
|
||||||
|
|
||||||
|
v_show_c(VDI_handle, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GEM_LockScreen(_THIS)
|
||||||
|
{
|
||||||
|
if (!GEM_locked) {
|
||||||
|
/* Reserve memory space, used to be sure of compatibility */
|
||||||
|
form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
|
||||||
|
/* Lock AES */
|
||||||
|
wind_update(BEG_UPDATE);
|
||||||
|
wind_update(BEG_MCTRL);
|
||||||
|
|
||||||
|
GEM_locked=SDL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GEM_UnlockScreen(_THIS)
|
||||||
|
{
|
||||||
|
if (GEM_locked) {
|
||||||
|
/* Restore screen memory, and send REDRAW to all apps */
|
||||||
|
form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
|
||||||
|
/* Unlock AES */
|
||||||
|
wind_update(END_MCTRL);
|
||||||
|
wind_update(END_UPDATE);
|
||||||
|
|
||||||
|
GEM_locked=SDL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
|
SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
int width, int height, int bpp, Uint32 flags)
|
int width, int height, int bpp, Uint32 flags)
|
||||||
{
|
{
|
||||||
|
@ -574,11 +628,22 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
use_shadow=SDL_FALSE;
|
use_shadow=SDL_FALSE;
|
||||||
if (flags & SDL_FULLSCREEN) {
|
if (flags & SDL_FULLSCREEN) {
|
||||||
if (!VDI_screen) {
|
if (!VDI_screen) {
|
||||||
|
/* No access to real framebuffer, use shadow surface */
|
||||||
use_shadow=SDL_TRUE;
|
use_shadow=SDL_TRUE;
|
||||||
} else if (VDI_format==VDI_FORMAT_INTER) {
|
} else {
|
||||||
use_shadow=SDL_TRUE;
|
if (VDI_format==VDI_FORMAT_INTER) {
|
||||||
|
/* Real framebuffer, interleaved bitplanes,
|
||||||
|
use shadow surface */
|
||||||
|
use_shadow=SDL_TRUE;
|
||||||
|
} else if (flags & SDL_DOUBLEBUF) {
|
||||||
|
/* Real framebuffer, double-buffered,
|
||||||
|
use shadow surface */
|
||||||
|
use_shadow=SDL_TRUE;
|
||||||
|
modeflags |= SDL_DOUBLEBUF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* Windowed mode, always with shadow surface */
|
||||||
use_shadow=SDL_TRUE;
|
use_shadow=SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,30 +660,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
|
|
||||||
/*--- Initialize screen ---*/
|
/*--- Initialize screen ---*/
|
||||||
if (flags & SDL_FULLSCREEN) {
|
if (flags & SDL_FULLSCREEN) {
|
||||||
short rgb[3]={0,0,0};
|
GEM_LockScreen(this);
|
||||||
short pxy[4];
|
|
||||||
|
|
||||||
if (!GEM_locked) {
|
GEM_ClearScreen(this);
|
||||||
/* Reserve memory space, used to be sure of compatibility */
|
|
||||||
form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
|
|
||||||
/* Lock AES */
|
|
||||||
while (!wind_update(BEG_UPDATE|BEG_MCTRL));
|
|
||||||
|
|
||||||
GEM_locked=SDL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear screen */
|
|
||||||
pxy[0] = pxy[1] = 0;
|
|
||||||
pxy[2] = VDI_w - 1;
|
|
||||||
pxy[3] = VDI_h - 1;
|
|
||||||
vs_color(VDI_handle, vdi_index[0], rgb);
|
|
||||||
vsf_color(VDI_handle,0);
|
|
||||||
vsf_interior(VDI_handle,1);
|
|
||||||
vsf_perimeter(VDI_handle,0);
|
|
||||||
v_bar(VDI_handle,pxy);
|
|
||||||
|
|
||||||
modeflags |= SDL_FULLSCREEN;
|
modeflags |= SDL_FULLSCREEN;
|
||||||
if (VDI_screen && (VDI_format==VDI_FORMAT_PACK)) {
|
if (VDI_screen && (VDI_format==VDI_FORMAT_PACK) && !use_shadow) {
|
||||||
modeflags |= SDL_HWSURFACE;
|
modeflags |= SDL_HWSURFACE;
|
||||||
} else {
|
} else {
|
||||||
modeflags |= SDL_SWSURFACE;
|
modeflags |= SDL_SWSURFACE;
|
||||||
|
@ -627,13 +674,7 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
int posx,posy;
|
int posx,posy;
|
||||||
short x2,y2,w2,h2;
|
short x2,y2,w2,h2;
|
||||||
|
|
||||||
if (GEM_locked) {
|
GEM_UnlockScreen(this);
|
||||||
/* Restore screen memory, and send REDRAW to all apps */
|
|
||||||
form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
|
|
||||||
/* Unlock AES */
|
|
||||||
wind_update(END_UPDATE|END_MCTRL);
|
|
||||||
GEM_locked=SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Center our window */
|
/* Center our window */
|
||||||
posx = GEM_desk_x;
|
posx = GEM_desk_x;
|
||||||
|
@ -722,6 +763,9 @@ static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface)
|
||||||
static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
|
static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
|
||||||
{
|
{
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
MFDB mfdb_src;
|
||||||
|
short blitcoords[8];
|
||||||
|
int i;
|
||||||
|
|
||||||
surface = this->screen;
|
surface = this->screen;
|
||||||
|
|
||||||
|
@ -734,48 +778,70 @@ static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
|
||||||
destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
|
destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
|
||||||
destx = (VDI_w - surface->w) >> 1;
|
destx = (VDI_w - surface->w) >> 1;
|
||||||
destx &= ~15;
|
destx &= ~15;
|
||||||
destscr += VDI_pixelsize * destx;
|
destscr += destx;
|
||||||
|
|
||||||
/* Convert chunky to planar screen */
|
for (i=0;i<numrects;i++) {
|
||||||
Atari_C2pConvert(
|
void *source,*destination;
|
||||||
surface->pixels,
|
int x1,x2;
|
||||||
destscr,
|
|
||||||
surface->w,
|
x1 = rects[i].x & ~15;
|
||||||
surface->h,
|
x2 = rects[i].x+rects[i].w;
|
||||||
SDL_FALSE,
|
if (x2 & 15) {
|
||||||
surface->pitch,
|
x2 = (x2 | 15) +1;
|
||||||
VDI_pitch
|
}
|
||||||
);
|
|
||||||
|
source = surface->pixels;
|
||||||
|
source += surface->pitch * rects[i].y;
|
||||||
|
source += x1;
|
||||||
|
|
||||||
|
destination = destscr;
|
||||||
|
destination += VDI_pitch * rects[i].y;
|
||||||
|
destination += x1;
|
||||||
|
|
||||||
|
/* Convert chunky to planar screen */
|
||||||
|
Atari_C2pConvert(
|
||||||
|
source,
|
||||||
|
destination,
|
||||||
|
x2-x1,
|
||||||
|
rects[i].h,
|
||||||
|
SDL_FALSE,
|
||||||
|
surface->pitch,
|
||||||
|
VDI_pitch
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
MFDB mfdb_src;
|
|
||||||
short blitcoords[8];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
mfdb_src.fd_addr=surface->pixels;
|
if (!(surface->flags & SDL_DOUBLEBUF)) {
|
||||||
mfdb_src.fd_w=surface->w;
|
return;
|
||||||
mfdb_src.fd_h=surface->h;
|
|
||||||
mfdb_src.fd_wdwidth=(surface->w) >> 4;
|
|
||||||
mfdb_src.fd_stand=0;
|
|
||||||
mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
|
|
||||||
mfdb_src.fd_r1=0;
|
|
||||||
mfdb_src.fd_r2=0;
|
|
||||||
mfdb_src.fd_r3=0;
|
|
||||||
|
|
||||||
for ( i=0; i<numrects; ++i ) {
|
|
||||||
blitcoords[0] = rects[i].x;
|
|
||||||
blitcoords[1] = rects[i].y;
|
|
||||||
blitcoords[2] = blitcoords[0] + rects[i].w - 1;
|
|
||||||
blitcoords[3] = blitcoords[1] + rects[i].h - 1;
|
|
||||||
|
|
||||||
blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1);
|
|
||||||
blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1);
|
|
||||||
blitcoords[6] = blitcoords[4] + rects[i].w - 1;
|
|
||||||
blitcoords[7] = blitcoords[5] + rects[i].h - 1;
|
|
||||||
|
|
||||||
vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mfdb_src.fd_addr=surface->pixels;
|
||||||
|
mfdb_src.fd_w=surface->w;
|
||||||
|
mfdb_src.fd_h=surface->h;
|
||||||
|
mfdb_src.fd_wdwidth=(surface->w) >> 4;
|
||||||
|
mfdb_src.fd_stand=0;
|
||||||
|
mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
|
||||||
|
mfdb_src.fd_r1=0;
|
||||||
|
mfdb_src.fd_r2=0;
|
||||||
|
mfdb_src.fd_r3=0;
|
||||||
|
|
||||||
|
for ( i=0; i<numrects; ++i ) {
|
||||||
|
blitcoords[0] = rects[i].x;
|
||||||
|
blitcoords[1] = rects[i].y;
|
||||||
|
blitcoords[2] = blitcoords[0] + rects[i].w - 1;
|
||||||
|
blitcoords[3] = blitcoords[1] + rects[i].h - 1;
|
||||||
|
|
||||||
|
blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1);
|
||||||
|
blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1);
|
||||||
|
blitcoords[6] = blitcoords[4] + rects[i].w - 1;
|
||||||
|
blitcoords[7] = blitcoords[5] + rects[i].h - 1;
|
||||||
|
|
||||||
|
vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
|
static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
|
||||||
|
@ -810,6 +876,9 @@ static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
|
||||||
|
|
||||||
static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
|
static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
|
MFDB mfdb_src;
|
||||||
|
short blitcoords[8];
|
||||||
|
|
||||||
if (VDI_screen) {
|
if (VDI_screen) {
|
||||||
if (VDI_format==VDI_FORMAT_INTER) {
|
if (VDI_format==VDI_FORMAT_INTER) {
|
||||||
void *destscr;
|
void *destscr;
|
||||||
|
@ -820,7 +889,7 @@ static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
|
||||||
destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
|
destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
|
||||||
destx = (VDI_w - surface->w) >> 1;
|
destx = (VDI_w - surface->w) >> 1;
|
||||||
destx &= ~15;
|
destx &= ~15;
|
||||||
destscr += VDI_pixelsize * destx;
|
destscr += destx;
|
||||||
|
|
||||||
/* Convert chunky to planar screen */
|
/* Convert chunky to planar screen */
|
||||||
Atari_C2pConvert(
|
Atari_C2pConvert(
|
||||||
|
@ -832,32 +901,35 @@ static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
|
||||||
surface->pitch,
|
surface->pitch,
|
||||||
VDI_pitch
|
VDI_pitch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
MFDB mfdb_src;
|
|
||||||
short blitcoords[8];
|
|
||||||
|
|
||||||
mfdb_src.fd_addr=surface->pixels;
|
if (!(surface->flags & SDL_DOUBLEBUF)) {
|
||||||
mfdb_src.fd_w=surface->w;
|
return(0);
|
||||||
mfdb_src.fd_h=surface->h;
|
}
|
||||||
mfdb_src.fd_wdwidth=(surface->w) >> 4;
|
|
||||||
mfdb_src.fd_stand=0;
|
|
||||||
mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
|
|
||||||
mfdb_src.fd_r1=0;
|
|
||||||
mfdb_src.fd_r2=0;
|
|
||||||
mfdb_src.fd_r3=0;
|
|
||||||
|
|
||||||
blitcoords[0] = 0;
|
|
||||||
blitcoords[1] = 0;
|
|
||||||
blitcoords[2] = surface->w - 1;
|
|
||||||
blitcoords[3] = surface->h - 1;
|
|
||||||
blitcoords[4] = (VDI_w - surface->w) >> 1;
|
|
||||||
blitcoords[5] = (VDI_h - surface->h) >> 1;
|
|
||||||
blitcoords[6] = blitcoords[4] + surface->w - 1;
|
|
||||||
blitcoords[7] = blitcoords[5] + surface->h - 1;
|
|
||||||
|
|
||||||
vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mfdb_src.fd_addr=surface->pixels;
|
||||||
|
mfdb_src.fd_w=surface->w;
|
||||||
|
mfdb_src.fd_h=surface->h;
|
||||||
|
mfdb_src.fd_wdwidth=(surface->w) >> 4;
|
||||||
|
mfdb_src.fd_stand=0;
|
||||||
|
mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
|
||||||
|
mfdb_src.fd_r1=0;
|
||||||
|
mfdb_src.fd_r2=0;
|
||||||
|
mfdb_src.fd_r3=0;
|
||||||
|
|
||||||
|
blitcoords[0] = 0;
|
||||||
|
blitcoords[1] = 0;
|
||||||
|
blitcoords[2] = surface->w - 1;
|
||||||
|
blitcoords[3] = surface->h - 1;
|
||||||
|
blitcoords[4] = (VDI_w - surface->w) >> 1;
|
||||||
|
blitcoords[5] = (VDI_h - surface->h) >> 1;
|
||||||
|
blitcoords[6] = blitcoords[4] + surface->w - 1;
|
||||||
|
blitcoords[7] = blitcoords[5] + surface->h - 1;
|
||||||
|
|
||||||
|
vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -894,7 +966,6 @@ static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < ncolors; i++)
|
for(i = 0; i < ncolors; i++)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
@ -918,18 +989,9 @@ static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
|
||||||
static int GEM_ToggleFullScreen(_THIS, int on)
|
static int GEM_ToggleFullScreen(_THIS, int on)
|
||||||
{
|
{
|
||||||
if (on) {
|
if (on) {
|
||||||
if (!GEM_locked) {
|
GEM_LockScreen(this);
|
||||||
/* Lock AES */
|
|
||||||
while (!wind_update(BEG_UPDATE|BEG_MCTRL));
|
|
||||||
GEM_locked=SDL_TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (GEM_locked) {
|
GEM_UnlockScreen(this);
|
||||||
/* Unlock AES */
|
|
||||||
wind_update(END_UPDATE|END_MCTRL);
|
|
||||||
GEM_locked=SDL_FALSE;
|
|
||||||
}
|
|
||||||
/* Redraw all screen */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
|
@ -945,15 +1007,8 @@ void GEM_VideoQuit(_THIS)
|
||||||
|
|
||||||
GEM_FreeBuffers(this);
|
GEM_FreeBuffers(this);
|
||||||
|
|
||||||
if (GEM_locked) {
|
GEM_UnlockScreen(this);
|
||||||
/* Restore screen memory, and send REDRAW to all apps */
|
|
||||||
form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
|
|
||||||
/* Unlock AES */
|
|
||||||
wind_update(END_UPDATE|END_MCTRL);
|
|
||||||
GEM_locked=SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close AES application */
|
|
||||||
appl_exit();
|
appl_exit();
|
||||||
|
|
||||||
/* Restore palette */
|
/* Restore palette */
|
||||||
|
@ -990,7 +1045,7 @@ void GEM_wind_redraw(_THIS, int winhandle, short *inside)
|
||||||
short todo[4];
|
short todo[4];
|
||||||
|
|
||||||
/* Tell AES we are going to update */
|
/* Tell AES we are going to update */
|
||||||
while (!wind_update(BEG_UPDATE));
|
wind_update(BEG_UPDATE);
|
||||||
|
|
||||||
v_hide_c(VDI_handle);
|
v_hide_c(VDI_handle);
|
||||||
|
|
||||||
|
|
|
@ -639,7 +639,10 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
|
||||||
int x1,x2;
|
int x1,x2;
|
||||||
|
|
||||||
x1 = rects[i].x & ~15;
|
x1 = rects[i].x & ~15;
|
||||||
x2 = ((rects[i].x+rects[i].w) | 15) +1;
|
x2 = rects[i].x+rects[i].w;
|
||||||
|
if (x2 & 15) {
|
||||||
|
x2 = (x2 | 15) +1;
|
||||||
|
}
|
||||||
|
|
||||||
source = surface->pixels;
|
source = surface->pixels;
|
||||||
source += surface->pitch * rects[i].y;
|
source += surface->pitch * rects[i].y;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue