mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
NES: HD Packs - Fixed display issues (transparency, missing tiles)
This commit is contained in:
parent
90ae21e1ac
commit
ace23978f7
4 changed files with 7 additions and 2 deletions
|
@ -318,7 +318,7 @@ public:
|
||||||
uint32_t* pngData = Bitmap->PixelData.data();
|
uint32_t* pngData = Bitmap->PixelData.data();
|
||||||
|
|
||||||
HdTileData.resize(Width * Height);
|
HdTileData.resize(Width * Height);
|
||||||
if(Bitmap->PixelData.size() >= bitmapOffset + (Height * Bitmap->Width) + Width) {
|
if(Bitmap->PixelData.size() >= bitmapOffset + ((Height - 1) * Bitmap->Width) + Width) {
|
||||||
for(uint32_t y = 0; y < Height; y++) {
|
for(uint32_t y = 0; y < Height; y++) {
|
||||||
memcpy(HdTileData.data() + (y * Width), pngData + bitmapOffset, Width * sizeof(uint32_t));
|
memcpy(HdTileData.data() + (y * Width), pngData + bitmapOffset, Width * sizeof(uint32_t));
|
||||||
bitmapOffset += Bitmap->Width;
|
bitmapOffset += Bitmap->Width;
|
||||||
|
|
|
@ -156,6 +156,10 @@ void HdNesPack::OnLineStart(HdPpuPixelInfo &lineFirstPixel, uint8_t y)
|
||||||
for(int layer = 0; layer < 4; layer++) {
|
for(int layer = 0; layer < 4; layer++) {
|
||||||
for(int i = 0; i < _activeBgCount[layer]; i++) {
|
for(int i = 0; i < _activeBgCount[layer]; i++) {
|
||||||
HdBgConfig& cfg = _bgConfig[layer * HdNesPack::PriorityLevelsPerLayer + i];
|
HdBgConfig& cfg = _bgConfig[layer * HdNesPack::PriorityLevelsPerLayer + i];
|
||||||
|
if(cfg.BackgroundIndex < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
HdBackgroundInfo& bgInfo = _hdData->Backgrounds[cfg.BackgroundIndex];
|
HdBackgroundInfo& bgInfo = _hdData->Backgrounds[cfg.BackgroundIndex];
|
||||||
bgInfo.Data->Init();
|
bgInfo.Data->Init();
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,7 @@ bool HdPackLoader::ProcessImgTag(string src)
|
||||||
MessageManager::Log("[HDPack] Error loading HDPack: PNG file " + src + " could not be read.");
|
MessageManager::Log("[HDPack] Error loading HDPack: PNG file " + src + " could not be read.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bitmapInfo.PngName = src;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ int PNGHelper::DecodePNG(vector<T>& out_image, unsigned long& image_width, unsig
|
||||||
|
|
||||||
out_image.resize(out_size / sizeof(T));
|
out_image.resize(out_size / sizeof(T));
|
||||||
|
|
||||||
if((r = spng_decode_image(ctx, (unsigned char*)out_image.data(), out_size, fmt, 0))) {
|
if((r = spng_decode_image(ctx, (unsigned char*)out_image.data(), out_size, fmt, SPNG_DECODE_TRNS))) {
|
||||||
spng_ctx_free(ctx);
|
spng_ctx_free(ctx);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue