Merge commit 'afab51279e5879488cf738079eac0a1e7ec897ba'

Pull in some fixes from upstream (but not too many :)
This commit is contained in:
Jonas Kulla 2015-08-03 04:10:13 +02:00
commit 213ee81f1c
19 changed files with 32 additions and 444 deletions

View File

@ -44,7 +44,7 @@ This binding only exists for testing purposes and does nothing (the engine quits
* SDL2* * SDL2*
* SDL2_image * SDL2_image
* SDL2_ttf * SDL2_ttf
* SDL_sound (latest hg, apply provided patches!) * [my SDL_sound fork](https://github.com/Ancurio/SDL_sound)
* vorbisfile * vorbisfile
* pixman * pixman
* zlib (only ruby bindings) * zlib (only ruby bindings)
@ -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. 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 ## 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. 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.

View File

@ -191,7 +191,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
if (!RB_TYPE_P(tmp, RUBY_T_STRING)) if (!RB_TYPE_P(tmp, RUBY_T_STRING))
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI); rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
*s = StringValueCStr(tmp); *s = RSTRING_PTR(tmp);
++argI; ++argI;
break; break;

View File

@ -32,7 +32,7 @@ DEF_TYPE(Bitmap);
static const char *objAsStringPtr(VALUE obj) static const char *objAsStringPtr(VALUE obj)
{ {
VALUE str = rb_obj_as_string(obj); VALUE str = rb_obj_as_string(obj);
return StringValueCStr(str); return RSTRING_PTR(str);
} }
void bitmapInitProps(Bitmap *b, VALUE self) void bitmapInitProps(Bitmap *b, VALUE self)

View File

@ -48,7 +48,7 @@ RB_METHOD(graphicsTransition)
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int duration = 8; int duration = 8;
const char *filename = 0; const char *filename = "";
int vague = 40; int vague = 40;
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END); rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);

View File

@ -45,7 +45,7 @@ MRB_FUNCTION(graphicsFreeze)
MRB_FUNCTION(graphicsTransition) MRB_FUNCTION(graphicsTransition)
{ {
mrb_int duration = 8; mrb_int duration = 8;
const char *filename = 0; const char *filename = "";
mrb_int vague = 40; mrb_int vague = 40;
mrb_get_args(mrb, "|izi", &duration, &filename, &vague); mrb_get_args(mrb, "|izi", &duration, &filename, &vague);

View File

@ -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:

View File

@ -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
])

View File

@ -236,7 +236,6 @@ void ALStream::openSource(const std::string &filename)
char buf[512]; char buf[512];
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s.%s: %s", snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s.%s: %s",
filename.c_str(), ext, e.msg.c_str()); filename.c_str(), ext, e.msg.c_str());
buf[sizeof(buf)-1] = '\0';
Debug() << buf; Debug() << buf;
} }

View File

@ -28,6 +28,8 @@
#include <SDL_thread.h> #include <SDL_thread.h>
#include <SDL_touch.h> #include <SDL_touch.h>
#include <al.h>
#include <alc.h>
#include <alext.h> #include <alext.h>
#include "sharedstate.h" #include "sharedstate.h"

View File

@ -611,7 +611,6 @@ static void fontSetEnumCB(void *data, const char *,
char filename[512]; char filename[512];
snprintf(filename, sizeof(filename), "Fonts/%s", fname); snprintf(filename, sizeof(filename), "Fonts/%s", fname);
filename[sizeof(filename)-1] = '\0';
PHYSFS_File *handle = PHYSFS_openRead(filename); PHYSFS_File *handle = PHYSFS_openRead(filename);

View File

@ -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) void blitRectangle(const IntRect &src, const IntRect &dst, bool smooth)

View File

@ -68,8 +68,7 @@ void vaoUnbind(VAO &vao);
void blitBegin(TEXFBO &target); void blitBegin(TEXFBO &target);
void blitBeginScreen(const Vec2i &size); void blitBeginScreen(const Vec2i &size);
void blitSource(TEXFBO &source); void blitSource(TEXFBO &source);
void blitRectangle(const IntRect &src, const Vec2i &dstPos, void blitRectangle(const IntRect &src, const Vec2i &dstPos);
bool smooth = false);
void blitRectangle(const IntRect &src, const IntRect &dst, void blitRectangle(const IntRect &src, const IntRect &dst,
bool smooth = false); bool smooth = false);
void blitEnd(); void blitEnd();

View File

@ -174,7 +174,12 @@ public:
const IntRect &viewpRect = glState.scissorBox.get(); const IntRect &viewpRect = glState.scissorBox.get();
const IntRect &screenRect = geometry.rect; 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(); pp.swapRender();
@ -206,19 +211,14 @@ public:
glState.blend.pop(); glState.blend.pop();
} }
bool toneEffect = t.xyzHasEffect(); if (!toneRGBEffect && !colorEffect && !flashEffect)
bool colorEffect = c.xyzHasEffect();
bool flashEffect = f.xyzHasEffect();
if (!toneEffect && !colorEffect && !flashEffect)
return; return;
FlatColorShader &shader = shState->shaders().flatColor; FlatColorShader &shader = shState->shaders().flatColor;
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
/* Apply tone */ if (toneRGBEffect)
if (toneEffect)
{ {
/* First split up additive / substractive components */ /* First split up additive / substractive components */
Vec4 add, sub; Vec4 add, sub;
@ -722,7 +722,7 @@ void Graphics::transition(int duration,
return; return;
vague = clamp(vague, 1, 256); vague = clamp(vague, 1, 256);
Bitmap *transMap = filename ? new Bitmap(filename) : 0; Bitmap *transMap = *filename ? new Bitmap(filename) : 0;
setBrightness(255); setBrightness(255);

View File

@ -37,7 +37,7 @@ public:
void update(); void update();
void freeze(); void freeze();
void transition(int duration = 8, void transition(int duration = 8,
const char *filename = 0, const char *filename = "",
int vague = 40); int vague = 40);
void frameReset(); void frameReset();

View File

@ -44,7 +44,7 @@ int __sdlThreadFun(void *obj)
template<class C, void (C::*func)()> template<class C, void (C::*func)()>
SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string()) SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string())
{ {
return SDL_CreateThread(__sdlThreadFun<C, func>, name.c_str(), obj); return SDL_CreateThread((__sdlThreadFun<C, func>), name.c_str(), obj);
} }
/* On Android, SDL_RWFromFile always opens files from inside /* On Android, SDL_RWFromFile always opens files from inside

View File

@ -533,7 +533,6 @@ struct SettingsMenuPrivate
{ {
char buf[64]; char buf[64];
snprintf(buf, sizeof(buf), "Press key or joystick button for \"%s\"", captureName); snprintf(buf, sizeof(buf), "Press key or joystick button for \"%s\"", captureName);
buf[sizeof(buf)-1] = '\0';
drawOff = Vec2i(); drawOff = Vec2i();

View File

@ -213,7 +213,6 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename)
char buf[512]; char buf[512];
snprintf(buf, sizeof(buf), "Unable to decode sound: %s.%s: %s", snprintf(buf, sizeof(buf), "Unable to decode sound: %s.%s: %s",
filename.c_str(), ext, Sound_GetError()); filename.c_str(), ext, Sound_GetError());
buf[sizeof(buf)-1] = '\0';
Debug() << buf; Debug() << buf;
return 0; return 0;

View File

@ -607,7 +607,12 @@ static void
readLayer(Reader &reader, const Table &data, readLayer(Reader &reader, const Table &data,
const Table *flags, int ox, int oy, int w, int h, int z) 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) for (int x = 0; x < w; ++x)
{ {
int16_t tileID = tableGetWrapped(data, x+ox, y+oy, z); int16_t tileID = tableGetWrapped(data, x+ox, y+oy, z);

View File

@ -25,6 +25,7 @@
#define OV_EXCLUDE_STATIC_CALLBACKS #define OV_EXCLUDE_STATIC_CALLBACKS
#include <vorbis/vorbisfile.h> #include <vorbis/vorbisfile.h>
#include <vector> #include <vector>
#include <algorithm>
static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *ops) static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *ops)
{ {