Example #1
0
bool C3dsTool::createFile()
{
	bool bResult = false;
	switch (m_eFileType)
	{
	case kFileTypeCci:
		{
			CNcsd ncsd;
			ncsd.SetFileName(m_pFileName);
			ncsd.SetVerbose(m_bVerbose);
			ncsd.SetHeaderFileName(m_pHeaderFileName);
			ncsd.SetNcchFileName(m_pNcchFileName);
			ncsd.SetNotPad(m_bNotPad);
			bResult = ncsd.CreateFile();
		}
		break;
	case kFileTypeCxi:
		{
			CNcch ncch;
			ncch.SetFileName(m_pFileName);
			ncch.SetVerbose(m_bVerbose);
			ncch.SetHeaderFileName(m_pHeaderFileName);
			ncch.SetEncryptMode(m_nEncryptMode);
			ncch.SetKey(m_Key);
			ncch.SetNotUpdateExtendedHeaderHash(m_bNotUpdateExtendedHeaderHash);
			ncch.SetNotUpdateExeFsHash(m_bNotUpdateExeFsHash);
			ncch.SetNotUpdateRomFsHash(m_bNotUpdateRomFsHash);
			ncch.SetExtendedHeaderFileName(m_pExtendedHeaderFileName);
			ncch.SetLogoRegionFileName(m_pLogoRegionFileName);
			ncch.SetPlainRegionFileName(m_pPlainRegionFileName);
			ncch.SetExeFsFileName(m_pExeFsFileName);
			ncch.SetRomFsFileName(m_pRomFsFileName);
			ncch.SetExtendedHeaderXorFileName(m_pExtendedHeaderXorFileName);
			ncch.SetExeFsXorFileName(m_pExeFsXorFileName);
			ncch.SetExeFsTopXorFileName(m_pExeFsTopXorFileName);
			ncch.SetRomFsXorFileName(m_pRomFsXorFileName);
			ncch.SetExeFsTopAutoKey(m_bExeFsTopAutoKey);
			ncch.SetRomFsAutoKey(m_bRomFsAutoKey);
			bResult = ncch.CreateFile();
		}
		break;
	case kFileTypeCfa:
		{
			CNcch ncch;
			ncch.SetFileName(m_pFileName);
			ncch.SetVerbose(m_bVerbose);
			ncch.SetHeaderFileName(m_pHeaderFileName);
			ncch.SetEncryptMode(m_nEncryptMode);
			ncch.SetKey(m_Key);
			ncch.SetNotUpdateExeFsHash(m_bNotUpdateExeFsHash);
			ncch.SetNotUpdateRomFsHash(m_bNotUpdateRomFsHash);
			ncch.SetExeFsFileName(m_pExeFsFileName);
			ncch.SetRomFsFileName(m_pRomFsFileName);
			ncch.SetExeFsXorFileName(m_pExeFsXorFileName);
			ncch.SetRomFsXorFileName(m_pRomFsXorFileName);
			ncch.SetRomFsAutoKey(m_bRomFsAutoKey);
			bResult = ncch.CreateFile();
		}
		break;
	case kFileTypeExeFs:
		{
			CExeFs exeFs;
			exeFs.SetFileName(m_pFileName);
			exeFs.SetVerbose(m_bVerbose);
			exeFs.SetHeaderFileName(m_pHeaderFileName);
			exeFs.SetExeFsDirName(m_pExeFsDirName);
			exeFs.SetCompress(m_bCompress);
			bResult = exeFs.CreateFile();
		}
		break;
	case kFileTypeRomFs:
		{
			CRomFs romFs;
			romFs.SetFileName(m_pFileName);
			romFs.SetVerbose(m_bVerbose);
			romFs.SetRomFsDirName(m_pRomFsDirName);
			romFs.SetRomFsFileName(m_pRomFsFileName);
			bResult = romFs.CreateFile();
		}
		break;
	case kFileTypeBanner:
		{
			CBanner banner;
			banner.SetFileName(m_pFileName);
			banner.SetVerbose(m_bVerbose);
			banner.SetBannerDirName(m_pBannerDirName);
			bResult = banner.CreateFile();
		}
		break;
	default:
		break;
	}
	return bResult;
}
Example #2
0
bool C3dsTool::extractFile()
{
	bool bResult = false;
	switch (m_eFileType)
	{
	case kFileTypeCci:
		{
			CNcsd ncsd;
			ncsd.SetFileName(m_pFileName);
			ncsd.SetVerbose(m_bVerbose);
			ncsd.SetHeaderFileName(m_pHeaderFileName);
			ncsd.SetNcchFileName(m_pNcchFileName);
			bResult = ncsd.ExtractFile();
		}
		break;
	case kFileTypeCxi:
		{
			CNcch ncch;
			ncch.SetFileName(m_pFileName);
			ncch.SetVerbose(m_bVerbose);
			ncch.SetHeaderFileName(m_pHeaderFileName);
			ncch.SetEncryptMode(m_nEncryptMode);
			ncch.SetKey(m_uKey);
			ncch.SetExtendedHeaderFileName(m_pExtendedHeaderFileName);
			ncch.SetLogoRegionFileName(m_pLogoRegionFileName);
			ncch.SetPlainRegionFileName(m_pPlainRegionFileName);
			ncch.SetExeFsFileName(m_pExeFsFileName);
			ncch.SetRomFsFileName(m_pRomFsFileName);
			ncch.SetExtendedHeaderXorFileName(m_pExtendedHeaderXorFileName);
			ncch.SetExeFsXorFileName(m_pExeFsXorFileName);
			ncch.SetExeFsTopXorFileName(m_pExeFsTopXorFileName);
			ncch.SetRomFsXorFileName(m_pRomFsXorFileName);
			bResult = ncch.ExtractFile();
		}
		break;
	case kFileTypeCfa:
		{
			CNcch ncch;
			ncch.SetFileName(m_pFileName);
			ncch.SetVerbose(m_bVerbose);
			ncch.SetHeaderFileName(m_pHeaderFileName);
			ncch.SetEncryptMode(m_nEncryptMode);
			ncch.SetKey(m_uKey);
			ncch.SetExeFsFileName(m_pExeFsFileName);
			ncch.SetRomFsFileName(m_pRomFsFileName);
			ncch.SetExeFsXorFileName(m_pExeFsXorFileName);
			ncch.SetRomFsXorFileName(m_pRomFsXorFileName);
			bResult = ncch.ExtractFile();
		}
		break;
	case kFileTypeExefs:
		{
			CExeFs exeFs;
			exeFs.SetFileName(m_pFileName);
			exeFs.SetVerbose(m_bVerbose);
			exeFs.SetHeaderFileName(m_pHeaderFileName);
			exeFs.SetExeFsDirName(m_pExeFsDirName);
			exeFs.SetUncompress(m_bUncompress);
			bResult = exeFs.ExtractFile();
		}
		break;
	case kFileTypeRomfs:
		{
			CRomFs romFs;
			romFs.SetFileName(m_pFileName);
			romFs.SetVerbose(m_bVerbose);
			romFs.SetRomFsDirName(m_pRomFsDirName);
			bResult = romFs.ExtractFile();
		}
		break;
	case kFileTypeBanner:
		{
			CBanner banner;
			banner.SetFileName(m_pFileName);
			banner.SetVerbose(m_bVerbose);
			banner.SetBannerDirName(m_pBannerDirName);
			bResult = banner.ExtractFile();
		}
		break;
	default:
		break;
	}
	return bResult;
}