From 57b9ad0d95835299da6914943b3a93438b122c0a Mon Sep 17 00:00:00 2001 From: Dan Sumorok Date: Sun, 5 May 2013 14:11:09 -0400 Subject: [PATCH 1/2] Remove 15 bit video for OS X. This mode doesn't seem to work. This also fixes 2-bit, 4-bit, and 8-bit modes. --- BasiliskII/src/Unix/video_x.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BasiliskII/src/Unix/video_x.cpp b/BasiliskII/src/Unix/video_x.cpp index 6f8ef67f7..b02e28546 100644 --- a/BasiliskII/src/Unix/video_x.cpp +++ b/BasiliskII/src/Unix/video_x.cpp @@ -1637,6 +1637,12 @@ bool VideoInit(bool classic) return false; } std::sort(avail_depths, avail_depths + num_depths); + +#ifdef __APPLE__ + // 15-bit color does not seem to work on OS X + int *last = std::remove(avail_depths, avail_depths + num_depths, 15); + num_depths = ( (size_t)last - (size_t)avail_depths ) / sizeof(int); +#endif #ifdef ENABLE_FBDEV_DGA // Frame buffer name From 241162f261e1d68d698cb39e61915d59cdfc24c9 Mon Sep 17 00:00:00 2001 From: Dan Sumorok Date: Sun, 5 May 2013 16:20:37 -0400 Subject: [PATCH 2/2] Fixed code that removed 15-bit color mode. 15-bit color mode is now removed on all platforms. The removal of 15-bit color mode now happens before the sort. Updated a variable name. Changed list length calculation to use C++'s clever pointer subtraction. --- BasiliskII/src/Unix/video_x.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/BasiliskII/src/Unix/video_x.cpp b/BasiliskII/src/Unix/video_x.cpp index b02e28546..6f8be92aa 100644 --- a/BasiliskII/src/Unix/video_x.cpp +++ b/BasiliskII/src/Unix/video_x.cpp @@ -1636,13 +1636,12 @@ bool VideoInit(bool classic) ErrorAlert(STR_UNSUPP_DEPTH_ERR); return false; } - std::sort(avail_depths, avail_depths + num_depths); -#ifdef __APPLE__ // 15-bit color does not seem to work on OS X - int *last = std::remove(avail_depths, avail_depths + num_depths, 15); - num_depths = ( (size_t)last - (size_t)avail_depths ) / sizeof(int); -#endif + int *list_end = std::remove(avail_depths, avail_depths + num_depths, + 15); + num_depths = list_end - avail_depths; + std::sort(avail_depths, avail_depths + num_depths); #ifdef ENABLE_FBDEV_DGA // Frame buffer name