From e62be036739f5bf7f6d8ab2c60716fb787ec79b5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 10 Dec 2016 19:10:33 -0500 Subject: [PATCH] Removed endianness assumption. --- Machines/Oric/Video.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index 320cbd34b..81281022d 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -63,6 +63,16 @@ void VideoOutput::set_colour_rom(const std::vector &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 VideoOutput::get_crt()