1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Removed endianness assumption.

This commit is contained in:
Thomas Harte 2016-12-10 19:10:33 -05:00
parent 34d213dec4
commit e62be03673

View File

@ -63,6 +63,16 @@ void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom)
rom_value = (rom_value & 0xff00) | ((rom_value >> 4)&0x000f) | ((rom_value << 4)&0x00f0);
colour_forms_[c] = rom_value;
}
// check for big endianness and byte swap if required
uint16_t test_value = 0x0001;
if(*(uint8_t *)&test_value != 0x01)
{
for(size_t c = 0; c < 8; c++)
{
colour_forms_[c] = (uint16_t)((colour_forms_[c] >> 8) | (colour_forms_[c] << 8));
}
}
}
std::shared_ptr<Outputs::CRT::CRT> VideoOutput::get_crt()