- The mouse system has been rewritten so that we don't need to do mouse capturing while interacting with GUI widgets, which could be buggy sometimes. - The different Disk Op. item paths (mod./instr./smp./pat./trk.) now behave exactly like real FT2. I.e. if they haven't been initialized before, they will be set to the current working directory. - Scrollbar thumbs are now limited to minimum 9 pixels in length/height, to prevent them from being difficult to click on.
Showing the changes to src/ft2_module_loader.c (1 of 16 files). Show all
Unified · Split
| @@ -622,16 +622,6 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 621 unmodified lines | ||
| 622 | 622 | s = &instrTmp[1+a]->samp[0]; |
| 623 | 623 | |
| 624 | 624 | s->len = 2 * SWAP16(h_MOD31.instr[a].len); |
| 625 | − | |
| 626 | − s->pek = NULL; | |
| 627 | − s->origPek = (int8_t *)malloc(s->len + LOOP_FIX_LEN); | |
| 628 | − if (s->origPek == NULL) | |
| 629 | − { | |
| 630 | − showMsg(0, "System message", "Not enough memory!"); | |
| 631 | − goto modLoadError; | |
| 632 | − } | |
| 633 | − | |
| 634 | − s->pek = s->origPek + SMP_DAT_OFFSET; | |
| 635 | 625 | |
| 636 | 626 | if (modFormat != FORMAT_HMNT) // most of "His Master's Noisetracker" songs have junk sample names, so let's not load them |
| 637 | 627 | memcpy(s->name, songTmp.instrName[1+a], 22); |
| @@ -655,11 +645,11 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 17 unmodified lines | ||
| 655 | 645 | s->repL = 2; |
| 656 | 646 | |
| 657 | 647 | // in The Ultimate SoundTracker, sample loop start is in bytes, not words |
| 658 | − if (mightBeSTK) | |
| 648 | + if (modFormat == FORMAT_STK) | |
| 659 | 649 | s->repS >>= 1; |
| 660 | 650 | |
| 661 | 651 | // fix for poorly converted STK (< v2.5) -> PT/NT modules (FIXME: Worth keeping or not?) |
| 662 | − if (!mightBeSTK && s->repL > 2 && s->repS+s->repL > s->len) | |
| 652 | + if (modFormat != FORMAT_STK && s->repL > 2 && s->repS+s->repL > s->len) | |
| 663 | 653 | { |
| 664 | 654 | if ((s->repS>>1)+s->repL <= s->len) |
| 665 | 655 | s->repS >>= 1; |
| @@ -692,6 +682,16 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 26 unmodified lines | ||
| 692 | 682 | s->repS = 0; |
| 693 | 683 | } |
| 694 | 684 | |
| 685 | + s->pek = NULL; | |
| 686 | + s->origPek = (int8_t *)malloc(s->len + LOOP_FIX_LEN); | |
| 687 | + if (s->origPek == NULL) | |
| 688 | + { | |
| 689 | + showMsg(0, "System message", "Not enough memory!"); | |
| 690 | + goto modLoadError; | |
| 691 | + } | |
| 692 | + | |
| 693 | + s->pek = s->origPek + SMP_DAT_OFFSET; | |
| 694 | + | |
| 695 | 695 | int32_t bytesRead = (int32_t)fread(s->pek, 1, s->len, f); |
| 696 | 696 | if (bytesRead < s->len) |
| 697 | 697 | { |
| @@ -737,7 +737,7 @@ static uint8_t stmTempoToBPM(uint8_t tempo) // ported from original ST2.3 replay · 39 unmodified lines | ||
| 737 | 737 | static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread) |
| 738 | 738 | { |
| 739 | 739 | uint8_t typ, tempo; |
| 740 | − int16_t i, j, k, ai, ap, tmp; | |
| 740 | + int16_t i, j, k, ap, tmp; | |
| 741 | 741 | uint16_t a; |
| 742 | 742 | tonTyp *ton; |
| 743 | 743 | sampleTyp *s; |
| @@ -899,7 +899,6 @@ static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread) · 155 unmodified lines | ||
| 899 | 899 | } |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | − ai = 31; | |
| 903 | 902 | for (i = 0; i < 31; i++) |
| 904 | 903 | { |
| 905 | 904 | // trim off spaces at end of name |
| @@ -1010,7 +1009,6 @@ static int8_t countS3MChannels(uint16_t antPtn) · 104 unmodified lines | ||
| 1010 | 1009 | static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread) |
| 1011 | 1010 | { |
| 1012 | 1011 | int8_t *tmpSmp; |
| 1013 | − bool illegalUxx; | |
| 1014 | 1012 | uint8_t ha[2048]; |
| 1015 | 1013 | uint8_t alastnfo[32], alastefx[32], alastvibnfo[32], s3mLastGInstr[32]; |
| 1016 | 1014 | uint8_t typ; |
| @@ -1129,8 +1127,6 @@ static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread) · 112 unmodified lines | ||
| 1129 | 1127 | |
| 1130 | 1128 | // *** PATTERNS *** |
| 1131 | 1129 | |
| 1132 | − illegalUxx = false; | |
| 1133 | − | |
| 1134 | 1130 | k = 0; |
| 1135 | 1131 | for (i = 0; i < ap; i++) |
| 1136 | 1132 | { |
| @@ -2012,7 +2008,7 @@ static bool loadInstrHeader(FILE *f, uint16_t i) · 875 unmodified lines | ||
| 2012 | 2008 | ins->vibDepth = ih.vibDepth; |
| 2013 | 2009 | ins->vibRate = ih.vibRate; |
| 2014 | 2010 | ins->fadeOut = ih.fadeOut; |
| 2015 | − ins->midiOn = (ih.midiOn > 0) ? true : false; | |
| 2011 | + ins->midiOn = (ih.midiOn == 1) ? true : false; | |
| 2016 | 2012 | ins->midiChannel = ih.midiChannel; |
| 2017 | 2013 | ins->midiProgram = ih.midiProgram; |
| 2018 | 2014 | ins->midiBend = ih.midiBend; |