diff --git a/src/main/kotlin/rhmodding/tickompiler/gameextractor/GameExtractor.kt b/src/main/kotlin/rhmodding/tickompiler/gameextractor/GameExtractor.kt index d96271d..7db701f 100644 --- a/src/main/kotlin/rhmodding/tickompiler/gameextractor/GameExtractor.kt +++ b/src/main/kotlin/rhmodding/tickompiler/gameextractor/GameExtractor.kt @@ -73,7 +73,8 @@ class GameExtractor(val allSubs: Boolean) { val beats = buffer.getFloat(addr - 0x100000) val seconds = buffer.getInt(addr - 0x100000 + 4) / 32000.0 // will not work with unsigned but not important val bpm = 60 * beats / seconds - s += "${correctlyRoundDouble(bpm, DECIMALS)} ${correctlyRoundDouble(beats.toDouble(), DECIMALS)}\n" + val loop = buffer.getInt(addr - 0x100000 + 8) + s += "${correctlyRoundDouble(bpm, DECIMALS)} ${correctlyRoundDouble(beats.toDouble(), DECIMALS)} ${loop}\n" if (buffer.getIntAdj(addr + 8) != 0) break addr += 12 diff --git a/src/main/kotlin/rhmodding/tickompiler/gameputter/GamePutter.kt b/src/main/kotlin/rhmodding/tickompiler/gameputter/GamePutter.kt index 45a896d..14fccf8 100644 --- a/src/main/kotlin/rhmodding/tickompiler/gameputter/GamePutter.kt +++ b/src/main/kotlin/rhmodding/tickompiler/gameputter/GamePutter.kt @@ -62,15 +62,20 @@ object GamePutter { tempo.drop(1).forEachIndexed { index, list -> val bpm = list[0].toFloat() val beats = list[1].toFloat() + val loop = if (list.size > 2){ // Check for loop value + list[2].toInt() + } else { // Special case for tempo files lacking loop value, behaves exactly as older Tickompiler versions + if (index == tempo.size - 2) { + 0x8000 + } else { + 0 + } + } val time = 60*beats/bpm val timeInt = (time * 32000).roundToInt() result.add(java.lang.Float.floatToIntBits(beats)) result.add(timeInt) - if (index == tempo.size - 2) { - result.add(0x8000) - } else { - result.add(0) - } + result.add(loop) } for (i in 0 until 0x1DD) { val one = base.getInt(16*i + 0x1588)