diff options
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/ps2')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.c | 121 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.h | 46 |
2 files changed, 167 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.c b/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.c new file mode 100644 index 0000000..e8d2635 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.c | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_VIDEO_DRIVER_PS2 | ||
| 24 | |||
| 25 | /* PS2 SDL video driver implementation; this is just enough to make an | ||
| 26 | * SDL-based application THINK it's got a working video driver, for | ||
| 27 | * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, | ||
| 28 | * and also for use as a collection of stubs when porting SDL to a new | ||
| 29 | * platform for which you haven't yet written a valid video driver. | ||
| 30 | * | ||
| 31 | * This is also a great way to determine bottlenecks: if you think that SDL | ||
| 32 | * is a performance problem for a given platform, enable this driver, and | ||
| 33 | * then see if your application runs faster without video overhead. | ||
| 34 | * | ||
| 35 | * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion | ||
| 36 | * of this was cut-and-pasted from Stephane Peter's work in the AAlib | ||
| 37 | * SDL video driver. Renamed to "PS2" by Sam Lantinga. | ||
| 38 | */ | ||
| 39 | |||
| 40 | #include "../SDL_sysvideo.h" | ||
| 41 | #include "../SDL_pixels_c.h" | ||
| 42 | #include "../../events/SDL_events_c.h" | ||
| 43 | |||
| 44 | #include "SDL_ps2video.h" | ||
| 45 | |||
| 46 | // PS2 driver bootstrap functions | ||
| 47 | |||
| 48 | static bool PS2_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode) | ||
| 49 | { | ||
| 50 | return true; | ||
| 51 | } | ||
| 52 | |||
| 53 | static void PS2_DeleteDevice(SDL_VideoDevice *device) | ||
| 54 | { | ||
| 55 | SDL_free(device); | ||
| 56 | } | ||
| 57 | |||
| 58 | static bool PS2_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props) | ||
| 59 | { | ||
| 60 | SDL_SetKeyboardFocus(window); | ||
| 61 | |||
| 62 | // Window has been successfully created | ||
| 63 | return true; | ||
| 64 | } | ||
| 65 | |||
| 66 | static bool PS2_VideoInit(SDL_VideoDevice *_this) | ||
| 67 | { | ||
| 68 | SDL_DisplayMode mode; | ||
| 69 | |||
| 70 | SDL_zero(mode); | ||
| 71 | mode.w = 640; | ||
| 72 | mode.h = 480; | ||
| 73 | mode.refresh_rate = 60.0f; | ||
| 74 | |||
| 75 | // 32 bpp for default | ||
| 76 | mode.format = SDL_PIXELFORMAT_ABGR8888; | ||
| 77 | |||
| 78 | SDL_AddBasicVideoDisplay(&mode); | ||
| 79 | |||
| 80 | return true; | ||
| 81 | } | ||
| 82 | |||
| 83 | static void PS2_VideoQuit(SDL_VideoDevice *_this) | ||
| 84 | { | ||
| 85 | } | ||
| 86 | |||
| 87 | static void PS2_PumpEvents(SDL_VideoDevice *_this) | ||
| 88 | { | ||
| 89 | // do nothing. | ||
| 90 | } | ||
| 91 | |||
| 92 | static SDL_VideoDevice *PS2_CreateDevice(void) | ||
| 93 | { | ||
| 94 | SDL_VideoDevice *device; | ||
| 95 | |||
| 96 | // Initialize all variables that we clean on shutdown | ||
| 97 | device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); | ||
| 98 | if (!device) { | ||
| 99 | return NULL; | ||
| 100 | } | ||
| 101 | |||
| 102 | // Set the function pointers | ||
| 103 | device->VideoInit = PS2_VideoInit; | ||
| 104 | device->VideoQuit = PS2_VideoQuit; | ||
| 105 | device->SetDisplayMode = PS2_SetDisplayMode; | ||
| 106 | device->CreateSDLWindow = PS2_CreateWindow; | ||
| 107 | device->PumpEvents = PS2_PumpEvents; | ||
| 108 | device->free = PS2_DeleteDevice; | ||
| 109 | |||
| 110 | return device; | ||
| 111 | } | ||
| 112 | |||
| 113 | VideoBootStrap PS2_bootstrap = { | ||
| 114 | "ps2", | ||
| 115 | "PS2 Video Driver", | ||
| 116 | PS2_CreateDevice, | ||
| 117 | NULL, // no ShowMessageBox implementation | ||
| 118 | false | ||
| 119 | }; | ||
| 120 | |||
| 121 | #endif // SDL_VIDEO_DRIVER_PS2 | ||
diff --git a/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.h b/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.h new file mode 100644 index 0000000..fb79781 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/ps2/SDL_ps2video.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_ps2video_h_ | ||
| 24 | #define SDL_ps2video_h_ | ||
| 25 | |||
| 26 | #include "../SDL_sysvideo.h" | ||
| 27 | |||
| 28 | #include <kernel.h> | ||
| 29 | |||
| 30 | #include <gsKit.h> | ||
| 31 | #include <dmaKit.h> | ||
| 32 | |||
| 33 | #include <gsToolkit.h> | ||
| 34 | |||
| 35 | #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA | ||
| 36 | #pragma GCC diagnostic push | ||
| 37 | #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" | ||
| 38 | #endif | ||
| 39 | |||
| 40 | #include <gsInline.h> | ||
| 41 | |||
| 42 | #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA | ||
| 43 | #pragma GCC diagnostic pop | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #endif // SDL_ps2video_h_ | ||
