gosu 1.4.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL_sound/SDL_sound.c +21 -63
  3. data/dependencies/SDL_sound/SDL_sound.h +2 -2
  4. data/dependencies/SDL_sound/SDL_sound_aiff.c +26 -23
  5. data/dependencies/SDL_sound/SDL_sound_au.c +8 -8
  6. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +4 -5
  7. data/dependencies/SDL_sound/SDL_sound_flac.c +28 -30
  8. data/dependencies/SDL_sound/SDL_sound_internal.h +4 -4
  9. data/dependencies/SDL_sound/SDL_sound_modplug.c +1 -1
  10. data/dependencies/SDL_sound/SDL_sound_mp3.c +19 -23
  11. data/dependencies/SDL_sound/SDL_sound_raw.c +5 -6
  12. data/dependencies/SDL_sound/SDL_sound_shn.c +4 -4
  13. data/dependencies/SDL_sound/SDL_sound_voc.c +15 -15
  14. data/dependencies/SDL_sound/SDL_sound_vorbis.c +14 -7
  15. data/dependencies/SDL_sound/SDL_sound_wav.c +17 -17
  16. data/dependencies/SDL_sound/dr_flac.h +10840 -4779
  17. data/dependencies/SDL_sound/dr_mp3.h +2793 -1004
  18. data/dependencies/SDL_sound/libmodplug/fastmix.c +5 -0
  19. data/dependencies/SDL_sound/libmodplug/load_669.c +1 -1
  20. data/dependencies/SDL_sound/libmodplug/load_amf.c +1 -0
  21. data/dependencies/SDL_sound/libmodplug/load_ams.c +38 -22
  22. data/dependencies/SDL_sound/libmodplug/load_it.c +18 -14
  23. data/dependencies/SDL_sound/libmodplug/load_mdl.c +18 -9
  24. data/dependencies/SDL_sound/libmodplug/load_med.c +7 -6
  25. data/dependencies/SDL_sound/libmodplug/load_mt2.c +36 -17
  26. data/dependencies/SDL_sound/libmodplug/load_okt.c +51 -24
  27. data/dependencies/SDL_sound/libmodplug/load_psm.c +4 -2
  28. data/dependencies/SDL_sound/libmodplug/load_s3m.c +4 -4
  29. data/dependencies/SDL_sound/libmodplug/load_ult.c +4 -3
  30. data/dependencies/SDL_sound/libmodplug/load_xm.c +5 -5
  31. data/dependencies/SDL_sound/libmodplug/snd_fx.c +8 -1
  32. data/dependencies/SDL_sound/libmodplug/sndfile.c +21 -4
  33. data/dependencies/SDL_sound/stb_vorbis.h +10 -18
  34. data/dependencies/mojoAL/mojoal.c +260 -6
  35. data/dependencies/stb/stb_image.h +208 -73
  36. data/dependencies/stb/stb_image_write.h +57 -23
  37. data/dependencies/stb/stb_truetype.h +345 -279
  38. data/dependencies/utf8proc/utf8proc.c +37 -18
  39. data/dependencies/utf8proc/utf8proc.h +17 -5
  40. data/dependencies/utf8proc/utf8proc_data.h +12012 -10089
  41. data/include/Gosu/Buttons.hpp +103 -103
  42. data/include/Gosu/Directories.hpp +31 -24
  43. data/include/Gosu/Font.hpp +4 -2
  44. data/include/Gosu/Gosu.hpp +5 -8
  45. data/include/Gosu/IO.hpp +0 -3
  46. data/include/Gosu/Math.hpp +0 -3
  47. data/include/Gosu/Timing.hpp +2 -8
  48. data/include/Gosu/Version.hpp +1 -1
  49. data/src/AudioImpl.cpp +0 -7
  50. data/src/AudioImpl.hpp +1 -3
  51. data/src/BitmapIO.cpp +23 -2
  52. data/src/DirectoriesApple.cpp +25 -24
  53. data/src/DirectoriesUnix.cpp +14 -12
  54. data/src/DirectoriesWin.cpp +26 -30
  55. data/src/Font.cpp +12 -2
  56. data/src/Image.cpp +10 -15
  57. data/src/RubyGosu.cxx +6 -34
  58. data/src/TimingApple.cpp +1 -7
  59. data/src/TimingUnix.cpp +0 -6
  60. data/src/TimingWin.cpp +0 -6
  61. data/src/Window.cpp +4 -3
  62. metadata +2 -2
@@ -28,9 +28,9 @@
28
28
 
29
29
  #if SOUND_SUPPORTS_RAW
30
30
 
31
- static int RAW_init(void)
31
+ static SDL_bool RAW_init(void)
32
32
  {
33
- return 1; /* always succeeds. */
33
+ return SDL_TRUE; /* always succeeds. */
34
34
  } /* RAW_init */
35
35
 
36
36
 
@@ -80,8 +80,7 @@ static int RAW_open(Sound_Sample *sample, const char *ext)
80
80
  BAIL_MACRO("RAW: can't reset file.", 0);
81
81
  }
82
82
 
83
- sample_rate = (sample->actual.rate * sample->actual.channels
84
- * ( (sample->actual.format & 0x0018) >> 3) );
83
+ sample_rate = (sample->actual.rate * sample->actual.channels * ((sample->actual.format & 0x0018) >> 3));
85
84
  internal->total_time = ( pos ) / sample_rate * 1000;
86
85
  internal->total_time += (pos % sample_rate) * 1000 / sample_rate;
87
86
 
@@ -133,8 +132,8 @@ static int RAW_rewind(Sound_Sample *sample)
133
132
  static int RAW_seek(Sound_Sample *sample, Uint32 ms)
134
133
  {
135
134
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
136
- int pos = (int) __Sound_convertMsToBytePos(&sample->actual, ms);
137
- int err = (SDL_RWseek(internal->rw, pos, RW_SEEK_SET) != pos);
135
+ const Sint64 pos = __Sound_convertMsToBytePos(&sample->actual, ms);
136
+ const int err = (SDL_RWseek(internal->rw, pos, RW_SEEK_SET) != pos);
138
137
  BAIL_IF_MACRO(err, ERR_IO_ERROR, 0);
139
138
  return 1;
140
139
  } /* RAW_seek */
@@ -57,7 +57,7 @@ typedef struct
57
57
  Uint8 *backBuffer;
58
58
  Uint32 backBufferSize;
59
59
  Uint32 backBufLeft;
60
- Uint32 start_pos;
60
+ Sint64 start_pos;
61
61
  } shn_t;
62
62
 
63
63
 
@@ -282,9 +282,9 @@ static SDL_INLINE int uint_get(int nbit, shn_t *shn, SDL_RWops *rw, Sint32 *w)
282
282
  } /* uint_get */
283
283
 
284
284
 
285
- static int SHN_init(void)
285
+ static SDL_bool SHN_init(void)
286
286
  {
287
- return 1; /* initialization always successful. */
287
+ return SDL_TRUE; /* initialization always successful. */
288
288
  } /* SHN_init */
289
289
 
290
290
 
@@ -1257,7 +1257,7 @@ static int SHN_rewind(Sound_Sample *sample)
1257
1257
 
1258
1258
  #if 0
1259
1259
  shn_t *shn = (shn_t *) internal->decoder_private;
1260
- int rc = SDL_RWseek(internal->rw, shn->start_pos, RW_SEEK_SET);
1260
+ Sint64 rc = SDL_RWseek(internal->rw, shn->start_pos, RW_SEEK_SET);
1261
1261
  BAIL_IF_MACRO(rc != shn->start_pos, ERR_IO_ERROR, 0);
1262
1262
  /* !!! FIXME: set state. */
1263
1263
  return 1;
@@ -39,7 +39,7 @@ typedef struct vocstuff {
39
39
  Uint8 channels; /* number of sound channels */
40
40
  int extended; /* Has an extended block been read? */
41
41
  Uint32 bufpos; /* byte position in internal->buffer. */
42
- Uint32 start_pos; /* offset to seek to in stream when rewinding. */
42
+ Sint64 start_pos; /* offset to seek to in stream when rewinding. */
43
43
  int error; /* error condition (as opposed to EOF). */
44
44
  } vs_t;
45
45
 
@@ -77,9 +77,9 @@ typedef struct vocstuff {
77
77
  #define VOC_DATA_16 9
78
78
 
79
79
 
80
- static int VOC_init(void)
80
+ static SDL_bool VOC_init(void)
81
81
  {
82
- return 1; /* always succeeds. */
82
+ return SDL_TRUE; /* always succeeds. */
83
83
  } /* VOC_init */
84
84
 
85
85
 
@@ -191,8 +191,7 @@ static int voc_get_block(Sound_Sample *sample, vs_t *v)
191
191
  v->rest = sblen - 2;
192
192
  v->size = ST_SIZE_BYTE;
193
193
 
194
- bytes_per_second = sample->actual.rate
195
- * sample->actual.channels;
194
+ bytes_per_second = sample->actual.rate * sample->actual.channels;
196
195
  internal->total_time += ( v->rest ) / bytes_per_second * 1000;
197
196
  internal->total_time += (v->rest % bytes_per_second) * 1000
198
197
  / bytes_per_second;
@@ -342,7 +341,7 @@ static int voc_read_waveform(Sound_Sample *sample, int fill_buf, Uint32 max)
342
341
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
343
342
  SDL_RWops *src = internal->rw;
344
343
  vs_t *v = (vs_t *) internal->decoder_private;
345
- int done = 0;
344
+ Sint64 done = 0;
346
345
  Uint8 silence = 0x80;
347
346
  Uint8 *buf = internal->buffer;
348
347
 
@@ -355,7 +354,8 @@ static int voc_read_waveform(Sound_Sample *sample, int fill_buf, Uint32 max)
355
354
  if (v->rest == 0)
356
355
  return 0;
357
356
 
358
- max = (v->rest < max) ? v->rest : max;
357
+ if (v->rest < max)
358
+ max = v->rest;
359
359
 
360
360
  if (v->silent)
361
361
  {
@@ -366,8 +366,8 @@ static int voc_read_waveform(Sound_Sample *sample, int fill_buf, Uint32 max)
366
366
  if (fill_buf)
367
367
  SDL_memset(buf + v->bufpos, silence, max);
368
368
 
369
- done = max;
370
- v->rest -= done;
369
+ done = (Sint64) max;
370
+ v->rest -= max;
371
371
  } /* if */
372
372
 
373
373
  else
@@ -375,7 +375,7 @@ static int voc_read_waveform(Sound_Sample *sample, int fill_buf, Uint32 max)
375
375
  if (fill_buf)
376
376
  {
377
377
  done = SDL_RWread(src, buf + v->bufpos, 1, max);
378
- if (done < max)
378
+ if (done < ((Sint64) max))
379
379
  {
380
380
  __Sound_SetError("VOC: i/o error");
381
381
  sample->flags |= SOUND_SAMPLEFLAG_ERROR;
@@ -384,7 +384,7 @@ static int voc_read_waveform(Sound_Sample *sample, int fill_buf, Uint32 max)
384
384
 
385
385
  else
386
386
  {
387
- int cur, rc;
387
+ Sint64 cur, rc;
388
388
  cur = SDL_RWtell(src);
389
389
  if (cur >= 0)
390
390
  {
@@ -482,7 +482,7 @@ static int VOC_rewind(Sound_Sample *sample)
482
482
  {
483
483
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
484
484
  vs_t *v = (vs_t *) internal->decoder_private;
485
- int rc = SDL_RWseek(internal->rw, v->start_pos, RW_SEEK_SET);
485
+ const Sint64 rc = SDL_RWseek(internal->rw, v->start_pos, RW_SEEK_SET);
486
486
  BAIL_IF_MACRO(rc != v->start_pos, ERR_IO_ERROR, 0);
487
487
  v->rest = 0;
488
488
  return 1;
@@ -503,9 +503,9 @@ static int VOC_seek(Sound_Sample *sample, Uint32 ms)
503
503
 
504
504
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
505
505
  vs_t *v = (vs_t *) internal->decoder_private;
506
- int offset = __Sound_convertMsToBytePos(&sample->actual, ms);
507
- int origpos = SDL_RWtell(internal->rw);
508
- int origrest = v->rest;
506
+ Uint32 offset = __Sound_convertMsToBytePos(&sample->actual, ms);
507
+ const Sint64 origpos = SDL_RWtell(internal->rw);
508
+ const Uint32 origrest = v->rest;
509
509
 
510
510
  BAIL_IF_MACRO(!VOC_rewind(sample), NULL, 0);
511
511
 
@@ -52,13 +52,20 @@
52
52
  #define malloc SDL_malloc
53
53
  #define realloc SDL_realloc
54
54
  #define free SDL_free
55
- /* there is no 'dealloca' in stb_vorbis: we need alloca()
56
- #ifdef alloca
57
- #undef alloca
55
+ #ifndef __WATCOMC__ /* #@!.!.. */
56
+ #define pow SDL_pow
57
+ #define floor SDL_floor
58
+ #define ldexp(v, e) SDL_scalbn((v), (e))
59
+ #define abs(x) SDL_abs(x)
60
+ #define cos(x) SDL_cos(x)
61
+ #define sin(x) SDL_sin(x)
62
+ #define log(x) SDL_log(x)
63
+ #if SDL_VERSION_ATLEAST(2, 0, 9)
64
+ #define exp SDL_exp
58
65
  #endif
59
- #define alloca(x) ((void *) SDL_stack_alloc(Uint8, (x)))
60
- */
61
66
  #endif
67
+ #endif
68
+
62
69
  #include "stb_vorbis.h"
63
70
 
64
71
  static const char *vorbis_error_string(const int err)
@@ -90,9 +97,9 @@ static const char *vorbis_error_string(const int err)
90
97
  return "VORBIS: unknown error";
91
98
  } /* vorbis_error_string */
92
99
 
93
- static int VORBIS_init(void)
100
+ static SDL_bool VORBIS_init(void)
94
101
  {
95
- return 1; /* always succeeds. */
102
+ return SDL_TRUE; /* always succeeds. */
96
103
  } /* VORBIS_init */
97
104
 
98
105
  static void VORBIS_quit(void)
@@ -99,10 +99,10 @@ typedef struct S_WAV_FMT_T
99
99
  Uint16 wBlockAlign;
100
100
  Uint16 wBitsPerSample;
101
101
 
102
- Uint32 next_chunk_offset;
102
+ Sint64 next_chunk_offset;
103
103
 
104
104
  Uint32 sample_frame_size;
105
- Uint32 data_starting_offset;
105
+ Sint64 data_starting_offset;
106
106
  Uint32 total_bytes;
107
107
 
108
108
  void (*free)(struct S_WAV_FMT_T *fmt);
@@ -243,9 +243,9 @@ static int seek_sample_fmt_normal(Sound_Sample *sample, Uint32 ms)
243
243
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
244
244
  wav_t *w = (wav_t *) internal->decoder_private;
245
245
  fmt_t *fmt = w->fmt;
246
- int offset = __Sound_convertMsToBytePos(&sample->actual, ms);
247
- int pos = (int) (fmt->data_starting_offset + offset);
248
- int rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
246
+ const Sint64 offset = __Sound_convertMsToBytePos(&sample->actual, ms);
247
+ const Sint64 pos = (fmt->data_starting_offset + offset);
248
+ const Sint64 rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
249
249
  BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0);
250
250
  w->bytesLeft = fmt->total_bytes - offset;
251
251
  return 1; /* success. */
@@ -490,13 +490,13 @@ static int seek_sample_fmt_adpcm(Sound_Sample *sample, Uint32 ms)
490
490
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
491
491
  wav_t *w = (wav_t *) internal->decoder_private;
492
492
  fmt_t *fmt = w->fmt;
493
- Uint32 origsampsleft = fmt->fmt.adpcm.samples_left_in_block;
494
- int origpos = SDL_RWtell(internal->rw);
495
- int offset = __Sound_convertMsToBytePos(&sample->actual, ms);
496
- int bpb = (fmt->fmt.adpcm.wSamplesPerBlock * fmt->sample_frame_size);
497
- int skipsize = (offset / bpb) * fmt->wBlockAlign;
498
- int pos = skipsize + fmt->data_starting_offset;
499
- int rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
493
+ const Uint32 origsampsleft = fmt->fmt.adpcm.samples_left_in_block;
494
+ const Sint64 origpos = SDL_RWtell(internal->rw);
495
+ const Sint64 offset = __Sound_convertMsToBytePos(&sample->actual, ms);
496
+ const Sint64 bpb = (fmt->fmt.adpcm.wSamplesPerBlock * fmt->sample_frame_size);
497
+ Sint64 skipsize = (offset / bpb) * fmt->wBlockAlign;
498
+ const Sint64 pos = skipsize + fmt->data_starting_offset;
499
+ Sint64 rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
500
500
  BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0);
501
501
 
502
502
  /* The offset we need is in this block, so we need to decode to there. */
@@ -573,9 +573,9 @@ static int read_fmt_adpcm(SDL_RWops *rw, fmt_t *fmt)
573
573
  * Everything else... *
574
574
  *****************************************************************************/
575
575
 
576
- static int WAV_init(void)
576
+ static SDL_bool WAV_init(void)
577
577
  {
578
- return 1; /* always succeeds. */
578
+ return SDL_TRUE; /* always succeeds. */
579
579
  } /* WAV_init */
580
580
 
581
581
 
@@ -619,7 +619,7 @@ static int find_chunk(SDL_RWops *rw, Uint32 id)
619
619
  {
620
620
  Sint32 siz = 0;
621
621
  Uint32 _id = 0;
622
- Uint32 pos = SDL_RWtell(rw);
622
+ Sint64 pos = SDL_RWtell(rw);
623
623
 
624
624
  while (1)
625
625
  {
@@ -627,7 +627,7 @@ static int find_chunk(SDL_RWops *rw, Uint32 id)
627
627
  if (_id == id)
628
628
  return 1;
629
629
 
630
- /* skip ahead and see what next chunk is... */
630
+ /* skip ahead and see what next chunk is... */
631
631
  BAIL_IF_MACRO(!read_le32s(rw, &siz), NULL, 0);
632
632
  SDL_assert(siz >= 0);
633
633
  pos += (sizeof (Uint32) * 2) + siz;
@@ -749,7 +749,7 @@ static int WAV_rewind(Sound_Sample *sample)
749
749
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
750
750
  wav_t *w = (wav_t *) internal->decoder_private;
751
751
  fmt_t *fmt = w->fmt;
752
- int rc = SDL_RWseek(internal->rw, fmt->data_starting_offset, RW_SEEK_SET);
752
+ const Sint64 rc = SDL_RWseek(internal->rw, fmt->data_starting_offset, RW_SEEK_SET);
753
753
  BAIL_IF_MACRO(rc != fmt->data_starting_offset, ERR_IO_ERROR, 0);
754
754
  w->bytesLeft = fmt->total_bytes;
755
755
  return fmt->rewind_sample(sample);