Skip to content

Commit

Permalink
Added a way to limit the number of total primitives to load at startu…
Browse files Browse the repository at this point in the history
…p 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).
  • Loading branch information
Vitty85 committed Aug 12, 2021
1 parent ecc5ddf commit 1e0928b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions projects/mtg/src/MTGDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> 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);

Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 1e0928b

Please sign in to comment.