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
622622 s = &instrTmp[1+a]->samp[0];
623623
624624 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;
635625
636626 if (modFormat != FORMAT_HMNT) // most of "His Master's Noisetracker" songs have junk sample names, so let's not load them
637627 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
655645 s->repL = 2;
656646
657647 // in The Ultimate SoundTracker, sample loop start is in bytes, not words
658− if (mightBeSTK)
648+ if (modFormat == FORMAT_STK)
659649 s->repS >>= 1;
660650
661651 // 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)
663653 {
664654 if ((s->repS>>1)+s->repL <= s->len)
665655 s->repS >>= 1;
@@ -692,6 +682,16 @@ static bool loadMusicMOD(FILE *f, uint32_t fileLength, bool fromExternalThread) · 26 unmodified lines
692682 s->repS = 0;
693683 }
694684
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+
695695 int32_t bytesRead = (int32_t)fread(s->pek, 1, s->len, f);
696696 if (bytesRead < s->len)
697697 {
@@ -737,7 +737,7 @@ static uint8_t stmTempoToBPM(uint8_t tempo) // ported from original ST2.3 replay · 39 unmodified lines
737737 static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread)
738738 {
739739 uint8_t typ, tempo;
740− int16_t i, j, k, ai, ap, tmp;
740+ int16_t i, j, k, ap, tmp;
741741 uint16_t a;
742742 tonTyp *ton;
743743 sampleTyp *s;
@@ -899,7 +899,6 @@ static bool loadMusicSTM(FILE *f, uint32_t fileLength, bool fromExternalThread) · 155 unmodified lines
899899 }
900900 }
901901
902− ai = 31;
903902 for (i = 0; i < 31; i++)
904903 {
905904 // trim off spaces at end of name
@@ -1010,7 +1009,6 @@ static int8_t countS3MChannels(uint16_t antPtn) · 104 unmodified lines
10101009 static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread)
10111010 {
10121011 int8_t *tmpSmp;
1013− bool illegalUxx;
10141012 uint8_t ha[2048];
10151013 uint8_t alastnfo[32], alastefx[32], alastvibnfo[32], s3mLastGInstr[32];
10161014 uint8_t typ;
@@ -1129,8 +1127,6 @@ static bool loadMusicS3M(FILE *f, uint32_t dataLength, bool fromExternalThread) · 112 unmodified lines
11291127
11301128 // *** PATTERNS ***
11311129
1132− illegalUxx = false;
1133−
11341130 k = 0;
11351131 for (i = 0; i < ap; i++)
11361132 {
@@ -2012,7 +2008,7 @@ static bool loadInstrHeader(FILE *f, uint16_t i) · 875 unmodified lines
20122008 ins->vibDepth = ih.vibDepth;
20132009 ins->vibRate = ih.vibRate;
20142010 ins->fadeOut = ih.fadeOut;
2015− ins->midiOn = (ih.midiOn > 0) ? true : false;
2011+ ins->midiOn = (ih.midiOn == 1) ? true : false;
20162012 ins->midiChannel = ih.midiChannel;
20172013 ins->midiProgram = ih.midiProgram;
20182014 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