module Rattletrap.Decode.LoadoutAttribute ( decodeLoadoutAttributeBits ) where import Rattletrap.Decode.Common import Rattletrap.Decode.Word32le import Rattletrap.Decode.Word8le import Rattletrap.Type.LoadoutAttribute import Rattletrap.Type.Word8le decodeLoadoutAttributeBits :: DecodeBits LoadoutAttribute decodeLoadoutAttributeBits :: DecodeBits LoadoutAttribute decodeLoadoutAttributeBits = do Word8le version <- DecodeBits Word8le decodeWord8leBits Word8le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute LoadoutAttribute Word8le version (Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet Word32le -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 11) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 16) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 16) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 16) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 17) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 19) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 22) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> BitGet (Maybe Word32le -> LoadoutAttribute) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 22) BitGet Word32le decodeWord32leBits BitGet (Maybe Word32le -> LoadoutAttribute) -> BitGet (Maybe Word32le) -> DecodeBits LoadoutAttribute forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Bool -> BitGet Word32le -> BitGet (Maybe Word32le) forall (m :: * -> *) (f :: * -> *) a. (Applicative m, Alternative f) => Bool -> m a -> m (f a) decodeWhen (Word8le version Word8le -> Word8le -> Bool forall a. Ord a => a -> a -> Bool >= Word8 -> Word8le Word8le Word8 22) BitGet Word32le decodeWord32leBits