Compare commits

...

2 Commits

Author SHA1 Message Date
Andrew Zirkel
01ec87daa9 Move SDL2 reference
Move SDL2 reference relevant to source, instead of from the system location.  This reflects how Xcode is setup.
2022-03-07 15:29:11 -05:00
Andrew Zirkel
56110e5177 Update utility.c
Do not write "HomeworldDataPath" to the config file if it is not set in the config file.  The reason is in MacOS the DataPath is typically contained within the app bundle, which can be moved.  Add other options not to write with "addOptionsNotToWrite".
2022-03-07 15:27:36 -05:00
3 changed files with 41 additions and 2 deletions

View File

@ -649,6 +649,8 @@ color versionColor = colWhite;
// some crude formatting within the .cfg's scriptEntry context
char filecfgblankspace = '\0';
//array of options to skip writing out, add dynamically in code
char optionsNotToWrite[200][50];
scriptEntry utyOptionsList[] =
{
@ -911,6 +913,40 @@ void utyOptionsFileRead(void)
}
/*-----------------------------------------------------------------------------
Name : addOptionsNotToWrite
Description : Adds an option to exclude writing to the Homeworld.ini file
Inputs : option name string
Outputs : Adds option to optionsNotToWrite
Return : void
----------------------------------------------------------------------------*/
void addOptionsNotToWrite(char option[]){
for (int i=0;i<sizeof(optionsNotToWrite)/sizeof(optionsNotToWrite[0]);i++) {
if (optionsNotToWrite[i][0]=='\0') {
strcpy(optionsNotToWrite[i],option);
break;
}
}
}
/*-----------------------------------------------------------------------------
Name : checkOptionsNotToWrite
Description : check if option is is contained in optionsNotToWrite
Inputs : option name string
Outputs :
Return : True if optionsNotToWrite contain inputed option, false otherwise
----------------------------------------------------------------------------*/
bool checkOptionsNotToWrite(char optionName[]){
for(int i=0;i<sizeof(optionsNotToWrite)/sizeof(optionsNotToWrite[0]);i++) {
if (strcmp(optionsNotToWrite[i],optionName) == 0) {
return TRUE;
}
}
return FALSE;
}
/*-----------------------------------------------------------------------------
Name : utyOptionsFileWrite
Description : Write a set of options from the Homeworld.ini file
@ -944,6 +980,7 @@ void utyOptionsFileWrite(void)
for (index = 0; utyOptionsList[index].name != NULL; index++)
{
if (checkOptionsNotToWrite(utyOptionsList[index].name)) continue;
if (utyOptionsList[index].setVarCB == scriptSetUbyteCB) {
fprintf(f, "%s %u\n", utyOptionsList[index].name,
*((ubyte *)utyOptionsList[index].dataPtr));
@ -3583,6 +3620,8 @@ char* utyGameSystemsPreInit(void)
// Check to see if fileHomeworldDataPath is set
if (fileHomeworldDataPath[0] == '\0')
{
//do not write this option out if it was not set in the config
addOptionsNotToWrite("HomeworldDataPath");
getcwd(filePathTempBuffer, PATH_MAX);
dataPath = filePathTempBuffer;

View File

@ -4,7 +4,7 @@
/usr/bin/gcc \
-D _MACOSX \
-I /Library/Frameworks/SDL2.framework/Headers \
-I ../../Mac/SDL2.framework/Headers \
-I ../../src/SDL \
-I ../../src/ThirdParty/CRC \
-I ../../src/ThirdParty/LZSS \

View File

@ -11,7 +11,7 @@
/usr/bin/gcc \
-D_MACOSX \
-I /Library/Frameworks/SDL2.framework/Headers \
-I ../../Mac/SDL2.framework/Headers \
*.c \
-o kas2c