Mercurial > sdl-ios-xcode
annotate src/video/ps2gs/SDL_gsvideo.c @ 3099:82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
From: "Mike Gorchak"
Subject: New QNX patches
Please apply patch qnx4.diff, which is attached. What has been done:
1)Added back OpenGL ES renderer for QNX target. Added few corrections to
OpenGL ES renderer to let it work under QNX. OpenGL ES renderer do not
support textures under QNX, so I think some additional work must be done.
2) Added GL_OES_query_matrix extension to SDL_opengles.h header file, which
required by OpenGL ES 1.1 specification.
3) Added attribute clearing at the entrance of function
SDL_GL_GetAttribure(). Added error checking into the function
SDL_GL_GetAttribure(), because some attributes can't be obtained in OpenGL
ES 1.0.
4) Porting testdyngles to OpenGL ES 1.0 (1.1 has glColor4ub() and
glColor4f() functions, but 1.0 has glColor4f() only).
5) Added error checking after obtaining attributes using
SDL_GL_GetAttribute() function to the testgl2 and testgles.
6) Small correction to testmultiaudio with printing errors.
7) Added software and accelerated OpenGL ES 1.0 support into the QNX GF
driver.
Please remove ./src/audio/nto directory - it will not be used anymore.
Please create ./src/audio/qsa directory and add content of the archive
qsa.tar.gz into this directory. I rewrote some sound code, added support for
multiple audio cards, enumeration, etc. Added initial support for capture.
As far as I can understand SDL 1.3 is not supporting audio capture right now
? Sam, Am I right ? Or audio capture must be supported through the
PlayDevice routine ?
And last, please put file SDL_gf_opengles.c to the ./src/video/qnxgf
directory. It is OpenGL ES 1.1 emulation layer for some functions, which are
not supported by OpenGL ES 1.0.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Mar 2009 10:33:12 +0000 |
parents | 99210400e8b9 |
children |
rev | line source |
---|---|
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 /* |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
4 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
9 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
13 Lesser General Public License for more details. |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
18 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
19 Sam Lantinga |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
20 slouken@libsdl.org |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
23 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
24 /* Framebuffer console based SDL video driver implementation. |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
25 */ |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
26 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
27 #include <fcntl.h> |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
28 #include <unistd.h> |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
29 #include <sys/ioctl.h> |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
30 #include <sys/mman.h> |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
31 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
32 #include "SDL_video.h" |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
33 #include "SDL_mouse.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
34 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
35 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
36 #include "../../events/SDL_events_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
37 #include "../SDL_cursor_c.h" |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
38 #include "SDL_gsvideo.h" |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
39 #include "SDL_gsmouse_c.h" |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
40 #include "SDL_gsevents_c.h" |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
41 #include "SDL_gsyuv_c.h" |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
42 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
43 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
44 /* Initialization/Query functions */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
45 static int GS_VideoInit(_THIS, SDL_PixelFormat * vformat); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
46 static SDL_Rect **GS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
47 static SDL_Surface *GS_SetVideoMode(_THIS, SDL_Surface * current, int width, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
48 int height, int bpp, Uint32 flags); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
49 static int GS_SetColors(_THIS, int firstcolor, int ncolors, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
50 SDL_Color * colors); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
51 static void GS_VideoQuit(_THIS); |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
52 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
53 /* Hardware surface functions */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
54 static int GS_AllocHWSurface(_THIS, SDL_Surface * surface); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
55 static int GS_LockHWSurface(_THIS, SDL_Surface * surface); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
56 static void GS_UnlockHWSurface(_THIS, SDL_Surface * surface); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
57 static void GS_FreeHWSurface(_THIS, SDL_Surface * surface); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
58 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
59 /* GS driver bootstrap functions */ |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
60 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
61 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
62 GS_Available(void) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
63 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
64 int console, memory; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
65 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
66 console = open(PS2_DEV_GS, O_RDWR, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
67 if (console >= 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
68 close(console); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
69 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
70 memory = open(PS2_DEV_MEM, O_RDWR, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
71 if (memory >= 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
72 close(memory); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
73 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
74 return ((console >= 0) && (memory >= 0)); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
75 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
76 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
77 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
78 GS_DeleteDevice(SDL_VideoDevice * device) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
79 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
80 SDL_free(device->hidden); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
81 SDL_free(device); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
82 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
83 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
84 static SDL_VideoDevice * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
85 GS_CreateDevice(int devindex) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
86 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
87 SDL_VideoDevice *this; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
88 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
89 /* Initialize all variables that we clean on shutdown */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
90 this = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
91 if (this) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
92 SDL_memset(this, 0, (sizeof *this)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
93 this->hidden = (struct SDL_PrivateVideoData *) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
94 SDL_malloc((sizeof *this->hidden)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
95 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
96 if ((this == NULL) || (this->hidden == NULL)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
97 SDL_OutOfMemory(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
98 if (this) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
99 SDL_free(this); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
100 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
101 return (0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
102 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
103 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
104 mouse_fd = -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
105 keyboard_fd = -1; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
106 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
107 /* Set the function pointers */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
108 this->VideoInit = GS_VideoInit; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
109 this->ListModes = GS_ListModes; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
110 this->SetVideoMode = GS_SetVideoMode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
111 this->CreateYUVOverlay = GS_CreateYUVOverlay; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
112 this->SetColors = GS_SetColors; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
113 this->UpdateRects = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
114 this->VideoQuit = GS_VideoQuit; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
115 this->AllocHWSurface = GS_AllocHWSurface; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
116 this->CheckHWBlit = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
117 this->FillHWRect = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
118 this->SetHWColorKey = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
119 this->SetHWAlpha = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
120 this->LockHWSurface = GS_LockHWSurface; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
121 this->UnlockHWSurface = GS_UnlockHWSurface; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
122 this->FlipHWSurface = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
123 this->FreeHWSurface = GS_FreeHWSurface; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
124 this->SetIcon = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
125 this->SetCaption = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
126 this->GetWMInfo = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
127 this->FreeWMCursor = GS_FreeWMCursor; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
128 this->CreateWMCursor = GS_CreateWMCursor; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
129 this->ShowWMCursor = GS_ShowWMCursor; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
130 this->MoveWMCursor = GS_MoveWMCursor; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
131 this->InitOSKeymap = GS_InitOSKeymap; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
132 this->PumpEvents = GS_PumpEvents; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
133 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
134 this->free = GS_DeleteDevice; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
135 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
136 return this; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
137 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
138 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
139 VideoBootStrap PS2GS_bootstrap = { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
140 "ps2gs", "PlayStation 2 Graphics Synthesizer", |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
141 GS_Available, GS_CreateDevice |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
142 }; |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
143 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
144 /* These are the pixel formats for the 32, 24, and 16 bit video modes */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
145 static struct |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
146 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
147 int bpp; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
148 Uint32 r; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
149 Uint32 g; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
150 Uint32 b; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
151 } GS_pixelmasks[] = { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
152 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
153 32, 0x000000FF, /* RGB little-endian */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
154 0x0000FF00, 0x00FF0000}, { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
155 24, 0x000000FF, /* RGB little-endian */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
156 0x0000FF00, 0x00FF0000}, { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
157 16, 0x0000001f, /* RGB little-endian */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
158 0x000003e0, 0x00007c00},}; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
159 |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
160 /* This is a mapping from SDL bytes-per-pixel to GS pixel format */ |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
161 static int GS_formatmap[] = { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
162 -1, /* 0 bpp, not a legal value */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
163 -1, /* 8 bpp, not supported (yet?) */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
164 PS2_GS_PSMCT16, /* 16 bpp */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
165 PS2_GS_PSMCT24, /* 24 bpp */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
166 PS2_GS_PSMCT32 /* 32 bpp */ |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
167 }; |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
168 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
169 static unsigned long long head_tags[] __attribute__ ((aligned(16))) = { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
170 4 | (1LL << 60), /* GIFtag */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
171 0x0e, /* A+D */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
172 0, /* 2 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
173 PS2_GS_BITBLTBUF, 0, /* 4 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
174 PS2_GS_TRXPOS, 0, /* 6 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
175 PS2_GS_TRXREG, 0, /* 8 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
176 PS2_GS_TRXDIR}; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
177 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
178 #define MAXIMG (32767 * 16) |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
179 #define MAXTAGS 8 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
180 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
181 static inline int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
182 loadimage_nonblock(int fd, struct ps2_image *image, int size, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
183 unsigned long long *hm, unsigned long long *im) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
184 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
185 struct ps2_plist plist; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
186 struct ps2_packet packet[1 + MAXTAGS * 2]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
187 int isize; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
188 int pnum, it, eop; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
189 char *data; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
190 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
191 /* initialize the variables */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
192 data = (char *) image->ptr; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
193 pnum = it = eop = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
194 plist.packet = packet; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
195 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
196 /* make BITBLT packet */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
197 packet[pnum].ptr = hm; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
198 packet[pnum].len = sizeof(head_tags); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
199 pnum++; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
200 hm[2] = ((unsigned long long) image->fbp << 32) | |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
201 ((unsigned long long) image->fbw << 48) | |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
202 ((unsigned long long) image->psm << 56); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
203 hm[4] = ((unsigned long long) image->x << 32) | |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
204 ((unsigned long long) image->y << 48); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
205 hm[6] = (unsigned long long) image->w | |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
206 ((unsigned long long) image->h << 32); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
207 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
208 /* make image mode tags */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
209 while (!eop) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
210 isize = size > MAXIMG ? MAXIMG : size; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
211 size -= isize; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
212 eop = (size == 0); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
213 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
214 packet[pnum].ptr = &im[it]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
215 packet[pnum].len = sizeof(unsigned long long) * 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
216 pnum++; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
217 im[it++] = (isize >> 4) | (eop ? (1 << 15) : 0) | (2LL << 58); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
218 im[it++] = 0; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
219 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
220 packet[pnum].ptr = (void *) data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
221 packet[pnum].len = isize; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
222 pnum++; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
223 data += isize; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
224 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
225 plist.num = pnum; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
226 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
227 return ioctl(fd, PS2IOC_SENDL, &plist); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
228 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
229 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
230 static unsigned long long tex_tags[] __attribute__ ((aligned(16))) = { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
231 3 | (1LL << 60), /* GIFtag */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
232 0x0e, /* A+D */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
233 0, /* 2 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
234 PS2_GS_TEX0_1, (1 << 5) + (1 << 6), PS2_GS_TEX1_1, 0, PS2_GS_TEXFLUSH}; |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
235 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
236 static unsigned long long scale_tags[] __attribute__ ((aligned(16))) = { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
237 5 | (1LL << 60), /* GIFtag */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
238 0x0e, /* A+D */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
239 6 + (1 << 4) + (1 << 8), PS2_GS_PRIM, ((unsigned long long) 0 * 16) + (((unsigned long long) 0 * 16) << 16), PS2_GS_UV, ((unsigned long long) 0 * 16) + (((unsigned long long) 0 * 16) << 16), PS2_GS_XYZ2, 0, /* 8 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
240 PS2_GS_UV, 0, /* 10 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
241 PS2_GS_XYZ2}; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
242 |
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
243 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
244 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
245 scaleimage_nonblock(int fd, unsigned long long *tm, unsigned long long *sm) |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
246 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
247 struct ps2_plist plist; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
248 struct ps2_packet packet[2]; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
249 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
250 /* initialize the variables */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
251 plist.num = 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
252 plist.packet = packet; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
253 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
254 packet[0].ptr = tm; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
255 packet[0].len = sizeof(tex_tags); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
256 packet[1].ptr = sm; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
257 packet[1].len = sizeof(scale_tags); |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
258 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
259 return ioctl(fd, PS2IOC_SENDL, &plist); |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
260 } |
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
261 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
262 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
263 power_of_2(int value) |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
264 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
265 int shift; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
266 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
267 for (shift = 0; (1 << shift) < value; ++shift) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
268 /* Keep looking */ ; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
269 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
270 return (shift); |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
271 } |
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
272 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
273 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
274 GS_VideoInit(_THIS, SDL_PixelFormat * vformat) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
275 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
276 struct ps2_screeninfo vinfo; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
277 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
278 /* Initialize the library */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
279 console_fd = open(PS2_DEV_GS, O_RDWR, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
280 if (console_fd < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
281 SDL_SetError("Unable to open %s", PS2_DEV_GS); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
282 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
283 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
284 memory_fd = open(PS2_DEV_MEM, O_RDWR, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
285 if (memory_fd < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
286 close(console_fd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
287 console_fd = -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
288 SDL_SetError("Unable to open %s", PS2_DEV_MEM); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
289 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
290 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
291 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
292 if (ioctl(console_fd, PS2IOC_GSCREENINFO, &vinfo) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
293 close(memory_fd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
294 close(console_fd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
295 console_fd = -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
296 SDL_SetError("Couldn't get console pixel format"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
297 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
298 } |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
299 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
300 /* Determine the current screen size */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
301 this->info.current_w = vinfo.w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
302 this->info.current_h = vinfo.h; |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
303 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
304 /* Determine the current screen depth */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
305 switch (vinfo.psm) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
306 /* Supported pixel formats */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
307 case PS2_GS_PSMCT32: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
308 case PS2_GS_PSMCT24: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
309 case PS2_GS_PSMCT16: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
310 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
311 default: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
312 GS_VideoQuit(this); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
313 SDL_SetError("Unknown console pixel format: %d", vinfo.psm); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
314 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
315 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
316 vformat->BitsPerPixel = GS_pixelmasks[vinfo.psm].bpp; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
317 vformat->Rmask = GS_pixelmasks[vinfo.psm].r; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
318 vformat->Gmask = GS_pixelmasks[vinfo.psm].g; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
319 vformat->Bmask = GS_pixelmasks[vinfo.psm].b; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
320 saved_vinfo = vinfo; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
321 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
322 /* Enable mouse and keyboard support */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
323 if (GS_OpenKeyboard(this) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
324 GS_VideoQuit(this); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
325 SDL_SetError("Unable to open keyboard"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
326 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
327 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
328 if (GS_OpenMouse(this) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
329 const char *sdl_nomouse; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
330 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
331 sdl_nomouse = SDL_getenv("SDL_NOMOUSE"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
332 if (!sdl_nomouse) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
333 GS_VideoQuit(this); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
334 SDL_SetError("Unable to open mouse"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
335 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
336 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
337 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
338 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
339 /* We're done! */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
340 return (0); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
341 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
342 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
343 static SDL_Rect ** |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
344 GS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
345 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
346 static SDL_Rect GS_vesa_mode_list[] = { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
347 {0, 0, 1280, 1024}, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
348 {0, 0, 1024, 768}, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
349 {0, 0, 800, 600}, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
350 {0, 0, 640, 480} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
351 }; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
352 static SDL_Rect *GS_vesa_modes[] = { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
353 &GS_vesa_mode_list[0], |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
354 &GS_vesa_mode_list[1], |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
355 &GS_vesa_mode_list[2], |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
356 &GS_vesa_mode_list[3], |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
357 NULL |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
358 }; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
359 static SDL_Rect GS_tvout_stretch; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
360 static SDL_Rect GS_tvout_mode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
361 static SDL_Rect *GS_tvout_modes[3]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
362 SDL_Rect **modes = NULL; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
363 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
364 switch (format->BitsPerPixel) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
365 case 16: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
366 case 24: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
367 case 32: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
368 if (saved_vinfo.mode == PS2_GS_VESA) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
369 modes = GS_vesa_modes; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
370 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
371 int i, j = 0; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
372 |
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
373 // FIXME - what's wrong with the stretch code at 16 bpp? |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
374 if (format->BitsPerPixel != 32) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
375 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
376 /* Add a mode that we could possibly stretch to */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
377 for (i = 0; GS_vesa_modes[i]; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
378 if ((GS_vesa_modes[i]->w == saved_vinfo.w) && |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
379 (GS_vesa_modes[i]->h != saved_vinfo.h)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
380 GS_tvout_stretch.w = GS_vesa_modes[i]->w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
381 GS_tvout_stretch.h = GS_vesa_modes[i]->h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
382 GS_tvout_modes[j++] = &GS_tvout_stretch; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
383 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
384 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
385 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
386 /* Add the current TV video mode */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
387 GS_tvout_mode.w = saved_vinfo.w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
388 GS_tvout_mode.h = saved_vinfo.h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
389 GS_tvout_modes[j++] = &GS_tvout_mode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
390 GS_tvout_modes[j++] = NULL; |
136
717f739d6ec1
Added hardware stretching code to scale 640x480 to TV resolution
Sam Lantinga <slouken@libsdl.org>
parents:
135
diff
changeset
|
391 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
392 /* Return the created list of modes */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
393 modes = GS_tvout_modes; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
394 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
395 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
396 default: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
397 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
398 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
399 return (modes); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
400 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
401 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
402 /* Various screen update functions available */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
403 static void GS_DMAFullUpdate(_THIS, int numrects, SDL_Rect * rects); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
404 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
405 static SDL_Surface * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
406 GS_SetVideoMode(_THIS, SDL_Surface * current, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
407 int width, int height, int bpp, Uint32 flags) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
408 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
409 struct ps2_screeninfo vinfo; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
410 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
411 /* Set the terminal into graphics mode */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
412 if (GS_EnterGraphicsMode(this) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
413 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
414 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
415 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
416 /* Set the video mode and get the final screen format */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
417 if (ioctl(console_fd, PS2IOC_GSCREENINFO, &vinfo) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
418 SDL_SetError("Couldn't get console screen info"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
419 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
420 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
421 if ((vinfo.w != width) || (vinfo.h != height) || |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
422 (GS_pixelmasks[vinfo.psm].bpp != bpp)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
423 /* If we're not in VESA mode, we have to scale resolution */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
424 if (saved_vinfo.mode == PS2_GS_VESA) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
425 switch (width) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
426 case 640: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
427 vinfo.res = PS2_GS_640x480; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
428 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
429 case 800: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
430 vinfo.res = PS2_GS_800x600; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
431 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
432 case 1024: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
433 vinfo.res = PS2_GS_1024x768; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
434 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
435 case 1280: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
436 vinfo.res = PS2_GS_1280x1024; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
437 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
438 default: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
439 SDL_SetError("Unsupported resolution: %dx%d\n", |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
440 width, height); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
441 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
442 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
443 vinfo.res |= (PS2_GS_75Hz << 8); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
444 vinfo.w = width; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
445 vinfo.h = height; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
446 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
447 vinfo.fbp = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
448 vinfo.psm = GS_formatmap[bpp / 8]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
449 if (vinfo.psm < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
450 SDL_SetError("Unsupported depth: %d bpp\n", bpp); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
451 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
452 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
453 if (ioctl(console_fd, PS2IOC_SSCREENINFO, &vinfo) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
454 SDL_SetError("Couldn't set console screen info"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
455 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
456 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
457 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
458 /* Unmap the previous DMA buffer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
459 if (mapped_mem) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
460 munmap(mapped_mem, mapped_len); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
461 mapped_mem = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
462 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
463 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
464 if (!SDL_ReallocFormat(current, GS_pixelmasks[vinfo.psm].bpp, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
465 GS_pixelmasks[vinfo.psm].r, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
466 GS_pixelmasks[vinfo.psm].g, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
467 GS_pixelmasks[vinfo.psm].b, 0)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
468 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
469 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
470 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
471 /* Set up the new mode framebuffer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
472 current->flags = SDL_FULLSCREEN; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
473 current->w = width; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
474 current->h = height; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
475 current->pitch = SDL_CalculatePitch(current); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
476 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
477 /* Memory map the DMA area for block memory transfer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
478 if (!mapped_mem) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
479 pixels_len = height * current->pitch; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
480 mapped_len = pixels_len + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
481 /* Screen update DMA command area */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
482 sizeof(head_tags) + ((2 * MAXTAGS) * 16); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
483 if (saved_vinfo.mode != PS2_GS_VESA) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
484 mapped_len += sizeof(tex_tags) + sizeof(scale_tags); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
485 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
486 mapped_mem = mmap(0, mapped_len, PROT_READ | PROT_WRITE, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
487 MAP_SHARED, memory_fd, 0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
488 if (mapped_mem == MAP_FAILED) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
489 SDL_SetError("Unable to map %d bytes for DMA", mapped_len); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
490 mapped_mem = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
491 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
492 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
493 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
494 /* Set up the entire screen for DMA transfer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
495 screen_image.ptr = mapped_mem; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
496 screen_image.fbp = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
497 screen_image.fbw = (vinfo.w + 63) / 64; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
498 screen_image.psm = vinfo.psm; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
499 screen_image.x = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
500 if (vinfo.h == height) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
501 screen_image.y = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
502 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
503 /* Put image offscreen and scale to screen height */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
504 screen_image.y = vinfo.h; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
505 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
506 screen_image.w = current->w; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
507 screen_image.h = current->h; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
508 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
509 /* get screen image data size (qword aligned) */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
510 screen_image_size = (screen_image.w * screen_image.h); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
511 switch (screen_image.psm) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
512 case PS2_GS_PSMCT32: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
513 screen_image_size *= 4; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
514 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
515 case PS2_GS_PSMCT24: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
516 screen_image_size *= 3; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
517 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
518 case PS2_GS_PSMCT16: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
519 screen_image_size *= 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
520 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
521 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
522 screen_image_size = (screen_image_size + 15) & ~15; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
523 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
524 /* Set up the memory for screen update DMA commands */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
525 head_tags_mem = (unsigned long long *) (mapped_mem + pixels_len); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
526 image_tags_mem = (unsigned long long *) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
527 ((caddr_t) head_tags_mem + sizeof(head_tags)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
528 SDL_memcpy(head_tags_mem, head_tags, sizeof(head_tags)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
529 if (saved_vinfo.mode != PS2_GS_VESA) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
530 tex_tags_mem = (unsigned long long *) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
531 ((caddr_t) image_tags_mem + ((2 * MAXTAGS) * 16)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
532 scale_tags_mem = (unsigned long long *) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
533 ((caddr_t) tex_tags_mem + sizeof(tex_tags)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
534 SDL_memcpy(tex_tags_mem, tex_tags, sizeof(tex_tags)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
535 tex_tags_mem[2] = |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
536 (vinfo.h * vinfo.w) / 64 + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
537 ((unsigned long long) screen_image.fbw << 14) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
538 ((unsigned long long) screen_image.psm << 20) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
539 ((unsigned long long) power_of_2(screen_image.w) << 26) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
540 ((unsigned long long) power_of_2(screen_image.h) << 30) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
541 ((unsigned long long) 1 << 34) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
542 ((unsigned long long) 1 << 35); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
543 SDL_memcpy(scale_tags_mem, scale_tags, sizeof(scale_tags)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
544 scale_tags_mem[8] = |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
545 ((unsigned long long) screen_image.w * 16) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
546 (((unsigned long long) screen_image.h * 16) << 16); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
547 scale_tags_mem[10] = |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
548 ((unsigned long long) vinfo.w * 16) + |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
549 (((unsigned long long) vinfo.h * 16) << 16); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
550 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
551 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
552 current->pixels = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
553 if (SDL_getenv("SDL_FULLSCREEN_UPDATE")) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
554 /* Correct semantics */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
555 current->flags |= SDL_ASYNCBLIT; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
556 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
557 /* We lie here - the screen memory isn't really the visible |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
558 display memory and still requires an update, but this |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
559 has the desired effect for most applications. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
560 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
561 current->flags |= SDL_HWSURFACE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
562 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
563 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
564 /* Set the update rectangle function */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
565 this->UpdateRects = GS_DMAFullUpdate; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
566 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
567 /* We're done */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
568 return (current); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
569 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
570 |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
571 /* We don't support hardware surfaces yet */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
572 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
573 GS_AllocHWSurface(_THIS, SDL_Surface * surface) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
574 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
575 return (-1); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
576 } |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
577 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
578 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
579 GS_FreeHWSurface(_THIS, SDL_Surface * surface) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
580 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
581 return; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
582 } |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
583 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
584 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
585 GS_LockHWSurface(_THIS, SDL_Surface * surface) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
586 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
587 if (surface == this->screen) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
588 /* Since mouse motion affects 'pixels', lock it */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
589 SDL_LockCursor(); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
590 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
591 /* Make sure any pending DMA has completed */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
592 if (dma_pending) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
593 ioctl(console_fd, PS2IOC_SENDQCT, 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
594 dma_pending = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
595 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
596 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
597 /* If the cursor is drawn on the DMA area, remove it */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
598 if (cursor_drawn) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
599 surface->pixels = mapped_mem + surface->offset; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
600 SDL_EraseCursorNoLock(this->screen); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
601 cursor_drawn = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
602 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
603 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
604 /* Set the surface pixels to the base of the DMA area */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
605 surface->pixels = mapped_mem; |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
606 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
607 /* We're finished! */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
608 SDL_UnlockCursor(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
609 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
610 return (0); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
611 } |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
612 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
613 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
614 GS_UnlockHWSurface(_THIS, SDL_Surface * surface) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
615 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
616 if (surface == this->screen) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
617 /* Since mouse motion affects 'pixels', lock it */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
618 SDL_LockCursor(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
619 surface->pixels = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
620 SDL_UnlockCursor(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
621 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
622 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
623 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
624 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
625 GS_DMAFullUpdate(_THIS, int numrects, SDL_Rect * rects) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
626 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
627 /* Lock so we aren't interrupted by a mouse update */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
628 SDL_LockCursor(); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
629 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
630 /* Make sure any pending DMA has completed */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
631 if (dma_pending) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
632 ioctl(console_fd, PS2IOC_SENDQCT, 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
633 dma_pending = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
634 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
635 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
636 /* If the mouse is visible, draw it on the DMA area */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
637 if ((SDL_cursorstate & CURSOR_VISIBLE) && !cursor_drawn) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
638 this->screen->pixels = mapped_mem + this->screen->offset; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
639 SDL_DrawCursorNoLock(this->screen); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
640 this->screen->pixels = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
641 cursor_drawn = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
642 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
643 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
644 /* Put the image onto the screen */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
645 loadimage_nonblock(console_fd, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
646 &screen_image, screen_image_size, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
647 head_tags_mem, image_tags_mem); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
648 if (screen_image.y > 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
649 /* Need to scale offscreen image to TV output */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
650 ioctl(console_fd, PS2IOC_SENDQCT, 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
651 dma_pending = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
652 scaleimage_nonblock(console_fd, tex_tags_mem, scale_tags_mem); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
653 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
654 dma_pending = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
655 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
656 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
657 /* We're finished! */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
658 SDL_UnlockCursor(); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
659 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
660 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
661 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
662 GS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
663 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
664 return (0); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
665 } |
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
666 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
667 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
668 GS_VideoQuit(_THIS) |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
669 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
670 /* Close console and input file descriptors */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
671 if (console_fd > 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
672 /* Unmap the video framebuffer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
673 if (mapped_mem) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
674 /* Unmap the video framebuffer */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
675 munmap(mapped_mem, mapped_len); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
676 mapped_mem = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
677 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
678 close(memory_fd); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
679 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
680 /* Restore the original video mode */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
681 if (GS_InGraphicsMode(this)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
682 ioctl(console_fd, PS2IOC_SSCREENINFO, &saved_vinfo); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
683 } |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
684 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
685 /* We're all done with the graphics device */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
686 close(console_fd); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
687 console_fd = -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
688 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
689 GS_CloseMouse(this); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
690 GS_CloseKeyboard(this); |
70
f590dd383b5d
Added Linux PlayStation 2 Graphics Synthesizer support
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
691 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
692 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
693 /* vi: set ts=4 sw=4 expandtab: */ |