From 1e0928b2277b2797dfab8f8025664128ce276b37 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Thu, 12 Aug 2021 19:10:48 +0200 Subject: [PATCH] Added a way to limit the number of total primitives to load at startup using a file named LimitedCardList.txt (that has to be copied in User folder). This should help to run the game even on older devices with low RAM such as PSP-3000 and PSVita (with Adrenaline). --- projects/mtg/src/MTGDeck.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index a9c5053f7..b8a85616b 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -474,6 +474,19 @@ int MTGAllCards::load(const string& config_file, const string &set_name) int MTGAllCards::load(const string &config_file, int set_id) { + izfstream limitedFile; + vector limitedCardList; + if (JFileSystem::GetInstance()->openForRead(limitedFile, "LimitedCardList.txt")) + { + string limitedLine; + while (getline(limitedFile,limitedLine)) + { + if (limitedLine.size()) + limitedCardList.push_back(limitedLine); + } + } + limitedFile.close(); + conf_read_mode = 0; MTGSetInfo *si = setlist.getInfo(set_id); @@ -543,6 +556,16 @@ int MTGAllCards::load(const string &config_file, int set_id) if (s[0] == '[' && s[1] == '/') { conf_read_mode = MTGAllCards::READ_ANYTHING; + if (limitedCardList.size() && tempPrimitive){ + bool found = false; + for(size_t i = 0; i < limitedCardList.size(); i++) + if(limitedCardList.at(i) == tempPrimitive->name) + found = true; + if(!found){ + tempCard = NULL; + tempPrimitive = NULL; + } + } if (tempPrimitive) tempPrimitive = addPrimitive(tempPrimitive, tempCard); if (tempCard) {