diff --git a/.gitignore b/.gitignore index 2a6e2f0c..4c203053 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,32 @@ # Mac OS X metadata *.DS_Store + +# +# Xcode gitignore settings are from https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore +# + +## Xcode, Build generated +build/ +DerivedData/ + +## Xcode, Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Xcode, Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +# +# JetBrains IDE settings +# +*.idea diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp old mode 100644 new mode 100755 diff --git a/BasiliskII/src/CrossPlatform/video_blit.cpp b/BasiliskII/src/CrossPlatform/video_blit.cpp old mode 100644 new mode 100755 index 3ff27b27..fc8bb451 --- a/BasiliskII/src/CrossPlatform/video_blit.cpp +++ b/BasiliskII/src/CrossPlatform/video_blit.cpp @@ -22,6 +22,10 @@ #include "video.h" #include "video_blit.h" +#if USE_SDL_VIDEO +#include +#endif + #include #include @@ -519,12 +523,21 @@ bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_or #else const bool use_sdl_video = false; #endif -#if REAL_ADDRESSING || DIRECT_ADDRESSING +#if REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO if (mac_depth == 1 && !use_sdl_video && !visual_format.fullscreen) { // Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines Screen_blit = Blit_Copy_Raw; +#if __MACOSX__ + // dludwig@pobox.com, HACK: This works on OSX (64-bit, at least), but not Linux (32-bit?). Why? + // To note, __MACOSX__ is an SDL-declared macro (for platform identification at compile time). + } else if (mac_depth == 16) { + + Screen_blit = Blit_Copy_Raw; + +#endif + } else { // Compute RGB shift values diff --git a/BasiliskII/src/CrossPlatform/video_vosf.h b/BasiliskII/src/CrossPlatform/video_vosf.h index 4a5677e1..f99b44bf 100644 --- a/BasiliskII/src/CrossPlatform/video_vosf.h +++ b/BasiliskII/src/CrossPlatform/video_vosf.h @@ -30,6 +30,12 @@ #include "util_windows.h" #endif +// Import SDL-backend-specific functions +#ifdef USE_SDL_VIDEO +extern void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h); +extern void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects); +#endif + // Glue for SDL and X11 support #ifdef TEST_VOSF_PERFORMANCE #define MONITOR_INIT /* nothing */ @@ -514,7 +520,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT) VIDEO_DRV_UNLOCK_PIXELS; #ifdef USE_SDL_VIDEO - SDL_UpdateRect(drv->s, 0, y1, VIDEO_MODE_X, height); + update_sdl_video(drv->s, 0, y1, VIDEO_MODE_X, height); #else if (VIDEO_DRV_HAVE_SHM) XShmPutImage(x_display, VIDEO_DRV_WINDOW, VIDEO_DRV_GC, VIDEO_DRV_IMAGE, 0, y1, 0, y1, VIDEO_MODE_X, height, 0); @@ -558,7 +564,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) i2 += scr_bytes_per_row; } #ifdef USE_SDL_VIDEO - SDL_UpdateRect(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y); + update_sdl_video(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y); #endif VIDEO_DRV_UNLOCK_PIXELS; return; @@ -664,7 +670,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) #endif } #ifdef USE_SDL_VIDEO - SDL_UpdateRects(drv->s, bbi, bb); + update_sdl_video(drv->s, bbi, bb); #endif VIDEO_DRV_UNLOCK_PIXELS; } diff --git a/BasiliskII/src/CrossPlatform/vm_alloc.cpp b/BasiliskII/src/CrossPlatform/vm_alloc.cpp old mode 100644 new mode 100755 diff --git a/BasiliskII/src/MacOSX/Assets.xcassets/AppIcon.appiconset/Contents.json b/BasiliskII/src/MacOSX/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..2db2b1c7 --- /dev/null +++ b/BasiliskII/src/MacOSX/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj new file mode 100644 index 00000000..aec36915 --- /dev/null +++ b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj @@ -0,0 +1,1595 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 4ECAC2671F8A8A5D0013B963 /* ether_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2661F8A8A5D0013B963 /* ether_unix.cpp */; }; + 4ECAC2681F8A8AE90013B963 /* bootp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2601F8A8A020013B963 /* bootp.c */; }; + 4ECAC2691F8A8AF10013B963 /* cksum.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2541F8A8A000013B963 /* cksum.c */; }; + 4ECAC26A1F8A8AF80013B963 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC23F1F8A89FE0013B963 /* debug.c */; }; + 4ECAC26B1F8A8B010013B963 /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2501F8A8A000013B963 /* if.c */; }; + 4ECAC26C1F8A8B120013B963 /* ip_icmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2441F8A89FE0013B963 /* ip_icmp.c */; }; + 4ECAC26D1F8A8B120013B963 /* ip_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2481F8A89FF0013B963 /* ip_input.c */; }; + 4ECAC26E1F8A8B120013B963 /* ip_output.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2471F8A89FF0013B963 /* ip_output.c */; }; + 4ECAC26F1F8A8B230013B963 /* mbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC24F1F8A89FF0013B963 /* mbuf.c */; }; + 4ECAC2701F8A8B230013B963 /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2401F8A89FE0013B963 /* misc.c */; }; + 4ECAC2711F8A8B350013B963 /* sbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC24A1F8A89FF0013B963 /* sbuf.c */; }; + 4ECAC2721F8A8B390013B963 /* slirp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC23D1F8A89FE0013B963 /* slirp.c */; }; + 4ECAC2731F8A8B390013B963 /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2431F8A89FE0013B963 /* socket.c */; }; + 4ECAC2741F8A8B480013B963 /* tcp_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC25E1F8A8A020013B963 /* tcp_input.c */; }; + 4ECAC2751F8A8B480013B963 /* tcp_output.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC24C1F8A89FF0013B963 /* tcp_output.c */; }; + 4ECAC2761F8A8B480013B963 /* tcp_subr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2571F8A8A000013B963 /* tcp_subr.c */; }; + 4ECAC2771F8A8B480013B963 /* tcp_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC24D1F8A89FF0013B963 /* tcp_timer.c */; }; + 4ECAC2781F8A8B4B0013B963 /* tftp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC2521F8A8A000013B963 /* tftp.c */; }; + 4ECAC2791F8A8B530013B963 /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECAC24E1F8A89FF0013B963 /* udp.c */; }; + 752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752F26F81F240E51001032B4 /* Foundation.framework */; }; + 752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752F26FA1F240E69001032B4 /* IOKit.framework */; }; + 752F27011F242BAF001032B4 /* prefs_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 752F27001F242BAF001032B4 /* prefs_sdl.cpp */; }; + 752F27031F242F51001032B4 /* xpram_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 752F27021F242F51001032B4 /* xpram_sdl.cpp */; }; + 752F27141F251B5C001032B4 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752F270D1F251B4A001032B4 /* SDL2.framework */; }; + 752F27151F251B5C001032B4 /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 752F270D1F251B4A001032B4 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 753252E91F535A0C0024025B /* build68k.c in Sources */ = {isa = PBXBuildFile; fileRef = 753252E51F5359040024025B /* build68k.c */; }; + 753252EE1F535DD10024025B /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = 753252ED1F535DD10024025B /* defs68k.c */; }; + 753253021F535F210024025B /* gencpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 753253011F535F210024025B /* gencpu.c */; }; + 753253151F5363400024025B /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = 753252ED1F535DD10024025B /* defs68k.c */; }; + 753253201F53650F0024025B /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */; }; + 753253311F5368370024025B /* cpuemu_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532C1F5368370024025B /* cpuemu_nf.cpp */; }; + 753253321F5368370024025B /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532D1F5368370024025B /* cpuemu.cpp */; }; + 753253331F5368370024025B /* cpustbl_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532E1F5368370024025B /* cpustbl_nf.cpp */; }; + 753253341F5368370024025B /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532F1F5368370024025B /* cpustbl.cpp */; }; + 753253351F53688D0024025B /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */; }; + 7539DFBF1F23B17E006B2DF2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7539DFBE1F23B17E006B2DF2 /* Assets.xcassets */; }; + 7539E1251F23B25A006B2DF2 /* adb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFC91F23B25A006B2DF2 /* adb.cpp */; }; + 7539E1261F23B25A006B2DF2 /* audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCA1F23B25A006B2DF2 /* audio.cpp */; }; + 7539E1271F23B25A006B2DF2 /* cdrom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCB1F23B25A006B2DF2 /* cdrom.cpp */; }; + 7539E1281F23B25A006B2DF2 /* sigsegv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCD1F23B25A006B2DF2 /* sigsegv.cpp */; }; + 7539E1291F23B25A006B2DF2 /* video_blit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCF1F23B25A006B2DF2 /* video_blit.cpp */; }; + 7539E12A1F23B25A006B2DF2 /* vm_alloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFD21F23B25A006B2DF2 /* vm_alloc.cpp */; }; + 7539E12B1F23B25A006B2DF2 /* disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFD41F23B25A006B2DF2 /* disk.cpp */; }; + 7539E12C1F23B25A006B2DF2 /* emul_op.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFD51F23B25A006B2DF2 /* emul_op.cpp */; }; + 7539E12D1F23B25A006B2DF2 /* ether.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFD61F23B25A006B2DF2 /* ether.cpp */; }; + 7539E12E1F23B25A006B2DF2 /* extfs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFD71F23B25A006B2DF2 /* extfs.cpp */; }; + 7539E12F1F23B25A006B2DF2 /* macos_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFF81F23B25A006B2DF2 /* macos_util.cpp */; }; + 7539E1301F23B25A006B2DF2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7539DFFA1F23B25A006B2DF2 /* Assets.xcassets */; }; + 7539E1341F23B25A006B2DF2 /* BasiliskII.icns in Resources */ = {isa = PBXBuildFile; fileRef = 7539E0021F23B25A006B2DF2 /* BasiliskII.icns */; }; + 7539E1381F23B25A006B2DF2 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E00A1F23B25A006B2DF2 /* Credits.html */; }; + 7539E13B1F23B25A006B2DF2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7539E00F1F23B25A006B2DF2 /* InfoPlist.strings */; }; + 7539E13E1F23B25A006B2DF2 /* HowTo.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E0141F23B25A006B2DF2 /* HowTo.html */; }; + 7539E14B1F23B25A006B2DF2 /* ToDo.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E02B1F23B25A006B2DF2 /* ToDo.html */; }; + 7539E14D1F23B25A006B2DF2 /* Versions.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E02E1F23B25A006B2DF2 /* Versions.html */; }; + 7539E16C1F23B25A006B2DF2 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0651F23B25A006B2DF2 /* main.cpp */; }; + 7539E16D1F23B25A006B2DF2 /* pict.c in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0681F23B25A006B2DF2 /* pict.c */; }; + 7539E16F1F23B25A006B2DF2 /* prefs_items.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E06C1F23B25A006B2DF2 /* prefs_items.cpp */; }; + 7539E1701F23B25A006B2DF2 /* prefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E06D1F23B25A006B2DF2 /* prefs.cpp */; }; + 7539E1711F23B25A006B2DF2 /* rom_patches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E06E1F23B25A006B2DF2 /* rom_patches.cpp */; }; + 7539E1721F23B25A006B2DF2 /* rsrc_patches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E06F1F23B25A006B2DF2 /* rsrc_patches.cpp */; }; + 7539E1731F23B25A006B2DF2 /* scsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0701F23B25A006B2DF2 /* scsi.cpp */; }; + 7539E1741F23B25A006B2DF2 /* audio_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0721F23B25A006B2DF2 /* audio_sdl.cpp */; }; + 7539E1751F23B25A006B2DF2 /* keycodes in Resources */ = {isa = PBXBuildFile; fileRef = 7539E0731F23B25A006B2DF2 /* keycodes */; }; + 7539E1781F23B25A006B2DF2 /* serial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0771F23B25A006B2DF2 /* serial.cpp */; }; + 7539E18D1F23B25A006B2DF2 /* slot_rom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */; }; + 7539E18E1F23B25A006B2DF2 /* sony.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A31F23B25A006B2DF2 /* sony.cpp */; }; + 7539E18F1F23B25A006B2DF2 /* timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A41F23B25A006B2DF2 /* timer.cpp */; }; + 7539E1901F23B25A006B2DF2 /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */; }; + 7539E1981F23B25A006B2DF2 /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0B51F23B25A006B2DF2 /* exceptions.cpp */; }; + 7539E1991F23B25A006B2DF2 /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0B71F23B25A006B2DF2 /* flags.cpp */; }; + 7539E19D1F23B25A006B2DF2 /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C21F23B25A006B2DF2 /* mathlib.cpp */; }; + 7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C41F23B25A006B2DF2 /* rounding.cpp */; }; + 7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C91F23B25A006B2DF2 /* memory.cpp */; }; + 7539E1A31F23B25A006B2DF2 /* table68k in Resources */ = {isa = PBXBuildFile; fileRef = 7539E0D11F23B25A006B2DF2 /* table68k */; }; + 7539E1E11F23B25A006B2DF2 /* user_strings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1221F23B25A006B2DF2 /* user_strings.cpp */; }; + 7539E1E21F23B25A006B2DF2 /* video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1231F23B25A006B2DF2 /* video.cpp */; }; + 7539E1E31F23B25A006B2DF2 /* xpram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1241F23B25A006B2DF2 /* xpram.cpp */; }; + 7539E23F1F23B32A006B2DF2 /* bincue_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */; }; + 7539E2451F23B32A006B2DF2 /* gtk-osx.patch in Resources */ = {isa = PBXBuildFile; fileRef = 7539E1F81F23B329006B2DF2 /* gtk-osx.patch */; }; + 7539E2471F23B32A006B2DF2 /* mkstandalone in Resources */ = {isa = PBXBuildFile; fileRef = 7539E1FA1F23B32A006B2DF2 /* mkstandalone */; }; + 7539E2491F23B32A006B2DF2 /* testlmem.sh in Resources */ = {isa = PBXBuildFile; fileRef = 7539E1FC1F23B32A006B2DF2 /* testlmem.sh */; }; + 7539E24A1F23B32A006B2DF2 /* disk_sparsebundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1FD1F23B32A006B2DF2 /* disk_sparsebundle.cpp */; }; + 7539E24C1F23B32A006B2DF2 /* extfs_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2001F23B32A006B2DF2 /* extfs_unix.cpp */; }; + 7539E24D1F23B32A006B2DF2 /* fbdevices in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2011F23B32A006B2DF2 /* fbdevices */; }; + 7539E2501F23B32A006B2DF2 /* install-sh in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2051F23B32A006B2DF2 /* install-sh */; }; + 7539E2541F23B32A006B2DF2 /* keycodes in Resources */ = {isa = PBXBuildFile; fileRef = 7539E20A1F23B32A006B2DF2 /* keycodes */; }; + 7539E2551F23B32A006B2DF2 /* freebsd-i386.ld in Resources */ = {isa = PBXBuildFile; fileRef = 7539E20C1F23B32A006B2DF2 /* freebsd-i386.ld */; }; + 7539E2561F23B32A006B2DF2 /* linux-i386.ld in Resources */ = {isa = PBXBuildFile; fileRef = 7539E20D1F23B32A006B2DF2 /* linux-i386.ld */; }; + 7539E2571F23B32A006B2DF2 /* linux-ppc.ld in Resources */ = {isa = PBXBuildFile; fileRef = 7539E20E1F23B32A006B2DF2 /* linux-ppc.ld */; }; + 7539E2581F23B32A006B2DF2 /* linux-x86_64.ld in Resources */ = {isa = PBXBuildFile; fileRef = 7539E20F1F23B32A006B2DF2 /* linux-x86_64.ld */; }; + 7539E25D1F23B32A006B2DF2 /* egrep.m4 in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2181F23B32A006B2DF2 /* egrep.m4 */; }; + 7539E25E1F23B32A006B2DF2 /* esd.m4 in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2191F23B32A006B2DF2 /* esd.m4 */; }; + 7539E25F1F23B32A006B2DF2 /* gettext.m4 in Resources */ = {isa = PBXBuildFile; fileRef = 7539E21A1F23B32A006B2DF2 /* gettext.m4 */; }; + 7539E2601F23B32A006B2DF2 /* gtk-2.0.m4 in Resources */ = {isa = PBXBuildFile; fileRef = 7539E21B1F23B32A006B2DF2 /* gtk-2.0.m4 */; }; + 7539E2611F23B32A006B2DF2 /* gtk.m4 in Resources */ = {isa = PBXBuildFile; fileRef = 7539E21C1F23B32A006B2DF2 /* gtk.m4 */; }; + 7539E2631F23B32A006B2DF2 /* Makefile.in in Resources */ = {isa = PBXBuildFile; fileRef = 7539E21E1F23B32A006B2DF2 /* Makefile.in */; }; + 7539E2641F23B32A006B2DF2 /* mkinstalldirs in Resources */ = {isa = PBXBuildFile; fileRef = 7539E21F1F23B32A006B2DF2 /* mkinstalldirs */; }; + 7539E2681F23B32A006B2DF2 /* rpc_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2241F23B32A006B2DF2 /* rpc_unix.cpp */; }; + 7539E26C1F23B32A006B2DF2 /* sshpty.c in Sources */ = {isa = PBXBuildFile; fileRef = 7539E22A1F23B32A006B2DF2 /* sshpty.c */; }; + 7539E26D1F23B32A006B2DF2 /* strlcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 7539E22C1F23B32A006B2DF2 /* strlcpy.c */; }; + 7539E26E1F23B32A006B2DF2 /* sys_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E22E1F23B32A006B2DF2 /* sys_unix.cpp */; }; + 7539E26F1F23B32A006B2DF2 /* timer_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2301F23B32A006B2DF2 /* timer_unix.cpp */; }; + 7539E2701F23B32A006B2DF2 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2311F23B32A006B2DF2 /* tinyxml2.cpp */; }; + 7539E2711F23B32A006B2DF2 /* tunconfig in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2331F23B32A006B2DF2 /* tunconfig */; }; + 7539E2801F23C4CA006B2DF2 /* main_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E27F1F23C4CA006B2DF2 /* main_unix.cpp */; }; + 7539E28E1F23C56F006B2DF2 /* clip_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2851F23C56F006B2DF2 /* clip_dummy.cpp */; }; + 7539E2911F23C56F006B2DF2 /* prefs_editor_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2881F23C56F006B2DF2 /* prefs_editor_dummy.cpp */; }; + 7539E2921F23C56F006B2DF2 /* scsi_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2891F23C56F006B2DF2 /* scsi_dummy.cpp */; }; + 7539E2931F23C56F006B2DF2 /* serial_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */; }; + 7539E2971F23C5FD006B2DF2 /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2961F23C5FD006B2DF2 /* newcpu.cpp */; }; + 7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */; }; + 7539E29F1F23C939006B2DF2 /* fpu_uae.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E29E1F23C939006B2DF2 /* fpu_uae.cpp */; }; + 7539E2AB1F23CDB7006B2DF2 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2AA1F23CDB7006B2DF2 /* Info.plist */; }; + 756C1B341F252FC100620917 /* utils_macosx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 756C1B331F252FC100620917 /* utils_macosx.mm */; }; + 756C1B391F25306A00620917 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 756C1B381F25306A00620917 /* AppKit.framework */; }; + 757A2BF01F5AF9D6003EDB01 /* user_strings_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 757A2BEF1F5AF9D6003EDB01 /* user_strings_unix.cpp */; }; + 75CBCF751F5DB3AD00830063 /* video_sdl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75CBCF741F5DB3AD00830063 /* video_sdl2.cpp */; }; + 75CBCF771F5DB65E00830063 /* video_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75CBCF761F5DB65E00830063 /* video_sdl.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 752F270C1F251B4A001032B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF66C0761BA81005FE872; + remoteInfo = Framework; + }; + 752F270E1F251B4A001032B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF6B30761BA81005FE872; + remoteInfo = "Static Library"; + }; + 752F27101F251B4A001032B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DB31407717554B71006C0E22; + remoteInfo = "Shared Library"; + }; + 752F27121F251B4A001032B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF6BE0761BA81005FE872; + remoteInfo = "Standard DMG"; + }; + 752F27161F251B5C001032B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = BECDF5FE0761BA81005FE872; + remoteInfo = Framework; + }; + 7532530B1F53611F0024025B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539DFAA1F23B17E006B2DF2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 753252D91F5358D30024025B; + remoteInfo = build68k; + }; + 7532531A1F5364030024025B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539DFAA1F23B17E006B2DF2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 753252F21F535E1E0024025B; + remoteInfo = gencpu; + }; + 7532531C1F53640B0024025B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539DFAA1F23B17E006B2DF2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 753253071F5360E30024025B; + remoteInfo = RunBuild68k; + }; + 7532531E1F5364170024025B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539DFAA1F23B17E006B2DF2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 753253161F5363D20024025B; + remoteInfo = RunGencpu; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 752F26F31F240140001032B4 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 752F27151F251B5C001032B4 /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 753252D81F5358D30024025B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 753252F11F535E1E0024025B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 4ECAC23D1F8A89FE0013B963 /* slirp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = slirp.c; path = ../../slirp/slirp.c; sourceTree = ""; }; + 4ECAC23E1F8A89FE0013B963 /* tcp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tcp.h; path = ../../slirp/tcp.h; sourceTree = ""; }; + 4ECAC23F1F8A89FE0013B963 /* debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = debug.c; path = ../../slirp/debug.c; sourceTree = ""; }; + 4ECAC2401F8A89FE0013B963 /* misc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = misc.c; path = ../../slirp/misc.c; sourceTree = ""; }; + 4ECAC2411F8A89FE0013B963 /* if.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = if.h; path = ../../slirp/if.h; sourceTree = ""; }; + 4ECAC2421F8A89FE0013B963 /* sbuf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = sbuf.h; path = ../../slirp/sbuf.h; sourceTree = ""; }; + 4ECAC2431F8A89FE0013B963 /* socket.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = socket.c; path = ../../slirp/socket.c; sourceTree = ""; }; + 4ECAC2441F8A89FE0013B963 /* ip_icmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ip_icmp.c; path = ../../slirp/ip_icmp.c; sourceTree = ""; }; + 4ECAC2451F8A89FE0013B963 /* socket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = socket.h; path = ../../slirp/socket.h; sourceTree = ""; }; + 4ECAC2461F8A89FE0013B963 /* udp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = udp.h; path = ../../slirp/udp.h; sourceTree = ""; }; + 4ECAC2471F8A89FF0013B963 /* ip_output.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ip_output.c; path = ../../slirp/ip_output.c; sourceTree = ""; }; + 4ECAC2481F8A89FF0013B963 /* ip_input.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ip_input.c; path = ../../slirp/ip_input.c; sourceTree = ""; }; + 4ECAC2491F8A89FF0013B963 /* icmp_var.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = icmp_var.h; path = ../../slirp/icmp_var.h; sourceTree = ""; }; + 4ECAC24A1F8A89FF0013B963 /* sbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = sbuf.c; path = ../../slirp/sbuf.c; sourceTree = ""; }; + 4ECAC24B1F8A89FF0013B963 /* slirp_config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = slirp_config.h; path = ../../slirp/slirp_config.h; sourceTree = ""; }; + 4ECAC24C1F8A89FF0013B963 /* tcp_output.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tcp_output.c; path = ../../slirp/tcp_output.c; sourceTree = ""; }; + 4ECAC24D1F8A89FF0013B963 /* tcp_timer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tcp_timer.c; path = ../../slirp/tcp_timer.c; sourceTree = ""; }; + 4ECAC24E1F8A89FF0013B963 /* udp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = udp.c; path = ../../slirp/udp.c; sourceTree = ""; }; + 4ECAC24F1F8A89FF0013B963 /* mbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = mbuf.c; path = ../../slirp/mbuf.c; sourceTree = ""; }; + 4ECAC2501F8A8A000013B963 /* if.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = if.c; path = ../../slirp/if.c; sourceTree = ""; }; + 4ECAC2511F8A8A000013B963 /* ip_icmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ip_icmp.h; path = ../../slirp/ip_icmp.h; sourceTree = ""; }; + 4ECAC2521F8A8A000013B963 /* tftp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tftp.c; path = ../../slirp/tftp.c; sourceTree = ""; }; + 4ECAC2531F8A8A000013B963 /* debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../../slirp/debug.h; sourceTree = ""; }; + 4ECAC2541F8A8A000013B963 /* cksum.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cksum.c; path = ../../slirp/cksum.c; sourceTree = ""; }; + 4ECAC2551F8A8A000013B963 /* tcp_var.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tcp_var.h; path = ../../slirp/tcp_var.h; sourceTree = ""; }; + 4ECAC2561F8A8A000013B963 /* slirp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = slirp.h; path = ../../slirp/slirp.h; sourceTree = ""; }; + 4ECAC2571F8A8A000013B963 /* tcp_subr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tcp_subr.c; path = ../../slirp/tcp_subr.c; sourceTree = ""; }; + 4ECAC2581F8A8A010013B963 /* ip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ip.h; path = ../../slirp/ip.h; sourceTree = ""; }; + 4ECAC2591F8A8A010013B963 /* bootp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = bootp.h; path = ../../slirp/bootp.h; sourceTree = ""; }; + 4ECAC25A1F8A8A010013B963 /* ctl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ctl.h; path = ../../slirp/ctl.h; sourceTree = ""; }; + 4ECAC25B1F8A8A010013B963 /* libslirp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = libslirp.h; path = ../../slirp/libslirp.h; sourceTree = ""; }; + 4ECAC25C1F8A8A010013B963 /* VERSION */ = {isa = PBXFileReference; lastKnownFileType = text; name = VERSION; path = ../../slirp/VERSION; sourceTree = ""; }; + 4ECAC25D1F8A8A010013B963 /* tcpip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tcpip.h; path = ../../slirp/tcpip.h; sourceTree = ""; }; + 4ECAC25E1F8A8A020013B963 /* tcp_input.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tcp_input.c; path = ../../slirp/tcp_input.c; sourceTree = ""; }; + 4ECAC25F1F8A8A020013B963 /* misc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = misc.h; path = ../../slirp/misc.h; sourceTree = ""; }; + 4ECAC2601F8A8A020013B963 /* bootp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = bootp.c; path = ../../slirp/bootp.c; sourceTree = ""; }; + 4ECAC2611F8A8A020013B963 /* mbuf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mbuf.h; path = ../../slirp/mbuf.h; sourceTree = ""; }; + 4ECAC2621F8A8A020013B963 /* COPYRIGHT */ = {isa = PBXFileReference; lastKnownFileType = text; name = COPYRIGHT; path = ../../slirp/COPYRIGHT; sourceTree = ""; }; + 4ECAC2631F8A8A020013B963 /* main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = main.h; path = ../../slirp/main.h; sourceTree = ""; }; + 4ECAC2641F8A8A020013B963 /* tcp_timer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tcp_timer.h; path = ../../slirp/tcp_timer.h; sourceTree = ""; }; + 4ECAC2651F8A8A030013B963 /* tftp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tftp.h; path = ../../slirp/tftp.h; sourceTree = ""; }; + 4ECAC2661F8A8A5D0013B963 /* ether_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ether_unix.cpp; path = ../../Unix/ether_unix.cpp; sourceTree = ""; }; + 752F26F81F240E51001032B4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 752F26FA1F240E69001032B4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + 752F27001F242BAF001032B4 /* prefs_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prefs_sdl.cpp; sourceTree = ""; }; + 752F27021F242F51001032B4 /* xpram_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpram_sdl.cpp; sourceTree = ""; }; + 752F27051F251B4A001032B4 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../../../external/SDL/Xcode/SDL/SDL.xcodeproj; sourceTree = ""; }; + 753252DA1F5358D30024025B /* build68k */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = build68k; sourceTree = BUILT_PRODUCTS_DIR; }; + 753252E51F5359040024025B /* build68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = build68k.c; sourceTree = ""; }; + 753252ED1F535DD10024025B /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = build68k_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; }; + 753252F31F535E1E0024025B /* gencpu */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gencpu; sourceTree = BUILT_PRODUCTS_DIR; }; + 753253011F535F210024025B /* gencpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gencpu.c; sourceTree = ""; }; + 7532532C1F5368370024025B /* cpuemu_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu_nf.cpp; path = gencpu_output/cpuemu_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; + 7532532D1F5368370024025B /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; + 7532532E1F5368370024025B /* cpustbl_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl_nf.cpp; path = gencpu_output/cpustbl_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; + 7532532F1F5368370024025B /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; + 753253301F5368370024025B /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; }; + 7539DFB21F23B17E006B2DF2 /* BasiliskII.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BasiliskII.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7539DFBE1F23B17E006B2DF2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7539DFC91F23B25A006B2DF2 /* adb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = adb.cpp; path = ../adb.cpp; sourceTree = ""; }; + 7539DFCA1F23B25A006B2DF2 /* audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio.cpp; path = ../audio.cpp; sourceTree = ""; }; + 7539DFCB1F23B25A006B2DF2 /* cdrom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cdrom.cpp; path = ../cdrom.cpp; sourceTree = ""; }; + 7539DFCD1F23B25A006B2DF2 /* sigsegv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sigsegv.cpp; sourceTree = ""; }; + 7539DFCE1F23B25A006B2DF2 /* sigsegv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sigsegv.h; sourceTree = ""; }; + 7539DFCF1F23B25A006B2DF2 /* video_blit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_blit.cpp; sourceTree = ""; }; + 7539DFD01F23B25A006B2DF2 /* video_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_blit.h; sourceTree = ""; }; + 7539DFD11F23B25A006B2DF2 /* video_vosf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_vosf.h; sourceTree = ""; }; + 7539DFD21F23B25A006B2DF2 /* vm_alloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = vm_alloc.cpp; sourceTree = ""; }; + 7539DFD31F23B25A006B2DF2 /* vm_alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vm_alloc.h; sourceTree = ""; }; + 7539DFD41F23B25A006B2DF2 /* disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = disk.cpp; path = ../disk.cpp; sourceTree = ""; }; + 7539DFD51F23B25A006B2DF2 /* emul_op.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = emul_op.cpp; path = ../emul_op.cpp; sourceTree = ""; }; + 7539DFD61F23B25A006B2DF2 /* ether.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ether.cpp; path = ../ether.cpp; sourceTree = ""; }; + 7539DFD71F23B25A006B2DF2 /* extfs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = extfs.cpp; path = ../extfs.cpp; sourceTree = ""; }; + 7539DFD91F23B25A006B2DF2 /* adb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = adb.h; sourceTree = ""; }; + 7539DFDA1F23B25A006B2DF2 /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.h; sourceTree = ""; }; + 7539DFDB1F23B25A006B2DF2 /* audio_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_defs.h; sourceTree = ""; }; + 7539DFDC1F23B25A006B2DF2 /* cdrom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cdrom.h; sourceTree = ""; }; + 7539DFDD1F23B25A006B2DF2 /* clip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clip.h; sourceTree = ""; }; + 7539DFDE1F23B25A006B2DF2 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; }; + 7539DFDF1F23B25A006B2DF2 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; + 7539DFE01F23B25A006B2DF2 /* emul_op.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emul_op.h; sourceTree = ""; }; + 7539DFE11F23B25A006B2DF2 /* ether.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ether.h; sourceTree = ""; }; + 7539DFE21F23B25A006B2DF2 /* ether_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ether_defs.h; sourceTree = ""; }; + 7539DFE31F23B25A006B2DF2 /* extfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extfs.h; sourceTree = ""; }; + 7539DFE41F23B25A006B2DF2 /* extfs_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extfs_defs.h; sourceTree = ""; }; + 7539DFE51F23B25A006B2DF2 /* macos_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macos_util.h; sourceTree = ""; }; + 7539DFE61F23B25A006B2DF2 /* main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = ""; }; + 7539DFE71F23B25A006B2DF2 /* pict.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pict.h; sourceTree = ""; }; + 7539DFE81F23B25A006B2DF2 /* prefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prefs.h; sourceTree = ""; }; + 7539DFE91F23B25A006B2DF2 /* prefs_editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prefs_editor.h; sourceTree = ""; }; + 7539DFEA1F23B25A006B2DF2 /* rom_patches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rom_patches.h; sourceTree = ""; }; + 7539DFEB1F23B25A006B2DF2 /* rsrc_patches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rsrc_patches.h; sourceTree = ""; }; + 7539DFEC1F23B25A006B2DF2 /* scsi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scsi.h; sourceTree = ""; }; + 7539DFED1F23B25A006B2DF2 /* serial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serial.h; sourceTree = ""; }; + 7539DFEE1F23B25A006B2DF2 /* serial_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serial_defs.h; sourceTree = ""; }; + 7539DFEF1F23B25A006B2DF2 /* slot_rom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slot_rom.h; sourceTree = ""; }; + 7539DFF01F23B25A006B2DF2 /* sony.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sony.h; sourceTree = ""; }; + 7539DFF11F23B25A006B2DF2 /* sys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sys.h; sourceTree = ""; }; + 7539DFF21F23B25A006B2DF2 /* timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timer.h; sourceTree = ""; }; + 7539DFF31F23B25A006B2DF2 /* user_strings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_strings.h; sourceTree = ""; }; + 7539DFF41F23B25A006B2DF2 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; + 7539DFF51F23B25A006B2DF2 /* video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video.h; sourceTree = ""; }; + 7539DFF61F23B25A006B2DF2 /* video_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_defs.h; sourceTree = ""; }; + 7539DFF71F23B25A006B2DF2 /* xpram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xpram.h; sourceTree = ""; }; + 7539DFF81F23B25A006B2DF2 /* macos_util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = macos_util.cpp; path = ../macos_util.cpp; sourceTree = ""; }; + 7539DFFA1F23B25A006B2DF2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7539DFFB1F23B25A006B2DF2 /* audio_defs_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_defs_macosx.h; sourceTree = ""; }; + 7539E0021F23B25A006B2DF2 /* BasiliskII.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = BasiliskII.icns; sourceTree = ""; }; + 7539E00A1F23B25A006B2DF2 /* Credits.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Credits.html; sourceTree = ""; }; + 7539E0101F23B25A006B2DF2 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 7539E0141F23B25A006B2DF2 /* HowTo.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HowTo.html; sourceTree = ""; }; + 7539E02B1F23B25A006B2DF2 /* ToDo.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ToDo.html; sourceTree = ""; }; + 7539E02E1F23B25A006B2DF2 /* Versions.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Versions.html; sourceTree = ""; }; + 7539E0651F23B25A006B2DF2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../main.cpp; sourceTree = ""; }; + 7539E0681F23B25A006B2DF2 /* pict.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pict.c; path = ../pict.c; sourceTree = ""; }; + 7539E06C1F23B25A006B2DF2 /* prefs_items.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = prefs_items.cpp; path = ../prefs_items.cpp; sourceTree = ""; }; + 7539E06D1F23B25A006B2DF2 /* prefs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = prefs.cpp; path = ../prefs.cpp; sourceTree = ""; }; + 7539E06E1F23B25A006B2DF2 /* rom_patches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rom_patches.cpp; path = ../rom_patches.cpp; sourceTree = ""; }; + 7539E06F1F23B25A006B2DF2 /* rsrc_patches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rsrc_patches.cpp; path = ../rsrc_patches.cpp; sourceTree = ""; }; + 7539E0701F23B25A006B2DF2 /* scsi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scsi.cpp; path = ../scsi.cpp; sourceTree = ""; }; + 7539E0721F23B25A006B2DF2 /* audio_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audio_sdl.cpp; sourceTree = ""; }; + 7539E0731F23B25A006B2DF2 /* keycodes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keycodes; sourceTree = ""; }; + 7539E0771F23B25A006B2DF2 /* serial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = serial.cpp; path = ../serial.cpp; sourceTree = ""; }; + 7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slot_rom.cpp; path = ../slot_rom.cpp; sourceTree = ""; }; + 7539E0A31F23B25A006B2DF2 /* sony.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sony.cpp; path = ../sony.cpp; sourceTree = ""; }; + 7539E0A41F23B25A006B2DF2 /* timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = timer.cpp; path = ../timer.cpp; sourceTree = ""; }; + 7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = basilisk_glue.cpp; sourceTree = ""; }; + 7539E0AB1F23B25A006B2DF2 /* compemu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compemu.h; sourceTree = ""; }; + 7539E0AE1F23B25A006B2DF2 /* flags_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flags_x86.h; sourceTree = ""; }; + 7539E0B11F23B25A006B2DF2 /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_emulation.h; sourceTree = ""; }; + 7539E0B41F23B25A006B2DF2 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = ""; }; + 7539E0B51F23B25A006B2DF2 /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = exceptions.cpp; sourceTree = ""; }; + 7539E0B61F23B25A006B2DF2 /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exceptions.h; sourceTree = ""; }; + 7539E0B71F23B25A006B2DF2 /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flags.cpp; sourceTree = ""; }; + 7539E0B81F23B25A006B2DF2 /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flags.h; sourceTree = ""; }; + 7539E0B91F23B25A006B2DF2 /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu.h; sourceTree = ""; }; + 7539E0BB1F23B25A006B2DF2 /* fpu_ieee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_ieee.h; sourceTree = ""; }; + 7539E0BD1F23B25A006B2DF2 /* fpu_uae.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_uae.h; sourceTree = ""; }; + 7539E0BF1F23B25A006B2DF2 /* fpu_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_x86.h; sourceTree = ""; }; + 7539E0C01F23B25A006B2DF2 /* fpu_x86_asm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_x86_asm.h; sourceTree = ""; }; + 7539E0C11F23B25A006B2DF2 /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl.h; sourceTree = ""; }; + 7539E0C21F23B25A006B2DF2 /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mathlib.cpp; sourceTree = ""; }; + 7539E0C31F23B25A006B2DF2 /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathlib.h; sourceTree = ""; }; + 7539E0C41F23B25A006B2DF2 /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rounding.cpp; sourceTree = ""; }; + 7539E0C51F23B25A006B2DF2 /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rounding.h; sourceTree = ""; }; + 7539E0C61F23B25A006B2DF2 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; + 7539E0C81F23B25A006B2DF2 /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = m68k.h; sourceTree = ""; }; + 7539E0C91F23B25A006B2DF2 /* memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memory.cpp; sourceTree = ""; }; + 7539E0CA1F23B25A006B2DF2 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; + 7539E0CC1F23B25A006B2DF2 /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = newcpu.h; sourceTree = ""; }; + 7539E0CD1F23B25A006B2DF2 /* noflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = noflags.h; sourceTree = ""; }; + 7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readcpu.cpp; sourceTree = ""; }; + 7539E0CF1F23B25A006B2DF2 /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readcpu.h; sourceTree = ""; }; + 7539E0D01F23B25A006B2DF2 /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spcflags.h; sourceTree = ""; }; + 7539E0D11F23B25A006B2DF2 /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = table68k; sourceTree = ""; }; + 7539E1221F23B25A006B2DF2 /* user_strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = user_strings.cpp; path = ../user_strings.cpp; sourceTree = ""; }; + 7539E1231F23B25A006B2DF2 /* video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = video.cpp; path = ../video.cpp; sourceTree = ""; }; + 7539E1241F23B25A006B2DF2 /* xpram.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xpram.cpp; path = ../xpram.cpp; sourceTree = ""; }; + 7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bincue_unix.cpp; sourceTree = ""; }; + 7539E1F11F23B329006B2DF2 /* bincue_unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bincue_unix.h; sourceTree = ""; }; + 7539E1F81F23B329006B2DF2 /* gtk-osx.patch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "gtk-osx.patch"; sourceTree = ""; }; + 7539E1FA1F23B32A006B2DF2 /* mkstandalone */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = mkstandalone; sourceTree = ""; }; + 7539E1FC1F23B32A006B2DF2 /* testlmem.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = testlmem.sh; sourceTree = ""; }; + 7539E1FD1F23B32A006B2DF2 /* disk_sparsebundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = disk_sparsebundle.cpp; sourceTree = ""; }; + 7539E1FE1F23B32A006B2DF2 /* disk_unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk_unix.h; sourceTree = ""; }; + 7539E2001F23B32A006B2DF2 /* extfs_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extfs_unix.cpp; sourceTree = ""; }; + 7539E2011F23B32A006B2DF2 /* fbdevices */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fbdevices; sourceTree = ""; }; + 7539E2051F23B32A006B2DF2 /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = ""; }; + 7539E20A1F23B32A006B2DF2 /* keycodes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keycodes; sourceTree = ""; }; + 7539E20C1F23B32A006B2DF2 /* freebsd-i386.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "freebsd-i386.ld"; sourceTree = ""; }; + 7539E20D1F23B32A006B2DF2 /* linux-i386.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linux-i386.ld"; sourceTree = ""; }; + 7539E20E1F23B32A006B2DF2 /* linux-ppc.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linux-ppc.ld"; sourceTree = ""; }; + 7539E20F1F23B32A006B2DF2 /* linux-x86_64.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linux-x86_64.ld"; sourceTree = ""; }; + 7539E2181F23B32A006B2DF2 /* egrep.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = egrep.m4; sourceTree = ""; }; + 7539E2191F23B32A006B2DF2 /* esd.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = esd.m4; sourceTree = ""; }; + 7539E21A1F23B32A006B2DF2 /* gettext.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gettext.m4; sourceTree = ""; }; + 7539E21B1F23B32A006B2DF2 /* gtk-2.0.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "gtk-2.0.m4"; sourceTree = ""; }; + 7539E21C1F23B32A006B2DF2 /* gtk.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gtk.m4; sourceTree = ""; }; + 7539E21E1F23B32A006B2DF2 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; + 7539E21F1F23B32A006B2DF2 /* mkinstalldirs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = mkinstalldirs; sourceTree = ""; }; + 7539E2231F23B32A006B2DF2 /* rpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpc.h; sourceTree = ""; }; + 7539E2241F23B32A006B2DF2 /* rpc_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rpc_unix.cpp; sourceTree = ""; }; + 7539E2251F23B32A006B2DF2 /* semaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = semaphore.h; sourceTree = ""; }; + 7539E22A1F23B32A006B2DF2 /* sshpty.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sshpty.c; sourceTree = ""; }; + 7539E22B1F23B32A006B2DF2 /* sshpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sshpty.h; sourceTree = ""; }; + 7539E22C1F23B32A006B2DF2 /* strlcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcpy.c; sourceTree = ""; }; + 7539E22D1F23B32A006B2DF2 /* strlcpy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strlcpy.h; sourceTree = ""; }; + 7539E22E1F23B32A006B2DF2 /* sys_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_unix.cpp; sourceTree = ""; }; + 7539E22F1F23B32A006B2DF2 /* sysdeps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sysdeps.h; sourceTree = ""; }; + 7539E2301F23B32A006B2DF2 /* timer_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = timer_unix.cpp; sourceTree = ""; }; + 7539E2311F23B32A006B2DF2 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml2.cpp; sourceTree = ""; }; + 7539E2321F23B32A006B2DF2 /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyxml2.h; sourceTree = ""; }; + 7539E2331F23B32A006B2DF2 /* tunconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = tunconfig; sourceTree = ""; }; + 7539E2351F23B32A006B2DF2 /* user_strings_unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_strings_unix.h; sourceTree = ""; }; + 7539E27E1F23BEB4006B2DF2 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; + 7539E27F1F23C4CA006B2DF2 /* main_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main_unix.cpp; sourceTree = ""; }; + 7539E2851F23C56F006B2DF2 /* clip_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clip_dummy.cpp; sourceTree = ""; }; + 7539E2861F23C56F006B2DF2 /* ether_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ether_dummy.cpp; sourceTree = ""; }; + 7539E2881F23C56F006B2DF2 /* prefs_editor_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prefs_editor_dummy.cpp; sourceTree = ""; }; + 7539E2891F23C56F006B2DF2 /* scsi_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scsi_dummy.cpp; sourceTree = ""; }; + 7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = serial_dummy.cpp; sourceTree = ""; }; + 7539E2961F23C5FD006B2DF2 /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = newcpu.cpp; sourceTree = ""; }; + 7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_darwin.cpp; sourceTree = ""; }; + 7539E29E1F23C939006B2DF2 /* fpu_uae.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fpu_uae.cpp; sourceTree = ""; }; + 7539E2AA1F23CDB7006B2DF2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 756C1B321F252FC100620917 /* utils_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils_macosx.h; sourceTree = ""; }; + 756C1B331F252FC100620917 /* utils_macosx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = utils_macosx.mm; sourceTree = ""; }; + 756C1B381F25306A00620917 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 757A2BEF1F5AF9D6003EDB01 /* user_strings_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = user_strings_unix.cpp; sourceTree = ""; }; + 75CBCF741F5DB3AD00830063 /* video_sdl2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_sdl2.cpp; sourceTree = ""; }; + 75CBCF761F5DB65E00830063 /* video_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_sdl.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 753252D71F5358D30024025B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 753252F01F535E1E0024025B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7539DFAF1F23B17E006B2DF2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 756C1B391F25306A00620917 /* AppKit.framework in Frameworks */, + 752F27141F251B5C001032B4 /* SDL2.framework in Frameworks */, + 752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */, + 752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 4ECAC23C1F8A89ED0013B963 /* slirp */ = { + isa = PBXGroup; + children = ( + 4ECAC2661F8A8A5D0013B963 /* ether_unix.cpp */, + 4ECAC2601F8A8A020013B963 /* bootp.c */, + 4ECAC2591F8A8A010013B963 /* bootp.h */, + 4ECAC2541F8A8A000013B963 /* cksum.c */, + 4ECAC2621F8A8A020013B963 /* COPYRIGHT */, + 4ECAC25A1F8A8A010013B963 /* ctl.h */, + 4ECAC23F1F8A89FE0013B963 /* debug.c */, + 4ECAC2531F8A8A000013B963 /* debug.h */, + 4ECAC2491F8A89FF0013B963 /* icmp_var.h */, + 4ECAC2501F8A8A000013B963 /* if.c */, + 4ECAC2411F8A89FE0013B963 /* if.h */, + 4ECAC2441F8A89FE0013B963 /* ip_icmp.c */, + 4ECAC2511F8A8A000013B963 /* ip_icmp.h */, + 4ECAC2481F8A89FF0013B963 /* ip_input.c */, + 4ECAC2471F8A89FF0013B963 /* ip_output.c */, + 4ECAC2581F8A8A010013B963 /* ip.h */, + 4ECAC25B1F8A8A010013B963 /* libslirp.h */, + 4ECAC2631F8A8A020013B963 /* main.h */, + 4ECAC24F1F8A89FF0013B963 /* mbuf.c */, + 4ECAC2611F8A8A020013B963 /* mbuf.h */, + 4ECAC2401F8A89FE0013B963 /* misc.c */, + 4ECAC25F1F8A8A020013B963 /* misc.h */, + 4ECAC24A1F8A89FF0013B963 /* sbuf.c */, + 4ECAC2421F8A89FE0013B963 /* sbuf.h */, + 4ECAC24B1F8A89FF0013B963 /* slirp_config.h */, + 4ECAC23D1F8A89FE0013B963 /* slirp.c */, + 4ECAC2561F8A8A000013B963 /* slirp.h */, + 4ECAC2431F8A89FE0013B963 /* socket.c */, + 4ECAC2451F8A89FE0013B963 /* socket.h */, + 4ECAC25E1F8A8A020013B963 /* tcp_input.c */, + 4ECAC24C1F8A89FF0013B963 /* tcp_output.c */, + 4ECAC2571F8A8A000013B963 /* tcp_subr.c */, + 4ECAC24D1F8A89FF0013B963 /* tcp_timer.c */, + 4ECAC2641F8A8A020013B963 /* tcp_timer.h */, + 4ECAC2551F8A8A000013B963 /* tcp_var.h */, + 4ECAC23E1F8A89FE0013B963 /* tcp.h */, + 4ECAC25D1F8A8A010013B963 /* tcpip.h */, + 4ECAC2521F8A8A000013B963 /* tftp.c */, + 4ECAC2651F8A8A030013B963 /* tftp.h */, + 4ECAC24E1F8A89FF0013B963 /* udp.c */, + 4ECAC2461F8A89FE0013B963 /* udp.h */, + 4ECAC25C1F8A8A010013B963 /* VERSION */, + ); + name = slirp; + path = ../slirp; + sourceTree = ""; + }; + 752F26F71F240E51001032B4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 756C1B381F25306A00620917 /* AppKit.framework */, + 752F26FA1F240E69001032B4 /* IOKit.framework */, + 752F26F81F240E51001032B4 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 752F27041F251B27001032B4 /* external */ = { + isa = PBXGroup; + children = ( + 752F27051F251B4A001032B4 /* SDL.xcodeproj */, + ); + name = external; + sourceTree = ""; + }; + 752F27061F251B4A001032B4 /* Products */ = { + isa = PBXGroup; + children = ( + 752F270D1F251B4A001032B4 /* SDL2.framework */, + 752F270F1F251B4A001032B4 /* libSDL2.a */, + 752F27111F251B4A001032B4 /* libSDL2.dylib */, + 752F27131F251B4A001032B4 /* Standard DMG */, + ); + name = Products; + sourceTree = ""; + }; + 753252FF1F535E5D0024025B /* generated src */ = { + isa = PBXGroup; + children = ( + 753253001F535E840024025B /* build68k output */, + 7532532B1F53675E0024025B /* gencpu output */, + ); + name = "generated src"; + sourceTree = ""; + }; + 753253001F535E840024025B /* build68k output */ = { + isa = PBXGroup; + children = ( + 753252ED1F535DD10024025B /* defs68k.c */, + ); + name = "build68k output"; + sourceTree = ""; + }; + 7532532B1F53675E0024025B /* gencpu output */ = { + isa = PBXGroup; + children = ( + 7532532C1F5368370024025B /* cpuemu_nf.cpp */, + 7532532D1F5368370024025B /* cpuemu.cpp */, + 7532532E1F5368370024025B /* cpustbl_nf.cpp */, + 7532532F1F5368370024025B /* cpustbl.cpp */, + 753253301F5368370024025B /* cputbl.h */, + ); + name = "gencpu output"; + sourceTree = ""; + }; + 7539DFA91F23B17E006B2DF2 = { + isa = PBXGroup; + children = ( + 7539E1E41F23B25E006B2DF2 /* src */, + 753252FF1F535E5D0024025B /* generated src */, + 752F27041F251B27001032B4 /* external */, + 7539DFB41F23B17E006B2DF2 /* Assets */, + 7539DFB31F23B17E006B2DF2 /* Products */, + 752F26F71F240E51001032B4 /* Frameworks */, + ); + sourceTree = ""; + }; + 7539DFB31F23B17E006B2DF2 /* Products */ = { + isa = PBXGroup; + children = ( + 7539DFB21F23B17E006B2DF2 /* BasiliskII.app */, + 753252DA1F5358D30024025B /* build68k */, + 753252F31F535E1E0024025B /* gencpu */, + ); + name = Products; + path = ../../../../../../../../Documents/Code/macemu/BasiliskII/src/MacOSX; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7539DFB41F23B17E006B2DF2 /* Assets */ = { + isa = PBXGroup; + children = ( + 7539DFBE1F23B17E006B2DF2 /* Assets.xcassets */, + ); + name = Assets; + path = BasiliskII; + sourceTree = ""; + }; + 7539DFCC1F23B25A006B2DF2 /* CrossPlatform */ = { + isa = PBXGroup; + children = ( + 7539DFCD1F23B25A006B2DF2 /* sigsegv.cpp */, + 7539DFCE1F23B25A006B2DF2 /* sigsegv.h */, + 7539DFCF1F23B25A006B2DF2 /* video_blit.cpp */, + 7539DFD01F23B25A006B2DF2 /* video_blit.h */, + 7539DFD11F23B25A006B2DF2 /* video_vosf.h */, + 7539DFD21F23B25A006B2DF2 /* vm_alloc.cpp */, + 7539DFD31F23B25A006B2DF2 /* vm_alloc.h */, + ); + name = CrossPlatform; + path = ../CrossPlatform; + sourceTree = ""; + }; + 7539DFD81F23B25A006B2DF2 /* include */ = { + isa = PBXGroup; + children = ( + 7539DFD91F23B25A006B2DF2 /* adb.h */, + 7539DFDA1F23B25A006B2DF2 /* audio.h */, + 7539DFDB1F23B25A006B2DF2 /* audio_defs.h */, + 7539DFDC1F23B25A006B2DF2 /* cdrom.h */, + 7539DFDD1F23B25A006B2DF2 /* clip.h */, + 7539DFDE1F23B25A006B2DF2 /* debug.h */, + 7539DFDF1F23B25A006B2DF2 /* disk.h */, + 7539DFE01F23B25A006B2DF2 /* emul_op.h */, + 7539DFE11F23B25A006B2DF2 /* ether.h */, + 7539DFE21F23B25A006B2DF2 /* ether_defs.h */, + 7539DFE31F23B25A006B2DF2 /* extfs.h */, + 7539DFE41F23B25A006B2DF2 /* extfs_defs.h */, + 7539DFE51F23B25A006B2DF2 /* macos_util.h */, + 7539DFE61F23B25A006B2DF2 /* main.h */, + 7539DFE71F23B25A006B2DF2 /* pict.h */, + 7539DFE81F23B25A006B2DF2 /* prefs.h */, + 7539DFE91F23B25A006B2DF2 /* prefs_editor.h */, + 7539DFEA1F23B25A006B2DF2 /* rom_patches.h */, + 7539DFEB1F23B25A006B2DF2 /* rsrc_patches.h */, + 7539DFEC1F23B25A006B2DF2 /* scsi.h */, + 7539DFED1F23B25A006B2DF2 /* serial.h */, + 7539DFEE1F23B25A006B2DF2 /* serial_defs.h */, + 7539DFEF1F23B25A006B2DF2 /* slot_rom.h */, + 7539DFF01F23B25A006B2DF2 /* sony.h */, + 7539DFF11F23B25A006B2DF2 /* sys.h */, + 7539DFF21F23B25A006B2DF2 /* timer.h */, + 7539DFF31F23B25A006B2DF2 /* user_strings.h */, + 7539DFF41F23B25A006B2DF2 /* version.h */, + 7539DFF51F23B25A006B2DF2 /* video.h */, + 7539DFF61F23B25A006B2DF2 /* video_defs.h */, + 7539DFF71F23B25A006B2DF2 /* xpram.h */, + ); + name = include; + path = ../include; + sourceTree = ""; + }; + 7539DFF91F23B25A006B2DF2 /* MacOSX */ = { + isa = PBXGroup; + children = ( + 7539E2AA1F23CDB7006B2DF2 /* Info.plist */, + 7539E27E1F23BEB4006B2DF2 /* config.h */, + 7539DFFA1F23B25A006B2DF2 /* Assets.xcassets */, + 7539DFFB1F23B25A006B2DF2 /* audio_defs_macosx.h */, + 7539E0021F23B25A006B2DF2 /* BasiliskII.icns */, + 7539E00A1F23B25A006B2DF2 /* Credits.html */, + 7539E00F1F23B25A006B2DF2 /* InfoPlist.strings */, + 7539E0141F23B25A006B2DF2 /* HowTo.html */, + 7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */, + 7539E02B1F23B25A006B2DF2 /* ToDo.html */, + 756C1B321F252FC100620917 /* utils_macosx.h */, + 756C1B331F252FC100620917 /* utils_macosx.mm */, + 7539E02E1F23B25A006B2DF2 /* Versions.html */, + ); + name = MacOSX; + sourceTree = ""; + }; + 7539E0711F23B25A006B2DF2 /* SDL */ = { + isa = PBXGroup; + children = ( + 752F27021F242F51001032B4 /* xpram_sdl.cpp */, + 752F27001F242BAF001032B4 /* prefs_sdl.cpp */, + 7539E0721F23B25A006B2DF2 /* audio_sdl.cpp */, + 7539E0731F23B25A006B2DF2 /* keycodes */, + 75CBCF761F5DB65E00830063 /* video_sdl.cpp */, + 75CBCF741F5DB3AD00830063 /* video_sdl2.cpp */, + ); + name = SDL; + path = ../SDL; + sourceTree = ""; + }; + 7539E0A51F23B25A006B2DF2 /* uae_cpu */ = { + isa = PBXGroup; + children = ( + 7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */, + 753252E51F5359040024025B /* build68k.c */, + 7539E0A81F23B25A006B2DF2 /* compiler */, + 7539E0B11F23B25A006B2DF2 /* cpu_emulation.h */, + 7539E0B31F23B25A006B2DF2 /* fpu */, + 753253011F535F210024025B /* gencpu.c */, + 7539E0C81F23B25A006B2DF2 /* m68k.h */, + 7539E0C91F23B25A006B2DF2 /* memory.cpp */, + 7539E0CA1F23B25A006B2DF2 /* memory.h */, + 7539E2961F23C5FD006B2DF2 /* newcpu.cpp */, + 7539E0CC1F23B25A006B2DF2 /* newcpu.h */, + 7539E0CD1F23B25A006B2DF2 /* noflags.h */, + 7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */, + 7539E0CF1F23B25A006B2DF2 /* readcpu.h */, + 7539E0D01F23B25A006B2DF2 /* spcflags.h */, + 7539E0D11F23B25A006B2DF2 /* table68k */, + ); + name = uae_cpu; + path = ../uae_cpu; + sourceTree = ""; + }; + 7539E0A81F23B25A006B2DF2 /* compiler */ = { + isa = PBXGroup; + children = ( + 7539E0AB1F23B25A006B2DF2 /* compemu.h */, + 7539E0AE1F23B25A006B2DF2 /* flags_x86.h */, + ); + path = compiler; + sourceTree = ""; + }; + 7539E0B31F23B25A006B2DF2 /* fpu */ = { + isa = PBXGroup; + children = ( + 7539E29E1F23C939006B2DF2 /* fpu_uae.cpp */, + 7539E0B41F23B25A006B2DF2 /* core.h */, + 7539E0B51F23B25A006B2DF2 /* exceptions.cpp */, + 7539E0B61F23B25A006B2DF2 /* exceptions.h */, + 7539E0B71F23B25A006B2DF2 /* flags.cpp */, + 7539E0B81F23B25A006B2DF2 /* flags.h */, + 7539E0B91F23B25A006B2DF2 /* fpu.h */, + 7539E0BB1F23B25A006B2DF2 /* fpu_ieee.h */, + 7539E0BD1F23B25A006B2DF2 /* fpu_uae.h */, + 7539E0BF1F23B25A006B2DF2 /* fpu_x86.h */, + 7539E0C01F23B25A006B2DF2 /* fpu_x86_asm.h */, + 7539E0C11F23B25A006B2DF2 /* impl.h */, + 7539E0C21F23B25A006B2DF2 /* mathlib.cpp */, + 7539E0C31F23B25A006B2DF2 /* mathlib.h */, + 7539E0C41F23B25A006B2DF2 /* rounding.cpp */, + 7539E0C51F23B25A006B2DF2 /* rounding.h */, + 7539E0C61F23B25A006B2DF2 /* types.h */, + ); + path = fpu; + sourceTree = ""; + }; + 7539E1E41F23B25E006B2DF2 /* src */ = { + isa = PBXGroup; + children = ( + 7539DFC91F23B25A006B2DF2 /* adb.cpp */, + 7539DFCA1F23B25A006B2DF2 /* audio.cpp */, + 7539DFCB1F23B25A006B2DF2 /* cdrom.cpp */, + 7539DFCC1F23B25A006B2DF2 /* CrossPlatform */, + 7539DFD41F23B25A006B2DF2 /* disk.cpp */, + 7539E2811F23C52C006B2DF2 /* dummy */, + 7539DFD51F23B25A006B2DF2 /* emul_op.cpp */, + 7539DFD61F23B25A006B2DF2 /* ether.cpp */, + 7539DFD71F23B25A006B2DF2 /* extfs.cpp */, + 7539DFD81F23B25A006B2DF2 /* include */, + 7539DFF81F23B25A006B2DF2 /* macos_util.cpp */, + 7539DFF91F23B25A006B2DF2 /* MacOSX */, + 7539E0651F23B25A006B2DF2 /* main.cpp */, + 7539E0681F23B25A006B2DF2 /* pict.c */, + 7539E06C1F23B25A006B2DF2 /* prefs_items.cpp */, + 7539E06D1F23B25A006B2DF2 /* prefs.cpp */, + 7539E06E1F23B25A006B2DF2 /* rom_patches.cpp */, + 7539E06F1F23B25A006B2DF2 /* rsrc_patches.cpp */, + 7539E0701F23B25A006B2DF2 /* scsi.cpp */, + 7539E0711F23B25A006B2DF2 /* SDL */, + 7539E0771F23B25A006B2DF2 /* serial.cpp */, + 4ECAC23C1F8A89ED0013B963 /* slirp */, + 7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */, + 7539E0A31F23B25A006B2DF2 /* sony.cpp */, + 7539E0A41F23B25A006B2DF2 /* timer.cpp */, + 7539E0A51F23B25A006B2DF2 /* uae_cpu */, + 7539E1E91F23B329006B2DF2 /* Unix */, + 7539E1221F23B25A006B2DF2 /* user_strings.cpp */, + 7539E1231F23B25A006B2DF2 /* video.cpp */, + 7539E1241F23B25A006B2DF2 /* xpram.cpp */, + ); + name = src; + sourceTree = ""; + }; + 7539E1E91F23B329006B2DF2 /* Unix */ = { + isa = PBXGroup; + children = ( + 7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */, + 7539E1F11F23B329006B2DF2 /* bincue_unix.h */, + 7539E1F71F23B329006B2DF2 /* Darwin */, + 7539E1FD1F23B32A006B2DF2 /* disk_sparsebundle.cpp */, + 7539E1FE1F23B32A006B2DF2 /* disk_unix.h */, + 7539E2001F23B32A006B2DF2 /* extfs_unix.cpp */, + 7539E2011F23B32A006B2DF2 /* fbdevices */, + 7539E2051F23B32A006B2DF2 /* install-sh */, + 7539E20A1F23B32A006B2DF2 /* keycodes */, + 7539E20B1F23B32A006B2DF2 /* ldscripts */, + 7539E2171F23B32A006B2DF2 /* m4 */, + 7539E27F1F23C4CA006B2DF2 /* main_unix.cpp */, + 7539E21E1F23B32A006B2DF2 /* Makefile.in */, + 7539E21F1F23B32A006B2DF2 /* mkinstalldirs */, + 7539E2231F23B32A006B2DF2 /* rpc.h */, + 7539E2241F23B32A006B2DF2 /* rpc_unix.cpp */, + 7539E2251F23B32A006B2DF2 /* semaphore.h */, + 7539E22A1F23B32A006B2DF2 /* sshpty.c */, + 7539E22B1F23B32A006B2DF2 /* sshpty.h */, + 7539E22C1F23B32A006B2DF2 /* strlcpy.c */, + 7539E22D1F23B32A006B2DF2 /* strlcpy.h */, + 7539E22E1F23B32A006B2DF2 /* sys_unix.cpp */, + 7539E22F1F23B32A006B2DF2 /* sysdeps.h */, + 7539E2301F23B32A006B2DF2 /* timer_unix.cpp */, + 7539E2311F23B32A006B2DF2 /* tinyxml2.cpp */, + 7539E2321F23B32A006B2DF2 /* tinyxml2.h */, + 7539E2331F23B32A006B2DF2 /* tunconfig */, + 757A2BEF1F5AF9D6003EDB01 /* user_strings_unix.cpp */, + 7539E2351F23B32A006B2DF2 /* user_strings_unix.h */, + ); + name = Unix; + path = ../Unix; + sourceTree = ""; + }; + 7539E1F71F23B329006B2DF2 /* Darwin */ = { + isa = PBXGroup; + children = ( + 7539E1F81F23B329006B2DF2 /* gtk-osx.patch */, + 7539E1FA1F23B32A006B2DF2 /* mkstandalone */, + 7539E1FC1F23B32A006B2DF2 /* testlmem.sh */, + ); + path = Darwin; + sourceTree = ""; + }; + 7539E20B1F23B32A006B2DF2 /* ldscripts */ = { + isa = PBXGroup; + children = ( + 7539E20C1F23B32A006B2DF2 /* freebsd-i386.ld */, + 7539E20D1F23B32A006B2DF2 /* linux-i386.ld */, + 7539E20E1F23B32A006B2DF2 /* linux-ppc.ld */, + 7539E20F1F23B32A006B2DF2 /* linux-x86_64.ld */, + ); + path = ldscripts; + sourceTree = ""; + }; + 7539E2171F23B32A006B2DF2 /* m4 */ = { + isa = PBXGroup; + children = ( + 7539E2181F23B32A006B2DF2 /* egrep.m4 */, + 7539E2191F23B32A006B2DF2 /* esd.m4 */, + 7539E21A1F23B32A006B2DF2 /* gettext.m4 */, + 7539E21B1F23B32A006B2DF2 /* gtk-2.0.m4 */, + 7539E21C1F23B32A006B2DF2 /* gtk.m4 */, + ); + path = m4; + sourceTree = ""; + }; + 7539E2811F23C52C006B2DF2 /* dummy */ = { + isa = PBXGroup; + children = ( + 7539E2851F23C56F006B2DF2 /* clip_dummy.cpp */, + 7539E2861F23C56F006B2DF2 /* ether_dummy.cpp */, + 7539E2881F23C56F006B2DF2 /* prefs_editor_dummy.cpp */, + 7539E2891F23C56F006B2DF2 /* scsi_dummy.cpp */, + 7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */, + ); + name = dummy; + path = ../dummy; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXLegacyTarget section */ + 753253071F5360E30024025B /* run_build68k */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "$(ACTION)"; + buildConfigurationList = 753253081F5360E30024025B /* Build configuration list for PBXLegacyTarget "run_build68k" */; + buildPhases = ( + ); + buildToolPath = "$(PROJECT_DIR)/run_build68k_for_xcode.sh"; + buildWorkingDirectory = ""; + dependencies = ( + 7532530C1F53611F0024025B /* PBXTargetDependency */, + ); + name = run_build68k; + passBuildSettingsInEnvironment = 1; + productName = RunBuild68k; + }; + 753253161F5363D20024025B /* run_gencpu */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "$(ACTION)"; + buildConfigurationList = 753253171F5363D20024025B /* Build configuration list for PBXLegacyTarget "run_gencpu" */; + buildPhases = ( + ); + buildToolPath = "$(PROJECT_DIR)/run_gencpu_for_xcode.sh"; + buildWorkingDirectory = ""; + dependencies = ( + 7532531B1F5364030024025B /* PBXTargetDependency */, + ); + name = run_gencpu; + passBuildSettingsInEnvironment = 1; + productName = RunGencpu; + }; +/* End PBXLegacyTarget section */ + +/* Begin PBXNativeTarget section */ + 753252D91F5358D30024025B /* build68k */ = { + isa = PBXNativeTarget; + buildConfigurationList = 753252E31F5358D30024025B /* Build configuration list for PBXNativeTarget "build68k" */; + buildPhases = ( + 753252D61F5358D30024025B /* Sources */, + 753252D71F5358D30024025B /* Frameworks */, + 753252D81F5358D30024025B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = build68k; + productName = build68k; + productReference = 753252DA1F5358D30024025B /* build68k */; + productType = "com.apple.product-type.tool"; + }; + 753252F21F535E1E0024025B /* gencpu */ = { + isa = PBXNativeTarget; + buildConfigurationList = 753252F71F535E1E0024025B /* Build configuration list for PBXNativeTarget "gencpu" */; + buildPhases = ( + 753252EF1F535E1E0024025B /* Sources */, + 753252F01F535E1E0024025B /* Frameworks */, + 753252F11F535E1E0024025B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 7532531D1F53640B0024025B /* PBXTargetDependency */, + ); + name = gencpu; + productName = gencpu; + productReference = 753252F31F535E1E0024025B /* gencpu */; + productType = "com.apple.product-type.tool"; + }; + 7539DFB11F23B17E006B2DF2 /* BasiliskII */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7539DFC61F23B17E006B2DF2 /* Build configuration list for PBXNativeTarget "BasiliskII" */; + buildPhases = ( + 752F27181F251CB1001032B4 /* Run Script */, + 7539DFAE1F23B17E006B2DF2 /* Sources */, + 7539DFAF1F23B17E006B2DF2 /* Frameworks */, + 7539DFB01F23B17E006B2DF2 /* Resources */, + 752F26F31F240140001032B4 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 7532531F1F5364170024025B /* PBXTargetDependency */, + 752F27171F251B5C001032B4 /* PBXTargetDependency */, + ); + name = BasiliskII; + productName = BasiliskII; + productReference = 7539DFB21F23B17E006B2DF2 /* BasiliskII.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7539DFAA1F23B17E006B2DF2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + TargetAttributes = { + 753252D91F5358D30024025B = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 753252F21F535E1E0024025B = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 753253071F5360E30024025B = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 753253161F5363D20024025B = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 7539DFB11F23B17E006B2DF2 = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 7539DFAD1F23B17E006B2DF2 /* Build configuration list for PBXProject "BasiliskII" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + English, + ); + mainGroup = 7539DFA91F23B17E006B2DF2; + productRefGroup = 7539DFB31F23B17E006B2DF2 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 752F27061F251B4A001032B4 /* Products */; + ProjectRef = 752F27051F251B4A001032B4 /* SDL.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 7539DFB11F23B17E006B2DF2 /* BasiliskII */, + 753252D91F5358D30024025B /* build68k */, + 753252F21F535E1E0024025B /* gencpu */, + 753253071F5360E30024025B /* run_build68k */, + 753253161F5363D20024025B /* run_gencpu */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 752F270D1F251B4A001032B4 /* SDL2.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = SDL2.framework; + remoteRef = 752F270C1F251B4A001032B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 752F270F1F251B4A001032B4 /* libSDL2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.a; + remoteRef = 752F270E1F251B4A001032B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 752F27111F251B4A001032B4 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.dylib"; + path = libSDL2.dylib; + remoteRef = 752F27101F251B4A001032B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 752F27131F251B4A001032B4 /* Standard DMG */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = "Standard DMG"; + remoteRef = 752F27121F251B4A001032B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 7539DFB01F23B17E006B2DF2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7539E25D1F23B32A006B2DF2 /* egrep.m4 in Resources */, + 7539E1A31F23B25A006B2DF2 /* table68k in Resources */, + 7539E1341F23B25A006B2DF2 /* BasiliskII.icns in Resources */, + 7539E2601F23B32A006B2DF2 /* gtk-2.0.m4 in Resources */, + 7539E2541F23B32A006B2DF2 /* keycodes in Resources */, + 7539E1381F23B25A006B2DF2 /* Credits.html in Resources */, + 7539E25E1F23B32A006B2DF2 /* esd.m4 in Resources */, + 7539E2631F23B32A006B2DF2 /* Makefile.in in Resources */, + 7539E2571F23B32A006B2DF2 /* linux-ppc.ld in Resources */, + 7539E24D1F23B32A006B2DF2 /* fbdevices in Resources */, + 7539E2501F23B32A006B2DF2 /* install-sh in Resources */, + 7539E1301F23B25A006B2DF2 /* Assets.xcassets in Resources */, + 7539E2641F23B32A006B2DF2 /* mkinstalldirs in Resources */, + 7539DFBF1F23B17E006B2DF2 /* Assets.xcassets in Resources */, + 7539E2581F23B32A006B2DF2 /* linux-x86_64.ld in Resources */, + 7539E2451F23B32A006B2DF2 /* gtk-osx.patch in Resources */, + 7539E2AB1F23CDB7006B2DF2 /* Info.plist in Resources */, + 7539E2471F23B32A006B2DF2 /* mkstandalone in Resources */, + 7539E14B1F23B25A006B2DF2 /* ToDo.html in Resources */, + 7539E13E1F23B25A006B2DF2 /* HowTo.html in Resources */, + 7539E1751F23B25A006B2DF2 /* keycodes in Resources */, + 7539E14D1F23B25A006B2DF2 /* Versions.html in Resources */, + 7539E2711F23B32A006B2DF2 /* tunconfig in Resources */, + 7539E2561F23B32A006B2DF2 /* linux-i386.ld in Resources */, + 7539E2551F23B32A006B2DF2 /* freebsd-i386.ld in Resources */, + 7539E13B1F23B25A006B2DF2 /* InfoPlist.strings in Resources */, + 7539E25F1F23B32A006B2DF2 /* gettext.m4 in Resources */, + 7539E2491F23B32A006B2DF2 /* testlmem.sh in Resources */, + 7539E2611F23B32A006B2DF2 /* gtk.m4 in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 752F27181F251CB1001032B4 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# ${PROJECT_DIR}/generate_cpu_srcs_for_xcode.sh"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 753252D61F5358D30024025B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 753252E91F535A0C0024025B /* build68k.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 753252EF1F535E1E0024025B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 753253021F535F210024025B /* gencpu.c in Sources */, + 753253201F53650F0024025B /* readcpu.cpp in Sources */, + 753253151F5363400024025B /* defs68k.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7539DFAE1F23B17E006B2DF2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */, + 7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */, + 7539E1291F23B25A006B2DF2 /* video_blit.cpp in Sources */, + 4ECAC2701F8A8B230013B963 /* misc.c in Sources */, + 4ECAC26E1F8A8B120013B963 /* ip_output.c in Sources */, + 4ECAC2781F8A8B4B0013B963 /* tftp.c in Sources */, + 7539E28E1F23C56F006B2DF2 /* clip_dummy.cpp in Sources */, + 7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */, + 753253351F53688D0024025B /* readcpu.cpp in Sources */, + 4ECAC26B1F8A8B010013B963 /* if.c in Sources */, + 7539E1741F23B25A006B2DF2 /* audio_sdl.cpp in Sources */, + 753252EE1F535DD10024025B /* defs68k.c in Sources */, + 7539E29F1F23C939006B2DF2 /* fpu_uae.cpp in Sources */, + 7539E1E21F23B25A006B2DF2 /* video.cpp in Sources */, + 7539E18F1F23B25A006B2DF2 /* timer.cpp in Sources */, + 7539E1711F23B25A006B2DF2 /* rom_patches.cpp in Sources */, + 7539E1281F23B25A006B2DF2 /* sigsegv.cpp in Sources */, + 753253341F5368370024025B /* cpustbl.cpp in Sources */, + 4ECAC2761F8A8B480013B963 /* tcp_subr.c in Sources */, + 756C1B341F252FC100620917 /* utils_macosx.mm in Sources */, + 753253321F5368370024025B /* cpuemu.cpp in Sources */, + 7539E2701F23B32A006B2DF2 /* tinyxml2.cpp in Sources */, + 7539E1721F23B25A006B2DF2 /* rsrc_patches.cpp in Sources */, + 7539E2931F23C56F006B2DF2 /* serial_dummy.cpp in Sources */, + 7539E1981F23B25A006B2DF2 /* exceptions.cpp in Sources */, + 75CBCF771F5DB65E00830063 /* video_sdl.cpp in Sources */, + 4ECAC2771F8A8B480013B963 /* tcp_timer.c in Sources */, + 7539E1901F23B25A006B2DF2 /* basilisk_glue.cpp in Sources */, + 4ECAC26D1F8A8B120013B963 /* ip_input.c in Sources */, + 4ECAC2791F8A8B530013B963 /* udp.c in Sources */, + 7539E2801F23C4CA006B2DF2 /* main_unix.cpp in Sources */, + 7539E1E11F23B25A006B2DF2 /* user_strings.cpp in Sources */, + 75CBCF751F5DB3AD00830063 /* video_sdl2.cpp in Sources */, + 752F27011F242BAF001032B4 /* prefs_sdl.cpp in Sources */, + 7539E2971F23C5FD006B2DF2 /* newcpu.cpp in Sources */, + 7539E12A1F23B25A006B2DF2 /* vm_alloc.cpp in Sources */, + 4ECAC26F1F8A8B230013B963 /* mbuf.c in Sources */, + 753253331F5368370024025B /* cpustbl_nf.cpp in Sources */, + 7539E16C1F23B25A006B2DF2 /* main.cpp in Sources */, + 7539E26D1F23B32A006B2DF2 /* strlcpy.c in Sources */, + 7539E26E1F23B32A006B2DF2 /* sys_unix.cpp in Sources */, + 4ECAC2721F8A8B390013B963 /* slirp.c in Sources */, + 7539E1271F23B25A006B2DF2 /* cdrom.cpp in Sources */, + 753253311F5368370024025B /* cpuemu_nf.cpp in Sources */, + 7539E1261F23B25A006B2DF2 /* audio.cpp in Sources */, + 7539E1701F23B25A006B2DF2 /* prefs.cpp in Sources */, + 7539E12D1F23B25A006B2DF2 /* ether.cpp in Sources */, + 4ECAC2731F8A8B390013B963 /* socket.c in Sources */, + 7539E26C1F23B32A006B2DF2 /* sshpty.c in Sources */, + 4ECAC2741F8A8B480013B963 /* tcp_input.c in Sources */, + 4ECAC26A1F8A8AF80013B963 /* debug.c in Sources */, + 7539E1781F23B25A006B2DF2 /* serial.cpp in Sources */, + 757A2BF01F5AF9D6003EDB01 /* user_strings_unix.cpp in Sources */, + 7539E1991F23B25A006B2DF2 /* flags.cpp in Sources */, + 4ECAC2691F8A8AF10013B963 /* cksum.c in Sources */, + 7539E2921F23C56F006B2DF2 /* scsi_dummy.cpp in Sources */, + 7539E16F1F23B25A006B2DF2 /* prefs_items.cpp in Sources */, + 7539E18E1F23B25A006B2DF2 /* sony.cpp in Sources */, + 7539E26F1F23B32A006B2DF2 /* timer_unix.cpp in Sources */, + 7539E12E1F23B25A006B2DF2 /* extfs.cpp in Sources */, + 7539E23F1F23B32A006B2DF2 /* bincue_unix.cpp in Sources */, + 7539E12C1F23B25A006B2DF2 /* emul_op.cpp in Sources */, + 7539E19D1F23B25A006B2DF2 /* mathlib.cpp in Sources */, + 4ECAC2671F8A8A5D0013B963 /* ether_unix.cpp in Sources */, + 752F27031F242F51001032B4 /* xpram_sdl.cpp in Sources */, + 7539E16D1F23B25A006B2DF2 /* pict.c in Sources */, + 7539E1251F23B25A006B2DF2 /* adb.cpp in Sources */, + 4ECAC2751F8A8B480013B963 /* tcp_output.c in Sources */, + 7539E12F1F23B25A006B2DF2 /* macos_util.cpp in Sources */, + 7539E24A1F23B32A006B2DF2 /* disk_sparsebundle.cpp in Sources */, + 4ECAC26C1F8A8B120013B963 /* ip_icmp.c in Sources */, + 7539E18D1F23B25A006B2DF2 /* slot_rom.cpp in Sources */, + 7539E1731F23B25A006B2DF2 /* scsi.cpp in Sources */, + 7539E12B1F23B25A006B2DF2 /* disk.cpp in Sources */, + 7539E1E31F23B25A006B2DF2 /* xpram.cpp in Sources */, + 4ECAC2681F8A8AE90013B963 /* bootp.c in Sources */, + 4ECAC2711F8A8B350013B963 /* sbuf.c in Sources */, + 7539E24C1F23B32A006B2DF2 /* extfs_unix.cpp in Sources */, + 7539E2681F23B32A006B2DF2 /* rpc_unix.cpp in Sources */, + 7539E2911F23C56F006B2DF2 /* prefs_editor_dummy.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 752F27171F251B5C001032B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Framework; + targetProxy = 752F27161F251B5C001032B4 /* PBXContainerItemProxy */; + }; + 7532530C1F53611F0024025B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 753252D91F5358D30024025B /* build68k */; + targetProxy = 7532530B1F53611F0024025B /* PBXContainerItemProxy */; + }; + 7532531B1F5364030024025B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 753252F21F535E1E0024025B /* gencpu */; + targetProxy = 7532531A1F5364030024025B /* PBXContainerItemProxy */; + }; + 7532531D1F53640B0024025B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 753253071F5360E30024025B /* run_build68k */; + targetProxy = 7532531C1F53640B0024025B /* PBXContainerItemProxy */; + }; + 7532531F1F5364170024025B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 753253161F5363D20024025B /* run_gencpu */; + targetProxy = 7532531E1F5364170024025B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 7539E00F1F23B25A006B2DF2 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 7539E0101F23B25A006B2DF2 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 753252DE1F5358D30024025B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LIBRARY = "compiler-default"; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 753252DF1F5358D30024025B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LIBRARY = "compiler-default"; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 753252F81F535E1E0024025B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LIBRARY = "compiler-default"; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 753252F91F535E1E0024025B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LIBRARY = "compiler-default"; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 753253091F5360E30024025B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 7532530A1F5360E30024025B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 753253181F5363D20024025B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 753253191F5363D20024025B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 7539DFC41F23B17E006B2DF2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_CONFIG_H, + "USE_XCODE=1", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", + ../MacOSX, + ../include, + ../uae_cpu, + ../UNIX, + ); + MACOSX_DEPLOYMENT_TARGET = 10.7; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 7539DFC51F23B17E006B2DF2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_CONFIG_H, + "USE_XCODE=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", + ../MacOSX, + ../include, + ../uae_cpu, + ../UNIX, + ); + MACOSX_DEPLOYMENT_TARGET = 10.7; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 7539DFC71F23B17E006B2DF2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = NO; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = NO; + CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; + COMBINE_HIDPI_IMAGES = NO; + ENABLE_NS_ASSERTIONS = YES; + ENABLE_TESTABILITY = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_USE_STANDARD_INCLUDE_SEARCHING = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; + HEADER_SEARCH_PATHS = ( + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", + ../MacOSX, + ../include, + ../uae_cpu, + ../Unix, + ../slirp, + ); + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_CFLAGS = ""; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.basiliskii.BasiliskII; + PRODUCT_NAME = "$(TARGET_NAME)"; + USE_HEADERMAP = YES; + WARNING_CFLAGS = ""; + }; + name = Debug; + }; + 7539DFC81F23B17E006B2DF2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = NO; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = NO; + CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; + COMBINE_HIDPI_IMAGES = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_NS_ASSERTIONS = YES; + ENABLE_TESTABILITY = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_DYNAMIC_NO_PIC = YES; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_OPTIMIZATION_LEVEL = fast; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_USE_STANDARD_INCLUDE_SEARCHING = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; + HEADER_SEARCH_PATHS = ( + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", + ../MacOSX, + ../include, + ../uae_cpu, + ../Unix, + ../slirp, + ); + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_CFLAGS = ""; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.basiliskii.BasiliskII; + PRODUCT_NAME = "$(TARGET_NAME)"; + USE_HEADERMAP = YES; + WARNING_CFLAGS = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 753252E31F5358D30024025B /* Build configuration list for PBXNativeTarget "build68k" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 753252DE1F5358D30024025B /* Debug */, + 753252DF1F5358D30024025B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 753252F71F535E1E0024025B /* Build configuration list for PBXNativeTarget "gencpu" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 753252F81F535E1E0024025B /* Debug */, + 753252F91F535E1E0024025B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 753253081F5360E30024025B /* Build configuration list for PBXLegacyTarget "run_build68k" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 753253091F5360E30024025B /* Debug */, + 7532530A1F5360E30024025B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 753253171F5363D20024025B /* Build configuration list for PBXLegacyTarget "run_gencpu" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 753253181F5363D20024025B /* Debug */, + 753253191F5363D20024025B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7539DFAD1F23B17E006B2DF2 /* Build configuration list for PBXProject "BasiliskII" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7539DFC41F23B17E006B2DF2 /* Debug */, + 7539DFC51F23B17E006B2DF2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7539DFC61F23B17E006B2DF2 /* Build configuration list for PBXNativeTarget "BasiliskII" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7539DFC71F23B17E006B2DF2 /* Debug */, + 7539DFC81F23B17E006B2DF2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7539DFAA1F23B17E006B2DF2 /* Project object */; +} diff --git a/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..8c36dd88 --- /dev/null +++ b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/BasiliskII/src/MacOSX/BasiliskII_keycodes b/BasiliskII/src/MacOSX/BasiliskII_keycodes new file mode 100644 index 00000000..cfdc7f5f --- /dev/null +++ b/BasiliskII/src/MacOSX/BasiliskII_keycodes @@ -0,0 +1,576 @@ +# /usr/share/BasiliskII/keycodes +# +# Basilisk II (C) 1997-2005 Christian Bauer +# +# This file is used to translate the (server-specific) scancodes to +# Mac keycodes depending on the window server being used. +# +# The format of this file is as follows: +# +# sdl +# +# +# +# ... +# sdl +# +# +# ... +# +# The "driver string" must match the first part of the SDL driver vendor +# description as reported by SDL_VideoDriverName(). If a match is found, +# the keycode translation table is constructed from the following +# lines. Each line contains an SDL scancode followed by its associated +# Mac keycode. Both keycodes have to be given in decimal. Lines +# beginning with "#" or ";" are treated as comments and ignored. +# + +# +# Cocoa French Keyboard +# + +sdl cocoa +41 53 # Esc +58 122 # F1 +59 120 # F2 +60 99 # F3 +61 118 # F4 +62 96 # F5 +63 97 # F6 +64 98 # F7 +65 100 # F8 +66 101 # F9 +67 109 # F10 +68 103 # F11 +69 111 # F12 +70 105 # F13/PrintScrn +71 107 # F14/Scroll Lock +72 113 # F15/Pause +53 10 # ` +30 18 # 1 +31 19 # 2 +32 20 # 3 +33 21 # 4 +34 23 # 5 +35 22 # 6 +36 26 # 7 +37 28 # 8 +38 25 # 9 +39 29 # 0 +45 27 # - +46 24 # = +42 51 # Backspace +73 114 # Help/Insert +74 115 # Home +75 116 # Page Up +83 71 # Num Lock +81 81 # KP = +84 75 # KP / +85 67 # KP * +43 48 # Tab +20 12 # Q +26 13 # W +8 14 # E +21 15 # R +23 17 # T +28 16 # Y +24 32 # U +12 34 # I +18 31 # O +19 35 # P +47 33 # [ +48 30 # ] +40 36 # Return +76 117 # Delete +77 119 # End +78 121 # Page Down +95 89 # KP 7 +96 91 # KP 8 +97 92 # KP 9 +86 78 # KP - +130 57 # Caps Lock +4 0 # A +22 1 # S +7 2 # D +9 3 # F +10 5 # G +11 4 # H +13 38 # J +14 40 # K +15 37 # L +51 41 # ; +52 39 # ' +49 42 # \ +92 86 # KP 4 +93 87 # KP 5 +94 88 # KP 6 +87 69 # KP + +56 56 # Shift +100 50 # International SDL_NONUSBACKSLASH +29 6 # Z +27 7 # X +6 8 # C +25 9 # V +5 11 # B +17 45 # N +16 46 # M +54 43 # , +55 47 # . +56 44 # / +82 62 # Cursor Up +80 59 # Cursor Left +81 61 # Cursor Down +79 60 # Cursor Right +83 83 # KP 1 +84 84 # KP 2 +85 85 # KP 3 +76 76 # KP Enter +228 54 # Ctrl +226 58 # Option +227 55 # Command +224 54 # Ctrl Left +230 58 # Right Alt->option +231 55 # Right cmd +44 49 # Space +82 82 # KP 0 +65 65 # KP . + +# +# X11 server +# +sdl x11 +sdl dga +9 53 # Esc +67 122 # F1 +68 120 # F2 +69 99 # F3 +70 118 # F4 +71 96 # F5 +72 97 # F6 +73 98 # F7 +74 100 # F8 +75 101 # F9 +76 109 # F10 +95 103 # F11 +96 111 # F12 +111 105 # PrintScrn +78 107 # Scroll Lock +110 113 # Pause +49 10 # ` +10 18 # 1 +11 19 # 2 +12 20 # 3 +13 21 # 4 +14 23 # 5 +15 22 # 6 +16 26 # 7 +17 28 # 8 +18 25 # 9 +19 29 # 0 +20 27 # - +21 24 # = +22 51 # Backspace +106 114 # Insert +97 115 # Home +99 116 # Page Up +77 71 # Num Lock +112 75 # KP / +63 67 # KP * +82 78 # KP - +23 48 # Tab +24 12 # Q +25 13 # W +26 14 # E +27 15 # R +28 17 # T +29 16 # Y +30 32 # U +31 34 # I +32 31 # O +33 35 # P +34 33 # [ +35 30 # ] +36 36 # Return +107 117 # Delete +103 119 # End +105 121 # Page Down +79 89 # KP 7 +80 91 # KP 8 +81 92 # KP 9 +86 69 # KP + +66 57 # Caps Lock +38 0 # A +39 1 # S +40 2 # D +41 3 # F +42 5 # G +43 4 # H +44 38 # J +45 40 # K +46 37 # L +47 41 # ; +48 39 # ' +83 86 # KP 4 +84 87 # KP 5 +85 88 # KP 6 +50 56 # Shift Left +94 50 # International +52 6 # Z +53 7 # X +54 8 # C +55 9 # V +56 11 # B +57 45 # N +58 46 # M +59 43 # , +60 47 # . +61 44 # / +62 56 # Shift Right +51 42 # \ +98 62 # Cursor Up +87 83 # KP 1 +88 84 # KP 2 +89 85 # KP 3 +108 76 # KP Enter +37 54 # Ctrl Left +115 58 # Logo Left (-> Option) +64 55 # Alt Left (-> Command) +65 49 # Space +113 55 # Alt Right (-> Command) +116 58 # Logo Right (-> Option) +117 50 # Menu (-> International) +109 54 # Ctrl Right +100 59 # Cursor Left +104 61 # Cursor Down +102 60 # Cursor Right +90 82 # KP 0 +91 65 # KP . + +# +# Linux Framebuffer Console +# +sdl fbcon +1 53 # Esc +59 122 # F1 +60 120 # F2 +61 99 # F3 +62 118 # F4 +63 96 # F5 +64 97 # F6 +65 98 # F7 +66 100 # F8 +67 101 # F9 +68 109 # F10 +87 103 # F11 +88 111 # F12 +99 105 # PrintScrn +70 107 # Scroll Lock +119 113 # Pause +41 10 # ` +2 18 # 1 +3 19 # 2 +4 20 # 3 +5 21 # 4 +6 23 # 5 +7 22 # 6 +8 26 # 7 +9 28 # 8 +10 25 # 9 +11 29 # 0 +12 27 # - +13 24 # = +14 51 # Backspace +110 114 # Insert +102 115 # Home +104 116 # Page Up +69 71 # Num Lock +98 75 # KP / +55 67 # KP * +74 78 # KP - +15 48 # Tab +16 12 # Q +17 13 # W +18 14 # E +19 15 # R +20 17 # T +21 16 # Y +22 32 # U +23 34 # I +24 31 # O +25 35 # P +26 33 # [ +27 30 # ] +28 36 # Return +111 117 # Delete +107 119 # End +109 121 # Page Down +71 89 # KP 7 +72 91 # KP 8 +73 92 # KP 9 +78 69 # KP + +58 57 # Caps Lock +30 0 # A +31 1 # S +32 2 # D +33 3 # F +34 5 # G +35 4 # H +36 38 # J +37 40 # K +38 37 # L +39 41 # ; +40 39 # ' +75 86 # KP 4 +76 87 # KP 5 +77 88 # KP 6 +42 56 # Shift Left +86 50 # International +44 6 # Z +45 7 # X +46 8 # C +47 9 # V +48 11 # B +49 45 # N +50 46 # M +51 43 # , +52 47 # . +53 44 # / +54 56 # Shift Right +43 42 # \ +103 62 # Cursor Up +79 83 # KP 1 +80 84 # KP 2 +81 85 # KP 3 +96 76 # KP Enter +29 54 # Ctrl Left +125 58 # Logo Left (-> Option) +56 55 # Alt Left (-> Command) +57 49 # Space +100 55 # Alt Right (-> Command) +126 58 # Logo Right (-> Option) +97 54 # Ctrl Right +105 59 # Cursor Left +108 61 # Cursor Down +106 60 # Cursor Right +82 82 # KP 0 +83 65 # KP . + +# +# Quartz (1:1 translation actually) +# +sdl Quartz +41 53 # Esc +58 122 # F1 +59 120 # F2 +60 99 # F3 +61 118 # F4 +62 96 # F5 +63 97 # F6 +64 98 # F7 +65 100 # F8 +66 101 # F9 +67 109 # F10 +68 103 # F11 +69 111 # F12 +70 105 # F13/PrintScrn +71 107 # F14/Scroll Lock +72 113 # F15/Pause +52 10 # ` +30 18 # 1 +31 19 # 2 +32 20 # 3 +33 21 # 4 +34 23 # 5 +35 22 # 6 +36 26 # 7 +37 28 # 8 +38 25 # 9 +39 29 # 0 +45 27 # - +24 24 # = +42 51 # Backspace +114 114 # Help/Insert +74 115 # Home +75 116 # Page Up +83 71 # Num Lock +81 81 # KP = +84 75 # KP / +85 67 # KP * +48 48 # Tab +20 12 # Q +26 13 # W +8 14 # E +21 15 # R +23 17 # T +28 16 # Y +24 32 # U +12 34 # I +18 31 # O +19 35 # P +47 33 # [ +48 30 # ] +40 36 # Return +117 117 # Delete +119 119 # End +121 121 # Page Down +95 89 # KP 7 +96 91 # KP 8 +97 92 # KP 9 +86 78 # KP - +57 57 # Caps Lock +4 0 # A +22 1 # S +7 2 # D +9 3 # F +10 5 # G +11 4 # H +13 38 # J +14 40 # K +15 37 # L +51 41 # ; +52 39 # ' +49 42 # \ +92 86 # KP 4 +93 87 # KP 5 +94 88 # KP 6 +87 69 # KP + +56 56 # Shift +100 50 # International SDL_NONUSBACKSLASH +29 6 # Z +27 7 # X +6 8 # C +25 9 # V +5 11 # B +17 45 # N +16 46 # M +54 43 # , +55 47 # . +56 44 # / +126 62 # Cursor Up +123 59 # Cursor Left +125 61 # Cursor Down +124 60 # Cursor Right +83 83 # KP 1 +84 84 # KP 2 +85 85 # KP 3 +76 76 # KP Enter +228 54 # Ctrl +226 58 # Option +227 55 # Command +224 54 # Ctrl Left +230 58 # Right Alt->option +231 55 # Right cmd +44 49 # Space +82 82 # KP 0 +65 65 # KP . + +# +# Windows +# +sdl windib +sdl directx +1 53 # Esc +59 122 # F1 +60 120 # F2 +61 99 # F3 +62 118 # F4 +63 96 # F5 +64 97 # F6 +65 98 # F7 +66 100 # F8 +67 101 # F9 +68 109 # F10 +87 103 # F11 +88 111 # F12 +183 105 # PrintScrn +70 107 # Scroll Lock +197 113 # Pause +41 10 # ` +2 18 # 1 +3 19 # 2 +4 20 # 3 +5 21 # 4 +6 23 # 5 +7 22 # 6 +8 26 # 7 +9 28 # 8 +10 25 # 9 +11 29 # 0 +12 27 # - +13 24 # = +14 51 # Backspace +210 114 # Insert +199 115 # Home +75 116 # Page Up +69 71 # Num Lock +181 75 # KP / +55 67 # KP * +74 78 # KP - +15 48 # Tab +16 12 # Q +17 13 # W +18 14 # E +19 15 # R +20 17 # T +21 16 # Y +22 32 # U +23 34 # I +24 31 # O +25 35 # P +26 33 # [ +27 30 # ] +28 36 # Return +211 117 # Delete +207 119 # End +209 121 # Page Down +71 89 # KP 7 +72 91 # KP 8 +73 92 # KP 9 +78 69 # KP + +58 57 # Caps Lock +30 0 # A +31 1 # S +32 2 # D +33 3 # F +34 5 # G +35 4 # H +36 38 # J +37 40 # K +38 37 # L +39 41 # ; +40 39 # ' +75 86 # KP 4 +76 87 # KP 5 +77 88 # KP 6 +225 56 # Shift Left +100 50 # International +44 6 # Z +45 7 # X +46 8 # C +47 9 # V +48 11 # B +49 45 # N +50 46 # M +51 43 # , +52 47 # . +53 44 # / +229 56 # Shift Right +43 42 # \ +200 62 # Cursor Up +79 83 # KP 1 +80 84 # KP 2 +81 85 # KP 3 +156 76 # KP Enter +224 54 # Ctrl Left +227 58 # Logo Left (-> Option) +226 55 # Alt Left (-> Command) +57 49 # Space +230 55 # Alt Right (-> Command) +231 58 # Logo Right (-> Option) +221 50 # Menu (-> International) +157 54 # Ctrl Right +80 59 # Cursor Left +81 61 # Cursor Down +79 60 # Cursor Right +98 82 # KP 0 +99 65 # KP . diff --git a/BasiliskII/src/MacOSX/Credits.html b/BasiliskII/src/MacOSX/Credits.html index 29ee57a9..aa43da65 100644 --- a/BasiliskII/src/MacOSX/Credits.html +++ b/BasiliskII/src/MacOSX/Credits.html @@ -4,8 +4,14 @@ It enables you to run 68k MacOS software on your computer, even if you are using
The Official Basilisk II Home Page
+
MacOS X (native windowing) port
by Nigel Pearson <nigel@ind.tansu.com.au> +
+
+SDL2 port +
+by David Ludwig <dludwig@pobox.com>
diff --git a/BasiliskII/src/MacOSX/English.lproj/InfoPlist.strings b/BasiliskII/src/MacOSX/English.lproj/InfoPlist.strings index fbcc2d40..5b8ae8d0 100755 --- a/BasiliskII/src/MacOSX/English.lproj/InfoPlist.strings +++ b/BasiliskII/src/MacOSX/English.lproj/InfoPlist.strings @@ -1,3 +1,3 @@ /* Localized versions of Info.plist keys */ -NSHumanReadableCopyright = "Copyright © 1997-2006 Christian Bauer et al. Freely distributable under the terms of the GNU GPL."; +NSHumanReadableCopyright = "Copyright © 1997-2017 Christian Bauer et al. Freely distributable under the terms of the GNU GPL."; diff --git a/BasiliskII/src/MacOSX/Info.plist b/BasiliskII/src/MacOSX/Info.plist index 31a02329..391fb133 100644 --- a/BasiliskII/src/MacOSX/Info.plist +++ b/BasiliskII/src/MacOSX/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -7,7 +7,7 @@ CFBundleExecutable BasiliskII CFBundleGetInfoString - Basilisk II version 1.0, Copyright © 1997-2006 Christian Bauer et al. Mac OS X port 19 + Basilisk II version 1.0, Copyright © 1997-2017 Christian Bauer et al. SDL2 port CFBundleIconFile BasiliskII.icns CFBundleIdentifier @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - Basilisk II 1.0, Mac OS X port 19 + Basilisk II 1.0, SDL2 port CFBundleSignature ???? NSHelpFile diff --git a/BasiliskII/src/MacOSX/clip_macosx.cpp b/BasiliskII/src/MacOSX/clip_macosx.cpp index 1d37edfc..a1a3e5da 100644 --- a/BasiliskII/src/MacOSX/clip_macosx.cpp +++ b/BasiliskII/src/MacOSX/clip_macosx.cpp @@ -100,7 +100,8 @@ void GetScrap(void **handle, uint32 type, int32 offset) { #if defined(__LP64__) D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); - #warning Carbon scrapbook function are not implemented in 64-bit mode + #error Carbon scrapbook function are not implemented in 64-bit mode + #error Use clip_macosx64.mm instead. #else D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); ScrapRef theScrap; @@ -177,7 +178,8 @@ void ZeroScrap() void PutScrap(uint32 type, void *scrap, int32 length) { #if defined(__LP64__) - #warning Carbon scrapbook function are not implemented in 64-bit mode + #error Carbon scrapbook function are not implemented in 64-bit mode + #error Use clip_macosx64.mm instead. D(bug("PutScrap type %4.4s, data %08lx, length %ld\n", &type, scrap, length)); #else static bool clear = true; diff --git a/BasiliskII/src/MacOSX/config.h b/BasiliskII/src/MacOSX/config.h new file mode 100644 index 00000000..f75200eb --- /dev/null +++ b/BasiliskII/src/MacOSX/config.h @@ -0,0 +1,822 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +#if ! USE_XCODE +// HACK, dludwig@pobox.com: Unless we are building with Xcode, use the +// config.h file that Autotools generates. This is located in +// BasiliskII/src/Unix/ +#include "../Unix/config.h" +#else + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define is using ESD. */ +/* #undef ENABLE_ESD */ + +/* Define if using DGA with framebuffer device. */ +/* #define ENABLE_FBDEV_DGA 1 */ + +/* Define if using GTK. */ +/* #undef ENABLE_GTK */ + +/* Define if using "mon". */ +/* #undef ENABLE_MON */ + +/* Define if using native 68k mode. */ +/* #undef ENABLE_NATIVE_M68K */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* Define if your system supports TUN/TAP devices. */ +/* #undef ENABLE_TUNTAP */ + +/* Define if using video enabled on SEGV signals. */ +/* #undef ENABLE_VOSF */ +#define ENABLE_VOSF 1 + +/* Define if using XFree86 DGA extension. */ +/* #undef ENABLE_XF86_DGA */ + +/* Define if using XFree86 DGA extension. */ +/* #define ENABLE_XF86_VIDMODE 1 */ + +/* Define to 1 if you have the `acoshl' function. */ +#define HAVE_ACOSHL 1 + +/* Define to 1 if you have the `acosl' function. */ +#define HAVE_ACOSL 1 + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARGZ_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `asinhl' function. */ +#define HAVE_ASINHL 1 + +/* Define to 1 if you have the `asinl' function. */ +#define HAVE_ASINL 1 + +/* Define if your system has header. */ +/* #undef HAVE_ASM_UCONTEXT */ + +/* Define to 1 if you have the `asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* Define to 1 if you have the `atanh' function. */ +#define HAVE_ATANH 1 + +/* Define to 1 if you have the `atanhl' function. */ +#define HAVE_ATANHL 1 + +/* Define to 1 if you have the `atanl' function. */ +#define HAVE_ATANL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_AVAILABILITYMACROS_H 1 + +/* Define to 1 if the system has the type `caddr_t'. */ +#define HAVE_CADDR_T 1 + +/* Define to 1 if you have the `ceill' function. */ +#define HAVE_CEILL 1 + +/* Define to 1 if you have the `cfmakeraw' function. */ +#define HAVE_CFMAKERAW 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `coshl' function. */ +#define HAVE_COSHL 1 + +/* Define to 1 if you have the `cosl' function. */ +#define HAVE_COSL 1 + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_FEOF_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FGETS_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_GETC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you + don't. */ +#define HAVE_DECL__SNPRINTF 0 + +/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you + don't. */ +#define HAVE_DECL__SNWPRINTF 0 + +/* Define if you have /dev/ptmx */ +/* #undef HAVE_DEV_PTMX */ + +/* Define if you have /dev/ptc */ +/* #undef HAVE_DEV_PTS_AND_PTC */ + +/* Define to 1 if you have the `expl' function. */ +#define HAVE_EXPL 1 + +/* Define to 1 if you have the `fabsl' function. */ +#define HAVE_FABSL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `finite' function. */ +#define HAVE_FINITE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FLOATINGPOINT_H */ + +/* Define to 1 if you have the `floorl' function. */ +#define HAVE_FLOORL 1 + +/* Define if framework AppKit is available. */ +#define HAVE_FRAMEWORK_APPKIT 1 + +/* Define if framework Carbon is available. */ +#define HAVE_FRAMEWORK_CARBON 1 + +/* Define if framework CoreFoundation is available. */ +#define HAVE_FRAMEWORK_COREFOUNDATION 1 + +/* Define if framework IOKit is available. */ +#define HAVE_FRAMEWORK_IOKIT 1 + +/* Define if framework SDL is available. */ +/* #undef HAVE_FRAMEWORK_SDL */ + +/* Define to 1 if you have the `fwprintf' function. */ +#define HAVE_FWPRINTF 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getegid' function. */ +#define HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getgid' function. */ +#define HAVE_GETGID 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* Define to 1 if you have the `getuid' function. */ +#define HAVE_GETUID 1 + +/* Define if libgnomeui is available. */ +/* #undef HAVE_GNOMEUI */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_HISTORY_H */ + +/* Define if you have the iconv() function. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEE754_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* Define to 1 if you have the `inet_aton' function. */ +#define HAVE_INET_ATON 1 + +/* Define if you have the 'intmax_t' type in or . */ +#define HAVE_INTMAX_T 1 + +/* Define if exists and doesn't clash with . */ +#define HAVE_INTTYPES_H 1 + +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 + +/* Define to 1 if you have the header + file. */ +#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDEVICE_H 1 + +/* Define to 1 if you have the `isinf' function. */ +#define HAVE_ISINF 1 + +/* Define to 1 if you have the `isinfl' function. */ +/* #undef HAVE_ISINFL */ + +/* Define to 1 if you have the `isnan' function. */ +#define HAVE_ISNAN 1 + +/* Define to 1 if you have the `isnanl' function. */ +/* #undef HAVE_ISNANL */ + +/* Define to 1 if you have the `isnormal' function. */ +/* #undef HAVE_ISNORMAL */ + +/* Define if you have and nl_langinfo(CODESET). */ +#define HAVE_LANGINFO_CODESET 1 + +/* Define if your file defines LC_MESSAGES. */ +#define HAVE_LC_MESSAGES 1 + +/* Define to 1 if you have the `curses' library (-lcurses). */ +/* #undef HAVE_LIBCURSES */ + +/* Define to 1 if you have the `Hcurses' library (-lHcurses). */ +/* #undef HAVE_LIBHCURSES */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `ncurses' library (-lncurses). */ +/* #undef HAVE_LIBNCURSES */ + +/* Define to 1 if you have the `posix4' library (-lposix4). */ +/* #undef HAVE_LIBPOSIX4 */ + +/* Define to 1 if you have the `readline' library (-lreadline). */ +/* #undef HAVE_LIBREADLINE */ + +/* Define to 1 if you have the `rt' library (-lrt). */ +/* #undef HAVE_LIBRT */ + +/* Define to 1 if you have the `termcap' library (-ltermcap). */ +/* #undef HAVE_LIBTERMCAP */ + +/* Define to 1 if you have the `terminfo' library (-lterminfo). */ +/* #undef HAVE_LIBTERMINFO */ + +/* Define to 1 if you have the `termlib' library (-ltermlib). */ +/* #undef HAVE_LIBTERMLIB */ + +/* Define to 1 if you have the `vhd' library (-lvhd). */ +/* #undef HAVE_LIBVHD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if there is a linker script to relocate the executable above + 0x70000000. */ +/* #undef HAVE_LINKER_SCRIPT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IF_TUN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if the system has the type `loff_t'. */ +/* #undef HAVE_LOFF_T */ + +/* Define to 1 if you have the `log10l' function. */ +#define HAVE_LOG10L 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LOGIN_H */ + +/* Define to 1 if you have the `logl' function. */ +#define HAVE_LOGL 1 + +/* Define if you have the 'long double' type. */ +#define HAVE_LONG_DOUBLE 1 + +/* Define if you have the 'long long' type. */ +#define HAVE_LONG_LONG 1 + +/* Define if your system supports Mach exceptions. */ +#define HAVE_MACH_EXCEPTIONS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MACH_MACH_H 1 + +/* Define to 1 if you have the `mach_task_self' function. */ +#define HAVE_MACH_TASK_SELF 1 + +/* Define if your system has a working vm_allocate()-based memory allocator. + */ +#define HAVE_MACH_VM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MALLOC_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mempcpy' function. */ +/* #undef HAVE_MEMPCPY */ + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define if defines MAP_ANON and mmap()'ing with MAP_ANON works. + */ +/* #undef HAVE_MMAP_ANON */ + +/* Define if defines MAP_ANONYMOUS and mmap()'ing with + MAP_ANONYMOUS works. */ +/* #undef HAVE_MMAP_ANONYMOUS */ + +/* Define if your system has a working mmap()-based memory allocator. */ +/* #undef HAVE_MMAP_VM */ + +/* Define to 1 if you have the `mprotect' function. */ +#define HAVE_MPROTECT 1 + +/* Define to 1 if you have the `munmap' function. */ +#define HAVE_MUNMAP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NET_IF_TUN_H */ + +/* Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for + sshpty.c). */ +/* #undef HAVE_NEWS4 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NL_TYPES_H 1 + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define if your printf() function supports format strings with positions. */ +#define HAVE_POSIX_PRINTF 1 + +/* Define to 1 if you have the `powl' function. */ +#define HAVE_POWL 1 + +/* Define if pthreads are available. */ +#define HAVE_PTHREADS 1 + +/* Define to 1 if you have the `pthread_cancel' function. */ +#define HAVE_PTHREAD_CANCEL 1 + +/* Define to 1 if you have the `pthread_cond_init' function. */ +#define HAVE_PTHREAD_COND_INIT 1 + +/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */ +#define HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1 + +/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */ +#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1 + +/* Define to 1 if you have the `pthread_mutexattr_settype' function. */ +#define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1 + +/* Define to 1 if you have the `pthread_testcancel' function. */ +#define HAVE_PTHREAD_TESTCANCEL 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PTY_H */ + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READLINE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_READLINE_HISTORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_READLINE_READLINE_H 1 + +/* Define to 1 if you have the `sem_init' function. */ +#define HAVE_SEM_INIT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define if we know a hack to replace siginfo_t->si_addr member. */ +/* #undef HAVE_SIGCONTEXT_SUBTERFUGE */ + +/* Define if your system supports extended signals. */ +/* #undef HAVE_SIGINFO_T */ +//#define HAVE_SIGINFO_T 1 + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if you have the `signbit' function. */ +/* #undef HAVE_SIGNBIT */ + +/* Define if we can ignore the fault (instruction skipping in SIGSEGV + handler). */ +#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 + +/* Define to 1 if you have the `sinhl' function. */ +#define HAVE_SINHL 1 + +/* Define to 1 if you have the `sinl' function. */ +#define HAVE_SINL 1 + +/* Define if slirp library is supported */ +#define HAVE_SLIRP 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `sqrtl' function. */ +#define HAVE_SQRTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define if exists, doesn't clash with , and declares + uintmax_t. */ +#define HAVE_STDINT_H_WITH_UINTMAX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `stpcpy' function. */ +#define HAVE_STPCPY 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BSDTTY_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STROPTS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tanhl' function. */ +#define HAVE_TANHL 1 + +/* Define to 1 if you have the `tanl' function. */ +#define HAVE_TANL 1 + +/* Define to 1 if you have the `task_self' function. */ +/* #undef HAVE_TASK_SELF */ + +/* Define to 1 if you have the `timer_create' function. */ +/* #undef HAVE_TIMER_CREATE */ + +/* Define to 1 if you have the `tsearch' function. */ +#define HAVE_TSEARCH 1 + +/* Define if you have the 'uintmax_t' type in or . */ +#define HAVE_UINTMAX_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the 'unsigned long long' type. */ +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIL_H 1 + +/* Define to 1 if you have the `vhangup' function. */ +/* #undef HAVE_VHANGUP */ + +/* Define to 1 if you have the `vm_allocate' function. */ +#define HAVE_VM_ALLOCATE 1 + +/* Define to 1 if you have the `vm_deallocate' function. */ +#define HAVE_VM_DEALLOCATE 1 + +/* Define to 1 if you have the `vm_protect' function. */ +#define HAVE_VM_PROTECT 1 + +/* Define if you have the 'wchar_t' type. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcslen' function. */ +#define HAVE_WCSLEN 1 + +/* Define if your system supports Windows exceptions. */ +/* #undef HAVE_WIN32_EXCEPTIONS */ + +/* Define if you have the 'wint_t' type. */ +#define HAVE_WINT_T 1 + +/* Define to 1 if you have the `_getpty' function. */ +/* #undef HAVE__GETPTY */ + +/* Define to 1 if you have the `__argz_count' function. */ +/* #undef HAVE___ARGZ_COUNT */ + +/* Define to 1 if you have the `__argz_next' function. */ +/* #undef HAVE___ARGZ_NEXT */ + +/* Define to 1 if you have the `__argz_stringify' function. */ +/* #undef HAVE___ARGZ_STRINGIFY */ + +/* Define to 1 if you have the `__fsetlocking' function. */ +/* #undef HAVE___FSETLOCKING */ + +/* Define to the floating point format of the host machine. */ +#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT + +/* Define to 1 if the host machine stores floating point numbers in memory + with the word containing the sign bit at the lowest address, or to 0 if it + does it the other way around. This macro should not be defined if the + ordering is the same as for multi-word integers. */ +/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */ + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Define if integer division by zero raises signal SIGFPE. */ +#define INTDIV0_RAISES_SIGFPE 0 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define this program name. */ +#define PACKAGE "Basilisk II" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "Christian.Bauer@uni-mainz.de" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Basilisk II" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Basilisk II 1.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "BasiliskII" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0" + +/* Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this + system. */ +/* #undef PAGEZERO_HACK */ + +/* Define if exists and defines unusable PRI* macros. */ +/* #undef PRI_MACROS_BROKEN */ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define if your system requires sigactions to be reinstalled. */ +/* #undef SIGACTION_NEED_REINSTALL */ + +/* Define if your system requires signals to be reinstalled. */ +/* #undef SIGNAL_NEED_REINSTALL */ + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +/* #undef SIZE_MAX */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if BSD-style non-blocking I/O is to be used */ +/* #undef USE_FIONBIO */ + +/* Define to enble SDL support */ +#define USE_SDL 1 + +/* Define to enable SDL audio support */ +#define USE_SDL_AUDIO 1 + +/* Define to enable SDL video graphics support */ +#define USE_SDL_VIDEO 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define this program version. */ +#define VERSION "1.0" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define as the type of the result of subtracting two pointers, if the system + doesn't define it. */ +/* #undef ptrdiff_t */ + +/* Define to empty if the C compiler doesn't support this keyword. */ +/* #undef signed */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to 'int' if doesn't define. */ +/* #undef socklen_t */ + +/* Define to unsigned long or unsigned long long if and + don't define. */ +/* #undef uintmax_t */ + +#define FPU_UAE 1 +//#define FPU_IMPLEMENTATION 1 + +#endif diff --git a/BasiliskII/src/MacOSX/run_build68k_for_xcode.sh b/BasiliskII/src/MacOSX/run_build68k_for_xcode.sh new file mode 100755 index 00000000..30047f7f --- /dev/null +++ b/BasiliskII/src/MacOSX/run_build68k_for_xcode.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e + +# +# run_build68k_for_xcode.sh +# +# Generates files for 68k emulation, via UAE's virtual cpu, for use on Mac OS X hosts +# + +if [ ! -d "$BUILT_PRODUCTS_DIR" ] || [ ! "$PROJECT_DIR" ]; then + echo "ERROR: $(basename $0) must be run from an Xcode 'External Build System' target" + exit 1 +fi + +# Log some debugging information +echo "1=$1" +echo "BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR" +echo "PROJECT_DIR=$PROJECT_DIR" + +# Perform actions, given the passed-in build step +case "$1" in + "clean") + echo "Cleaning build68k output(s)" + rm -rf "$BUILT_PRODUCTS_DIR/build68k_output" + ;; + "") + echo "Running build68k" + cd "$BUILT_PRODUCTS_DIR" + mkdir -p build68k_output + cd build68k_output + cat "$PROJECT_DIR/../uae_cpu/table68k" | "$BUILT_PRODUCTS_DIR/build68k" > "./defs68k.c" + ls -al + ;; +esac diff --git a/BasiliskII/src/MacOSX/run_gencpu_for_xcode.sh b/BasiliskII/src/MacOSX/run_gencpu_for_xcode.sh new file mode 100755 index 00000000..16c014df --- /dev/null +++ b/BasiliskII/src/MacOSX/run_gencpu_for_xcode.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e + +# +# run_gemcpu_for_xcode.sh +# +# Generates files for 68k emulation, via UAE's virtual cpu, for use on Mac OS X hosts +# + +if [ ! -d "$BUILT_PRODUCTS_DIR" ] || [ ! "$PROJECT_DIR" ]; then + echo "ERROR: $(basename $0) must be run from an Xcode 'External Build System' target" + exit 1 +fi + +# Log some debugging information +echo "1=$1" +echo "BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR" +echo "PROJECT_DIR=$PROJECT_DIR" + +# Perform actions, given the passed-in build step +case "$1" in + "clean") + echo "Cleaning gencpu output(s)" + rm -rf "$BUILT_PRODUCTS_DIR/gencpu_output" + ;; + "") + echo "Running gencpu" + cd "$BUILT_PRODUCTS_DIR" + mkdir -p gencpu_output + cd gencpu_output + "$BUILT_PRODUCTS_DIR/gencpu" + ls -al + ;; +esac diff --git a/BasiliskII/src/MacOSX/sys_darwin.cpp b/BasiliskII/src/MacOSX/sys_darwin.cpp index cc6c8a3c..5582fff0 100644 --- a/BasiliskII/src/MacOSX/sys_darwin.cpp +++ b/BasiliskII/src/MacOSX/sys_darwin.cpp @@ -259,7 +259,7 @@ void DarwinAddFloppyPrefs(void) while ((nextFloppy = IOIteratorNext(allFloppies))) { char bsdPath[MAXPATHLEN]; - long size; + long size = 0; Boolean gotSize = FALSE; CFTypeRef sizeAsCFNumber = IORegistryEntryCreateCFProperty(nextFloppy, diff --git a/BasiliskII/src/MacOSX/utils_macosx.mm b/BasiliskII/src/MacOSX/utils_macosx.mm index b653638d..e5683341 100644 --- a/BasiliskII/src/MacOSX/utils_macosx.mm +++ b/BasiliskII/src/MacOSX/utils_macosx.mm @@ -20,6 +20,11 @@ #include #include "utils_macosx.h" +#include + +#if SDL_VERSION_ATLEAST(2,0,0) +#include +#endif // This is used from video_sdl.cpp. void NSAutoReleasePool_wrap(void (*fn)(void)) @@ -28,3 +33,37 @@ void NSAutoReleasePool_wrap(void (*fn)(void)) fn(); [pool release]; } + +void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() { + for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) { + if (menu_item.hasSubmenu) { + for (NSMenuItem * sub_item in menu_item.submenu.itemArray) { + sub_item.keyEquivalent = @""; + sub_item.keyEquivalentModifierMask = 0; + } + } + } +} + +#if SDL_VERSION_ATLEAST(2,0,0) +bool is_fullscreen_osx(SDL_Window * window) +{ + if (!window) { + return false; + } + + SDL_SysWMinfo wmInfo; + SDL_VERSION(&wmInfo.version); + if (!SDL_GetWindowWMInfo(window, &wmInfo)) { + return false; + } + + const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask]; + return (styleMask & NSWindowStyleMaskFullScreen) != 0; +} +#endif + +void set_menu_bar_visible_osx(bool visible) +{ + [NSMenu setMenuBarVisible:(visible ? YES : NO)]; +} diff --git a/BasiliskII/src/SDL/SDLMain.m b/BasiliskII/src/SDL/SDLMain.m index 0f23664d..811e05e1 100644 --- a/BasiliskII/src/SDL/SDLMain.m +++ b/BasiliskII/src/SDL/SDLMain.m @@ -6,6 +6,8 @@ */ #include "SDL.h" +#if (SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)) // SDLMain.m is not needed in SDL 2.x + #include "SDLMain.h" #include /* for MAXPATHLEN */ #include @@ -379,3 +381,4 @@ int main (int argc, char **argv) return 0; } +#endif // ends: SDL version check diff --git a/BasiliskII/src/SDL/audio_sdl.cpp b/BasiliskII/src/SDL/audio_sdl.cpp index 921beb4c..6bff36c3 100644 --- a/BasiliskII/src/SDL/audio_sdl.cpp +++ b/BasiliskII/src/SDL/audio_sdl.cpp @@ -28,6 +28,7 @@ #include #include +#include #define DEBUG 0 #include "debug.h" @@ -87,6 +88,7 @@ static bool open_sdl_audio(void) } SDL_AudioSpec audio_spec; + memset(&audio_spec, 0, sizeof(audio_spec)); audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16; audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? AUDIO_U8 : AUDIO_S16MSB; audio_spec.channels = audio_channel_counts[audio_channel_count_index]; @@ -99,14 +101,27 @@ static bool open_sdl_audio(void) fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError()); return false; } + +#if SDL_VERSION_ATLEAST(2,0,0) + // HACK: workaround a bug in SDL pre-2.0.6 (reported via https://bugzilla.libsdl.org/show_bug.cgi?id=3710 ) + // whereby SDL does not update audio_spec.size + if (audio_spec.size == 0) { + audio_spec.size = (SDL_AUDIO_BITSIZE(audio_spec.format) / 8) * audio_spec.channels * audio_spec.samples; + } +#endif #if defined(BINCUE) OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels, audio_spec.silence); #endif +#if SDL_VERSION_ATLEAST(2,0,0) + const char * driver_name = SDL_GetCurrentAudioDriver(); +#else char driver_name[32]; - printf("Using SDL/%s audio output\n", SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1)); + SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1); +#endif + printf("Using SDL/%s audio output\n", driver_name ? driver_name : ""); silence_byte = audio_spec.silence; SDL_PauseAudio(0); diff --git a/BasiliskII/src/SDL/prefs_sdl.cpp b/BasiliskII/src/SDL/prefs_sdl.cpp new file mode 100644 index 00000000..8150d709 --- /dev/null +++ b/BasiliskII/src/SDL/prefs_sdl.cpp @@ -0,0 +1,106 @@ +/* + * prefs_sdl.cpp - Preferences handling, SDL2 implementation + * + * Basilisk II (C) 1997-2008 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sysdeps.h" + +#include +#include +#include +#include + +#include "prefs.h" + + +// Platform-specific preferences items +prefs_desc platform_prefs_items[] = { + {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, + {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, + {NULL, TYPE_END, false} // End of list +}; + + +// Prefs file name and path +const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs"; + +std::string UserPrefsPath; + + +/* + * Load preferences from settings file + */ + +void LoadPrefs(const char * vmdir) // TODO: load prefs from 'vmdir' +{ + // Build a full-path to the settings file + char prefs_path[4096]; + if (!vmdir) { + vmdir = SDL_getenv("HOME"); + } + if (!vmdir) { + vmdir = "./"; + } + SDL_snprintf(prefs_path, sizeof(prefs_path), "%s/%s", vmdir, PREFS_FILE_NAME); + + // Read preferences from settings file + FILE *f = fopen(prefs_path, "r"); + if (f != NULL) { + + // Prefs file found, load settings + LoadPrefsFromStream(f); + fclose(f); + + } else { + + // No prefs file, save defaults + SavePrefs(); + } +} + + +/* + * Save preferences to settings file + */ + +void SavePrefs(void) +{ + // Build a full-path to the settings file + char prefs_path[4096]; + const char * dir = SDL_getenv("HOME"); + if (!dir) { + dir = "./"; + } + SDL_snprintf(prefs_path, sizeof(prefs_path), "%s/%s", dir, PREFS_FILE_NAME); + + FILE *f; + if ((f = fopen(prefs_path, "w")) != NULL) { + SavePrefsToStream(f); + fclose(f); + } +} + + +/* + * Add defaults of platform-specific prefs items + * You may also override the defaults set in PrefsInit() + */ + +void AddPlatformPrefsDefaults(void) +{ +} diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 011941f9..599a27ad 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -1,5 +1,5 @@ /* - * video_sdl.cpp - Video/graphics emulation, SDL specific stuff + * video_sdl.cpp - Video/graphics emulation, SDL 1.x specific stuff * * Basilisk II (C) 1997-2008 Christian Bauer * @@ -43,6 +43,8 @@ #include "sysdeps.h" #include +#if (SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)) + #include #include #include @@ -584,6 +586,16 @@ static void migrate_screen_prefs(void) #endif } +void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h) +{ + SDL_UpdateRect(screen, x, y, w, h); +} + +void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects) +{ + SDL_UpdateRects(screen, numrects, rects); +} + /* * Display "driver" classes @@ -2223,7 +2235,7 @@ static int redraw_func(void *arg) // Wait next += VIDEO_REFRESH_DELAY; - int32 delay = int32(next - GetTicks_usec()); + uint64 delay = int32(next - GetTicks_usec()); if (delay > 0) Delay_usec(delay); else if (delay < -VIDEO_REFRESH_DELAY) @@ -2269,3 +2281,5 @@ void video_set_dirty_area(int x, int y, int w, int h) // XXX handle dirty bounding boxes for non-VOSF modes } #endif + +#endif // ends: SDL version check diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp new file mode 100644 index 00000000..0b4bfb86 --- /dev/null +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -0,0 +1,2636 @@ +/* + * video_sdl2.cpp - Video/graphics emulation, SDL 2.x specific stuff + * + * Basilisk II (C) 1997-2008 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * NOTES: + * The Ctrl key works like a qualifier for special actions: + * Ctrl-Tab = suspend DGA mode (TODO) + * Ctrl-Esc = emergency quit + * Ctrl-F1 = mount floppy + * Ctrl-F5 = grab mouse (in windowed mode) + * + * FIXMEs and TODOs: + * - Windows requires an extra mouse event to update the actual cursor image? + * - Ctr-Tab for suspend/resume but how? SDL does not support that for non-Linux + * - Ctrl-Fn doesn't generate SDL_KEYDOWN events (SDL bug?) + * - Mouse acceleration, there is no API in SDL yet for that + * - Gamma tables support is likely to be broken here + * - Events processing is bound to the general emulation thread as SDL requires + * to PumpEvents() within the same thread as the one that called SetVideoMode(). + * Besides, there can't seem to be a way to call SetVideoMode() from a child thread. + * - Backport hw cursor acceleration to Basilisk II? + * - Factor out code + */ + +#include "sysdeps.h" + +#include +#if SDL_VERSION_ATLEAST(2,0,0) + +#include +#include +#include +#include + +#ifdef WIN32 +#include /* alloca() */ +#endif + +#include +#include "main.h" +#include "adb.h" +#include "macos_util.h" +#include "prefs.h" +#include "user_strings.h" +#include "video.h" +#include "video_defs.h" +#include "video_blit.h" +#include "vm_alloc.h" + +#define DEBUG 0 +#include "debug.h" + +// Supported video modes +using std::vector; +static vector VideoModes; + +// Display types +#ifdef SHEEPSHAVER +enum { + DISPLAY_WINDOW = DIS_WINDOW, // windowed display + DISPLAY_SCREEN = DIS_SCREEN // fullscreen display +}; +extern int display_type; // See enum above +#else +enum { + DISPLAY_WINDOW, // windowed display + DISPLAY_SCREEN // fullscreen display +}; +static int display_type = DISPLAY_WINDOW; // See enum above +#endif + +// Constants +#ifdef WIN32 +const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes"; +#elif __MACOSX__ +const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes"; +#else +const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes"; +#endif + + +// Global variables +static uint32 frame_skip; // Prefs items +static int16 mouse_wheel_mode; +static int16 mouse_wheel_lines; + +static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into) +static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes) +static uint32 the_buffer_size; // Size of allocated the_buffer + +static bool redraw_thread_active = false; // Flag: Redraw thread installed +#ifndef USE_CPU_EMUL_SERVICES +static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread +static SDL_Thread *redraw_thread = NULL; // Redraw thread +static volatile bool thread_stop_req = false; +static volatile bool thread_stop_ack = false; // Acknowledge for thread_stop_req +#endif + +#ifdef ENABLE_VOSF +static bool use_vosf = false; // Flag: VOSF enabled +#else +static const bool use_vosf = false; // VOSF not possible +#endif + +static bool ctrl_down = false; // Flag: Ctrl key pressed +static bool caps_on = false; // Flag: Caps Lock on +static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread +static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread +static bool emul_suspended = false; // Flag: Emulator suspended + +static bool classic_mode = false; // Flag: Classic Mac video mode + +static bool use_keycodes = false; // Flag: Use keycodes rather than keysyms +static int keycode_table[256]; // X keycode -> Mac keycode translation table + +// SDL variables +SDL_Window * sdl_window = NULL; // Wraps an OS-native window +static SDL_Surface * host_surface = NULL; // Surface in host-OS display format +static SDL_Surface * guest_surface = NULL; // Surface in guest-OS display format +static SDL_Renderer * sdl_renderer = NULL; // Handle to SDL2 renderer +static SDL_threadID sdl_renderer_thread_id = 0; // Thread ID where the SDL_renderer was created, and SDL_renderer ops should run (for compatibility w/ d3d9) +static SDL_Texture * sdl_texture = NULL; // Handle to a GPU texture, with which to draw guest_surface to +static SDL_Rect sdl_update_video_rect = {0,0,0,0}; // Union of all rects to update, when updating sdl_texture +static SDL_mutex * sdl_update_video_mutex = NULL; // Mutex to protect sdl_update_video_rect +static int screen_depth; // Depth of current screen +static SDL_Cursor *sdl_cursor = NULL; // Copy of Mac cursor +static SDL_Palette *sdl_palette = NULL; // Color palette to be used as CLUT and gamma table +static bool sdl_palette_changed = false; // Flag: Palette changed, redraw thread must set new colors +static bool toggle_fullscreen = false; +static bool did_add_event_watch = false; + +static bool mouse_grabbed = false; + +// Mutex to protect SDL events +static SDL_mutex *sdl_events_lock = NULL; +#define LOCK_EVENTS SDL_LockMutex(sdl_events_lock) +#define UNLOCK_EVENTS SDL_UnlockMutex(sdl_events_lock) + +// Mutex to protect palette +static SDL_mutex *sdl_palette_lock = NULL; +#define LOCK_PALETTE SDL_LockMutex(sdl_palette_lock) +#define UNLOCK_PALETTE SDL_UnlockMutex(sdl_palette_lock) + +// Mutex to protect frame buffer +static SDL_mutex *frame_buffer_lock = NULL; +#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock) +#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock) + +// Video refresh function +static void VideoRefreshInit(void); +static void (*video_refresh)(void); + + +// Prototypes +static int redraw_func(void *arg); +static int present_sdl_video(); +static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event); +static bool is_fullscreen(SDL_Window *); + +// From sys_unix.cpp +extern void SysMountFirstFloppy(void); + + +/* + * SDL surface locking glue + */ + +#ifdef ENABLE_VOSF +#define SDL_VIDEO_LOCK_VOSF_SURFACE(SURFACE) do { \ + if (sdl_window && SDL_GetWindowFlags(sdl_window) & (SDL_WINDOW_FULLSCREEN)) \ + the_host_buffer = (uint8 *)(SURFACE)->pixels; \ +} while (0) +#else +#define SDL_VIDEO_LOCK_VOSF_SURFACE(SURFACE) +#endif + +#define SDL_VIDEO_LOCK_SURFACE(SURFACE) do { \ + if (SDL_MUSTLOCK(SURFACE)) { \ + SDL_LockSurface(SURFACE); \ + SDL_VIDEO_LOCK_VOSF_SURFACE(SURFACE); \ + } \ +} while (0) + +#define SDL_VIDEO_UNLOCK_SURFACE(SURFACE) do { \ + if (SDL_MUSTLOCK(SURFACE)) \ + SDL_UnlockSurface(SURFACE); \ +} while (0) + + +/* + * Framebuffer allocation routines + */ + +static void *vm_acquire_framebuffer(uint32 size) +{ + // always try to reallocate framebuffer at the same address + static void *fb = VM_MAP_FAILED; + if (fb != VM_MAP_FAILED) { + if (vm_acquire_fixed(fb, size) < 0) { +#ifndef SHEEPSHAVER + printf("FATAL: Could not reallocate framebuffer at previous address\n"); +#endif + fb = VM_MAP_FAILED; + } + } + if (fb == VM_MAP_FAILED) + fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT); + return fb; +} + +static inline void vm_release_framebuffer(void *fb, uint32 size) +{ + vm_release(fb, size); +} + +static inline int get_customized_color_depth(int default_depth) +{ + int display_color_depth = PrefsFindInt32("displaycolordepth"); + + D(bug("Get displaycolordepth %d\n", display_color_depth)); + + if(0 == display_color_depth) + return default_depth; + else{ + switch (display_color_depth) { + case 8: + return VIDEO_DEPTH_8BIT; + case 15: case 16: + return VIDEO_DEPTH_16BIT; + case 24: case 32: + return VIDEO_DEPTH_32BIT; + default: + return default_depth; + } + } +} + +/* + * Windows message handler + */ + +#ifdef WIN32 +#include +static WNDPROC sdl_window_proc = NULL; // Window proc used by SDL + +extern void SysMediaArrived(void); +extern void SysMediaRemoved(void); +extern HWND GetMainWindowHandle(void); + +static LRESULT CALLBACK windows_message_handler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_DEVICECHANGE: + if (wParam == DBT_DEVICEREMOVECOMPLETE) { + DEV_BROADCAST_HDR *p = (DEV_BROADCAST_HDR *)lParam; + if (p->dbch_devicetype == DBT_DEVTYP_VOLUME) + SysMediaRemoved(); + } + else if (wParam == DBT_DEVICEARRIVAL) { + DEV_BROADCAST_HDR *p = (DEV_BROADCAST_HDR *)lParam; + if (p->dbch_devicetype == DBT_DEVTYP_VOLUME) + SysMediaArrived(); + } + return 0; + + default: + if (sdl_window_proc) + return CallWindowProc(sdl_window_proc, hwnd, msg, wParam, lParam); + } + + return DefWindowProc(hwnd, msg, wParam, lParam); +} +#endif + + +/* + * SheepShaver glue + */ + +#ifdef SHEEPSHAVER +// Color depth modes type +typedef int video_depth; + +// 1, 2, 4 and 8 bit depths use a color palette +static inline bool IsDirectMode(VIDEO_MODE const & mode) +{ + return IsDirectMode(mode.viAppleMode); +} + +// Abstract base class representing one (possibly virtual) monitor +// ("monitor" = rectangular display with a contiguous frame buffer) +class monitor_desc { +public: + monitor_desc(const vector &available_modes, video_depth default_depth, uint32 default_id) {} + virtual ~monitor_desc() {} + + // Get current Mac frame buffer base address + uint32 get_mac_frame_base(void) const {return screen_base;} + + // Set Mac frame buffer base address (called from switch_to_mode()) + void set_mac_frame_base(uint32 base) {screen_base = base;} + + // Get current video mode + const VIDEO_MODE &get_current_mode(void) const {return VModes[cur_mode];} + + // Called by the video driver to switch the video mode on this display + // (must call set_mac_frame_base()) + virtual void switch_to_current_mode(void) = 0; + + // Called by the video driver to set the color palette (in indexed modes) + // or the gamma table (in direct modes) + virtual void set_palette(uint8 *pal, int num) = 0; +}; + +// Vector of pointers to available monitor descriptions, filled by VideoInit() +static vector VideoMonitors; + +// Find Apple mode matching best specified dimensions +static int find_apple_resolution(int xsize, int ysize) +{ + if (xsize == 640 && ysize == 480) + return APPLE_640x480; + if (xsize == 800 && ysize == 600) + return APPLE_800x600; + if (xsize == 1024 && ysize == 768) + return APPLE_1024x768; + if (xsize == 1152 && ysize == 768) + return APPLE_1152x768; + if (xsize == 1152 && ysize == 900) + return APPLE_1152x900; + if (xsize == 1280 && ysize == 1024) + return APPLE_1280x1024; + if (xsize == 1600 && ysize == 1200) + return APPLE_1600x1200; + return APPLE_CUSTOM; +} + +// Display error alert +static void ErrorAlert(int error) +{ + ErrorAlert(GetString(error)); +} +#endif + + +/* + * monitor_desc subclass for SDL display + */ + +class SDL_monitor_desc : public monitor_desc { +public: + SDL_monitor_desc(const vector &available_modes, video_depth default_depth, uint32 default_id) : monitor_desc(available_modes, default_depth, default_id) {} + ~SDL_monitor_desc() {} + + virtual void switch_to_current_mode(void); + virtual void set_palette(uint8 *pal, int num); + + bool video_open(void); + void video_close(void); +}; + + +/* + * Utility functions + */ + +// Find palette size for given color depth +static int palette_size(int mode) +{ + switch (mode) { + case VIDEO_DEPTH_1BIT: return 2; + case VIDEO_DEPTH_2BIT: return 4; + case VIDEO_DEPTH_4BIT: return 16; + case VIDEO_DEPTH_8BIT: return 256; + case VIDEO_DEPTH_16BIT: return 32; + case VIDEO_DEPTH_32BIT: return 256; + default: return 0; + } +} + +// Map video_mode depth ID to numerical depth value +static int mac_depth_of_video_depth(int video_depth) +{ + int depth = -1; + switch (video_depth) { + case VIDEO_DEPTH_1BIT: + depth = 1; + break; + case VIDEO_DEPTH_2BIT: + depth = 2; + break; + case VIDEO_DEPTH_4BIT: + depth = 4; + break; + case VIDEO_DEPTH_8BIT: + depth = 8; + break; + case VIDEO_DEPTH_16BIT: + depth = 16; + break; + case VIDEO_DEPTH_32BIT: + depth = 32; + break; + default: + abort(); + } + return depth; +} + +// Map video_mode depth ID to SDL screen depth +static int sdl_depth_of_video_depth(int video_depth) +{ + return (video_depth <= VIDEO_DEPTH_8BIT) ? 8 : mac_depth_of_video_depth(video_depth); +} + +// Get screen dimensions +static void sdl_display_dimensions(int &width, int &height) +{ + SDL_DisplayMode desktop_mode; + const int display_index = 0; // TODO: try supporting multiple displays + if (SDL_GetDesktopDisplayMode(display_index, &desktop_mode) != 0) { + // TODO: report a warning, here? + width = height = 0; + return; + } + width = desktop_mode.w; + height = desktop_mode.h; +} + +static inline int sdl_display_width(void) +{ + int width, height; + sdl_display_dimensions(width, height); + return width; +} + +static inline int sdl_display_height(void) +{ + int width, height; + sdl_display_dimensions(width, height); + return height; +} + +// Check wether specified mode is available +static bool has_mode(int type, int width, int height, int depth) +{ +#ifdef SHEEPSHAVER + // Filter out Classic resolutions + if (width == 512 && height == 384) + return false; +#endif + + // Filter out out-of-bounds resolutions + if (width > sdl_display_width() || height > sdl_display_height()) + return false; + + // Whatever size it is, beyond what we've checked, we'll scale to/from as appropriate. + return true; +} + +// Add mode to list of supported modes +static void add_mode(int type, int width, int height, int resolution_id, int bytes_per_row, int depth) +{ + // Filter out unsupported modes + if (!has_mode(type, width, height, depth)) + return; + + // Fill in VideoMode entry + VIDEO_MODE mode; +#ifdef SHEEPSHAVER + resolution_id = find_apple_resolution(width, height); + mode.viType = type; +#endif + VIDEO_MODE_X = width; + VIDEO_MODE_Y = height; + VIDEO_MODE_RESOLUTION = resolution_id; + VIDEO_MODE_ROW_BYTES = bytes_per_row; + VIDEO_MODE_DEPTH = (video_depth)depth; + VideoModes.push_back(mode); +} + +// Set Mac frame layout and base address (uses the_buffer/MacFrameBaseMac) +static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth, bool native_byte_order) +{ +#if !REAL_ADDRESSING && !DIRECT_ADDRESSING + int layout = FLAYOUT_DIRECT; + if (depth == VIDEO_DEPTH_16BIT) + layout = (screen_depth == 15) ? FLAYOUT_HOST_555 : FLAYOUT_HOST_565; + else if (depth == VIDEO_DEPTH_32BIT) + layout = (screen_depth == 24) ? FLAYOUT_HOST_888 : FLAYOUT_DIRECT; + if (native_byte_order) + MacFrameLayout = layout; + else + MacFrameLayout = FLAYOUT_DIRECT; + monitor.set_mac_frame_base(MacFrameBaseMac); + + // Set variables used by UAE memory banking + const VIDEO_MODE &mode = monitor.get_current_mode(); + MacFrameBaseHost = the_buffer; + MacFrameSize = VIDEO_MODE_ROW_BYTES * VIDEO_MODE_Y; + InitFrameBufferMapping(); +#else + monitor.set_mac_frame_base(Host2MacAddr(the_buffer)); +#endif + D(bug("monitor.mac_frame_base = %08x\n", monitor.get_mac_frame_base())); +} + +// Set window name and class +static void set_window_name(int name) +{ + if (!sdl_window) { + return; + } + const char *str = GetString(name); + SDL_SetWindowTitle(sdl_window, str); +} + +// Set mouse grab mode +static void set_grab_mode(bool grab) +{ + if (!sdl_window) { + return; + } + SDL_SetWindowGrab(sdl_window, grab ? SDL_TRUE : SDL_FALSE); +} + +// Migrate preferences items (XXX to be handled in MigratePrefs()) +static void migrate_screen_prefs(void) +{ +#ifdef SHEEPSHAVER + // Look-up priorities are: "screen", "screenmodes", "windowmodes". + if (PrefsFindString("screen")) + return; + + uint32 window_modes = PrefsFindInt32("windowmodes"); + uint32 screen_modes = PrefsFindInt32("screenmodes"); + int width = 0, height = 0; + if (screen_modes) { + static const struct { + int id; + int width; + int height; + } + modes[] = { + { 1, 640, 480 }, + { 2, 800, 600 }, + { 4, 1024, 768 }, + { 64, 1152, 768 }, + { 8, 1152, 900 }, + { 16, 1280, 1024 }, + { 32, 1600, 1200 }, + { 0, } + }; + for (int i = 0; modes[i].id != 0; i++) { + if (screen_modes & modes[i].id) { + if (width < modes[i].width && height < modes[i].height) { + width = modes[i].width; + height = modes[i].height; + } + } + } + } else { + if (window_modes & 1) + width = 640, height = 480; + if (window_modes & 2) + width = 800, height = 600; + } + if (width && height) { + char str[32]; + sprintf(str, "%s/%d/%d", screen_modes ? "dga" : "win", width, height); + PrefsReplaceString("screen", str); + } +#endif +} + + +/* + * Display "driver" classes + */ + +class driver_base { +public: + driver_base(SDL_monitor_desc &m); + ~driver_base(); + + void init(); // One-time init + void set_video_mode(int flags); + void adapt_to_video_mode(); + + void update_palette(void); + void suspend(void) {} + void resume(void) {} + void toggle_mouse_grab(void); + void mouse_moved(int x, int y) { ADBMouseMoved(x, y); } + + void disable_mouse_accel(void); + void restore_mouse_accel(void); + + void grab_mouse(void); + void ungrab_mouse(void); + +public: + SDL_monitor_desc &monitor; // Associated video monitor + const VIDEO_MODE &mode; // Video mode handled by the driver + + bool init_ok; // Initialization succeeded (we can't use exceptions because of -fomit-frame-pointer) + SDL_Surface *s; // The surface we draw into +}; + +#ifdef ENABLE_VOSF +static void update_display_window_vosf(driver_base *drv); +#endif +static void update_display_static(driver_base *drv); + +static driver_base *drv = NULL; // Pointer to currently used driver object + +#ifdef ENABLE_VOSF +# include "video_vosf.h" +#endif + +driver_base::driver_base(SDL_monitor_desc &m) + : monitor(m), mode(m.get_current_mode()), init_ok(false), s(NULL) +{ + the_buffer = NULL; + the_buffer_copy = NULL; +} + +static void delete_sdl_video_surfaces() +{ + if (sdl_texture) { + SDL_DestroyTexture(sdl_texture); + sdl_texture = NULL; + } + + if (host_surface) { + if (host_surface == guest_surface) { + guest_surface = NULL; + } + + SDL_FreeSurface(host_surface); + host_surface = NULL; + } + + if (guest_surface) { + SDL_FreeSurface(guest_surface); + guest_surface = NULL; + } +} + +static void delete_sdl_video_window() +{ + if (sdl_renderer) { + SDL_DestroyRenderer(sdl_renderer); + sdl_renderer = NULL; + } + + if (sdl_window) { + SDL_DestroyWindow(sdl_window); + sdl_window = NULL; + } +} + +static void shutdown_sdl_video() +{ + delete_sdl_video_surfaces(); + delete_sdl_video_window(); +} + +static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags) +{ + if (guest_surface) { + delete_sdl_video_surfaces(); + } + + int window_width = width; + int window_height = height; + Uint32 window_flags = 0; + const int window_flags_to_monitor = SDL_WINDOW_FULLSCREEN; + + if (flags & SDL_WINDOW_FULLSCREEN) { + SDL_DisplayMode desktop_mode; + if (SDL_GetDesktopDisplayMode(0, &desktop_mode) != 0) { + shutdown_sdl_video(); + return NULL; + } + window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + window_width = desktop_mode.w; + window_height = desktop_mode.h; + } + + if (sdl_window) { + int old_window_width, old_window_height, old_window_flags; + SDL_GetWindowSize(sdl_window, &old_window_width, &old_window_height); + old_window_flags = SDL_GetWindowFlags(sdl_window); + if (old_window_width != window_width || + old_window_height != window_height || + (old_window_flags & window_flags_to_monitor) != (window_flags & window_flags_to_monitor)) + { + delete_sdl_video_window(); + } + } + + // Apply anti-aliasing, if and when appropriate (usually in fullscreen) + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); + + // Always use a resize-able window. This helps allow SDL to manage + // transitions involving fullscreen to or from windowed-mode. + window_flags |= SDL_WINDOW_RESIZABLE; + + if (!sdl_window) { + sdl_window = SDL_CreateWindow( + "Basilisk II", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + window_width, + window_height, + window_flags); + if (!sdl_window) { + shutdown_sdl_video(); + return NULL; + } + } + + // Some SDL events (regarding some native-window events), need processing + // as they are generated. SDL2 has a facility, SDL_AddEventWatch(), which + // allows events to be processed as they are generated. + if (!did_add_event_watch) { + SDL_AddEventWatch(&on_sdl_event_generated, NULL); + did_add_event_watch = true; + } + + if (!sdl_renderer) { + const char *render_driver = PrefsFindString("sdlrender"); + if (render_driver) { + if (SDL_strcmp(render_driver, "auto") == 0) { + SDL_SetHint(SDL_HINT_RENDER_DRIVER, ""); + } else { + SDL_SetHint(SDL_HINT_RENDER_DRIVER, render_driver); + } + } + + sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0); + if (!sdl_renderer) { + shutdown_sdl_video(); + return NULL; + } + sdl_renderer_thread_id = SDL_ThreadID(); + + SDL_RendererInfo info; + memset(&info, 0, sizeof(info)); + SDL_GetRendererInfo(sdl_renderer, &info); + printf("Using SDL_Renderer driver: %s\n", (info.name ? info.name : "(null)")); + } + + if (!sdl_update_video_mutex) { + sdl_update_video_mutex = SDL_CreateMutex(); + } + + SDL_assert(sdl_texture == NULL); + sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, width, height); + if (!sdl_texture) { + shutdown_sdl_video(); + return NULL; + } + sdl_update_video_rect.x = 0; + sdl_update_video_rect.y = 0; + sdl_update_video_rect.w = 0; + sdl_update_video_rect.h = 0; + + SDL_assert(guest_surface == NULL); + SDL_assert(host_surface == NULL); + switch (bpp) { + case 8: + guest_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0); + break; + case 16: + guest_surface = SDL_CreateRGBSurface(0, width, height, 16, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000); + break; + case 32: + guest_surface = SDL_CreateRGBSurface(0, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); + host_surface = guest_surface; + break; + default: + printf("WARNING: An unsupported bpp of %d was used\n", bpp); + break; + } + if (!guest_surface) { + shutdown_sdl_video(); + return NULL; + } + + if (!host_surface) { + Uint32 texture_format; + if (SDL_QueryTexture(sdl_texture, &texture_format, NULL, NULL, NULL) != 0) { + printf("ERROR: Unable to get the SDL texture's pixel format: %s\n", SDL_GetError()); + shutdown_sdl_video(); + return NULL; + } + + int bpp; + Uint32 Rmask, Gmask, Bmask, Amask; + if (!SDL_PixelFormatEnumToMasks(texture_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { + printf("ERROR: Unable to determine format for host SDL_surface: %s\n", SDL_GetError()); + shutdown_sdl_video(); + return NULL; + } + + host_surface = SDL_CreateRGBSurface(0, width, height, bpp, Rmask, Gmask, Bmask, Amask); + if (!host_surface) { + printf("ERROR: Unable to create host SDL_surface: %s\n", SDL_GetError()); + shutdown_sdl_video(); + return NULL; + } + } + + if (SDL_RenderSetLogicalSize(sdl_renderer, width, height) != 0) { + printf("ERROR: Unable to set SDL rendeer's logical size (to %dx%d): %s\n", + width, height, SDL_GetError()); + shutdown_sdl_video(); + return NULL; + } + + return guest_surface; +} + +static int present_sdl_video() +{ + if (!sdl_renderer || !sdl_texture || !guest_surface) { + printf("WARNING: A video mode does not appear to have been set.\n"); + return -1; + } + + // Some systems, such as D3D9, can fail if and when they are used across + // certain operations. To address this, only utilize SDL_Renderer in a + // single thread, preferably the main thread. + // + // This was added as part of a fix for https://github.com/DavidLudwig/macemu/issues/21 + // "BasiliskII, Win32: resizing a window does not stretch " + SDL_assert(SDL_ThreadID() == sdl_renderer_thread_id); + + // Make sure the display's internal (to SDL, possibly the OS) buffer gets + // cleared. Not doing so can, if and when letterboxing is applied (whereby + // colored bars are drawn on the screen's sides to help with aspect-ratio + // correction), the colored bars can be an unknown color. + SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 0); // Use black + SDL_RenderClear(sdl_renderer); // Clear the display + + // We're about to work with sdl_update_video_rect, so stop other threads from + // modifying it! + SDL_LockMutex(sdl_update_video_mutex); + + // Convert from the guest OS' pixel format, to the host OS' texture, if necessary. + if (host_surface != guest_surface && + host_surface != NULL && + guest_surface != NULL) + { + SDL_Rect destRect = sdl_update_video_rect; + if (SDL_BlitSurface(guest_surface, &sdl_update_video_rect, host_surface, &destRect) != 0) { + SDL_UnlockMutex(sdl_update_video_mutex); + return -1; + } + } + + // Update the host OS' texture + void * srcPixels = (void *)((uint8_t *)host_surface->pixels + + sdl_update_video_rect.y * host_surface->pitch + + sdl_update_video_rect.x * host_surface->format->BytesPerPixel); + + if (SDL_UpdateTexture(sdl_texture, &sdl_update_video_rect, srcPixels, host_surface->pitch) != 0) { + SDL_UnlockMutex(sdl_update_video_mutex); + return -1; + } + + // We are done working with pixels in host_surface. Reset sdl_update_video_rect, then let + // other threads modify it, as-needed. + sdl_update_video_rect.x = 0; + sdl_update_video_rect.y = 0; + sdl_update_video_rect.w = 0; + sdl_update_video_rect.h = 0; + SDL_UnlockMutex(sdl_update_video_mutex); + + // Copy the texture to the display + if (SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL) != 0) { + return -1; + } + + // Update the display + SDL_RenderPresent(sdl_renderer); + + // Indicate success to the caller! + return 0; +} + +void update_sdl_video(SDL_Surface *s, int numrects, SDL_Rect *rects) +{ + // TODO: make sure SDL_Renderer resources get displayed, if and when + // MacsBug is running (and VideoInterrupt() might not get called) + + SDL_LockMutex(sdl_update_video_mutex); + for (int i = 0; i < numrects; ++i) { + SDL_UnionRect(&sdl_update_video_rect, &rects[i], &sdl_update_video_rect); + } + SDL_UnlockMutex(sdl_update_video_mutex); +} + +void update_sdl_video(SDL_Surface *s, Sint32 x, Sint32 y, Sint32 w, Sint32 h) +{ + SDL_Rect temp = {x, y, w, h}; + update_sdl_video(s, 1, &temp); +} + +void driver_base::set_video_mode(int flags) +{ + int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH); + if ((s = init_sdl_video(VIDEO_MODE_X, VIDEO_MODE_Y, depth, flags)) == NULL) + return; +#ifdef ENABLE_VOSF + the_host_buffer = (uint8 *)s->pixels; +#endif +} + +void driver_base::init() +{ + set_video_mode(display_type == DISPLAY_SCREEN ? SDL_WINDOW_FULLSCREEN : 0); + int aligned_height = (VIDEO_MODE_Y + 15) & ~15; + +#ifdef ENABLE_VOSF + use_vosf = true; + // Allocate memory for frame buffer (SIZE is extended to page-boundary) + the_buffer_size = page_extend((aligned_height + 2) * s->pitch); + the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size); + the_buffer_copy = (uint8 *)malloc(the_buffer_size); + D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); + + // Check whether we can initialize the VOSF subsystem and it's profitable + if (!video_vosf_init(monitor)) { + WarningAlert(GetString(STR_VOSF_INIT_ERR)); + use_vosf = false; + } + else if (!video_vosf_profitable()) { + video_vosf_exit(); + printf("VOSF acceleration is not profitable on this platform, disabling it\n"); + use_vosf = false; + } + if (!use_vosf) { + free(the_buffer_copy); + vm_release(the_buffer, the_buffer_size); + the_host_buffer = NULL; + } +#endif + if (!use_vosf) { + // Allocate memory for frame buffer + the_buffer_size = (aligned_height + 2) * s->pitch; + the_buffer_copy = (uint8 *)calloc(1, the_buffer_size); + the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size); + D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy)); + } + + // Set frame buffer base + set_mac_frame_buffer(monitor, VIDEO_MODE_DEPTH, true); + + adapt_to_video_mode(); +} + +void driver_base::adapt_to_video_mode() { + ADBSetRelMouseMode(mouse_grabbed); + + // Init blitting routines + SDL_PixelFormat *f = s->format; + VisualFormat visualFormat; + visualFormat.depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH); + visualFormat.Rmask = f->Rmask; + visualFormat.Gmask = f->Gmask; + visualFormat.Bmask = f->Bmask; + Screen_blitter_init(visualFormat, true, mac_depth_of_video_depth(VIDEO_MODE_DEPTH)); + + // Load gray ramp to 8->16/32 expand map + if (!IsDirectMode(mode)) + for (int i=0; i<256; i++) + ExpandMap[i] = SDL_MapRGB(f, i, i, i); + + + bool hardware_cursor = false; +#ifdef SHEEPSHAVER + hardware_cursor = video_can_change_cursor(); + if (hardware_cursor) { + // Create cursor + if ((sdl_cursor = SDL_CreateCursor(MacCursor + 4, MacCursor + 36, 16, 16, 0, 0)) != NULL) { + SDL_SetCursor(sdl_cursor); + } + } + // Tell the video driver there's a change in cursor type + if (private_data) + private_data->cursorHardware = hardware_cursor; +#endif + // Hide cursor + SDL_ShowCursor(hardware_cursor); + + // Set window name/class + set_window_name(mouse_grabbed ? (int)STR_WINDOW_TITLE_GRABBED : (int)STR_WINDOW_TITLE); + + // Everything went well + init_ok = true; +} + +driver_base::~driver_base() +{ + ungrab_mouse(); + restore_mouse_accel(); + + // HACK: Just delete instances of SDL_Surface and SDL_Texture, rather + // than also the SDL_Window and SDL_Renderer. This fixes a bug whereby + // OSX hosts, when in fullscreen, will, on a guest OS resolution change, + // do a series of switches (using OSX's "Spaces" feature) to and from + // the Basilisk II desktop, + delete_sdl_video_surfaces(); // This deletes instances of SDL_Surface and SDL_Texture + //shutdown_sdl_video(); // This deletes SDL_Window, SDL_Renderer, in addition to + // instances of SDL_Surface and SDL_Texture. + + // the_buffer shall always be mapped through vm_acquire_framebuffer() + if (the_buffer != VM_MAP_FAILED) { + D(bug(" releasing the_buffer at %p (%d bytes)\n", the_buffer, the_buffer_size)); + vm_release_framebuffer(the_buffer, the_buffer_size); + the_buffer = NULL; + } + + // Free frame buffer(s) + if (!use_vosf) { + if (the_buffer_copy) { + free(the_buffer_copy); + the_buffer_copy = NULL; + } + } +#ifdef ENABLE_VOSF + else { + if (the_buffer_copy) { + D(bug(" freeing the_buffer_copy at %p\n", the_buffer_copy)); + free(the_buffer_copy); + the_buffer_copy = NULL; + } + + // Deinitialize VOSF + video_vosf_exit(); + } +#endif + + SDL_ShowCursor(1); +} + +// Palette has changed +void driver_base::update_palette(void) +{ + const VIDEO_MODE &mode = monitor.get_current_mode(); + + if ((int)VIDEO_MODE_DEPTH <= VIDEO_DEPTH_8BIT) { + SDL_SetSurfacePalette(s, sdl_palette); + } +} + +// Disable mouse acceleration +void driver_base::disable_mouse_accel(void) +{ +} + +// Restore mouse acceleration to original value +void driver_base::restore_mouse_accel(void) +{ +} + +// Toggle mouse grab +void driver_base::toggle_mouse_grab(void) +{ + if (mouse_grabbed) + ungrab_mouse(); + else + grab_mouse(); +} + +static void update_mouse_grab() +{ + if (mouse_grabbed) { + SDL_SetRelativeMouseMode(SDL_TRUE); + } else { + SDL_SetRelativeMouseMode(SDL_FALSE); + } +} + +// Grab mouse, switch to relative mouse mode +void driver_base::grab_mouse(void) +{ + if (!mouse_grabbed) { + mouse_grabbed = true; + update_mouse_grab(); + set_window_name(STR_WINDOW_TITLE_GRABBED); + disable_mouse_accel(); + ADBSetRelMouseMode(true); + } +} + +// Ungrab mouse, switch to absolute mouse mode +void driver_base::ungrab_mouse(void) +{ + if (mouse_grabbed) { + mouse_grabbed = false; + update_mouse_grab(); + set_window_name(STR_WINDOW_TITLE); + restore_mouse_accel(); + ADBSetRelMouseMode(false); + } +} + +/* + * Initialization + */ + +// Init keycode translation table +static void keycode_init(void) +{ + bool use_kc = PrefsFindBool("keycodes"); + if (use_kc) { + + // Get keycode file path from preferences + const char *kc_path = PrefsFindString("keycodefile"); + + // Open keycode table + FILE *f = fopen(kc_path ? kc_path : KEYCODE_FILE_NAME, "r"); + if (f == NULL) { + char str[256]; + snprintf(str, sizeof(str), GetString(STR_KEYCODE_FILE_WARN), kc_path ? kc_path : KEYCODE_FILE_NAME, strerror(errno)); + WarningAlert(str); + return; + } + + // Default translation table + for (int i=0; i<256; i++) + keycode_table[i] = -1; + + // Search for server vendor string, then read keycodes + const char * video_driver = SDL_GetCurrentVideoDriver(); + bool video_driver_found = false; + char line[256]; + int n_keys = 0; + while (fgets(line, sizeof(line) - 1, f)) { + // Read line + int len = strlen(line); + if (len == 0) + continue; + line[len-1] = 0; + + // Comments begin with "#" or ";" + if (line[0] == '#' || line[0] == ';' || line[0] == 0) + continue; + + if (video_driver_found) { + // Skip aliases as long as we have read keycodes yet + // Otherwise, it's another mapping and we have to stop + static const char sdl_str[] = "sdl"; + if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0 && n_keys == 0) + continue; + + // Read keycode + int x_code, mac_code; + if (sscanf(line, "%d %d", &x_code, &mac_code) == 2) + keycode_table[x_code & 0xff] = mac_code, n_keys++; + else + break; + } else { + // Search for SDL video driver string + static const char sdl_str[] = "sdl"; + if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0) { + char *p = line + sizeof(sdl_str); + if (video_driver && strstr(video_driver, p) == video_driver) + video_driver_found = true; + } + } + } + + // Keycode file completely read + fclose(f); + use_keycodes = video_driver_found; + + // Vendor not found? Then display warning + if (!video_driver_found) { + char str[256]; + snprintf(str, sizeof(str), GetString(STR_KEYCODE_VENDOR_WARN), video_driver ? video_driver : "", kc_path ? kc_path : KEYCODE_FILE_NAME); + WarningAlert(str); + return; + } + + D(bug("Using SDL/%s keycodes table, %d key mappings\n", video_driver ? video_driver : "", n_keys)); + } +} + +// Open display for current mode +bool SDL_monitor_desc::video_open(void) +{ + D(bug("video_open()\n")); +#if DEBUG + const VIDEO_MODE &mode = get_current_mode(); + D(bug("Current video mode:\n")); + D(bug(" %dx%d (ID %02x), %d bpp\n", VIDEO_MODE_X, VIDEO_MODE_Y, VIDEO_MODE_RESOLUTION, 1 << (VIDEO_MODE_DEPTH & 0x0f))); +#endif + + // Create display driver object of requested type + drv = new(std::nothrow) driver_base(*this); + if (drv == NULL) + return false; + drv->init(); + if (!drv->init_ok) { + delete drv; + drv = NULL; + return false; + } + +#ifdef WIN32 + // Chain in a new message handler for WM_DEVICECHANGE + HWND the_window = GetMainWindowHandle(); + sdl_window_proc = (WNDPROC)GetWindowLongPtr(the_window, GWLP_WNDPROC); + SetWindowLongPtr(the_window, GWLP_WNDPROC, (LONG_PTR)windows_message_handler); +#endif + + // Initialize VideoRefresh function + VideoRefreshInit(); + + // Lock down frame buffer + LOCK_FRAME_BUFFER; + + // Start redraw/input thread +#ifndef USE_CPU_EMUL_SERVICES + redraw_thread_cancel = false; + redraw_thread_active = ((redraw_thread = SDL_CreateThread(redraw_func, "Redraw Thread", NULL)) != NULL); + if (!redraw_thread_active) { + printf("FATAL: cannot create redraw thread\n"); + return false; + } +#else + redraw_thread_active = true; +#endif + return true; +} + +#ifdef SHEEPSHAVER +bool VideoInit(void) +{ + const bool classic = false; +#else +bool VideoInit(bool classic) +{ +#endif + classic_mode = classic; + +#ifdef ENABLE_VOSF + // Zero the mainBuffer structure + mainBuffer.dirtyPages = NULL; + mainBuffer.pageInfo = NULL; +#endif + + // Create Mutexes + if ((sdl_events_lock = SDL_CreateMutex()) == NULL) + return false; + if ((sdl_palette_lock = SDL_CreateMutex()) == NULL) + return false; + if ((frame_buffer_lock = SDL_CreateMutex()) == NULL) + return false; + + // Init keycode translation + keycode_init(); + + // Read prefs + frame_skip = PrefsFindInt32("frameskip"); + mouse_wheel_mode = PrefsFindInt32("mousewheelmode"); + mouse_wheel_lines = PrefsFindInt32("mousewheellines"); + + // Get screen mode from preferences + migrate_screen_prefs(); + const char *mode_str = NULL; + if (classic_mode) + mode_str = "win/512/342"; + else + mode_str = PrefsFindString("screen"); + + // Determine display type and default dimensions + int default_width, default_height; + if (classic) { + default_width = 512; + default_height = 384; + } + else { + default_width = 640; + default_height = 480; + } + display_type = DISPLAY_WINDOW; + if (mode_str) { + if (sscanf(mode_str, "win/%d/%d", &default_width, &default_height) == 2) + display_type = DISPLAY_WINDOW; + else if (sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) + display_type = DISPLAY_SCREEN; + } + if (default_width <= 0) + default_width = sdl_display_width(); + else if (default_width > sdl_display_width()) + default_width = sdl_display_width(); + if (default_height <= 0) + default_height = sdl_display_height(); + else if (default_height > sdl_display_height()) + default_height = sdl_display_height(); + + // Mac screen depth follows X depth + screen_depth = 32; + SDL_DisplayMode desktop_mode; + if (SDL_GetDesktopDisplayMode(0, &desktop_mode) == 0) { + screen_depth = SDL_BITSPERPIXEL(desktop_mode.format); + } + int default_depth; + switch (screen_depth) { + case 8: + default_depth = VIDEO_DEPTH_8BIT; + break; + case 15: case 16: + default_depth = VIDEO_DEPTH_16BIT; + break; + case 24: case 32: + default_depth = VIDEO_DEPTH_32BIT; + break; + default: + default_depth = VIDEO_DEPTH_1BIT; + break; + } + + // Initialize list of video modes to try + struct { + int w; + int h; + int resolution_id; + } + video_modes[] = { + { -1, -1, 0x80 }, + { 512, 384, 0x80 }, + { 640, 480, 0x81 }, + { 800, 600, 0x82 }, + { 1024, 768, 0x83 }, + { 1152, 870, 0x84 }, + { 1280, 1024, 0x85 }, + { 1600, 1200, 0x86 }, + { 0, } + }; + video_modes[0].w = default_width; + video_modes[0].h = default_height; + + // Construct list of supported modes + if (display_type == DISPLAY_WINDOW) { + if (classic) + add_mode(display_type, 512, 342, 0x80, 64, VIDEO_DEPTH_1BIT); + else { + for (int i = 0; video_modes[i].w != 0; i++) { + const int w = video_modes[i].w; + const int h = video_modes[i].h; + if (i > 0 && (w >= default_width || h >= default_height)) + continue; + for (int d = VIDEO_DEPTH_1BIT; d <= default_depth; d++) + add_mode(display_type, w, h, video_modes[i].resolution_id, TrivialBytesPerRow(w, (video_depth)d), d); + } + } + } else if (display_type == DISPLAY_SCREEN) { + for (int i = 0; video_modes[i].w != 0; i++) { + const int w = video_modes[i].w; + const int h = video_modes[i].h; + if (i > 0 && (w >= default_width || h >= default_height)) + continue; + for (int d = VIDEO_DEPTH_1BIT; d <= default_depth; d++) + add_mode(display_type, w, h, video_modes[i].resolution_id, TrivialBytesPerRow(w, (video_depth)d), d); + } + } + + if (VideoModes.empty()) { + ErrorAlert(STR_NO_XVISUAL_ERR); + return false; + } + + // Find requested default mode with specified dimensions + uint32 default_id; + std::vector::const_iterator i, end = VideoModes.end(); + for (i = VideoModes.begin(); i != end; ++i) { + const VIDEO_MODE & mode = (*i); + if (VIDEO_MODE_X == default_width && VIDEO_MODE_Y == default_height && VIDEO_MODE_DEPTH == default_depth) { + default_id = VIDEO_MODE_RESOLUTION; +#ifdef SHEEPSHAVER + std::vector::const_iterator begin = VideoModes.begin(); + cur_mode = distance(begin, i); +#endif + break; + } + } + if (i == end) { // not found, use first available mode + const VIDEO_MODE & mode = VideoModes[0]; + default_depth = VIDEO_MODE_DEPTH; + default_id = VIDEO_MODE_RESOLUTION; +#ifdef SHEEPSHAVER + cur_mode = 0; +#endif + } + +#ifdef SHEEPSHAVER + for (int i = 0; i < VideoModes.size(); i++) + VModes[i] = VideoModes[i]; + VideoInfo *p = &VModes[VideoModes.size()]; + p->viType = DIS_INVALID; // End marker + p->viRowBytes = 0; + p->viXsize = p->viYsize = 0; + p->viAppleMode = 0; + p->viAppleID = 0; +#endif + +#if DEBUG + D(bug("Available video modes:\n")); + for (i = VideoModes.begin(); i != end; ++i) { + const VIDEO_MODE & mode = (*i); + int bits = 1 << VIDEO_MODE_DEPTH; + if (bits == 16) + bits = 15; + else if (bits == 32) + bits = 24; + D(bug(" %dx%d (ID %02x), %d colors\n", VIDEO_MODE_X, VIDEO_MODE_Y, VIDEO_MODE_RESOLUTION, 1 << bits)); + } +#endif + + int color_depth = get_customized_color_depth(default_depth); + + D(bug("Return get_customized_color_depth %d\n", color_depth)); + + // Create SDL_monitor_desc for this (the only) display + SDL_monitor_desc *monitor = new SDL_monitor_desc(VideoModes, (video_depth)color_depth, default_id); + VideoMonitors.push_back(monitor); + + // Open display + return monitor->video_open(); +} + + +/* + * Deinitialization + */ + +// Close display +void SDL_monitor_desc::video_close(void) +{ + D(bug("video_close()\n")); + +#ifdef WIN32 + // Remove message handler for WM_DEVICECHANGE + HWND the_window = GetMainWindowHandle(); + SetWindowLongPtr(the_window, GWLP_WNDPROC, (LONG_PTR)sdl_window_proc); +#endif + + // Stop redraw thread +#ifndef USE_CPU_EMUL_SERVICES + if (redraw_thread_active) { + redraw_thread_cancel = true; + SDL_WaitThread(redraw_thread, NULL); + } +#endif + redraw_thread_active = false; + + // Unlock frame buffer + UNLOCK_FRAME_BUFFER; + D(bug(" frame buffer unlocked\n")); + + // Close display + delete drv; + drv = NULL; +} + +void VideoExit(void) +{ + // Close displays + vector::iterator i, end = VideoMonitors.end(); + for (i = VideoMonitors.begin(); i != end; ++i) + dynamic_cast(*i)->video_close(); + + // Destroy locks + if (frame_buffer_lock) + SDL_DestroyMutex(frame_buffer_lock); + if (sdl_palette_lock) + SDL_DestroyMutex(sdl_palette_lock); + if (sdl_events_lock) + SDL_DestroyMutex(sdl_events_lock); +} + + +/* + * Close down full-screen mode (if bringing up error alerts is unsafe while in full-screen mode) + */ + +void VideoQuitFullScreen(void) +{ + D(bug("VideoQuitFullScreen()\n")); + quit_full_screen = true; +} + +static void do_toggle_fullscreen(void) +{ +#ifndef USE_CPU_EMUL_SERVICES + // pause redraw thread + thread_stop_ack = false; + thread_stop_req = true; + while (!thread_stop_ack) ; +#endif + + // Apply fullscreen + if (sdl_window) { + if (display_type == DISPLAY_SCREEN) { + display_type = DISPLAY_WINDOW; + SDL_SetWindowFullscreen(sdl_window, 0); + } else { + display_type = DISPLAY_SCREEN; + SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP); + } + } + + // switch modes + drv->adapt_to_video_mode(); + + // reset the palette +#ifdef SHEEPSHAVER + video_set_palette(); +#endif + drv->update_palette(); + + // reset the video refresh handler + VideoRefreshInit(); + + // while SetVideoMode is happening, control key up may be missed + ADBKeyUp(0x36); + + // resume redraw thread + toggle_fullscreen = false; +#ifndef USE_CPU_EMUL_SERVICES + thread_stop_req = false; +#endif +} + +/* + * Mac VBL interrupt + */ + +/* + * Execute video VBL routine + */ + +static bool is_fullscreen(SDL_Window * window) +{ +#ifdef __MACOSX__ + // On OSX, SDL, at least as of 2.0.5 (and possibly beyond), does not always + // report changes to fullscreen via the SDL_WINDOW_FULLSCREEN flag. + // (Example: https://bugzilla.libsdl.org/show_bug.cgi?id=3766 , which + // involves fullscreen/windowed toggles via window-manager UI controls). + // Until it does, or adds a facility to do so, we'll use a platform-specific + // code path to detect fullscreen changes. + extern bool is_fullscreen_osx(SDL_Window * window); + return is_fullscreen_osx(sdl_window); +#else + if (!window) { + return false; + } + const Uint32 sdl_window_flags = SDL_GetWindowFlags(sdl_window); + return (sdl_window_flags & SDL_WINDOW_FULLSCREEN) != 0; +#endif +} + +#ifdef SHEEPSHAVER +void VideoVBL(void) +{ + // Emergency quit requested? Then quit + if (emerg_quit) + QuitEmulator(); + + if (toggle_fullscreen) + do_toggle_fullscreen(); + + present_sdl_video(); + + // Temporarily give up frame buffer lock (this is the point where + // we are suspended when the user presses Ctrl-Tab) + UNLOCK_FRAME_BUFFER; + LOCK_FRAME_BUFFER; + + // Execute video VBL + if (private_data != NULL && private_data->interruptsEnabled) + VSLDoInterruptService(private_data->vslServiceID); +} +#else +void VideoInterrupt(void) +{ + // We must fill in the events queue in the same thread that did call SDL_SetVideoMode() + SDL_PumpEvents(); + + // Emergency quit requested? Then quit + if (emerg_quit) + QuitEmulator(); + + if (toggle_fullscreen) + do_toggle_fullscreen(); + + present_sdl_video(); + + // Temporarily give up frame buffer lock (this is the point where + // we are suspended when the user presses Ctrl-Tab) + UNLOCK_FRAME_BUFFER; + LOCK_FRAME_BUFFER; +} +#endif + + +/* + * Set palette + */ + +#ifdef SHEEPSHAVER +void video_set_palette(void) +{ + monitor_desc * monitor = VideoMonitors[0]; + int n_colors = palette_size(monitor->get_current_mode().viAppleMode); + uint8 pal[256 * 3]; + for (int c = 0; c < n_colors; c++) { + pal[c*3 + 0] = mac_pal[c].red; + pal[c*3 + 1] = mac_pal[c].green; + pal[c*3 + 2] = mac_pal[c].blue; + } + monitor->set_palette(pal, n_colors); +} +#endif + +void SDL_monitor_desc::set_palette(uint8 *pal, int num_in) +{ + const VIDEO_MODE &mode = get_current_mode(); + + // FIXME: how can we handle the gamma ramp? + if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT) + return; + + LOCK_PALETTE; + + // Convert colors to XColor array + int num_out = 256; + bool stretch = false; + + if (!sdl_palette) { + sdl_palette = SDL_AllocPalette(num_out); + } + + SDL_Color *p = sdl_palette->colors; + for (int i=0; ir = pal[c*3 + 0] * 0x0101; + p->g = pal[c*3 + 1] * 0x0101; + p->b = pal[c*3 + 2] * 0x0101; + p++; + } + + // Recalculate pixel color expansion map + if (!IsDirectMode(mode)) { + for (int i=0; i<256; i++) { + int c = i & (num_in-1); // If there are less than 256 colors, we repeat the first entries (this makes color expansion easier) + ExpandMap[i] = SDL_MapRGB(drv->s->format, pal[c*3+0], pal[c*3+1], pal[c*3+2]); + } + +#ifdef ENABLE_VOSF + if (use_vosf) { + // We have to redraw everything because the interpretation of pixel values changed + LOCK_VOSF; + PFLAG_SET_ALL; + UNLOCK_VOSF; + memset(the_buffer_copy, 0, VIDEO_MODE_ROW_BYTES * VIDEO_MODE_Y); + } +#endif + } + + // Tell redraw thread to change palette + sdl_palette_changed = true; + + UNLOCK_PALETTE; +} + + +/* + * Switch video mode + */ + +#ifdef SHEEPSHAVER +int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr) +{ + /* return if no mode change */ + if ((csSave->saveData == ReadMacInt32(ParamPtr + csData)) && + (csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr; + + /* first find video mode in table */ + for (int i=0; VModes[i].viType != DIS_INVALID; i++) { + if ((ReadMacInt16(ParamPtr + csMode) == VModes[i].viAppleMode) && + (ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) { + csSave->saveMode = ReadMacInt16(ParamPtr + csMode); + csSave->saveData = ReadMacInt32(ParamPtr + csData); + csSave->savePage = ReadMacInt16(ParamPtr + csPage); + + // Disable interrupts and pause redraw thread + DisableInterrupt(); + thread_stop_ack = false; + thread_stop_req = true; + while (!thread_stop_ack) ; + + cur_mode = i; + monitor_desc *monitor = VideoMonitors[0]; + monitor->switch_to_current_mode(); + + WriteMacInt32(ParamPtr + csBaseAddr, screen_base); + csSave->saveBaseAddr=screen_base; + csSave->saveData=VModes[cur_mode].viAppleID;/* First mode ... */ + csSave->saveMode=VModes[cur_mode].viAppleMode; + + // Enable interrupts and resume redraw thread + thread_stop_req = false; + EnableInterrupt(); + return noErr; + } + } + return paramErr; +} +#endif + +void SDL_monitor_desc::switch_to_current_mode(void) +{ + // Close and reopen display + LOCK_EVENTS; + video_close(); + video_open(); + UNLOCK_EVENTS; + + if (drv == NULL) { + ErrorAlert(STR_OPEN_WINDOW_ERR); + QuitEmulator(); + } +} + + +/* + * Can we set the MacOS cursor image into the window? + */ + +#ifdef SHEEPSHAVER +bool video_can_change_cursor(void) +{ + if (display_type != DISPLAY_WINDOW) + return false; + + return true; +} +#endif + + +/* + * Set cursor image for window + */ + +#ifdef SHEEPSHAVER +void video_set_cursor(void) +{ + // Set new cursor image if it was changed + if (sdl_cursor) { + SDL_FreeCursor(sdl_cursor); + sdl_cursor = SDL_CreateCursor(MacCursor + 4, MacCursor + 36, 16, 16, MacCursor[2], MacCursor[3]); + if (sdl_cursor) { + SDL_ShowCursor(private_data == NULL || private_data->cursorVisible); + SDL_SetCursor(sdl_cursor); + + // XXX Windows apparently needs an extra mouse event to + // make the new cursor image visible. + // On Mac, if mouse is grabbed, SDL_ShowCursor() recenters the + // mouse, we have to put it back. + bool move = false; +#ifdef WIN32 + move = true; +#elif defined(__APPLE__) + move = mouse_grabbed; +#endif + if (move) { + int visible = SDL_ShowCursor(-1); + if (visible) { + int x, y; + SDL_GetMouseState(&x, &y); + printf("WarpMouse to {%d,%d} via video_set_cursor\n", x, y); + SDL_WarpMouseGlobal(x, y); + } + } + } + } +} +#endif + + +/* + * Keyboard-related utilify functions + */ + +static bool is_modifier_key(SDL_KeyboardEvent const & e) +{ + switch (e.keysym.sym) { + case SDLK_NUMLOCKCLEAR: + case SDLK_CAPSLOCK: + case SDLK_SCROLLLOCK: + case SDLK_RSHIFT: + case SDLK_LSHIFT: + case SDLK_RCTRL: + case SDLK_LCTRL: + case SDLK_RALT: + case SDLK_LALT: + case SDLK_RGUI: + case SDLK_LGUI: + case SDLK_MODE: + case SDLK_APPLICATION: + return true; + } + return false; +} + +static bool is_ctrl_down(SDL_Keysym const & ks) +{ + return ctrl_down || (ks.mod & KMOD_CTRL); +} + + +/* + * Translate key event to Mac keycode, returns -1 if no keycode was found + * and -2 if the key was recognized as a hotkey + */ + +static int kc_decode(SDL_Keysym const & ks, bool key_down) +{ + switch (ks.sym) { + case SDLK_a: return 0x00; + case SDLK_b: return 0x0b; + case SDLK_c: return 0x08; + case SDLK_d: return 0x02; + case SDLK_e: return 0x0e; + case SDLK_f: return 0x03; + case SDLK_g: return 0x05; + case SDLK_h: return 0x04; + case SDLK_i: return 0x22; + case SDLK_j: return 0x26; + case SDLK_k: return 0x28; + case SDLK_l: return 0x25; + case SDLK_m: return 0x2e; + case SDLK_n: return 0x2d; + case SDLK_o: return 0x1f; + case SDLK_p: return 0x23; + case SDLK_q: return 0x0c; + case SDLK_r: return 0x0f; + case SDLK_s: return 0x01; + case SDLK_t: return 0x11; + case SDLK_u: return 0x20; + case SDLK_v: return 0x09; + case SDLK_w: return 0x0d; + case SDLK_x: return 0x07; + case SDLK_y: return 0x10; + case SDLK_z: return 0x06; + + case SDLK_1: case SDLK_EXCLAIM: return 0x12; + case SDLK_2: case SDLK_AT: return 0x13; + case SDLK_3: case SDLK_HASH: return 0x14; + case SDLK_4: case SDLK_DOLLAR: return 0x15; + case SDLK_5: return 0x17; + case SDLK_6: return 0x16; + case SDLK_7: return 0x1a; + case SDLK_8: return 0x1c; + case SDLK_9: return 0x19; + case SDLK_0: return 0x1d; + + case SDLK_BACKQUOTE: return 0x0a; + case SDLK_MINUS: case SDLK_UNDERSCORE: return 0x1b; + case SDLK_EQUALS: case SDLK_PLUS: return 0x18; + case SDLK_LEFTBRACKET: return 0x21; + case SDLK_RIGHTBRACKET: return 0x1e; + case SDLK_BACKSLASH: return 0x2a; + case SDLK_SEMICOLON: case SDLK_COLON: return 0x29; + case SDLK_QUOTE: case SDLK_QUOTEDBL: return 0x27; + case SDLK_COMMA: case SDLK_LESS: return 0x2b; + case SDLK_PERIOD: case SDLK_GREATER: return 0x2f; + case SDLK_SLASH: case SDLK_QUESTION: return 0x2c; + + case SDLK_TAB: if (is_ctrl_down(ks)) {if (!key_down) drv->suspend(); return -2;} else return 0x30; + case SDLK_RETURN: if (is_ctrl_down(ks)) {if (!key_down) toggle_fullscreen = true; return -2;} else return 0x24; + case SDLK_SPACE: return 0x31; + case SDLK_BACKSPACE: return 0x33; + + case SDLK_DELETE: return 0x75; + case SDLK_INSERT: return 0x72; + case SDLK_HOME: case SDLK_HELP: return 0x73; + case SDLK_END: return 0x77; + case SDLK_PAGEUP: return 0x74; + case SDLK_PAGEDOWN: return 0x79; + + case SDLK_LCTRL: return 0x36; + case SDLK_RCTRL: return 0x36; + case SDLK_LSHIFT: return 0x38; + case SDLK_RSHIFT: return 0x38; +#if (defined(__APPLE__) && defined(__MACH__)) + case SDLK_LALT: return 0x3a; + case SDLK_RALT: return 0x3a; + case SDLK_LGUI: return 0x37; + case SDLK_RGUI: return 0x37; +#else + case SDLK_LALT: return 0x37; + case SDLK_RALT: return 0x37; + case SDLK_LGUI: return 0x3a; + case SDLK_RGUI: return 0x3a; +#endif + case SDLK_MENU: return 0x32; + case SDLK_CAPSLOCK: return 0x39; + case SDLK_NUMLOCKCLEAR: return 0x47; + + case SDLK_UP: return 0x3e; + case SDLK_DOWN: return 0x3d; + case SDLK_LEFT: return 0x3b; + case SDLK_RIGHT: return 0x3c; + + case SDLK_ESCAPE: if (is_ctrl_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35; + + case SDLK_F1: if (is_ctrl_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a; + case SDLK_F2: return 0x78; + case SDLK_F3: return 0x63; + case SDLK_F4: return 0x76; + case SDLK_F5: return 0x60; + case SDLK_F6: return 0x61; + case SDLK_F7: return 0x62; + case SDLK_F8: return 0x64; + case SDLK_F9: return 0x65; + case SDLK_F10: return 0x6d; + case SDLK_F11: return 0x67; + case SDLK_F12: return 0x6f; + + case SDLK_PRINTSCREEN: return 0x69; + case SDLK_SCROLLLOCK: return 0x6b; + case SDLK_PAUSE: return 0x71; + + case SDLK_KP_0: return 0x52; + case SDLK_KP_1: return 0x53; + case SDLK_KP_2: return 0x54; + case SDLK_KP_3: return 0x55; + case SDLK_KP_4: return 0x56; + case SDLK_KP_5: return 0x57; + case SDLK_KP_6: return 0x58; + case SDLK_KP_7: return 0x59; + case SDLK_KP_8: return 0x5b; + case SDLK_KP_9: return 0x5c; + case SDLK_KP_PERIOD: return 0x41; + case SDLK_KP_PLUS: return 0x45; + case SDLK_KP_MINUS: return 0x4e; + case SDLK_KP_MULTIPLY: return 0x43; + case SDLK_KP_DIVIDE: return 0x4b; + case SDLK_KP_ENTER: return 0x4c; + case SDLK_KP_EQUALS: return 0x51; + } + D(bug("Unhandled SDL keysym: %d\n", ks.sym)); + return -1; +} + +static int event2keycode(SDL_KeyboardEvent const &ev, bool key_down) +{ + return kc_decode(ev.keysym, key_down); +} + +static void force_complete_window_refresh() +{ + if (display_type == DISPLAY_WINDOW) { +#ifdef ENABLE_VOSF + if (use_vosf) { // VOSF refresh + LOCK_VOSF; + PFLAG_SET_ALL; + UNLOCK_VOSF; + } +#endif + // Ensure each byte of the_buffer_copy differs from the_buffer to force a full update. + const VIDEO_MODE &mode = VideoMonitors[0]->get_current_mode(); + const int len = VIDEO_MODE_ROW_BYTES * VIDEO_MODE_Y; + for (int i = 0; i < len; i++) + the_buffer_copy[i] = !the_buffer[i]; + } +} + +/* + * SDL event handling + */ + +// possible return codes for SDL-registered event watches +enum { + EVENT_DROP_FROM_QUEUE = 0, + EVENT_ADD_TO_QUEUE = 1 +}; + +// Some events need to be processed in the host-app's main thread, due to +// host-OS requirements. +// +// This function is called by SDL, whenever it generates an SDL_Event. It has +// the ability to process events, and optionally, to prevent them from being +// added to SDL's event queue (and retrieve-able via SDL_PeepEvents(), etc.) +static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event) +{ + switch (event->type) { + case SDL_KEYUP: { + SDL_Keysym const & ks = event->key.keysym; + switch (ks.sym) { + case SDLK_F5: { + if (is_ctrl_down(ks)) { + drv->toggle_mouse_grab(); + return EVENT_DROP_FROM_QUEUE; + } + } break; + } + } break; + + case SDL_WINDOWEVENT: { + switch (event->window.event) { + case SDL_WINDOWEVENT_RESIZED: { + // Handle changes of fullscreen. This is done here, in + // on_sdl_event_generated() and not the main SDL_Event-processing + // loop, in order to perform this change on the main thread. + // (Some os'es UI APIs, such as OSX's NSWindow, are not + // thread-safe.) + const bool is_full = is_fullscreen(sdl_window); + const bool adjust_fullscreen = \ + (display_type == DISPLAY_WINDOW && is_full) || + (display_type == DISPLAY_SCREEN && !is_full); + if (adjust_fullscreen) { + do_toggle_fullscreen(); + +#if __MACOSX__ + // HACK-FIX: on OSX hosts, make sure that the OSX menu + // bar does not show up in fullscreen mode, when the + // cursor is near the top of the screen, lest the + // guest OS' menu bar be obscured. + if (is_full) { + extern void set_menu_bar_visible_osx(bool); + set_menu_bar_visible_osx(false); + } +#endif + } + } break; + } + } break; + } + + return EVENT_ADD_TO_QUEUE; +} + + +static void handle_events(void) +{ + SDL_Event events[10]; + const int n_max_events = sizeof(events) / sizeof(events[0]); + int n_events; + + while ((n_events = SDL_PeepEvents(events, n_max_events, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) > 0) { + for (int i = 0; i < n_events; i++) { + SDL_Event & event = events[i]; + + switch (event.type) { + + // Mouse button + case SDL_MOUSEBUTTONDOWN: { + unsigned int button = event.button.button; + if (button == SDL_BUTTON_LEFT) + ADBMouseDown(0); + else if (button == SDL_BUTTON_RIGHT) + ADBMouseDown(1); + else if (button == SDL_BUTTON_MIDDLE) + ADBMouseDown(2); + else if (button < 6) { // Wheel mouse + if (mouse_wheel_mode == 0) { + int key = (button == 5) ? 0x79 : 0x74; // Page up/down + ADBKeyDown(key); + ADBKeyUp(key); + } else { + int key = (button == 5) ? 0x3d : 0x3e; // Cursor up/down + for(int i=0; imouse_moved(event.motion.xrel, event.motion.yrel); + } else { + drv->mouse_moved(event.motion.x, event.motion.y); + } + break; + + // Keyboard + case SDL_KEYDOWN: { + int code = -1; + if (use_keycodes && !is_modifier_key(event.key)) { + if (event2keycode(event.key, true) != -2) // This is called to process the hotkeys + code = keycode_table[event.key.keysym.scancode & 0xff]; + } else + code = event2keycode(event.key, true); + if (code >= 0) { + if (!emul_suspended) { + if (code == 0x39) { // Caps Lock pressed + if (caps_on) { + ADBKeyUp(code); + caps_on = false; + } else { + ADBKeyDown(code); + caps_on = true; + } + } else + ADBKeyDown(code); + if (code == 0x36) + ctrl_down = true; + } else { + if (code == 0x31) + drv->resume(); // Space wakes us up + } + } + break; + } + case SDL_KEYUP: { + int code = -1; + if (use_keycodes && !is_modifier_key(event.key)) { + if (event2keycode(event.key, false) != -2) // This is called to process the hotkeys + code = keycode_table[event.key.keysym.scancode & 0xff]; + } else + code = event2keycode(event.key, false); + if (code >= 0) { + if (code == 0x39) { // Caps Lock released + if (caps_on) { + ADBKeyUp(code); + caps_on = false; + } else { + ADBKeyDown(code); + caps_on = true; + } + } else + ADBKeyUp(code); + if (code == 0x36) + ctrl_down = false; + } + break; + } + + case SDL_WINDOWEVENT: { + switch (event.window.event) { + // Hidden parts exposed, force complete refresh of window + case SDL_WINDOWEVENT_EXPOSED: + force_complete_window_refresh(); + break; + + // Force a complete window refresh when activating, to avoid redraw artifacts otherwise. + case SDL_WINDOWEVENT_RESTORED: + force_complete_window_refresh(); + break; + + } + break; + } + + // Window "close" widget clicked + case SDL_QUIT: + ADBKeyDown(0x7f); // Power key + ADBKeyUp(0x7f); + break; + } + } + } +} + + +/* + * Window display update + */ + +// Static display update (fixed frame rate, but incremental) +static void update_display_static(driver_base *drv) +{ + // Incremental update code + int wide = 0, high = 0; + uint32 x1, x2, y1, y2; + const VIDEO_MODE &mode = drv->mode; + int bytes_per_row = VIDEO_MODE_ROW_BYTES; + uint8 *p, *p2; + + // Check for first line from top and first line from bottom that have changed + y1 = 0; + for (uint32 j = 0; j < VIDEO_MODE_Y; j++) { + if (memcmp(&the_buffer[j * bytes_per_row], &the_buffer_copy[j * bytes_per_row], bytes_per_row)) { + y1 = j; + break; + } + } + y2 = y1 - 1; + for (uint32 j = VIDEO_MODE_Y; j-- > y1; ) { + if (memcmp(&the_buffer[j * bytes_per_row], &the_buffer_copy[j * bytes_per_row], bytes_per_row)) { + y2 = j; + break; + } + } + high = y2 - y1 + 1; + + // Check for first column from left and first column from right that have changed + if (high) { + if ((int)VIDEO_MODE_DEPTH < (int)VIDEO_DEPTH_8BIT) { + const int src_bytes_per_row = bytes_per_row; + const int dst_bytes_per_row = drv->s->pitch; + const int pixels_per_byte = VIDEO_MODE_X / src_bytes_per_row; + + x1 = VIDEO_MODE_X / pixels_per_byte; + for (uint32 j = y1; j <= y2; j++) { + p = &the_buffer[j * bytes_per_row]; + p2 = &the_buffer_copy[j * bytes_per_row]; + for (uint32 i = 0; i < x1; i++) { + if (*p != *p2) { + x1 = i; + break; + } + p++; p2++; + } + } + x2 = x1; + for (uint32 j = y1; j <= y2; j++) { + p = &the_buffer[j * bytes_per_row]; + p2 = &the_buffer_copy[j * bytes_per_row]; + p += bytes_per_row; + p2 += bytes_per_row; + for (uint32 i = (VIDEO_MODE_X / pixels_per_byte); i > x2; i--) { + p--; p2--; + if (*p != *p2) { + x2 = i; + break; + } + } + } + x1 *= pixels_per_byte; + x2 *= pixels_per_byte; + wide = (x2 - x1 + pixels_per_byte - 1) & -pixels_per_byte; + + // Update copy of the_buffer + if (high && wide) { + + // Lock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_LockSurface(drv->s); + + // Blit to screen surface + int si = y1 * src_bytes_per_row + (x1 / pixels_per_byte); + int di = y1 * dst_bytes_per_row + x1; + for (uint32 j = y1; j <= y2; j++) { + memcpy(the_buffer_copy + si, the_buffer + si, wide / pixels_per_byte); + Screen_blit((uint8 *)drv->s->pixels + di, the_buffer + si, wide / pixels_per_byte); + si += src_bytes_per_row; + di += dst_bytes_per_row; + } + + // Unlock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_UnlockSurface(drv->s); + + // Refresh display + update_sdl_video(drv->s, x1, y1, wide, high); + } + + } else { + const int bytes_per_pixel = VIDEO_MODE_ROW_BYTES / VIDEO_MODE_X; + const int dst_bytes_per_row = drv->s->pitch; + + x1 = VIDEO_MODE_X; + for (uint32 j = y1; j <= y2; j++) { + p = &the_buffer[j * bytes_per_row]; + p2 = &the_buffer_copy[j * bytes_per_row]; + for (uint32 i = 0; i < x1 * bytes_per_pixel; i++) { + if (*p != *p2) { + x1 = i / bytes_per_pixel; + break; + } + p++; p2++; + } + } + x2 = x1; + for (uint32 j = y1; j <= y2; j++) { + p = &the_buffer[j * bytes_per_row]; + p2 = &the_buffer_copy[j * bytes_per_row]; + p += bytes_per_row; + p2 += bytes_per_row; + for (uint32 i = VIDEO_MODE_X * bytes_per_pixel; i > x2 * bytes_per_pixel; i--) { + p--; + p2--; + if (*p != *p2) { + x2 = i / bytes_per_pixel; + break; + } + } + } + wide = x2 - x1; + + // Update copy of the_buffer + if (high && wide) { + + // Lock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_LockSurface(drv->s); + + // Blit to screen surface + for (uint32 j = y1; j <= y2; j++) { + uint32 i = j * bytes_per_row + x1 * bytes_per_pixel; + int dst_i = j * dst_bytes_per_row + x1 * bytes_per_pixel; + memcpy(the_buffer_copy + i, the_buffer + i, bytes_per_pixel * wide); + Screen_blit((uint8 *)drv->s->pixels + dst_i, the_buffer + i, bytes_per_pixel * wide); + } + + // Unlock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_UnlockSurface(drv->s); + + // Refresh display + update_sdl_video(drv->s, x1, y1, wide, high); + } + } + } +} + +// Static display update (fixed frame rate, bounding boxes based) +// XXX use NQD bounding boxes to help detect dirty areas? +static void update_display_static_bbox(driver_base *drv) +{ + const VIDEO_MODE &mode = drv->mode; + + // Allocate bounding boxes for SDL_UpdateRects() + const uint32 N_PIXELS = 64; + const uint32 n_x_boxes = (VIDEO_MODE_X + N_PIXELS - 1) / N_PIXELS; + const uint32 n_y_boxes = (VIDEO_MODE_Y + N_PIXELS - 1) / N_PIXELS; + SDL_Rect *boxes = (SDL_Rect *)alloca(sizeof(SDL_Rect) * n_x_boxes * n_y_boxes); + uint32 nr_boxes = 0; + + // Lock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_LockSurface(drv->s); + + // Update the surface from Mac screen + const uint32 bytes_per_row = VIDEO_MODE_ROW_BYTES; + const uint32 bytes_per_pixel = bytes_per_row / VIDEO_MODE_X; + const uint32 dst_bytes_per_row = drv->s->pitch; + for (uint32 y = 0; y < VIDEO_MODE_Y; y += N_PIXELS) { + uint32 h = N_PIXELS; + if (h > VIDEO_MODE_Y - y) + h = VIDEO_MODE_Y - y; + for (uint32 x = 0; x < VIDEO_MODE_X; x += N_PIXELS) { + uint32 w = N_PIXELS; + if (w > VIDEO_MODE_X - x) + w = VIDEO_MODE_X - x; + const int xs = w * bytes_per_pixel; + const int xb = x * bytes_per_pixel; + bool dirty = false; + for (uint32 j = y; j < (y + h); j++) { + const uint32 yb = j * bytes_per_row; + const uint32 dst_yb = j * dst_bytes_per_row; + if (memcmp(&the_buffer[yb + xb], &the_buffer_copy[yb + xb], xs) != 0) { + memcpy(&the_buffer_copy[yb + xb], &the_buffer[yb + xb], xs); + Screen_blit((uint8 *)drv->s->pixels + dst_yb + xb, the_buffer + yb + xb, xs); + dirty = true; + } + } + if (dirty) { + boxes[nr_boxes].x = x; + boxes[nr_boxes].y = y; + boxes[nr_boxes].w = w; + boxes[nr_boxes].h = h; + nr_boxes++; + } + } + } + + // Unlock surface, if required + if (SDL_MUSTLOCK(drv->s)) + SDL_UnlockSurface(drv->s); + + // Refresh display + if (nr_boxes) + update_sdl_video(drv->s, nr_boxes, boxes); +} + + +// We suggest the compiler to inline the next two functions so that it +// may specialise the code according to the current screen depth and +// display type. A clever compiler would do that job by itself though... + +// NOTE: update_display_vosf is inlined too + +static inline void possibly_quit_dga_mode() +{ + // Quit DGA mode if requested (something terrible has happened and we + // want to give control back to the user) + if (quit_full_screen) { + quit_full_screen = false; + delete drv; + drv = NULL; + } +} + +static inline void possibly_ungrab_mouse() +{ + // Ungrab mouse if requested (something terrible has happened and we + // want to give control back to the user) + if (quit_full_screen) { + quit_full_screen = false; + if (drv) + drv->ungrab_mouse(); + } +} + +static inline void handle_palette_changes(void) +{ + LOCK_PALETTE; + + if (sdl_palette_changed) { + sdl_palette_changed = false; + drv->update_palette(); + } + + UNLOCK_PALETTE; +} + +static void video_refresh_window_static(void); + +static void video_refresh_dga(void) +{ + // Quit DGA mode if requested + possibly_quit_dga_mode(); + video_refresh_window_static(); +} + +#ifdef ENABLE_VOSF +#if REAL_ADDRESSING || DIRECT_ADDRESSING +static void video_refresh_dga_vosf(void) +{ + // Quit DGA mode if requested + possibly_quit_dga_mode(); + + // Update display (VOSF variant) + static uint32 tick_counter = 0; + if (++tick_counter >= frame_skip) { + tick_counter = 0; + if (mainBuffer.dirty) { + LOCK_VOSF; + update_display_dga_vosf(drv); + UNLOCK_VOSF; + } + } +} +#endif + +static void video_refresh_window_vosf(void) +{ + // Ungrab mouse if requested + possibly_ungrab_mouse(); + + // Update display (VOSF variant) + static uint32 tick_counter = 0; + if (++tick_counter >= frame_skip) { + tick_counter = 0; + if (mainBuffer.dirty) { + LOCK_VOSF; + update_display_window_vosf(drv); + UNLOCK_VOSF; + } + } +} +#endif // def ENABLE_VOSF + +static void video_refresh_window_static(void) +{ + // Ungrab mouse if requested + possibly_ungrab_mouse(); + + // Update display (static variant) + static uint32 tick_counter = 0; + if (++tick_counter >= frame_skip) { + tick_counter = 0; + const VIDEO_MODE &mode = drv->mode; + if ((int)VIDEO_MODE_DEPTH >= VIDEO_DEPTH_8BIT) + update_display_static_bbox(drv); + else + update_display_static(drv); + } +} + + +/* + * Thread for screen refresh, input handling etc. + */ + +static void VideoRefreshInit(void) +{ + // TODO: set up specialised 8bpp VideoRefresh handlers ? + if (display_type == DISPLAY_SCREEN) { +#if ENABLE_VOSF && (REAL_ADDRESSING || DIRECT_ADDRESSING) + if (use_vosf) + video_refresh = video_refresh_dga_vosf; + else +#endif + video_refresh = video_refresh_dga; + } + else { +#ifdef ENABLE_VOSF + if (use_vosf) + video_refresh = video_refresh_window_vosf; + else +#endif + video_refresh = video_refresh_window_static; + } +} + +static inline void do_video_refresh(void) +{ + // Handle SDL events + handle_events(); + + // Update display + video_refresh(); + + + // Set new palette if it was changed + handle_palette_changes(); +} + +// This function is called on non-threaded platforms from a timer interrupt +void VideoRefresh(void) +{ + // We need to check redraw_thread_active to inhibit refreshed during + // mode changes on non-threaded platforms + if (!redraw_thread_active) + return; + + // Process pending events and update display + do_video_refresh(); +} + +const int VIDEO_REFRESH_HZ = 60; +const int VIDEO_REFRESH_DELAY = 1000000 / VIDEO_REFRESH_HZ; + +#ifndef USE_CPU_EMUL_SERVICES +static int redraw_func(void *arg) +{ + uint64 start = GetTicks_usec(); + int64 ticks = 0; + uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY; + + while (!redraw_thread_cancel) { + + // Wait + next += VIDEO_REFRESH_DELAY; + uint64 delay = int32(next - GetTicks_usec()); + if (delay > 0) + Delay_usec(delay); + else if (delay < -VIDEO_REFRESH_DELAY) + next = GetTicks_usec(); + ticks++; + + // Pause if requested (during video mode switches) + if (thread_stop_req) { + thread_stop_ack = true; + continue; + } + + // Process pending events and update display + do_video_refresh(); + } + + uint64 end = GetTicks_usec(); + D(bug("%lld refreshes in %lld usec = %f refreshes/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start))); + return 0; +} +#endif + + +/* + * Record dirty area from NQD + */ + +#ifdef SHEEPSHAVER +void video_set_dirty_area(int x, int y, int w, int h) +{ +#ifdef ENABLE_VOSF + const VIDEO_MODE &mode = drv->mode; + const unsigned screen_width = VIDEO_MODE_X; + const unsigned screen_height = VIDEO_MODE_Y; + const unsigned bytes_per_row = VIDEO_MODE_ROW_BYTES; + + if (use_vosf) { + vosf_set_dirty_area(x, y, w, h, screen_width, screen_height, bytes_per_row); + return; + } +#endif + + // XXX handle dirty bounding boxes for non-VOSF modes +} +#endif + +#endif // ends: SDL version check diff --git a/BasiliskII/src/SDL/xpram_sdl.cpp b/BasiliskII/src/SDL/xpram_sdl.cpp new file mode 100644 index 00000000..4526bae6 --- /dev/null +++ b/BasiliskII/src/SDL/xpram_sdl.cpp @@ -0,0 +1,98 @@ +/* + * xpram_sdl.cpp - XPRAM handling, SDL implementation + * + * Basilisk II (C) 1997-2008 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sysdeps.h" + +#include +#include +#include + +#include "xpram.h" + + +// XPRAM file name and path +const char XPRAM_FILE_NAME[] = ".basilisk_ii_xpram"; + + +/* + * Load XPRAM from settings file + */ + +void LoadXPRAM(const char *dir) +{ + // Build a full-path to the file + char full_path[4096]; + if (!dir) { + dir = SDL_getenv("HOME"); + } + if (!dir) { + dir = "./"; + } + SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME); + + // Open the XPRAM file + FILE *f = fopen(full_path, "rb"); + if (f != NULL) { + fread(XPRAM, 256, 1, f); + fclose(f); + } +} + + +/* + * Save XPRAM to settings file + */ + +void SaveXPRAM(void) +{ + // Build a full-path to the file + char full_path[4096]; + const char *dir = SDL_getenv("HOME"); + if (!dir) { + dir = "./"; + } + SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME); + + // Save the XPRAM file + FILE *f = fopen(XPRAM_FILE_NAME, "wb"); + if (f != NULL) { + fwrite(XPRAM, 256, 1, f); + fclose(f); + } +} + + +/* + * Delete PRAM file + */ + +void ZapPRAM(void) +{ + // Build a full-path to the file + char full_path[4096]; + const char *dir = SDL_getenv("HOME"); + if (!dir) { + dir = "./"; + } + SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME); + + // Delete the XPRAM file + remove(full_path); +} diff --git a/BasiliskII/src/Unix/bincue_unix.cpp b/BasiliskII/src/Unix/bincue_unix.cpp index b20b8543..612cf790 100644 --- a/BasiliskII/src/Unix/bincue_unix.cpp +++ b/BasiliskII/src/Unix/bincue_unix.cpp @@ -526,6 +526,7 @@ loff_t size_bincue(void *fh) if (fh) { return ((CueSheet *)fh)->length * COOKED_SECTOR_SIZE; } + return 0; } bool readtoc_bincue(void *fh, unsigned char *toc) @@ -564,6 +565,7 @@ bool readtoc_bincue(void *fh, unsigned char *toc) *toc++ = toc_size & 0xff; return true; } + return false; } bool GetPosition_bincue(void *fh, uint8 *pos) diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac old mode 100644 new mode 100755 index 962199ad..ff200e12 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -36,6 +36,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphi AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) +AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) dnl JIT compiler options. AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no]) @@ -224,11 +225,11 @@ dnl We use mon if possible. MONSRCS= if [[ "x$WANT_MON" = "xyes" ]]; then AC_MSG_CHECKING(for mon) - mon_srcdir=../../../cxmon/src + mon_srcdir=../../../mon/src if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then AC_MSG_RESULT(yes) AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) - MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" + MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c $mon_srcdir/disass/mips-dis.c $mon_srcdir/disass/mips-opc.c $mon_srcdir/disass/mips16-opc.c" CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" AC_CHECK_LIB(ncurses, tgetent, , [AC_CHECK_LIB(termcap, tgetent, , @@ -250,7 +251,7 @@ AC_CHECK_LIB(rt, timer_create) AC_CHECK_LIB(rt, shm_open) AC_CHECK_LIB(m, cos) -dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES) +dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES, $3=ACTION_IF_SUCCESSFUL, $4=ACTION_IF_UNSUCCESSFUL) dnl AC_TRY_LINK uses main() but SDL needs main to take args, dnl therefore main is undefined with #undef. dnl Framework can be in an custom location. @@ -260,18 +261,16 @@ AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [ ac_Framework, [ saved_LIBS="$LIBS" LIBS="$LIBS -framework $1" - if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then - if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then - LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" - fi + if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then + LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" fi saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers" + CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/$1.framework/Headers" AC_TRY_LINK( [$2 #undef main], [], - [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); -LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"] + [AS_VAR_SET(ac_Framework, yes); $3], [AS_VAR_SET(ac_Framework, no); +LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"; $4] ) ]) AS_IF([test AS_VAR_GET(ac_Framework) = yes], @@ -295,27 +294,58 @@ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then fi if [[ "x$WANT_SDL" = "xyes" ]]; then if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then - AC_CHECK_SDLFRAMEWORK(SDL, [#include ]) + TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then + TEMP_WANT_SDL_VERSION_MAJOR=2 + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then + AC_CHECK_SDLFRAMEWORK(SDL2, [#include ], [ + WANT_SDL_VERSION_MAJOR=2 + ], [ + TEMP_WANT_SDL_VERSION_MAJOR=1 + ]) + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then + AC_CHECK_SDLFRAMEWORK(SDL, [#include ], [ + WANT_SDL_VERSION_MAJOR=1 + ]) + fi else ac_cv_framework_SDL=no fi if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then - AC_PATH_PROG(sdl_config, "sdl-config") - if [[ -n "$sdl_config" ]]; then - sdl_cflags=`$sdl_config --cflags` - if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then - sdl_libs=`$sdl_config --static-libs` - else - sdl_libs=`$sdl_config --libs` - fi - CFLAGS="$CFLAGS $sdl_cflags" - CXXFLAGS="$CXXFLAGS $sdl_cflags" - LIBS="$LIBS $sdl_libs" - else - WANT_SDL=no - WANT_SDL_VIDEO=no - WANT_SDL_AUDIO=no - SDL_SUPPORT="none" + TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then + TEMP_WANT_SDL_VERSION_MAJOR=2 + fi + + dnl use PKG_PROG_PKG_CONFIG to declare PKG_CONFIG variables. Otherwise, + dnl PKG_* macros may fail, without much explanation. The lack of this + dnl was causing --with-sdl1 to fail, as SDL 1.x could not be detected, + dnl as the 2nd call to PKG_CHECK_MODULES would fail, as $PKG_CONFIG + dnl never got defined (bizarrely-enough). -- dludwig@pobox.com + PKG_PROG_PKG_CONFIG + + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then + PKG_CHECK_MODULES([sdl2], [sdl2 >= 2.0], [ + CFLAGS="$CFLAGS $sdl2_CFLAGS" + CXXFLAGS="$CXXFLAGS $sdl2_CFLAGS" + LIBS="$LIBS $sdl2_LIBS" + WANT_SDL_VERSION_MAJOR=2 + ], [ + TEMP_WANT_SDL_VERSION_MAJOR=1 + ]) + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then + PKG_CHECK_MODULES([sdl], [sdl >= 1.2], [ + CFLAGS="$CFLAGS $sdl_CFLAGS" + CXXFLAGS="$CXXFLAGS $sdl_CFLAGS" + LIBS="$LIBS $sdl_LIBS" + WANT_SDL_VERSION_MAJOR=1 + ], [ + WANT_SDL=no + WANT_SDL_VERSION_MAJOR= + ]) fi fi SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` @@ -323,8 +353,8 @@ else SDL_SUPPORT="none" fi -dnl We need X11, if not using SDL or Mac GUI. -if [[ "x$WANT_SDL_VIDEO" = "xno" -a "x$WANT_MACOSX_GUI" = "xno" ]]; then +dnl We need X11, if not using SDL. +if [[ "x$WANT_SDL_VIDEO" = "xno" ]]; then AC_PATH_XTRA if [[ "x$no_x" = "xyes" ]]; then AC_MSG_ERROR([You need X11 to run Basilisk II.]) @@ -339,12 +369,10 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no]) AS_IF([test "x$have_bincue" = "xyes" ], [ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then DEFINES="$DEFINES -DBINCUE" - AC_SUBST(USE_BINCUE, yes) else AC_MSG_ERROR([You need SDL Audio to use BINCUE support.]) - AC_SUBST(USE_BINCUE, no) fi -], [AC_SUBST(USE_BINCUE, no)]) +]) dnl LIBVHD AS_IF([test "x$with_libvhd" = "xyes" ], [have_libvhd=yes], [have_libvhd=no]) @@ -825,7 +853,7 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then fi if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support]) - VIDEOSRCS="../SDL/video_sdl.cpp" + VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp" KEYCODES="../SDL/keycodes" if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then AC_MSG_CHECKING([whether __LP64__ is defined]) @@ -906,9 +934,6 @@ dnl Check that the host supports TUN/TAP devices AC_CACHE_CHECK([whether TUN/TAP is supported], ac_cv_tun_tap_support, [ AC_TRY_COMPILE([ - #ifdef HAVE_SYS_SOCKET_H - #include - #endif #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) #include #include @@ -1301,7 +1326,7 @@ AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", dnl Resolve and set the proper sigsegv_recovery method... -if [[ "x$ac_cv_have_mach_exceptions" = "xyes" ]]; then +if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then sigsegv_recovery=mach elif [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then sigsegv_recovery=win32 @@ -1851,6 +1876,7 @@ echo echo Mac OS X GUI ........................... : $WANT_MACOSX_GUI echo Mac OS X Sound ......................... : $WANT_MACOSX_SOUND echo SDL support ............................ : $SDL_SUPPORT +echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR echo BINCUE support ......................... : $have_bincue echo LIBVHD support ......................... : $have_libvhd echo XFree86 DGA support .................... : $WANT_XF86_DGA diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index c4f975a3..aba9bddb 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -28,6 +28,7 @@ #ifdef USE_SDL # include +# include #endif #ifndef USE_SDL_VIDEO @@ -437,6 +438,19 @@ int main(int argc, char **argv) argv[i] = NULL; PrintROMInfo = true; } + +#if defined(__APPLE__) && defined(__MACH__) + // Mac OS X likes to pass in various options of its own, when launching an app. + // Attempt to ignore these. + if (argv[i]) { + const char * mac_psn_prefix = "-psn_"; + if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { + argv[i] = NULL; + } else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) { + argv[i] = NULL; + } + } +#endif } // Remove processed arguments @@ -520,6 +534,18 @@ int main(int argc, char **argv) QuitEmulator(); } atexit(SDL_Quit); + +#if __MACOSX__ + // On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK, + // except that it will also install keyboard shortcuts, such as Command + Q, + // which can interfere with keyboard shortcuts in the guest OS. + // + // HACK: disable these shortcuts, while leaving all other pieces of SDL2's + // menu bar in-place. + extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts(); + disable_SDL2_macosx_menu_bar_keyboard_shortcuts(); +#endif + #endif // Init system routines diff --git a/BasiliskII/src/Unix/prefs_unix.cpp b/BasiliskII/src/Unix/prefs_unix.cpp index a92cd640..4ab21b6a 100644 --- a/BasiliskII/src/Unix/prefs_unix.cpp +++ b/BasiliskII/src/Unix/prefs_unix.cpp @@ -42,6 +42,9 @@ prefs_desc platform_prefs_items[] = { {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, #endif {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, +#ifdef USE_SDL_VIDEO + {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, +#endif {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/BasiliskII/src/Unix/sysdeps.h b/BasiliskII/src/Unix/sysdeps.h index 7ac37f29..51a53c78 100644 --- a/BasiliskII/src/Unix/sysdeps.h +++ b/BasiliskII/src/Unix/sysdeps.h @@ -25,7 +25,7 @@ #error "Your compiler is not ANSI. Get a real one." #endif -#include "config.h" +#include #include "user_strings_unix.h" #ifndef STDC_HEADERS @@ -219,7 +219,7 @@ typedef uae_u32 uaecptr; /* Timing functions */ extern uint64 GetTicks_usec(void); -extern void Delay_usec(uint32 usec); +extern void Delay_usec(uint64 usec); /* Spinlocks */ #ifdef __GNUC__ diff --git a/BasiliskII/src/Unix/timer_unix.cpp b/BasiliskII/src/Unix/timer_unix.cpp index 709194cd..f00420e2 100644 --- a/BasiliskII/src/Unix/timer_unix.cpp +++ b/BasiliskII/src/Unix/timer_unix.cpp @@ -44,8 +44,8 @@ static inline void mach_current_time(tm_time_t &t) { host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &host_clock); host_clock_inited = true; } - - clock_get_time(host_clock, &t); + + clock_get_time(host_clock, (mach_timespec_t *)&t); } #endif @@ -264,7 +264,7 @@ uint64 GetTicks_usec(void) #define USE_COND_TIMEDWAIT #endif -void Delay_usec(uint32 usec) +void Delay_usec(uint64 usec) { int was_error; diff --git a/BasiliskII/src/Windows/BasiliskII.sln b/BasiliskII/src/Windows/BasiliskII.sln index 1c4b7a1f..65b6b30f 100644 --- a/BasiliskII/src/Windows/BasiliskII.sln +++ b/BasiliskII/src/Windows/BasiliskII.sln @@ -1,140 +1,140 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasiliskII", "BasiliskII.vcxproj", "{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}" - ProjectSection(ProjectDependencies) = postProject - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48} = {1A9EA738-8DA7-422F-9E0D-BE92893C0E48} - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04} = {95933FE9-C27C-41F0-B4AF-EAAADE94FD04} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build68k", "build68k.vcxproj", "{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpu", "gencpu.vcxproj", "{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}" - ProjectSection(ProjectDependencies) = postProject - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencomp", "gencomp.vcxproj", "{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}" - ProjectSection(ProjectDependencies) = postProject - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "..\..\..\..\SDL-1.2.15\VisualC\SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "..\..\..\..\SDL-1.2.15\VisualC\SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug JIT|x64 = Debug JIT|x64 - Debug JIT|x86 = Debug JIT|x86 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release JIT|x64 = Release JIT|x64 - Release JIT|x86 = Release JIT|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.ActiveCfg = Debug JIT|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.Build.0 = Debug JIT|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.ActiveCfg = Debug JIT|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.Build.0 = Debug JIT|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.ActiveCfg = Debug|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.Build.0 = Debug|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.ActiveCfg = Debug|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.Build.0 = Debug|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.ActiveCfg = Release JIT|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.Build.0 = Release JIT|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.ActiveCfg = Release JIT|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.Build.0 = Release JIT|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.ActiveCfg = Release|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.Build.0 = Release|x64 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.ActiveCfg = Release|Win32 - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.Build.0 = Release|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.ActiveCfg = Debug|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.Build.0 = Debug|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.ActiveCfg = Debug|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.Build.0 = Debug|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.ActiveCfg = Debug|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.Build.0 = Debug|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.ActiveCfg = Debug|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.Build.0 = Debug|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.ActiveCfg = Release|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.Build.0 = Release|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.ActiveCfg = Release|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.Build.0 = Release|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.ActiveCfg = Release|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.Build.0 = Release|x64 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.ActiveCfg = Release|Win32 - {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.Build.0 = Release|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.ActiveCfg = Debug|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.Build.0 = Debug|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.ActiveCfg = Debug|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.Build.0 = Debug|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.ActiveCfg = Debug|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.Build.0 = Debug|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.ActiveCfg = Debug|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.Build.0 = Debug|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.ActiveCfg = Release|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.Build.0 = Release|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.ActiveCfg = Release|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.Build.0 = Release|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.ActiveCfg = Release|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.Build.0 = Release|x64 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.ActiveCfg = Release|Win32 - {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.Build.0 = Release|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.ActiveCfg = Debug|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.Build.0 = Debug|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.ActiveCfg = Debug|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.Build.0 = Debug|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.ActiveCfg = Debug|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.Build.0 = Debug|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.ActiveCfg = Debug|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.Build.0 = Debug|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.ActiveCfg = Release|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.Build.0 = Release|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.ActiveCfg = Release|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.Build.0 = Release|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.ActiveCfg = Release|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.Build.0 = Release|x64 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.ActiveCfg = Release|Win32 - {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.Build.0 = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.ActiveCfg = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.Build.0 = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.ActiveCfg = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.Build.0 = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.ActiveCfg = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.Build.0 = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.ActiveCfg = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.Build.0 = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.ActiveCfg = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.Build.0 = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.ActiveCfg = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.Build.0 = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.ActiveCfg = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.Build.0 = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.ActiveCfg = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.Build.0 = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.ActiveCfg = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.Build.0 = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.ActiveCfg = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.Build.0 = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.ActiveCfg = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.Build.0 = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.ActiveCfg = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasiliskII", "BasiliskII.vcxproj", "{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}" + ProjectSection(ProjectDependencies) = postProject + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48} = {1A9EA738-8DA7-422F-9E0D-BE92893C0E48} + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04} = {95933FE9-C27C-41F0-B4AF-EAAADE94FD04} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build68k", "build68k.vcxproj", "{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpu", "gencpu.vcxproj", "{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}" + ProjectSection(ProjectDependencies) = postProject + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencomp", "gencomp.vcxproj", "{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}" + ProjectSection(ProjectDependencies) = postProject + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "..\..\..\external\SDL\VisualC\SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "..\..\..\external\SDL\VisualC\SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug JIT|x64 = Debug JIT|x64 + Debug JIT|x86 = Debug JIT|x86 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release JIT|x64 = Release JIT|x64 + Release JIT|x86 = Release JIT|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.ActiveCfg = Debug JIT|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.Build.0 = Debug JIT|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.ActiveCfg = Debug JIT|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.Build.0 = Debug JIT|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.ActiveCfg = Debug|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.Build.0 = Debug|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.ActiveCfg = Debug|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.Build.0 = Debug|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.ActiveCfg = Release JIT|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.Build.0 = Release JIT|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.ActiveCfg = Release JIT|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.Build.0 = Release JIT|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.ActiveCfg = Release|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.Build.0 = Release|x64 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.ActiveCfg = Release|Win32 + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.Build.0 = Release|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.ActiveCfg = Debug|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.Build.0 = Debug|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.ActiveCfg = Debug|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.Build.0 = Debug|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.ActiveCfg = Debug|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.Build.0 = Debug|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.ActiveCfg = Debug|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.Build.0 = Debug|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.ActiveCfg = Release|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.Build.0 = Release|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.ActiveCfg = Release|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.Build.0 = Release|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.ActiveCfg = Release|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.Build.0 = Release|x64 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.ActiveCfg = Release|Win32 + {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.Build.0 = Release|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.ActiveCfg = Debug|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.Build.0 = Debug|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.ActiveCfg = Debug|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.Build.0 = Debug|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.ActiveCfg = Debug|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.Build.0 = Debug|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.ActiveCfg = Debug|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.Build.0 = Debug|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.ActiveCfg = Release|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.Build.0 = Release|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.ActiveCfg = Release|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.Build.0 = Release|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.ActiveCfg = Release|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.Build.0 = Release|x64 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.ActiveCfg = Release|Win32 + {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.Build.0 = Release|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.ActiveCfg = Debug|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.Build.0 = Debug|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.ActiveCfg = Debug|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.Build.0 = Debug|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.ActiveCfg = Debug|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.Build.0 = Debug|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.ActiveCfg = Debug|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.Build.0 = Debug|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.ActiveCfg = Release|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.Build.0 = Release|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.ActiveCfg = Release|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.Build.0 = Release|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.ActiveCfg = Release|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.Build.0 = Release|x64 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.ActiveCfg = Release|Win32 + {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.Build.0 = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.ActiveCfg = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.Build.0 = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.ActiveCfg = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.Build.0 = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.ActiveCfg = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.Build.0 = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.Build.0 = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.Build.0 = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.Build.0 = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.ActiveCfg = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.Build.0 = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.ActiveCfg = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.Build.0 = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.ActiveCfg = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.Build.0 = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.ActiveCfg = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.Build.0 = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.ActiveCfg = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.Build.0 = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.ActiveCfg = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/BasiliskII/src/Windows/BasiliskII.vcxproj b/BasiliskII/src/Windows/BasiliskII.vcxproj index cd05c309..b3a3a3ff 100644 --- a/BasiliskII/src/Windows/BasiliskII.vcxproj +++ b/BasiliskII/src/Windows/BasiliskII.vcxproj @@ -1,685 +1,698 @@ - - - - - Debug JIT - Win32 - - - Debug JIT - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release JIT - Win32 - - - Release JIT - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - - - true - true - true - true - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {81ce8daf-ebb2-4761-8e45-b71abcca8c68} - - - {da956fd3-e142-46f2-9dd5-c78bebb56b7a} - - - - {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0} - Win32Proj - BasiliskII - 8.1 - - - - Application - true - v140_xp - Unicode - - - Application - true - v140_xp - Unicode - - - Application - true - v140_xp - Unicode - - - Application - true - v140_xp - Unicode - - - Application - false - v140_xp - true - Unicode - - - Application - false - v140_xp - true - Unicode - - - Application - false - v140_xp - true - Unicode - - - Application - false - v140_xp - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - ClCompile - - - ClCompile - true - - - true - $(Configuration)\$(ProjectName)\ - ClCompile - - - ClCompile - true - - - false - $(Configuration)\$(ProjectName)\ - ClCompile - - - ClCompile - false - - - false - $(Configuration)\$(ProjectName)\ - ClCompile - - - ClCompile - false - - - - - - Level3 - Disabled - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - - - Level3 - Disabled - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - - - Level3 - Disabled - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;USE_JIT;USE_JIT_FPU;JIT_DEBUG;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - - - Level3 - Disabled - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;USE_JIT;USE_JIT_FPU;JIT_DEBUG;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - Level3 - - - MaxSpeed - true - true - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - true - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - Level3 - - - MaxSpeed - true - true - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - true - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - Level3 - - - MaxSpeed - true - true - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;USE_JIT;USE_JIT_FPU;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - true - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - Level3 - - - MaxSpeed - true - true - HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;USE_JIT;USE_JIT_FPU;%(PreprocessorDefinitions) - ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\..\SDL-1.2.15\include - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - $(IntDir)%(RelativeDir) - - - Windows - true - true - true - WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) - - - cd ..\uae_cpu -"$(ToolsDir)gencpu" -"$(ToolsDir)gencomp" - - - - Generating CPU emulation sources... - - - ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) - - - $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe - - - - - + + + + + Debug JIT + Win32 + + + Debug JIT + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release JIT + Win32 + + + Release JIT + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + + + + {1AAA5D96-9498-4EB5-A436-0143E2B7A0B0} + Win32Proj + BasiliskII + 8.1 + + + + Application + true + v140_xp + Unicode + + + Application + true + v140_xp + Unicode + + + Application + true + v140_xp + Unicode + + + Application + true + v140_xp + Unicode + + + Application + false + v140_xp + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + ClCompile + + + ClCompile + true + + + true + $(Configuration)\$(ProjectName)\ + ClCompile + + + ClCompile + true + + + false + $(Configuration)\$(ProjectName)\ + ClCompile + + + ClCompile + false + + + false + $(Configuration)\$(ProjectName)\ + ClCompile + + + ClCompile + false + + + + + + Level3 + Disabled + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + BasiliskII_MSVC_PostBuild.bat "$(SolutionDir)" "$(Platform)" "$(Configuration)" "$(OutDir)" + + + + + + + Level3 + Disabled + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + + + + + Level3 + Disabled + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;USE_JIT;USE_JIT_FPU;JIT_DEBUG;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + BasiliskII_MSVC_PostBuild.bat "$(SolutionDir)" "$(Platform)" "$(Configuration)" "$(OutDir)" + + + + + + + Level3 + Disabled + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;USE_JIT;USE_JIT_FPU;JIT_DEBUG;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + + + Level3 + + + MaxSpeed + true + true + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + true + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + BasiliskII_MSVC_PostBuild.bat "$(SolutionDir)" "$(Platform)" "$(Configuration)" "$(OutDir)" + + + + + Level3 + + + MaxSpeed + true + true + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + true + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + + + Level3 + + + MaxSpeed + true + true + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;USE_JIT;USE_JIT_FPU;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + true + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + BasiliskII_MSVC_PostBuild.bat "$(SolutionDir)" "$(Platform)" "$(Configuration)" "$(OutDir)" + + + + + Level3 + + + MaxSpeed + true + true + HAVE_CONFIG_H;DIRECT_ADDRESSING;UNALIGNED_PROFITABLE;MSVC_INTRINSICS;OPTIMIZED_FLAGS;SAHF_SETO_PROFITABLE;FPU_IEEE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;OPTIMIZED_FLAGS;USE_JIT;USE_JIT_FPU;%(PreprocessorDefinitions) + ..\include;..\uae_cpu;.;..\CrossPlatform;..\slirp;..\..\..\external\SDL\include + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + $(IntDir)%(RelativeDir) + + + Windows + true + true + true + WS2_32.lib;IPHlpApi.lib;%(AdditionalDependencies) + + + cd ..\uae_cpu +"$(ToolsDir)gencpu" +"$(ToolsDir)gencomp" + + + + Generating CPU emulation sources... + + + ..\uae_cpu\cpustbl.cpp;..\uae_cpu\cpustbl_nf.cpp;..\uae_cpu\cputbl.h;..\uae_cpu\cpuemu.cpp;..\uae_cpu\cpuemu_nf.cpp;..\uae_cpu\compstbl.cpp;..\uae_cpu\comptbl.h;..\uae_cpu\compemu.cpp;%(Outputs) + + + $(ToolsDir)gencpu.exe;$(ToolsDir)gencomp.exe + + + + + \ No newline at end of file diff --git a/BasiliskII/src/Windows/BasiliskII.vcxproj.filters b/BasiliskII/src/Windows/BasiliskII.vcxproj.filters index 50eae3d1..2d460b26 100644 --- a/BasiliskII/src/Windows/BasiliskII.vcxproj.filters +++ b/BasiliskII/src/Windows/BasiliskII.vcxproj.filters @@ -270,6 +270,9 @@ Source Files + + Source Files + Source Files diff --git a/BasiliskII/src/Windows/BasiliskII_MSVC_PostBuild.bat b/BasiliskII/src/Windows/BasiliskII_MSVC_PostBuild.bat new file mode 100644 index 00000000..54d63182 --- /dev/null +++ b/BasiliskII/src/Windows/BasiliskII_MSVC_PostBuild.bat @@ -0,0 +1,7 @@ +@echo off +set SOLUTION_DIR=%~1 +set PLATFORM=%~2 +set CONFIGURATION=%~3 +set CONFIGURATION=%CONFIGURATION: JIT=% +set OUT_DIR=%~4 +xcopy /y "%SOLUTION_DIR%%PLATFORM%\%CONFIGURATION%\SDL2.dll" "%OUT_DIR%" diff --git a/BasiliskII/src/Windows/Makefile.in b/BasiliskII/src/Windows/Makefile.in index dfa59a60..d5a5dd5f 100755 --- a/BasiliskII/src/Windows/Makefile.in +++ b/BasiliskII/src/Windows/Makefile.in @@ -63,7 +63,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window ../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_windows.cpp ../timer.cpp \ timer_windows.cpp ../adb.cpp ../serial.cpp serial_windows.cpp \ ../ether.cpp ether_windows.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp \ - ../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp \ + ../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp \ video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \ ../extfs.cpp extfs_windows.cpp ../user_strings.cpp user_strings_windows.cpp \ vm_alloc.cpp sigsegv.cpp posix_emu.cpp util_windows.cpp \ diff --git a/BasiliskII/src/Windows/b2ether/packet32.cpp b/BasiliskII/src/Windows/b2ether/packet32.cpp index 72efb1fe..93dd647f 100755 --- a/BasiliskII/src/Windows/b2ether/packet32.cpp +++ b/BasiliskII/src/Windows/b2ether/packet32.cpp @@ -26,7 +26,6 @@ #include #include #include "cpu_emulation.h" -typedef unsigned long ULONG_PTR, *PULONG_PTR; // VC6 does not have this, Platform SDK has. // In case of errors, try to comment out, the needed diff --git a/BasiliskII/src/Windows/main_windows.cpp b/BasiliskII/src/Windows/main_windows.cpp index 184a2dc6..2629c4b7 100755 --- a/BasiliskII/src/Windows/main_windows.cpp +++ b/BasiliskII/src/Windows/main_windows.cpp @@ -212,6 +212,26 @@ int main(int argc, char **argv) char str[256]; bool cd_boot = false; + // Redirect stdout and stderr to a log file, for diagnostic purposes. + // Unbuffered file IO will be used (setup via setvbuf() calls), so as + // to write log file data ASAP, lest it get lost in case of program + // termination. + wchar_t logFileName[4096]; + logFileName[0] = L'\0'; + _wgetcwd(logFileName, SDL_arraysize(logFileName)); + if (logFileName[0] != L'\0') { + SDL_wcslcat(logFileName, L"\\BasiliskII_log.txt", SDL_arraysize(logFileName)); + FILE * fp; + fp = _wfreopen(logFileName, L"w", stdout); + if (fp) { + setvbuf(stdout, NULL, _IONBF, 0); + } + fp = _wfreopen(logFileName, L"w", stderr); + if (fp) { + setvbuf(stderr, NULL, _IONBF, 0); + } + } + // Initialize variables RAMBaseHost = NULL; ROMBaseHost = NULL; @@ -283,10 +303,6 @@ int main(int argc, char **argv) QuitEmulator(); #endif - // FIXME: default to DIB driver - if (getenv("SDL_VIDEODRIVER") == NULL) - putenv("SDL_VIDEODRIVER=windib"); - // Initialize SDL system int sdl_flags = 0; #ifdef USE_SDL_VIDEO @@ -400,7 +416,7 @@ int main(int argc, char **argv) emul_thread = GetCurrentThread(); // SDL threads available, start 60Hz thread - tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, NULL)) != NULL); + tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, "Redraw Thread", NULL)) != NULL); if (!tick_thread_active) { sprintf(str, GetString(STR_TICK_THREAD_ERR), strerror(errno)); ErrorAlert(str); @@ -410,7 +426,7 @@ int main(int argc, char **argv) // Start XPRAM watchdog thread memcpy(last_xpram, XPRAM, XPRAM_SIZE); - xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, NULL)) != NULL); + xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, "XPRAM Thread", NULL)) != NULL); D(bug("XPRAM thread started\n")); // Start 68k and jump to ROM boot routine @@ -625,11 +641,21 @@ static int tick_func(void *arg) #ifdef USE_SDL_VIDEO #include +extern SDL_Window *sdl_window; HWND GetMainWindowHandle(void) { SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); - return SDL_GetWMInfo(&wmInfo) ? wmInfo.window : NULL; + if (!sdl_window) { + return NULL; + } + if (!SDL_GetWindowWMInfo(sdl_window, &wmInfo)) { + return NULL; + } + if (wmInfo.subsystem != SDL_SYSWM_WINDOWS) { + return NULL; + } + return wmInfo.info.win.window; } #endif diff --git a/BasiliskII/src/dummy/prefs_dummy.cpp b/BasiliskII/src/dummy/prefs_dummy.cpp index 84dd31ec..1b33489c 100644 --- a/BasiliskII/src/dummy/prefs_dummy.cpp +++ b/BasiliskII/src/dummy/prefs_dummy.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "prefs.h" @@ -33,14 +34,20 @@ prefs_desc platform_prefs_items[] = { // Prefs file name and path +#if defined(__APPLE__) && defined(__MACH__) +const char PREFS_FILE_NAME[] = "/tmp/BasiliskII/BasiliskII_Prefs"; // HACK: for now, just load stuff from a fixed dir, inside /tmp +#else const char PREFS_FILE_NAME[] = "BasiliskII_Prefs"; +#endif + +std::string UserPrefsPath; /* * Load preferences from settings file */ -void LoadPrefs(void) +void LoadPrefs(const char * vmdir) // TODO: load prefs from 'vmdir' { // Read preferences from settings file FILE *f = fopen(PREFS_FILE_NAME, "r"); diff --git a/BasiliskII/src/dummy/user_strings_dummy.cpp b/BasiliskII/src/dummy/user_strings_dummy.cpp index 5f97823d..2ff2ead7 100644 --- a/BasiliskII/src/dummy/user_strings_dummy.cpp +++ b/BasiliskII/src/dummy/user_strings_dummy.cpp @@ -23,7 +23,7 @@ // Platform-specific string definitions -const user_string_def platform_strings[] = { +user_string_def platform_strings[] = { {-1, NULL} // End marker }; @@ -32,7 +32,7 @@ const user_string_def platform_strings[] = { * Fetch pointer to string, given the string number */ -char *GetString(int num) +const char *GetString(int num) { // First search for platform-specific string int i = 0; diff --git a/BasiliskII/src/include/version.h b/BasiliskII/src/include/version.h index 44819c70..79ba3196 100644 --- a/BasiliskII/src/include/version.h +++ b/BasiliskII/src/include/version.h @@ -22,8 +22,8 @@ #define VERSION_H const int VERSION_MAJOR = 1; -const int VERSION_MINOR = 0; +const int VERSION_MINOR = 1; -#define VERSION_STRING "Basilisk II V1.0" +#define VERSION_STRING "Basilisk II V1.0 SDL2" #endif diff --git a/BasiliskII/src/include/video.h b/BasiliskII/src/include/video.h index 78526e67..208881ba 100644 --- a/BasiliskII/src/include/video.h +++ b/BasiliskII/src/include/video.h @@ -76,6 +76,9 @@ inline video_depth DepthModeForPixelDepth(int depth) } } +// Returns the name of a video_depth, or an empty string if the depth is unknown +const char * NameOfDepth(video_depth depth); + // Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth) { diff --git a/BasiliskII/src/prefs_items.cpp b/BasiliskII/src/prefs_items.cpp index 834dfc7d..6da364b0 100644 --- a/BasiliskII/src/prefs_items.cpp +++ b/BasiliskII/src/prefs_items.cpp @@ -68,6 +68,10 @@ prefs_desc common_prefs_items[] = { {"jitinline", TYPE_BOOLEAN, false, "enable translation through constant jumps"}, {"jitblacklist", TYPE_STRING, false, "blacklist opcodes from translation"}, {"keyboardtype", TYPE_INT32, false, "hardware keyboard type"}, + {"keycodes",TYPE_BOOLEAN,false,"use raw keycode"}, + {"keycodefile",TYPE_STRING,"Keycode file"}, + {"mousewheelmode",TYPE_BOOLEAN,"Use WheelMode"}, + {"mousewheellines",TYPE_INT32,"wheel line nb"}, {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/BasiliskII/src/slirp/VERSION b/BasiliskII/src/slirp/VERSION index 353ad940..12adff9b 100644 --- a/BasiliskII/src/slirp/VERSION +++ b/BasiliskII/src/slirp/VERSION @@ -1 +1,2 @@ qemu 0.9.0 (2007/02/05) +Plus 64 Bits Patchs \ No newline at end of file diff --git a/BasiliskII/src/slirp/bootp.c b/BasiliskII/src/slirp/bootp.c old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/bootp.h b/BasiliskII/src/slirp/bootp.h old mode 100644 new mode 100755 index 54a86ca2..5c2e62ab --- a/BasiliskII/src/slirp/bootp.h +++ b/BasiliskII/src/slirp/bootp.h @@ -115,7 +115,7 @@ struct bootp_t { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif void bootp_input(struct mbuf *m); diff --git a/BasiliskII/src/slirp/cksum.c b/BasiliskII/src/slirp/cksum.c old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/ctl.h b/BasiliskII/src/slirp/ctl.h old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/debug.c b/BasiliskII/src/slirp/debug.c old mode 100644 new mode 100755 index 916b9a8e..d3d8c579 --- a/BasiliskII/src/slirp/debug.c +++ b/BasiliskII/src/slirp/debug.c @@ -16,6 +16,8 @@ int dostats = 0; #endif int slirp_debug = 0; +extern char *strerror _P((int)); + /* Carry over one item from main.c so that the tty's restored. * Only done when the tty being used is /dev/tty --RedWolf */ extern struct termios slirp_tty_settings; @@ -292,7 +294,6 @@ mbufstats() void sockstats() { - char addr[INET_ADDRSTRLEN]; char buff[256]; int n; struct socket *so; @@ -310,11 +311,9 @@ sockstats() buff[17] = 0; lprint("%s %3d %15s %5d ", buff, so->s, - inet_ntop(AF_INET, &so->so_laddr, addr, sizeof(addr)), - ntohs(so->so_lport)); + inet_ntoa(so->so_laddr), ntohs(so->so_lport)); lprint("%15s %5d %5d %5d\r\n", - inet_ntop(AF_INET, &so->so_faddr, addr, sizeof(addr)), - ntohs(so->so_fport), + inet_ntoa(so->so_faddr), ntohs(so->so_fport), so->so_rcv.sb_cc, so->so_snd.sb_cc); } @@ -326,11 +325,9 @@ sockstats() buff[17] = 0; lprint("%s %3d %15s %5d ", buff, so->s, - inet_ntop(AF_INET, &so->so_laddr, addr, sizeof(addr)), - ntohs(so->so_lport)); + inet_ntoa(so->so_laddr), ntohs(so->so_lport)); lprint("%15s %5d %5d %5d\r\n", - inet_ntop(AF_INET, &so->so_faddr, addr, sizeof(addr)), - ntohs(so->so_fport), + inet_ntoa(so->so_faddr), ntohs(so->so_fport), so->so_rcv.sb_cc, so->so_snd.sb_cc); } } diff --git a/BasiliskII/src/slirp/debug.h b/BasiliskII/src/slirp/debug.h old mode 100644 new mode 100755 index c5d42195..6e8444da --- a/BasiliskII/src/slirp/debug.h +++ b/BasiliskII/src/slirp/debug.h @@ -36,15 +36,15 @@ extern int slirp_debug; #endif -void debug_init(char *, int); -//void ttystats(struct ttys *); -void allttystats(void); -void ipstats(void); -void vjstats(void); -void tcpstats(void); -void udpstats(void); -void icmpstats(void); -void mbufstats(void); -void sockstats(void); -void slirp_exit(int); +void debug_init _P((char *, int)); +//void ttystats _P((struct ttys *)); +void allttystats _P((void)); +void ipstats _P((void)); +void vjstats _P((void)); +void tcpstats _P((void)); +void udpstats _P((void)); +void icmpstats _P((void)); +void mbufstats _P((void)); +void sockstats _P((void)); +void slirp_exit _P((int)); diff --git a/BasiliskII/src/slirp/icmp_var.h b/BasiliskII/src/slirp/icmp_var.h old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/if.c b/BasiliskII/src/slirp/if.c old mode 100644 new mode 100755 index 9185dcf6..eab8a46e --- a/BasiliskII/src/slirp/if.c +++ b/BasiliskII/src/slirp/if.c @@ -7,11 +7,11 @@ #include -size_t if_mtu, if_mru; +int if_mtu, if_mru; int if_comp; int if_maxlinkhdr; -int if_queued = 0; /* Number of packets queued so far */ -int if_thresh = 10; /* Number of packets queued before we start sending +int if_queued = 0; /* Number of packets queued so far */ +int if_thresh = 10; /* Number of packets queued before we start sending * (to prevent allocing too many mbufs) */ struct mbuf if_fastq; /* fast queue (for interactive data) */ @@ -116,8 +116,7 @@ if_input(ttyp) DEBUG_MISC((dfd, " read %d bytes\n", if_n)); if (if_n <= 0) { - int error = WSAGetLastError(); - if (if_n == 0 || (error != WSAEINTR && error != EAGAIN)) { + if (if_n == 0 || (errno != EINTR && errno != EAGAIN)) { if (ttyp->up) link_up--; tty_detached(ttyp, 0); diff --git a/BasiliskII/src/slirp/if.h b/BasiliskII/src/slirp/if.h old mode 100644 new mode 100755 index a2564ab1..5d96a903 --- a/BasiliskII/src/slirp/if.h +++ b/BasiliskII/src/slirp/if.h @@ -15,8 +15,8 @@ /* Needed for FreeBSD */ #undef if_mtu -extern size_t if_mtu; -extern size_t if_mru; /* MTU and MRU */ +extern int if_mtu; +extern int if_mru; /* MTU and MRU */ extern int if_comp; /* Flags for compression */ extern int if_maxlinkhdr; extern int if_queued; /* Number of packets queued so far */ diff --git a/BasiliskII/src/slirp/ip.h b/BasiliskII/src/slirp/ip.h old mode 100644 new mode 100755 index e0c7de96..94dcc606 --- a/BasiliskII/src/slirp/ip.h +++ b/BasiliskII/src/slirp/ip.h @@ -98,7 +98,7 @@ struct ip { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif #define IP_MAXPACKET 65535 /* maximum packet size */ @@ -168,7 +168,7 @@ struct ip_timestamp { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif /* flag bits for ipt_flg */ @@ -195,23 +195,19 @@ struct ip_timestamp { #define IP_MSS 576 /* default maximum segment size */ -#ifdef HAVE_SYS_TYPES32_H /* Overcome some Solaris 2.x junk */ -#include -#else #if SIZEOF_CHAR_P == 4 -typedef caddr_t caddr32_t; + struct mbuf_ptr { + struct mbuf *mptr; + uint32_t dummy; + }; #else -typedef u_int32_t caddr32_t; -#endif -#endif - -#if SIZEOF_CHAR_P == 4 -typedef struct ipq *ipqp_32; -typedef struct ipasfrag *ipasfragp_32; -#else -typedef caddr32_t ipqp_32; -typedef caddr32_t ipasfragp_32; + struct mbuf_ptr { + struct mbuf *mptr; + }; #endif +struct qlink { + void *next, *prev; +}; /* * Overlay for ip header used by other protocols (tcp, udp). @@ -221,16 +217,16 @@ typedef caddr32_t ipasfragp_32; #endif struct ipovly { - caddr32_t ih_next, ih_prev; /* for protocol sequence q's */ + struct mbuf_ptr ih_mbuf; /* backpointer to mbuf */ u_int8_t ih_x1; /* (unused) */ u_int8_t ih_pr; /* protocol */ u_int16_t ih_len; /* protocol length */ struct in_addr ih_src; /* source internet address */ struct in_addr ih_dst; /* destination internet address */ -} PACKED__; +} __attribute__((packed)); #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif /* @@ -241,12 +237,13 @@ struct ipovly { * size 28 bytes */ struct ipq { - ipqp_32 next,prev; /* to other reass headers */ + struct qlink frag_link; /* to ip headers of fragments */ + struct qlink ip_link; /* to other reass headers */ + u_int8_t ipq_ttl; /* time for reass q to live */ u_int8_t ipq_p; /* protocol of this fragment */ u_int16_t ipq_id; /* sequence id for reassembly */ - ipasfragp_32 ipq_next,ipq_prev; - /* to ip headers of fragments */ + struct in_addr ipq_src,ipq_dst; }; @@ -256,29 +253,16 @@ struct ipq { * Note: ipf_next must be at same offset as ipq_next above */ struct ipasfrag { -#ifdef WORDS_BIGENDIAN - u_char ip_v:4, - ip_hl:4; -#else - u_char ip_hl:4, - ip_v:4; -#endif - /* BUG : u_int changed to u_int8_t. - * sizeof(u_int)==4 on linux 2.0 - */ - u_int8_t ipf_mff; /* XXX overlays ip_tos: use low bit - * to avoid destroying tos (PPPDTRuu); - * copied from (ip_off&IP_MF) */ - u_int16_t ip_len; - u_int16_t ip_id; - u_int16_t ip_off; - u_int8_t ip_ttl; - u_int8_t ip_p; - u_int16_t ip_sum; - ipasfragp_32 ipf_next; /* next fragment */ - ipasfragp_32 ipf_prev; /* previous fragment */ + struct qlink ipf_link; + struct ip ipf_ip; }; +#define ipf_off ipf_ip.ip_off +#define ipf_tos ipf_ip.ip_tos +#define ipf_len ipf_ip.ip_len +#define ipf_next ipf_link.next +#define ipf_prev ipf_link.prev + /* * Structure stored in mbuf in inpcb.ip_options * and passed to ip_output when ip options are in use. diff --git a/BasiliskII/src/slirp/ip_icmp.c b/BasiliskII/src/slirp/ip_icmp.c old mode 100644 new mode 100755 index 55376a8b..7cbda790 --- a/BasiliskII/src/slirp/ip_icmp.c +++ b/BasiliskII/src/slirp/ip_icmp.c @@ -77,7 +77,7 @@ icmp_input(m, hlen) DEBUG_CALL("icmp_input"); DEBUG_ARG("m = %lx", (long )m); - DEBUG_ARG("m_len = %zu", m->m_len); + DEBUG_ARG("m_len = %d", m->m_len); icmpstat.icps_received++; @@ -201,12 +201,12 @@ end_error: #define ICMP_MAXDATALEN (IP_MSS-28) void -icmp_error( - struct mbuf *msrc, - u_char type, - u_char code, - int minsize, - char *message) +icmp_error(msrc, type, code, minsize, message) + struct mbuf *msrc; + u_char type; + u_char code; + int minsize; + char *message; { unsigned hlen, shlen, s_ip_len; register struct ip *ip; @@ -215,7 +215,7 @@ icmp_error( DEBUG_CALL("icmp_error"); DEBUG_ARG("msrc = %lx", (long )msrc); - DEBUG_ARG("msrc_len = %zu", msrc->m_len); + DEBUG_ARG("msrc_len = %d", msrc->m_len); if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error; @@ -223,9 +223,9 @@ icmp_error( if(!msrc) goto end_error; ip = mtod(msrc, struct ip *); #if DEBUG - { char bufa[INET_ADDRSTRLEN], bufb[INET_ADDRSTRLEN]; - inet_ntop(AF_INET, &ip->ip_src, bufa, sizeof(bufa)); - inet_ntop(AF_INET, &ip->ip_dst, bufb, sizeof(bufb)); + { char bufa[20], bufb[20]; + strcpy(bufa, inet_ntoa(ip->ip_src)); + strcpy(bufb, inet_ntoa(ip->ip_dst)); DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb)); } #endif @@ -244,7 +244,7 @@ icmp_error( /* make a copy */ if(!(m=m_get())) goto end_error; /* get mbuf */ - { u_int new_m_size; + { int new_m_size; new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN; if(new_m_size>m->m_size) m_inc(m, new_m_size); } @@ -299,7 +299,7 @@ icmp_error( /* fill in ip */ ip->ip_hl = hlen >> 2; - ip->ip_len = (u_int16_t)m->m_len; + ip->ip_len = m->m_len; ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */ diff --git a/BasiliskII/src/slirp/ip_icmp.h b/BasiliskII/src/slirp/ip_icmp.h old mode 100644 new mode 100755 index 683dc87f..6968daa7 --- a/BasiliskII/src/slirp/ip_icmp.h +++ b/BasiliskII/src/slirp/ip_icmp.h @@ -95,7 +95,7 @@ struct icmp { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif /* @@ -161,8 +161,8 @@ struct icmp { (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) -void icmp_input(struct mbuf *, int); -void icmp_error(struct mbuf *, u_char, u_char, int, char *); -void icmp_reflect(struct mbuf *); +void icmp_input _P((struct mbuf *, int)); +void icmp_error _P((struct mbuf *, u_char, u_char, int, char *)); +void icmp_reflect _P((struct mbuf *)); #endif diff --git a/BasiliskII/src/slirp/ip_input.c b/BasiliskII/src/slirp/ip_input.c old mode 100644 new mode 100755 index cac8493b..7c995c98 --- a/BasiliskII/src/slirp/ip_input.c +++ b/BasiliskII/src/slirp/ip_input.c @@ -38,6 +38,16 @@ * terms and conditions of the copyright. */ +#include +#include +#include +#include + +#define container_of(ptr, type, member) ({ \ + const typeof(((type *) 0)->member) *__mptr = (ptr); \ + (type *) ((char *) __mptr - offsetof(type, member));}) + + #include #include "ip_icmp.h" @@ -52,7 +62,7 @@ struct ipq ipq; void ip_init() { - ipq.next = ipq.prev = (ipqp_32)&ipq; + ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link; ip_id = tt.tv_sec & 0xffff; udp_init(); tcp_init(); @@ -68,11 +78,11 @@ ip_input(m) struct mbuf *m; { register struct ip *ip; - u_int hlen; + int hlen; DEBUG_CALL("ip_input"); DEBUG_ARG("m = %lx", (long)m); - DEBUG_ARG("m_len = %zu", m->m_len); + DEBUG_ARG("m_len = %d", m->m_len); ipstat.ips_total++; @@ -155,18 +165,20 @@ ip_input(m) */ if (ip->ip_off &~ IP_DF) { register struct ipq *fp; + struct qlink *l; /* * Look for queue of fragments * of this datagram. */ - for (fp = (struct ipq *) ipq.next; fp != &ipq; - fp = (struct ipq *) fp->next) - if (ip->ip_id == fp->ipq_id && - ip->ip_src.s_addr == fp->ipq_src.s_addr && - ip->ip_dst.s_addr == fp->ipq_dst.s_addr && - ip->ip_p == fp->ipq_p) + for (l = ipq.ip_link.next; l != &ipq.ip_link; l = l->next) { + fp = container_of(l, struct ipq, ip_link); + if (ip->ip_id == fp->ipq_id && + ip->ip_src.s_addr == fp->ipq_src.s_addr && + ip->ip_dst.s_addr == fp->ipq_dst.s_addr && + ip->ip_p == fp->ipq_p) goto found; - fp = 0; + } + fp = NULL; found: /* @@ -176,9 +188,9 @@ ip_input(m) */ ip->ip_len -= hlen; if (ip->ip_off & IP_MF) - ((struct ipasfrag *)ip)->ipf_mff |= 1; + ip->ip_tos |= 1; else - ((struct ipasfrag *)ip)->ipf_mff &= ~1; + ip->ip_tos &= ~1; ip->ip_off <<= 3; @@ -187,9 +199,9 @@ ip_input(m) * or if this is not the first fragment, * attempt reassembly; if it succeeds, proceed. */ - if (((struct ipasfrag *)ip)->ipf_mff & 1 || ip->ip_off) { + if (ip->ip_tos & 1 || ip->ip_off) { ipstat.ips_fragments++; - ip = ip_reass((struct ipasfrag *)ip, fp); + ip = ip_reass(ip, fp); if (ip == 0) return; ipstat.ips_reassembled++; @@ -225,21 +237,21 @@ bad: return; } +#define iptofrag(P) ((struct ipasfrag *)(((char*)(P)) - sizeof(struct qlink))) +#define fragtoip(P) ((struct ip*)(((char*)(P)) + sizeof(struct qlink))) /* * Take incoming datagram fragment and try to * reassemble it into whole datagram. If a chain for * reassembly of this datagram already exists, then it * is given as fp; otherwise have to make a chain. */ -struct ip * -ip_reass(ip, fp) - register struct ipasfrag *ip; - register struct ipq *fp; +static struct ip * +ip_reass(register struct ip *ip, register struct ipq *fp) { register struct mbuf *m = dtom(ip); register struct ipasfrag *q; int hlen = ip->ip_hl << 2; - int i, next; + u_int16_t i, next; DEBUG_CALL("ip_reass"); DEBUG_ARG("ip = %lx", (long)ip); @@ -261,13 +273,13 @@ ip_reass(ip, fp) struct mbuf *t; if ((t = m_get()) == NULL) goto dropfrag; fp = mtod(t, struct ipq *); - insque_32(fp, &ipq); + insque(&fp->ip_link, &ipq.ip_link); fp->ipq_ttl = IPFRAGTTL; fp->ipq_p = ip->ip_p; fp->ipq_id = ip->ip_id; - fp->ipq_next = fp->ipq_prev = (ipasfragp_32)fp; - fp->ipq_src = ((struct ip *)ip)->ip_src; - fp->ipq_dst = ((struct ip *)ip)->ip_dst; + fp->frag_link.next = fp->frag_link.prev = &fp->frag_link; + fp->ipq_src = ip->ip_src; + fp->ipq_dst = ip->ip_dst; q = (struct ipasfrag *)fp; goto insert; } @@ -275,9 +287,9 @@ ip_reass(ip, fp) /* * Find a segment which begins after this one does. */ - for (q = (struct ipasfrag *)fp->ipq_next; q != (struct ipasfrag *)fp; - q = (struct ipasfrag *)q->ipf_next) - if (q->ip_off > ip->ip_off) + for (q = fp->frag_link.next; q != (struct ipasfrag *)&fp->frag_link; + q = q->ipf_next) + if (q->ipf_off > ip->ip_off) break; /* @@ -285,9 +297,9 @@ ip_reass(ip, fp) * our data already. If so, drop the data from the incoming * segment. If it provides all of our data, drop us. */ - if (q->ipf_prev != (ipasfragp_32)fp) { - i = ((struct ipasfrag *)(q->ipf_prev))->ip_off + - ((struct ipasfrag *)(q->ipf_prev))->ip_len - ip->ip_off; + if (q->ipf_prev != &fp->frag_link) { + struct ipasfrag *pq = q->ipf_prev; + i = pq->ipf_off + pq->ipf_len - ip->ip_off; if (i > 0) { if (i >= ip->ip_len) goto dropfrag; @@ -301,17 +313,18 @@ ip_reass(ip, fp) * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - while (q != (struct ipasfrag *)fp && ip->ip_off + ip->ip_len > q->ip_off) { - i = (ip->ip_off + ip->ip_len) - q->ip_off; - if (i < q->ip_len) { - q->ip_len -= i; - q->ip_off += i; + while (q != (struct ipasfrag*)&fp->frag_link && + ip->ip_off + ip->ip_len > q->ipf_off) { + i = (ip->ip_off + ip->ip_len) - q->ipf_off; + if (i < q->ipf_len) { + q->ipf_len -= i; + q->ipf_off += i; m_adj(dtom(q), i); break; } - q = (struct ipasfrag *) q->ipf_next; - m_freem(dtom((struct ipasfrag *) q->ipf_prev)); - ip_deq((struct ipasfrag *) q->ipf_prev); + q = q->ipf_next; + m_freem(dtom(q->ipf_prev)); + ip_deq(q->ipf_prev); } insert: @@ -319,27 +332,26 @@ insert: * Stick new segment in its place; * check for complete reassembly. */ - ip_enq(ip, (struct ipasfrag *) q->ipf_prev); + ip_enq(iptofrag(ip), q->ipf_prev); next = 0; - for (q = (struct ipasfrag *) fp->ipq_next; q != (struct ipasfrag *)fp; - q = (struct ipasfrag *) q->ipf_next) { - if (q->ip_off != next) + for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link; + q = q->ipf_next) { + if (q->ipf_off != next) return (0); - next += q->ip_len; + next += q->ipf_len; } - if (((struct ipasfrag *)(q->ipf_prev))->ipf_mff & 1) + if (((struct ipasfrag *)(q->ipf_prev))->ipf_tos & 1) return (0); /* * Reassembly is complete; concatenate fragments. */ - q = (struct ipasfrag *) fp->ipq_next; + q = fp->frag_link.next; m = dtom(q); q = (struct ipasfrag *) q->ipf_next; - while (q != (struct ipasfrag *)fp) { - struct mbuf *t; - t = dtom(q); + while (q != (struct ipasfrag*)&fp->frag_link) { + struct mbuf *t = dtom(q); q = (struct ipasfrag *) q->ipf_next; m_cat(m, t); } @@ -350,7 +362,7 @@ insert: * dequeue and discard fragment reassembly header. * Make header visible. */ - ip = (struct ipasfrag *) fp->ipq_next; + q = fp->frag_link.next; /* * If the fragments concatenated to an mbuf that's @@ -361,24 +373,24 @@ insert: */ if (m->m_flags & M_EXT) { int delta; - delta = (char *)ip - m->m_dat; - ip = (struct ipasfrag *)(m->m_ext + delta); + delta = (char *)q - m->m_dat; + q = (struct ipasfrag *)(m->m_ext + delta); } /* DEBUG_ARG("ip = %lx", (long)ip); * ip=(struct ipasfrag *)m->m_data; */ + ip = fragtoip(q); ip->ip_len = next; - ip->ipf_mff &= ~1; - ((struct ip *)ip)->ip_src = fp->ipq_src; - ((struct ip *)ip)->ip_dst = fp->ipq_dst; - remque_32(fp); + ip->ip_tos &= ~1; + ip->ip_src = fp->ipq_src; + ip->ip_dst = fp->ipq_dst; + remque(&fp->ip_link); (void) m_free(dtom(fp)); - m = dtom(ip); m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); - return ((struct ip *)ip); + return ip; dropfrag: ipstat.ips_fragdropped++; @@ -396,13 +408,12 @@ ip_freef(fp) { register struct ipasfrag *q, *p; - for (q = (struct ipasfrag *) fp->ipq_next; q != (struct ipasfrag *)fp; - q = p) { - p = (struct ipasfrag *) q->ipf_next; + for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link; q = p) { + p = q->ipf_next; ip_deq(q); m_freem(dtom(q)); } - remque_32(fp); + remque(&fp->ip_link); (void) m_free(dtom(fp)); } @@ -416,10 +427,10 @@ ip_enq(p, prev) { DEBUG_CALL("ip_enq"); DEBUG_ARG("prev = %lx", (long)prev); - p->ipf_prev = (ipasfragp_32) prev; + p->ipf_prev = prev; p->ipf_next = prev->ipf_next; - ((struct ipasfrag *)(prev->ipf_next))->ipf_prev = (ipasfragp_32) p; - prev->ipf_next = (ipasfragp_32) p; + ((struct ipasfrag *)(prev->ipf_next))->ipf_prev = p; + prev->ipf_next = p; } /* @@ -441,20 +452,21 @@ ip_deq(p) void ip_slowtimo() { - register struct ipq *fp; + struct qlink *l; DEBUG_CALL("ip_slowtimo"); - fp = (struct ipq *) ipq.next; - if (fp == 0) + l = ipq.ip_link.next; + + if (l == 0) return; - while (fp != &ipq) { - --fp->ipq_ttl; - fp = (struct ipq *) fp->next; - if (((struct ipq *)(fp->prev))->ipq_ttl == 0) { + while (l != &ipq.ip_link) { + struct ipq *fp = container_of(l, struct ipq, ip_link); + l = l->next; + if (--fp->ipq_ttl == 0) { ipstat.ips_fragtimeout++; - ip_freef((struct ipq *) fp->prev); + ip_freef(fp); } } } diff --git a/BasiliskII/src/slirp/ip_output.c b/BasiliskII/src/slirp/ip_output.c old mode 100644 new mode 100755 index fb9a9420..0d1ae1b2 --- a/BasiliskII/src/slirp/ip_output.c +++ b/BasiliskII/src/slirp/ip_output.c @@ -55,9 +55,8 @@ ip_output(so, m0) { register struct ip *ip; register struct mbuf *m = m0; - register u_int hlen = sizeof(struct ip); - u_int len, off; - int error = 0; + register int hlen = sizeof(struct ip ); + int len, off, error = 0; DEBUG_CALL("ip_output"); DEBUG_ARG("so = %lx", (long)so); @@ -129,7 +128,7 @@ ip_output(so, m0) */ m0 = m; mhlen = sizeof (struct ip); - for (off = hlen + len; off < ip->ip_len; off += len) { + for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) { register struct ip *mhip; m = m_get(); if (m == 0) { @@ -174,7 +173,7 @@ ip_output(so, m0) * and updating header, then send each fragment (in order). */ m = m0; - m_adj(m, hlen + firstlen - ip->ip_len); + m_adj(m, hlen + firstlen - (u_int16_t)ip->ip_len); ip->ip_len = htons((u_int16_t)m->m_len); ip->ip_off = htons((u_int16_t)(ip->ip_off | IP_MF)); ip->ip_sum = 0; diff --git a/BasiliskII/src/slirp/libslirp.h b/BasiliskII/src/slirp/libslirp.h old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/main.h b/BasiliskII/src/slirp/main.h old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/mbuf.c b/BasiliskII/src/slirp/mbuf.c old mode 100644 new mode 100755 index 5a16fab8..2b53bc3e --- a/BasiliskII/src/slirp/mbuf.c +++ b/BasiliskII/src/slirp/mbuf.c @@ -24,16 +24,18 @@ int mbuf_alloced = 0; struct mbuf m_freelist, m_usedlist; int mbuf_thresh = 30; int mbuf_max = 0; -size_t msize; +int msize; -void m_init() +void +m_init() { m_freelist.m_next = m_freelist.m_prev = &m_freelist; m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist; msize_init(); } -void msize_init() +void +msize_init() { /* * Find a nice value for msize @@ -51,7 +53,8 @@ void msize_init() * free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE, * which tells m_free to actually free() it */ -struct mbuf *m_get() +struct mbuf * +m_get() { register struct mbuf *m; int flags = 0; @@ -86,7 +89,9 @@ end_error: return m; } -void m_free(struct mbuf *m) +void +m_free(m) + struct mbuf *m; { DEBUG_CALL("m_free"); @@ -119,7 +124,9 @@ void m_free(struct mbuf *m) * the other.. if result is too big for one mbuf, malloc() * an M_EXT data segment */ -void m_cat(register struct mbuf *m, register struct mbuf *n) +void +m_cat(m, n) + register struct mbuf *m, *n; { /* * If there's no room, realloc @@ -135,7 +142,10 @@ void m_cat(register struct mbuf *m, register struct mbuf *n) /* make m size bytes large */ -void m_inc(struct mbuf *m, u_int size) +void +m_inc(m, size) + struct mbuf *m; + int size; { int datasize; @@ -169,7 +179,10 @@ void m_inc(struct mbuf *m, u_int size) -void m_adj(struct mbuf *m, int len) +void +m_adj(m, len) + struct mbuf *m; + int len; { if (m == NULL) return; @@ -189,7 +202,9 @@ void m_adj(struct mbuf *m, int len) * Copy len bytes from m, starting off bytes into n */ int -m_copy(struct mbuf *n, struct mbuf *m, u_int off, u_int len) +m_copy(n, m, off, len) + struct mbuf *n, *m; + int off, len; { if (len > M_FREEROOM(n)) return -1; @@ -205,7 +220,9 @@ m_copy(struct mbuf *n, struct mbuf *m, u_int off, u_int len) * XXX This is a kludge, I should eliminate the need for it * Fortunately, it's not used often */ -struct mbuf *dtom(void *dat) +struct mbuf * +dtom(dat) + void *dat; { struct mbuf *m; diff --git a/BasiliskII/src/slirp/mbuf.h b/BasiliskII/src/slirp/mbuf.h old mode 100644 new mode 100755 index 11b252bb..183254a0 --- a/BasiliskII/src/slirp/mbuf.h +++ b/BasiliskII/src/slirp/mbuf.h @@ -63,11 +63,11 @@ struct m_hdr { struct mbuf *mh_prevpkt; /* Flags aren't used in the output queue */ int mh_flags; /* Misc flags */ - size_t mh_size; /* Size of data */ + int mh_size; /* Size of data */ struct socket *mh_so; caddr_t mh_data; /* Location of data */ - size_t mh_len; /* Amount of data in this mbuf */ + int mh_len; /* Amount of data in this mbuf */ }; /* @@ -130,14 +130,14 @@ extern int mbuf_alloced; extern struct mbuf m_freelist, m_usedlist; extern int mbuf_max; -void m_init(void); -void msize_init(void); -struct mbuf * m_get(void); -void m_free(struct mbuf *); -void m_cat(register struct mbuf *, register struct mbuf *); -void m_inc(struct mbuf *, u_int); -void m_adj(struct mbuf *, int); -int m_copy(struct mbuf *, struct mbuf *, u_int, u_int); -struct mbuf * dtom(void *); +void m_init _P((void)); +void msize_init _P((void)); +struct mbuf * m_get _P((void)); +void m_free _P((struct mbuf *)); +void m_cat _P((register struct mbuf *, register struct mbuf *)); +void m_inc _P((struct mbuf *, int)); +void m_adj _P((struct mbuf *, int)); +int m_copy _P((struct mbuf *, struct mbuf *, int, int)); +struct mbuf * dtom _P((void *)); #endif diff --git a/BasiliskII/src/slirp/misc.c b/BasiliskII/src/slirp/misc.c old mode 100644 new mode 100755 index b80caf66..9438af38 --- a/BasiliskII/src/slirp/misc.c +++ b/BasiliskII/src/slirp/misc.c @@ -17,7 +17,10 @@ int x_port = -1; int x_display = 0; int x_screen = 0; -int show_x(char *buff, struct socket *inso) +int +show_x(buff, inso) + char *buff; + struct socket *inso; { if (x_port < 0) { lprint("X Redir: X not being redirected.\r\n"); @@ -37,7 +40,12 @@ int show_x(char *buff, struct socket *inso) /* * XXX Allow more than one X redirection? */ -void redir_x(u_int32_t inaddr, int start_port, int display, int screen) +void +redir_x(inaddr, start_port, display, screen) + u_int32_t inaddr; + int start_port; + int display; + int screen; { int i; @@ -61,69 +69,44 @@ void redir_x(u_int32_t inaddr, int start_port, int display, int screen) #endif #ifndef HAVE_INET_ATON -int inet_aton(const char *cp, struct in_addr *ia) +int +inet_aton(cp, ia) + const char *cp; + struct in_addr *ia; { - return inet_pton(AF_INET, cp, &ia->s_addr); + u_int32_t addr = inet_addr(cp); + if (addr == 0xffffffff) + return 0; + ia->s_addr = addr; + return 1; } #endif /* * Get our IP address and put it in our_addr */ -void getouraddr() +void +getouraddr() { char buff[256]; - - if (gethostname(buff, sizeof(buff)) == 0) - { - struct addrinfo hints = { 0 }; - hints.ai_flags = AI_NUMERICHOST; - hints.ai_family = AF_INET; - struct addrinfo* ai; - if (getaddrinfo(buff, NULL, &hints, &ai) == 0) - { - our_addr = *(struct in_addr *)ai->ai_addr->sa_data; - freeaddrinfo(ai); - } - } - if (our_addr.s_addr == 0) - our_addr.s_addr = loopback_addr.s_addr; + struct hostent *he = NULL; + + if (gethostname(buff,256) == 0) + he = gethostbyname(buff); + if (he) + our_addr = *(struct in_addr *)he->h_addr; + if (our_addr.s_addr == 0) + our_addr.s_addr = loopback_addr.s_addr; } -#if SIZEOF_CHAR_P == 8 - -struct quehead_32 { - u_int32_t qh_link; - u_int32_t qh_rlink; -}; - -inline void insque_32(void *a, void *b) -{ - register struct quehead_32 *element = (struct quehead_32 *) a; - register struct quehead_32 *head = (struct quehead_32 *) b; - element->qh_link = head->qh_link; - head->qh_link = (u_int32_t)element; - element->qh_rlink = (u_int32_t)head; - ((struct quehead_32 *)(element->qh_link))->qh_rlink - = (u_int32_t)element; -} - -inline void remque_32(void *a) -{ - register struct quehead_32 *element = (struct quehead_32 *) a; - ((struct quehead_32 *)(element->qh_link))->qh_rlink = element->qh_rlink; - ((struct quehead_32 *)(element->qh_rlink))->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -#endif /* SIZEOF_CHAR_P == 8 */ - struct quehead { struct quehead *qh_link; struct quehead *qh_rlink; }; -void insque(void *a, void *b) +void +insque(a, b) + void *a, *b; { register struct quehead *element = (struct quehead *) a; register struct quehead *head = (struct quehead *) b; @@ -134,7 +117,9 @@ void insque(void *a, void *b) = (struct quehead *)element; } -void remque(void *a) +void +remque(a) + void *a; { register struct quehead *element = (struct quehead *) a; ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; @@ -146,7 +131,13 @@ void remque(void *a) /* #endif */ -int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port) +int +add_exec(ex_ptr, do_pty, exec, addr, port) + struct ex_list **ex_ptr; + int do_pty; + char *exec; + int addr; + int port; { struct ex_list *tmp_ptr; @@ -175,7 +166,9 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port extern int sys_nerr; extern char *sys_errlist[]; -char *strerror(int error) +char * +strerror(error) + int error; { if (error < sys_nerr) return sys_errlist[error]; @@ -188,7 +181,11 @@ char *strerror(int error) #ifdef _WIN32 -int fork_exec(struct socket *so, char *ex, int do_pty) +int +fork_exec(so, ex, do_pty) + struct socket *so; + char *ex; + int do_pty; { /* not implemented */ return 0; @@ -196,7 +193,9 @@ int fork_exec(struct socket *so, char *ex, int do_pty) #else -int slirp_openpty(int *amaster, int *aslave) +int +slirp_openpty(amaster, aslave) + int *amaster, *aslave; { register int master, slave; @@ -270,7 +269,11 @@ int slirp_openpty(int *amaster, int *aslave) * do_pty = 1 Fork/exec using slirp.telnetd * do_ptr = 2 Fork/exec using pty */ -int fork_exec(struct socket *so, char *ex, int do_pty) +int +fork_exec(so, ex, do_pty) + struct socket *so; + char *ex; + int do_pty; { int s; struct sockaddr_in addr; @@ -426,7 +429,9 @@ int fork_exec(struct socket *so, char *ex, int do_pty) #endif #ifndef HAVE_STRDUP -char *strdup(const char *str) +char * +strdup(str) + const char *str; { char *bptr; @@ -438,7 +443,9 @@ char *strdup(const char *str) #endif #if 0 -void snooze_hup(int num) +void +snooze_hup(num) + int num; { int s, ret; #ifndef NO_UNIX_SOCKETS @@ -478,7 +485,8 @@ void snooze_hup(int num) } -void snooze() +void +snooze() { sigset_t s; int i; @@ -502,7 +510,9 @@ void snooze() exit(255); } -void relay(int s) +void +relay(s) + int s; { char buf[8192]; int n; @@ -562,14 +572,25 @@ void relay(int s) } #endif -int (*lprint_print)(void *, const char *, va_list); +int (*lprint_print) _P((void *, const char *, va_list)); char *lprint_ptr, *lprint_ptr2, **lprint_arg; -void lprint(const char *format, ...) +void +#ifdef __STDC__ +lprint(const char *format, ...) +#else +lprint(va_alist) va_dcl +#endif { va_list args; - va_start(args, format); +#ifdef __STDC__ + va_start(args, format); +#else + char *format; + va_start(args); + format = va_arg(args, char *); +#endif #if 0 /* If we're printing to an sbuf, make sure there's enough room */ /* XXX +100? */ @@ -618,7 +639,9 @@ void lprint(const char *format, ...) va_end(args); } -void add_emu(char *buff) +void +add_emu(buff) + char *buff; { u_int lport, fport; u_int8_t tos = 0, emu = 0; @@ -710,24 +733,42 @@ void add_emu(char *buff) * Some BSD-derived systems have a sprintf which returns char * */ -int vsprintf_len(char *string, const char *format, va_list args) +int +vsprintf_len(string, format, args) + char *string; + const char *format; + va_list args; { vsprintf(string, format, args); return strlen(string); } -int sprintf_len(char *string, const char *format, ...) +int +#ifdef __STDC__ +sprintf_len(char *string, const char *format, ...) +#else +sprintf_len(va_alist) va_dcl +#endif { va_list args; +#ifdef __STDC__ va_start(args, format); +#else + char *string; + char *format; + va_start(args); + string = va_arg(args, char *); + format = va_arg(args, char *); +#endif vsprintf(string, format, args); - va_end(args); return strlen(string); } #endif -void u_sleep(int usec) +void +u_sleep(usec) + int usec; { struct timeval t; fd_set fdset; @@ -744,7 +785,9 @@ void u_sleep(int usec) * Set fd blocking and non-blocking */ -void fd_nonblock(int fd) +void +fd_nonblock(fd) + int fd; { #if defined USE_FIONBIO && defined FIONBIO ioctlsockopt_t opt = 1; @@ -759,7 +802,9 @@ void fd_nonblock(int fd) #endif } -void fd_block(int fd) +void +fd_block(fd) + int fd; { #if defined USE_FIONBIO && defined FIONBIO ioctlsockopt_t opt = 0; @@ -779,8 +824,13 @@ void fd_block(int fd) /* * invoke RSH */ -int rsh_exec(struct socket *so, struct socket *ns, - char *user, char *host, char *args) +int +rsh_exec(so,ns, user, host, args) + struct socket *so; + struct socket *ns; + char *user; + char *host; + char *args; { int fd[2]; int fd0[2]; diff --git a/BasiliskII/src/slirp/misc.h b/BasiliskII/src/slirp/misc.h old mode 100644 new mode 100755 index 381f5f3e..efea9ff8 --- a/BasiliskII/src/slirp/misc.h +++ b/BasiliskII/src/slirp/misc.h @@ -19,15 +19,15 @@ struct ex_list { extern struct ex_list *exec_list; extern u_int curtime, time_fasttimo, last_slowtimo, detach_time, detach_wait; -extern int (*lprint_print)(void *, const char *, va_list); +extern int (*lprint_print) _P((void *, const char *, va_list)); extern char *lprint_ptr, *lprint_ptr2, **lprint_arg; extern struct sbuf *lprint_sb; #ifndef HAVE_STRDUP -char *strdup(const char *); +char *strdup _P((const char *)); #endif -void do_wait(int); +void do_wait _P((int)); #define EMU_NONE 0x0 @@ -67,21 +67,21 @@ extern struct emu_t *tcpemu; extern int x_port, x_server, x_display; -int show_x(char *, struct socket *); -void redir_x(u_int32_t, int, int, int); -void getouraddr(void); -void slirp_insque(void *, void *); -void slirp_remque(void *); -int add_exec(struct ex_list **, int, char *, int, int); -int slirp_openpty(int *, int *); -int fork_exec(struct socket *, char *, int); -void snooze_hup(int); -void snooze(void); -void relay(int); -void add_emu(char *); -void u_sleep(int); -void fd_nonblock(int); -void fd_block(int); -int rsh_exec(struct socket *, struct socket *, char *, char *, char *); +int show_x _P((char *, struct socket *)); +void redir_x _P((u_int32_t, int, int, int)); +void getouraddr _P((void)); +void slirp_insque _P((void *, void *)); +void slirp_remque _P((void *)); +int add_exec _P((struct ex_list **, int, char *, int, int)); +int slirp_openpty _P((int *, int *)); +int fork_exec _P((struct socket *, char *, int)); +void snooze_hup _P((int)); +void snooze _P((void)); +void relay _P((int)); +void add_emu _P((char *)); +void u_sleep _P((int)); +void fd_nonblock _P((int)); +void fd_block _P((int)); +int rsh_exec _P((struct socket *, struct socket *, char *, char *, char *)); #endif diff --git a/BasiliskII/src/slirp/sbuf.c b/BasiliskII/src/slirp/sbuf.c old mode 100644 new mode 100755 index 278e3687..0d880092 --- a/BasiliskII/src/slirp/sbuf.c +++ b/BasiliskII/src/slirp/sbuf.c @@ -5,7 +5,7 @@ * terms and conditions of the copyright. */ -#include +// #include #include /* Done as a macro in socket.h */ @@ -16,12 +16,17 @@ * } */ -void sbfree(struct sbuf *sb) +void +sbfree(sb) + struct sbuf *sb; { free(sb->sb_data); } -void sbdrop(struct sbuf *sb, u_int num) +void +sbdrop(sb, num) + struct sbuf *sb; + int num; { /* * We can only drop how much we have @@ -36,7 +41,10 @@ void sbdrop(struct sbuf *sb, u_int num) } -void sbreserve(struct sbuf *sb, size_t size) +void +sbreserve(sb, size) + struct sbuf *sb; + int size; { if (sb->sb_data) { /* Already alloced, realloc if necessary */ @@ -64,14 +72,17 @@ void sbreserve(struct sbuf *sb, size_t size) * this prevents an unnecessary copy of the data * (the socket is non-blocking, so we won't hang) */ -void sbappend(struct socket *so, struct mbuf *m) +void +sbappend(so, m) + struct socket *so; + struct mbuf *m; { int ret = 0; DEBUG_CALL("sbappend"); DEBUG_ARG("so = %lx", (long)so); DEBUG_ARG("m = %lx", (long)m); - DEBUG_ARG("m->m_len = %zu", m->m_len); + DEBUG_ARG("m->m_len = %d", m->m_len); /* Shouldn't happen, but... e.g. foreign host closes connection */ if (m->m_len <= 0) { @@ -123,7 +134,10 @@ void sbappend(struct socket *so, struct mbuf *m) * Copy the data from m into sb * The caller is responsible to make sure there's enough room */ -void sbappendsb(struct sbuf *sb, struct mbuf *m) +void +sbappendsb(sb, m) + struct sbuf *sb; + struct mbuf *m; { int len, n, nn; @@ -159,7 +173,12 @@ void sbappendsb(struct sbuf *sb, struct mbuf *m) * Don't update the sbuf rptr, this will be * done in sbdrop when the data is acked */ -void sbcopy(struct sbuf *sb, u_int off, u_int len, char *to) +void +sbcopy(sb, off, len, to) + struct sbuf *sb; + int off; + int len; + char *to; { char *from; diff --git a/BasiliskII/src/slirp/sbuf.h b/BasiliskII/src/slirp/sbuf.h old mode 100644 new mode 100755 index 04f7981c..161e0bb7 --- a/BasiliskII/src/slirp/sbuf.h +++ b/BasiliskII/src/slirp/sbuf.h @@ -8,8 +8,6 @@ #ifndef _SBUF_H_ #define _SBUF_H_ -#include - #define sbflush(sb) sbdrop((sb),(sb)->sb_cc) #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) @@ -23,11 +21,11 @@ struct sbuf { char *sb_data; /* Actual data */ }; -void sbfree(struct sbuf *); -void sbdrop(struct sbuf *, u_int); -void sbreserve(struct sbuf *, size_t); -void sbappend(struct socket *, struct mbuf *); -void sbappendsb(struct sbuf *, struct mbuf *); -void sbcopy(struct sbuf *, u_int, u_int, char *); +void sbfree _P((struct sbuf *)); +void sbdrop _P((struct sbuf *, int)); +void sbreserve _P((struct sbuf *, int)); +void sbappend _P((struct socket *, struct mbuf *)); +void sbappendsb _P((struct sbuf *, struct mbuf *)); +void sbcopy _P((struct sbuf *, int, int, char *)); #endif diff --git a/BasiliskII/src/slirp/slirp.c b/BasiliskII/src/slirp/slirp.c old mode 100644 new mode 100755 index dc2fdc65..44f777d0 --- a/BasiliskII/src/slirp/slirp.c +++ b/BasiliskII/src/slirp/slirp.c @@ -84,7 +84,7 @@ static int get_dns_addr(struct in_addr *pdns_addr) static int get_dns_addr(struct in_addr *pdns_addr) { char buff[512]; - char buff2[256+1]; + char buff2[256]; FILE *f; int found = 0; struct in_addr tmp_addr; @@ -211,8 +211,8 @@ int slirp_select_fill(int *pnfds, * in the fragment queue, or there are TCP connections active */ do_slowtimo = ((tcb.so_next != &tcb) || - ((struct ipasfrag *)&ipq != (struct ipasfrag *)ipq.next)); - + (&ipq.ip_link != ipq.ip_link.next)); + for (so = tcb.so_next; so != &tcb; so = so_next) { so_next = so->so_next; @@ -220,14 +220,14 @@ int slirp_select_fill(int *pnfds, * See if we need a tcp_fasttimo */ if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK) - time_fasttimo = curtime; /* Flag when we want a fasttimo */ + time_fasttimo = curtime; /* Flag when we want a fasttimo */ /* * NOFDREF can include still connecting to local-host, * newly socreated() sockets etc. Don't want to select these. */ if (so->so_state & SS_NOFDREF || so->s == -1) - continue; + continue; /* * Set for reading sockets which are accepting @@ -346,18 +346,18 @@ int slirp_select_fill(int *pnfds, void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds) { - struct socket *so, *so_next; - int ret; + struct socket *so, *so_next; + int ret; - global_readfds = readfds; - global_writefds = writefds; - global_xfds = xfds; + global_readfds = readfds; + global_writefds = writefds; + global_xfds = xfds; /* Update time */ updtime(); - + /* - * See if anything has timed out + * See if anything has timed out */ if (link_up) { if (time_fasttimo && ((curtime - time_fasttimo) >= FAST_TIMO)) { @@ -370,7 +370,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds) last_slowtimo = curtime; } } - + /* * Check sockets */ @@ -380,21 +380,21 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds) */ for (so = tcb.so_next; so != &tcb; so = so_next) { so_next = so->so_next; - + /* * FD_ISSET is meaningless on these sockets * (and they can crash the program) */ if (so->so_state & SS_NOFDREF || so->s == -1) - continue; - + continue; + /* * Check for URG data * This will soread as well, so no need to * test for readfds below if this succeeds */ if (FD_ISSET(so->s, xfds)) - sorecvoob(so); + sorecvoob(so); /* * Check sockets for reading */ @@ -407,92 +407,86 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds) continue; } /* else */ ret = soread(so); - + /* Output it if we read something */ if (ret > 0) - tcp_output(sototcpcb(so)); + tcp_output(sototcpcb(so)); } - + /* * Check sockets for writing */ if (FD_ISSET(so->s, writefds)) { - /* - * Check for non-blocking, still-connecting sockets - */ - if (so->so_state & SS_ISFCONNECTING) { - /* Connected */ - so->so_state &= ~SS_ISFCONNECTING; - - ret = send(so->s, (char*)&ret, 0, 0); - if (ret < 0) { - /* XXXXX Must fix, zero bytes is a NOP */ - int error = WSAGetLastError(); - if (error == EAGAIN || error == WSAEWOULDBLOCK || - error == WSAEINPROGRESS || error == WSAENOTCONN) - continue; - - /* else failed */ - so->so_state = SS_NOFDREF; - } - /* else so->so_state &= ~SS_ISFCONNECTING; */ - - /* - * Continue tcp_input - */ - tcp_input((struct mbuf *)NULL, sizeof(struct ip), so); - /* continue; */ - } - else - ret = sowrite(so); - /* - * XXXXX If we wrote something (a lot), there - * could be a need for a window update. - * In the worst case, the remote will send - * a window probe to get things going again - */ + /* + * Check for non-blocking, still-connecting sockets + */ + if (so->so_state & SS_ISFCONNECTING) { + /* Connected */ + so->so_state &= ~SS_ISFCONNECTING; + + ret = send(so->s, &ret, 0, 0); + if (ret < 0) { + /* XXXXX Must fix, zero bytes is a NOP */ + if (errno == EAGAIN || errno == EWOULDBLOCK || + errno == EINPROGRESS || errno == ENOTCONN) + continue; + + /* else failed */ + so->so_state = SS_NOFDREF; + } + /* else so->so_state &= ~SS_ISFCONNECTING; */ + + /* + * Continue tcp_input + */ + tcp_input((struct mbuf *)NULL, sizeof(struct ip), so); + /* continue; */ + } else + ret = sowrite(so); + /* + * XXXXX If we wrote something (a lot), there + * could be a need for a window update. + * In the worst case, the remote will send + * a window probe to get things going again + */ } - + /* * Probe a still-connecting, non-blocking socket * to check if it's still alive - */ + */ #ifdef PROBE_CONN if (so->so_state & SS_ISFCONNECTING) { - ret = recv(so->s, (char *)&ret, 0, 0); - - if (ret < 0) { - /* XXX */ - int error = WSAGetLastError(); - if (error == EAGAIN || error == WSAEWOULDBLOCK || - error == WSAEINPROGRESS || error == WSAENOTCONN) - continue; /* Still connecting, continue */ - - /* else failed */ - so->so_state = SS_NOFDREF; - - /* tcp_input will take care of it */ - } - else { - ret = send(so->s, &ret, 0, 0); - if (ret < 0) { - /* XXX */ - int error = WSAGetLastError(); - if (error == EAGAIN || error == WSAEWOULDBLOCK || - error == WSAEINPROGRESS || error == WSAENOTCONN) - continue; - /* else failed */ - so->so_state = SS_NOFDREF; - } - else - so->so_state &= ~SS_ISFCONNECTING; - - } - tcp_input((struct mbuf *)NULL, sizeof(struct ip), so); - } /* SS_ISFCONNECTING */ + ret = recv(so->s, (char *)&ret, 0,0); + + if (ret < 0) { + /* XXX */ + if (errno == EAGAIN || errno == EWOULDBLOCK || + errno == EINPROGRESS || errno == ENOTCONN) + continue; /* Still connecting, continue */ + + /* else failed */ + so->so_state = SS_NOFDREF; + + /* tcp_input will take care of it */ + } else { + ret = send(so->s, &ret, 0,0); + if (ret < 0) { + /* XXX */ + if (errno == EAGAIN || errno == EWOULDBLOCK || + errno == EINPROGRESS || errno == ENOTCONN) + continue; + /* else failed */ + so->so_state = SS_NOFDREF; + } else + so->so_state &= ~SS_ISFCONNECTING; + + } + tcp_input((struct mbuf *)NULL, sizeof(struct ip),so); + } /* SS_ISFCONNECTING */ #endif - } - + } + /* * Now UDP sockets. * Incoming packets are sent straight away, they're not buffered. @@ -500,27 +494,27 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds) */ for (so = udb.so_next; so != &udb; so = so_next) { so_next = so->so_next; - + if (so->s != -1 && FD_ISSET(so->s, readfds)) { - sorecvfrom(so); - } + sorecvfrom(so); + } } -} - + } + /* * See if we can start outputting */ if (if_queued && link_up) - if_start(); + if_start(); /* clear global file descriptor sets. * these reside on the stack in vl.c * so they're unusable if we're not in * slirp_select_fill or slirp_select_poll. */ - global_readfds = NULL; - global_writefds = NULL; - global_xfds = NULL; + global_readfds = NULL; + global_writefds = NULL; + global_xfds = NULL; } #define ETH_ALEN 6 diff --git a/BasiliskII/src/slirp/slirp.h b/BasiliskII/src/slirp/slirp.h old mode 100644 new mode 100755 index b845caa7..16266f6c --- a/BasiliskII/src/slirp/slirp.h +++ b/BasiliskII/src/slirp/slirp.h @@ -22,12 +22,18 @@ typedef char *caddr_t; typedef int socklen_t; typedef unsigned long ioctlsockopt_t; +# include # include -# include # include # include # define USE_FIONBIO 1 +# define EWOULDBLOCK WSAEWOULDBLOCK +# define EINPROGRESS WSAEINPROGRESS +# define ENOTCONN WSAENOTCONN +# define EHOSTUNREACH WSAEHOSTUNREACH +# define ENETUNREACH WSAENETUNREACH +# define ECONNREFUSED WSAECONNREFUSED /* Basilisk II Router defines those */ # define udp_read_completion slirp_udp_read_completion @@ -133,29 +139,35 @@ typedef u_int32_t uint32; #include #endif +#ifndef _P +#ifndef NO_PROTOTYPES +# define _P(x) x +#else +# define _P(x) () +#endif +#endif + + #ifdef GETTIMEOFDAY_ONE_ARG #define gettimeofday(x, y) gettimeofday(x) #endif /* Systems lacking strdup() definition in . */ #if defined(ultrix) -char *strdup(const char *); +char *strdup _P((const char *)); #endif /* Systems lacking malloc() definition in . */ #if defined(ultrix) || defined(hcx) -void *malloc(size_t arg); -void free(void *ptr); +void *malloc _P((size_t arg)); +void free _P((void *ptr)); #endif #ifndef HAVE_INET_ATON -int inet_aton(const char *cp, struct in_addr *ia); +int inet_aton _P((const char *cp, struct in_addr *ia)); #endif #include -#ifdef _WIN32 -#include -#endif #ifndef NO_UNIX_SOCKETS #include #endif @@ -187,7 +199,11 @@ int inet_aton(const char *cp, struct in_addr *ia); #include #endif +#ifdef __STDC__ #include +#else +#include +#endif #include @@ -204,13 +220,8 @@ int inet_aton(const char *cp, struct in_addr *ia); #if defined __GNUC__ #define PACKED__ __attribute__ ((packed)) -#elif defined _MSC_VER -#define PRAGMA_PACK_SUPPORTED 1 -#define PACK_RESET -#define PACKED__ #elif defined __sgi #define PRAGMA_PACK_SUPPORTED 1 -#define PACK_RESET 0 #define PACKED__ #else #error "Packed attribute or pragma shall be supported" @@ -246,49 +257,41 @@ extern struct ttys *ttys_unit[MAX_INTERFACES]; #endif #ifndef FULL_BOLT -void if_start(void); +void if_start _P((void)); #else -void if_start(struct ttys *); +void if_start _P((struct ttys *)); #endif #ifdef BAD_SPRINTF # define vsprintf vsprintf_len # define sprintf sprintf_len - extern int vsprintf_len(char *, const char *, va_list); - extern int sprintf_len(char *, const char *, ...); + extern int vsprintf_len _P((char *, const char *, va_list)); + extern int sprintf_len _P((char *, const char *, ...)); #endif #ifdef DECLARE_SPRINTF # ifndef BAD_SPRINTF - extern int vsprintf(char *, const char *, va_list); + extern int vsprintf _P((char *, const char *, va_list)); # endif - extern int vfprintf(FILE *, const char *, va_list); + extern int vfprintf _P((FILE *, const char *, va_list)); #endif #ifndef HAVE_STRERROR - extern char *strerror(int error); + extern char *strerror _P((int error)); #endif #ifndef HAVE_INDEX - char *index(const char *, int); + char *index _P((const char *, int)); #endif #ifndef HAVE_GETHOSTID - long gethostid(void); + long gethostid _P((void)); #endif -void lprint(const char *, ...); +void lprint _P((const char *, ...)); extern int do_echo; -#if SIZEOF_CHAR_P == 4 -# define insque_32 insque -# define remque_32 remque -#else - extern inline void insque_32(void *, void *); - extern inline void remque_32(void *); -#endif - #ifndef _WIN32 #include #endif @@ -299,47 +302,48 @@ extern int do_echo; int cksum(struct mbuf *m, int len); /* if.c */ -void if_init(void); -void if_output(struct socket *, struct mbuf *); +void if_init _P((void)); +void if_output _P((struct socket *, struct mbuf *)); /* ip_input.c */ -void ip_init(void); -void ip_input(struct mbuf *); -struct ip * ip_reass(register struct ipasfrag *, register struct ipq *); -void ip_freef(struct ipq *); -void ip_enq(register struct ipasfrag *, register struct ipasfrag *); -void ip_deq(register struct ipasfrag *); -void ip_slowtimo(void); -void ip_stripoptions(register struct mbuf *, struct mbuf *); +void ip_init _P((void)); +void ip_input _P((struct mbuf *)); +static struct ip * +ip_reass(register struct ip *ip, register struct ipq *); +void ip_freef _P((struct ipq *)); +void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *)); +void ip_deq _P((register struct ipasfrag *)); +void ip_slowtimo _P((void)); +void ip_stripoptions _P((register struct mbuf *, struct mbuf *)); /* ip_output.c */ -int ip_output(struct socket *, struct mbuf *); +int ip_output _P((struct socket *, struct mbuf *)); /* tcp_input.c */ -int tcp_reass(register struct tcpcb *, register struct tcpiphdr *, struct mbuf *); -void tcp_input(register struct mbuf *, int, struct socket *); -void tcp_dooptions(struct tcpcb *, u_char *, int, struct tcpiphdr *); -void tcp_xmit_timer(register struct tcpcb *, int); -u_int tcp_mss(register struct tcpcb *, u_int); +int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *)); +void tcp_input _P((register struct mbuf *, int, struct socket *)); +void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *)); +void tcp_xmit_timer _P((register struct tcpcb *, int)); +int tcp_mss _P((register struct tcpcb *, u_int)); /* tcp_output.c */ -int tcp_output(register struct tcpcb *); -void tcp_setpersist(register struct tcpcb *); +int tcp_output _P((register struct tcpcb *)); +void tcp_setpersist _P((register struct tcpcb *)); /* tcp_subr.c */ -void tcp_init(void); -void tcp_template(struct tcpcb *); -void tcp_respond(struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int); -struct tcpcb * tcp_newtcpcb(struct socket *); -struct tcpcb * tcp_close(register struct tcpcb *); -void tcp_drain(void); -void tcp_sockclosed(struct tcpcb *); -int tcp_fconnect(struct socket *); -void tcp_connect(struct socket *); -int tcp_attach(struct socket *); -u_int8_t tcp_tos(struct socket *); -int tcp_emu(struct socket *, struct mbuf *); -int tcp_ctl(struct socket *); +void tcp_init _P((void)); +void tcp_template _P((struct tcpcb *)); +void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int)); +struct tcpcb * tcp_newtcpcb _P((struct socket *)); +struct tcpcb * tcp_close _P((register struct tcpcb *)); +void tcp_drain _P((void)); +void tcp_sockclosed _P((struct tcpcb *)); +int tcp_fconnect _P((struct socket *)); +void tcp_connect _P((struct socket *)); +int tcp_attach _P((struct socket *)); +u_int8_t tcp_tos _P((struct socket *)); +int tcp_emu _P((struct socket *, struct mbuf *)); +int tcp_ctl _P((struct socket *)); struct tcpcb *tcp_drop(struct tcpcb *tp, int err); #ifdef USE_PPP @@ -355,4 +359,9 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err); #define max(x,y) ((x) > (y) ? (x) : (y)) #endif +#ifdef _WIN32 +#undef errno +#define errno (WSAGetLastError()) +#endif + #endif diff --git a/BasiliskII/src/slirp/slirp_config.h b/BasiliskII/src/slirp/slirp_config.h old mode 100644 new mode 100755 index 237268fa..e583dcc8 --- a/BasiliskII/src/slirp/slirp_config.h +++ b/BasiliskII/src/slirp/slirp_config.h @@ -40,6 +40,11 @@ */ #undef USE_LOWCPU +/* Define this if your compiler doesn't like prototypes */ +#ifndef __STDC__ +#define NO_PROTOTYPES +#endif + /*********************************************************/ /* * Autoconf defined configuration options @@ -72,6 +77,9 @@ /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H +/* Define if your compiler doesn't like prototypes */ +#undef NO_PROTOTYPES + /* Define if you don't have u_int32_t etc. typedef'd */ #undef NEED_TYPEDEFS #ifdef __sun__ diff --git a/BasiliskII/src/slirp/socket.c b/BasiliskII/src/slirp/socket.c old mode 100644 new mode 100755 index 42ba31b2..f3d10e53 --- a/BasiliskII/src/slirp/socket.c +++ b/BasiliskII/src/slirp/socket.c @@ -14,12 +14,6 @@ #include #endif -#ifdef _WIN32 -#define IS_EAGAIN(e) ((e) == WSAEINTR || (e) == EAGAIN) -#else -#define IS_EAGAIN(e) ((e) == EAGAIN) -#endif - void so_init() { @@ -103,12 +97,11 @@ int soread(so) struct socket *so; { - int n, nn; - u_int lss, total; + int n, nn, lss, total; struct sbuf *sb = &so->so_snd; - u_int len = sb->sb_datalen - sb->sb_cc; + int len = sb->sb_datalen - sb->sb_cc; struct iovec iov[2]; - u_int mss = so->so_tcpcb->t_maxseg; + int mss = so->so_tcpcb->t_maxseg; DEBUG_CALL("soread"); DEBUG_ARG("so = %lx", (long )so); @@ -166,8 +159,7 @@ soread(so) nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0); #endif if (nn <= 0) { - int error = WSAGetLastError(); - if (nn < 0 && IS_EAGAIN(error)) + if (nn < 0 && (errno == EINTR || errno == EAGAIN)) return 0; else { DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno))); @@ -305,7 +297,7 @@ sowrite(so) { int n,nn; struct sbuf *sb = &so->so_rcv; - u_int len = sb->sb_cc; + int len = sb->sb_cc; struct iovec iov[2]; DEBUG_CALL("sowrite"); @@ -352,12 +344,9 @@ sowrite(so) nn = send(so->s, iov[0].iov_base, iov[0].iov_len,0); #endif /* This should never happen, but people tell me it does *shrug* */ - if (nn < 0) { - int error = WSAGetLastError(); - if (IS_EAGAIN(error)) - return 0; - } - + if (nn < 0 && (errno == EAGAIN || errno == EINTR)) + return 0; + if (nn <= 0) { DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state = %x, errno = %d\n", so->so_state, errno)); @@ -416,9 +405,8 @@ sorecvfrom(so) if(len == -1 || len == 0) { u_char code=ICMP_UNREACH_PORT; - int error = WSAGetLastError(); - if(error == WSAEHOSTUNREACH) code=ICMP_UNREACH_HOST; - else if(error == WSAENETUNREACH) code=ICMP_UNREACH_NET; + if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST; + else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET; DEBUG_MISC((dfd," udp icmp rx errno = %d-%s\n", errno,strerror(errno))); @@ -431,7 +419,7 @@ sorecvfrom(so) udp_detach(so); } else { /* A "normal" UDP packet */ struct mbuf *m; - u_int len; + int len; ioctlsockopt_t n; if (!(m = m_get())) return; @@ -454,14 +442,13 @@ sorecvfrom(so) m->m_len = recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC((dfd, " did recvfrom %zu, errno = %d-%s\n", + DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n", m->m_len, errno,strerror(errno))); if(m->m_len<0) { u_char code=ICMP_UNREACH_PORT; - int error = WSAGetLastError(); - if(error == WSAEHOSTUNREACH) code=ICMP_UNREACH_HOST; - else if(error == WSAENETUNREACH) code=ICMP_UNREACH_NET; + if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST; + else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET; DEBUG_MISC((dfd," rx error, tx icmp ICMP_UNREACH:%i\n", code)); icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno)); @@ -526,9 +513,7 @@ sosendto(so, m) addr.sin_addr = so->so_faddr; addr.sin_port = so->so_fport; - char addrstr[INET_ADDRSTRLEN]; - DEBUG_MISC((dfd, " sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", - ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr, addrstr, sizeof(addrstr)))); + DEBUG_MISC((dfd, " sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr))); /* Don't care what port we get */ ret = sendto(so->s, m->m_data, m->m_len, 0, @@ -599,12 +584,16 @@ solisten(port, laddr, lport, flags) (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) || (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) || (listen(s,1) < 0)) { - int error = WSAGetLastError(); /* Don't clobber the real reason we failed */ + int tmperrno = errno; /* Don't clobber the real reason we failed */ close(s); sofree(so); /* Restore the real errno */ - WSASetLastError(error); +#ifdef _WIN32 + WSASetLastError(tmperrno); +#else + errno = tmperrno; +#endif return NULL; } setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); diff --git a/BasiliskII/src/slirp/socket.h b/BasiliskII/src/slirp/socket.h old mode 100644 new mode 100755 index 3b0fee16..d05354c8 --- a/BasiliskII/src/slirp/socket.h +++ b/BasiliskII/src/slirp/socket.h @@ -81,24 +81,24 @@ struct iovec { }; #endif -void so_init(void); -struct socket * solookup(struct socket *, struct in_addr, u_int, struct in_addr, u_int); -struct socket * socreate(void); -void sofree(struct socket *); -int soread(struct socket *); -void sorecvoob(struct socket *); -int sosendoob(struct socket *); -int sowrite(struct socket *); -void sorecvfrom(struct socket *); -int sosendto(struct socket *, struct mbuf *); -struct socket * solisten(u_int, u_int32_t, u_int, int); -void sorwakeup(struct socket *); -void sowwakeup(struct socket *); -void soisfconnecting(register struct socket *); -void soisfconnected(register struct socket *); -void sofcantrcvmore(struct socket *); -void sofcantsendmore(struct socket *); -void soisfdisconnected(struct socket *); -void sofwdrain(struct socket *); +void so_init _P((void)); +struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int)); +struct socket * socreate _P((void)); +void sofree _P((struct socket *)); +int soread _P((struct socket *)); +void sorecvoob _P((struct socket *)); +int sosendoob _P((struct socket *)); +int sowrite _P((struct socket *)); +void sorecvfrom _P((struct socket *)); +int sosendto _P((struct socket *, struct mbuf *)); +struct socket * solisten _P((u_int, u_int32_t, u_int, int)); +void sorwakeup _P((struct socket *)); +void sowwakeup _P((struct socket *)); +void soisfconnecting _P((register struct socket *)); +void soisfconnected _P((register struct socket *)); +void sofcantrcvmore _P((struct socket *)); +void sofcantsendmore _P((struct socket *)); +void soisfdisconnected _P((struct socket *)); +void sofwdrain _P((struct socket *)); #endif /* _SOCKET_H_ */ diff --git a/BasiliskII/src/slirp/tcp.h b/BasiliskII/src/slirp/tcp.h old mode 100644 new mode 100755 index 24e7914a..5f03f9e1 --- a/BasiliskII/src/slirp/tcp.h +++ b/BasiliskII/src/slirp/tcp.h @@ -38,8 +38,8 @@ typedef u_int32_t tcp_seq; #define PR_SLOWHZ 2 /* 2 slow timeouts per second (approx) */ #define PR_FASTHZ 5 /* 5 fast timeouts per second (not important) */ -extern size_t tcp_rcvspace; -extern size_t tcp_sndspace; +extern int tcp_rcvspace; +extern int tcp_sndspace; extern struct socket *tcp_last_so; #define TCP_SNDSPACE 8192 @@ -78,7 +78,7 @@ struct tcphdr { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif #include "tcp_var.h" diff --git a/BasiliskII/src/slirp/tcp_input.c b/BasiliskII/src/slirp/tcp_input.c old mode 100644 new mode 100755 index 032e5378..fc7c0bc0 --- a/BasiliskII/src/slirp/tcp_input.c +++ b/BasiliskII/src/slirp/tcp_input.c @@ -68,7 +68,7 @@ tcp_seq tcp_iss; /* tcp initial send seq # */ #ifdef TCP_ACK_HACK #define TCP_REASS(tp, ti, m, so, flags) {\ if ((ti)->ti_seq == (tp)->rcv_nxt && \ - (tp)->seg_next == (tcpiphdrp_32)(tp) && \ + tcpfrag_list_empty(tp) && \ (tp)->t_state == TCPS_ESTABLISHED) {\ if (ti->ti_flags & TH_PUSH) \ tp->t_flags |= TF_ACKNOW; \ @@ -91,7 +91,7 @@ tcp_seq tcp_iss; /* tcp initial send seq # */ #else #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq == (tp)->rcv_nxt && \ - (tp)->seg_next == (tcpiphdrp_32)(tp) && \ + tcpfrag_list_empty(tp) && \ (tp)->t_state == TCPS_ESTABLISHED) { \ tp->t_flags |= TF_DELACK; \ (tp)->rcv_nxt += (ti)->ti_len; \ @@ -111,7 +111,10 @@ tcp_seq tcp_iss; /* tcp initial send seq # */ #endif int -tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, struct mbuf *m) +tcp_reass(tp, ti, m) + register struct tcpcb *tp; + register struct tcpiphdr *ti; + struct mbuf *m; { register struct tcpiphdr *q; struct socket *so = tp->t_socket; @@ -127,8 +130,8 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, struct mbuf * /* * Find a segment which begins after this one does. */ - for (q = (struct tcpiphdr *)tp->seg_next; q != (struct tcpiphdr *)tp; - q = (struct tcpiphdr *)q->ti_next) + for (q = tcpfrag_list_first(tp); !tcpfrag_list_end(q, tp); + q = tcpiphdr_next(q)) if (SEQ_GT(q->ti_seq, ti->ti_seq)) break; @@ -137,9 +140,9 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, struct mbuf * * our data already. If so, drop the data from the incoming * segment. If it provides all of our data, drop us. */ - if ((struct tcpiphdr *)q->ti_prev != (struct tcpiphdr *)tp) { + if (!tcpfrag_list_end(tcpiphdr_prev(q), tp)) { register int i; - q = (struct tcpiphdr *)q->ti_prev; + q = tcpiphdr_prev(q); /* conversion to int (in i) handles seq wraparound */ i = q->ti_seq + q->ti_len - ti->ti_seq; if (i > 0) { @@ -159,37 +162,36 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, struct mbuf * ti->ti_len -= i; ti->ti_seq += i; } - q = (struct tcpiphdr *)(q->ti_next); + q = tcpiphdr_next(q); } tcpstat.tcps_rcvoopack++; tcpstat.tcps_rcvoobyte += ti->ti_len; - REASS_MBUF(ti) = (mbufp_32) m; /* XXX */ + ti->ti_mbuf = m; /* * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - while (q != (struct tcpiphdr *)tp) { + while (!tcpfrag_list_end(q, tp)) { register int i = (ti->ti_seq + ti->ti_len) - q->ti_seq; if (i <= 0) break; if (i < q->ti_len) { q->ti_seq += i; q->ti_len -= i; - m_adj((struct mbuf *) REASS_MBUF(q), i); + m_adj(q->ti_mbuf, i); break; } - q = (struct tcpiphdr *)q->ti_next; - m = (struct mbuf *) REASS_MBUF((struct tcpiphdr *)q->ti_prev); - remque_32((void *)(q->ti_prev)); + q = tcpiphdr_next(q); + m = tcpiphdr_prev(q)->ti_mbuf; + remque(tcpiphdr2qlink(tcpiphdr_prev(q))); m_freem(m); } /* * Stick new segment in its place. */ - insque_32(ti, (void *)(q->ti_prev)); - + insque(tcpiphdr2qlink(ti), tcpiphdr2qlink(tcpiphdr_prev(q))); present: /* * Present data to user, advancing rcv_nxt through @@ -197,17 +199,17 @@ present: */ if (!TCPS_HAVEESTABLISHED(tp->t_state)) return (0); - ti = (struct tcpiphdr *) tp->seg_next; - if (ti == (struct tcpiphdr *)tp || ti->ti_seq != tp->rcv_nxt) + ti = tcpfrag_list_first(tp); + if (tcpfrag_list_end(ti, tp) || ti->ti_seq != tp->rcv_nxt) return (0); if (tp->t_state == TCPS_SYN_RECEIVED && ti->ti_len) return (0); do { tp->rcv_nxt += ti->ti_len; flags = ti->ti_flags & TH_FIN; - remque_32(ti); - m = (struct mbuf *) REASS_MBUF(ti); /* XXX */ - ti = (struct tcpiphdr *)ti->ti_next; + remque(tcpiphdr2qlink(ti)); + m = ti->ti_mbuf; + ti = tcpiphdr_next(ti); /* if (so->so_state & SS_FCANTRCVMORE) */ if (so->so_state & SS_FCANTSENDMORE) m_freem(m); @@ -226,9 +228,13 @@ present: * TCP input routine, follows pages 65-76 of the * protocol specification dated September, 1981 very closely. */ -void tcp_input(register struct mbuf *m, int iphlen, struct socket *inso) +void +tcp_input(m, iphlen, inso) + register struct mbuf *m; + int iphlen; + struct socket *inso; { - struct ip save_ip, *ip; + struct ip save_ip, *ip; register struct tcpiphdr *ti; caddr_t optp = NULL; int optlen = 0; @@ -236,25 +242,23 @@ void tcp_input(register struct mbuf *m, int iphlen, struct socket *inso) register struct tcpcb *tp = 0; register int tiflags; struct socket *so = 0; - int todrop; - u_int acked; - int ourfinisacked, needoutput = 0; - /* int dropsocket = 0; */ + int todrop, acked, ourfinisacked, needoutput = 0; +/* int dropsocket = 0; */ int iss = 0; u_long tiwin; int ret; - /* int ts_present = 0; */ +/* int ts_present = 0; */ DEBUG_CALL("tcp_input"); - DEBUG_ARGS((dfd, " m = %8lx iphlen = %2d inso = %lx\n", - (long)m, iphlen, (long)inso)); - + DEBUG_ARGS((dfd," m = %8lx iphlen = %2d inso = %lx\n", + (long )m, iphlen, (long )inso )); + /* * If called with m == 0, then we're continuing the connect */ if (m == NULL) { so = inso; - + /* Re-set a few variables */ tp = sototcpcb(so); m = so->so_m; @@ -262,46 +266,47 @@ void tcp_input(register struct mbuf *m, int iphlen, struct socket *inso) ti = so->so_ti; tiwin = ti->ti_win; tiflags = ti->ti_flags; - + goto cont_conn; } - - + + tcpstat.tcps_rcvtotal++; /* * Get IP and TCP header together in first mbuf. * Note: IP leaves IP header in first mbuf. */ ti = mtod(m, struct tcpiphdr *); - if (iphlen > sizeof(struct ip)) { - ip_stripoptions(m, (struct mbuf *)0); - iphlen = sizeof(struct ip); + if (iphlen > sizeof(struct ip )) { + ip_stripoptions(m, (struct mbuf *)0); + iphlen=sizeof(struct ip ); } /* XXX Check if too short */ - + /* * Save a copy of the IP header in case we want restore it * for sending an ICMP error message in response. */ - ip = mtod(m, struct ip *); - save_ip = *ip; - save_ip.ip_len += iphlen; + ip=mtod(m, struct ip *); + save_ip = *ip; + save_ip.ip_len+= iphlen; /* * Checksum extended TCP header and data. */ tlen = ((struct ip *)ti)->ip_len; - ti->ti_next = ti->ti_prev = 0; + tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = 0; + memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); ti->ti_x1 = 0; ti->ti_len = htons((u_int16_t)tlen); - len = sizeof(struct ip) + tlen; + len = sizeof(struct ip ) + tlen; /* keep checksum for ICMP reply - * ti->ti_sum = cksum(m, len); + * ti->ti_sum = cksum(m, len); * if (ti->ti_sum) { */ - if (cksum(m, len)) { - tcpstat.tcps_rcvbadsum++; - goto drop; + if(cksum(m, len)) { + tcpstat.tcps_rcvbadsum++; + goto drop; } /* @@ -309,37 +314,37 @@ void tcp_input(register struct mbuf *m, int iphlen, struct socket *inso) * pull out TCP options and adjust length. XXX */ off = ti->ti_off << 2; - if (off < sizeof(struct tcphdr) || off > tlen) { - tcpstat.tcps_rcvbadoff++; - goto drop; + if (off < sizeof (struct tcphdr) || off > tlen) { + tcpstat.tcps_rcvbadoff++; + goto drop; } tlen -= off; ti->ti_len = tlen; - if (off > sizeof(struct tcphdr)) { - optlen = off - sizeof(struct tcphdr); - optp = mtod(m, caddr_t) + sizeof(struct tcpiphdr); + if (off > sizeof (struct tcphdr)) { + optlen = off - sizeof (struct tcphdr); + optp = mtod(m, caddr_t) + sizeof (struct tcpiphdr); - /* + /* * Do quick retrieval of timestamp options ("options * prediction?"). If timestamp is the only option and it's * formatted as recommended in RFC 1323 appendix A, we * quickly get the values now and not bother calling * tcp_dooptions(), etc. */ - /* if ((optlen == TCPOLEN_TSTAMP_APPA || - * (optlen > TCPOLEN_TSTAMP_APPA && - * optp[TCPOLEN_TSTAMP_APPA] == TCPOPT_EOL)) && - * *(u_int32_t *)optp == htonl(TCPOPT_TSTAMP_HDR) && - * (ti->ti_flags & TH_SYN) == 0) { - * ts_present = 1; - * ts_val = ntohl(*(u_int32_t *)(optp + 4)); - * ts_ecr = ntohl(*(u_int32_t *)(optp + 8)); - * optp = NULL; / * we've parsed the options * / - * } - */ +/* if ((optlen == TCPOLEN_TSTAMP_APPA || + * (optlen > TCPOLEN_TSTAMP_APPA && + * optp[TCPOLEN_TSTAMP_APPA] == TCPOPT_EOL)) && + * *(u_int32_t *)optp == htonl(TCPOPT_TSTAMP_HDR) && + * (ti->ti_flags & TH_SYN) == 0) { + * ts_present = 1; + * ts_val = ntohl(*(u_int32_t *)(optp + 4)); + * ts_ecr = ntohl(*(u_int32_t *)(optp + 8)); + * optp = NULL; / * we've parsed the options * / + * } + */ } tiflags = ti->ti_flags; - + /* * Convert TCP protocol specific fields to host format. */ @@ -351,20 +356,20 @@ void tcp_input(register struct mbuf *m, int iphlen, struct socket *inso) /* * Drop TCP, IP headers and TCP options. */ - m->m_data += sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr); - m->m_len -= sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr); - + m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + /* * Locate pcb for segment. */ findso: so = tcp_last_so; if (so->so_fport != ti->ti_dport || - so->so_lport != ti->ti_sport || - so->so_laddr.s_addr != ti->ti_src.s_addr || - so->so_faddr.s_addr != ti->ti_dst.s_addr) { + so->so_lport != ti->ti_sport || + so->so_laddr.s_addr != ti->ti_src.s_addr || + so->so_faddr.s_addr != ti->ti_dst.s_addr) { so = solookup(&tcb, ti->ti_src, ti->ti_sport, - ti->ti_dst, ti->ti_dport); + ti->ti_dst, ti->ti_dport); if (so) tcp_last_so = so; ++tcpstat.tcps_socachemiss; @@ -377,63 +382,63 @@ findso: * but should either do a listen or a connect soon. * * state == CLOSED means we've done socreate() but haven't - * attached it to a protocol yet... - * + * attached it to a protocol yet... + * * XXX If a TCB does not exist, and the TH_SYN flag is * the only flag set, then create a session, mark it * as if it was LISTENING, and continue... */ if (so == 0) { - if ((tiflags & (TH_SYN | TH_FIN | TH_RST | TH_URG | TH_ACK)) != TH_SYN) - goto dropwithreset; - - if ((so = socreate()) == NULL) - goto dropwithreset; - if (tcp_attach(so) < 0) { - free(so); /* Not sofree (if it failed, it's not insqued) */ - goto dropwithreset; - } - - sbreserve(&so->so_snd, tcp_sndspace); - sbreserve(&so->so_rcv, tcp_rcvspace); - - /* tcp_last_so = so; */ /* XXX ? */ - /* tp = sototcpcb(so); */ - - so->so_laddr = ti->ti_src; - so->so_lport = ti->ti_sport; - so->so_faddr = ti->ti_dst; - so->so_fport = ti->ti_dport; - - if ((so->so_iptos = tcp_tos(so)) == 0) - so->so_iptos = ((struct ip *)ti)->ip_tos; - - tp = sototcpcb(so); - tp->t_state = TCPS_LISTEN; + if ((tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) != TH_SYN) + goto dropwithreset; + + if ((so = socreate()) == NULL) + goto dropwithreset; + if (tcp_attach(so) < 0) { + free(so); /* Not sofree (if it failed, it's not insqued) */ + goto dropwithreset; + } + + sbreserve(&so->so_snd, tcp_sndspace); + sbreserve(&so->so_rcv, tcp_rcvspace); + + /* tcp_last_so = so; */ /* XXX ? */ + /* tp = sototcpcb(so); */ + + so->so_laddr = ti->ti_src; + so->so_lport = ti->ti_sport; + so->so_faddr = ti->ti_dst; + so->so_fport = ti->ti_dport; + + if ((so->so_iptos = tcp_tos(so)) == 0) + so->so_iptos = ((struct ip *)ti)->ip_tos; + + tp = sototcpcb(so); + tp->t_state = TCPS_LISTEN; } - - /* - * If this is a still-connecting socket, this probably - * a retransmit of the SYN. Whether it's a retransmit SYN - * or something else, we nuke it. - */ - if (so->so_state & SS_ISFCONNECTING) - goto drop; + + /* + * If this is a still-connecting socket, this probably + * a retransmit of the SYN. Whether it's a retransmit SYN + * or something else, we nuke it. + */ + if (so->so_state & SS_ISFCONNECTING) + goto drop; tp = sototcpcb(so); - + /* XXX Should never fail */ if (tp == 0) goto dropwithreset; if (tp->t_state == TCPS_CLOSED) goto drop; - + /* Unscale the window into a 32-bit value. */ /* if ((tiflags & TH_SYN) == 0) * tiwin = ti->ti_win << tp->snd_scale; * else */ - tiwin = ti->ti_win; + tiwin = ti->ti_win; /* * Segment received on connection. @@ -441,66 +446,66 @@ findso: */ tp->t_idle = 0; if (so_options) - tp->t_timer[TCPT_KEEP] = tcp_keepintvl; + tp->t_timer[TCPT_KEEP] = tcp_keepintvl; else - tp->t_timer[TCPT_KEEP] = tcp_keepidle; + tp->t_timer[TCPT_KEEP] = tcp_keepidle; /* * Process options if not in LISTEN state, * else do it below (after getting remote address). */ if (optp && tp->t_state != TCPS_LISTEN) - tcp_dooptions(tp, (u_char *)optp, optlen, ti); - /* , */ - /* &ts_present, &ts_val, &ts_ecr); */ + tcp_dooptions(tp, (u_char *)optp, optlen, ti); +/* , */ +/* &ts_present, &ts_val, &ts_ecr); */ - /* - * Header prediction: check for the two common cases - * of a uni-directional data xfer. If the packet has - * no control flags, is in-sequence, the window didn't - * change and we're not retransmitting, it's a - * candidate. If the length is zero and the ack moved - * forward, we're the sender side of the xfer. Just - * free the data acked & wake any higher level process - * that was blocked waiting for space. If the length - * is non-zero and the ack didn't move, we're the - * receiver side. If we're getting packets in-order - * (the reassembly queue is empty), add the data to - * the socket buffer and note that we need a delayed ack. - * - * XXX Some of these tests are not needed - * eg: the tiwin == tp->snd_wnd prevents many more - * predictions.. with no *real* advantage.. - */ + /* + * Header prediction: check for the two common cases + * of a uni-directional data xfer. If the packet has + * no control flags, is in-sequence, the window didn't + * change and we're not retransmitting, it's a + * candidate. If the length is zero and the ack moved + * forward, we're the sender side of the xfer. Just + * free the data acked & wake any higher level process + * that was blocked waiting for space. If the length + * is non-zero and the ack didn't move, we're the + * receiver side. If we're getting packets in-order + * (the reassembly queue is empty), add the data to + * the socket buffer and note that we need a delayed ack. + * + * XXX Some of these tests are not needed + * eg: the tiwin == tp->snd_wnd prevents many more + * predictions.. with no *real* advantage.. + */ if (tp->t_state == TCPS_ESTABLISHED && - (tiflags & (TH_SYN | TH_FIN | TH_RST | TH_URG | TH_ACK)) == TH_ACK && - /* (!ts_present || TSTMP_GEQ(ts_val, tp->ts_recent)) && */ - ti->ti_seq == tp->rcv_nxt && - tiwin && tiwin == tp->snd_wnd && - tp->snd_nxt == tp->snd_max) { - /* + (tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) == TH_ACK && +/* (!ts_present || TSTMP_GEQ(ts_val, tp->ts_recent)) && */ + ti->ti_seq == tp->rcv_nxt && + tiwin && tiwin == tp->snd_wnd && + tp->snd_nxt == tp->snd_max) { + /* * If last ACK falls within this segment's sequence numbers, * record the timestamp. */ - /* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && - * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len)) { - * tp->ts_recent_age = tcp_now; - * tp->ts_recent = ts_val; - * } - */ +/* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && + * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len)) { + * tp->ts_recent_age = tcp_now; + * tp->ts_recent = ts_val; + * } + */ if (ti->ti_len == 0) { if (SEQ_GT(ti->ti_ack, tp->snd_una) && - SEQ_LEQ(ti->ti_ack, tp->snd_max) && - tp->snd_cwnd >= tp->snd_wnd) { + SEQ_LEQ(ti->ti_ack, tp->snd_max) && + tp->snd_cwnd >= tp->snd_wnd) { /* * this is a pure ack for outstanding data. */ ++tcpstat.tcps_predack; - /* if (ts_present) - * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); - * else - */ if (tp->t_rtt && -SEQ_GT(ti->ti_ack, tp->t_rtseq)) +/* if (ts_present) + * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); + * else + */ if (tp->t_rtt && + SEQ_GT(ti->ti_ack, tp->t_rtseq)) tcp_xmit_timer(tp, tp->t_rtt); acked = ti->ti_ack - tp->snd_una; tcpstat.tcps_rcvackpack++; @@ -523,27 +528,26 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) else if (tp->t_timer[TCPT_PERSIST] == 0) tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; - /* + /* * There's room in so_snd, sowwakup will read() * from the socket if we can */ - /* if (so->so_snd.sb_flags & SB_NOTIFY) - * sowwakeup(so); - */ - /* - * This is called because sowwakeup might have - * put data into so_snd. Since we don't so sowwakeup, - * we don't need this.. XXX??? - */ +/* if (so->so_snd.sb_flags & SB_NOTIFY) + * sowwakeup(so); + */ + /* + * This is called because sowwakeup might have + * put data into so_snd. Since we don't so sowwakeup, + * we don't need this.. XXX??? + */ if (so->so_snd.sb_cc) (void) tcp_output(tp); return; } - } - else if (ti->ti_ack == tp->snd_una && - tp->seg_next == (tcpiphdrp_32)tp && - ti->ti_len <= sbspace(&so->so_rcv)) { + } else if (ti->ti_ack == tp->snd_una && + tcpfrag_list_empty(tp) && + ti->ti_len <= sbspace(&so->so_rcv)) { /* * this is a pure, in-sequence data packet * with nothing on the reassembly queue and @@ -557,26 +561,25 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * Add data to socket buffer. */ if (so->so_emu) { - if (tcp_emu(so, m)) sbappend(so, m); - } - else + if (tcp_emu(so,m)) sbappend(so, m); + } else sbappend(so, m); - - /* + + /* * XXX This is called when data arrives. Later, check * if we can actually write() to the socket * XXX Need to check? It's be NON_BLOCKING */ - /* sorwakeup(so); */ - - /* - * If this is a short packet, then ACK now - with Nagel - * congestion avoidance sender won't send more until - * he gets an ACK. - * - * It is better to not delay acks at all to maximize - * TCP throughput. See RFC 2581. - */ +/* sorwakeup(so); */ + + /* + * If this is a short packet, then ACK now - with Nagel + * congestion avoidance sender won't send more until + * he gets an ACK. + * + * It is better to not delay acks at all to maximize + * TCP throughput. See RFC 2581. + */ tp->t_flags |= TF_ACKNOW; tcp_output(tp); return; @@ -589,147 +592,141 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * but not less than advertised window. */ { int win; - win = sbspace(&so->so_rcv); - if (win < 0) - win = 0; - tp->rcv_wnd = max(win, (int)(tp->rcv_adv - tp->rcv_nxt)); + win = sbspace(&so->so_rcv); + if (win < 0) + win = 0; + tp->rcv_wnd = max(win, (int)(tp->rcv_adv - tp->rcv_nxt)); } switch (tp->t_state) { - /* - * If the state is LISTEN then ignore segment if it contains an RST. - * If the segment contains an ACK then it is bad and send a RST. - * If it does not contain a SYN then it is not interesting; drop it. - * Don't bother responding if the destination was a broadcast. - * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial - * tp->iss, and send a segment: - * - * Also initialize tp->snd_nxt to tp->iss+1 and tp->snd_una to tp->iss. - * Fill in remote peer address fields if not previously specified. - * Enter SYN_RECEIVED state, and process any other fields of this - * segment in this state. - */ + /* + * If the state is LISTEN then ignore segment if it contains an RST. + * If the segment contains an ACK then it is bad and send a RST. + * If it does not contain a SYN then it is not interesting; drop it. + * Don't bother responding if the destination was a broadcast. + * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial + * tp->iss, and send a segment: + * + * Also initialize tp->snd_nxt to tp->iss+1 and tp->snd_una to tp->iss. + * Fill in remote peer address fields if not previously specified. + * Enter SYN_RECEIVED state, and process any other fields of this + * segment in this state. + */ case TCPS_LISTEN: { - if (tiflags & TH_RST) - goto drop; - if (tiflags & TH_ACK) - goto dropwithreset; - if ((tiflags & TH_SYN) == 0) - goto drop; - - /* - * This has way too many gotos... - * But a bit of spaghetti code never hurt anybody :) - */ - - /* - * If this is destined for the control address, then flag to - * tcp_ctl once connected, otherwise connect - */ - if ((so->so_faddr.s_addr&htonl(0xffffff00)) == special_addr.s_addr) { - int lastbyte = ntohl(so->so_faddr.s_addr) & 0xff; - if (lastbyte != CTL_ALIAS && lastbyte != CTL_DNS) { + if (tiflags & TH_RST) + goto drop; + if (tiflags & TH_ACK) + goto dropwithreset; + if ((tiflags & TH_SYN) == 0) + goto drop; + + /* + * This has way too many gotos... + * But a bit of spaghetti code never hurt anybody :) + */ + + /* + * If this is destined for the control address, then flag to + * tcp_ctl once connected, otherwise connect + */ + if ((so->so_faddr.s_addr&htonl(0xffffff00)) == special_addr.s_addr) { + int lastbyte=ntohl(so->so_faddr.s_addr) & 0xff; + if (lastbyte!=CTL_ALIAS && lastbyte!=CTL_DNS) { #if 0 - if (lastbyte == CTL_CMD || lastbyte == CTL_EXEC) { - /* Command or exec adress */ - so->so_state |= SS_CTL; - } - else + if(lastbyte==CTL_CMD || lastbyte==CTL_EXEC) { + /* Command or exec adress */ + so->so_state |= SS_CTL; + } else #endif - { - /* May be an add exec */ - struct ex_list *ex_ptr; - for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { - if (ex_ptr->ex_fport == so->so_fport && - lastbyte == ex_ptr->ex_addr) { - so->so_state |= SS_CTL; - break; - } - } - } - if (so->so_state & SS_CTL) goto cont_input; - } - /* CTL_ALIAS: Do nothing, tcp_fconnect will be called on it */ + { + /* May be an add exec */ + struct ex_list *ex_ptr; + for(ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { + if(ex_ptr->ex_fport == so->so_fport && + lastbyte == ex_ptr->ex_addr) { + so->so_state |= SS_CTL; + break; + } } + } + if(so->so_state & SS_CTL) goto cont_input; + } + /* CTL_ALIAS: Do nothing, tcp_fconnect will be called on it */ + } + + if (so->so_emu & EMU_NOCONNECT) { + so->so_emu &= ~EMU_NOCONNECT; + goto cont_input; + } + + if((tcp_fconnect(so) == -1) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK)) { + u_char code=ICMP_UNREACH_NET; + DEBUG_MISC((dfd," tcp fconnect errno = %d-%s\n", + errno,strerror(errno))); + if(errno == ECONNREFUSED) { + /* ACK the SYN, send RST to refuse the connection */ + tcp_respond(tp, ti, m, ti->ti_seq+1, (tcp_seq)0, + TH_RST|TH_ACK); + } else { + if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST; + HTONL(ti->ti_seq); /* restore tcp header */ + HTONL(ti->ti_ack); + HTONS(ti->ti_win); + HTONS(ti->ti_urp); + m->m_data -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + m->m_len += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + *ip=save_ip; + icmp_error(m, ICMP_UNREACH,code, 0,strerror(errno)); + } + tp = tcp_close(tp); + m_free(m); + } else { + /* + * Haven't connected yet, save the current mbuf + * and ti, and return + * XXX Some OS's don't tell us whether the connect() + * succeeded or not. So we must time it out. + */ + so->so_m = m; + so->so_ti = ti; + tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; + tp->t_state = TCPS_SYN_RECEIVED; + } + return; - if (so->so_emu & EMU_NOCONNECT) { - so->so_emu &= ~EMU_NOCONNECT; - goto cont_input; - } - - if (tcp_fconnect(so) == -1) { - int error = WSAGetLastError(); - if ((error != WSAEINPROGRESS) && (error != WSAEWOULDBLOCK)) { - u_char code = ICMP_UNREACH_NET; - DEBUG_MISC((dfd, " tcp fconnect errno = %d-%s\n", - errno, strerror(errno))); - if (error == WSAECONNREFUSED) { - /* ACK the SYN, send RST to refuse the connection */ - tcp_respond(tp, ti, m, ti->ti_seq + 1, (tcp_seq)0, - TH_RST | TH_ACK); - } - else { - if (error == WSAEHOSTUNREACH) code = ICMP_UNREACH_HOST; - HTONL(ti->ti_seq); /* restore tcp header */ - HTONL(ti->ti_ack); - HTONS(ti->ti_win); - HTONS(ti->ti_urp); - m->m_data -= sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr); - m->m_len += sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr); - *ip = save_ip; - icmp_error(m, ICMP_UNREACH, code, 0, strerror(errno)); - } - tp = tcp_close(tp); - m_free(m); - return; - } - } - - /* - * Haven't connected yet, save the current mbuf - * and ti, and return - * XXX Some OS's don't tell us whether the connect() - * succeeded or not. So we must time it out. - */ - so->so_m = m; - so->so_ti = ti; - tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; - tp->t_state = TCPS_SYN_RECEIVED; - return; - - cont_conn: - /* m==NULL - * Check if the connect succeeded - */ - if (so->so_state & SS_NOFDREF) { - tp = tcp_close(tp); - goto dropwithreset; - } - cont_input: - tcp_template(tp); - - if (optp) - tcp_dooptions(tp, (u_char *)optp, optlen, ti); - /* , */ - /* &ts_present, &ts_val, &ts_ecr); */ - - if (iss) - tp->iss = iss; - else - tp->iss = tcp_iss; - tcp_iss += TCP_ISSINCR / 2; - tp->irs = ti->ti_seq; - tcp_sendseqinit(tp); - tcp_rcvseqinit(tp); - tp->t_flags |= TF_ACKNOW; - tp->t_state = TCPS_SYN_RECEIVED; - tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; - tcpstat.tcps_accepts++; - goto trimthenstep6; + cont_conn: + /* m==NULL + * Check if the connect succeeded + */ + if (so->so_state & SS_NOFDREF) { + tp = tcp_close(tp); + goto dropwithreset; + } + cont_input: + tcp_template(tp); + + if (optp) + tcp_dooptions(tp, (u_char *)optp, optlen, ti); + /* , */ + /* &ts_present, &ts_val, &ts_ecr); */ + + if (iss) + tp->iss = iss; + else + tp->iss = tcp_iss; + tcp_iss += TCP_ISSINCR/2; + tp->irs = ti->ti_seq; + tcp_sendseqinit(tp); + tcp_rcvseqinit(tp); + tp->t_flags |= TF_ACKNOW; + tp->t_state = TCPS_SYN_RECEIVED; + tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; + tcpstat.tcps_accepts++; + goto trimthenstep6; } /* case TCPS_LISTEN */ - + /* * If the state is SYN_SENT: * if seg contains an ACK, but not for our SYN, drop the input. @@ -744,13 +741,13 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) */ case TCPS_SYN_SENT: if ((tiflags & TH_ACK) && - (SEQ_LEQ(ti->ti_ack, tp->iss) || - SEQ_GT(ti->ti_ack, tp->snd_max))) + (SEQ_LEQ(ti->ti_ack, tp->iss) || + SEQ_GT(ti->ti_ack, tp->snd_max))) goto dropwithreset; if (tiflags & TH_RST) { if (tiflags & TH_ACK) - tp = tcp_drop(tp, 0); /* XXX Check t_softerror! */ + tp = tcp_drop(tp,0); /* XXX Check t_softerror! */ goto drop; } @@ -770,7 +767,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) tcpstat.tcps_connects++; soisfconnected(so); tp->t_state = TCPS_ESTABLISHED; - + /* Do window scaling on this connection? */ /* if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == * (TF_RCVD_SCALE|TF_REQ_SCALE)) { @@ -778,7 +775,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * tp->rcv_scale = tp->request_r_scale; * } */ - (void)tcp_reass(tp, (struct tcpiphdr *)0, + (void) tcp_reass(tp, (struct tcpiphdr *)0, (struct mbuf *)0); /* * if we didn't have to retransmit the SYN, @@ -786,11 +783,10 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) */ if (tp->t_rtt) tcp_xmit_timer(tp, tp->t_rtt); - } - else + } else tp->t_state = TCPS_SYN_RECEIVED; - trimthenstep6: +trimthenstep6: /* * Advance ti->ti_seq to correspond to first data byte. * If data, trim to stay within window, @@ -812,45 +808,45 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) /* * States other than LISTEN or SYN_SENT. * First check timestamp, if present. - * Then check that at least some bytes of segment are within + * Then check that at least some bytes of segment are within * receive window. If segment begins before rcv_nxt, * drop leading data (and SYN); if nothing left, just ack. - * + * * RFC 1323 PAWS: If we have a timestamp reply on this segment * and it's less than ts_recent, drop it. */ - /* if (ts_present && (tiflags & TH_RST) == 0 && tp->ts_recent && - * TSTMP_LT(ts_val, tp->ts_recent)) { - * - */ /* Check to see if ts_recent is over 24 days old. */ - /* if ((int)(tcp_now - tp->ts_recent_age) > TCP_PAWS_IDLE) { - */ /* - * * Invalidate ts_recent. If this segment updates - * * ts_recent, the age will be reset later and ts_recent - * * will get a valid value. If it does not, setting - * * ts_recent to zero will at least satisfy the - * * requirement that zero be placed in the timestamp - * * echo reply when ts_recent isn't valid. The - * * age isn't reset until we get a valid ts_recent - * * because we don't want out-of-order segments to be - * * dropped when ts_recent is old. - * */ - /* tp->ts_recent = 0; - * } else { - * tcpstat.tcps_rcvduppack++; - * tcpstat.tcps_rcvdupbyte += ti->ti_len; - * tcpstat.tcps_pawsdrop++; - * goto dropafterack; - * } - * } - */ +/* if (ts_present && (tiflags & TH_RST) == 0 && tp->ts_recent && + * TSTMP_LT(ts_val, tp->ts_recent)) { + * + */ /* Check to see if ts_recent is over 24 days old. */ +/* if ((int)(tcp_now - tp->ts_recent_age) > TCP_PAWS_IDLE) { + */ /* + * * Invalidate ts_recent. If this segment updates + * * ts_recent, the age will be reset later and ts_recent + * * will get a valid value. If it does not, setting + * * ts_recent to zero will at least satisfy the + * * requirement that zero be placed in the timestamp + * * echo reply when ts_recent isn't valid. The + * * age isn't reset until we get a valid ts_recent + * * because we don't want out-of-order segments to be + * * dropped when ts_recent is old. + * */ +/* tp->ts_recent = 0; + * } else { + * tcpstat.tcps_rcvduppack++; + * tcpstat.tcps_rcvdupbyte += ti->ti_len; + * tcpstat.tcps_pawsdrop++; + * goto dropafterack; + * } + * } + */ todrop = tp->rcv_nxt - ti->ti_seq; if (todrop > 0) { if (tiflags & TH_SYN) { tiflags &= ~TH_SYN; ti->ti_seq++; - if (ti->ti_urp > 1) + if (ti->ti_urp > 1) ti->ti_urp--; else tiflags &= ~TH_URG; @@ -860,14 +856,14 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * Following if statement from Stevens, vol. 2, p. 960. */ if (todrop > ti->ti_len - || (todrop == ti->ti_len && (tiflags & TH_FIN) == 0)) { + || (todrop == ti->ti_len && (tiflags & TH_FIN) == 0)) { /* * Any valid FIN must be to the left of the window. * At this point the FIN must be a duplicate or out * of sequence; drop it. */ tiflags &= ~TH_FIN; - + /* * Send an ACK to resynchronize and drop any data. * But keep on processing for RST or ACK. @@ -876,8 +872,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) todrop = ti->ti_len; tcpstat.tcps_rcvduppack++; tcpstat.tcps_rcvdupbyte += todrop; - } - else { + } else { tcpstat.tcps_rcvpartduppack++; tcpstat.tcps_rcvpartdupbyte += todrop; } @@ -896,7 +891,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * user processes are gone, then RST the other end. */ if ((so->so_state & SS_NOFDREF) && - tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) { + tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) { tp = tcp_close(tp); tcpstat.tcps_rcvafterclose++; goto dropwithreset; @@ -906,7 +901,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * If segment ends after window, drop trailing data * (and PUSH and FIN); if nothing left, just ACK. */ - todrop = (ti->ti_seq + ti->ti_len) - (tp->rcv_nxt + tp->rcv_wnd); + todrop = (ti->ti_seq+ti->ti_len) - (tp->rcv_nxt+tp->rcv_wnd); if (todrop > 0) { tcpstat.tcps_rcvpackafterwin++; if (todrop >= ti->ti_len) { @@ -918,8 +913,8 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * are above the previous ones. */ if (tiflags & TH_SYN && - tp->t_state == TCPS_TIME_WAIT && - SEQ_GT(ti->ti_seq, tp->rcv_nxt)) { + tp->t_state == TCPS_TIME_WAIT && + SEQ_GT(ti->ti_seq, tp->rcv_nxt)) { iss = tp->rcv_nxt + TCP_ISSINCR; tp = tcp_close(tp); goto findso; @@ -934,55 +929,53 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) if (tp->rcv_wnd == 0 && ti->ti_seq == tp->rcv_nxt) { tp->t_flags |= TF_ACKNOW; tcpstat.tcps_rcvwinprobe++; - } - else + } else goto dropafterack; - } - else + } else tcpstat.tcps_rcvbyteafterwin += todrop; m_adj(m, -todrop); ti->ti_len -= todrop; - tiflags &= ~(TH_PUSH | TH_FIN); + tiflags &= ~(TH_PUSH|TH_FIN); } /* * If last ACK falls within this segment's sequence numbers, * record its timestamp. */ - /* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && - * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len + - * ((tiflags & (TH_SYN|TH_FIN)) != 0))) { - * tp->ts_recent_age = tcp_now; - * tp->ts_recent = ts_val; - * } - */ +/* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && + * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len + + * ((tiflags & (TH_SYN|TH_FIN)) != 0))) { + * tp->ts_recent_age = tcp_now; + * tp->ts_recent = ts_val; + * } + */ - /* - * If the RST bit is set examine the state: - * SYN_RECEIVED STATE: - * If passive open, return to LISTEN state. - * If active open, inform user that connection was refused. - * ESTABLISHED, FIN_WAIT_1, FIN_WAIT2, CLOSE_WAIT STATES: - * Inform user that connection was reset, and close tcb. - * CLOSING, LAST_ACK, TIME_WAIT STATES - * Close the tcb. - */ + /* + * If the RST bit is set examine the state: + * SYN_RECEIVED STATE: + * If passive open, return to LISTEN state. + * If active open, inform user that connection was refused. + * ESTABLISHED, FIN_WAIT_1, FIN_WAIT2, CLOSE_WAIT STATES: + * Inform user that connection was reset, and close tcb. + * CLOSING, LAST_ACK, TIME_WAIT STATES + * Close the tcb. + */ if (tiflags&TH_RST) switch (tp->t_state) { case TCPS_SYN_RECEIVED: - /* so->so_error = ECONNREFUSED; */ +/* so->so_error = ECONNREFUSED; */ goto close; case TCPS_ESTABLISHED: case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: - /* so->so_error = ECONNRESET; */ - close: - tp->t_state = TCPS_CLOSED; - tcpstat.tcps_drops++; - tp = tcp_close(tp); - goto drop; +/* so->so_error = ECONNRESET; */ + close: + tp->t_state = TCPS_CLOSED; + tcpstat.tcps_drops++; + tp = tcp_close(tp); + goto drop; case TCPS_CLOSING: case TCPS_LAST_ACK: @@ -996,7 +989,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * error and we send an RST and drop the connection. */ if (tiflags & TH_SYN) { - tp = tcp_drop(tp, 0); + tp = tcp_drop(tp,0); goto dropwithreset; } @@ -1009,45 +1002,42 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * Ack processing. */ switch (tp->t_state) { - /* - * In SYN_RECEIVED state if the ack ACKs our SYN then enter - * ESTABLISHED state and continue processing, otherwise - * send an RST. una<=ack<=max - */ + /* + * In SYN_RECEIVED state if the ack ACKs our SYN then enter + * ESTABLISHED state and continue processing, otherwise + * send an RST. una<=ack<=max + */ case TCPS_SYN_RECEIVED: if (SEQ_GT(tp->snd_una, ti->ti_ack) || - SEQ_GT(ti->ti_ack, tp->snd_max)) + SEQ_GT(ti->ti_ack, tp->snd_max)) goto dropwithreset; tcpstat.tcps_connects++; tp->t_state = TCPS_ESTABLISHED; - /* - * The sent SYN is ack'ed with our sequence number +1 - * The first data byte already in the buffer will get + /* + * The sent SYN is ack'ed with our sequence number +1 + * The first data byte already in the buffer will get * lost if no correction is made. This is only needed for * SS_CTL since the buffer is empty otherwise. - * tp->snd_una++; or: + * tp->snd_una++; or: */ - tp->snd_una = ti->ti_ack; + tp->snd_una=ti->ti_ack; if (so->so_state & SS_CTL) { - /* So tcp_ctl reports the right state */ - ret = tcp_ctl(so); - if (ret == 1) { - soisfconnected(so); - so->so_state &= ~SS_CTL; /* success XXX */ - } - else if (ret == 2) { - so->so_state = SS_NOFDREF; /* CTL_CMD */ - } - else { - needoutput = 1; - tp->t_state = TCPS_FIN_WAIT_1; - } + /* So tcp_ctl reports the right state */ + ret = tcp_ctl(so); + if (ret == 1) { + soisfconnected(so); + so->so_state &= ~SS_CTL; /* success XXX */ + } else if (ret == 2) { + so->so_state = SS_NOFDREF; /* CTL_CMD */ + } else { + needoutput = 1; + tp->t_state = TCPS_FIN_WAIT_1; + } + } else { + soisfconnected(so); } - else { - soisfconnected(so); - } - + /* Do window scaling? */ /* if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == * (TF_RCVD_SCALE|TF_REQ_SCALE)) { @@ -1055,7 +1045,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * tp->rcv_scale = tp->request_r_scale; * } */ - (void)tcp_reass(tp, (struct tcpiphdr *)0, (struct mbuf *)0); + (void) tcp_reass(tp, (struct tcpiphdr *)0, (struct mbuf *)0); tp->snd_wl1 = ti->ti_seq - 1; /* Avoid ack processing; snd_una==ti_ack => dup ack */ goto synrx_to_est; @@ -1079,9 +1069,9 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { - tcpstat.tcps_rcvdupack++; - DEBUG_MISC((dfd, " dup ack m = %lx so = %lx \n", - (long)m, (long)so)); + tcpstat.tcps_rcvdupack++; + DEBUG_MISC((dfd," dup ack m = %lx so = %lx \n", + (long )m, (long )so)); /* * If we have outstanding data (other than * a window probe), this is a completely @@ -1101,18 +1091,18 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * the new ssthresh). * * Dup acks mean that packets have left the - * network (they're now cached at the receiver) + * network (they're now cached at the receiver) * so bump cwnd by the amount in the receiver * to keep a constant cwnd packets in the * network. */ if (tp->t_timer[TCPT_REXMT] == 0 || - ti->ti_ack != tp->snd_una) + ti->ti_ack != tp->snd_una) tp->t_dupacks = 0; else if (++tp->t_dupacks == tcprexmtthresh) { tcp_seq onxt = tp->snd_nxt; u_int win = - min(tp->snd_wnd, tp->snd_cwnd) / 2 / + min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; if (win < 2) @@ -1122,20 +1112,18 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) tp->t_rtt = 0; tp->snd_nxt = ti->ti_ack; tp->snd_cwnd = tp->t_maxseg; - (void)tcp_output(tp); + (void) tcp_output(tp); tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * tp->t_dupacks; + tp->t_maxseg * tp->t_dupacks; if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; - } - else if (tp->t_dupacks > tcprexmtthresh) { + } else if (tp->t_dupacks > tcprexmtthresh) { tp->snd_cwnd += tp->t_maxseg; - (void)tcp_output(tp); + (void) tcp_output(tp); goto drop; } - } - else + } else tp->t_dupacks = 0; break; } @@ -1145,7 +1133,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * for the other side's cached packets, retract it. */ if (tp->t_dupacks > tcprexmtthresh && - tp->snd_cwnd > tp->snd_ssthresh) + tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; tp->t_dupacks = 0; if (SEQ_GT(ti->ti_ack, tp->snd_max)) { @@ -1165,12 +1153,12 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * timer backoff (cf., Phil Karn's retransmit alg.). * Recompute the initial retransmit timer. */ - /* if (ts_present) - * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); - * else - */ - if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) - tcp_xmit_timer(tp, tp->t_rtt); +/* if (ts_present) + * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); + * else + */ + if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) + tcp_xmit_timer(tp,tp->t_rtt); /* * If all outstanding data is acked, stop retransmit @@ -1181,8 +1169,7 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) if (ti->ti_ack == tp->snd_max) { tp->t_timer[TCPT_REXMT] = 0; needoutput = 1; - } - else if (tp->t_timer[TCPT_PERSIST] == 0) + } else if (tp->t_timer[TCPT_PERSIST] == 0) tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; /* * When new data is acked, open the congestion window. @@ -1192,41 +1179,40 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) * (maxseg^2 / cwnd per packet). */ { - register u_int cw = tp->snd_cwnd; - register u_int incr = tp->t_maxseg; + register u_int cw = tp->snd_cwnd; + register u_int incr = tp->t_maxseg; - if (cw > tp->snd_ssthresh) - incr = incr * incr / cw; - tp->snd_cwnd = min(cw + incr, (u_int32_t) (TCP_MAXWIN << tp->snd_scale)); + if (cw > tp->snd_ssthresh) + incr = incr * incr / cw; + tp->snd_cwnd = min(cw + incr, TCP_MAXWIN<snd_scale); } if (acked > so->so_snd.sb_cc) { tp->snd_wnd -= so->so_snd.sb_cc; - sbdrop(&so->so_snd, so->so_snd.sb_cc); + sbdrop(&so->so_snd, (int )so->so_snd.sb_cc); ourfinisacked = 1; - } - else { + } else { sbdrop(&so->so_snd, acked); tp->snd_wnd -= acked; ourfinisacked = 0; } /* * XXX sowwakup is called when data is acked and there's room for - * for more data... it should read() the socket + * for more data... it should read() the socket */ - /* if (so->so_snd.sb_flags & SB_NOTIFY) - * sowwakeup(so); - */ +/* if (so->so_snd.sb_flags & SB_NOTIFY) + * sowwakeup(so); + */ tp->snd_una = ti->ti_ack; if (SEQ_LT(tp->snd_nxt, tp->snd_una)) tp->snd_nxt = tp->snd_una; switch (tp->t_state) { - /* - * In FIN_WAIT_1 STATE in addition to the processing - * for the ESTABLISHED state if our FIN is now acknowledged - * then enter FIN_WAIT_2. - */ + /* + * In FIN_WAIT_1 STATE in addition to the processing + * for the ESTABLISHED state if our FIN is now acknowledged + * then enter FIN_WAIT_2. + */ case TCPS_FIN_WAIT_1: if (ourfinisacked) { /* @@ -1244,12 +1230,12 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) } break; - /* - * In CLOSING STATE in addition to the processing for - * the ESTABLISHED state if the ACK acknowledges our FIN - * then enter the TIME-WAIT state, otherwise ignore - * the segment. - */ + /* + * In CLOSING STATE in addition to the processing for + * the ESTABLISHED state if the ACK acknowledges our FIN + * then enter the TIME-WAIT state, otherwise ignore + * the segment. + */ case TCPS_CLOSING: if (ourfinisacked) { tp->t_state = TCPS_TIME_WAIT; @@ -1259,12 +1245,12 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) } break; - /* - * In LAST_ACK, we may still be waiting for data to drain - * and/or to be acked, as well as for the ack of our FIN. - * If our FIN is now acknowledged, delete the TCB, - * enter the closed state and return. - */ + /* + * In LAST_ACK, we may still be waiting for data to drain + * and/or to be acked, as well as for the ack of our FIN. + * If our FIN is now acknowledged, delete the TCB, + * enter the closed state and return. + */ case TCPS_LAST_ACK: if (ourfinisacked) { tp = tcp_close(tp); @@ -1272,11 +1258,11 @@ SEQ_GT(ti->ti_ack, tp->t_rtseq)) } break; - /* - * In TIME_WAIT state the only thing that should arrive - * is a retransmission of the remote FIN. Acknowledge - * it and restart the finack timer. - */ + /* + * In TIME_WAIT state the only thing that should arrive + * is a retransmission of the remote FIN. Acknowledge + * it and restart the finack timer. + */ case TCPS_TIME_WAIT: tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; goto dropafterack; @@ -1289,12 +1275,12 @@ step6: * Don't look at window if no ACK: TAC's send garbage on first SYN. */ if ((tiflags & TH_ACK) && - (SEQ_LT(tp->snd_wl1, ti->ti_seq) || - (tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) || - (tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) { + (SEQ_LT(tp->snd_wl1, ti->ti_seq) || + (tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) || + (tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) { /* keep track of pure window updates */ if (ti->ti_len == 0 && - tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd) + tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd) tcpstat.tcps_rcvwinupd++; tp->snd_wnd = tiwin; tp->snd_wl1 = ti->ti_seq; @@ -1308,7 +1294,7 @@ step6: * Process segments with URG. */ if ((tiflags & TH_URG) && ti->ti_urp && - TCPS_HAVERCVDFIN(tp->t_state) == 0) { + TCPS_HAVERCVDFIN(tp->t_state) == 0) { /* * This is a kludge, but if we receive and accept * random urgent pointers, we'll crash in @@ -1324,32 +1310,31 @@ step6: * If this segment advances the known urgent pointer, * then mark the data stream. This should not happen * in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since - * a FIN has been received from the remote side. + * a FIN has been received from the remote side. * In these states we ignore the URG. * * According to RFC961 (Assigned Protocols), * the urgent pointer points to the last octet * of urgent data. We continue, however, * to consider it to indicate the first octet - * of data past the urgent section as the original + * of data past the urgent section as the original * spec states (in one of two places). */ - if (SEQ_GT(ti->ti_seq + ti->ti_urp, tp->rcv_up)) { + if (SEQ_GT(ti->ti_seq+ti->ti_urp, tp->rcv_up)) { tp->rcv_up = ti->ti_seq + ti->ti_urp; - so->so_urgc = so->so_rcv.sb_cc + + so->so_urgc = so->so_rcv.sb_cc + (tp->rcv_up - tp->rcv_nxt); /* -1; */ tp->rcv_up = ti->ti_seq + ti->ti_urp; - + } - } - else + } else /* * If no out of band data is expected, * pull receive urgent pointer along * with the receive window. */ if (SEQ_GT(tp->rcv_nxt, tp->rcv_up)) - tp->rcv_up = tp->rcv_nxt; + tp->rcv_up = tp->rcv_nxt; dodata: /* @@ -1361,7 +1346,7 @@ dodata: * connection then we just ignore the text. */ if ((ti->ti_len || (tiflags&TH_FIN)) && - TCPS_HAVERCVDFIN(tp->t_state) == 0) { + TCPS_HAVERCVDFIN(tp->t_state) == 0) { TCP_REASS(tp, ti, m, so, tiflags); /* * Note the amount of data that peer has sent into @@ -1369,8 +1354,7 @@ dodata: * buffer size. */ len = so->so_rcv.sb_datalen - (tp->rcv_adv - tp->rcv_nxt); - } - else { + } else { m_free(m); tiflags &= ~TH_FIN; } @@ -1384,45 +1368,45 @@ dodata: /* * If we receive a FIN we can't send more data, * set it SS_FDRAIN - * Shutdown the socket if there is no rx data in the + * Shutdown the socket if there is no rx data in the * buffer. * soread() is called on completion of shutdown() and * will got to TCPS_LAST_ACK, and use tcp_output() * to send the FIN. */ - /* sofcantrcvmore(so); */ +/* sofcantrcvmore(so); */ sofwdrain(so); - + tp->t_flags |= TF_ACKNOW; tp->rcv_nxt++; } switch (tp->t_state) { - /* - * In SYN_RECEIVED and ESTABLISHED STATES - * enter the CLOSE_WAIT state. - */ + /* + * In SYN_RECEIVED and ESTABLISHED STATES + * enter the CLOSE_WAIT state. + */ case TCPS_SYN_RECEIVED: case TCPS_ESTABLISHED: - if (so->so_emu == EMU_CTL) /* no shutdown on socket */ - tp->t_state = TCPS_LAST_ACK; - else - tp->t_state = TCPS_CLOSE_WAIT; - break; + if(so->so_emu == EMU_CTL) /* no shutdown on socket */ + tp->t_state = TCPS_LAST_ACK; + else + tp->t_state = TCPS_CLOSE_WAIT; + break; - /* - * If still in FIN_WAIT_1 STATE FIN has not been acked so - * enter the CLOSING state. - */ + /* + * If still in FIN_WAIT_1 STATE FIN has not been acked so + * enter the CLOSING state. + */ case TCPS_FIN_WAIT_1: tp->t_state = TCPS_CLOSING; break; - /* - * In FIN_WAIT_2 state enter the TIME_WAIT state, - * starting the time-wait timer, turning off the other - * standard timers. - */ + /* + * In FIN_WAIT_2 state enter the TIME_WAIT state, + * starting the time-wait timer, turning off the other + * standard timers. + */ case TCPS_FIN_WAIT_2: tp->t_state = TCPS_TIME_WAIT; tcp_canceltimers(tp); @@ -1430,9 +1414,9 @@ dodata: soisfdisconnected(so); break; - /* - * In TIME_WAIT state restart the 2 MSL time_wait timer. - */ + /* + * In TIME_WAIT state restart the 2 MSL time_wait timer. + */ case TCPS_TIME_WAIT: tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; break; @@ -1443,18 +1427,18 @@ dodata: * If this is a small packet, then ACK now - with Nagel * congestion avoidance sender won't send more until * he gets an ACK. - * + * * See above. */ - /* if (ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg) { - */ - /* if ((ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg && - * (so->so_iptos & IPTOS_LOWDELAY) == 0) || - * ((so->so_iptos & IPTOS_LOWDELAY) && - * ((struct tcpiphdr_2 *)ti)->first_char == (char)27)) { - */ +/* if (ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg) { + */ +/* if ((ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg && + * (so->so_iptos & IPTOS_LOWDELAY) == 0) || + * ((so->so_iptos & IPTOS_LOWDELAY) && + * ((struct tcpiphdr_2 *)ti)->first_char == (char)27)) { + */ if (ti->ti_len && (unsigned)ti->ti_len <= 5 && - ((struct tcpiphdr_2 *)ti)->first_char == (char)27) { + ((struct tcpiphdr_2 *)ti)->first_char == (char)27) { tp->t_flags |= TF_ACKNOW; } @@ -1462,7 +1446,7 @@ dodata: * Return any desired output. */ if (needoutput || (tp->t_flags & TF_ACKNOW)) { - (void)tcp_output(tp); + (void) tcp_output(tp); } return; @@ -1475,7 +1459,7 @@ dropafterack: goto drop; m_freem(m); tp->t_flags |= TF_ACKNOW; - (void)tcp_output(tp); + (void) tcp_output(tp); return; dropwithreset: @@ -1484,8 +1468,8 @@ dropwithreset: tcp_respond(tp, ti, m, (tcp_seq)0, ti->ti_ack, TH_RST); else { if (tiflags & TH_SYN) ti->ti_len++; - tcp_respond(tp, ti, m, ti->ti_seq + ti->ti_len, (tcp_seq)0, - TH_RST | TH_ACK); + tcp_respond(tp, ti, m, ti->ti_seq+ti->ti_len, (tcp_seq)0, + TH_RST|TH_ACK); } return; @@ -1504,7 +1488,11 @@ drop: * u_int32_t *ts_val, *ts_ecr; */ void -tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) +tcp_dooptions(tp, cp, cnt, ti) + struct tcpcb *tp; + u_char *cp; + int cnt; + struct tcpiphdr *ti; { u_int16_t mss; int opt, optlen; @@ -1535,7 +1523,7 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) continue; memcpy((char *) &mss, (char *) cp + 2, sizeof(mss)); NTOHS(mss); - tcp_mss(tp, mss); /* sets t_maxseg */ + (void) tcp_mss(tp, mss); /* sets t_maxseg */ break; /* case TCPOPT_WINDOW: @@ -1580,7 +1568,11 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) #ifdef notdef -void tcp_pulloutofband(struct socket *so, struct tcpiphdr *ti, register struct mbuf *m) +void +tcp_pulloutofband(so, ti, m) + struct socket *so; + struct tcpiphdr *ti; + register struct mbuf *m; { int cnt = ti->ti_urp - 1; @@ -1610,7 +1602,10 @@ void tcp_pulloutofband(struct socket *so, struct tcpiphdr *ti, register struct m * and update averages and current timeout. */ -void tcp_xmit_timer(register struct tcpcb *tp, int rtt) +void +tcp_xmit_timer(tp, rtt) + register struct tcpcb *tp; + int rtt; { register short delta; @@ -1697,10 +1692,13 @@ void tcp_xmit_timer(register struct tcpcb *tp, int rtt) * parameters from pre-set or cached values in the routing entry. */ -u_int tcp_mss(register struct tcpcb *tp, u_int offer) +int +tcp_mss(tp, offer) + register struct tcpcb *tp; + u_int offer; { struct socket *so = tp->t_socket; - u_int mss; + int mss; DEBUG_CALL("tcp_mss"); DEBUG_ARG("tp = %lx", (long)tp); diff --git a/BasiliskII/src/slirp/tcp_output.c b/BasiliskII/src/slirp/tcp_output.c old mode 100644 new mode 100755 index 01df0118..5cb1a61e --- a/BasiliskII/src/slirp/tcp_output.c +++ b/BasiliskII/src/slirp/tcp_output.c @@ -63,7 +63,9 @@ u_char tcp_outflags[TCP_NSTATES] = { /* * Tcp output routine: figure out what should be sent and send it. */ -int tcp_output(register struct tcpcb *tp) +int +tcp_output(tp) + register struct tcpcb *tp; { register struct socket *so = tp->t_socket; register long len, win; @@ -124,7 +126,7 @@ again: * to send then the probe will be the FIN * itself. */ - if (off < (int)so->so_snd.sb_cc) + if (off < so->so_snd.sb_cc) flags &= ~TH_FIN; win = 1; } else { @@ -199,12 +201,12 @@ again: * taking into account that we are limited by * TCP_MAXWIN << tp->rcv_scale. */ - long adv = min(win, TCP_MAXWIN << tp->rcv_scale) - + long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) - (tp->rcv_adv - tp->rcv_nxt); - if (adv >= (long)(2 * tp->t_maxseg)) + if (adv >= (long) (2 * tp->t_maxseg)) goto send; - if (2 * adv >= (long)so->so_rcv.sb_datalen) + if (2 * adv >= (long) so->so_rcv.sb_datalen) goto send; } @@ -357,7 +359,7 @@ send: */ /* if (len <= MHLEN - hdrlen - max_linkhdr) { */ - sbcopy(&so->so_snd, off, len, mtod(m, caddr_t) + hdrlen); + sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); m->m_len += len; /* } else { @@ -433,12 +435,12 @@ send: * Calculate receive window. Don't shrink window, * but avoid silly window syndrome. */ - if (win < (so->so_rcv.sb_datalen / 4) && win < tp->t_maxseg) + if (win < (long)(so->so_rcv.sb_datalen / 4) && win < (long)tp->t_maxseg) win = 0; - if (win > (u_long) (TCP_MAXWIN << tp->rcv_scale)) - win = (u_long) (TCP_MAXWIN << tp->rcv_scale); - if (win < (tp->rcv_adv - tp->rcv_nxt)) - win = (tp->rcv_adv - tp->rcv_nxt); + if (win > (long)TCP_MAXWIN << tp->rcv_scale) + win = (long)TCP_MAXWIN << tp->rcv_scale; + if (win < (long)(tp->rcv_adv - tp->rcv_nxt)) + win = (long)(tp->rcv_adv - tp->rcv_nxt); ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale)); if (SEQ_GT(tp->snd_up, tp->snd_una)) { @@ -528,7 +530,7 @@ send: { - ((struct ip *)ti)->ip_len = (u_int16_t) m->m_len; + ((struct ip *)ti)->ip_len = m->m_len; ((struct ip *)ti)->ip_ttl = ip_defttl; ((struct ip *)ti)->ip_tos = so->so_iptos; @@ -579,7 +581,9 @@ out: return (0); } -void tcp_setpersist(register struct tcpcb *tp) +void +tcp_setpersist(tp) + register struct tcpcb *tp; { int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; diff --git a/BasiliskII/src/slirp/tcp_subr.c b/BasiliskII/src/slirp/tcp_subr.c old mode 100644 new mode 100755 index 70e04b5e..39135080 --- a/BasiliskII/src/slirp/tcp_subr.c +++ b/BasiliskII/src/slirp/tcp_subr.c @@ -46,13 +46,14 @@ int tcp_mssdflt = TCP_MSS; int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; int tcp_do_rfc1323 = 0; /* Don't do rfc1323 performance enhancements */ -size_t tcp_rcvspace; /* You may want to change this */ -size_t tcp_sndspace; /* Keep small if you have an error prone link */ +int tcp_rcvspace; /* You may want to change this */ +int tcp_sndspace; /* Keep small if you have an error prone link */ /* * Tcp initialization */ -void tcp_init() +void +tcp_init() { tcp_iss = 1; /* wrong */ tcb.so_next = tcb.so_prev = &tcb; @@ -73,12 +74,14 @@ void tcp_init() * necessary when the connection is used. */ /* struct tcpiphdr * */ -void tcp_template(struct tcpcb *tp) +void +tcp_template(tp) + struct tcpcb *tp; { struct socket *so = tp->t_socket; register struct tcpiphdr *n = &tp->t_template; - n->ti_next = n->ti_prev = 0; + n->ti_mbuf = NULL; n->ti_x1 = 0; n->ti_pr = IPPROTO_TCP; n->ti_len = htons(sizeof (struct tcpiphdr) - sizeof (struct ip)); @@ -110,8 +113,13 @@ void tcp_template(struct tcpcb *tp) * In any case the ack and sequence number of the transmitted * segment are as specified by the parameters. */ -void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti, - register struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) +void +tcp_respond(tp, ti, m, ack, seq, flags) + struct tcpcb *tp; + register struct tcpiphdr *ti; + register struct mbuf *m; + tcp_seq ack, seq; + int flags; { register int tlen; int win = 0; @@ -156,7 +164,7 @@ void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti, tlen += sizeof (struct tcpiphdr); m->m_len = tlen; - ti->ti_next = ti->ti_prev = 0; + ti->ti_mbuf = 0; ti->ti_x1 = 0; ti->ti_seq = htonl(seq); ti->ti_ack = htonl(ack); @@ -185,7 +193,9 @@ void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti, * empty reassembly queue and hooking it to the argument * protocol control block. */ -struct tcpcb *tcp_newtcpcb(struct socket *so) +struct tcpcb * +tcp_newtcpcb(so) + struct socket *so; { register struct tcpcb *tp; @@ -194,7 +204,7 @@ struct tcpcb *tcp_newtcpcb(struct socket *so) return ((struct tcpcb *)0); memset((char *) tp, 0, sizeof(struct tcpcb)); - tp->seg_next = tp->seg_prev = (tcpiphdrp_32)tp; + tp->seg_next = tp->seg_prev = (struct tcpiphdr*)tp; tp->t_maxseg = tcp_mssdflt; tp->t_flags = tcp_do_rfc1323 ? (TF_REQ_SCALE|TF_REQ_TSTMP) : 0; @@ -258,7 +268,9 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err) * discard internet protocol block * wake up any sleepers */ -struct tcpcb *tcp_close(register struct tcpcb *tp) +struct tcpcb * +tcp_close(tp) + register struct tcpcb *tp; { register struct tcpiphdr *t; struct socket *so = tp->t_socket; @@ -268,11 +280,11 @@ struct tcpcb *tcp_close(register struct tcpcb *tp) DEBUG_ARG("tp = %lx", (long )tp); /* free the reassembly queue, if any */ - t = (struct tcpiphdr *) tp->seg_next; - while (t != (struct tcpiphdr *)tp) { - t = (struct tcpiphdr *)t->ti_next; - m = (struct mbuf *) REASS_MBUF((struct tcpiphdr *)t->ti_prev); - remque_32((struct tcpiphdr *) t->ti_prev); + t = tcpfrag_list_first(tp); + while (!tcpfrag_list_end(t, tp)) { + t = tcpiphdr_next(t); + m = tcpiphdr_prev(t)->ti_mbuf; + remque(tcpiphdr2qlink(tcpiphdr_prev(t))); m_freem(m); } /* It's static */ @@ -294,7 +306,8 @@ struct tcpcb *tcp_close(register struct tcpcb *tp) return ((struct tcpcb *)0); } -void tcp_drain() +void +tcp_drain() { /* XXX */ } @@ -306,7 +319,10 @@ void tcp_drain() #ifdef notdef -void tcp_quench(int i, int errno) +void +tcp_quench(i, errno) + + int errno; { struct tcpcb *tp = intotcpcb(inp); @@ -330,7 +346,9 @@ void tcp_quench(int i, int errno) * for peer to send FIN or not respond to keep-alives, etc. * We can let the user exit from the close as soon as the FIN is acked. */ -void tcp_sockclosed(struct tcpcb *tp) +void +tcp_sockclosed(tp) + struct tcpcb *tp; { DEBUG_CALL("tcp_sockclosed"); @@ -371,7 +389,8 @@ void tcp_sockclosed(struct tcpcb *tp) * nonblocking. Connect returns after the SYN is sent, and does * not wait for ACK+SYN. */ -int tcp_fconnect(struct socket *so) +int tcp_fconnect(so) + struct socket *so; { int ret=0; @@ -404,12 +423,10 @@ int tcp_fconnect(struct socket *so) } else addr.sin_addr = so->so_faddr; addr.sin_port = so->so_fport; - - char addrstr[INET_ADDRSTRLEN]; + DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, " "addr.sin_addr.s_addr=%.16s\n", - ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr, - addrstr, sizeof(addrstr)))); + ntohs(addr.sin_port), inet_ntoa(addr.sin_addr))); /* We don't care what port we get */ ret = connect(s,(struct sockaddr *)&addr,sizeof (addr)); @@ -435,7 +452,9 @@ int tcp_fconnect(struct socket *so) * the time it gets to accept(), so... We simply accept * here and SYN the local-host. */ -void tcp_connect(struct socket *inso) +void +tcp_connect(inso) + struct socket *inso; { struct socket *so; struct sockaddr_in addr; @@ -467,7 +486,7 @@ void tcp_connect(struct socket *inso) so->so_lport = inso->so_lport; } - tcp_mss(sototcpcb(so), 0); + (void) tcp_mss(sototcpcb(so), 0); if ((s = accept(inso->s,(struct sockaddr *)&addr,&addrlen)) < 0) { tcp_close(sototcpcb(so)); /* This will sofree() as well */ @@ -520,7 +539,9 @@ void tcp_connect(struct socket *inso) /* * Attach a TCPCB to a socket. */ -int tcp_attach(struct socket *so) +int +tcp_attach(so) + struct socket *so; { if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL) return -1; @@ -554,7 +575,9 @@ struct emu_t *tcpemu = 0; /* * Return TOS according to the above table */ -u_int8_t tcp_tos(struct socket *so) +u_int8_t +tcp_tos(so) + struct socket *so; { int i = 0; struct emu_t *emup; @@ -606,7 +629,10 @@ int do_echo = -1; * * NOTE: if you return 0 you MUST m_free() the mbuf! */ -int tcp_emu(struct socket *so, struct mbuf *m) +int +tcp_emu(so, m) + struct socket *so; + struct mbuf *m; { u_int n1, n2, n3, n4, n5, n6; char buff[256]; @@ -807,7 +833,7 @@ int tcp_emu(struct socket *so, struct mbuf *m) ns->so_laddr=so->so_laddr; ns->so_lport=htons(port); - tcp_mss(sototcpcb(ns), 0); + (void) tcp_mss(sototcpcb(ns), 0); ns->so_faddr=so->so_faddr; ns->so_fport=htons(IPPORT_RESERVED-1); /* Use a fake port. */ @@ -1034,7 +1060,7 @@ do_prompt: * of the connection as a NUL-terminated decimal ASCII string. */ so->so_emu = 0; - for (lport = 0, i = 0; i < (int) (m->m_len-1); ++i) { + for (lport = 0, i = 0; i < m->m_len-1; ++i) { if (m->m_data[i] < '0' || m->m_data[i] > '9') return 1; /* invalid number */ lport *= 10; @@ -1219,7 +1245,9 @@ do_prompt: * Return 0 if this connections is to be closed, 1 otherwise, * return 2 if this is a command-line connection */ -int tcp_ctl(struct socket *so) +int +tcp_ctl(so) + struct socket *so; { struct sbuf *sb = &so->so_snd; int command; diff --git a/BasiliskII/src/slirp/tcp_timer.c b/BasiliskII/src/slirp/tcp_timer.c old mode 100644 new mode 100755 diff --git a/BasiliskII/src/slirp/tcp_timer.h b/BasiliskII/src/slirp/tcp_timer.h old mode 100644 new mode 100755 index 73fe2089..0bc438c7 --- a/BasiliskII/src/slirp/tcp_timer.h +++ b/BasiliskII/src/slirp/tcp_timer.h @@ -130,9 +130,9 @@ extern int tcp_backoff[]; struct tcpcb; -void tcp_fasttimo(void); -void tcp_slowtimo(void); -void tcp_canceltimers(struct tcpcb *); -struct tcpcb * tcp_timers(register struct tcpcb *, int); +void tcp_fasttimo _P((void)); +void tcp_slowtimo _P((void)); +void tcp_canceltimers _P((struct tcpcb *)); +struct tcpcb * tcp_timers _P((register struct tcpcb *, int)); #endif diff --git a/BasiliskII/src/slirp/tcp_var.h b/BasiliskII/src/slirp/tcp_var.h old mode 100644 new mode 100755 index c8e99ae0..064ac69a --- a/BasiliskII/src/slirp/tcp_var.h +++ b/BasiliskII/src/slirp/tcp_var.h @@ -36,18 +36,12 @@ #include "tcpip.h" #include "tcp_timer.h" -#if SIZEOF_CHAR_P == 4 - typedef struct tcpiphdr *tcpiphdrp_32; -#else - typedef u_int32_t tcpiphdrp_32; -#endif - /* * Tcp control block, one per tcp; fields: */ struct tcpcb { - tcpiphdrp_32 seg_next; /* sequencing queue */ - tcpiphdrp_32 seg_prev; + struct tcpiphdr *seg_next; /* sequencing queue */ + struct tcpiphdr *seg_prev; short t_state; /* state of this connection */ short t_timer[TCPT_NTIMERS]; /* tcp timers */ short t_rxtshift; /* log(2) of rexmt exp. backoff */ @@ -166,21 +160,6 @@ struct tcpcb { #define TCP_REXMTVAL(tp) \ (((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) -/* XXX - * We want to avoid doing m_pullup on incoming packets but that - * means avoiding dtom on the tcp reassembly code. That in turn means - * keeping an mbuf pointer in the reassembly queue (since we might - * have a cluster). As a quick hack, the source & destination - * port numbers (which are no longer needed once we've located the - * tcpcb) are overlayed with an mbuf pointer. - */ -#if SIZEOF_CHAR_P == 4 -typedef struct mbuf *mbufp_32; -#else -typedef u_int32_t mbufp_32; -#endif -#define REASS_MBUF(ti) (*(mbufp_32 *)&((ti)->ti_t)) - /* * TCP statistics. * Many of these should be kept per connection, diff --git a/BasiliskII/src/slirp/tcpip.h b/BasiliskII/src/slirp/tcpip.h old mode 100644 new mode 100755 index dff5a3c9..7974ce3d --- a/BasiliskII/src/slirp/tcpip.h +++ b/BasiliskII/src/slirp/tcpip.h @@ -40,8 +40,7 @@ struct tcpiphdr { struct ipovly ti_i; /* overlaid ip structure */ struct tcphdr ti_t; /* tcp header */ }; -#define ti_next ti_i.ih_next -#define ti_prev ti_i.ih_prev +#define ti_mbuf ti_i.ih_mbuf.mptr #define ti_x1 ti_i.ih_x1 #define ti_pr ti_i.ih_pr #define ti_len ti_i.ih_len @@ -58,6 +57,14 @@ struct tcpiphdr { #define ti_sum ti_t.th_sum #define ti_urp ti_t.th_urp +#define tcpiphdr2qlink(T) ((struct qlink*)(((char*)(T)) - sizeof(struct qlink))) +#define qlink2tcpiphdr(Q) ((struct tcpiphdr*)(((char*)(Q)) + sizeof(struct qlink))) +#define tcpiphdr_next(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->next) +#define tcpiphdr_prev(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->prev) +#define tcpfrag_list_first(T) qlink2tcpiphdr((T)->seg_next) +#define tcpfrag_list_end(F, T) (tcpiphdr2qlink(F) == (struct qlink*)(T)) +#define tcpfrag_list_empty(T) ((T)->seg_next == (struct tcpiphdr*)(T)) + /* * Just a clean way to get to the first byte * of the packet diff --git a/BasiliskII/src/slirp/tftp.c b/BasiliskII/src/slirp/tftp.c old mode 100644 new mode 100755 index 3ba2971c..e656c4f0 --- a/BasiliskII/src/slirp/tftp.c +++ b/BasiliskII/src/slirp/tftp.c @@ -127,6 +127,7 @@ static int tftp_send_error(struct tftp_session *spt, struct sockaddr_in saddr, daddr; struct mbuf *m; struct tftp_t *tp; + int nobytes; m = m_get(); @@ -151,6 +152,8 @@ static int tftp_send_error(struct tftp_session *spt, daddr.sin_addr = spt->client_ip; daddr.sin_port = spt->client_port; + nobytes = 2; + m->m_len = sizeof(struct tftp_t) - 514 + 3 + strlen(msg) - sizeof(struct ip) - sizeof(struct udphdr); diff --git a/BasiliskII/src/slirp/tftp.h b/BasiliskII/src/slirp/tftp.h old mode 100644 new mode 100755 index b150a049..f89e0393 --- a/BasiliskII/src/slirp/tftp.h +++ b/BasiliskII/src/slirp/tftp.h @@ -34,7 +34,7 @@ struct tftp_t { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif void tftp_input(struct mbuf *m); diff --git a/BasiliskII/src/slirp/udp.c b/BasiliskII/src/slirp/udp.c old mode 100644 new mode 100755 index deedb1e7..7917aaa4 --- a/BasiliskII/src/slirp/udp.c +++ b/BasiliskII/src/slirp/udp.c @@ -128,8 +128,7 @@ udp_input(m, iphlen) * Checksum extended UDP header and data. */ if (udpcksum && uh->uh_sum) { - ((struct ipovly *)ip)->ih_next = 0; - ((struct ipovly *)ip)->ih_prev = 0; + memset(&((struct ipovly *)ip)->ih_mbuf, 0, sizeof(struct mbuf_ptr)); ((struct ipovly *)ip)->ih_x1 = 0; ((struct ipovly *)ip)->ih_len = uh->uh_ulen; /* keep uh_sum for ICMP reply @@ -272,10 +271,10 @@ int udp_output2(struct socket *so, struct mbuf *m, * and addresses and length put into network format. */ ui = mtod(m, struct udpiphdr *); - ui->ui_next = ui->ui_prev = 0; + memset(&ui->ui_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); ui->ui_x1 = 0; ui->ui_pr = IPPROTO_UDP; - ui->ui_len = htons((u_short) (m->m_len - sizeof(struct ip))); /* + sizeof (struct udphdr)); */ + ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* + sizeof (struct udphdr)); */ /* XXXXX Check for from-one-location sockets, or from-any-location sockets */ ui->ui_src = saddr->sin_addr; ui->ui_dst = daddr->sin_addr; @@ -291,7 +290,7 @@ int udp_output2(struct socket *so, struct mbuf *m, if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0) ui->ui_sum = 0xffff; } - ((struct ip *)ui)->ip_len = (u_int16_t) m->m_len; + ((struct ip *)ui)->ip_len = m->m_len; ((struct ip *)ui)->ip_ttl = ip_defttl; ((struct ip *)ui)->ip_tos = iptos; @@ -338,10 +337,14 @@ udp_attach(so) addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; if(bind(so->s, (struct sockaddr *)&addr, sizeof(addr))<0) { - int error = WSAGetLastError(); + int lasterrno=errno; closesocket(so->s); so->s=-1; - WSASetLastError(error); +#ifdef _WIN32 + WSASetLastError(lasterrno); +#else + errno=lasterrno; +#endif } else { /* success, insert in queue */ so->so_expire = curtime + SO_EXPIRE; diff --git a/BasiliskII/src/slirp/udp.h b/BasiliskII/src/slirp/udp.h old mode 100644 new mode 100755 index 7d844efe..639a2f2c --- a/BasiliskII/src/slirp/udp.h +++ b/BasiliskII/src/slirp/udp.h @@ -54,7 +54,7 @@ struct udphdr { } PACKED__; #ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(PACK_RESET) +#pragma pack(0) #endif /* @@ -64,8 +64,7 @@ struct udpiphdr { struct ipovly ui_i; /* overlaid ip structure */ struct udphdr ui_u; /* udp header */ }; -#define ui_next ui_i.ih_next -#define ui_prev ui_i.ih_prev +#define ui_mbuf ui_i.ih_mbuf.mptr #define ui_x1 ui_i.ih_x1 #define ui_pr ui_i.ih_pr #define ui_len ui_i.ih_len @@ -100,14 +99,14 @@ extern struct udpstat udpstat; extern struct socket udb; struct mbuf; -void udp_init(void); -void udp_input(register struct mbuf *, int); -int udp_output(struct socket *, struct mbuf *, struct sockaddr_in *); -int udp_attach(struct socket *); -void udp_detach(struct socket *); -u_int8_t udp_tos(struct socket *); -void udp_emu(struct socket *, struct mbuf *); -struct socket * udp_listen(u_int, u_int32_t, u_int, int); +void udp_init _P((void)); +void udp_input _P((register struct mbuf *, int)); +int udp_output _P((struct socket *, struct mbuf *, struct sockaddr_in *)); +int udp_attach _P((struct socket *)); +void udp_detach _P((struct socket *)); +u_int8_t udp_tos _P((struct socket *)); +void udp_emu _P((struct socket *, struct mbuf *)); +struct socket * udp_listen _P((u_int, u_int32_t, u_int, int)); int udp_output2(struct socket *so, struct mbuf *m, struct sockaddr_in *saddr, struct sockaddr_in *daddr, int iptos); diff --git a/BasiliskII/src/timer.cpp b/BasiliskII/src/timer.cpp index 1383d8ee..316d8d38 100644 --- a/BasiliskII/src/timer.cpp +++ b/BasiliskII/src/timer.cpp @@ -173,7 +173,7 @@ void TimerReset(void) int16 InsTime(uint32 tm, uint16 trap) { D(bug("InsTime %08lx, trap %04x\n", tm, trap)); - WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x1fff | (trap << 4) & 0x6000); + WriteMacInt16(tm + qType, (ReadMacInt16(tm + qType) & 0x1fff) | ((trap << 4) & 0x6000)); if (find_desc(tm) >= 0) printf("WARNING: InsTime(): Task re-inserted\n"); else { diff --git a/BasiliskII/src/uae_cpu/gencpu.c b/BasiliskII/src/uae_cpu/gencpu.c index 1653adab..5045dffd 100644 --- a/BasiliskII/src/uae_cpu/gencpu.c +++ b/BasiliskII/src/uae_cpu/gencpu.c @@ -2189,14 +2189,14 @@ static void gen_opcode (unsigned long int opcode) case i_CINVA: /* gb-- srcreg now contains the cache field */ printf ("\tif (srcreg&0x2)\n"); - printf ("\t\tflush_icache(%d);\n", 30 + ((opcode >> 3) & 3)); + printf ("\t\tflush_icache(%d);\n", (int)(30 + ((opcode >> 3) & 3))); break; case i_CPUSHL: case i_CPUSHP: case i_CPUSHA: /* gb-- srcreg now contains the cache field */ printf ("\tif (srcreg&0x2)\n"); - printf ("\t\tflush_icache(%d);\n", 40 + ((opcode >> 3) & 3)); + printf ("\t\tflush_icache(%d);\n", (int)(40 + ((opcode >> 3) & 3))); break; case i_MOVE16: if ((opcode & 0xfff8) == 0xf620) { diff --git a/BasiliskII/src/video.cpp b/BasiliskII/src/video.cpp index 8f84f48d..3b46864e 100644 --- a/BasiliskII/src/video.cpp +++ b/BasiliskII/src/video.cpp @@ -48,6 +48,23 @@ uint8 monitor_desc::next_slot_id = 0x80; vector VideoMonitors; +/* + * Converts a video_depth to a C-String name ("VDEPTH_1BIT", "VDEPTH_2BIT", etc.) + */ +const char * NameOfDepth(video_depth depth) +{ + switch (depth) { + case VDEPTH_1BIT: return "VDEPTH_1BIT"; + case VDEPTH_2BIT: return "VDEPTH_2BIT"; + case VDEPTH_4BIT: return "VDEPTH_4BIT"; + case VDEPTH_8BIT: return "VDEPTH_8BIT"; + case VDEPTH_16BIT: return "VDEPTH_16BIT"; + case VDEPTH_32BIT: return "VDEPTH_32BIT"; + } + return ""; +} + + /* * Find palette size for given color depth */ diff --git a/SheepShaver/src/MacOSX/Launcher/Info.plist b/SheepShaver/src/MacOSX/Launcher/Info.plist index 54bcb8dd..7c2c94bf 100644 --- a/SheepShaver/src/MacOSX/Launcher/Info.plist +++ b/SheepShaver/src/MacOSX/Launcher/Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile SheepShaver.icns CFBundleIdentifier - net.sourceforge.SheepShaverLauncher + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj b/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj index fe382f61..abfe0315 100644 --- a/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj +++ b/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj @@ -10,7 +10,7 @@ 084186B10B3A0515004B1F63 /* VMSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 084186B00B3A0515004B1F63 /* VMSettingsController.mm */; }; 088EBBB61B41AEBB0066D352 /* DiskType.m in Sources */ = {isa = PBXBuildFile; fileRef = 088EBBB51B41AEBB0066D352 /* DiskType.m */; }; 08AAB16D102614D5007E1230 /* SheepShaver.icns in Resources */ = {isa = PBXBuildFile; fileRef = 08AAB16C102614D5007E1230 /* SheepShaver.icns */; }; - 08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */ = {isa = PBXBuildFile; fileRef = 08AAB1B11026168B007E1230 /* SheepShaver */; }; + 08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */ = {isa = PBXBuildFile; fileRef = 08AAB1B11026168B007E1230 /* SheepShaver */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 08B5FAFD102497FA0047FD1B /* VMSettingsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFB102497FA0047FD1B /* VMSettingsWindow.nib */; }; 08B5FB01102498B00047FD1B /* VMListWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFF102498B00047FD1B /* VMListWindow.nib */; }; 08B5FB221024FE320047FD1B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08B5FB211024FE320047FD1B /* AppController.mm */; }; @@ -209,6 +209,9 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0900; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverLauncher" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; @@ -310,11 +313,13 @@ PREFS_EDITOR, STANDALONE_PREFS, ); - GCC_VERSION = 4.0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; OTHER_CFLAGS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverLauncher; PRODUCT_NAME = SheepShaverLauncher; + SDKROOT = macosx; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -324,11 +329,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - x86_64, - ); COPY_PHASE_STRIP = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; @@ -337,15 +337,17 @@ PREFS_EDITOR, STANDALONE_PREFS, ); - GCC_VERSION = 4.0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; "GCC_VERSION[arch=x86_64]" = 4.2; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; OTHER_CFLAGS = "$(inherited)"; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverLauncher; PRODUCT_NAME = SheepShaverLauncher; - "SDKROOT[arch=x86_64]" = macosx10.6; + SDKROOT = macosx; + "SDKROOT[arch=x86_64]" = macosx10.13; WRAPPER_EXTENSION = app; }; name = Release; @@ -353,8 +355,33 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; @@ -363,10 +390,33 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_PREFIX_HEADER = LauncherPrefix.h; GCC_VERSION = 4.0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; PREBINDING = NO; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; diff --git a/SheepShaver/src/MacOSX/PrefsEditor/Info.plist b/SheepShaver/src/MacOSX/PrefsEditor/Info.plist index 68215486..dfaec90d 100644 --- a/SheepShaver/src/MacOSX/PrefsEditor/Info.plist +++ b/SheepShaver/src/MacOSX/PrefsEditor/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - net.sourceforge.SheepShaverPrefs + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm b/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm index 29b48305..ca833b45 100644 --- a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm +++ b/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm @@ -54,12 +54,12 @@ void prefs_exit() return self; } -- (int)numberOfRowsInTableView:(NSTableView *)aTable +- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTable { return [diskArray count]; } -- (id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(int)aRow +- (id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow { return [diskArray objectAtIndex: aRow]; } diff --git a/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj b/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj index 92ed7a0e..38729ece 100644 --- a/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj +++ b/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 45; objects = { /* Begin PBXBuildFile section */ @@ -161,10 +161,19 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0900; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverPrefs" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = en; hasScannedForEncodings = 1; + knownRegions = ( + en, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* SheepShaverPrefs */; projectDirPath = ""; + projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* SheepShaverPrefs */, ); @@ -234,7 +243,9 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; OTHER_CFLAGS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverPrefs; PRODUCT_NAME = SheepShaverPrefs; + SDKROOT = macosx; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -243,10 +254,6 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_MODEL_TUNING = G5; @@ -257,7 +264,9 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; OTHER_CFLAGS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverPrefs; PRODUCT_NAME = SheepShaverPrefs; + SDKROOT = macosx; WRAPPER_EXTENSION = app; }; name = Release; @@ -265,20 +274,66 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; name = Release; }; diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac old mode 100644 new mode 100755 index 006fe872..4663f90d --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -46,7 +46,7 @@ AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [d esac], [WANT_GTK="gtk2 gtk"]) AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) -AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes or 'precompiled'], [DYNGEN_CC=$withval]) +AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) AC_ARG_WITH(bincue, AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode])) @@ -72,6 +72,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphic AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) +AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) dnl Checks for programs. AC_PROG_CC @@ -144,7 +145,7 @@ dnl Checks for libraries. AC_CHECK_LIB(posix4, sem_init) AC_CHECK_LIB(m, cos) -dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES) +dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES, $3=ACTION_IF_SUCCESSFUL, $4=ACTION_IF_UNSUCCESSFUL) dnl AC_TRY_LINK uses main() but SDL needs main to take args, dnl therefore main is undefined with #undef. dnl Framework can be in an custom location. @@ -154,18 +155,16 @@ AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [ ac_Framework, [ saved_LIBS="$LIBS" LIBS="$LIBS -framework $1" - if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then - if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then - LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" - fi + if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then + LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" fi saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers" + CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/$1.framework/Headers" AC_TRY_LINK( [$2 #undef main], [], - [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); -LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"] + [AS_VAR_SET(ac_Framework, yes); $3], [AS_VAR_SET(ac_Framework, no); +LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"; $4] ) ]) AS_IF([test AS_VAR_GET(ac_Framework) = yes], @@ -189,27 +188,65 @@ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then fi if [[ "x$WANT_SDL" = "xyes" ]]; then if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then - AC_CHECK_SDLFRAMEWORK(SDL, [#include ]) + TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then + TEMP_WANT_SDL_VERSION_MAJOR=2 + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then + AC_CHECK_SDLFRAMEWORK(SDL2, [#include ], [ + WANT_SDL_VERSION_MAJOR=2 + ], [ + TEMP_WANT_SDL_VERSION_MAJOR=1 + ]) + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then + AC_CHECK_SDLFRAMEWORK(SDL, [#include ], [ + WANT_SDL_VERSION_MAJOR=1 + ]) + fi else ac_cv_framework_SDL=no fi if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then - AC_PATH_PROG(sdl_config, "sdl-config") - if [[ -n "$sdl_config" ]]; then - sdl_cflags=`$sdl_config --cflags` - if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then - sdl_libs=`$sdl_config --static-libs` + TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then + TEMP_WANT_SDL_VERSION_MAJOR=2 + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then + AC_PATH_PROG(sdl2_config, "sdl2-config") + if [[ -n "$sdl2_config" ]]; then + sdl2_cflags=`$sdl2_config --cflags` + if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then + sdl2_libs=`$sdl2_config --static-libs` + else + sdl2_libs=`$sdl2_config --libs` + fi + CFLAGS="$CFLAGS $sdl2_cflags" + CXXFLAGS="$CXXFLAGS $sdl2_cflags" + LIBS="$LIBS $sdl2_libs" + WANT_SDL_VERSION_MAJOR=2 else - sdl_libs=`$sdl_config --libs` + TEMP_WANT_SDL_VERSION_MAJOR=1 + fi + fi + if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then + AC_PATH_PROG(sdl_config, "sdl-config") + if [[ -n "$sdl_config" ]]; then + sdl_cflags=`$sdl_config --cflags` + if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then + sdl_libs=`$sdl_config --static-libs` + else + sdl_libs=`$sdl_config --libs` + fi + CFLAGS="$CFLAGS $sdl_cflags" + CXXFLAGS="$CXXFLAGS $sdl_cflags" + LIBS="$LIBS $sdl_libs" + WANT_SDL_VERSION_MAJOR=1 + else + WANT_SDL=no + WANT_SDL_VIDEO=no + WANT_SDL_AUDIO=no fi - CFLAGS="$CFLAGS $sdl_cflags" - CXXFLAGS="$CXXFLAGS $sdl_cflags" - LIBS="$LIBS $sdl_libs" - else - WANT_SDL=no - WANT_SDL_VIDEO=no - WANT_SDL_AUDIO=no - SDL_SUPPORT="none" fi fi SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` @@ -658,12 +695,10 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no]) AS_IF([test "x$have_bincue" = "xyes" ], [ if [[ "xOSX_CORE_AUDIO" = "xno" -a "x$WANT_SDL_AUDIO"="xno" ]]; then AC_MSG_ERROR([You need SDL or OSX Core Audio to use BINCUE support.]) - AC_SUBST(USE_BINCUE, no) else CPPFLAGS="$CPPFLAGS -DBINCUE $OSX_CORE_AUDIO" - AC_SUBST(USE_BINCUE, yes) fi -], [AC_SUBST(USE_BINCUE, no)]) +]) dnl LIBVHD AS_IF([test "x$with_libvhd" = "xyes" ], [have_libvhd=yes], [have_libvhd=no]) @@ -705,13 +740,10 @@ AC_SUBST(SLIRP_SRCS) dnl SDL overrides if [[ "x$WANT_SDL" = "xyes" ]]; then AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) - if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m" - fi fi if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) - VIDEOSRCS="../SDL/video_sdl.cpp" + VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp" KEYCODES="../SDL/keycodes" if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then AC_MSG_CHECKING([whether __LP64__ is defined]) @@ -1435,17 +1467,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) [AC_MSG_RESULT(yes); HAVE_GCC30=yes], [AC_MSG_RESULT(no)]) -dnl Check for GCC 4.0 or higher. -HAVE_GCC40=no -AC_MSG_CHECKING(for GCC 4.0 or higher) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 4) - # error gcc < 4 - typedef syntax error; - #endif - ]])], - [AC_MSG_RESULT(yes); HAVE_GCC40=yes], - [AC_MSG_RESULT(no)]) - dnl Check for ICC. AC_MSG_CHECKING(for ICC) HAVE_ICC=no @@ -1518,7 +1539,6 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then dnl Enable JIT compiler, if possible if [[ "x$WANT_JIT" = "xyes" ]]; then - ac_cv_use_dyngen_precompiled=no AC_CACHE_CHECK([whether dyngen can be used], ac_cv_use_dyngen, [ case $host_cpu:$ac_cv_object_format in @@ -1549,30 +1569,20 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then esac dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) if [[ -z "$DYNGEN_CC" ]]; then - if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_GCC40" = "xno" -a "x$HAVE_ICC" = "xno" ]]; then + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then DYNGEN_CC=$CXX - elif command -v g++ >/dev/null; then - vers=`g++ -dumpversion` - function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } - if [[ $(version $vers) -ge $(version "2.7.0") ]] && [[ $(version $vers) -lt $(version "4.0.0") ]]; then - DYNGEN_CC="$gxx" - fi + else + for p in /usr/bin /usr/local/bin /usr/freeware/bin; do + gxx="$p/g++" + if [[ -x "$gxx" ]]; then + DYNGEN_CC="$gxx" + fi + done fi fi - if [[ -z "$DYNGEN_CC" -o "x$DYNGEN_CC" = "xprecompiled" ]]; then - case $host_cpu in - i?86) - ac_cv_use_dyngen_precompiled=yes - ;; - x86_64) - ac_cv_use_dyngen_precompiled=yes - ;; - *) - ac_cv_use_dyngen=no - ;; - esac + if [[ -z "$DYNGEN_CC" ]]; then + ac_cv_use_dyngen=no fi - if [[ "x$ac_cv_use_dyngen_precompiled" = "xyes" ]]; then DYNGEN_CC=precompiled; fi ]) if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then case $host_cpu in @@ -1589,17 +1599,10 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then ;; esac have_dyngen_gcc3=no - if [[ "$DYNGEN_CC" != "precompiled" ]]; then - case "x`$DYNGEN_CC -dumpversion`" in - x[12].*) ;; - x*) have_dyngen_gcc3=yes ;; - esac - else - case "x`$CXX -dumpversion`" in - x[12].*) ;; - x*) have_dyngen_gcc3=yes ;; - esac - fi + case "x`$DYNGEN_CC -dumpversion`" in + x[12].*) ;; + x*) have_dyngen_gcc3=yes ;; + esac if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions" else @@ -1683,7 +1686,6 @@ AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works", dnl Generate Makefile. AC_SUBST(PERL) AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) -AC_SUBST(USE_DYNGEN_PRECOMPILED, [$ac_cv_use_dyngen_precompiled]) AC_SUBST(DYNGENSRCS) AC_SUBST(DYNGEN_CC) AC_SUBST(DYNGEN_CFLAGS) @@ -1703,6 +1705,7 @@ echo echo SheepShaver configuration summary: echo echo SDL support ...................... : $SDL_SUPPORT +echo SDL major-version ................ : $WANT_SDL_VERSION_MAJOR echo BINCUE support ................... : $have_bincue echo LIBVHD support ................... : $have_libvhd echo FBDev DGA support ................ : $WANT_FBDEV_DGA diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp index 7f89a107..2a81e7bd 100644 --- a/SheepShaver/src/Unix/prefs_unix.cpp +++ b/SheepShaver/src/Unix/prefs_unix.cpp @@ -41,6 +41,9 @@ prefs_desc platform_prefs_items[] = { {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, #endif {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, +#ifdef USE_SDL_VIDEO + {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, +#endif {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h index a3cb3278..3cf79b30 100644 --- a/SheepShaver/src/Unix/sysdeps.h +++ b/SheepShaver/src/Unix/sysdeps.h @@ -149,7 +149,7 @@ typedef long int32; #error "No 4 byte type, you lose." #endif #if SIZEOF_LONG == 8 -typedef unsigned long uint64; +typedef uint64_t uint64; typedef long int64; #define VAL64(a) (a ## l) #define UVAL64(a) (a ## ul) @@ -429,7 +429,7 @@ typedef struct timeval tm_time_t; // Timing functions extern uint64 GetTicks_usec(void); -extern void Delay_usec(uint32 usec); +extern void Delay_usec(uint64 usec); #ifdef HAVE_PTHREADS // Setup pthread attributes diff --git a/SheepShaver/src/Unix/timer_unix.cpp b/SheepShaver/src/Unix/timer_unix.cpp deleted file mode 120000 index db93bbd3..00000000 --- a/SheepShaver/src/Unix/timer_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/timer_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/timer_unix.cpp b/SheepShaver/src/Unix/timer_unix.cpp new file mode 100644 index 00000000..97372b49 --- /dev/null +++ b/SheepShaver/src/Unix/timer_unix.cpp @@ -0,0 +1,401 @@ +/* + * timer_unix.cpp - Time Manager emulation, Unix specific stuff + * + * Basilisk II (C) 1997-2008 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sysdeps.h" +#include "macos_util.h" +#include "timer.h" + +#include + +#define DEBUG 0 +#include "debug.h" + +// For NetBSD with broken pthreads headers +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +#if defined(__MACH__) +#include +#include + +static clock_serv_t host_clock; +static bool host_clock_inited = false; + +static inline void mach_current_time(tm_time_t &t) { + if(!host_clock_inited) { + host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &host_clock); + host_clock_inited = true; + } + + clock_get_time(host_clock, (mach_timespec_t *)&t); +} +#endif + + +/* + * Return microseconds since boot (64 bit) + */ + +void Microseconds(uint32 &hi, uint32 &lo) +{ + D(bug("Microseconds\n")); +#if defined(__MACH__) + tm_time_t t; + mach_current_time(t); + uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000; +#elif defined(HAVE_CLOCK_GETTIME) + struct timespec t; + clock_gettime(CLOCK_REALTIME, &t); + uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000; +#else + struct timeval t; + gettimeofday(&t, NULL); + uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_usec; +#endif + hi = tl >> 32; + lo = tl; +} + + +/* + * Return local date/time in Mac format (seconds since 1.1.1904) + */ + +uint32 TimerDateTime(void) +{ + return TimeToMacTime(time(NULL)); +} + + +/* + * Get current time + */ + +void timer_current_time(tm_time_t &t) +{ +#if defined(__MACH__) + mach_current_time(t); +#elif defined(HAVE_CLOCK_GETTIME) + clock_gettime(CLOCK_REALTIME, &t); +#else + gettimeofday(&t, NULL); +#endif +} + + +/* + * Add times + */ + +void timer_add_time(tm_time_t &res, tm_time_t a, tm_time_t b) +{ +#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__) + res.tv_sec = a.tv_sec + b.tv_sec; + res.tv_nsec = a.tv_nsec + b.tv_nsec; + if (res.tv_nsec >= 1000000000) { + res.tv_sec++; + res.tv_nsec -= 1000000000; + } +#else + res.tv_sec = a.tv_sec + b.tv_sec; + res.tv_usec = a.tv_usec + b.tv_usec; + if (res.tv_usec >= 1000000) { + res.tv_sec++; + res.tv_usec -= 1000000; + } +#endif +} + + +/* + * Subtract times + */ + +void timer_sub_time(tm_time_t &res, tm_time_t a, tm_time_t b) +{ +#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__) + res.tv_sec = a.tv_sec - b.tv_sec; + res.tv_nsec = a.tv_nsec - b.tv_nsec; + if (res.tv_nsec < 0) { + res.tv_sec--; + res.tv_nsec += 1000000000; + } +#else + res.tv_sec = a.tv_sec - b.tv_sec; + res.tv_usec = a.tv_usec - b.tv_usec; + if (res.tv_usec < 0) { + res.tv_sec--; + res.tv_usec += 1000000; + } +#endif +} + + +/* + * Compare times (<0: a < b, =0: a = b, >0: a > b) + */ + +int timer_cmp_time(tm_time_t a, tm_time_t b) +{ +#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__) + if (a.tv_sec == b.tv_sec) + return a.tv_nsec - b.tv_nsec; + else + return a.tv_sec - b.tv_sec; +#else + if (a.tv_sec == b.tv_sec) + return a.tv_usec - b.tv_usec; + else + return a.tv_sec - b.tv_sec; +#endif +} + + +/* + * Convert Mac time value (>0: microseconds, <0: microseconds) to tm_time_t + */ + +void timer_mac2host_time(tm_time_t &res, int32 mactime) +{ +#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__) + if (mactime > 0) { + // Time in milliseconds + res.tv_sec = mactime / 1000; + res.tv_nsec = (mactime % 1000) * 1000000; + } else { + // Time in negative microseconds + res.tv_sec = -mactime / 1000000; + res.tv_nsec = (-mactime % 1000000) * 1000; + } +#else + if (mactime > 0) { + // Time in milliseconds + res.tv_sec = mactime / 1000; + res.tv_usec = (mactime % 1000) * 1000; + } else { + // Time in negative microseconds + res.tv_sec = -mactime / 1000000; + res.tv_usec = -mactime % 1000000; + } +#endif +} + + +/* + * Convert positive tm_time_t to Mac time value (>0: microseconds, <0: microseconds) + * A negative input value for hosttime results in a zero return value + * As long as the microseconds value fits in 32 bit, it must not be converted to milliseconds! + */ + +int32 timer_host2mac_time(tm_time_t hosttime) +{ + if (hosttime.tv_sec < 0) + return 0; + else { +#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__) + uint64 t = (uint64)hosttime.tv_sec * 1000000 + hosttime.tv_nsec / 1000; +#else + uint64 t = (uint64)hosttime.tv_sec * 1000000 + hosttime.tv_usec; +#endif + if (t > 0x7fffffff) + return t / 1000; // Time in milliseconds + else + return -t; // Time in negative microseconds + } +} + + +/* + * Get current value of microsecond timer + */ + +uint64 GetTicks_usec(void) +{ +#if defined(__MACH__) + tm_time_t t; + mach_current_time(t); + return (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000; +#elif defined(HAVE_CLOCK_GETTIME) + struct timespec t; + clock_gettime(CLOCK_REALTIME, &t); + return (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000; +#else + struct timeval t; + gettimeofday(&t, NULL); + return (uint64)t.tv_sec * 1000000 + t.tv_usec; +#endif +} + + +/* + * Delay by specified number of microseconds (<1 second) + * (adapted from SDL_Delay() source; this function is designed to provide + * the highest accuracy possible) + */ + +#if defined(linux) +// Linux select() changes its timeout parameter upon return to contain +// the remaining time. Most other unixen leave it unchanged or undefined. +#define SELECT_SETS_REMAINING +#elif defined(__FreeBSD__) || defined(__sun__) || (defined(__MACH__) && defined(__APPLE__)) +#define USE_NANOSLEEP +#elif defined(HAVE_PTHREADS) && defined(sgi) +// SGI pthreads has a bug when using pthreads+signals+nanosleep, +// so instead of using nanosleep, wait on a CV which is never signalled. +#include +#define USE_COND_TIMEDWAIT +#endif + +void Delay_usec(uint64 usec) +{ + int was_error; + +#if defined(USE_NANOSLEEP) + struct timespec elapsed, tv; +#elif defined(USE_COND_TIMEDWAIT) + // Use a local mutex and cv, so threads remain independent + pthread_cond_t delay_cond = PTHREAD_COND_INITIALIZER; + pthread_mutex_t delay_mutex = PTHREAD_MUTEX_INITIALIZER; + struct timespec elapsed; + uint64 future; +#else + struct timeval tv; +#ifndef SELECT_SETS_REMAINING + uint64 then, now, elapsed; +#endif +#endif + + // Set the timeout interval - Linux only needs to do this once +#if defined(SELECT_SETS_REMAINING) + tv.tv_sec = 0; + tv.tv_usec = usec; +#elif defined(USE_NANOSLEEP) + elapsed.tv_sec = 0; + elapsed.tv_nsec = usec * 1000; +#elif defined(USE_COND_TIMEDWAIT) + future = GetTicks_usec() + usec; + elapsed.tv_sec = future / 1000000; + elapsed.tv_nsec = (future % 1000000) * 1000; +#else + then = GetTicks_usec(); +#endif + + do { + errno = 0; +#if defined(USE_NANOSLEEP) + tv.tv_sec = elapsed.tv_sec; + tv.tv_nsec = elapsed.tv_nsec; + was_error = nanosleep(&tv, &elapsed); +#elif defined(USE_COND_TIMEDWAIT) + was_error = pthread_mutex_lock(&delay_mutex); + was_error = pthread_cond_timedwait(&delay_cond, &delay_mutex, &elapsed); + was_error = pthread_mutex_unlock(&delay_mutex); +#else +#ifndef SELECT_SETS_REMAINING + // Calculate the time interval left (in case of interrupt) + now = GetTicks_usec(); + elapsed = now - then; + then = now; + if (elapsed >= usec) + break; + usec -= elapsed; + tv.tv_sec = 0; + tv.tv_usec = usec; +#endif + was_error = select(0, NULL, NULL, NULL, &tv); +#endif + } while (was_error && (errno == EINTR)); +} + + +/* + * Suspend emulator thread, virtual CPU in idle mode + */ + +#ifdef HAVE_PTHREADS +#if defined(HAVE_PTHREAD_COND_INIT) +#define IDLE_USES_COND_WAIT 1 +static pthread_mutex_t idle_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t idle_cond = PTHREAD_COND_INITIALIZER; +#elif defined(HAVE_SEM_INIT) +#define IDLE_USES_SEMAPHORE 1 +#include +#ifdef HAVE_SPINLOCKS +static spinlock_t idle_lock = SPIN_LOCK_UNLOCKED; +#define LOCK_IDLE spin_lock(&idle_lock) +#define UNLOCK_IDLE spin_unlock(&idle_lock) +#else +static pthread_mutex_t idle_lock = PTHREAD_MUTEX_INITIALIZER; +#define LOCK_IDLE pthread_mutex_lock(&idle_lock) +#define UNLOCK_IDLE pthread_mutex_unlock(&idle_lock) +#endif +static sem_t idle_sem; +static int idle_sem_ok = -1; +#endif +#endif + +void idle_wait(void) +{ +#ifdef IDLE_USES_COND_WAIT + pthread_mutex_lock(&idle_lock); + pthread_cond_wait(&idle_cond, &idle_lock); + pthread_mutex_unlock(&idle_lock); +#else +#ifdef IDLE_USES_SEMAPHORE + LOCK_IDLE; + if (idle_sem_ok < 0) + idle_sem_ok = (sem_init(&idle_sem, 0, 0) == 0); + if (idle_sem_ok > 0) { + idle_sem_ok++; + UNLOCK_IDLE; + sem_wait(&idle_sem); + return; + } + UNLOCK_IDLE; +#endif + + // Fallback: sleep 10 ms + Delay_usec(10000); +#endif +} + + +/* + * Resume execution of emulator thread, events just arrived + */ + +void idle_resume(void) +{ +#ifdef IDLE_USES_COND_WAIT + pthread_cond_signal(&idle_cond); +#else +#ifdef IDLE_USES_SEMAPHORE + LOCK_IDLE; + if (idle_sem_ok > 1) { + idle_sem_ok--; + UNLOCK_IDLE; + sem_post(&idle_sem); + return; + } + UNLOCK_IDLE; +#endif +#endif +} diff --git a/SheepShaver/src/Windows/Makefile.in b/SheepShaver/src/Windows/Makefile.in index edd28f59..76617aed 100755 --- a/SheepShaver/src/Windows/Makefile.in +++ b/SheepShaver/src/Windows/Makefile.in @@ -65,7 +65,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window ../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \ ../macos_util.cpp ../timer.cpp timer_windows.cpp ../xpram.cpp xpram_windows.cpp \ ../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp ../dummy/scsi_dummy.cpp \ - ../gfxaccel.cpp ../video.cpp ../SDL/video_sdl.cpp video_blit.cpp \ + ../gfxaccel.cpp ../video.cpp ../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp video_blit.cpp \ ../audio.cpp ../SDL/audio_sdl.cpp ../ether.cpp ether_windows.cpp \ ../thunks.cpp ../serial.cpp serial_windows.cpp ../extfs.cpp extfs_windows.cpp \ about_window_windows.cpp ../user_strings.cpp user_strings_windows.cpp \ diff --git a/SheepShaver/src/adb.cpp b/SheepShaver/src/adb.cpp deleted file mode 120000 index 1cc36b98..00000000 --- a/SheepShaver/src/adb.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/adb.cpp \ No newline at end of file diff --git a/SheepShaver/src/adb.cpp b/SheepShaver/src/adb.cpp new file mode 100644 index 00000000..c05c0000 --- /dev/null +++ b/SheepShaver/src/adb.cpp @@ -0,0 +1,460 @@ +/* + * adb.cpp - ADB emulation (mouse/keyboard) + * + * Basilisk II (C) Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * SEE ALSO + * Inside Macintosh: Devices, chapter 5 "ADB Manager" + * Technote HW 01: "ADB - The Untold Story: Space Aliens Ate My Mouse" + */ + +#include + +#include "sysdeps.h" +#include "cpu_emulation.h" +#include "emul_op.h" +#include "main.h" +#include "prefs.h" +#include "video.h" +#include "adb.h" + +#ifdef POWERPC_ROM +#include "thunks.h" +#endif + +#define DEBUG 0 +#include "debug.h" + + +// Global variables +static int mouse_x = 0, mouse_y = 0; // Mouse position +static int old_mouse_x = 0, old_mouse_y = 0; +static bool mouse_button[3] = {false, false, false}; // Mouse button states +static bool old_mouse_button[3] = {false, false, false}; +static bool relative_mouse = false; + +static uint8 key_states[16]; // Key states (Mac keycodes) +#define MATRIX(code) (key_states[code >> 3] & (1 << (~code & 7))) + +// Keyboard event buffer (Mac keycodes with up/down flag) +const int KEY_BUFFER_SIZE = 16; +static uint8 key_buffer[KEY_BUFFER_SIZE]; +static unsigned int key_read_ptr = 0, key_write_ptr = 0; + +static uint8 mouse_reg_3[2] = {0x63, 0x01}; // Mouse ADB register 3 + +static uint8 key_reg_2[2] = {0xff, 0xff}; // Keyboard ADB register 2 +static uint8 key_reg_3[2] = {0x62, 0x05}; // Keyboard ADB register 3 + +static uint8 m_keyboard_type = 0x05; + +// ADB mouse motion lock (for platforms that use separate input thread) +static B2_mutex *mouse_lock; + + +/* + * Initialize ADB emulation + */ + +void ADBInit(void) +{ + mouse_lock = B2_create_mutex(); + m_keyboard_type = (uint8)PrefsFindInt32("keyboardtype"); + key_reg_3[1] = m_keyboard_type; +} + + +/* + * Exit ADB emulation + */ + +void ADBExit(void) +{ + if (mouse_lock) { + B2_delete_mutex(mouse_lock); + mouse_lock = NULL; + } +} + + +/* + * ADBOp() replacement + */ + +void ADBOp(uint8 op, uint8 *data) +{ + D(bug("ADBOp op %02x, data %02x %02x %02x\n", op, data[0], data[1], data[2])); + + // ADB reset? + if ((op & 0x0f) == 0) { + mouse_reg_3[0] = 0x63; + mouse_reg_3[1] = 0x01; + key_reg_2[0] = 0xff; + key_reg_2[1] = 0xff; + key_reg_3[0] = 0x62; + key_reg_3[1] = m_keyboard_type; + return; + } + + // Cut op into fields + uint8 adr = op >> 4; + uint8 cmd = (op >> 2) & 3; + uint8 reg = op & 3; + + // Check which device was addressed and act accordingly + if (adr == (mouse_reg_3[0] & 0x0f)) { + + // Mouse + if (cmd == 2) { + + // Listen + switch (reg) { + case 3: // Address/HandlerID + if (data[2] == 0xfe) // Change address + mouse_reg_3[0] = (mouse_reg_3[0] & 0xf0) | (data[1] & 0x0f); + else if (data[2] == 1 || data[2] == 2 || data[2] == 4) // Change device handler ID + mouse_reg_3[1] = data[2]; + else if (data[2] == 0x00) // Change address and enable bit + mouse_reg_3[0] = (mouse_reg_3[0] & 0xd0) | (data[1] & 0x2f); + break; + } + + } else if (cmd == 3) { + + // Talk + switch (reg) { + case 1: // Extended mouse protocol + data[0] = 8; + data[1] = 'a'; // Identifier + data[2] = 'p'; + data[3] = 'p'; + data[4] = 'l'; + data[5] = 300 >> 8; // Resolution (dpi) + data[6] = 300 & 0xff; + data[7] = 1; // Class (mouse) + data[8] = 3; // Number of buttons + break; + case 3: // Address/HandlerID + data[0] = 2; + data[1] = (mouse_reg_3[0] & 0xf0) | (rand() & 0x0f); + data[2] = mouse_reg_3[1]; + break; + default: + data[0] = 0; + break; + } + } + D(bug(" mouse reg 3 %02x%02x\n", mouse_reg_3[0], mouse_reg_3[1])); + + } else if (adr == (key_reg_3[0] & 0x0f)) { + + // Keyboard + if (cmd == 2) { + + // Listen + switch (reg) { + case 2: // LEDs/Modifiers + key_reg_2[0] = data[1]; + key_reg_2[1] = data[2]; + break; + case 3: // Address/HandlerID + if (data[2] == 0xfe) // Change address + key_reg_3[0] = (key_reg_3[0] & 0xf0) | (data[1] & 0x0f); + else if (data[2] == 0x00) // Change address and enable bit + key_reg_3[0] = (key_reg_3[0] & 0xd0) | (data[1] & 0x2f); + break; + } + + } else if (cmd == 3) { + + // Talk + switch (reg) { + case 2: { // LEDs/Modifiers + uint8 reg2hi = 0xff; + uint8 reg2lo = key_reg_2[1] | 0xf8; + if (MATRIX(0x6b)) // Scroll Lock + reg2lo &= ~0x40; + if (MATRIX(0x47)) // Num Lock + reg2lo &= ~0x80; + if (MATRIX(0x37)) // Command + reg2hi &= ~0x01; + if (MATRIX(0x3a)) // Option + reg2hi &= ~0x02; + if (MATRIX(0x38)) // Shift + reg2hi &= ~0x04; + if (MATRIX(0x36)) // Control + reg2hi &= ~0x08; + if (MATRIX(0x39)) // Caps Lock + reg2hi &= ~0x20; + if (MATRIX(0x75)) // Delete + reg2hi &= ~0x40; + data[0] = 2; + data[1] = reg2hi; + data[2] = reg2lo; + break; + } + case 3: // Address/HandlerID + data[0] = 2; + data[1] = (key_reg_3[0] & 0xf0) | (rand() & 0x0f); + data[2] = key_reg_3[1]; + break; + default: + data[0] = 0; + break; + } + } + D(bug(" keyboard reg 3 %02x%02x\n", key_reg_3[0], key_reg_3[1])); + + } else // Unknown address + if (cmd == 3) + data[0] = 0; // Talk: 0 bytes of data +} + + +/* + * Mouse was moved (x/y are absolute or relative, depending on ADBSetRelMouseMode()) + */ + +void ADBMouseMoved(int x, int y) +{ + B2_lock_mutex(mouse_lock); + if (relative_mouse) { + mouse_x += x; mouse_y += y; + } else { + mouse_x = x; mouse_y = y; + } + B2_unlock_mutex(mouse_lock); + SetInterruptFlag(INTFLAG_ADB); + TriggerInterrupt(); +} + + +/* + * Mouse button pressed + */ + +void ADBMouseDown(int button) +{ + mouse_button[button] = true; + SetInterruptFlag(INTFLAG_ADB); + TriggerInterrupt(); +} + + +/* + * Mouse button released + */ + +void ADBMouseUp(int button) +{ + mouse_button[button] = false; + SetInterruptFlag(INTFLAG_ADB); + TriggerInterrupt(); +} + + +/* + * Set mouse mode (absolute or relative) + */ + +void ADBSetRelMouseMode(bool relative) +{ + if (relative_mouse != relative) { + relative_mouse = relative; + mouse_x = mouse_y = 0; + } +} + + +/* + * Key pressed ("code" is the Mac key code) + */ + +void ADBKeyDown(int code) +{ + // Add keycode to buffer + key_buffer[key_write_ptr] = code; + key_write_ptr = (key_write_ptr + 1) % KEY_BUFFER_SIZE; + + // Set key in matrix + key_states[code >> 3] |= (1 << (~code & 7)); + + // Trigger interrupt + SetInterruptFlag(INTFLAG_ADB); + TriggerInterrupt(); +} + + +/* + * Key released ("code" is the Mac key code) + */ + +void ADBKeyUp(int code) +{ + // Add keycode to buffer + key_buffer[key_write_ptr] = code | 0x80; // Key-up flag + key_write_ptr = (key_write_ptr + 1) % KEY_BUFFER_SIZE; + + // Clear key in matrix + key_states[code >> 3] &= ~(1 << (~code & 7)); + + // Trigger interrupt + SetInterruptFlag(INTFLAG_ADB); + TriggerInterrupt(); +} + + +/* + * ADB interrupt function (executed as part of 60Hz interrupt) + */ + +void ADBInterrupt(void) +{ + M68kRegisters r; + + // Return if ADB is not initialized + uint32 adb_base = ReadMacInt32(0xcf8); + if (!adb_base || adb_base == 0xffffffff) + return; + uint32 tmp_data = adb_base + 0x163; // Temporary storage for faked ADB data + + // Get mouse state + B2_lock_mutex(mouse_lock); + int mx = mouse_x; + int my = mouse_y; + if (relative_mouse) + mouse_x = mouse_y = 0; + bool mb[3] = {mouse_button[0], mouse_button[1], mouse_button[2]}; + B2_unlock_mutex(mouse_lock); + + uint32 key_base = adb_base + 4; + uint32 mouse_base = adb_base + 16; + + if (relative_mouse) { + + // Mouse movement (relative) and buttons + if (mx != 0 || my != 0 || mb[0] != old_mouse_button[0] || mb[1] != old_mouse_button[1] || mb[2] != old_mouse_button[2]) { + + // Call mouse ADB handler + if (mouse_reg_3[1] == 4) { + // Extended mouse protocol + WriteMacInt8(tmp_data, 3); + WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mb[0] ? 0 : 0x80)); + WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mb[1] ? 0 : 0x80)); + WriteMacInt8(tmp_data + 3, ((my >> 3) & 0x70) | ((mx >> 7) & 0x07) | (mb[2] ? 0x08 : 0x88)); + } else { + // 100/200 dpi mode + WriteMacInt8(tmp_data, 2); + WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mb[0] ? 0 : 0x80)); + WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mb[1] ? 0 : 0x80)); + } + r.a[0] = tmp_data; + r.a[1] = ReadMacInt32(mouse_base); + r.a[2] = ReadMacInt32(mouse_base + 4); + r.a[3] = adb_base; + r.d[0] = (mouse_reg_3[0] << 4) | 0x0c; // Talk 0 + Execute68k(r.a[1], &r); + + old_mouse_button[0] = mb[0]; + old_mouse_button[1] = mb[1]; + old_mouse_button[2] = mb[2]; + } + + } else { + + // Update mouse position (absolute) + if (mx != old_mouse_x || my != old_mouse_y) { +#ifdef POWERPC_ROM + static const uint8 proc_template[] = { + 0x2f, 0x08, // move.l a0,-(sp) + 0x2f, 0x00, // move.l d0,-(sp) + 0x2f, 0x01, // move.l d1,-(sp) + 0x70, 0x01, // moveq #1,d0 (MoveTo) + 0xaa, 0xdb, // CursorDeviceDispatch + M68K_RTS >> 8, M68K_RTS & 0xff + }; + BUILD_SHEEPSHAVER_PROCEDURE(proc); + r.a[0] = ReadMacInt32(mouse_base + 4); + r.d[0] = mx; + r.d[1] = my; + Execute68k(proc, &r); +#else + WriteMacInt16(0x82a, mx); + WriteMacInt16(0x828, my); + WriteMacInt16(0x82e, mx); + WriteMacInt16(0x82c, my); + WriteMacInt8(0x8ce, ReadMacInt8(0x8cf)); // CrsrCouple -> CrsrNew +#endif + old_mouse_x = mx; + old_mouse_y = my; + } + + // Send mouse button events + if (mb[0] != old_mouse_button[0] || mb[1] != old_mouse_button[1] || mb[2] != old_mouse_button[2]) { + uint32 mouse_base = adb_base + 16; + + // Call mouse ADB handler + if (mouse_reg_3[1] == 4) { + // Extended mouse protocol + WriteMacInt8(tmp_data, 3); + WriteMacInt8(tmp_data + 1, mb[0] ? 0 : 0x80); + WriteMacInt8(tmp_data + 2, mb[1] ? 0 : 0x80); + WriteMacInt8(tmp_data + 3, mb[2] ? 0x08 : 0x88); + } else { + // 100/200 dpi mode + WriteMacInt8(tmp_data, 2); + WriteMacInt8(tmp_data + 1, mb[0] ? 0 : 0x80); + WriteMacInt8(tmp_data + 2, mb[1] ? 0 : 0x80); + } + r.a[0] = tmp_data; + r.a[1] = ReadMacInt32(mouse_base); + r.a[2] = ReadMacInt32(mouse_base + 4); + r.a[3] = adb_base; + r.d[0] = (mouse_reg_3[0] << 4) | 0x0c; // Talk 0 + Execute68k(r.a[1], &r); + + old_mouse_button[0] = mb[0]; + old_mouse_button[1] = mb[1]; + old_mouse_button[2] = mb[2]; + } + } + + // Process accumulated keyboard events + while (key_read_ptr != key_write_ptr) { + + // Read keyboard event + uint8 mac_code = key_buffer[key_read_ptr]; + key_read_ptr = (key_read_ptr + 1) % KEY_BUFFER_SIZE; + + // Call keyboard ADB handler + WriteMacInt8(tmp_data, 2); + WriteMacInt8(tmp_data + 1, mac_code); + WriteMacInt8(tmp_data + 2, mac_code == 0x7f ? 0x7f : 0xff); // Power key is special + r.a[0] = tmp_data; + r.a[1] = ReadMacInt32(key_base); + r.a[2] = ReadMacInt32(key_base + 4); + r.a[3] = adb_base; + r.d[0] = (key_reg_3[0] << 4) | 0x0c; // Talk 0 + Execute68k(r.a[1], &r); + } + + // Clear temporary data + WriteMacInt32(tmp_data, 0); + WriteMacInt32(tmp_data + 4, 0); +}