Page 1 of 2

[PATCH] Build fixes + porting to modern versions of libs

PostPosted: 24 Jun 2012, 12:30
by douggiem
I finally made ZB to complete its built.
Here are patches: http://ftp.osuosl.org/pub/manulix/zeroballistics/

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 24 Jun 2012, 12:33
by douggiem
Now it's time to fix endianess issues.
For example, sound is just noise, i.e. PCM streams are not byte-swapped for target's byte ordering.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 26 Jun 2012, 16:10
by Hackeridze
Ask access to SVN from developers!

Fork

PostPosted: 26 Jun 2012, 16:24
by Hackeridze
Also, just make repo on GITHUB and fork this game.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 26 Jun 2012, 21:38
by douggiem
Yep, to fork this great game is a great idea. Since devs don't care about it anymore.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 03 Jul 2012, 09:30
by Michael
douggiem wrote:Yep, to fork this great game is a great idea. Since devs don't care about it anymore.


Hi douggiem

It's not true that we don't care about it anymore, we just do not have time anymore for futher development. Therefore we would appreciate any dev done from people who are interested and would like this game to improve. Just ask on sourceforge for svn+wiki write permissions and we'll grant it, antoher fork/branch would just create more confusion and split up resources that could contribute on the same bugs/features/improvements.

kind regards,
Michael

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 18 Jul 2012, 17:45
by douggiem
douggiem wrote:Now it's time to fix endianess issues.
For example, sound is just noise, i.e. PCM streams are not byte-swapped for target's byte ordering.


I found the source: source/bluebeard/src/OggVobis.cpp; here: "ov_read returns PCM 16-bit little-endian smaples" is wrong. Fourth parameter for ov_read is 0 for endian-little (not normal reverse byte order, a.k.a. little endian), and must be 1 to get playable PCM streams on big-endian.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 18 Jul 2012, 18:04
by douggiem
Patch for ov_read calling stuff:

Code: Select all
Index: bluebeard/src/OggStream.cpp
===================================================================
--- bluebeard/src/OggStream.cpp   (revision 4455)
+++ bluebeard/src/OggStream.cpp   (working copy)
@@ -7,12 +7,16 @@
#include "SoundManager.h"
#include "Paths.h"

+#ifdef __BIG_ENDIAN__
+const int bigendianp = 1;
+#else
+const int bigendianp = 0;
+#endif

float UPDATE_PERIOD  = 0.1f; // time between sound buffer updates
float FADE_PERIOD    = 0.1f; // time between volume adjustments when fading
float FADE_CHANGE    = 0.1f; // amount of volume change per adjustment when fading

-
//------------------------------------------------------------------------------
OggStream::OggStream(const std::string & filename, unsigned char flags) :
     filename_(filename),
@@ -272,8 +276,8 @@

     while(size < BUFFER_SIZE)
     {
-        result = ov_read(&stream_, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
-   
+        result = ov_read(&stream_, pcm + size, BUFFER_SIZE - size, bigendianp, 2, 1, &section);
+
         if(result > 0)
             size += result;
         else
Index: bluebeard/src/OggVorbis.cpp
===================================================================
--- bluebeard/src/OggVorbis.cpp   (revision 4455)
+++ bluebeard/src/OggVorbis.cpp   (working copy)
@@ -6,7 +6,19 @@

#include "Exception.h"

+#ifdef __BIG_ENDIAN__
+const int bigendianp = 1;
+#else
+const int bigendianp = 0;
+#endif

+/* return 0 for little endian, 1 for big endian */
+/*int  bigendian( void )
+{
+    long one = 1;
+    return !(*((char*)(&one)));
+}*/
+
ALboolean loadOgg(  const char *fname,
                     void **wave,
                     ALsizei *format,
@@ -21,7 +33,6 @@
     int eof = 0;
     int current_section;


     long ret;

     FILE * file = fopen(fname,"rb+");
@@ -42,10 +53,10 @@
         *freq = (ALsizei) vi->rate;
         /************* HACK? ************/
         *size = (ALsizei) ov_pcm_total(&vf, -1)*2;
-       
-        *bits = (ALsizei) 16; //ov_read returns PCM 16-bit little-endian samples

-        int channels = vi->channels;       
+        *bits = (ALsizei) 16; //ov_read returns PCM 16-bit samples
+
+        int channels = vi->channels;
         if (channels == 1)
         {
             *format = AL_FORMAT_MONO16;
@@ -64,7 +75,7 @@

     while(!eof)
     {
-      ret=ov_read(&vf,(char *)pcm_data_p,4096,0,2,1,&current_section);
+      ret=ov_read(&vf,(char *)pcm_data_p,4096,bigendianp,2,1,&current_section);
         if (ret == 0)
         {
             /* EOF */
@@ -80,7 +91,6 @@
                you'll have to*/

             pcm_data_p += ret;
-       
         }
     }



See also http://ftp.osuosl.org/pub/manulix/zeroballistics/ (oggvorbis_oggstream-ov_read-big_endian.patch)

Now it's time to fix Windows WAVE to playable PCM issue.

Here http://kcat.strangesoft.net/openal-tutorial.html is written:

Note that the .wav format spec has multibyte sample foramts stored as little-endian. If you were on a big-endian machine, you'd have to iterate over the returned data and flip the bytes for those formats before giving it to OpenAL.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 18 Jul 2012, 18:41
by douggiem
Michael wrote:It's not true that we don't care about it anymore, we just do not have time anymore for futher development.


So you do care only in management and copyrights? No time does mean (is absolutely equal to) no interest.

Michael wrote:Therefore we would appreciate any dev done from people who are interested and would like this game to improve. Just ask on sourceforge for svn+wiki write permissions and we'll grant it


I'm interesting primarily in porting this game to Linux@PowerPC (and other big endian archs, like MIPS and ARM (MIPSEL and ARMEL are endian-little ones)) at least, and to have it included in repos of at least Debian.

Michael wrote:antoher fork/branch would just create more confusion and split up resources that could contribute on the same bugs/features/improvements.


Let's look at LibreOffice vs OpenOffice.org. Forking may be really good.

Re: [PATCH] Build fixes + porting to modern versions of libs

PostPosted: 21 Jul 2012, 21:42
by douggiem
Patch for debugging info.

Code: Select all
Index: code/CMakeLists.txt
===================================================================
--- code/CMakeLists.txt (revision 4455)
+++ code/CMakeLists.txt (working copy)
@@ -1,6 +1,13 @@

cmake_minimum_required(VERSION 2.6)

+#set(CMAKE_CXX_FLAGS "-Wall")
+set(CMAKE_CXX_FLAGS_DEBUG "-g") # for line numbers
+
+set(CMAKE_BUILD_TYPE Debug)
+#set(CMAKE_BUILD_TYPE Release)
+
+
project(tanks)