diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-04-04 20:24:33 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-04-11 19:29:47 +0200 |
commit | e28d1fe91671f64ce30d6e439787a48d71de5616 (patch) | |
tree | f787aaac6e894abf7e3f4144cd1b827e65db673d | |
parent | 2ad6c3438e53ddaa80c0aa43e995376495ce1a77 (diff) | |
download | rockbox-e28d1fe91671f64ce30d6e439787a48d71de5616.tar.gz rockbox-e28d1fe91671f64ce30d6e439787a48d71de5616.zip |
SDL: Silence a large number of compile warnings (WIP)
There are some real bugs in here, but we're drowning in warnings.
Change-Id: I7c2c0eafc8426327521bdd8a3ac2d3742ac16864
44 files changed, 425 insertions, 396 deletions
diff --git a/apps/plugins/sdl/SDL_image/IMG.c b/apps/plugins/sdl/SDL_image/IMG.c index 58707671d8..e015e3ef09 100644 --- a/apps/plugins/sdl/SDL_image/IMG.c +++ b/apps/plugins/sdl/SDL_image/IMG.c | |||
@@ -60,15 +60,15 @@ const SDL_version *IMG_Linked_Version(void) | |||
60 | return(&linked_version); | 60 | return(&linked_version); |
61 | } | 61 | } |
62 | 62 | ||
63 | extern int IMG_InitJPG(); | 63 | extern int IMG_InitJPG(void); |
64 | extern void IMG_QuitJPG(); | 64 | extern void IMG_QuitJPG(void); |
65 | extern int IMG_InitPNG(); | 65 | extern int IMG_InitPNG(void); |
66 | extern void IMG_QuitPNG(); | 66 | extern void IMG_QuitPNG(void); |
67 | extern int IMG_InitTIF(); | 67 | extern int IMG_InitTIF(void); |
68 | extern void IMG_QuitTIF(); | 68 | extern void IMG_QuitTIF(void); |
69 | 69 | ||
70 | extern int IMG_InitWEBP(); | 70 | extern int IMG_InitWEBP(void); |
71 | extern void IMG_QuitWEBP(); | 71 | extern void IMG_QuitWEBP(void); |
72 | 72 | ||
73 | static int initialized = 0; | 73 | static int initialized = 0; |
74 | 74 | ||
diff --git a/apps/plugins/sdl/SDL_image/IMG_jpg.c b/apps/plugins/sdl/SDL_image/IMG_jpg.c index 7484ab1bbb..997e3cd613 100644 --- a/apps/plugins/sdl/SDL_image/IMG_jpg.c +++ b/apps/plugins/sdl/SDL_image/IMG_jpg.c | |||
@@ -60,7 +60,7 @@ static struct { | |||
60 | } lib; | 60 | } lib; |
61 | 61 | ||
62 | #ifdef LOAD_JPG_DYNAMIC | 62 | #ifdef LOAD_JPG_DYNAMIC |
63 | int IMG_InitJPG() | 63 | int IMG_InitJPG(void) |
64 | { | 64 | { |
65 | if ( lib.loaded == 0 ) { | 65 | if ( lib.loaded == 0 ) { |
66 | lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC); | 66 | lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC); |
@@ -74,56 +74,56 @@ int IMG_InitJPG() | |||
74 | SDL_UnloadObject(lib.handle); | 74 | SDL_UnloadObject(lib.handle); |
75 | return -1; | 75 | return -1; |
76 | } | 76 | } |
77 | lib.jpeg_CreateDecompress = | 77 | lib.jpeg_CreateDecompress = |
78 | (void (*) (j_decompress_ptr, int, size_t)) | 78 | (void (*) (j_decompress_ptr, int, size_t)) |
79 | SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress"); | 79 | SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress"); |
80 | if ( lib.jpeg_CreateDecompress == NULL ) { | 80 | if ( lib.jpeg_CreateDecompress == NULL ) { |
81 | SDL_UnloadObject(lib.handle); | 81 | SDL_UnloadObject(lib.handle); |
82 | return -1; | 82 | return -1; |
83 | } | 83 | } |
84 | lib.jpeg_destroy_decompress = | 84 | lib.jpeg_destroy_decompress = |
85 | (void (*) (j_decompress_ptr)) | 85 | (void (*) (j_decompress_ptr)) |
86 | SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress"); | 86 | SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress"); |
87 | if ( lib.jpeg_destroy_decompress == NULL ) { | 87 | if ( lib.jpeg_destroy_decompress == NULL ) { |
88 | SDL_UnloadObject(lib.handle); | 88 | SDL_UnloadObject(lib.handle); |
89 | return -1; | 89 | return -1; |
90 | } | 90 | } |
91 | lib.jpeg_finish_decompress = | 91 | lib.jpeg_finish_decompress = |
92 | (boolean (*) (j_decompress_ptr)) | 92 | (boolean (*) (j_decompress_ptr)) |
93 | SDL_LoadFunction(lib.handle, "jpeg_finish_decompress"); | 93 | SDL_LoadFunction(lib.handle, "jpeg_finish_decompress"); |
94 | if ( lib.jpeg_finish_decompress == NULL ) { | 94 | if ( lib.jpeg_finish_decompress == NULL ) { |
95 | SDL_UnloadObject(lib.handle); | 95 | SDL_UnloadObject(lib.handle); |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | lib.jpeg_read_header = | 98 | lib.jpeg_read_header = |
99 | (int (*) (j_decompress_ptr, boolean)) | 99 | (int (*) (j_decompress_ptr, boolean)) |
100 | SDL_LoadFunction(lib.handle, "jpeg_read_header"); | 100 | SDL_LoadFunction(lib.handle, "jpeg_read_header"); |
101 | if ( lib.jpeg_read_header == NULL ) { | 101 | if ( lib.jpeg_read_header == NULL ) { |
102 | SDL_UnloadObject(lib.handle); | 102 | SDL_UnloadObject(lib.handle); |
103 | return -1; | 103 | return -1; |
104 | } | 104 | } |
105 | lib.jpeg_read_scanlines = | 105 | lib.jpeg_read_scanlines = |
106 | (JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION)) | 106 | (JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION)) |
107 | SDL_LoadFunction(lib.handle, "jpeg_read_scanlines"); | 107 | SDL_LoadFunction(lib.handle, "jpeg_read_scanlines"); |
108 | if ( lib.jpeg_read_scanlines == NULL ) { | 108 | if ( lib.jpeg_read_scanlines == NULL ) { |
109 | SDL_UnloadObject(lib.handle); | 109 | SDL_UnloadObject(lib.handle); |
110 | return -1; | 110 | return -1; |
111 | } | 111 | } |
112 | lib.jpeg_resync_to_restart = | 112 | lib.jpeg_resync_to_restart = |
113 | (boolean (*) (j_decompress_ptr, int)) | 113 | (boolean (*) (j_decompress_ptr, int)) |
114 | SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart"); | 114 | SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart"); |
115 | if ( lib.jpeg_resync_to_restart == NULL ) { | 115 | if ( lib.jpeg_resync_to_restart == NULL ) { |
116 | SDL_UnloadObject(lib.handle); | 116 | SDL_UnloadObject(lib.handle); |
117 | return -1; | 117 | return -1; |
118 | } | 118 | } |
119 | lib.jpeg_start_decompress = | 119 | lib.jpeg_start_decompress = |
120 | (boolean (*) (j_decompress_ptr)) | 120 | (boolean (*) (j_decompress_ptr)) |
121 | SDL_LoadFunction(lib.handle, "jpeg_start_decompress"); | 121 | SDL_LoadFunction(lib.handle, "jpeg_start_decompress"); |
122 | if ( lib.jpeg_start_decompress == NULL ) { | 122 | if ( lib.jpeg_start_decompress == NULL ) { |
123 | SDL_UnloadObject(lib.handle); | 123 | SDL_UnloadObject(lib.handle); |
124 | return -1; | 124 | return -1; |
125 | } | 125 | } |
126 | lib.jpeg_std_error = | 126 | lib.jpeg_std_error = |
127 | (struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *)) | 127 | (struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *)) |
128 | SDL_LoadFunction(lib.handle, "jpeg_std_error"); | 128 | SDL_LoadFunction(lib.handle, "jpeg_std_error"); |
129 | if ( lib.jpeg_std_error == NULL ) { | 129 | if ( lib.jpeg_std_error == NULL ) { |
@@ -135,7 +135,7 @@ int IMG_InitJPG() | |||
135 | 135 | ||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | void IMG_QuitJPG() | 138 | void IMG_QuitJPG(void) |
139 | { | 139 | { |
140 | if ( lib.loaded == 0 ) { | 140 | if ( lib.loaded == 0 ) { |
141 | return; | 141 | return; |
@@ -146,7 +146,7 @@ void IMG_QuitJPG() | |||
146 | --lib.loaded; | 146 | --lib.loaded; |
147 | } | 147 | } |
148 | #else | 148 | #else |
149 | int IMG_InitJPG() | 149 | int IMG_InitJPG(void) |
150 | { | 150 | { |
151 | if ( lib.loaded == 0 ) { | 151 | if ( lib.loaded == 0 ) { |
152 | lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions; | 152 | lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions; |
@@ -163,7 +163,7 @@ int IMG_InitJPG() | |||
163 | 163 | ||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | void IMG_QuitJPG() | 166 | void IMG_QuitJPG(void) |
167 | { | 167 | { |
168 | if ( lib.loaded == 0 ) { | 168 | if ( lib.loaded == 0 ) { |
169 | return; | 169 | return; |
@@ -468,13 +468,13 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src) | |||
468 | 468 | ||
469 | #else | 469 | #else |
470 | 470 | ||
471 | int IMG_InitJPG() | 471 | int IMG_InitJPG(void) |
472 | { | 472 | { |
473 | IMG_SetError("JPEG images are not supported"); | 473 | IMG_SetError("JPEG images are not supported"); |
474 | return(-1); | 474 | return(-1); |
475 | } | 475 | } |
476 | 476 | ||
477 | void IMG_QuitJPG() | 477 | void IMG_QuitJPG(void) |
478 | { | 478 | { |
479 | } | 479 | } |
480 | 480 | ||
diff --git a/apps/plugins/sdl/SDL_image/IMG_png.c b/apps/plugins/sdl/SDL_image/IMG_png.c index 93c7ee5dfd..394368f0ea 100644 --- a/apps/plugins/sdl/SDL_image/IMG_png.c +++ b/apps/plugins/sdl/SDL_image/IMG_png.c | |||
@@ -32,25 +32,25 @@ | |||
32 | 32 | ||
33 | /*============================================================================= | 33 | /*============================================================================= |
34 | File: SDL_png.c | 34 | File: SDL_png.c |
35 | Purpose: A PNG loader and saver for the SDL library | 35 | Purpose: A PNG loader and saver for the SDL library |
36 | Revision: | 36 | Revision: |
37 | Created by: Philippe Lavoie (2 November 1998) | 37 | Created by: Philippe Lavoie (2 November 1998) |
38 | lavoie@zeus.genie.uottawa.ca | 38 | lavoie@zeus.genie.uottawa.ca |
39 | Modified by: | 39 | Modified by: |
40 | 40 | ||
41 | Copyright notice: | 41 | Copyright notice: |
42 | Copyright (C) 1998 Philippe Lavoie | 42 | Copyright (C) 1998 Philippe Lavoie |
43 | 43 | ||
44 | This library is free software; you can redistribute it and/or | 44 | This library is free software; you can redistribute it and/or |
45 | modify it under the terms of the GNU Library General Public | 45 | modify it under the terms of the GNU Library General Public |
46 | License as published by the Free Software Foundation; either | 46 | License as published by the Free Software Foundation; either |
47 | version 2 of the License, or (at your option) any later version. | 47 | version 2 of the License, or (at your option) any later version. |
48 | 48 | ||
49 | This library is distributed in the hope that it will be useful, | 49 | This library is distributed in the hope that it will be useful, |
50 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 50 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
51 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 51 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
52 | Library General Public License for more details. | 52 | Library General Public License for more details. |
53 | 53 | ||
54 | You should have received a copy of the GNU Library General Public | 54 | You should have received a copy of the GNU Library General Public |
55 | License along with this library; if not, write to the Free | 55 | License along with this library; if not, write to the Free |
56 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 56 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
@@ -102,7 +102,7 @@ static struct { | |||
102 | } lib; | 102 | } lib; |
103 | 103 | ||
104 | #ifdef LOAD_PNG_DYNAMIC | 104 | #ifdef LOAD_PNG_DYNAMIC |
105 | int IMG_InitPNG() | 105 | int IMG_InitPNG(void) |
106 | { | 106 | { |
107 | if ( lib.loaded == 0 ) { | 107 | if ( lib.loaded == 0 ) { |
108 | lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC); | 108 | lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC); |
@@ -249,7 +249,7 @@ int IMG_InitPNG() | |||
249 | 249 | ||
250 | return 0; | 250 | return 0; |
251 | } | 251 | } |
252 | void IMG_QuitPNG() | 252 | void IMG_QuitPNG(void) |
253 | { | 253 | { |
254 | if ( lib.loaded == 0 ) { | 254 | if ( lib.loaded == 0 ) { |
255 | return; | 255 | return; |
@@ -260,7 +260,7 @@ void IMG_QuitPNG() | |||
260 | --lib.loaded; | 260 | --lib.loaded; |
261 | } | 261 | } |
262 | #else | 262 | #else |
263 | int IMG_InitPNG() | 263 | int IMG_InitPNG(void) |
264 | { | 264 | { |
265 | if ( lib.loaded == 0 ) { | 265 | if ( lib.loaded == 0 ) { |
266 | lib.png_create_info_struct = png_create_info_struct; | 266 | lib.png_create_info_struct = png_create_info_struct; |
@@ -289,7 +289,7 @@ int IMG_InitPNG() | |||
289 | 289 | ||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | void IMG_QuitPNG() | 292 | void IMG_QuitPNG(void) |
293 | { | 293 | { |
294 | if ( lib.loaded == 0 ) { | 294 | if ( lib.loaded == 0 ) { |
295 | return; | 295 | return; |
@@ -526,7 +526,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src) | |||
526 | palette->colors[i].b = i; | 526 | palette->colors[i].b = i; |
527 | } | 527 | } |
528 | } else if (png_num_palette > 0 ) { | 528 | } else if (png_num_palette > 0 ) { |
529 | palette->ncolors = png_num_palette; | 529 | palette->ncolors = png_num_palette; |
530 | for( i=0; i<png_num_palette; ++i ) { | 530 | for( i=0; i<png_num_palette; ++i ) { |
531 | palette->colors[i].b = png_palette[i].blue; | 531 | palette->colors[i].b = png_palette[i].blue; |
532 | palette->colors[i].g = png_palette[i].green; | 532 | palette->colors[i].g = png_palette[i].green; |
@@ -552,18 +552,18 @@ done: /* Clean up and return */ | |||
552 | } | 552 | } |
553 | IMG_SetError(error); | 553 | IMG_SetError(error); |
554 | } | 554 | } |
555 | return(surface); | 555 | return(surface); |
556 | } | 556 | } |
557 | 557 | ||
558 | #else | 558 | #else |
559 | 559 | ||
560 | int IMG_InitPNG() | 560 | int IMG_InitPNG(void) |
561 | { | 561 | { |
562 | IMG_SetError("PNG images are not supported"); | 562 | IMG_SetError("PNG images are not supported"); |
563 | return(-1); | 563 | return(-1); |
564 | } | 564 | } |
565 | 565 | ||
566 | void IMG_QuitPNG() | 566 | void IMG_QuitPNG(void) |
567 | { | 567 | { |
568 | } | 568 | } |
569 | 569 | ||
diff --git a/apps/plugins/sdl/SDL_image/IMG_tif.c b/apps/plugins/sdl/SDL_image/IMG_tif.c index 25084ad7ac..3457c2250d 100644 --- a/apps/plugins/sdl/SDL_image/IMG_tif.c +++ b/apps/plugins/sdl/SDL_image/IMG_tif.c | |||
@@ -42,7 +42,7 @@ static struct { | |||
42 | } lib; | 42 | } lib; |
43 | 43 | ||
44 | #ifdef LOAD_TIF_DYNAMIC | 44 | #ifdef LOAD_TIF_DYNAMIC |
45 | int IMG_InitTIF() | 45 | int IMG_InitTIF(void) |
46 | { | 46 | { |
47 | if ( lib.loaded == 0 ) { | 47 | if ( lib.loaded == 0 ) { |
48 | lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC); | 48 | lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC); |
@@ -89,7 +89,7 @@ int IMG_InitTIF() | |||
89 | 89 | ||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | void IMG_QuitTIF() | 92 | void IMG_QuitTIF(void) |
93 | { | 93 | { |
94 | if ( lib.loaded == 0 ) { | 94 | if ( lib.loaded == 0 ) { |
95 | return; | 95 | return; |
@@ -100,7 +100,7 @@ void IMG_QuitTIF() | |||
100 | --lib.loaded; | 100 | --lib.loaded; |
101 | } | 101 | } |
102 | #else | 102 | #else |
103 | int IMG_InitTIF() | 103 | int IMG_InitTIF(void) |
104 | { | 104 | { |
105 | if ( lib.loaded == 0 ) { | 105 | if ( lib.loaded == 0 ) { |
106 | lib.TIFFClientOpen = TIFFClientOpen; | 106 | lib.TIFFClientOpen = TIFFClientOpen; |
@@ -113,7 +113,7 @@ int IMG_InitTIF() | |||
113 | 113 | ||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | void IMG_QuitTIF() | 116 | void IMG_QuitTIF(void) |
117 | { | 117 | { |
118 | if ( lib.loaded == 0 ) { | 118 | if ( lib.loaded == 0 ) { |
119 | return; | 119 | return; |
@@ -222,7 +222,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src) | |||
222 | } | 222 | } |
223 | 223 | ||
224 | /* turn off memory mapped access with the m flag */ | 224 | /* turn off memory mapped access with the m flag */ |
225 | tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src, | 225 | tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src, |
226 | tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, tiff_map, tiff_unmap); | 226 | tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, tiff_map, tiff_unmap); |
227 | if(!tiff) | 227 | if(!tiff) |
228 | goto error; | 228 | goto error; |
@@ -239,7 +239,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src) | |||
239 | Rmask, Gmask, Bmask, Amask); | 239 | Rmask, Gmask, Bmask, Amask); |
240 | if(!surface) | 240 | if(!surface) |
241 | goto error; | 241 | goto error; |
242 | 242 | ||
243 | if(!lib.TIFFReadRGBAImage(tiff, img_width, img_height, surface->pixels, 0)) | 243 | if(!lib.TIFFReadRGBAImage(tiff, img_width, img_height, surface->pixels, 0)) |
244 | goto error; | 244 | goto error; |
245 | 245 | ||
@@ -258,7 +258,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src) | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | lib.TIFFClose(tiff); | 260 | lib.TIFFClose(tiff); |
261 | 261 | ||
262 | return surface; | 262 | return surface; |
263 | 263 | ||
264 | error: | 264 | error: |
@@ -271,13 +271,13 @@ error: | |||
271 | 271 | ||
272 | #else | 272 | #else |
273 | 273 | ||
274 | int IMG_InitTIF() | 274 | int IMG_InitTIF(void) |
275 | { | 275 | { |
276 | IMG_SetError("TIFF images are not supported"); | 276 | IMG_SetError("TIFF images are not supported"); |
277 | return(-1); | 277 | return(-1); |
278 | } | 278 | } |
279 | 279 | ||
280 | void IMG_QuitTIF() | 280 | void IMG_QuitTIF(void) |
281 | { | 281 | { |
282 | } | 282 | } |
283 | 283 | ||
diff --git a/apps/plugins/sdl/SDL_image/IMG_webp.c b/apps/plugins/sdl/SDL_image/IMG_webp.c index 94727ce195..a13af15a9c 100644 --- a/apps/plugins/sdl/SDL_image/IMG_webp.c +++ b/apps/plugins/sdl/SDL_image/IMG_webp.c | |||
@@ -30,8 +30,8 @@ | |||
30 | 30 | ||
31 | /*============================================================================= | 31 | /*============================================================================= |
32 | File: SDL_webp.c | 32 | File: SDL_webp.c |
33 | Purpose: A WEBP loader for the SDL library | 33 | Purpose: A WEBP loader for the SDL library |
34 | Revision: | 34 | Revision: |
35 | Created by: Michael Bonfils (Murlock) (26 November 2011) | 35 | Created by: Michael Bonfils (Murlock) (26 November 2011) |
36 | murlock42@gmail.com | 36 | murlock42@gmail.com |
37 | 37 | ||
@@ -53,14 +53,14 @@ static struct { | |||
53 | } lib; | 53 | } lib; |
54 | 54 | ||
55 | #ifdef LOAD_WEBP_DYNAMIC | 55 | #ifdef LOAD_WEBP_DYNAMIC |
56 | int IMG_InitWEBP() | 56 | int IMG_InitWEBP(void) |
57 | { | 57 | { |
58 | if ( lib.loaded == 0 ) { | 58 | if ( lib.loaded == 0 ) { |
59 | lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC); | 59 | lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC); |
60 | if ( lib.handle == NULL ) { | 60 | if ( lib.handle == NULL ) { |
61 | return -1; | 61 | return -1; |
62 | } | 62 | } |
63 | lib.webp_get_features_internal = | 63 | lib.webp_get_features_internal = |
64 | ( int (*) (const uint8_t *, uint32_t, WebPBitstreamFeatures* const, int) ) | 64 | ( int (*) (const uint8_t *, uint32_t, WebPBitstreamFeatures* const, int) ) |
65 | SDL_LoadFunction(lib.handle, "WebPGetFeaturesInternal" ); | 65 | SDL_LoadFunction(lib.handle, "WebPGetFeaturesInternal" ); |
66 | if ( lib.webp_get_features_internal == NULL ) { | 66 | if ( lib.webp_get_features_internal == NULL ) { |
@@ -68,7 +68,7 @@ int IMG_InitWEBP() | |||
68 | return -1; | 68 | return -1; |
69 | } | 69 | } |
70 | 70 | ||
71 | lib.webp_decode_rgb_into = | 71 | lib.webp_decode_rgb_into = |
72 | ( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) ) | 72 | ( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) ) |
73 | SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" ); | 73 | SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" ); |
74 | if ( lib.webp_decode_rgb_into == NULL ) { | 74 | if ( lib.webp_decode_rgb_into == NULL ) { |
@@ -76,7 +76,7 @@ int IMG_InitWEBP() | |||
76 | return -1; | 76 | return -1; |
77 | } | 77 | } |
78 | 78 | ||
79 | lib.webp_decode_rgba_into = | 79 | lib.webp_decode_rgba_into = |
80 | ( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) ) | 80 | ( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) ) |
81 | SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" ); | 81 | SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" ); |
82 | if ( lib.webp_decode_rgba_into == NULL ) { | 82 | if ( lib.webp_decode_rgba_into == NULL ) { |
@@ -88,7 +88,7 @@ int IMG_InitWEBP() | |||
88 | 88 | ||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | void IMG_QuitWEBP() | 91 | void IMG_QuitWEBP(void) |
92 | { | 92 | { |
93 | if ( lib.loaded == 0 ) { | 93 | if ( lib.loaded == 0 ) { |
94 | return; | 94 | return; |
@@ -99,7 +99,7 @@ void IMG_QuitWEBP() | |||
99 | --lib.loaded; | 99 | --lib.loaded; |
100 | } | 100 | } |
101 | #else | 101 | #else |
102 | int IMG_InitWEBP() | 102 | int IMG_InitWEBP(void) |
103 | { | 103 | { |
104 | if ( lib.loaded == 0 ) { | 104 | if ( lib.loaded == 0 ) { |
105 | lib.webp_get_features_internal = WebPGetFeaturesInternal; | 105 | lib.webp_get_features_internal = WebPGetFeaturesInternal; |
@@ -110,7 +110,7 @@ int IMG_InitWEBP() | |||
110 | 110 | ||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | void IMG_QuitWEBP() | 113 | void IMG_QuitWEBP(void) |
114 | { | 114 | { |
115 | if ( lib.loaded == 0 ) { | 115 | if ( lib.loaded == 0 ) { |
116 | return; | 116 | return; |
@@ -207,7 +207,7 @@ SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src) | |||
207 | error = "Failed to read WEBP"; | 207 | error = "Failed to read WEBP"; |
208 | goto error; | 208 | goto error; |
209 | } | 209 | } |
210 | 210 | ||
211 | #if 0 | 211 | #if 0 |
212 | // extract size of picture, not interesting since we don't know about alpha channel | 212 | // extract size of picture, not interesting since we don't know about alpha channel |
213 | int width = -1, height = -1; | 213 | int width = -1, height = -1; |
@@ -270,13 +270,13 @@ error: | |||
270 | 270 | ||
271 | #else | 271 | #else |
272 | 272 | ||
273 | int IMG_InitWEBP() | 273 | int IMG_InitWEBP(void) |
274 | { | 274 | { |
275 | IMG_SetError("WEBP images are not supported"); | 275 | IMG_SetError("WEBP images are not supported"); |
276 | return(-1); | 276 | return(-1); |
277 | } | 277 | } |
278 | 278 | ||
279 | void IMG_QuitWEBP() | 279 | void IMG_QuitWEBP(void) |
280 | { | 280 | { |
281 | } | 281 | } |
282 | 282 | ||
diff --git a/apps/plugins/sdl/SDL_mixer/dynamic_flac.h b/apps/plugins/sdl/SDL_mixer/dynamic_flac.h index e2dd3f7540..dd795ba302 100644 --- a/apps/plugins/sdl/SDL_mixer/dynamic_flac.h +++ b/apps/plugins/sdl/SDL_mixer/dynamic_flac.h | |||
@@ -62,5 +62,5 @@ extern flac_loader flac; | |||
62 | 62 | ||
63 | #endif /* FLAC_MUSIC */ | 63 | #endif /* FLAC_MUSIC */ |
64 | 64 | ||
65 | extern int Mix_InitFLAC(); | 65 | extern int Mix_InitFLAC(void); |
66 | extern void Mix_QuitFLAC(); | 66 | extern void Mix_QuitFLAC(void); |
diff --git a/apps/plugins/sdl/SDL_mixer/dynamic_mod.h b/apps/plugins/sdl/SDL_mixer/dynamic_mod.h index 3561b151db..e0128e77fe 100644 --- a/apps/plugins/sdl/SDL_mixer/dynamic_mod.h +++ b/apps/plugins/sdl/SDL_mixer/dynamic_mod.h | |||
@@ -58,5 +58,5 @@ extern mikmod_loader mikmod; | |||
58 | 58 | ||
59 | #endif /* MOD_MUSIC */ | 59 | #endif /* MOD_MUSIC */ |
60 | 60 | ||
61 | extern int Mix_InitMOD(); | 61 | extern int Mix_InitMOD(void); |
62 | extern void Mix_QuitMOD(); | 62 | extern void Mix_QuitMOD(void); |
diff --git a/apps/plugins/sdl/SDL_mixer/dynamic_mp3.h b/apps/plugins/sdl/SDL_mixer/dynamic_mp3.h index 03cbbbf9cf..87d7f518cc 100644 --- a/apps/plugins/sdl/SDL_mixer/dynamic_mp3.h +++ b/apps/plugins/sdl/SDL_mixer/dynamic_mp3.h | |||
@@ -43,5 +43,5 @@ extern smpeg_loader smpeg; | |||
43 | 43 | ||
44 | #endif /* MUSIC_MP3 */ | 44 | #endif /* MUSIC_MP3 */ |
45 | 45 | ||
46 | extern int Mix_InitMP3(); | 46 | extern int Mix_InitMP3(void); |
47 | extern void Mix_QuitMP3(); | 47 | extern void Mix_QuitMP3(void); |
diff --git a/apps/plugins/sdl/SDL_mixer/dynamic_ogg.h b/apps/plugins/sdl/SDL_mixer/dynamic_ogg.h index 822458d49e..725d686dbc 100644 --- a/apps/plugins/sdl/SDL_mixer/dynamic_ogg.h +++ b/apps/plugins/sdl/SDL_mixer/dynamic_ogg.h | |||
@@ -49,5 +49,5 @@ extern vorbis_loader vorbis; | |||
49 | 49 | ||
50 | #endif /* OGG_MUSIC */ | 50 | #endif /* OGG_MUSIC */ |
51 | 51 | ||
52 | extern int Mix_InitOgg(); | 52 | extern int Mix_InitOgg(void); |
53 | extern void Mix_QuitOgg(); | 53 | extern void Mix_QuitOgg(void); |
diff --git a/apps/plugins/sdl/SDL_mixer/music.c b/apps/plugins/sdl/SDL_mixer/music.c index dce16a9de3..075b89b0a3 100644 --- a/apps/plugins/sdl/SDL_mixer/music.c +++ b/apps/plugins/sdl/SDL_mixer/music.c | |||
@@ -173,7 +173,7 @@ static void music_internal_initialize_volume(void); | |||
173 | static void music_internal_volume(int volume); | 173 | static void music_internal_volume(int volume); |
174 | static int music_internal_play(Mix_Music *music, double position); | 174 | static int music_internal_play(Mix_Music *music, double position); |
175 | static int music_internal_position(double position); | 175 | static int music_internal_position(double position); |
176 | static int music_internal_playing(); | 176 | static int music_internal_playing(void); |
177 | static void music_internal_halt(void); | 177 | static void music_internal_halt(void); |
178 | 178 | ||
179 | 179 | ||
@@ -193,8 +193,8 @@ void Mix_HookMusicFinished(void (*music_finished)(void)) | |||
193 | static int music_halt_or_loop (void) | 193 | static int music_halt_or_loop (void) |
194 | { | 194 | { |
195 | /* Restart music if it has to loop */ | 195 | /* Restart music if it has to loop */ |
196 | 196 | ||
197 | if (!music_internal_playing()) | 197 | if (!music_internal_playing()) |
198 | { | 198 | { |
199 | #ifdef USE_NATIVE_MIDI | 199 | #ifdef USE_NATIVE_MIDI |
200 | /* Native MIDI handles looping internally */ | 200 | /* Native MIDI handles looping internally */ |
@@ -211,17 +211,17 @@ static int music_halt_or_loop (void) | |||
211 | current_fade = music_playing->fading; | 211 | current_fade = music_playing->fading; |
212 | music_internal_play(music_playing, 0.0); | 212 | music_internal_play(music_playing, 0.0); |
213 | music_playing->fading = current_fade; | 213 | music_playing->fading = current_fade; |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | music_internal_halt(); | 217 | music_internal_halt(); |
218 | if (music_finished_hook) | 218 | if (music_finished_hook) |
219 | music_finished_hook(); | 219 | music_finished_hook(); |
220 | 220 | ||
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | return 1; | 225 | return 1; |
226 | } | 226 | } |
227 | 227 | ||
@@ -258,7 +258,7 @@ void music_mixer(void *udata, Uint8 *stream, int len) | |||
258 | music_playing->fading = MIX_NO_FADING; | 258 | music_playing->fading = MIX_NO_FADING; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | music_halt_or_loop(); | 262 | music_halt_or_loop(); |
263 | if (!music_internal_playing()) | 263 | if (!music_internal_playing()) |
264 | return; | 264 | return; |
@@ -309,7 +309,7 @@ void music_mixer(void *udata, Uint8 *stream, int len) | |||
309 | #endif | 309 | #endif |
310 | #ifdef OGG_MUSIC | 310 | #ifdef OGG_MUSIC |
311 | case MUS_OGG: | 311 | case MUS_OGG: |
312 | 312 | ||
313 | left = OGG_playAudio(music_playing->data.ogg, stream, len); | 313 | left = OGG_playAudio(music_playing->data.ogg, stream, len); |
314 | break; | 314 | break; |
315 | #endif | 315 | #endif |
@@ -334,7 +334,7 @@ void music_mixer(void *udata, Uint8 *stream, int len) | |||
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | skip: | 338 | skip: |
339 | /* Handle seamless music looping */ | 339 | /* Handle seamless music looping */ |
340 | if (left > 0 && left < len) { | 340 | if (left > 0 && left < len) { |
diff --git a/apps/plugins/sdl/SDL_mixer/timidity/config.h b/apps/plugins/sdl/SDL_mixer/timidity/config.h index 46f1aa95fe..32da0a8358 100644 --- a/apps/plugins/sdl/SDL_mixer/timidity/config.h +++ b/apps/plugins/sdl/SDL_mixer/timidity/config.h | |||
@@ -9,7 +9,9 @@ | |||
9 | /* This is for use with the SDL library */ | 9 | /* This is for use with the SDL library */ |
10 | #ifndef __TIMIDITY_CONFIG_H__ | 10 | #ifndef __TIMIDITY_CONFIG_H__ |
11 | #define __TIMIDITY_CONFIG_H__ | 11 | #define __TIMIDITY_CONFIG_H__ |
12 | #ifndef SDL | ||
12 | #define SDL | 13 | #define SDL |
14 | #endif | ||
13 | #include "SDL_config.h" | 15 | #include "SDL_config.h" |
14 | #include "SDL_endian.h" | 16 | #include "SDL_endian.h" |
15 | 17 | ||
@@ -24,7 +26,7 @@ | |||
24 | #define DEFAULT_PROGRAM 0 | 26 | #define DEFAULT_PROGRAM 0 |
25 | 27 | ||
26 | /* 9 here is MIDI channel 10, which is the standard percussion channel. | 28 | /* 9 here is MIDI channel 10, which is the standard percussion channel. |
27 | Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too. | 29 | Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too. |
28 | On the other hand, some files know that 16 is not a drum channel and | 30 | On the other hand, some files know that 16 is not a drum channel and |
29 | try to play music on it. This is now a runtime option, so this isn't | 31 | try to play music on it. This is now a runtime option, so this isn't |
30 | a critical choice anymore. */ | 32 | a critical choice anymore. */ |
@@ -131,7 +133,7 @@ typedef double FLOAT_T; | |||
131 | #define MAX_CONTROL_RATIO 255 | 133 | #define MAX_CONTROL_RATIO 255 |
132 | 134 | ||
133 | typedef unsigned int uint32; | 135 | typedef unsigned int uint32; |
134 | typedef int int32; | 136 | typedef int int32; |
135 | typedef unsigned short uint16; | 137 | typedef unsigned short uint16; |
136 | typedef short int16; | 138 | typedef short int16; |
137 | typedef unsigned char uint8; | 139 | typedef unsigned char uint8; |
diff --git a/apps/plugins/sdl/SDL_mixer/timidity/playmidi.c b/apps/plugins/sdl/SDL_mixer/timidity/playmidi.c index 84b18cf5cb..1638732dc5 100644 --- a/apps/plugins/sdl/SDL_mixer/timidity/playmidi.c +++ b/apps/plugins/sdl/SDL_mixer/timidity/playmidi.c | |||
@@ -6,9 +6,10 @@ | |||
6 | it under the terms of the Perl Artistic License, available in COPYING. | 6 | it under the terms of the Perl Artistic License, available in COPYING. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "config.h" | ||
10 | |||
9 | #include <SDL_rwops.h> | 11 | #include <SDL_rwops.h> |
10 | 12 | ||
11 | #include "config.h" | ||
12 | #include "common.h" | 13 | #include "common.h" |
13 | #include "instrum.h" | 14 | #include "instrum.h" |
14 | #include "playmidi.h" | 15 | #include "playmidi.h" |
@@ -69,14 +70,14 @@ int XG_System_variation_type; | |||
69 | 70 | ||
70 | 71 | ||
71 | static void adjust_amplification(void) | 72 | static void adjust_amplification(void) |
72 | { | 73 | { |
73 | master_volume = (FLOAT_T)(amplification) / (FLOAT_T)100.0; | 74 | master_volume = (FLOAT_T)(amplification) / (FLOAT_T)100.0; |
74 | master_volume /= 2; | 75 | master_volume /= 2; |
75 | } | 76 | } |
76 | 77 | ||
77 | 78 | ||
78 | static void adjust_master_volume(int32 vol) | 79 | static void adjust_master_volume(int32 vol) |
79 | { | 80 | { |
80 | master_volume = (double)(vol*amplification) / 1638400.0L; | 81 | master_volume = (double)(vol*amplification) / 1638400.0L; |
81 | master_volume /= 2; | 82 | master_volume /= 2; |
82 | } | 83 | } |
@@ -146,7 +147,7 @@ static void select_sample(int v, Instrument *ip) | |||
146 | } | 147 | } |
147 | 148 | ||
148 | f=voice[v].orig_frequency; | 149 | f=voice[v].orig_frequency; |
149 | /* | 150 | /* |
150 | No suitable sample found! We'll select the sample whose root | 151 | No suitable sample found! We'll select the sample whose root |
151 | frequency is closest to the one we want. (Actually we should | 152 | frequency is closest to the one we want. (Actually we should |
152 | probably convert the low, high, and root frequencies to MIDI note | 153 | probably convert the low, high, and root frequencies to MIDI note |
@@ -214,11 +215,11 @@ static void select_stereo_samples(int v, InstrumentLayer *lp) | |||
214 | 215 | ||
215 | static void recompute_freq(int v) | 216 | static void recompute_freq(int v) |
216 | { | 217 | { |
217 | int | 218 | int |
218 | sign=(voice[v].sample_increment < 0), /* for bidirectional loops */ | 219 | sign=(voice[v].sample_increment < 0), /* for bidirectional loops */ |
219 | pb=channel[voice[v].channel].pitchbend; | 220 | pb=channel[voice[v].channel].pitchbend; |
220 | double a; | 221 | double a; |
221 | 222 | ||
222 | if (!voice[v].sample->sample_rate) | 223 | if (!voice[v].sample->sample_rate) |
223 | return; | 224 | return; |
224 | 225 | ||
@@ -262,22 +263,22 @@ static void recompute_freq(int v) | |||
262 | (double)(play_mode->rate)), | 263 | (double)(play_mode->rate)), |
263 | FRACTION_BITS); | 264 | FRACTION_BITS); |
264 | 265 | ||
265 | if (sign) | 266 | if (sign) |
266 | a = -a; /* need to preserve the loop direction */ | 267 | a = -a; /* need to preserve the loop direction */ |
267 | 268 | ||
268 | voice[v].sample_increment = (int32)(a); | 269 | voice[v].sample_increment = (int32)(a); |
269 | } | 270 | } |
270 | 271 | ||
271 | static int expr_curve[128] = { | 272 | static int expr_curve[128] = { |
272 | 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, | 273 | 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, |
273 | 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, | 274 | 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, |
274 | 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, | 275 | 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, |
275 | 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, | 276 | 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, |
276 | 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, | 277 | 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, |
277 | 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63, | 278 | 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63, |
278 | 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89, | 279 | 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89, |
279 | 91, 93, 95, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 121, | 280 | 91, 93, 95, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 121, |
280 | 124, 127 | 281 | 124, 127 |
281 | }; | 282 | }; |
282 | 283 | ||
283 | static int panf(int pan, int speaker, int separation) | 284 | static int panf(int pan, int speaker, int separation) |
@@ -423,7 +424,7 @@ static void recompute_amp(int v) | |||
423 | /* just a variant of note_on() */ | 424 | /* just a variant of note_on() */ |
424 | static int vc_alloc(int j) | 425 | static int vc_alloc(int j) |
425 | { | 426 | { |
426 | int i=voices; | 427 | int i=voices; |
427 | 428 | ||
428 | while (i--) | 429 | while (i--) |
429 | { | 430 | { |
@@ -439,7 +440,7 @@ static void kill_note(int i); | |||
439 | 440 | ||
440 | static void kill_others(int i) | 441 | static void kill_others(int i) |
441 | { | 442 | { |
442 | int j=voices; | 443 | int j=voices; |
443 | 444 | ||
444 | if (!voice[i].sample->exclusiveClass) return; | 445 | if (!voice[i].sample->exclusiveClass) return; |
445 | 446 | ||
@@ -769,7 +770,7 @@ static void start_note(MidiEvent *e, int i) | |||
769 | ip = lp->instrument; | 770 | ip = lp->instrument; |
770 | if (ip->type == INST_GUS && ip->samples != 1) | 771 | if (ip->type == INST_GUS && ip->samples != 1) |
771 | { | 772 | { |
772 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, | 773 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, |
773 | "Strange: percussion instrument with %d samples!", ip->samples); | 774 | "Strange: percussion instrument with %d samples!", ip->samples); |
774 | } | 775 | } |
775 | 776 | ||
@@ -989,14 +990,14 @@ static void kill_note(int i) | |||
989 | /* Only one instance of a note can be playing on a single channel. */ | 990 | /* Only one instance of a note can be playing on a single channel. */ |
990 | static void note_on(MidiEvent *e) | 991 | static void note_on(MidiEvent *e) |
991 | { | 992 | { |
992 | int i=voices, lowest=-1; | 993 | int i=voices, lowest=-1; |
993 | int32 lv=0x7FFFFFFF, v; | 994 | int32 lv=0x7FFFFFFF, v; |
994 | 995 | ||
995 | while (i--) | 996 | while (i--) |
996 | { | 997 | { |
997 | if (voice[i].status == VOICE_FREE) | 998 | if (voice[i].status == VOICE_FREE) |
998 | lowest=i; /* Can't get a lower volume than silence */ | 999 | lowest=i; /* Can't get a lower volume than silence */ |
999 | else if (voice[i].channel==e->channel && | 1000 | else if (voice[i].channel==e->channel && |
1000 | (voice[i].note==e->a || channel[voice[i].channel].mono)) | 1001 | (voice[i].note==e->a || channel[voice[i].channel].mono)) |
1001 | kill_note(i); | 1002 | kill_note(i); |
1002 | } | 1003 | } |
@@ -1007,7 +1008,7 @@ static void note_on(MidiEvent *e) | |||
1007 | start_note(e,lowest); | 1008 | start_note(e,lowest); |
1008 | return; | 1009 | return; |
1009 | } | 1010 | } |
1010 | 1011 | ||
1011 | #if 0 | 1012 | #if 0 |
1012 | /* Look for the decaying note with the lowest volume */ | 1013 | /* Look for the decaying note with the lowest volume */ |
1013 | i=voices; | 1014 | i=voices; |
@@ -1136,7 +1137,7 @@ static void all_notes_off(int c) | |||
1136 | if (voice[i].status==VOICE_ON && | 1137 | if (voice[i].status==VOICE_ON && |
1137 | voice[i].channel==c) | 1138 | voice[i].channel==c) |
1138 | { | 1139 | { |
1139 | if (channel[c].sustain) | 1140 | if (channel[c].sustain) |
1140 | { | 1141 | { |
1141 | voice[i].status=VOICE_SUSTAINED; | 1142 | voice[i].status=VOICE_SUSTAINED; |
1142 | ctl->note(i); | 1143 | ctl->note(i); |
@@ -1151,7 +1152,7 @@ static void all_sounds_off(int c) | |||
1151 | { | 1152 | { |
1152 | int i=voices; | 1153 | int i=voices; |
1153 | while (i--) | 1154 | while (i--) |
1154 | if (voice[i].channel==c && | 1155 | if (voice[i].channel==c && |
1155 | voice[i].status != VOICE_FREE && | 1156 | voice[i].status != VOICE_FREE && |
1156 | voice[i].status != VOICE_DIE) | 1157 | voice[i].status != VOICE_DIE) |
1157 | { | 1158 | { |
@@ -1232,29 +1233,29 @@ static void seek_forward(int32 until_time) | |||
1232 | current_event->a; | 1233 | current_event->a; |
1233 | channel[current_event->channel].pitchfactor=0; | 1234 | channel[current_event->channel].pitchfactor=0; |
1234 | break; | 1235 | break; |
1235 | 1236 | ||
1236 | case ME_PITCHWHEEL: | 1237 | case ME_PITCHWHEEL: |
1237 | channel[current_event->channel].pitchbend= | 1238 | channel[current_event->channel].pitchbend= |
1238 | current_event->a + current_event->b * 128; | 1239 | current_event->a + current_event->b * 128; |
1239 | channel[current_event->channel].pitchfactor=0; | 1240 | channel[current_event->channel].pitchfactor=0; |
1240 | break; | 1241 | break; |
1241 | 1242 | ||
1242 | case ME_MAINVOLUME: | 1243 | case ME_MAINVOLUME: |
1243 | channel[current_event->channel].volume=current_event->a; | 1244 | channel[current_event->channel].volume=current_event->a; |
1244 | break; | 1245 | break; |
1245 | 1246 | ||
1246 | case ME_MASTERVOLUME: | 1247 | case ME_MASTERVOLUME: |
1247 | adjust_master_volume(current_event->a + (current_event->b <<7)); | 1248 | adjust_master_volume(current_event->a + (current_event->b <<7)); |
1248 | break; | 1249 | break; |
1249 | 1250 | ||
1250 | case ME_PAN: | 1251 | case ME_PAN: |
1251 | channel[current_event->channel].panning=current_event->a; | 1252 | channel[current_event->channel].panning=current_event->a; |
1252 | break; | 1253 | break; |
1253 | 1254 | ||
1254 | case ME_EXPRESSION: | 1255 | case ME_EXPRESSION: |
1255 | channel[current_event->channel].expression=current_event->a; | 1256 | channel[current_event->channel].expression=current_event->a; |
1256 | break; | 1257 | break; |
1257 | 1258 | ||
1258 | case ME_PROGRAM: | 1259 | case ME_PROGRAM: |
1259 | /* if (ISDRUMCHANNEL(current_event->channel)) */ | 1260 | /* if (ISDRUMCHANNEL(current_event->channel)) */ |
1260 | if (channel[current_event->channel].kit) | 1261 | if (channel[current_event->channel].kit) |
@@ -1310,11 +1311,11 @@ static void seek_forward(int32 until_time) | |||
1310 | case ME_RESET_CONTROLLERS: | 1311 | case ME_RESET_CONTROLLERS: |
1311 | reset_controllers(current_event->channel); | 1312 | reset_controllers(current_event->channel); |
1312 | break; | 1313 | break; |
1313 | 1314 | ||
1314 | case ME_TONE_BANK: | 1315 | case ME_TONE_BANK: |
1315 | channel[current_event->channel].bank=current_event->a; | 1316 | channel[current_event->channel].bank=current_event->a; |
1316 | break; | 1317 | break; |
1317 | 1318 | ||
1318 | case ME_EOT: | 1319 | case ME_EOT: |
1319 | current_sample=current_event->time; | 1320 | current_sample=current_event->time; |
1320 | return; | 1321 | return; |
@@ -1336,7 +1337,7 @@ static void skip_to(int32 until_time) | |||
1336 | buffered_count=0; | 1337 | buffered_count=0; |
1337 | buffer_pointer=common_buffer; | 1338 | buffer_pointer=common_buffer; |
1338 | current_event=event_list; | 1339 | current_event=event_list; |
1339 | 1340 | ||
1340 | if (until_time) | 1341 | if (until_time) |
1341 | seek_forward(until_time); | 1342 | seek_forward(until_time); |
1342 | ctl->reset(); | 1343 | ctl->reset(); |
@@ -1351,15 +1352,15 @@ static int apply_controls(void) | |||
1351 | switch(rc=ctl->read(&val)) | 1352 | switch(rc=ctl->read(&val)) |
1352 | { | 1353 | { |
1353 | case RC_QUIT: /* [] */ | 1354 | case RC_QUIT: /* [] */ |
1354 | case RC_LOAD_FILE: | 1355 | case RC_LOAD_FILE: |
1355 | case RC_NEXT: /* >>| */ | 1356 | case RC_NEXT: /* >>| */ |
1356 | case RC_REALLY_PREVIOUS: /* |<< */ | 1357 | case RC_REALLY_PREVIOUS: /* |<< */ |
1357 | return rc; | 1358 | return rc; |
1358 | 1359 | ||
1359 | case RC_CHANGE_VOLUME: | 1360 | case RC_CHANGE_VOLUME: |
1360 | if (val>0 || amplification > -val) | 1361 | if (val>0 || amplification > -val) |
1361 | amplification += val; | 1362 | amplification += val; |
1362 | else | 1363 | else |
1363 | amplification=0; | 1364 | amplification=0; |
1364 | if (amplification > MAX_AMPLIFICATION) | 1365 | if (amplification > MAX_AMPLIFICATION) |
1365 | amplification=MAX_AMPLIFICATION; | 1366 | amplification=MAX_AMPLIFICATION; |
@@ -1382,20 +1383,20 @@ static int apply_controls(void) | |||
1382 | skip_to(0); | 1383 | skip_to(0); |
1383 | did_skip=1; | 1384 | did_skip=1; |
1384 | break; | 1385 | break; |
1385 | 1386 | ||
1386 | case RC_JUMP: | 1387 | case RC_JUMP: |
1387 | if (val >= sample_count) | 1388 | if (val >= sample_count) |
1388 | return RC_NEXT; | 1389 | return RC_NEXT; |
1389 | skip_to(val); | 1390 | skip_to(val); |
1390 | return rc; | 1391 | return rc; |
1391 | 1392 | ||
1392 | case RC_FORWARD: /* >> */ | 1393 | case RC_FORWARD: /* >> */ |
1393 | if (val+current_sample >= sample_count) | 1394 | if (val+current_sample >= sample_count) |
1394 | return RC_NEXT; | 1395 | return RC_NEXT; |
1395 | skip_to(val+current_sample); | 1396 | skip_to(val+current_sample); |
1396 | did_skip=1; | 1397 | did_skip=1; |
1397 | break; | 1398 | break; |
1398 | 1399 | ||
1399 | case RC_BACK: /* << */ | 1400 | case RC_BACK: /* << */ |
1400 | if (current_sample > val) | 1401 | if (current_sample > val) |
1401 | skip_to(current_sample-val); | 1402 | skip_to(current_sample-val); |
@@ -1405,10 +1406,10 @@ static int apply_controls(void) | |||
1405 | break; | 1406 | break; |
1406 | } | 1407 | } |
1407 | while (rc!= RC_NONE); | 1408 | while (rc!= RC_NONE); |
1408 | 1409 | ||
1409 | /* Advertise the skip so that we stop computing the audio buffer */ | 1410 | /* Advertise the skip so that we stop computing the audio buffer */ |
1410 | if (did_skip) | 1411 | if (did_skip) |
1411 | return RC_JUMP; | 1412 | return RC_JUMP; |
1412 | else | 1413 | else |
1413 | return rc; | 1414 | return rc; |
1414 | } | 1415 | } |
@@ -1466,7 +1467,7 @@ static int compute_data(void *stream, int32 count) | |||
1466 | s32tobuf(stream, common_buffer, channels*AUDIO_BUFFER_SIZE); | 1467 | s32tobuf(stream, common_buffer, channels*AUDIO_BUFFER_SIZE); |
1467 | buffer_pointer=common_buffer; | 1468 | buffer_pointer=common_buffer; |
1468 | buffered_count=0; | 1469 | buffered_count=0; |
1469 | 1470 | ||
1470 | ctl->current_time(current_sample); | 1471 | ctl->current_time(current_sample); |
1471 | if ((rc=apply_controls())!=RC_NONE) | 1472 | if ((rc=apply_controls())!=RC_NONE) |
1472 | return rc; | 1473 | return rc; |
@@ -1485,7 +1486,7 @@ int Timidity_PlaySome(void *stream, int samples) | |||
1485 | //printf("Timidity_PlaySome()\n"); | 1486 | //printf("Timidity_PlaySome()\n"); |
1486 | int rc = RC_NONE; | 1487 | int rc = RC_NONE; |
1487 | int32 end_sample; | 1488 | int32 end_sample; |
1488 | 1489 | ||
1489 | if ( ! midi_playing ) { | 1490 | if ( ! midi_playing ) { |
1490 | return RC_NONE; | 1491 | return RC_NONE; |
1491 | } | 1492 | } |
@@ -1504,33 +1505,33 @@ int Timidity_PlaySome(void *stream, int samples) | |||
1504 | else | 1505 | else |
1505 | note_on(current_event); | 1506 | note_on(current_event); |
1506 | break; | 1507 | break; |
1507 | 1508 | ||
1508 | case ME_NOTEOFF: | 1509 | case ME_NOTEOFF: |
1509 | current_event->a += channel[current_event->channel].transpose; | 1510 | current_event->a += channel[current_event->channel].transpose; |
1510 | note_off(current_event); | 1511 | note_off(current_event); |
1511 | break; | 1512 | break; |
1512 | 1513 | ||
1513 | case ME_KEYPRESSURE: | 1514 | case ME_KEYPRESSURE: |
1514 | adjust_pressure(current_event); | 1515 | adjust_pressure(current_event); |
1515 | break; | 1516 | break; |
1516 | 1517 | ||
1517 | /* Effects affecting a single channel */ | 1518 | /* Effects affecting a single channel */ |
1518 | 1519 | ||
1519 | case ME_PITCH_SENS: | 1520 | case ME_PITCH_SENS: |
1520 | channel[current_event->channel].pitchsens=current_event->a; | 1521 | channel[current_event->channel].pitchsens=current_event->a; |
1521 | channel[current_event->channel].pitchfactor=0; | 1522 | channel[current_event->channel].pitchfactor=0; |
1522 | break; | 1523 | break; |
1523 | 1524 | ||
1524 | case ME_PITCHWHEEL: | 1525 | case ME_PITCHWHEEL: |
1525 | channel[current_event->channel].pitchbend= | 1526 | channel[current_event->channel].pitchbend= |
1526 | current_event->a + current_event->b * 128; | 1527 | current_event->a + current_event->b * 128; |
1527 | channel[current_event->channel].pitchfactor=0; | 1528 | channel[current_event->channel].pitchfactor=0; |
1528 | /* Adjust pitch for notes already playing */ | 1529 | /* Adjust pitch for notes already playing */ |
1529 | adjust_pitchbend(current_event->channel); | 1530 | adjust_pitchbend(current_event->channel); |
1530 | ctl->pitch_bend(current_event->channel, | 1531 | ctl->pitch_bend(current_event->channel, |
1531 | channel[current_event->channel].pitchbend); | 1532 | channel[current_event->channel].pitchbend); |
1532 | break; | 1533 | break; |
1533 | 1534 | ||
1534 | case ME_MAINVOLUME: | 1535 | case ME_MAINVOLUME: |
1535 | channel[current_event->channel].volume=current_event->a; | 1536 | channel[current_event->channel].volume=current_event->a; |
1536 | adjust_volume(current_event->channel); | 1537 | adjust_volume(current_event->channel); |
@@ -1540,7 +1541,7 @@ int Timidity_PlaySome(void *stream, int samples) | |||
1540 | case ME_MASTERVOLUME: | 1541 | case ME_MASTERVOLUME: |
1541 | adjust_master_volume(current_event->a + (current_event->b <<7)); | 1542 | adjust_master_volume(current_event->a + (current_event->b <<7)); |
1542 | break; | 1543 | break; |
1543 | 1544 | ||
1544 | case ME_REVERBERATION: | 1545 | case ME_REVERBERATION: |
1545 | channel[current_event->channel].reverberation=current_event->a; | 1546 | channel[current_event->channel].reverberation=current_event->a; |
1546 | break; | 1547 | break; |
@@ -1555,13 +1556,13 @@ int Timidity_PlaySome(void *stream, int samples) | |||
1555 | adjust_panning(current_event->channel); | 1556 | adjust_panning(current_event->channel); |
1556 | ctl->panning(current_event->channel, current_event->a); | 1557 | ctl->panning(current_event->channel, current_event->a); |
1557 | break; | 1558 | break; |
1558 | 1559 | ||
1559 | case ME_EXPRESSION: | 1560 | case ME_EXPRESSION: |
1560 | channel[current_event->channel].expression=current_event->a; | 1561 | channel[current_event->channel].expression=current_event->a; |
1561 | adjust_volume(current_event->channel); | 1562 | adjust_volume(current_event->channel); |
1562 | ctl->expression(current_event->channel, current_event->a); | 1563 | ctl->expression(current_event->channel, current_event->a); |
1563 | break; | 1564 | break; |
1564 | 1565 | ||
1565 | case ME_PROGRAM: | 1566 | case ME_PROGRAM: |
1566 | /* if (ISDRUMCHANNEL(current_event->channel)) { */ | 1567 | /* if (ISDRUMCHANNEL(current_event->channel)) { */ |
1567 | if (channel[current_event->channel].kit) { | 1568 | if (channel[current_event->channel].kit) { |
@@ -1574,23 +1575,23 @@ int Timidity_PlaySome(void *stream, int samples) | |||
1574 | } | 1575 | } |
1575 | ctl->program(current_event->channel, current_event->a); | 1576 | ctl->program(current_event->channel, current_event->a); |
1576 | break; | 1577 | break; |
1577 | 1578 | ||
1578 | case ME_SUSTAIN: | 1579 | case ME_SUSTAIN: |
1579 | channel[current_event->channel].sustain=current_event->a; | 1580 | channel[current_event->channel].sustain=current_event->a; |
1580 | if (!current_event->a) | 1581 | if (!current_event->a) |
1581 | drop_sustain(current_event->channel); | 1582 | drop_sustain(current_event->channel); |
1582 | ctl->sustain(current_event->channel, current_event->a); | 1583 | ctl->sustain(current_event->channel, current_event->a); |
1583 | break; | 1584 | break; |
1584 | 1585 | ||
1585 | case ME_RESET_CONTROLLERS: | 1586 | case ME_RESET_CONTROLLERS: |
1586 | reset_controllers(current_event->channel); | 1587 | reset_controllers(current_event->channel); |
1587 | redraw_controllers(current_event->channel); | 1588 | redraw_controllers(current_event->channel); |
1588 | break; | 1589 | break; |
1589 | 1590 | ||
1590 | case ME_ALL_NOTES_OFF: | 1591 | case ME_ALL_NOTES_OFF: |
1591 | all_notes_off(current_event->channel); | 1592 | all_notes_off(current_event->channel); |
1592 | break; | 1593 | break; |
1593 | 1594 | ||
1594 | case ME_ALL_SOUNDS_OFF: | 1595 | case ME_ALL_SOUNDS_OFF: |
1595 | all_sounds_off(current_event->channel); | 1596 | all_sounds_off(current_event->channel); |
1596 | break; | 1597 | break; |
@@ -1725,7 +1726,7 @@ void Timidity_FreeSong(MidiSong *song) | |||
1725 | { | 1726 | { |
1726 | if (free_instruments_afterwards) | 1727 | if (free_instruments_afterwards) |
1727 | free_instruments(); | 1728 | free_instruments(); |
1728 | 1729 | ||
1729 | free(song->events); | 1730 | free(song->events); |
1730 | free(song); | 1731 | free(song); |
1731 | } | 1732 | } |
@@ -1743,4 +1744,3 @@ void Timidity_Close(void) | |||
1743 | free_instruments(); | 1744 | free_instruments(); |
1744 | free_pathlist(); | 1745 | free_pathlist(); |
1745 | } | 1746 | } |
1746 | |||
diff --git a/apps/plugins/sdl/SDL_mixer/timidity/readmidi.c b/apps/plugins/sdl/SDL_mixer/timidity/readmidi.c index afd3f9f571..d08a6f7dd4 100644 --- a/apps/plugins/sdl/SDL_mixer/timidity/readmidi.c +++ b/apps/plugins/sdl/SDL_mixer/timidity/readmidi.c | |||
@@ -6,9 +6,10 @@ | |||
6 | it under the terms of the Perl Artistic License, available in COPYING. | 6 | it under the terms of the Perl Artistic License, available in COPYING. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "config.h" | ||
10 | |||
9 | #include <SDL_rwops.h> | 11 | #include <SDL_rwops.h> |
10 | 12 | ||
11 | #include "config.h" | ||
12 | #include "common.h" | 13 | #include "common.h" |
13 | #include "instrum.h" | 14 | #include "instrum.h" |
14 | #include "playmidi.h" | 15 | #include "playmidi.h" |
@@ -282,11 +283,11 @@ static MidiEventList *read_midi_event(void) | |||
282 | at+=getvl(); | 283 | at+=getvl(); |
283 | if (SDL_RWread(rw,&me,1,1)!=1) | 284 | if (SDL_RWread(rw,&me,1,1)!=1) |
284 | { | 285 | { |
285 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s", | 286 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s", |
286 | current_filename, strerror(errno)); | 287 | current_filename, strerror(errno)); |
287 | return 0; | 288 | return 0; |
288 | } | 289 | } |
289 | 290 | ||
290 | if(me==0xF0 || me == 0xF7) /* SysEx event */ | 291 | if(me==0xF0 || me == 0xF7) /* SysEx event */ |
291 | { | 292 | { |
292 | int32 sret; | 293 | int32 sret; |
@@ -340,9 +341,9 @@ static MidiEventList *read_midi_event(void) | |||
340 | case 0x51: /* Tempo */ | 341 | case 0x51: /* Tempo */ |
341 | SDL_RWread(rw,&a,1,1); SDL_RWread(rw,&b,1,1); SDL_RWread(rw,&c,1,1); | 342 | SDL_RWread(rw,&a,1,1); SDL_RWread(rw,&b,1,1); SDL_RWread(rw,&c,1,1); |
342 | MIDIEVENT(at, ME_TEMPO, c, a, b); | 343 | MIDIEVENT(at, ME_TEMPO, c, a, b); |
343 | 344 | ||
344 | default: | 345 | default: |
345 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, | 346 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, |
346 | "(Meta event type 0x%02x, length %ld)", type, len); | 347 | "(Meta event type 0x%02x, length %ld)", type, len); |
347 | SDL_RWseek(rw, len, RW_SEEK_CUR); | 348 | SDL_RWseek(rw, len, RW_SEEK_CUR); |
348 | break; | 349 | break; |
@@ -414,7 +415,7 @@ static MidiEventList *read_midi_event(void) | |||
414 | case 101: nrpn=0; rpn_lsb[lastchan]=b; break; | 415 | case 101: nrpn=0; rpn_lsb[lastchan]=b; break; |
415 | case 99: nrpn=1; rpn_msb[lastchan]=b; break; | 416 | case 99: nrpn=1; rpn_msb[lastchan]=b; break; |
416 | case 98: nrpn=1; rpn_lsb[lastchan]=b; break; | 417 | case 98: nrpn=1; rpn_lsb[lastchan]=b; break; |
417 | 418 | ||
418 | case 6: | 419 | case 6: |
419 | if (nrpn) | 420 | if (nrpn) |
420 | { | 421 | { |
@@ -455,13 +456,13 @@ static MidiEventList *read_midi_event(void) | |||
455 | */ | 456 | */ |
456 | } | 457 | } |
457 | 458 | ||
458 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, | 459 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, |
459 | "(Data entry (MSB) for NRPN %02x,%02x: %ld)", | 460 | "(Data entry (MSB) for NRPN %02x,%02x: %ld)", |
460 | rpn_msb[lastchan], rpn_lsb[lastchan], | 461 | rpn_msb[lastchan], rpn_lsb[lastchan], |
461 | b); | 462 | b); |
462 | break; | 463 | break; |
463 | } | 464 | } |
464 | 465 | ||
465 | switch((rpn_msb[lastchan]<<8) | rpn_lsb[lastchan]) | 466 | switch((rpn_msb[lastchan]<<8) | rpn_lsb[lastchan]) |
466 | { | 467 | { |
467 | case 0x0000: /* Pitch bend sensitivity */ | 468 | case 0x0000: /* Pitch bend sensitivity */ |
@@ -473,22 +474,22 @@ static MidiEventList *read_midi_event(void) | |||
473 | MIDIEVENT(at, ME_PITCH_SENS, lastchan, 2, 0); | 474 | MIDIEVENT(at, ME_PITCH_SENS, lastchan, 2, 0); |
474 | 475 | ||
475 | default: | 476 | default: |
476 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, | 477 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, |
477 | "(Data entry (MSB) for RPN %02x,%02x: %ld)", | 478 | "(Data entry (MSB) for RPN %02x,%02x: %ld)", |
478 | rpn_msb[lastchan], rpn_lsb[lastchan], | 479 | rpn_msb[lastchan], rpn_lsb[lastchan], |
479 | b); | 480 | b); |
480 | break; | 481 | break; |
481 | } | 482 | } |
482 | break; | 483 | break; |
483 | 484 | ||
484 | default: | 485 | default: |
485 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, | 486 | ctl->cmsg(CMSG_INFO, VERB_DEBUG, |
486 | "(Control %d: %d)", a, b); | 487 | "(Control %d: %d)", a, b); |
487 | break; | 488 | break; |
488 | } | 489 | } |
489 | if (control != 255) | 490 | if (control != 255) |
490 | { | 491 | { |
491 | MIDIEVENT(at, control, lastchan, b, 0); | 492 | MIDIEVENT(at, control, lastchan, b, 0); |
492 | } | 493 | } |
493 | } | 494 | } |
494 | break; | 495 | break; |
@@ -505,15 +506,15 @@ static MidiEventList *read_midi_event(void) | |||
505 | b &= 0x7F; | 506 | b &= 0x7F; |
506 | MIDIEVENT(at, ME_PITCHWHEEL, lastchan, a, b); | 507 | MIDIEVENT(at, ME_PITCHWHEEL, lastchan, a, b); |
507 | 508 | ||
508 | default: | 509 | default: |
509 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 510 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
510 | "*** Can't happen: status 0x%02X, channel 0x%02X", | 511 | "*** Can't happen: status 0x%02X, channel 0x%02X", |
511 | laststatus, lastchan); | 512 | laststatus, lastchan); |
512 | break; | 513 | break; |
513 | } | 514 | } |
514 | } | 515 | } |
515 | } | 516 | } |
516 | 517 | ||
517 | return new; | 518 | return new; |
518 | } | 519 | } |
519 | 520 | ||
@@ -574,7 +575,7 @@ static int read_track(int append) | |||
574 | meep=next; | 575 | meep=next; |
575 | next=meep->next; | 576 | next=meep->next; |
576 | } | 577 | } |
577 | 578 | ||
578 | new->next=next; | 579 | new->next=next; |
579 | meep->next=new; | 580 | meep->next=new; |
580 | 581 | ||
@@ -720,7 +721,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
720 | } | 721 | } |
721 | if (current_set[meep->event.channel] != new_value) | 722 | if (current_set[meep->event.channel] != new_value) |
722 | current_set[meep->event.channel]=new_value; | 723 | current_set[meep->event.channel]=new_value; |
723 | else | 724 | else |
724 | skip_this_event=1; | 725 | skip_this_event=1; |
725 | } | 726 | } |
726 | else | 727 | else |
@@ -776,7 +777,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
776 | if (mprog==SPECIAL_PROGRAM) | 777 | if (mprog==SPECIAL_PROGRAM) |
777 | break; | 778 | break; |
778 | 779 | ||
779 | if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120]) | 780 | if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120]) |
780 | banknum = 120; | 781 | banknum = 120; |
781 | 782 | ||
782 | /*if (current_config_pc42b) pcmap(&banknum, &dnote, &mprog, &drumsflag);*/ | 783 | /*if (current_config_pc42b) pcmap(&banknum, &dnote, &mprog, &drumsflag);*/ |
@@ -812,7 +813,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
812 | new_value=meep->event.a; | 813 | new_value=meep->event.a; |
813 | if (current_kit[meep->event.channel] != new_value) | 814 | if (current_kit[meep->event.channel] != new_value) |
814 | current_kit[meep->event.channel]=new_value; | 815 | current_kit[meep->event.channel]=new_value; |
815 | else | 816 | else |
816 | skip_this_event=1; | 817 | skip_this_event=1; |
817 | break; | 818 | break; |
818 | } | 819 | } |
@@ -846,7 +847,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
846 | } | 847 | } |
847 | if (tonebank[SFXBANK] || tonebank[120]) /* Is this a defined tone bank? */ | 848 | if (tonebank[SFXBANK] || tonebank[120]) /* Is this a defined tone bank? */ |
848 | new_value=SFX_BANKTYPE; | 849 | new_value=SFX_BANKTYPE; |
849 | else | 850 | else |
850 | { | 851 | { |
851 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, | 852 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, |
852 | "XG Sfx bank is undefined"); | 853 | "XG Sfx bank is undefined"); |
@@ -873,7 +874,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
873 | } | 874 | } |
874 | else if (tonebank[meep->event.a]) /* Is this a defined tone bank? */ | 875 | else if (tonebank[meep->event.a]) /* Is this a defined tone bank? */ |
875 | new_value=meep->event.a; | 876 | new_value=meep->event.a; |
876 | else | 877 | else |
877 | { | 878 | { |
878 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, | 879 | ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, |
879 | "Tone bank %d is undefined", meep->event.a); | 880 | "Tone bank %d is undefined", meep->event.a); |
@@ -924,7 +925,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp) | |||
924 | lp->type=ME_EOT; | 925 | lp->type=ME_EOT; |
925 | our_event_count++; | 926 | our_event_count++; |
926 | free_midi_list(); | 927 | free_midi_list(); |
927 | 928 | ||
928 | *eventsp=our_event_count; | 929 | *eventsp=our_event_count; |
929 | *samplesp=st; | 930 | *samplesp=st; |
930 | return groomed_list; | 931 | return groomed_list; |
@@ -968,11 +969,11 @@ past_riff: | |||
968 | { | 969 | { |
969 | /* if (ferror(fp)) | 970 | /* if (ferror(fp)) |
970 | { | 971 | { |
971 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename, | 972 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename, |
972 | strerror(errno)); | 973 | strerror(errno)); |
973 | } | 974 | } |
974 | else*/ | 975 | else*/ |
975 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 976 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
976 | "%s: Not a MIDI file!", current_filename); | 977 | "%s: Not a MIDI file!", current_filename); |
977 | return 0; | 978 | return 0; |
978 | } | 979 | } |
@@ -1010,18 +1011,18 @@ past_riff: | |||
1010 | 1011 | ||
1011 | if (len > 6) | 1012 | if (len > 6) |
1012 | { | 1013 | { |
1013 | ctl->cmsg(CMSG_WARNING, VERB_NORMAL, | 1014 | ctl->cmsg(CMSG_WARNING, VERB_NORMAL, |
1014 | "%s: MIDI file header size %ld bytes", | 1015 | "%s: MIDI file header size %ld bytes", |
1015 | current_filename, len); | 1016 | current_filename, len); |
1016 | SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */ | 1017 | SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */ |
1017 | } | 1018 | } |
1018 | if (format<0 || format >2) | 1019 | if (format<0 || format >2) |
1019 | { | 1020 | { |
1020 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 1021 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
1021 | "%s: Unknown MIDI file format %d", current_filename, format); | 1022 | "%s: Unknown MIDI file format %d", current_filename, format); |
1022 | return 0; | 1023 | return 0; |
1023 | } | 1024 | } |
1024 | ctl->cmsg(CMSG_INFO, VERB_VERBOSE, | 1025 | ctl->cmsg(CMSG_INFO, VERB_VERBOSE, |
1025 | "Format: %d Tracks: %d Divisions: %d", format, tracks, divisions); | 1026 | "Format: %d Tracks: %d Divisions: %d", format, tracks, divisions); |
1026 | 1027 | ||
1027 | /* Put a do-nothing event first in the list for easier processing */ | 1028 | /* Put a do-nothing event first in the list for easier processing */ |
diff --git a/apps/plugins/sdl/SDL_mixer/timidity/timidity.c b/apps/plugins/sdl/SDL_mixer/timidity/timidity.c index 7d3214f5f6..fbb90e832f 100644 --- a/apps/plugins/sdl/SDL_mixer/timidity/timidity.c +++ b/apps/plugins/sdl/SDL_mixer/timidity/timidity.c | |||
@@ -6,8 +6,8 @@ | |||
6 | it under the terms of the Perl Artistic License, available in COPYING. | 6 | it under the terms of the Perl Artistic License, available in COPYING. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "SDL.h" | ||
10 | #include "config.h" | 9 | #include "config.h" |
10 | #include "SDL.h" | ||
11 | #include "common.h" | 11 | #include "common.h" |
12 | #include "instrum.h" | 12 | #include "instrum.h" |
13 | #include "playmidi.h" | 13 | #include "playmidi.h" |
@@ -88,7 +88,7 @@ static int read_config_file(const char *name) | |||
88 | { | 88 | { |
89 | if (words != 2) | 89 | if (words != 2) |
90 | { | 90 | { |
91 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 91 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
92 | "%s: line %d: Must specify exactly one patch name\n", | 92 | "%s: line %d: Must specify exactly one patch name\n", |
93 | name, line); | 93 | name, line); |
94 | return -2; | 94 | return -2; |
@@ -101,14 +101,14 @@ static int read_config_file(const char *name) | |||
101 | if (words < 2) | 101 | if (words < 2) |
102 | { | 102 | { |
103 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 103 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
104 | "%s: line %d: No drum set number given\n", | 104 | "%s: line %d: No drum set number given\n", |
105 | name, line); | 105 | name, line); |
106 | return -2; | 106 | return -2; |
107 | } | 107 | } |
108 | i=atoi(w[1]); | 108 | i=atoi(w[1]); |
109 | if (i<0 || i>127) | 109 | if (i<0 || i>127) |
110 | { | 110 | { |
111 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 111 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
112 | "%s: line %d: Drum set must be between 0 and 127\n", | 112 | "%s: line %d: Drum set must be between 0 and 127\n", |
113 | name, line); | 113 | name, line); |
114 | return -2; | 114 | return -2; |
@@ -125,14 +125,14 @@ static int read_config_file(const char *name) | |||
125 | if (words < 2) | 125 | if (words < 2) |
126 | { | 126 | { |
127 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 127 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
128 | "%s: line %d: No bank number given\n", | 128 | "%s: line %d: No bank number given\n", |
129 | name, line); | 129 | name, line); |
130 | return -2; | 130 | return -2; |
131 | } | 131 | } |
132 | i=atoi(w[1]); | 132 | i=atoi(w[1]); |
133 | if (i<0 || i>127) | 133 | if (i<0 || i>127) |
134 | { | 134 | { |
135 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 135 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
136 | "%s: line %d: Tone bank must be between 0 and 127\n", | 136 | "%s: line %d: Tone bank must be between 0 and 127\n", |
137 | name, line); | 137 | name, line); |
138 | return -2; | 138 | return -2; |
@@ -161,7 +161,7 @@ static int read_config_file(const char *name) | |||
161 | } | 161 | } |
162 | if (!bank) | 162 | if (!bank) |
163 | { | 163 | { |
164 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 164 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
165 | "%s: line %d: Must specify tone bank or drum set " | 165 | "%s: line %d: Must specify tone bank or drum set " |
166 | "before assignment\n", | 166 | "before assignment\n", |
167 | name, line); | 167 | name, line); |
@@ -188,7 +188,7 @@ static int read_config_file(const char *name) | |||
188 | k=atoi(cp); | 188 | k=atoi(cp); |
189 | if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9')) | 189 | if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9')) |
190 | { | 190 | { |
191 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 191 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
192 | "%s: line %d: amplification must be between " | 192 | "%s: line %d: amplification must be between " |
193 | "0 and %d\n", name, line, MAX_AMPLIFICATION); | 193 | "0 and %d\n", name, line, MAX_AMPLIFICATION); |
194 | return -2; | 194 | return -2; |
@@ -200,7 +200,7 @@ static int read_config_file(const char *name) | |||
200 | k=atoi(cp); | 200 | k=atoi(cp); |
201 | if ((k<0 || k>127) || (*cp < '0' || *cp > '9')) | 201 | if ((k<0 || k>127) || (*cp < '0' || *cp > '9')) |
202 | { | 202 | { |
203 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 203 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
204 | "%s: line %d: note must be between 0 and 127\n", | 204 | "%s: line %d: note must be between 0 and 127\n", |
205 | name, line); | 205 | name, line); |
206 | return -2; | 206 | return -2; |
@@ -220,7 +220,7 @@ static int read_config_file(const char *name) | |||
220 | if ((k<0 || k>127) || | 220 | if ((k<0 || k>127) || |
221 | (k==0 && *cp!='-' && (*cp < '0' || *cp > '9'))) | 221 | (k==0 && *cp!='-' && (*cp < '0' || *cp > '9'))) |
222 | { | 222 | { |
223 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, | 223 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
224 | "%s: line %d: panning must be left, right, " | 224 | "%s: line %d: panning must be left, right, " |
225 | "center, or between -100 and 100\n", | 225 | "center, or between -100 and 100\n", |
226 | name, line); | 226 | name, line); |
@@ -302,7 +302,7 @@ int Timidity_Init(int rate, int format, int channels, int samples) | |||
302 | } | 302 | } |
303 | if ( channels == 1 ) { | 303 | if ( channels == 1 ) { |
304 | play_mode->encoding |= PE_MONO; | 304 | play_mode->encoding |= PE_MONO; |
305 | } | 305 | } |
306 | switch (format) { | 306 | switch (format) { |
307 | case AUDIO_S8: | 307 | case AUDIO_S8: |
308 | s32tobuf = s32tos8; | 308 | s32tobuf = s32tos8; |
@@ -356,4 +356,3 @@ const char *Timidity_Error(void) | |||
356 | { | 356 | { |
357 | return(timidity_error); | 357 | return(timidity_error); |
358 | } | 358 | } |
359 | |||
diff --git a/apps/plugins/sdl/SDL_mixer/wavestream.c b/apps/plugins/sdl/SDL_mixer/wavestream.c index 4e95da7af4..489863908f 100644 --- a/apps/plugins/sdl/SDL_mixer/wavestream.c +++ b/apps/plugins/sdl/SDL_mixer/wavestream.c | |||
@@ -59,7 +59,7 @@ typedef struct WaveFMT { | |||
59 | Uint32 FMTchunk; | 59 | Uint32 FMTchunk; |
60 | Uint32 fmtlen; | 60 | Uint32 fmtlen; |
61 | */ | 61 | */ |
62 | Uint16 encoding; | 62 | Uint16 encoding; |
63 | Uint16 channels; /* 1 = mono, 2 = stereo */ | 63 | Uint16 channels; /* 1 = mono, 2 = stereo */ |
64 | Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ | 64 | Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ |
65 | Uint32 byterate; /* Average bytes per second */ | 65 | Uint32 byterate; /* Average bytes per second */ |
@@ -213,11 +213,11 @@ int WAVStream_PlaySome(Uint8 *stream, int len) | |||
213 | } | 213 | } |
214 | data = SDL_stack_alloc(Uint8, len); | 214 | data = SDL_stack_alloc(Uint8, len); |
215 | if (data) | 215 | if (data) |
216 | { | 216 | { |
217 | SDL_RWread(music->rw, data, len, 1); | 217 | SDL_RWread(music->rw, data, len, 1); |
218 | SDL_MixAudio(stream, data, len, wavestream_volume); | 218 | SDL_MixAudio(stream, data, len, wavestream_volume); |
219 | SDL_stack_free(data); | 219 | SDL_stack_free(data); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } |
223 | return left; | 223 | return left; |
@@ -286,7 +286,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec, | |||
286 | 286 | ||
287 | /* WAV magic header */ | 287 | /* WAV magic header */ |
288 | Uint32 RIFFchunk; | 288 | Uint32 RIFFchunk; |
289 | Uint32 wavelen; | 289 | // Uint32 wavelen; |
290 | Uint32 WAVEmagic; | 290 | Uint32 WAVEmagic; |
291 | 291 | ||
292 | /* FMT chunk */ | 292 | /* FMT chunk */ |
@@ -296,7 +296,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec, | |||
296 | 296 | ||
297 | /* Check the magic header */ | 297 | /* Check the magic header */ |
298 | RIFFchunk = SDL_ReadLE32(src); | 298 | RIFFchunk = SDL_ReadLE32(src); |
299 | wavelen = SDL_ReadLE32(src); | 299 | // wavelen = SDL_ReadLE32(src); |
300 | WAVEmagic = SDL_ReadLE32(src); | 300 | WAVEmagic = SDL_ReadLE32(src); |
301 | if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) { | 301 | if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) { |
302 | Mix_SetError("Unrecognized file type (not WAVE)"); | 302 | Mix_SetError("Unrecognized file type (not WAVE)"); |
@@ -416,7 +416,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec, | |||
416 | Uint32 AIFFmagic; | 416 | Uint32 AIFFmagic; |
417 | /* SSND chunk */ | 417 | /* SSND chunk */ |
418 | Uint32 offset; | 418 | Uint32 offset; |
419 | Uint32 blocksize; | 419 | // Uint32 blocksize; |
420 | /* COMM format chunk */ | 420 | /* COMM format chunk */ |
421 | Uint16 channels = 0; | 421 | Uint16 channels = 0; |
422 | Uint32 numsamples = 0; | 422 | Uint32 numsamples = 0; |
@@ -459,7 +459,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec, | |||
459 | case SSND: | 459 | case SSND: |
460 | found_SSND = 1; | 460 | found_SSND = 1; |
461 | offset = SDL_ReadBE32(src); | 461 | offset = SDL_ReadBE32(src); |
462 | blocksize = SDL_ReadBE32(src); | 462 | // blocksize = SDL_ReadBE32(src); |
463 | *start = SDL_RWtell(src) + offset; | 463 | *start = SDL_RWtell(src) + offset; |
464 | break; | 464 | break; |
465 | 465 | ||
@@ -485,7 +485,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec, | |||
485 | was_error = 1; | 485 | was_error = 1; |
486 | goto done; | 486 | goto done; |
487 | } | 487 | } |
488 | 488 | ||
489 | if (!found_COMM) { | 489 | if (!found_COMM) { |
490 | Mix_SetError("Bad AIFF file (no COMM chunk)"); | 490 | Mix_SetError("Bad AIFF file (no COMM chunk)"); |
491 | was_error = 1; | 491 | was_error = 1; |
@@ -518,4 +518,3 @@ done: | |||
518 | } | 518 | } |
519 | return(src); | 519 | return(src); |
520 | } | 520 | } |
521 | |||
diff --git a/apps/plugins/sdl/include/SDL_config_rockbox.h b/apps/plugins/sdl/include/SDL_config_rockbox.h index 91183ebf88..2a4c62801d 100644 --- a/apps/plugins/sdl/include/SDL_config_rockbox.h +++ b/apps/plugins/sdl/include/SDL_config_rockbox.h | |||
@@ -92,6 +92,9 @@ | |||
92 | #undef strdup | 92 | #undef strdup |
93 | 93 | ||
94 | /* clock() wraps current_tick */ | 94 | /* clock() wraps current_tick */ |
95 | #ifdef CLOCKS_PER_SEC | ||
96 | #undef CLOCKS_PER_SEC | ||
97 | #endif | ||
95 | #define CLOCKS_PER_SEC HZ | 98 | #define CLOCKS_PER_SEC HZ |
96 | 99 | ||
97 | /* | 100 | /* |
@@ -160,9 +163,13 @@ | |||
160 | #define strlcpy rb->strlcpy | 163 | #define strlcpy rb->strlcpy |
161 | #define strlen rb->strlen | 164 | #define strlen rb->strlen |
162 | #define strncasecmp rb->strncasecmp | 165 | #define strncasecmp rb->strncasecmp |
166 | #ifndef strncat | ||
163 | #define strncat rb->strlcat /* hack */ | 167 | #define strncat rb->strlcat /* hack */ |
168 | #endif | ||
164 | #define strncmp rb->strncmp | 169 | #define strncmp rb->strncmp |
170 | #ifndef strncat | ||
165 | #define strpbrk strpbrk_wrapper | 171 | #define strpbrk strpbrk_wrapper |
172 | #endif | ||
166 | #define strrchr rb->strrchr | 173 | #define strrchr rb->strrchr |
167 | #define strstr SDL_strstr | 174 | #define strstr SDL_strstr |
168 | #define strtok strtok_wrapper | 175 | #define strtok strtok_wrapper |
diff --git a/apps/plugins/sdl/main.c b/apps/plugins/sdl/main.c index 72ef841900..be5192898c 100644 --- a/apps/plugins/sdl/main.c +++ b/apps/plugins/sdl/main.c | |||
@@ -71,8 +71,8 @@ void cleanup(void) | |||
71 | #endif | 71 | #endif |
72 | } | 72 | } |
73 | 73 | ||
74 | /* 256KB */ | 74 | static long main_stack[1024 * 1024 / 4]; /* ie 1 MB */ |
75 | static long main_stack[1024 * 1024 / 2]; | 75 | |
76 | int (*main_fn)(int argc, char *argv[]); | 76 | int (*main_fn)(int argc, char *argv[]); |
77 | int prog_idx; | 77 | int prog_idx; |
78 | static void main_thread(void) | 78 | static void main_thread(void) |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c index c16c8fb25c..5a92c3c9ab 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c | |||
@@ -244,7 +244,7 @@ static void init_new_res_vars(int32_t davidoption) | |||
244 | qsetmode = surface->h; | 244 | qsetmode = surface->h; |
245 | activepage = visualpage = 0; | 245 | activepage = visualpage = 0; |
246 | 246 | ||
247 | 247 | ||
248 | frameoffset = frameplace = (uint8_t*)surface->pixels; | 248 | frameoffset = frameplace = (uint8_t*)surface->pixels; |
249 | 249 | ||
250 | if (screen != NULL) | 250 | if (screen != NULL) |
@@ -259,7 +259,7 @@ static void init_new_res_vars(int32_t davidoption) | |||
259 | { | 259 | { |
260 | case 1:i = xdim*ydim; break; | 260 | case 1:i = xdim*ydim; break; |
261 | case 2: xdim = 320; ydim = 200; i = xdim*ydim; break; | 261 | case 2: xdim = 320; ydim = 200; i = xdim*ydim; break; |
262 | 262 | ||
263 | default: assert(0); | 263 | default: assert(0); |
264 | } | 264 | } |
265 | j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */ | 265 | j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */ |
@@ -269,13 +269,13 @@ static void init_new_res_vars(int32_t davidoption) | |||
269 | 269 | ||
270 | if(horizlookup2) | 270 | if(horizlookup2) |
271 | free(horizlookup2); | 271 | free(horizlookup2); |
272 | 272 | ||
273 | horizlookup = (int32_t*)malloc(j); | 273 | horizlookup = (int32_t*)malloc(j); |
274 | horizlookup2 = (int32_t*)malloc(j); | 274 | horizlookup2 = (int32_t*)malloc(j); |
275 | 275 | ||
276 | j = 0; | 276 | j = 0; |
277 | 277 | ||
278 | //Build lookup table (X screespace -> frambuffer offset. | 278 | //Build lookup table (X screespace -> frambuffer offset. |
279 | for(i = 0; i <= ydim; i++) | 279 | for(i = 0; i <= ydim; i++) |
280 | { | 280 | { |
281 | ylookup[i] = j; | 281 | ylookup[i] = j; |
@@ -290,16 +290,16 @@ static void init_new_res_vars(int32_t davidoption) | |||
290 | //Let the Assembly module how many pixels to skip when drawing a column | 290 | //Let the Assembly module how many pixels to skip when drawing a column |
291 | setBytesPerLine(bytesperline); | 291 | setBytesPerLine(bytesperline); |
292 | 292 | ||
293 | 293 | ||
294 | setview(0L,0L,xdim-1,ydim-1); | 294 | setview(0L,0L,xdim-1,ydim-1); |
295 | 295 | ||
296 | setbrightness(curbrightness, palette); | 296 | setbrightness(curbrightness, palette); |
297 | 297 | ||
298 | if (searchx < 0) { | 298 | if (searchx < 0) { |
299 | searchx = halfxdimen; | 299 | searchx = halfxdimen; |
300 | searchy = (ydimen>>1); | 300 | searchy = (ydimen>>1); |
301 | } | 301 | } |
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | 305 | ||
@@ -370,17 +370,17 @@ static int sdl_mouse_motion_filter(SDL_Event const *event) | |||
370 | } | 370 | } |
371 | else | 371 | else |
372 | { | 372 | { |
373 | if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) | 373 | if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) |
374 | { | 374 | { |
375 | mouse_relative_x += event->motion.xrel; | 375 | mouse_relative_x += event->motion.xrel; |
376 | mouse_relative_y += event->motion.yrel; | 376 | mouse_relative_y += event->motion.yrel; |
377 | //printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n", | 377 | //printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n", |
378 | // mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel); | 378 | // mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel); |
379 | 379 | ||
380 | // mouse_relative_* is already reset in | 380 | // mouse_relative_* is already reset in |
381 | // readmousexy(). It must not be | 381 | // readmousexy(). It must not be |
382 | // reset here because calling this function does not mean | 382 | // reset here because calling this function does not mean |
383 | // we always handle the mouse. | 383 | // we always handle the mouse. |
384 | // FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode. | 384 | // FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode. |
385 | } | 385 | } |
386 | else | 386 | else |
@@ -431,12 +431,12 @@ static __inline int handle_keypad_enter_hack(const SDL_Event *event) | |||
431 | 431 | ||
432 | void fullscreen_toggle_and_change_driver(void) | 432 | void fullscreen_toggle_and_change_driver(void) |
433 | { | 433 | { |
434 | 434 | ||
435 | // FIX_00002: New Toggle Windowed/FullScreen system now simpler and will | 435 | // FIX_00002: New Toggle Windowed/FullScreen system now simpler and will |
436 | // dynamically change for Windib or Directx driver. Windowed/Fullscreen | 436 | // dynamically change for Windib or Directx driver. Windowed/Fullscreen |
437 | // toggle also made available from menu. | 437 | // toggle also made available from menu. |
438 | // Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags) | 438 | // Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags) |
439 | 439 | ||
440 | int32_t x,y; | 440 | int32_t x,y; |
441 | x = surface->w; | 441 | x = surface->w; |
442 | y = surface->h; | 442 | y = surface->h; |
@@ -462,8 +462,8 @@ static int sdl_key_filter(const SDL_Event *event) | |||
462 | 462 | ||
463 | // FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M) | 463 | // FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M) |
464 | // This is usefull to move the duke window when playing in window mode. | 464 | // This is usefull to move the duke window when playing in window mode. |
465 | 465 | ||
466 | if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) | 466 | if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) |
467 | { | 467 | { |
468 | SDL_WM_GrabInput(SDL_GRAB_OFF); | 468 | SDL_WM_GrabInput(SDL_GRAB_OFF); |
469 | SDL_ShowCursor(1); | 469 | SDL_ShowCursor(1); |
@@ -491,9 +491,9 @@ static int sdl_key_filter(const SDL_Event *event) | |||
491 | lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended) | 491 | lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended) |
492 | keyhandler(); | 492 | keyhandler(); |
493 | SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys | 493 | SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys |
494 | 494 | ||
495 | return(0); | 495 | return(0); |
496 | } | 496 | } |
497 | 497 | ||
498 | if (!handle_keypad_enter_hack(event)) | 498 | if (!handle_keypad_enter_hack(event)) |
499 | lastkey = scancodes[event->key.keysym.sym]; | 499 | lastkey = scancodes[event->key.keysym.sym]; |
@@ -546,7 +546,7 @@ static int root_sdl_event_filter(const SDL_Event *event) | |||
546 | return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event)); | 546 | return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event)); |
547 | case SDL_QUIT: | 547 | case SDL_QUIT: |
548 | /* !!! rcg TEMP */ | 548 | /* !!! rcg TEMP */ |
549 | Error(EXIT_SUCCESS, "Exit through SDL\n"); | 549 | Error(EXIT_SUCCESS, "Exit through SDL\n"); |
550 | default: | 550 | default: |
551 | //printf("This event is not handled: %d\n",event->type); | 551 | //printf("This event is not handled: %d\n",event->type); |
552 | break; | 552 | break; |
@@ -662,7 +662,7 @@ int _joystick_update(void) | |||
662 | int _joystick_axis(int axis) | 662 | int _joystick_axis(int axis) |
663 | { | 663 | { |
664 | if (joystick == NULL) | 664 | if (joystick == NULL) |
665 | { | 665 | { |
666 | return(0); | 666 | return(0); |
667 | } | 667 | } |
668 | 668 | ||
@@ -672,7 +672,7 @@ int _joystick_axis(int axis) | |||
672 | int _joystick_hat(int hat) | 672 | int _joystick_hat(int hat) |
673 | { | 673 | { |
674 | if (joystick == NULL) | 674 | if (joystick == NULL) |
675 | { | 675 | { |
676 | return(-1); | 676 | return(-1); |
677 | } | 677 | } |
678 | 678 | ||
@@ -753,28 +753,28 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico | |||
753 | //TODO: | 753 | //TODO: |
754 | //TODO ( "[Todo: handle -netmode <int>]" ) | 754 | //TODO ( "[Todo: handle -netmode <int>]" ) |
755 | Setup_StableNetworking(); | 755 | Setup_StableNetworking(); |
756 | 756 | ||
757 | } | 757 | } |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | 761 | ||
762 | if (SDL_Init(SDL_INIT_VIDEO) == -1){ | 762 | if (SDL_Init(SDL_INIT_VIDEO) == -1){ |
763 | Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError()); | 763 | Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError()); |
764 | } | 764 | } |
765 | 765 | ||
766 | 766 | ||
767 | // Set up the correct renderer | 767 | // Set up the correct renderer |
768 | // Becarfull setenv can't reach dll in VC++ | 768 | // Becarfull setenv can't reach dll in VC++ |
769 | // A way to proceed is to integrate the SDL libs | 769 | // A way to proceed is to integrate the SDL libs |
770 | // in the exe instead. | 770 | // in the exe instead. |
771 | 771 | ||
772 | // FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe | 772 | // FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe |
773 | // (this also makes the Windib/Directx driver switching easier with SDL) | 773 | // (this also makes the Windib/Directx driver switching easier with SDL) |
774 | 774 | ||
775 | // This requires to recompile the whole sdl and sdl mixer with the lib | 775 | // This requires to recompile the whole sdl and sdl mixer with the lib |
776 | // switch instead of the default dll switch. | 776 | // switch instead of the default dll switch. |
777 | 777 | ||
778 | putenv("SDL_VIDEO_CENTERED=1"); | 778 | putenv("SDL_VIDEO_CENTERED=1"); |
779 | 779 | ||
780 | if (title == NULL) | 780 | if (title == NULL) |
@@ -895,12 +895,12 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico | |||
895 | scancodes[SDLK_PAGEDOWN] = 0xE051; | 895 | scancodes[SDLK_PAGEDOWN] = 0xE051; |
896 | scancodes[SDLK_INSERT] = 0xE052; | 896 | scancodes[SDLK_INSERT] = 0xE052; |
897 | scancodes[SDLK_DELETE] = 0xE053; | 897 | scancodes[SDLK_DELETE] = 0xE053; |
898 | 898 | ||
899 | 899 | ||
900 | 900 | ||
901 | output_sdl_versions(); | 901 | output_sdl_versions(); |
902 | output_driver_info(); | 902 | output_driver_info(); |
903 | 903 | ||
904 | 904 | ||
905 | printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20)); | 905 | printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20)); |
906 | 906 | ||
@@ -909,11 +909,11 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico | |||
909 | // Capture BMP of the current frame | 909 | // Capture BMP of the current frame |
910 | int screencapture(char *filename, uint8_t inverseit) | 910 | int screencapture(char *filename, uint8_t inverseit) |
911 | { | 911 | { |
912 | // FIX_00006: better naming system for screenshots + message when pic is taken. | 912 | // FIX_00006: better naming system for screenshots + message when pic is taken. |
913 | // Use ./screenshots folder. Screenshot code rerwritten. Faster and | 913 | // Use ./screenshots folder. Screenshot code rerwritten. Faster and |
914 | // makes smaller files. Doesn't freeze or lag the game anymore. | 914 | // makes smaller files. Doesn't freeze or lag the game anymore. |
915 | 915 | ||
916 | SDL_SaveBMP(surface, filename); | 916 | SDL_SaveBMP(surface, filename); |
917 | return 0; | 917 | return 0; |
918 | } /* screencapture */ | 918 | } /* screencapture */ |
919 | 919 | ||
@@ -928,7 +928,7 @@ void setvmode(int mode) | |||
928 | } else | 928 | } else |
929 | printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode); | 929 | printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode); |
930 | 930 | ||
931 | } | 931 | } |
932 | 932 | ||
933 | int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim) | 933 | int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim) |
934 | { | 934 | { |
@@ -941,13 +941,13 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim) | |||
941 | colorkey = 0; // index in this image to be transparent | 941 | colorkey = 0; // index in this image to be transparent |
942 | SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); | 942 | SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); |
943 | SDL_WM_SetIcon(image,NULL); | 943 | SDL_WM_SetIcon(image,NULL); |
944 | 944 | ||
945 | if (daxdim > MAXXDIM || daydim > MAXYDIM) | 945 | if (daxdim > MAXXDIM || daydim > MAXYDIM) |
946 | { | 946 | { |
947 | printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM); | 947 | printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM); |
948 | daxdim = MAXXDIM; | 948 | daxdim = MAXXDIM; |
949 | daydim = MAXYDIM; | 949 | daydim = MAXYDIM; |
950 | } | 950 | } |
951 | 951 | ||
952 | getvalidvesamodes(); | 952 | getvalidvesamodes(); |
953 | 953 | ||
@@ -1052,8 +1052,8 @@ static __inline void add_user_defined_resolution(void) | |||
1052 | /* rockbox hack */ | 1052 | /* rockbox hack */ |
1053 | add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT); | 1053 | add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT); |
1054 | add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH); | 1054 | add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH); |
1055 | 1055 | ||
1056 | 1056 | ||
1057 | if (envr == NULL) | 1057 | if (envr == NULL) |
1058 | return; | 1058 | return; |
1059 | 1059 | ||
@@ -1111,7 +1111,7 @@ static __inline void cull_large_vesa_modes(void) | |||
1111 | int32_t max_w; | 1111 | int32_t max_w; |
1112 | int32_t max_h; | 1112 | int32_t max_h; |
1113 | int i; | 1113 | int i; |
1114 | 1114 | ||
1115 | get_max_screen_res(&max_w, &max_h); | 1115 | get_max_screen_res(&max_w, &max_h); |
1116 | printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h); | 1116 | printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h); |
1117 | 1117 | ||
@@ -1139,7 +1139,7 @@ static __inline void cull_duplicate_vesa_modes(void) | |||
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | #define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; } | 1145 | #define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; } |
@@ -1196,7 +1196,7 @@ static __inline void output_vesa_modelist(void) | |||
1196 | } /* for */ | 1196 | } /* for */ |
1197 | 1197 | ||
1198 | printf("Final sorted modelist:%s", buffer); | 1198 | printf("Final sorted modelist:%s", buffer); |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | 1201 | ||
1202 | void getvalidvesamodes(void) | 1202 | void getvalidvesamodes(void) |
@@ -1233,37 +1233,37 @@ void getvalidvesamodes(void) | |||
1233 | 1233 | ||
1234 | /* print it out for debugging purposes... */ | 1234 | /* print it out for debugging purposes... */ |
1235 | output_vesa_modelist(); | 1235 | output_vesa_modelist(); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | uint8_t lastPalette[768]; | 1238 | uint8_t lastPalette[768]; |
1239 | void WriteTranslucToFile(void){ | 1239 | void WriteTranslucToFile(void){ |
1240 | 1240 | ||
1241 | uint8_t buffer[65535*4]; | 1241 | uint8_t buffer[65535*4]; |
1242 | uint8_t tga_header[18]; | 1242 | uint8_t tga_header[18]; |
1243 | uint8_t* transPointer = transluc; | 1243 | uint8_t* transPointer = transluc; |
1244 | uint8_t* bufferPointer = buffer; | 1244 | uint8_t* bufferPointer = buffer; |
1245 | int i; | 1245 | int i; |
1246 | FILE* file; | 1246 | FILE* file; |
1247 | 1247 | ||
1248 | for (i=0; i < 65535; i++) { | 1248 | for (i=0; i < 65535; i++) { |
1249 | 1249 | ||
1250 | bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255; | 1250 | bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255; |
1251 | bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255; | 1251 | bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255; |
1252 | bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255; | 1252 | bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255; |
1253 | bufferPointer[3] = 255; | 1253 | bufferPointer[3] = 255; |
1254 | 1254 | ||
1255 | printf("%d,",*transPointer); | 1255 | printf("%d,",*transPointer); |
1256 | if (i%255 ==0) | 1256 | if (i%255 ==0) |
1257 | printf("\n"); | 1257 | printf("\n"); |
1258 | 1258 | ||
1259 | transPointer +=1; | 1259 | transPointer +=1; |
1260 | bufferPointer+=4; | 1260 | bufferPointer+=4; |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | 1263 | ||
1264 | 1264 | ||
1265 | file = fopen("/transluc.tga", "w"); | 1265 | file = fopen("/transluc.tga", "w"); |
1266 | 1266 | ||
1267 | memset(tga_header, 0, 18); | 1267 | memset(tga_header, 0, 18); |
1268 | tga_header[2] = 2; | 1268 | tga_header[2] = 2; |
1269 | tga_header[12] = (256 & 0x00FF); | 1269 | tga_header[12] = (256 & 0x00FF); |
@@ -1271,23 +1271,23 @@ void WriteTranslucToFile(void){ | |||
1271 | tga_header[14] = (256 & 0x00FF) ; | 1271 | tga_header[14] = (256 & 0x00FF) ; |
1272 | tga_header[15] =(256 & 0xFF00) / 256; | 1272 | tga_header[15] =(256 & 0xFF00) / 256; |
1273 | tga_header[16] = 32 ; | 1273 | tga_header[16] = 32 ; |
1274 | 1274 | ||
1275 | fwrite(&tga_header, 18, sizeof(uint8_t), file); | 1275 | fwrite(&tga_header, 18, sizeof(uint8_t), file); |
1276 | fwrite(buffer, 65535, 4, file); | 1276 | fwrite(buffer, 65535, 4, file); |
1277 | fclose(file); | 1277 | fclose(file); |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){ | 1280 | void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){ |
1281 | 1281 | ||
1282 | uint8_t tga_header[18]; | 1282 | uint8_t tga_header[18]; |
1283 | uint8_t* buffer; | 1283 | uint8_t* buffer; |
1284 | uint8_t* palettePointer = palette; | 1284 | uint8_t* palettePointer = palette; |
1285 | uint8_t* bufferPointer ; | 1285 | uint8_t* bufferPointer ; |
1286 | int i; | 1286 | int i; |
1287 | 1287 | ||
1288 | FILE* file = fopen(filename, "w"); | 1288 | FILE* file = fopen(filename, "w"); |
1289 | 1289 | ||
1290 | 1290 | ||
1291 | memset(tga_header, 0, 18); | 1291 | memset(tga_header, 0, 18); |
1292 | tga_header[2] = 2; | 1292 | tga_header[2] = 2; |
1293 | tga_header[12] = (width & 0x00FF); | 1293 | tga_header[12] = (width & 0x00FF); |
@@ -1295,30 +1295,30 @@ void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int hei | |||
1295 | tga_header[14] = (height & 0x00FF) ; | 1295 | tga_header[14] = (height & 0x00FF) ; |
1296 | tga_header[15] =(height & 0xFF00) / 256; | 1296 | tga_header[15] =(height & 0xFF00) / 256; |
1297 | tga_header[16] = 32 ; | 1297 | tga_header[16] = 32 ; |
1298 | 1298 | ||
1299 | fwrite(&tga_header, 18, sizeof(uint8_t), file); | 1299 | fwrite(&tga_header, 18, sizeof(uint8_t), file); |
1300 | 1300 | ||
1301 | bufferPointer = buffer = malloc(width*height*4); | 1301 | bufferPointer = buffer = malloc(width*height*4); |
1302 | 1302 | ||
1303 | for (i = 0 ; i < width*height ; i++) | 1303 | for (i = 0 ; i < width*height ; i++) |
1304 | { | 1304 | { |
1305 | bufferPointer[0] = palettePointer[0] / 63.0 * 255; | 1305 | bufferPointer[0] = palettePointer[0] / 63.0 * 255; |
1306 | bufferPointer[1] = palettePointer[1] / 63.0 * 255; | 1306 | bufferPointer[1] = palettePointer[1] / 63.0 * 255; |
1307 | bufferPointer[2] = palettePointer[2] / 63.0 * 255; | 1307 | bufferPointer[2] = palettePointer[2] / 63.0 * 255; |
1308 | bufferPointer[3] = 255; | 1308 | bufferPointer[3] = 255; |
1309 | 1309 | ||
1310 | bufferPointer += 4; | 1310 | bufferPointer += 4; |
1311 | palettePointer+= 3; | 1311 | palettePointer+= 3; |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | fwrite(buffer, width*height, 4, file); | 1314 | fwrite(buffer, width*height, 4, file); |
1315 | fclose(file); | 1315 | fclose(file); |
1316 | 1316 | ||
1317 | free(buffer); | 1317 | free(buffer); |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | 1320 | ||
1321 | void WriteLastPaletteToFile(){ | 1321 | void WriteLastPaletteToFile(void){ |
1322 | WritePaletteToFile(lastPalette,"lastPalette.tga",16,16); | 1322 | WritePaletteToFile(lastPalette,"lastPalette.tga",16,16); |
1323 | } | 1323 | } |
1324 | 1324 | ||
@@ -1342,18 +1342,18 @@ int VBE_setPalette(uint8_t *palettebuffer) | |||
1342 | uint8_t *p = palettebuffer; | 1342 | uint8_t *p = palettebuffer; |
1343 | int i; | 1343 | int i; |
1344 | //static updated=0; | 1344 | //static updated=0; |
1345 | 1345 | ||
1346 | //if (updated >=1 ) | 1346 | //if (updated >=1 ) |
1347 | // return ; | 1347 | // return ; |
1348 | 1348 | ||
1349 | //WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16); | 1349 | //WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16); |
1350 | //updated++; | 1350 | //updated++; |
1351 | 1351 | ||
1352 | 1352 | ||
1353 | //CODE EXPLORATION | 1353 | //CODE EXPLORATION |
1354 | //Used only to write the last palette to file. | 1354 | //Used only to write the last palette to file. |
1355 | memcpy(lastPalette, palettebuffer, 768); | 1355 | memcpy(lastPalette, palettebuffer, 768); |
1356 | 1356 | ||
1357 | for (i = 0; i < 256; i++){ | 1357 | for (i = 0; i < 256; i++){ |
1358 | /* doesn't map perfectly */ | 1358 | /* doesn't map perfectly */ |
1359 | sdlp->b = (Uint8) (*p << 2) | (*p >> 4); | 1359 | sdlp->b = (Uint8) (*p << 2) | (*p >> 4); |
@@ -1383,10 +1383,10 @@ int VBE_getPalette(int32_t start, int32_t num, uint8_t *palettebuffer) | |||
1383 | *p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0); | 1383 | *p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0); |
1384 | *p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */ | 1384 | *p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */ |
1385 | sdlp++; | 1385 | sdlp++; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | return(1); | 1388 | return(1); |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | 1391 | ||
1392 | void _uninitengine(void) | 1392 | void _uninitengine(void) |
@@ -1464,13 +1464,13 @@ void _nextpage(void) | |||
1464 | 1464 | ||
1465 | _handle_events(); | 1465 | _handle_events(); |
1466 | 1466 | ||
1467 | 1467 | ||
1468 | SDL_UpdateRect(surface, 0, 0, 0, 0); | 1468 | SDL_UpdateRect(surface, 0, 0, 0, 0); |
1469 | 1469 | ||
1470 | //sprintf(bmpName,"%d.bmp",counter++); | 1470 | //sprintf(bmpName,"%d.bmp",counter++); |
1471 | //SDL_SaveBMP(surface,bmpName); | 1471 | //SDL_SaveBMP(surface,bmpName); |
1472 | 1472 | ||
1473 | 1473 | ||
1474 | //if (CLEAR_FRAMEBUFFER) | 1474 | //if (CLEAR_FRAMEBUFFER) |
1475 | // SDL_FillRect(surface,NULL,0); | 1475 | // SDL_FillRect(surface,NULL,0); |
1476 | 1476 | ||
@@ -1480,15 +1480,15 @@ void _nextpage(void) | |||
1480 | total_rendered_frames = 0; | 1480 | total_rendered_frames = 0; |
1481 | total_render_time = 1; | 1481 | total_render_time = 1; |
1482 | last_render_ticks = ticks; | 1482 | last_render_ticks = ticks; |
1483 | } | 1483 | } |
1484 | total_rendered_frames++; | 1484 | total_rendered_frames++; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | 1487 | ||
1488 | uint8_t readpixel(uint8_t * offset) | 1488 | uint8_t readpixel(uint8_t * offset) |
1489 | { | 1489 | { |
1490 | return *offset; | 1490 | return *offset; |
1491 | } | 1491 | } |
1492 | 1492 | ||
1493 | void drawpixel(uint8_t * location, uint8_t pixel) | 1493 | void drawpixel(uint8_t * location, uint8_t pixel) |
1494 | { | 1494 | { |
@@ -1519,7 +1519,7 @@ void fillscreen16(int32_t offset, int32_t color, int32_t blocksize) | |||
1519 | pixels = get_framebuffer(); | 1519 | pixels = get_framebuffer(); |
1520 | 1520 | ||
1521 | /* Make this function pageoffset aware - DDOI */ | 1521 | /* Make this function pageoffset aware - DDOI */ |
1522 | if (!pageoffset) { | 1522 | if (!pageoffset) { |
1523 | offset = offset << 3; | 1523 | offset = offset << 3; |
1524 | offset += 640*336; | 1524 | offset += 640*336; |
1525 | } | 1525 | } |
@@ -1584,7 +1584,7 @@ void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint | |||
1584 | 1584 | ||
1585 | dx = XEnd-XStart; | 1585 | dx = XEnd-XStart; |
1586 | dy = YEnd-YStart; | 1586 | dy = YEnd-YStart; |
1587 | 1587 | ||
1588 | //Analyse the slope | 1588 | //Analyse the slope |
1589 | if (dx >= 0) | 1589 | if (dx >= 0) |
1590 | { | 1590 | { |
@@ -1803,7 +1803,7 @@ void (*installusertimercallback(void (*callback)(void)))(void) | |||
1803 | inittimer() -- initialise timer | 1803 | inittimer() -- initialise timer |
1804 | FCS: The tickspersecond parameter is a ratio value that helps replicating | 1804 | FCS: The tickspersecond parameter is a ratio value that helps replicating |
1805 | oldschool DOS tick per seconds. | 1805 | oldschool DOS tick per seconds. |
1806 | 1806 | ||
1807 | The way the timer work is: | 1807 | The way the timer work is: |
1808 | float newSystemTickPerSecond = [0,1] | 1808 | float newSystemTickPerSecond = [0,1] |
1809 | tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ; | 1809 | tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ; |
@@ -1812,8 +1812,8 @@ void (*installusertimercallback(void (*callback)(void)))(void) | |||
1812 | int inittimer(int tickspersecond) | 1812 | int inittimer(int tickspersecond) |
1813 | { | 1813 | { |
1814 | int64_t t; | 1814 | int64_t t; |
1815 | 1815 | ||
1816 | 1816 | ||
1817 | if (timerfreq) return 0; // already installed | 1817 | if (timerfreq) return 0; // already installed |
1818 | 1818 | ||
1819 | //printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond); | 1819 | //printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond); |
@@ -1831,7 +1831,7 @@ int inittimer(int tickspersecond) | |||
1831 | timerlastsample = (int32_t)(t*timerticspersec / timerfreq); | 1831 | timerlastsample = (int32_t)(t*timerticspersec / timerfreq); |
1832 | 1832 | ||
1833 | usertimercallback = NULL; | 1833 | usertimercallback = NULL; |
1834 | 1834 | ||
1835 | return 0; | 1835 | return 0; |
1836 | } | 1836 | } |
1837 | 1837 | ||
@@ -1853,12 +1853,12 @@ void sampletimer(void) | |||
1853 | { | 1853 | { |
1854 | int64_t i; | 1854 | int64_t i; |
1855 | int32_t n; | 1855 | int32_t n; |
1856 | 1856 | ||
1857 | if (!timerfreq) return; | 1857 | if (!timerfreq) return; |
1858 | 1858 | ||
1859 | TIMER_GetPlatformTicks(&i); | 1859 | TIMER_GetPlatformTicks(&i); |
1860 | 1860 | ||
1861 | 1861 | ||
1862 | n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample; | 1862 | n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample; |
1863 | if (n>0) { | 1863 | if (n>0) { |
1864 | totalclock += n; | 1864 | totalclock += n; |
@@ -1907,10 +1907,9 @@ int TIMER_GetPlatformTicksInOneSecond(int64_t* t) | |||
1907 | *t = 1000; | 1907 | *t = 1000; |
1908 | return 1; | 1908 | return 1; |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | void TIMER_GetPlatformTicks(int64_t* t) | 1911 | void TIMER_GetPlatformTicks(int64_t* t) |
1912 | { | 1912 | { |
1913 | *t = SDL_GetTicks(); | 1913 | *t = SDL_GetTicks(); |
1914 | } | 1914 | } |
1915 | /* end of sdl_driver.c ... */ | 1915 | /* end of sdl_driver.c ... */ |
1916 | |||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/display.h b/apps/plugins/sdl/progs/duke3d/Engine/src/display.h index 791d6b9692..53091ed385 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/display.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/display.h | |||
@@ -96,7 +96,7 @@ void timerhandler(void); | |||
96 | /* resolution inits. sdl_driver.c ... */ | 96 | /* resolution inits. sdl_driver.c ... */ |
97 | int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim); | 97 | int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim); |
98 | 98 | ||
99 | uint32_t getticks(); | 99 | uint32_t getticks(void); |
100 | 100 | ||
101 | void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color); | 101 | void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color); |
102 | void setcolor16(uint8_t color); | 102 | void setcolor16(uint8_t color); |
@@ -106,5 +106,3 @@ void setcolor16(uint8_t color); | |||
106 | void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority); | 106 | void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority); |
107 | 107 | ||
108 | #endif | 108 | #endif |
109 | |||
110 | |||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/network.h b/apps/plugins/sdl/progs/duke3d/Engine/src/network.h index 2d6f6e2e2a..34f16e268a 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/network.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/network.h | |||
@@ -11,8 +11,8 @@ | |||
11 | 11 | ||
12 | #include "platform.h" | 12 | #include "platform.h" |
13 | 13 | ||
14 | void Setup_UnstableNetworking(); | 14 | void Setup_UnstableNetworking(void); |
15 | void Setup_StableNetworking(); | 15 | void Setup_StableNetworking(void); |
16 | 16 | ||
17 | void callcommit(void); | 17 | void callcommit(void); |
18 | void initcrc(void); | 18 | void initcrc(void); |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h b/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h index 90a5676f8b..3e7993d4ea 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h | |||
@@ -56,8 +56,12 @@ | |||
56 | #define IP_RECVERR SO_BROADCAST | 56 | #define IP_RECVERR SO_BROADCAST |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef stricmp | ||
59 | #define stricmp strcasecmp | 60 | #define stricmp strcasecmp |
61 | #endif | ||
62 | #ifndef strcmpi | ||
60 | #define strcmpi strcasecmp | 63 | #define strcmpi strcasecmp |
64 | #endif | ||
61 | 65 | ||
62 | #define S_IREAD S_IRUSR | 66 | #define S_IREAD S_IRUSR |
63 | 67 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c index 4c82f6eec0..cd6311801d 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c | |||
@@ -17,7 +17,7 @@ static int FB_SRC_A, FB_SRC_B, IIR_DEST_A0, IIR_DEST_A1, ACC_SRC_A0, ACC_SRC_A1, | |||
17 | ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0, | 17 | ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0, |
18 | ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0, | 18 | ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0, |
19 | MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1; | 19 | MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1; |
20 | 20 | ||
21 | //static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X, | 21 | //static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X, |
22 | // IN_COEF_L, IN_COEF_R; | 22 | // IN_COEF_L, IN_COEF_R; |
23 | 23 | ||
@@ -51,7 +51,7 @@ static inline int cnv_offset(int src) | |||
51 | 51 | ||
52 | // extern __stdcall OutputDebugStringA(char *); | 52 | // extern __stdcall OutputDebugStringA(char *); |
53 | 53 | ||
54 | static inline void check_buffer() | 54 | static inline void check_buffer(void) |
55 | { | 55 | { |
56 | int new_delay = cnv_offset(MV_ReverbDelay); | 56 | int new_delay = cnv_offset(MV_ReverbDelay); |
57 | 57 | ||
@@ -99,7 +99,7 @@ static inline long g_buffer(int iOff, long *ptr) // get | |||
99 | } | 99 | } |
100 | 100 | ||
101 | iOff=(iOff*4)+CurrAddr; | 101 | iOff=(iOff*4)+CurrAddr; |
102 | while(iOff>correctDelay-1) | 102 | while(iOff>correctDelay-1) |
103 | { | 103 | { |
104 | iOff=iOff-correctDelay; | 104 | iOff=iOff-correctDelay; |
105 | } | 105 | } |
@@ -141,11 +141,11 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se | |||
141 | } | 141 | } |
142 | 142 | ||
143 | iOff=(iOff*4)+CurrAddr+1; | 143 | iOff=(iOff*4)+CurrAddr+1; |
144 | while(iOff>correctDelay-1) | 144 | while(iOff>correctDelay-1) |
145 | { | 145 | { |
146 | iOff=iOff-correctDelay; | 146 | iOff=iOff-correctDelay; |
147 | } | 147 | } |
148 | while(iOff<0) | 148 | while(iOff<0) |
149 | { | 149 | { |
150 | iOff=correctDelay-(0-iOff); | 150 | iOff=correctDelay-(0-iOff); |
151 | } | 151 | } |
@@ -155,12 +155,12 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se | |||
155 | static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr) | 155 | static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr) |
156 | { | 156 | { |
157 | long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1; | 157 | long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1; |
158 | 158 | ||
159 | const long IIR_INPUT_A0 = (fp_mul(g_buffer(IIR_SRC_A0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS)); | 159 | const long IIR_INPUT_A0 = (fp_mul(g_buffer(IIR_SRC_A0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS)); |
160 | const long IIR_INPUT_A1 = (fp_mul(g_buffer(IIR_SRC_A1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS)); | 160 | const long IIR_INPUT_A1 = (fp_mul(g_buffer(IIR_SRC_A1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS)); |
161 | const long IIR_INPUT_B0 = (fp_mul(g_buffer(IIR_SRC_B0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS)); | 161 | const long IIR_INPUT_B0 = (fp_mul(g_buffer(IIR_SRC_B0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS)); |
162 | const long IIR_INPUT_B1 = (fp_mul(g_buffer(IIR_SRC_B1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS)); | 162 | const long IIR_INPUT_B1 = (fp_mul(g_buffer(IIR_SRC_B1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS)); |
163 | 163 | ||
164 | const long one = (1 << FRACBITS); | 164 | const long one = (1 << FRACBITS); |
165 | const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS); | 165 | const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS); |
166 | const long IIR_A1 = fp_mul(IIR_INPUT_A1, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A1, ptr), (one - IIR_ALPHA), FRACBITS); | 166 | const long IIR_A1 = fp_mul(IIR_INPUT_A1, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A1, ptr), (one - IIR_ALPHA), FRACBITS); |
@@ -171,7 +171,7 @@ static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long | |||
171 | s_buffer1(IIR_DEST_A1, IIR_A1, ptr); | 171 | s_buffer1(IIR_DEST_A1, IIR_A1, ptr); |
172 | s_buffer1(IIR_DEST_B0, IIR_B0, ptr); | 172 | s_buffer1(IIR_DEST_B0, IIR_B0, ptr); |
173 | s_buffer1(IIR_DEST_B1, IIR_B1, ptr); | 173 | s_buffer1(IIR_DEST_B1, IIR_B1, ptr); |
174 | 174 | ||
175 | ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) + | 175 | ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) + |
176 | fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) + | 176 | fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) + |
177 | fp_mul(g_buffer(ACC_SRC_C0, ptr), ACC_COEF_C, FRACBITS) + | 177 | fp_mul(g_buffer(ACC_SRC_C0, ptr), ACC_COEF_C, FRACBITS) + |
@@ -180,24 +180,24 @@ static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long | |||
180 | fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) + | 180 | fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) + |
181 | fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) + | 181 | fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) + |
182 | fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS)); | 182 | fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS)); |
183 | 183 | ||
184 | FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr); | 184 | FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr); |
185 | FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr); | 185 | FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr); |
186 | FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr); | 186 | FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr); |
187 | FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr); | 187 | FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr); |
188 | 188 | ||
189 | s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr); | 189 | s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr); |
190 | s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr); | 190 | s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr); |
191 | 191 | ||
192 | s_buffer(MIX_DEST_B0, fp_mul(FB_ALPHA , ACC0, FRACBITS) - fp_mul(FB_A0, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B0, FB_X, FRACBITS), ptr); | 192 | s_buffer(MIX_DEST_B0, fp_mul(FB_ALPHA , ACC0, FRACBITS) - fp_mul(FB_A0, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B0, FB_X, FRACBITS), ptr); |
193 | s_buffer(MIX_DEST_B1, fp_mul(FB_ALPHA , ACC1, FRACBITS) - fp_mul(FB_A1, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B1, FB_X, FRACBITS), ptr); | 193 | s_buffer(MIX_DEST_B1, fp_mul(FB_ALPHA , ACC1, FRACBITS) - fp_mul(FB_A1, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B1, FB_X, FRACBITS), ptr); |
194 | 194 | ||
195 | iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3; | 195 | iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3; |
196 | iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3; | 196 | iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3; |
197 | 197 | ||
198 | CurrAddr++; | 198 | CurrAddr++; |
199 | if(CurrAddr>delay-1) CurrAddr=0; | 199 | if(CurrAddr>delay-1) CurrAddr=0; |
200 | 200 | ||
201 | return (long)iRVBLeft; | 201 | return (long)iRVBLeft; |
202 | } | 202 | } |
203 | 203 | ||
@@ -228,7 +228,7 @@ void MV_FPReverb(int volume) | |||
228 | // OutputDebugStringA(err); | 228 | // OutputDebugStringA(err); |
229 | 229 | ||
230 | long scale = (volume << FRACBITS) / MV_MaxVolume; | 230 | long scale = (volume << FRACBITS) / MV_MaxVolume; |
231 | 231 | ||
232 | if (MV_Channels == 1) | 232 | if (MV_Channels == 1) |
233 | { | 233 | { |
234 | for (i = 0; i < count; i++) | 234 | for (i = 0; i < count; i++) |
@@ -308,7 +308,7 @@ void MV_16BitReverbFast( const char *src, char *dest, int count, int shift ) | |||
308 | 308 | ||
309 | short *pdest = (short *)dest; | 309 | short *pdest = (short *)dest; |
310 | const short *psrc = (const short *)src; | 310 | const short *psrc = (const short *)src; |
311 | 311 | ||
312 | for (i = 0; i < count; i++) { | 312 | for (i = 0; i < count; i++) { |
313 | pdest[i] = readLE16(psrc + i) >> shift; | 313 | pdest[i] = readLE16(psrc + i) >> shift; |
314 | } | 314 | } |
@@ -319,11 +319,11 @@ void MV_8BitReverbFast( const signed char *src, signed char *dest, int count, in | |||
319 | int i; | 319 | int i; |
320 | 320 | ||
321 | unsigned char sh = 0x80 - (0x80 >> shift); | 321 | unsigned char sh = 0x80 - (0x80 >> shift); |
322 | 322 | ||
323 | for (i = 0; i < count; i++) { | 323 | for (i = 0; i < count; i++) { |
324 | unsigned char a = ((unsigned char) src[i]) >> shift; | 324 | unsigned char a = ((unsigned char) src[i]) >> shift; |
325 | unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7; | 325 | unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7; |
326 | 326 | ||
327 | dest[i] = (signed char) (a + sh + c); | 327 | dest[i] = (signed char) (a + sh + c); |
328 | } | 328 | } |
329 | } | 329 | } |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/console.c b/apps/plugins/sdl/progs/duke3d/Game/src/console.c index 229bb3b564..c4a465eda3 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/console.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/console.c | |||
@@ -23,8 +23,8 @@ typedef struct console_element | |||
23 | 23 | ||
24 | // Private member functions | 24 | // Private member functions |
25 | void CONSOLE_InsertUsedCommand(const char * szUsedCommand); | 25 | void CONSOLE_InsertUsedCommand(const char * szUsedCommand); |
26 | void CONSOLE_ClearUsedCommandList(); | 26 | void CONSOLE_ClearUsedCommandList(void); |
27 | void CONSOLE_RecalculateDirtyBuffer(); | 27 | void CONSOLE_RecalculateDirtyBuffer(void); |
28 | 28 | ||
29 | // console argument tracker | 29 | // console argument tracker |
30 | int argc; | 30 | int argc; |
@@ -50,7 +50,7 @@ int nConsole_Active = 0; | |||
50 | 50 | ||
51 | void CVAR_RegisterDefaultCvarBindings(void); | 51 | void CVAR_RegisterDefaultCvarBindings(void); |
52 | // Initialize the console | 52 | // Initialize the console |
53 | void CONSOLE_Init() | 53 | void CONSOLE_Init(void) |
54 | { | 54 | { |
55 | CONSOLE_Reset(); | 55 | CONSOLE_Reset(); |
56 | 56 | ||
@@ -63,7 +63,7 @@ void CONSOLE_Init() | |||
63 | CONSOLE_Printf("Type \'HELP\' for help with console Commands."); | 63 | CONSOLE_Printf("Type \'HELP\' for help with console Commands."); |
64 | } | 64 | } |
65 | 65 | ||
66 | void CONSOLE_Reset() | 66 | void CONSOLE_Reset(void) |
67 | { | 67 | { |
68 | CONSOLEELEMENT *pElement; | 68 | CONSOLEELEMENT *pElement; |
69 | CONSOLEELEMENT *pDelElement; | 69 | CONSOLEELEMENT *pDelElement; |
@@ -144,7 +144,7 @@ void CONSOLE_HandleInput() | |||
144 | { | 144 | { |
145 | ud.pause_on = 0; | 145 | ud.pause_on = 0; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | } | 148 | } |
149 | else | 149 | else |
150 | // Bug fix: make sure the frag bar displays after console | 150 | // Bug fix: make sure the frag bar displays after console |
@@ -153,7 +153,7 @@ void CONSOLE_HandleInput() | |||
153 | { | 153 | { |
154 | if ( ud.multimode > 1 && ud.coop != 1 ) | 154 | if ( ud.multimode > 1 && ud.coop != 1 ) |
155 | { | 155 | { |
156 | displayfragbar(); | 156 | displayfragbar(); |
157 | } | 157 | } |
158 | if(numplayers<2) | 158 | if(numplayers<2) |
159 | ud.pause_on = 0; | 159 | ud.pause_on = 0; |
@@ -169,7 +169,7 @@ void CONSOLE_HandleInput() | |||
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | 171 | ||
172 | switch(KB_GetLastScanCode()) | 172 | switch(KB_GetLastScanCode()) |
173 | { | 173 | { |
174 | case sc_Space: | 174 | case sc_Space: |
175 | { | 175 | { |
@@ -221,7 +221,7 @@ void CONSOLE_HandleInput() | |||
221 | case sc_kpad_Enter: | 221 | case sc_kpad_Enter: |
222 | case sc_Enter: | 222 | case sc_Enter: |
223 | { | 223 | { |
224 | //If console_buffer[0] strlen() != 0 | 224 | //If console_buffer[0] strlen() != 0 |
225 | //1. Push the dirty_buffer unto the console_buffer | 225 | //1. Push the dirty_buffer unto the console_buffer |
226 | //2. parse the text | 226 | //2. parse the text |
227 | rb->kbd_input(dirty_buffer, sizeof(dirty_buffer)); | 227 | rb->kbd_input(dirty_buffer, sizeof(dirty_buffer)); |
@@ -278,7 +278,7 @@ void CONSOLE_HandleInput() | |||
278 | if(p_console_current_view->next != NULL) | 278 | if(p_console_current_view->next != NULL) |
279 | { | 279 | { |
280 | p_console_current_view = p_console_current_view->next; | 280 | p_console_current_view = p_console_current_view->next; |
281 | } | 281 | } |
282 | else | 282 | else |
283 | { | 283 | { |
284 | break; | 284 | break; |
@@ -351,10 +351,10 @@ void CONSOLE_HandleInput() | |||
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | KB_ClearLastScanCode(); | 354 | KB_ClearLastScanCode(); |
355 | } | 355 | } |
356 | 356 | ||
357 | void CONSOLE_Render() | 357 | void CONSOLE_Render(void) |
358 | { | 358 | { |
359 | if(g_CV_classic) | 359 | if(g_CV_classic) |
360 | { | 360 | { |
@@ -371,7 +371,7 @@ void CONSOLE_Render() | |||
371 | int iYOffset = 3; //offset for the console text | 371 | int iYOffset = 3; //offset for the console text |
372 | CONSOLEELEMENT *pElement; | 372 | CONSOLEELEMENT *pElement; |
373 | 373 | ||
374 | y1 = 0; | 374 | y1 = 0; |
375 | y2 = (ydim / 2) - ((ydim / 2)/12); | 375 | y2 = (ydim / 2) - ((ydim / 2)/12); |
376 | 376 | ||
377 | // Draw console background | 377 | // Draw console background |
@@ -418,9 +418,9 @@ void CONSOLE_Render() | |||
418 | minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16); | 418 | minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16); |
419 | 419 | ||
420 | // Draw the cursor //Change the color every second | 420 | // Draw the cursor //Change the color every second |
421 | minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16); | 421 | minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16); |
422 | } | 422 | } |
423 | else | 423 | else |
424 | if(g_CV_num_console_lines > 0) | 424 | if(g_CV_num_console_lines > 0) |
425 | { | 425 | { |
426 | int i, iYOffset = 3; //offset for the console text | 426 | int i, iYOffset = 3; //offset for the console text |
@@ -517,7 +517,7 @@ void CONSOLE_InsertUsedCommand(const char * szUsedCommand) | |||
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | void CONSOLE_ClearUsedCommandList() | 520 | void CONSOLE_ClearUsedCommandList(void) |
521 | { | 521 | { |
522 | CONSOLEELEMENT *pElement; | 522 | CONSOLEELEMENT *pElement; |
523 | CONSOLEELEMENT *pDelElement; | 523 | CONSOLEELEMENT *pDelElement; |
@@ -537,7 +537,7 @@ void CONSOLE_ClearUsedCommandList() | |||
537 | } | 537 | } |
538 | 538 | ||
539 | 539 | ||
540 | void CONSOLE_RecalculateDirtyBuffer() | 540 | void CONSOLE_RecalculateDirtyBuffer(void) |
541 | { | 541 | { |
542 | int len; | 542 | int len; |
543 | int l; | 543 | int l; |
@@ -605,7 +605,7 @@ void CONSOLE_Printf(const char *newmsg, ...) | |||
605 | } | 605 | } |
606 | 606 | ||
607 | // Get the current number of args for this keyword | 607 | // Get the current number of args for this keyword |
608 | int CONSOLE_GetArgc() | 608 | int CONSOLE_GetArgc(void) |
609 | { | 609 | { |
610 | return argc; | 610 | return argc; |
611 | } | 611 | } |
@@ -617,9 +617,9 @@ char * CONSOLE_GetArgv(unsigned int var) | |||
617 | } | 617 | } |
618 | 618 | ||
619 | // Is our console showing? | 619 | // Is our console showing? |
620 | int CONSOLE_IsActive() | 620 | int CONSOLE_IsActive(void) |
621 | { | 621 | { |
622 | 622 | ||
623 | return nConsole_Active; | 623 | return nConsole_Active; |
624 | } | 624 | } |
625 | 625 | ||
@@ -627,4 +627,4 @@ int CONSOLE_IsActive() | |||
627 | void CONSOLE_SetActive(int i) | 627 | void CONSOLE_SetActive(int i) |
628 | { | 628 | { |
629 | nConsole_Active = (i == 0) ? 0 : 1; | 629 | nConsole_Active = (i == 0) ? 0 : 1; |
630 | } \ No newline at end of file | 630 | } |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/console.h b/apps/plugins/sdl/progs/duke3d/Game/src/console.h index 58c0e34b25..955c41d885 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/console.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/console.h | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | // Public member functions | 5 | // Public member functions |
6 | void CONSOLE_Init(); | 6 | void CONSOLE_Init(void); |
7 | void CONSOLE_Reset(); | 7 | void CONSOLE_Reset(void); |
8 | void CONSOLE_Term(); | 8 | void CONSOLE_Term(void); |
9 | void CONSOLE_ParseStartupScript(); | 9 | void CONSOLE_ParseStartupScript(void); |
10 | void CONSOLE_HandleInput(); | 10 | void CONSOLE_HandleInput(void); |
11 | void CONSOLE_Render(); | 11 | void CONSOLE_Render(void); |
12 | void CONSOLE_ParseCommand(char * command); | 12 | void CONSOLE_ParseCommand(char * command); |
13 | void CONSOLE_Printf(const char *newmsg, ...); | 13 | void CONSOLE_Printf(const char *newmsg, ...); |
14 | int CONSOLE_GetArgc(); | 14 | int CONSOLE_GetArgc(void); |
15 | char * CONSOLE_GetArgv(unsigned int var); | 15 | char * CONSOLE_GetArgv(unsigned int var); |
16 | int CONSOLE_IsActive(); | 16 | int CONSOLE_IsActive(void); |
17 | void CONSOLE_SetActive(int i); | 17 | void CONSOLE_SetActive(int i); |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h index 1e6319c807..55102d791c 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h | |||
@@ -3,8 +3,8 @@ | |||
3 | 3 | ||
4 | #include <inttypes.h> | 4 | #include <inttypes.h> |
5 | 5 | ||
6 | void CVARDEFS_Init(); | 6 | void CVARDEFS_Init(void); |
7 | void CVARDEFS_Render(); | 7 | void CVARDEFS_Render(void); |
8 | // | 8 | // |
9 | // Function declarations | 9 | // Function declarations |
10 | // | 10 | // |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h index 206e16a9c4..91077c8656 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h | |||
@@ -18,8 +18,8 @@ typedef struct t_cvar_binding | |||
18 | 18 | ||
19 | 19 | ||
20 | void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function); | 20 | void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function); |
21 | int CVAR_GetNumCvarBindings(); | 21 | int CVAR_GetNumCvarBindings(void); |
22 | cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding); | 22 | cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding); |
23 | void CVAR_Render(); | 23 | void CVAR_Render(void); |
24 | 24 | ||
25 | #endif \ No newline at end of file | 25 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.h b/apps/plugins/sdl/progs/duke3d/Game/src/global.h index a9a00002f0..e8aaca0d3a 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/global.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.h | |||
@@ -31,6 +31,7 @@ void Shutdown(void); | |||
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #ifdef ROCKBOX | 33 | #ifdef ROCKBOX |
34 | #undef BYTE_ORDER | ||
34 | #ifdef ROCKBOX_LITTLE_ENDIAN | 35 | #ifdef ROCKBOX_LITTLE_ENDIAN |
35 | #define BYTE_ORDER LITTLE_ENDIAN | 36 | #define BYTE_ORDER LITTLE_ENDIAN |
36 | #else | 37 | #else |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/types.h b/apps/plugins/sdl/progs/duke3d/Game/src/types.h index 93d6f80c86..b5e98b04e0 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/types.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/types.h | |||
@@ -67,8 +67,12 @@ typedef float64 appfloat; | |||
67 | // | 67 | // |
68 | //*************************************************************************** | 68 | //*************************************************************************** |
69 | 69 | ||
70 | #ifndef true | ||
70 | #define true ( 1 == 1 ) | 71 | #define true ( 1 == 1 ) |
72 | #endif | ||
73 | #ifndef false | ||
71 | #define false ( ! true ) | 74 | #define false ( ! true ) |
75 | #endif | ||
72 | 76 | ||
73 | //*************************************************************************** | 77 | //*************************************************************************** |
74 | // | 78 | // |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h index 6519331b77..5085e64fae 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h | |||
@@ -11,7 +11,7 @@ of the License, or (at your option) any later version. | |||
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15 | 15 | ||
16 | See the GNU General Public License for more details. | 16 | See the GNU General Public License for more details. |
17 | 17 | ||
@@ -60,7 +60,7 @@ int16 IntelShort (int16 l); | |||
60 | int32_t Motoint32_t (int32_t l); | 60 | int32_t Motoint32_t (int32_t l); |
61 | int32_t Intelint32_t (int32_t l); | 61 | int32_t Intelint32_t (int32_t l); |
62 | 62 | ||
63 | void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)()); | 63 | //void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)()); |
64 | 64 | ||
65 | #ifdef __cplusplus | 65 | #ifdef __cplusplus |
66 | }; | 66 | }; |
diff --git a/apps/plugins/sdl/progs/quake/cl_input.c b/apps/plugins/sdl/progs/quake/cl_input.c index 5327b7363e..613ca431b9 100644 --- a/apps/plugins/sdl/progs/quake/cl_input.c +++ b/apps/plugins/sdl/progs/quake/cl_input.c | |||
@@ -172,35 +172,36 @@ float CL_KeyState (kbutton_t *key) | |||
172 | { | 172 | { |
173 | float val; | 173 | float val; |
174 | qboolean impulsedown, impulseup, down; | 174 | qboolean impulsedown, impulseup, down; |
175 | 175 | ||
176 | impulsedown = key->state & 2; | 176 | impulsedown = key->state & 2; |
177 | impulseup = key->state & 4; | 177 | impulseup = key->state & 4; |
178 | down = key->state & 1; | 178 | down = key->state & 1; |
179 | val = 0; | 179 | val = 0; |
180 | 180 | ||
181 | if (impulsedown && !impulseup) | 181 | if (impulsedown && !impulseup) { |
182 | if (down) | 182 | if (down) |
183 | val = 0.5; // pressed and held this frame | 183 | val = 0.5; // pressed and held this frame |
184 | else | 184 | else |
185 | val = 0; // I_Error (); | 185 | val = 0; // I_Error (); |
186 | if (impulseup && !impulsedown) | 186 | } else if (impulseup && !impulsedown) { |
187 | if (down) | 187 | if (down) |
188 | val = 0; // I_Error (); | 188 | val = 0; // I_Error (); |
189 | else | 189 | else |
190 | val = 0; // released this frame | 190 | val = 0; // released this frame |
191 | if (!impulsedown && !impulseup) | 191 | } else if (!impulsedown && !impulseup) { |
192 | if (down) | 192 | if (down) |
193 | val = 1.0; // held the entire frame | 193 | val = 1.0; // held the entire frame |
194 | else | 194 | else |
195 | val = 0; // up the entire frame | 195 | val = 0; // up the entire frame |
196 | if (impulsedown && impulseup) | 196 | } else if (impulsedown && impulseup) { |
197 | if (down) | 197 | if (down) |
198 | val = 0.75; // released and re-pressed this frame | 198 | val = 0.75; // released and re-pressed this frame |
199 | else | 199 | else |
200 | val = 0.25; // pressed and released this frame | 200 | val = 0.25; // pressed and released this frame |
201 | } | ||
201 | 202 | ||
202 | key->state &= 1; // clear impulses | 203 | key->state &= 1; // clear impulses |
203 | 204 | ||
204 | return val; | 205 | return val; |
205 | } | 206 | } |
206 | 207 | ||
diff --git a/apps/plugins/sdl/progs/quake/d_iface.h b/apps/plugins/sdl/progs/quake/d_iface.h index 8dc5ce94bc..1dbc7f3580 100644 --- a/apps/plugins/sdl/progs/quake/d_iface.h +++ b/apps/plugins/sdl/progs/quake/d_iface.h | |||
@@ -182,6 +182,9 @@ extern byte *r_skysource; | |||
182 | #define DR_TRANSPARENT 1 | 182 | #define DR_TRANSPARENT 1 |
183 | 183 | ||
184 | // !!! must be kept the same as in quakeasm.h !!! | 184 | // !!! must be kept the same as in quakeasm.h !!! |
185 | #ifdef TRANSPARENT_COLOR | ||
186 | #undef TRANSPARENT_COLOR | ||
187 | #endif | ||
185 | #define TRANSPARENT_COLOR 0xFF | 188 | #define TRANSPARENT_COLOR 0xFF |
186 | 189 | ||
187 | extern void *acolormap; // FIXME: should go away | 190 | extern void *acolormap; // FIXME: should go away |
diff --git a/apps/plugins/sdl/progs/quake/mathlib.h b/apps/plugins/sdl/progs/quake/mathlib.h index 5f7ae430f1..4a91274589 100644 --- a/apps/plugins/sdl/progs/quake/mathlib.h +++ b/apps/plugins/sdl/progs/quake/mathlib.h | |||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version. | |||
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, | 9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12 | 12 | ||
13 | See the GNU General Public License for more details. | 13 | See the GNU General Public License for more details. |
14 | 14 | ||
@@ -69,11 +69,13 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); | |||
69 | //void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt | 69 | //void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt |
70 | //float VectorNormalize (vec3_t v); // returns vector length | 70 | //float VectorNormalize (vec3_t v); // returns vector length |
71 | 71 | ||
72 | #pragma GCC diagnostic push | ||
73 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" | ||
72 | static inline float InvSqrt( float number ) { | 74 | static inline float InvSqrt( float number ) { |
73 | long i; | 75 | long i; |
74 | float x2, y; | 76 | float x2, y; |
75 | const float threehalfs = 1.5F; | 77 | const float threehalfs = 1.5F; |
76 | 78 | ||
77 | x2 = number * 0.5F; | 79 | x2 = number * 0.5F; |
78 | y = number; | 80 | y = number; |
79 | i = * ( long * ) &y; // evil floating point bit level hacking | 81 | i = * ( long * ) &y; // evil floating point bit level hacking |
@@ -84,13 +86,14 @@ static inline float InvSqrt( float number ) { | |||
84 | 86 | ||
85 | return y; | 87 | return y; |
86 | } | 88 | } |
89 | #pragma GCC diagnostic pop | ||
87 | 90 | ||
88 | static inline void VectorNormalizeNoRet (vec3_t v) | 91 | static inline void VectorNormalizeNoRet (vec3_t v) |
89 | { | 92 | { |
90 | float length, ilength; | 93 | float length, ilength; |
91 | 94 | ||
92 | ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); | 95 | ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); |
93 | 96 | ||
94 | v[0] *= ilength; | 97 | v[0] *= ilength; |
95 | v[1] *= ilength; | 98 | v[1] *= ilength; |
96 | v[2] *= ilength; | 99 | v[2] *= ilength; |
@@ -110,7 +113,7 @@ static inline float VectorNormalize (vec3_t v) | |||
110 | v[1] *= ilength; | 113 | v[1] *= ilength; |
111 | v[2] *= ilength; | 114 | v[2] *= ilength; |
112 | } | 115 | } |
113 | 116 | ||
114 | return length; | 117 | return length; |
115 | 118 | ||
116 | } | 119 | } |
diff --git a/apps/plugins/sdl/progs/quake/net.h b/apps/plugins/sdl/progs/quake/net.h index 813472c0c6..6b6be3d36e 100644 --- a/apps/plugins/sdl/progs/quake/net.h +++ b/apps/plugins/sdl/progs/quake/net.h | |||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version. | |||
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, | 9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12 | 12 | ||
13 | See the GNU General Public License for more details. | 13 | See the GNU General Public License for more details. |
14 | 14 | ||
@@ -126,7 +126,7 @@ typedef struct qsocket_s | |||
126 | qboolean disconnected; | 126 | qboolean disconnected; |
127 | qboolean canSend; | 127 | qboolean canSend; |
128 | qboolean sendNext; | 128 | qboolean sendNext; |
129 | 129 | ||
130 | int driver; | 130 | int driver; |
131 | int landriver; | 131 | int landriver; |
132 | int socket; | 132 | int socket; |
@@ -314,7 +314,7 @@ typedef struct _PollProcedure | |||
314 | { | 314 | { |
315 | struct _PollProcedure *next; | 315 | struct _PollProcedure *next; |
316 | double nextTime; | 316 | double nextTime; |
317 | void (*procedure)(); | 317 | void (*procedure)(void *); |
318 | void *arg; | 318 | void *arg; |
319 | } PollProcedure; | 319 | } PollProcedure; |
320 | 320 | ||
diff --git a/apps/plugins/sdl/progs/quake/server.h b/apps/plugins/sdl/progs/quake/server.h index 5fe33deca0..c0d879ec7d 100644 --- a/apps/plugins/sdl/progs/quake/server.h +++ b/apps/plugins/sdl/progs/quake/server.h | |||
@@ -250,7 +250,7 @@ void SV_MoveToGoal (void); | |||
250 | 250 | ||
251 | void SV_CheckForNewClients (void); | 251 | void SV_CheckForNewClients (void); |
252 | void SV_RunClients (void); | 252 | void SV_RunClients (void); |
253 | void SV_SaveSpawnparms (); | 253 | void SV_SaveSpawnparms (void); |
254 | #ifdef QUAKE2 | 254 | #ifdef QUAKE2 |
255 | void SV_SpawnServer (char *server, char *startspot); | 255 | void SV_SpawnServer (char *server, char *startspot); |
256 | #else | 256 | #else |
diff --git a/apps/plugins/sdl/progs/wolf3d/id_in.h b/apps/plugins/sdl/progs/wolf3d/id_in.h index 90e0c05109..31c79ef61b 100644 --- a/apps/plugins/sdl/progs/wolf3d/id_in.h +++ b/apps/plugins/sdl/progs/wolf3d/id_in.h | |||
@@ -165,12 +165,12 @@ extern ScanCode IN_WaitForKey(void); | |||
165 | extern word IN_GetJoyButtonsDB(word joy); | 165 | extern word IN_GetJoyButtonsDB(word joy); |
166 | extern const char *IN_GetScanName(ScanCode); | 166 | extern const char *IN_GetScanName(ScanCode); |
167 | 167 | ||
168 | void IN_WaitAndProcessEvents(); | 168 | void IN_WaitAndProcessEvents(void); |
169 | void IN_ProcessEvents(); | 169 | void IN_ProcessEvents(void); |
170 | 170 | ||
171 | int IN_MouseButtons (void); | 171 | int IN_MouseButtons (void); |
172 | 172 | ||
173 | boolean IN_JoyPresent(); | 173 | boolean IN_JoyPresent(void); |
174 | void IN_SetJoyCurrent(int joyIndex); | 174 | void IN_SetJoyCurrent(int joyIndex); |
175 | int IN_JoyButtons (void); | 175 | int IN_JoyButtons (void); |
176 | void IN_GetJoyDelta(int *dx,int *dy); | 176 | void IN_GetJoyDelta(int *dx,int *dy); |
@@ -178,6 +178,6 @@ void IN_GetJoyFineDelta(int *dx, int *dy); | |||
178 | 178 | ||
179 | void IN_StartAck(void); | 179 | void IN_StartAck(void); |
180 | boolean IN_CheckAck (void); | 180 | boolean IN_CheckAck (void); |
181 | bool IN_IsInputGrabbed(); | 181 | bool IN_IsInputGrabbed(void); |
182 | void IN_CenterMouse(); | 182 | void IN_CenterMouse(void); |
183 | #endif | 183 | #endif |
diff --git a/apps/plugins/sdl/progs/wolf3d/id_pm.h b/apps/plugins/sdl/progs/wolf3d/id_pm.h index bbedb78c78..f8c4ae26b0 100644 --- a/apps/plugins/sdl/progs/wolf3d/id_pm.h +++ b/apps/plugins/sdl/progs/wolf3d/id_pm.h | |||
@@ -17,40 +17,40 @@ extern bool PMSoundInfoPagePadded; | |||
17 | // The last pointer points one byte after the last page. | 17 | // The last pointer points one byte after the last page. |
18 | extern uint8_t **PMPages; | 18 | extern uint8_t **PMPages; |
19 | 19 | ||
20 | void PM_Startup(); | 20 | void PM_Startup(void); |
21 | void PM_Shutdown(); | 21 | void PM_Shutdown(void); |
22 | 22 | ||
23 | static uint32_t PM_GetPageSize(int page) | 23 | static inline uint32_t PM_GetPageSize(int page) |
24 | { | 24 | { |
25 | if(page < 0 || page >= ChunksInFile) | 25 | if(page < 0 || page >= ChunksInFile) |
26 | Quit("PM_GetPageSize: Tried to access illegal page: %i", page); | 26 | Quit("PM_GetPageSize: Tried to access illegal page: %i", page); |
27 | return (uint32_t) (PMPages[page + 1] - PMPages[page]); | 27 | return (uint32_t) (PMPages[page + 1] - PMPages[page]); |
28 | } | 28 | } |
29 | 29 | ||
30 | static uint8_t *PM_GetPage(int page) | 30 | static inline uint8_t *PM_GetPage(int page) |
31 | { | 31 | { |
32 | if(page < 0 || page >= ChunksInFile) | 32 | if(page < 0 || page >= ChunksInFile) |
33 | Quit("PM_GetPage: Tried to access illegal page: %i", page); | 33 | Quit("PM_GetPage: Tried to access illegal page: %i", page); |
34 | return PMPages[page]; | 34 | return PMPages[page]; |
35 | } | 35 | } |
36 | 36 | ||
37 | static uint8_t *PM_GetEnd() | 37 | static inline uint8_t *PM_GetEnd(void) |
38 | { | 38 | { |
39 | return PMPages[ChunksInFile]; | 39 | return PMPages[ChunksInFile]; |
40 | } | 40 | } |
41 | 41 | ||
42 | static byte *PM_GetTexture(int wallpic) | 42 | static inline byte *PM_GetTexture(int wallpic) |
43 | { | 43 | { |
44 | return PM_GetPage(wallpic); | 44 | return PM_GetPage(wallpic); |
45 | } | 45 | } |
46 | 46 | ||
47 | static uint16_t *PM_GetSprite(int shapenum) | 47 | static inline uint16_t *PM_GetSprite(int shapenum) |
48 | { | 48 | { |
49 | // correct alignment is enforced by PM_Startup() | 49 | // correct alignment is enforced by PM_Startup() |
50 | return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum); | 50 | return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum); |
51 | } | 51 | } |
52 | 52 | ||
53 | static byte *PM_GetSound(int soundpagenum) | 53 | static inline byte *PM_GetSound(int soundpagenum) |
54 | { | 54 | { |
55 | return PM_GetPage(PMSoundStart + soundpagenum); | 55 | return PM_GetPage(PMSoundStart + soundpagenum); |
56 | } | 56 | } |
diff --git a/apps/plugins/sdl/progs/wolf3d/id_us.h b/apps/plugins/sdl/progs/wolf3d/id_us.h index 84958631f7..6a1f7ea3ff 100644 --- a/apps/plugins/sdl/progs/wolf3d/id_us.h +++ b/apps/plugins/sdl/progs/wolf3d/id_us.h | |||
@@ -96,6 +96,6 @@ void USL_PrintInCenter(const char *s,Rect r); | |||
96 | char *USL_GiveSaveName(word game); | 96 | char *USL_GiveSaveName(word game); |
97 | 97 | ||
98 | void US_InitRndT(int randomize); | 98 | void US_InitRndT(int randomize); |
99 | int US_RndT(); | 99 | int US_RndT(void); |
100 | 100 | ||
101 | #endif | 101 | #endif |
diff --git a/apps/plugins/sdl/progs/wolf3d/id_vh.h b/apps/plugins/sdl/progs/wolf3d/id_vh.h index 814e28d49c..fc9f738fe9 100644 --- a/apps/plugins/sdl/progs/wolf3d/id_vh.h +++ b/apps/plugins/sdl/progs/wolf3d/id_vh.h | |||
@@ -64,7 +64,7 @@ void VWB_Vlin (int y1, int y2, int x, int color); | |||
64 | #define VWB_HlinScaledCoord VW_Hlin | 64 | #define VWB_HlinScaledCoord VW_Hlin |
65 | #define VWB_VlinScaledCoord VW_Vlin | 65 | #define VWB_VlinScaledCoord VW_Vlin |
66 | 66 | ||
67 | void VH_UpdateScreen(); | 67 | void VH_UpdateScreen(void); |
68 | #define VW_UpdateScreen VH_UpdateScreen | 68 | #define VW_UpdateScreen VH_UpdateScreen |
69 | 69 | ||
70 | // | 70 | // |
@@ -91,7 +91,7 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum); | |||
91 | void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum); | 91 | void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum); |
92 | void LoadLatchMem (void); | 92 | void LoadLatchMem (void); |
93 | 93 | ||
94 | void VH_Startup(); | 94 | void VH_Startup(void); |
95 | boolean FizzleFade (SDL_Surface *source, int x1, int y1, | 95 | boolean FizzleFade (SDL_Surface *source, int x1, int y1, |
96 | unsigned width, unsigned height, unsigned frames, boolean abortable); | 96 | unsigned width, unsigned height, unsigned frames, boolean abortable); |
97 | 97 | ||
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_def.h b/apps/plugins/sdl/progs/wolf3d/wl_def.h index af74a5315c..63cd22f4e8 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_def.h +++ b/apps/plugins/sdl/progs/wolf3d/wl_def.h | |||
@@ -961,7 +961,7 @@ void DrawPlayBorder (void); | |||
961 | void DrawStatusBorder (byte color); | 961 | void DrawStatusBorder (byte color); |
962 | void DrawPlayScreen (void); | 962 | void DrawPlayScreen (void); |
963 | void DrawPlayBorderSides (void); | 963 | void DrawPlayBorderSides (void); |
964 | void ShowActStatus(); | 964 | void ShowActStatus(void); |
965 | 965 | ||
966 | void PlayDemo (int demonumber); | 966 | void PlayDemo (int demonumber); |
967 | void RecordDemo (void); | 967 | void RecordDemo (void); |
@@ -1372,7 +1372,7 @@ void GP2X_ButtonUp(int button); | |||
1372 | ============================================================================= | 1372 | ============================================================================= |
1373 | */ | 1373 | */ |
1374 | 1374 | ||
1375 | static fixed FixedMul(fixed a, fixed b) | 1375 | static inline fixed FixedMul(fixed a, fixed b) |
1376 | { | 1376 | { |
1377 | return (fixed)(((int64_t)a * b + 0x8000) >> 16); | 1377 | return (fixed)(((int64_t)a * b + 0x8000) >> 16); |
1378 | } | 1378 | } |
@@ -1394,13 +1394,13 @@ static fixed FixedMul(fixed a, fixed b) | |||
1394 | 1394 | ||
1395 | #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) | 1395 | #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) |
1396 | 1396 | ||
1397 | static char* itoa(int value, char* string, int radix) | 1397 | static inline char* itoa(int value, char* string, int radix) |
1398 | { | 1398 | { |
1399 | sprintf(string, "%d", value); | 1399 | sprintf(string, "%d", value); |
1400 | return string; | 1400 | return string; |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | static char* ltoa(long value, char* string, int radix) | 1403 | static inline char* ltoa(long value, char* string, int radix) |
1404 | { | 1404 | { |
1405 | sprintf(string, "%ld", value); | 1405 | sprintf(string, "%ld", value); |
1406 | return string; | 1406 | return string; |
@@ -1409,14 +1409,14 @@ static char* ltoa(long value, char* string, int radix) | |||
1409 | #define lengthof(x) (sizeof(x) / sizeof(*(x))) | 1409 | #define lengthof(x) (sizeof(x) / sizeof(*(x))) |
1410 | #define endof(x) ((x) + lengthof(x)) | 1410 | #define endof(x) ((x) + lengthof(x)) |
1411 | 1411 | ||
1412 | static word READWORD(byte **ptr) | 1412 | static inline word READWORD(byte **ptr) |
1413 | { | 1413 | { |
1414 | word val = (*ptr)[0] | (*ptr)[1] << 8; | 1414 | word val = (*ptr)[0] | (*ptr)[1] << 8; |
1415 | *ptr += 2; | 1415 | *ptr += 2; |
1416 | return val; | 1416 | return val; |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | static longword READLONGWORD(byte **ptr) | 1419 | static inline longword READLONGWORD(byte **ptr) |
1420 | { | 1420 | { |
1421 | longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24; | 1421 | longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24; |
1422 | *ptr += 4; | 1422 | *ptr += 4; |
@@ -1454,7 +1454,7 @@ static longword READLONGWORD(byte **ptr) | |||
1454 | *************************************************************/ | 1454 | *************************************************************/ |
1455 | 1455 | ||
1456 | // The feature flags are stored as a wall in the upper right corner of each level | 1456 | // The feature flags are stored as a wall in the upper right corner of each level |
1457 | static word GetFeatureFlags() | 1457 | static inline word GetFeatureFlags() |
1458 | { | 1458 | { |
1459 | return ffDataTopRight; | 1459 | return ffDataTopRight; |
1460 | } | 1460 | } |
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_draw.c b/apps/plugins/sdl/progs/wolf3d/wl_draw.c index 625e93dc0a..09db5af05d 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_draw.c +++ b/apps/plugins/sdl/progs/wolf3d/wl_draw.c | |||
@@ -251,7 +251,7 @@ boolean TransformTile (int tx, int ty, short *dispx, short *dispheight) | |||
251 | ==================== | 251 | ==================== |
252 | */ | 252 | */ |
253 | 253 | ||
254 | int CalcHeight() | 254 | int CalcHeight(void) |
255 | { | 255 | { |
256 | fixed z = FixedMul(xintercept - viewx, viewcos) | 256 | fixed z = FixedMul(xintercept - viewx, viewcos) |
257 | - FixedMul(yintercept - viewy, viewsin); | 257 | - FixedMul(yintercept - viewy, viewsin); |
@@ -275,7 +275,7 @@ byte *postsource; | |||
275 | int postx; | 275 | int postx; |
276 | int postwidth; | 276 | int postwidth; |
277 | 277 | ||
278 | void ScalePost() | 278 | void ScalePost(void) |
279 | { | 279 | { |
280 | int ywcount, yoffs, yw, yd, yendoffs; | 280 | int ywcount, yoffs, yw, yd, yendoffs; |
281 | byte col; | 281 | byte col; |
@@ -1091,7 +1091,7 @@ void CalcTics (void) | |||
1091 | 1091 | ||
1092 | //========================================================================== | 1092 | //========================================================================== |
1093 | 1093 | ||
1094 | void AsmRefresh() | 1094 | void AsmRefresh(void) |
1095 | { | 1095 | { |
1096 | int32_t xstep,ystep; | 1096 | int32_t xstep,ystep; |
1097 | longword xpartial,ypartial; | 1097 | longword xpartial,ypartial; |
@@ -1517,7 +1517,7 @@ void WallRefresh (void) | |||
1517 | ScalePost (); // no more optimization on last post | 1517 | ScalePost (); // no more optimization on last post |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | void CalcViewVariables() | 1520 | void CalcViewVariables(void) |
1521 | { | 1521 | { |
1522 | viewangle = player->angle; | 1522 | viewangle = player->angle; |
1523 | midangle = viewangle*(FINEANGLES/ANGLES); | 1523 | midangle = viewangle*(FINEANGLES/ANGLES); |
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_menu.h b/apps/plugins/sdl/progs/wolf3d/wl_menu.h index c56fd7f576..2d5a5fe4c3 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_menu.h +++ b/apps/plugins/sdl/progs/wolf3d/wl_menu.h | |||
@@ -118,10 +118,10 @@ extern CP_iteminfo MainItems; | |||
118 | 118 | ||
119 | void US_ControlPanel(ScanCode); | 119 | void US_ControlPanel(ScanCode); |
120 | 120 | ||
121 | void EnableEndGameMenuItem(); | 121 | void EnableEndGameMenuItem(void); |
122 | 122 | ||
123 | void SetupControlPanel(void); | 123 | void SetupControlPanel(void); |
124 | void SetupSaveGames(); | 124 | void SetupSaveGames(void); |
125 | void CleanupControlPanel(void); | 125 | void CleanupControlPanel(void); |
126 | 126 | ||
127 | void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); | 127 | void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); |
diff --git a/apps/plugins/sdl/sdl.make b/apps/plugins/sdl/sdl.make index 9514d7ad93..4e7e518fc1 100644 --- a/apps/plugins/sdl/sdl.make +++ b/apps/plugins/sdl/sdl.make | |||
@@ -32,6 +32,13 @@ SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \ | |||
32 | -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \ | 32 | -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \ |
33 | -D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings | 33 | -D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings |
34 | 34 | ||
35 | # WIP SDLFLAGS for warning deletions | ||
36 | #SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \ | ||
37 | #-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wno-sign-compare \ | ||
38 | #-Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unknown-pragmas \ | ||
39 | #-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \ | ||
40 | #-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF | ||
41 | |||
35 | # use FPU on ARMv6 | 42 | # use FPU on ARMv6 |
36 | ifeq ($(ARCH_VERSION),6) | 43 | ifeq ($(ARCH_VERSION),6) |
37 | SDLFLAGS += -mfloat-abi=softfp | 44 | SDLFLAGS += -mfloat-abi=softfp |
diff --git a/apps/plugins/sdl/src/audio/SDL_wave.c b/apps/plugins/sdl/src/audio/SDL_wave.c index b4ad6c7876..21a7260be3 100644 --- a/apps/plugins/sdl/src/audio/SDL_wave.c +++ b/apps/plugins/sdl/src/audio/SDL_wave.c | |||
@@ -125,7 +125,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) | |||
125 | encoded_len = *audio_len; | 125 | encoded_len = *audio_len; |
126 | encoded = *audio_buf; | 126 | encoded = *audio_buf; |
127 | freeable = *audio_buf; | 127 | freeable = *audio_buf; |
128 | *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * | 128 | *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * |
129 | MS_ADPCM_state.wSamplesPerBlock* | 129 | MS_ADPCM_state.wSamplesPerBlock* |
130 | MS_ADPCM_state.wavefmt.channels*sizeof(Sint16); | 130 | MS_ADPCM_state.wavefmt.channels*sizeof(Sint16); |
131 | *audio_buf = (Uint8 *)SDL_malloc(*audio_len); | 131 | *audio_buf = (Uint8 *)SDL_malloc(*audio_len); |
@@ -340,7 +340,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) | |||
340 | encoded_len = *audio_len; | 340 | encoded_len = *audio_len; |
341 | encoded = *audio_buf; | 341 | encoded = *audio_buf; |
342 | freeable = *audio_buf; | 342 | freeable = *audio_buf; |
343 | *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * | 343 | *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * |
344 | IMA_ADPCM_state.wSamplesPerBlock* | 344 | IMA_ADPCM_state.wSamplesPerBlock* |
345 | IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16); | 345 | IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16); |
346 | *audio_buf = (Uint8 *)SDL_malloc(*audio_len); | 346 | *audio_buf = (Uint8 *)SDL_malloc(*audio_len); |
@@ -413,7 +413,9 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, | |||
413 | was_error = 1; | 413 | was_error = 1; |
414 | goto done; | 414 | goto done; |
415 | } | 415 | } |
416 | 416 | chunk.data = NULL; | |
417 | chunk.length = 0; | ||
418 | |||
417 | /* Check the magic header */ | 419 | /* Check the magic header */ |
418 | RIFFchunk = SDL_ReadLE32(src); | 420 | RIFFchunk = SDL_ReadLE32(src); |
419 | wavelen = SDL_ReadLE32(src); | 421 | wavelen = SDL_ReadLE32(src); |
@@ -432,7 +434,6 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, | |||
432 | headerDiff += sizeof(Uint32); /* for WAVE */ | 434 | headerDiff += sizeof(Uint32); /* for WAVE */ |
433 | 435 | ||
434 | /* Read the audio data format chunk */ | 436 | /* Read the audio data format chunk */ |
435 | chunk.data = NULL; | ||
436 | do { | 437 | do { |
437 | if ( chunk.data != NULL ) { | 438 | if ( chunk.data != NULL ) { |
438 | SDL_free(chunk.data); | 439 | SDL_free(chunk.data); |
diff --git a/apps/plugins/sdl/src/video/SDL_gamma.c b/apps/plugins/sdl/src/video/SDL_gamma.c index 4fd037019f..c820620b5c 100644 --- a/apps/plugins/sdl/src/video/SDL_gamma.c +++ b/apps/plugins/sdl/src/video/SDL_gamma.c | |||
@@ -29,10 +29,10 @@ | |||
29 | /* Math routines from uClibc: http://www.uclibc.org */ | 29 | /* Math routines from uClibc: http://www.uclibc.org */ |
30 | #include "math_private.h" | 30 | #include "math_private.h" |
31 | #include "e_sqrt.h" | 31 | #include "e_sqrt.h" |
32 | #include "e_pow.h" | 32 | //#include "e_pow.h" |
33 | #include "e_log.h" | 33 | //#include "e_log.h" |
34 | #define pow(x, y) __ieee754_pow(x, y) | 34 | //#define pow(x, y) __ieee754_pow(x, y) |
35 | #define log(x) __ieee754_log(x) | 35 | //#define log(x) __ieee754_log(x) |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include "SDL_sysvideo.h" | 38 | #include "SDL_sysvideo.h" |
@@ -94,7 +94,7 @@ int SDL_SetGamma(float red, float green, float blue) | |||
94 | { | 94 | { |
95 | int succeeded; | 95 | int succeeded; |
96 | SDL_VideoDevice *video = current_video; | 96 | SDL_VideoDevice *video = current_video; |
97 | SDL_VideoDevice *this = current_video; | 97 | SDL_VideoDevice *this = current_video; |
98 | 98 | ||
99 | succeeded = -1; | 99 | succeeded = -1; |
100 | /* Prefer using SetGammaRamp(), as it's more flexible */ | 100 | /* Prefer using SetGammaRamp(), as it's more flexible */ |
@@ -120,7 +120,7 @@ int SDL_GetGamma(float *red, float *green, float *blue) | |||
120 | { | 120 | { |
121 | int succeeded; | 121 | int succeeded; |
122 | SDL_VideoDevice *video = current_video; | 122 | SDL_VideoDevice *video = current_video; |
123 | SDL_VideoDevice *this = current_video; | 123 | SDL_VideoDevice *this = current_video; |
124 | 124 | ||
125 | succeeded = -1; | 125 | succeeded = -1; |
126 | /* Prefer using GetGammaRamp(), as it's more flexible */ | 126 | /* Prefer using GetGammaRamp(), as it's more flexible */ |
@@ -145,7 +145,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue) | |||
145 | { | 145 | { |
146 | int succeeded; | 146 | int succeeded; |
147 | SDL_VideoDevice *video = current_video; | 147 | SDL_VideoDevice *video = current_video; |
148 | SDL_VideoDevice *this = current_video; | 148 | SDL_VideoDevice *this = current_video; |
149 | SDL_Surface *screen = SDL_PublicSurface; | 149 | SDL_Surface *screen = SDL_PublicSurface; |
150 | 150 | ||
151 | /* Verify the screen parameter */ | 151 | /* Verify the screen parameter */ |
@@ -177,7 +177,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue) | |||
177 | /* If physical palette has been set independently, use it */ | 177 | /* If physical palette has been set independently, use it */ |
178 | if(video->physpal) | 178 | if(video->physpal) |
179 | pal = video->physpal; | 179 | pal = video->physpal; |
180 | 180 | ||
181 | SDL_SetPalette(screen, SDL_PHYSPAL, | 181 | SDL_SetPalette(screen, SDL_PHYSPAL, |
182 | pal->colors, 0, pal->ncolors); | 182 | pal->colors, 0, pal->ncolors); |
183 | return 0; | 183 | return 0; |
@@ -196,7 +196,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue) | |||
196 | int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue) | 196 | int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue) |
197 | { | 197 | { |
198 | SDL_VideoDevice *video = current_video; | 198 | SDL_VideoDevice *video = current_video; |
199 | SDL_VideoDevice *this = current_video; | 199 | SDL_VideoDevice *this = current_video; |
200 | 200 | ||
201 | /* Lazily allocate the gamma table */ | 201 | /* Lazily allocate the gamma table */ |
202 | if ( ! video->gamma ) { | 202 | if ( ! video->gamma ) { |