示例#1
0
void D_SetGameDescription(void)
{
    gamedescription = "Unknown";

    if (logical_gamemission == doom)
    {
        // Doom 1.  But which version?

        if (gamemode == retail)
        {
            // Ultimate Doom

            gamedescription = GetGameName("The Ultimate DOOM");
        } 
        else if (gamemode == registered)
        {
            gamedescription = GetGameName("DOOM Registered");
        }
        else if (gamemode == shareware)
        {
            gamedescription = GetGameName("DOOM Shareware");
        }
    }
    else
    {
        // Doom 2 of some kind.  But which mission?

        if (logical_gamemission == doom2)
            gamedescription = GetGameName("DOOM 2: Hell on Earth");
        else if (logical_gamemission == pack_plut)
            gamedescription = GetGameName("DOOM 2: Plutonia Experiment"); 
        else if (logical_gamemission == pack_tnt)
            gamedescription = GetGameName("DOOM 2: TNT - Evilution");
    }
}
示例#2
0
bool SavedataParam::GetFilesList(SceUtilitySavedataParam *param)
{
	if (!param)
	{
		return false;
	}

	u32 dataAddr = param->fileListAddr;
	if (!Memory::IsValidAddress(dataAddr))
		return false;

	// TODO : Need to be checked against more game

	u32 fileInfosAddr = Memory::Read_U32(dataAddr + 24);

	//for Valkyria2, dataAddr+0 and dataAddr+12 has "5" for 5 files
	int numFiles = Memory::Read_U32(dataAddr+12);
	int foundFiles = 0;
	for (int i = 0; i < numFiles; i++)
	{
		// for each file (80 bytes):
		// u32 mode, u32 ??, u64 size, u64 ctime, u64 ??, u64 atime, u64 ???, u64 mtime, u64 ???
		// u8[16] filename (or 13 + padding?)
		u32 curFileInfoAddr = fileInfosAddr + i*80;

		char fileName[16];
		strncpy(fileName, Memory::GetCharPointer(curFileInfoAddr + 64),16);
		std::string filePath = savePath + GetGameName(param) + GetSaveName(param) + "/" + fileName;
		PSPFileInfo info = pspFileSystem.GetFileInfo(filePath);
		if (info.exists)
		{
			bool isCrypted = IsSaveEncrypted(param,0);
			Memory::Write_U32(0x21FF, curFileInfoAddr+0);
			if(isCrypted)	// Crypted save are 16 bytes bigger
				Memory::Write_U64(info.size - 0x10, curFileInfoAddr+8);
			else
				Memory::Write_U64(info.size, curFileInfoAddr+8);
			Memory::Write_U64(0,curFileInfoAddr + 16); // TODO ctime
			Memory::Write_U64(0,curFileInfoAddr + 24); // TODO unknow
			Memory::Write_U64(0,curFileInfoAddr + 32); // TODO atime
			Memory::Write_U64(0,curFileInfoAddr + 40); // TODO unknow
			Memory::Write_U64(0,curFileInfoAddr + 48); // TODO mtime
			Memory::Write_U64(0,curFileInfoAddr + 56); // TODO unknow
			foundFiles++;
		}
	}

	// TODO : verify if return true if at least 1 file found or only if all found
	return foundFiles > 0;
}
示例#3
0
        bool GameManager::InitializeGame(const std::wstring& fileName) {
            LOG_DEBUG(L"Initializing special game support");

            // Guild Wars 2
            auto guildWars2 = make_shared<GameGw2>();
            if (guildWars2->GetFileName() == fileName) {
                this->AddChild(guildWars2->GetGameName(), guildWars2);
                if (guildWars2->Initialize()) {
                    LOG_INFO(L"Guild Wars 2 found");
                    return true;
                }
            }

            LOG_INFO(L"No special game support found");
            return false;
        }
示例#4
0
bool SavedataParam::GetSize(SceUtilitySavedataParam *param)
{
	if (!param)
	{
		return false;
	}

	std::string saveDir = savePath + GetGameName(param) + GetSaveName(param);
	PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir);
	bool exists = info.exists;

	if (Memory::IsValidAddress(param->sizeAddr))
	{
		PspUtilitySavedataSizeInfo sizeInfo;
		Memory::ReadStruct(param->sizeAddr, &sizeInfo);

		// TODO: Read the entries and count up the size vs. existing size?

		sizeInfo.sectorSize = (int)MemoryStick_SectorSize();
		sizeInfo.freeSectors = (int)(MemoryStick_FreeSpace() / MemoryStick_SectorSize());

		// TODO: Is this after the specified files?  Before?
		sizeInfo.freeKB = (int)(MemoryStick_FreeSpace() / 1024);
		std::string spaceTxt = SavedataParam::GetSpaceText((int)MemoryStick_FreeSpace());
		strncpy(sizeInfo.freeString, spaceTxt.c_str(), 8);
		sizeInfo.freeString[7] = '\0';

		// TODO.
		sizeInfo.neededKB = 0;
		strcpy(sizeInfo.neededString, "0 KB");
		sizeInfo.overwriteKB = 0;
		strcpy(sizeInfo.overwriteString, "0 KB");

		Memory::WriteStruct(param->sizeAddr, &sizeInfo);
	}

	return exists;
}
示例#5
0
//把录像文件按时间逆序,然后反应到控件上  yjj 090304
void CAppealDlg::ProcessRecordFile(const CString& strUserName)
{
    if (strUserName == "")
    {
        return;
    }
    GetDlgItem(IDC_EDIT_USERNAME)->SetWindowText(strUserName);
    GetDlgItem(IDC_EDIT_PHONE_NUM)->SetWindowText("");
    GetDlgItem(IDC_EDIT_APPEAL_EMAIL)->SetWindowText("");
    GetDlgItem(IDC_EDIT_APPEAL_CONTENT)->SetWindowText("");



    CString strPath = CBcfFile::GetAppPath(); //得到当前的目录

    strPath += "log";
    strPath += "\\";

    CString gamenamefile = strPath + "gamename.bcf";
    DWORD dwHandle = cfgOpenFile(gamenamefile);

    if(dwHandle < 0x10)
        return;

    strPath += "log_";
    strPath += strUserName;
    strPath += "\\";

    CTime tCurTime = CTime::GetCurrentTime();
    CString direct = tCurTime.Format("%Y-%m-%d");

    CString strCurDir = strPath + direct;

    strCurDir += "\\";
    CFileFind finder;
    strCurDir += _T("*.*");
    int iFindFileCount = 0;
    m_fileList.clear();

    //从当前,向前找6个目录
    for (int i=0; i<6; i++)
    {
        BOOL bWorking = finder.FindFile(strCurDir);
        while (bWorking)
        {
            bWorking = finder.FindNextFile();
            if (finder.IsDots())
                continue;




            //找到一个文件
            //CString sFileName = finder.GetFileName();
            //CString sFilePath = finder.GetFilePath();
            RecordFileStruct recordfile;

            recordfile.strWholeName = finder.GetFilePath(); //得到完整名字
            recordfile.strFileName = finder.GetFileName();     //得到文件名字

            //wushuqun 2009.5.20
            recordfile.strGamePath = finder.GetFilePath();

            //if (recordfile.strFileName.Find(".zxh") == -1)
            //{
            //	continue;
            //}
            CString strNameId = GetFileNameID(recordfile.strFileName);
            recordfile.strGameName = GetGameName(dwHandle,strNameId); //得到游戏名字

            if (recordfile.strGameName == "")
            {
                continue;
            }
            finder.GetCreationTime(recordfile.timeCreatTime);    //得到创建文件时间
            recordfile.strGameTime = recordfile.timeCreatTime.Format("%m-%d %H:%M ");
            m_fileList.push_back(recordfile);  //把文件信息加入链表
            iFindFileCount ++;
        }
        //找完整个目录
        if (iFindFileCount >= 20)
        {
            break;
        }
        //
        CTimeSpan ts(1,   0,   0,   0);
        tCurTime -= ts;
        direct = tCurTime.Format("%Y-%m-%d");
        strCurDir = strPath + direct;

        strCurDir += "\\";
        strCurDir +=_T("*.*");
        //找上一天的目录
    }

    //按升序排列



    m_fileList.sort();
    m_FileListCtrl.DeleteAllItems();


    list<RecordFileStruct>::iterator iter = m_fileList.begin();
    int iCount = 0;
    for (; iter != m_fileList.end(); iter++)
    {
        RecordFileStruct recordfile = *iter;

        //RecordFileStruct* pRecordFile = iter;
        //iter ++;
        //CString strListNmae;
        //strListNmae.Format("%s  %s",recordfile.strGameName,recordfile.strGameTime);

        int iItem = m_FileListCtrl.InsertItem(m_FileListCtrl.GetItemCount(),recordfile.strGameName);
        m_FileListCtrl.SetItemText(iItem,1,recordfile.strGameTime);

        //wushuqun 2009.5.20
        //新增加一列“文件名称"
        m_FileListCtrl.SetItemText(iItem,2,recordfile.strFileName);

        //m_FileListCtrl.SetItemData(iItem,(DWORD)&iter);
        iCount++;
        //m_ListBox.AddString(strListNmae);
        //m_ListBox.InsertString(iCount++,strListNmae);
        if (iCount == 20)
        {
            break;
        }
    }









    cfgClose(dwHandle);
    finder.Close();



}
示例#6
0
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;
	}

	char (*saveNameListData)[20];
	bool hasMultipleFileName = false;
	if (param->saveNameList != 0)
	{
		Clear();

		saveNameListData = (char(*)[20])Memory::GetPointer(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++)
			{
				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)
					{
						saveDataList[realCount].size = 0;
						saveDataList[realCount].saveName = saveNameListData[i];
						saveDataList[realCount].idx = i;
						saveDataList[realCount].textureData = 0;

						if(Memory::IsValidAddress(param->newData))
						{
							// We have a png to show
							PspUtilitySavedataFileData newData;
							Memory::ReadStruct(param->newData, &newData);
							CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[realCount]);
						}
						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(pspParam));

			DEBUG_LOG(HLE,"%s Exist",fileDataPath.c_str());
			saveNameListDataCount = 1;
		}
		else
		{
			if (listEmptyFile)
			{
				saveDataList[0].size = 0;
				saveDataList[0].saveName = GetSaveName(param);
				saveDataList[0].idx = 0;
				saveDataList[0].textureData = 0;

				if(Memory::IsValidAddress(param->newData))
				{
					// We have a png to show
					PspUtilitySavedataFileData newData;
					Memory::ReadStruct(param->newData, &newData);
					CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[0]);
				}
				DEBUG_LOG(HLE,"Don't Exist");
			}
			saveNameListDataCount = 0;
			return 0;
		}
	}
	return 0;
}
示例#7
0
void D_SetGameDescription(void)
{
    gamedescription = GetGameName("Strife: Quest for the Sigil");
}
示例#8
0
int SavedataParam::GetFilesList(SceUtilitySavedataParam *param)
{
	if (!param)	{
		return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_STATUS;
	}

	if (!param->fileList.Valid()) {
		ERROR_LOG_REPORT(HLE, "SavedataParam::GetFilesList(): bad fileList address %08x", param->fileList.ptr);
		// Should crash.
		return -1;
	}

	auto &fileList = param->fileList;
	if (fileList->secureEntries.Valid() && fileList->maxSecureEntries > 99) {
		ERROR_LOG_REPORT(HLE, "SavedataParam::GetFilesList(): too many secure entries, %d", fileList->maxSecureEntries);
		return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS;
	}
	if (fileList->normalEntries.Valid() && fileList->maxNormalEntries > 8192) {
		ERROR_LOG_REPORT(HLE, "SavedataParam::GetFilesList(): too many normal entries, %d", fileList->maxNormalEntries);
		return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS;
	}
	if (fileList->systemEntries.Valid() && fileList->maxSystemEntries > 5) {
		ERROR_LOG_REPORT(HLE, "SavedataParam::GetFilesList(): too many system entries, %d", fileList->maxSystemEntries);
		return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS;
	}

	std::string dirPath = savePath + GetGameName(param) + GetSaveName(param);
	if (!pspFileSystem.GetFileInfo(dirPath).exists) {
		DEBUG_LOG(HLE, "SavedataParam::GetFilesList(): directory %s does not exist", dirPath.c_str());
		return SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA;
	}

	// Even if there are no files, initialize to 0.
	fileList->resultNumSecureEntries = 0;
	fileList->resultNumNormalEntries = 0;
	fileList->resultNumSystemEntries = 0;

	// We need PARAMS.SFO's SAVEDATA_FILE_LIST to determine which entries are secure.
	PSPFileInfo sfoFileInfo = pspFileSystem.GetFileInfo(dirPath + "/" + SFO_FILENAME);
	std::set<std::string> secureFilenames;
	// TODO: Error code if not?
	if (sfoFileInfo.exists) {
		ParamSFOData sfoFile;
		size_t sfoSize = (size_t)sfoFileInfo.size;
		u8 *sfoData = new u8[sfoSize];
		if (ReadPSPFile(dirPath + "/" + SFO_FILENAME, &sfoData, sfoSize, NULL)){
			sfoFile.ReadSFO(sfoData, sfoSize);
		}
		delete[] sfoData;

		u32 sfoFileListSize = 0;
		char *sfoFileList = (char *)sfoFile.GetValueData("SAVEDATA_FILE_LIST", &sfoFileListSize);
		const int FILE_LIST_ITEM_SIZE = 13 + 16 + 3;
		const int FILE_LIST_COUNT_MAX = 99;

		// Filenames are 13 bytes long at most.  Add a NULL so there's no surprises.
		char temp[14];
		temp[13] = '\0';

		for (u32 i = 0; i < FILE_LIST_COUNT_MAX; ++i) {
			// Ends at a NULL filename.
			if (i * FILE_LIST_ITEM_SIZE >= sfoFileListSize || sfoFileList[i * FILE_LIST_ITEM_SIZE] == '\0') {
				break;
			}

			strncpy(temp, &sfoFileList[i * FILE_LIST_ITEM_SIZE], 13);
			secureFilenames.insert(temp);
		}
	}

	// Does not list directories, nor recurse into them, and ignores files not ALL UPPERCASE.
	auto files = pspFileSystem.GetDirListing(dirPath);
	for (auto file = files.begin(), end = files.end(); file != end; ++file) {
		if (file->type == FILETYPE_DIRECTORY) {
			continue;
		}
		// TODO: What are the exact rules?  It definitely skips lowercase, and allows FILE or FILE.EXT.
		if (file->name.find_first_of("abcdefghijklmnopqrstuvwxyz") != file->name.npos) {
			DEBUG_LOG(HLE, "SavedataParam::GetFilesList(): skipping file %s with lowercase", file->name.c_str());
			continue;
		}

		bool isSystemFile = file->name == ICON0_FILENAME || file->name == ICON1_FILENAME || file->name == PIC1_FILENAME;
		isSystemFile = isSystemFile || file->name == SND0_FILENAME || file->name == SFO_FILENAME;

		SceUtilitySavedataFileListEntry *entry = NULL;
		int sizeOffset = 0;
		if (isSystemFile) {
			if (fileList->systemEntries.Valid() && fileList->resultNumSystemEntries < fileList->maxSystemEntries) {
				entry = &fileList->systemEntries[fileList->resultNumSystemEntries++];
			}
		} else if (secureFilenames.find(file->name) != secureFilenames.end()) {
			if (fileList->secureEntries.Valid() && fileList->resultNumSecureEntries < fileList->maxSecureEntries) {
				entry = &fileList->secureEntries[fileList->resultNumSecureEntries++];
			}
			// Secure files are slightly bigger.
			bool isCrypted = IsSaveEncrypted(param, GetSaveDirName(param, 0));
			if (isCrypted) {
				sizeOffset = -0x10;
			}
		} else {
			if (fileList->normalEntries.Valid() && fileList->resultNumNormalEntries < fileList->maxNormalEntries) {
				entry = &fileList->normalEntries[fileList->resultNumNormalEntries++];
			}
		}

		// Out of space for this file in the list.
		if (entry == NULL) {
			continue;
		}

		entry->st_mode = 0x21FF;
		entry->st_size = file->size + sizeOffset;
		// TODO: ctime, atime, mtime
		// TODO: Probably actually 13 + 3 pad...
		strncpy(entry->name, file->name.c_str(), 16);
		entry->name[15] = '\0';
	}

	return 0;
}
示例#9
0
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;
}