add -r flag to generate rez file/proper resource fork at run time

This commit is contained in:
Kelvin Sherlock 2021-05-05 21:58:48 -04:00
parent 34fd580448
commit fb3ea1342d
3 changed files with 15 additions and 7 deletions

View File

@ -26,7 +26,6 @@
// This enables a workaround for creating the resources by writing a .rez file rather than
// writing it directly. At the moment, Golden Gate does not support writing resources
// but this will let me test it without that capability.
#define RESOURCE_WORKAROUND
#define TEACH_FILE_TYPE 0x50
#define TEACH_AUX_TYPE 0x5445
@ -159,7 +158,6 @@ MD_SIZE outputPos(void)
static int writeResources(void)
{
int result = 0;
#ifndef RESOURCE_WORKAROUND
int shutdownResources = 0;
Word writeResId;
Word oldResId;
@ -216,7 +214,14 @@ error:
if (shutdownResources)
ResourceShutDown();
#else
return result;
}
static int writeRez(void)
{
int result = 0;
FILE * rezFile;
uint8_t * ptr;
uint32_t size;
@ -279,7 +284,6 @@ error:
"\n");
fclose(rezFile);
#endif
return result;
}
@ -295,7 +299,7 @@ int closeOutputFile(void)
closeRec.refNum = writeRec.refNum;
CloseGS(&closeRec);
return writeResources();
return generateRez ? writeRez() : writeResources();
}

View File

@ -36,13 +36,14 @@
char * commandName;
int debugEnabled = 0;
int debugIndentLevel = 0;
int generateRez = 0;
// Implementation
static void printUsage(void)
{
fprintf(stderr, "USAGE: %s [ -d ] inputfile outputfile\n", commandName);
fprintf(stderr, "USAGE: %s [ -d -r ] inputfile outputfile\n", commandName);
}
@ -64,6 +65,9 @@ static int parseArgs(int argc, char * argv[])
case 'd':
debugEnabled = 1;
break;
case 'r':
generateRez = 1;
break;
default:
printUsage();

View File

@ -13,6 +13,6 @@
extern char * commandName;
extern int debugEnabled;
extern int debugIndentLevel;
extern int generateRez;
#endif /* main_h */