History

Pushed v1.16 code

- 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.

Olav Sørensen committed 6 years ago

Commit 2247f4c1 parent 108c33316 files · +458 −256Browse files

Showing the changes to src/ft2_module_loader.c (1 of 16 files). Show all

Unified · Split

src/ft2_module_loader.c+14−18
@@ -622,16 +622,6 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 621 unmodified lines
622 s = &instrTmp[1+a]->samp[0];622 s = &instrTmp[1+a]->samp[0];
623 623
624 s->len = 2 * SWAP16(h_MOD31.instr[a].len);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 if (modFormat != FORMAT_HMNT) // most of "His Master's Noisetracker" songs have junk sample names, so let's not load them626 if (modFormat != FORMAT_HMNT) // most of "His Master's Noisetracker" songs have junk sample names, so let's not load them
637 memcpy(s->name, songTmp.instrName[1+a], 22);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 s->repL = 2;645 s->repL = 2;
656 646
657 // in The Ultimate SoundTracker, sample loop start is in bytes, not words647 // in The Ultimate SoundTracker, sample loop start is in bytes, not words
658 if (mightBeSTK)648 if (modFormat == FORMAT_STK)
659 s->repS >>= 1;649 s->repS >>= 1;
660 650
661 // fix for poorly converted STK (< v2.5) -> PT/NT modules (FIXME: Worth keeping or not?)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 if ((s->repS>>1)+s->repL <= s->len)654 if ((s->repS>>1)+s->repL <= s->len)
665 s->repS >>= 1;655 s->repS >>= 1;
@@ -692,6 +682,16 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 26 unmodified lines
692 s->repS = 0;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 int32_t bytesRead = (int32_t)fread(s->pek, 1, s->len, f);695 int32_t bytesRead = (int32_t)fread(s->pek, 1, s->len, f);
696 if (bytesRead < s->len)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
737static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread)737static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread)
738{738{
739 uint8_t typ, tempo;739 uint8_t typ, tempo;
740 int16_t i, j, k, ai, ap, tmp;740 int16_t i, j, k, ap, tmp;
741 uint16_t a;741 uint16_t a;
742 tonTyp *ton;742 tonTyp *ton;
743 sampleTyp *s;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 for (i = 0; i < 31; i++)902 for (i = 0; i < 31; i++)
904 {903 {
905 // trim off spaces at end of name904 // trim off spaces at end of name
@@ -1010,7 +1009,6 @@ static int8_t countS3MChannels(uint16_t antPtn) · 104 unmodified lines
1010static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread)1009static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread)
1011{1010{
1012 int8_t *tmpSmp;1011 int8_t *tmpSmp;
1013 bool illegalUxx;
1014 uint8_t ha[2048];1012 uint8_t ha[2048];
1015 uint8_t alastnfo[32], alastefx[32], alastvibnfo[32], s3mLastGInstr[32];1013 uint8_t alastnfo[32], alastefx[32], alastvibnfo[32], s3mLastGInstr[32];
1016 uint8_t typ;1014 uint8_t typ;
@@ -1129,8 +1127,6 @@ static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread) · 112 unmodified lines
1129 1127
1130 // *** PATTERNS ***1128 // *** PATTERNS ***
1131 1129
1132 illegalUxx = false;
1133
1134 k = 0;1130 k = 0;
1135 for (i = 0; i < ap; i++)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 ins->vibDepth = ih.vibDepth;2008 ins->vibDepth = ih.vibDepth;
2013 ins->vibRate = ih.vibRate;2009 ins->vibRate = ih.vibRate;
2014 ins->fadeOut = ih.fadeOut;2010 ins->fadeOut = ih.fadeOut;
2015 ins->midiOn = (ih.midiOn > 0) ? true : false;2011 ins->midiOn = (ih.midiOn == 1) ? true : false;
2016 ins->midiChannel = ih.midiChannel;2012 ins->midiChannel = ih.midiChannel;
2017 ins->midiProgram = ih.midiProgram;2013 ins->midiProgram = ih.midiProgram;
2018 ins->midiBend = ih.midiBend;2014 ins->midiBend = ih.midiBend;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t