From d906fb23b0b417df8527f416a4f3206bcb8e282c Mon Sep 17 00:00:00 2001 From: kanjitalk755 Date: Mon, 10 Aug 2020 13:01:22 +0900 Subject: [PATCH] CD fix default palette --- BasiliskII/src/CrossPlatform/sigsegv.cpp | 7 +++---- BasiliskII/src/SDL/video_sdl2.cpp | 5 +++++ BasiliskII/src/cdrom.cpp | 2 ++ SheepShaver/src/CrossPlatform/sigsegv.cpp | 7 +++---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp index bd089de9..73ca8330 100755 --- a/BasiliskII/src/CrossPlatform/sigsegv.cpp +++ b/BasiliskII/src/CrossPlatform/sigsegv.cpp @@ -2501,10 +2501,9 @@ static bool arm_skip_instruction(unsigned long * regs) #ifdef _STRUCT_ARM_THREAD_STATE64 static bool aarch64_skip_instruction(unsigned long *regs) { - _STRUCT_ARM_THREAD_STATE64 t; - const int PC = &t.__pc - &t.__x[0]; - if (!regs[PC]) return false; - regs[PC] += 4; + _STRUCT_ARM_THREAD_STATE64 *ts = (_STRUCT_ARM_THREAD_STATE64 *)regs; + if (!ts->__pc) return false; + ts->__pc += 4; return true; } #endif diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 85b14e85..a17921a6 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -1030,6 +1030,11 @@ void driver_base::init() set_mac_frame_buffer(monitor, VIDEO_MODE_DEPTH, true); adapt_to_video_mode(); + + // set default B/W palette + sdl_palette = SDL_AllocPalette(256); + sdl_palette->colors[1] = (SDL_Color){ .r = 0, .g = 0, .b = 0 }; + SDL_SetSurfacePalette(s, sdl_palette); } void driver_base::adapt_to_video_mode() { diff --git a/BasiliskII/src/cdrom.cpp b/BasiliskII/src/cdrom.cpp index 36250297..ee8d2350 100644 --- a/BasiliskII/src/cdrom.cpp +++ b/BasiliskII/src/cdrom.cpp @@ -539,6 +539,7 @@ int16 CDROMControl(uint32 pb, uint32 dce) // Audio calls tend to end up without correct reference // Real mac would just play first disc, but we can guess correct one from last data call info = get_drive_info(last_drive_num); + if (info == drives.end()) return nsDrvErr; } } @@ -1071,6 +1072,7 @@ int16 CDROMStatus(uint32 pb, uint32 dce) return nsDrvErr; } else { info = get_drive_info(last_drive_num); + if (info == drives.end()) return nsDrvErr; } } diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index f26c476a..d117366e 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -2501,10 +2501,9 @@ static bool arm_skip_instruction(unsigned long * regs) #ifdef _STRUCT_ARM_THREAD_STATE64 static bool aarch64_skip_instruction(unsigned long *regs) { - _STRUCT_ARM_THREAD_STATE64 t; - const int PC = &t.__pc - &t.__x[0]; - if (!regs[PC]) return false; - regs[PC] += 4; + _STRUCT_ARM_THREAD_STATE64 *ts = (_STRUCT_ARM_THREAD_STATE64 *)regs; + if (!ts->__pc) return false; + ts->__pc += 4; return true; } #endif