Mac Classic and CodeWarrior patches.
authorRyan C. Gordon
Thu, 08 Sep 2005 06:34:28 +0000
changeset 1135cf6133247d34
parent 1134 55a86cfe6277
child 1136 d16c010d5d98
Mac Classic and CodeWarrior patches.

--ryan.



From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se>
Subject: Re: [SDL] Updated Mac patch
Date: Tue, 6 Sep 2005 15:21:27 +0200
To: A list for developers using the SDL library <sdl@libsdl.org>

Earlier, I wrote:

> Updated the previous Mac patch to disable Carbon by default.
> Also "fixed" the SDL.spec again, so that it builds on Darwin.
>
> http://www.algonet.se/~afb/SDL-1.2.9-mac.patch
> Also applied fine to SDL12 CVS, when I tried it.
>
> Haven't completed any new packaging or projects for Xcode/PB,
> but it seems to build and install fine here (in development).

Tested the new patch to build with old CodeWarrior and MPW,
and it seems it needed some hacks with those old headers...

Just in case you want to support the archeological versions -
here is a small add-on to the above patch, to fix those...

http://www.algonet.se/~afb/SDL-1.2.9-classic.patch


I couldn't get the old CW5 projects to build without a few
modifications - such as deleting the stray old header in:
"CWprojects/Support/Carbon/Include/ConditionalMacros.h" ?

But I updated both projects to CW6 too and built for Carbon,
and it ran all of the Mac test projects without any problems.
The MPW file seems to have compiled, with a small order change.


As long as you're still shipping the CWProjects and MPWmake
with the download, they should probably be updated/fixed ?
(another "solution" would of course be to just delete them)

I'll post my new projects along with the new Xcode projects
later on, along with XML exports of the various .mcp files.
(CW5 builds for Classic / "PPC", and CW6 builds for Carbon)


It'll be packaged as a part of the next SpriteWorld X release...
http://spriteworldx.sourceforge.net/ [Classic/Carbon/Win/X11]

--anders
src/SDL_loadso.c
src/audio/macrom/SDL_romaudio.c
src/joystick/win32/SDL_mmjoystick.c
src/video/macdsp/SDL_dspvideo.c
     1.1 --- a/src/SDL_loadso.c	Thu Sep 08 06:17:23 2005 +0000
     1.2 +++ b/src/SDL_loadso.c	Thu Sep 08 06:34:28 2005 +0000
     1.3 @@ -37,6 +37,7 @@
     1.4  # include <be/kernel/image.h>
     1.5  #elif defined(macintosh)
     1.6  # include <string.h>
     1.7 +#define OLDP2C 1
     1.8  # include <Strings.h>
     1.9  # include <CodeFragments.h>
    1.10  # include <Errors.h>
     2.1 --- a/src/audio/macrom/SDL_romaudio.c	Thu Sep 08 06:17:23 2005 +0000
     2.2 +++ b/src/audio/macrom/SDL_romaudio.c	Thu Sep 08 06:34:28 2005 +0000
     2.3 @@ -42,6 +42,9 @@
     2.4  #if !defined(NewSndCallBackProc) /* avoid circular redefinition... */
     2.5  #define NewSndCallBackUPP NewSndCallBackProc
     2.6  #endif
     2.7 +#if !defined(NewSndCallBackUPP)
     2.8 +#define NewSndCallBackUPP NewSndCallBackProc
     2.9 +#endif
    2.10  #endif
    2.11  
    2.12  #include "SDL_endian.h"
     3.1 --- a/src/joystick/win32/SDL_mmjoystick.c	Thu Sep 08 06:17:23 2005 +0000
     3.2 +++ b/src/joystick/win32/SDL_mmjoystick.c	Thu Sep 08 06:34:28 2005 +0000
     3.3 @@ -87,7 +87,7 @@
     3.4  	unsigned char regvalue[256];
     3.5  	unsigned char regname[256];
     3.6  
     3.7 -	sprintf(regkey, "%s\\%s\\%s",
     3.8 +	sprintf((char *) regkey, "%s\\%s\\%s",
     3.9  		REGSTR_PATH_JOYCONFIG,
    3.10  		szRegKey,
    3.11  		REGSTR_KEY_JOYCURR);
    3.12 @@ -100,20 +100,20 @@
    3.13  			joystick's properties
    3.14  		*/
    3.15  		regsize = sizeof(regname);
    3.16 -		sprintf(regvalue,
    3.17 +		sprintf((char *) regvalue,
    3.18  			"Joystick%d%s", index+1,
    3.19  			REGSTR_VAL_JOYOEMNAME);
    3.20  		regresult = RegQueryValueExA(hKey,
    3.21 -			regvalue, 0, 0, (LPBYTE) &regname,
    3.22 +			(char *) regvalue, 0, 0, (LPBYTE) &regname,
    3.23  			(LPDWORD) &regsize);
    3.24  		RegCloseKey(hKey);
    3.25  		if (regresult == ERROR_SUCCESS)
    3.26  		{
    3.27  			/* open that registry key */
    3.28 -			sprintf(regkey, "%s\\%s",
    3.29 +			sprintf((char *) regkey, "%s\\%s",
    3.30  				REGSTR_PATH_JOYOEM, regname);
    3.31  			regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
    3.32 -				regkey, 0, KEY_READ, &hKey);
    3.33 +				(char *) regkey, 0, KEY_READ, &hKey);
    3.34  			if (regresult == ERROR_SUCCESS)
    3.35  			{
    3.36  				/* find the size for the OEM name text */
     4.1 --- a/src/video/macdsp/SDL_dspvideo.c	Thu Sep 08 06:17:23 2005 +0000
     4.2 +++ b/src/video/macdsp/SDL_dspvideo.c	Thu Sep 08 06:34:28 2005 +0000
     4.3 @@ -520,9 +520,11 @@
     4.4  
     4.5  static int DSp_VideoInit(_THIS, SDL_PixelFormat *vformat)
     4.6  {
     4.7 -	NumVersion dsp_version;
     4.8 +	NumVersion dsp_version = { 0x01, 0x00, 0x00, 0x00 };
     4.9  	
    4.10 +#if UNIVERSAL_INTERFACES_VERSION > 0x0320
    4.11  	dsp_version = DSpGetVersion ();
    4.12 +#endif
    4.13  	
    4.14  	if (  (dsp_version.majorRev == 1 && dsp_version.minorAndBugRev < 0x73) ||
    4.15  	      (dsp_version.majorRev < 1)  ) {                          
    4.16 @@ -801,7 +803,7 @@
    4.17  	attrib.colorNeeds           = kDSpColorNeeds_Require;
    4.18  	attrib.colorTable           = 0;
    4.19  	attrib.pageCount            = page_count;
    4.20 -        #if TARGET_API_MAC_OSX
    4.21 +        #if TARGET_API_MAC_OSX || UNIVERSAL_INTERFACES_VERSION == 0x0320
    4.22          
    4.23          if ( DSpFindBestContext (&attrib, &dsp_context) != noErr ) {
    4.24              SDL_SetError ("DrawSprocket couldn't find a context");