From e72bced0f7bd6f7d1e2d052c1b810d8d45ba4b98 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Fri, 27 Mar 2015 08:21:47 +0100 Subject: [PATCH 01/10] 'snprintf()' guarantees null termination of buffer Thanks @cremno. --- src/alstream.cpp | 1 - src/filesystem.cpp | 1 - src/settingsmenu.cpp | 1 - src/soundemitter.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/src/alstream.cpp b/src/alstream.cpp index 7f225b9..18799ff 100644 --- a/src/alstream.cpp +++ b/src/alstream.cpp @@ -236,7 +236,6 @@ void ALStream::openSource(const std::string &filename) char buf[512]; snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s.%s: %s", filename.c_str(), ext, e.msg.c_str()); - buf[sizeof(buf)-1] = '\0'; Debug() << buf; } diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 624ffc0..6642d3b 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -611,7 +611,6 @@ static void fontSetEnumCB(void *data, const char *, char filename[512]; snprintf(filename, sizeof(filename), "Fonts/%s", fname); - filename[sizeof(filename)-1] = '\0'; PHYSFS_File *handle = PHYSFS_openRead(filename); diff --git a/src/settingsmenu.cpp b/src/settingsmenu.cpp index dbf6cc6..a14b488 100644 --- a/src/settingsmenu.cpp +++ b/src/settingsmenu.cpp @@ -533,7 +533,6 @@ struct SettingsMenuPrivate { char buf[64]; snprintf(buf, sizeof(buf), "Press key or joystick button for \"%s\"", captureName); - buf[sizeof(buf)-1] = '\0'; drawOff = Vec2i(); diff --git a/src/soundemitter.cpp b/src/soundemitter.cpp index 59a1b9b..3850c0b 100644 --- a/src/soundemitter.cpp +++ b/src/soundemitter.cpp @@ -213,7 +213,6 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename) char buf[512]; snprintf(buf, sizeof(buf), "Unable to decode sound: %s.%s: %s", filename.c_str(), ext, Sound_GetError()); - buf[sizeof(buf)-1] = '\0'; Debug() << buf; return 0; From 88eca58268af0dbaf069ca5bdc912ba9ea6aab6e Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Thu, 2 Apr 2015 03:15:31 +0200 Subject: [PATCH 02/10] Revert "check Ruby strings for embedded null bytes" This reverts commit 29dfda0011e7ecaf88611679dcf0a3b9dd3f84da. It turned out to be a bad idea after all. --- binding-mri/binding-util.cpp | 2 +- binding-mri/bitmap-binding.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/binding-mri/binding-util.cpp b/binding-mri/binding-util.cpp index a663a18..e73d999 100644 --- a/binding-mri/binding-util.cpp +++ b/binding-mri/binding-util.cpp @@ -191,7 +191,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...) if (!RB_TYPE_P(tmp, RUBY_T_STRING)) rb_raise(rb_eTypeError, "Argument %d: Expected string", argI); - *s = StringValueCStr(tmp); + *s = RSTRING_PTR(tmp); ++argI; break; diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index 8781d05..f1572fe 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -32,7 +32,7 @@ DEF_TYPE(Bitmap); static const char *objAsStringPtr(VALUE obj) { VALUE str = rb_obj_as_string(obj); - return StringValueCStr(str); + return RSTRING_PTR(str); } void bitmapInitProps(Bitmap *b, VALUE self) From e4bc08e9725fac9e938c28b7ea4a5325dd713c59 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 26 May 2015 01:40:53 +0200 Subject: [PATCH 03/10] Fix for old, broken OpenAL-Soft headers See 4219b91bbbe9636a6a11857efd08fa93dee3e810 --- src/eventthread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 63a6d86..df381e8 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include #include #include "sharedstate.h" From d5bacf50f50a632286118adac6e8a7e40e75c066 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sun, 31 May 2015 20:58:05 +0200 Subject: [PATCH 04/10] TileAtlasVX: Fix table extents being covered by below tiles Fixes the appearance of tables in VX, which place table tiles on the same layer as ground tiles. --- src/tileatlasvx.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tileatlasvx.cpp b/src/tileatlasvx.cpp index 8726335..8f3ec47 100644 --- a/src/tileatlasvx.cpp +++ b/src/tileatlasvx.cpp @@ -607,7 +607,12 @@ static void readLayer(Reader &reader, const Table &data, const Table *flags, int ox, int oy, int w, int h, int z) { - for (int y = 0; y < h; ++y) + /* The table autotile pattern (A2) has two quads (table + * legs, etc.) which extend over the tile below. We process + * the tiles in rows from bottom to top so the table extents + * are added after the tile below and drawn over it. */ + + for (int y = h-1; y >= 0; --y) for (int x = 0; x < w; ++x) { int16_t tileID = tableGetWrapped(data, x+ox, y+oy, z); From 064b7ac80d21f47188cdfa091ea539252b2530f7 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Wed, 3 Jun 2015 16:01:29 +0200 Subject: [PATCH 05/10] README: Add link to dependency kit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 9fb46c1..c66aad4 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ These depend on the SDL auxiliary libraries. For maximum RGSS compliance, build To run mkxp, you should have a graphics card capable of at least **OpenGL (ES) 2.0** with an up-to-date driver installed. +## Dependency kit + +To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://www.dropbox.com/s/mtp44ur367m2zts/mkxp-depkit.tar.xz). Read the "README" for instructions. + ## Configuration mkxp reads configuration data from the file "mkxp.conf". The format is ini-style. Do *not* use quotes around file paths (spaces won't break). Lines starting with '#' are comments. See 'mkxp.conf.sample' for a list of accepted entries. From 6380a93cec1163c40da9762793fdf752045a9997 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Wed, 10 Jun 2015 13:23:39 +0200 Subject: [PATCH 06/10] Graphics: Fix ::transition() "filename" default value The default value is an empty string, which triggers the simple transition. Passing null is not legal (and wasn't possible in mkxp from Ruby side anyway). Fixes #108. --- binding-mri/graphics-binding.cpp | 2 +- binding-mruby/graphics-binding.cpp | 2 +- src/graphics.cpp | 2 +- src/graphics.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index c28be77..a585e17 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -48,7 +48,7 @@ RB_METHOD(graphicsTransition) RB_UNUSED_PARAM; int duration = 8; - const char *filename = 0; + const char *filename = ""; int vague = 40; rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END); diff --git a/binding-mruby/graphics-binding.cpp b/binding-mruby/graphics-binding.cpp index 632283c..035da21 100644 --- a/binding-mruby/graphics-binding.cpp +++ b/binding-mruby/graphics-binding.cpp @@ -45,7 +45,7 @@ MRB_FUNCTION(graphicsFreeze) MRB_FUNCTION(graphicsTransition) { mrb_int duration = 8; - const char *filename = 0; + const char *filename = ""; mrb_int vague = 40; mrb_get_args(mrb, "|izi", &duration, &filename, &vague); diff --git a/src/graphics.cpp b/src/graphics.cpp index 41fcc72..1862629 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -716,7 +716,7 @@ void Graphics::transition(int duration, return; vague = clamp(vague, 1, 256); - Bitmap *transMap = filename ? new Bitmap(filename) : 0; + Bitmap *transMap = *filename ? new Bitmap(filename) : 0; setBrightness(255); diff --git a/src/graphics.h b/src/graphics.h index 05436bc..e914178 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -37,7 +37,7 @@ public: void update(); void freeze(); void transition(int duration = 8, - const char *filename = 0, + const char *filename = "", int vague = 40); void frameReset(); From e778dc17c54a446cb49eadd662054f2ddf1ff40a Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Thu, 18 Jun 2015 07:11:38 +0200 Subject: [PATCH 07/10] Relocate SDL_sound patches into forked repo --- README.md | 2 +- patches/SDL_sound/ima-adpcm.patch | 365 ------------------------------ patches/SDL_sound/pkgconfig.patch | 54 ----- 3 files changed, 1 insertion(+), 420 deletions(-) delete mode 100644 patches/SDL_sound/ima-adpcm.patch delete mode 100644 patches/SDL_sound/pkgconfig.patch diff --git a/README.md b/README.md index c66aad4..fede712 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ This binding only exists for testing purposes and does nothing (the engine quits * SDL2* * SDL2_image * SDL2_ttf -* SDL_sound (latest hg, apply provided patches!) +* [my SDL_sound fork](https://github.com/Ancurio/SDL_sound) * vorbisfile * pixman * zlib (only ruby bindings) diff --git a/patches/SDL_sound/ima-adpcm.patch b/patches/SDL_sound/ima-adpcm.patch deleted file mode 100644 index bf6ba73..0000000 --- a/patches/SDL_sound/ima-adpcm.patch +++ /dev/null @@ -1,365 +0,0 @@ -diff -r 719dade41745 decoders/wav.c ---- a/decoders/wav.c Wed Aug 15 23:52:18 2012 -0400 -+++ b/decoders/wav.c Fri Sep 12 06:50:35 2014 +0200 -@@ -113,8 +113,9 @@ - - #define fmtID 0x20746D66 /* "fmt ", in ascii. */ - --#define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */ --#define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */ -+#define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */ -+#define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */ -+#define FMT_IMA 0x0011 /* IMA ADPCM compressed waveform data. */ - - typedef struct - { -@@ -130,6 +131,12 @@ - Sint16 iSamp2; - } ADPCMBLOCKHEADER; - -+typedef struct -+{ -+ Sint16 iPrevSamp; -+ Uint8 iStepIndex; -+} IMAADPCMDATA; -+ - typedef struct S_WAV_FMT_T - { - Uint32 chunkID; -@@ -166,6 +173,25 @@ - Sint8 nibble; - } adpcm; - -+ struct -+ { -+ /* per channel decoder state */ -+ IMAADPCMDATA *d; -+ /* auxiliary buffer */ -+ Uint8 *buf; -+ -+ Uint16 block_frames; -+ Uint16 block_framesets; -+ Uint16 enc_frameset_size; -+ Uint16 headerset_size; -+ Uint16 dec_frame_size; -+ Uint16 dec_frameset_size; -+ Uint16 rem_block_framesets; -+ -+ /* whether the next word(s) are the start of a new block */ -+ int read_header; -+ } ima; -+ - /* put other format-specific data here... */ - } fmt; - } fmt_t; -@@ -614,6 +640,296 @@ - - - /***************************************************************************** -+ * IMA ADPCM compression handler... * -+ *****************************************************************************/ -+ -+static const int ima_index_table[16] = -+{ -+ -1, -1, -1, -1, 2, 4, 6, 8, -+ -1, -1, -1, -1, 2, 4, 6, 8 -+}; -+ -+static const int ima_step_table[89] = -+{ -+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, -+ 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, -+ 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, -+ 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, -+ 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, -+ 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, -+ 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, -+ 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, -+ 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -+}; -+ -+/* 1 frameset = 4 bytes (per channel) = 8 nibbles = 8 frames */ -+#define FRAMESET_FRAMES 8 -+ -+ -+static int read_ima_block_headers(SDL_RWops *rw, IMAADPCMDATA *d, -+ Uint16 chan_count, Sint16 *out) -+{ -+ Uint16 i; -+ Uint8 dummy; -+ -+ for (i = 0; i < chan_count; i++) -+ { -+ BAIL_IF_MACRO(!read_le16(rw, &d[i].iPrevSamp), NULL, 0); -+ BAIL_IF_MACRO(!read_uint8(rw, &d[i].iStepIndex), NULL, 0); -+ BAIL_IF_MACRO(!read_uint8(rw, &dummy), NULL, 0); -+ -+ out[i] = d[i].iPrevSamp; -+ } /* for */ -+ -+ return(1); -+} /* read_ima_block_headers */ -+ -+ -+static Sint16 decode_ima_nibble(Uint8 nibble, IMAADPCMDATA *state) -+{ -+ int step = ima_step_table[state->iStepIndex]; -+ int diff = 0; -+ int samp, index; -+ -+ if (nibble & 0x4) -+ diff += step >> 0; -+ if (nibble & 0x2) -+ diff += step >> 1; -+ if (nibble & 0x1) -+ diff += step >> 2; -+ -+ diff += step >> 3; -+ -+ if (nibble & 0x8) -+ diff = -diff; -+ -+ samp = state->iPrevSamp + diff; -+ samp = SDL_max(SDL_min(samp, 32767), -32768); -+ state->iPrevSamp = samp; -+ -+ index = state->iStepIndex + ima_index_table[nibble]; -+ state->iStepIndex = SDL_max(SDL_min(index, 88), 0); -+ -+ return samp; -+} /* decode_ima_nibble */ -+ -+ -+static int read_ima_frameset(SDL_RWops *rw, wav_t *wav, Sint16 *out) -+{ -+ fmt_t *fmt = wav->fmt; -+ Uint16 i, j; -+ Uint8 *fs_buf = fmt->fmt.ima.buf; -+ Uint32 fs_buf_size = fmt->fmt.ima.enc_frameset_size; -+ Uint16 chan_count = fmt->wChannels; -+ IMAADPCMDATA *data = fmt->fmt.ima.d; -+ -+ /* read encoded frameset into temp buffer */ -+ BAIL_IF_MACRO(!SDL_RWread(rw, fs_buf, fs_buf_size, 1), NULL, 0); -+ -+ for (i = 0; i < chan_count; i++) -+ { -+ for (j = 0; j < 4; j++) -+ { -+ Uint8 byte = fs_buf[i*4+j]; -+ Sint16 *_out = out + j*chan_count*2+i; -+ -+ /* low nibble */ -+ *_out = decode_ima_nibble(byte & 0xF, &data[i]); -+ -+ _out += chan_count; -+ -+ /* high nibble */ -+ *_out = decode_ima_nibble(byte >> 4, &data[i]); -+ } -+ } /* for */ -+ -+ return(1); -+} /* read_ima_frameset */ -+ -+ -+static Uint32 read_sample_fmt_ima(Sound_Sample *sample) -+{ -+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; -+ wav_t *w = (wav_t *) internal->decoder_private; -+ fmt_t *fmt = w->fmt; -+ void *const out_buf = internal->buffer; -+ Uint32 bw = 0; -+ int rc; -+ -+ while (1) -+ { -+ if (fmt->fmt.ima.read_header) -+ { -+ if (w->bytesLeft < fmt->fmt.ima.headerset_size) -+ { -+ sample->flags |= SOUND_SAMPLEFLAG_EOF; -+ break; -+ } /* if */ -+ -+ if (bw+fmt->fmt.ima.dec_frame_size > internal->buffer_size) -+ break; -+ -+ rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d, -+ fmt->wChannels, (Sint16*) (out_buf+bw)); -+ -+ if (!rc) -+ { -+ sample->flags |= SOUND_SAMPLEFLAG_ERROR; -+ return 0; -+ } /* if */ -+ -+ w->bytesLeft -= fmt->fmt.ima.headerset_size; -+ bw += fmt->fmt.ima.dec_frame_size; -+ -+ fmt->fmt.ima.read_header = 0; -+ fmt->fmt.ima.rem_block_framesets = fmt->fmt.ima.block_framesets; -+ } /* if */ -+ -+ if (w->bytesLeft < fmt->fmt.ima.enc_frameset_size) -+ { -+ sample->flags |= SOUND_SAMPLEFLAG_EOF; -+ break; -+ } /* if */ -+ -+ if (bw+fmt->fmt.ima.dec_frameset_size > internal->buffer_size) -+ break; -+ -+ rc = read_ima_frameset(internal->rw, w, (Sint16*) (out_buf+bw)); -+ -+ if (!rc) -+ { -+ sample->flags |= SOUND_SAMPLEFLAG_ERROR; -+ return 0; -+ } /* if */ -+ -+ bw += fmt->fmt.ima.dec_frameset_size; -+ w->bytesLeft -= fmt->fmt.ima.enc_frameset_size; -+ -+ if (--fmt->fmt.ima.rem_block_framesets == 0) -+ fmt->fmt.ima.read_header = 1; -+ } /* while */ -+ -+ return(bw); -+} /* read_sample_fmt_ima */ -+ -+ -+static void free_fmt_ima(fmt_t *fmt) -+{ -+ free(fmt->fmt.ima.d); -+ free(fmt->fmt.ima.buf); -+} /* free_fmt_ima */ -+ -+ -+static int rewind_sample_fmt_ima(Sound_Sample *sample) -+{ -+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; -+ wav_t *w = (wav_t *) internal->decoder_private; -+ fmt_t *fmt = w->fmt; -+ -+ fmt->fmt.ima.read_header = 1; -+ -+ return(1); -+} /* rewind_sample_fmt_ima */ -+ -+ -+static int seek_sample_fmt_ima(Sound_Sample *sample, Uint32 ms) -+{ -+ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; -+ wav_t *w = (wav_t *) internal->decoder_private; -+ fmt_t *fmt = w->fmt; -+ Sint16 *dummy_buf = (Sint16*) (fmt->fmt.ima.buf + -+ fmt->fmt.ima.enc_frameset_size); -+ Uint32 i; -+ int rc, pos; -+ -+ Uint32 seek_frames = (fmt->dwSamplesPerSec * ms) / 1000; -+ Uint32 seek_blocks = seek_frames / fmt->fmt.ima.block_frames; -+ Uint32 seek_framesets; -+ seek_frames %= fmt->fmt.ima.block_frames; -+ -+ w->bytesLeft = fmt->total_bytes; -+ pos = seek_blocks * fmt->wBlockAlign + fmt->data_starting_offset; -+ rc = SDL_RWseek(internal->rw, pos, SEEK_SET); -+ BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0); -+ w->bytesLeft -= seek_blocks * fmt->wBlockAlign; -+ -+ fmt->fmt.ima.read_header = 0; -+ -+ if (seek_frames == 0) -+ { -+ fmt->fmt.ima.read_header = 1; -+ return(1); -+ } /* if */ -+ -+ rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d, -+ fmt->wChannels, dummy_buf); -+ BAIL_IF_MACRO(!rc, NULL, 0); -+ w->bytesLeft -= fmt->fmt.ima.headerset_size; -+ -+ if (w->bytesLeft < fmt->fmt.ima.headerset_size) -+ { -+ sample->flags |= SOUND_SAMPLEFLAG_EOF; -+ return(1); -+ } /* if */ -+ -+ seek_frames -= 1; -+ seek_framesets = seek_frames / FRAMESET_FRAMES; -+ -+ for (i = 0; i < seek_framesets; i++) -+ { -+ rc = read_ima_frameset(internal->rw, w, dummy_buf); -+ BAIL_IF_MACRO(!rc, NULL, 0); -+ w->bytesLeft -= fmt->fmt.ima.enc_frameset_size; -+ } /* for */ -+ -+ fmt->fmt.ima.rem_block_framesets = -+ fmt->fmt.ima.block_framesets - seek_framesets; -+ -+ if (w->bytesLeft < fmt->fmt.ima.enc_frameset_size) -+ sample->flags |= SOUND_SAMPLEFLAG_EOF; -+ -+ return(1); /* success. */ -+} /* seek_sample_fmt_ima */ -+ -+ -+static int read_fmt_ima(SDL_RWops *rw, fmt_t *fmt) -+{ -+ Uint16 chan = fmt->wChannels; -+ Sint16 extraBytes; -+ int rc; -+ -+ /* setup function pointers */ -+ fmt->free = free_fmt_ima; -+ fmt->read_sample = read_sample_fmt_ima; -+ fmt->rewind_sample = rewind_sample_fmt_ima; -+ fmt->seek_sample = seek_sample_fmt_ima; -+ -+ BAIL_IF_MACRO(!read_le16(rw, &extraBytes), NULL, 0); -+ BAIL_IF_MACRO(!read_le16(rw, &fmt->fmt.ima.block_frames), NULL, 0); -+ -+ /* skip to end of fmt chunk */ -+ rc = SDL_RWseek(rw, extraBytes-2, SEEK_CUR); -+ BAIL_IF_MACRO(!rc, NULL, 0); -+ -+ fmt->fmt.ima.block_framesets = (fmt->fmt.ima.block_frames-1) / FRAMESET_FRAMES; -+ fmt->fmt.ima.enc_frameset_size = 4 * chan; -+ fmt->fmt.ima.headerset_size = 4 * chan; -+ fmt->fmt.ima.dec_frame_size = sizeof(Uint16) * chan; -+ fmt->fmt.ima.dec_frameset_size = fmt->fmt.ima.dec_frame_size * FRAMESET_FRAMES; -+ fmt->fmt.ima.read_header = 1; -+ -+ fmt->fmt.ima.d = malloc(sizeof(IMAADPCMDATA) * chan); -+ -+ size_t buf_size = fmt->fmt.ima.enc_frameset_size + -+ fmt->fmt.ima.dec_frameset_size; -+ fmt->fmt.ima.buf = malloc(buf_size); -+ -+ return(1); -+} /* read_fmt_ima */ -+ -+ -+ -+/***************************************************************************** - * Everything else... * - *****************************************************************************/ - -@@ -642,6 +958,13 @@ - SNDDBG(("WAV: Appears to be ADPCM compressed audio.\n")); - return(read_fmt_adpcm(rw, fmt)); - -+ case FMT_IMA: -+ if (fmt->wBitsPerSample == 4) -+ { -+ SNDDBG(("WAV: Appears to be 4bit IMA ADPCM compressed audio.\n")); -+ return(read_fmt_ima(rw, fmt)); -+ } -+ - /* add other types here. */ - - default: diff --git a/patches/SDL_sound/pkgconfig.patch b/patches/SDL_sound/pkgconfig.patch deleted file mode 100644 index d338329..0000000 --- a/patches/SDL_sound/pkgconfig.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff -r 719dade41745 Makefile.am ---- a/Makefile.am Wed Aug 15 23:52:18 2012 -0400 -+++ b/Makefile.am Thu Nov 28 18:42:40 2013 +0100 -@@ -1,8 +1,8 @@ - lib_LTLIBRARIES = libSDL_sound.la - --SUBDIRS = decoders . playsound -+SUBDIRS = decoders . - --libSDL_soundincludedir = $(includedir)/SDL -+libSDL_soundincludedir = $(includedir)/SDL2 - libSDL_soundinclude_HEADERS = \ - SDL_sound.h - -@@ -49,3 +49,5 @@ - echo >> $(distdir)/docs/README - rm -rf `find $(distdir) -type d -name ".svn"` - -+pkgconfigdir = $(libdir)/pkgconfig -+pkgconfig_DATA = SDL_sound.pc -diff -r 719dade41745 SDL_sound.pc.in ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/SDL_sound.pc.in Thu Nov 28 18:42:40 2013 +0100 -@@ -0,0 +1,11 @@ -+prefix=@prefix@ -+exec_prefix=@exec_prefix@ -+libdir=@libdir@ -+includedir=@includedir@ -+ -+Name: SDL_sound -+Description: audio decoding library for Simple DirectMedia Layer -+Version: @VERSION@ -+Requires: sdl2 >= @SDL_VERSION@ -+Libs: -L${libdir} -lSDL_sound -+Cflags: -I${includedir}/SDL2 -diff -r 719dade41745 configure.in ---- a/configure.in Wed Aug 15 23:52:18 2012 -0400 -+++ b/configure.in Thu Nov 28 18:42:40 2013 +0100 -@@ -107,7 +107,8 @@ - dnl --------------------------------------------------------------------- - - dnl Check for SDL --SDL_VERSION=1.2.0 -+SDL_VERSION=2.0.0 -+AC_SUBST(SDL_VERSION) - AM_PATH_SDL($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) -@@ -339,4 +340,5 @@ - decoders/timidity/Makefile - decoders/libmpg123/Makefile - playsound/Makefile -+SDL_sound.pc - ]) From 2d31d08fa65412e35189fcaff86b0df7b4c0590c Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Thu, 18 Jun 2015 07:21:55 +0200 Subject: [PATCH 08/10] Add some general fixes from #111 found by @chosenofbear --- src/sdl-util.h | 2 +- src/vorbissource.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl-util.h b/src/sdl-util.h index 1ed615d..4c94d39 100644 --- a/src/sdl-util.h +++ b/src/sdl-util.h @@ -44,7 +44,7 @@ int __sdlThreadFun(void *obj) template SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string()) { - return SDL_CreateThread(__sdlThreadFun, name.c_str(), obj); + return SDL_CreateThread((__sdlThreadFun), name.c_str(), obj); } /* On Android, SDL_RWFromFile always opens files from inside diff --git a/src/vorbissource.cpp b/src/vorbissource.cpp index 07dcdb4..7716a69 100644 --- a/src/vorbissource.cpp +++ b/src/vorbissource.cpp @@ -25,6 +25,7 @@ #define OV_EXCLUDE_STATIC_CALLBACKS #include #include +#include static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *ops) { From 61849a915811bf7a422086ee3e4f64fd00fd5732 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 7 Jul 2015 15:25:48 +0200 Subject: [PATCH 09/10] GLMeta: Eliminate redundant parameter --- src/gl-meta.cpp | 4 ++-- src/gl-meta.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gl-meta.cpp b/src/gl-meta.cpp index 1bfe9cd..8733449 100644 --- a/src/gl-meta.cpp +++ b/src/gl-meta.cpp @@ -175,9 +175,9 @@ void blitSource(TEXFBO &source) } } -void blitRectangle(const IntRect &src, const Vec2i &dstPos, bool smooth) +void blitRectangle(const IntRect &src, const Vec2i &dstPos) { - blitRectangle(src, IntRect(dstPos.x, dstPos.y, src.w, src.h), smooth); + blitRectangle(src, IntRect(dstPos.x, dstPos.y, src.w, src.h), false); } void blitRectangle(const IntRect &src, const IntRect &dst, bool smooth) diff --git a/src/gl-meta.h b/src/gl-meta.h index ca683bc..a30e478 100644 --- a/src/gl-meta.h +++ b/src/gl-meta.h @@ -68,8 +68,7 @@ void vaoUnbind(VAO &vao); void blitBegin(TEXFBO &target); void blitBeginScreen(const Vec2i &size); void blitSource(TEXFBO &source); -void blitRectangle(const IntRect &src, const Vec2i &dstPos, - bool smooth = false); +void blitRectangle(const IntRect &src, const Vec2i &dstPos); void blitRectangle(const IntRect &src, const IntRect &dst, bool smooth = false); void blitEnd(); From afab51279e5879488cf738079eac0a1e7ec897ba Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 7 Jul 2015 15:53:15 +0200 Subject: [PATCH 10/10] Graphics: Fix viewport color/flash effectiveness calculation Fixes #121. --- src/graphics.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index 1862629..4d7eb59 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -174,7 +174,12 @@ public: const IntRect &viewpRect = glState.scissorBox.get(); const IntRect &screenRect = geometry.rect; - if (t.w != 0.0) + bool toneRGBEffect = t.xyzHasEffect(); + bool toneGrayEffect = t.w != 0; + bool colorEffect = c.w > 0; + bool flashEffect = f.w > 0; + + if (toneGrayEffect) { pp.swapRender(); @@ -206,19 +211,14 @@ public: glState.blend.pop(); } - bool toneEffect = t.xyzHasEffect(); - bool colorEffect = c.xyzHasEffect(); - bool flashEffect = f.xyzHasEffect(); - - if (!toneEffect && !colorEffect && !flashEffect) + if (!toneRGBEffect && !colorEffect && !flashEffect) return; FlatColorShader &shader = shState->shaders().flatColor; shader.bind(); shader.applyViewportProj(); - /* Apply tone */ - if (toneEffect) + if (toneRGBEffect) { /* First split up additive / substractive components */ Vec4 add, sub;