void DOS_Drive_Cache::ClearFileInfo(CFileInfo *dir) { for(Bit32u i=0; i<dir->fileList.size(); i++) { if (CFileInfo *info = dir->fileList[i]) ClearFileInfo(info); } if (dir->id != MAX_OPENDIRS) { dirSearch[dir->id] = 0; dir->id = MAX_OPENDIRS; } }
STATIC void initFileInfo( mod_info *curr_mod ) /********************************************/ { file_info *new_file; int file_len; ClearFileInfo( curr_mod ); file_len = strlen( LIT( Unknown_File ) ) + 1; new_file = ProfCAlloc( sizeof( file_info ) + file_len ); memcpy( new_file->name, LIT( Unknown_File ), file_len ); new_file->unknown_file = true; initRoutineInfo( new_file ); curr_mod->mod_file = ProfCAlloc( 2 * sizeof( pointer ) ); curr_mod->mod_file[0] = new_file; file_len = strlen( LIT( Gathered_Files ) ) + 1; new_file = ProfCAlloc( sizeof( file_info )+file_len ); memcpy( new_file->name, LIT( Gathered_Files ), file_len ); new_file->ignore_gather = true; new_file->gather_file = true; initRoutineInfo( new_file ); curr_mod->mod_file[1] = new_file; curr_mod->file_count = 2; }
int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) { pspParam = param; if (!pspParam) { Clear(); return 0; } bool listEmptyFile = true; if (param->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTLOAD || param->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE) { listEmptyFile = false; } SceUtilitySavedataSaveName *saveNameListData; bool hasMultipleFileName = false; if (param->saveNameList.Valid()) { Clear(); saveNameListData = param->saveNameList; // Get number of fileName in array saveDataListCount = 0; while (saveNameListData[saveDataListCount][0] != 0) { saveDataListCount++; } if (saveDataListCount > 0) { hasMultipleFileName = true; saveDataList = new SaveFileInfo[saveDataListCount]; // get and stock file info for each file int realCount = 0; for (int i = 0; i < saveDataListCount; i++) { // TODO: Maybe we should fill the list with existing files instead? if (strcmp(saveNameListData[i], "<>") == 0) continue; DEBUG_LOG(HLE,"Name : %s",saveNameListData[i]); std::string fileDataPath = savePath+GetGameName(param) + saveNameListData[i] + "/" + param->fileName; PSPFileInfo info = pspFileSystem.GetFileInfo(fileDataPath); if (info.exists) { SetFileInfo(realCount, info, saveNameListData[i]); DEBUG_LOG(HLE,"%s Exist",fileDataPath.c_str()); realCount++; } else { if (listEmptyFile) { ClearFileInfo(saveDataList[realCount], saveNameListData[i]); DEBUG_LOG(HLE,"Don't Exist"); realCount++; } } } saveNameListDataCount = realCount; } } if (!hasMultipleFileName) // Load info on only save { saveNameListData = 0; Clear(); saveDataList = new SaveFileInfo[1]; saveDataListCount = 1; // get and stock file info for each file DEBUG_LOG(HLE,"Name : %s",GetSaveName(param).c_str()); std::string fileDataPath = savePath + GetGameName(param) + GetSaveName(param) + "/" + param->fileName; PSPFileInfo info = pspFileSystem.GetFileInfo(fileDataPath); if (info.exists) { SetFileInfo(0, info, GetSaveName(param)); DEBUG_LOG(HLE,"%s Exist",fileDataPath.c_str()); saveNameListDataCount = 1; } else { if (listEmptyFile) { ClearFileInfo(saveDataList[0], GetSaveName(param)); DEBUG_LOG(HLE,"Don't Exist"); } saveNameListDataCount = 0; return 0; } } return 0; }
void DOS_Drive_Cache::DeleteFileInfo(CFileInfo *dir) { if (dir) ClearFileInfo(dir); delete dir; }