本文整理汇总了C++中SaveStateList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ SaveStateList::end方法的具体用法?C++ SaveStateList::end怎么用?C++ SaveStateList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaveStateList
的用法示例。
在下文中一共展示了SaveStateList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listSaves
SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern("fullpipe.s##");
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
Common::ScopedPtr<Common::InSaveFile> in(saveFileMan->openForLoading(*file));
if (in) {
Fullpipe::FullpipeSavegameHeader header;
Fullpipe::readSavegameHeader(in.get(), header);
SaveStateDescriptor desc;
parseSavegameHeader(header, desc);
desc.setSaveSlot(slotNum);
saveList.push_back(desc);
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例2: listSaves
SaveStateList GrimMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String targetString(target);
Common::String pattern = targetString.hasPrefix("monkey4") ? "efmi*.gsv" : "grim*.gsv";
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
char str[256];
int32 strSize;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + 4);
if (slotNum >= 0) {
SaveGame *savedState = SaveGame::openForLoading(*file);
if (savedState && savedState->isCompatible()) {
savedState->beginSection('SUBS');
strSize = savedState->readLESint32();
savedState->read(str, strSize);
savedState->endSection();
saveList.push_back(SaveStateDescriptor(slotNum, str));
}
delete savedState;
}
}
Common::sort(saveList.begin(), saveList.end(), cmpSave);
return saveList;
}
示例3: listSaves
SaveStateList listSaves(const char *target) const override {
Common::String pattern = Common::String::format("%s-###.tlj", target);
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
int targetLen = strlen(target);
SaveStateList saveList;
for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
// Extract the slot number from the filename
char slot[4];
slot[0] = (*filename)[targetLen + 1];
slot[1] = (*filename)[targetLen + 2];
slot[2] = (*filename)[targetLen + 3];
slot[3] = '\0';
// Read the description from the save
Common::String description;
Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(*filename);
if (save) {
StateReadStream stream(save);
description = stream.readString();
}
saveList.push_back(SaveStateDescriptor(atoi(slot), description));
}
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例4: listSaves
virtual SaveStateList listSaves(const char *target) const {
Common::String pattern = Tucker::generateGameStateFileName(target, 0, true);
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
Tucker::TuckerEngine::SavegameHeader header;
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
int slot;
const char *ext = strrchr(file->c_str(), '.');
if (ext && (slot = atoi(ext + 1)) >= 0 && slot <= Tucker::kLastSaveSlot) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
if (in) {
if (Tucker::TuckerEngine::readSavegameHeader(in, header) == Tucker::TuckerEngine::kSavegameNoError) {
saveList.push_back(SaveStateDescriptor(slot, header.description));
}
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例5: o_checkvalidsaves
void Script::o_checkvalidsaves() {
debugScript(1, true, "CHECKVALIDSAVES");
// Reset the array of valid saves and the savegame names cache
for (int i = 0; i < 10; i++) {
setVariable(i, 0);
_saveNames[i] = "E M P T Y";
}
// Get the list of savefiles
SaveStateList list = SaveLoad::listValidSaves(ConfMan.getActiveDomainName());
// Mark the existing savefiles as valid
uint count = 0;
SaveStateList::iterator it = list.begin();
while (it != list.end()) {
int8 slot = it->getVal("save_slot").lastChar() - '0';
if (SaveLoad::isSlotValid(slot)) {
debugScript(2, true, " Found valid savegame: %s", it->getVal("description").c_str());
// Mark this slot as used
setVariable(slot, 1);
// Cache this slot's description
_saveNames[slot] = it->getVal("description");
count++;
}
it++;
}
// Save the number of valid saves
setVariable(0x104, count);
debugScript(1, true, " Found %d valid savegames", count);
}
示例6: listSaves
SaveStateList MADSMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String saveDesc;
Common::String pattern = Common::String::format("%s.0##", target);
MADS::MADSSavegameHeader header;
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
const char *ext = strrchr(file->c_str(), '.');
int slot = ext ? atoi(ext + 1) : -1;
if (slot >= 0 && slot < MAX_SAVES) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
if (in) {
MADS::Game::readSavegameHeader(in, header);
saveList.push_back(SaveStateDescriptor(slot, header._saveName));
header._thumbnail->free();
delete header._thumbnail;
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例7: listSaves
SaveStateList DraciMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern("draci.s##");
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= 99) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
Draci::DraciSavegameHeader header;
if (Draci::readSavegameHeader(in, header)) {
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
}
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例8: listSaves
SaveStateList SagaMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
char saveDesc[SAVE_TITLE_SIZE];
Common::String pattern = target;
pattern += ".s##";
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
int slotNum = 0;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum < MAX_SAVES) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
for (int i = 0; i < 3; i++)
in->readUint32BE();
in->read(saveDesc, SAVE_TITLE_SIZE);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例9: listSaves
SaveStateList SkyMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
SaveStateList saveList;
// Load the descriptions
Common::StringArray savenames;
savenames.resize(MAX_SAVE_GAMES+1);
Common::InSaveFile *inf;
inf = saveFileMan->openForLoading("SKY-VM.SAV");
if (inf != NULL) {
char *tmpBuf = new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
char *tmpPtr = tmpBuf;
inf->read(tmpBuf, MAX_SAVE_GAMES * MAX_TEXT_LEN);
for (int i = 0; i < MAX_SAVE_GAMES; ++i) {
savenames[i] = tmpPtr;
tmpPtr += savenames[i].size() + 1;
}
delete inf;
delete[] tmpBuf;
}
// Find all saves
Common::StringArray filenames;
filenames = saveFileMan->listSavefiles("SKY-VM.###");
// Slot 0 is the autosave, if it exists.
// TODO: Check for the existence of the autosave -- but this require us
// to know which SKY variant we are looking at.
saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*"));
// Prepare the list of savestates by looping over all matching savefiles
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Extract the extension
Common::String ext = file->c_str() + file->size() - 3;
ext.toUppercase();
int slotNum = atoi(ext.c_str());
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
saveList.push_back(SaveStateDescriptor(slotNum+1, savenames[slotNum]));
delete in;
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例10: atoi
SaveStateList CGE2MetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern = target;
pattern += ".###";
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(filename->c_str() + filename->size() - 3);
if (slotNum >= 0 && slotNum <= 99) {
Common::InSaveFile *file = saveFileMan->openForLoading(*filename);
if (file) {
CGE2::SavegameHeader header;
// Check to see if it's a ScummVM savegame or not
char buffer[kSavegameStrSize + 1];
file->read(buffer, kSavegameStrSize + 1);
if (!strncmp(buffer, kSavegameStr, kSavegameStrSize + 1)) {
// Valid savegame
if (CGE2::CGE2Engine::readSavegameHeader(file, header)) {
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
if (header.thumbnail) {
header.thumbnail->free();
delete header.thumbnail;
}
}
} else {
// Must be an original format savegame
saveList.push_back(SaveStateDescriptor(slotNum, "Unknown"));
}
delete file;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例11: listSaves
SaveStateList AdlMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray files = saveFileMan->listSavefiles(Common::String(target) + ".s##");
SaveStateList saveList;
for (uint i = 0; i < files.size(); ++i) {
const Common::String &fileName = files[i];
Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName);
if (!inFile) {
warning("Cannot open save file '%s'", fileName.c_str());
continue;
}
if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) {
warning("No header found in '%s'", fileName.c_str());
delete inFile;
continue;
}
byte saveVersion = inFile->readByte();
if (saveVersion != SAVEGAME_VERSION) {
warning("Unsupported save game version %i found in '%s'", saveVersion, fileName.c_str());
delete inFile;
continue;
}
char name[SAVEGAME_NAME_LEN] = { };
inFile->read(name, sizeof(name) - 1);
delete inFile;
int slotNum = atoi(fileName.c_str() + fileName.size() - 2);
SaveStateDescriptor sd(slotNum, name);
saveList.push_back(sd);
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例12: switchMode
bool EventRecorder::switchMode() {
const Common::String gameId = ConfMan.get("gameid");
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
bool metaInfoSupport = (*plugin)->hasFeature(MetaEngine::kSavesSupportMetaInfo);
bool featuresSupport = metaInfoSupport &&
g_engine->canSaveGameStateCurrently() &&
(*plugin)->hasFeature(MetaEngine::kSupportsListSaves) &&
(*plugin)->hasFeature(MetaEngine::kSupportsDeleteSave);
if (!featuresSupport) {
return false;
}
int emptySlot = 1;
SaveStateList saveList = (*plugin)->listSaves(gameId.c_str());
for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
int saveSlot = x->getSaveSlot();
if (saveSlot == 0) {
continue;
}
if (emptySlot != saveSlot) {
break;
}
emptySlot++;
}
Common::String saveName;
if (emptySlot >= 0) {
saveName = Common::String::format("Save %d", emptySlot + 1);
Common::Error status = g_engine->saveGameState(emptySlot, saveName);
if (status.getCode() == Common::kNoError) {
Common::Event eventRTL;
eventRTL.type = Common::EVENT_RTL;
g_system->getEventManager()->pushEvent(eventRTL);
}
}
ConfMan.set("record_mode", "", Common::ConfigManager::kTransientDomain);
ConfMan.setInt("save_slot", emptySlot, Common::ConfigManager::kTransientDomain);
_needcontinueGame = true;
return true;
}
示例13: list
SaveStateList SaveFileManager::list(const Common::String &target) {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray files = saveFileMan->listSavefiles(target + ".###");
SaveStateList saveList;
for (Common::StringArray::const_iterator fileName = files.begin(); fileName != files.end(); ++fileName) {
Common::InSaveFile *saveFile = saveFileMan->openForLoading(*fileName);
if (saveFile == nullptr || saveFile->err()) {
continue;
}
BladeRunner::SaveFileHeader header;
readHeader(*saveFile, header);
int slotNum = atoi(fileName->c_str() + fileName->size() - 3);
saveList.push_back(SaveStateDescriptor(slotNum, header._name));
}
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例14: listSaves
SaveStateList GrimMetaEngine::listSaves(const char *target) const {
Common::String gameId = ConfMan.get("gameid", target);
Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern = gameId == "monkey4" ? "efmi###.gsv" : "grim##.gsv";
if (platform == Common::kPlatformPS2)
pattern = "efmi###.ps2";
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
char str[256];
int32 strSize;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + 4);
if (slotNum >= 0) {
SaveGame *savedState = SaveGame::openForLoading(*file);
if (savedState && savedState->isCompatible()) {
if (platform == Common::kPlatformPS2)
savedState->beginSection('PS2S');
else
savedState->beginSection('SUBS');
strSize = savedState->readLESint32();
savedState->read(str, strSize);
savedState->endSection();
saveList.push_back(SaveStateDescriptor(slotNum, str));
}
delete savedState;
}
}
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例15: listSaves
SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
Common::StringArray filenames;
SaveStateList saveList;
// Loading games is only supported in Myst/Riven currently.
#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
filenames = g_system->getSavefileManager()->listSavefiles("myst-###.mys");
size_t prefixLen = sizeof("myst") - 1;
for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
// Extract the slot number from the filename
char slot[4];
slot[0] = (*filename)[prefixLen + 1];
slot[1] = (*filename)[prefixLen + 2];
slot[2] = (*filename)[prefixLen + 3];
slot[3] = '\0';
int slotNum = atoi(slot);
// Read the description from the save
Common::String description = Mohawk::MystGameState::querySaveDescription(slotNum);
saveList.push_back(SaveStateDescriptor(slotNum, description));
}
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
} else
#endif
if (strstr(target, "riven")) {
filenames = g_system->getSavefileManager()->listSavefiles("*.rvn");
for (uint32 i = 0; i < filenames.size(); i++)
saveList.push_back(SaveStateDescriptor(i, filenames[i]));
}
return saveList;
}