diff options
| author | Kermalis <29823718+Kermalis@users.noreply.github.com> | 2018-09-25 12:51:52 -0400 | 
|---|---|---|
| committer | Kermalis <29823718+Kermalis@users.noreply.github.com> | 2018-09-25 12:51:52 -0400 | 
| commit | 4b5609b739042a6f0892c13c42402220fadbe892 (patch) | |
| tree | 60c30f71afeb0b950a0a86ce0aadf6a6f9eaf2d2 | |
| parent | 2bb647245a22d6073d769b5f73629df7ccd39cc8 (diff) | |
| parent | d86b290419169579ecbca29aafcc46bb5a53f34f (diff) | |
Merge branch 'master' of https://github.com/pret/pokeemerald
| -rw-r--r-- | tools/mid2agb/midi.cpp | 23 | 
1 files changed, 15 insertions, 8 deletions
| diff --git a/tools/mid2agb/midi.cpp b/tools/mid2agb/midi.cpp index 8a84a0945..b49970282 100644 --- a/tools/mid2agb/midi.cpp +++ b/tools/mid2agb/midi.cpp @@ -773,7 +773,6 @@ void CalculateWaits(std::vector<Event>& events)      }  } -// This code is (purposely) buggy as shit, to mimic how the real mid2agb worked  int CalculateCompressionScore(std::vector<Event>& events, int index)  {      int score = 0; @@ -781,8 +780,13 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)      std::uint8_t lastVelocity = 0x80u;      EventType lastType = events[index].type;      std::int32_t lastDuration = 0x80000000; -    std::uint8_t lastNote = 0x80u; -    //std::int32_t lastParam2; +    std::uint8_t lastNote = 0x40u; + +    if (events[index].type == EventType::Note) +    { +        // Bug reintroduction +        lastParam1 |= events[index].note + 0x40; +    }      if (events[index].time > 0)          score++; @@ -793,11 +797,10 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)          {              int val = 0; -            // BUG: uses type instead of note -            if ((std::uint8_t)events[i].type != lastNote) +            if (events[i].note != lastNote)              {                  val++; -                lastNote = (std::uint8_t)events[i].type; +                lastNote = events[i].note;              }              if (events[i].param1 != lastVelocity) @@ -845,8 +848,12 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)          // BUG: uses type instead of param1          lastParam1 = (std::uint8_t)events[i].type; -        // unused -        //lastParam2 = events[i].param2; +        if (events[i].type == EventType::Note) +        { +            // Bug reintroduction +            lastParam1 |= events[i].note + 0x40; +        } +          lastType = events[i].type;          if (events[i].time) | 
