|
jjPAL(...).load(): possibly false positive detection of no GIF global color table?
Save this as a mutator and test on a local server. Pay attention to chatlogger for angelscript warnings.
Code:
// Reference: https://en.wikipedia.org/wiki/GIF#Example_GIF_file
// Reference: https://giflib.sourceforge.net/whatsinagif/bits_and_bytes.html
bool hasGlobalColorTable(string filename) {
jjSTREAM dat(filename);
if (dat.getSize() < 13) {
return false;
}
string magic;
dat.get(magic, 6);
if (magic != "GIF89a") {
return false;
}
dat.discard(2); // discard logical screen width
dat.discard(2); // discard logical screen height
uint8 gctFlags;
dat.pop(gctFlags);
if (gctFlags & 0x80 != 0) { // "the highest true bit means that the GCT is present"
return true;
}
return false;
}
void onLevelBegin() {
jjConsole("Test GIFs by typing a filename in chat");
}
bool onLocalChat(string &in stringReceived, CHAT::Type) {
bool res1 = jjPAL().load(stringReceived);
bool res2 = hasGlobalColorTable(stringReceived);
if (res1 != res2) {
jjAlert("jjPAL().load(...) != hasGlobalColorTable(...)");
jjAlert(" " + res1 + " != " + res2);
}
return true;
}
|