- Fixed possible crash when starting the program on M1 Macs (thanks kode54) - Fixed possible mouse cursor corruption when hovering over text boxes on Linux - Fixed possibly buggy string operations - Refactored some code that was doing unnecessary/wrong stuff - Minor code cleanup - Updated help text
Unified · Split
| @@ -20,6 +20,11 @@ · 19 unmodified lines | |||
| 20 | #include "mixer/ft2_silence_mix.h" | 20 | #include "mixer/ft2_silence_mix.h" |
| 21 | // -------------------------------- | 21 | // -------------------------------- |
| 22 | 22 | ||
| 23 | // hide POSIX warnings | ||
| 24 | #ifdef _MSC_VER | ||
| 25 | #pragma warning(disable: 4996) | ||
| 26 | #endif | ||
| 27 | |||
| 23 | #define INITIAL_DITHER_SEED 0x12345000 | 28 | #define INITIAL_DITHER_SEED 0x12345000 |
| 24 | 29 | ||
| 25 | static int8_t pmpCountDiv, pmpChannels = 2; | 30 | static int8_t pmpCountDiv, pmpChannels = 2; |
| @@ -87,14 +92,7 @@ bool setNewAudioSettings(void) // only call this from the main input/video threa · 61 unmodified lines | |||
| 87 | audio.currOutputDevice = NULL; | 92 | audio.currOutputDevice = NULL; |
| 88 | } | 93 | } |
| 89 | 94 | ||
| 90 | const uint32_t stringLen = (uint32_t)strlen(audio.lastWorkingAudioDeviceName); | 95 | audio.currOutputDevice = strdup(audio.lastWorkingAudioDeviceName); |
| 91 | |||
| 92 | audio.currOutputDevice = (char *)malloc(stringLen + 2); | ||
| 93 | if (audio.currOutputDevice != NULL) | ||
| 94 | { | ||
| 95 | strcpy(audio.currOutputDevice, audio.lastWorkingAudioDeviceName); | ||
| 96 | audio.currOutputDevice[stringLen + 1] = '\0'; // UTF-8 needs double null termination | ||
| 97 | } | ||
| 98 | } | 96 | } |
| 99 | 97 | ||
| 100 | // also update config audio radio buttons if we're on that screen at the moment | 98 | // also update config audio radio buttons if we're on that screen at the moment |
| @@ -1050,17 +1048,7 @@ static void setLastWorkingAudioDevName(void) · 949 unmodified lines | |||
| 1050 | } | 1048 | } |
| 1051 | 1049 | ||
| 1052 | if (audio.currOutputDevice != NULL) | 1050 | if (audio.currOutputDevice != NULL) |
| 1053 | { | 1051 | audio.lastWorkingAudioDeviceName = strdup(audio.currOutputDevice); |
| 1054 | const uint32_t stringLen = (uint32_t)strlen(audio.currOutputDevice); | ||
| 1055 | |||
| 1056 | audio.lastWorkingAudioDeviceName = (char *)malloc(stringLen + 2); | ||
| 1057 | if (audio.lastWorkingAudioDeviceName != NULL) | ||
| 1058 | { | ||
| 1059 | if (stringLen > 0) | ||
| 1060 | strcpy(audio.lastWorkingAudioDeviceName, audio.currOutputDevice); | ||
| 1061 | audio.lastWorkingAudioDeviceName[stringLen + 1] = '\0'; // UTF-8 needs double null termination | ||
| 1062 | } | ||
| 1063 | } | ||
| 1064 | } | 1052 | } |
| 1065 | 1053 | ||
| 1066 | bool setupAudio(bool showErrorMsg) | 1054 | bool setupAudio(bool showErrorMsg) |
| @@ -13,53 +13,75 @@ · 12 unmodified lines | |||
| 13 | #include "ft2_audioselector.h" | 13 | #include "ft2_audioselector.h" |
| 14 | #include "ft2_structs.h" | 14 | #include "ft2_structs.h" |
| 15 | 15 | ||
| 16 | char *getAudioOutputDeviceFromConfig(void) | 16 | enum |
| 17 | { | 17 | { |
| 18 | INPUT_DEVICE = 0, | ||
| 19 | OUTPUT_DEVICE = 1 | ||
| 20 | }; | ||
| 21 | |||
| 18 | #define MAX_DEV_STR_LEN 256 | 22 | #define MAX_DEV_STR_LEN 256 |
| 19 | 23 | ||
| 20 | char *devString = (char *)calloc(MAX_DEV_STR_LEN + 1, sizeof (char)); | 24 | // hide POSIX warnings |
| 21 | if (devString == NULL) | 25 | #ifdef _MSC_VER |
| 26 | #pragma warning(disable: 4996) | ||
| 27 | #endif | ||
| 28 | |||
| 29 | static char *getReasonableAudioDevice(int32_t iscapture) // can and will return NULL | ||
| 30 | { | ||
| 31 | int32_t numAudioDevs = SDL_GetNumAudioDevices(iscapture); | ||
| 32 | if (numAudioDevs == 0 || numAudioDevs > 1) | ||
| 33 | return NULL; // we don't know which audio output device is the default device | ||
| 34 | |||
| 35 | const char *devName = SDL_GetAudioDeviceName(0, iscapture); | ||
| 36 | if (devName == NULL) | ||
| 22 | return NULL; | 37 | return NULL; |
| 23 | 38 | ||
| 24 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r"); | 39 | return strdup(devName); |
| 25 | if (f == NULL) | 40 | } |
| 41 | |||
| 42 | char *getAudioOutputDeviceFromConfig(void) | ||
| 43 | { | ||
| 44 | bool audioDeviceRead = false; | ||
| 45 | char *devString = NULL; | ||
| 46 | |||
| 47 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocationU, "r"); | ||
| 48 | if (f != NULL) | ||
| 26 | { | 49 | { |
| 27 | #if defined(__APPLE__) | 50 | devString = (char *)malloc(MAX_DEV_STR_LEN+1); |
| 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 | 51 | if (devString == NULL) |
| 29 | #else | ||
| 30 | const char *devStringTmp = SDL_GetAudioDeviceName(0, false); | ||
| 31 | if (devStringTmp == NULL) | ||
| 32 | { | 52 | { |
| 33 | free(devString); | 53 | fclose(f); |
| 34 | return NULL; | 54 | return NULL; // out of memory |
| 35 | } | 55 | } |
| 36 | 56 | ||
| 37 | const uint32_t devStringLen = (uint32_t)strlen(devStringTmp); | 57 | devString[0] = '\0'; |
| 58 | fgets(devString, MAX_DEV_STR_LEN, f); | ||
| 59 | fclose(f); | ||
| 60 | |||
| 61 | const int32_t devStringLen = (int32_t)strlen(devString); | ||
| 38 | if (devStringLen > 0) | 62 | if (devStringLen > 0) |
| 39 | strncpy(devString, devStringTmp, MAX_DEV_STR_LEN); | ||
| 40 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 41 | #endif | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | if (fgets(devString, MAX_DEV_STR_LEN, f) == NULL) | ||
| 46 | { | 63 | { |
| 47 | free(devString); | 64 | if (devString[devStringLen-1] == '\n') |
| 48 | fclose(f); | 65 | devString[devStringLen-1] = ' '; |
| 49 | return NULL; | 66 | |
| 67 | if (!(devStringLen == 1 && devString[0] == ' ')) // space only = no device | ||
| 68 | audioDeviceRead = true; | ||
| 50 | } | 69 | } |
| 70 | } | ||
| 51 | 71 | ||
| 52 | const uint32_t devStringLen = (uint32_t)strlen(devString); | 72 | if (!audioDeviceRead) |
| 53 | if (devString[devStringLen-1] == '\n') | 73 | { |
| 54 | devString[devStringLen-1] = '\0'; | 74 | if (devString != NULL) |
| 55 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination | 75 | free(devString); |
| 56 | 76 | ||
| 57 | #if defined(__APPLE__) | 77 | devString = getReasonableAudioDevice(OUTPUT_DEVICE); |
| 58 | if (devString[0] == '\0') | 78 | } |
| 59 | return NULL; // macOS SDL2 locks up indefinitely if fed an empty string for device name | ||
| 60 | #endif | ||
| 61 | 79 | ||
| 62 | fclose(f); | 80 | // SDL_OpenAudioDevice() doesn't seem to like an empty audio device string |
| 81 | if (devString != NULL && devString[0] == '\0') | ||
| 82 | { | ||
| 83 | free(devString); | ||
| 84 | return NULL; | ||
| 63 | } | 85 | } |
| 64 | 86 | ||
| 65 | return devString; | 87 | return devString; |
| @@ -67,50 +89,48 @@ char *getAudioOutputDeviceFromConfig(void) · 1 unmodified line | |||
| 67 | 89 | ||
| 68 | char *getAudioInputDeviceFromConfig(void) | 90 | char *getAudioInputDeviceFromConfig(void) |
| 69 | { | 91 | { |
| 70 | #define MAX_DEV_STR_LEN 256 | 92 | bool audioDeviceRead = false; |
| 93 | char *devString = NULL; | ||
| 71 | 94 | ||
| 72 | char *devString = (char *)calloc(MAX_DEV_STR_LEN + 1, sizeof (char)); | 95 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocationU, "r"); |
| 73 | if (devString == NULL) | 96 | if (f != NULL) |
| 74 | return NULL; | ||
| 75 | |||
| 76 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r"); | ||
| 77 | if (f == NULL) | ||
| 78 | { | 97 | { |
| 79 | const char *devStringTmp = SDL_GetAudioDeviceName(0, true); | 98 | devString = (char *)malloc(MAX_DEV_STR_LEN+1); |
| 80 | if (devStringTmp == NULL) | 99 | if (devString == NULL) |
| 81 | { | 100 | { |
| 82 | free(devString); | 101 | fclose(f); |
| 83 | return NULL; | 102 | return NULL; // out of memory |
| 84 | } | 103 | } |
| 85 | 104 | ||
| 86 | const uint32_t devStringLen = (uint32_t)strlen(devStringTmp); | 105 | devString[0] = '\0'; |
| 106 | fgets(devString, MAX_DEV_STR_LEN, f); // skip first line (we want the input device) | ||
| 107 | fgets(devString, MAX_DEV_STR_LEN, f); | ||
| 108 | fclose(f); | ||
| 109 | |||
| 110 | const int32_t devStringLen = (int32_t)strlen(devString); | ||
| 87 | if (devStringLen > 0) | 111 | if (devStringLen > 0) |
| 88 | strncpy(devString, devStringTmp, MAX_DEV_STR_LEN); | ||
| 89 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 90 | } | ||
| 91 | else | ||
| 92 | { | ||
| 93 | if (fgets(devString, MAX_DEV_STR_LEN, f) == NULL) | ||
| 94 | { | 112 | { |
| 95 | free(devString); | 113 | if (devString[devStringLen-1] == '\n') |
| 96 | fclose(f); | 114 | devString[devStringLen-1] = ' '; |
| 97 | return NULL; | 115 | |
| 116 | if (!(devStringLen == 1 && devString[0] == ' ')) // space only = no device | ||
| 117 | audioDeviceRead = true; | ||
| 98 | } | 118 | } |
| 119 | } | ||
| 99 | 120 | ||
| 100 | // do it one more time (next line) | 121 | if (!audioDeviceRead) |
| 101 | if (fgets(devString, MAX_DEV_STR_LEN, f) == NULL) | 122 | { |
| 102 | { | 123 | if (devString != NULL) |
| 103 | free(devString); | 124 | free(devString); |
| 104 | fclose(f); | ||
| 105 | return NULL; | ||
| 106 | } | ||
| 107 | 125 | ||
| 108 | const uint32_t devStringLen = (uint32_t)strlen(devString); | 126 | devString = getReasonableAudioDevice(INPUT_DEVICE); |
| 109 | if (devString[devStringLen-1] == '\n') | 127 | } |
| 110 | devString[devStringLen-1] = '\0'; | ||
| 111 | devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 112 | 128 | ||
| 113 | fclose(f); | 129 | // SDL_OpenAudioDevice() doesn't seem to like an empty audio device string |
| 130 | if (devString != NULL && devString[0] == '\0') | ||
| 131 | { | ||
| 132 | free(devString); | ||
| 133 | return NULL; | ||
| 114 | } | 134 | } |
| 115 | 135 | ||
| 116 | return devString; | 136 | return devString; |
| @@ -118,15 +138,21 @@ char *getAudioInputDeviceFromConfig(void) · 1 unmodified line | |||
| 118 | 138 | ||
| 119 | bool saveAudioDevicesToConfig(const char *outputDevice, const char *inputDevice) | 139 | bool saveAudioDevicesToConfig(const char *outputDevice, const char *inputDevice) |
| 120 | { | 140 | { |
| 121 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "w"); | 141 | FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocationU, "w"); |
| 122 | if (f == NULL) | 142 | if (f == NULL) |
| 123 | return false; | 143 | return false; |
| 124 | 144 | ||
| 125 | if (outputDevice != NULL) | 145 | if (outputDevice != NULL) |
| 126 | fputs(outputDevice, f); | 146 | fputs(outputDevice, f); |
| 147 | else | ||
| 148 | fputc(' ', f); | ||
| 149 | |||
| 127 | fputc('\n', f); | 150 | fputc('\n', f); |
| 151 | |||
| 128 | if (inputDevice != NULL) | 152 | if (inputDevice != NULL) |
| 129 | fputs(inputDevice, f); | 153 | fputs(inputDevice, f); |
| 154 | else | ||
| 155 | fputc(' ', f); | ||
| 130 | 156 | ||
| 131 | fclose(f); | 157 | fclose(f); |
| 132 | return true; | 158 | return true; |
| @@ -231,13 +257,14 @@ bool testAudioDeviceListsMouseDown(void) · 98 unmodified lines | |||
| 231 | 257 | ||
| 232 | const uint32_t devStringLen = (uint32_t)strlen(devString); | 258 | const uint32_t devStringLen = (uint32_t)strlen(devString); |
| 233 | 259 | ||
| 234 | audio.currOutputDevice = (char *)malloc(devStringLen + 2); | 260 | audio.currOutputDevice = (char *)malloc(devStringLen+1); |
| 235 | if (audio.currOutputDevice == NULL) | 261 | if (audio.currOutputDevice == NULL) |
| 236 | return true; | 262 | return true; |
| 237 | 263 | ||
| 264 | audio.currOutputDevice[0] = '\0'; | ||
| 265 | |||
| 238 | if (devStringLen > 0) | 266 | if (devStringLen > 0) |
| 239 | strcpy(audio.currOutputDevice, devString); | 267 | strcpy(audio.currOutputDevice, devString); |
| 240 | audio.currOutputDevice[devStringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 241 | 268 | ||
| 242 | if (!setNewAudioSettings()) | 269 | if (!setNewAudioSettings()) |
| 243 | okBox(0, "System message", "Couldn't open audio input device!"); | 270 | okBox(0, "System message", "Couldn't open audio input device!"); |
| @@ -263,13 +290,14 @@ bool testAudioDeviceListsMouseDown(void) · 19 unmodified lines | |||
| 263 | 290 | ||
| 264 | const uint32_t devStringLen = (uint32_t)strlen(devString); | 291 | const uint32_t devStringLen = (uint32_t)strlen(devString); |
| 265 | 292 | ||
| 266 | audio.currInputDevice = (char *)malloc(devStringLen + 2); | 293 | audio.currInputDevice = (char *)malloc(devStringLen+1); |
| 267 | if (audio.currInputDevice == NULL) | 294 | if (audio.currInputDevice == NULL) |
| 268 | return true; | 295 | return true; |
| 269 | 296 | ||
| 297 | audio.currInputDevice[0] = '\0'; | ||
| 298 | |||
| 270 | if (devStringLen > 0) | 299 | if (devStringLen > 0) |
| 271 | strcpy(audio.currInputDevice, devString); | 300 | strcpy(audio.currInputDevice, devString); |
| 272 | audio.currInputDevice[devStringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 273 | 301 | ||
| 274 | drawAudioInputList(); | 302 | drawAudioInputList(); |
| 275 | } | 303 | } |
| @@ -303,10 +331,10 @@ void freeAudioDeviceLists(void) · 27 unmodified lines | |||
| 303 | 331 | ||
| 304 | void freeAudioDeviceSelectorBuffers(void) | 332 | void freeAudioDeviceSelectorBuffers(void) |
| 305 | { | 333 | { |
| 306 | if (editor.audioDevConfigFileLocation != NULL) | 334 | if (editor.audioDevConfigFileLocationU != NULL) |
| 307 | { | 335 | { |
| 308 | free(editor.audioDevConfigFileLocation); | 336 | free(editor.audioDevConfigFileLocationU); |
| 309 | editor.audioDevConfigFileLocation = NULL; | 337 | editor.audioDevConfigFileLocationU = NULL; |
| 310 | } | 338 | } |
| 311 | 339 | ||
| 312 | if (audio.currOutputDevice != NULL) | 340 | if (audio.currOutputDevice != NULL) |
| @@ -352,14 +380,12 @@ void setToDefaultAudioOutputDevice(void) · 39 unmodified lines | |||
| 352 | audio.currOutputDevice = NULL; | 380 | audio.currOutputDevice = NULL; |
| 353 | } | 381 | } |
| 354 | 382 | ||
| 355 | audio.currOutputDevice = (char *)malloc(stringLen + 2); | 383 | audio.currOutputDevice = (char *)malloc(stringLen + 1); |
| 356 | if (audio.currOutputDevice == NULL) | 384 | if (audio.currOutputDevice == NULL) |
| 357 | return; | 385 | return; |
| 358 | 386 | ||
| 359 | if (stringLen > 0) | 387 | if (stringLen > 0) |
| 360 | strcpy(audio.currOutputDevice, devString); | 388 | strcpy(audio.currOutputDevice, devString); |
| 361 | |||
| 362 | audio.currOutputDevice[stringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 363 | } | 389 | } |
| 364 | 390 | ||
| 365 | void setToDefaultAudioInputDevice(void) | 391 | void setToDefaultAudioInputDevice(void) |
| @@ -384,14 +410,12 @@ void setToDefaultAudioInputDevice(void) · 18 unmodified lines | |||
| 384 | audio.currInputDevice = NULL; | 410 | audio.currInputDevice = NULL; |
| 385 | } | 411 | } |
| 386 | 412 | ||
| 387 | audio.currInputDevice = (char *)malloc(stringLen + 2); | 413 | audio.currInputDevice = (char *)malloc(stringLen + 1); |
| 388 | if (audio.currInputDevice == NULL) | 414 | if (audio.currInputDevice == NULL) |
| 389 | return; | 415 | return; |
| 390 | 416 | ||
| 391 | if (stringLen > 0) | 417 | if (stringLen > 0) |
| 392 | strcpy(audio.currInputDevice, devString); | 418 | strcpy(audio.currInputDevice, devString); |
| 393 | |||
| 394 | audio.currInputDevice[stringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 395 | } | 419 | } |
| 396 | 420 | ||
| 397 | void rescanAudioDevices(void) | 421 | void rescanAudioDevices(void) |
| @@ -417,14 +441,12 @@ void rescanAudioDevices(void) · 19 unmodified lines | |||
| 417 | 441 | ||
| 418 | const uint32_t stringLen = (uint32_t)strlen(deviceName); | 442 | const uint32_t stringLen = (uint32_t)strlen(deviceName); |
| 419 | 443 | ||
| 420 | audio.outputDeviceNames[i] = (char *)malloc(stringLen + 2); | 444 | audio.outputDeviceNames[i] = (char *)malloc(stringLen + 1); |
| 421 | if (audio.outputDeviceNames[i] == NULL) | 445 | if (audio.outputDeviceNames[i] == NULL) |
| 422 | break; | 446 | break; |
| 423 | 447 | ||
| 424 | if (stringLen > 0) | 448 | if (stringLen > 0) |
| 425 | strcpy(audio.outputDeviceNames[i], deviceName); | 449 | strcpy(audio.outputDeviceNames[i], deviceName); |
| 426 | |||
| 427 | audio.outputDeviceNames[i][stringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 428 | } | 450 | } |
| 429 | 451 | ||
| 430 | // GET AUDIO INPUT DEVICES | 452 | // GET AUDIO INPUT DEVICES |
| @@ -444,14 +466,12 @@ void rescanAudioDevices(void) · 13 unmodified lines | |||
| 444 | 466 | ||
| 445 | const uint32_t stringLen = (uint32_t)strlen(deviceName); | 467 | const uint32_t stringLen = (uint32_t)strlen(deviceName); |
| 446 | 468 | ||
| 447 | audio.inputDeviceNames[i] = (char *)malloc(stringLen + 2); | 469 | audio.inputDeviceNames[i] = (char *)malloc(stringLen + 1); |
| 448 | if (audio.inputDeviceNames[i] == NULL) | 470 | if (audio.inputDeviceNames[i] == NULL) |
| 449 | break; | 471 | break; |
| 450 | 472 | ||
| 451 | if (stringLen > 0) | 473 | if (stringLen > 0) |
| 452 | strcpy(audio.inputDeviceNames[i], deviceName); | 474 | strcpy(audio.inputDeviceNames[i], deviceName); |
| 453 | |||
| 454 | audio.inputDeviceNames[i][stringLen+1] = '\0'; // UTF-8 needs double null termination | ||
| 455 | } | 475 | } |
| 456 | 476 | ||
| 457 | setScrollBarEnd(SB_AUDIO_OUTPUT_SCROLL, audio.outputDeviceNum); | 477 | setScrollBarEnd(SB_AUDIO_OUTPUT_SCROLL, audio.outputDeviceNum); |
| @@ -264,7 +264,7 @@ bool loadConfig(bool showErrorFlag) · 263 unmodified lines | |||
| 264 | } | 264 | } |
| 265 | #endif | 265 | #endif |
| 266 | 266 | ||
| 267 | if (editor.configFileLocation == NULL) | 267 | if (editor.configFileLocationU == NULL) |
| 268 | { | 268 | { |
| 269 | if (showErrorFlag) | 269 | if (showErrorFlag) |
| 270 | okBox(0, "System message", "Error opening config file for reading!"); | 270 | okBox(0, "System message", "Error opening config file for reading!"); |
| @@ -272,7 +272,7 @@ bool loadConfig(bool showErrorFlag) · 1 unmodified line | |||
| 272 | return false; | 272 | return false; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | FILE *f = UNICHAR_FOPEN(editor.configFileLocation, "rb"); | 275 | FILE *f = UNICHAR_FOPEN(editor.configFileLocationU, "rb"); |
| 276 | if (f == NULL) | 276 | if (f == NULL) |
| 277 | { | 277 | { |
| 278 | if (showErrorFlag) | 278 | if (showErrorFlag) |
| @@ -353,7 +353,7 @@ void loadConfig2(void) // called by "Load config" button · 74 unmodified lines | |||
| 353 | 353 | ||
| 354 | bool saveConfig(bool showErrorFlag) | 354 | bool saveConfig(bool showErrorFlag) |
| 355 | { | 355 | { |
| 356 | if (editor.configFileLocation == NULL) | 356 | if (editor.configFileLocationU == NULL) |
| 357 | { | 357 | { |
| 358 | if (showErrorFlag) | 358 | if (showErrorFlag) |
| 359 | okBox(0, "System message", "General I/O error during saving! Is the file in use?"); | 359 | okBox(0, "System message", "General I/O error during saving! Is the file in use?"); |
| @@ -366,7 +366,7 @@ bool saveConfig(bool showErrorFlag) · 6 unmodified lines | |||
| 366 | saveMidiInputDeviceToConfig(); | 366 | saveMidiInputDeviceToConfig(); |
| 367 | #endif | 367 | #endif |
| 368 | 368 | ||
| 369 | FILE *f = UNICHAR_FOPEN(editor.configFileLocation, "wb"); | 369 | FILE *f = UNICHAR_FOPEN(editor.configFileLocationU, "wb"); |
| 370 | if (f == NULL) | 370 | if (f == NULL) |
| 371 | { | 371 | { |
| 372 | if (showErrorFlag) | 372 | if (showErrorFlag) |
| @@ -410,14 +410,14 @@ void saveConfig2(void) // called by "Save config" button · 37 unmodified lines | |||
| 410 | saveConfig(CONFIG_SHOW_ERRORS); | 410 | saveConfig(CONFIG_SHOW_ERRORS); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | static UNICHAR *getFullAudDevConfigPath(void) // kinda hackish | 413 | static UNICHAR *getFullAudDevConfigPathU(void) // kinda hackish |
| 414 | { | 414 | { |
| 415 | int32_t audiodevDotIniStrLen, ft2DotCfgStrLen; | 415 | int32_t audiodevDotIniStrLen, ft2DotCfgStrLen; |
| 416 | 416 | ||
| 417 | if (editor.configFileLocation == NULL) | 417 | if (editor.configFileLocationU == NULL) |
| 418 | return NULL; | 418 | return NULL; |
| 419 | 419 | ||
| 420 | const int32_t ft2ConfPathLen = (int32_t)UNICHAR_STRLEN(editor.configFileLocation); | 420 | const int32_t ft2ConfPathLen = (int32_t)UNICHAR_STRLEN(editor.configFileLocationU); |
| 421 | 421 | ||
| 422 | #ifdef _WIN32 | 422 | #ifdef _WIN32 |
| 423 | audiodevDotIniStrLen = (int32_t)UNICHAR_STRLEN(L"audiodev.ini"); | 423 | audiodevDotIniStrLen = (int32_t)UNICHAR_STRLEN(L"audiodev.ini"); |
| @@ -427,31 +427,29 @@ static UNICHAR *getFullAudDevConfigPath(void) // kinda hackish · 3 unmodified lines | |||
| 427 | ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); | 427 | ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); |
| 428 | #endif | 428 | #endif |
| 429 | 429 | ||
| 430 | UNICHAR *filePath = (UNICHAR *)calloc(ft2ConfPathLen + audiodevDotIniStrLen + 2, sizeof (UNICHAR)); | 430 | UNICHAR *filePathU = (UNICHAR *)malloc((ft2ConfPathLen + audiodevDotIniStrLen + 1) * sizeof (UNICHAR)); |
| 431 | filePathU[0] = 0; | ||
| 431 | 432 | ||
| 432 | UNICHAR_STRCPY(filePath, editor.configFileLocation); | 433 | UNICHAR_STRCPY(filePathU, editor.configFileLocationU); |
| 433 | 434 | filePathU[ft2ConfPathLen-ft2DotCfgStrLen] = 0; | |
| 434 | const int32_t stringOffset = ft2ConfPathLen - ft2DotCfgStrLen; | ||
| 435 | filePath[stringOffset+0] = '\0'; | ||
| 436 | filePath[stringOffset+1] = '\0'; | ||
| 437 | 435 | ||
| 438 | #ifdef _WIN32 | 436 | #ifdef _WIN32 |
| 439 | UNICHAR_STRCAT(filePath, L"audiodev.ini"); | 437 | UNICHAR_STRCAT(filePathU, L"audiodev.ini"); |
| 440 | #else | 438 | #else |
| 441 | UNICHAR_STRCAT(filePath, "audiodev.ini"); | 439 | UNICHAR_STRCAT(filePathU, "audiodev.ini"); |
| 442 | #endif | 440 | #endif |
| 443 | 441 | ||
| 444 | return filePath; | 442 | return filePathU; |
| 445 | } | 443 | } |
| 446 | 444 | ||
| 447 | static UNICHAR *getFullMidiDevConfigPath(void) // kinda hackish | 445 | static UNICHAR *getFullMidiDevConfigPathU(void) // kinda hackish |
| 448 | { | 446 | { |
| 449 | int32_t mididevDotIniStrLen, ft2DotCfgStrLen; | 447 | int32_t mididevDotIniStrLen, ft2DotCfgStrLen; |
| 450 | 448 | ||
| 451 | if (editor.configFileLocation == NULL) | 449 | if (editor.configFileLocationU == NULL) |
| 452 | return NULL; | 450 | return NULL; |
| 453 | 451 | ||
| 454 | const int32_t ft2ConfPathLen = (int32_t)UNICHAR_STRLEN(editor.configFileLocation); | 452 | const int32_t ft2ConfPathLen = (int32_t)UNICHAR_STRLEN(editor.configFileLocationU); |
| 455 | 453 | ||
| 456 | #ifdef _WIN32 | 454 | #ifdef _WIN32 |
| 457 | mididevDotIniStrLen = (int32_t)UNICHAR_STRLEN(L"mididev.ini"); | 455 | mididevDotIniStrLen = (int32_t)UNICHAR_STRLEN(L"mididev.ini"); |
| @@ -461,21 +459,19 @@ static UNICHAR *getFullMidiDevConfigPath(void) // kinda hackish · 3 unmodified lines | |||
| 461 | ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); | 459 | ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); |
| 462 | #endif | 460 | #endif |
| 463 | 461 | ||
| 464 | UNICHAR *filePath = (UNICHAR *)calloc(ft2ConfPathLen + mididevDotIniStrLen + 2, sizeof (UNICHAR)); | 462 | UNICHAR *filePathU = (UNICHAR *)malloc((ft2ConfPathLen + mididevDotIniStrLen + 1) * sizeof (UNICHAR)); |
| 465 | 463 | filePathU[0] = 0; | |
| 466 | UNICHAR_STRCPY(filePath, editor.configFileLocation); | ||
| 467 | 464 | ||
| 468 | const int32_t stringOffset = ft2ConfPathLen - ft2DotCfgStrLen; | 465 | UNICHAR_STRCPY(filePathU, editor.configFileLocationU); |
| 469 | filePath[stringOffset+0] = '\0'; | 466 | filePathU[ft2ConfPathLen-ft2DotCfgStrLen] = 0; |
| 470 | filePath[stringOffset+1] = '\0'; | ||
| 471 | 467 | ||
| 472 | #ifdef _WIN32 | 468 | #ifdef _WIN32 |
| 473 | UNICHAR_STRCAT(filePath, L"mididev.ini"); | 469 | UNICHAR_STRCAT(filePathU, L"mididev.ini"); |
| 474 | #else | 470 | #else |
| 475 | UNICHAR_STRCAT(filePath, "mididev.ini"); | 471 | UNICHAR_STRCAT(filePathU, "mididev.ini"); |
| 476 | #endif | 472 | #endif |
| 477 | 473 | ||
| 478 | return filePath; | 474 | return filePathU; |
| 479 | } | 475 | } |
| 480 | 476 | ||
| 481 | static void setConfigFileLocation(void) // kinda hackish | 477 | static void setConfigFileLocation(void) // kinda hackish |
| @@ -484,41 +480,44 @@ static void setConfigFileLocation(void) // kinda hackish · 2 unmodified lines | |||
| 484 | #ifdef _WIN32 | 480 | #ifdef _WIN32 |
| 485 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN(L"FT2.CFG"); | 481 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN(L"FT2.CFG"); |
| 486 | 482 | ||
| 487 | UNICHAR *oldPath = (UNICHAR *)calloc(PATH_MAX + 8 + 2, sizeof (UNICHAR)); | 483 | UNICHAR *oldPathU = (UNICHAR *)malloc((PATH_MAX + 8 + 1) * sizeof (UNICHAR)); |
| 488 | UNICHAR *tmpPath = (UNICHAR *)calloc(PATH_MAX + 8 + 2, sizeof (UNICHAR)); | 484 | UNICHAR *tmpPathU = (UNICHAR *)malloc((PATH_MAX + 8 + 1) * sizeof (UNICHAR)); |
| 489 | editor.configFileLocation = (UNICHAR *)calloc(PATH_MAX + ft2DotCfgStrLen + 2, sizeof (UNICHAR)); | 485 | editor.configFileLocationU = (UNICHAR *)malloc((PATH_MAX + ft2DotCfgStrLen + 1) * sizeof (UNICHAR)); |
| 490 | 486 | ||
| 491 | if (oldPath == NULL || tmpPath == NULL || editor.configFileLocation == NULL) | 487 | if (oldPathU == NULL || tmpPathU == NULL || editor.configFileLocationU == NULL) |
| 492 | { | 488 | { |
| 493 | if (oldPath != NULL) free(oldPath); | 489 | if (oldPathU != NULL) free(oldPathU); |
| 494 | if (tmpPath != NULL) free(tmpPath); | 490 | if (tmpPathU != NULL) free(tmpPathU); |
| 495 | if (editor.configFileLocation != NULL) free(editor.configFileLocation); | 491 | if (editor.configFileLocationU != NULL) free(editor.configFileLocationU); |
| 496 | 492 | ||
| 497 | editor.configFileLocation = NULL; | 493 | editor.configFileLocationU = NULL; |
| 498 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 494 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 499 | return; | 495 | return; |
| 500 | } | 496 | } |
| 501 | 497 | ||
| 502 | if (GetCurrentDirectoryW(PATH_MAX - ft2DotCfgStrLen - 1, oldPath) == 0) | 498 | oldPathU[0] = 0; |
| 499 | tmpPathU[0] = 0; | ||
| 500 | |||
| 501 | if (GetCurrentDirectoryW(PATH_MAX - ft2DotCfgStrLen - 1, oldPathU) == 0) | ||
| 503 | { | 502 | { |
| 504 | free(oldPath); | 503 | free(oldPathU); |
| 505 | free(tmpPath); | 504 | free(tmpPathU); |
| 506 | free(editor.configFileLocation); | 505 | free(editor.configFileLocationU); |
| 507 | 506 | ||
| 508 | editor.configFileLocation = NULL; | 507 | editor.configFileLocationU = NULL; |
| 509 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 508 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 510 | return; | 509 | return; |
| 511 | } | 510 | } |
| 512 | 511 | ||
| 513 | UNICHAR_STRCPY(editor.configFileLocation, oldPath); | 512 | UNICHAR_STRCPY(editor.configFileLocationU, oldPathU); |
| 514 | 513 | ||
| 515 | FILE *f = fopen("FT2.CFG", "rb"); | 514 | FILE *f = fopen("FT2.CFG", "rb"); |
| 516 | if (f == NULL) // FT2.CFG not found in current dir, try default config dir | 515 | if (f == NULL) // FT2.CFG not found in current dir, try default config dir |
| 517 | { | 516 | { |
| 518 | int32_t result = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tmpPath); | 517 | int32_t result = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tmpPathU); |
| 519 | if (result == S_OK) | 518 | if (result == S_OK) |
| 520 | { | 519 | { |
| 521 | if (SetCurrentDirectoryW(tmpPath) != 0) | 520 | if (SetCurrentDirectoryW(tmpPathU) != 0) |
| 522 | { | 521 | { |
| 523 | result = chdir("FT2 clone"); | 522 | result = chdir("FT2 clone"); |
| 524 | if (result != 0) | 523 | if (result != 0) |
| @@ -528,7 +527,7 @@ static void setConfigFileLocation(void) // kinda hackish · 3 unmodified lines | |||
| 528 | } | 527 | } |
| 529 | 528 | ||
| 530 | if (result == 0) | 529 | if (result == 0) |
| 531 | GetCurrentDirectoryW(PATH_MAX - ft2DotCfgStrLen - 1, editor.configFileLocation); // we can, set it | 530 | GetCurrentDirectoryW(PATH_MAX - ft2DotCfgStrLen - 1, editor.configFileLocationU); // we can, set it |
| 532 | } | 531 | } |
| 533 | } | 532 | } |
| 534 | } | 533 | } |
| @@ -537,27 +536,29 @@ static void setConfigFileLocation(void) // kinda hackish · 2 unmodified lines | |||
| 537 | fclose(f); | 536 | fclose(f); |
| 538 | } | 537 | } |
| 539 | 538 | ||
| 540 | free(tmpPath); | 539 | free(tmpPathU); |
| 541 | SetCurrentDirectoryW(oldPath); | 540 | SetCurrentDirectoryW(oldPathU); |
| 542 | free(oldPath); | 541 | free(oldPathU); |
| 543 | 542 | ||
| 544 | UNICHAR_STRCAT(editor.configFileLocation, L"\\FT2.CFG"); | 543 | UNICHAR_STRCAT(editor.configFileLocationU, L"\\FT2.CFG"); |
| 545 | 544 | ||
| 546 | // OS X / macOS | 545 | // OS X / macOS |
| 547 | #elif defined __APPLE__ | 546 | #elif defined __APPLE__ |
| 548 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); | 547 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); |
| 549 | 548 | ||
| 550 | editor.configFileLocation = (UNICHAR *)calloc(PATH_MAX + ft2DotCfgStrLen + 2, sizeof (UNICHAR)); | 549 | editor.configFileLocationU = (UNICHAR *)malloc((PATH_MAX + ft2DotCfgStrLen + 1) * sizeof (UNICHAR)); |
| 551 | if (editor.configFileLocation == NULL) | 550 | if (editor.configFileLocationU == NULL) |
| 552 | { | 551 | { |
| 553 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 552 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 554 | return; | 553 | return; |
| 555 | } | 554 | } |
| 556 | 555 | ||
| 557 | if (getcwd(editor.configFileLocation, PATH_MAX - ft2DotCfgStrLen - 1) == NULL) | 556 | editor.configFileLocationU[0] = 0; |
| 557 | |||
| 558 | if (getcwd(editor.configFileLocationU, PATH_MAX - ft2DotCfgStrLen - 1) == NULL) | ||
| 558 | { | 559 | { |
| 559 | free(editor.configFileLocation); | 560 | free(editor.configFileLocationU); |
| 560 | editor.configFileLocation = NULL; | 561 | editor.configFileLocationU = NULL; |
| 561 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 562 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 562 | return; | 563 | return; |
| 563 | } | 564 | } |
| @@ -578,7 +579,7 @@ static void setConfigFileLocation(void) // kinda hackish · 14 unmodified lines | |||
| 578 | } | 579 | } |
| 579 | 580 | ||
| 580 | if (result == 0) | 581 | if (result == 0) |
| 581 | getcwd(editor.configFileLocation, PATH_MAX - ft2DotCfgStrLen - 1); | 582 | getcwd(editor.configFileLocationU, PATH_MAX - ft2DotCfgStrLen - 1); |
| 582 | } | 583 | } |
| 583 | } | 584 | } |
| 584 | } | 585 | } |
| @@ -587,23 +588,25 @@ static void setConfigFileLocation(void) // kinda hackish · 2 unmodified lines | |||
| 587 | fclose(f); | 588 | fclose(f); |
| 588 | } | 589 | } |
| 589 | 590 | ||
| 590 | strcat(editor.configFileLocation, "/FT2.CFG"); | 591 | strcat(editor.configFileLocationU, "/FT2.CFG"); |
| 591 | 592 | ||
| 592 | // Linux etc | 593 | // Linux etc |
| 593 | #else | 594 | #else |
| 594 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); | 595 | int32_t ft2DotCfgStrLen = (int32_t)UNICHAR_STRLEN("FT2.CFG"); |
| 595 | 596 | ||
| 596 | editor.configFileLocation = (UNICHAR *)calloc(PATH_MAX + ft2DotCfgStrLen + 2, sizeof (UNICHAR)); | 597 | editor.configFileLocationU = (UNICHAR *)malloc((PATH_MAX + ft2DotCfgStrLen + 1) * sizeof (UNICHAR)); |
| 597 | if (editor.configFileLocation == NULL) | 598 | if (editor.configFileLocationU == NULL) |
| 598 | { | 599 | { |
| 599 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 600 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 600 | return; | 601 | return; |
| 601 | } | 602 | } |
| 602 | 603 | ||
| 603 | if (getcwd(editor.configFileLocation, PATH_MAX - ft2DotCfgStrLen - 1) == NULL) | 604 | editor.configFileLocationU[0] = 0; |
| 605 | |||
| 606 | if (getcwd(editor.configFileLocationU, PATH_MAX - ft2DotCfgStrLen - 1) == NULL) | ||
| 604 | { | 607 | { |
| 605 | free(editor.configFileLocation); | 608 | free(editor.configFileLocationU); |
| 606 | editor.configFileLocation = NULL; | 609 | editor.configFileLocationU = NULL; |
| 607 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); | 610 | showErrorMsgBox("Error: Couldn't set config file location. You can't load/save the config!"); |
| 608 | return; | 611 | return; |
| 609 | } | 612 | } |
| @@ -632,7 +635,7 @@ static void setConfigFileLocation(void) // kinda hackish · 22 unmodified lines | |||
| 632 | } | 635 | } |
| 633 | 636 | ||
| 634 | if (result == 0) | 637 | if (result == 0) |
| 635 | getcwd(editor.configFileLocation, PATH_MAX - ft2DotCfgStrLen - 1); | 638 | getcwd(editor.configFileLocationU, PATH_MAX - ft2DotCfgStrLen - 1); |
| 636 | } | 639 | } |
| 637 | } | 640 | } |
| 638 | else | 641 | else |
| @@ -640,23 +643,23 @@ static void setConfigFileLocation(void) // kinda hackish · 1 unmodified line | |||
| 640 | fclose(f); | 643 | fclose(f); |
| 641 | } | 644 | } |
| 642 | 645 | ||
| 643 | strcat(editor.configFileLocation, "/FT2.CFG"); | 646 | strcat(editor.configFileLocationU, "/FT2.CFG"); |
| 644 | #endif | 647 | #endif |
| 645 | 648 | ||
| 646 | editor.midiConfigFileLocation = getFullMidiDevConfigPath(); | 649 | editor.midiConfigFileLocationU = getFullMidiDevConfigPathU(); |
| 647 | editor.audioDevConfigFileLocation = getFullAudDevConfigPath(); | 650 | editor.audioDevConfigFileLocationU = getFullAudDevConfigPathU(); |
| 648 | } | 651 | } |
| 649 | 652 | ||
| 650 | void loadConfigOrSetDefaults(void) | 653 | void loadConfigOrSetDefaults(void) |
| 651 | { | 654 | { |
| 652 | setConfigFileLocation(); | 655 | setConfigFileLocation(); |
| 653 | if (editor.configFileLocation == NULL) | 656 | if (editor.configFileLocationU == NULL) |
| 654 | { | 657 | { |
| 655 | setDefaultConfigSettings(); | 658 | setDefaultConfigSettings(); |
| 656 | return; | 659 | return; |
| 657 | } | 660 | } |
| 658 | 661 | ||
| 659 | FILE *f = UNICHAR_FOPEN(editor.configFileLocation, "rb"); | 662 | FILE *f = UNICHAR_FOPEN(editor.configFileLocationU, "rb"); |
| 660 | if (f == NULL) | 663 | if (f == NULL) |
| 661 | { | 664 | { |
| 662 | setDefaultConfigSettings(); | 665 | setDefaultConfigSettings(); |
| @@ -72,7 +72,7 @@ typedef struct DirRec · 71 unmodified lines | |||
| 72 | int32_t filesize; | 72 | int32_t filesize; |
| 73 | } DirRec; | 73 | } DirRec; |
| 74 | 74 | ||
| 75 | static char FReq_SysReqText[196], *FReq_FileName, *FReq_NameTemp; | 75 | static char FReq_SysReqText[256], *FReq_FileName, *FReq_NameTemp; |
| 76 | static char *modTmpFName, *insTmpFName, *smpTmpFName, *patTmpFName, *trkTmpFName; | 76 | static char *modTmpFName, *insTmpFName, *smpTmpFName, *patTmpFName, *trkTmpFName; |
| 77 | static char *modTmpFNameUTF8; // for window title | 77 | static char *modTmpFNameUTF8; // for window title |
| 78 | static uint8_t FReq_Item; | 78 | static uint8_t FReq_Item; |
| @@ -84,6 +84,18 @@ static SDL_Thread *thread; · 5 unmodified lines | |||
| 84 | 84 | ||
| 85 | static void setDiskOpItem(uint8_t item); | 85 | static void setDiskOpItem(uint8_t item); |
| 86 | 86 | ||
| 87 | bool setupExecutablePath(void) | ||
| 88 | { | ||
| 89 | editor.binaryPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); | ||
| 90 | if (editor.binaryPathU == NULL) | ||
| 91 | return false; | ||
| 92 | |||
| 93 | editor.binaryPathU[0] = 0; | ||
| 94 | UNICHAR_GETCWD(editor.binaryPathU, PATH_MAX); | ||
| 95 | |||
| 96 | return true; | ||
| 97 | } | ||
| 98 | |||
| 87 | int32_t getFileSize(UNICHAR *fileNameU) // returning -1 = filesize over 2GB | 99 | int32_t getFileSize(UNICHAR *fileNameU) // returning -1 = filesize over 2GB |
| 88 | { | 100 | { |
| 89 | int64_t fSize; | 101 | int64_t fSize; |
| @@ -173,56 +185,70 @@ static void setupInitialPaths(void) · 83 unmodified lines | |||
| 173 | 185 | ||
| 174 | #ifdef _WIN32 | 186 | #ifdef _WIN32 |
| 175 | if (config.modulesPath[0] != '\0') | 187 | if (config.modulesPath[0] != '\0') |
| 188 | { | ||
| 176 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.modulesPath, -1, FReq_ModCurPathU, 80); | 189 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.modulesPath, -1, FReq_ModCurPathU, 80); |
| 190 | FReq_ModCurPathU[80] = 0; | ||
| 191 | } | ||
| 177 | 192 | ||
| 178 | if (config.instrPath[0] != '\0') | 193 | if (config.instrPath[0] != '\0') |
| 179 | { | 194 | { |
| 180 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.instrPath, -1, FReq_InsCurPathU, 80); | 195 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.instrPath, -1, FReq_InsCurPathU, 80); |
| 196 | FReq_InsCurPathU[80] = 0; | ||
| 181 | insPathSet = true; | 197 | insPathSet = true; |
| 182 | } | 198 | } |
| 183 | 199 | ||
| 184 | if (config.samplesPath[0] != '\0') | 200 | if (config.samplesPath[0] != '\0') |
| 185 | { | 201 | { |
| 186 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.samplesPath, -1, FReq_SmpCurPathU, 80); | 202 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.samplesPath, -1, FReq_SmpCurPathU, 80); |
| 203 | FReq_SmpCurPathU[80] = 0; | ||
| 187 | smpPathSet = true; | 204 | smpPathSet = true; |
| 188 | } | 205 | } |
| 189 | 206 | ||
| 190 | if (config.patternsPath[0] != '\0') | 207 | if (config.patternsPath[0] != '\0') |
| 191 | { | 208 | { |
| 192 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.patternsPath, -1, FReq_PatCurPathU, 80); | 209 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.patternsPath, -1, FReq_PatCurPathU, 80); |
| 210 | FReq_PatCurPathU[80] = 0; | ||
| 193 | patPathSet = true; | 211 | patPathSet = true; |
| 194 | } | 212 | } |
| 195 | 213 | ||
| 196 | if (config.tracksPath[0] != '\0') | 214 | if (config.tracksPath[0] != '\0') |
| 197 | { | 215 | { |
| 198 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.tracksPath, -1, FReq_TrkCurPathU, 80); | 216 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.tracksPath, -1, FReq_TrkCurPathU, 80); |
| 217 | FReq_TrkCurPathU[80] = 0; | ||
| 199 | trkPathSet = true; | 218 | trkPathSet = true; |
| 200 | } | 219 | } |
| 201 | #else | 220 | #else |
| 202 | if (config.modulesPath[0] != '\0') | 221 | if (config.modulesPath[0] != '\0') |
| 222 | { | ||
| 203 | strncpy(FReq_ModCurPathU, config.modulesPath, 80); | 223 | strncpy(FReq_ModCurPathU, config.modulesPath, 80); |
| 224 | FReq_ModCurPathU[80] = 0; | ||
| 225 | } | ||
| 204 | 226 | ||
| 205 | if (config.instrPath[0] != '\0') | 227 | if (config.instrPath[0] != '\0') |
| 206 | { | 228 | { |
| 207 | strncpy(FReq_InsCurPathU, config.instrPath, 80); | 229 | strncpy(FReq_InsCurPathU, config.instrPath, 80); |
| 230 | FReq_InsCurPathU[80] = 0; | ||
| 208 | insPathSet = true; | 231 | insPathSet = true; |
| 209 | } | 232 | } |
| 210 | 233 | ||
| 211 | if (config.samplesPath[0] != '\0') | 234 | if (config.samplesPath[0] != '\0') |
| 212 | { | 235 | { |
| 213 | strncpy(FReq_SmpCurPathU, config.samplesPath, 80); | 236 | strncpy(FReq_SmpCurPathU, config.samplesPath, 80); |
| 237 | FReq_SmpCurPathU[80] = 0; | ||
| 214 | smpPathSet = true; | 238 | smpPathSet = true; |
| 215 | } | 239 | } |
| 216 | 240 | ||
| 217 | if (config.patternsPath[0] != '\0') | 241 | if (config.patternsPath[0] != '\0') |
| 218 | { | 242 | { |
| 219 | strncpy(FReq_PatCurPathU, config.patternsPath, 80); | 243 | strncpy(FReq_PatCurPathU, config.patternsPath, 80); |
| 244 | FReq_PatCurPathU[80] = 0; | ||
| 220 | patPathSet = true; | 245 | patPathSet = true; |
| 221 | } | 246 | } |
| 222 | 247 | ||
| 223 | if (config.tracksPath[0] != '\0') | 248 | if (config.tracksPath[0] != '\0') |
| 224 | { | 249 | { |
| 225 | strncpy(FReq_TrkCurPathU, config.tracksPath, 80); | 250 | strncpy(FReq_TrkCurPathU, config.tracksPath, 80); |
| 251 | FReq_TrkCurPathU[80] = 0; | ||
| 226 | trkPathSet = true; | 252 | trkPathSet = true; |
| 227 | } | 253 | } |
| 228 | #endif | 254 | #endif |
| @@ -277,28 +303,42 @@ void freeDiskOp(void) · 48 unmodified lines | |||
| 277 | 303 | ||
| 278 | bool setupDiskOp(void) | 304 | bool setupDiskOp(void) |
| 279 | { | 305 | { |
| 280 | modTmpFName = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 306 | modTmpFName = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 281 | insTmpFName = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 307 | insTmpFName = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 282 | smpTmpFName = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 308 | smpTmpFName = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 283 | patTmpFName = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 309 | patTmpFName = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 284 | trkTmpFName = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 310 | trkTmpFName = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 285 | FReq_NameTemp = (char *)calloc(PATH_MAX + 1, sizeof (char)); | 311 | FReq_NameTemp = (char *)malloc((PATH_MAX + 1) * sizeof (char)); |
| 286 | FReq_ModCurPathU = (UNICHAR *)calloc(PATH_MAX + 2, sizeof (UNICHAR)); | 312 | |
| 287 | FReq_InsCurPathU = (UNICHAR *)calloc(PATH_MAX + 2, sizeof (UNICHAR)); | 313 | FReq_ModCurPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 288 | FReq_SmpCurPathU = (UNICHAR *)calloc(PATH_MAX + 2, sizeof (UNICHAR)); | 314 | FReq_InsCurPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 289 | FReq_PatCurPathU = (UNICHAR *)calloc(PATH_MAX + 2, sizeof (UNICHAR)); | 315 | FReq_SmpCurPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 290 | FReq_TrkCurPathU = (UNICHAR *)calloc(PATH_MAX + 2, sizeof (UNICHAR)); | 316 | FReq_PatCurPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 291 | 317 | FReq_TrkCurPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); | |
| 292 | if (modTmpFName == NULL || insTmpFName == NULL || smpTmpFName == NULL || patTmpFName == NULL || | 318 | |
| 293 | trkTmpFName == NULL || FReq_NameTemp == NULL || FReq_ModCurPathU == NULL || | 319 | if (modTmpFName == NULL || insTmpFName == NULL || smpTmpFName == NULL || |
| 294 | FReq_InsCurPathU == NULL || FReq_SmpCurPathU == NULL || FReq_PatCurPathU == NULL || | 320 | patTmpFName == NULL || trkTmpFName == NULL || FReq_NameTemp == NULL || |
| 295 | FReq_TrkCurPathU == NULL) | 321 | FReq_ModCurPathU == NULL || FReq_InsCurPathU == NULL || FReq_SmpCurPathU == NULL || |
| 322 | FReq_PatCurPathU == NULL || FReq_TrkCurPathU == NULL) | ||
| 296 | { | 323 | { |
| 297 | // allocated memory is free'd lateron | 324 | // allocated memory is free'd lateron |
| 298 | showErrorMsgBox("Not enough memory!"); | 325 | showErrorMsgBox("Not enough memory!"); |
| 299 | return false; | 326 | return false; |
| 300 | } | 327 | } |
| 301 | 328 | ||
| 329 | // clear first entry of strings | ||
| 330 | modTmpFName[0] = '\0'; | ||
| 331 | insTmpFName[0] = '\0'; | ||
| 332 | smpTmpFName[0] = '\0'; | ||
| 333 | patTmpFName[0] = '\0'; | ||
| 334 | trkTmpFName[0] = '\0'; | ||
| 335 | FReq_NameTemp[0] = '\0'; | ||
| 336 | FReq_ModCurPathU[0] = 0; | ||
| 337 | FReq_InsCurPathU[0] = 0; | ||
| 338 | FReq_SmpCurPathU[0] = 0; | ||
| 339 | FReq_PatCurPathU[0] = 0; | ||
| 340 | FReq_TrkCurPathU[0] = 0; | ||
| 341 | |||
| 302 | strcpy(modTmpFName, "untitled.xm"); | 342 | strcpy(modTmpFName, "untitled.xm"); |
| 303 | strcpy(insTmpFName, "untitled.xi"); | 343 | strcpy(insTmpFName, "untitled.xi"); |
| 304 | strcpy(smpTmpFName, "untitled.wav"); | 344 | strcpy(smpTmpFName, "untitled.wav"); |
| @@ -602,7 +642,7 @@ void diskOpSetFilename(uint8_t type, UNICHAR *pathU) · 297 unmodified lines | |||
| 602 | char *filename = getFilenameFromPath(ansiPath); | 642 | char *filename = getFilenameFromPath(ansiPath); |
| 603 | uint32_t filenameLen = (uint32_t)strlen(filename); | 643 | uint32_t filenameLen = (uint32_t)strlen(filename); |
| 604 | 644 | ||
| 605 | if (filenameLen > PATH_MAX-1) | 645 | if (filenameLen > PATH_MAX) |
| 606 | { | 646 | { |
| 607 | free(ansiPath); | 647 | free(ansiPath); |
| 608 | return; // filename is too long, don't bother to copy it over | 648 | return; // filename is too long, don't bother to copy it over |
| @@ -693,9 +733,9 @@ static void openFile(UNICHAR *filenameU, bool songModifiedCheck) · 84 unmodified lines | |||
| 693 | { | 733 | { |
| 694 | if (songModifiedCheck && song.isModified) | 734 | if (songModifiedCheck && song.isModified) |
| 695 | { | 735 | { |
| 696 | // remove file selection | 736 | // remove file selection before okBox() opens up |
| 697 | FReq_EntrySelected = -1; | 737 | FReq_EntrySelected = -1; |
| 698 | diskOp_DrawDirectory(); | 738 | diskOp_DrawFilelist(); |
| 699 | 739 | ||
| 700 | if (okBox(2, "System request", "You have unsaved changes in your song. Load new song and lose all changes?") != 1) | 740 | if (okBox(2, "System request", "You have unsaved changes in your song. Load new song and lose all changes?") != 1) |
| 701 | return; | 741 | return; |
| @@ -758,8 +798,6 @@ void changeFilenameExt(char *name, char *ext, int32_t nameMaxLen) · 56 unmodified lines | |||
| 758 | void diskOpChangeFilenameExt(char *ext) | 798 | void diskOpChangeFilenameExt(char *ext) |
| 759 | { | 799 | { |
| 760 | changeFilenameExt(FReq_FileName, ext, PATH_MAX); | 800 | changeFilenameExt(FReq_FileName, ext, PATH_MAX); |
| 761 | if (ui.diskOpShown) | ||
| 762 | diskOp_DrawDirectory(); | ||
| 763 | } | 801 | } |
| 764 | 802 | ||
| 765 | void trimEntryName(char *name, bool isDir) | 803 | void trimEntryName(char *name, bool isDir) |
| @@ -1011,7 +1049,7 @@ static void fileListPressed(int32_t index) · 245 unmodified lines | |||
| 1011 | 1049 | ||
| 1012 | // remove file selection | 1050 | // remove file selection |
| 1013 | FReq_EntrySelected = -1; | 1051 | FReq_EntrySelected = -1; |
| 1014 | diskOp_DrawDirectory(); | 1052 | diskOp_DrawFilelist(); |
| 1015 | 1053 | ||
| 1016 | DirRec *dirEntry = &FReq_Buffer[entryIndex]; | 1054 | DirRec *dirEntry = &FReq_Buffer[entryIndex]; |
| 1017 | switch (mode) | 1055 | switch (mode) |
| @@ -1077,15 +1115,16 @@ static void fileListPressed(int32_t index) · 59 unmodified lines | |||
| 1077 | if (nameTmp == NULL) | 1115 | if (nameTmp == NULL) |
| 1078 | break; | 1116 | break; |
| 1079 | 1117 | ||
| 1080 | strncpy(FReq_NameTemp, nameTmp, PATH_MAX - 1); | 1118 | strncpy(FReq_NameTemp, nameTmp, PATH_MAX); |
| 1119 | FReq_NameTemp[PATH_MAX] = '\0'; | ||
| 1081 | free(nameTmp); | 1120 | free(nameTmp); |
| 1082 | 1121 | ||
| 1083 | // in case of UTF8 -> CP437 encoding failure, there can be question marks. Remove them... | 1122 | // in case of UTF8 -> CP437 encoding failure, there can be question marks. Remove them... |
| 1084 | removeQuestionmarksFromString(FReq_NameTemp); | 1123 | removeQuestionmarksFromString(FReq_NameTemp); |
| 1085 | 1124 | ||
| 1086 | if (inputBox(1, dirEntry->isDir ? "Enter new directory name:" : "Enter new filename:", FReq_NameTemp, PATH_MAX - 1) == 1) | 1125 | if (inputBox(1, dirEntry->isDir ? "Enter new directory name:" : "Enter new filename:", FReq_NameTemp, PATH_MAX) == 1) |
| 1087 | { | 1126 | { |
| 1088 | if ((FReq_NameTemp == NULL) || (FReq_NameTemp[0] == '\0')) | 1127 | if (FReq_NameTemp == NULL || FReq_NameTemp[0] == '\0') |
| 1089 | { | 1128 | { |
| 1090 | okBox(0, "System message", "New name can't be empty!"); | 1129 | okBox(0, "System message", "New name can't be empty!"); |
| 1091 | break; | 1130 | break; |
| @@ -1120,7 +1159,7 @@ bool testDiskOpMouseDown(bool mouseHeldDlown) · 28 unmodified lines | |||
| 1120 | if (max > DISKOP_ENTRY_NUM) // needed kludge when mouse-scrolling | 1159 | if (max > DISKOP_ENTRY_NUM) // needed kludge when mouse-scrolling |
| 1121 | max = DISKOP_ENTRY_NUM; | 1160 | max = DISKOP_ENTRY_NUM; |
| 1122 | 1161 | ||
| 1123 | if (!mouseHeldDlown) | 1162 | if (!mouseHeldDlown) // select file |
| 1124 | { | 1163 | { |
| 1125 | FReq_EntrySelected = -1; | 1164 | FReq_EntrySelected = -1; |
| 1126 | 1165 | ||
| @@ -1130,7 +1169,7 @@ bool testDiskOpMouseDown(bool mouseHeldDlown) · 3 unmodified lines | |||
| 1130 | if (tmpEntry >= 0 && tmpEntry < max) | 1169 | if (tmpEntry >= 0 && tmpEntry < max) |
| 1131 | { | 1170 | { |
| 1132 | FReq_EntrySelected = tmpEntry; | 1171 | FReq_EntrySelected = tmpEntry; |
| 1133 | diskOp_DrawDirectory(); | 1172 | diskOp_DrawFilelist(); |
| 1134 | } | 1173 | } |
| 1135 | 1174 | ||
| 1136 | mouse.lastUsedObjectType = OBJECT_DISKOPLIST; | 1175 | mouse.lastUsedObjectType = OBJECT_DISKOPLIST; |
| @@ -1161,7 +1200,7 @@ bool testDiskOpMouseDown(bool mouseHeldDlown) · 24 unmodified lines | |||
| 1161 | if (mouse.x < 169 || mouse.x > 331 || mouse.y < 4 || tmpEntry < 0 || tmpEntry >= max) | 1200 | if (mouse.x < 169 || mouse.x > 331 || mouse.y < 4 || tmpEntry < 0 || tmpEntry >= max) |
| 1162 | { | 1201 | { |
| 1163 | FReq_EntrySelected = -1; | 1202 | FReq_EntrySelected = -1; |
| 1164 | diskOp_DrawDirectory(); | 1203 | diskOp_DrawFilelist(); |
| 1165 | 1204 | ||
| 1166 | return true; | 1205 | return true; |
| 1167 | } | 1206 | } |
| @@ -1169,7 +1208,7 @@ bool testDiskOpMouseDown(bool mouseHeldDlown) · 1 unmodified line | |||
| 1169 | if (tmpEntry != FReq_EntrySelected) | 1208 | if (tmpEntry != FReq_EntrySelected) |
| 1170 | { | 1209 | { |
| 1171 | FReq_EntrySelected = tmpEntry; | 1210 | FReq_EntrySelected = tmpEntry; |
| 1172 | diskOp_DrawDirectory(); | 1211 | diskOp_DrawFilelist(); |
| 1173 | } | 1212 | } |
| 1174 | 1213 | ||
| 1175 | return true; | 1214 | return true; |
| @@ -1183,7 +1222,7 @@ void testDiskOpMouseRelease(void) · 7 unmodified lines | |||
| 1183 | fileListPressed((mouse.y - 4) / (FONT1_CHAR_H + 1)); | 1222 | fileListPressed((mouse.y - 4) / (FONT1_CHAR_H + 1)); |
| 1184 | 1223 | ||
| 1185 | FReq_EntrySelected = -1; | 1224 | FReq_EntrySelected = -1; |
| 1186 | diskOp_DrawDirectory(); | 1225 | diskOp_DrawFilelist(); |
| 1187 | } | 1226 | } |
| 1188 | } | 1227 | } |
| 1189 | 1228 | ||
| @@ -1537,7 +1576,7 @@ static char *ach(int32_t rad) // used for sortDirectory() · 347 unmodified lines | |||
| 1537 | return NULL; | 1576 | return NULL; |
| 1538 | } | 1577 | } |
| 1539 | 1578 | ||
| 1540 | char *p = (char *)malloc(nameLen + 2); | 1579 | char *p = (char *)malloc(nameLen+1+1); |
| 1541 | if (p == NULL) | 1580 | if (p == NULL) |
| 1542 | { | 1581 | { |
| 1543 | free(name); | 1582 | free(name); |
| @@ -1701,6 +1740,9 @@ static void displayCurrPath(void) · 157 unmodified lines | |||
| 1701 | { | 1740 | { |
| 1702 | fillRect(4, 145, 162, 10, PAL_DESKTOP); | 1741 | fillRect(4, 145, 162, 10, PAL_DESKTOP); |
| 1703 | 1742 | ||
| 1743 | if (FReq_CurPathU == NULL) | ||
| 1744 | return; | ||
| 1745 | |||
| 1704 | const uint32_t pathLen = (uint32_t)UNICHAR_STRLEN(FReq_CurPathU); | 1746 | const uint32_t pathLen = (uint32_t)UNICHAR_STRLEN(FReq_CurPathU); |
| 1705 | if (pathLen == 0) | 1747 | if (pathLen == 0) |
| 1706 | return; | 1748 | return; |
| @@ -1722,11 +1764,14 @@ static void displayCurrPath(void) · 15 unmodified lines | |||
| 1722 | { | 1764 | { |
| 1723 | // path doesn't fit, print drive + ".." + last directory | 1765 | // path doesn't fit, print drive + ".." + last directory |
| 1724 | 1766 | ||
| 1725 | memset(FReq_NameTemp, 0, PATH_MAX + 1); | ||
| 1726 | #ifdef _WIN32 | 1767 | #ifdef _WIN32 |
| 1727 | strncpy(FReq_NameTemp, p, 3); | 1768 | memcpy(FReq_NameTemp, p, 3); // get drive (f.ex. C:\) |
| 1769 | FReq_NameTemp[3] = '\0'; | ||
| 1770 | |||
| 1728 | strcat(FReq_NameTemp, ".\001"); // special character in font | 1771 | strcat(FReq_NameTemp, ".\001"); // special character in font |
| 1772 | FReq_NameTemp[5] = '\0'; | ||
| 1729 | #else | 1773 | #else |
| 1774 | FReq_NameTemp[0] = '\0'; | ||
| 1730 | strcpy(FReq_NameTemp, "/"); | 1775 | strcpy(FReq_NameTemp, "/"); |
| 1731 | strcat(FReq_NameTemp, ".."); | 1776 | strcat(FReq_NameTemp, ".."); |
| 1732 | #endif | 1777 | #endif |
| @@ -1735,7 +1780,7 @@ static void displayCurrPath(void) · 2 unmodified lines | |||
| 1735 | if (delimiter != NULL) | 1780 | if (delimiter != NULL) |
| 1736 | { | 1781 | { |
| 1737 | #ifdef _WIN32 | 1782 | #ifdef _WIN32 |
| 1738 | strcat(FReq_NameTemp, delimiter + 1); | 1783 | strcat(FReq_NameTemp, delimiter+1); |
| 1739 | #else | 1784 | #else |
| 1740 | strcat(FReq_NameTemp, delimiter); | 1785 | strcat(FReq_NameTemp, delimiter); |
| 1741 | #endif | 1786 | #endif |
| @@ -1749,9 +1794,9 @@ static void displayCurrPath(void) · 7 unmodified lines | |||
| 1749 | p = FReq_NameTemp; | 1794 | p = FReq_NameTemp; |
| 1750 | while (j >= 6 && textWidth(p) >= 162) | 1795 | while (j >= 6 && textWidth(p) >= 162) |
| 1751 | { | 1796 | { |
| 1752 | p[j - 2] = '.'; | 1797 | p[j-2] = '.'; |
| 1753 | p[j - 1] = '.'; | 1798 | p[j-1] = '.'; |
| 1754 | p[j - 0] = '\0'; | 1799 | p[j-0] = '\0'; |
| 1755 | j--; | 1800 | j--; |
| 1756 | } | 1801 | } |
| 1757 | } | 1802 | } |
| @@ -1762,25 +1807,20 @@ static void displayCurrPath(void) · 4 unmodified lines | |||
| 1762 | free(asciiPath); | 1807 | free(asciiPath); |
| 1763 | } | 1808 | } |
| 1764 | 1809 | ||
| 1765 | void diskOp_DrawDirectory(void) | 1810 | void diskOp_DrawFilelist(void) |
| 1766 | { | 1811 | { |
| 1767 | clearRect(FILENAME_TEXT_X - 1, 4, 162, 164); | 1812 | clearRect(FILENAME_TEXT_X-1, 4, 162, 164); |
| 1768 | drawTextBox(TB_DISKOP_FILENAME); | ||
| 1769 | 1813 | ||
| 1814 | if (FReq_FileCount == 0) | ||
| 1815 | return; | ||
| 1816 | |||
| 1817 | // draw "selected file" rectangle | ||
| 1770 | if (FReq_EntrySelected != -1) | 1818 | if (FReq_EntrySelected != -1) |
| 1771 | { | 1819 | { |
| 1772 | const uint16_t y = 4 + (uint16_t)((FONT1_CHAR_H + 1) * FReq_EntrySelected); | 1820 | const uint16_t y = 4 + (uint16_t)((FONT1_CHAR_H + 1) * FReq_EntrySelected); |
| 1773 | fillRect(FILENAME_TEXT_X - 1, y, 162, FONT1_CHAR_H, PAL_PATTEXT); | 1821 | fillRect(FILENAME_TEXT_X - 1, y, 162, FONT1_CHAR_H, PAL_PATTEXT); |
| 1774 | } | 1822 | } |
| 1775 | 1823 | ||
| 1776 | displayCurrPath(); | ||
| 1777 | #ifdef _WIN32 | ||
| 1778 | setupDiskOpDrives(); | ||
| 1779 | #endif | ||
| 1780 | |||
| 1781 | if (FReq_FileCount == 0) | ||
| 1782 | return; | ||
| 1783 | |||
| 1784 | for (uint16_t i = 0; i < DISKOP_ENTRY_NUM; i++) | 1824 | for (uint16_t i = 0; i < DISKOP_ENTRY_NUM; i++) |
| 1785 | { | 1825 | { |
| 1786 | const int32_t bufEntry = FReq_DirPos + i; | 1826 | const int32_t bufEntry = FReq_DirPos + i; |
| @@ -1817,9 +1857,21 @@ void diskOp_DrawDirectory(void) · 30 unmodified lines | |||
| 1817 | if (!FReq_Buffer[bufEntry].isDir) | 1857 | if (!FReq_Buffer[bufEntry].isDir) |
| 1818 | printFormattedFilesize(FILESIZE_TEXT_X, y, bufEntry); | 1858 | printFormattedFilesize(FILESIZE_TEXT_X, y, bufEntry); |
| 1819 | } | 1859 | } |
| 1860 | } | ||
| 1861 | |||
| 1862 | void diskOp_DrawDirectory(void) | ||
| 1863 | { | ||
| 1864 | drawTextBox(TB_DISKOP_FILENAME); | ||
| 1865 | |||
| 1866 | displayCurrPath(); | ||
| 1867 | #ifdef _WIN32 | ||
| 1868 | setupDiskOpDrives(); | ||
| 1869 | #endif | ||
| 1820 | 1870 | ||
| 1821 | setScrollBarPos(SB_DISKOP_LIST, FReq_DirPos, true); | ||
| 1822 | setScrollBarEnd(SB_DISKOP_LIST, FReq_FileCount); | 1871 | setScrollBarEnd(SB_DISKOP_LIST, FReq_FileCount); |
| 1872 | setScrollBarPos(SB_DISKOP_LIST, FReq_DirPos, false); | ||
| 1873 | |||
| 1874 | diskOp_DrawFilelist(); | ||
| 1823 | } | 1875 | } |
| 1824 | 1876 | ||
| 1825 | static DirRec *bufferCreateEmptyDir(void) // special case: creates a dir entry with a ".." directory | 1877 | static DirRec *bufferCreateEmptyDir(void) // special case: creates a dir entry with a ".." directory |
| @@ -2035,7 +2087,7 @@ static void setDiskOpItem(uint8_t item) · 209 unmodified lines | |||
| 2035 | // FReq_ModCurPathU is always set at this point | 2087 | // FReq_ModCurPathU is always set at this point |
| 2036 | 2088 | ||
| 2037 | FReq_CurPathU = FReq_ModCurPathU; | 2089 | FReq_CurPathU = FReq_ModCurPathU; |
| 2038 | if (FReq_CurPathU != NULL) | 2090 | if (FReq_CurPathU != NULL && FReq_CurPathU[0] != '\0') |
| 2039 | UNICHAR_CHDIR(FReq_CurPathU); | 2091 | UNICHAR_CHDIR(FReq_CurPathU); |
| 2040 | } | 2092 | } |
| 2041 | break; | 2093 | break; |
| @@ -2044,7 +2096,7 @@ static void setDiskOpItem(uint8_t item) · 2 unmodified lines | |||
| 2044 | { | 2096 | { |
| 2045 | FReq_FileName = insTmpFName; | 2097 | FReq_FileName = insTmpFName; |
| 2046 | 2098 | ||
| 2047 | if (!insPathSet) | 2099 | if (!insPathSet && FReq_CurPathU != NULL && FReq_CurPathU[0] != '\0') |
| 2048 | { | 2100 | { |
| 2049 | UNICHAR_STRCPY(FReq_InsCurPathU, FReq_CurPathU); | 2101 | UNICHAR_STRCPY(FReq_InsCurPathU, FReq_CurPathU); |
| 2050 | insPathSet = true; | 2102 | insPathSet = true; |
| @@ -2060,7 +2112,7 @@ static void setDiskOpItem(uint8_t item) · 9 unmodified lines | |||
| 2060 | { | 2112 | { |
| 2061 | FReq_FileName = smpTmpFName; | 2113 | FReq_FileName = smpTmpFName; |
| 2062 | 2114 | ||
| 2063 | if (!smpPathSet) | 2115 | if (!smpPathSet && FReq_CurPathU != NULL && FReq_CurPathU[0] != '\0') |
| 2064 | { | 2116 | { |
| 2065 | UNICHAR_STRCPY(FReq_SmpCurPathU, FReq_CurPathU); | 2117 | UNICHAR_STRCPY(FReq_SmpCurPathU, FReq_CurPathU); |
| 2066 | smpPathSet = true; | 2118 | smpPathSet = true; |
| @@ -2076,7 +2128,7 @@ static void setDiskOpItem(uint8_t item) · 9 unmodified lines | |||
| 2076 | { | 2128 | { |
| 2077 | FReq_FileName = patTmpFName; | 2129 | FReq_FileName = patTmpFName; |
| 2078 | 2130 | ||
| 2079 | if (!patPathSet) | 2131 | if (!patPathSet && FReq_CurPathU != NULL && FReq_CurPathU[0] != '\0') |
| 2080 | { | 2132 | { |
| 2081 | UNICHAR_STRCPY(FReq_PatCurPathU, FReq_CurPathU); | 2133 | UNICHAR_STRCPY(FReq_PatCurPathU, FReq_CurPathU); |
| 2082 | patPathSet = true; | 2134 | patPathSet = true; |
| @@ -2092,7 +2144,7 @@ static void setDiskOpItem(uint8_t item) · 9 unmodified lines | |||
| 2092 | { | 2144 | { |
| 2093 | FReq_FileName = trkTmpFName; | 2145 | FReq_FileName = trkTmpFName; |
| 2094 | 2146 | ||
| 2095 | if (!trkPathSet) | 2147 | if (!trkPathSet && FReq_CurPathU != NULL && FReq_CurPathU[0] != '\0') |
| 2096 | { | 2148 | { |
| 2097 | UNICHAR_STRCPY(FReq_TrkCurPathU, FReq_CurPathU); | 2149 | UNICHAR_STRCPY(FReq_TrkCurPathU, FReq_CurPathU); |
| 2098 | trkPathSet = true; | 2150 | trkPathSet = true; |
| @@ -2105,15 +2157,13 @@ static void setDiskOpItem(uint8_t item) · 6 unmodified lines | |||
| 2105 | break; | 2157 | break; |
| 2106 | } | 2158 | } |
| 2107 | 2159 | ||
| 2108 | const int32_t pathLen = (int32_t)UNICHAR_STRLEN(FReq_CurPathU); | 2160 | if (FReq_CurPathU != NULL && FReq_ModCurPathU != NULL) |
| 2109 | if (pathLen == 0 && FReq_ModCurPathU[0] != '\0') | ||
| 2110 | { | 2161 | { |
| 2111 | memset(FReq_CurPathU, 0, (PATH_MAX + 2) * sizeof (UNICHAR)); | 2162 | if (FReq_CurPathU[0] == '\0' && FReq_ModCurPathU[0] != '\0') |
| 2112 | UNICHAR_STRCPY(FReq_CurPathU, FReq_ModCurPathU); | 2163 | UNICHAR_STRCPY(FReq_CurPathU, FReq_ModCurPathU); |
| 2113 | } | 2164 | } |
| 2114 | 2165 | ||
| 2115 | textBoxes[TB_DISKOP_FILENAME].textPtr = FReq_FileName; | 2166 | textBoxes[TB_DISKOP_FILENAME].textPtr = FReq_FileName; |
| 2116 | |||
| 2117 | FReq_ShowAllFiles = false; | 2167 | FReq_ShowAllFiles = false; |
| 2118 | 2168 | ||
| 2119 | if (ui.diskOpShown) | 2169 | if (ui.diskOpShown) |
| @@ -2199,14 +2249,15 @@ void showDiskOpScreen(void) · 79 unmodified lines | |||
| 2199 | assert(FReq_ModCurPathU != NULL); | 2249 | assert(FReq_ModCurPathU != NULL); |
| 2200 | 2250 | ||
| 2201 | // first test if we can change the dir to the one stored in the config (if present) | 2251 | // first test if we can change the dir to the one stored in the config (if present) |
| 2202 | if (UNICHAR_STRLEN(FReq_ModCurPathU) == 0 || UNICHAR_CHDIR(FReq_ModCurPathU) != 0) | 2252 | if (FReq_ModCurPathU[0] == '\0' || UNICHAR_CHDIR(FReq_ModCurPathU) != 0) |
| 2203 | { | 2253 | { |
| 2204 | // nope, couldn't do that, set Disk Op. path to user/home directory | 2254 | // nope, couldn't do that, set Disk Op. path to user/home directory |
| 2205 | #ifdef _WIN32 | 2255 | #ifdef _WIN32 |
| 2206 | SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, FReq_ModCurPathU); | 2256 | SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, FReq_ModCurPathU); |
| 2207 | #else | 2257 | #else |
| 2208 | if (getenv("HOME") != NULL) | 2258 | char *home = getenv("HOME"); |
| 2209 | UNICHAR_STRCPY(FReq_ModCurPathU, getenv("HOME")); | 2259 | if (home != NULL) |
| 2260 | UNICHAR_STRCPY(FReq_ModCurPathU, home); | ||
| 2210 | #endif | 2261 | #endif |
| 2211 | UNICHAR_CHDIR(FReq_ModCurPathU); | 2262 | UNICHAR_CHDIR(FReq_ModCurPathU); |
| 2212 | } | 2263 | } |
| @@ -2285,7 +2336,7 @@ void sbDiskOpSetPos(uint32_t pos) · 72 unmodified lines | |||
| 2285 | if ((int32_t)pos != FReq_DirPos && FReq_FileCount > DISKOP_ENTRY_NUM) | 2336 | if ((int32_t)pos != FReq_DirPos && FReq_FileCount > DISKOP_ENTRY_NUM) |
| 2286 | { | 2337 | { |
| 2287 | FReq_DirPos = (int32_t)pos; | 2338 | FReq_DirPos = (int32_t)pos; |
| 2288 | diskOp_DrawDirectory(); | 2339 | diskOp_DrawFilelist(); |
| 2289 | } | 2340 | } |
| 2290 | } | 2341 | } |
| 2291 | 2342 | ||
| @@ -2345,7 +2396,7 @@ void pbDiskOpRename(void) · 53 unmodified lines | |||
| 2345 | void pbDiskOpMakeDir(void) | 2396 | void pbDiskOpMakeDir(void) |
| 2346 | { | 2397 | { |
| 2347 | FReq_NameTemp[0] = '\0'; | 2398 | FReq_NameTemp[0] = '\0'; |
| 2348 | if (inputBox(1, "Enter directory name:", FReq_NameTemp, PATH_MAX - 1) == 1) | 2399 | if (inputBox(1, "Enter directory name:", FReq_NameTemp, PATH_MAX) == 1) |
| 2349 | { | 2400 | { |
| 2350 | if (FReq_NameTemp[0] == '\0') | 2401 | if (FReq_NameTemp[0] == '\0') |
| 2351 | { | 2402 | { |
| @@ -2371,7 +2422,7 @@ void pbDiskOpRefresh(void) · 19 unmodified lines | |||
| 2371 | void pbDiskOpSetPath(void) | 2422 | void pbDiskOpSetPath(void) |
| 2372 | { | 2423 | { |
| 2373 | FReq_NameTemp[0] = '\0'; | 2424 | FReq_NameTemp[0] = '\0'; |
| 2374 | if (inputBox(1, "Enter new directory path:", FReq_NameTemp, PATH_MAX - 1) == 1) | 2425 | if (inputBox(1, "Enter new directory path:", FReq_NameTemp, PATH_MAX) == 1) |
| 2375 | { | 2426 | { |
| 2376 | if (FReq_NameTemp[0] == '\0') | 2427 | if (FReq_NameTemp[0] == '\0') |
| 2377 | { | 2428 | { |
| @@ -21,6 +21,7 @@ enum · 20 unmodified lines | |||
| 21 | SMP_SAVE_MODE_WAV = 2 | 21 | SMP_SAVE_MODE_WAV = 2 |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | bool setupExecutablePath(void); | ||
| 24 | int32_t getFileSize(UNICHAR *fileNameU); | 25 | int32_t getFileSize(UNICHAR *fileNameU); |
| 25 | uint8_t getDiskOpItem(void); | 26 | uint8_t getDiskOpItem(void); |
| 26 | void updateCurrSongFilename(void); // for window title | 27 | void updateCurrSongFilename(void); // for window title |
| @@ -41,6 +42,7 @@ int32_t getExtOffset(char *s, int32_t stringLen); // get byte offset of file ext · 14 unmodified lines | |||
| 41 | bool testDiskOpMouseDown(bool mouseHeldDown); | 42 | bool testDiskOpMouseDown(bool mouseHeldDown); |
| 42 | void testDiskOpMouseRelease(void); | 43 | void testDiskOpMouseRelease(void); |
| 43 | void diskOp_StartDirReadThread(void); | 44 | void diskOp_StartDirReadThread(void); |
| 45 | void diskOp_DrawFilelist(void); | ||
| 44 | void diskOp_DrawDirectory(void); | 46 | void diskOp_DrawDirectory(void); |
| 45 | void showDiskOpScreen(void); | 47 | void showDiskOpScreen(void); |
| 46 | void hideDiskOpScreen(void); | 48 | void hideDiskOpScreen(void); |
| @@ -35,13 +35,14 @@ · 34 unmodified lines | |||
| 35 | 35 | ||
| 36 | #define CRASH_TEXT "Oh no!\nThe Fasttracker II clone has crashed...\n\nA backup .xm was hopefully " \ | 36 | #define CRASH_TEXT "Oh no!\nThe Fasttracker II clone has crashed...\n\nA backup .xm was hopefully " \ |
| 37 | "saved to the current module directory.\n\nPlease report this bug if you can.\n" \ | 37 | "saved to the current module directory.\n\nPlease report this bug if you can.\n" \ |
| 38 | "Try to mention what you did before the crash happened." | 38 | "Try to mention what you did before the crash happened.\n" \ |
| 39 | "My email can be found at the bottom of 16-bits.org." | ||
| 39 | 40 | ||
| 40 | static bool backupMadeAfterCrash; | 41 | static bool backupMadeAfterCrash; |
| 41 | 42 | ||
| 42 | #ifdef _WIN32 | 43 | #ifdef _WIN32 |
| 43 | #define SYSMSG_FILE_ARG (WM_USER + 1) | 44 | #define SYSMSG_FILE_ARG (WM_USER+1) |
| 44 | #define ARGV_SHARED_MEM_MAX_LEN ((MAX_PATH * 2) + 2) | 45 | #define ARGV_SHARED_MEM_MAX_LEN ((PATH_MAX+1) * sizeof (WCHAR)) |
| 45 | #define SHARED_HWND_NAME TEXT("Local\\FT2CloneHwnd") | 46 | #define SHARED_HWND_NAME TEXT("Local\\FT2CloneHwnd") |
| 46 | #define SHARED_FILENAME TEXT("Local\\FT2CloneFilename") | 47 | #define SHARED_FILENAME TEXT("Local\\FT2CloneFilename") |
| 47 | static HWND hWnd; | 48 | static HWND hWnd; |
| @@ -127,20 +127,21 @@ void unstuckLastUsedGUIElement(void) · 126 unmodified lines | |||
| 127 | 127 | ||
| 128 | bool setupGUI(void) | 128 | bool setupGUI(void) |
| 129 | { | 129 | { |
| 130 | int32_t i; | ||
| 131 | |||
| 132 | // all memory will be NULL-tested and free'd if we return false somewhere in this function | 130 | // all memory will be NULL-tested and free'd if we return false somewhere in this function |
| 133 | 131 | ||
| 134 | editor.tmpFilenameU = (UNICHAR *)calloc(PATH_MAX + 1, sizeof (UNICHAR)); | 132 | editor.tmpFilenameU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 135 | editor.tmpInstrFilenameU = (UNICHAR *)calloc(PATH_MAX + 1, sizeof (UNICHAR)); | 133 | editor.tmpInstrFilenameU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 136 | 134 | ||
| 137 | if (editor.tmpFilenameU == NULL || editor.tmpInstrFilenameU == NULL) | 135 | if (editor.tmpFilenameU == NULL || editor.tmpInstrFilenameU == NULL) |
| 138 | goto setupGUI_OOM; | 136 | goto setupGUI_OOM; |
| 139 | 137 | ||
| 138 | editor.tmpFilenameU[0] = 0; | ||
| 139 | editor.tmpInstrFilenameU[0] = 0; | ||
| 140 | |||
| 140 | // set uninitialized GUI struct entries | 141 | // set uninitialized GUI struct entries |
| 141 | 142 | ||
| 142 | textBox_t *t = &textBoxes[1]; // skip first entry, it's reserved for inputBox()) | 143 | textBox_t *t = &textBoxes[1]; // skip first entry, it's reserved for inputBox()) |
| 143 | for (i = 1; i < NUM_TEXTBOXES; i++, t++) | 144 | for (int32_t i = 1; i < NUM_TEXTBOXES; i++, t++) |
| 144 | { | 145 | { |
| 145 | t->visible = false; | 146 | t->visible = false; |
| 146 | t->bufOffset = 0; | 147 | t->bufOffset = 0; |
| @@ -156,7 +157,7 @@ bool setupGUI(void) · 9 unmodified lines | |||
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | pushButton_t *p = pushButtons; | 159 | pushButton_t *p = pushButtons; |
| 159 | for (i = 0; i < NUM_PUSHBUTTONS; i++, p++) | 160 | for (int32_t i = 0; i < NUM_PUSHBUTTONS; i++, p++) |
| 160 | { | 161 | { |
| 161 | p->state = 0; | 162 | p->state = 0; |
| 162 | p->visible = false; | 163 | p->visible = false; |
| @@ -174,7 +175,7 @@ bool setupGUI(void) · 11 unmodified lines | |||
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | checkBox_t *c = checkBoxes; | 177 | checkBox_t *c = checkBoxes; |
| 177 | for (i = 0; i < NUM_CHECKBOXES; i++, c++) | 178 | for (int32_t i = 0; i < NUM_CHECKBOXES; i++, c++) |
| 178 | { | 179 | { |
| 179 | c->state = 0; | 180 | c->state = 0; |
| 180 | c->checked = false; | 181 | c->checked = false; |
| @@ -182,14 +183,14 @@ bool setupGUI(void) · 1 unmodified line | |||
| 182 | } | 183 | } |
| 183 | 184 | ||
| 184 | radioButton_t *r = radioButtons; | 185 | radioButton_t *r = radioButtons; |
| 185 | for (i = 0; i < NUM_RADIOBUTTONS; i++, r++) | 186 | for (int32_t i = 0; i < NUM_RADIOBUTTONS; i++, r++) |
| 186 | { | 187 | { |
| 187 | r->state = 0; | 188 | r->state = 0; |
| 188 | r->visible = false; | 189 | r->visible = false; |
| 189 | } | 190 | } |
| 190 | 191 | ||
| 191 | scrollBar_t *s = scrollBars; | 192 | scrollBar_t *s = scrollBars; |
| 192 | for (i = 0; i < NUM_SCROLLBARS; i++, s++) | 193 | for (int32_t i = 0; i < NUM_SCROLLBARS; i++, s++) |
| 193 | { | 194 | { |
| 194 | s->visible = false; | 195 | s->visible = false; |
| 195 | s->state = 0; | 196 | s->state = 0; |
| @@ -122,7 +122,8 @@ void keyDownHandler(SDL_Scancode scancode, SDL_Keycode keycode, bool keyWasRepea · 121 unmodified lines | |||
| 122 | return; // do NOT repeat keys in Nibbles or if keyRepeat is disabled | 122 | return; // do NOT repeat keys in Nibbles or if keyRepeat is disabled |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | keyb.keyRepeat = true; | 125 | if (scancode != SDL_SCANCODE_ESCAPE) |
| 126 | keyb.keyRepeat = true; | ||
| 126 | 127 | ||
| 127 | // handle certain keys (home/end/left/right etc) when editing text | 128 | // handle certain keys (home/end/left/right etc) when editing text |
| 128 | if (editor.editTextFlag) | 129 | if (editor.editTextFlag) |
| @@ -669,6 +670,7 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 540 unmodified lines | |||
| 669 | 670 | ||
| 670 | case SDLK_KP_ENTER: | 671 | case SDLK_KP_ENTER: |
| 671 | case SDLK_RETURN: | 672 | case SDLK_RETURN: |
| 673 | { | ||
| 672 | if (keyb.leftAltPressed) | 674 | if (keyb.leftAltPressed) |
| 673 | { | 675 | { |
| 674 | toggleFullScreen(); | 676 | toggleFullScreen(); |
| @@ -679,9 +681,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 679 | #endif | 681 | #endif |
| 680 | return true; | 682 | return true; |
| 681 | } | 683 | } |
| 682 | break; | 684 | } |
| 685 | break; | ||
| 683 | 686 | ||
| 684 | case SDLK_F9: | 687 | case SDLK_F9: |
| 688 | { | ||
| 685 | if (keyb.leftCtrlPressed) | 689 | if (keyb.leftCtrlPressed) |
| 686 | { | 690 | { |
| 687 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[0]); | 691 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[0]); |
| @@ -692,9 +696,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 692 | editor.ptnJumpPos[0] = (uint8_t)editor.pattPos; | 696 | editor.ptnJumpPos[0] = (uint8_t)editor.pattPos; |
| 693 | return true; | 697 | return true; |
| 694 | } | 698 | } |
| 695 | break; | 699 | } |
| 700 | break; | ||
| 696 | 701 | ||
| 697 | case SDLK_F10: | 702 | case SDLK_F10: |
| 703 | { | ||
| 698 | if (keyb.leftCtrlPressed) | 704 | if (keyb.leftCtrlPressed) |
| 699 | { | 705 | { |
| 700 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[1]); | 706 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[1]); |
| @@ -705,9 +711,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 705 | editor.ptnJumpPos[1] = (uint8_t)editor.pattPos; | 711 | editor.ptnJumpPos[1] = (uint8_t)editor.pattPos; |
| 706 | return true; | 712 | return true; |
| 707 | } | 713 | } |
| 708 | break; | 714 | } |
| 715 | break; | ||
| 709 | 716 | ||
| 710 | case SDLK_F11: | 717 | case SDLK_F11: |
| 718 | { | ||
| 711 | if (keyb.leftCtrlPressed) | 719 | if (keyb.leftCtrlPressed) |
| 712 | { | 720 | { |
| 713 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[2]); | 721 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[2]); |
| @@ -718,9 +726,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 718 | editor.ptnJumpPos[2] = (uint8_t)editor.pattPos; | 726 | editor.ptnJumpPos[2] = (uint8_t)editor.pattPos; |
| 719 | return true; | 727 | return true; |
| 720 | } | 728 | } |
| 721 | break; | 729 | } |
| 730 | break; | ||
| 722 | 731 | ||
| 723 | case SDLK_F12: | 732 | case SDLK_F12: |
| 733 | { | ||
| 724 | if (keyb.leftCtrlPressed) | 734 | if (keyb.leftCtrlPressed) |
| 725 | { | 735 | { |
| 726 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[3]); | 736 | startPlaying(PLAYMODE_PATT, editor.ptnJumpPos[3]); |
| @@ -731,9 +741,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 731 | editor.ptnJumpPos[3] = (uint8_t)editor.pattPos; | 741 | editor.ptnJumpPos[3] = (uint8_t)editor.pattPos; |
| 732 | return true; | 742 | return true; |
| 733 | } | 743 | } |
| 734 | break; | 744 | } |
| 745 | break; | ||
| 735 | 746 | ||
| 736 | case SDLK_a: | 747 | case SDLK_a: |
| 748 | { | ||
| 737 | if (keyb.leftCtrlPressed) | 749 | if (keyb.leftCtrlPressed) |
| 738 | { | 750 | { |
| 739 | if (ui.sampleEditorShown) | 751 | if (ui.sampleEditorShown) |
| @@ -752,9 +764,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 12 unmodified lines | |||
| 752 | 764 | ||
| 753 | return true; | 765 | return true; |
| 754 | } | 766 | } |
| 755 | break; | 767 | } |
| 768 | break; | ||
| 756 | 769 | ||
| 757 | case SDLK_b: | 770 | case SDLK_b: |
| 771 | { | ||
| 758 | if (keyb.leftCtrlPressed) | 772 | if (keyb.leftCtrlPressed) |
| 759 | { | 773 | { |
| 760 | if (!ui.aboutScreenShown) | 774 | if (!ui.aboutScreenShown) |
| @@ -762,9 +776,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 1 unmodified line | |||
| 762 | 776 | ||
| 763 | return true; | 777 | return true; |
| 764 | } | 778 | } |
| 765 | break; | 779 | } |
| 780 | break; | ||
| 766 | 781 | ||
| 767 | case SDLK_c: | 782 | case SDLK_c: |
| 783 | { | ||
| 768 | if (keyb.leftAltPressed) | 784 | if (keyb.leftAltPressed) |
| 769 | { | 785 | { |
| 770 | if (ui.sampleEditorShown) | 786 | if (ui.sampleEditorShown) |
| @@ -793,9 +809,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 22 unmodified lines | |||
| 793 | 809 | ||
| 794 | return true; | 810 | return true; |
| 795 | } | 811 | } |
| 796 | break; | 812 | } |
| 813 | break; | ||
| 797 | 814 | ||
| 798 | case SDLK_d: | 815 | case SDLK_d: |
| 816 | { | ||
| 799 | if (keyb.leftAltPressed) | 817 | if (keyb.leftAltPressed) |
| 800 | { | 818 | { |
| 801 | jumpToChannel(10); | 819 | jumpToChannel(10); |
| @@ -808,9 +826,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 6 unmodified lines | |||
| 808 | 826 | ||
| 809 | return true; | 827 | return true; |
| 810 | } | 828 | } |
| 811 | break; | 829 | } |
| 830 | break; | ||
| 812 | 831 | ||
| 813 | case SDLK_e: | 832 | case SDLK_e: |
| 833 | { | ||
| 814 | if (keyb.leftAltPressed) | 834 | if (keyb.leftAltPressed) |
| 815 | { | 835 | { |
| 816 | jumpToChannel(2); | 836 | jumpToChannel(2); |
| @@ -826,9 +846,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 9 unmodified lines | |||
| 826 | showSampleEditorExt(); | 846 | showSampleEditorExt(); |
| 827 | return true; | 847 | return true; |
| 828 | } | 848 | } |
| 829 | break; | 849 | } |
| 850 | break; | ||
| 830 | 851 | ||
| 831 | case SDLK_f: | 852 | case SDLK_f: |
| 853 | { | ||
| 832 | #ifdef __APPLE__ | 854 | #ifdef __APPLE__ |
| 833 | if (keyb.leftCommandPressed && keyb.leftCtrlPressed) | 855 | if (keyb.leftCommandPressed && keyb.leftCtrlPressed) |
| 834 | { | 856 | { |
| @@ -854,17 +876,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 19 unmodified lines | |||
| 854 | jumpToChannel(11); | 876 | jumpToChannel(11); |
| 855 | return true; | 877 | return true; |
| 856 | } | 878 | } |
| 857 | break; | 879 | } |
| 880 | break; | ||
| 858 | 881 | ||
| 859 | case SDLK_g: | 882 | case SDLK_g: |
| 883 | { | ||
| 860 | if (keyb.leftAltPressed) | 884 | if (keyb.leftAltPressed) |
| 861 | { | 885 | { |
| 862 | jumpToChannel(12); | 886 | jumpToChannel(12); |
| 863 | return true; | 887 | return true; |
| 864 | } | 888 | } |
| 865 | break; | 889 | } |
| 890 | break; | ||
| 866 | 891 | ||
| 867 | case SDLK_h: | 892 | case SDLK_h: |
| 893 | { | ||
| 868 | if (keyb.leftAltPressed) | 894 | if (keyb.leftAltPressed) |
| 869 | { | 895 | { |
| 870 | jumpToChannel(13); | 896 | jumpToChannel(13); |
| @@ -875,9 +901,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 875 | showHelpScreen(); | 901 | showHelpScreen(); |
| 876 | return true; | 902 | return true; |
| 877 | } | 903 | } |
| 878 | break; | 904 | } |
| 905 | break; | ||
| 879 | 906 | ||
| 880 | case SDLK_i: | 907 | case SDLK_i: |
| 908 | { | ||
| 881 | if (keyb.leftAltPressed) | 909 | if (keyb.leftAltPressed) |
| 882 | { | 910 | { |
| 883 | jumpToChannel(7); | 911 | jumpToChannel(7); |
| @@ -888,25 +916,31 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 888 | showInstEditor(); | 916 | showInstEditor(); |
| 889 | return true; | 917 | return true; |
| 890 | } | 918 | } |
| 891 | break; | 919 | } |
| 920 | break; | ||
| 892 | 921 | ||
| 893 | case SDLK_j: | 922 | case SDLK_j: |
| 923 | { | ||
| 894 | if (keyb.leftAltPressed) | 924 | if (keyb.leftAltPressed) |
| 895 | { | 925 | { |
| 896 | jumpToChannel(14); | 926 | jumpToChannel(14); |
| 897 | return true; | 927 | return true; |
| 898 | } | 928 | } |
| 899 | break; | 929 | } |
| 930 | break; | ||
| 900 | 931 | ||
| 901 | case SDLK_k: | 932 | case SDLK_k: |
| 933 | { | ||
| 902 | if (keyb.leftAltPressed) | 934 | if (keyb.leftAltPressed) |
| 903 | { | 935 | { |
| 904 | jumpToChannel(15); | 936 | jumpToChannel(15); |
| 905 | return true; | 937 | return true; |
| 906 | } | 938 | } |
| 907 | break; | 939 | } |
| 940 | break; | ||
| 908 | 941 | ||
| 909 | case SDLK_m: | 942 | case SDLK_m: |
| 943 | { | ||
| 910 | if (keyb.leftCtrlPressed) | 944 | if (keyb.leftCtrlPressed) |
| 911 | { | 945 | { |
| 912 | if (ui.aboutScreenShown) hideAboutScreen(); | 946 | if (ui.aboutScreenShown) hideAboutScreen(); |
| @@ -918,17 +952,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 5 unmodified lines | |||
| 918 | 952 | ||
| 919 | return true; | 953 | return true; |
| 920 | } | 954 | } |
| 921 | break; | 955 | } |
| 956 | break; | ||
| 922 | 957 | ||
| 923 | case SDLK_n: | 958 | case SDLK_n: |
| 959 | { | ||
| 924 | if (keyb.leftCtrlPressed) | 960 | if (keyb.leftCtrlPressed) |
| 925 | { | 961 | { |
| 926 | showNibblesScreen(); | 962 | showNibblesScreen(); |
| 927 | return true; | 963 | return true; |
| 928 | } | 964 | } |
| 929 | break; | 965 | } |
| 966 | break; | ||
| 930 | 967 | ||
| 931 | case SDLK_p: | 968 | case SDLK_p: |
| 969 | { | ||
| 932 | if (keyb.leftCtrlPressed) | 970 | if (keyb.leftCtrlPressed) |
| 933 | { | 971 | { |
| 934 | if (!ui.patternEditorShown) | 972 | if (!ui.patternEditorShown) |
| @@ -942,17 +980,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 7 unmodified lines | |||
| 942 | 980 | ||
| 943 | return true; | 981 | return true; |
| 944 | } | 982 | } |
| 945 | break; | 983 | } |
| 984 | break; | ||
| 946 | 985 | ||
| 947 | case SDLK_q: | 986 | case SDLK_q: |
| 987 | { | ||
| 948 | if (keyb.leftAltPressed) | 988 | if (keyb.leftAltPressed) |
| 949 | { | 989 | { |
| 950 | jumpToChannel(0); | 990 | jumpToChannel(0); |
| 951 | return true; | 991 | return true; |
| 952 | } | 992 | } |
| 953 | break; | 993 | } |
| 994 | break; | ||
| 954 | 995 | ||
| 955 | case SDLK_r: | 996 | case SDLK_r: |
| 997 | { | ||
| 956 | if (keyb.leftAltPressed) | 998 | if (keyb.leftAltPressed) |
| 957 | { | 999 | { |
| 958 | if (ui.sampleEditorShown) | 1000 | if (ui.sampleEditorShown) |
| @@ -967,9 +1009,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 8 unmodified lines | |||
| 967 | showTrimScreen(); | 1009 | showTrimScreen(); |
| 968 | return true; | 1010 | return true; |
| 969 | } | 1011 | } |
| 970 | break; | 1012 | } |
| 1013 | break; | ||
| 971 | 1014 | ||
| 972 | case SDLK_s: | 1015 | case SDLK_s: |
| 1016 | { | ||
| 973 | if (keyb.leftAltPressed) | 1017 | if (keyb.leftAltPressed) |
| 974 | { | 1018 | { |
| 975 | if (ui.sampleEditorShown) | 1019 | if (ui.sampleEditorShown) |
| @@ -984,9 +1028,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 8 unmodified lines | |||
| 984 | showSampleEditor(); | 1028 | showSampleEditor(); |
| 985 | return true; | 1029 | return true; |
| 986 | } | 1030 | } |
| 987 | break; | 1031 | } |
| 1032 | break; | ||
| 988 | 1033 | ||
| 989 | case SDLK_t: | 1034 | case SDLK_t: |
| 1035 | { | ||
| 990 | if (keyb.leftAltPressed) | 1036 | if (keyb.leftAltPressed) |
| 991 | { | 1037 | { |
| 992 | jumpToChannel(4); | 1038 | jumpToChannel(4); |
| @@ -997,17 +1043,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 4 unmodified lines | |||
| 997 | showTranspose(); | 1043 | showTranspose(); |
| 998 | return true; | 1044 | return true; |
| 999 | } | 1045 | } |
| 1000 | break; | 1046 | } |
| 1047 | break; | ||
| 1001 | 1048 | ||
| 1002 | case SDLK_u: | 1049 | case SDLK_u: |
| 1050 | { | ||
| 1003 | if (keyb.leftAltPressed) | 1051 | if (keyb.leftAltPressed) |
| 1004 | { | 1052 | { |
| 1005 | jumpToChannel(6); | 1053 | jumpToChannel(6); |
| 1006 | return true; | 1054 | return true; |
| 1007 | } | 1055 | } |
| 1008 | break; | 1056 | } |
| 1057 | break; | ||
| 1009 | 1058 | ||
| 1010 | case SDLK_v: | 1059 | case SDLK_v: |
| 1060 | { | ||
| 1011 | if (keyb.leftAltPressed) | 1061 | if (keyb.leftAltPressed) |
| 1012 | { | 1062 | { |
| 1013 | if (ui.sampleEditorShown) | 1063 | if (ui.sampleEditorShown) |
| @@ -1036,17 +1086,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 22 unmodified lines | |||
| 1036 | 1086 | ||
| 1037 | return true; | 1087 | return true; |
| 1038 | } | 1088 | } |
| 1039 | break; | 1089 | } |
| 1090 | break; | ||
| 1040 | 1091 | ||
| 1041 | case SDLK_w: | 1092 | case SDLK_w: |
| 1093 | { | ||
| 1042 | if (keyb.leftAltPressed) | 1094 | if (keyb.leftAltPressed) |
| 1043 | { | 1095 | { |
| 1044 | jumpToChannel(1); | 1096 | jumpToChannel(1); |
| 1045 | return true; | 1097 | return true; |
| 1046 | } | 1098 | } |
| 1047 | break; | 1099 | } |
| 1100 | break; | ||
| 1048 | 1101 | ||
| 1049 | case SDLK_x: | 1102 | case SDLK_x: |
| 1103 | { | ||
| 1050 | if (keyb.leftAltPressed) | 1104 | if (keyb.leftAltPressed) |
| 1051 | { | 1105 | { |
| 1052 | if (ui.sampleEditorShown) | 1106 | if (ui.sampleEditorShown) |
| @@ -1080,17 +1134,21 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 27 unmodified lines | |||
| 1080 | 1134 | ||
| 1081 | return true; | 1135 | return true; |
| 1082 | } | 1136 | } |
| 1083 | break; | 1137 | } |
| 1138 | break; | ||
| 1084 | 1139 | ||
| 1085 | case SDLK_y: | 1140 | case SDLK_y: |
| 1141 | { | ||
| 1086 | if (keyb.leftAltPressed) | 1142 | if (keyb.leftAltPressed) |
| 1087 | { | 1143 | { |
| 1088 | jumpToChannel(5); | 1144 | jumpToChannel(5); |
| 1089 | return true; | 1145 | return true; |
| 1090 | } | 1146 | } |
| 1091 | break; | 1147 | } |
| 1148 | break; | ||
| 1092 | 1149 | ||
| 1093 | case SDLK_z: | 1150 | case SDLK_z: |
| 1151 | { | ||
| 1094 | if (keyb.leftAltPressed) | 1152 | if (keyb.leftAltPressed) |
| 1095 | { | 1153 | { |
| 1096 | if (ui.sampleEditorShown) | 1154 | if (ui.sampleEditorShown) |
| @@ -1103,9 +1161,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 6 unmodified lines | |||
| 1103 | togglePatternEditorExtended(); | 1161 | togglePatternEditorExtended(); |
| 1104 | return true; | 1162 | return true; |
| 1105 | } | 1163 | } |
| 1106 | break; | 1164 | } |
| 1165 | break; | ||
| 1107 | 1166 | ||
| 1108 | case SDLK_1: | 1167 | case SDLK_1: |
| 1168 | { | ||
| 1109 | if (keyb.leftAltPressed) | 1169 | if (keyb.leftAltPressed) |
| 1110 | { | 1170 | { |
| 1111 | if (keyb.leftShiftPressed) | 1171 | if (keyb.leftShiftPressed) |
| @@ -1123,9 +1183,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 11 unmodified lines | |||
| 1123 | 1183 | ||
| 1124 | return true; | 1184 | return true; |
| 1125 | } | 1185 | } |
| 1126 | break; | 1186 | } |
| 1187 | break; | ||
| 1127 | 1188 | ||
| 1128 | case SDLK_2: | 1189 | case SDLK_2: |
| 1190 | { | ||
| 1129 | if (keyb.leftAltPressed) | 1191 | if (keyb.leftAltPressed) |
| 1130 | { | 1192 | { |
| 1131 | if (keyb.leftShiftPressed) | 1193 | if (keyb.leftShiftPressed) |
| @@ -1143,9 +1205,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 11 unmodified lines | |||
| 1143 | 1205 | ||
| 1144 | return true; | 1206 | return true; |
| 1145 | } | 1207 | } |
| 1146 | break; | 1208 | } |
| 1209 | break; | ||
| 1147 | 1210 | ||
| 1148 | case SDLK_3: | 1211 | case SDLK_3: |
| 1212 | { | ||
| 1149 | if (keyb.leftAltPressed) | 1213 | if (keyb.leftAltPressed) |
| 1150 | { | 1214 | { |
| 1151 | if (keyb.leftShiftPressed) | 1215 | if (keyb.leftShiftPressed) |
| @@ -1163,9 +1227,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 11 unmodified lines | |||
| 1163 | 1227 | ||
| 1164 | return true; | 1228 | return true; |
| 1165 | } | 1229 | } |
| 1166 | break; | 1230 | } |
| 1231 | break; | ||
| 1167 | 1232 | ||
| 1168 | case SDLK_4: | 1233 | case SDLK_4: |
| 1234 | { | ||
| 1169 | if (keyb.leftAltPressed) | 1235 | if (keyb.leftAltPressed) |
| 1170 | { | 1236 | { |
| 1171 | if (keyb.leftShiftPressed) | 1237 | if (keyb.leftShiftPressed) |
| @@ -1185,9 +1251,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 13 unmodified lines | |||
| 1185 | return true; | 1251 | return true; |
| 1186 | } | 1252 | } |
| 1187 | #endif | 1253 | #endif |
| 1188 | break; | 1254 | } |
| 1255 | break; | ||
| 1189 | 1256 | ||
| 1190 | case SDLK_5: | 1257 | case SDLK_5: |
| 1258 | { | ||
| 1191 | if (keyb.leftAltPressed) | 1259 | if (keyb.leftAltPressed) |
| 1192 | { | 1260 | { |
| 1193 | if (keyb.leftShiftPressed) | 1261 | if (keyb.leftShiftPressed) |
| @@ -1197,9 +1265,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1197 | 1265 | ||
| 1198 | return true; | 1266 | return true; |
| 1199 | } | 1267 | } |
| 1200 | break; | 1268 | } |
| 1269 | break; | ||
| 1201 | 1270 | ||
| 1202 | case SDLK_6: | 1271 | case SDLK_6: |
| 1272 | { | ||
| 1203 | if (keyb.leftAltPressed) | 1273 | if (keyb.leftAltPressed) |
| 1204 | { | 1274 | { |
| 1205 | if (keyb.leftShiftPressed) | 1275 | if (keyb.leftShiftPressed) |
| @@ -1209,9 +1279,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1209 | 1279 | ||
| 1210 | return true; | 1280 | return true; |
| 1211 | } | 1281 | } |
| 1212 | break; | 1282 | } |
| 1283 | break; | ||
| 1213 | 1284 | ||
| 1214 | case SDLK_7: | 1285 | case SDLK_7: |
| 1286 | { | ||
| 1215 | if (keyb.leftAltPressed) | 1287 | if (keyb.leftAltPressed) |
| 1216 | { | 1288 | { |
| 1217 | if (keyb.leftShiftPressed) | 1289 | if (keyb.leftShiftPressed) |
| @@ -1221,9 +1293,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1221 | 1293 | ||
| 1222 | return true; | 1294 | return true; |
| 1223 | } | 1295 | } |
| 1224 | break; | 1296 | } |
| 1297 | break; | ||
| 1225 | 1298 | ||
| 1226 | case SDLK_8: | 1299 | case SDLK_8: |
| 1300 | { | ||
| 1227 | if (keyb.leftAltPressed) | 1301 | if (keyb.leftAltPressed) |
| 1228 | { | 1302 | { |
| 1229 | if (keyb.leftShiftPressed) | 1303 | if (keyb.leftShiftPressed) |
| @@ -1233,9 +1307,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1233 | 1307 | ||
| 1234 | return true; | 1308 | return true; |
| 1235 | } | 1309 | } |
| 1236 | break; | 1310 | } |
| 1311 | break; | ||
| 1237 | 1312 | ||
| 1238 | case SDLK_9: | 1313 | case SDLK_9: |
| 1314 | { | ||
| 1239 | if (keyb.leftAltPressed) | 1315 | if (keyb.leftAltPressed) |
| 1240 | { | 1316 | { |
| 1241 | if (keyb.leftShiftPressed) | 1317 | if (keyb.leftShiftPressed) |
| @@ -1245,9 +1321,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1245 | 1321 | ||
| 1246 | return true; | 1322 | return true; |
| 1247 | } | 1323 | } |
| 1248 | break; | 1324 | } |
| 1325 | break; | ||
| 1249 | 1326 | ||
| 1250 | case SDLK_0: | 1327 | case SDLK_0: |
| 1328 | { | ||
| 1251 | if (keyb.leftAltPressed) | 1329 | if (keyb.leftAltPressed) |
| 1252 | { | 1330 | { |
| 1253 | if (keyb.leftShiftPressed) | 1331 | if (keyb.leftShiftPressed) |
| @@ -1257,9 +1335,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 3 unmodified lines | |||
| 1257 | 1335 | ||
| 1258 | return true; | 1336 | return true; |
| 1259 | } | 1337 | } |
| 1260 | break; | 1338 | } |
| 1339 | break; | ||
| 1261 | 1340 | ||
| 1262 | case SDLK_LEFT: | 1341 | case SDLK_LEFT: |
| 1342 | { | ||
| 1263 | if (keyb.leftShiftPressed) | 1343 | if (keyb.leftShiftPressed) |
| 1264 | { | 1344 | { |
| 1265 | decSongPos(); | 1345 | decSongPos(); |
| @@ -1275,9 +1355,11 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 9 unmodified lines | |||
| 1275 | keybPattMarkLeft(); | 1355 | keybPattMarkLeft(); |
| 1276 | return true; | 1356 | return true; |
| 1277 | } | 1357 | } |
| 1278 | break; | 1358 | } |
| 1359 | break; | ||
| 1279 | 1360 | ||
| 1280 | case SDLK_RIGHT: | 1361 | case SDLK_RIGHT: |
| 1362 | { | ||
| 1281 | if (keyb.leftShiftPressed) | 1363 | if (keyb.leftShiftPressed) |
| 1282 | { | 1364 | { |
| 1283 | incSongPos(); | 1365 | incSongPos(); |
| @@ -1293,7 +1375,8 @@ static bool checkModifiedKeys(SDL_Keycode keycode) · 9 unmodified lines | |||
| 1293 | keybPattMarkRight(); | 1375 | keybPattMarkRight(); |
| 1294 | return true; | 1376 | return true; |
| 1295 | } | 1377 | } |
| 1296 | break; | 1378 | } |
| 1379 | break; | ||
| 1297 | } | 1380 | } |
| 1298 | 1381 | ||
| 1299 | return false; | 1382 | return false; |
| @@ -147,9 +147,7 @@ int main(int argc, char *argv[]) · 146 unmodified lines | |||
| 147 | #ifdef __APPLE__ | 147 | #ifdef __APPLE__ |
| 148 | osxSetDirToProgramDirFromArgs(argv); | 148 | osxSetDirToProgramDirFromArgs(argv); |
| 149 | #endif | 149 | #endif |
| 150 | UNICHAR_GETCWD(editor.binaryPathU, PATH_MAX); | 150 | if (!setupExecutablePath() || !loadBMPs()) |
| 151 | |||
| 152 | if (!loadBMPs()) | ||
| 153 | { | 151 | { |
| 154 | cleanUpAndExit(); | 152 | cleanUpAndExit(); |
| 155 | return 1; | 153 | return 1; |
| @@ -351,22 +349,28 @@ static void cleanUpAndExit(void) // never call this inside the main loop! · 195 unmodified lines | |||
| 351 | } | 349 | } |
| 352 | #endif | 350 | #endif |
| 353 | 351 | ||
| 354 | if (editor.audioDevConfigFileLocation != NULL) | 352 | if (editor.audioDevConfigFileLocationU != NULL) |
| 353 | { | ||
| 354 | free(editor.audioDevConfigFileLocationU); | ||
| 355 | editor.audioDevConfigFileLocationU = NULL; | ||
| 356 | } | ||
| 357 | |||
| 358 | if (editor.configFileLocationU != NULL) | ||
| 355 | { | 359 | { |
| 356 | free(editor.audioDevConfigFileLocation); | 360 | free(editor.configFileLocationU); |
| 357 | editor.audioDevConfigFileLocation = NULL; | 361 | editor.configFileLocationU = NULL; |
| 358 | } | 362 | } |
| 359 | 363 | ||
| 360 | if (editor.configFileLocation != NULL) | 364 | if (editor.midiConfigFileLocationU != NULL) |
| 361 | { | 365 | { |
| 362 | free(editor.configFileLocation); | 366 | free(editor.midiConfigFileLocationU); |
| 363 | editor.configFileLocation = NULL; | 367 | editor.midiConfigFileLocationU = NULL; |
| 364 | } | 368 | } |
| 365 | 369 | ||
| 366 | if (editor.midiConfigFileLocation != NULL) | 370 | if (editor.binaryPathU != NULL) |
| 367 | { | 371 | { |
| 368 | free(editor.midiConfigFileLocation); | 372 | free(editor.binaryPathU); |
| 369 | editor.midiConfigFileLocation = NULL; | 373 | editor.binaryPathU = NULL; |
| 370 | } | 374 | } |
| 371 | 375 | ||
| 372 | #ifdef _WIN32 | 376 | #ifdef _WIN32 |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | |||
| 18 | #include "ft2_structs.h" | 18 | #include "ft2_structs.h" |
| 19 | #include "rtmidi/rtmidi_c.h" | 19 | #include "rtmidi/rtmidi_c.h" |
| 20 | 20 | ||
| 21 | #define MAX_DEV_STR_LEN 256 | ||
| 22 | |||
| 21 | // hide POSIX warnings | 23 | // hide POSIX warnings |
| 22 | #ifdef _MSC_VER | 24 | #ifdef _MSC_VER |
| 23 | #pragma warning(disable: 4996) | 25 | #pragma warning(disable: 4996) |
| @@ -265,7 +267,7 @@ bool saveMidiInputDeviceToConfig(void) · 241 unmodified lines | |||
| 265 | if (midiInStr == NULL) | 267 | if (midiInStr == NULL) |
| 266 | return false; | 268 | return false; |
| 267 | 269 | ||
| 268 | FILE *f = UNICHAR_FOPEN(editor.midiConfigFileLocation, "w"); | 270 | FILE *f = UNICHAR_FOPEN(editor.midiConfigFileLocationU, "w"); |
| 269 | if (f == NULL) | 271 | if (f == NULL) |
| 270 | { | 272 | { |
| 271 | free(midiInStr); | 273 | free(midiInStr); |
| @@ -281,8 +283,6 @@ bool saveMidiInputDeviceToConfig(void) · 9 unmodified lines | |||
| 281 | 283 | ||
| 282 | bool setMidiInputDeviceFromConfig(void) | 284 | bool setMidiInputDeviceFromConfig(void) |
| 283 | { | 285 | { |
| 284 | #define MAX_DEV_STR_LEN 1024 | ||
| 285 | |||
| 286 | uint32_t i; | 286 | uint32_t i; |
| 287 | 287 | ||
| 288 | if (midi.inputDeviceName != NULL) | 288 | if (midi.inputDeviceName != NULL) |
| @@ -292,17 +292,19 @@ bool setMidiInputDeviceFromConfig(void) · 3 unmodified lines | |||
| 292 | if (numDevices == 0) | 292 | if (numDevices == 0) |
| 293 | goto setDefMidiInputDev; | 293 | goto setDefMidiInputDev; |
| 294 | 294 | ||
| 295 | FILE *f = UNICHAR_FOPEN(editor.midiConfigFileLocation, "r"); | 295 | FILE *f = UNICHAR_FOPEN(editor.midiConfigFileLocationU, "r"); |
| 296 | if (f == NULL) | 296 | if (f == NULL) |
| 297 | goto setDefMidiInputDev; | 297 | goto setDefMidiInputDev; |
| 298 | 298 | ||
| 299 | char *devString = (char *)calloc(MAX_DEV_STR_LEN+4, sizeof (char)); | 299 | char *devString = (char *)malloc((MAX_DEV_STR_LEN+4) * sizeof (char)); |
| 300 | if (devString == NULL) | 300 | if (devString == NULL) |
| 301 | { | 301 | { |
| 302 | fclose(f); | 302 | fclose(f); |
| 303 | goto setDefMidiInputDev; | 303 | goto setDefMidiInputDev; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | devString[0] = '\0'; | ||
| 307 | |||
| 306 | if (fgets(devString, MAX_DEV_STR_LEN, f) == NULL) | 308 | if (fgets(devString, MAX_DEV_STR_LEN, f) == NULL) |
| 307 | { | 309 | { |
| 308 | fclose(f); | 310 | fclose(f); |
| @@ -526,9 +526,7 @@ static void setupLoadedModule(void) · 525 unmodified lines | |||
| 526 | 526 | ||
| 527 | bool handleModuleLoadFromArg(int argc, char **argv) | 527 | bool handleModuleLoadFromArg(int argc, char **argv) |
| 528 | { | 528 | { |
| 529 | UNICHAR tmpPathU[PATH_MAX+2]; | 529 | // we always expect only one parameter, and that it is the module |
| 530 | |||
| 531 | // this is crude, we always expect only one parameter, and that it is the module. | ||
| 532 | 530 | ||
| 533 | if (argc != 2 || argv[1] == NULL || argv[1][0] == '\0') | 531 | if (argc != 2 || argv[1] == NULL || argv[1][0] == '\0') |
| 534 | return false; | 532 | return false; |
| @@ -540,15 +538,26 @@ bool handleModuleLoadFromArg(int argc, char **argv) · 5 unmodified lines | |||
| 540 | 538 | ||
| 541 | const uint32_t filenameLen = (const uint32_t)strlen(argv[1]); | 539 | const uint32_t filenameLen = (const uint32_t)strlen(argv[1]); |
| 542 | 540 | ||
| 543 | UNICHAR *filenameU = (UNICHAR *)calloc(filenameLen+1, sizeof (UNICHAR)); | 541 | UNICHAR *tmpPathU = (UNICHAR *)malloc((PATH_MAX + 1) * sizeof (UNICHAR)); |
| 542 | if (tmpPathU == NULL) | ||
| 543 | { | ||
| 544 | okBox(0, "System message", "Not enough memory!"); | ||
| 545 | return false; | ||
| 546 | } | ||
| 547 | |||
| 548 | UNICHAR *filenameU = (UNICHAR *)malloc((filenameLen + 1) * sizeof (UNICHAR)); | ||
| 544 | if (filenameU == NULL) | 549 | if (filenameU == NULL) |
| 545 | { | 550 | { |
| 551 | free(tmpPathU); | ||
| 546 | okBox(0, "System message", "Not enough memory!"); | 552 | okBox(0, "System message", "Not enough memory!"); |
| 547 | return false; | 553 | return false; |
| 548 | } | 554 | } |
| 549 | 555 | ||
| 556 | tmpPathU[0] = 0; | ||
| 557 | filenameU[0] = 0; | ||
| 558 | |||
| 550 | #ifdef _WIN32 | 559 | #ifdef _WIN32 |
| 551 | MultiByteToWideChar(CP_UTF8, 0, argv[1], -1, filenameU, filenameLen); | 560 | MultiByteToWideChar(CP_UTF8, 0, argv[1], -1, filenameU, filenameLen+1); |
| 552 | #else | 561 | #else |
| 553 | strcpy(filenameU, argv[1]); | 562 | strcpy(filenameU, argv[1]); |
| 554 | #endif | 563 | #endif |
| @@ -562,9 +571,11 @@ bool handleModuleLoadFromArg(int argc, char **argv) · 7 unmodified lines | |||
| 562 | const int32_t filesize = getFileSize(filenameU); | 571 | const int32_t filesize = getFileSize(filenameU); |
| 563 | if (filesize == -1 || filesize >= 512L*1024*1024) // 1) >=2GB 2) >=512MB | 572 | if (filesize == -1 || filesize >= 512L*1024*1024) // 1) >=2GB 2) >=512MB |
| 564 | { | 573 | { |
| 565 | okBox(0, "System message", "Error: The module is too big to be loaded!"); | ||
| 566 | free(filenameU); | 574 | free(filenameU); |
| 567 | UNICHAR_CHDIR(tmpPathU); // set old path back | 575 | UNICHAR_CHDIR(tmpPathU); // set old path back |
| 576 | free(tmpPathU); | ||
| 577 | |||
| 578 | okBox(0, "System message", "Error: The module is too big to be loaded!"); | ||
| 568 | return false; | 579 | return false; |
| 569 | } | 580 | } |
| 570 | 581 | ||
| @@ -572,6 +583,8 @@ bool handleModuleLoadFromArg(int argc, char **argv) · 1 unmodified line | |||
| 572 | 583 | ||
| 573 | free(filenameU); | 584 | free(filenameU); |
| 574 | UNICHAR_CHDIR(tmpPathU); // set old path back | 585 | UNICHAR_CHDIR(tmpPathU); // set old path back |
| 586 | free(tmpPathU); | ||
| 587 | |||
| 575 | return result; | 588 | return result; |
| 576 | } | 589 | } |
| 577 | 590 | ||
| @@ -642,15 +655,17 @@ void loadDroppedFile(char *fullPathUTF8, bool songModifiedCheck) · 64 unmodified lines | |||
| 642 | if (fullPathLen == 0) | 655 | if (fullPathLen == 0) |
| 643 | return; | 656 | return; |
| 644 | 657 | ||
| 645 | UNICHAR *fullPathU = (UNICHAR *)calloc(fullPathLen + 2, sizeof (UNICHAR)); | 658 | UNICHAR *fullPathU = (UNICHAR *)malloc((fullPathLen + 1) * sizeof (UNICHAR)); |
| 646 | if (fullPathU == NULL) | 659 | if (fullPathU == NULL) |
| 647 | { | 660 | { |
| 648 | okBox(0, "System message", "Not enough memory!"); | 661 | okBox(0, "System message", "Not enough memory!"); |
| 649 | return; | 662 | return; |
| 650 | } | 663 | } |
| 651 | 664 | ||
| 665 | fullPathU[0] = 0; | ||
| 666 | |||
| 652 | #ifdef _WIN32 | 667 | #ifdef _WIN32 |
| 653 | MultiByteToWideChar(CP_UTF8, 0, fullPathUTF8, -1, fullPathU, fullPathLen); | 668 | MultiByteToWideChar(CP_UTF8, 0, fullPathUTF8, -1, fullPathU, fullPathLen+1); |
| 654 | #else | 669 | #else |
| 655 | strcpy(fullPathU, fullPathUTF8); | 670 | strcpy(fullPathU, fullPathUTF8); |
| 656 | #endif | 671 | #endif |
| @@ -301,7 +301,7 @@ static void changeCursorIfOverTextBoxes(void) · 300 unmodified lines | |||
| 301 | textBox_t *t = textBoxes; | 301 | textBox_t *t = textBoxes; |
| 302 | for (i = 0; i < NUM_TEXTBOXES; i++, t++) | 302 | for (i = 0; i < NUM_TEXTBOXES; i++, t++) |
| 303 | { | 303 | { |
| 304 | if (ui.sysReqShown && i > 0) | 304 | if (ui.sysReqShown && i != 0) // Sys. Req can only have one (special) text box |
| 305 | continue; | 305 | continue; |
| 306 | 306 | ||
| 307 | if (!t->visible) | 307 | if (!t->visible) |
| @@ -313,7 +313,10 @@ static void changeCursorIfOverTextBoxes(void) · 5 unmodified lines | |||
| 313 | if (my >= t->y && my < t->y+t->h && mx >= t->x && mx < t->x+t->w) | 313 | if (my >= t->y && my < t->y+t->h && mx >= t->x && mx < t->x+t->w) |
| 314 | { | 314 | { |
| 315 | mouse.mouseOverTextBox = true; | 315 | mouse.mouseOverTextBox = true; |
| 316 | setTextEditMouse(); | 316 | |
| 317 | if (mouseShape != MOUSE_IDLE_TEXT_EDIT) | ||
| 318 | setTextEditMouse(); | ||
| 319 | |||
| 317 | return; | 320 | return; |
| 318 | } | 321 | } |
| 319 | } | 322 | } |
| @@ -11,9 +11,8 @@ typedef struct cpu_t · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | typedef struct editor_t | 12 | typedef struct editor_t |
| 13 | { | 13 | { |
| 14 | UNICHAR binaryPathU[PATH_MAX + 2]; | 14 | UNICHAR *binaryPathU, *tmpFilenameU, *tmpInstrFilenameU; // used by saving/loading threads |
| 15 | UNICHAR *tmpFilenameU, *tmpInstrFilenameU; // used by saving/loading threads | 15 | UNICHAR *configFileLocationU, *audioDevConfigFileLocationU, *midiConfigFileLocationU; |
| 16 | UNICHAR *configFileLocation, *audioDevConfigFileLocation, *midiConfigFileLocation; | ||
| 17 | 16 | ||
| 18 | volatile bool mainLoopOngoing; | 17 | volatile bool mainLoopOngoing; |
| 19 | volatile bool busy, scopeThreadMutex, programRunning, wavIsRendering, wavReachedEndFlag; | 18 | volatile bool busy, scopeThreadMutex, programRunning, wavIsRendering, wavReachedEndFlag; |
| @@ -299,8 +299,11 @@ int16_t okBox(int16_t typ, const char *headline, const char *text) · 298 unmodified lines | |||
| 299 | { | 299 | { |
| 300 | if (inputEvent.key.keysym.sym == SDLK_ESCAPE) | 300 | if (inputEvent.key.keysym.sym == SDLK_ESCAPE) |
| 301 | { | 301 | { |
| 302 | returnVal = 0; | 302 | if (!inputEvent.key.repeat) // don't let previously held-down ESC immediately close the box |
| 303 | ui.sysReqShown = false; | 303 | { |
| 304 | returnVal = 0; | ||
| 305 | ui.sysReqShown = false; | ||
| 306 | } | ||
| 304 | } | 307 | } |
| 305 | else if (inputEvent.key.keysym.sym == SDLK_RETURN) | 308 | else if (inputEvent.key.keysym.sym == SDLK_RETURN) |
| 306 | { | 309 | { |
| @@ -52,7 +52,7 @@ textBox_t textBoxes[NUM_TEXTBOXES] = · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | // ------ DISK OP. TEXTBOXES ------ | 53 | // ------ DISK OP. TEXTBOXES ------ |
| 54 | // x, y, w, h, tx,ty, maxc, rmb, cmc | 54 | // x, y, w, h, tx,ty, maxc, rmb, cmc |
| 55 | { 31, 158, 134, 12, 2, 1, PATH_MAX-1, false, true }, | 55 | { 31, 158, 134, 12, 2, 1, PATH_MAX, false, true }, |
| 56 | 56 | ||
| 57 | // ------ CONFIG TEXTBOXES ------ | 57 | // ------ CONFIG TEXTBOXES ------ |
| 58 | // x, y, w, h, tx,ty, maxc, rmb, cmc | 58 | // x, y, w, h, tx,ty, maxc, rmb, cmc |
| @@ -57,15 +57,14 @@ char *cp437ToUtf8(char *src) · 56 unmodified lines | |||
| 57 | return NULL; | 57 | return NULL; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | char *x = (char *)malloc((reqSize + 2) * sizeof (char)); | 60 | char *x = (char *)malloc((reqSize + 1) * sizeof (char)); |
| 61 | if (x == NULL) | 61 | if (x == NULL) |
| 62 | { | 62 | { |
| 63 | free(w); | 63 | free(w); |
| 64 | return NULL; | 64 | return NULL; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | x[reqSize+0] = '\0'; | 67 | x[reqSize] = '\0'; |
| 68 | x[reqSize+1] = '\0'; | ||
| 69 | 68 | ||
| 70 | retVal = WideCharToMultiByte(CP_UTF8, 0, w, srcLen, x, reqSize, 0, 0); | 69 | retVal = WideCharToMultiByte(CP_UTF8, 0, w, srcLen, x, reqSize, 0, 0); |
| 71 | free(w); | 70 | free(w); |
| @@ -148,7 +147,7 @@ char *utf8ToCp437(char *src, bool removeIllegalChars) · 76 unmodified lines | |||
| 148 | return NULL; | 147 | return NULL; |
| 149 | } | 148 | } |
| 150 | 149 | ||
| 151 | char *x = (char *)calloc(reqSize + 1, sizeof (char)); | 150 | char *x = (char *)malloc((reqSize + 1) * sizeof (char)); |
| 152 | if (x == NULL) | 151 | if (x == NULL) |
| 153 | { | 152 | { |
| 154 | free(w); | 153 | free(w); |
| @@ -216,7 +215,7 @@ char *unicharToCp437(UNICHAR *src, bool removeIllegalChars) · 61 unmodified lines | |||
| 216 | { | 215 | { |
| 217 | const int8_t ch = (const int8_t)x[i]; | 216 | const int8_t ch = (const int8_t)x[i]; |
| 218 | if (ch < 32 && ch != 0 && ch != -124 && ch != -108 && | 217 | if (ch < 32 && ch != 0 && ch != -124 && ch != -108 && |
| 219 | ch != -122 && ch != -114 && ch != -103 && ch != -113) | 218 | ch != -122 && ch != -114 && ch != -103 && ch != -113) |
| 220 | { | 219 | { |
| 221 | x[i] = ' '; // character not allowed, turn it into space | 220 | x[i] = ' '; // character not allowed, turn it into space |
| 222 | } | 221 | } |
| @@ -244,7 +243,7 @@ char *cp437ToUtf8(char *src) · 21 unmodified lines | |||
| 244 | 243 | ||
| 245 | size_t outLen = srcLen * 2; // should be sufficient | 244 | size_t outLen = srcLen * 2; // should be sufficient |
| 246 | 245 | ||
| 247 | char *outBuf = (char *)calloc(outLen + 2, sizeof (char)); | 246 | char *outBuf = (char *)malloc((outLen + 1) * sizeof (char)); |
| 248 | if (outBuf == NULL) | 247 | if (outBuf == NULL) |
| 249 | return NULL; | 248 | return NULL; |
| 250 | 249 | ||
| @@ -266,6 +265,8 @@ char *cp437ToUtf8(char *src) · 15 unmodified lines | |||
| 266 | return NULL; | 265 | return NULL; |
| 267 | } | 266 | } |
| 268 | 267 | ||
| 268 | outBuf[outLen] = '\0'; | ||
| 269 | |||
| 269 | return outBuf; | 270 | return outBuf; |
| 270 | } | 271 | } |
| 271 | 272 | ||
| @@ -290,7 +291,7 @@ char *utf8ToCp437(char *src, bool removeIllegalChars) · 18 unmodified lines | |||
| 290 | 291 | ||
| 291 | size_t outLen = srcLen * 2; // should be sufficient | 292 | size_t outLen = srcLen * 2; // should be sufficient |
| 292 | 293 | ||
| 293 | char *outBuf = (char *)calloc(outLen + 1, sizeof (char)); | 294 | char *outBuf = (char *)malloc((outLen + 1) * sizeof (char)); |
| 294 | if (outBuf == NULL) | 295 | if (outBuf == NULL) |
| 295 | return NULL; | 296 | return NULL; |
| 296 | 297 | ||
| @@ -312,6 +313,8 @@ char *utf8ToCp437(char *src, bool removeIllegalChars) · 15 unmodified lines | |||
| 312 | return NULL; | 313 | return NULL; |
| 313 | } | 314 | } |
| 314 | 315 | ||
| 316 | outBuf[outLen] = '\0'; | ||
| 317 | |||
| 315 | if (removeIllegalChars) | 318 | if (removeIllegalChars) |
| 316 | { | 319 | { |
| 317 | // remove illegal characters (only allow certain nordic ones) | 320 | // remove illegal characters (only allow certain nordic ones) |
| @@ -319,7 +322,7 @@ char *utf8ToCp437(char *src, bool removeIllegalChars) · 1 unmodified line | |||
| 319 | { | 322 | { |
| 320 | const int8_t ch = (const int8_t)outBuf[i]; | 323 | const int8_t ch = (const int8_t)outBuf[i]; |
| 321 | if (ch < 32 && ch != 0 && ch != -124 && ch != -108 && | 324 | if (ch < 32 && ch != 0 && ch != -124 && ch != -108 && |
| 322 | ch != -122 && ch != -114 && ch != -103 && ch != -113) | 325 | ch != -122 && ch != -114 && ch != -103 && ch != -113) |
| 323 | { | 326 | { |
| 324 | outBuf[i] = ' '; // character not allowed, turn it into space | 327 | outBuf[i] = ' '; // character not allowed, turn it into space |
| 325 | } | 328 | } |
| @@ -46,7 +46,7 @@ static const uint8_t textCursorData[12] = · 45 unmodified lines | |||
| 46 | video_t video; // globalized | 46 | video_t video; // globalized |
| 47 | 47 | ||
| 48 | static bool songIsModified; | 48 | static bool songIsModified; |
| 49 | static char wndTitle[128 + PATH_MAX]; | 49 | static char wndTitle[256]; |
| 50 | static uint64_t timeNext64, timeNext64Frac; | 50 | static uint64_t timeNext64, timeNext64Frac; |
| 51 | static sprite_t sprites[SPRITE_NUM]; | 51 | static sprite_t sprites[SPRITE_NUM]; |
| 52 | 52 | ||
| @@ -845,10 +845,14 @@ void updateWindowTitle(bool forceUpdate) · 792 unmodified lines | |||
| 845 | char *songTitle = getCurrSongFilename(); | 845 | char *songTitle = getCurrSongFilename(); |
| 846 | if (songTitle != NULL) | 846 | if (songTitle != NULL) |
| 847 | { | 847 | { |
| 848 | char songTitleTrunc[128]; | ||
| 849 | strncpy(songTitleTrunc, songTitle, sizeof (songTitleTrunc)-1); | ||
| 850 | songTitleTrunc[sizeof (songTitleTrunc)-1] = '\0'; | ||
| 851 | |||
| 848 | if (song.isModified) | 852 | if (song.isModified) |
| 849 | sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\" (unsaved)", PROG_VER_STR, songTitle); | 853 | sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\" (unsaved)", PROG_VER_STR, songTitleTrunc); |
| 850 | else | 854 | else |
| 851 | sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\"", PROG_VER_STR, songTitle); | 855 | sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\"", PROG_VER_STR, songTitleTrunc); |
| 852 | } | 856 | } |
| 853 | else | 857 | else |
| 854 | { | 858 | { |
| @@ -923,10 +923,6 @@ END · 922 unmodified lines | |||
| 923 | and you need to press a key or click the mouse to abort the render when you want | 923 | and you need to press a key or click the mouse to abort the render when you want |
| 924 | it to. | 924 | it to. |
| 925 | >@X010 | 925 | >@X010 |
| 926 | >@C001Mouse / keyboard: | ||
| 927 | > | ||
| 928 | >@C002- Linux: The mouse cursor graphics can be glitchy at times... | ||
| 929 | >@X010 | ||
| 930 | >@C001Video: | 926 | >@C001Video: |
| 931 | >@C002 | 927 | >@C002 |
| 932 | >@X010- Fullscreen mode can be unbearably slow on a Raspberry Pi (even on RPi 4) | 928 | >@X010- Fullscreen mode can be unbearably slow on a Raspberry Pi (even on RPi 4) |
| @@ -3,9 +3,9 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #include <stdint.h> | 4 | #include <stdint.h> |
| 5 | 5 | ||
| 6 | #define HELP_DATA_LEN 27486 | 6 | #define HELP_DATA_LEN 27385 |
| 7 | 7 | ||
| 8 | const uint8_t helpData[27486] = | 8 | const uint8_t helpData[27385] = |
| 9 | { | 9 | { |
| 10 | 0x4C,0x3B,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A, | 10 | 0x4C,0x3B,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A, |
| 11 | 0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A, | 11 | 0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A, |
| @@ -2258,46 +2258,38 @@ const uint8_t helpData[27486] = · 2246 unmodified lines | |||
| 2258 | 0x74,0x6F,0x20,0x61,0x62,0x6F,0x72,0x74,0x20,0x74,0x68,0x65, | 2258 | 0x74,0x6F,0x20,0x61,0x62,0x6F,0x72,0x74,0x20,0x74,0x68,0x65, |
| 2259 | 0x20,0x72,0x65,0x6E,0x64,0x65,0x72,0x20,0x77,0x68,0x65,0x6E, | 2259 | 0x20,0x72,0x65,0x6E,0x64,0x65,0x72,0x20,0x77,0x68,0x65,0x6E, |
| 2260 | 0x20,0x79,0x6F,0x75,0x20,0x77,0x61,0x6E,0x74,0x06,0x69,0x74, | 2260 | 0x20,0x79,0x6F,0x75,0x20,0x77,0x61,0x6E,0x74,0x06,0x69,0x74, |
| 2261 | 0x20,0x74,0x6F,0x2E,0x06,0x3E,0x40,0x58,0x30,0x31,0x30,0x17, | 2261 | 0x20,0x74,0x6F,0x2E,0x06,0x3E,0x40,0x58,0x30,0x31,0x30,0x0C, |
| 2262 | 0x3E,0x40,0x43,0x30,0x30,0x31,0x4D,0x6F,0x75,0x73,0x65,0x20, | 2262 | 0x3E,0x40,0x43,0x30,0x30,0x31,0x56,0x69,0x64,0x65,0x6F,0x3A, |
| 2263 | 0x2F,0x20,0x6B,0x65,0x79,0x62,0x6F,0x61,0x72,0x64,0x3A,0x01, | 2263 | 0x06,0x3E,0x40,0x43,0x30,0x30,0x32,0x50,0x3E,0x40,0x58,0x30, |
| 2264 | 0x3E,0x43,0x3E,0x40,0x43,0x30,0x30,0x32,0x2D,0x20,0x4C,0x69, | 2264 | 0x31,0x30,0x2D,0x20,0x46,0x75,0x6C,0x6C,0x73,0x63,0x72,0x65, |
| 2265 | 0x6E,0x75,0x78,0x3A,0x20,0x54,0x68,0x65,0x20,0x6D,0x6F,0x75, | 2265 | 0x65,0x6E,0x20,0x6D,0x6F,0x64,0x65,0x20,0x63,0x61,0x6E,0x20, |
| 2266 | 0x73,0x65,0x20,0x63,0x75,0x72,0x73,0x6F,0x72,0x20,0x67,0x72, | 2266 | 0x62,0x65,0x20,0x75,0x6E,0x62,0x65,0x61,0x72,0x61,0x62,0x6C, |
| 2267 | 0x61,0x70,0x68,0x69,0x63,0x73,0x20,0x63,0x61,0x6E,0x20,0x62, | 2267 | 0x79,0x20,0x73,0x6C,0x6F,0x77,0x20,0x6F,0x6E,0x20,0x61,0x20, |
| 2268 | 0x65,0x20,0x67,0x6C,0x69,0x74,0x63,0x68,0x79,0x20,0x61,0x74, | 2268 | 0x52,0x61,0x73,0x70,0x62,0x65,0x72,0x72,0x79,0x20,0x50,0x69, |
| 2269 | 0x20,0x74,0x69,0x6D,0x65,0x73,0x2E,0x2E,0x2E,0x06,0x3E,0x40, | 2269 | 0x20,0x28,0x65,0x76,0x65,0x6E,0x20,0x6F,0x6E,0x20,0x52,0x50, |
| 2270 | 0x58,0x30,0x31,0x30,0x0C,0x3E,0x40,0x43,0x30,0x30,0x31,0x56, | 2270 | 0x69,0x20,0x34,0x29,0x01,0x3E,0x52,0x3E,0x40,0x58,0x30,0x31, |
| 2271 | 0x69,0x64,0x65,0x6F,0x3A,0x06,0x3E,0x40,0x43,0x30,0x30,0x32, | 2271 | 0x30,0x2D,0x20,0x4E,0x6F,0x74,0x20,0x61,0x20,0x62,0x75,0x67, |
| 2272 | 0x50,0x3E,0x40,0x58,0x30,0x31,0x30,0x2D,0x20,0x46,0x75,0x6C, | 2272 | 0x2C,0x20,0x62,0x75,0x74,0x20,0x69,0x66,0x20,0x79,0x6F,0x75, |
| 2273 | 0x6C,0x73,0x63,0x72,0x65,0x65,0x6E,0x20,0x6D,0x6F,0x64,0x65, | 2273 | 0x72,0x20,0x6D,0x6F,0x6E,0x69,0x74,0x6F,0x72,0x27,0x73,0x20, |
| 2274 | 0x20,0x63,0x61,0x6E,0x20,0x62,0x65,0x20,0x75,0x6E,0x62,0x65, | 2274 | 0x72,0x65,0x66,0x72,0x65,0x73,0x68,0x20,0x72,0x61,0x74,0x65, |
| 2275 | 0x61,0x72,0x61,0x62,0x6C,0x79,0x20,0x73,0x6C,0x6F,0x77,0x20, | 2275 | 0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x73,0x65,0x74,0x20, |
| 2276 | 0x6F,0x6E,0x20,0x61,0x20,0x52,0x61,0x73,0x70,0x62,0x65,0x72, | 2276 | 0x74,0x6F,0x20,0x36,0x30,0x48,0x7A,0x20,0x28,0x6F,0x72,0x20, |
| 2277 | 0x72,0x79,0x20,0x50,0x69,0x20,0x28,0x65,0x76,0x65,0x6E,0x20, | 2277 | 0x35,0x39,0x48,0x7A,0x29,0x4F,0x3E,0x40,0x58,0x30,0x32,0x31, |
| 2278 | 0x6F,0x6E,0x20,0x52,0x50,0x69,0x20,0x34,0x29,0x01,0x3E,0x52, | 2278 | 0x79,0x6F,0x75,0x20,0x6D,0x61,0x79,0x20,0x65,0x78,0x70,0x65, |
| 2279 | 0x3E,0x40,0x58,0x30,0x31,0x30,0x2D,0x20,0x4E,0x6F,0x74,0x20, | 2279 | 0x72,0x69,0x65,0x6E,0x63,0x65,0x20,0x76,0x69,0x73,0x75,0x61, |
| 2280 | 0x61,0x20,0x62,0x75,0x67,0x2C,0x20,0x62,0x75,0x74,0x20,0x69, | 2280 | 0x6C,0x20,0x73,0x74,0x75,0x74,0x74,0x65,0x72,0x69,0x6E,0x67, |
| 2281 | 0x66,0x20,0x79,0x6F,0x75,0x72,0x20,0x6D,0x6F,0x6E,0x69,0x74, | 2281 | 0x20,0x62,0x65,0x63,0x61,0x75,0x73,0x65,0x20,0x56,0x53,0x79, |
| 2282 | 0x6F,0x72,0x27,0x73,0x20,0x72,0x65,0x66,0x72,0x65,0x73,0x68, | 2282 | 0x6E,0x63,0x20,0x77,0x69,0x6C,0x6C,0x20,0x6E,0x6F,0x74,0x20, |
| 2283 | 0x20,0x72,0x61,0x74,0x65,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74, | 2283 | 0x62,0x65,0x20,0x75,0x73,0x65,0x64,0x20,0x74,0x68,0x65,0x6E, |
| 2284 | 0x20,0x73,0x65,0x74,0x20,0x74,0x6F,0x20,0x36,0x30,0x48,0x7A, | 2284 | 0x2E,0x51,0x49,0x20,0x68,0x69,0x67,0x68,0x6C,0x79,0x20,0x72, |
| 2285 | 0x20,0x28,0x6F,0x72,0x20,0x35,0x39,0x48,0x7A,0x29,0x4F,0x3E, | 2285 | 0x65,0x63,0x6F,0x6D,0x6D,0x65,0x6E,0x64,0x20,0x72,0x75,0x6E, |
| 2286 | 0x40,0x58,0x30,0x32,0x31,0x79,0x6F,0x75,0x20,0x6D,0x61,0x79, | 2286 | 0x6E,0x69,0x6E,0x67,0x20,0x79,0x6F,0x75,0x72,0x20,0x6D,0x6F, |
| 2287 | 0x20,0x65,0x78,0x70,0x65,0x72,0x69,0x65,0x6E,0x63,0x65,0x20, | 2287 | 0x6E,0x69,0x74,0x6F,0x72,0x20,0x61,0x74,0x20,0x36,0x30,0x48, |
| 2288 | 0x76,0x69,0x73,0x75,0x61,0x6C,0x20,0x73,0x74,0x75,0x74,0x74, | 2288 | 0x7A,0x20,0x69,0x66,0x20,0x79,0x6F,0x75,0x27,0x72,0x65,0x20, |
| 2289 | 0x65,0x72,0x69,0x6E,0x67,0x20,0x62,0x65,0x63,0x61,0x75,0x73, | 2289 | 0x61,0x20,0x68,0x61,0x72,0x64,0x63,0x6F,0x72,0x65,0x20,0x75, |
| 2290 | 0x65,0x20,0x56,0x53,0x79,0x6E,0x63,0x20,0x77,0x69,0x6C,0x6C, | 2290 | 0x73,0x65,0x72,0x20,0x6F,0x66,0x20,0x74,0x68,0x69,0x73,0x08, |
| 2291 | 0x20,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x75,0x73,0x65,0x64, | 2291 | 0x70,0x72,0x6F,0x67,0x72,0x61,0x6D,0x2E,0x00,0x03,0x45,0x4E, |
| 2292 | 0x20,0x74,0x68,0x65,0x6E,0x2E,0x51,0x49,0x20,0x68,0x69,0x67, | 2292 | 0x44 |
| 2293 | 0x68,0x6C,0x79,0x20,0x72,0x65,0x63,0x6F,0x6D,0x6D,0x65,0x6E, | ||
| 2294 | 0x64,0x20,0x72,0x75,0x6E,0x6E,0x69,0x6E,0x67,0x20,0x79,0x6F, | ||
| 2295 | 0x75,0x72,0x20,0x6D,0x6F,0x6E,0x69,0x74,0x6F,0x72,0x20,0x61, | ||
| 2296 | 0x74,0x20,0x36,0x30,0x48,0x7A,0x20,0x69,0x66,0x20,0x79,0x6F, | ||
| 2297 | 0x75,0x27,0x72,0x65,0x20,0x61,0x20,0x68,0x61,0x72,0x64,0x63, | ||
| 2298 | 0x6F,0x72,0x65,0x20,0x75,0x73,0x65,0x72,0x20,0x6F,0x66,0x20, | ||
| 2299 | 0x74,0x68,0x69,0x73,0x08,0x70,0x72,0x6F,0x67,0x72,0x61,0x6D, | ||
| 2300 | 0x2E,0x00,0x03,0x45,0x4E,0x44 | ||
| 2301 | }; | 2293 | }; |
| 2302 | 2294 | ||
| 2303 | #endif | 2295 | #endif |