Author Topic: Need help patching SDL  (Read 10373 times)

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Need help patching SDL
« on: October 15, 2014, 10:38:09 pm »
I've downloaded SDL-1.2.10-bin-20060602.zip and unzipped it into D:\tools\os2.x86\libsdl. This gives me the following directorie in D:\tools\os2.x86\libsdl: SDL, SDLGfx, SDLImage, SDLMixer, SDLNet, SDLTTF & readme.txt. I need to apply the following patch (diff?) to SDL I don't know how to accomplish this. Thanks much to anybody that can give me a fairly detailed description of how todo this.

klipp

diff -rwu SDL/include/SDL_audio.h D:/coding/vbox/svn/trunk/tools/os2.x86/libsdl/v1.2.10-20060602/SDL/include/SDL_audio.h
--- SDL/include/SDL_audio.h   Mon May  1 03:03:00 2006
+++ D:/coding/vbox/svn/trunk/tools/os2.x86/libsdl/v1.2.10-20060602/SDL/include/SDL_audio.h   Sat Jan 13 06:47:04 2007
@@ -76,6 +76,8 @@
 #define AUDIO_S16SYS   AUDIO_S16MSB
 #endif
 
+/* A filter callback */
+typedef void (SDLCALL * SDL_AudioCVTFilterCall)(struct SDL_AudioCVT *cvt, Uint16 format);
 
 /* A structure to hold a set of audio conversion filters and buffers */
 typedef struct SDL_AudioCVT {
@@ -88,7 +90,7 @@
    int    len_cvt;         /* Length of converted audio buffer */
    int    len_mult;      /* buffer must be len*len_mult big */
    double len_ratio;    /* Given len, final size is len*len_ratio */
-   void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
+   SDL_AudioCVTFilterCall filters[10];
    int filter_index;      /* Current audio conversion function */
 } SDL_AudioCVT;
 
diff -rwu SDL/include/SDL_config_os2.h D:/coding/vbox/svn/trunk/tools/os2.x86/libsdl/v1.2.10-20060602/SDL/include/SDL_config_os2.h
--- SDL/include/SDL_config_os2.h   Mon May  1 03:03:00 2006
+++ D:/coding/vbox/svn/trunk/tools/os2.x86/libsdl/v1.2.10-20060602/SDL/include/SDL_config_os2.h   Sat Jan 13 06:44:38 2007
@@ -27,6 +27,9 @@
 
 /* This is a set of defines to configure the SDL features */
 
+#ifdef __GNUC__
+# include <stdint.h>
+#else
 typedef signed char         int8_t;
 typedef unsigned char       uint8_t;
 typedef signed short        int16_t;
@@ -37,6 +40,7 @@
 typedef unsigned long       uintptr_t;
 typedef signed long long    int64_t;
 typedef unsigned long long  uint64_t;
+#endif
 
 #define SDL_HAS_64BIT_TYPE   1
 


TeLLie

  • Full Member
  • ***
  • Posts: 226
  • Karma: +11/-0
    • View Profile
Re: Need help patching SDL
« Reply #1 on: October 15, 2014, 10:53:11 pm »
Hi Klipp

Why not take latest SDL, http://hobbes.nmsu.edu/download/pub/incoming/SDL-1.2.15-20140930.zip
Normaly it's patch -p1 < *.diff

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4696
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Need help patching SDL
« Reply #2 on: October 16, 2014, 12:26:01 am »
Or try cloning some Github repository: https://github.com/os2world?query=SDL

I was not able to find the source code of the newer ones.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Re: Need help patching SDL
« Reply #3 on: October 16, 2014, 12:32:30 am »
Thanks for the response tellie. I've got the newer version of SDL also but could'nt make it work. It might work with this patch also but I believe the older version is what's needed with the patch applied. The patch modify's SDL so that it will compile in vbox source. Which directory should I be in when I execute the patch command?  --  thanks again.

klipp

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4775
  • Karma: +99/-1
    • View Profile
Re: Need help patching SDL
« Reply #4 on: October 16, 2014, 01:25:33 am »
You need the source to patch, then you need to rebuild the binaries.  The official sources only support compiling with OpenWatcom, see README.OS2. Also someone has done quite a bit of work fixing some of the bugs and uploading binaries to Hobbes, probably best to start from his sources.
As Tellie said, use patch to apply a patch except it is usually -p0 and sometimes such as with diffs made by git -p1. best to try both, patch will complain if you pick the wrong -p option. Patch will also inform you of other problems so it is good to log the command.
The other way is to apply by hand.  The first number,  such as @@ 76,6 means line 76, position 6, ignore the position. Second number is the new line number after applying the patch. Just go to the line number,  find the line that starts with a minus sign and replace with the line that begins with the plus sign. Sometimes if applying for a different version, the  code can be a few or more lines different then the patch indicates. so you have to go by the neighbouring lines.

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Re: Need help patching SDL
« Reply #5 on: October 16, 2014, 02:14:43 am »
WoW!! Dave --- Thanks for the detailed response, I'll do some practice runs in a test directory first and try both methods of patching. Again, thanks for describing in a manner that even a "klutz" like myself stands a chance of being successful.

klipp

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4775
  • Karma: +99/-1
    • View Profile
Re: Need help patching SDL
« Reply #6 on: October 16, 2014, 03:43:30 am »
I forgot the most important option, --dry-run. patch.exe -p0 --dry-run < sdl.diff. The --dry-run will do everything except actually write the changes, once happy, remove --dry-run.

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Re: Need help patching SDL
« Reply #7 on: October 16, 2014, 03:48:51 am »
GOT IT !¡!¡ Thanks --- I'll have to wait till tomorrow to check it out.

klipp

Mentore

  • Full Member
  • ***
  • Posts: 150
  • Karma: +4/-0
    • View Profile
Re: Need help patching SDL
« Reply #8 on: October 17, 2014, 08:59:59 am »
GOT IT !¡!¡ Thanks --- I'll have to wait till tomorrow to check it out.

klipp

While we are on it, I have an unresolved question - or two, but maybe I will post the other on another thread.

SDL behaves strangely on Panorama VESA: it seems it's working in a wrong color space, like RGB instead of BGR (or viceversa). That means, if I fire up an SDL application on my machines (which all have had Panorama VESA in the last times), I see blue instead of red, while the green channel is always ok.

Is it possible to change this behaviour via some SDL options, or do we need some patch to the source code?

I'd gladly take the challenge, once I solve the second problem I'm encountering...

Mentore

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4775
  • Karma: +99/-1
    • View Profile
Re: Need help patching SDL
« Reply #9 on: October 17, 2014, 04:33:29 pm »
Somebody has fixed this and a few other issues and uploaded the fixed SDL to Hobbes,  currently in incoming,  http://hobbes.nmsu.edu/download/pub/incoming/SDL-1.2.15-20140930.zip

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Re: Need help patching SDL
« Reply #10 on: October 17, 2014, 05:42:33 pm »
Hey Dave, I was unable to get the patch installed using varients of patch.exe -p0 (or -p1) and matching directory containing the .diff file I created, so I tried it manually like you described and it "worked like a charm" -- thanks again!

klipp

R.M. Klippstein

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +3/-0
    • View Profile
Re: Need help patching SDL
« Reply #11 on: October 19, 2014, 09:15:39 pm »
Hi Dave, once again! Do you use IBM's Linker ILINK.EXE? Turns out now I need it and CPPOM30.DLL to compile QT3. They are both included in IBM Visual Age C/C++ 3.08 (which I thought I had, buried somewhere, but can't find!). Are they available for download anywhere?

thanks,  klipp

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4775
  • Karma: +99/-1
    • View Profile
Re: Need help patching SDL
« Reply #12 on: October 20, 2014, 01:33:38 am »
I use ilink v5 which IBM made available for building Mozilla. Can't remember offhand where it is available but it doesn't require any supporting DLLs and is the recommended ilink for GCC.
I also use wl.exe (patched wlink from OpenWatcom). There's a good enough version available on netlabs ftp site, the GCC or Libc directory, forget which or better yet is the one available with YUM/RPM, gcc-wlink-4.4.6.17-1.oc00.i386.rpm.
Run emxomfld with no parameters to get the environment variables you need to set to use wl and also wrc