HD Packs: Fixed crash when attempting to load invalid condition tags + fixed bug where built-in conditions were being saved to the hires.txt file
This commit is contained in:
parent
6726e9e5a9
commit
503806ee22
3 changed files with 13 additions and 2 deletions
|
@ -123,6 +123,7 @@ struct HdPackCondition
|
|||
uint32_t PaletteColors;
|
||||
int32_t TileIndex;
|
||||
uint8_t TileData[16];
|
||||
bool IsBuiltInCondition;
|
||||
|
||||
bool CheckCondition(HdPpuPixelInfo *screenTiles, int x, int y, HdPpuTileInfo* tile)
|
||||
{
|
||||
|
|
|
@ -327,7 +327,9 @@ void HdPackBuilder::SaveHdPack()
|
|||
savePng(-1);
|
||||
|
||||
for(unique_ptr<HdPackCondition> &condition : _hdData.Conditions) {
|
||||
ss << condition->ToString() << std::endl;
|
||||
if(!condition->IsBuiltInCondition) {
|
||||
ss << condition->ToString() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(HdBackgroundInfo &bgInfo : _hdData.Backgrounds) {
|
||||
|
|
|
@ -205,16 +205,19 @@ void HdPackLoader::InitializeGlobalConditions()
|
|||
HdPackCondition* hmirror = new HdPackCondition();
|
||||
hmirror->Name = "hmirror";
|
||||
hmirror->Type = HdPackConditionType::HorizontalMirroring;
|
||||
hmirror->IsBuiltInCondition = true;
|
||||
_data->Conditions.push_back(unique_ptr<HdPackCondition>(hmirror));
|
||||
|
||||
HdPackCondition* vmirror = new HdPackCondition();
|
||||
vmirror->Name = "vmirror";
|
||||
vmirror->Type = HdPackConditionType::VerticalMirroring;
|
||||
vmirror->IsBuiltInCondition = true;
|
||||
_data->Conditions.push_back(unique_ptr<HdPackCondition>(vmirror));
|
||||
|
||||
HdPackCondition* bgpriority = new HdPackCondition();
|
||||
bgpriority->Name = "bgpriority";
|
||||
bgpriority->Type = HdPackConditionType::BackgroundPriority;
|
||||
bgpriority->IsBuiltInCondition = true;
|
||||
_data->Conditions.push_back(unique_ptr<HdPackCondition>(bgpriority));
|
||||
}
|
||||
|
||||
|
@ -340,6 +343,11 @@ void HdPackLoader::ProcessOptionTag(vector<string> &tokens)
|
|||
|
||||
void HdPackLoader::ProcessConditionTag(vector<string> &tokens)
|
||||
{
|
||||
if(tokens.size() < 7) {
|
||||
MessageManager::Log("[HDPack] Invalid condition tag");
|
||||
return;
|
||||
}
|
||||
|
||||
HdPackCondition *condition = new HdPackCondition();
|
||||
tokens[0].erase(tokens[0].find_last_not_of(" \n\r\t") + 1);
|
||||
condition->Name = tokens[0];
|
||||
|
@ -377,7 +385,7 @@ void HdPackLoader::ProcessConditionTag(vector<string> &tokens)
|
|||
}
|
||||
|
||||
condition->PaletteColors = HexUtilities::FromHex(tokens[index++]);
|
||||
|
||||
condition->IsBuiltInCondition = false;
|
||||
_data->Conditions.push_back(unique_ptr<HdPackCondition>(condition));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue