mirror of
https://github.com/NovaSquirrel/Mesen-X.git
synced 2024-05-31 18:38:15 -04:00
Fix random background
This commit is contained in:
parent
ecc5a8ded5
commit
2e676c1c65
|
@ -658,7 +658,7 @@ void HdPackLoader::ProcessConditionTag(vector<string> &tokens, bool createInvert
|
|||
checkConstraint(_data->Version >= 106, "[HDPack] This feature requires version 106+ of HD Packs");
|
||||
checkConstraint(tokens.size() >= 3, "[HDPack] Condition tag should contain at least 3 parameters");
|
||||
|
||||
int32_t operandA;
|
||||
float operandA;
|
||||
operandA = std::stof(tokens[index++]);
|
||||
|
||||
((HdPackRandomBackgroundCondition*)condition.get())->Initialize(operandA);
|
||||
|
|
|
@ -68,7 +68,7 @@ void HdPpu::DrawPixel()
|
|||
tileInfo.EmphasisBits = _intensifyColorBits >> 6;
|
||||
tileInfo.Tile.PpuBackgroundColor = ReadPaletteRAM(0);
|
||||
tileInfo.Tile.BgColorIndex = backgroundColor;
|
||||
tileInfo.Tile.nameTableIdx = _state.VideoRamAddr;
|
||||
tileInfo.Tile.nameTableIdx = _state.bgTileAddr;
|
||||
|
||||
if(backgroundColor == 0) {
|
||||
tileInfo.Tile.BgColor = tileInfo.Tile.PpuBackgroundColor;
|
||||
|
@ -263,6 +263,13 @@ HdPpu::HdPpu(shared_ptr<Console> console, HdPackData * hdData) : PPU(console)
|
|||
_screenInfo[0] = new HdScreenInfo(isChrRamGame);
|
||||
_screenInfo[1] = new HdScreenInfo(isChrRamGame);
|
||||
_info = _screenInfo[0];
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 mt(rd());
|
||||
std::uniform_real_distribution<> dist(0, 1);
|
||||
for (uint16_t i = 0; i < 0x1000; i++) {
|
||||
_nameTableRandVal[i] = dist(mt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -666,10 +666,12 @@ void PPU::LoadTileInfo()
|
|||
|
||||
_state.LowBitShift |= _nextTile.LowByte;
|
||||
_state.HighBitShift |= _nextTile.HighByte;
|
||||
_state.bgTileAddr = _nextTile.bgTileAddr;
|
||||
|
||||
uint8_t tileIndex = ReadVram(GetNameTableAddr());
|
||||
_nextTile.TileAddr = (tileIndex << 4) | (_state.VideoRamAddr >> 12) | _flags.BackgroundPatternAddr;
|
||||
_nextTile.OffsetY = _state.VideoRamAddr >> 12;
|
||||
_nextTile.bgTileAddr = _state.VideoRamAddr & 0x0FFF;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ struct PPUState
|
|||
uint16_t TmpVideoRamAddr;
|
||||
bool WriteToggle;
|
||||
|
||||
uint16_t bgTileAddr; //used by HD ppu
|
||||
uint16_t HighBitShift;
|
||||
uint16_t LowBitShift;
|
||||
};
|
||||
|
@ -177,6 +178,7 @@ struct TileInfo
|
|||
|
||||
int32_t AbsoluteTileAddr; //used by HD ppu
|
||||
uint8_t OffsetY; //used by HD ppu
|
||||
uint16_t bgTileAddr; //used by HD ppu
|
||||
};
|
||||
|
||||
struct SpriteInfo : TileInfo
|
||||
|
|
Loading…
Reference in a new issue