Fix dynarec on OSX/x64. Clean exit when window closed.

This commit is contained in:
Flyinghead 2018-07-24 13:26:31 +02:00
parent 07a36ee256
commit b28e1505c5
3 changed files with 17 additions and 8 deletions

View File

@ -430,7 +430,10 @@ void _vmem_bm_reset() {
#endif #endif
} }
if (!virt_ram_base || HOST_OS == OS_DARWIN) { #ifndef TARGET_IPHONE
if (!virt_ram_base)
#endif
{
bm_vmem_pagefill((void**)p_sh4rcb->fpcb, FPCB_SIZE); bm_vmem_pagefill((void**)p_sh4rcb->fpcb, FPCB_SIZE);
} }
} }
@ -624,7 +627,7 @@ void _vmem_bm_reset_nvmem()
return; return;
#endif #endif
#if (HOST_OS == OS_DARWIN) #ifdef TARGET_IPHONE
//On iOS & nacl we allways allocate all of the mapping table //On iOS & nacl we allways allocate all of the mapping table
mprotect(p_sh4rcb, sizeof(p_sh4rcb->fpcb), PROT_READ | PROT_WRITE); mprotect(p_sh4rcb, sizeof(p_sh4rcb->fpcb), PROT_READ | PROT_WRITE);
return; return;

View File

@ -47,10 +47,8 @@ void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) {
printf("SIGILL @ %08X, fault_handler+0x%08X ... %08X -> was not in vram, %d\n", pc, pc - (unat)sigill_handler, (unat)si->si_addr, dyna_cde); printf("SIGILL @ %08X, fault_handler+0x%08X ... %08X -> was not in vram, %d\n", pc, pc - (unat)sigill_handler, (unat)si->si_addr, dyna_cde);
printf("Entering infiniloop"); //printf("PC is used here %08X\n", pc);
kill(getpid(), SIGABRT);
for (;;);
printf("PC is used here %08X\n", pc);
} }
#endif #endif

View File

@ -8,7 +8,7 @@
import Cocoa import Cocoa
class EmuGLView: NSOpenGLView { class EmuGLView: NSOpenGLView, NSWindowDelegate {
override var acceptsFirstResponder: Bool { override var acceptsFirstResponder: Bool {
return true; return true;
@ -72,4 +72,12 @@ class EmuGLView: NSOpenGLView {
emu_key_input(e.keyCode, 0); emu_key_input(e.keyCode, 0);
} }
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
self.window!.delegate = self
}
func windowWillClose(_ notification: Notification) {
emu_shutdown()
}
} }