Beispiel #1
0
/// Initialize archives
void ArchiveInit() {
    next_handle = 1;

    // TODO(Subv): Add the other archive types (see here for the known types:
    // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes).

    std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX);
    std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
    auto sdmc_archive = Common::make_unique<FileSys::Archive_SDMC>(sdmc_directory);
    if (sdmc_archive->Initialize())
        CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC);
    else
        LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
    
    // Create the SaveData archive
    auto savedata_archive = Common::make_unique<FileSys::Archive_SaveData>(sdmc_directory);
    CreateArchive(std::move(savedata_archive), ArchiveIdCode::SaveData);

    auto extsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(sdmc_directory, false);
    if (extsavedata_archive->Initialize())
        CreateArchive(std::move(extsavedata_archive), ArchiveIdCode::ExtSaveData);
    else
        LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_archive->GetMountPoint().c_str());

    auto sharedextsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(nand_directory, true);
    if (sharedextsavedata_archive->Initialize())
        CreateArchive(std::move(sharedextsavedata_archive), ArchiveIdCode::SharedExtSaveData);
    else
        LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", 
            sharedextsavedata_archive->GetMountPoint().c_str());

    // Create the SaveDataCheck archive, basically a small variation of the RomFS archive
    auto savedatacheck_archive = Common::make_unique<FileSys::Archive_SaveDataCheck>(nand_directory);
    CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck);
}
Beispiel #2
0
// (archiveName:string, param_table) -> lightuserdata
int C_archive_CreateArchive(lua_State* L)
{
    const char* archiveName = luaL_checkstring(L,1);
    const int param_table = 2;
    lua_getfield(L, param_table, "useTrigrams");  // index 3
    bool useTrigrams = false;
    if (!lua_isnil(L, 3)) useTrigrams = lua_toboolean(L, 3);
    ArchiveCreateParams params;
    params.useTrigrams = useTrigrams;
    lua_pushlightuserdata(L, CreateArchive(archiveName, &params));
    return 1;
}
Beispiel #3
0
int OnQueryArchive (QueryArchiveStruct *pQAS)
{
	SFXSize=0;
	ArcType=MyIsArchive(pQAS->lpFileName,(const unsigned char*)pQAS->lpBuffer,pQAS->dwBufferSize);
	if(ArcType!=INVALID_FORMAT)
	{
		pQAS->nFormats = -1;
		pQAS->hResult = (HANDLE)CreateArchive(pQAS->lpFileName,ArcType);
		return NAERROR_SUCCESS;
	}

	return NAERROR_INTERNAL;
}
Beispiel #4
0
/**
 * Creates an Archive
 * @param backend File system backend interface to the archive
 * @param name Optional name of Archive
 * @return Handle to newly created Archive object
 */
Handle CreateArchive(FileSys::Archive* backend, const std::string& name) {
    Handle handle;
    Archive* archive = CreateArchive(handle, backend, name);
    return handle;
}
/**
 * Serializes the passed in data unless the current event is suppressed.
 *
 * @param	Data	Text to log
 * @param	Event	Event name used for suppression purposes
 */
void FOutputDeviceFile::Serialize( const TCHAR* Data, ELogVerbosity::Type Verbosity, const class FName& Category, const double Time )
{
#if ALLOW_LOG_FILE && !NO_LOGGING
	static bool Entry=false;
	if( !GIsCriticalError || Entry )
	{
		if( !LogAr && !Dead )
		{
			// Make log filename.
			if( !Filename[0] )
			{
				FCString::Strcpy(Filename, *FPlatformOutputDevices::GetAbsoluteLogFilename());
			}

			// if the file already exists, create a backup as we are going to overwrite it
			if (!bDisableBackup && !Opened)
			{
				CreateBackupCopy(Filename);
			}

			// Open log file.
			LogAr = CreateArchive();

			if( LogAr )
			{
				Opened = 1;

				WriteByteOrderMarkToArchive(EByteOrderMark::UTF8);

				if (!bSuppressEventTag)
				{
					Logf( TEXT("Log file open, %s"), FPlatformTime::StrTimestamp() );
				}
			}
			else 
			{
				Dead = true;
			}
		}

		if( LogAr && Verbosity != ELogVerbosity::SetColor )
		{
			WriteDataToArchive(Data, Verbosity, Category, Time);

			static bool GForceLogFlush = false;
			static bool GTestedCmdLine = false;
			if (!GTestedCmdLine)
			{
				GTestedCmdLine = true;
				// Force a log flush after each line
				GForceLogFlush = FParse::Param( FCommandLine::Get(), TEXT("FORCELOGFLUSH") );
			}
			if( GForceLogFlush )
			{
				LogAr->Flush();
			}
		}
	}
	else
	{
		Entry=true;
		Serialize( Data, Verbosity, Category, Time );
		Entry=false;
	}
#endif
}