gosu 1.4.5.pre1 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/lib/SDL2.dll +0 -0
  99. data/lib64/SDL2.dll +0 -0
  100. data/src/Window.cpp +3 -0
  101. metadata +5 -4
@@ -29,12 +29,6 @@
29
29
  #define DRMP3_COPY_MEMORY(dst, src, sz) SDL_memcpy((dst), (src), (sz))
30
30
  #define DRMP3_MOVE_MEMORY(dst, src, sz) SDL_memmove((dst), (src), (sz))
31
31
  #define DRMP3_ZERO_MEMORY(p, sz) SDL_memset((p), 0, (sz))
32
- #ifndef __WATCOMC__ /* #@!.!.. */
33
- #if SDL_VERSION_ATLEAST(2, 0, 9)
34
- #define exp SDL_exp
35
- #endif
36
- #define floor SDL_floor
37
- #endif
38
32
 
39
33
  #include "dr_mp3.h"
40
34
 
@@ -83,6 +77,7 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
83
77
  {
84
78
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
85
79
  drmp3 *dr = (drmp3 *) SDL_calloc(1, sizeof (drmp3));
80
+ Uint64 frames;
86
81
 
87
82
  BAIL_IF_MACRO(!dr, ERR_OUT_OF_MEMORY, 0);
88
83
  if (drmp3_init(dr, mp3_read, mp3_seek, sample, NULL) != DRMP3_TRUE)
@@ -99,7 +94,16 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
99
94
  sample->actual.rate = dr->sampleRate;
100
95
  sample->actual.format = AUDIO_F32SYS; /* dr_mp3 only does float. */
101
96
 
102
- internal->total_time = -1; /* !!! FIXME? */
97
+ frames = drmp3_get_pcm_frame_count(dr);
98
+ if (frames == 0) /* ever possible ??? */
99
+ internal->total_time = -1;
100
+ else
101
+ {
102
+ const Uint32 rate = dr->sampleRate;
103
+ internal->total_time = (frames / rate) * 1000;
104
+ internal->total_time += ((frames % rate) * 1000) / rate;
105
+ } /* else */
106
+
103
107
  internal->decoder_private = dr;
104
108
 
105
109
  return 1;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -174,10 +174,6 @@ static const Uint8 ulaw_outward[13][256] = {
174
174
  #define M_PI 3.14159265358979323846
175
175
  #endif
176
176
 
177
- #if defined(HAVE_LIBC) && defined(__WATCOMC__) /* Watcom has issues... */
178
- #define SDL_log log
179
- #endif
180
-
181
177
 
182
178
  static int word_get(shn_t *shn, SDL_RWops *rw, Uint32 *word)
183
179
  {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -27,12 +27,12 @@
27
27
  #define STB_VORBIS_NO_CRT 1
28
28
  #define STB_VORBIS_NO_PUSHDATA_API 1
29
29
  #define STB_VORBIS_MAX_CHANNELS 6
30
- #define STBV_CDECL
31
30
  #define STB_VORBIS_NO_COMMENTS 1
32
31
  #define STB_FORCEINLINE SDL_FORCE_INLINE
33
32
  #if SDL_BYTEORDER == SDL_BIG_ENDIAN
34
33
  #define STB_VORBIS_BIG_ENDIAN 1
35
34
  #endif
35
+ #define STBV_CDECL SDLCALL /* for SDL_qsort */
36
36
 
37
37
  #if !defined(__clang_analyzer__)
38
38
  #ifdef assert
@@ -52,7 +52,6 @@
52
52
  #define malloc SDL_malloc
53
53
  #define realloc SDL_realloc
54
54
  #define free SDL_free
55
- #ifndef __WATCOMC__ /* #@!.!.. */
56
55
  #define pow SDL_pow
57
56
  #define floor SDL_floor
58
57
  #define ldexp(v, e) SDL_scalbn((v), (e))
@@ -64,7 +63,6 @@
64
63
  #define exp SDL_exp
65
64
  #endif
66
65
  #endif
67
- #endif
68
66
 
69
67
  #include "stb_vorbis.h"
70
68
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -70,9 +70,10 @@ static SDL_INLINE int read_uint8(SDL_RWops *rw, Uint8 *ui8)
70
70
 
71
71
  #define fmtID 0x20746D66 /* "fmt ", in ascii. */
72
72
 
73
- #define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
74
- #define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
75
- #define FMT_IEEE_FLOAT 0x0003 /* Uncompressed IEEE floating point waveform data. */
73
+ #define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
74
+ #define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
75
+ #define FMT_IEEE_FLOAT 0x0003 /* Uncompressed IEEE floating point waveform data. */
76
+ #define FMT_EXTENSIBLE 0xFFFE /* "Extensible" tag */
76
77
 
77
78
  typedef struct
78
79
  {
@@ -92,7 +93,7 @@ typedef struct S_WAV_FMT_T
92
93
  {
93
94
  Uint32 chunkID;
94
95
  Sint32 chunkSize;
95
- Sint16 wFormatTag;
96
+ Uint16 wFormatTag;
96
97
  Uint16 wChannels;
97
98
  Uint32 dwSamplesPerSec;
98
99
  Uint32 dwAvgBytesPerSec;
@@ -144,7 +145,7 @@ static int read_fmt_chunk(SDL_RWops *rw, fmt_t *fmt)
144
145
  BAIL_IF_MACRO(fmt->chunkSize < 16, "WAV: Invalid chunk size", 0);
145
146
  fmt->next_chunk_offset = SDL_RWtell(rw) + fmt->chunkSize;
146
147
 
147
- BAIL_IF_MACRO(!read_le16s(rw, &fmt->wFormatTag), NULL, 0);
148
+ BAIL_IF_MACRO(!read_le16(rw, &fmt->wFormatTag), NULL, 0);
148
149
  BAIL_IF_MACRO(!read_le16(rw, &fmt->wChannels), NULL, 0);
149
150
  BAIL_IF_MACRO(!read_le32(rw, &fmt->dwSamplesPerSec), NULL, 0);
150
151
  BAIL_IF_MACRO(!read_le32(rw, &fmt->dwAvgBytesPerSec), NULL, 0);
@@ -211,7 +212,19 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
211
212
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
212
213
  wav_t *w = (wav_t *) internal->decoder_private;
213
214
  Uint32 max = (internal->buffer_size < (Uint32) w->bytesLeft) ?
214
- internal->buffer_size : (Uint32) w->bytesLeft;
215
+ internal->buffer_size : (Uint32) w->bytesLeft;
216
+
217
+ /* We need to convert 24-bit PCM to an SDL-friendly AUDIO_S32SYS ... */
218
+ if (w->fmt->wBitsPerSample == 24) {
219
+ const Uint32 num_samples = max / 3;
220
+
221
+ /* we're going to expand by 25%...3 bytes to 4. Make sure the buffer has room to expand. */
222
+ max = (num_samples - (num_samples / 4)) * 3;
223
+ if (max == 0) {
224
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
225
+ return 0;
226
+ }
227
+ }
215
228
 
216
229
  SDL_assert(max > 0);
217
230
 
@@ -234,6 +247,19 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
234
247
  else if (retval < internal->buffer_size)
235
248
  sample->flags |= SOUND_SAMPLEFLAG_EAGAIN;
236
249
 
250
+ /* deal with 24-bit PCM. */
251
+ if ((retval > 0) && (w->fmt->wBitsPerSample == 24)) {
252
+ const Uint32 total = retval / 3;
253
+ const Uint8 *src = ((Uint8 *)internal->buffer + retval) - 3;
254
+ Uint32 *dst = (Uint32 *) (((Uint8 *)internal->buffer + (total * 4)) - 4);
255
+ Uint32 i;
256
+ for (i = 0; i < total; i++, dst--, src -= 3) {
257
+ const Uint32 sample = ((Uint32) src[0]) | (((Uint32) src[1]) << 8) | (((Uint32) src[2]) << 16);
258
+ *dst = sample << 8; /* shift it up so the most significant bits cover the 32-bit space. */
259
+ }
260
+ retval = total * 4;
261
+ }
262
+
237
263
  return retval;
238
264
  } /* read_sample_fmt_normal */
239
265
 
@@ -590,6 +616,7 @@ static int read_fmt(SDL_RWops *rw, fmt_t *fmt)
590
616
  /* if it's in this switch statement, we support the format. */
591
617
  switch (fmt->wFormatTag)
592
618
  {
619
+ case FMT_EXTENSIBLE: /* !!! FIXME: this isn't correct */
593
620
  case FMT_NORMAL:
594
621
  SNDDBG(("WAV: Appears to be uncompressed audio.\n"));
595
622
  return read_fmt_normal(rw, fmt);
@@ -603,7 +630,6 @@ static int read_fmt(SDL_RWops *rw, fmt_t *fmt)
603
630
  return read_fmt_normal(rw, fmt); /* just normal PCM, otherwise. */
604
631
 
605
632
  /* add other types here. */
606
-
607
633
  } /* switch */
608
634
 
609
635
  SNDDBG(("WAV: Format 0x%X is unknown.\n",
@@ -662,19 +688,17 @@ static int WAV_open_internal(Sound_Sample *sample, const char *ext, fmt_t *fmt)
662
688
  } /* if */
663
689
  else
664
690
  {
665
- if (fmt->wBitsPerSample == 4)
666
- sample->actual.format = AUDIO_S16SYS;
667
- else if (fmt->wBitsPerSample == 8)
668
- sample->actual.format = AUDIO_U8;
669
- else if (fmt->wBitsPerSample == 16)
670
- sample->actual.format = AUDIO_S16LSB;
671
- else if (fmt->wBitsPerSample == 32)
672
- sample->actual.format = AUDIO_S32LSB;
673
- else
691
+ switch (fmt->wBitsPerSample)
674
692
  {
675
- SNDDBG(("WAV: %d bits per sample!?\n", (int) fmt->wBitsPerSample));
676
- BAIL_MACRO("WAV: Unsupported sample size.", 0);
677
- } /* else */
693
+ case 4: sample->actual.format = AUDIO_S16SYS; break;
694
+ case 8: sample->actual.format = AUDIO_U8; break;
695
+ case 16: sample->actual.format = AUDIO_S16LSB; break;
696
+ case 24: sample->actual.format = AUDIO_S32SYS; break;
697
+ case 32: sample->actual.format = AUDIO_S32LSB; break;
698
+ default:
699
+ SNDDBG(("WAV: %d bits per sample!?\n", (int) fmt->wBitsPerSample));
700
+ BAIL_MACRO("WAV: Unsupported sample size.", 0);
701
+ } /* switch */
678
702
  } /* else */
679
703
 
680
704
  BAIL_IF_MACRO(!read_fmt(rw, fmt), NULL, 0);