1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_GroupFileReader.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 28085 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_GROUP_FILE_READER_H_
17 #define NW_SND_GROUP_FILE_READER_H_
18 
19 #include <nw/snd/snd_GroupFile.h>
20 
21 namespace nw {
22 namespace snd {
23 namespace internal {
24 
25 struct GroupItemLocationInfo
26 {
27     u32 fileId;
28     const void* address;    // 非 NULL: 埋め込みアイテム。ロードされたアドレスを格納。
29                             // NULL   : リンクアイテム。別途ロードが必要。
30 };
31 
32 class GroupFileReader
33 {
34 public:
35     static const u32 SIGNATURE_FILE = NW_UT_MAKE_SIGWORD( 'C', 'G', 'R', 'P' );
36 
37     GroupFileReader( const void* groupFile );
38 
39     // InfoBlock の情報を取得
GetGroupItemCount()40     u32 GetGroupItemCount() const { return m_pInfoBlockBody->GetGroupItemInfoCount(); }
41     bool ReadGroupItemLocationInfo( GroupItemLocationInfo* out, u32 index ) const;
42 
43     // InfoExBlock の情報を取得
44     u32 GetGroupItemExCount() const;
45     bool ReadGroupItemInfoEx( GroupFile::GroupItemInfoEx* out, u32 index ) const;
46 
47 private:
48     const GroupFile::InfoBlockBody* m_pInfoBlockBody;
49     const GroupFile::FileBlockBody* m_pFileBlockBody;
50     const GroupFile::InfoExBlockBody* m_pInfoExBlockBody;
51 };
52 
53 } // namespace nw::snd::internal
54 } // namespace nw::snd
55 } // namespace nw
56 
57 
58 #endif /* NW_SND_GROUP_FILE_READER_H_ */
59 
60