1 /* 2 SDL - Simple DirectMedia Layer 3 Copyright (C) 1997-2012 Sam Lantinga 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public 16 License along with this library; if not, write to the Free 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 Sam Lantinga 20 slouken (at) libsdl.org 21 */ 22 #include "SDL_config.h" 23 24 /* 25 ScreenBlaster 3 functions 26 27 Patrice Mandin 28 */ 29 30 /*--- Includes ---*/ 31 32 #include "SDL_stdinc.h" 33 #include "SDL_xbios.h" 34 #include "SDL_xbios_sb3.h" 35 36 /*--- Defines ---*/ 37 38 const int SDL_XBIOS_scpn_planes_device[]={ 39 SCPN_DEV_1BPP, 40 SCPN_DEV_4BPP, 41 SCPN_DEV_8BPP, 42 SCPN_DEV_16BPP, 43 SCPN_DEV_2BPP, 44 SCPN_DEV_4BPP, 45 SCPN_DEV_1BPP 46 }; 47 48 /*--- Functions ---*/ 49 50 int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn) 51 { 52 scpn_screeninfo_t *scrinfo; 53 int bpp; 54 55 /* Check if current SB3 mode is usable, i.e. 8 or 16bpp */ 56 scrinfo = cookie_scpn->screen_info; 57 bpp = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]); 58 59 if ((bpp==8) || (bpp==16)) { 60 return 1; 61 } 62 63 return 0; 64 } 65 66 void SDL_XBIOS_ListSB3Modes(_THIS, int actually_add, scpn_cookie_t *cookie_scpn) 67 { 68 scpn_screeninfo_t *scrinfo; 69 xbiosmode_t modeinfo; 70 71 scrinfo = cookie_scpn->screen_info; 72 if (actually_add) { 73 scrinfo->h_pos = scrinfo->v_pos = 0; 74 } 75 76 modeinfo.number = -1; 77 modeinfo.width = scrinfo->virtual_width; 78 modeinfo.height = scrinfo->virtual_height; 79 modeinfo.depth = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]); 80 modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0); 81 82 SDL_XBIOS_AddMode(this, actually_add, &modeinfo); 83 } 84