fix a couple of loose ends: sdl_mixer is informed of that OGG is provided by Tremor with its own macro, there is no more a segfault on Tremor cleanup, added new event type and timestamp entry for SDL, removed spurious characters from the japanese translation, uSound errors now are output with SDLTry, uSound doesn't need sound preloading any more
authorkoda
Fri, 06 Jan 2012 01:51:04 +0100
changeset 6551 a2f39cb9af62
parent 6550 4531a2b141ba
child 6552 91adc9ee7b8c
fix a couple of loose ends: sdl_mixer is informed of that OGG is provided by Tremor with its own macro, there is no more a segfault on Tremor cleanup, added new event type and timestamp entry for SDL, removed spurious characters from the japanese translation, uSound errors now are output with SDLTry, uSound doesn't need sound preloading any more
hedgewars/SDLh.pas
hedgewars/uSound.pas
misc/libtremor/tremor/vorbisfile.c
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
project_files/HedgewarsMobile/Locale/Japanese.lproj/About.strings
project_files/HedgewarsMobile/Locale/Japanese.lproj/Localizable.strings
project_files/HedgewarsMobile/Locale/Japanese.lproj/Scheme.strings
--- a/hedgewars/SDLh.pas	Wed Jan 04 02:06:44 2012 +0100
+++ b/hedgewars/SDLh.pas	Fri Jan 06 01:51:04 2012 +0100
@@ -148,6 +148,7 @@
     SDL_DOLLARRECORD      = $801;
     SDL_MULTIGESTURE      = $802;
     SDL_CLIPBOARDUPDATE   = $900;
+    SDL_DROPFILE          = $1000;
     SDL_USEREVENT         = $8000;
     SDL_LASTEVENT         = $FFFF;
     // no compatibility events $7000
@@ -443,6 +444,7 @@
 
     TSDL_WindowEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         event: Byte;
         padding1, padding2, padding3: Byte;
@@ -452,6 +454,7 @@
     // available in sdl12 but not exposed
     TSDL_TextEditingEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         text: array[0..31] of Byte;
         start, lenght: LongInt;
@@ -460,12 +463,14 @@
     // available in sdl12 but not exposed
     TSDL_TextInputEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         text: array[0..31] of Byte;
         end;
 
     TSDL_TouchFingerEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowId: LongWord;
         touchId: Int64;
         fingerId: Int64;
@@ -477,6 +482,7 @@
 
     TSDL_TouchButtonEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowId: LongWord;
         touchId: Int64;
         state, button, padding1, padding2: Byte;
@@ -484,6 +490,7 @@
 
     TSDL_MultiGestureEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowId: LongWord;
         touchId: Int64;
         dTheta, dDist, x, y: Single;
@@ -492,6 +499,7 @@
 
     TSDL_DollarGestureEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         windowId: LongWord;
         touchId: Int64;
         gesturedId: Int64;
@@ -499,8 +507,15 @@
         error: Single;
         end;
 
+    TSDL_DropEvent = record
+        type_: LongWord;
+        timestamp: LongWord;
+        filename: PChar;
+        end;
+
     TSDL_SysWMEvent = record
         type_: LongWord;
+        timestamp: LongWord;
         msg: Pointer;
         end;
 {$ELSE}
@@ -526,6 +541,7 @@
     TSDL_KeyboardEvent = record
 {$IFDEF SDL13}
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         state, repeat_, padding2, padding3: Byte;
 {$ELSE}
@@ -537,6 +553,7 @@
     TSDL_MouseMotionEvent = record
 {$IFDEF SDL13}
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         state, padding1, padding2, padding3: Byte;
         x, y, z, xrel, yrel : LongInt;
@@ -549,6 +566,7 @@
     TSDL_MouseButtonEvent = record
 {$IFDEF SDL13}
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
         buttonm, state, padding1, padding2: Byte;
         x, y: LongInt;
@@ -561,6 +579,7 @@
     TSDL_MouseWheelEvent = record
         type_: LongWord;
 {$IFDEF SDL13}
+        timestamp: LongWord;
         windowID: LongWord;
 {$ELSE}
         which: Byte;
@@ -569,7 +588,12 @@
         end;
 
     TSDL_JoyAxisEvent = record
-        type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
+{$IFDEF SDL13}
+        type_: LongWord;
+        timestamp: LongWord;
+{$ELSE}
+        type_: Byte;
+{$ENDIF}
         which: Byte;
         axis: Byte;
 {$IFDEF SDL13}
@@ -581,7 +605,12 @@
         end;
 
     TSDL_JoyBallEvent = record
-        type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
+{$IFDEF SDL13}
+        type_: LongWord;
+        timestamp: LongWord;
+{$ELSE}
+        type_: Byte;
+{$ENDIF}
         which: Byte;
         ball: Byte;
 {$IFDEF SDL13}
@@ -593,7 +622,12 @@
         end;
 
     TSDL_JoyHatEvent = record
-        type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
+{$IFDEF SDL13}
+        type_: LongWord;
+        timestamp: LongWord;
+{$ELSE}
+        type_: Byte;
+{$ENDIF}
         which: Byte;
         hat: Byte;
         value: Byte;
@@ -603,7 +637,12 @@
         end;
 
     TSDL_JoyButtonEvent = record
-        type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
+{$IFDEF SDL13}
+        type_: LongWord;
+        timestamp: LongWord;
+{$ELSE}
+        type_: Byte;
+{$ENDIF}
         which: Byte;
         button: Byte;
         state: Byte;
@@ -613,12 +652,18 @@
         end;
 
     TSDL_QuitEvent = record
-        type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
+{$IFDEF SDL13}
+        type_: LongWord;
+        timestamp: LongWord;
+{$ELSE}
+        type_: Byte;
+{$ENDIF}
         end;
 
     TSDL_UserEvent = record
 {$IFDEF SDL13}
         type_: LongWord;
+        timestamp: LongWord;
         windowID: LongWord;
 {$ELSE}
         type_: Byte;
@@ -656,6 +701,7 @@
             SDL_TOUCHBUTTONDOWN: (tbutton: TSDL_TouchButtonEvent);
             SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
             SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent);
+            SDL_DROPFILE: (drop: TSDL_DropEvent);
             SDL_ALLEVENTS: (foo: shortstring);
 {$ELSE}
         case Byte of
--- a/hedgewars/uSound.pas	Wed Jan 04 02:06:44 2012 +0100
+++ b/hedgewars/uSound.pas	Fri Jan 06 01:51:04 2012 +0100
@@ -217,7 +217,6 @@
 procedure SoundLoad;
 var i: TSound;
     t: Longword;
-    s:shortstring;
 begin
     if not isSoundEnabled then exit;
 
@@ -229,10 +228,11 @@
             for i:= Low(TSound) to High(TSound) do
                 voicepacks[t].chunks[i]:= nil;
 
-    // preload all the big sound files (>32k) that would otherwise lockup the game
     for i:= Low(TSound) to High(TSound) do
     begin
         defVoicepack^.chunks[i]:= nil;
+        (* this is not necessary when SDL_mixer is compiled with USE_OGG_TREMOR
+        // preload all the big sound files (>32k) that would otherwise lockup the game
         if (i in [sndBeeWater, sndBee, sndCake, sndHellishImpact1, sndHellish, sndHomerun,
                   sndMolotov, sndMortar, sndRideOfTheValkyries, sndYoohoo])
             and (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then
@@ -241,9 +241,9 @@
             if not FileExists(s) then s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName;
             WriteToConsole(msgLoading + s + ' ');
             defVoicepack^.chunks[i]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
-            TryDo(defVoicepack^.chunks[i] <> nil, msgFailed, true);
+            SDLTry(defVoicepack^.chunks[i] <> nil, true);
             WriteLnToConsole(msgOK);
-        end;
+        end;*)
     end;
 
 end;
@@ -295,7 +295,7 @@
             if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
             WriteToConsole(msgLoading + s + ' ');
             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
-            TryDo(defVoicepack^.chunks[snd] <> nil, msgFailed, true);
+            SDLTry(defVoicepack^.chunks[snd] <> nil, true);
             WriteLnToConsole(msgOK);
             end;
         lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
@@ -387,7 +387,7 @@
             if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
             WriteToConsole(msgLoading + s + ' ');
             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
-            TryDo(defVoicepack^.chunks[snd] <> nil, msgFailed, true);
+            SDLTry(defVoicepack^.chunks[snd] <> nil, true);
             WriteLnToConsole(msgOK);
         end;
         if fadems > 0 then
@@ -435,7 +435,7 @@
     WriteToConsole(msgLoading + s + ' ');
 
     Mus:= Mix_LoadMUS(Str2PChar(s));
-    TryDo(Mus <> nil, msgFailed, false);
+    SDLTry(Mus <> nil, false);
     WriteLnToConsole(msgOK);
 
     SDLTry(Mix_FadeInMusic(Mus, -1, 3000) <> -1, false)
--- a/misc/libtremor/tremor/vorbisfile.c	Wed Jan 04 02:06:44 2012 +0100
+++ b/misc/libtremor/tremor/vorbisfile.c	Fri Jan 06 01:51:04 2012 +0100
@@ -739,7 +739,8 @@
     if(vf->offsets)_ogg_free(vf->offsets);
     ogg_sync_destroy(vf->oy);
 
-    if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
+    if(vf->datasource && vf->callbacks.close_func)
+      (vf->callbacks.close_func)(vf->datasource);
     memset(vf,0,sizeof(*vf));
   }
 #ifdef DEBUG_LEAKS
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Wed Jan 04 02:06:44 2012 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Fri Jan 06 01:51:04 2012 +0100
@@ -1208,10 +1208,10 @@
 		9283015C0F10E48900CC5A3C /* Pascal Sources */ = {
 			isa = PBXGroup;
 			children = (
+				61798892114AA56300BA94A9 /* inc */,
 				61D08D7114AEA7FE0007C078 /* uGearsHedgehog.pas */,
 				61D08D7214AEA7FE0007C078 /* uGearsList.pas */,
 				61D08D7314AEA7FE0007C078 /* uGearsUtils.pas */,
-				61798892114AA56300BA94A9 /* inc */,
 				61177C00148B8BB100686905 /* uLandGenMaze.pas */,
 				61177C01148B8BB100686905 /* uLandOutline.pas */,
 				611D7A4F142FDCD3006E0798 /* uTouch.pas */,
--- a/project_files/HedgewarsMobile/Locale/Japanese.lproj/About.strings	Wed Jan 04 02:06:44 2012 +0100
+++ b/project_files/HedgewarsMobile/Locale/Japanese.lproj/About.strings	Fri Jan 06 01:51:04 2012 +0100
@@ -1,4 +1,4 @@
-yt/* code credit */
+/* code credit */
 "Engine, frontend, net server" = "エンジン、フロントエンド、ネットサーバー";
 "Many desktop frontend improvements" = "多くのデスクトップフロントエンドの改善";
 "Many engine and desktop frontend improvements" = "多くのエンジンとデスクトップフロントエンドの改善";
--- a/project_files/HedgewarsMobile/Locale/Japanese.lproj/Localizable.strings	Wed Jan 04 02:06:44 2012 +0100
+++ b/project_files/HedgewarsMobile/Locale/Japanese.lproj/Localizable.strings	Fri Jan 06 01:51:04 2012 +0100
@@ -1,4 +1,4 @@
-yt/* No comment provided by engineer. */
+/* No comment provided by engineer. */
 "A monitor has been disconnected while playing and this has ended the match! You need to restart the game if you wish to use the second display again." = "モニターの接続が切断され、マッチを終了してしまいました!二番目のディスプレーをまた使用したい場合はゲームをリスタートしなければいけません。";
 
 /* from the scheme panel
--- a/project_files/HedgewarsMobile/Locale/Japanese.lproj/Scheme.strings	Wed Jan 04 02:06:44 2012 +0100
+++ b/project_files/HedgewarsMobile/Locale/Japanese.lproj/Scheme.strings	Fri Jan 06 01:51:04 2012 +0100
@@ -1,4 +1,4 @@
-yt/* game mod description */
+/* game mod description */
 "Land can not be destroyed" = "土地は破壊することができません";
 
 /* game mod title */