deepstone

changeset 24:ad6b185723cd

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 21 Sep 2013 20:18:28 +0300
parents 4ad71b558ab2
children 5ff8ce78059a
files dosemu/dosemu.c src/inttypes.h
diffstat 2 files changed, 24 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/dosemu/dosemu.c	Sat Sep 21 19:09:03 2013 +0300
     1.2 +++ b/dosemu/dosemu.c	Sat Sep 21 20:18:28 2013 +0300
     1.3 @@ -1,21 +1,3 @@
     1.4 -/*
     1.5 -256-color 3D graphics hack for real-mode DOS.
     1.6 -Copyright (C) 2011  John Tsiombikas <nuclear@member.fsf.org>
     1.7 -
     1.8 -This program is free software: you can redistribute it and/or modify
     1.9 -it under the terms of the GNU General Public License as published by
    1.10 -the Free Software Foundation, either version 3 of the License, or
    1.11 -(at your option) any later version.
    1.12 -
    1.13 -This program is distributed in the hope that it will be useful,
    1.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 -GNU General Public License for more details.
    1.17 -
    1.18 -You should have received a copy of the GNU General Public License
    1.19 -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 -*/
    1.21 -
    1.22  /* This file implements all calls made to dos-specific code using SDL
    1.23   * Don't ask why ...
    1.24   */
    1.25 @@ -23,19 +5,19 @@
    1.26  #include <stdlib.h>
    1.27  #include <assert.h>
    1.28  #include <SDL.h>
    1.29 -#include "vga.h"
    1.30 +#include "wvga.h"
    1.31  #include "conio.h"
    1.32  #include "mouse.h"
    1.33  #include "timer.h"
    1.34  
    1.35  static void proc_events(void);
    1.36  
    1.37 -/* ----- graphics (vga.c implementation) ----- */
    1.38 +/* ----- graphics (wvga.c implementation) ----- */
    1.39  static SDL_Surface *fbsurf;
    1.40  
    1.41  #define DOUBLESZ	(fbsurf->w != 320)
    1.42  
    1.43 -void set_video_mode(int mode)
    1.44 +int set_video_mode(int mode)
    1.45  {
    1.46  	int resx = 320, resy = 200;
    1.47  	unsigned int sdl_flags = SDL_HWPALETTE;
    1.48 @@ -69,22 +51,36 @@
    1.49  	default:
    1.50  		break;
    1.51  	}
    1.52 +
    1.53 +	return 0;
    1.54  }
    1.55  
    1.56 -void set_palette(unsigned char c, unsigned char r, unsigned char g, unsigned char b)
    1.57 +void set_palette(int idx, int *col, int count)
    1.58 +{
    1.59 +	int i;
    1.60 +
    1.61 +	for(i=0; i<count; i++) {
    1.62 +		set_pal_entry(idx + i, col[0], col[1], col[2]);
    1.63 +		col += 3;
    1.64 +	}
    1.65 +}
    1.66 +
    1.67 +void set_pal_entry(int idx, int r, int g, int b)
    1.68  {
    1.69  	SDL_Color col;
    1.70  	col.r = r;
    1.71  	col.g = g;
    1.72  	col.b = b;
    1.73  
    1.74 -	if(SDL_SetPalette(fbsurf, SDL_LOGPAL | SDL_PHYSPAL, &col, c, 1) != 1) {
    1.75 +	if(SDL_SetPalette(fbsurf, SDL_LOGPAL | SDL_PHYSPAL, &col, idx, 1) != 1) {
    1.76  		fprintf(stderr, "set_palette failed to set the required color\n");
    1.77  	}
    1.78  }
    1.79  
    1.80 -void copy_frame(unsigned char *frame)
    1.81 +void copy_frame(void *pixels)
    1.82  {
    1.83 +	unsigned char *frame = (unsigned char*)pixels;
    1.84 +
    1.85  	if(SDL_MUSTLOCK(fbsurf)) {
    1.86  		SDL_LockSurface(fbsurf);
    1.87  	}
     2.1 --- a/src/inttypes.h	Sat Sep 21 19:09:03 2013 +0300
     2.2 +++ b/src/inttypes.h	Sat Sep 21 20:18:28 2013 +0300
     2.3 @@ -1,6 +1,7 @@
     2.4  #ifndef INT_TYPES_H_
     2.5  #define INT_TYPES_H_
     2.6  
     2.7 +#ifdef __DOS__
     2.8  typedef char int8_t;
     2.9  typedef short int16_t;
    2.10  typedef long int32_t;
    2.11 @@ -8,5 +9,8 @@
    2.12  typedef unsigned char uint8_t;
    2.13  typedef unsigned short uint16_t;
    2.14  typedef unsigned long uint32_t;
    2.15 +#else
    2.16 +#include <stdint.h>
    2.17 +#endif
    2.18  
    2.19  #endif	/* INT_TYPES_H_ */