Minor quality of life improvements for macOS, now it works on Big Sur
Unified · Split
| @@ -24,6 +24,9 @@ char *getAudioOutputDeviceFromConfig(void) · 23 unmodified lines | ||
| 24 | 24 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r"); |
| 25 | 25 | if (f == NULL) |
| 26 | 26 | { |
| 27 | +#if defined(__APPLE__) | |
| 28 | + return NULL; // SDL doesn't return devices in any appreciable order, and device 0 is most certainly not guaranteed to be the current default device | |
| 29 | +#else | |
| 27 | 30 | const char *devStringTmp = SDL_GetAudioDeviceName(0, false); |
| 28 | 31 | if (devStringTmp == NULL) |
| 29 | 32 | { |
| @@ -35,6 +38,7 @@ char *getAudioOutputDeviceFromConfig(void) · 5 unmodified lines | ||
| 35 | 38 | if (devStringLen > 0) |
| 36 | 39 | strncpy(devString, devStringTmp, MAX_DEV_STR_LEN); |
| 37 | 40 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination |
| 41 | +#endif | |
| 38 | 42 | } |
| 39 | 43 | else |
| 40 | 44 | { |
| @@ -50,6 +54,11 @@ char *getAudioOutputDeviceFromConfig(void) · 9 unmodified lines | ||
| 50 | 54 | devString[devStringLen-1] = '\0'; |
| 51 | 55 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination |
| 52 | 56 | |
| 57 | +#if defined(__APPLE__) | |
| 58 | + if (devString[0] == '\0') | |
| 59 | + return NULL; // macOS SDL2 locks up indefinitely if fed an empty string for device name | |
| 60 | +#endif | |
| 61 | + | |
| 53 | 62 | fclose(f); |
| 54 | 63 | } |
| 55 | 64 | |
| @@ -2106,7 +2106,7 @@ static void setDiskOpItem(uint8_t item) · 2105 unmodified lines | ||
| 2106 | 2106 | } |
| 2107 | 2107 | |
| 2108 | 2108 | const int32_t pathLen = (int32_t)UNICHAR_STRLEN(FReq_CurPathU); |
| 2109 | − if (pathLen == 0) | |
| 2109 | + if (pathLen == 0 && FReq_ModCurPathU[0] != '\0') | |
| 2110 | 2110 | { |
| 2111 | 2111 | memset(FReq_CurPathU, 0, (PATH_MAX + 2) * sizeof (UNICHAR)); |
| 2112 | 2112 | UNICHAR_STRCPY(FReq_CurPathU, FReq_ModCurPathU); |