packages feed

rattletrap 0.1.0 → 0.1.1

raw patch · 10 files changed

+60/−25 lines, 10 filesdep ~rattletrapPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: rattletrap

API changes (from Hackage documentation)

+ Rattletrap.Content: [contentTrailingBits] :: Content -> [Bool]
+ Rattletrap.Utility: getRemainingBits :: BitGet [Bool]
+ Rattletrap.Version: version :: Version
- Rattletrap.Content: Content :: List Text -> List KeyFrame -> Word32 -> [Frame] -> List Message -> List Mark -> List Text -> List Text -> List Text -> List ClassMapping -> List Cache -> Content
+ Rattletrap.Content: Content :: List Text -> List KeyFrame -> Word32 -> [Frame] -> [Bool] -> List Message -> List Mark -> List Text -> List Text -> List Text -> List ClassMapping -> List Cache -> Content
- Rattletrap.Frame: getFrame :: (Int, Int) -> ClassAttributeMap -> ActorMap -> BitGet (Maybe (Frame, ActorMap))
+ Rattletrap.Frame: getFrame :: (Int, Int) -> ClassAttributeMap -> ActorMap -> BitGet (Frame, ActorMap)

Files

README.markdown view
@@ -1,5 +1,6 @@ # [Rattletrap][] +[![Version badge][]][version] [![Windows build badge][]][windows build] [![Build badge][]][build] @@ -58,6 +59,8 @@ ```  [Rattletrap]: https://github.com/tfausak/rattletrap+[Version badge]: https://img.shields.io/hackage/v/rattletrap.svg+[version]: https://hackage.haskell.org/package/rattletrap [Windows build badge]: https://ci.appveyor.com/api/projects/status/github/tfausak/rattletrap?branch=master&svg=true [windows build]: https://ci.appveyor.com/project/TaylorFausak/rattletrap [Build badge]: https://travis-ci.org/tfausak/rattletrap.svg?branch=master
executable/Main.hs view
@@ -14,6 +14,7 @@ import qualified Data.Binary.Get as Binary import qualified Data.Binary.Put as Binary import qualified Data.ByteString.Lazy as ByteString+import qualified Data.Version as Version import qualified Language.Haskell.TH as TH import qualified System.Environment as Environment @@ -25,6 +26,7 @@ mainWithArgs :: [String] -> IO () mainWithArgs args =   case args of+    ["version"] -> putStrLn (Version.showVersion version)     "decode":files -> do       (getInput, putOutput) <- getIO files       input <- getInput
library/Rattletrap.hs view
@@ -36,6 +36,7 @@ import Rattletrap.Text as Export import Rattletrap.Utility as Export import Rattletrap.Vector as Export+import Rattletrap.Version as Export import Rattletrap.Word32 as Export import Rattletrap.Word64 as Export import Rattletrap.Word8 as Export
library/Rattletrap/Content.hs view
@@ -24,6 +24,7 @@   , contentKeyFrames :: List KeyFrame   , contentStreamSize :: Word32   , contentFrames :: [Frame]+  , contentTrailingBits :: [Bool]   , contentMessages :: List Message   , contentMarks :: List Mark   , contentPackages :: List Text@@ -47,17 +48,22 @@   classMappings <- getList getClassMapping   caches <- getList getCache   let classAttributeMap = makeClassAttributeMap objects classMappings caches-  let (frames, _) =+  let (frames, remainingBits) =         Binary.runGet           (BinaryBit.runBitGet-             (getFrames version numFrames classAttributeMap makeActorMap))+             (do (theFrames, _) <-+                   getFrames version numFrames classAttributeMap makeActorMap+                 theRemainingBits <- getRemainingBits+                 pure (theFrames, theRemainingBits)))           (reverseBytes stream)+  let trailingBits = reverse (dropWhile not (reverse remainingBits))   pure     Content     { contentLevels = levels     , contentKeyFrames = keyFrames     , contentStreamSize = streamSize     , contentFrames = frames+    , contentTrailingBits = trailingBits     , contentMessages = messages     , contentMarks = marks     , contentPackages = packages@@ -74,7 +80,10 @@   let streamSize = contentStreamSize content   putWord32 streamSize   let stream =-        Binary.runPut (BinaryBit.runBitPut (putFrames (contentFrames content)))+        Binary.runPut+          (BinaryBit.runBitPut+             (do putFrames (contentFrames content)+                 mapM_ BinaryBit.putBool (contentTrailingBits content)))   Binary.putLazyByteString     (reverseBytes (padBytes (word32Value streamSize) stream))   putList putMessage (contentMessages content)
library/Rattletrap/Data.hs view
@@ -55,7 +55,7 @@   , ("TAGame.Vehicle_TA", "TAGame.RBActor_TA")   , ("TAGame.VehiclePickup_Boost_TA", "TAGame.VehiclePickup_TA")   , ("TAGame.VehiclePickup_TA", "Engine.ReplicationInfo")-  -- , ("TAGame.VoteActor_TA", "Engine.ReplicationInfo")+  , ("TAGame.VoteActor_TA", "Engine.Actor")   ]  rawClassesWithLocation :: [String]@@ -142,7 +142,7 @@   -- , ("TAGame.CameraSettingsActor_TA:PRI", "TAGame.CameraSettingsActor_TA")   , ("TAGame.Default__CameraSettingsActor_TA", "TAGame.CameraSettingsActor_TA")   , ("TAGame.Default__PRI_TA", "TAGame.PRI_TA")-  -- , ("TAGame.Default__VoteActor_TA", "TAGame.VoteActor_TA")+  , ("TAGame.Default__VoteActor_TA", "TAGame.VoteActor_TA")   , ("TheWorld:PersistentLevel.CrowdActor_TA", "TAGame.CrowdActor_TA")   , ("TheWorld:PersistentLevel.CrowdManager_TA", "TAGame.CrowdManager_TA")   , ("TheWorld:PersistentLevel.InMapScoreboard_TA", "TAGame.InMapScoreboard_TA")
library/Rattletrap/Frame.hs view
@@ -20,14 +20,11 @@   -> ClassAttributeMap   -> ActorMap   -> BinaryBit.BitGet ([Frame], ActorMap)-getFrames version numFrames classAttributeMap actorMap = do-  maybeFrame <--    if numFrames > 0-      then getFrame version classAttributeMap actorMap-      else pure Nothing-  case maybeFrame of-    Nothing -> pure ([], actorMap)-    Just (frame, newActorMap) -> do+getFrames version numFrames classAttributeMap actorMap =+  if numFrames <= 0+    then pure ([], actorMap)+    else do+      (frame, newActorMap) <- getFrame version classAttributeMap actorMap       (frames, newerActorMap) <-         getFrames version (numFrames - 1) classAttributeMap newActorMap       pure (frame : frames, newerActorMap)@@ -39,20 +36,16 @@   :: (Int, Int)   -> ClassAttributeMap   -> ActorMap-  -> BinaryBit.BitGet (Maybe (Frame, ActorMap))+  -> BinaryBit.BitGet (Frame, ActorMap) getFrame version classAttributeMap actorMap = do   time <- getFloat32Bits   delta <- getFloat32Bits   (replications, newActorMap) <-     getReplications version classAttributeMap actorMap   pure-    (Just-       ( Frame-         { frameTime = time-         , frameDelta = delta-         , frameReplications = replications-         }-       , newActorMap))+    ( Frame+      {frameTime = time, frameDelta = delta, frameReplications = replications}+    , newActorMap)  putFrame :: Frame -> BinaryBit.BitPut () putFrame frame = do
library/Rattletrap/Utility.hs view
@@ -1,9 +1,20 @@ module Rattletrap.Utility where +import qualified Data.Binary.Bits.Get as BinaryBit import qualified Data.Bits as Bits import qualified Data.ByteString.Lazy as ByteString import qualified Data.Word as Word import qualified Text.Regex as Regex++getRemainingBits :: BinaryBit.BitGet [Bool]+getRemainingBits = do+  isEmpty <- BinaryBit.isEmpty+  if isEmpty+    then pure []+    else do+      bit <- BinaryBit.getBool+      bits <- getRemainingBits+      pure (bit : bits)  padBytes   :: Integral a
+ library/Rattletrap/Version.hs view
@@ -0,0 +1,7 @@+module Rattletrap.Version where++import qualified Data.Version as Version+import qualified Paths_rattletrap as This++version :: Version.Version+version = This.version
rattletrap.cabal view
@@ -1,10 +1,12 @@ name: rattletrap-version: 0.1.0+version: 0.1.1 cabal-version: >=1.10 build-type: Simple license: MIT license-file: LICENSE.markdown maintainer: Taylor Fausak+homepage: https://github.com/tfausak/rattletrap#readme+bug-reports: https://github.com/tfausak/rattletrap/issues synopsis: Parse and generate Rocket League replays. description:     Rattletrap parses and generates Rocket League replays.@@ -13,6 +15,10 @@     HLint.hs     README.markdown +source-repository head+    type: git+    location: https://github.com/tfausak/rattletrap+ library     exposed-modules:         Rattletrap@@ -79,6 +85,7 @@         Rattletrap.Text         Rattletrap.Utility         Rattletrap.Vector+        Rattletrap.Version         Rattletrap.Word32         Rattletrap.Word64         Rattletrap.Word8@@ -95,6 +102,8 @@         vector >=0.11.0.0 && <0.12     default-language: Haskell2010     hs-source-dirs: library+    other-modules:+        Paths_rattletrap     ghc-options: -Wall  executable rattletrap@@ -105,7 +114,7 @@         base >=4.9.0.0 && <4.10,         binary >=0.8.3.0 && <0.9,         bytestring >=0.10.8.1 && <0.11,-        rattletrap >=0.1.0 && <0.2,+        rattletrap >=0.1.1 && <0.2,         template-haskell >=2.11.0.0 && <2.12     default-language: Haskell2010     hs-source-dirs: executable@@ -130,7 +139,7 @@         binary >=0.8.3.0 && <0.9,         bytestring >=0.10.8.1 && <0.11,         filepath >=1.4.1.0 && <1.5,-        rattletrap >=0.1.0 && <0.2,+        rattletrap >=0.1.1 && <0.2,         tasty >=0.11.0.4 && <0.12,         tasty-hspec >=1.1.3 && <1.2     default-language: Haskell2010
test/Test.hs view
@@ -71,7 +71,7 @@   , ("A52F804845573D8DA65E97BF59026A43", "some more mutators")   , ("A6711CE74272B2E663DCC9A200A218E3", "a waiting player")   , ("A7F001A1417A19BFA8C90990D8F7C2FF", "a ready attribute")-  -- , ("B82DDB624C393A4A425E68AB40DC2450", "TODO")+  , ("B82DDB624C393A4A425E68AB40DC2450", "a vote actor and trailing bits")   , ("B9F9B87D4A9D0A3D25D4EC91C0401DE2", "a party leader")   , ("C14F7E0E4D9B5E6BE9AD5D8ED56B174C", "some mutators")   , ("C375E0EC4971B506C51678B465D35AE9", "some UTF-16 text")