summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/main/macos
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-02-07 20:04:46 -0500
committerFranklin Wei <git@fwei.tk>2018-03-12 20:52:01 -0400
commit6039eb05ba6d82ef56f2868c96654c552d117bf9 (patch)
tree9db7016bcbf66cfdf7b9bc998d84c6eaff9c8378 /apps/plugins/sdl/src/main/macos
parentef373c03b96b0be08babca581d9f10bccfd4931f (diff)
downloadrockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.tar.gz
rockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.zip
sdl: remove non-rockbox drivers
We never use any of these other drivers, so having them around just takes up space. Change-Id: Iced812162df1fef3fd55522b7e700acb6c3bcd41
Diffstat (limited to 'apps/plugins/sdl/src/main/macos')
-rw-r--r--apps/plugins/sdl/src/main/macos/SDL.r1
-rw-r--r--apps/plugins/sdl/src/main/macos/SDL.shlib.r1
-rw-r--r--apps/plugins/sdl/src/main/macos/SDL_main.c610
-rw-r--r--apps/plugins/sdl/src/main/macos/SIZE.r1
-rw-r--r--apps/plugins/sdl/src/main/macos/exports/Makefile39
-rw-r--r--apps/plugins/sdl/src/main/macos/exports/SDL.x1
-rw-r--r--apps/plugins/sdl/src/main/macos/exports/gendef.pl43
7 files changed, 0 insertions, 696 deletions
diff --git a/apps/plugins/sdl/src/main/macos/SDL.r b/apps/plugins/sdl/src/main/macos/SDL.r
deleted file mode 100644
index 438f6872ef..0000000000
--- a/apps/plugins/sdl/src/main/macos/SDL.r
+++ /dev/null
@@ -1 +0,0 @@
1data '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/apps/plugins/sdl/src/main/macos/SDL.shlib.r b/apps/plugins/sdl/src/main/macos/SDL.shlib.r
deleted file mode 100644
index 313c79485a..0000000000
--- a/apps/plugins/sdl/src/main/macos/SDL.shlib.r
+++ /dev/null
@@ -1 +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/apps/plugins/sdl/src/main/macos/SDL_main.c b/apps/plugins/sdl/src/main/macos/SDL_main.c
deleted file mode 100644
index ff1ffdca0d..0000000000
--- a/apps/plugins/sdl/src/main/macos/SDL_main.c
+++ /dev/null
@@ -1,610 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22
23/* This file takes care of command line argument parsing, and stdio redirection
24 in the MacOS environment. (stdio/stderr is *not* directed for Mach-O builds)
25 */
26
27#if defined(__APPLE__) && defined(__MACH__)
28#include <Carbon/Carbon.h>
29#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
30#include <Carbon.h>
31#else
32#include <Dialogs.h>
33#include <Fonts.h>
34#include <Events.h>
35#include <Resources.h>
36#include <Folders.h>
37#endif
38
39/* Include the SDL main definition header */
40#include "SDL.h"
41#include "SDL_main.h"
42#ifdef main
43#undef main
44#endif
45
46#if !(defined(__APPLE__) && defined(__MACH__))
47/* The standard output files */
48#define STDOUT_FILE "stdout.txt"
49#define STDERR_FILE "stderr.txt"
50#endif
51
52#if !defined(__MWERKS__) && !TARGET_API_MAC_CARBON
53 /* In MPW, the qd global has been removed from the libraries */
54 QDGlobals qd;
55#endif
56
57/* Structure for keeping prefs in 1 variable */
58typedef struct {
59 Str255 command_line;
60 Str255 video_driver_name;
61 Boolean output_to_file;
62} PrefsRecord;
63
64/* See if the command key is held down at startup */
65static Boolean CommandKeyIsDown(void)
66{
67 KeyMap theKeyMap;
68
69 GetKeys(theKeyMap);
70
71 if (((unsigned char *) theKeyMap)[6] & 0x80) {
72 return(true);
73 }
74 return(false);
75}
76
77#if !(defined(__APPLE__) && defined(__MACH__))
78
79/* Parse a command line buffer into arguments */
80static int ParseCommandLine(char *cmdline, char **argv)
81{
82 char *bufp;
83 int argc;
84
85 argc = 0;
86 for ( bufp = cmdline; *bufp; ) {
87 /* Skip leading whitespace */
88 while ( SDL_isspace(*bufp) ) {
89 ++bufp;
90 }
91 /* Skip over argument */
92 if ( *bufp == '"' ) {
93 ++bufp;
94 if ( *bufp ) {
95 if ( argv ) {
96 argv[argc] = bufp;
97 }
98 ++argc;
99 }
100 /* Skip over word */
101 while ( *bufp && (*bufp != '"') ) {
102 ++bufp;
103 }
104 } else {
105 if ( *bufp ) {
106 if ( argv ) {
107 argv[argc] = bufp;
108 }
109 ++argc;
110 }
111 /* Skip over word */
112 while ( *bufp && ! SDL_isspace(*bufp) ) {
113 ++bufp;
114 }
115 }
116 if ( *bufp ) {
117 if ( argv ) {
118 *bufp = '\0';
119 }
120 ++bufp;
121 }
122 }
123 if ( argv ) {
124 argv[argc] = NULL;
125 }
126 return(argc);
127}
128
129/* Remove the output files if there was no output written */
130static void cleanup_output(void)
131{
132 FILE *file;
133 int empty;
134
135 /* Flush the output in case anything is queued */
136 fclose(stdout);
137 fclose(stderr);
138
139 /* See if the files have any output in them */
140 file = fopen(STDOUT_FILE, "rb");
141 if ( file ) {
142 empty = (fgetc(file) == EOF) ? 1 : 0;
143 fclose(file);
144 if ( empty ) {
145 remove(STDOUT_FILE);
146 }
147 }
148 file = fopen(STDERR_FILE, "rb");
149 if ( file ) {
150 empty = (fgetc(file) == EOF) ? 1 : 0;
151 fclose(file);
152 if ( empty ) {
153 remove(STDERR_FILE);
154 }
155 }
156}
157
158#endif //!(defined(__APPLE__) && defined(__MACH__))
159
160static int getCurrentAppName (StrFileName name) {
161
162 ProcessSerialNumber process;
163 ProcessInfoRec process_info;
164 FSSpec process_fsp;
165
166 process.highLongOfPSN = 0;
167 process.lowLongOfPSN = kCurrentProcess;
168 process_info.processInfoLength = sizeof (process_info);
169 process_info.processName = NULL;
170 process_info.processAppSpec = &process_fsp;
171
172 if ( noErr != GetProcessInformation (&process, &process_info) )
173 return 0;
174
175 SDL_memcpy(name, process_fsp.name, process_fsp.name[0] + 1);
176 return 1;
177}
178
179static int getPrefsFile (FSSpec *prefs_fsp, int create) {
180
181 /* The prefs file name is the application name, possibly truncated, */
182 /* plus " Preferences */
183
184 #define SUFFIX " Preferences"
185 #define MAX_NAME 19 /* 31 - strlen (SUFFIX) */
186
187 short volume_ref_number;
188 long directory_id;
189 StrFileName prefs_name;
190 StrFileName app_name;
191
192 /* Get Preferences folder - works with Multiple Users */
193 if ( noErr != FindFolder ( kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder,
194 &volume_ref_number, &directory_id) )
195 exit (-1);
196
197 if ( ! getCurrentAppName (app_name) )
198 exit (-1);
199
200 /* Truncate if name is too long */
201 if (app_name[0] > MAX_NAME )
202 app_name[0] = MAX_NAME;
203
204 SDL_memcpy(prefs_name + 1, app_name + 1, app_name[0]);
205 SDL_memcpy(prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX));
206 prefs_name[0] = app_name[0] + strlen (SUFFIX);
207
208 /* Make the file spec for prefs file */
209 if ( noErr != FSMakeFSSpec (volume_ref_number, directory_id, prefs_name, prefs_fsp) ) {
210 if ( !create )
211 return 0;
212 else {
213 /* Create the prefs file */
214 SDL_memcpy(prefs_fsp->name, prefs_name, prefs_name[0] + 1);
215 prefs_fsp->parID = directory_id;
216 prefs_fsp->vRefNum = volume_ref_number;
217
218 FSpCreateResFile (prefs_fsp, 0x3f3f3f3f, 'pref', 0); // '????' parsed as trigraph
219
220 if ( noErr != ResError () )
221 return 0;
222 }
223 }
224 return 1;
225}
226
227static int readPrefsResource (PrefsRecord *prefs) {
228
229 Handle prefs_handle;
230
231 prefs_handle = Get1Resource( 'CLne', 128 );
232
233 if (prefs_handle != NULL) {
234 int offset = 0;
235// int j = 0;
236
237 HLock(prefs_handle);
238
239 /* Get command line string */
240 SDL_memcpy(prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
241
242 /* Get video driver name */
243 offset += (*prefs_handle)[0] + 1;
244 SDL_memcpy(prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 1);
245
246 /* Get save-to-file option (1 or 0) */
247 offset += (*prefs_handle)[offset] + 1;
248 prefs->output_to_file = (*prefs_handle)[offset];
249
250 ReleaseResource( prefs_handle );
251
252 return ResError() == noErr;
253 }
254
255 return 0;
256}
257
258static int writePrefsResource (PrefsRecord *prefs, short resource_file) {
259
260 Handle prefs_handle;
261
262 UseResFile (resource_file);
263
264 prefs_handle = Get1Resource ( 'CLne', 128 );
265 if (prefs_handle != NULL)
266 RemoveResource (prefs_handle);
267
268 prefs_handle = NewHandle ( prefs->command_line[0] + prefs->video_driver_name[0] + 4 );
269 if (prefs_handle != NULL) {
270
271 int offset;
272
273 HLock (prefs_handle);
274
275 /* Command line text */
276 offset = 0;
277 SDL_memcpy(*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
278
279 /* Video driver name */
280 offset += prefs->command_line[0] + 1;
281 SDL_memcpy(*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[0] + 1);
282
283 /* Output-to-file option */
284 offset += prefs->video_driver_name[0] + 1;
285 *( *((char**)prefs_handle) + offset) = (char)prefs->output_to_file;
286 *( *((char**)prefs_handle) + offset + 1) = 0;
287
288 AddResource (prefs_handle, 'CLne', 128, "\pCommand Line");
289 WriteResource (prefs_handle);
290 UpdateResFile (resource_file);
291 DisposeHandle (prefs_handle);
292
293 return ResError() == noErr;
294 }
295
296 return 0;
297}
298
299static int readPreferences (PrefsRecord *prefs) {
300
301 int no_error = 1;
302 FSSpec prefs_fsp;
303
304 /* Check for prefs file first */
305 if ( getPrefsFile (&prefs_fsp, 0) ) {
306
307 short prefs_resource;
308
309 prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdPerm);
310 if ( prefs_resource == -1 ) /* this shouldn't happen, but... */
311 return 0;
312
313 UseResFile (prefs_resource);
314 no_error = readPrefsResource (prefs);
315 CloseResFile (prefs_resource);
316 }
317
318 /* Fall back to application's resource fork (reading only, so this is safe) */
319 else {
320
321 no_error = readPrefsResource (prefs);
322 }
323
324 return no_error;
325}
326
327static int writePreferences (PrefsRecord *prefs) {
328
329 int no_error = 1;
330 FSSpec prefs_fsp;
331
332 /* Get prefs file, create if it doesn't exist */
333 if ( getPrefsFile (&prefs_fsp, 1) ) {
334
335 short prefs_resource;
336
337 prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdWrPerm);
338 if (prefs_resource == -1)
339 return 0;
340 no_error = writePrefsResource (prefs, prefs_resource);
341 CloseResFile (prefs_resource);
342 }
343
344 return no_error;
345}
346
347/* This is where execution begins */
348int main(int argc, char *argv[])
349{
350
351#if !(defined(__APPLE__) && defined(__MACH__))
352#pragma unused(argc, argv)
353#endif
354
355#define DEFAULT_ARGS "\p" /* pascal string for default args */
356#define DEFAULT_VIDEO_DRIVER "\ptoolbox" /* pascal string for default video driver name */
357#define DEFAULT_OUTPUT_TO_FILE 1 /* 1 == output to file, 0 == no output */
358
359#define VIDEO_ID_DRAWSPROCKET 1 /* these correspond to popup menu choices */
360#define VIDEO_ID_TOOLBOX 2
361
362 PrefsRecord prefs = { DEFAULT_ARGS, DEFAULT_VIDEO_DRIVER, DEFAULT_OUTPUT_TO_FILE };
363
364#if !(defined(__APPLE__) && defined(__MACH__))
365 int nargs;
366 char **args;
367 char *commandLine;
368
369 StrFileName appNameText;
370#endif
371 int videodriver = VIDEO_ID_TOOLBOX;
372 int settingsChanged = 0;
373
374 long i;
375
376 /* Kyle's SDL command-line dialog code ... */
377#if !TARGET_API_MAC_CARBON
378 InitGraf (&qd.thePort);
379 InitFonts ();
380 InitWindows ();
381 InitMenus ();
382 InitDialogs (nil);
383#endif
384 InitCursor ();
385 FlushEvents(everyEvent,0);
386#if !TARGET_API_MAC_CARBON
387 MaxApplZone ();
388#endif
389 MoreMasters ();
390 MoreMasters ();
391#if 0
392 /* Intialize SDL, and put up a dialog if we fail */
393 if ( SDL_Init (0) < 0 ) {
394
395#define kErr_OK 1
396#define kErr_Text 2
397
398 DialogPtr errorDialog;
399 short dummyType;
400 Rect dummyRect;
401 Handle dummyHandle;
402 short itemHit;
403
404 errorDialog = GetNewDialog (1001, nil, (WindowPtr)-1);
405 if (errorDialog == NULL)
406 return -1;
407 DrawDialog (errorDialog);
408
409 GetDialogItem (errorDialog, kErr_Text, &dummyType, &dummyHandle, &dummyRect);
410 SetDialogItemText (dummyHandle, "\pError Initializing SDL");
411
412#if TARGET_API_MAC_CARBON
413 SetPort (GetDialogPort(errorDialog));
414#else
415 SetPort (errorDialog);
416#endif
417 do {
418 ModalDialog (nil, &itemHit);
419 } while (itemHit != kErr_OK);
420
421 DisposeDialog (errorDialog);
422 exit (-1);
423 }
424 atexit(cleanup_output);
425 atexit(SDL_Quit);
426#endif
427
428/* Set up SDL's QuickDraw environment */
429#if !TARGET_API_MAC_CARBON
430 SDL_InitQuickDraw(&qd);
431#endif
432
433 if ( readPreferences (&prefs) ) {
434
435 if (SDL_memcmp(prefs.video_driver_name+1, "DSp", 3) == 0)
436 videodriver = 1;
437 else if (SDL_memcmp(prefs.video_driver_name+1, "toolbox", 7) == 0)
438 videodriver = 2;
439 }
440
441 if ( CommandKeyIsDown() ) {
442
443#define kCL_OK 1
444#define kCL_Cancel 2
445#define kCL_Text 3
446#define kCL_File 4
447#define kCL_Video 6
448
449 DialogPtr commandDialog;
450 short dummyType;
451 Rect dummyRect;
452 Handle dummyHandle;
453 short itemHit;
454 #if TARGET_API_MAC_CARBON
455 ControlRef control;
456 #endif
457
458 /* Assume that they will change settings, rather than do exhaustive check */
459 settingsChanged = 1;
460
461 /* Create dialog and display it */
462 commandDialog = GetNewDialog (1000, nil, (WindowPtr)-1);
463 #if TARGET_API_MAC_CARBON
464 SetPort ( GetDialogPort(commandDialog) );
465 #else
466 SetPort (commandDialog);
467 #endif
468
469 /* Setup controls */
470 #if TARGET_API_MAC_CARBON
471 GetDialogItemAsControl(commandDialog, kCL_File, &control);
472 SetControlValue (control, prefs.output_to_file);
473 #else
474 GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
475 SetControlValue ((ControlHandle)dummyHandle, prefs.output_to_file );
476 #endif
477
478 GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect);
479 SetDialogItemText (dummyHandle, prefs.command_line);
480
481 #if TARGET_API_MAC_CARBON
482 GetDialogItemAsControl(commandDialog, kCL_Video, &control);
483 SetControlValue (control, videodriver);
484 #else
485 GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
486 SetControlValue ((ControlRef)dummyHandle, videodriver);
487 #endif
488
489 SetDialogDefaultItem (commandDialog, kCL_OK);
490 SetDialogCancelItem (commandDialog, kCL_Cancel);
491
492 do {
493
494 ModalDialog(nil, &itemHit); /* wait for user response */
495
496 /* Toggle command-line output checkbox */
497 if ( itemHit == kCL_File ) {
498 #if TARGET_API_MAC_CARBON
499 GetDialogItemAsControl(commandDialog, kCL_File, &control);
500 SetControlValue (control, !GetControlValue(control));
501 #else
502 GetDialogItem(commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
503 SetControlValue((ControlHandle)dummyHandle, !GetControlValue((ControlHandle)dummyHandle) );
504 #endif
505 }
506
507 } while (itemHit != kCL_OK && itemHit != kCL_Cancel);
508
509 /* Get control values, even if they did not change */
510 GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect); /* MJS */
511 GetDialogItemText (dummyHandle, prefs.command_line);
512
513 #if TARGET_API_MAC_CARBON
514 GetDialogItemAsControl(commandDialog, kCL_File, &control);
515 prefs.output_to_file = GetControlValue(control);
516 #else
517 GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
518 prefs.output_to_file = GetControlValue ((ControlHandle)dummyHandle);
519 #endif
520
521 #if TARGET_API_MAC_CARBON
522 GetDialogItemAsControl(commandDialog, kCL_Video, &control);
523 videodriver = GetControlValue(control);
524 #else
525 GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
526 videodriver = GetControlValue ((ControlRef)dummyHandle);
527 #endif
528
529 DisposeDialog (commandDialog);
530
531 if (itemHit == kCL_Cancel ) {
532 exit (0);
533 }
534 }
535
536 /* Set pseudo-environment variables for video driver, update prefs */
537 switch ( videodriver ) {
538 case VIDEO_ID_DRAWSPROCKET:
539 SDL_putenv("SDL_VIDEODRIVER=DSp");
540 SDL_memcpy(prefs.video_driver_name, "\pDSp", 4);
541 break;
542 case VIDEO_ID_TOOLBOX:
543 SDL_putenv("SDL_VIDEODRIVER=toolbox");
544 SDL_memcpy(prefs.video_driver_name, "\ptoolbox", 8);
545 break;
546 }
547
548#if !(defined(__APPLE__) && defined(__MACH__))
549 /* Redirect standard I/O to files */
550 if ( prefs.output_to_file ) {
551 freopen (STDOUT_FILE, "w", stdout);
552 freopen (STDERR_FILE, "w", stderr);
553 } else {
554 fclose (stdout);
555 fclose (stderr);
556 }
557#endif
558
559 if (settingsChanged) {
560 /* Save the prefs, even if they might not have changed (but probably did) */
561 if ( ! writePreferences (&prefs) )
562 fprintf (stderr, "WARNING: Could not save preferences!\n");
563 }
564
565#if !(defined(__APPLE__) && defined(__MACH__))
566 appNameText[0] = 0;
567 getCurrentAppName (appNameText); /* check for error here ? */
568
569 commandLine = (char*) malloc (appNameText[0] + prefs.command_line[0] + 2);
570 if ( commandLine == NULL ) {
571 exit(-1);
572 }
573
574 /* Rather than rewrite ParseCommandLine method, let's replace */
575 /* any spaces in application name with underscores, */
576 /* so that the app name is only 1 argument */
577 for (i = 1; i < 1+appNameText[0]; i++)
578 if ( appNameText[i] == ' ' ) appNameText[i] = '_';
579
580 /* Copy app name & full command text to command-line C-string */
581 SDL_memcpy(commandLine, appNameText + 1, appNameText[0]);
582 commandLine[appNameText[0]] = ' ';
583 SDL_memcpy(commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[0]);
584 commandLine[ appNameText[0] + 1 + prefs.command_line[0] ] = '\0';
585
586 /* Parse C-string into argv and argc */
587 nargs = ParseCommandLine (commandLine, NULL);
588 args = (char **)malloc((nargs+1)*(sizeof *args));
589 if ( args == NULL ) {
590 exit(-1);
591 }
592 ParseCommandLine (commandLine, args);
593
594 /* Run the main application code */
595 SDL_main(nargs, args);
596 free (args);
597 free (commandLine);
598
599 /* Remove useless stdout.txt and stderr.txt */
600 cleanup_output ();
601#else // defined(__APPLE__) && defined(__MACH__)
602 SDL_main(argc, argv);
603#endif
604
605 /* Exit cleanly, calling atexit() functions */
606 exit (0);
607
608 /* Never reached, but keeps the compiler quiet */
609 return (0);
610}
diff --git a/apps/plugins/sdl/src/main/macos/SIZE.r b/apps/plugins/sdl/src/main/macos/SIZE.r
deleted file mode 100644
index 940f37fc7f..0000000000
--- a/apps/plugins/sdl/src/main/macos/SIZE.r
+++ /dev/null
@@ -1 +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/apps/plugins/sdl/src/main/macos/exports/Makefile b/apps/plugins/sdl/src/main/macos/exports/Makefile
deleted file mode 100644
index 5f37ae0760..0000000000
--- a/apps/plugins/sdl/src/main/macos/exports/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
1
2EXPORTS = SDL.x
3HEADERS = \
4 ../../../../include/SDL.h \
5 ../../../../include/SDL_active.h \
6 ../../../../include/SDL_audio.h \
7 ../../../../include/SDL_byteorder.h \
8 ../../../../include/SDL_cdrom.h \
9 ../../../../include/SDL_copying.h \
10 ../../../../include/SDL_cpuinfo.h \
11 ../../../../include/SDL_endian.h \
12 ../../../../include/SDL_error.h \
13 ../../../../include/SDL_events.h \
14 ../../../../include/SDL_getenv.h \
15 ../../../../include/SDL_joystick.h \
16 ../../../../include/SDL_keyboard.h \
17 ../../../../include/SDL_keysym.h \
18 ../../../../include/SDL_loadso.h \
19 ../../../../include/SDL_mouse.h \
20 ../../../../include/SDL_mutex.h \
21 ../../../../include/SDL_name.h \
22 ../../../../include/SDL_platform.h \
23 ../../../../include/SDL_quit.h \
24 ../../../../include/SDL_rwops.h \
25 ../../../../include/SDL_syswm.h \
26 ../../../../include/SDL_thread.h \
27 ../../../../include/SDL_timer.h \
28 ../../../../include/SDL_types.h \
29 ../../../../include/SDL_version.h \
30 ../../../../include/SDL_video.h
31
32
33all: $(EXPORTS)
34
35$(EXPORTS): Makefile gendef.pl $(HEADERS)
36 perl gendef.pl $(HEADERS) >$@ || rm $@
37
38clean:
39 rm -f $(EXPORTS)
diff --git a/apps/plugins/sdl/src/main/macos/exports/SDL.x b/apps/plugins/sdl/src/main/macos/exports/SDL.x
deleted file mode 100644
index 4830c43e93..0000000000
--- a/apps/plugins/sdl/src/main/macos/exports/SDL.x
+++ /dev/null
@@ -1 +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/apps/plugins/sdl/src/main/macos/exports/gendef.pl b/apps/plugins/sdl/src/main/macos/exports/gendef.pl
deleted file mode 100644
index 9cffca92aa..0000000000
--- a/apps/plugins/sdl/src/main/macos/exports/gendef.pl
+++ /dev/null
@@ -1,43 +0,0 @@
1#!/usr/bin/perl
2#
3# Program to take a set of header files and generate DLL export definitions
4
5# Special exports to ignore for this platform
6
7while ( ($file = shift(@ARGV)) ) {
8 if ( ! defined(open(FILE, $file)) ) {
9 warn "Couldn't open $file: $!\n";
10 next;
11 }
12 $printed_header = 0;
13 $file =~ s,.*/,,;
14 while (<FILE>) {
15 if ( / DECLSPEC.* SDLCALL ([^\s\(]+)/ ) {
16 if ( not $exclude{$1} ) {
17 print "\t$1\r";
18 }
19 }
20 }
21 close(FILE);
22}
23
24# Special exports to include for this platform
25print "\tSDL_putenv\r";
26print "\tSDL_getenv\r";
27print "\tSDL_qsort\r";
28print "\tSDL_revcpy\r";
29print "\tSDL_strlcpy\r";
30print "\tSDL_strlcat\r";
31print "\tSDL_strdup\r";
32print "\tSDL_strrev\r";
33print "\tSDL_strupr\r";
34print "\tSDL_strlwr\r";
35print "\tSDL_ltoa\r";
36print "\tSDL_ultoa\r";
37print "\tSDL_strcasecmp\r";
38print "\tSDL_strncasecmp\r";
39print "\tSDL_snprintf\r";
40print "\tSDL_vsnprintf\r";
41print "\tSDL_iconv\r";
42print "\tSDL_iconv_string\r";
43print "\tSDL_InitQuickDraw\r";