Updated MacOS Classic MPW build
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401428
This commit is contained in:
parent
ef1df3f896
commit
8e8a8d88df
24 changed files with 397 additions and 101 deletions
|
@ -24,10 +24,6 @@
|
|||
in the MacOS environment. (stdio/stderr is *not* directed for Mach-O builds)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#include <Carbon/Carbon.h>
|
||||
#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
|
||||
|
@ -89,7 +85,7 @@ static int ParseCommandLine(char *cmdline, char **argv)
|
|||
argc = 0;
|
||||
for ( bufp = cmdline; *bufp; ) {
|
||||
/* Skip leading whitespace */
|
||||
while ( isspace(*bufp) ) {
|
||||
while ( SDL_isspace(*bufp) ) {
|
||||
++bufp;
|
||||
}
|
||||
/* Skip over argument */
|
||||
|
@ -113,7 +109,7 @@ static int ParseCommandLine(char *cmdline, char **argv)
|
|||
++argc;
|
||||
}
|
||||
/* Skip over word */
|
||||
while ( *bufp && ! isspace(*bufp) ) {
|
||||
while ( *bufp && ! SDL_isspace(*bufp) ) {
|
||||
++bufp;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +172,7 @@ static int getCurrentAppName (StrFileName name) {
|
|||
if ( noErr != GetProcessInformation (&process, &process_info) )
|
||||
return 0;
|
||||
|
||||
memcpy (name, process_fsp.name, process_fsp.name[0] + 1);
|
||||
SDL_memcpy(name, process_fsp.name, process_fsp.name[0] + 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -205,8 +201,8 @@ static int getPrefsFile (FSSpec *prefs_fsp, int create) {
|
|||
if (app_name[0] > MAX_NAME )
|
||||
app_name[0] = MAX_NAME;
|
||||
|
||||
memcpy (prefs_name + 1, app_name + 1, app_name[0]);
|
||||
memcpy (prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX));
|
||||
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 */
|
||||
|
@ -215,7 +211,7 @@ static int getPrefsFile (FSSpec *prefs_fsp, int create) {
|
|||
return 0;
|
||||
else {
|
||||
/* Create the prefs file */
|
||||
memcpy (prefs_fsp->name, prefs_name, prefs_name[0] + 1);
|
||||
SDL_memcpy(prefs_fsp->name, prefs_name, prefs_name[0] + 1);
|
||||
prefs_fsp->parID = directory_id;
|
||||
prefs_fsp->vRefNum = volume_ref_number;
|
||||
|
||||
|
@ -241,11 +237,11 @@ static int readPrefsResource (PrefsRecord *prefs) {
|
|||
HLock(prefs_handle);
|
||||
|
||||
/* Get command line string */
|
||||
memcpy (prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
|
||||
SDL_memcpy(prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1);
|
||||
|
||||
/* Get video driver name */
|
||||
offset += (*prefs_handle)[0] + 1;
|
||||
memcpy (prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 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;
|
||||
|
@ -278,11 +274,11 @@ static int writePrefsResource (PrefsRecord *prefs, short resource_file) {
|
|||
|
||||
/* Command line text */
|
||||
offset = 0;
|
||||
memcpy (*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
|
||||
SDL_memcpy(*prefs_handle, prefs->command_line, prefs->command_line[0] + 1);
|
||||
|
||||
/* Video driver name */
|
||||
offset += prefs->command_line[0] + 1;
|
||||
memcpy (*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[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;
|
||||
|
@ -436,9 +432,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if ( readPreferences (&prefs) ) {
|
||||
|
||||
if (memcmp (prefs.video_driver_name+1, "DSp", 3) == 0)
|
||||
if (SDL_memcmp(prefs.video_driver_name+1, "DSp", 3) == 0)
|
||||
videodriver = 1;
|
||||
else if (memcmp (prefs.video_driver_name+1, "toolbox", 7) == 0)
|
||||
else if (SDL_memcmp(prefs.video_driver_name+1, "toolbox", 7) == 0)
|
||||
videodriver = 2;
|
||||
}
|
||||
|
||||
|
@ -540,12 +536,12 @@ int main(int argc, char *argv[])
|
|||
/* Set pseudo-environment variables for video driver, update prefs */
|
||||
switch ( videodriver ) {
|
||||
case VIDEO_ID_DRAWSPROCKET:
|
||||
putenv ("SDL_VIDEODRIVER=DSp");
|
||||
memcpy (prefs.video_driver_name, "\pDSp", 4);
|
||||
SDL_putenv("SDL_VIDEODRIVER=DSp");
|
||||
SDL_memcpy(prefs.video_driver_name, "\pDSp", 4);
|
||||
break;
|
||||
case VIDEO_ID_TOOLBOX:
|
||||
putenv ("SDL_VIDEODRIVER=toolbox");
|
||||
memcpy (prefs.video_driver_name, "\ptoolbox", 8);
|
||||
SDL_putenv("SDL_VIDEODRIVER=toolbox");
|
||||
SDL_memcpy(prefs.video_driver_name, "\ptoolbox", 8);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -582,9 +578,9 @@ int main(int argc, char *argv[])
|
|||
if ( appNameText[i] == ' ' ) appNameText[i] = '_';
|
||||
|
||||
/* Copy app name & full command text to command-line C-string */
|
||||
memcpy (commandLine, appNameText + 1, appNameText[0]);
|
||||
SDL_memcpy(commandLine, appNameText + 1, appNameText[0]);
|
||||
commandLine[appNameText[0]] = ' ';
|
||||
memcpy (commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue