summaryrefslogtreecommitdiffstats
path: root/apps/plugins/sdl
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-04-04 20:24:33 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-04-11 19:29:47 +0200
commite28d1fe91671f64ce30d6e439787a48d71de5616 (patch)
treef787aaac6e894abf7e3f4144cd1b827e65db673d /apps/plugins/sdl
parent2ad6c3438e53ddaa80c0aa43e995376495ce1a77 (diff)
downloadrockbox-e28d1fe91671f64ce30d6e439787a48d71de5616.tar.gz
rockbox-e28d1fe91671f64ce30d6e439787a48d71de5616.tar.bz2
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
Diffstat (limited to 'apps/plugins/sdl')
-rw-r--r--apps/plugins/sdl/SDL_image/IMG.c18
-rw-r--r--apps/plugins/sdl/SDL_image/IMG_jpg.c28
-rw-r--r--apps/plugins/sdl/SDL_image/IMG_png.c28
-rw-r--r--apps/plugins/sdl/SDL_image/IMG_tif.c18
-rw-r--r--apps/plugins/sdl/SDL_image/IMG_webp.c24
-rw-r--r--apps/plugins/sdl/SDL_mixer/dynamic_flac.h4
-rw-r--r--apps/plugins/sdl/SDL_mixer/dynamic_mod.h4
-rw-r--r--apps/plugins/sdl/SDL_mixer/dynamic_mp3.h4
-rw-r--r--apps/plugins/sdl/SDL_mixer/dynamic_ogg.h4
-rw-r--r--apps/plugins/sdl/SDL_mixer/music.c20
-rw-r--r--apps/plugins/sdl/SDL_mixer/timidity/config.h6
-rw-r--r--apps/plugins/sdl/SDL_mixer/timidity/playmidi.c116
-rw-r--r--apps/plugins/sdl/SDL_mixer/timidity/readmidi.c59
-rw-r--r--apps/plugins/sdl/SDL_mixer/timidity/timidity.c23
-rw-r--r--apps/plugins/sdl/SDL_mixer/wavestream.c17
-rw-r--r--apps/plugins/sdl/include/SDL_config_rockbox.h7
-rw-r--r--apps/plugins/sdl/main.c4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/display.c185
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/display.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/network.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c34
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/console.c40
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/console.h18
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/cvars.h6
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/global.h1
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/types.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h4
-rw-r--r--apps/plugins/sdl/progs/quake/cl_input.c15
-rw-r--r--apps/plugins/sdl/progs/quake/d_iface.h3
-rw-r--r--apps/plugins/sdl/progs/quake/mathlib.h11
-rw-r--r--apps/plugins/sdl/progs/quake/net.h6
-rw-r--r--apps/plugins/sdl/progs/quake/server.h2
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_in.h10
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_pm.h16
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_us.h2
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_vh.h4
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_def.h14
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_draw.c8
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_menu.h4
-rw-r--r--apps/plugins/sdl/sdl.make7
-rw-r--r--apps/plugins/sdl/src/audio/SDL_wave.c9
-rw-r--r--apps/plugins/sdl/src/video/SDL_gamma.c18
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)
return(&linked_version);
}
-extern int IMG_InitJPG();
-extern void IMG_QuitJPG();
-extern int IMG_InitPNG();
-extern void IMG_QuitPNG();
-extern int IMG_InitTIF();
-extern void IMG_QuitTIF();
-
-extern int IMG_InitWEBP();
-extern void IMG_QuitWEBP();
+extern int IMG_InitJPG(void);
+extern void IMG_QuitJPG(void);
+extern int IMG_InitPNG(void);
+extern void IMG_QuitPNG(void);
+extern int IMG_InitTIF(void);
+extern void IMG_QuitTIF(void);
+
+extern int IMG_InitWEBP(void);
+extern void IMG_QuitWEBP(void);
static int initialized = 0;
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 {
} lib;
#ifdef LOAD_JPG_DYNAMIC
-int IMG_InitJPG()
+int IMG_InitJPG(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
@@ -74,56 +74,56 @@ int IMG_InitJPG()
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_CreateDecompress =
+ lib.jpeg_CreateDecompress =
(void (*) (j_decompress_ptr, int, size_t))
SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress");
if ( lib.jpeg_CreateDecompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_destroy_decompress =
+ lib.jpeg_destroy_decompress =
(void (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress");
if ( lib.jpeg_destroy_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_finish_decompress =
+ lib.jpeg_finish_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_finish_decompress");
if ( lib.jpeg_finish_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_read_header =
+ lib.jpeg_read_header =
(int (*) (j_decompress_ptr, boolean))
SDL_LoadFunction(lib.handle, "jpeg_read_header");
if ( lib.jpeg_read_header == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_read_scanlines =
+ lib.jpeg_read_scanlines =
(JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION))
SDL_LoadFunction(lib.handle, "jpeg_read_scanlines");
if ( lib.jpeg_read_scanlines == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_resync_to_restart =
+ lib.jpeg_resync_to_restart =
(boolean (*) (j_decompress_ptr, int))
SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart");
if ( lib.jpeg_resync_to_restart == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_start_decompress =
+ lib.jpeg_start_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_start_decompress");
if ( lib.jpeg_start_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
- lib.jpeg_std_error =
+ lib.jpeg_std_error =
(struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *))
SDL_LoadFunction(lib.handle, "jpeg_std_error");
if ( lib.jpeg_std_error == NULL ) {
@@ -135,7 +135,7 @@ int IMG_InitJPG()
return 0;
}
-void IMG_QuitJPG()
+void IMG_QuitJPG(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -146,7 +146,7 @@ void IMG_QuitJPG()
--lib.loaded;
}
#else
-int IMG_InitJPG()
+int IMG_InitJPG(void)
{
if ( lib.loaded == 0 ) {
lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;
@@ -163,7 +163,7 @@ int IMG_InitJPG()
return 0;
}
-void IMG_QuitJPG()
+void IMG_QuitJPG(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -468,13 +468,13 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
#else
-int IMG_InitJPG()
+int IMG_InitJPG(void)
{
IMG_SetError("JPEG images are not supported");
return(-1);
}
-void IMG_QuitJPG()
+void IMG_QuitJPG(void)
{
}
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 @@
/*=============================================================================
File: SDL_png.c
- Purpose: A PNG loader and saver for the SDL library
- Revision:
+ Purpose: A PNG loader and saver for the SDL library
+ Revision:
Created by: Philippe Lavoie (2 November 1998)
lavoie@zeus.genie.uottawa.ca
- Modified by:
+ Modified by:
Copyright notice:
Copyright (C) 1998 Philippe Lavoie
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
-
+
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
-
+
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -102,7 +102,7 @@ static struct {
} lib;
#ifdef LOAD_PNG_DYNAMIC
-int IMG_InitPNG()
+int IMG_InitPNG(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
@@ -249,7 +249,7 @@ int IMG_InitPNG()
return 0;
}
-void IMG_QuitPNG()
+void IMG_QuitPNG(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -260,7 +260,7 @@ void IMG_QuitPNG()
--lib.loaded;
}
#else
-int IMG_InitPNG()
+int IMG_InitPNG(void)
{
if ( lib.loaded == 0 ) {
lib.png_create_info_struct = png_create_info_struct;
@@ -289,7 +289,7 @@ int IMG_InitPNG()
return 0;
}
-void IMG_QuitPNG()
+void IMG_QuitPNG(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -526,7 +526,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
palette->colors[i].b = i;
}
} else if (png_num_palette > 0 ) {
- palette->ncolors = png_num_palette;
+ palette->ncolors = png_num_palette;
for( i=0; i<png_num_palette; ++i ) {
palette->colors[i].b = png_palette[i].blue;
palette->colors[i].g = png_palette[i].green;
@@ -552,18 +552,18 @@ done: /* Clean up and return */
}
IMG_SetError(error);
}
- return(surface);
+ return(surface);
}
#else
-int IMG_InitPNG()
+int IMG_InitPNG(void)
{
IMG_SetError("PNG images are not supported");
return(-1);
}
-void IMG_QuitPNG()
+void IMG_QuitPNG(void)
{
}
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 {
} lib;
#ifdef LOAD_TIF_DYNAMIC
-int IMG_InitTIF()
+int IMG_InitTIF(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
@@ -89,7 +89,7 @@ int IMG_InitTIF()
return 0;
}
-void IMG_QuitTIF()
+void IMG_QuitTIF(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -100,7 +100,7 @@ void IMG_QuitTIF()
--lib.loaded;
}
#else
-int IMG_InitTIF()
+int IMG_InitTIF(void)
{
if ( lib.loaded == 0 ) {
lib.TIFFClientOpen = TIFFClientOpen;
@@ -113,7 +113,7 @@ int IMG_InitTIF()
return 0;
}
-void IMG_QuitTIF()
+void IMG_QuitTIF(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -222,7 +222,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
}
/* turn off memory mapped access with the m flag */
- tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
+ tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, tiff_map, tiff_unmap);
if(!tiff)
goto error;
@@ -239,7 +239,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
Rmask, Gmask, Bmask, Amask);
if(!surface)
goto error;
-
+
if(!lib.TIFFReadRGBAImage(tiff, img_width, img_height, surface->pixels, 0))
goto error;
@@ -258,7 +258,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
}
}
lib.TIFFClose(tiff);
-
+
return surface;
error:
@@ -271,13 +271,13 @@ error:
#else
-int IMG_InitTIF()
+int IMG_InitTIF(void)
{
IMG_SetError("TIFF images are not supported");
return(-1);
}
-void IMG_QuitTIF()
+void IMG_QuitTIF(void)
{
}
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 @@
/*=============================================================================
File: SDL_webp.c
- Purpose: A WEBP loader for the SDL library
- Revision:
+ Purpose: A WEBP loader for the SDL library
+ Revision:
Created by: Michael Bonfils (Murlock) (26 November 2011)
murlock42@gmail.com
@@ -53,14 +53,14 @@ static struct {
} lib;
#ifdef LOAD_WEBP_DYNAMIC
-int IMG_InitWEBP()
+int IMG_InitWEBP(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC);
if ( lib.handle == NULL ) {
return -1;
}
- lib.webp_get_features_internal =
+ lib.webp_get_features_internal =
( int (*) (const uint8_t *, uint32_t, WebPBitstreamFeatures* const, int) )
SDL_LoadFunction(lib.handle, "WebPGetFeaturesInternal" );
if ( lib.webp_get_features_internal == NULL ) {
@@ -68,7 +68,7 @@ int IMG_InitWEBP()
return -1;
}
- lib.webp_decode_rgb_into =
+ lib.webp_decode_rgb_into =
( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) )
SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" );
if ( lib.webp_decode_rgb_into == NULL ) {
@@ -76,7 +76,7 @@ int IMG_InitWEBP()
return -1;
}
- lib.webp_decode_rgba_into =
+ lib.webp_decode_rgba_into =
( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) )
SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" );
if ( lib.webp_decode_rgba_into == NULL ) {
@@ -88,7 +88,7 @@ int IMG_InitWEBP()
return 0;
}
-void IMG_QuitWEBP()
+void IMG_QuitWEBP(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -99,7 +99,7 @@ void IMG_QuitWEBP()
--lib.loaded;
}
#else
-int IMG_InitWEBP()
+int IMG_InitWEBP(void)
{
if ( lib.loaded == 0 ) {
lib.webp_get_features_internal = WebPGetFeaturesInternal;
@@ -110,7 +110,7 @@ int IMG_InitWEBP()
return 0;
}
-void IMG_QuitWEBP()
+void IMG_QuitWEBP(void)
{
if ( lib.loaded == 0 ) {
return;
@@ -207,7 +207,7 @@ SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src)
error = "Failed to read WEBP";
goto error;
}
-
+
#if 0
// extract size of picture, not interesting since we don't know about alpha channel
int width = -1, height = -1;
@@ -270,13 +270,13 @@ error:
#else
-int IMG_InitWEBP()
+int IMG_InitWEBP(void)
{
IMG_SetError("WEBP images are not supported");
return(-1);
}
-void IMG_QuitWEBP()
+void IMG_QuitWEBP(void)
{
}
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;
#endif /* FLAC_MUSIC */
-extern int Mix_InitFLAC();
-extern void Mix_QuitFLAC();
+extern int Mix_InitFLAC(void);
+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;
#endif /* MOD_MUSIC */
-extern int Mix_InitMOD();
-extern void Mix_QuitMOD();
+extern int Mix_InitMOD(void);
+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;
#endif /* MUSIC_MP3 */
-extern int Mix_InitMP3();
-extern void Mix_QuitMP3();
+extern int Mix_InitMP3(void);
+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;
#endif /* OGG_MUSIC */
-extern int Mix_InitOgg();
-extern void Mix_QuitOgg();
+extern int Mix_InitOgg(void);
+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);
static void music_internal_volume(int volume);
static int music_internal_play(Mix_Music *music, double position);
static int music_internal_position(double position);
-static int music_internal_playing();
+static int music_internal_playing(void);
static void music_internal_halt(void);
@@ -193,8 +193,8 @@ void Mix_HookMusicFinished(void (*music_finished)(void))
static int music_halt_or_loop (void)
{
/* Restart music if it has to loop */
-
- if (!music_internal_playing())
+
+ if (!music_internal_playing())
{
#ifdef USE_NATIVE_MIDI
/* Native MIDI handles looping internally */
@@ -211,17 +211,17 @@ static int music_halt_or_loop (void)
current_fade = music_playing->fading;
music_internal_play(music_playing, 0.0);
music_playing->fading = current_fade;
- }
- else
+ }
+ else
{
music_internal_halt();
if (music_finished_hook)
music_finished_hook();
-
+
return 0;
}
}
-
+
return 1;
}
@@ -258,7 +258,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
music_playing->fading = MIX_NO_FADING;
}
}
-
+
music_halt_or_loop();
if (!music_internal_playing())
return;
@@ -309,7 +309,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
#endif
#ifdef OGG_MUSIC
case MUS_OGG:
-
+
left = OGG_playAudio(music_playing->data.ogg, stream, len);
break;
#endif
@@ -334,7 +334,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
}
}
-
+
skip:
/* Handle seamless music looping */
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 @@
/* This is for use with the SDL library */
#ifndef __TIMIDITY_CONFIG_H__
#define __TIMIDITY_CONFIG_H__
+#ifndef SDL
#define SDL
+#endif
#include "SDL_config.h"
#include "SDL_endian.h"
@@ -24,7 +26,7 @@
#define DEFAULT_PROGRAM 0
/* 9 here is MIDI channel 10, which is the standard percussion channel.
- Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
+ Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
On the other hand, some files know that 16 is not a drum channel and
try to play music on it. This is now a runtime option, so this isn't
a critical choice anymore. */
@@ -131,7 +133,7 @@ typedef double FLOAT_T;
#define MAX_CONTROL_RATIO 255
typedef unsigned int uint32;
-typedef int int32;
+typedef int int32;
typedef unsigned short uint16;
typedef short int16;
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 @@
it under the terms of the Perl Artistic License, available in COPYING.
*/
+#include "config.h"
+
#include <SDL_rwops.h>
-#include "config.h"
#include "common.h"
#include "instrum.h"
#include "playmidi.h"
@@ -69,14 +70,14 @@ int XG_System_variation_type;
static void adjust_amplification(void)
-{
+{
master_volume = (FLOAT_T)(amplification) / (FLOAT_T)100.0;
master_volume /= 2;
}
static void adjust_master_volume(int32 vol)
-{
+{
master_volume = (double)(vol*amplification) / 1638400.0L;
master_volume /= 2;
}
@@ -146,7 +147,7 @@ static void select_sample(int v, Instrument *ip)
}
f=voice[v].orig_frequency;
- /*
+ /*
No suitable sample found! We'll select the sample whose root
frequency is closest to the one we want. (Actually we should
probably convert the low, high, and root frequencies to MIDI note
@@ -214,11 +215,11 @@ static void select_stereo_samples(int v, InstrumentLayer *lp)
static void recompute_freq(int v)
{
- int
+ int
sign=(voice[v].sample_increment < 0), /* for bidirectional loops */
pb=channel[voice[v].channel].pitchbend;
double a;
-
+
if (!voice[v].sample->sample_rate)
return;
@@ -262,22 +263,22 @@ static void recompute_freq(int v)
(double)(play_mode->rate)),
FRACTION_BITS);
- if (sign)
+ if (sign)
a = -a; /* need to preserve the loop direction */
voice[v].sample_increment = (int32)(a);
}
static int expr_curve[128] = {
- 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11,
- 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15,
- 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22,
- 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31,
- 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63,
- 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89,
+ 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11,
+ 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15,
+ 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22,
+ 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31,
+ 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63,
+ 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89,
91, 93, 95, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 121,
- 124, 127
+ 124, 127
};
static int panf(int pan, int speaker, int separation)
@@ -423,7 +424,7 @@ static void recompute_amp(int v)
/* just a variant of note_on() */
static int vc_alloc(int j)
{
- int i=voices;
+ int i=voices;
while (i--)
{
@@ -439,7 +440,7 @@ static void kill_note(int i);
static void kill_others(int i)
{
- int j=voices;
+ int j=voices;
if (!voice[i].sample->exclusiveClass) return;
@@ -769,7 +770,7 @@ static void start_note(MidiEvent *e, int i)
ip = lp->instrument;
if (ip->type == INST_GUS && ip->samples != 1)
{
- ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
+ ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
"Strange: percussion instrument with %d samples!", ip->samples);
}
@@ -989,14 +990,14 @@ static void kill_note(int i)
/* Only one instance of a note can be playing on a single channel. */
static void note_on(MidiEvent *e)
{
- int i=voices, lowest=-1;
+ int i=voices, lowest=-1;
int32 lv=0x7FFFFFFF, v;
while (i--)
{
if (voice[i].status == VOICE_FREE)
lowest=i; /* Can't get a lower volume than silence */
- else if (voice[i].channel==e->channel &&
+ else if (voice[i].channel==e->channel &&
(voice[i].note==e->a || channel[voice[i].channel].mono))
kill_note(i);
}
@@ -1007,7 +1008,7 @@ static void note_on(MidiEvent *e)
start_note(e,lowest);
return;
}
-
+
#if 0
/* Look for the decaying note with the lowest volume */
i=voices;
@@ -1136,7 +1137,7 @@ static void all_notes_off(int c)
if (voice[i].status==VOICE_ON &&
voice[i].channel==c)
{
- if (channel[c].sustain)
+ if (channel[c].sustain)
{
voice[i].status=VOICE_SUSTAINED;
ctl->note(i);
@@ -1151,7 +1152,7 @@ static void all_sounds_off(int c)
{
int i=voices;
while (i--)
- if (voice[i].channel==c &&
+ if (voice[i].channel==c &&
voice[i].status != VOICE_FREE &&
voice[i].status != VOICE_DIE)
{
@@ -1232,29 +1233,29 @@ static void seek_forward(int32 until_time)
current_event->a;
channel[current_event->channel].pitchfactor=0;
break;
-
+
case ME_PITCHWHEEL:
channel[current_event->channel].pitchbend=
current_event->a + current_event->b * 128;
channel[current_event->channel].pitchfactor=0;
break;
-
+
case ME_MAINVOLUME:
channel[current_event->channel].volume=current_event->a;
break;
-
+
case ME_MASTERVOLUME:
adjust_master_volume(current_event->a + (current_event->b <<7));
break;
-
+
case ME_PAN:
channel[current_event->channel].panning=current_event->a;
break;
-
+
case ME_EXPRESSION:
channel[current_event->channel].expression=current_event->a;
break;
-
+
case ME_PROGRAM:
/* if (ISDRUMCHANNEL(current_event->channel)) */
if (channel[current_event->channel].kit)
@@ -1310,11 +1311,11 @@ static void seek_forward(int32 until_time)
case ME_RESET_CONTROLLERS:
reset_controllers(current_event->channel);
break;
-
+
case ME_TONE_BANK:
channel[current_event->channel].bank=current_event->a;
break;
-
+
case ME_EOT:
current_sample=current_event->time;
return;
@@ -1336,7 +1337,7 @@ static void skip_to(int32 until_time)
buffered_count=0;
buffer_pointer=common_buffer;
current_event=event_list;
-
+
if (until_time)
seek_forward(until_time);
ctl->reset();
@@ -1351,15 +1352,15 @@ static int apply_controls(void)
switch(rc=ctl->read(&val))
{
case RC_QUIT: /* [] */
- case RC_LOAD_FILE:
+ case RC_LOAD_FILE:
case RC_NEXT: /* >>| */
case RC_REALLY_PREVIOUS: /* |<< */
return rc;
-
+
case RC_CHANGE_VOLUME:
if (val>0 || amplification > -val)
amplification += val;
- else
+ else
amplification=0;
if (amplification > MAX_AMPLIFICATION)
amplification=MAX_AMPLIFICATION;
@@ -1382,20 +1383,20 @@ static int apply_controls(void)
skip_to(0);
did_skip=1;
break;
-
+
case RC_JUMP:
if (val >= sample_count)
return RC_NEXT;
skip_to(val);
return rc;
-
+
case RC_FORWARD: /* >> */
if (val+current_sample >= sample_count)
return RC_NEXT;
skip_to(val+current_sample);
did_skip=1;
break;
-
+
case RC_BACK: /* << */
if (current_sample > val)
skip_to(current_sample-val);
@@ -1405,10 +1406,10 @@ static int apply_controls(void)
break;
}
while (rc!= RC_NONE);
-
+
/* Advertise the skip so that we stop computing the audio buffer */
if (did_skip)
- return RC_JUMP;
+ return RC_JUMP;
else
return rc;
}
@@ -1466,7 +1467,7 @@ static int compute_data(void *stream, int32 count)
s32tobuf(stream, common_buffer, channels*AUDIO_BUFFER_SIZE);
buffer_pointer=common_buffer;
buffered_count=0;
-
+
ctl->current_time(current_sample);
if ((rc=apply_controls())!=RC_NONE)
return rc;
@@ -1485,7 +1486,7 @@ int Timidity_PlaySome(void *stream, int samples)
//printf("Timidity_PlaySome()\n");
int rc = RC_NONE;
int32 end_sample;
-
+
if ( ! midi_playing ) {
return RC_NONE;
}
@@ -1504,33 +1505,33 @@ int Timidity_PlaySome(void *stream, int samples)
else
note_on(current_event);
break;
-
+
case ME_NOTEOFF:
current_event->a += channel[current_event->channel].transpose;
note_off(current_event);
break;
-
+
case ME_KEYPRESSURE:
adjust_pressure(current_event);
break;
-
+
/* Effects affecting a single channel */
-
+
case ME_PITCH_SENS:
channel[current_event->channel].pitchsens=current_event->a;
channel[current_event->channel].pitchfactor=0;
break;
-
+
case ME_PITCHWHEEL:
channel[current_event->channel].pitchbend=
current_event->a + current_event->b * 128;
channel[current_event->channel].pitchfactor=0;
/* Adjust pitch for notes already playing */
adjust_pitchbend(current_event->channel);
- ctl->pitch_bend(current_event->channel,
+ ctl->pitch_bend(current_event->channel,
channel[current_event->channel].pitchbend);
break;
-
+
case ME_MAINVOLUME:
channel[current_event->channel].volume=current_event->a;
adjust_volume(current_event->channel);
@@ -1540,7 +1541,7 @@ int Timidity_PlaySome(void *stream, int samples)
case ME_MASTERVOLUME:
adjust_master_volume(current_event->a + (current_event->b <<7));
break;
-
+
case ME_REVERBERATION:
channel[current_event->channel].reverberation=current_event->a;
break;
@@ -1555,13 +1556,13 @@ int Timidity_PlaySome(void *stream, int samples)
adjust_panning(current_event->channel);
ctl->panning(current_event->channel, current_event->a);
break;
-
+
case ME_EXPRESSION:
channel[current_event->channel].expression=current_event->a;
adjust_volume(current_event->channel);
ctl->expression(current_event->channel, current_event->a);
break;
-
+
case ME_PROGRAM:
/* if (ISDRUMCHANNEL(current_event->channel)) { */
if (channel[current_event->channel].kit) {
@@ -1574,23 +1575,23 @@ int Timidity_PlaySome(void *stream, int samples)
}
ctl->program(current_event->channel, current_event->a);
break;
-
+
case ME_SUSTAIN:
channel[current_event->channel].sustain=current_event->a;
if (!current_event->a)
drop_sustain(current_event->channel);
ctl->sustain(current_event->channel, current_event->a);
break;
-
+
case ME_RESET_CONTROLLERS:
reset_controllers(current_event->channel);
redraw_controllers(current_event->channel);
break;
-
+
case ME_ALL_NOTES_OFF:
all_notes_off(current_event->channel);
break;
-
+
case ME_ALL_SOUNDS_OFF:
all_sounds_off(current_event->channel);
break;
@@ -1725,7 +1726,7 @@ void Timidity_FreeSong(MidiSong *song)
{
if (free_instruments_afterwards)
free_instruments();
-
+
free(song->events);
free(song);
}
@@ -1743,4 +1744,3 @@ void Timidity_Close(void)
free_instruments();
free_pathlist();
}
-
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 @@
it under the terms of the Perl Artistic License, available in COPYING.
*/
+#include "config.h"
+
#include <SDL_rwops.h>
-#include "config.h"
#include "common.h"
#include "instrum.h"
#include "playmidi.h"
@@ -282,11 +283,11 @@ static MidiEventList *read_midi_event(void)
at+=getvl();
if (SDL_RWread(rw,&me,1,1)!=1)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s",
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s",
current_filename, strerror(errno));
return 0;
}
-
+
if(me==0xF0 || me == 0xF7) /* SysEx event */
{
int32 sret;
@@ -340,9 +341,9 @@ static MidiEventList *read_midi_event(void)
case 0x51: /* Tempo */
SDL_RWread(rw,&a,1,1); SDL_RWread(rw,&b,1,1); SDL_RWread(rw,&c,1,1);
MIDIEVENT(at, ME_TEMPO, c, a, b);
-
+
default:
- ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+ ctl->cmsg(CMSG_INFO, VERB_DEBUG,
"(Meta event type 0x%02x, length %ld)", type, len);
SDL_RWseek(rw, len, RW_SEEK_CUR);
break;
@@ -414,7 +415,7 @@ static MidiEventList *read_midi_event(void)
case 101: nrpn=0; rpn_lsb[lastchan]=b; break;
case 99: nrpn=1; rpn_msb[lastchan]=b; break;
case 98: nrpn=1; rpn_lsb[lastchan]=b; break;
-
+
case 6:
if (nrpn)
{
@@ -455,13 +456,13 @@ static MidiEventList *read_midi_event(void)
*/
}
- ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+ ctl->cmsg(CMSG_INFO, VERB_DEBUG,
"(Data entry (MSB) for NRPN %02x,%02x: %ld)",
rpn_msb[lastchan], rpn_lsb[lastchan],
b);
break;
}
-
+
switch((rpn_msb[lastchan]<<8) | rpn_lsb[lastchan])
{
case 0x0000: /* Pitch bend sensitivity */
@@ -473,22 +474,22 @@ static MidiEventList *read_midi_event(void)
MIDIEVENT(at, ME_PITCH_SENS, lastchan, 2, 0);
default:
- ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+ ctl->cmsg(CMSG_INFO, VERB_DEBUG,
"(Data entry (MSB) for RPN %02x,%02x: %ld)",
rpn_msb[lastchan], rpn_lsb[lastchan],
b);
break;
}
break;
-
+
default:
- ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+ ctl->cmsg(CMSG_INFO, VERB_DEBUG,
"(Control %d: %d)", a, b);
break;
}
if (control != 255)
- {
- MIDIEVENT(at, control, lastchan, b, 0);
+ {
+ MIDIEVENT(at, control, lastchan, b, 0);
}
}
break;
@@ -505,15 +506,15 @@ static MidiEventList *read_midi_event(void)
b &= 0x7F;
MIDIEVENT(at, ME_PITCHWHEEL, lastchan, a, b);
- default:
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ default:
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"*** Can't happen: status 0x%02X, channel 0x%02X",
laststatus, lastchan);
break;
}
}
}
-
+
return new;
}
@@ -574,7 +575,7 @@ static int read_track(int append)
meep=next;
next=meep->next;
}
-
+
new->next=next;
meep->next=new;
@@ -720,7 +721,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
}
if (current_set[meep->event.channel] != new_value)
current_set[meep->event.channel]=new_value;
- else
+ else
skip_this_event=1;
}
else
@@ -776,7 +777,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
if (mprog==SPECIAL_PROGRAM)
break;
- if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120])
+ if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120])
banknum = 120;
/*if (current_config_pc42b) pcmap(&banknum, &dnote, &mprog, &drumsflag);*/
@@ -812,7 +813,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
new_value=meep->event.a;
if (current_kit[meep->event.channel] != new_value)
current_kit[meep->event.channel]=new_value;
- else
+ else
skip_this_event=1;
break;
}
@@ -846,7 +847,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
}
if (tonebank[SFXBANK] || tonebank[120]) /* Is this a defined tone bank? */
new_value=SFX_BANKTYPE;
- else
+ else
{
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
"XG Sfx bank is undefined");
@@ -873,7 +874,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
}
else if (tonebank[meep->event.a]) /* Is this a defined tone bank? */
new_value=meep->event.a;
- else
+ else
{
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
"Tone bank %d is undefined", meep->event.a);
@@ -924,7 +925,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
lp->type=ME_EOT;
our_event_count++;
free_midi_list();
-
+
*eventsp=our_event_count;
*samplesp=st;
return groomed_list;
@@ -968,11 +969,11 @@ past_riff:
{
/* if (ferror(fp))
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
strerror(errno));
}
else*/
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: Not a MIDI file!", current_filename);
return 0;
}
@@ -1010,18 +1011,18 @@ past_riff:
if (len > 6)
{
- ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
- "%s: MIDI file header size %ld bytes",
+ ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
+ "%s: MIDI file header size %ld bytes",
current_filename, len);
SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */
}
if (format<0 || format >2)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: Unknown MIDI file format %d", current_filename, format);
return 0;
}
- ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
+ ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
"Format: %d Tracks: %d Divisions: %d", format, tracks, divisions);
/* 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 @@
it under the terms of the Perl Artistic License, available in COPYING.
*/
-#include "SDL.h"
#include "config.h"
+#include "SDL.h"
#include "common.h"
#include "instrum.h"
#include "playmidi.h"
@@ -88,7 +88,7 @@ static int read_config_file(const char *name)
{
if (words != 2)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify exactly one patch name\n",
name, line);
return -2;
@@ -101,14 +101,14 @@ static int read_config_file(const char *name)
if (words < 2)
{
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
- "%s: line %d: No drum set number given\n",
+ "%s: line %d: No drum set number given\n",
name, line);
return -2;
}
i=atoi(w[1]);
if (i<0 || i>127)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Drum set must be between 0 and 127\n",
name, line);
return -2;
@@ -125,14 +125,14 @@ static int read_config_file(const char *name)
if (words < 2)
{
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
- "%s: line %d: No bank number given\n",
+ "%s: line %d: No bank number given\n",
name, line);
return -2;
}
i=atoi(w[1]);
if (i<0 || i>127)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Tone bank must be between 0 and 127\n",
name, line);
return -2;
@@ -161,7 +161,7 @@ static int read_config_file(const char *name)
}
if (!bank)
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set "
"before assignment\n",
name, line);
@@ -188,7 +188,7 @@ static int read_config_file(const char *name)
k=atoi(cp);
if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9'))
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: amplification must be between "
"0 and %d\n", name, line, MAX_AMPLIFICATION);
return -2;
@@ -200,7 +200,7 @@ static int read_config_file(const char *name)
k=atoi(cp);
if ((k<0 || k>127) || (*cp < '0' || *cp > '9'))
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: note must be between 0 and 127\n",
name, line);
return -2;
@@ -220,7 +220,7 @@ static int read_config_file(const char *name)
if ((k<0 || k>127) ||
(k==0 && *cp!='-' && (*cp < '0' || *cp > '9')))
{
- ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: panning must be left, right, "
"center, or between -100 and 100\n",
name, line);
@@ -302,7 +302,7 @@ int Timidity_Init(int rate, int format, int channels, int samples)
}
if ( channels == 1 ) {
play_mode->encoding |= PE_MONO;
- }
+ }
switch (format) {
case AUDIO_S8:
s32tobuf = s32tos8;
@@ -356,4 +356,3 @@ const char *Timidity_Error(void)
{
return(timidity_error);
}
-
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 {
Uint32 FMTchunk;
Uint32 fmtlen;
*/
- Uint16 encoding;
+ Uint16 encoding;
Uint16 channels; /* 1 = mono, 2 = stereo */
Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
Uint32 byterate; /* Average bytes per second */
@@ -213,11 +213,11 @@ int WAVStream_PlaySome(Uint8 *stream, int len)
}
data = SDL_stack_alloc(Uint8, len);
if (data)
- {
+ {
SDL_RWread(music->rw, data, len, 1);
SDL_MixAudio(stream, data, len, wavestream_volume);
SDL_stack_free(data);
- }
+ }
}
}
return left;
@@ -286,7 +286,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
/* WAV magic header */
Uint32 RIFFchunk;
- Uint32 wavelen;
+// Uint32 wavelen;
Uint32 WAVEmagic;
/* FMT chunk */
@@ -296,7 +296,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
/* Check the magic header */
RIFFchunk = SDL_ReadLE32(src);
- wavelen = SDL_ReadLE32(src);
+// wavelen = SDL_ReadLE32(src);
WAVEmagic = SDL_ReadLE32(src);
if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
Mix_SetError("Unrecognized file type (not WAVE)");
@@ -416,7 +416,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
Uint32 AIFFmagic;
/* SSND chunk */
Uint32 offset;
- Uint32 blocksize;
+// Uint32 blocksize;
/* COMM format chunk */
Uint16 channels = 0;
Uint32 numsamples = 0;
@@ -459,7 +459,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
case SSND:
found_SSND = 1;
offset = SDL_ReadBE32(src);
- blocksize = SDL_ReadBE32(src);
+// blocksize = SDL_ReadBE32(src);
*start = SDL_RWtell(src) + offset;
break;
@@ -485,7 +485,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
was_error = 1;
goto done;
}
-
+
if (!found_COMM) {
Mix_SetError("Bad AIFF file (no COMM chunk)");
was_error = 1;
@@ -518,4 +518,3 @@ done:
}
return(src);
}
-
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 @@
#undef strdup
/* clock() wraps current_tick */
+#ifdef CLOCKS_PER_SEC
+#undef CLOCKS_PER_SEC
+#endif
#define CLOCKS_PER_SEC HZ
/*
@@ -160,9 +163,13 @@
#define strlcpy rb->strlcpy
#define strlen rb->strlen
#define strncasecmp rb->strncasecmp
+#ifndef strncat
#define strncat rb->strlcat /* hack */
+#endif
#define strncmp rb->strncmp
+#ifndef strncat
#define strpbrk strpbrk_wrapper
+#endif
#define strrchr rb->strrchr
#define strstr SDL_strstr
#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)
#endif
}
-/* 256KB */
-static long main_stack[1024 * 1024 / 2];
+static long main_stack[1024 * 1024 / 4]; /* ie 1 MB */
+
int (*main_fn)(int argc, char *argv[]);
int prog_idx;
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)
qsetmode = surface->h;
activepage = visualpage = 0;
-
+
frameoffset = frameplace = (uint8_t*)surface->pixels;
if (screen != NULL)
@@ -259,7 +259,7 @@ static void init_new_res_vars(int32_t davidoption)
{
case 1:i = xdim*ydim; break;
case 2: xdim = 320; ydim = 200; i = xdim*ydim; break;
-
+
default: assert(0);
}
j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */
@@ -269,13 +269,13 @@ static void init_new_res_vars(int32_t davidoption)
if(horizlookup2)
free(horizlookup2);
-
+
horizlookup = (int32_t*)malloc(j);
horizlookup2 = (int32_t*)malloc(j);
j = 0;
-
- //Build lookup table (X screespace -> frambuffer offset.
+
+ //Build lookup table (X screespace -> frambuffer offset.
for(i = 0; i <= ydim; i++)
{
ylookup[i] = j;
@@ -290,16 +290,16 @@ static void init_new_res_vars(int32_t davidoption)
//Let the Assembly module how many pixels to skip when drawing a column
setBytesPerLine(bytesperline);
-
+
setview(0L,0L,xdim-1,ydim-1);
-
+
setbrightness(curbrightness, palette);
if (searchx < 0) {
searchx = halfxdimen;
searchy = (ydimen>>1);
}
-
+
}
@@ -370,17 +370,17 @@ static int sdl_mouse_motion_filter(SDL_Event const *event)
}
else
{
- if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
+ if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
{
mouse_relative_x += event->motion.xrel;
mouse_relative_y += event->motion.yrel;
//printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n",
// mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel);
-
- // mouse_relative_* is already reset in
+
+ // mouse_relative_* is already reset in
// readmousexy(). It must not be
// reset here because calling this function does not mean
- // we always handle the mouse.
+ // we always handle the mouse.
// FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode.
}
else
@@ -431,12 +431,12 @@ static __inline int handle_keypad_enter_hack(const SDL_Event *event)
void fullscreen_toggle_and_change_driver(void)
{
-
-// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will
-// dynamically change for Windib or Directx driver. Windowed/Fullscreen
+
+// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will
+// dynamically change for Windib or Directx driver. Windowed/Fullscreen
// toggle also made available from menu.
// Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags)
-
+
int32_t x,y;
x = surface->w;
y = surface->h;
@@ -462,8 +462,8 @@ static int sdl_key_filter(const SDL_Event *event)
// FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M)
// This is usefull to move the duke window when playing in window mode.
-
- if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
+
+ if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(1);
@@ -491,9 +491,9 @@ static int sdl_key_filter(const SDL_Event *event)
lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended)
keyhandler();
SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys
-
- return(0);
- }
+
+ return(0);
+ }
if (!handle_keypad_enter_hack(event))
lastkey = scancodes[event->key.keysym.sym];
@@ -546,7 +546,7 @@ static int root_sdl_event_filter(const SDL_Event *event)
return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event));
case SDL_QUIT:
/* !!! rcg TEMP */
- Error(EXIT_SUCCESS, "Exit through SDL\n");
+ Error(EXIT_SUCCESS, "Exit through SDL\n");
default:
//printf("This event is not handled: %d\n",event->type);
break;
@@ -662,7 +662,7 @@ int _joystick_update(void)
int _joystick_axis(int axis)
{
if (joystick == NULL)
- {
+ {
return(0);
}
@@ -672,7 +672,7 @@ int _joystick_axis(int axis)
int _joystick_hat(int hat)
{
if (joystick == NULL)
- {
+ {
return(-1);
}
@@ -753,28 +753,28 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
//TODO:
//TODO ( "[Todo: handle -netmode <int>]" )
Setup_StableNetworking();
-
+
}
}
}
-
-
+
+
if (SDL_Init(SDL_INIT_VIDEO) == -1){
Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError());
- }
-
+ }
+
// Set up the correct renderer
// Becarfull setenv can't reach dll in VC++
// A way to proceed is to integrate the SDL libs
// in the exe instead.
-
+
// FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe
- // (this also makes the Windib/Directx driver switching easier with SDL)
+ // (this also makes the Windib/Directx driver switching easier with SDL)
// This requires to recompile the whole sdl and sdl mixer with the lib
// switch instead of the default dll switch.
-
+
putenv("SDL_VIDEO_CENTERED=1");
if (title == NULL)
@@ -895,12 +895,12 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
scancodes[SDLK_PAGEDOWN] = 0xE051;
scancodes[SDLK_INSERT] = 0xE052;
scancodes[SDLK_DELETE] = 0xE053;
-
-
+
+
output_sdl_versions();
output_driver_info();
-
+
printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20));
@@ -909,11 +909,11 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
// Capture BMP of the current frame
int screencapture(char *filename, uint8_t inverseit)
{
-// FIX_00006: better naming system for screenshots + message when pic is taken.
+// FIX_00006: better naming system for screenshots + message when pic is taken.
// Use ./screenshots folder. Screenshot code rerwritten. Faster and
// makes smaller files. Doesn't freeze or lag the game anymore.
-
- SDL_SaveBMP(surface, filename);
+
+ SDL_SaveBMP(surface, filename);
return 0;
} /* screencapture */
@@ -928,7 +928,7 @@ void setvmode(int mode)
} else
printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode);
-}
+}
int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
{
@@ -941,13 +941,13 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
colorkey = 0; // index in this image to be transparent
SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
SDL_WM_SetIcon(image,NULL);
-
+
if (daxdim > MAXXDIM || daydim > MAXYDIM)
{
printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
daxdim = MAXXDIM;
daydim = MAXYDIM;
- }
+ }
getvalidvesamodes();
@@ -1052,8 +1052,8 @@ static __inline void add_user_defined_resolution(void)
/* rockbox hack */
add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT);
add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH);
-
-
+
+
if (envr == NULL)
return;
@@ -1111,7 +1111,7 @@ static __inline void cull_large_vesa_modes(void)
int32_t max_w;
int32_t max_h;
int i;
-
+
get_max_screen_res(&max_w, &max_h);
printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h);
@@ -1139,7 +1139,7 @@ static __inline void cull_duplicate_vesa_modes(void)
}
}
}
-}
+}
#define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; }
@@ -1196,7 +1196,7 @@ static __inline void output_vesa_modelist(void)
} /* for */
printf("Final sorted modelist:%s", buffer);
-}
+}
void getvalidvesamodes(void)
@@ -1233,37 +1233,37 @@ void getvalidvesamodes(void)
/* print it out for debugging purposes... */
output_vesa_modelist();
-}
+}
uint8_t lastPalette[768];
void WriteTranslucToFile(void){
-
+
uint8_t buffer[65535*4];
uint8_t tga_header[18];
uint8_t* transPointer = transluc;
uint8_t* bufferPointer = buffer;
int i;
FILE* file;
-
+
for (i=0; i < 65535; i++) {
-
+
bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255;
bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255;
bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255;
bufferPointer[3] = 255;
-
+
printf("%d,",*transPointer);
if (i%255 ==0)
printf("\n");
-
+
transPointer +=1;
bufferPointer+=4;
}
-
-
-
+
+
+
file = fopen("/transluc.tga", "w");
-
+
memset(tga_header, 0, 18);
tga_header[2] = 2;
tga_header[12] = (256 & 0x00FF);
@@ -1271,23 +1271,23 @@ void WriteTranslucToFile(void){
tga_header[14] = (256 & 0x00FF) ;
tga_header[15] =(256 & 0xFF00) / 256;
tga_header[16] = 32 ;
-
+
fwrite(&tga_header, 18, sizeof(uint8_t), file);
fwrite(buffer, 65535, 4, file);
fclose(file);
}
void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){
-
+
uint8_t tga_header[18];
uint8_t* buffer;
uint8_t* palettePointer = palette;
uint8_t* bufferPointer ;
int i;
-
+
FILE* file = fopen(filename, "w");
-
-
+
+
memset(tga_header, 0, 18);
tga_header[2] = 2;
tga_header[12] = (width & 0x00FF);
@@ -1295,30 +1295,30 @@ void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int hei
tga_header[14] = (height & 0x00FF) ;
tga_header[15] =(height & 0xFF00) / 256;
tga_header[16] = 32 ;
-
+
fwrite(&tga_header, 18, sizeof(uint8_t), file);
-
+
bufferPointer = buffer = malloc(width*height*4);
-
+
for (i = 0 ; i < width*height ; i++)
{
bufferPointer[0] = palettePointer[0] / 63.0 * 255;
bufferPointer[1] = palettePointer[1] / 63.0 * 255;
bufferPointer[2] = palettePointer[2] / 63.0 * 255;
bufferPointer[3] = 255;
-
+
bufferPointer += 4;
palettePointer+= 3;
}
-
+
fwrite(buffer, width*height, 4, file);
fclose(file);
-
+
free(buffer);
}
-void WriteLastPaletteToFile(){
+void WriteLastPaletteToFile(void){
WritePaletteToFile(lastPalette,"lastPalette.tga",16,16);
}
@@ -1342,18 +1342,18 @@ int VBE_setPalette(uint8_t *palettebuffer)
uint8_t *p = palettebuffer;
int i;
//static updated=0;
-
+
//if (updated >=1 )
// return ;
-
+
//WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16);
//updated++;
-
-
+
+
//CODE EXPLORATION
//Used only to write the last palette to file.
memcpy(lastPalette, palettebuffer, 768);
-
+
for (i = 0; i < 256; i++){
/* doesn't map perfectly */
sdlp->b = (Uint8) (*p << 2) | (*p >> 4);
@@ -1383,10 +1383,10 @@ int VBE_getPalette(int32_t start, int32_t num, uint8_t *palettebuffer)
*p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0);
*p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */
sdlp++;
- }
+ }
return(1);
-}
+}
void _uninitengine(void)
@@ -1464,13 +1464,13 @@ void _nextpage(void)
_handle_events();
-
+
SDL_UpdateRect(surface, 0, 0, 0, 0);
-
+
//sprintf(bmpName,"%d.bmp",counter++);
//SDL_SaveBMP(surface,bmpName);
-
-
+
+
//if (CLEAR_FRAMEBUFFER)
// SDL_FillRect(surface,NULL,0);
@@ -1480,15 +1480,15 @@ void _nextpage(void)
total_rendered_frames = 0;
total_render_time = 1;
last_render_ticks = ticks;
- }
+ }
total_rendered_frames++;
-}
+}
uint8_t readpixel(uint8_t * offset)
{
return *offset;
-}
+}
void drawpixel(uint8_t * location, uint8_t pixel)
{
@@ -1519,7 +1519,7 @@ void fillscreen16(int32_t offset, int32_t color, int32_t blocksize)
pixels = get_framebuffer();
/* Make this function pageoffset aware - DDOI */
- if (!pageoffset) {
+ if (!pageoffset) {
offset = offset << 3;
offset += 640*336;
}
@@ -1584,7 +1584,7 @@ void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint
dx = XEnd-XStart;
dy = YEnd-YStart;
-
+
//Analyse the slope
if (dx >= 0)
{
@@ -1803,7 +1803,7 @@ void (*installusertimercallback(void (*callback)(void)))(void)
inittimer() -- initialise timer
FCS: The tickspersecond parameter is a ratio value that helps replicating
oldschool DOS tick per seconds.
-
+
The way the timer work is:
float newSystemTickPerSecond = [0,1]
tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ;
@@ -1812,8 +1812,8 @@ void (*installusertimercallback(void (*callback)(void)))(void)
int inittimer(int tickspersecond)
{
int64_t t;
-
-
+
+
if (timerfreq) return 0; // already installed
//printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond);
@@ -1831,7 +1831,7 @@ int inittimer(int tickspersecond)
timerlastsample = (int32_t)(t*timerticspersec / timerfreq);
usertimercallback = NULL;
-
+
return 0;
}
@@ -1853,12 +1853,12 @@ void sampletimer(void)
{
int64_t i;
int32_t n;
-
+
if (!timerfreq) return;
TIMER_GetPlatformTicks(&i);
-
-
+
+
n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample;
if (n>0) {
totalclock += n;
@@ -1907,10 +1907,9 @@ int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
*t = 1000;
return 1;
}
-
+
void TIMER_GetPlatformTicks(int64_t* t)
{
*t = SDL_GetTicks();
}
/* end of sdl_driver.c ... */
-
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);
/* resolution inits. sdl_driver.c ... */
int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim);
-uint32_t getticks();
+uint32_t getticks(void);
void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color);
void setcolor16(uint8_t color);
@@ -106,5 +106,3 @@ void setcolor16(uint8_t color);
void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority);
#endif
-
-
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 @@
#include "platform.h"
-void Setup_UnstableNetworking();
-void Setup_StableNetworking();
+void Setup_UnstableNetworking(void);
+void Setup_StableNetworking(void);
void callcommit(void);
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 @@
#define IP_RECVERR SO_BROADCAST
*/
+#ifndef stricmp
#define stricmp strcasecmp
+#endif
+#ifndef strcmpi
#define strcmpi strcasecmp
+#endif
#define S_IREAD S_IRUSR
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,
ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0,
ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0,
MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1;
-
+
//static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X,
// IN_COEF_L, IN_COEF_R;
@@ -51,7 +51,7 @@ static inline int cnv_offset(int src)
// extern __stdcall OutputDebugStringA(char *);
-static inline void check_buffer()
+static inline void check_buffer(void)
{
int new_delay = cnv_offset(MV_ReverbDelay);
@@ -99,7 +99,7 @@ static inline long g_buffer(int iOff, long *ptr) // get
}
iOff=(iOff*4)+CurrAddr;
- while(iOff>correctDelay-1)
+ while(iOff>correctDelay-1)
{
iOff=iOff-correctDelay;
}
@@ -141,11 +141,11 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
}
iOff=(iOff*4)+CurrAddr+1;
- while(iOff>correctDelay-1)
+ while(iOff>correctDelay-1)
{
iOff=iOff-correctDelay;
}
- while(iOff<0)
+ while(iOff<0)
{
iOff=correctDelay-(0-iOff);
}
@@ -155,12 +155,12 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr)
{
long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1;
-
+
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));
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));
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));
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));
-
+
const long one = (1 << FRACBITS);
const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS);
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
s_buffer1(IIR_DEST_A1, IIR_A1, ptr);
s_buffer1(IIR_DEST_B0, IIR_B0, ptr);
s_buffer1(IIR_DEST_B1, IIR_B1, ptr);
-
+
ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) +
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
fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS));
-
+
FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr);
FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr);
FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr);
FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr);
-
+
s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr);
s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr);
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);
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);
-
+
iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3;
iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3;
-
+
CurrAddr++;
if(CurrAddr>delay-1) CurrAddr=0;
-
+
return (long)iRVBLeft;
}
@@ -228,7 +228,7 @@ void MV_FPReverb(int volume)
// OutputDebugStringA(err);
long scale = (volume << FRACBITS) / MV_MaxVolume;
-
+
if (MV_Channels == 1)
{
for (i = 0; i < count; i++)
@@ -308,7 +308,7 @@ void MV_16BitReverbFast( const char *src, char *dest, int count, int shift )
short *pdest = (short *)dest;
const short *psrc = (const short *)src;
-
+
for (i = 0; i < count; i++) {
pdest[i] = readLE16(psrc + i) >> shift;
}
@@ -319,11 +319,11 @@ void MV_8BitReverbFast( const signed char *src, signed char *dest, int count, in
int i;
unsigned char sh = 0x80 - (0x80 >> shift);
-
+
for (i = 0; i < count; i++) {
unsigned char a = ((unsigned char) src[i]) >> shift;
unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7;
-
+
dest[i] = (signed char) (a + sh + c);
}
}
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
// Private member functions
void CONSOLE_InsertUsedCommand(const char * szUsedCommand);
-void CONSOLE_ClearUsedCommandList();
-void CONSOLE_RecalculateDirtyBuffer();
+void CONSOLE_ClearUsedCommandList(void);
+void CONSOLE_RecalculateDirtyBuffer(void);
// console argument tracker
int argc;
@@ -50,7 +50,7 @@ int nConsole_Active = 0;
void CVAR_RegisterDefaultCvarBindings(void);
// Initialize the console
-void CONSOLE_Init()
+void CONSOLE_Init(void)
{
CONSOLE_Reset();
@@ -63,7 +63,7 @@ void CONSOLE_Init()
CONSOLE_Printf("Type \'HELP\' for help with console Commands.");
}
-void CONSOLE_Reset()
+void CONSOLE_Reset(void)
{
CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement;
@@ -144,7 +144,7 @@ void CONSOLE_HandleInput()
{
ud.pause_on = 0;
}
- }
+ }
}
else
// Bug fix: make sure the frag bar displays after console
@@ -153,7 +153,7 @@ void CONSOLE_HandleInput()
{
if ( ud.multimode > 1 && ud.coop != 1 )
{
- displayfragbar();
+ displayfragbar();
}
if(numplayers<2)
ud.pause_on = 0;
@@ -169,7 +169,7 @@ void CONSOLE_HandleInput()
return;
}
- switch(KB_GetLastScanCode())
+ switch(KB_GetLastScanCode())
{
case sc_Space:
{
@@ -221,7 +221,7 @@ void CONSOLE_HandleInput()
case sc_kpad_Enter:
case sc_Enter:
{
- //If console_buffer[0] strlen() != 0
+ //If console_buffer[0] strlen() != 0
//1. Push the dirty_buffer unto the console_buffer
//2. parse the text
rb->kbd_input(dirty_buffer, sizeof(dirty_buffer));
@@ -278,7 +278,7 @@ void CONSOLE_HandleInput()
if(p_console_current_view->next != NULL)
{
p_console_current_view = p_console_current_view->next;
- }
+ }
else
{
break;
@@ -351,10 +351,10 @@ void CONSOLE_HandleInput()
}
- KB_ClearLastScanCode();
+ KB_ClearLastScanCode();
}
-void CONSOLE_Render()
+void CONSOLE_Render(void)
{
if(g_CV_classic)
{
@@ -371,7 +371,7 @@ void CONSOLE_Render()
int iYOffset = 3; //offset for the console text
CONSOLEELEMENT *pElement;
- y1 = 0;
+ y1 = 0;
y2 = (ydim / 2) - ((ydim / 2)/12);
// Draw console background
@@ -418,9 +418,9 @@ void CONSOLE_Render()
minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16);
// Draw the cursor //Change the color every second
- minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16);
+ minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16);
}
- else
+ else
if(g_CV_num_console_lines > 0)
{
int i, iYOffset = 3; //offset for the console text
@@ -517,7 +517,7 @@ void CONSOLE_InsertUsedCommand(const char * szUsedCommand)
}
}
-void CONSOLE_ClearUsedCommandList()
+void CONSOLE_ClearUsedCommandList(void)
{
CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement;
@@ -537,7 +537,7 @@ void CONSOLE_ClearUsedCommandList()
}
-void CONSOLE_RecalculateDirtyBuffer()
+void CONSOLE_RecalculateDirtyBuffer(void)
{
int len;
int l;
@@ -605,7 +605,7 @@ void CONSOLE_Printf(const char *newmsg, ...)
}
// Get the current number of args for this keyword
-int CONSOLE_GetArgc()
+int CONSOLE_GetArgc(void)
{
return argc;
}
@@ -617,9 +617,9 @@ char * CONSOLE_GetArgv(unsigned int var)
}
// Is our console showing?
-int CONSOLE_IsActive()
+int CONSOLE_IsActive(void)
{
-
+
return nConsole_Active;
}
@@ -627,4 +627,4 @@ int CONSOLE_IsActive()
void CONSOLE_SetActive(int i)
{
nConsole_Active = (i == 0) ? 0 : 1;
-} \ No newline at end of file
+}
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 @@
// Public member functions
-void CONSOLE_Init();
-void CONSOLE_Reset();
-void CONSOLE_Term();
-void CONSOLE_ParseStartupScript();
-void CONSOLE_HandleInput();
-void CONSOLE_Render();
+void CONSOLE_Init(void);
+void CONSOLE_Reset(void);
+void CONSOLE_Term(void);
+void CONSOLE_ParseStartupScript(void);
+void CONSOLE_HandleInput(void);
+void CONSOLE_Render(void);
void CONSOLE_ParseCommand(char * command);
void CONSOLE_Printf(const char *newmsg, ...);
-int CONSOLE_GetArgc();
+int CONSOLE_GetArgc(void);
char * CONSOLE_GetArgv(unsigned int var);
-int CONSOLE_IsActive();
-void CONSOLE_SetActive(int i);
+int CONSOLE_IsActive(void);
+void CONSOLE_SetActive(int i);
#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 @@
#include <inttypes.h>
-void CVARDEFS_Init();
-void CVARDEFS_Render();
+void CVARDEFS_Init(void);
+void CVARDEFS_Render(void);
//
// Function declarations
//
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
void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function);
-int CVAR_GetNumCvarBindings();
+int CVAR_GetNumCvarBindings(void);
cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding);
-void CVAR_Render();
+void CVAR_Render(void);
-#endif \ No newline at end of file
+#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);
#endif
#ifdef ROCKBOX
+#undef BYTE_ORDER
#ifdef ROCKBOX_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#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;
//
//***************************************************************************
+#ifndef true
#define true ( 1 == 1 )
+#endif
+#ifndef false
#define false ( ! true )
+#endif
//***************************************************************************
//
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -60,7 +60,7 @@ int16 IntelShort (int16 l);
int32_t Motoint32_t (int32_t l);
int32_t Intelint32_t (int32_t l);
-void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
+//void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
#ifdef __cplusplus
};
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)
{
float val;
qboolean impulsedown, impulseup, down;
-
+
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
-
- if (impulsedown && !impulseup)
+
+ if (impulsedown && !impulseup) {
if (down)
val = 0.5; // pressed and held this frame
else
val = 0; // I_Error ();
- if (impulseup && !impulsedown)
+ } else if (impulseup && !impulsedown) {
if (down)
val = 0; // I_Error ();
else
val = 0; // released this frame
- if (!impulsedown && !impulseup)
+ } else if (!impulsedown && !impulseup) {
if (down)
val = 1.0; // held the entire frame
else
val = 0; // up the entire frame
- if (impulsedown && impulseup)
+ } else if (impulsedown && impulseup) {
if (down)
val = 0.75; // released and re-pressed this frame
else
val = 0.25; // pressed and released this frame
+ }
key->state &= 1; // clear impulses
-
+
return val;
}
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;
#define DR_TRANSPARENT 1
// !!! must be kept the same as in quakeasm.h !!!
+#ifdef TRANSPARENT_COLOR
+#undef TRANSPARENT_COLOR
+#endif
#define TRANSPARENT_COLOR 0xFF
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -69,11 +69,13 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
//void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt
//float VectorNormalize (vec3_t v); // returns vector length
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
static inline float InvSqrt( float number ) {
long i;
float x2, y;
const float threehalfs = 1.5F;
-
+
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
@@ -84,13 +86,14 @@ static inline float InvSqrt( float number ) {
return y;
}
+#pragma GCC diagnostic pop
static inline void VectorNormalizeNoRet (vec3_t v)
{
float length, ilength;
ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
-
+
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
@@ -110,7 +113,7 @@ static inline float VectorNormalize (vec3_t v)
v[1] *= ilength;
v[2] *= ilength;
}
-
+
return length;
}
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -126,7 +126,7 @@ typedef struct qsocket_s
qboolean disconnected;
qboolean canSend;
qboolean sendNext;
-
+
int driver;
int landriver;
int socket;
@@ -314,7 +314,7 @@ typedef struct _PollProcedure
{
struct _PollProcedure *next;
double nextTime;
- void (*procedure)();
+ void (*procedure)(void *);
void *arg;
} PollProcedure;
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);
void SV_CheckForNewClients (void);
void SV_RunClients (void);
-void SV_SaveSpawnparms ();
+void SV_SaveSpawnparms (void);
#ifdef QUAKE2
void SV_SpawnServer (char *server, char *startspot);
#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);
extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode);
-void IN_WaitAndProcessEvents();
-void IN_ProcessEvents();
+void IN_WaitAndProcessEvents(void);
+void IN_ProcessEvents(void);
int IN_MouseButtons (void);
-boolean IN_JoyPresent();
+boolean IN_JoyPresent(void);
void IN_SetJoyCurrent(int joyIndex);
int IN_JoyButtons (void);
void IN_GetJoyDelta(int *dx,int *dy);
@@ -178,6 +178,6 @@ void IN_GetJoyFineDelta(int *dx, int *dy);
void IN_StartAck(void);
boolean IN_CheckAck (void);
-bool IN_IsInputGrabbed();
-void IN_CenterMouse();
+bool IN_IsInputGrabbed(void);
+void IN_CenterMouse(void);
#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;
// The last pointer points one byte after the last page.
extern uint8_t **PMPages;
-void PM_Startup();
-void PM_Shutdown();
+void PM_Startup(void);
+void PM_Shutdown(void);
-static uint32_t PM_GetPageSize(int page)
+static inline uint32_t PM_GetPageSize(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
return (uint32_t) (PMPages[page + 1] - PMPages[page]);
}
-static uint8_t *PM_GetPage(int page)
+static inline uint8_t *PM_GetPage(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPage: Tried to access illegal page: %i", page);
return PMPages[page];
}
-static uint8_t *PM_GetEnd()
+static inline uint8_t *PM_GetEnd(void)
{
return PMPages[ChunksInFile];
}
-static byte *PM_GetTexture(int wallpic)
+static inline byte *PM_GetTexture(int wallpic)
{
return PM_GetPage(wallpic);
}
-static uint16_t *PM_GetSprite(int shapenum)
+static inline uint16_t *PM_GetSprite(int shapenum)
{
// correct alignment is enforced by PM_Startup()
return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
}
-static byte *PM_GetSound(int soundpagenum)
+static inline byte *PM_GetSound(int soundpagenum)
{
return PM_GetPage(PMSoundStart + soundpagenum);
}
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);
char *USL_GiveSaveName(word game);
void US_InitRndT(int randomize);
-int US_RndT();
+int US_RndT(void);
#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);
#define VWB_HlinScaledCoord VW_Hlin
#define VWB_VlinScaledCoord VW_Vlin
-void VH_UpdateScreen();
+void VH_UpdateScreen(void);
#define VW_UpdateScreen VH_UpdateScreen
//
@@ -91,7 +91,7 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum);
void LoadLatchMem (void);
-void VH_Startup();
+void VH_Startup(void);
boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable);
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);
void DrawStatusBorder (byte color);
void DrawPlayScreen (void);
void DrawPlayBorderSides (void);
-void ShowActStatus();
+void ShowActStatus(void);
void PlayDemo (int demonumber);
void RecordDemo (void);
@@ -1372,7 +1372,7 @@ void GP2X_ButtonUp(int button);
=============================================================================
*/
-static fixed FixedMul(fixed a, fixed b)
+static inline fixed FixedMul(fixed a, fixed b)
{
return (fixed)(((int64_t)a * b + 0x8000) >> 16);
}
@@ -1394,13 +1394,13 @@ static fixed FixedMul(fixed a, fixed b)
#define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__)
-static char* itoa(int value, char* string, int radix)
+static inline char* itoa(int value, char* string, int radix)
{
sprintf(string, "%d", value);
return string;
}
-static char* ltoa(long value, char* string, int radix)
+static inline char* ltoa(long value, char* string, int radix)
{
sprintf(string, "%ld", value);
return string;
@@ -1409,14 +1409,14 @@ static char* ltoa(long value, char* string, int radix)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define endof(x) ((x) + lengthof(x))
-static word READWORD(byte **ptr)
+static inline word READWORD(byte **ptr)
{
word val = (*ptr)[0] | (*ptr)[1] << 8;
*ptr += 2;
return val;
}
-static longword READLONGWORD(byte **ptr)
+static inline longword READLONGWORD(byte **ptr)
{
longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24;
*ptr += 4;
@@ -1454,7 +1454,7 @@ static longword READLONGWORD(byte **ptr)
*************************************************************/
// The feature flags are stored as a wall in the upper right corner of each level
- static word GetFeatureFlags()
+ static inline word GetFeatureFlags()
{
return ffDataTopRight;
}
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)
====================
*/
-int CalcHeight()
+int CalcHeight(void)
{
fixed z = FixedMul(xintercept - viewx, viewcos)
- FixedMul(yintercept - viewy, viewsin);
@@ -275,7 +275,7 @@ byte *postsource;
int postx;
int postwidth;
-void ScalePost()
+void ScalePost(void)
{
int ywcount, yoffs, yw, yd, yendoffs;
byte col;
@@ -1091,7 +1091,7 @@ void CalcTics (void)
//==========================================================================
-void AsmRefresh()
+void AsmRefresh(void)
{
int32_t xstep,ystep;
longword xpartial,ypartial;
@@ -1517,7 +1517,7 @@ void WallRefresh (void)
ScalePost (); // no more optimization on last post
}
-void CalcViewVariables()
+void CalcViewVariables(void)
{
viewangle = player->angle;
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;
void US_ControlPanel(ScanCode);
-void EnableEndGameMenuItem();
+void EnableEndGameMenuItem(void);
void SetupControlPanel(void);
-void SetupSaveGames();
+void SetupSaveGames(void);
void CleanupControlPanel(void);
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)) \
-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings
+# WIP SDLFLAGS for warning deletions
+#SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
+#-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wno-sign-compare \
+#-Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unknown-pragmas \
+#-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
+#-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF
+
# use FPU on ARMv6
ifeq ($(ARCH_VERSION),6)
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)
encoded_len = *audio_len;
encoded = *audio_buf;
freeable = *audio_buf;
- *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
+ *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
MS_ADPCM_state.wSamplesPerBlock*
MS_ADPCM_state.wavefmt.channels*sizeof(Sint16);
*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
@@ -340,7 +340,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
encoded_len = *audio_len;
encoded = *audio_buf;
freeable = *audio_buf;
- *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
+ *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
IMA_ADPCM_state.wSamplesPerBlock*
IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16);
*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
@@ -413,7 +413,9 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
was_error = 1;
goto done;
}
-
+ chunk.data = NULL;
+ chunk.length = 0;
+
/* Check the magic header */
RIFFchunk = SDL_ReadLE32(src);
wavelen = SDL_ReadLE32(src);
@@ -432,7 +434,6 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
headerDiff += sizeof(Uint32); /* for WAVE */
/* Read the audio data format chunk */
- chunk.data = NULL;
do {
if ( chunk.data != NULL ) {
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 @@
/* Math routines from uClibc: http://www.uclibc.org */
#include "math_private.h"
#include "e_sqrt.h"
-#include "e_pow.h"
-#include "e_log.h"
-#define pow(x, y) __ieee754_pow(x, y)
-#define log(x) __ieee754_log(x)
+//#include "e_pow.h"
+//#include "e_log.h"
+//#define pow(x, y) __ieee754_pow(x, y)
+//#define log(x) __ieee754_log(x)
#endif
#include "SDL_sysvideo.h"
@@ -94,7 +94,7 @@ int SDL_SetGamma(float red, float green, float blue)
{
int succeeded;
SDL_VideoDevice *video = current_video;
- SDL_VideoDevice *this = current_video;
+ SDL_VideoDevice *this = current_video;
succeeded = -1;
/* Prefer using SetGammaRamp(), as it's more flexible */
@@ -120,7 +120,7 @@ int SDL_GetGamma(float *red, float *green, float *blue)
{
int succeeded;
SDL_VideoDevice *video = current_video;
- SDL_VideoDevice *this = current_video;
+ SDL_VideoDevice *this = current_video;
succeeded = -1;
/* Prefer using GetGammaRamp(), as it's more flexible */
@@ -145,7 +145,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue)
{
int succeeded;
SDL_VideoDevice *video = current_video;
- SDL_VideoDevice *this = current_video;
+ SDL_VideoDevice *this = current_video;
SDL_Surface *screen = SDL_PublicSurface;
/* Verify the screen parameter */
@@ -177,7 +177,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue)
/* If physical palette has been set independently, use it */
if(video->physpal)
pal = video->physpal;
-
+
SDL_SetPalette(screen, SDL_PHYSPAL,
pal->colors, 0, pal->ncolors);
return 0;
@@ -196,7 +196,7 @@ int SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue)
int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue)
{
SDL_VideoDevice *video = current_video;
- SDL_VideoDevice *this = current_video;
+ SDL_VideoDevice *this = current_video;
/* Lazily allocate the gamma table */
if ( ! video->gamma ) {