From 6196d7604edbe18918e6e4016c73516d7c7bef96 Mon Sep 17 00:00:00 2001 From: GregHib Date: Mon, 22 Jan 2024 22:31:01 +0000 Subject: [PATCH] Fix underscore name warnings --- .../voidps/cache/compress/BZIP2Compressor.kt | 424 +++++++++--------- .../cache/config/decoder/OverlayDecoder.kt | 36 +- .../decoder/InterfaceDecoderFull.kt | 74 ++- .../gregs/voidps/cache/secure/Whirlpool.kt | 206 ++++----- 4 files changed, 368 insertions(+), 372 deletions(-) diff --git a/cache/src/main/kotlin/world/gregs/voidps/cache/compress/BZIP2Compressor.kt b/cache/src/main/kotlin/world/gregs/voidps/cache/compress/BZIP2Compressor.kt index 4cb464459..3e4d54188 100644 --- a/cache/src/main/kotlin/world/gregs/voidps/cache/compress/BZIP2Compressor.kt +++ b/cache/src/main/kotlin/world/gregs/voidps/cache/compress/BZIP2Compressor.kt @@ -72,10 +72,10 @@ internal class BZIP2Compressor { var intArray1 = IntArray(0) var intArray2 = IntArray(0) var intArray3 = IntArray(0) - var bool_28_ = true - while (bool_28_) { - var i_29_ = method152(8) - if (i_29_ == 23) { + var bool28 = true + while (bool28) { + var i29 = method152(8) + if (i29 == 23) { break } method152(8) @@ -89,25 +89,25 @@ internal class BZIP2Compressor { method152(8) method152(1) anInt3083 = 0 - var i_30_ = method152(8) - anInt3083 = anInt3083 shl 8 or (i_30_ and 0xff) - i_30_ = method152(8) - anInt3083 = anInt3083 shl 8 or (i_30_ and 0xff) - i_30_ = method152(8) - anInt3083 = anInt3083 shl 8 or (i_30_ and 0xff) - for (i_31_ in 0..15) { - i_29_ = method152(1) - aBooleanArray3072[i_31_] = i_29_ == 1 + var i30 = method152(8) + anInt3083 = anInt3083 shl 8 or (i30 and 0xff) + i30 = method152(8) + anInt3083 = anInt3083 shl 8 or (i30 and 0xff) + i30 = method152(8) + anInt3083 = anInt3083 shl 8 or (i30 and 0xff) + for (i31 in 0..15) { + i29 = method152(1) + aBooleanArray3072[i31] = i29 == 1 } - for (i_32_ in 0..255) { - aBooleanArray3103[i_32_] = false + for (i32 in 0..255) { + aBooleanArray3103[i32] = false } - for (i_33_ in 0..15) { - if (aBooleanArray3072[i_33_]) { - for (i_34_ in 0..15) { - i_29_ = method152(1) - if (i_29_ == 1) { - aBooleanArray3103[i_33_ * 16 + i_34_] = true + for (i33 in 0..15) { + if (aBooleanArray3072[i33]) { + for (i34 in 0..15) { + i29 = method152(1) + if (i29 == 1) { + aBooleanArray3103[i33 * 16 + i34] = true } } } @@ -119,227 +119,227 @@ internal class BZIP2Compressor { anInt3073++ } } - val i_35_ = anInt3073 + 2 - val i_36_ = method152(3) - val i_37_ = method152(15) - for (i_38_ in 0 until i_37_) { - var i_39_ = 0 + val i35 = anInt3073 + 2 + val i36 = method152(3) + val i37 = method152(15) + for (i38 in 0 until i37) { + var i39 = 0 while (true) { - i_29_ = method152(1) - if (i_29_ == 0) { + i29 = method152(1) + if (i29 == 0) { break } - i_39_++ + i39++ } - aByteArray3094[i_38_] = i_39_.toByte() + aByteArray3094[i38] = i39.toByte() } - val is_40_ = ByteArray(6) - for (i_41_ in 0 until i_36_) { - is_40_[i_41_] = i_41_.toByte() + val is40 = ByteArray(6) + for (i41 in 0 until i36) { + is40[i41] = i41.toByte() } - for (i_42_ in 0 until i_37_) { - var i_43_ = aByteArray3094[i_42_] - val i_44_ = is_40_[i_43_.toInt()] - while (i_43_ > 0) { - is_40_[i_43_.toInt()] = is_40_[i_43_ - 1] - i_43_-- + for (i42 in 0 until i37) { + var i43 = aByteArray3094[i42] + val i44 = is40[i43.toInt()] + while (i43 > 0) { + is40[i43.toInt()] = is40[i43 - 1] + i43-- } - is_40_[0] = i_44_ - aByteArray3076[i_42_] = i_44_ + is40[0] = i44 + aByteArray3076[i42] = i44 } - for (i_45_ in 0 until i_36_) { - var i_46_ = method152(5) - for (i_47_ in 0 until i_35_) { + for (i45 in 0 until i36) { + var i46 = method152(5) + for (i47 in 0 until i35) { while (true) { - i_29_ = method152(1) - if (i_29_ == 0) { + i29 = method152(1) + if (i29 == 0) { break } - i_29_ = method152(1) - if (i_29_ == 0) { - i_46_++ + i29 = method152(1) + if (i29 == 0) { + i46++ } else { - i_46_-- + i46-- } } - aByteArrayArray3098[i_45_][i_47_] = i_46_.toByte() + aByteArrayArray3098[i45][i47] = i46.toByte() } } - for (i_48_ in 0 until i_36_) { - var i_49_ = 32 - var i_50_: Byte = 0 - for (i_51_ in 0 until i_35_) { - if (aByteArrayArray3098[i_48_][i_51_] > i_50_) { - i_50_ = aByteArrayArray3098[i_48_][i_51_] + for (i48 in 0 until i36) { + var i49 = 32 + var i50: Byte = 0 + for (i51 in 0 until i35) { + if (aByteArrayArray3098[i48][i51] > i50) { + i50 = aByteArrayArray3098[i48][i51] } - if (aByteArrayArray3098[i_48_][i_51_] < i_49_) { - i_49_ = aByteArrayArray3098[i_48_][i_51_].toInt() + if (aByteArrayArray3098[i48][i51] < i49) { + i49 = aByteArrayArray3098[i48][i51].toInt() } } - method145(anIntArrayArray3095[i_48_], - anIntArrayArray3082[i_48_], - anIntArrayArray3099[i_48_], - aByteArrayArray3098[i_48_], - i_49_, - i_50_.toInt(), - i_35_) - anIntArray3090[i_48_] = i_49_ + method145(anIntArrayArray3095[i48], + anIntArrayArray3082[i48], + anIntArrayArray3099[i48], + aByteArrayArray3098[i48], + i49, + i50.toInt(), + i35) + anIntArray3090[i48] = i49 } - val i_52_ = anInt3073 + 1 - var i_53_ = -1 - var i_54_ = 0 - for (i_55_ in 0..255) { - anIntArray3075[i_55_] = 0 + val i52 = anInt3073 + 1 + var i53 = -1 + var i54 = 0 + for (i55 in 0..255) { + anIntArray3075[i55] = 0 } - var i_56_ = 4095 - for (i_57_ in 15 downTo 0) { - for (i_58_ in 15 downTo 0) { - aByteArray3101[i_56_] = (i_57_ * 16 + i_58_).toByte() - i_56_-- + var i56 = 4095 + for (i57 in 15 downTo 0) { + for (i58 in 15 downTo 0) { + aByteArray3101[i56] = (i57 * 16 + i58).toByte() + i56-- } - anIntArray3092[i_57_] = i_56_ + 1 + anIntArray3092[i57] = i56 + 1 } - var i_59_ = 0 - if (i_54_ == 0) { - i_53_++ - i_54_ = 50 - val i_60_ = aByteArray3076[i_53_] - i = anIntArray3090[i_60_.toInt()] - intArray1 = anIntArrayArray3095[i_60_.toInt()] - intArray3 = anIntArrayArray3099[i_60_.toInt()] - intArray2 = anIntArrayArray3082[i_60_.toInt()] + var i59 = 0 + if (i54 == 0) { + i53++ + i54 = 50 + val index = aByteArray3076[i53] + i = anIntArray3090[index.toInt()] + intArray1 = anIntArrayArray3095[index.toInt()] + intArray3 = anIntArrayArray3099[index.toInt()] + intArray2 = anIntArrayArray3082[index.toInt()] } - i_54_-- - var i_61_ = i - var i_62_: Int - var i_63_: Int - i_63_ = method152(i_61_) - while (i_63_ > intArray1[i_61_]) { - i_61_++ - i_62_ = method152(1) - i_63_ = i_63_ shl 1 or i_62_ + i54-- + var i61 = i + var i62: Int + var i63: Int + i63 = method152(i61) + while (i63 > intArray1[i61]) { + i61++ + i62 = method152(1) + i63 = i63 shl 1 or i62 } - var i_64_ = intArray3[i_63_ - intArray2[i_61_]] - while (i_64_ != i_52_) { - if (i_64_ == 0 || i_64_ == 1) { - var i_65_ = -1 - var i_66_ = 1 + var i64 = intArray3[i63 - intArray2[i61]] + while (i64 != i52) { + if (i64 == 0 || i64 == 1) { + var i65 = -1 + var i66 = 1 do { - if (i_64_ == 0) { - i_65_ += i_66_ - } else if (i_64_ == 1) { - i_65_ += 2 * i_66_ + i65 += if (i64 == 0) { + i66 + } else { + 2 * i66 } - i_66_ *= 2 - if (i_54_ == 0) { - i_53_++ - i_54_ = 50 - val i_67_ = aByteArray3076[i_53_] - i = anIntArray3090[i_67_.toInt()] - intArray1 = anIntArrayArray3095[i_67_.toInt()] - intArray3 = anIntArrayArray3099[i_67_.toInt()] - intArray2 = anIntArrayArray3082[i_67_.toInt()] + i66 *= 2 + if (i54 == 0) { + i53++ + i54 = 50 + val index = aByteArray3076[i53] + i = anIntArray3090[index.toInt()] + intArray1 = anIntArrayArray3095[index.toInt()] + intArray3 = anIntArrayArray3099[index.toInt()] + intArray2 = anIntArrayArray3082[index.toInt()] } - i_54_-- - i_61_ = i - i_63_ = method152(i_61_) - while (i_63_ > intArray1[i_61_]) { - i_61_++ - i_62_ = method152(1) - i_63_ = i_63_ shl 1 or i_62_ + i54-- + i61 = i + i63 = method152(i61) + while (i63 > intArray1[i61]) { + i61++ + i62 = method152(1) + i63 = i63 shl 1 or i62 } - i_64_ = intArray3[i_63_ - intArray2[i_61_]] - } while (i_64_ == 0 || i_64_ == 1) - i_65_++ - i_30_ = aByteArray3107[aByteArray3101[anIntArray3092[0]].toInt() and 0xff].toInt() - anIntArray3075[i_30_ and 0xff] += i_65_ - while ( /**/i_65_ > 0) { - anIntArray5786[i_59_] = i_30_ and 0xff - i_59_++ - i_65_-- + i64 = intArray3[i63 - intArray2[i61]] + } while (i64 == 0 || i64 == 1) + i65++ + i30 = aByteArray3107[aByteArray3101[anIntArray3092[0]].toInt() and 0xff].toInt() + anIntArray3075[i30 and 0xff] += i65 + while ( /**/i65 > 0) { + anIntArray5786[i59] = i30 and 0xff + i59++ + i65-- } } else { - var i_68_ = i_64_ - 1 - if (i_68_ < 16) { - val i_69_ = anIntArray3092[0] - i_29_ = aByteArray3101[i_69_ + i_68_].toInt() - while ( /**/i_68_ > 3) { - val i_70_ = i_69_ + i_68_ - aByteArray3101[i_70_] = aByteArray3101[i_70_ - 1] - aByteArray3101[i_70_ - 1] = aByteArray3101[i_70_ - 2] - aByteArray3101[i_70_ - 2] = aByteArray3101[i_70_ - 3] - aByteArray3101[i_70_ - 3] = aByteArray3101[i_70_ - 4] - i_68_ -= 4 + var i68 = i64 - 1 + if (i68 < 16) { + val i69 = anIntArray3092[0] + i29 = aByteArray3101[i69 + i68].toInt() + while ( /**/i68 > 3) { + val i70 = i69 + i68 + aByteArray3101[i70] = aByteArray3101[i70 - 1] + aByteArray3101[i70 - 1] = aByteArray3101[i70 - 2] + aByteArray3101[i70 - 2] = aByteArray3101[i70 - 3] + aByteArray3101[i70 - 3] = aByteArray3101[i70 - 4] + i68 -= 4 } - while ( /**/i_68_ > 0) { - aByteArray3101[i_69_ + i_68_] = aByteArray3101[i_69_ + i_68_ - 1] - i_68_-- + while ( /**/i68 > 0) { + aByteArray3101[i69 + i68] = aByteArray3101[i69 + i68 - 1] + i68-- } - aByteArray3101[i_69_] = i_29_.toByte() + aByteArray3101[i69] = i29.toByte() } else { - var i_71_ = i_68_ / 16 - val i_72_ = i_68_ % 16 - var i_73_ = anIntArray3092[i_71_] + i_72_ - i_29_ = aByteArray3101[i_73_].toInt() - while (i_73_ > anIntArray3092[i_71_]) { - aByteArray3101[i_73_] = aByteArray3101[i_73_ - 1] - i_73_-- + var i71 = i68 / 16 + val i72 = i68 % 16 + var i73 = anIntArray3092[i71] + i72 + i29 = aByteArray3101[i73].toInt() + while (i73 > anIntArray3092[i71]) { + aByteArray3101[i73] = aByteArray3101[i73 - 1] + i73-- } - anIntArray3092[i_71_]++ - while (i_71_ > 0) { - anIntArray3092[i_71_]-- - aByteArray3101[anIntArray3092[i_71_]] = aByteArray3101[anIntArray3092[i_71_ - 1] + 16 - 1] - i_71_-- + anIntArray3092[i71]++ + while (i71 > 0) { + anIntArray3092[i71]-- + aByteArray3101[anIntArray3092[i71]] = aByteArray3101[anIntArray3092[i71 - 1] + 16 - 1] + i71-- } anIntArray3092[0]-- - aByteArray3101[anIntArray3092[0]] = i_29_.toByte() + aByteArray3101[anIntArray3092[0]] = i29.toByte() if (anIntArray3092[0] == 0) { - var i_74_ = 4095 - for (i_75_ in 15 downTo 0) { - for (i_76_ in 15 downTo 0) { - aByteArray3101[i_74_] = aByteArray3101[anIntArray3092[i_75_] + i_76_] - i_74_-- + var i74 = 4095 + for (i75 in 15 downTo 0) { + for (i76 in 15 downTo 0) { + aByteArray3101[i74] = aByteArray3101[anIntArray3092[i75] + i76] + i74-- } - anIntArray3092[i_75_] = i_74_ + 1 + anIntArray3092[i75] = i74 + 1 } } } - anIntArray3075[aByteArray3107[i_29_ and 0xff].toInt() and 0xff]++ - anIntArray5786[i_59_] = aByteArray3107[i_29_ and 0xff].toInt() and 0xff - i_59_++ - if (i_54_ == 0) { - i_53_++ - i_54_ = 50 - val i_77_ = aByteArray3076[i_53_] - i = anIntArray3090[i_77_.toInt()] - intArray1 = anIntArrayArray3095[i_77_.toInt()] - intArray3 = anIntArrayArray3099[i_77_.toInt()] - intArray2 = anIntArrayArray3082[i_77_.toInt()] + anIntArray3075[aByteArray3107[i29 and 0xff].toInt() and 0xff]++ + anIntArray5786[i59] = aByteArray3107[i29 and 0xff].toInt() and 0xff + i59++ + if (i54 == 0) { + i53++ + i54 = 50 + val i77 = aByteArray3076[i53] + i = anIntArray3090[i77.toInt()] + intArray1 = anIntArrayArray3095[i77.toInt()] + intArray3 = anIntArrayArray3099[i77.toInt()] + intArray2 = anIntArrayArray3082[i77.toInt()] } - i_54_-- - i_61_ = i - i_63_ = method152(i_61_) - while (i_63_ > intArray1[i_61_]) { - i_61_++ - i_62_ = method152(1) - i_63_ = i_63_ shl 1 or i_62_ + i54-- + i61 = i + i63 = method152(i61) + while (i63 > intArray1[i61]) { + i61++ + i62 = method152(1) + i63 = i63 shl 1 or i62 } - i_64_ = intArray3[i_63_ - intArray2[i_61_]] + i64 = intArray3[i63 - intArray2[i61]] } } anInt3080 = 0 aByte3108 = 0.toByte() anIntArray3091[0] = 0 - for (i_78_ in 1..256) { - anIntArray3091[i_78_] = anIntArray3075[i_78_ - 1] + for (i78 in 1..256) { + anIntArray3091[i78] = anIntArray3075[i78 - 1] } - for (i_79_ in 1..256) { - anIntArray3091[i_79_] += anIntArray3091[i_79_ - 1] + for (i79 in 1..256) { + anIntArray3091[i79] += anIntArray3091[i79 - 1] } - for (i_80_ in 0 until i_59_) { - i_30_ = (anIntArray5786[i_80_] and 0xff).toByte().toInt() - anIntArray5786[anIntArray3091[i_30_ and 0xff]] = anIntArray5786[anIntArray3091[i_30_ and 0xff]] or (i_80_ shl 8) - anIntArray3091[i_30_ and 0xff]++ + for (i80 in 0 until i59) { + i30 = (anIntArray5786[i80] and 0xff).toByte().toInt() + anIntArray5786[anIntArray3091[i30 and 0xff]] = anIntArray5786[anIntArray3091[i30 and 0xff]] or (i80 shl 8) + anIntArray3091[i30 and 0xff]++ } anInt3106 = anIntArray5786[anInt3083] shr 8 anInt3071 = 0 @@ -347,9 +347,9 @@ internal class BZIP2Compressor { anInt3070 = (anInt3106 and 0xff).toByte().toInt() anInt3106 = anInt3106 shr 8 anInt3071++ - anInt3077 = i_59_ + anInt3077 = i59 method151() - bool_28_ = anInt3071 == anInt3077 + 1 && anInt3080 == 0 + bool28 = anInt3071 == anInt3077 + 1 && anInt3080 == 0 } } @@ -478,34 +478,34 @@ internal class BZIP2Compressor { private fun method145(arg0: IntArray, arg1: IntArray, arg2: IntArray, arg3: ByteArray, arg4: Int, arg5: Int, arg6: Int) { var i = 0 - for (i_0_ in arg4..arg5) { - for (i_1_ in 0 until arg6) { - if (arg3[i_1_].toInt() == i_0_) { - arg2[i] = i_1_ + for (i0 in arg4..arg5) { + for (i1 in 0 until arg6) { + if (arg3[i1].toInt() == i0) { + arg2[i] = i1 i++ } } } - for (i_2_ in 0..22) { - arg1[i_2_] = 0 + for (index in 0..22) { + arg1[index] = 0 } - for (i_3_ in 0 until arg6) { - arg1[arg3[i_3_] + 1]++ + for (index in 0 until arg6) { + arg1[arg3[index] + 1]++ } - for (i_4_ in 1..22) { - arg1[i_4_] += arg1[i_4_ - 1] + for (index in 1..22) { + arg1[index] += arg1[index - 1] } - for (i_5_ in 0..22) { - arg0[i_5_] = 0 + for (index in 0..22) { + arg0[index] = 0 } - var i_6_ = 0 - for (i_7_ in arg4..arg5) { - i_6_ += arg1[i_7_ + 1] - arg1[i_7_] - arg0[i_7_] = i_6_ - 1 - i_6_ = i_6_ shl 1 + var i6 = 0 + for (index in arg4..arg5) { + i6 += arg1[index + 1] - arg1[index] + arg0[index] = i6 - 1 + i6 = i6 shl 1 } - for (i_8_ in arg4 + 1..arg5) { - arg1[i_8_] = (arg0[i_8_ - 1] + 1 shl 1) - arg1[i_8_] + for (index in arg4 + 1..arg5) { + arg1[index] = (arg0[index - 1] + 1 shl 1) - arg1[index] } } } \ No newline at end of file diff --git a/cache/src/main/kotlin/world/gregs/voidps/cache/config/decoder/OverlayDecoder.kt b/cache/src/main/kotlin/world/gregs/voidps/cache/config/decoder/OverlayDecoder.kt index cc9f63f3a..846702547 100644 --- a/cache/src/main/kotlin/world/gregs/voidps/cache/config/decoder/OverlayDecoder.kt +++ b/cache/src/main/kotlin/world/gregs/voidps/cache/config/decoder/OverlayDecoder.kt @@ -80,33 +80,33 @@ class OverlayDecoder : ConfigDecoder(FLOOR_OVERLAY) { } } h /= 6.0 - val i_15_ = (h * 256.0).toInt() - var i_16_ = (256.0 * s).toInt() - var i_17_ = (l * 256.0).toInt() - if (i_16_ < 0) { - i_16_ = 0 - } else if (i_16_ > 255) { - i_16_ = 255 + val h2 = (256.0 * h).toInt() + var s2 = (256.0 * s).toInt() + var l2 = (256.0 * l).toInt() + if (s2 < 0) { + s2 = 0 + } else if (s2 > 255) { + s2 = 255 } - if (i_17_ >= 0) { - if (i_17_ > 255) { - i_17_ = 255 + if (l2 >= 0) { + if (l2 > 255) { + l2 = 255 } } else { - i_17_ = 0 + l2 = 0 } //Shift hsl - i_16_ = if (i_17_ <= 243) { + s2 = if (l2 <= 243) { when { - i_17_ > 217 -> i_16_ shr 3 - i_17_ > 192 -> i_16_ shr 2 - i_17_ > 179 -> i_16_ shr 1 - else -> i_16_ + l2 > 217 -> s2 shr 3 + l2 > 192 -> s2 shr 2 + l2 > 179 -> s2 shr 1 + else -> s2 } } else { - i_16_ shr 4 + s2 shr 4 } - return (i_17_ shr 1) + ((i_16_ shr 5 shl 7) + (i_15_ and 0xff shr 2 shl 10)) + return (l2 shr 1) + ((s2 shr 5 shl 7) + (h2 and 0xff shr 2 shl 10)) } } } \ No newline at end of file diff --git a/cache/src/main/kotlin/world/gregs/voidps/cache/definition/decoder/InterfaceDecoderFull.kt b/cache/src/main/kotlin/world/gregs/voidps/cache/definition/decoder/InterfaceDecoderFull.kt index c27d1b91e..11ee347d4 100644 --- a/cache/src/main/kotlin/world/gregs/voidps/cache/definition/decoder/InterfaceDecoderFull.kt +++ b/cache/src/main/kotlin/world/gregs/voidps/cache/definition/decoder/InterfaceDecoderFull.kt @@ -64,8 +64,8 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC if (parent == 65535) { parent = -1 } - val i_17_ = buffer.readUnsignedByte() - hidden = 0x1 and i_17_ != 0 + val flag = buffer.readUnsignedByte() + hidden = 0x1 and flag != 0 if (type == 0) { scrollWidth = buffer.readShort() scrollHeight = buffer.readShort() @@ -89,9 +89,9 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC } else if (type == 5) { defaultImage = buffer.readInt() imageRotation = buffer.readShort() - val i_18_ = buffer.readUnsignedByte() - aBoolean4861 = i_18_ and 0x1 != 0 - imageRepeat = i_18_ and 0x2 != 0 + val type = buffer.readUnsignedByte() + aBoolean4861 = type and 0x1 != 0 + imageRepeat = type and 0x2 != 0 alpha = buffer.readUnsignedByte() rotation = buffer.readUnsignedByte() backgroundColour = buffer.readInt() @@ -104,11 +104,11 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC if (defaultMediaId == 65535) { defaultMediaId = -1 } - val i_19_ = buffer.readUnsignedByte() - animated = 0x4 and i_19_ == 4 - val bool = 0x1 and i_19_ == 1 - centreType = i_19_ and 0x2 == 2 - ignoreZBuffer = 0x8 and i_19_ == 8 + val modelFlag = buffer.readUnsignedByte() + animated = 0x4 and modelFlag == 4 + val bool = 0x1 and modelFlag == 1 + centreType = modelFlag and 0x2 == 2 + ignoreZBuffer = 0x8 and modelFlag == 8 if (bool) { viewportX = buffer.readUnsignedShort() viewportY = buffer.readUnsignedShort() @@ -141,44 +141,40 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC lineMirrored = buffer.readUnsignedByte() == 1 } val setting = buffer.readUnsignedMedium() - var i_21_ = buffer.readUnsignedByte() - if (i_21_ != 0) { + var mod = buffer.readUnsignedByte() + if (mod != 0) { keyRepeats = ByteArray(11) keyCodes = ByteArray(11) keyModifiers = IntArray(11) - while (i_21_ != 0) { - val i_22_ = (i_21_ shr 4) - 1 - i_21_ = buffer.readUnsignedByte() or i_21_ shl 8 - i_21_ = i_21_ and 0xfff - if (i_21_ == 4095) { - i_21_ = -1 - } - val b_23_ = buffer.readByte().toByte() - if (b_23_.toInt() != 0) { + while (mod != 0) { + val index = (mod shr 4) - 1 + mod = buffer.readUnsignedByte() or mod shl 8 + mod = mod and 0xfff + val repeat = buffer.readByte().toByte() + if (repeat.toInt() != 0) { clickable = true } - val b_24_ = buffer.readByte().toByte() - keyModifiers!![i_22_] = i_21_ - keyRepeats!![i_22_] = b_23_ - keyCodes!![i_22_] = b_24_ - i_21_ = buffer.readUnsignedByte() + val code = buffer.readByte().toByte() + keyModifiers!![index] = mod + keyRepeats!![index] = repeat + keyCodes!![index] = code + mod = buffer.readUnsignedByte() } } name = buffer.readString() - val i_25_ = buffer.readUnsignedByte() - val optionCount = i_25_ and 0xf + val mouseFlag = buffer.readUnsignedByte() + val optionCount = mouseFlag and 0xf if (optionCount > 0) { options = Array(optionCount) { buffer.readString() } } - val iconCount = i_25_ shr 4 + val iconCount = mouseFlag shr 4 if (iconCount > 0) { - val i_29_ = buffer.readUnsignedByte() - mouseIcon = IntArray(i_29_ + 1) { if (i_29_ + 1 > it) -1 else 0 } - mouseIcon!![i_29_] = buffer.readShort() + val size = buffer.readUnsignedByte() + mouseIcon = IntArray(size + 1) { if (size + 1 > it) -1 else 0 } + mouseIcon!![size] = buffer.readShort() } if (iconCount > 1) { - val i_31_ = buffer.readUnsignedByte() - mouseIcon!![i_31_] = buffer.readShort() + mouseIcon!![buffer.readUnsignedByte()] = buffer.readShort() } optionOverride = buffer.readString() if (optionOverride == "") { @@ -188,11 +184,11 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC anInt4795 = buffer.readUnsignedByte() anInt4860 = buffer.readUnsignedByte() useOption = buffer.readString() - var i_32_ = -1 + var settingData = -1 if (setting and 0x3fda8 shr 11 != 0) { - i_32_ = buffer.readShort() - if (i_32_ == 65535) { - i_32_ = -1 + settingData = buffer.readShort() + if (settingData == 65535) { + settingData = -1 } anInt4698 = buffer.readShort() if (anInt4698 == 65535) { @@ -203,7 +199,7 @@ class InterfaceDecoderFull : DefinitionDecoder(INTERFAC anInt4839 = -1 } } - this.setting = InterfaceComponentSetting(setting, i_32_) + this.setting = InterfaceComponentSetting(setting, settingData) anObjectArray4758 = decodeScript(buffer) mouseEnterHandler = decodeScript(buffer) mouseExitHandler = decodeScript(buffer) diff --git a/cache/src/main/kotlin/world/gregs/voidps/cache/secure/Whirlpool.kt b/cache/src/main/kotlin/world/gregs/voidps/cache/secure/Whirlpool.kt index 271cee3c1..008761c59 100644 --- a/cache/src/main/kotlin/world/gregs/voidps/cache/secure/Whirlpool.kt +++ b/cache/src/main/kotlin/world/gregs/voidps/cache/secure/Whirlpool.kt @@ -19,36 +19,36 @@ class Whirlpool { for (i in 0..255) { val code = chars[i / 2].code val l = if (i and 0x1 == 0) (code ushr 8).toLong() else (code and 0xff).toLong() - var l_38_ = l shl 1 - if (l_38_ >= 256L) { - l_38_ = l_38_ xor 0x11dL + var l38 = l shl 1 + if (l38 >= 256L) { + l38 = l38 xor 0x11dL } - var l_39_ = l_38_ shl 1 - if (l_39_ >= 256L) { - l_39_ = l_39_ xor 0x11dL + var l39 = l38 shl 1 + if (l39 >= 256L) { + l39 = l39 xor 0x11dL } - val l_40_ = l_39_ xor l - var l_41_ = l_39_ shl 1 - if (l_41_ >= 256L) { - l_41_ = l_41_ xor 0x11dL + val l40 = l39 xor l + var l41 = l39 shl 1 + if (l41 >= 256L) { + l41 = l41 xor 0x11dL } - val l_42_ = l_41_ xor l - aLongArrayArray6630[0][i] = l shl 56 or (l shl 48) or (l_39_ shl 40) or (l shl 32) or (l_41_ shl 24) or (l_40_ shl 16) or (l_38_ shl 8) or l_42_ - for (i_43_ in 1..7) { - aLongArrayArray6630[i_43_][i] = aLongArrayArray6630[i_43_ - 1][i] ushr 8 or (aLongArrayArray6630[i_43_ - 1][i] shl 56) + val l42 = l41 xor l + aLongArrayArray6630[0][i] = l shl 56 or (l shl 48) or (l39 shl 40) or (l shl 32) or (l41 shl 24) or (l40 shl 16) or (l38 shl 8) or l42 + for (index in 1..7) { + aLongArrayArray6630[index][i] = aLongArrayArray6630[index - 1][i] ushr 8 or (aLongArrayArray6630[index - 1][i] shl 56) } } aLongArray6631[0] = 0L for (i in 1..10) { - val i_44_ = 8 * (i - 1) - aLongArray6631[i] = aLongArrayArray6630[0][i_44_] and 0xffffffffffffffL.inv() xor - (aLongArrayArray6630[1][i_44_ + 1] and 0xff000000000000L) xor - (aLongArrayArray6630[2][i_44_ + 2] and 0xff0000000000L) xor - (aLongArrayArray6630[3][i_44_ + 3] and 0xff00000000L) xor - (aLongArrayArray6630[4][4 + i_44_] and 0xff000000L) xor - (aLongArrayArray6630[5][5 + i_44_] and 0xff0000L) xor - (aLongArrayArray6630[6][6 + i_44_] and 0xff00L) xor - (aLongArrayArray6630[7][7 + i_44_] and 0xffL) + val index = 8 * (i - 1) + aLongArray6631[i] = aLongArrayArray6630[0][index] and 0xffffffffffffffL.inv() xor + (aLongArrayArray6630[1][index + 1] and 0xff000000000000L) xor + (aLongArrayArray6630[2][index + 2] and 0xff0000000000L) xor + (aLongArrayArray6630[3][index + 3] and 0xff00000000L) xor + (aLongArrayArray6630[4][index + 4] and 0xff000000L) xor + (aLongArrayArray6630[5][index + 5] and 0xff0000L) xor + (aLongArrayArray6630[6][index + 6] and 0xff00L) xor + (aLongArrayArray6630[7][index + 7] and 0xffL) } reset() } @@ -60,74 +60,74 @@ class Whirlpool { bufferPosition = 0 bufferBits = 0 buffer[0] = 0.toByte() - for (i_3_ in 0..7) { - hash[i_3_] = 0L + for (i in 0..7) { + hash[i] = 0L } } private fun processBuffer() { - var i_4_ = 0 - var i_5_ = 0 - while (i_4_ < 8) { - block[i_4_] = buffer[i_5_].toLong() shl 56 xor - (buffer[i_5_ + 1].toLong() and 0xffL shl 48) xor - (buffer[2 + i_5_].toLong() and 0xffL shl 40) xor - (buffer[i_5_ + 3].toLong() and 0xffL shl 32) xor - (buffer[i_5_ + 4].toLong() and 0xffL shl 24) xor - (buffer[5 + i_5_].toLong() and 0xffL shl 16) xor - (buffer[i_5_ + 6].toLong() and 0xffL shl 8) xor - (buffer[7 + i_5_].toLong() and 0xffL) - i_4_++ - i_5_ += 8 + var index = 0 + var offset = 0 + while (index < 8) { + block[index] = buffer[offset].toLong() shl 56 xor + (buffer[offset + 1].toLong() and 0xffL shl 48) xor + (buffer[offset + 2].toLong() and 0xffL shl 40) xor + (buffer[offset + 3].toLong() and 0xffL shl 32) xor + (buffer[offset + 4].toLong() and 0xffL shl 24) xor + (buffer[offset + 5].toLong() and 0xffL shl 16) xor + (buffer[offset + 6].toLong() and 0xffL shl 8) xor + (buffer[offset + 7].toLong() and 0xffL) + index++ + offset += 8 } - i_4_ = 0 - while (i_4_ < 8) { - state[i_4_] = block[i_4_] xor hash[i_4_].also { aLongArray6637[i_4_] = it } - i_4_++ + index = 0 + while (index < 8) { + state[index] = block[index] xor hash[index].also { aLongArray6637[index] = it } + index++ } - i_4_ = 1 - while (i_4_ <= 10) { - i_5_ = 0 - while (i_5_ < 8) { - aLongArray6638[i_5_] = 0L - var i_6_ = 0 - var i_7_ = 56 - while (i_6_ < 8) { - aLongArray6638[i_5_] = aLongArray6638[i_5_] xor aLongArrayArray6630[i_6_][(aLongArray6637[i_5_ - i_6_ and 0x7] ushr i_7_).toInt() and 0xff] - i_6_++ - i_7_ -= 8 + index = 1 + while (index <= 10) { + offset = 0 + while (offset < 8) { + aLongArray6638[offset] = 0L + var start = 0 + var offset2 = 56 + while (start < 8) { + aLongArray6638[offset] = aLongArray6638[offset] xor aLongArrayArray6630[start][(aLongArray6637[offset - start and 0x7] ushr offset2).toInt() and 0xff] + start++ + offset2 -= 8 } - i_5_++ + offset++ } - i_5_ = 0 - while (i_5_ < 8) { - aLongArray6637[i_5_] = aLongArray6638[i_5_] - i_5_++ + offset = 0 + while (offset < 8) { + aLongArray6637[offset] = aLongArray6638[offset] + offset++ } - aLongArray6637[0] = aLongArray6637[0] xor aLongArray6631[i_4_] - i_5_ = 0 - while (i_5_ < 8) { - aLongArray6638[i_5_] = aLongArray6637[i_5_] - var i_8_ = 0 - var i_9_ = 56 - while (i_8_ < 8) { - aLongArray6638[i_5_] = aLongArray6638[i_5_] xor aLongArrayArray6630[i_8_][(state[i_5_ - i_8_ and 0x7] ushr i_9_).toInt() and 0xff] - i_8_++ - i_9_ -= 8 + aLongArray6637[0] = aLongArray6637[0] xor aLongArray6631[index] + offset = 0 + while (offset < 8) { + aLongArray6638[offset] = aLongArray6637[offset] + var offset2 = 0 + var start = 56 + while (offset2 < 8) { + aLongArray6638[offset] = aLongArray6638[offset] xor aLongArrayArray6630[offset2][(state[offset - offset2 and 0x7] ushr start).toInt() and 0xff] + offset2++ + start -= 8 } - i_5_++ + offset++ } - i_5_ = 0 - while (i_5_ < 8) { - state[i_5_] = aLongArray6638[i_5_] - i_5_++ + offset = 0 + while (offset < 8) { + state[offset] = aLongArray6638[offset] + offset++ } - i_4_++ + index++ } - i_4_ = 0 - while (i_4_ < 8) { - hash[i_4_] = hash[i_4_] xor (state[i_4_] xor block[i_4_]) - i_4_++ + index = 0 + while (index < 8) { + hash[index] = hash[index] xor (state[index] xor block[index]) + index++ } } @@ -166,55 +166,55 @@ class Whirlpool { fun add(source: ByteArray, offset: Int = 0, length: Int = source.size) { var sourceBits = length * 8L var i = offset - val i_23_ = 8 - (sourceBits.toInt() and 0x7) and 0x7 - val i_24_ = bufferBits and 0x7 - var l_25_ = sourceBits - var i_26_ = 31 - var i_27_ = 0 - while ( /**/i_26_ >= 0) { - i_27_ += (bitLength[i_26_].toInt() and 0xff) + (l_25_.toInt() and 0xff) - bitLength[i_26_] = i_27_.toByte() - i_27_ = i_27_ ushr 8 - l_25_ = l_25_ ushr 8 - i_26_-- + val diff = 8 - (sourceBits.toInt() and 0x7) and 0x7 + val bits = bufferBits and 0x7 + var previous = sourceBits + var index = 31 + var total = 0 + while (index >= 0) { + total += (bitLength[index].toInt() and 0xff) + (previous.toInt() and 0xff) + bitLength[index] = total.toByte() + total = total ushr 8 + previous = previous ushr 8 + index-- } while (sourceBits > 8L) { - val i_28_ = source[i].toInt() shl i_23_ and 0xff or (source[i + 1].toInt() and 0xff ushr 8 - i_23_) - if (i_28_ < 0 || i_28_ >= 256) { + val value = source[i].toInt() shl diff and 0xff or (source[i + 1].toInt() and 0xff ushr 8 - diff) + if (value < 0 || value >= 256) { throw RuntimeException() } - buffer[bufferPosition] = (buffer[bufferPosition].toInt() or (i_28_ ushr i_24_)).toByte() + buffer[bufferPosition] = (buffer[bufferPosition].toInt() or (value ushr bits)).toByte() ++bufferPosition - bufferBits += 8 - i_24_ + bufferBits += 8 - bits if (bufferBits == 512) { processBuffer() bufferPosition = 0 bufferBits = 0 } - buffer[bufferPosition] = (i_28_ shl 8 - i_24_ and 0xff).toByte() - bufferBits += i_24_ + buffer[bufferPosition] = (value shl 8 - bits and 0xff).toByte() + bufferBits += bits sourceBits -= 8L i++ } - val i_29_: Int + val last: Int if (sourceBits > 0L) { - i_29_ = source[i].toInt() shl i_23_ and 0xff - buffer[bufferPosition] = (buffer[bufferPosition].toInt() or (i_29_ ushr i_24_)).toByte() + last = source[i].toInt() shl diff and 0xff + buffer[bufferPosition] = (buffer[bufferPosition].toInt() or (last ushr bits)).toByte() } else { - i_29_ = 0 + last = 0 } - if (i_24_.toLong() + sourceBits < 8L) { + if (bits.toLong() + sourceBits < 8L) { bufferBits += sourceBits.toInt() } else { ++bufferPosition - bufferBits += 8 - i_24_ - sourceBits -= (8 - i_24_).toLong() + bufferBits += 8 - bits + sourceBits -= (8 - bits).toLong() if (bufferBits == 512) { processBuffer() bufferPosition = 0 bufferBits = 0 } - buffer[bufferPosition] = (i_29_ shl 8 - i_24_ and 0xff).toByte() + buffer[bufferPosition] = (last shl 8 - bits and 0xff).toByte() bufferBits += sourceBits.toInt() } }