From: Holger Schemel Date: Fri, 10 Jun 2022 10:31:16 +0000 (+0200) Subject: changed some platform-related preprocessor definition names X-Git-Tag: 4.3.2.2~16 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=c8689f0335cd584d24570046c6eb5a3b75701305 changed some platform-related preprocessor definition names --- diff --git a/src/events.c b/src/events.c index 7a6ff377..4a31bcd6 100644 --- a/src/events.c +++ b/src/events.c @@ -585,7 +585,7 @@ void HandleWheelEvent(WheelEvent *event) event->y < 0 ? MB_WHEEL_DOWN : event->y > 0 ? MB_WHEEL_UP : 0); -#if defined(PLATFORM_WIN32) || defined(PLATFORM_MACOSX) +#if defined(PLATFORM_WINDOWS) || defined(PLATFORM_MAC) // accelerated mouse wheel available on Mac and Windows wheel_steps = (event->x ? ABS(event->x) : ABS(event->y)); #else diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 54e5bfd1..7b82420c 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -763,7 +763,7 @@ static unsigned int init_random_number_ext(int nr, int seed) // default random seed seed = (int)time(NULL); // seconds since the epoch -#if !defined(PLATFORM_WIN32) +#if !defined(PLATFORM_WINDOWS) // add some more randomness struct timeval current_time; @@ -896,7 +896,7 @@ char *getLoginName(void) { static char *login_name = NULL; -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) if (login_name == NULL) { unsigned long buffer_size = MAX_USERNAME_LEN + 1; @@ -927,7 +927,7 @@ char *getRealName(void) { static char *real_name = NULL; -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) if (real_name == NULL) { static char buffer[MAX_USERNAME_LEN + 1]; @@ -1543,7 +1543,7 @@ void GetOptions(int argc, char *argv[], if (option_arg == next_option) options_left++; } -#if defined(PLATFORM_MACOSX) +#if defined(PLATFORM_MAC) else if (strPrefix(option, "-psn")) { // ignore process serial number when launched via GUI on Mac OS X @@ -1617,7 +1617,7 @@ void checked_free(void *ptr) void clear_mem(void *ptr, unsigned int size) { -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) // for unknown reason, memset() sometimes crashes when compiled with MinGW char *cptr = (char *)ptr; @@ -4201,7 +4201,7 @@ void DumpLogFile(int nr) void NotifyUserAboutErrorFile(void) { -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) char *title_text = getStringCat2(program.program_title, " Error Message"); char *error_text = getStringCat2("The program was aborted due to an error; " "for details, see the following error file:" diff --git a/src/libgame/platform.h b/src/libgame/platform.h index ee7bff30..b9c8a411 100644 --- a/src/libgame/platform.h +++ b/src/libgame/platform.h @@ -16,8 +16,8 @@ // define main platform keywords // ============================================================================ -#if defined(WIN32) || defined(_WIN32) -#define PLATFORM_WIN32 +#if defined(WIN32) || defined(_WIN32) || defined(_WIN64) +#define PLATFORM_WINDOWS #define PLATFORM_STRING "Windows" #else #define PLATFORM_UNIX @@ -86,7 +86,7 @@ #endif #if defined(__APPLE__) && defined(__MACH__) -#define PLATFORM_MACOSX +#define PLATFORM_MAC #undef PLATFORM_STRING #define PLATFORM_STRING "Mac" #endif diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index b75f2c8c..5be4c0dc 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -264,7 +264,7 @@ static void SDLSetWindowIcon(char *basename) // (setting the window icon on Mac OS X would replace the high-quality // dock icon with the currently smaller (and uglier) icon from file) -#if !defined(PLATFORM_MACOSX) +#if !defined(PLATFORM_MAC) char *filename = getCustomImageFilename(basename); SDL_Surface *surface; diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index a5271c81..a45e68ec 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -17,7 +17,7 @@ #include #include #include -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) #include #endif diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 8da478a3..58e13b6b 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -516,7 +516,7 @@ char *getProgramMainDataPath(char *command_filename, char *base_path) set the current working directory to the program package directory) */ char *main_data_path = getBasePath(command_filename); -#if defined(PLATFORM_MACOSX) +#if defined(PLATFORM_MAC) if (strSuffix(main_data_path, MAC_APP_BINARY_SUBDIR)) { char *main_data_path_old = main_data_path; @@ -1785,7 +1785,7 @@ void sortTreeInfo(TreeInfo **node_first) // some stuff from "files.c" // ============================================================================ -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) #ifndef S_IRGRP #define S_IRGRP S_IRUSR #endif @@ -1810,7 +1810,7 @@ void sortTreeInfo(TreeInfo **node_first) #ifndef S_ISGID #define S_ISGID 0 #endif -#endif // PLATFORM_WIN32 +#endif // PLATFORM_WINDOWS // file permissions for newly written files #define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH) @@ -1834,7 +1834,7 @@ char *getHomeDir(void) { static char *dir = NULL; -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) if (dir == NULL) { dir = checked_malloc(MAX_PATH + 1); @@ -1868,7 +1868,7 @@ char *getPersonalDataDir(void) { static char *personal_data_dir = NULL; -#if defined(PLATFORM_MACOSX) +#if defined(PLATFORM_MAC) if (personal_data_dir == NULL) personal_data_dir = getPath2(getHomeDir(), "Documents"); #else @@ -1922,7 +1922,7 @@ static mode_t posix_umask(mode_t mask) static int posix_mkdir(const char *pathname, mode_t mode) { -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) return mkdir(pathname); #else return mkdir(pathname, mode); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index d7ec9504..12b01c38 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -233,7 +233,7 @@ static void Mixer_PlayMusicChannel(void) Mix_VolumeMusic(mixer[audio.music_channel].volume); Mix_FadeInMusic(mixer[audio.music_channel].data_ptr, loops, 100); -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) // playing MIDI music is broken since Windows Vista, as it sets the volume // for MIDI music also for all other sounds and music, which cannot be set // back to normal unless playing MIDI music again with that desired volume @@ -281,7 +281,7 @@ static void Mixer_FadeMusicChannel(void) Mix_FadeOutMusic(SOUND_FADING_INTERVAL); -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) // playing MIDI music is broken since Windows Vista, as it sets the volume // for MIDI music also for all other sounds and music, which cannot be set // back to normal unless playing MIDI music again with that desired volume diff --git a/src/libgame/sound.h b/src/libgame/sound.h index a2a65999..190c441e 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -35,7 +35,7 @@ #define DEFAULT_AUDIO_SAMPLE_RATE AUDIO_SAMPLE_RATE_22050 -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) #define DEFAULT_AUDIO_FRAGMENT_SIZE AUDIO_FRAGMENT_SIZE_1024 #else #define DEFAULT_AUDIO_FRAGMENT_SIZE AUDIO_FRAGMENT_SIZE_512 diff --git a/src/libgame/system.h b/src/libgame/system.h index 60a2d7cc..4b57594d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -16,9 +16,9 @@ #include "types.h" -#if defined(PLATFORM_MACOSX) +#if defined(PLATFORM_MAC) #include "macosx.h" -#elif defined(PLATFORM_WIN32) +#elif defined(PLATFORM_WINDOWS) #include "windows.h" #elif defined(PLATFORM_ANDROID) #include "android.h" @@ -163,7 +163,7 @@ #define DEFAULT_KEY_RIGHT KSYM_Right #define DEFAULT_KEY_UP KSYM_Up #define DEFAULT_KEY_DOWN KSYM_Down -#if defined(PLATFORM_MACOSX) +#if defined(PLATFORM_MAC) #define DEFAULT_KEY_SNAP KSYM_Control_L #define DEFAULT_KEY_DROP KSYM_KP_Enter #else @@ -722,7 +722,7 @@ #define STRING_NEWLINE_UNIX "\n" #define STRING_NEWLINE_DOS "\r\n" -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) #define CHAR_PATH_SEPARATOR CHAR_PATH_SEPARATOR_DOS #define STRING_PATH_SEPARATOR STRING_PATH_SEPARATOR_DOS #define STRING_NEWLINE STRING_NEWLINE_DOS diff --git a/src/libgame/types.h b/src/libgame/types.h index 62752f1f..9fb00ec7 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -19,7 +19,7 @@ #include -#if !defined(PLATFORM_WIN32) +#if !defined(PLATFORM_WINDOWS) typedef int boolean; typedef unsigned char byte; #endif diff --git a/src/main.c b/src/main.c index 1cf3c9e6..a4c95d26 100644 --- a/src/main.c +++ b/src/main.c @@ -7831,7 +7831,7 @@ static void InitProgramConfig(char *command_filename) strlen(setup.internal.program_icon_file) > 0) program_icon_file = getStringCopy(setup.internal.program_icon_file); -#if defined(PLATFORM_WIN32) || defined(PLATFORM_MACOSX) || defined(PLATFORM_EMSCRIPTEN) +#if defined(PLATFORM_WINDOWS) || defined(PLATFORM_MAC) || defined(PLATFORM_EMSCRIPTEN) userdata_subdir = program_title; #elif defined(PLATFORM_UNIX) userdata_subdir = getStringCat2(".", userdata_basename); diff --git a/src/tools.c b/src/tools.c index bbfd5c15..f3f6a33b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9976,7 +9976,7 @@ void OpenURLFromHash(SetupFileHash *hash, int hash_key) // tests // ============================================================================ -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) /* FILETIME of Jan 1 1970 00:00:00. */ static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL); @@ -10030,7 +10030,7 @@ static char *test_init_uuid_random_function_better(void) return seed_text; } -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) static char *test_init_uuid_random_function_better_windows(void) { static char seed_text[100]; @@ -10058,7 +10058,7 @@ static unsigned int test_uuid_random_function_better(int max) return (max > 0 ? prng_get_uint() % max : 0); } -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) #define NUM_UUID_TESTS 3 #else #define NUM_UUID_TESTS 2 @@ -10085,7 +10085,7 @@ static void TestGeneratingUUIDs_RunTest(int nr, int always_seed, int num_uuids) test_uuid_random_function_better); int xpos = 40; -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_WINDOWS) if (nr == 2) { random_name = "windows";