/*---------------------------------------------------------------------------* Project: NintendoWare File: lyt_ArcUtil.cpp Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. 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. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include #ifdef NW_PLATFORM_CTR #define _wcsicmp std::wcscasecmp #endif namespace nw { namespace lyt { bool ArcUtil::OpenResourceDir( ARCHandle* pArcHandle, const wchar_t* pRootDir, ResType resType, ARCDir* pDir) { NW_NULL_ASSERT(pArcHandle); NW_NULL_ASSERT(pDir); NW_ASSERT(resType != 0); bool result; result = ARCChangeDir(pArcHandle, pRootDir); if (!result) { return result; } wchar_t dirName[5]; // リソースタイプからディレクトリ名を生成。 dirName[0] = u8(resType >> 24); dirName[1] = u8(resType >> 16); dirName[2] = u8(resType >> 8); dirName[3] = u8(resType >> 0); dirName[4] = 0; result = ARCOpenDir(pArcHandle, dirName, pDir); return result; } bool ArcUtil::ReadResourceDir( ARCDir* pDir, const wchar_t* pExtStr, u32 extLen, ARCDirEntry* pDirEnt) { NW_NULL_ASSERT(pDir); NW_NULL_ASSERT(pExtStr); NW_ASSERT(extLen > 0); NW_NULL_ASSERT(pDirEnt); while (ARCReadDir(pDir, pDirEnt)) { size_t nameLen = std::wcslen(pDirEnt->name); if (nameLen <= extLen) { continue; } if (0 != _wcsicmp(pDirEnt->name + nameLen - extLen, pExtStr)) { continue; } return true; } return false; } } // namespace nw::lyt } // namespace nw