/*--------------------------------------------------------------------------
  Project:  Manual 2D Library - m2d
  File:     arcResourceAccessor.h

  Copyright (C)2007-2009 Nintendo  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: 1.15 $
 *-------------------------------------------------------------------------*/

#ifndef NTMV_M2D_ARCRESOURCEACCESSOR_H_
#define NTMV_M2D_ARCRESOURCEACCESSOR_H_

#if defined(__CWCC__)
#pragma once
#endif

#include <nitro.h>
#include <nnsys/fnd.h>

#include <ntmv/m2d/resourceAccessor.h>
#include <cstddef>

namespace ntmv
{
namespace m2d
{

class ArcResourceAccessor : public ResourceAccessor
{
public:
    static const int    ROOTPATH_MAX        = FS_FILE_NAME_MAX;
    static const int    ARCHIVE_PATH_MAX    = FS_FILE_NAME_MAX;

                        ArcResourceAccessor();

    bool                Attach(
                            const char*     resourceRootDirectory);

    void*               Detach();

    virtual void*       GetResource(
                            ResType     resType,
                            const char* name);

    virtual void*       GetLocalizeResource(
                            ResType     resType,
                            const char* name);

    virtual void        SetLanguage(u16 lang);

    virtual bool        Exists(
                            ResType     resType,
                            u16         lang,
                            const char* name);

    bool                IsAttached() const  { return mbAttached; }

protected:
    char                mResRootDir[ROOTPATH_MAX];
    char                mPathBuf[ARCHIVE_PATH_MAX];
    u16                 mLang;
    bool                mbAttached;
};

}   // namespace m2d
}   // namespace ntmv

/* NTMV_M2D_ARCRESOURCEACCESSOR_H_ */
#endif
