File confec.cpp changed (mode: 100644) (index 78729cf..4a7f0a1) |
... |
... |
struct SpecialItem { |
456 |
456 |
int32_t special_item_result = 0; |
int32_t special_item_result = 0; |
457 |
457 |
|
|
458 |
458 |
// App variable definitions. |
// App variable definitions. |
459 |
|
std::string app_version = "v0.6.2"; |
|
|
459 |
|
std::string app_version = "v0.6.3"; |
460 |
460 |
#ifdef __DEMO__ |
#ifdef __DEMO__ |
461 |
461 |
app_version += " demo"; |
app_version += " demo"; |
462 |
462 |
std::string app_name = "Confectioner Engine Demo"; |
std::string app_name = "Confectioner Engine Demo"; |
|
... |
... |
int main( int argc, char* argv[] ){ |
941 |
941 |
} |
} |
942 |
942 |
#endif |
#endif |
943 |
943 |
|
|
944 |
|
bool windowed_mode = false; |
|
|
944 |
|
bool save_here = false, windowed_mode = false; |
945 |
945 |
|
|
946 |
946 |
for( int i = 1; i < argc; i++ ){ |
for( int i = 1; i < argc; i++ ){ |
947 |
947 |
std::string arg( argv[i] ); |
std::string arg( argv[i] ); |
|
... |
... |
int main( int argc, char* argv[] ){ |
953 |
953 |
// parameters. |
// parameters. |
954 |
954 |
mod_paths.insert( mod_paths.begin(), arg.substr( 2 ) ); |
mod_paths.insert( mod_paths.begin(), arg.substr( 2 ) ); |
955 |
955 |
printf( "Using mod: %s\n", mod_paths[0].c_str() ); |
printf( "Using mod: %s\n", mod_paths[0].c_str() ); |
|
956 |
|
}else if( arg == "--savehere" ){ |
|
957 |
|
save_here = true; |
|
958 |
|
printf( "Using the game folder for saving.\n" ); |
956 |
959 |
}else if( arg == "--window" ){ |
}else if( arg == "--window" ){ |
957 |
960 |
windowed_mode = true; |
windowed_mode = true; |
958 |
961 |
printf( "Starting in windowed mode.\n" ); |
printf( "Starting in windowed mode.\n" ); |
|
... |
... |
int main( int argc, char* argv[] ){ |
960 |
963 |
fprintf( |
fprintf( |
961 |
964 |
stderr, |
stderr, |
962 |
965 |
"Unrecognized argument. Valid arguments are:\n%s\n", |
"Unrecognized argument. Valid arguments are:\n%s\n", |
963 |
|
"-mModPath --window" |
|
|
966 |
|
"-mModPath --savehere --window" |
964 |
967 |
); |
); |
965 |
968 |
} |
} |
966 |
969 |
}else{ |
}else{ |
|
... |
... |
int main( int argc, char* argv[] ){ |
972 |
975 |
// Default to a local path if there is no system user data folder. |
// Default to a local path if there is no system user data folder. |
973 |
976 |
user_data_path = data_path + "/userdata"; |
user_data_path = data_path + "/userdata"; |
974 |
977 |
|
|
975 |
|
// Make a user data path based on platform and app name. |
|
976 |
|
#ifdef _WIN32 |
|
977 |
|
// Windows. |
|
978 |
|
char* localappdata = std::getenv( "LocalAppData" ); |
|
979 |
|
if( localappdata ){ |
|
980 |
|
user_data_path = std::string( localappdata ) + "/" + app_name; |
|
981 |
|
} |
|
982 |
|
#elif defined(__APPLE__) |
|
983 |
|
// MacOS (and iOS?) |
|
984 |
|
// This does not work with MacOS sandboxing. |
|
985 |
|
char* home = std::getenv( "HOME" ); |
|
986 |
|
if( home ){ |
|
987 |
|
user_data_path = std::string( home ) + "/Library/Application Support/" + app_name; |
|
988 |
|
} |
|
989 |
|
#elif !defined(__EMSCRIPTEN__) |
|
990 |
|
// Other POSIX (Linux, Android, etc.) |
|
991 |
|
char* xdgdatahome = std::getenv( "XDG_DATA_HOME" ); |
|
992 |
|
if( xdgdatahome ){ |
|
993 |
|
user_data_path = std::string( xdgdatahome ) + "/" + app_name; |
|
994 |
|
}else{ |
|
|
978 |
|
if( !save_here ){ |
|
979 |
|
// Make a user data path based on platform and app name. |
|
980 |
|
#ifdef _WIN32 |
|
981 |
|
// Windows. |
|
982 |
|
char* localappdata = std::getenv( "LocalAppData" ); |
|
983 |
|
if( localappdata ){ |
|
984 |
|
user_data_path = std::string( localappdata ) + "/" + app_name; |
|
985 |
|
} |
|
986 |
|
#elif defined(__APPLE__) |
|
987 |
|
// MacOS (and iOS?) |
|
988 |
|
// This does not work with MacOS sandboxing. |
995 |
989 |
char* home = std::getenv( "HOME" ); |
char* home = std::getenv( "HOME" ); |
996 |
990 |
if( home ){ |
if( home ){ |
997 |
|
user_data_path = std::string( home ) + "/.local/share/" + app_name; |
|
|
991 |
|
user_data_path = std::string( home ) + "/Library/Application Support/" + app_name; |
998 |
992 |
} |
} |
999 |
|
} |
|
1000 |
|
#endif |
|
|
993 |
|
#elif !defined(__EMSCRIPTEN__) |
|
994 |
|
// Other POSIX (Linux, Android, etc.) |
|
995 |
|
char* xdgdatahome = std::getenv( "XDG_DATA_HOME" ); |
|
996 |
|
if( xdgdatahome ){ |
|
997 |
|
user_data_path = std::string( xdgdatahome ) + "/" + app_name; |
|
998 |
|
}else{ |
|
999 |
|
char* home = std::getenv( "HOME" ); |
|
1000 |
|
if( home ){ |
|
1001 |
|
user_data_path = std::string( home ) + "/.local/share/" + app_name; |
|
1002 |
|
} |
|
1003 |
|
} |
|
1004 |
|
#endif |
|
1005 |
|
} |
1001 |
1006 |
|
|
1002 |
1007 |
// Create the user data folder if it doesn't exist. |
// Create the user data folder if it doesn't exist. |
1003 |
1008 |
#if defined(_MSC_VER) |
#if defined(_MSC_VER) |