Add HD pack conditions for matching which sprite palette is being used
The condition names are sppalette0, sppalette1, sppalette2, sppalette3
This commit is contained in:
parent
dd7d58732a
commit
2f25f2fc70
4 changed files with 83 additions and 0 deletions
|
@ -90,6 +90,7 @@ struct HdPpuTileInfo : public HdTileKey
|
||||||
uint8_t BgColor;
|
uint8_t BgColor;
|
||||||
uint8_t SpriteColor;
|
uint8_t SpriteColor;
|
||||||
uint8_t PpuBackgroundColor;
|
uint8_t PpuBackgroundColor;
|
||||||
|
uint32_t PaletteOffset;
|
||||||
|
|
||||||
uint8_t OAMIndex;
|
uint8_t OAMIndex;
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,6 +135,55 @@ struct HdPackBgPriorityCondition : public HdPackCondition
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HdPackSpPalette0Condition : public HdPackCondition
|
||||||
|
{
|
||||||
|
string GetConditionName() override { return "sppalette0"; }
|
||||||
|
string ToString() override { return ""; }
|
||||||
|
bool IsExcludedFromFile() override { return true; }
|
||||||
|
|
||||||
|
bool InternalCheckCondition(HdScreenInfo* screenInfo, int x, int y, HdPpuTileInfo* tile) override
|
||||||
|
{
|
||||||
|
return tile && ((0x03 & (tile->PaletteOffset >> 2)) == 0x00);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HdPackSpPalette1Condition : public HdPackCondition
|
||||||
|
{
|
||||||
|
string GetConditionName() override { return "sppalette1"; }
|
||||||
|
string ToString() override { return ""; }
|
||||||
|
bool IsExcludedFromFile() override { return true; }
|
||||||
|
|
||||||
|
bool InternalCheckCondition(HdScreenInfo* screenInfo, int x, int y, HdPpuTileInfo* tile) override
|
||||||
|
{
|
||||||
|
return tile && ((0x03 & (tile->PaletteOffset >> 2)) == 0x01);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HdPackSpPalette2Condition : public HdPackCondition
|
||||||
|
{
|
||||||
|
string GetConditionName() override { return "sppalette2"; }
|
||||||
|
string ToString() override { return ""; }
|
||||||
|
bool IsExcludedFromFile() override { return true; }
|
||||||
|
|
||||||
|
bool InternalCheckCondition(HdScreenInfo* screenInfo, int x, int y, HdPpuTileInfo* tile) override
|
||||||
|
{
|
||||||
|
return tile && ((0x03 & (tile->PaletteOffset >> 2)) == 0x02);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HdPackSpPalette3Condition : public HdPackCondition
|
||||||
|
{
|
||||||
|
string GetConditionName() override { return "sppalette3"; }
|
||||||
|
string ToString() override { return ""; }
|
||||||
|
bool IsExcludedFromFile() override { return true; }
|
||||||
|
|
||||||
|
bool InternalCheckCondition(HdScreenInfo* screenInfo, int x, int y, HdPpuTileInfo* tile) override
|
||||||
|
{
|
||||||
|
return tile && ((0x03 & (tile->PaletteOffset >> 2)) == 0x03);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct HdPackMemoryCheckCondition : public HdPackBaseMemoryCondition
|
struct HdPackMemoryCheckCondition : public HdPackBaseMemoryCondition
|
||||||
{
|
{
|
||||||
HdPackMemoryCheckCondition() { _useCache = true; }
|
HdPackMemoryCheckCondition() { _useCache = true; }
|
||||||
|
|
|
@ -273,6 +273,38 @@ void HdPackLoader::InitializeGlobalConditions()
|
||||||
HdPackCondition* invBgpriority = new HdPackBgPriorityCondition();
|
HdPackCondition* invBgpriority = new HdPackBgPriorityCondition();
|
||||||
invBgpriority->Name = "!bgpriority";
|
invBgpriority->Name = "!bgpriority";
|
||||||
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invBgpriority));
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invBgpriority));
|
||||||
|
|
||||||
|
HdPackCondition* sppalette0 = new HdPackSpPalette0Condition();
|
||||||
|
sppalette0->Name = "sppalette0";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(sppalette0));
|
||||||
|
|
||||||
|
HdPackCondition* invSppalette0 = new HdPackSpPalette0Condition();
|
||||||
|
invSppalette0->Name = "!sppalette0";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invSppalette0));
|
||||||
|
|
||||||
|
HdPackCondition* sppalette1 = new HdPackSpPalette1Condition();
|
||||||
|
sppalette1->Name = "sppalette1";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(sppalette1));
|
||||||
|
|
||||||
|
HdPackCondition* invSppalette1 = new HdPackSpPalette1Condition();
|
||||||
|
invSppalette1->Name = "!sppalette1";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invSppalette1));
|
||||||
|
|
||||||
|
HdPackCondition* sppalette2 = new HdPackSpPalette2Condition();
|
||||||
|
sppalette2->Name = "sppalette2";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(sppalette2));
|
||||||
|
|
||||||
|
HdPackCondition* invSppalette2 = new HdPackSpPalette2Condition();
|
||||||
|
invSppalette2->Name = "!sppalette2";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invSppalette2));
|
||||||
|
|
||||||
|
HdPackCondition* sppalette3 = new HdPackSpPalette3Condition();
|
||||||
|
sppalette3->Name = "sppalette3";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(sppalette3));
|
||||||
|
|
||||||
|
HdPackCondition* invSppalette3 = new HdPackSpPalette3Condition();
|
||||||
|
invSppalette3->Name = "!sppalette3";
|
||||||
|
_data->Conditions.push_back(unique_ptr<HdPackCondition>(invSppalette3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HdPackLoader::ProcessOverscanTag(vector<string> &tokens)
|
void HdPackLoader::ProcessOverscanTag(vector<string> &tokens)
|
||||||
|
|
|
@ -96,6 +96,7 @@ void HdPpu::DrawPixel()
|
||||||
} else {
|
} else {
|
||||||
tileInfo.Sprite[j].SpriteColor = ReadPaletteRAM(sprite.PaletteOffset + tileInfo.Sprite[j].SpriteColorIndex);
|
tileInfo.Sprite[j].SpriteColor = ReadPaletteRAM(sprite.PaletteOffset + tileInfo.Sprite[j].SpriteColorIndex);
|
||||||
}
|
}
|
||||||
|
tileInfo.Sprite[j].PaletteOffset = sprite.PaletteOffset;
|
||||||
|
|
||||||
tileInfo.Sprite[j].PpuBackgroundColor = tileInfo.Tile.PpuBackgroundColor;
|
tileInfo.Sprite[j].PpuBackgroundColor = tileInfo.Tile.PpuBackgroundColor;
|
||||||
tileInfo.Sprite[j].BgColorIndex = tileInfo.Tile.BgColorIndex;
|
tileInfo.Sprite[j].BgColorIndex = tileInfo.Tile.BgColorIndex;
|
||||||
|
|
Loading…
Add table
Reference in a new issue