packages feed

rattletrap 2.2.4 → 2.3.0

raw patch · 6 files changed

+61/−13 lines, 6 filesbinary-added

Files

library/Rattletrap/Attribute/Loadout.hs view
@@ -11,10 +11,14 @@   , loadoutAttributeDecal :: Word32   , loadoutAttributeWheels :: Word32   , loadoutAttributeRocketTrail :: Word32+  -- ^ Now known as "rocket boost".   , loadoutAttributeAntenna :: Word32   , loadoutAttributeTopper :: Word32   , loadoutAttributeUnknown1 :: Word32   , loadoutAttributeUnknown2 :: Maybe Word32+  , loadoutAttributeEngineAudio :: Maybe Word32+  , loadoutAttributeTrail :: Maybe Word32+  , loadoutAttributeGoalExplosion :: Maybe Word32   } deriving (Eq, Ord, Show)  getLoadoutAttribute :: BinaryBit.BitGet LoadoutAttribute@@ -26,16 +30,34 @@   rocketTrail <- getWord32Bits   antenna <- getWord32Bits   topper <- getWord32Bits-  g <- getWord32Bits-  h <--    if version > Word8 10-      then do-        h <- getWord32Bits-        pure (Just h)-      else pure Nothing+  unknown1 <- getWord32Bits+  unknown2 <- getOptional (version > Word8 10) getWord32Bits+  engineAudio <- getOptional (version >= Word8 16) getWord32Bits+  trail <- getOptional (version >= Word8 16) getWord32Bits+  goalExplosion <- getOptional (version >= Word8 16) getWord32Bits   pure-    (LoadoutAttribute version body decal wheels rocketTrail antenna topper g h)+    (LoadoutAttribute+       version+       body+       decal+       wheels+       rocketTrail+       antenna+       topper+       unknown1+       unknown2+       engineAudio+       trail+       goalExplosion) +getOptional :: Bool -> BinaryBit.BitGet a -> BinaryBit.BitGet (Maybe a)+getOptional p f =+  if p+    then do+      x <- f+      pure (Just x)+    else pure Nothing+ putLoadoutAttribute :: LoadoutAttribute -> BinaryBit.BitPut () putLoadoutAttribute loadoutAttribute = do   putWord8Bits (loadoutAttributeVersion loadoutAttribute)@@ -46,6 +68,13 @@   putWord32Bits (loadoutAttributeAntenna loadoutAttribute)   putWord32Bits (loadoutAttributeTopper loadoutAttribute)   putWord32Bits (loadoutAttributeUnknown1 loadoutAttribute)-  case loadoutAttributeUnknown2 loadoutAttribute of+  putOptional (loadoutAttributeUnknown2 loadoutAttribute) putWord32Bits+  putOptional (loadoutAttributeEngineAudio loadoutAttribute) putWord32Bits+  putOptional (loadoutAttributeTrail loadoutAttribute) putWord32Bits+  putOptional (loadoutAttributeGoalExplosion loadoutAttribute) putWord32Bits++putOptional :: Maybe a -> (a -> BinaryBit.BitPut ()) -> BinaryBit.BitPut ()+putOptional m f =+  case m of+    Just x -> f x     Nothing -> pure ()-    Just x -> putWord32Bits x
library/Rattletrap/Header.hs view
@@ -13,6 +13,8 @@   -- ^ The "major" version number.   , headerLicenseeVersion :: Word32   -- ^ The "minor" version number.+  , headerPatchVersion :: Maybe Word32+  -- ^ The "patch" version number.   , headerLabel :: Text   -- ^ Always @TAGame.Replay_Soccar_TA@.   , headerProperties :: Dictionary Property@@ -56,14 +58,29 @@ getHeader = do   engineVersion <- getWord32   licenseeVersion <- getWord32+  patchVersion <- getPatchVersion engineVersion licenseeVersion   label <- getText   properties <- getDictionary getProperty-  pure (Header engineVersion licenseeVersion label properties)+  pure (Header engineVersion licenseeVersion patchVersion label properties) +getPatchVersion :: Word32 -> Word32 -> Binary.Get (Maybe Word32)+getPatchVersion major minor =+  if hasPatchVersion major minor+    then do+      patchVersion <- getWord32+      pure (Just patchVersion)+    else pure Nothing++hasPatchVersion :: Word32 -> Word32 -> Bool+hasPatchVersion major minor = major >= Word32 868 && minor >= Word32 18+ putHeader :: Header -> Binary.Put putHeader header = do   putWord32 (headerEngineVersion header)   putWord32 (headerLicenseeVersion header)+  case headerPatchVersion header of+    Nothing -> pure ()+    Just patchVersion -> putWord32 patchVersion   putText (headerLabel header)   putDictionary putProperty (headerProperties header) 
package.yaml view
@@ -57,4 +57,4 @@     - -with-rtsopts=-N     main: Main.hs     source-dirs: tests-version: '2.2.4'+version: '2.3.0'
rattletrap.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           rattletrap-version:        2.2.4+version:        2.3.0 synopsis:       Parse and generate Rocket League replays. description:    Rattletrap parses and generates Rocket League replays. category:       Game@@ -24,6 +24,7 @@     replays/0AD21FEE4A512906BEB6C98136AAF49A.replay     replays/1205D96C4D819800927791820096CD49.replay     replays/160CA83E41083BFD8E6315B4BFCA0561.replay+    replays/16D580EF479483E015207C901776F9FB.replay     replays/18D6738D415B70B5BE4C299588D3C141.replay     replays/1A126AC24CAA0DB0E98835BD960B8AF8.replay     replays/1AE415514DFC65DCBF8B8391AD35488D.replay
+ replays/16D580EF479483E015207C901776F9FB.replay view

binary file changed (absent → 30691 bytes)

tests/Main.hs view
@@ -45,6 +45,7 @@   , ("0AD21FEE4A512906BEB6C98136AAF49A", "some Latin-1 text")   , ("1205D96C4D819800927791820096CD49", "rumble mode")   , ("160CA83E41083BFD8E6315B4BFCA0561", "a dedicated server IP")+  , ("16D580EF479483E015207C901776F9FB", "new property types")   , ("18D6738D415B70B5BE4C299588D3C141", "an online loadout attribute")   , ("1A126AC24CAA0DB0E98835BD960B8AF8", "overtime")   , ("1AE415514DFC65DCBF8B8391AD35488D", "a game time")