/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_GroupFile.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 13145 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_GROUP_FILE_H_ #define NW_SND_GROUP_FILE_H_ #include namespace nw { namespace snd { namespace internal { struct GroupFile { struct InfoBlock; struct FileBlock; struct InfoBlockBody; struct FileBlockBody; struct GroupItemInfo; struct FileHeader : public Util::SoundFileHeader { const InfoBlock* GetInfoBlock() const; const FileBlock* GetFileBlock() const; }; struct InfoBlockBody { // TODO: リファレンスがひとつ多いと思う。 // GroupItemInfo 自体が固定長なので、 // ここに直接 GroupItemInfo テーブルを埋めればいいのでは? // データ Util::ReferenceTable referenceTableOfGroupItemInfo; // アクセサ NW_INLINE u32 GetGroupItemInfoCount() const { return referenceTableOfGroupItemInfo.count; } const GroupItemInfo* GetGroupItemInfo( u32 index ) const { if ( index >= GetGroupItemInfoCount() ) { return NULL; } return static_cast( ut::AddOffsetToPtr( this, referenceTableOfGroupItemInfo.item[ index ].offset ) ); } #if 0 // データ Util::Table table; // アクセサ NW_INLINE u32 GetItemCount() const { return table.count; } const GroupItemInfo* GetItemInfo( u32 index ) const { if ( index > GetItemCount() ) { return NULL; } return &table.item[ index ]; } #endif }; struct InfoBlock { ut::BinaryBlockHeader header; InfoBlockBody body; }; struct GroupItemInfo { // データ ut::ResU32 fileId; Util::ReferenceWithSize embeddedItemInfo; // 埋め込まれたアイテムの場所やサイズを表現します。 // [場所] = [offset の起点] は、FileBlockBody です。 static const u32 OFFSET_FOR_LINK = 0xffffffff; static const u32 SIZE_FOR_LINK = 0xffffffff; // アクセサ const void* GetFileLocation( const FileBlockBody* fileBlockBody ) const { // ファイルブロック (ボディ?) のアドレスに、 // offset 値を足して返す。 if ( embeddedItemInfo.offset == OFFSET_FOR_LINK ) { return NULL; } return ut::AddOffsetToPtr( fileBlockBody, embeddedItemInfo.offset ); } }; struct FileBlockBody { // プレースホルダ }; struct FileBlock { ut::BinaryBlockHeader header; FileBlockBody body; }; }; } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_GROUP_FILE_H_ */