Sanity checks for shadow glyphs

Partially fixes text, huds and videos in Jeanne d'Arc.
These changes shouldn't negatively impact other games since all it does is makes sure shadow glyphs are within the vector sizes.
The text, huds and videos still don't fully display, but that's because of something else.
This commit is contained in:
CPkmn 2013-08-09 17:52:01 -07:00
parent e03acc4c58
commit c067c48585

View File

@ -221,9 +221,9 @@ void PGF::ReadPtr(const u8 *ptr, size_t dataSize) {
// And shadow glyphs.
for (size_t i = 0; i < shadowGlyphs.size(); i++) {
size_t shadowId = glyphs[i].shadowID;
if (shadowId < shadowMap.size()) {
if ((shadowId >= 0) && (shadowId < shadowMap.size()) && (shadowId < shadowGlyphs.size())) {
size_t charId = shadowMap[shadowId];
if (charId < glyphs.size()) {
if ((charId >= 0) && (charId < glyphs.size())) {
// TODO: check for pre existing shadow glyph
GetGlyph(fontData, charPointers[charId] * 4 * 8 /* ??? */, FONT_PGF_SHADOWGLYPH, shadowGlyphs[i]);
}
@ -578,4 +578,4 @@ u32 GetFontPixelColor(int color, int pixelformat) {
}
return color;
}
}