i_video.c: remove old cruft and dead code

This commit is contained in:
Ronald Kinard 2014-03-19 18:15:58 -05:00
parent 89cfb674d9
commit c282fe9dec
1 changed files with 6 additions and 433 deletions

View File

@ -19,9 +19,7 @@
#include <stdlib.h> #include <stdlib.h>
#ifndef _WIN32_WCE
#include <signal.h> #include <signal.h>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4214 4244) #pragma warning(disable : 4214 4244)
@ -38,16 +36,6 @@
#pragma warning(default : 4214 4244) #pragma warning(default : 4214 4244)
#endif #endif
#if SDL_VERSION_ATLEAST(1,2,9) && defined (_arch_dreamcast)
#define HAVE_DCSDL
#include "SDL_dreamcast.h"
#endif
#if SDL_VERSION_ATLEAST(1,2,9) && defined (GP2X)
#define HAVE_GP2XSDL
#include "SDL_gp2x.h"
#endif
#if SDL_VERSION_ATLEAST(1,3,0) #if SDL_VERSION_ATLEAST(1,3,0)
#define SDLK_EQUALS SDLK_KP_EQUALSAS400 #define SDLK_EQUALS SDLK_KP_EQUALSAS400
#define SDLK_LMETA SDLK_LGUI #define SDLK_LMETA SDLK_LGUI
@ -62,10 +50,6 @@
#ifdef HAVE_IMAGE #ifdef HAVE_IMAGE
#include "SDL_image.h" #include "SDL_image.h"
#elseif !(defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X))
#define LOAD_XPM //I want XPM!
#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so
#define HAVE_IMAGE //I have SDL_Image, sortof
#endif #endif
#ifdef HAVE_IMAGE #ifdef HAVE_IMAGE
@ -74,24 +58,10 @@
#include "../doomdef.h" #include "../doomdef.h"
#if defined (_WIN32) && !defined (_XBOX) #if defined (_WIN32)
#include "SDL_syswm.h" #include "SDL_syswm.h"
#endif #endif
#ifdef _arch_dreamcast
#include <conio/conio.h>
#include <dc/maple.h>
#include <dc/maple/vmu.h>
//#include "SRB2DC/VMU.xbm"
//#include <dc/pvr.h>
//#define malloc pvr_mem_malloc
//#define free pvr_mem_free
#endif
#if defined (_XBOX) && defined (__GNUC__)
#include <openxdk/debug.h>
#endif
#include "../doomstat.h" #include "../doomstat.h"
#include "../i_system.h" #include "../i_system.h"
#include "../v_video.h" #include "../v_video.h"
@ -115,27 +85,13 @@
#include "ogl_sdl.h" #include "ogl_sdl.h"
#endif #endif
#ifdef REMOTE_DEBUGGING
#ifdef _WII
#include <debug.h>
#endif
#endif
#ifdef HAVE_FILTER #ifdef HAVE_FILTER
#define FILTERS #define FILTERS
#include "filter/filters.h" #include "filter/filters.h"
#endif #endif
// maximum number of windowed modes (see windowedModes[][]) // maximum number of windowed modes (see windowedModes[][])
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
#define MAXWINMODES (1)
#elif defined (WII)
#define MAXWINMODES (8)
#elif defined (_PS3)
#define MAXWINMODES (26)
#else
#define MAXWINMODES (27) #define MAXWINMODES (27)
#endif
/** \brief /** \brief
*/ */
@ -150,11 +106,7 @@ rendermode_t rendermode=render_soft;
boolean highcolor = false; boolean highcolor = false;
// synchronize page flipping with screen refresh // synchronize page flipping with screen refresh
#if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL))
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#else
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
UINT8 graphics_started = 0; // Is used in console.c and screen.c UINT8 graphics_started = 0; // Is used in console.c and screen.c
@ -179,30 +131,14 @@ static SDL_Surface *bufSurface = NULL;
static SDL_Surface *icoSurface = NULL; static SDL_Surface *icoSurface = NULL;
static SDL_Color localPalette[256]; static SDL_Color localPalette[256];
static SDL_Rect **modeList = NULL; static SDL_Rect **modeList = NULL;
#ifdef DC
static Uint8 BitsPerPixel = 15;
#else
static Uint8 BitsPerPixel = 16; static Uint8 BitsPerPixel = 16;
#endif
static Uint16 realwidth = BASEVIDWIDTH; static Uint16 realwidth = BASEVIDWIDTH;
static Uint16 realheight = BASEVIDHEIGHT; static Uint16 realheight = BASEVIDHEIGHT;
#ifdef _WIN32_WCE
static const Uint32 surfaceFlagsW = SDL_HWPALETTE; //Can't handle WinCE changing sides
#else
static const Uint32 surfaceFlagsW = 0/*|SDL_RESIZABLE*/; static const Uint32 surfaceFlagsW = 0/*|SDL_RESIZABLE*/;
#endif
#ifdef _PSP
static const Uint32 surfaceFlagsF = SDL_HWSURFACE|SDL_FULLSCREEN;
#else
static const Uint32 surfaceFlagsF = 0; static const Uint32 surfaceFlagsF = 0;
#endif
static SDL_bool mousegrabok = SDL_TRUE; static SDL_bool mousegrabok = SDL_TRUE;
#define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2)) #define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2))
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
static SDL_bool videoblitok = SDL_TRUE;
#else
static SDL_bool videoblitok = SDL_FALSE; static SDL_bool videoblitok = SDL_FALSE;
#endif
static SDL_bool exposevideo = SDL_FALSE; static SDL_bool exposevideo = SDL_FALSE;
// SDL2 vars // SDL2 vars
@ -213,11 +149,7 @@ static SDL_Texture *texture;
// windowed video modes from which to choose from. // windowed video modes from which to choose from.
static INT32 windowedModes[MAXWINMODES][2] = static INT32 windowedModes[MAXWINMODES][2] =
{ {
#if !(defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined (GP2X))
#ifndef WII
#ifndef _PS3
{1920,1200}, // 1.60,6.00 {1920,1200}, // 1.60,6.00
#endif
{1680,1050}, // 1.60,5.25 {1680,1050}, // 1.60,5.25
{1600,1200}, // 1.33,5.00 {1600,1200}, // 1.33,5.00
{1600,1000}, // 1.60,5.00 {1600,1000}, // 1.60,5.00
@ -236,7 +168,6 @@ static INT32 windowedModes[MAXWINMODES][2] =
{ 960, 600}, // 1.60,3.00 { 960, 600}, // 1.60,3.00
{ 800, 600}, // 1.33,2.50 { 800, 600}, // 1.33,2.50
{ 800, 500}, // 1.60,2.50 { 800, 500}, // 1.60,2.50
#endif
{ 640, 480}, // 1.33,2.00 { 640, 480}, // 1.33,2.00
{ 640, 400}, // 1.60,2.00 { 640, 400}, // 1.60,2.00
{ 576, 432}, // 1.33,1.80 { 576, 432}, // 1.33,1.80
@ -244,7 +175,6 @@ static INT32 windowedModes[MAXWINMODES][2] =
{ 416, 312}, // 1.33,1.30 { 416, 312}, // 1.33,1.30
{ 400, 300}, // 1.33,1.25 { 400, 300}, // 1.33,1.25
{ 320, 240}, // 1.33,1.00 { 320, 240}, // 1.33,1.00
#endif
{ 320, 200}, // 1.60,1.00 { 320, 200}, // 1.60,1.00
}; };
@ -252,36 +182,11 @@ static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags)
{ {
#if 0 #if 0
const char *SDLVD = I_GetEnv("SDL_VIDEODRIVER"); const char *SDLVD = I_GetEnv("SDL_VIDEODRIVER");
#ifdef _WIN32_WCE
if (bpp < 16)
bpp = 16; // 256 mode poo
#endif
#ifdef _WII
bpp = 16; // 8-bit mode poo
#endif
#ifdef DC
if (bpp < 15)
bpp = 15;
height = 240;
#endif
#ifdef PSP
bpp = 16;
#endif
#ifdef GP2X
bpp = 16;
#ifdef HAVE_GP2XSDL
height = 240;
#endif
#endif
#ifdef FILTERS #ifdef FILTERS
bpp = Setupf2x(width, height, bpp); bpp = Setupf2x(width, height, bpp);
#endif #endif
if (SDLVD && strncasecmp(SDLVD,"glSDL",6) == 0) //for glSDL videodriver if (SDLVD && strncasecmp(SDLVD,"glSDL",6) == 0) //for glSDL videodriver
vidSurface = SDL_SetVideoMode(width, height,0,SDL_DOUBLEBUF); vidSurface = SDL_SetVideoMode(width, height,0,SDL_DOUBLEBUF);
#ifdef _WII // don't want it to use HWSURFACE, so make it first here
else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF) >= bpp) // SDL Wii uses double buffering
vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF);
#endif
else if (cv_vidwait.value && videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF) >= bpp) else if (cv_vidwait.value && videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF) >= bpp)
vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF); vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF);
else if (videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE) >= bpp) else if (videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE) >= bpp)
@ -291,14 +196,6 @@ static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags)
else return; else return;
realwidth = (Uint16)width; realwidth = (Uint16)width;
realheight = (Uint16)height; realheight = (Uint16)height;
#ifdef HAVE_DCSDL
//SDL_DC_SetWindow(320,200);
SDL_DC_EmulateMouse(SDL_FALSE);
SDL_DC_EmulateKeyboard(SDL_TRUE);
#endif
#ifdef HAVE_GP2XSDL
SDL_ShowCursor(SDL_DISABLE); //For GP2X Open2x
#endif
#ifdef FILTERS #ifdef FILTERS
if (vidSurface && preSurface && f2xSurface) if (vidSurface && preSurface && f2xSurface)
{ {
@ -334,17 +231,6 @@ static INT32 SDLatekey(SDLKey sym)
#if 0 // TODO SDL2 overhaul #if 0 // TODO SDL2 overhaul
INT32 rc = sym + 0x80; INT32 rc = sym + 0x80;
#ifdef _WIN32_WCE
if (sym == SDLK_KP8)
sym = SDLK_UP;
else if (sym == SDLK_KP4)
sym = SDLK_LEFT;
else if (sym == SDLK_KP6)
sym = SDLK_RIGHT;
else if (sym == SDLK_KP2)
sym = SDLK_DOWN;
#endif
switch (sym) switch (sym)
{ {
case SDLK_LEFT: case SDLK_LEFT:
@ -527,7 +413,6 @@ static INT32 SDLatekey(SDLKey sym)
rc = KEY_PLUSPAD; rc = KEY_PLUSPAD;
break; break;
#ifndef _arch_dreamcast
case SDLK_LSUPER: case SDLK_LSUPER:
#ifdef HAVE_SDLMETAKEYS #ifdef HAVE_SDLMETAKEYS
case SDLK_LMETA: case SDLK_LMETA:
@ -544,7 +429,6 @@ static INT32 SDLatekey(SDLKey sym)
case SDLK_MENU: case SDLK_MENU:
rc = KEY_MENU; rc = KEY_MENU;
break; break;
#endif
default: default:
if (sym >= SDLK_SPACE && sym <= SDLK_DELETE) if (sym >= SDLK_SPACE && sym <= SDLK_DELETE)
@ -769,7 +653,7 @@ static void VID_Command_Mode_f (void)
#endif #endif
} }
#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE) #if defined(RPC_NO_WINDOWS_H)
static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
UNREFERENCED_PARAMETER(hWnd); UNREFERENCED_PARAMETER(hWnd);
@ -784,236 +668,15 @@ static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
#endif #endif
#if 0 //#ifdef _WIN32
// Disable Composition in Vista DWM (Desktop Window Manager) ----------------
static HMODULE DMdll = NULL;
typedef HRESULT (CALLBACK *P_DwmIsCompositionEnabled) (BOOL *pfEnabled);
static P_DwmIsCompositionEnabled pfnDwmIsCompositionEnabled = NULL;
typedef HRESULT (CALLBACK *P_DwmEnableComposition) (BOOL fEnable);
static P_DwmEnableComposition pfnDwmEnableComposition = NULL;
static BOOL AeroWasEnabled = FALSE;
static inline VOID UnloadDM(VOID)
{
pfnDwmEnableComposition = NULL;
pfnDwmIsCompositionEnabled = NULL;
if (DMdll) FreeLibrary(DMdll);
DMdll = NULL;
}
static inline BOOL LoadDM(VOID)
{
if (DMdll)
return TRUE;
DMdll = LoadLibraryA("dwmapi.dll");
if (DMdll)
I_OutputMsg("dmwapi.dll loaded, Vista's Desktop Window Manager API\n");
else
return FALSE;
pfnDwmIsCompositionEnabled = (P_DwmIsCompositionEnabled)GetProcAddress(DMdll, "DwmIsCompositionEnabled");
if (pfnDwmIsCompositionEnabled)
I_OutputMsg("Composition Aero API found, DwmIsCompositionEnabled\n");
pfnDwmEnableComposition = (P_DwmEnableComposition)GetProcAddress(DMdll, "DwmEnableComposition");
if (pfnDwmEnableComposition)
I_OutputMsg("Composition Aero API found, DwmEnableComposition\n");
return TRUE;
}
static inline VOID DisableAero(VOID)
{
BOOL pfnDwmEnableCompositiond = FALSE;
AeroWasEnabled = FALSE;
if (!LoadDM())
return;
if (pfnDwmIsCompositionEnabled && SUCCEEDED(pfnDwmIsCompositionEnabled(&pfnDwmEnableCompositiond)))
I_OutputMsg("Got the result of DwmIsCompositionEnabled, %i\n", pfnDwmEnableCompositiond);
else
return;
if ((AeroWasEnabled = pfnDwmEnableCompositiond))
I_OutputMsg("Disable the Aero rendering\n");
else
return;
if (pfnDwmEnableComposition && SUCCEEDED(pfnDwmEnableComposition(FALSE)))
I_OutputMsg("Aero rendering disabled\n");
else
I_OutputMsg("We failed to disable the Aero rendering\n");
}
static inline VOID ResetAero(VOID)
{
if (pfnDwmEnableComposition && AeroWasEnabled)
{
if (SUCCEEDED(pfnDwmEnableComposition(AeroWasEnabled)))
I_OutputMsg("Aero rendering setting restored\n");
else
I_OutputMsg("We failed to restore Aero rendering\n");
}
UnloadDM();
}
#endif
static inline void SDLJoyRemap(event_t *event) static inline void SDLJoyRemap(event_t *event)
{ {
#if defined(GP2X)
#define GP2X_BUTTON_UP (0)
#define GP2X_BUTTON_DOWN (4)
#define GP2X_BUTTON_LEFT (2)
#define GP2X_BUTTON_RIGHT (6)
#define GP2X_BUTTON_UPLEFT (1)
#define GP2X_BUTTON_UPRIGHT (7)
#define GP2X_BUTTON_DOWNLEFT (3)
#define GP2X_BUTTON_DOWNRIGHT (5)
#define GP2X_BUTTON_CLICK (18)
#define GP2X_BUTTON_A (12)
#define GP2X_BUTTON_B (13)
#define GP2X_BUTTON_X (14)
#define GP2X_BUTTON_Y (15)
#define GP2X_BUTTON_L (10)
#define GP2X_BUTTON_R (11)
#define GP2X_BUTTON_START (8)
#define GP2X_BUTTON_SELECT (9)
#define GP2X_BUTTON_VOLUP (16)
#define GP2X_BUTTON_VOLDOWN (17)
if ((event->type == ev_keydown || event->type == ev_keyup) && (KEY_JOY1 <= event->data1 && event->data1 <= KEY_JOY1+JOYBUTTONS))
{
INT32 button = event->data1-KEY_JOY1;
if (button <= 7)
{
static UINT8 DPAD = 0;
if (event->type == ev_keyup)
{
event->type = ev_console;
DPAD &= ~(1<<button);
}
else
{
event->type = ev_joystick;
DPAD |= 1<<button;
}
event->data2 = event->data3 = INT32_MAX;
if ((DPAD & (1<<GP2X_BUTTON_UP)) && ((DPAD & (1<<GP2X_BUTTON_UPLEFT)) || (DPAD & (1<<GP2X_BUTTON_UPRIGHT))))
button = GP2X_BUTTON_UP;
if ((DPAD & (1<<GP2X_BUTTON_LEFT)) && ((DPAD & (1<<GP2X_BUTTON_UPLEFT)) || (DPAD & (1<<GP2X_BUTTON_DOWNLEFT))))
button = GP2X_BUTTON_LEFT;
if ((DPAD & (1<<GP2X_BUTTON_DOWN)) && ((DPAD & (1<<GP2X_BUTTON_DOWNLEFT)) || (DPAD & (1<<GP2X_BUTTON_DOWNRIGHT))))
button = GP2X_BUTTON_DOWN;
if ((DPAD & (1<<GP2X_BUTTON_RIGHT)) && ((DPAD & (1<<GP2X_BUTTON_UPRIGHT)) || (DPAD & (1<<GP2X_BUTTON_DOWNRIGHT))))
button = GP2X_BUTTON_RIGHT;
if (DPAD == 0)
{
event->type = ev_joystick;
event->data2 = event->data3 = 0;
}
else switch (button)
{
case GP2X_BUTTON_UP:
event->data3 = -1;
break;
case GP2X_BUTTON_DOWN:
event->data3 = 1;
break;
case GP2X_BUTTON_LEFT:
event->data2 = -1;
break;
case GP2X_BUTTON_RIGHT:
event->data2 = 1;
break;
case GP2X_BUTTON_UPLEFT:
event->data2 = -1;
event->data3 = -1;
break;
case GP2X_BUTTON_UPRIGHT:
event->data2 = 1;
event->data3 = -1;
break;
case GP2X_BUTTON_DOWNLEFT:
event->data2 = -1;
event->data3 = 1;
break;
case GP2X_BUTTON_DOWNRIGHT:
event->data2 = 1;
event->data3 = 1;
default:
break;
}
event->data1 = 0;
return;
}
else switch (button)
{
case GP2X_BUTTON_CLICK:
event->data1 = KEY_ENTER;
break;
case GP2X_BUTTON_A:
event->data1 = KEY_JOY1+0;
break;
case GP2X_BUTTON_B:
event->data1 = KEY_JOY1+2;
break;
case GP2X_BUTTON_X:
event->data1 = KEY_JOY1+3;
break;
case GP2X_BUTTON_Y:
event->data1 = KEY_JOY1+1;
break;
case GP2X_BUTTON_L:
event->data1 = KEY_JOY1+4;
break;
case GP2X_BUTTON_R:
event->data1 = KEY_JOY1+5;
break;
case GP2X_BUTTON_START:
event->data1 = KEY_ESCAPE;
break;
case GP2X_BUTTON_SELECT:
event->data1 = KEY_JOY1+8;
break;
case GP2X_BUTTON_VOLUP:
event->data1 = KEY_JOY1+6;
break;
case GP2X_BUTTON_VOLDOWN:
event->data1 = KEY_JOY1+7;
break;
default:
break;
}
//I_OutputMsg("Button %i: event key %i and type: %i\n", button, event->data1, event->type);
}
#elif defined(_PSP)
if (event->data1 > KEY_JOY1 + 9 + 2) // All button after D-Pad and Select/Start
event->data1 -= 4; // remap D-pad to Hats, offset of -4
else if (event->data1 == KEY_JOY1 + 6) // Down
event->data1 = KEY_HAT1+1;
else if (event->data1 == KEY_JOY1 + 7) // Left
event->data1 = KEY_HAT1+2;
else if (event->data1 == KEY_JOY1 + 8) // Up
event->data1 = KEY_HAT1+0;
else if (event->data1 == KEY_JOY1 + 9) // Right
event->data1 = KEY_HAT1+3;
else if (event->data1 == KEY_JOY1 + 10) // Select
event->data1 = KEY_TAB;
else if (event->data1 == KEY_JOY1 + 11) // Start
event->data1 = KEY_ESCAPE;
#else
(void)event; (void)event;
#endif
} }
static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
{ {
#ifdef _arch_dreamcast // -128 to 127 SDL for DC have give us a smaller range // -32768 to 32767
INT32 raxis = axis*8;
#else // -32768 to 32767
INT32 raxis = axis/32; INT32 raxis = axis/32;
#endif
if (which == ev_joystick) if (which == ev_joystick)
{ {
if (Joystick.bGamepadStyle) if (Joystick.bGamepadStyle)
@ -1237,7 +900,6 @@ void I_GetEvent(void)
SDLJoyRemap(&event); SDLJoyRemap(&event);
if (event.type != ev_console) D_PostEvent(&event); if (event.type != ev_console) D_PostEvent(&event);
break; break;
#ifndef _WIN32_WCE
case SDL_QUIT: case SDL_QUIT:
if (!sdlquit) if (!sdlquit)
{ {
@ -1245,8 +907,7 @@ void I_GetEvent(void)
M_QuitResponse('y'); M_QuitResponse('y');
} }
break; break;
#endif #if defined(RPC_NO_WINDOWS_H)
#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE)
case SDL_SYSWMEVENT: case SDL_SYSWMEVENT:
MainWndproc(inputEvent.syswm.msg->hwnd, MainWndproc(inputEvent.syswm.msg->hwnd,
inputEvent.syswm.msg->msg, inputEvent.syswm.msg->msg,
@ -1319,9 +980,6 @@ void I_OsPolling(void)
I_GetJoystickEvents(); I_GetJoystickEvents();
I_GetJoystick2Events(); I_GetJoystick2Events();
} }
#ifdef _arch_dreamcast
//vmu_set_icon(VMU_bits);
#endif
I_GetMouseEvents(); I_GetMouseEvents();
@ -1367,10 +1025,6 @@ static inline boolean I_SkipFrame(void)
skip = !skip; skip = !skip;
#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast))
return skip;
#endif
switch (gamestate) switch (gamestate)
{ {
case GS_LEVEL: case GS_LEVEL:
@ -1538,10 +1192,6 @@ void I_FinishUpdate(void)
} }
#endif #endif
#ifdef HAVE_GP2XSDL
//if (blited == 0)
SDL_GP2X_WaitForBlitter();
#endif
#if 0 #if 0
if (lockedsf == 0 && blited == 0 && vidSurface->flags&SDL_DOUBLEBUF) if (lockedsf == 0 && blited == 0 && vidSurface->flags&SDL_DOUBLEBUF)
SDL_Flip(vidSurface); SDL_Flip(vidSurface);
@ -1727,34 +1377,7 @@ void VID_PrepareModeList(void)
static inline void SDLESSet(void) static inline void SDLESSet(void)
{ {
#ifdef HAVE_DCSDL SDL2STUB();
INT32 j;
SDL_DC_SetVideoDriver(SDL_DC_DIRECT_VIDEO); //SDL_DC_DMA_VIDEO
for (j=0;j<4;j++)
{
SDL_DC_MapKey(j,SDL_DC_START,SDLK_ESCAPE);
SDL_DC_MapKey(j,SDL_DC_A,SDLK_UNKNOWN);
SDL_DC_MapKey(j,SDL_DC_B,SDLK_UNKNOWN);
SDL_DC_MapKey(j,SDL_DC_X,SDLK_UNKNOWN);
SDL_DC_MapKey(j,SDL_DC_Y,SDLK_UNKNOWN);
SDL_DC_MapKey(j,SDL_DC_L,SDLK_UNKNOWN);
SDL_DC_MapKey(j,SDL_DC_R,SDLK_UNKNOWN);
//SDL_DC_MapKey(j,SDL_DC_LEFT,SDLK_UNKNOWN);
//SDL_DC_MapKey(j,SDL_DC_RIGHT,SDLK_UNKNOWN);
//SDL_DC_MapKey(j,SDL_DC_UP,SDLK_UNKNOWN);
//SDL_DC_MapKey(j,SDL_DC_DOWN,SDLK_UNKNOWN);
}
//SDL_DC_MapKey(0,SDL_DC_L,SDLK_LEFTBRACKET);
//SDL_DC_MapKey(0,SDL_DC_R,SDLK_RIGHTBRACKET);
//SDL_DC_MapKey(0,SDL_DC_START,SDLK_UNKNOWN);
//SDL_DC_MapKey(1,SDL_DC_L,SDLK_z);
//SDL_DC_MapKey(1,SDL_DC_R,SDLK_x);
#endif
#ifdef HAVE_GP2XSDL
SDL_GP2X_MiniDisplay(0,0);
//SDL_GP2X_DenyGfxMemory(NULL, 0);
SDL_GP2X_AllowGfxMemory(NULL, 0);
#endif
} }
static void SDLWMSet(void) static void SDLWMSet(void)
@ -1774,9 +1397,7 @@ static void SDLWMSet(void)
SetFocus(vid.WndParent); SetFocus(vid.WndParent);
ShowWindow(vid.WndParent, SW_SHOW); ShowWindow(vid.WndParent, SW_SHOW);
} }
#ifndef _WIN32_WCE
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
#endif
#endif #endif
SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE);
#endif #endif
@ -1784,13 +1405,7 @@ static void SDLWMSet(void)
static void* SDLGetDirect(void) static void* SDLGetDirect(void)
{ {
#if 0 //#ifndef __MACH__ // Do not directly access the MacOSX's OpenGL memory // you can not use the video memory in pixels member in fullscreen mode
if (!SDL_MUSTLOCK(vidSurface) && SDLmatchVideoformat())
{
vid.rowbytes = vidSurface->pitch;
return vidSurface->pixels;
}
#endif // you can not use the video memory in pixels member in fullscreen mode
return NULL; return NULL;
} }
@ -1800,9 +1415,6 @@ INT32 VID_SetMode(INT32 modeNum)
SDL2STUB(); SDL2STUB();
return SDL_TRUE; return SDL_TRUE;
#if 0 #if 0
#ifdef _WIN32_WCE
(void)modeNum;
#else
SDLdoUngrabMouse(); SDLdoUngrabMouse();
vid.recalc = true; vid.recalc = true;
BitsPerPixel = (Uint8)cv_scr_depth.value; BitsPerPixel = (Uint8)cv_scr_depth.value;
@ -1901,7 +1513,6 @@ INT32 VID_SetMode(INT32 modeNum)
#if 0 // broken #if 0 // broken
if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
vid.height = (INT32)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match vid.height = (INT32)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
#endif
#endif #endif
I_StartupMouse(); I_StartupMouse();
@ -1933,11 +1544,7 @@ void I_StartupGraphics(void)
#ifdef FILTERS #ifdef FILTERS
CV_RegisterVar (&cv_filter); CV_RegisterVar (&cv_filter);
#endif #endif
#ifdef _PSP // pitch is 0, mod of 0 crash
disable_mouse = true;
#else
disable_mouse = M_CheckParm("-nomouse"); disable_mouse = M_CheckParm("-nomouse");
#endif
if (disable_mouse) if (disable_mouse)
I_PutEnv(SDLNOMOUSE); I_PutEnv(SDLNOMOUSE);
if (!I_GetEnv("SDL_VIDEO_CENTERED")) if (!I_GetEnv("SDL_VIDEO_CENTERED"))
@ -1945,9 +1552,6 @@ void I_StartupGraphics(void)
disable_fullscreen = M_CheckParm("-win"); disable_fullscreen = M_CheckParm("-win");
keyboard_started = true; keyboard_started = true;
#ifdef _arch_dreamcast
conio_shutdown();
#endif
#if !defined(HAVE_TTF) #if !defined(HAVE_TTF)
#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio #ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio
@ -1966,11 +1570,6 @@ void I_StartupGraphics(void)
return; return;
} }
} }
#ifdef REMOTE_DEBUGGING
#ifdef _WII
_break(); // break for debugger
#endif
#endif
#endif #endif
{ {
char vd[100]; //stack space for video name char vd[100]; //stack space for video name
@ -1996,11 +1595,7 @@ void I_StartupGraphics(void)
#endif #endif
// Window title // Window title
#ifdef _WIN32_WCE
SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2");
#else
//SDL_WM_SetCaption("SRB2: Starting up", "SRB2"); //SDL_WM_SetCaption("SRB2: Starting up", "SRB2");
#endif
// Window icon // Window icon
#ifdef HAVE_IMAGE #ifdef HAVE_IMAGE
@ -2008,10 +1603,6 @@ void I_StartupGraphics(void)
#endif #endif
//SDL_WM_SetIcon(icoSurface, NULL); //SDL_WM_SetIcon(icoSurface, NULL);
#ifdef _WIN32
//DisableAero(); //also disable Aero on Vista
#endif
#ifdef HWRENDER #ifdef HWRENDER
if (M_CheckParm("-opengl") || rendermode == render_opengl) if (M_CheckParm("-opengl") || rendermode == render_opengl)
{ {
@ -2044,13 +1635,8 @@ void I_StartupGraphics(void)
// check gl renderer lib // check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION) if (HWD.pfnGetRenderVersion() != VERSION)
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n")); I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
#if 1 //#ifdef _WIN32_WCE
vid.width = BASEVIDWIDTH; vid.width = BASEVIDWIDTH;
vid.height = BASEVIDHEIGHT; vid.height = BASEVIDHEIGHT;
#else
vid.width = 640; // hack to make voodoo cards work in 640x480
vid.height = 480;
#endif
if (HWD.pfnInit(I_Error)) // let load the OpenGL library if (HWD.pfnInit(I_Error)) // let load the OpenGL library
{ {
/* /*
@ -2073,16 +1659,8 @@ void I_StartupGraphics(void)
#endif #endif
if (render_soft == rendermode) if (render_soft == rendermode)
{ {
#if defined(_WII)
vid.width = 640;
vid.height = 480;
#elif defined(_PS3)
vid.width = 720;
vid.height = 480;
#else
vid.width = BASEVIDWIDTH; vid.width = BASEVIDWIDTH;
vid.height = BASEVIDHEIGHT; vid.height = BASEVIDHEIGHT;
#endif
SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW);
if (!vidSurface) if (!vidSurface)
{ {
@ -2147,18 +1725,13 @@ void I_ShutdownGraphics(void)
if (!graphics_started) if (!graphics_started)
return; return;
CONS_Printf("I_ShutdownGraphics: "); CONS_Printf("I_ShutdownGraphics: ");
#ifdef _WIN32
//ResetAero();
#endif
graphics_started = false; graphics_started = false;
CONS_Printf("%s", M_GetText("shut down\n")); CONS_Printf("%s", M_GetText("shut down\n"));
#ifdef HWRENDER #ifdef HWRENDER
if (GLUhandle) if (GLUhandle)
hwClose(GLUhandle); hwClose(GLUhandle);
#endif #endif
#ifndef _arch_dreamcast
SDL_QuitSubSystem(SDL_INIT_VIDEO); SDL_QuitSubSystem(SDL_INIT_VIDEO);
#endif
framebuffer = SDL_FALSE; framebuffer = SDL_FALSE;
} }
#endif #endif