module Sound.MED.Raw.MMD0exp where
import qualified Sound.MED.Raw.InstrExt as InstrExt
import Sound.MED.Raw.InstrExt(InstrExt)
import qualified Sound.MED.Raw.MMDInstrInfo as MMDInstrInfo
import Sound.MED.Raw.MMDInstrInfo(MMDInstrInfo)
import qualified Sound.MED.Raw.NotationInfo as NotationInfo
import Sound.MED.Raw.NotationInfo(NotationInfo)
import qualified Sound.MED.Raw.MMDDumpData as MMDDumpData
import Sound.MED.Raw.MMDDumpData(MMDDumpData)
import qualified Sound.MED.Raw.MMDInfo as MMDInfo
import Sound.MED.Raw.MMDInfo(MMDInfo)
import qualified Sound.MED.Raw.MMDARexx as MMDARexx
import Sound.MED.Raw.MMDARexx(MMDARexx)
import qualified Sound.MED.Raw.MMDMIDICmd3x as MMDMIDICmd3x
import Sound.MED.Raw.MMDMIDICmd3x(MMDMIDICmd3x)
import Sound.MED.Basic.Amiga
data MMD0exp = MMD0exp
{ nextmod :: PTR
, exp_smp :: [ InstrExt ]
, s_ext_entries :: UWORD
, s_ext_entrsz :: UWORD
, annotxt :: [ UBYTE ]
, annolen :: ULONG
, iinfo :: [ MMDInstrInfo ]
, i_ext_entries :: UWORD
, i_ext_entrsz :: UWORD
, jumpmask :: ULONG
, rgbtable :: [ UWORD ]
, channelsplit :: [ UBYTE ]
, n_info :: Maybe NotationInfo
, songname :: [ UBYTE ]
, songnamelen :: ULONG
, dumps :: Maybe MMDDumpData
, mmdinfo :: Maybe MMDInfo
, mmdrexx :: Maybe MMDARexx
, mmdcmd3x :: Maybe MMDMIDICmd3x
, reserved2 :: [ ULONG ]
, tag_end :: ULONG
}
deriving (Show)
peek :: MEM -> PTR -> IO MMD0exp
peek m p = do
nextmod' <- peekPTR m (p+0)
exp_smp'' <- peekPTR m (p+4)
s_ext_entries' <- peekUWORD m (p+8)
s_ext_entrsz' <- peekUWORD m (p+10)
exp_smp' <- mapM (InstrExt.peek s_ext_entrsz' m) $ pointerRangeGenCheck exp_smp'' (fromIntegral s_ext_entrsz') s_ext_entries'
annotxt'' <- peekPTR m (p+12)
annolen' <- peekULONG m (p+16)
annotxt' <- mapM (peekUBYTE m) $ pointerRangeGenCheck annotxt'' 1 annolen'
iinfo'' <- peekPTR m (p+20)
i_ext_entries' <- peekUWORD m (p+24)
i_ext_entrsz' <- peekUWORD m (p+26)
iinfo' <- mapM (MMDInstrInfo.peek i_ext_entrsz' m) $ pointerRangeGenCheck iinfo'' (fromIntegral i_ext_entrsz') i_ext_entries'
jumpmask' <- peekULONG m (p+28)
rgbtable'' <- peekPTR m (p+32)
rgbtable' <- mapM (peekUWORD m) $ pointerRangeGenCheck rgbtable'' 2 (8::Int)
channelsplit' <- mapM (peekUBYTE m) $ pointerRange (p+36) 1 4
n_info''' <- peekPTR m (p+40)
n_info' <- NotationInfo.peek m $? n_info'''
songname'' <- peekPTR m (p+44)
songnamelen' <- peekULONG m (p+48)
songname' <- mapM (peekUBYTE m) $ pointerRangeGenCheck songname'' 1 songnamelen'
dumps''' <- peekPTR m (p+52)
dumps' <- MMDDumpData.peek m $? dumps'''
mmdinfo''' <- peekPTR m (p+56)
mmdinfo' <- MMDInfo.peek m $? mmdinfo'''
mmdrexx''' <- peekPTR m (p+60)
mmdrexx' <- MMDARexx.peek m $? mmdrexx'''
mmdcmd3x''' <- peekPTR m (p+64)
mmdcmd3x' <- MMDMIDICmd3x.peek m $? mmdcmd3x'''
reserved2' <- mapM (peekULONG m) $ pointerRange (p+68) 4 3
tag_end' <- peekULONG m (p+80)
return $ MMD0exp
nextmod' exp_smp' i_ext_entries' s_ext_entrsz' annotxt' annolen'
iinfo' i_ext_entries' i_ext_entrsz' jumpmask' rgbtable'
channelsplit' n_info' songname' songnamelen' dumps' mmdinfo'
mmdrexx' mmdcmd3x' reserved2' tag_end'