comparison src/video/ps2gs/SDL_gsvideo.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
74 return((console >= 0) && (memory >= 0)); 74 return((console >= 0) && (memory >= 0));
75 } 75 }
76 76
77 static void GS_DeleteDevice(SDL_VideoDevice *device) 77 static void GS_DeleteDevice(SDL_VideoDevice *device)
78 { 78 {
79 free(device->hidden); 79 SDL_free(device->hidden);
80 free(device); 80 SDL_free(device);
81 } 81 }
82 82
83 static SDL_VideoDevice *GS_CreateDevice(int devindex) 83 static SDL_VideoDevice *GS_CreateDevice(int devindex)
84 { 84 {
85 SDL_VideoDevice *this; 85 SDL_VideoDevice *this;
86 86
87 /* Initialize all variables that we clean on shutdown */ 87 /* Initialize all variables that we clean on shutdown */
88 this = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 88 this = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
89 if ( this ) { 89 if ( this ) {
90 memset(this, 0, (sizeof *this)); 90 SDL_memset(this, 0, (sizeof *this));
91 this->hidden = (struct SDL_PrivateVideoData *) 91 this->hidden = (struct SDL_PrivateVideoData *)
92 malloc((sizeof *this->hidden)); 92 SDL_malloc((sizeof *this->hidden));
93 } 93 }
94 if ( (this == NULL) || (this->hidden == NULL) ) { 94 if ( (this == NULL) || (this->hidden == NULL) ) {
95 SDL_OutOfMemory(); 95 SDL_OutOfMemory();
96 if ( this ) { 96 if ( this ) {
97 free(this); 97 SDL_free(this);
98 } 98 }
99 return(0); 99 return(0);
100 } 100 }
101 memset(this->hidden, 0, (sizeof *this->hidden)); 101 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
102 mouse_fd = -1; 102 mouse_fd = -1;
103 keyboard_fd = -1; 103 keyboard_fd = -1;
104 104
105 /* Set the function pointers */ 105 /* Set the function pointers */
106 this->VideoInit = GS_VideoInit; 106 this->VideoInit = GS_VideoInit;
333 return(-1); 333 return(-1);
334 } 334 }
335 if ( GS_OpenMouse(this) < 0 ) { 335 if ( GS_OpenMouse(this) < 0 ) {
336 const char *sdl_nomouse; 336 const char *sdl_nomouse;
337 337
338 sdl_nomouse = getenv("SDL_NOMOUSE"); 338 sdl_nomouse = SDL_getenv("SDL_NOMOUSE");
339 if ( ! sdl_nomouse ) { 339 if ( ! sdl_nomouse ) {
340 GS_VideoQuit(this); 340 GS_VideoQuit(this);
341 SDL_SetError("Unable to open mouse"); 341 SDL_SetError("Unable to open mouse");
342 return(-1); 342 return(-1);
343 } 343 }
529 /* Set up the memory for screen update DMA commands */ 529 /* Set up the memory for screen update DMA commands */
530 head_tags_mem = (unsigned long long *) 530 head_tags_mem = (unsigned long long *)
531 (mapped_mem + pixels_len); 531 (mapped_mem + pixels_len);
532 image_tags_mem = (unsigned long long *) 532 image_tags_mem = (unsigned long long *)
533 ((caddr_t)head_tags_mem + sizeof(head_tags)); 533 ((caddr_t)head_tags_mem + sizeof(head_tags));
534 memcpy(head_tags_mem, head_tags, sizeof(head_tags)); 534 SDL_memcpy(head_tags_mem, head_tags, sizeof(head_tags));
535 if ( saved_vinfo.mode != PS2_GS_VESA ) { 535 if ( saved_vinfo.mode != PS2_GS_VESA ) {
536 tex_tags_mem = (unsigned long long *) 536 tex_tags_mem = (unsigned long long *)
537 ((caddr_t)image_tags_mem + ((2*MAXTAGS)*16)); 537 ((caddr_t)image_tags_mem + ((2*MAXTAGS)*16));
538 scale_tags_mem = (unsigned long long *) 538 scale_tags_mem = (unsigned long long *)
539 ((caddr_t)tex_tags_mem + sizeof(tex_tags)); 539 ((caddr_t)tex_tags_mem + sizeof(tex_tags));
540 memcpy(tex_tags_mem, tex_tags, sizeof(tex_tags)); 540 SDL_memcpy(tex_tags_mem, tex_tags, sizeof(tex_tags));
541 tex_tags_mem[2] = 541 tex_tags_mem[2] =
542 (vinfo.h * vinfo.w) / 64 + 542 (vinfo.h * vinfo.w) / 64 +
543 ((unsigned long long)screen_image.fbw << 14) + 543 ((unsigned long long)screen_image.fbw << 14) +
544 ((unsigned long long)screen_image.psm << 20) + 544 ((unsigned long long)screen_image.psm << 20) +
545 ((unsigned long long)power_of_2(screen_image.w) << 26) + 545 ((unsigned long long)power_of_2(screen_image.w) << 26) +
546 ((unsigned long long)power_of_2(screen_image.h) << 30) + 546 ((unsigned long long)power_of_2(screen_image.h) << 30) +
547 ((unsigned long long)1 << 34) + 547 ((unsigned long long)1 << 34) +
548 ((unsigned long long)1 << 35); 548 ((unsigned long long)1 << 35);
549 memcpy(scale_tags_mem, scale_tags, sizeof(scale_tags)); 549 SDL_memcpy(scale_tags_mem, scale_tags, sizeof(scale_tags));
550 scale_tags_mem[8] = 550 scale_tags_mem[8] =
551 ((unsigned long long)screen_image.w * 16) + 551 ((unsigned long long)screen_image.w * 16) +
552 (((unsigned long long)screen_image.h * 16) << 16); 552 (((unsigned long long)screen_image.h * 16) << 16);
553 scale_tags_mem[10] = 553 scale_tags_mem[10] =
554 ((unsigned long long)vinfo.w * 16) + 554 ((unsigned long long)vinfo.w * 16) +
555 (((unsigned long long)vinfo.h * 16) << 16); 555 (((unsigned long long)vinfo.h * 16) << 16);
556 } 556 }
557 } 557 }
558 current->pixels = NULL; 558 current->pixels = NULL;
559 if ( getenv("SDL_FULLSCREEN_UPDATE") ) { 559 if ( SDL_getenv("SDL_FULLSCREEN_UPDATE") ) {
560 /* Correct semantics */ 560 /* Correct semantics */
561 current->flags |= SDL_ASYNCBLIT; 561 current->flags |= SDL_ASYNCBLIT;
562 } else { 562 } else {
563 /* We lie here - the screen memory isn't really the visible 563 /* We lie here - the screen memory isn't really the visible
564 display memory and still requires an update, but this 564 display memory and still requires an update, but this