aboutsummaryrefslogtreecommitdiffstats
path: root/distrib/sdl-1.2.15/src/main/macos
diff options
context:
space:
mode:
Diffstat (limited to 'distrib/sdl-1.2.15/src/main/macos')
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/SDL.r1
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/SDL.shlib.r1
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/SDL_main.c610
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/SIZE.r1
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/exports/Makefile39
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/exports/SDL.x1
-rw-r--r--distrib/sdl-1.2.15/src/main/macos/exports/gendef.pl43
7 files changed, 696 insertions, 0 deletions
diff --git a/distrib/sdl-1.2.15/src/main/macos/SDL.r b/distrib/sdl-1.2.15/src/main/macos/SDL.r
new file mode 100644
index 0000000..a8fceca
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/SDL.r
@@ -0,0 +1 @@
+data 'DLOG' (1000) { $"0072 0040 00EA 01B3 0001 0100 0000 0000 0000 03E8 0C43 6F6D 6D61 6E64 204C 696E" /* .r.@..............Command Lin */ $"6500 280A" /* e.( */ }; data 'DLOG' (1001) { $"0072 0040 00DB 01AC 0001 0100 0000 0000 0000 03E9 0C45 7272 6F72 2057 696E 646F" /* .r.@..............Error Windo */ $"7700 280A" /* w.( */ }; data 'DLOG' (1002) { $"00B8 00BE 0147 01D8 0005 0100 0000 0000 0000 03EA 1643 6F6E 6669 726D 2044 6973" /* ...G.............Confirm Dis */ $"706C 6179 2043 6861 6E67 6510 280A" /* play Change.( */ }; data 'DITL' (1000) { $"0005 0000 0000 0052 0113 0066 0158 0402 4F4B 0000 0000 0052 00C2 0066 0107 0406" /* .......R...f.X..OK.....R..f.... */ $"4361 6E63 656C 0000 0000 000F 0084 001F 0155 1000 0000 0000 0054 0019 0066 007D" /* Cancel..........U.......T...f.} */ $"050E 4F75 7470 7574 2074 6F20 6669 6C65 0000 0000 000F 0018 001F 007F 080D 436F" /* ..Output to file..............Co */ $"6D6D 616E 6420 4C69 6E65 3A00 0000 0000 0030 0018 0040 0158 0702 0080" /* mmand Line:......0...@.X... */ }; data 'DITL' (1001) { $"0001 0000 0000 0046 0120 005A 015A 0402 4F4B 0000 0000 0010 000A 0038 0160 0800" /* .......F. .Z.Z..OK........8.`.. */ }; data 'DITL' (1002) { $"0002 0000 0000 006F 001E 0083 0058 0406 4361 6E63 656C 0000 0000 006E 00C0 0082" /* .......o....X..Cancel.....n.. */ $"00FA 0402 4F4B 0000 0000 000E 000F 005F 010C 88B3 5468 6520 7365 7474 696E 6720" /* ...OK........._..The setting */ $"666F 7220 796F 7572 206D 6F6E 6974 6F72 2068 6173 2062 6565 6E20 6368 616E 6765" /* for your monitor has been change */ $"642C 2061 6E64 2069 7420 6D61 7920 6E6F 7420 6265 2064 6973 706C 6179 6564 2063" /* d, and it may not be displayed c */ $"6F72 7265 6374 6C79 2E20 546F 2063 6F6E 6669 726D 2074 6865 2064 6973 706C 6179" /* orrectly. To confirm the display */ $"2069 7320 636F 7272 6563 742C 2063 6C69 636B 204F 4B2E 2054 6F20 7265 7475 726E" /* is correct, click OK. To return */ $"2074 6F20 7468 6520 6F72 6967 696E 616C 2073 6574 7469 6E67 2C20 636C 6963 6B20" /* to the original setting, click */ $"4361 6E63 656C 2E00" /* Cancel.. */ }; data 'MENU' (128, preload) { $"0080 0000 0000 0000 0000 FFFF FFFB 0114 0C41 626F 7574 2053 444C 2E2E 2E00 0000" /* ............About SDL...... */ $"0001 2D00 0000 0000" /* ..-..... */ }; data 'MENU' (129) { $"0081 0000 0000 0000 0000 FFFF FFFF 0C56 6964 656F 2044 7269 7665 7219 4472 6177" /* ..........Video Driver.Draw */ $"5370 726F 636B 6574 2028 4675 6C6C 7363 7265 656E 2900 0000 001E 546F 6F6C 426F" /* Sprocket (Fullscreen).....ToolBo */ $"7820 2028 4675 6C6C 7363 7265 656E 2F57 696E 646F 7765 6429 0000 0000 00" /* x (Fullscreen/Windowed)..... */ }; data 'CNTL' (128) { $"0000 0000 0010 0140 0000 0100 0064 0081 03F0 0000 0000 0D56 6964 656F 2044 7269" /* .......@.....d.......Video Dri */ $"7665 723A" /* ver: */ }; data 'TMPL' (128, "CLne") { $"0C43 6F6D 6D61 6E64 204C 696E 6550 5354 520C 5669 6465 6F20 4472 6976 6572 5053" /* .Command LinePSTR.Video DriverPS */ $"5452 0C53 6176 6520 546F 2046 696C 6542 4F4F 4C" /* TR.Save To FileBOOL */ }; \ No newline at end of file
diff --git a/distrib/sdl-1.2.15/src/main/macos/SDL.shlib.r b/distrib/sdl-1.2.15/src/main/macos/SDL.shlib.r
new file mode 100644
index 0000000..2523106
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/SDL.shlib.r
@@ -0,0 +1 @@
+ #ifndef __TYPES_R__ #include "Types.r" #endif #ifndef __BALLOONS_R__ #include "Balloons.r" #endif #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define REVISION 13 #define STATE release /* development | alpha | beta | release */ #define RELEASE_NO 0 /* number after letter, or zero for release */ #define COUNTRY verUS #define VERSION_STRING "1.2.13" #define NAME "SDL" #define SHORT_DESCRIPTION "Simple DirectMedia Layer by Sam Lantinga" #define LONG_DESCRIPTION "A cross-platform multimedia library.\n\nhttp://www.libsdl.org" resource 'vers' (1) { VERSION_MAJOR, (VERSION_MINOR << 4) | REVISION, STATE, RELEASE_NO, COUNTRY, VERSION_STRING, VERSION_STRING }; resource 'vers' (2) { VERSION_MAJOR, (VERSION_MINOR << 4) | REVISION, STATE, RELEASE_NO, COUNTRY, VERSION_STRING, SHORT_DESCRIPTION }; /* Extension Manager info */ data 'CCI' (128) { NAME "\n\n" LONG_DESCRIPTION }; /* Finder help balloon */ resource 'hfdr' (kHMHelpID) { HelpMgrVersion, hmDefaultOptions, 0, 0, { HMStringItem { NAME "\n\n" LONG_DESCRIPTION } } }; \ No newline at end of file
diff --git a/distrib/sdl-1.2.15/src/main/macos/SDL_main.c b/distrib/sdl-1.2.15/src/main/macos/SDL_main.c
new file mode 100644
index 0000000..ff1ffdc
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/SDL_main.c
@@ -0,0 +1,610 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2012 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/* This file takes care of command line argument parsing, and stdio redirection
+ in the MacOS environment. (stdio/stderr is *not* directed for Mach-O builds)
+ */
+
+#if defined(__APPLE__) && defined(__MACH__)
+#include <Carbon/Carbon.h>
+#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
+#include <Carbon.h>
+#else
+#include <Dialogs.h>
+#include <Fonts.h>
+#include <Events.h>
+#include <Resources.h>
+#include <Folders.h>
+#endif
+
+/* Include the SDL main definition header */
+#include "SDL.h"
+#include "SDL_main.h"
+#ifdef main
+#undef main
+#endif
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+/* The standard output files */
+#define STDOUT_FILE "stdout.txt"
+#define STDERR_FILE "stderr.txt"
+#endif
+
+#if !defined(__MWERKS__) && !TARGET_API_MAC_CARBON
+ /* In MPW, the qd global has been removed from the libraries */
+ QDGlobals qd;
+#endif
+
+/* Structure for keeping prefs in 1 variable */
+typedef struct {
+ Str255 command_line;
+ Str255 video_driver_name;
+ Boolean output_to_file;
+} PrefsRecord;
+
+/* See if the command key is held down at startup */
+static Boolean CommandKeyIsDown(void)
+{
+ KeyMap theKeyMap;
+
+ GetKeys(theKeyMap);
+
+ if (((unsigned char *) theKeyMap)[6] & 0x80) {
+ return(true);
+ }
+ return(false);
+}
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+
+/* Parse a command line buffer into arguments */
+static int ParseCommandLine(char *cmdline, char **argv)
+{
+ char *bufp;
+ int argc;
+
+ argc = 0;
+ for ( bufp = cmdline; *bufp; ) {
+ /* Skip leading whitespace */
+ while ( SDL_isspace(*bufp) ) {
+ ++bufp;
+ }
+ /* Skip over argument */
+ if ( *bufp == '"' ) {
+ ++bufp;
+ if ( *bufp ) {
+ if ( argv ) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ while ( *bufp && (*bufp != '"') ) {
+ ++bufp;
+ }
+ } else {
+ if ( *bufp ) {
+ if ( argv ) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ while ( *bufp && ! SDL_isspace(*bufp) ) {
+ ++bufp;
+ }
+ }
+ if ( *bufp ) {
+ if ( argv ) {
+ *bufp = '\0';
+ }
+ ++bufp;
+ }
+ }
+ if ( argv ) {
+ argv[argc] = NULL;
+ }
+ return(argc);
+}
+
+/* Remove the output files if there was no output written */
+static void cleanup_output(void)
+{
+ FILE *file;
+ int empty;
+
+ /* Flush the output in case anything is queued */
+ fclose(stdout);
+ fclose(stderr);
+
+ /* See if the files have any output in them */
+ file = fopen(STDOUT_FILE, "rb");
+ if ( file ) {
+ empty = (fgetc(file) == EOF) ? 1 : 0;
+ fclose(file);
+ if ( empty ) {
+ remove(STDOUT_FILE);
+ }
+ }
+ file = fopen(STDERR_FILE, "rb");
+ if ( file ) {
+ empty = (fgetc(file) == EOF) ? 1 : 0;
+ fclose(file);
+ if ( empty ) {
+ remove(STDERR_FILE);
+ }
+ }
+}
+
+#endif //!(defined(__APPLE__) && defined(__MACH__))
+
+static int getCurrentAppName (StrFileName name) {
+
+ ProcessSerialNumber process;
+ ProcessInfoRec process_info;
+ FSSpec process_fsp;
+
+ process.highLongOfPSN = 0;
+ process.lowLongOfPSN = kCurrentProcess;
+ process_info.processInfoLength = sizeof (process_info);
+ process_info.processName = NULL;
+ process_info.processAppSpec = &process_fsp;
+
+ if ( noErr != GetProcessInformation (&process, &process_info) )
+ return 0;
+
+ SDL_memcpy(name, process_fsp.name, process_fsp.name[0] + 1);
+ return 1;
+}
+
+static int getPrefsFile (FSSpec *prefs_fsp, int create) {
+
+ /* The prefs file name is the application name, possibly truncated, */
+ /* plus " Preferences */
+
+ #define SUFFIX " Preferences"
+ #define MAX_NAME 19 /* 31 - strlen (SUFFIX) */
+
+ short volume_ref_number;
+ long directory_id;
+ StrFileName prefs_name;
+ StrFileName app_name;
+
+ /* Get Preferences folder - works with Multiple Users */
+ if ( noErr != FindFolder ( kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder,
+ &volume_ref_number, &directory_id) )
+ exit (-1);
+
+ if ( ! getCurrentAppName (app_name) )
+ exit (-1);
+
+ /* Truncate if name is too long */
+ if (app_name[0] > MAX_NAME )
+ app_name[0] = MAX_NAME;
+
+ SDL_memcpy(prefs_name + 1, app_name + 1, app_name[0]);
+ SDL_memcpy(prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX));
+ prefs_name[0] = app_name[0] + strlen (SUFFIX);
+
+ /* Make the file spec for prefs file */
+ if ( noErr != FSMakeFSSpec (volume_ref_number, directory_id, prefs_name, prefs_fsp) ) {
+ if ( !create )
+ return 0;
+ else {
+ /* Create the prefs file */
+ SDL_memcpy(prefs_fsp->name, prefs_name, prefs_name[0] + 1);
+ prefs_fsp->parID = directory_id;
+ prefs_fsp->vRefNum = volume_ref_number;
+
+ FSpCreateResFile (prefs_fsp, 0x3f3f3f3f, 'pref', 0); // '????' parsed as trigraph
+
+ if ( noErr != ResError () )
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int readPrefsResource (PrefsRecord *prefs) {
+
+ Handle prefs_handle;
+
+ prefs_handle = Get1Resource( 'CLne', 128 );
+
+ if (prefs_handle != NULL) {
+ int offset = 0;
+// int j = 0;
+
+ HLock(prefs_handle);
+
+ /* Get command line string */
+ SDL_memcpy(prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
+
+ /* Get video driver name */
+ offset += (*prefs_handle)[0] + 1;
+ SDL_memcpy(prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 1);
+
+ /* Get save-to-file option (1 or 0) */
+ offset += (*prefs_handle)[offset] + 1;
+ prefs->output_to_file = (*prefs_handle)[offset];
+
+ ReleaseResource( prefs_handle );
+
+ return ResError() == noErr;
+ }
+
+ return 0;
+}
+
+static int writePrefsResource (PrefsRecord *prefs, short resource_file) {
+
+ Handle prefs_handle;
+
+ UseResFile (resource_file);
+
+ prefs_handle = Get1Resource ( 'CLne', 128 );
+ if (prefs_handle != NULL)
+ RemoveResource (prefs_handle);
+
+ prefs_handle = NewHandle ( prefs->command_line[0] + prefs->video_driver_name[0] + 4 );
+ if (prefs_handle != NULL) {
+
+ int offset;
+
+ HLock (prefs_handle);
+
+ /* Command line text */
+ offset = 0;
+ SDL_memcpy(*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
+
+ /* Video driver name */
+ offset += prefs->command_line[0] + 1;
+ SDL_memcpy(*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[0] + 1);
+
+ /* Output-to-file option */
+ offset += prefs->video_driver_name[0] + 1;
+ *( *((char**)prefs_handle) + offset) = (char)prefs->output_to_file;
+ *( *((char**)prefs_handle) + offset + 1) = 0;
+
+ AddResource (prefs_handle, 'CLne', 128, "\pCommand Line");
+ WriteResource (prefs_handle);
+ UpdateResFile (resource_file);
+ DisposeHandle (prefs_handle);
+
+ return ResError() == noErr;
+ }
+
+ return 0;
+}
+
+static int readPreferences (PrefsRecord *prefs) {
+
+ int no_error = 1;
+ FSSpec prefs_fsp;
+
+ /* Check for prefs file first */
+ if ( getPrefsFile (&prefs_fsp, 0) ) {
+
+ short prefs_resource;
+
+ prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdPerm);
+ if ( prefs_resource == -1 ) /* this shouldn't happen, but... */
+ return 0;
+
+ UseResFile (prefs_resource);
+ no_error = readPrefsResource (prefs);
+ CloseResFile (prefs_resource);
+ }
+
+ /* Fall back to application's resource fork (reading only, so this is safe) */
+ else {
+
+ no_error = readPrefsResource (prefs);
+ }
+
+ return no_error;
+}
+
+static int writePreferences (PrefsRecord *prefs) {
+
+ int no_error = 1;
+ FSSpec prefs_fsp;
+
+ /* Get prefs file, create if it doesn't exist */
+ if ( getPrefsFile (&prefs_fsp, 1) ) {
+
+ short prefs_resource;
+
+ prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdWrPerm);
+ if (prefs_resource == -1)
+ return 0;
+ no_error = writePrefsResource (prefs, prefs_resource);
+ CloseResFile (prefs_resource);
+ }
+
+ return no_error;
+}
+
+/* This is where execution begins */
+int main(int argc, char *argv[])
+{
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+#pragma unused(argc, argv)
+#endif
+
+#define DEFAULT_ARGS "\p" /* pascal string for default args */
+#define DEFAULT_VIDEO_DRIVER "\ptoolbox" /* pascal string for default video driver name */
+#define DEFAULT_OUTPUT_TO_FILE 1 /* 1 == output to file, 0 == no output */
+
+#define VIDEO_ID_DRAWSPROCKET 1 /* these correspond to popup menu choices */
+#define VIDEO_ID_TOOLBOX 2
+
+ PrefsRecord prefs = { DEFAULT_ARGS, DEFAULT_VIDEO_DRIVER, DEFAULT_OUTPUT_TO_FILE };
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+ int nargs;
+ char **args;
+ char *commandLine;
+
+ StrFileName appNameText;
+#endif
+ int videodriver = VIDEO_ID_TOOLBOX;
+ int settingsChanged = 0;
+
+ long i;
+
+ /* Kyle's SDL command-line dialog code ... */
+#if !TARGET_API_MAC_CARBON
+ InitGraf (&qd.thePort);
+ InitFonts ();
+ InitWindows ();
+ InitMenus ();
+ InitDialogs (nil);
+#endif
+ InitCursor ();
+ FlushEvents(everyEvent,0);
+#if !TARGET_API_MAC_CARBON
+ MaxApplZone ();
+#endif
+ MoreMasters ();
+ MoreMasters ();
+#if 0
+ /* Intialize SDL, and put up a dialog if we fail */
+ if ( SDL_Init (0) < 0 ) {
+
+#define kErr_OK 1
+#define kErr_Text 2
+
+ DialogPtr errorDialog;
+ short dummyType;
+ Rect dummyRect;
+ Handle dummyHandle;
+ short itemHit;
+
+ errorDialog = GetNewDialog (1001, nil, (WindowPtr)-1);
+ if (errorDialog == NULL)
+ return -1;
+ DrawDialog (errorDialog);
+
+ GetDialogItem (errorDialog, kErr_Text, &dummyType, &dummyHandle, &dummyRect);
+ SetDialogItemText (dummyHandle, "\pError Initializing SDL");
+
+#if TARGET_API_MAC_CARBON
+ SetPort (GetDialogPort(errorDialog));
+#else
+ SetPort (errorDialog);
+#endif
+ do {
+ ModalDialog (nil, &itemHit);
+ } while (itemHit != kErr_OK);
+
+ DisposeDialog (errorDialog);
+ exit (-1);
+ }
+ atexit(cleanup_output);
+ atexit(SDL_Quit);
+#endif
+
+/* Set up SDL's QuickDraw environment */
+#if !TARGET_API_MAC_CARBON
+ SDL_InitQuickDraw(&qd);
+#endif
+
+ if ( readPreferences (&prefs) ) {
+
+ if (SDL_memcmp(prefs.video_driver_name+1, "DSp", 3) == 0)
+ videodriver = 1;
+ else if (SDL_memcmp(prefs.video_driver_name+1, "toolbox", 7) == 0)
+ videodriver = 2;
+ }
+
+ if ( CommandKeyIsDown() ) {
+
+#define kCL_OK 1
+#define kCL_Cancel 2
+#define kCL_Text 3
+#define kCL_File 4
+#define kCL_Video 6
+
+ DialogPtr commandDialog;
+ short dummyType;
+ Rect dummyRect;
+ Handle dummyHandle;
+ short itemHit;
+ #if TARGET_API_MAC_CARBON
+ ControlRef control;
+ #endif
+
+ /* Assume that they will change settings, rather than do exhaustive check */
+ settingsChanged = 1;
+
+ /* Create dialog and display it */
+ commandDialog = GetNewDialog (1000, nil, (WindowPtr)-1);
+ #if TARGET_API_MAC_CARBON
+ SetPort ( GetDialogPort(commandDialog) );
+ #else
+ SetPort (commandDialog);
+ #endif
+
+ /* Setup controls */
+ #if TARGET_API_MAC_CARBON
+ GetDialogItemAsControl(commandDialog, kCL_File, &control);
+ SetControlValue (control, prefs.output_to_file);
+ #else
+ GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
+ SetControlValue ((ControlHandle)dummyHandle, prefs.output_to_file );
+ #endif
+
+ GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect);
+ SetDialogItemText (dummyHandle, prefs.command_line);
+
+ #if TARGET_API_MAC_CARBON
+ GetDialogItemAsControl(commandDialog, kCL_Video, &control);
+ SetControlValue (control, videodriver);
+ #else
+ GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
+ SetControlValue ((ControlRef)dummyHandle, videodriver);
+ #endif
+
+ SetDialogDefaultItem (commandDialog, kCL_OK);
+ SetDialogCancelItem (commandDialog, kCL_Cancel);
+
+ do {
+
+ ModalDialog(nil, &itemHit); /* wait for user response */
+
+ /* Toggle command-line output checkbox */
+ if ( itemHit == kCL_File ) {
+ #if TARGET_API_MAC_CARBON
+ GetDialogItemAsControl(commandDialog, kCL_File, &control);
+ SetControlValue (control, !GetControlValue(control));
+ #else
+ GetDialogItem(commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
+ SetControlValue((ControlHandle)dummyHandle, !GetControlValue((ControlHandle)dummyHandle) );
+ #endif
+ }
+
+ } while (itemHit != kCL_OK && itemHit != kCL_Cancel);
+
+ /* Get control values, even if they did not change */
+ GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect); /* MJS */
+ GetDialogItemText (dummyHandle, prefs.command_line);
+
+ #if TARGET_API_MAC_CARBON
+ GetDialogItemAsControl(commandDialog, kCL_File, &control);
+ prefs.output_to_file = GetControlValue(control);
+ #else
+ GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
+ prefs.output_to_file = GetControlValue ((ControlHandle)dummyHandle);
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+ GetDialogItemAsControl(commandDialog, kCL_Video, &control);
+ videodriver = GetControlValue(control);
+ #else
+ GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
+ videodriver = GetControlValue ((ControlRef)dummyHandle);
+ #endif
+
+ DisposeDialog (commandDialog);
+
+ if (itemHit == kCL_Cancel ) {
+ exit (0);
+ }
+ }
+
+ /* Set pseudo-environment variables for video driver, update prefs */
+ switch ( videodriver ) {
+ case VIDEO_ID_DRAWSPROCKET:
+ SDL_putenv("SDL_VIDEODRIVER=DSp");
+ SDL_memcpy(prefs.video_driver_name, "\pDSp", 4);
+ break;
+ case VIDEO_ID_TOOLBOX:
+ SDL_putenv("SDL_VIDEODRIVER=toolbox");
+ SDL_memcpy(prefs.video_driver_name, "\ptoolbox", 8);
+ break;
+ }
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+ /* Redirect standard I/O to files */
+ if ( prefs.output_to_file ) {
+ freopen (STDOUT_FILE, "w", stdout);
+ freopen (STDERR_FILE, "w", stderr);
+ } else {
+ fclose (stdout);
+ fclose (stderr);
+ }
+#endif
+
+ if (settingsChanged) {
+ /* Save the prefs, even if they might not have changed (but probably did) */
+ if ( ! writePreferences (&prefs) )
+ fprintf (stderr, "WARNING: Could not save preferences!\n");
+ }
+
+#if !(defined(__APPLE__) && defined(__MACH__))
+ appNameText[0] = 0;
+ getCurrentAppName (appNameText); /* check for error here ? */
+
+ commandLine = (char*) malloc (appNameText[0] + prefs.command_line[0] + 2);
+ if ( commandLine == NULL ) {
+ exit(-1);
+ }
+
+ /* Rather than rewrite ParseCommandLine method, let's replace */
+ /* any spaces in application name with underscores, */
+ /* so that the app name is only 1 argument */
+ for (i = 1; i < 1+appNameText[0]; i++)
+ if ( appNameText[i] == ' ' ) appNameText[i] = '_';
+
+ /* Copy app name & full command text to command-line C-string */
+ SDL_memcpy(commandLine, appNameText + 1, appNameText[0]);
+ commandLine[appNameText[0]] = ' ';
+ SDL_memcpy(commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[0]);
+ commandLine[ appNameText[0] + 1 + prefs.command_line[0] ] = '\0';
+
+ /* Parse C-string into argv and argc */
+ nargs = ParseCommandLine (commandLine, NULL);
+ args = (char **)malloc((nargs+1)*(sizeof *args));
+ if ( args == NULL ) {
+ exit(-1);
+ }
+ ParseCommandLine (commandLine, args);
+
+ /* Run the main application code */
+ SDL_main(nargs, args);
+ free (args);
+ free (commandLine);
+
+ /* Remove useless stdout.txt and stderr.txt */
+ cleanup_output ();
+#else // defined(__APPLE__) && defined(__MACH__)
+ SDL_main(argc, argv);
+#endif
+
+ /* Exit cleanly, calling atexit() functions */
+ exit (0);
+
+ /* Never reached, but keeps the compiler quiet */
+ return (0);
+}
diff --git a/distrib/sdl-1.2.15/src/main/macos/SIZE.r b/distrib/sdl-1.2.15/src/main/macos/SIZE.r
new file mode 100644
index 0000000..fe63e19
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/SIZE.r
@@ -0,0 +1 @@
+ #include "Processes.r" resource 'SIZE' (-1) { reserved, acceptSuspendResumeEvents, reserved, canBackground, doesActivateOnFGSwitch, backgroundAndForeground, getFrontClicks, ignoreAppDiedEvents, is32BitCompatible, isHighLevelEventAware, onlyLocalHLEvents, notStationeryAware, useTextEditServices, reserved, reserved, reserved, 5242880, // 5 megs minimum 5242880 // 5 megs maximum }; \ No newline at end of file
diff --git a/distrib/sdl-1.2.15/src/main/macos/exports/Makefile b/distrib/sdl-1.2.15/src/main/macos/exports/Makefile
new file mode 100644
index 0000000..5f37ae0
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/exports/Makefile
@@ -0,0 +1,39 @@
+
+EXPORTS = SDL.x
+HEADERS = \
+ ../../../../include/SDL.h \
+ ../../../../include/SDL_active.h \
+ ../../../../include/SDL_audio.h \
+ ../../../../include/SDL_byteorder.h \
+ ../../../../include/SDL_cdrom.h \
+ ../../../../include/SDL_copying.h \
+ ../../../../include/SDL_cpuinfo.h \
+ ../../../../include/SDL_endian.h \
+ ../../../../include/SDL_error.h \
+ ../../../../include/SDL_events.h \
+ ../../../../include/SDL_getenv.h \
+ ../../../../include/SDL_joystick.h \
+ ../../../../include/SDL_keyboard.h \
+ ../../../../include/SDL_keysym.h \
+ ../../../../include/SDL_loadso.h \
+ ../../../../include/SDL_mouse.h \
+ ../../../../include/SDL_mutex.h \
+ ../../../../include/SDL_name.h \
+ ../../../../include/SDL_platform.h \
+ ../../../../include/SDL_quit.h \
+ ../../../../include/SDL_rwops.h \
+ ../../../../include/SDL_syswm.h \
+ ../../../../include/SDL_thread.h \
+ ../../../../include/SDL_timer.h \
+ ../../../../include/SDL_types.h \
+ ../../../../include/SDL_version.h \
+ ../../../../include/SDL_video.h
+
+
+all: $(EXPORTS)
+
+$(EXPORTS): Makefile gendef.pl $(HEADERS)
+ perl gendef.pl $(HEADERS) >$@ || rm $@
+
+clean:
+ rm -f $(EXPORTS)
diff --git a/distrib/sdl-1.2.15/src/main/macos/exports/SDL.x b/distrib/sdl-1.2.15/src/main/macos/exports/SDL.x
new file mode 100644
index 0000000..ce9e96e
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/exports/SDL.x
@@ -0,0 +1 @@
+ SDL_Init SDL_InitSubSystem SDL_QuitSubSystem SDL_WasInit SDL_Quit SDL_GetAppState SDL_AudioInit SDL_AudioQuit SDL_AudioDriverName SDL_OpenAudio SDL_GetAudioStatus SDL_PauseAudio SDL_LoadWAV_RW SDL_FreeWAV SDL_BuildAudioCVT SDL_ConvertAudio SDL_MixAudio SDL_LockAudio SDL_UnlockAudio SDL_CloseAudio SDL_CDNumDrives SDL_CDName SDL_CDOpen SDL_CDStatus SDL_CDPlayTracks SDL_CDPlay SDL_CDPause SDL_CDResume SDL_CDStop SDL_CDEject SDL_CDClose SDL_HasRDTSC SDL_HasMMX SDL_HasMMXExt SDL_Has3DNow SDL_Has3DNowExt SDL_HasSSE SDL_HasSSE2 SDL_HasAltiVec SDL_SetError SDL_GetError SDL_ClearError SDL_Error SDL_PumpEvents SDL_PeepEvents SDL_PollEvent SDL_WaitEvent SDL_PushEvent SDL_SetEventFilter SDL_GetEventFilter SDL_EventState SDL_NumJoysticks SDL_JoystickName SDL_JoystickOpen SDL_JoystickOpened SDL_JoystickIndex SDL_JoystickNumAxes SDL_JoystickNumBalls SDL_JoystickNumHats SDL_JoystickNumButtons SDL_JoystickUpdate SDL_JoystickEventState SDL_JoystickGetAxis SDL_JoystickGetHat SDL_JoystickGetBall SDL_JoystickGetButton SDL_JoystickClose SDL_EnableUNICODE SDL_EnableKeyRepeat SDL_GetKeyRepeat SDL_GetKeyState SDL_GetModState SDL_SetModState SDL_GetKeyName SDL_LoadObject SDL_LoadFunction SDL_UnloadObject SDL_GetMouseState SDL_GetRelativeMouseState SDL_WarpMouse SDL_CreateCursor SDL_SetCursor SDL_GetCursor SDL_FreeCursor SDL_ShowCursor SDL_CreateMutex SDL_mutexP SDL_mutexV SDL_DestroyMutex SDL_CreateSemaphore SDL_DestroySemaphore SDL_SemWait SDL_SemTryWait SDL_SemWaitTimeout SDL_SemPost SDL_SemValue SDL_CreateCond SDL_DestroyCond SDL_CondSignal SDL_CondBroadcast SDL_CondWait SDL_CondWaitTimeout SDL_RWFromFile SDL_RWFromFP SDL_RWFromMem SDL_RWFromConstMem SDL_AllocRW SDL_FreeRW SDL_ReadLE16 SDL_ReadBE16 SDL_ReadLE32 SDL_ReadBE32 SDL_ReadLE64 SDL_ReadBE64 SDL_WriteLE16 SDL_WriteBE16 SDL_WriteLE32 SDL_WriteBE32 SDL_WriteLE64 SDL_WriteBE64 SDL_GetWMInfo SDL_CreateThread SDL_CreateThread SDL_ThreadID SDL_GetThreadID SDL_WaitThread SDL_KillThread SDL_GetTicks SDL_Delay SDL_SetTimer SDL_AddTimer SDL_RemoveTimer SDL_Linked_Version SDL_VideoInit SDL_VideoQuit SDL_VideoDriverName SDL_GetVideoSurface SDL_GetVideoInfo SDL_VideoModeOK SDL_ListModes SDL_SetVideoMode SDL_UpdateRects SDL_UpdateRect SDL_Flip SDL_SetGamma SDL_SetGammaRamp SDL_GetGammaRamp SDL_SetColors SDL_SetPalette SDL_MapRGB SDL_MapRGBA SDL_GetRGB SDL_GetRGBA SDL_CreateRGBSurface SDL_CreateRGBSurfaceFrom SDL_FreeSurface SDL_LockSurface SDL_UnlockSurface SDL_LoadBMP_RW SDL_SaveBMP_RW SDL_SetColorKey SDL_SetAlpha SDL_SetClipRect SDL_GetClipRect SDL_ConvertSurface SDL_UpperBlit SDL_LowerBlit SDL_FillRect SDL_DisplayFormat SDL_DisplayFormatAlpha SDL_CreateYUVOverlay SDL_LockYUVOverlay SDL_UnlockYUVOverlay SDL_DisplayYUVOverlay SDL_FreeYUVOverlay SDL_GL_LoadLibrary SDL_GL_GetProcAddress SDL_GL_SetAttribute SDL_GL_GetAttribute SDL_GL_SwapBuffers SDL_GL_UpdateRects SDL_GL_Lock SDL_GL_Unlock SDL_WM_SetCaption SDL_WM_GetCaption SDL_WM_SetIcon SDL_WM_IconifyWindow SDL_WM_ToggleFullScreen SDL_WM_GrabInput SDL_SoftStretch SDL_putenv SDL_getenv SDL_qsort SDL_revcpy SDL_strlcpy SDL_strlcat SDL_strdup SDL_strrev SDL_strupr SDL_strlwr SDL_ltoa SDL_ultoa SDL_strcasecmp SDL_strncasecmp SDL_snprintf SDL_vsnprintf SDL_iconv SDL_iconv_string SDL_InitQuickDraw \ No newline at end of file
diff --git a/distrib/sdl-1.2.15/src/main/macos/exports/gendef.pl b/distrib/sdl-1.2.15/src/main/macos/exports/gendef.pl
new file mode 100644
index 0000000..9cffca9
--- /dev/null
+++ b/distrib/sdl-1.2.15/src/main/macos/exports/gendef.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+#
+# Program to take a set of header files and generate DLL export definitions
+
+# Special exports to ignore for this platform
+
+while ( ($file = shift(@ARGV)) ) {
+ if ( ! defined(open(FILE, $file)) ) {
+ warn "Couldn't open $file: $!\n";
+ next;
+ }
+ $printed_header = 0;
+ $file =~ s,.*/,,;
+ while (<FILE>) {
+ if ( / DECLSPEC.* SDLCALL ([^\s\(]+)/ ) {
+ if ( not $exclude{$1} ) {
+ print "\t$1\r";
+ }
+ }
+ }
+ close(FILE);
+}
+
+# Special exports to include for this platform
+print "\tSDL_putenv\r";
+print "\tSDL_getenv\r";
+print "\tSDL_qsort\r";
+print "\tSDL_revcpy\r";
+print "\tSDL_strlcpy\r";
+print "\tSDL_strlcat\r";
+print "\tSDL_strdup\r";
+print "\tSDL_strrev\r";
+print "\tSDL_strupr\r";
+print "\tSDL_strlwr\r";
+print "\tSDL_ltoa\r";
+print "\tSDL_ultoa\r";
+print "\tSDL_strcasecmp\r";
+print "\tSDL_strncasecmp\r";
+print "\tSDL_snprintf\r";
+print "\tSDL_vsnprintf\r";
+print "\tSDL_iconv\r";
+print "\tSDL_iconv_string\r";
+print "\tSDL_InitQuickDraw\r";