Decompile fn_07870 (CGifRes::DecodeGif)

Batch #12438 by Yommy: 0 byte-identical, 1 confirmed by peer review.

- fn_07870 CGifRes::DecodeGif: logic confirmed by peer review

Peer-reviewed-by: KWDev, SapitoSucio, dori, cremane
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-05 15:15:26 +00:00
commit 327967cc1e
3 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
#include "Resource/GifLzw.h"
#include "Resource/GifResource.h"
#include <cstdlib>

View file

@ -1,7 +1,6 @@
#include "Resource/GifResource.h"
#include "File/File.h"
#include "Resource/GifLzw.h"
#include <algorithm>
#include <cstring>
@ -47,8 +46,8 @@ namespace {
// INLINED
bool IsGifSignature(const void* data) {
const auto* bytes = static_cast<const unsigned char*>(data);
return bytes[0] == 'G' && bytes[1] == 'I' && bytes[2] == 'F';
constexpr char signature[] = {'G', 'I', 'F'};
return std::memcmp(data, signature, sizeof(signature)) == 0;
}
}
@ -295,7 +294,7 @@ bool CGifRes::DecodeGif(const void* data, int bytes, bool iconOnly) {
++cursor;
unsigned char* indices = new unsigned char[descriptor.width * descriptor.height];
if (DecodeGifLzw(minimumCodeSize, compressed, compressedBytes, indices) > 0) {
if (this->DecodeGifLzw(minimumCodeSize, compressed, compressedBytes, indices) > 0) {
const unsigned int pixelCount = screenHeight * screenWidth;
std::uint32_t* pixels = new std::uint32_t[pixelCount];

View file

@ -23,6 +23,7 @@ public:
void CreateBlank(int width, int height);
bool DecodeGif(const void* data, int bytes, bool iconOnly);
int DecodeGifLzw(int minimumCodeSize, const unsigned char* input, int inputBytes, unsigned char* output);
/* 0124 */ std::vector<Frame> frames;
/* 0130 */ std::uint16_t loopCount;