rattletrap 11.2.4 → 11.2.5
raw patch · 5 files changed
+42/−37 lines, 5 filesdep ~aesondep ~aeson-prettydep ~base
Dependency ranges changed: aeson, aeson-pretty, base, bytestring, containers, http-client, http-client-tls, text
Files
- LICENSE.markdown +1/−1
- rattletrap.cabal +10/−9
- src/lib/Rattletrap/Type/CompressedWord.hs +21/−19
- src/lib/Rattletrap/Type/Replay.hs +9/−8
- src/test/Main.hs +1/−0
LICENSE.markdown view
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Taylor Fausak+Copyright (c) 2022 Taylor Fausak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
rattletrap.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: rattletrap-version: 11.2.4+version: 11.2.5 synopsis: Parse and generate Rocket League replays. description: Rattletrap parses and generates Rocket League replays. @@ -21,7 +21,7 @@ manual: True common library- build-depends: base ^>= 4.15.0+ build-depends: base ^>= 4.16.1 default-extensions: NamedFieldPuns default-language: Haskell2010 ghc-options:@@ -33,6 +33,7 @@ -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists+ -Wno-missing-kind-signatures -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module -Wno-safe@@ -52,15 +53,15 @@ autogen-modules: Paths_rattletrap build-depends:- , aeson ^>= 1.5.6 || ^>= 2.0.0- , aeson-pretty ^>= 0.8.8+ , aeson ^>= 2.0.3+ , aeson-pretty ^>= 0.8.9 , array ^>= 0.5.4- , bytestring ^>= 0.10.12- , containers ^>= 0.6.4+ , bytestring ^>= 0.11.3+ , containers ^>= 0.6.5 , filepath ^>= 1.4.2- , http-client ^>= 0.7.8- , http-client-tls ^>= 0.3.5- , text ^>= 1.2.4+ , http-client ^>= 0.7.11+ , http-client-tls ^>= 0.3.6+ , text ^>= 2.0 exposed-modules: Paths_rattletrap Rattletrap
src/lib/Rattletrap/Type/CompressedWord.hs view
@@ -65,23 +65,25 @@ in if x < 1024 && x == 2 ^ n then n + 1 else n bitGet :: Word -> BitGet.BitGet CompressedWord-bitGet limit = do- value <- step limit (getMaxBits_ limit) 0 0- pure CompressedWord { limit, value }--getMaxBits_ :: Word -> Word-getMaxBits_ x = do- let- n :: Word- n = max 1 (ceiling (logBase (2 :: Double) (fromIntegral (max 1 x))))- if x < 1024 && x == 2 ^ n then n + 1 else n+bitGet = bitGetNew -step :: Word -> Word -> Word -> Word -> BitGet.BitGet Word-step limit_ maxBits position value_ = do- let x = Bits.shiftL 1 (fromIntegral position) :: Word- if position < maxBits && value_ + x <= limit_- then do- bit <- BitGet.bool- let newValue = if bit then value_ + x else value_- step limit_ maxBits (position + 1) newValue- else pure value_+bitGetNew :: Word -> BitGet.BitGet CompressedWord+bitGetNew limit = do+ value <- if limit < 1+ then pure 0+ else do+ let+ numBits =+ max (0 :: Int)+ . subtract 1+ . ceiling+ . logBase (2 :: Double)+ $ fromIntegral limit+ partial <- BitGet.bits numBits+ let next = partial + Bits.shiftL 1 numBits+ if next > limit+ then pure partial+ else do+ x <- BitGet.bool+ pure $ if x then next else partial+ pure CompressedWord { limit, value }
src/lib/Rattletrap/Type/Replay.hs view
@@ -108,11 +108,12 @@ getMaxChannels :: Header.Header -> Word getMaxChannels header_ =- case- Dictionary.lookup- (Str.fromString "MaxChannels")- (Header.properties header_)- of- Just (Property.Property _ _ (PropertyValue.Int maxChannels)) ->- fromIntegral (I32.toInt32 (Property.Int.toI32 maxChannels))- _ -> 1023+ subtract 1+ $ case+ Dictionary.lookup+ (Str.fromString "MaxChannels")+ (Header.properties header_)+ of+ Just (Property.Property _ _ (PropertyValue.Int maxChannels)) ->+ fromIntegral (I32.toInt32 (Property.Int.toI32 maxChannels))+ _ -> 1023
src/test/Main.hs view
@@ -95,6 +95,7 @@ , ("540d", "a demolish attribute") -- https://github.com/tfausak/rattletrap/commit/65ce033 , ("551c", "private match settings") -- https://github.com/tfausak/rattletrap/commit/5c9ebfc , ("5a06", "esports items") -- https://github.com/tfausak/rattletrap/pull/114+ , ("5e0b", "max channels") -- https://github.com/tfausak/rattletrap/issues/254 , ("6210", "different player history key") -- https://github.com/tfausak/rattletrap/pull/63 , ("6320", "a forfeit attribute") -- https://github.com/tfausak/rattletrap/pull/20 , ("6688", "a malformed byte property") -- https://github.com/tfausak/rattletrap/commit/b1ec18b