Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Seth Polsley 2020-05-25 16:21:28 -05:00
commit eb722fc799
68 changed files with 15202 additions and 4072 deletions

View File

@ -11,11 +11,6 @@
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 */; };
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 */; };
@ -32,13 +27,7 @@
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 */; };
@ -47,7 +36,6 @@
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 */; };
@ -58,43 +46,23 @@
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 */; };
7539E24D1F23B32A006B2DF2 /* fbdevices in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2011F23B32A006B2DF2 /* fbdevices */; };
7539E2501F23B32A006B2DF2 /* install-sh in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2051F23B32A006B2DF2 /* install-sh */; };
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 */; };
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 */; };
@ -104,14 +72,12 @@
E413D92120D260BC00E437D8 /* tftp.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D8F820D260B900E437D8 /* tftp.c */; };
E413D92220D260BC00E437D8 /* mbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D8F920D260B900E437D8 /* mbuf.c */; };
E413D92320D260BC00E437D8 /* ip_icmp.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D8FB20D260B900E437D8 /* ip_icmp.c */; };
E413D92420D260BC00E437D8 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = E413D8FE20D260B900E437D8 /* VERSION */; };
E413D92520D260BC00E437D8 /* tcp_input.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90120D260B900E437D8 /* tcp_input.c */; };
E413D92620D260BC00E437D8 /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90220D260B900E437D8 /* misc.c */; };
E413D92720D260BC00E437D8 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90520D260BA00E437D8 /* debug.c */; };
E413D92820D260BC00E437D8 /* tcp_subr.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90620D260BA00E437D8 /* tcp_subr.c */; };
E413D92920D260BC00E437D8 /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90720D260BA00E437D8 /* udp.c */; };
E413D92A20D260BC00E437D8 /* sbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90920D260BA00E437D8 /* sbuf.c */; };
E413D92B20D260BC00E437D8 /* COPYRIGHT in Resources */ = {isa = PBXBuildFile; fileRef = E413D90C20D260BA00E437D8 /* COPYRIGHT */; };
E413D92C20D260BC00E437D8 /* slirp.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D90D20D260BA00E437D8 /* slirp.c */; };
E413D92D20D260BC00E437D8 /* tcp_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D91120D260BA00E437D8 /* tcp_timer.c */; };
E413D92E20D260BC00E437D8 /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = E413D91820D260BB00E437D8 /* socket.c */; };
@ -125,40 +91,15 @@
E413D93820D2613500E437D8 /* ether_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E413D93720D2613500E437D8 /* ether_unix.cpp */; };
E413D93A20D2614E00E437D8 /* extfs_macosx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E413D93920D2614E00E437D8 /* extfs_macosx.cpp */; };
E4150D1420D559800077C51A /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E4150D1320D559800077C51A /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
E416BEE82410AA4E00751E6D /* runtool.c in Sources */ = {isa = PBXBuildFile; fileRef = E416BEE72410AA4E00751E6D /* runtool.c */; };
E416BEEA2410AA9800751E6D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E416BEE92410AA9800751E6D /* Security.framework */; };
E416BEED2410AE0900751E6D /* etherhelpertool in Resources */ = {isa = PBXBuildFile; fileRef = E416BEEC2410AE0000751E6D /* etherhelpertool */; };
E4555EED2354434B00139FCE /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E00A1F23B25A006B2DF2 /* Credits.html */; };
E490334E20D3A5890012DD5F /* clip_macosx64.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490334D20D3A5890012DD5F /* clip_macosx64.mm */; };
E4D8245323543D9800849B78 /* fpu_ieee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D8245223543D9700849B78 /* fpu_ieee.cpp */; };
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E417913123D7D67C0009AD63 /* defs68k.c */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
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;
@ -171,24 +112,6 @@
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 */
@ -196,10 +119,7 @@
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 = "<group>"; };
752F27021F242F51001032B4 /* xpram_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpram_sdl.cpp; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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; };
@ -349,7 +269,6 @@
7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = serial_dummy.cpp; sourceTree = "<group>"; };
7539E2961F23C5FD006B2DF2 /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = newcpu.cpp; sourceTree = "<group>"; };
7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_darwin.cpp; sourceTree = "<group>"; };
7539E29E1F23C939006B2DF2 /* fpu_uae.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fpu_uae.cpp; sourceTree = "<group>"; };
7539E2AA1F23CDB7006B2DF2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
756C1B321F252FC100620917 /* utils_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils_macosx.h; sourceTree = "<group>"; };
756C1B331F252FC100620917 /* utils_macosx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = utils_macosx.mm; sourceTree = "<group>"; };
@ -404,29 +323,22 @@
E413D93720D2613500E437D8 /* ether_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ether_unix.cpp; sourceTree = "<group>"; };
E413D93920D2614E00E437D8 /* extfs_macosx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extfs_macosx.cpp; sourceTree = "<group>"; };
E4150D1320D559800077C51A /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<group>"; };
E416BEE72410AA4E00751E6D /* runtool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = runtool.c; sourceTree = "<group>"; };
E416BEE92410AA9800751E6D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
E416BEEB2410AB0E00751E6D /* etherhelpertool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = etherhelpertool.c; sourceTree = "<group>"; };
E416BEEC2410AE0000751E6D /* etherhelpertool */ = {isa = PBXFileReference; lastKnownFileType = text; path = etherhelpertool; sourceTree = BUILT_PRODUCTS_DIR; };
E417913123D7D67C0009AD63 /* defs68k.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
E490334D20D3A5890012DD5F /* clip_macosx64.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clip_macosx64.mm; sourceTree = "<group>"; };
E4D8245223543D9700849B78 /* fpu_ieee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fpu_ieee.cpp; sourceTree = "<group>"; };
/* 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 = (
E413D93620D260DA00E437D8 /* SDL2.framework in Frameworks */,
E416BEEA2410AA9800751E6D /* Security.framework in Frameworks */,
756C1B391F25306A00620917 /* AppKit.framework in Frameworks */,
752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */,
752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */,
@ -488,6 +400,7 @@
752F26F71F240E51001032B4 /* Frameworks */ = {
isa = PBXGroup;
children = (
E416BEE92410AA9800751E6D /* Security.framework */,
E413D93520D260DA00E437D8 /* SDL2.framework */,
756C1B381F25306A00620917 /* AppKit.framework */,
752F26FA1F240E69001032B4 /* IOKit.framework */,
@ -499,20 +412,12 @@
753252FF1F535E5D0024025B /* generated src */ = {
isa = PBXGroup;
children = (
753253001F535E840024025B /* build68k output */,
E416BEEC2410AE0000751E6D /* etherhelpertool */,
7532532B1F53675E0024025B /* gencpu output */,
);
name = "generated src";
sourceTree = "<group>";
};
753253001F535E840024025B /* build68k output */ = {
isa = PBXGroup;
children = (
753252ED1F535DD10024025B /* defs68k.c */,
);
name = "build68k output";
sourceTree = "<group>";
};
7532532B1F53675E0024025B /* gencpu output */ = {
isa = PBXGroup;
children = (
@ -521,6 +426,7 @@
7532532E1F5368370024025B /* cpustbl_nf.cpp */,
7532532F1F5368370024025B /* cpustbl.cpp */,
753253301F5368370024025B /* cputbl.h */,
E417913123D7D67C0009AD63 /* defs68k.c */,
);
name = "gencpu output";
sourceTree = "<group>";
@ -540,8 +446,6 @@
isa = PBXGroup;
children = (
7539DFB21F23B17E006B2DF2 /* BasiliskII.app */,
753252DA1F5358D30024025B /* build68k */,
753252F31F535E1E0024025B /* gencpu */,
);
name = Products;
path = ../../../../../../../../Documents/Code/macemu/BasiliskII/src/MacOSX;
@ -604,6 +508,8 @@
7539DFF91F23B25A006B2DF2 /* MacOSX */ = {
isa = PBXGroup;
children = (
E416BEEB2410AB0E00751E6D /* etherhelpertool.c */,
E416BEE72410AA4E00751E6D /* runtool.c */,
7539E2AA1F23CDB7006B2DF2 /* Info.plist */,
7539E27E1F23BEB4006B2DF2 /* config.h */,
7539DFFA1F23B25A006B2DF2 /* Assets.xcassets */,
@ -675,7 +581,7 @@
7539E0B31F23B25A006B2DF2 /* fpu */ = {
isa = PBXGroup;
children = (
7539E29E1F23C939006B2DF2 /* fpu_uae.cpp */,
E4D8245223543D9700849B78 /* fpu_ieee.cpp */,
7539E0B41F23B25A006B2DF2 /* core.h */,
7539E0B51F23B25A006B2DF2 /* exceptions.cpp */,
7539E0B61F23B25A006B2DF2 /* exceptions.h */,
@ -817,75 +723,7 @@
};
/* 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" */;
@ -899,7 +737,6 @@
buildRules = (
);
dependencies = (
7532531F1F5364170024025B /* PBXTargetDependency */,
);
name = BasiliskII;
productName = BasiliskII;
@ -914,22 +751,6 @@
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;
@ -951,10 +772,6 @@
projectRoot = "";
targets = (
7539DFB11F23B17E006B2DF2 /* BasiliskII */,
753252D91F5358D30024025B /* build68k */,
753252F21F535E1E0024025B /* gencpu */,
753253071F5360E30024025B /* run_build68k */,
753253161F5363D20024025B /* run_gencpu */,
);
};
/* End PBXProject section */
@ -964,35 +781,9 @@
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 */,
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 */,
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 */,
E413D92B20D260BC00E437D8 /* COPYRIGHT in Resources */,
7539E14D1F23B25A006B2DF2 /* Versions.html in Resources */,
E413D92420D260BC00E437D8 /* VERSION 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 */,
E4555EED2354434B00139FCE /* Credits.html in Resources */,
E416BEED2410AE0900751E6D /* etherhelpertool in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1008,48 +799,35 @@
);
name = "Run Script";
outputPaths = (
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu_nf.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl_nf.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/defs68k.c,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# ${PROJECT_DIR}/generate_cpu_srcs_for_xcode.sh";
shellScript = "make -f Makefile.gencpu\ncc etherhelpertool.c -framework Security -o $BUILT_PRODUCTS_DIR/etherhelpertool\n";
};
/* 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 = (
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */,
7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */,
7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */,
7539E1291F23B25A006B2DF2 /* video_blit.cpp in Sources */,
E413D93320D260BC00E437D8 /* cksum.c in Sources */,
E413D92920D260BC00E437D8 /* udp.c in Sources */,
E4D8245323543D9800849B78 /* fpu_ieee.cpp in Sources */,
7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */,
E40CEEC620D7910E00BCB88D /* SDLMain.m in Sources */,
753253351F53688D0024025B /* readcpu.cpp in Sources */,
7539E1741F23B25A006B2DF2 /* audio_sdl.cpp in Sources */,
753252EE1F535DD10024025B /* defs68k.c in Sources */,
E413D93120D260BC00E437D8 /* ip_output.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 */,
@ -1101,6 +879,7 @@
E413D92720D260BC00E437D8 /* debug.c in Sources */,
E413D92220D260BC00E437D8 /* mbuf.c in Sources */,
7539E19D1F23B25A006B2DF2 /* mathlib.cpp in Sources */,
E416BEE82410AA4E00751E6D /* runtool.c in Sources */,
E413D93020D260BC00E437D8 /* ip_input.c in Sources */,
752F27031F242F51001032B4 /* xpram_sdl.cpp in Sources */,
7539E16D1F23B25A006B2DF2 /* pict.c in Sources */,
@ -1124,29 +903,6 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
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;
@ -1159,70 +915,6 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
753252DE1F5358D30024025B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
753252DF1F5358D30024025B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
753252F81F535E1E0024025B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
753252F91F535E1E0024025B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
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 = {
@ -1358,6 +1050,11 @@
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_ENABLE_PASCAL_STRINGS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
ENABLE_MACOSX_ETHERHELPER,
HAVE_CONFIG_H,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_USE_STANDARD_INCLUDE_SEARCHING = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
@ -1376,7 +1073,7 @@
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.basiliskii.BasiliskII;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
PRODUCT_NAME = "$(TARGET_NAME)";
USE_HEADERMAP = YES;
VALID_ARCHS = x86_64;
@ -1410,6 +1107,11 @@
GCC_ENABLE_PASCAL_STRINGS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
ENABLE_MACOSX_ETHERHELPER,
HAVE_CONFIG_H,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_USE_STANDARD_INCLUDE_SEARCHING = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
@ -1427,7 +1129,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.basiliskii.BasiliskII;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
PRODUCT_NAME = "$(TARGET_NAME)";
USE_HEADERMAP = YES;
VALID_ARCHS = x86_64;
@ -1438,42 +1140,6 @@
/* 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 = (

View File

@ -11,7 +11,7 @@
<key>CFBundleIconFile</key>
<string>BasiliskII.icns</string>
<key>CFBundleIdentifier</key>
<string></string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -0,0 +1,27 @@
SRC = $(PROJECT_DIR)/../uae_cpu
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output
VPATH = $(SRC)
CFLAGS = -DUSE_XCODE=1 -I. -I../uae_cpu -I../UNIX
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
OBJS = $(addprefix $(DST)/, defs68k.o gencpu.o readcpu.o)
all: $(DST)/gencpu
cd $(DST); ./gencpu
$(DST)/gencpu: $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^
$(DST)/%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
$(DST)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
$(DST)/defs68k.c: $(DST)/build68k
$< < $(SRC)/table68k > $@
$(DST)/build68k: $(SRC)/build68k.c
mkdir -p $(DST)
$(CC) $(CFLAGS) -o $@ $<
clean:; rm -fr $(DST)

View File

@ -815,7 +815,6 @@
<inttypes.h> don't define. */
/* #undef uintmax_t */
#define FPU_UAE 1
//#define FPU_IMPLEMENTATION 1
#define FPU_IEEE
#endif

View File

@ -0,0 +1,580 @@
/*
* etherhelpertool.c - Reads and writes raw ethernet packets usng bpf
* interface.
*
* Copyright (C) 2010, Daniel Sumorok
*
* 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 <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
#include <ifaddrs.h>
#include <errno.h>
#include <sys/select.h>
#include <unistd.h>
#include <net/if.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <net/bpf.h>
#include <fcntl.h>
#include <strings.h>
#include <Carbon/Carbon.h>
#define STR_MAX 256
#define MAX_ARGV 10
static int open_bpf(char *ifname);
static int open_tap(char *ifname);
static int retreive_auth_info(void);
static int main_loop(int sd, int use_bpf);
static int run_cmd(const char *cmd);
static void handler(int signum);
static int install_signal_handlers();
static void do_exit();
static char remove_bridge[STR_MAX];
static const char *exec_name = "etherhelpertool";
int main(int argc, char **argv)
{
char *if_name;
int ret = 255;
int sd;
int tapNum;
int use_bpf;
if (argc != 2) {
return 255;
}
if_name = argv[1];
do {
ret = retreive_auth_info();
if (ret != 0) {
fprintf(stderr, "%s: authorization failed.\n",
exec_name);
ret = 254;
break;
}
if (strncmp(if_name, "tap", 3) == 0) {
sd = open_tap(if_name);
use_bpf = 0;
} else {
sd = open_bpf(if_name);
use_bpf = 1;
}
if (sd < 0) {
fprintf(stderr, "%s: open device failed.\n",
exec_name);
ret = 253;
break;
}
if (install_signal_handlers() != 0) {
fprintf(stderr,
"%s: failed to install signal handers.\n",
exec_name);
ret = 252;
break;
}
ret = main_loop(sd, use_bpf);
close(sd);
} while (0);
do_exit();
return ret;
}
static int main_loop(int sd, int use_bpf)
{
fd_set readSet;
char *outgoing, *incoming;
unsigned short *out_len;
unsigned short *in_len;
int in_index, out_index;
u_int blen = 0;
int ret;
int fret = 0;
struct bpf_hdr *hdr;
int pkt_len;
int frame_len;
int pad;
char c = 0;
if (use_bpf) {
if (ioctl(sd, BIOCGBLEN, &blen) < 0) {
fprintf(stderr,
"%s: ioctl() failed.\n",
exec_name);
return -1;
}
} else {
blen = 4096;
}
incoming = malloc(blen);
if (incoming == NULL) {
fprintf(stderr,
"%s: malloc() failed.\n",
exec_name);
return -2;
}
outgoing = malloc(blen);
if (outgoing == NULL) {
free(outgoing);
fprintf(stderr,
"%s: malloc() failed.\n",
exec_name);
return -3;
}
in_index = 0;
out_index = 0;
out_len = (unsigned short *)outgoing;
/* Let our parent know we are ready for business. */
write(0, &c, 1);
while (1) {
int i;
FD_ZERO(&readSet);
FD_SET(0, &readSet);
FD_SET(sd, &readSet);
ret = select(sd + 1, &readSet, NULL, NULL, NULL);
if (ret < 0) {
fprintf(stderr,
"%s: select() failed.\n",
exec_name);
fret = -4;
break;
}
if (FD_ISSET(0, &readSet)) {
if (out_index < 2) {
ret = read(0, outgoing + out_index, 2-out_index);
} else {
ret = read(0, outgoing + out_index, *out_len - out_index + 2);
}
if (ret < 1) {
if(ret < 0) {
fprintf(stderr,
"%s: read() failed.\n",
exec_name);
}
fret = -5;
break;
}
out_index += ret;
if (out_index > 1) {
if ((*out_len + 2) > blen) {
fret = -6;
break;
}
if (out_index == (*out_len + 2)) {
ret = write(sd, out_len + 1, *out_len);
if (ret != *out_len) {
fprintf(stderr,
"%s: write() failed.\n",
exec_name);
fret = -7;
break;
}
out_index = 0;
}
}
}
if (use_bpf && FD_ISSET(sd, &readSet)) {
int i;
ret = read(sd, incoming, blen);
if (ret < 1) {
if(ret < 0) {
fprintf(stderr,
"%s: read() failed %d.\n",
exec_name, errno);
}
fret = -8;
break;
}
hdr = (struct bpf_hdr *)incoming;
in_len = (unsigned short *)(incoming + 16);
do {
pkt_len = hdr->bh_caplen;
frame_len = pkt_len + 18;
if ((pkt_len < 0) || (frame_len > ret) || (frame_len < 0)) {
fret = -9;
break;
}
*in_len = pkt_len;
if (write(0, in_len, pkt_len + 2) < (pkt_len + 2)) {
fret = -10;
break;
}
if ((frame_len & 0x03) == 0) {
pad = 0;
} else {
pad = 4 - (frame_len & 0x03);
}
ret -= (frame_len + pad);
hdr = (struct bpf_hdr *)((unsigned char *)hdr + frame_len + pad);
in_len = (unsigned short *)((unsigned char *)hdr + 16);
} while (ret > 0);
if (fret != 0) {
fprintf(stderr,
"%s: fret == %d.\n",
exec_name, fret);
break;
}
}
if (!use_bpf && FD_ISSET(sd, &readSet)) {
in_len = (unsigned short *)incoming;
pkt_len = read(sd, in_len + 1, blen-2);
if (pkt_len < 14) {
fprintf(stderr,
"%s: read() returned %d.\n",
exec_name, pkt_len);
fret = -8;
break;
}
*in_len = pkt_len;
if (write(0, in_len, pkt_len + 2) < (pkt_len + 2)) {
fprintf(stderr,
"%s: write() failed\n",
exec_name);
fret = -10;
break;
}
}
}
free(incoming);
free(outgoing);
return fret;
}
static int retreive_auth_info(void)
{
AuthorizationRef aRef;
OSStatus status;
AuthorizationRights myRights;
AuthorizationRights *newRights;
AuthorizationItem *myItem;
AuthorizationItem myItems[1];
AuthorizationItemSet *mySet;
int i;
status = AuthorizationCopyPrivilegedReference(&aRef, kAuthorizationFlagDefaults);
if (status != errAuthorizationSuccess) {
return -1;
}
status = AuthorizationCopyInfo(aRef, NULL, &mySet);
if (status != errAuthorizationSuccess) {
AuthorizationFree(aRef, kAuthorizationFlagDestroyRights);
return -1;
}
myItems[0].name = "system.privilege.admin";
myItems[0].valueLength = 0;
myItems[0].value = NULL;
myItems[0].flags = 0;
myRights.count = sizeof (myItems) / sizeof (myItems[0]);
myRights.items = myItems;
status = AuthorizationCopyRights(aRef, &myRights, NULL,
kAuthorizationFlagExtendRights,
&newRights);
if (status != errAuthorizationSuccess) {
AuthorizationFreeItemSet(mySet);
AuthorizationFree(aRef, kAuthorizationFlagDestroyRights);
return -2;
}
AuthorizationFreeItemSet(newRights);
AuthorizationFreeItemSet(mySet);
AuthorizationFree(aRef, kAuthorizationFlagDestroyRights);
return 0;
}
static int open_tap(char *ifname)
{
char str[STR_MAX] = {0};
char ifstr[STR_MAX] = {0};
char *interface;
char *address = NULL;
char *netmask = NULL;
char *bridge = NULL;
char *bridged_if = NULL;
int sd;
snprintf(ifstr, STR_MAX, "%s", ifname);
interface = strtok(ifstr, "/");
bridge = strtok(NULL, "/");
if (bridge != NULL) {
bridged_if = strtok(NULL, "/");
}
interface = strtok(ifstr, ":");
address = strtok(NULL, ":");
if (address != NULL) {
netmask = strtok(NULL, ":");
}
snprintf(str, STR_MAX, "/dev/%s", interface);
sd = open(str, O_RDWR);
if (sd < 0) {
fprintf(stderr, "%s: Failed to open %s\n",
exec_name, interface);
return -1;
}
if (address == NULL) {
snprintf(str, STR_MAX, "/sbin/ifconfig %s up", interface);
} else if (netmask == NULL) {
snprintf(str, STR_MAX, "/sbin/ifconfig %s %s",
interface, address);
} else {
snprintf(str, STR_MAX, "/sbin/ifconfig %s %s netmask %s",
interface, address, netmask);
}
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to configure %s\n",
exec_name, interface);
close(sd);
return -1;
}
if (bridge != NULL) {
/* Check to see if bridge is alread up */
snprintf(str, STR_MAX, "/sbin/ifconfig %s", bridge);
if (run_cmd(str) == 0) {
/* bridge is already up */
if (bridged_if != NULL) {
fprintf(stderr, "%s: Warning: %s already exists, so %s was not added.\n",
exec_name, bridge, bridged_if);
}
} else {
snprintf(str, STR_MAX, "/sbin/ifconfig %s create", bridge);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to create %s\n",
exec_name, bridge);
close(sd);
return -1;
}
strlcpy(remove_bridge, bridge, STR_MAX);
snprintf(str, STR_MAX, "/sbin/ifconfig %s up", bridge);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to open %s\n",
exec_name, bridge);
close(sd);
return -1;
}
if (bridged_if != NULL) {
snprintf(str, STR_MAX, "/sbin/ifconfig %s addm %s",
bridge, bridged_if);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to add %s to %s\n",
exec_name, bridged_if, bridge);
close(sd);
return -1;
}
}
}
snprintf(str, STR_MAX, "/sbin/ifconfig %s addm %s",
bridge, interface);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to add %s to %s\n",
exec_name, interface, bridge);
close(sd);
return -1;
}
}
return sd;
}
static int open_bpf(char *ifname)
{
u_int blen = 0;
struct ifreq ifreq;
u_int arg;
int sd = open("/dev/bpf2", O_RDWR);
if (sd < 0) {
return -1;
}
if (ioctl(sd, BIOCGBLEN, &blen) < 0) {
close(sd);
return -2;
}
bzero(&ifreq, sizeof(ifreq));
strncpy(ifreq.ifr_name, ifname, IFNAMSIZ);
arg = 0;
if (ioctl(sd, BIOCSETIF, &ifreq) < 0) {
close(sd);
return -3;
}
arg = 0;
if (ioctl(sd, BIOCSSEESENT, &arg) < 0) {
close(sd);
return -4;
}
arg = 1;
if (ioctl(sd, BIOCPROMISC, &arg) < 0) {
close(sd);
return -5;
}
arg = 1;
if (ioctl(sd, BIOCIMMEDIATE, &arg) < 0) {
close(sd);
return -6;
}
return sd;
}
static int run_cmd(const char *cmd) {
char cmd_buffer[STR_MAX] = {0};
char *argv[MAX_ARGV + 1] = {0};
int i;
pid_t pid, waitpid;
int status = 0;
/* Collect arguments */
strncpy(cmd_buffer, cmd, STR_MAX-1);
argv[0] = strtok(cmd_buffer, " ");
for (i=1; i<MAX_ARGV; ++i) {
argv[i] = strtok(NULL, " ");
if (argv[i] == NULL) {
break;
}
}
/* Run sub process */
pid = fork();
if (pid == 0) {
/* Child process */
fclose(stdout);
fclose(stderr);
if (execve(argv[0], argv, NULL) < 0) {
perror("execve");
return -1;
}
} else {
/* Wait for child to exit */
waitpid = wait(&status);
if (waitpid < 0) {
perror("wait");
return -1;
}
if (status != 0) {
return -1;
}
}
return 0;
}
static void handler(int signum) {
do_exit();
exit(1);
}
static int install_signal_handlers() {
struct sigaction act = {0};
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
if (sigaction(SIGINT, &act, NULL) != 0) {
return -1;
}
if (sigaction(SIGHUP, &act, NULL) != 0) {
return -1;
}
if (sigaction(SIGTERM, &act, NULL) != 0) {
return -1;
}
return 0;
}
static void do_exit() {
if (*remove_bridge) {
char str[STR_MAX];
snprintf(str, STR_MAX, "/sbin/ifconfig %s destroy", remove_bridge);
run_cmd(str);
}
}

View File

@ -251,7 +251,9 @@ static int open_rsrc(const char *path, int flag)
char rsrc_path[MAX_PATH_LENGTH];
make_rsrc_path(path, rsrc_path);
return open(rsrc_path, flag);
int fd = open(rsrc_path, flag);
if (fd < 0 && flag == O_WRONLY) fd = open(rsrc_path, O_WRONLY | O_CREAT); // for APFS
return fd;
}

View File

@ -1,37 +0,0 @@
#!/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 [ ! "$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"
;;
"")
if [ ! -d "$BUILT_PRODUCTS_DIR" ]; then
echo "No built products directory"
exit 1
fi
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

View File

@ -1,37 +0,0 @@
#!/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 [ ! "$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"
;;
"")
if [ ! -d "$BUILT_PRODUCTS_DIR" ]; then
echo "No built products directory"
exit 1
fi
echo "Running gencpu"
cd "$BUILT_PRODUCTS_DIR"
mkdir -p gencpu_output
cd gencpu_output
"$BUILT_PRODUCTS_DIR/gencpu"
ls -al
;;
esac

View File

@ -0,0 +1,136 @@
/*
* runtool.m - Run an external program as root for networking
* Copyright (C) 2010, Daniel Sumorok
*
* 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 <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
#include <ifaddrs.h>
#include <errno.h>
#include <unistd.h>
#include <net/if.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <net/bpf.h>
#include <fcntl.h>
#include <strings.h>
#include <Carbon/Carbon.h>
FILE * run_tool(const char *if_name, const char *tool_name);
FILE * run_tool(const char *if_name, const char *tool_name)
{
OSStatus auth_status;
FILE *fp = NULL;
char *args[] = {NULL, NULL, NULL};
int ret;
char path_buffer[256];
AuthorizationFlags auth_flags;
AuthorizationRef auth_ref;
AuthorizationItem auth_items[1];
AuthorizationRights auth_rights;
CFBundleRef bundle_ref;
CFURLRef url_ref;
CFStringRef path_str;
CFStringRef tool_name_str;
char c;
bundle_ref = CFBundleGetMainBundle();
if(bundle_ref == NULL) {
return NULL;
}
tool_name_str = CFStringCreateWithCString(NULL, tool_name,
kCFStringEncodingUTF8);
url_ref = CFBundleCopyResourceURL(bundle_ref, tool_name_str,
NULL, NULL);
CFRelease(tool_name_str);
if(url_ref == NULL) {
return NULL;
}
path_str = CFURLCopyFileSystemPath(url_ref, kCFURLPOSIXPathStyle);
CFRelease(url_ref);
if(path_str == NULL) {
return NULL;
}
if(!CFStringGetCString(path_str, path_buffer, sizeof(path_buffer),
kCFStringEncodingUTF8)) {
CFRelease(path_str);
return NULL;
}
CFRelease(path_str);
args[0] = (char *)tool_name;
args[1] = (char *)if_name;
auth_flags = kAuthorizationFlagExtendRights |
kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagPreAuthorize;
auth_items[0].name = "system.privilege.admin";
auth_items[0].valueLength = 0;
auth_items[0].value = NULL;
auth_items[0].flags = 0;
auth_rights.count = sizeof (auth_items) / sizeof (auth_items[0]);
auth_rights.items = auth_items;
auth_status = AuthorizationCreate(&auth_rights,
kAuthorizationEmptyEnvironment,
auth_flags,
&auth_ref);
if (auth_status != errAuthorizationSuccess) {
fprintf(stderr, "%s: AuthorizationCreate() failed.\n",
__func__);
return NULL;
}
auth_status = AuthorizationExecuteWithPrivileges(auth_ref,
path_buffer,
kAuthorizationFlagDefaults,
args + 1,
&fp);
if (auth_status != errAuthorizationSuccess) {
fprintf(stderr, "%s: AuthorizationExecWithPrivileges() failed.\n",
__func__);
return NULL;
}
if(fread(&c, 1, 1, fp) != 1) {
fclose(fp);
return NULL;
}
return fp;
}

View File

@ -68,6 +68,9 @@
#define DEBUG 0
#include "debug.h"
#define CODE_INVALID -1
#define CODE_HOTKEY -2
// Supported video modes
using std::vector;
static vector<VIDEO_MODE> VideoModes;
@ -88,12 +91,12 @@ 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";
#if defined(__MACOSX__) || defined(WIN32)
const char KEYCODE_FILE_NAME[] = "keycodes";
const char KEYCODE_FILE_NAME2[] = "BasiliskII_keycodes";
#else
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
const char KEYCODE_FILE_NAME2[] = DATADIR "/BasiliskII_keycodes";
#endif
@ -760,11 +763,17 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
}
if (!sdl_renderer) {
const char *render_driver = PrefsFindString("sdlrender");
if (render_driver) {
SDL_SetHint(SDL_HINT_RENDER_DRIVER, render_driver);
}
else {
#ifdef WIN32
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
#else
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "");
#endif
}
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
if (!sdl_renderer) {
shutdown_sdl_video();
@ -1197,7 +1206,8 @@ static void keycode_init(void)
const char *kc_path = PrefsFindString("keycodefile");
// Open keycode table
FILE *f = fopen(kc_path ? kc_path : KEYCODE_FILE_NAME, "r");
FILE *f = fopen(kc_path && *kc_path ? kc_path : KEYCODE_FILE_NAME, "r");
if (f == NULL) f = fopen(KEYCODE_FILE_NAME2, "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));
@ -1207,7 +1217,7 @@ static void keycode_init(void)
// Default translation table
for (int i=0; i<256; i++)
keycode_table[i] = -1;
keycode_table[i] = CODE_INVALID;
// Search for server vendor string, then read keycodes
const char * video_driver = SDL_GetCurrentVideoDriver();
@ -1893,27 +1903,6 @@ void video_set_cursor(void)
* 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_hotkey_down(SDL_Keysym const & ks)
{
int hotkey = PrefsFindInt32("hotkey");
@ -1925,8 +1914,8 @@ static bool is_hotkey_down(SDL_Keysym const & ks)
/*
* Translate key event to Mac keycode, returns -1 if no keycode was found
* and -2 if the key was recognized as a hotkey
* Translate key event to Mac keycode, returns CODE_INVALID if no keycode was found
* and CODE_HOTKEY if the key was recognized as a hotkey
*/
static int kc_decode(SDL_Keysym const & ks, bool key_down)
@ -1982,8 +1971,8 @@ static int kc_decode(SDL_Keysym const & ks, bool key_down)
case SDLK_PERIOD: case SDLK_GREATER: return 0x2f;
case SDLK_SLASH: case SDLK_QUESTION: return 0x2c;
case SDLK_TAB: if (is_hotkey_down(ks)) {if (!key_down) drv->suspend(); return -2;} else return 0x30;
case SDLK_RETURN: if (is_hotkey_down(ks)) {if (!key_down) toggle_fullscreen = true; return -2;} else return 0x24;
case SDLK_TAB: if (is_hotkey_down(ks)) {if (!key_down) drv->suspend(); return CODE_HOTKEY;} else return 0x30;
case SDLK_RETURN: if (is_hotkey_down(ks)) {if (!key_down) toggle_fullscreen = true; return CODE_HOTKEY;} else return 0x24;
case SDLK_SPACE: return 0x31;
case SDLK_BACKSPACE: return 0x33;
@ -2018,9 +2007,9 @@ static int kc_decode(SDL_Keysym const & ks, bool key_down)
case SDLK_LEFT: return 0x3b;
case SDLK_RIGHT: return 0x3c;
case SDLK_ESCAPE: if (is_hotkey_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
case SDLK_ESCAPE: if (is_hotkey_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return CODE_HOTKEY;} else return 0x35;
case SDLK_F1: if (is_hotkey_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case SDLK_F1: if (is_hotkey_down(ks)) {if (!key_down) SysMountFirstFloppy(); return CODE_HOTKEY;} else return 0x7a;
case SDLK_F2: return 0x78;
case SDLK_F3: return 0x63;
case SDLK_F4: return 0x76;
@ -2056,7 +2045,7 @@ static int kc_decode(SDL_Keysym const & ks, bool key_down)
case SDLK_KP_EQUALS: return 0x51;
}
D(bug("Unhandled SDL keysym: %d\n", ks.sym));
return -1;
return CODE_INVALID;
}
static int event2keycode(SDL_KeyboardEvent const &ev, bool key_down)
@ -2209,18 +2198,21 @@ static void handle_events(void)
// 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
int code = CODE_INVALID;
if (use_keycodes && event2keycode(event.key, true) != CODE_HOTKEY)
code = keycode_table[event.key.keysym.scancode & 0xff];
if (code == CODE_INVALID)
code = event2keycode(event.key, true);
if (code >= 0) {
if (!emul_suspended) {
#ifdef WIN32
if (code == 0x39)
(SDL_GetModState() & KMOD_CAPS ? ADBKeyDown : ADBKeyUp)(code);
else
ADBKeyDown(code);
#else
ADBKeyDown(code);
#endif
if (code == 0x36)
ctrl_down = true;
#ifdef __APPLE__
@ -2243,15 +2235,18 @@ static void handle_events(void)
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
int code = CODE_INVALID;
if (use_keycodes && event2keycode(event.key, false) != CODE_HOTKEY)
code = keycode_table[event.key.keysym.scancode & 0xff];
if (code == CODE_INVALID)
code = event2keycode(event.key, false);
if (code >= 0) {
#ifdef WIN32
if (code != 0x39)
ADBKeyUp(code);
#else
ADBKeyUp(code);
#endif
if (code == 0x36)
ctrl_down = false;
#ifdef __APPLE__

View File

@ -71,7 +71,7 @@ void SaveXPRAM(void)
SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME);
// Save the XPRAM file
FILE *f = fopen(XPRAM_FILE_NAME, "wb");
FILE *f = fopen(full_path, "wb");
if (f != NULL) {
fwrite(XPRAM, 256, 1, f);
fclose(f);

File diff suppressed because it is too large Load Diff

View File

@ -1,166 +0,0 @@
/* GIMP RGBA C-Source image dump (BasiliskII_32x32x32_icon.c) */
static const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
unsigned char pixel_data[32 * 32 * 4 + 1];
} icon_32x32x32 = {
32, 32, 4,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q'\17s\377s\0\377q\37\6s\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0JJJ\377\7\7\7!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0h(\16k\377\214\0\377"
"\356b\16\357\36\27\27!\12\12\12\30%%%)\356b\16\357\315Y\40\316\263I\40\326"
"\245B)\377\203\27\0\204z\16\0{z\16\0{\203\27\0\204z\16\0{\203\27\0\204z\16"
"\0{z\16\0{\203\27\0\204\264I\27\265,\26\15""9\0\0\0\10\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\377{\0\377\377\204"
"\0\377%\22\22)\27\27\27!AAARbbb\224jjj\224\377\224\0\377\377\214\0\377\377"
"\224\0\377\377\224\0\377\377\214\0\377\377\224\0\377\377\224\0\377\377\224"
"\0\377\377\224\0\377\377\224\0\377\377\224\0\377\377\224\0\377\377\224\0"
"\377\377s\0\377,((9\37\37\37)\0\0\0\0\0\0\0\0,,,9jjj\204jjj\204aaa{jjj\204"
"\2138\40\224\377\224\0\377\377k\0\377bbb\204jjj\234zzz\306zzz\326\203\203"
"\203\316zzz\245\377\224\0\377\377\204\0\377\377s\0\377\377s\0\377\377{\0"
"\377\377s\0\377\377s\0\377\377s\0\377\377{\0\377\377s\0\377\377s\0\377\377"
"s\0\377\377s\0\377\377c\0\377zzz\306rrr\265\0\0\0\0\0\0\0\0jjj\204\234\234"
"\234\377\234\234\234\377\245\245\245\377\357c\30\377\377\224\0\377\367c\0"
"\377\224\224\224\377{{{\377ccc\377sss\377\214\214\214\377\234\234\234\377"
"\234\234\234\377\377\224\0\377\377{\0\377\377s\0\377\377k\0\377\377k\0\377"
"\377s\0\377\377k\0\377\377s\0\377\377k\0\377\377s\0\377\377s\0\377\377s\0"
"\377\377s\0\377\306Z9\377{{{\377rrr\275\0\0\0\0\0\0\0\0bbb\204\234\234\234"
"\377\245\245\245\377\367s\20\377\377\204\0\377\377k\0\377\214\214\214\377"
"kkk\377ZZZ\377{{{\377\224\224\224\377\234\234\234\377\245\245\245\377\224"
"\224\224\377\2559!\377\306\224\204\377\214kk\377kkk\377sss\377sss\377sss"
"\377sss\377sss\377sss\377sss\377\367R\10\377\377k\0\377{{{\377\203\203\203"
"\367XXX\204\0\0\0\0\0\0\0\0jjj\204\245\245\245\377\357c\30\377\377\204\0"
"\377\377s\0\377\224\204\204\377ccc\377ZZZ\377{{{\377\234\234\234\377\245"
"\245\245\377\245\245\245\377\234\234\234\377RRR\377sss\377\306\306\306\377"
"\214\214\214\377\214\214\214\377\214\214\214\377\214\214\214\377\214\214"
"\214\377\224\224\224\377\214\214\214\377\214\214\214\377\224\224\224\377"
"\377c\0\377\357R\30\377\204\204\204\377zzz\326666B\0\0\0\0\0\0\0\0aaa{\306"
"sR\377\377\224\0\377\377{\0\377\316R1\377ccc\377RRR\377JJJ\377{{{\377\234"
"\234\234\377\245\245\245\377\234\234\234\377\224\224\224\377RRR\377\336\336"
"\336\377\336\336\336\377\316\316\316\377\316\316\316\377\224\224\224\377"
"RRR\377\326\326\326\377\326\326\326\377\326\326\326\377\326\326\326\377\326"
"\306\306\377\377k\0\377\306\275\265\377\203\203\203\357jjj\234\25\25\25\30"
"\0\0\0\0\0\0\0\0jbb\204\377\224\0\377\377{\0\377\377k\0\377ccc\377RRR\377"
"kkk\377ccc\377\204\204\204\377\245\245\245\377\245\245\245\377\234\234\234"
"\377ZZZ\377ccc\377\347\347\347\377\347\347\347\377\347\347\347\377\347\347"
"\347\377\224\224\224\377RRR\377\347\347\347\377\336\336\336\377\347\347\347"
"\377\347\347\347\377\367k9\377\377c\0\377\275\275\275\377\203\203\203\347"
"IIIZ\0\0\0\0\0\0\0\0\0\0\0\0\356j\16\357\377\204\0\377\377s\0\377\234R9\377"
"RRR\377ZZZ\377\214\214\214\377ccc\377\204\204\204\377\234\234\234\377\234"
"\234\234\377\245\245\245\377RRR\377\326\326\326\377\347\347\347\377\336\336"
"\336\377\347\347\347\377\336\336\336\377\234\234\234\377JJJ\377\347\347\347"
"\377\347\347\347\377\347\347\347\377\336\336\336\377\377k\0\377\347\224\204"
"\377\234\234\234\377\203\203\203\326\36\36\36!\0\0\0\0\0\0\0\0\0\0\0\10\377"
"\224\0\377\377{\0\377\377k\0\377RRR\377RRR\377sss\377\224\224\224\377\234"
"\234\234\377\245\245\245\377\245\245\245\377\234\234\234\377\214\214\214"
"\377JJJ\377\347\347\347\377\347\347\347\377\347\347\347\377\336\336\336\377"
"\347\347\347\377\347\347\347\377\347\347\347\377\347\347\347\377\347\347"
"\347\377\336\336\336\377\347\275\265\377\377s\0\377\316\316\316\377\214\214"
"\214\377\203\203\203\265\0\0\0\10\0\0\0\0\0\0\0\0\335Y\26\336\377\214\0\377"
"\377s\0\377\316B\30\377JJJ\377ZZZ\377\204\204\204\377\234\234\234\377\245"
"\245\245\377\245\245\245\377\234\234\234\377\245\245\245\377ccc\377kkk\377"
"\347\347\347\377\336\336\336\377\347\347\347\377\347\347\347\377\347\347"
"\347\377\336\336\336\377\336\336\336\377\347\347\347\377\336\336\336\377"
"\347\347\347\377\377c!\377\367c)\377\265\265\265\377\214\214\214\377zzz\224"
"\0\0\0\0\0\0\0\0\0\0\0\0\377\224\0\377\377{\0\377\377k\0\377ZRR\377RRR\377"
"{kk\377\377Z\10\377\377s\0\377\377s\0\377\377s\0\377\357R\30\377\245\245"
"\245\377RRR\377\255\255\255\377\347\347\347\377\336\336\336\377\347\347\347"
"\377\336\336\336\377\347\347\347\377\347\347\347\377\347\347\347\377\347"
"\347\347\377\347\347\347\377\347\347\347\377\377k\0\377\336\316\316\377\234"
"\234\234\377\245\245\245\377yyy\204\0\0\0\0\0\0\0\0\36\27\27!\377\224\0\377"
"\377s\0\377\377k\0\377RRR\377ZRR\377\377k\0\377\316cJ\377\316cJ\377\377\214"
"\0\377\377s\0\377\377s\0\377\377c\0\377RRR\377\326\326\326\377\336\336\336"
"\377\347\347\347\377\347\347\347\377\347\347\347\377\336\336\336\377\347"
"\347\347\377\336\336\336\377\347\347\347\377\336\336\336\377\357\245\224"
"\377\377c\0\377\306\306\306\377\214\214\214\377\275\275\275\377yyy\204\0"
"\0\0\0\0\0\0\0\212(\16\214\377\224\0\377\377k\0\377\377R\0\377RRR\377ccc"
"\377\224\224\224\377\234\234\234\377{{{\377ccc\377\377\214\0\377\377s\0\377"
"\377s\0\377\347B\10\377\316\316\316\377\347\347\347\377\347\347\347\377\347"
"\347\347\377\336\336\336\377\347\347\347\377\347\347\347\377\347\347\347"
"\377\347\347\347\377\347\347\347\377\377R\0\377\357\204c\377\255\255\255"
"\377\224\224\224\377\326\326\326\377zzz{\0\0\0\0\0\0\0\0\335b\26\336\377"
"\214\0\377\377s\0\377\336J\20\377RRR\377kkk\377\224\224\224\377\204\204\204"
"\377kkk\377{{{\377\265ZJ\377\377\214\0\377\377s\0\377\377s\0\377111\377J"
"JJ\377RRR\377JJJ\377RRR\377\347\347\347\377\347\347\347\377\347\347\347\377"
"\336\336\336\377\347\347\347\377\377k\0\377\326\326\326\377\234\234\234\377"
"\255\255\255\377\336\336\336\377yyy\204\0\0\0\0\0\0\0\0\377Z\0\377\377\204"
"\0\377\377k\0\377\275B\30\377JJJ\377{{{\377\234\234\234\377\234\234\234\377"
"\234\234\234\377\234\234\234\377\234\234\234\377\377\224\0\377\377{\0\377"
"\377s\0\377\265B)\377sss\377\224\224\224\377kkk\377ZZZ\377\336\336\336\377"
"\336\336\336\377\347\347\347\377\347\347\347\377\367\224{\377\377Z\10\377"
"\306\306\306\377\214\214\214\377\306\306\306\377\336\336\336\377\203\203"
"\203\204\0\0\0\0\0\0\0\0\377c\0\377\377\204\0\377\377s\0\377\275B!\377RR"
"R\377{{{\377\234\234\234\377\245\245\245\377\234\234\234\377\245\245\245"
"\377\234\234\234\377\377c\0\377\377\214\0\377\377k\0\377\357J\10\377ccc\377"
"\224\224\224\377RRR\377\214\214\214\377\347\347\347\377\347\347\347\377\347"
"\347\347\377\336\336\336\377\377Z\0\377\347\245\234\377\255\255\255\377\234"
"\234\234\377\326\326\326\377\347\347\347\377zzz{\0\0\0\0\0\0\0\0\377c\0\377"
"\377\204\0\377\377s\0\377\316J\30\377RRR\377\204\204\204\377\224\224\224"
"\377kkk\377{{{\377\234\234\234\377\245\245\245\377\347c)\377\377\224\0\377"
"\377s\0\377\377R\0\377RRR\377\204\204\204\377JJJ\377\265\265\265\377\347"
"\347\347\377\336\336\336\377\347\347\347\377\336\336\336\377\377k\0\377J"
"JJ\377\214\214\214\377\265\265\265\377\336\336\336\377\347\347\347\377zz"
"z{\0\0\0\0\0\0\0\0\346b\17\347\377\214\0\377\377k\0\377\347J\10\377ZZZ\377"
"\204\204\204\377\245\245\245\377\214\214\214\377kkk\377kkk\377kkk\377\275"
"J1\377\377\224\0\377\377s\0\377\377Z\0\377JJJ\377sss\377RRR\377\214\214\214"
"\377sss\377ZZZ\377JJJ\377\275B!\377\336J\20\377\255\255\255\377\224\224\224"
"\377\316\316\316\377\336\336\336\377\347\347\347\377zzz{\0\0\0\0\0\0\0\0"
"\2437\27\245\377\214\0\377\377s\0\377\377Z\0\377RRR\377\204\204\204\377\234"
"\234\234\377\245\245\245\377\234\234\234\377\245\245\245\377\234\234\234"
"\377\306ZB\377\377\224\0\377\377s\0\377\367J\0\377111\377RRR\377RRR\377Z"
"ZZ\377sss\377\224\224\224\377\326\326\326\377\377c\0\377\336\326\316\377"
"\245\245\245\377\245\245\245\377\336\336\336\377\347\347\347\377\347\347"
"\347\377zzz{\0\0\0\0\0\0\0\0%\22\22)\377\214\0\377\377s\0\377\377k\0\377"
"RRR\377{{{\377\234\234\234\377\245\245\245\377\234\234\234\377\245\245\245"
"\377\234\234\234\377\326kJ\377\377\214\0\377\377s\0\377\306J!\377RRR\377"
"sss\377JJJ\377\265\265\265\377\336\336\336\377\347\347\347\377\347\326\326"
"\377\377c\0\377\316\316\316\377\224\224\224\377\275\275\275\377\336\336\336"
"\377\347\347\347\377\336\336\336\377zzz{\0\0\0\0\0\0\0\0\0\0\0\0\377\224"
"\0\377\377\204\0\377\377s\0\377kJJ\377kkk\377\234\234\234\377\245\245\245"
"\377\234\234\234\377\245\245\245\377\245\245\245\377\347c)\377\377\214\0"
"\377\377s\0\377cJB\377ZZZ\377{{{\377RRR\377\224\224\224\377\347\347\347\377"
"\347\347\347\377\367c)\377\367\204c\377\275\275\275\377\224\224\224\377\316"
"\316\316\377\347\347\347\377\347\347\347\377\347\347\347\377yyy\204\0\0\0"
"\0\0\0\0\0\0\0\0\0\264@\27\265\377\214\0\377\377s\0\377\357J\10\377kkk\377"
"\224\224\224\377\245\245\245\377\234\234\234\377\245\245\245\377\234\234"
"\234\377\377c\0\377\377\204\0\377\377c\0\377RRR\377ZZZ\377\204\204\204\377"
"ccc\377ccc\377\336\336\336\377\347\347\347\377\377s\0\377\326\326\326\377"
"\245\245\245\377\245\245\245\377\336\336\336\377\336\336\336\377\336\336"
"\336\377\347\347\347\377zzz{\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\377\224\0\377"
"\377\204\0\377\377k\0\377kkc\377\245\245\245\377\265\265\265\377\275\275"
"\275\377\265\265\265\377\265\265\265\377\377\224\0\377\377s\0\377\234ZR\377"
"ccc\377kkk\377\245\245\245\377\245\245\245\377RRR\377\357\357\357\377\357"
"\255\234\377\377R\0\377\326\326\326\377\234\234\234\377\326\326\326\377\357"
"\357\357\377\357\357\357\377\367\367\367\377\357\357\357\377zzz{\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0H%\37J\377\214\0\377\377{\0\377\367Z\0\377XXX\204"
"\17\17\17\20\0\0\0\0\0\0\0\0\2128\27\214\377{\0\377\335Q\16\336zzz\326zz"
"z\367bbb\224\17\17\17\20\0\0\0\0RRR\377\0\0\0\0\377Z\0\377W\37\26ZQQQkjj"
"j\234\27\27\27!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0yA0\204\377\224\0\377\377{\0\377\367Z\10\3776..B\0"
"\0\0\0P\37\17R\377{\0\377\346Y\16\357QQQk\203\203\203\357zzz\316666B\0\0"
"\0\10\0\0\0\0III\336777\234\377s\0\377\27\27\27!rrr\245QQQk\0\0\0\10\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\17\17\17\20YYY{\356Y\7\367\377k\0\377\377k\0\377\377s\0\377\377c\0\377"
"a&\27c%%%)rrr\265zzz\326QQQk\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\20RRR\377\0\0"
"\0\0""777Jrrr\265$$$1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\25\25\25\30YYY{zzz\336\203\203"
"\203\357rrr\255IIIZIIIZjjj\245zzz\316QQQk\17\17\17\20\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\10IIIZXXXs\17\17\17\20\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\10\17\17\17\20AAAJbbb\224rrr\275zzz\275jjj\255bbb\214666B\17\17\17"
"\20\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\20\17"
"\17\17\20\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0",
};

View File

@ -20,6 +20,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
sw_vers > /dev/null && exit 0
PAGEZERO_SIZE=0x2000
[[ -n "$1" ]] && PAGEZERO_SIZE=$1
# You want all the output to go to stderr so that configure is quiet but

View File

@ -0,0 +1,506 @@
/*
* etherhelpertool.c - Reads and writes raw ethernet packets usng bpf
* interface.
*
* Copyright (C) 2010, Daniel Sumorok
*
* 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 <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <errno.h>
#include <sys/select.h>
#include <unistd.h>
#include <stdlib.h>
#include <net/if.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <fcntl.h>
#include <signal.h>
#include <linux/if_tun.h>
#include <strings.h>
#define STR_MAX 256
#define MAX_ARGV 10
static int remove_bridge = 0;
static char bridge_name[STR_MAX];
static const char *exec_name = "etherhelpertool";
static int main_loop(int sd, int use_bpf);
static int open_tap(char *ifname);
static int run_cmd(const char *cmd);
static void handler(int signum);
static int install_signal_handlers(void);
static void do_exit(void);
static int open_bpf(char *ifname);
int main(int argc, char **argv)
{
char *if_name;
int ret = 255;
int sd = -1;
int tapNum;
int use_bpf;
if (argc != 2) {
return 255;
}
if_name = argv[1];
do {
if (strncmp(if_name, "tap", 3) == 0) {
sd = open_tap(if_name);
use_bpf = 0;
} else {
sd = open_bpf(if_name);
use_bpf = 1;
}
if (sd < 0) {
fprintf(stderr, "%s: open device failed.\n",
exec_name);
ret = 253;
break;
}
if (install_signal_handlers() != 0) {
fprintf(stderr,
"%s: failed to install signal handers.\n",
exec_name);
ret = 252;
break;
}
ret = main_loop(sd, use_bpf);
close(sd);
} while (0);
do_exit();
return ret;
}
static int main_loop(int sd, int use_bpf)
{
fd_set readSet;
char *outgoing, *incoming;
unsigned short *out_len;
unsigned short *in_len;
int in_index, out_index;
u_int blen = 0;
int ret;
int fret = 0;
int pkt_len;
int frame_len;
int pad;
char c = 0;
blen = 4096;
incoming = malloc(blen);
if (incoming == NULL) {
fprintf(stderr,
"%s: malloc() failed.\n",
exec_name);
return -2;
}
outgoing = malloc(blen);
if (outgoing == NULL) {
free(outgoing);
fprintf(stderr,
"%s: malloc() failed.\n",
exec_name);
return -3;
}
in_index = 0;
out_index = 0;
out_len = (unsigned short *)outgoing;
/* Let our parent know we are ready for business. */
if(write(0, &c, 1) != 1) {
fprintf(stderr, "%s: Failed to notify main application: %s\n",
__func__, strerror(errno));
}
while (1) {
int i;
FD_ZERO(&readSet);
FD_SET(0, &readSet);
FD_SET(sd, &readSet);
ret = select(sd + 1, &readSet, NULL, NULL, NULL);
if (ret < 0) {
fprintf(stderr,
"%s: select() failed.\n",
exec_name);
fret = -4;
break;
}
if (FD_ISSET(0, &readSet)) {
if (out_index < 2) {
ret = read(0, outgoing + out_index, 2-out_index);
} else {
ret = read(0, outgoing + out_index, *out_len - out_index + 2);
}
if (ret < 1) {
if(ret < 0) {
fprintf(stderr,
"%s: read() failed.\n",
exec_name);
}
fret = -5;
break;
}
out_index += ret;
if (out_index > 1) {
if ((*out_len + 2) > blen) {
fret = -6;
break;
}
if (out_index == (*out_len + 2)) {
if(use_bpf) {
ret = write(sd, out_len + 1, *out_len);
if (ret != *out_len) {
fprintf(stderr,
"%s: write() failed.\n",
exec_name);
fret = -7;
break;
}
} else {
ret = write(sd, out_len + 1, *out_len);
if (ret != *out_len) {
fprintf(stderr,
"%s: write() failed.\n",
exec_name);
fret = -7;
break;
}
}
out_index = 0;
}
}
}
if (FD_ISSET(sd, &readSet)) {
in_len = (unsigned short *)incoming;
pkt_len = read(sd, in_len + 1, blen-2);
if (pkt_len < 14) {
fprintf(stderr,
"%s: read() returned %d.\n",
exec_name, pkt_len);
fret = -8;
break;
}
*in_len = pkt_len;
if (write(0, in_len, pkt_len + 2) < (pkt_len + 2)) {
fprintf(stderr,
"%s: write() failed\n",
exec_name);
fret = -10;
break;
}
}
}
free(incoming);
free(outgoing);
return fret;
}
static int open_tap(char *ifname)
{
char str[STR_MAX] = {0};
char ifstr[STR_MAX] = {0};
char *interface;
char *address = NULL;
char *netmask = NULL;
char *bridge = NULL;
char *bridged_if = NULL;
int sd;
struct ifreq ifr = {0};
snprintf(ifstr, STR_MAX, "%s", ifname);
interface = strtok(ifstr, "/");
bridge = strtok(NULL, "/");
if (bridge != NULL) {
bridged_if = strtok(NULL, "/");
}
interface = strtok(ifstr, ":");
address = strtok(NULL, ":");
if (address != NULL) {
netmask = strtok(NULL, ":");
}
sd = open("/dev/net/tun", O_RDWR);
if (sd < 0) {
fprintf(stderr, "%s: Failed to open %s\n",
exec_name, interface);
return -1;
}
snprintf(str, STR_MAX, "/dev/%s", interface);
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
strncpy(ifr.ifr_name, interface, IFNAMSIZ);
if(ioctl(sd, TUNSETIFF, (void *)&ifr) != 0) {
fprintf(stderr, "%s: ioctl(TUNSETIFF): %s\n",
__func__, strerror(errno));
close(sd);
return -1;
}
if (address == NULL) {
snprintf(str, STR_MAX, "/sbin/ifconfig %s up", interface);
} else if (netmask == NULL) {
snprintf(str, STR_MAX, "/sbin/ifconfig %s %s",
interface, address);
} else {
snprintf(str, STR_MAX, "/sbin/ifconfig %s %s netmask %s",
interface, address, netmask);
}
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to configure %s\n",
exec_name, interface);
close(sd);
return -1;
}
if (bridge != NULL) {
/* Check to see if bridge is alread up */
snprintf(str, STR_MAX, "/sbin/ifconfig %s", bridge);
if (run_cmd(str) == 0) {
/* bridge is already up */
if (bridged_if != NULL) {
fprintf(stderr, "%s: Warning: %s already exists, so %s was not added.\n",
exec_name, bridge, bridged_if);
}
} else {
snprintf(str, STR_MAX, "/sbin/brctl addbr %s", bridge);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to create %s\n",
exec_name, bridge);
close(sd);
return -1;
}
remove_bridge = 1;
strncpy(bridge_name, bridge, STR_MAX);
snprintf(str, STR_MAX, "/sbin/ifconfig %s up", bridge);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to open %s\n",
exec_name, bridge);
close(sd);
return -1;
}
if (bridged_if != NULL) {
snprintf(str, STR_MAX, "/sbin/brctl addif %s %s",
bridge, bridged_if);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to add %s to %s\n",
exec_name, bridged_if, bridge);
close(sd);
return -1;
}
}
snprintf(str, STR_MAX, "/sbin/brctl addif %s %s",
bridge, interface);
if (run_cmd(str) != 0) {
fprintf(stderr, "%s: Failed to add %s to %s\n",
exec_name, interface, bridge);
close(sd);
return -1;
}
}
}
return sd;
}
static int run_cmd(const char *cmd) {
char cmd_buffer[STR_MAX] = {0};
char *argv[MAX_ARGV + 1] = {0};
int i;
pid_t pid, waitpid;
int status = 0;
/* Collect arguments */
strncpy(cmd_buffer, cmd, STR_MAX-1);
argv[0] = strtok(cmd_buffer, " ");
for (i=1; i<MAX_ARGV; ++i) {
argv[i] = strtok(NULL, " ");
if (argv[i] == NULL) {
break;
}
}
/* Run sub process */
pid = fork();
if (pid == 0) {
/* Child process */
fclose(stdout);
fclose(stderr);
if (execve(argv[0], argv, NULL) < 0) {
perror("execve");
return -1;
}
} else {
/* Wait for child to exit */
waitpid = wait(&status);
if (waitpid < 0) {
perror("wait");
return -1;
}
if (status != 0) {
return -1;
}
}
return 0;
}
static void handler(int signum) {
do_exit();
exit(1);
}
static int install_signal_handlers() {
struct sigaction act = {0};
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
if (sigaction(SIGINT, &act, NULL) != 0) {
return -1;
}
if (sigaction(SIGHUP, &act, NULL) != 0) {
return -1;
}
if (sigaction(SIGTERM, &act, NULL) != 0) {
return -1;
}
return 0;
}
static void do_exit() {
char cmd[STR_MAX];
if (remove_bridge) {
snprintf(cmd, STR_MAX, "/sbin/ifconfig %s down",
bridge_name);
if(run_cmd(cmd) != 0) {
fprintf(stderr, "Failed to bring bridge down\n");
}
snprintf(cmd, STR_MAX, "/sbin/brctl delbr %s",
bridge_name);
if(run_cmd(cmd) != 0) {
fprintf(stderr, "Failed to destroy bridge\n");
}
}
}
static int open_bpf(char *ifname)
{
int sd;
struct sockaddr_ll sockaddr = {0};
struct ifreq ifreq = {0};
struct packet_mreq pmreq = {0};
socklen_t socklen = sizeof(struct packet_mreq);
sd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if(sd < 0) {
perror("socket");
return -1;
}
strncpy(ifreq.ifr_name, ifname, IFNAMSIZ);
if(ioctl(sd, SIOCGIFINDEX, &ifreq) != 0) {
fprintf(stderr, "%s: ioctl(SIOCGIFINDEX): %s\n",
__func__, strerror(errno));
close(sd);
return -1;
}
pmreq.mr_ifindex = ifreq.ifr_ifindex;
pmreq.mr_type = PACKET_MR_PROMISC;
if(setsockopt(sd, SOL_PACKET, PACKET_ADD_MEMBERSHIP,
&pmreq, socklen) != 0) {
fprintf(stderr, "%s: setsockopt() failed: %s\n",
__func__, strerror(errno));
close(sd);
return -1;
}
sockaddr.sll_family = AF_PACKET;
sockaddr.sll_ifindex = ifreq.ifr_ifindex;
sockaddr.sll_protocol = htons(ETH_P_ALL);
if(bind(sd, (struct sockaddr *)&sockaddr,
sizeof(struct sockaddr_ll)) != 0) {
fprintf(stderr, "%s: bind failed: %s\n",
__func__, strerror(errno));
close(sd);
return -1;
}
return sd;
}

View File

@ -0,0 +1,58 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#define STR_MAX 1024
#define MAX_ARGV 10
FILE * run_tool(const char *if_name, const char *tool_name) {
char cmd_buffer[STR_MAX] = {0};
char * const argv[3] = {NULL, NULL, NULL};
int i;
pid_t pid, waitpid;
int status = 0;
int fds[2];
char c;
if(socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) != 0) {
fprintf(stderr, "%s: socketpair() failed: %s\n",
__func__, strerror(errno));
return NULL;
}
((const char**)argv)[0] = tool_name;
((const char**)argv)[1] = if_name;
/* Run sub process */
pid = fork();
if (pid == 0) {
/* Child process */
fclose(stdout);
fclose(stdin);
dup2(fds[0], 0);
close(fds[1]);
close(fds[0]);
if (execve(tool_name, argv, NULL) < 0) {
perror("execve");
exit(1);
}
}
close(fds[0]);
if(read(fds[1], &c, 1) < 1) {
close(fds[1]);
return NULL;
}
return fdopen(fds[1], "rw");
}

View File

@ -39,7 +39,7 @@ AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX d
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=yes])
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
dnl FPU emulation core.
@ -81,7 +81,7 @@ AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [
*) WANT_GTK="no";;
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(mon, [ --with-mon use mon as debugger [default=no]], [WANT_MON=$withval], [WANT_MON=no])
AC_ARG_WITH(bincue,
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
@ -881,6 +881,9 @@ if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
;;
esac
if [[ "$WANT_GTK" != "no" ]]; then
LIBS="$LIBS -lX11"
fi
fi
elif [[ "x$WANT_MACOSX_GUI" != "xyes" ]]; then
VIDEOSRCS="video_x.cpp"

View File

@ -41,6 +41,21 @@
#endif
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef ENABLE_MACOSX_ETHERHELPER
#ifdef __APPLE__
#include <net/if_dl.h>
#endif
#ifdef __linux__
#include <linux/if_packet.h>
#endif
#include <sys/socket.h>
#include <ifaddrs.h>
#endif
#include <sys/wait.h>
#include <netinet/in.h>
#include <pthread.h>
@ -49,6 +64,7 @@
#include <stdio.h>
#include <signal.h>
#include <map>
#include <string>
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
#include <net/if.h>
@ -93,9 +109,17 @@ enum {
NET_IF_SHEEPNET,
NET_IF_ETHERTAP,
NET_IF_TUNTAP,
NET_IF_SLIRP
NET_IF_SLIRP,
NET_IF_ETHERHELPER
};
#ifdef ENABLE_MACOSX_ETHERHELPER
extern "C" {
extern FILE * run_tool(const char *if_name, const char *tool_name);
}
#endif
// Constants
#if ENABLE_TUNTAP
static const char ETHERCONFIG_FILE_NAME[] = DATADIR "/tunconfig";
@ -122,6 +146,11 @@ static uint8 ether_addr[6]; // Our Ethernet address
const bool ether_driver_opened = true; // Flag: is the MacOS driver opened?
#endif
#ifdef ENABLE_MACOSX_ETHERHELPER
static uint8 packet_buffer[2048];
#endif
// Attached network protocols, maps protocol type to MacOS handler address
static map<uint16, uint32> net_protocols;
@ -135,6 +164,11 @@ static void ether_do_interrupt(void);
static void slirp_add_redirs();
static int slirp_add_redir(const char *redir_str);
#ifdef ENABLE_MACOSX_ETHERHELPER
static int get_mac_address(const char* dev, unsigned char *addr);
static bool open_ether_helper(const std::string &if_name);
static int read_packet(void);
#endif
/*
* Start packet reception thread
@ -235,6 +269,9 @@ bool ether_init(void)
// Do nothing if no Ethernet device specified
const char *name = PrefsFindString("ether");
#ifdef ENABLE_MACOSX_ETHERHELPER
std::string slave_dev;
#endif
if (name == NULL)
return false;
@ -249,6 +286,10 @@ bool ether_init(void)
#ifdef HAVE_SLIRP
else if (strcmp(name, "slirp") == 0)
net_if_type = NET_IF_SLIRP;
#endif
#ifdef ENABLE_MACOSX_ETHERHELPER
else if (strncmp(name, "etherhelper", 10) == 0)
net_if_type = NET_IF_ETHERHELPER;
#endif
else
net_if_type = NET_IF_SHEEPNET;
@ -300,6 +341,25 @@ bool ether_init(void)
case NET_IF_SHEEPNET:
strcpy(dev_name, "/dev/sheep_net");
break;
#ifdef ENABLE_MACOSX_ETHERHELPER
case NET_IF_ETHERHELPER: {
std::string device(name);
size_t pos;
pos = device.find('/');
if(pos != device.npos) {
slave_dev = device.substr(pos + 1);
}
if(slave_dev.size() == 0) {
WarningAlert("No network device specified.");
return false;
}
return open_ether_helper(slave_dev);
}
#endif
}
if (net_if_type != NET_IF_SLIRP) {
fd = open(dev_name, O_RDWR);
@ -750,6 +810,21 @@ static int16 ether_do_write(uint32 arg)
write(slirp_input_fd, packet, len);
return noErr;
} else
#endif
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
unsigned short pkt_len;
pkt_len = len;
if (write(fd, &pkt_len, 2) < 2) {
return excessCollsns;
}
if (write(fd, packet, len) < len) {
return excessCollsns;
}
return noErr;
} else
#endif
if (write(fd, packet, len) < 0) {
D(bug("WARNING: Couldn't transmit packet\n"));
@ -884,6 +959,13 @@ static void *receive_func(void *arg)
if (res <= 0)
break;
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
if (read_packet() < 1) {
break;
}
}
#endif
if (ether_driver_opened) {
// Trigger Ethernet interrupt
D(bug(" packet received, triggering Ethernet interrupt\n"));
@ -923,6 +1005,18 @@ void ether_do_interrupt(void)
ether_udp_read(packet, length, &from);
} else
#endif
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
unsigned short *pkt_len;
uint32 p = packet;
pkt_len = (unsigned short *)packet_buffer;
length = *pkt_len;
memcpy(Mac2HostAddr(packet), pkt_len + 1, length);
ether_dispatch_packet(p, length);
break;
} else
#endif
{
@ -1049,3 +1143,144 @@ static int slirp_add_redir(const char *redir_str)
WarningAlert(str);
return -1;
}
#ifdef ENABLE_MACOSX_ETHERHELPER
static int get_mac_address(const char* dev, unsigned char *addr)
{
struct ifaddrs *ifaddrs, *next;
int ret = -1;
#ifdef __APPLE__
struct sockaddr_dl *sa;
#endif
#ifdef __linux__
struct sockaddr_ll *sa;
#endif
if (getifaddrs(&ifaddrs) != 0) {
perror("getifaddrs");
return -1;
}
next = ifaddrs;
while (next != NULL) {
switch (next->ifa_addr->sa_family) {
#ifdef __APPLE__
case AF_LINK:
if (!strcmp(dev, next->ifa_name)) {
sa = (struct sockaddr_dl *)next->ifa_addr;
memcpy(addr, LLADDR(sa), 6);
ret = 0;
}
break;
#endif
#ifdef __linux__
case AF_PACKET:
if (!strcmp(dev, next->ifa_name)) {
sa = (struct sockaddr_ll *)next->ifa_addr;
memcpy(addr, sa->sll_addr, 6);
ret = 0;
}
break;
#endif
default:
break;
}
next = next->ifa_next;
}
freeifaddrs(ifaddrs);
return ret;
}
static bool open_ether_helper(const std::string &if_name)
{
FILE *fp;
char str[64];
std::string dev_name;
size_t pos;
fp = run_tool(if_name.c_str(), "etherhelpertool");
if (fp == NULL) {
snprintf(str, sizeof(str), "Unable to run ether helper helper tool.");
WarningAlert(str);
return false;
}
pos = if_name.find('/');
dev_name = if_name;
if(pos != if_name.npos) {
dev_name.erase(pos);
}
if(strncmp(if_name.c_str(), "tap", 3) != 0) {
if (get_mac_address(dev_name.c_str(), ether_addr) != 0) {
snprintf(str, sizeof(str), "Unable to find interface %s.",
dev_name.c_str());
WarningAlert(str);
return false;
}
} else {
/* There is something special about this address. */
pid_t p = getpid();
ether_addr[0] = 0xfe;
ether_addr[1] = 0xfd;
ether_addr[2] = p >> 24;
ether_addr[3] = p >> 16;
ether_addr[4] = p >> 8;
ether_addr[5] = p;
}
fd = dup(fileno(fp));
fclose(fp);
if (start_thread() == false) {
close(fd);
fd = -1;
return false;
}
return true;
}
static int read_packet()
{
int index;
unsigned short *pkt_len;
int ret = -1;
pkt_len = (unsigned short *)packet_buffer;
index = 0;
while (1) {
if (index < 2) {
ret = read(fd, packet_buffer + index, 2 - index);
} else {
ret = read(fd, packet_buffer + index, *pkt_len - index + 2);
}
if (ret < 1) {
fprintf(stderr, "%s: read() returned %d.\n", __func__, ret);
break;
}
index += ret;
if (index > 1) {
if (*pkt_len > (sizeof(packet_buffer) + 2)) {
fprintf(stderr, "%s: pkt_len (%d) too large.\n", __func__, *pkt_len);
break;
}
if (index == (*pkt_len + 2)) {
ret = *pkt_len;
break;
}
}
}
return ret;
}
#endif

6
BasiliskII/src/Unix/main_unix.cpp Normal file → Executable file
View File

@ -63,6 +63,9 @@ struct sigstate {
# ifdef HAVE_GNOMEUI
# include <gnome.h>
# endif
# if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
# include <X11/Xlib.h>
# endif
#endif
#ifdef ENABLE_XF86_DGA
@ -384,6 +387,9 @@ static void usage(const char *prg_name)
int main(int argc, char **argv)
{
#if defined(ENABLE_GTK) && !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
XInitThreads();
#endif
const char *vmdir = NULL;
char str[256];

View File

@ -31,11 +31,7 @@ using std::string;
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
{"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"},
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"},
{"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"},
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"},
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
{"dsp", TYPE_STRING, false, "audio output (dsp) device name"},
{"mixer", TYPE_STRING, false, "audio mixer device name"},
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION

View File

@ -446,87 +446,6 @@ static void set_window_name(Window w, int name)
}
}
// This struct is designed to match the ones generated by GIMP in
// BasiliskII_*_icon.c
struct gimp_image {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel;
unsigned char pixel_data[0]; // Variable-length
};
// These were generated by using 'icns2png -x
// ../MacOSX/BasiliskII.icns', then using GIMP to convert the
// resulting .png files into "C source code (*.c)". GIMP doesn't
// generate corresponding .h files with extern declarations, so just
// #include the .c files here.
#include "BasiliskII_32x32x32_icon.c"
#include "BasiliskII_128x128x32_icon.c"
// Set window icons
static void set_window_icons(Window w)
{
// As per the _NET_WM_ICON documentation at
// https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472568384,
// "The first two cardinals are width, height."
const unsigned int HEADER_SIZE = 2;
// We will pass 32-bit values to XChangeProperty()
const unsigned int FORMAT = 32;
// Icon data from GIMP to be converted and passed to the
// Window Manager
const struct gimp_image* const icons[] =
{(struct gimp_image *) &icon_32x32x32,
(struct gimp_image *) &icon_128x128x32};
const unsigned int num_icons = sizeof(icons) / sizeof(icons[0]);
unsigned int icon;
// Work out how big the buffer needs to be to store all of our icons
unsigned int buffer_size = 0;
for (icon = 0; icon < num_icons; icon++) {
buffer_size += HEADER_SIZE +
icons[icon]->width * icons[icon]->height;
}
// As per the XChangeProperty() man page, "If the specified
// format is 32, the property data must be a long array."
unsigned long buffer[buffer_size];
// This points to the start of the current icon within buffer
unsigned long *buffer_icon = buffer;
// Copy the icons into the buffer
for (icon = 0; icon < num_icons; icon++) {
const unsigned int pixel_count = icons[icon]->width *
icons[icon]->height;
assert(icons[icon]->bytes_per_pixel == 4);
buffer_icon[0] = icons[icon]->width;
buffer_icon[1] = icons[icon]->height;
unsigned long *const buffer_pixels = buffer_icon + HEADER_SIZE;
unsigned int i;
for (i = 0; i < pixel_count; i++) {
const unsigned char *src =
&icons[icon]->pixel_data[i * icons[icon]->bytes_per_pixel];
buffer_pixels[i] = (src[3] << 24 |
src[0] << 16 |
src[1] << 8 |
src[2]);
}
buffer_icon += HEADER_SIZE + pixel_count;
}
Atom net_wm_icon = XInternAtom(x_display, "_NET_WM_ICON", False);
if (net_wm_icon == None) {
ErrorAlert(STR_X_ICON_ATOM_ALLOC_ERR);
// We can still continue running, just without an icon
return;
}
XChangeProperty(x_display, w, net_wm_icon, XA_CARDINAL, FORMAT,
PropModeReplace, (const unsigned char *) buffer,
buffer_size);
}
// Set window input focus flag
static void set_window_focus(Window w)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@ -118,7 +118,7 @@ $(APP): $(XPLATSRCS) $(OBJ_DIR) $(OBJS)
$(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS)
$(UI_APP): $(XPLATSRCS) $(OBJ_DIR) $(UI_OBJS)
$(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin
$(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) -Wl,-Bdynamic $(GTK_LIBS) -Wl,-Bstatic -mwindows -static-libgcc
mostlyclean:
rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak
@ -149,7 +149,7 @@ $(OBJ_DIR)/%.o : %.cpp
$(OBJ_DIR)/%.o : %.s
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@
$(OBJ_DIR)/prefs_editor_gtk.o: prefs_editor_gtk.cpp
$(CXX) -O2 -mno-cygwin -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@
$(CXX) -O2 -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@
# Windows resources
$(OBJ_DIR)/%.o: %.rc

View File

@ -101,6 +101,14 @@ static int net_if_type = -1; // Ethernet device type
#ifdef SHEEPSHAVER
static bool net_open = false; // Flag: initialization succeeded, network device open
uint8 ether_addr[6]; // Our Ethernet address
#else
const bool ether_driver_opened = true; // Flag: Driver is open on MacOS side
// so ether.h layer is ready for
// calls.
// B2 doesn't provide this
// but also calls don't need it
#endif
// These are protected by queue_csection
@ -1571,10 +1579,16 @@ unsigned int WINAPI ether_thread_feed_int(void *arg)
D(bug("Triggering\n"));
looping = true;
while(thread_active && looping) {
trigger_queue();
// Wait for interrupt acknowledge by EtherInterrupt()
WaitForSingleObject(int_ack,INFINITE);
if(thread_active) looping = set_wait_request();
if (ether_driver_opened) {
trigger_queue();
// Wait for interrupt acknowledge by EtherInterrupt()
WaitForSingleObject(int_ack,INFINITE);
if(thread_active) looping = set_wait_request();
} else {
// Ether driver is closed on the MacOS side
// ether.h calls in this case are undefined
Delay_usec(20000);
}
}
D(bug("Queue empty.\n"));
}

View File

@ -392,14 +392,23 @@ void init_posix_emu(void)
int fd = my_creat( custom_icon_name, 0 );
if(fd >= 0) {
my_close(fd);
struct my_stat custom_icon_stat;
int stat_result = my_stat( custom_icon_name, &custom_icon_stat );
fd = open_rfork( custom_icon_name, O_RDWR|O_CREAT );
if(fd >= 0) {
my_write( fd, my_comp_icon, sizeof(my_comp_icon) );
my_close(fd);
static uint8 host_finfo[SIZEOF_FInfo];
// need room for the things from around the finfo that set_finfo reads
static uint8 custom_icon_hfile[ioFlXFndrInfo + SIZEOF_FXInfo];
memset(custom_icon_hfile, 0, ioFlXFndrInfo + SIZEOF_FXInfo);
static uint8 * host_finfo = custom_icon_hfile + ioFlFndrInfo;
uint32 finfo = Host2MacAddr(host_finfo);
get_finfo(custom_icon_name, finfo, 0, false);
WriteMacInt16(finfo + fdFlags, kIsInvisible);
if (stat_result == 0) {
WriteMacInt32(finfo - ioFlFndrInfo + ioFlCrDat, TimeToMacTime(custom_icon_stat.st_ctime));
WriteMacInt32(finfo - ioFlFndrInfo + ioFlMdDat, TimeToMacTime(custom_icon_stat.st_mtime));
}
set_finfo(custom_icon_name, finfo, 0, false);
get_finfo(my_computer, finfo, 0, true);
WriteMacInt16(finfo + fdFlags, ReadMacInt16(finfo + fdFlags) | kHasCustomIcon);

View File

@ -79,24 +79,33 @@ extern int my_errno;
// must hook all other functions that manipulate file names
#ifndef NO_POSIX_API_HOOK
#define stat my_stat
#define fstat my_fstat
#define open my_open
#define rename my_rename
#define access my_access
#define mkdir my_mkdir
#define remove my_remove
#define creat my_creat
#define close my_close
#define lseek my_lseek
#define read my_read
#define write my_write
#define ftruncate my_chsize
#define locking my_locking
#define utime my_utime
# ifdef stat
# undef stat
# endif
# define stat my_stat
# ifdef fstat
# undef fstat
# endif
# define fstat my_fstat
# define open my_open
# define rename my_rename
# define access my_access
# define mkdir my_mkdir
# define remove my_remove
# define creat my_creat
# define close my_close
# ifdef lseek
# undef lseek
# endif
# define lseek my_lseek
# define read my_read
# define write my_write
# define ftruncate my_chsize
# define locking my_locking
# define utime my_utime
#undef errno
#define errno my_errno
# undef errno
# define errno my_errno
#endif //!NO_POSIX_API_HOOK
#ifndef S_ISDIR
@ -125,6 +134,6 @@ struct my_utimbuf
};
// Your compiler may have different "struct stat" -> edit "struct my_stat"
#define validate_stat_struct ( sizeof(struct my_stat) == sizeof(struct stat) )
#define validate_stat_struct ( sizeof(struct my_stat) == sizeof(struct _stat) )
#define st_crtime st_ctime

View File

@ -26,6 +26,8 @@
#include <sys/stat.h>
#include <gtk/gtk.h>
#include <shellapi.h>
#include "user_strings.h"
#include "version.h"
#include "cdrom.h"
@ -76,6 +78,27 @@ enum {
* Utility functions
*/
gchar * tchar_to_g_utf8(const TCHAR * str) {
gchar * out;
if (str == NULL)
return NULL;
int len = _tcslen(str) + 1;
#ifdef _UNICODE
/* First call just to find what the output size will be */
int size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
if (size == 0)
return NULL;
out = (gchar *) g_malloc(size);
if (out == NULL)
return NULL;
WideCharToMultiByte(CP_UTF8, 0, str, len, out, size, NULL, NULL);
#else /* _UNICODE */
out = g_locale_to_utf8(str, -1, NULL, NULL, NULL);
#endif /* _UNICODE */
return out;
}
struct opt_desc {
int label_id;
GtkSignalFunc func;
@ -672,11 +695,11 @@ static GList *add_cdrom_names(void)
{
GList *glist = NULL;
char rootdir[4] = "X:\\";
for (char letter = 'C'; letter <= 'Z'; letter++) {
TCHAR rootdir[4] = TEXT("X:\\");
for (TCHAR letter = TEXT('C'); letter <= TEXT('Z'); letter++) {
rootdir[0] = letter;
if (GetDriveType(rootdir) == DRIVE_CDROM)
glist = g_list_append(glist, strdup(rootdir));
glist = g_list_append(glist, _tcsdup(rootdir));
}
return glist;
@ -887,11 +910,12 @@ static void create_jit_pane(GtkWidget *top)
#endif
set_jit_sensitive();
#endif
#ifdef SHEEPSHAVER
make_checkbox(box, STR_JIT_68K_CTRL, "jit68k", GTK_SIGNAL_FUNC(tb_jit_68k));
#endif
#endif
}
/*
@ -1466,24 +1490,25 @@ static int create_ether_menu(GtkWidget *menu)
n_items++;
// Basilisk II Ethernet Adapter
PacketOpenAdapter("", 0);
PacketOpenAdapter(TEXT(""), 0);
{
ULONG sz;
char names[1024];
TCHAR names[1024];
sz = sizeof(names);
if (PacketGetAdapterNames(NULL, names, &sz) == ERROR_SUCCESS) {
char *p = names;
TCHAR *p = names;
while (*p) {
const char DEVICE_HEADER[] = "\\Device\\B2ether_";
if (strnicmp(p, DEVICE_HEADER, sizeof(DEVICE_HEADER) - 1) == 0) {
const TCHAR DEVICE_HEADER[] = TEXT("\\Device\\B2ether_");
if (_tcsnicmp(p, DEVICE_HEADER, sizeof(DEVICE_HEADER) - 1) == 0) {
LPADAPTER fd = PacketOpenAdapter(p + sizeof(DEVICE_HEADER) - 1, 0);
if (fd) {
char guid[256];
sprintf(guid, "%s", p + sizeof(DEVICE_HEADER) - 1);
const char *name = ether_guid_to_name(guid);
if (name && (name = g_locale_to_utf8(name, -1, NULL, NULL, NULL))) {
add_menu_item(menu, name, (GtkSignalFunc)mn_ether_b2ether, strdup(guid));
if (etherguid && strcmp(guid, etherguid) == 0 &&
TCHAR guid[256];
_stprintf(guid, TEXT("%s"), p + sizeof(DEVICE_HEADER) - 1);
const gchar *name = tchar_to_g_utf8(ether_guid_to_name(guid));
if (name) {
std::string str_guid = to_string(guid);
add_menu_item(menu, name, (GtkSignalFunc)mn_ether_b2ether, strdup(str_guid.c_str()));
if (etherguid && to_tstring(guid).compare(to_tstring(etherguid)) == 0 &&
ether && strcmp(ether, "b2ether") == 0)
active = n_items;
n_items++;
@ -1491,26 +1516,27 @@ static int create_ether_menu(GtkWidget *menu)
PacketCloseAdapter(fd);
}
}
p += strlen(p) + 1;
p += _tcslen(p) + 1;
}
}
}
PacketCloseAdapter(NULL);
// TAP-Win32
const char *tap_devices;
const TCHAR *tap_devices;
if ((tap_devices = ether_tap_devices()) != NULL) {
const char *guid = tap_devices;
const TCHAR *guid = tap_devices;
while (*guid) {
const char *name = ether_guid_to_name(guid);
if (name && (name = g_locale_to_utf8(name, -1, NULL, NULL, NULL))) {
add_menu_item(menu, name, (GtkSignalFunc)mn_ether_tap, strdup(guid));
if (etherguid && strcmp(guid, etherguid) == 0 &&
const gchar *name = tchar_to_g_utf8(ether_guid_to_name(guid));
if (name) {
std::string str_guid = to_string(guid);
add_menu_item(menu, name, (GtkSignalFunc)mn_ether_tap, strdup(str_guid.c_str()));
if (etherguid && to_tstring(guid).compare(to_tstring(etherguid)) == 0 &&
ether && strcmp(ether, "tap") == 0)
active = n_items;
n_items++;
}
guid += strlen(guid) + 1;
guid += _tcslen(guid) + 1;
}
free((char *)tap_devices);
}
@ -1734,21 +1760,66 @@ void SysAddSerialPrefs(void)
* Display alerts
*/
static HWND GetMainWindowHandle() {
return NULL;
}
static void display_alert(int title_id, const char *text, int flags)
{
MessageBox(NULL, text, GetString(title_id), MB_OK | flags);
HWND hMainWnd = GetMainWindowHandle();
MessageBoxA(hMainWnd, text, GetString(title_id), MB_OK | flags);
}
#ifdef _UNICODE
static void display_alert(int title_id, const wchar_t *text, int flags)
{
HWND hMainWnd = GetMainWindowHandle();
MessageBoxW(hMainWnd, text, GetStringW(title_id).get(), MB_OK | flags);
}
#endif
/*
* Display error alert
*/
void ErrorAlert(const char *text)
{
if (PrefsFindBool("nogui"))
return;
display_alert(STR_ERROR_ALERT_TITLE, text, MB_ICONSTOP);
}
#ifdef _UNICODE
void ErrorAlert(const wchar_t *text)
{
if (PrefsFindBool("nogui"))
return;
display_alert(STR_ERROR_ALERT_TITLE, text, MB_ICONSTOP);
}
#endif
/*
* Display warning alert
*/
void WarningAlert(const char *text)
{
if (PrefsFindBool("nogui"))
return;
display_alert(STR_WARNING_ALERT_TITLE, text, MB_ICONSTOP);
}
#ifdef _UNICODE
void WarningAlert(const wchar_t *text)
{
if (PrefsFindBool("nogui"))
return;
display_alert(STR_WARNING_ALERT_TITLE, text, MB_ICONSTOP);
}
#endif
/*
* Start standalone GUI
@ -1774,23 +1845,23 @@ int main(int argc, char *argv[])
// Transfer control to the executable
if (start) {
char path[_MAX_PATH];
TCHAR path[_MAX_PATH];
bool ok = GetModuleFileName(NULL, path, sizeof(path)) != 0;
if (ok) {
char b2_path[_MAX_PATH];
char *p = strrchr(path, '\\');
*++p = '\0';
TCHAR b2_path[_MAX_PATH];
TCHAR *p = _tcsrchr(path, TEXT('\\'));
*++p = TEXT('\0');
SetCurrentDirectory(path);
strcpy(b2_path, path);
strcat(b2_path, PROGRAM_NAME);
strcat(b2_path, ".exe");
HINSTANCE h = ShellExecute(GetDesktopWindow(), "open",
b2_path, "", path, SW_SHOWNORMAL);
_tcscpy(b2_path, path);
_tcscat(b2_path, TEXT(PROGRAM_NAME));
_tcscat(b2_path, TEXT(".exe"));
HINSTANCE h = ShellExecute(GetDesktopWindow(), TEXT("open"),
b2_path, TEXT(""), path, SW_SHOWNORMAL);
if ((int)h <= 32)
ok = false;
}
if (!ok) {
ErrorAlert("Coult not start " PROGRAM_NAME " executable");
ErrorAlert(TEXT("Could not start ") TEXT(PROGRAM_NAME) TEXT(" executable"));
return 1;
}
}

View File

@ -23,6 +23,7 @@
#ifdef __MINGW32__
#define _UNICODE
#define UNICODE
#endif
#if !defined _MSC_VER && !defined __STDC__

View File

@ -20,7 +20,7 @@
#include "sysdeps.h"
#include "user_strings.h"
#include "util_windows.h"
// Platform-specific string definitions
user_string_def platform_strings[] = {
@ -81,7 +81,11 @@ static const char *get_volume_name(void)
HKEY hHelpKey;
DWORD key_type, cbData;
static char volume[256];
#ifdef _UNICODE
static char out_volume[256];
#endif
static TCHAR volume[256];
memset(volume, 0, sizeof(volume));
// Try Windows 2000 key first
@ -118,14 +122,20 @@ static const char *get_volume_name(void)
}
// Fix the error that some "tweak" apps do.
if (_stricmp(volume, "%USERNAME% on %COMPUTER%") == 0)
volume[0] = '\0';
if (_tcsicmp(volume, TEXT("%USERNAME% on %COMPUTER%")) == 0)
volume[0] = TEXT('\0');
// No volume name found, default to "My Computer"
if (volume[0] == 0)
strcpy(volume, "My Computer");
_tcscpy(volume, TEXT("My Computer"));
#ifdef _UNICODE
strlcpy(out_volume, volume, 256);
return out_volume;
#else
return volume;
#endif
}

View File

@ -57,6 +57,11 @@ const int KEY_BUFFER_SIZE = 16;
static uint8 key_buffer[KEY_BUFFER_SIZE];
static unsigned int key_read_ptr = 0, key_write_ptr = 0;
// O2S: Button event buffer (Mac button with up/down flag) -> avoid to loose tap on a trackpad
const int BUTTON_BUFFER_SIZE = 32;
static uint8 button_buffer[BUTTON_BUFFER_SIZE];
static unsigned int button_read_ptr = 0, button_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
@ -245,13 +250,17 @@ void ADBMouseMoved(int x, int y)
}
/*
/*
* Mouse button pressed
*/
void ADBMouseDown(int button)
{
mouse_button[button] = true;
// O2S: Add button to buffer
button_buffer[button_write_ptr] = button;
button_write_ptr = (button_write_ptr + 1) % BUTTON_BUFFER_SIZE;
// O2S: mouse_button[button] = true;
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
@ -263,7 +272,11 @@ void ADBMouseDown(int button)
void ADBMouseUp(int button)
{
mouse_button[button] = false;
// O2S: Add button to buffer
button_buffer[button_write_ptr] = button | 0x80;
button_write_ptr = (button_write_ptr + 1) % BUTTON_BUFFER_SIZE;
// O2S: mouse_button[button] = false;
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
@ -278,7 +291,7 @@ void ADBSetRelMouseMode(bool relative)
if (relative_mouse != relative) {
relative_mouse = relative;
mouse_x = mouse_y = 0;
}
}
}
@ -347,34 +360,39 @@ void ADBInterrupt(void)
uint32 mouse_base = adb_base + 16;
if (relative_mouse) {
while (mx != 0 || my != 0 || button_read_ptr != button_write_ptr) {
if (button_read_ptr != button_write_ptr) {
// Read button event
uint8 button = button_buffer[button_read_ptr];
button_read_ptr = (button_read_ptr + 1) % BUTTON_BUFFER_SIZE;
mouse_button[button & 0x3] = (button & 0x80) ? false : true;
}
// Call mouse ADB handler
if (mouse_reg_3[1] == 4) {
// Extended mouse protocol
WriteMacInt8(tmp_data, 3);
WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mouse_button[0] ? 0 : 0x80));
WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mouse_button[1] ? 0 : 0x80));
WriteMacInt8(tmp_data + 3, ((my >> 3) & 0x70) | ((mx >> 7) & 0x07) | (mouse_button[2] ? 0x08 : 0x88));
} else {
// 100/200 dpi mode
WriteMacInt8(tmp_data, 2);
WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mouse_button[0] ? 0 : 0x80));
WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mouse_button[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);
// 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];
}
old_mouse_button[0] = mouse_button[0];
old_mouse_button[1] = mouse_button[1];
old_mouse_button[2] = mouse_button[2];
mx = 0;
my = 0;
}
} else {
@ -405,34 +423,42 @@ void ADBInterrupt(void)
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;
// O2S: Process accumulated button events
while (button_read_ptr != button_write_ptr) {
// Read button event
uint8 button = button_buffer[button_read_ptr];
button_read_ptr = (button_read_ptr + 1) % BUTTON_BUFFER_SIZE;
mouse_button[button & 0x3] = (button & 0x80) ? false : true;
// 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);
if (mouse_button[0] != old_mouse_button[0] || mouse_button[1] != old_mouse_button[1] || mouse_button[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, mouse_button[0] ? 0 : 0x80);
WriteMacInt8(tmp_data + 2, mouse_button[1] ? 0 : 0x80);
WriteMacInt8(tmp_data + 3, mouse_button[2] ? 0x08 : 0x88);
} else {
// 100/200 dpi mode
WriteMacInt8(tmp_data, 2);
WriteMacInt8(tmp_data + 1, mouse_button[0] ? 0 : 0x80);
WriteMacInt8(tmp_data + 2, mouse_button[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] = mouse_button[0];
old_mouse_button[1] = mouse_button[1];
old_mouse_button[2] = mouse_button[2];
}
}
old_mouse_button[0] = mb[0];
old_mouse_button[1] = mb[1];
old_mouse_button[2] = mb[2];
}
}
// Process accumulated keyboard events

View File

@ -133,6 +133,13 @@ uint32 TimeToMacTime(time_t t)
// This code is taken from glibc 2.2
// Convert to number of seconds elapsed since 1-Jan-1904
#ifdef WIN32
if (t == -1) {
// failsafe as this will segfault
return 0;
}
#endif
struct tm *local = localtime(&t);
const int TM_EPOCH_YEAR = 1900;
const int MAC_EPOCH_YEAR = 1904;

View File

@ -68,10 +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"},
{"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"},
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"},
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support (0=page up/down, 1=cursor up/down)"},
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
{"hotkey",TYPE_INT32,false,"hotkey modifier"},
{"scale_nearest",TYPE_BOOLEAN,false,"nearest neighbor scaling"},
{"scale_integer",TYPE_BOOLEAN,false,"integer scaling"},

View File

@ -427,7 +427,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
/* Connected */
so->so_state &= ~SS_ISFCONNECTING;
ret = send(so->s, &ret, 0, 0);
ret = send(so->s, NULL, 0, 0);
if (ret < 0) {
/* XXXXX Must fix, zero bytes is a NOP */
if (errno == EAGAIN || errno == EWOULDBLOCK ||

View File

@ -32,21 +32,6 @@ typedef unsigned long ioctlsockopt_t;
# include <winsock2.h>
# include <WS2tcpip.h>
#ifdef __MINGW32__
char * WSAAPI inet_ntop(
INT Family,
PVOID pAddr,
PTSTR pStringBuf,
size_t StringBufSize
);
INT WSAAPI inet_pton(
INT Family,
const char * pszAddrString,
PVOID pAddrBuf
);
#endif
# include <sys/timeb.h>
# include <iphlpapi.h>

View File

@ -8,23 +8,25 @@ MinGW 32-bit JIT
```
macOS 64-bit JIT
Linux 32-bit JIT
MinGW 32-bit ---
MinGW 32-bit JIT
```
### How To Build
These builds need to be installed SDL2 framework/library.
These builds need to be installed SDL2.0.10+ framework/library.
#### BasiliskII
##### macOS
1. Open BasiliskII/src/MacOSX/BasiliskII.xcodeproj
1. Set Build Configuration to Release
1. Build
(or same as Linux)
##### Linux(x86)
```
$ cd macemu/BasiliskII/src/Unix
$ ./autogen.sh
$ make
```
##### MinGW32/MSYS
##### MinGW32/MSYS2
```
$ cd macemu/BasiliskII/src/Windows
$ ../Unix/autogen.sh
@ -36,15 +38,15 @@ $ make
1. Set Build Configuration to Release
1. Build
(or same as Linux)
##### Linux(x86)
```
$ cd macemu/SheepShaver
$ make links
$ cd src/Unix
$ cd macemu/SheepShaver/src/Unix
$ ./autogen.sh
$ make
```
##### MinGW32/MSYS
##### MinGW32/MSYS2
```
$ cd macemu/SheepShaver
$ make links

View File

@ -61,7 +61,7 @@ links:
BeOS/audio_beos.cpp BeOS/extfs_beos.cpp BeOS/scsi_beos.cpp \
BeOS/serial_beos.cpp BeOS/sys_beos.cpp BeOS/timer_beos.cpp \
BeOS/xpram_beos.cpp BeOS/SheepDriver BeOS/SheepNet \
CrossPlatform/sigsegv.h CrossPlatform/sigsegv.cpp CrossPlatform/vm_alloc.h CrossPlatform/vm_alloc.cpp \
CrossPlatform/sigsegv.h CrossPlatform/vm_alloc.h CrossPlatform/vm_alloc.cpp \
CrossPlatform/video_vosf.h CrossPlatform/video_blit.h CrossPlatform/video_blit.cpp \
Unix/audio_oss_esd.cpp Unix/bincue_unix.cpp Unix/bincue_unix.h \
Unix/vhd_unix.cpp \
@ -74,7 +74,7 @@ links:
Unix/rpc.h Unix/rpc_unix.cpp Unix/ldscripts \
Unix/tinyxml2.h Unix/tinyxml2.cpp Unix/disk_unix.h \
Unix/disk_sparsebundle.cpp Unix/Darwin/mkstandalone \
Unix/Darwin/lowmem.c Unix/Darwin/pagezero.c Unix/Darwin/testlmem.sh \
Unix/Darwin/pagezero.c Unix/Darwin/testlmem.sh \
dummy/audio_dummy.cpp dummy/clip_dummy.cpp dummy/serial_dummy.cpp \
dummy/prefs_editor_dummy.cpp dummy/scsi_dummy.cpp SDL slirp \
MacOSX/sys_darwin.cpp MacOSX/clip_macosx.cpp MacOSX/clip_macosx64.mm \
@ -99,7 +99,7 @@ links:
case $$i in *codegen_x86.h) o=kpx_cpu/src/cpu/jit/x86/codegen_x86.h;; esac; \
SUB=`echo $$o | sed 's;[^/]*/;../;g' | sed 's;[^/]*$$;;'` ;\
cur_link=src/$$o ;\
if [ -d "$$cur_link" ]; then rm -rf "$$cur_link"; fi ;\
if [ -e "$$cur_link" ]; then rm -rf "$$cur_link"; fi ;\
ln -sf "$$PREFIX$$SUB$(B2_TOPDIR)/src/$$i" $$cur_link; \
fi; \
done;

View File

@ -2608,8 +2608,14 @@ sigsegv_address_t sigsegv_get_fault_instruction_address(sigsegv_info_t *SIP)
#if defined(__APPLE__) && defined(__x86_64__)
extern uint8_t gZeroPage[0x3000], gKernelData[0x2000];
extern uint32_t RAMBase, ROMBase, ROMEnd;
#ifdef CONFIGURE_TEST_SIGSEGV_RECOVERY
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN uint8_t gZeroPage[0x3000], gKernelData[0x2000];
EXTERN uint32_t RAMBase, ROMBase, ROMEnd;
template<typename T> T safeLoad(uint32_t a) {
if (a < 0x3000) return *(T *)&gZeroPage[a];

View File

@ -1,25 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>SheepShaver</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@PACKAGE_VERSION@</string>
<key>CFBundleShortVersionString</key>
<string>@PACKAGE_VERSION@</string>
<key>CFBundleIconFile</key>
<string>SheepShaver.icns</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
@ -37,6 +21,24 @@
<true/>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>SheepShaver</string>
<key>CFBundleIconFile</key>
<string>SheepShaver.icns</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@PACKAGE_VERSION@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@PACKAGE_VERSION@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>

View File

@ -84,6 +84,9 @@
E413A40320CF7E6D00FBE967 /* video_sdl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E413A40220CF7E6D00FBE967 /* video_sdl2.cpp */; };
E4150D1220D557820077C51A /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E4150D1120D557820077C51A /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
E41936C420CFE64D003A7654 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = E41936C320CFE64D003A7654 /* SDLMain.m */; };
E4202603241250EE000508DF /* runtool.c in Sources */ = {isa = PBXBuildFile; fileRef = E4202602241250EE000508DF /* runtool.c */; };
E420260524125182000508DF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E420260424125182000508DF /* Security.framework */; };
E420260B24125442000508DF /* etherhelpertool in Resources */ = {isa = PBXBuildFile; fileRef = E420260A2412540D000508DF /* etherhelpertool */; };
E420910120D0C4FA0094654F /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E420910020D0C4FA0094654F /* SDL2.framework */; };
E444DC1520C8F06700DD29C9 /* pict.c in Sources */ = {isa = PBXBuildFile; fileRef = E444DC1420C8F06700DD29C9 /* pict.c */; };
E44C460520D262B0000583AE /* tftp.c in Sources */ = {isa = PBXBuildFile; fileRef = E44C45DC20D262AD000583AE /* tftp.c */; };
@ -329,6 +332,10 @@
E4150D1120D557820077C51A /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<group>"; };
E41936C220CFE64D003A7654 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLMain.h; path = ../../../BasiliskII/src/SDL/SDLMain.h; sourceTree = "<group>"; };
E41936C320CFE64D003A7654 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = ../../../BasiliskII/src/SDL/SDLMain.m; sourceTree = "<group>"; };
E4202600241250E2000508DF /* etherhelpertool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = etherhelpertool.c; sourceTree = "<group>"; };
E4202602241250EE000508DF /* runtool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = runtool.c; sourceTree = "<group>"; };
E420260424125182000508DF /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
E420260A2412540D000508DF /* etherhelpertool */ = {isa = PBXFileReference; lastKnownFileType = text; path = etherhelpertool; sourceTree = BUILT_PRODUCTS_DIR; };
E420910020D0C4FA0094654F /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<group>"; };
E4302EE21FBFE7FA00A5B500 /* lowmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lowmem.c; path = Darwin/lowmem.c; sourceTree = "<group>"; };
E444DC1420C8F06700DD29C9 /* pict.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pict.c; path = ../pict.c; sourceTree = "<group>"; };
@ -392,6 +399,7 @@
buildActionMask = 2147483647;
files = (
E420910120D0C4FA0094654F /* SDL2.framework in Frameworks */,
E420260524125182000508DF /* Security.framework in Frameworks */,
0856D21514A9A6C6000B1711 /* IOKit.framework in Frameworks */,
08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */,
08CD42E814B7B8AA009CA2A2 /* Carbon.framework in Frameworks */,
@ -430,6 +438,7 @@
0856CCC814A99E30000B1711 /* Sources */,
08CD42DF14B7B865009CA2A2 /* Frameworks */,
0856CCC214A99E1C000B1711 /* Products */,
E420260924125403000508DF /* Generated */,
);
sourceTree = "<group>";
};
@ -706,6 +715,8 @@
0856CE0614A99EEF000B1711 /* MacOSX */ = {
isa = PBXGroup;
children = (
E4202600241250E2000508DF /* etherhelpertool.c */,
E4202602241250EE000508DF /* runtool.c */,
0873A76514ABD151004F12B7 /* config */,
0856D2D614A9A704000B1711 /* Launcher */,
E456E2AC20C82B60006C8DC2 /* clip_macosx64.mm */,
@ -862,6 +873,7 @@
08CD42DF14B7B865009CA2A2 /* Frameworks */ = {
isa = PBXGroup;
children = (
E420260424125182000508DF /* Security.framework */,
E420910020D0C4FA0094654F /* SDL2.framework */,
08CD42E714B7B8AA009CA2A2 /* Carbon.framework */,
08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */,
@ -870,6 +882,14 @@
name = Frameworks;
sourceTree = "<group>";
};
E420260924125403000508DF /* Generated */ = {
isa = PBXGroup;
children = (
E420260A2412540D000508DF /* etherhelpertool */,
);
name = Generated;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -911,6 +931,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 0856CCC714A99E1D000B1711 /* Build configuration list for PBXNativeTarget "SheepShaver" */;
buildPhases = (
E4202606241251C6000508DF /* ShellScript */,
0856CCBD14A99E1C000B1711 /* Resources */,
0856CCBE14A99E1C000B1711 /* Sources */,
0856CCBF14A99E1C000B1711 /* Frameworks */,
@ -961,6 +982,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E420260B24125442000508DF /* etherhelpertool in Resources */,
E44C460820D262B0000583AE /* VERSION in Resources */,
0856D05914A99EF1000B1711 /* SheepShaver.icns in Resources */,
E44C460F20D262B0000583AE /* COPYRIGHT in Resources */,
@ -986,6 +1008,23 @@
shellPath = /bin/sh;
shellScript = "sed -i '' 's/@PACKAGE_VERSION@/2.5/g' \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"";
};
E4202606241251C6000508DF /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cc etherhelpertool.c -framework Security -o $BUILT_PRODUCTS_DIR/etherhelpertool\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -1049,6 +1088,7 @@
0856D06214A99EF1000B1711 /* audio_sdl.cpp in Sources */,
0856D06614A99EF1000B1711 /* serial.cpp in Sources */,
E456E2AD20C82B61006C8DC2 /* clip_macosx64.mm in Sources */,
E4202603241250EE000508DF /* runtool.c in Sources */,
0856D07B14A99EF1000B1711 /* sony.cpp in Sources */,
0856D07C14A99EF1000B1711 /* thunks.cpp in Sources */,
0856D07D14A99EF1000B1711 /* timer.cpp in Sources */,
@ -1227,6 +1267,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = (
ENABLE_MACOSX_ETHERHELPER,
"DATADIR=",
HAVE_CONFIG_H,
USE_JIT,
@ -1262,6 +1303,7 @@
"-lkpx_cpu",
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.sheepshaver;
PRODUCT_NAME = SheepShaver;
VALID_ARCHS = x86_64;
WARNING_LDFLAGS = "";
@ -1288,6 +1330,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = (
ENABLE_MACOSX_ETHERHELPER,
"DATADIR=",
HAVE_CONFIG_H,
USE_JIT,
@ -1324,6 +1367,7 @@
"-lkpx_cpu",
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.sheepshaver;
PRODUCT_NAME = SheepShaver;
VALID_ARCHS = x86_64;
};

View File

@ -0,0 +1 @@
../../../BasiliskII/src/MacOSX/etherhelpertool.c

View File

@ -0,0 +1 @@
../../../BasiliskII/src/MacOSX/runtool.c

View File

@ -21,5 +21,7 @@ dyngen
# Generated files from the Xcode build
basic-dyngen-ops-x86_32.hpp
basic-dyngen-ops-x86_64.hpp
basic-dyngen-ops-x86_64_macos.hpp
ppc-dyngen-ops-x86_32.hpp
ppc-dyngen-ops-x86_64.hpp
ppc-dyngen-ops-x86_64_macos.hpp

View File

@ -176,7 +176,7 @@ uninstall:
clean:
rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak ppc-execute-impl.cpp
rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc_asm.out.s
rm -f dyngen {basic,ppc}-dyngen-ops*.hpp ppc_asm.out.s
rm -rf $(APP_APP) $(GUI_APP_APP)
distclean: clean
@ -216,18 +216,22 @@ ifeq ($(USE_DYNGEN),yes)
DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp
ifeq ($(USE_DYNGEN_PRECOMPILED),yes)
basic-dyngen-ops.hpp: dyngen_precompiled/basic-dyngen-ops.hpp basic-dyngen-ops-x86_32.hpp basic-dyngen-ops-x86_64.hpp
basic-dyngen-ops.hpp: dyngen_precompiled/basic-dyngen-ops.hpp basic-dyngen-ops-x86_32.hpp basic-dyngen-ops-x86_64.hpp basic-dyngen-ops-x86_64_macos.hpp
cp -f $< $@
basic-dyngen-ops-x86_32.hpp: dyngen_precompiled/basic-dyngen-ops-x86_32.hpp
cp -f $< $@
basic-dyngen-ops-x86_64.hpp: dyngen_precompiled/basic-dyngen-ops-x86_64.hpp
cp -f $< $@
ppc-dyngen-ops.hpp: dyngen_precompiled/ppc-dyngen-ops.hpp ppc-dyngen-ops-x86_32.hpp ppc-dyngen-ops-x86_64.hpp
basic-dyngen-ops-x86_64_macos.hpp: dyngen_precompiled/basic-dyngen-ops-x86_64_macos.hpp
cp -f $< $@
ppc-dyngen-ops.hpp: dyngen_precompiled/ppc-dyngen-ops.hpp ppc-dyngen-ops-x86_32.hpp ppc-dyngen-ops-x86_64.hpp ppc-dyngen-ops-x86_64_macos.hpp
cp -f $< $@
ppc-dyngen-ops-x86_32.hpp: dyngen_precompiled/ppc-dyngen-ops-x86_32.hpp
cp -f $< $@
ppc-dyngen-ops-x86_64.hpp: dyngen_precompiled/ppc-dyngen-ops-x86_64.hpp
cp -f $< $@
ppc-dyngen-ops-x86_64_macos.hpp: dyngen_precompiled/ppc-dyngen-ops-x86_64_macos.hpp
cp -f $< $@
else
# Only GCC is supported for generating synthetic opcodes
$(DYNGEN): $(DYNGENOBJS)

View File

@ -34,7 +34,7 @@ AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb0 [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
AC_ARG_ENABLE(standalone-gui,[ --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no])
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]],
@ -764,6 +764,9 @@ if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
CPPFLAGS="$CPPFLAGS -I../MacOSX"
else
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
if [[ "$WANT_GTK" != "no" ]]; then
LIBS="$LIBS -lX11"
fi
fi
else
VIDEOSRCS="video_x.cpp"

View File

@ -57,6 +57,8 @@ template void powerpc_cpu::execute_fp_arith<double, op_fnmadds, operand_fp_RD, o
template void powerpc_cpu::execute_fp_arith<double, op_fnmsub, operand_fp_RD, operand_fp_RA, operand_fp_RC, operand_fp_RB, RC_BIT_G, true>(uint32);
template void powerpc_cpu::execute_fp_arith<double, op_fnmsubs, operand_fp_RD, operand_fp_RA, operand_fp_RC, operand_fp_RB, RC_BIT_G, true>(uint32);
template void powerpc_cpu::execute_fp_round<RC_BIT_G>(uint32);
template void powerpc_cpu::execute_fp_arith<double, op_fres, operand_fp_RD, operand_fp_RB, operand_fp_NONE, operand_fp_NONE, RC_BIT_G, true>(uint32);
template void powerpc_cpu::execute_fp_arith<double, op_frsqrte, operand_fp_RD, operand_fp_RB, operand_fp_NONE, operand_fp_NONE, RC_BIT_G, true>(uint32);
template void powerpc_cpu::execute_fp_arith<double, op_fsel, operand_fp_RD, operand_fp_RA, operand_fp_RC, operand_fp_RB, RC_BIT_G, false>(uint32);
template void powerpc_cpu::execute_fp_arith<double, op_fsub, operand_fp_RD, operand_fp_RA, operand_fp_RB, operand_fp_NONE, RC_BIT_G, true>(uint32);
template void powerpc_cpu::execute_fp_arith<float, op_fsub, operand_fp_RD, operand_fp_RA, operand_fp_RB, operand_fp_NONE, RC_BIT_G, true>(uint32);
@ -258,7 +260,7 @@ template void powerpc_cpu::execute_vector_arith<op_frsiz, operand_vD_V4SF, opera
template void powerpc_cpu::execute_vector_arith<op_vrl<uint8>, operand_vD_V16QI, operand_vA_V16QI, operand_vB_V16QI, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_arith<op_vrl<uint16>, operand_vD_V8HI, operand_vA_V8HI, operand_vB_V8HI, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_arith<op_vrl<uint32>, operand_vD_V4SI, operand_vA_V4SI, operand_vB_V4SI, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_arith<op_frsqrt, operand_vD_V4SF, operand_vA_NONE, operand_vB_V4SF, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_arith<op_frsqrte, operand_vD_V4SF, operand_vA_NONE, operand_vB_V4SF, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_arith<op_vsel, operand_vD_V4SI, operand_vA_V4SI, operand_vB_V4SI, operand_vC_V4SI, fake_bit_field< bool, false >, 0 >(uint32);
template void powerpc_cpu::execute_vector_shift<-1>(uint32);
template void powerpc_cpu::execute_vector_arith<op_vsl<uint8>, operand_vD_V16QI, operand_vA_V16QI, operand_vB_V16QI, operand_vC_NONE, fake_bit_field< bool, false >, 0 >(uint32);

View File

@ -133,6 +133,9 @@
#ifdef ENABLE_GTK
#include <gtk/gtk.h>
#if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
#include <X11/Xlib.h>
#endif
#endif
#ifdef ENABLE_XF86_DGA
@ -728,6 +731,9 @@ static bool init_sdl()
int main(int argc, char **argv)
{
#if defined(ENABLE_GTK) && !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
XInitThreads();
#endif
char str[256];
bool memory_mapped_from_zero, ram_rom_areas_contiguous;
const char *vmdir = NULL;

View File

@ -1,401 +0,0 @@
/*
* 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 <errno.h>
#define DEBUG 0
#include "debug.h"
// For NetBSD with broken pthreads headers
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
#if defined(__MACH__)
#include <mach/mach.h>
#include <mach/clock.h>
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 <pthread.h>
#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 <semaphore.h>
#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
}

View File

@ -0,0 +1 @@
../../../BasiliskII/src/Unix/timer_unix.cpp

View File

@ -35,7 +35,7 @@ CC = @CC@
CXX = @CXX@
CFLAGS = @CFLAGS@ $(SDL_CFLAGS)
CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS)
CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp -I../Unix/dyngen_precompiled
CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp
DEFS = @DEFS@
LDFLAGS = @LDFLAGS@ -Wl,-Bstatic
#TODO remove pthread part of that if irrelevant
@ -44,6 +44,7 @@ CPUSRCS = @CPUSRCS@
PERL = @PERL@
USE_DYNGEN = @USE_DYNGEN@
USE_PREGENERATED_DYNGEN = @USE_PREGENERATED_DYNGEN@
DYNGENSRCS = @DYNGENSRCS@
DYNGEN_CC = $(CXX)
DYNGEN_OP_FLAGS = @DYNGEN_OP_FLAGS@
@ -76,6 +77,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
UI_SRCS = ../prefs.cpp prefs_windows.cpp prefs_editor_gtk.cpp xpram_windows.cpp \
../prefs_items.cpp ../user_strings.cpp user_strings_windows.cpp util_windows.cpp \
../dummy/prefs_dummy.cpp \
b2ether/packet32.cpp SheepShaverGUI.rc
UI_APP = SheepShaverGUI.exe
@ -128,14 +130,15 @@ $(APP): $(XPLATSRCS) $(OBJ_DIR) $(OBJS)
$(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS)
$(UI_APP): $(XPLATSRCS) $(OBJ_DIR) $(UI_OBJS)
$(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin
$(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) -Wl,-Bdynamic $(GTK_LIBS) -Wl,-Bstatic -mwindows -static-libgcc
mostlyclean:
rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak
clean: mostlyclean
clean: mostlyclean dyngenclean
rm -f $(XPLATSRCS)
rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc-execute-impl.cpp
dyngenclean:
rm -f $(DYNGEN) basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc-execute-impl.cpp
distclean: clean
rm -rf $(OBJ_DIR)
@ -163,7 +166,7 @@ $(OBJ_DIR)/%.o : %.S
$(AS) $(ASFLAGS) -o $@ $*.out.s
rm $*.out.s
$(OBJ_DIR)/prefs_editor_gtk.o: prefs_editor_gtk.cpp
$(CXX) -O2 -mno-cygwin -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@
$(CXX) -O2 -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@
# Windows resources
$(OBJ_DIR)/%.o: %.rc
@ -176,36 +179,35 @@ DYNGEN = dyngen.exe
ifeq ($(USE_DYNGEN),yes)
DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp
dyngendeps: $(DYNGENDEPS)
###
basic-dyngen-ops.hpp: ../Unix/dyngen_precompiled/basic-dyngen-ops.hpp basic-dyngen-ops-x86_32.hpp basic-dyngen-ops-x86_64.hpp
$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp
$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp
ifeq ($(USE_PREGENERATED_DYNGEN),yes)
basic-dyngen-ops.hpp: cygwin_precompiled_dyngen/basic-dyngen-ops.hpp
cp -f $< $@
basic-dyngen-ops-x86_32.hpp: ../Unix/dyngen_precompiled/basic-dyngen-ops-x86_32.hpp
cp -f $< $@
basic-dyngen-ops-x86_64.hpp: ../Unix/dyngen_precompiled/basic-dyngen-ops-x86_64.hpp
cp -f $< $@
ppc-dyngen-ops.hpp: ../Unix/dyngen_precompiled/ppc-dyngen-ops.hpp ppc-dyngen-ops-x86_32.hpp ppc-dyngen-ops-x86_64.hpp
cp -f $< $@
ppc-dyngen-ops-x86_32.hpp: ../Unix/dyngen_precompiled/ppc-dyngen-ops-x86_32.hpp
cp -f $< $@
ppc-dyngen-ops-x86_64.hpp: ../Unix/dyngen_precompiled/ppc-dyngen-ops-x86_64.hpp
ppc-dyngen-ops.hpp: cygwin_precompiled_dyngen/ppc-dyngen-ops.hpp
cp -f $< $@
else
# Only GCC is supported for generating synthetic opcodes
#$(DYNGEN): $(DYNGENOBJS)
# $(HOST_CXX) -o $@ $(LDFLAGS) $(DYNGENOBJS)
$(DYNGEN): $(DYNGENOBJS)
$(HOST_CXX) -o $@ $(LDFLAGS) $(DYNGENOBJS)
#$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp
#$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp
# $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@
#basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN)
# ./$(DYNGEN) -o $@ $<
$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp
$(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@
basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN)
./$(DYNGEN) -o $@ $<
#$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp
#$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp
# $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@
#ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN)
# ./$(DYNGEN) -o $@ $<
$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp
$(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@
ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN)
./$(DYNGEN) -o $@ $<
endif
$(OBJ_DIR)/sheepshaver_glue.o $(OBJ_DIR)/ppc-cpu.o $(OBJ_DIR)/ppc-decode.o $(OBJ_DIR)/ppc-translate.o $(OBJ_DIR)/ppc-jit.o: basic-dyngen-ops.hpp ppc-dyngen-ops.hpp
endif

View File

@ -12,7 +12,7 @@ AC_CANONICAL_HOST
AC_CANONICAL_TARGET
dnl Options.
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=no])
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
@ -192,6 +192,13 @@ if [[ "x$HAVE_GCC30" = "xyes" ]]; then
CFLAGS="$SAVED_CFLAGS"
fi
case $host_os in
cygwin)
CFLAGS="$CFLAGS -mwin32"
CXXFLAGS="$CXXFLAGS -mwin32"
;;
esac
dnl CPU emulator sources
CPUSRCS="\
../kpx_cpu/src/mathlib/ieeefp.cpp \
@ -205,6 +212,7 @@ CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
dnl Enable JIT compiler, if possible
USE_DYNGEN="no"
USE_PREGENERATED_DYNGEN="no"
if [[ "x$WANT_JIT" = "xyes" ]]; then
case $host_cpu in
i?86)
@ -216,6 +224,16 @@ if [[ "x$WANT_JIT" = "xyes" ]]; then
fi
;;
esac
case $host_os in
cygwin)
USE_PREGENERATED_DYNGEN="no"
;;
*)
USE_PREGENERATED_DYNGEN="yes"
;;
esac
USE_DYNGEN="yes"
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0"
if [[ "x$HAVE_GCC30" = "xyes" ]]; then
@ -256,6 +274,7 @@ fi
dnl Generate Makefile.
AC_SUBST(PERL)
AC_SUBST(USE_DYNGEN)
AC_SUBST(USE_PREGENERATED_DYNGEN)
AC_SUBST(DYNGENSRCS)
AC_SUBST(DYNGEN_OP_FLAGS)
AC_SUBST(CPUSRCS)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,9 @@
#undef _TEXT
#include <time.h>
#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <WinSock2.h>
#endif
#include <sys/types.h>
@ -147,6 +149,19 @@ static inline uint32 do_opt_bswap_32(uint32 x)
__asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x));
return v;
}
#if defined(__CYGWIN__) || defined(__MINGW32__)
#define opt_bswap_16 do_opt_bswap_16
static inline uint16 do_opt_bswap_16(uint16 x)
{
uint16 v;
__asm__ __volatile__ ("rolw $8, %0" : "=r" (v) : "0" (x));
return v;
}
#endif
#endif
#endif

View File

@ -20,7 +20,7 @@
#include "sysdeps.h"
#include "user_strings.h"
#include "util_windows.h"
// Platform-specific string definitions
user_string_def platform_strings[] = {
@ -86,7 +86,11 @@ static const char *get_volume_name(void)
HKEY hHelpKey;
DWORD key_type, cbData;
static char volume[256];
#ifdef _UNICODE
static char out_volume[256];
#endif
static TCHAR volume[256];
memset(volume, 0, sizeof(volume));
// Try Windows 2000 key first
@ -123,14 +127,19 @@ static const char *get_volume_name(void)
}
// Fix the error that some "tweak" apps do.
if (stricmp(volume, "%USERNAME% on %COMPUTER%") == 0)
volume[0] = '\0';
if (_tcsicmp(volume, TEXT("%USERNAME% on %COMPUTER%")) == 0)
volume[0] = TEXT('\0');
// No volume name found, default to "My Computer"
if (volume[0] == 0)
strcpy(volume, "My Computer");
_tcscpy(volume, TEXT("My Computer"));
#ifdef _UNICODE
strlcpy(out_volume, volume, 256);
return out_volume;
#else
return volume;
#endif
}

View File

@ -525,7 +525,7 @@ union DL_primitives {
struct EnetPacketHeader {
uint8 fDestAddr[6];
uint8 fSourceAddr[6];
nw_uint16 fProto;
uint16 fProto;
} PACKED__;
struct T8022Header {
@ -548,7 +548,7 @@ struct T8022FullPacketHeader {
struct T8022AddressStruct {
uint8 fHWAddr[6];
nw_uint16 fSAP;
uint16 fSAP;
uint8 fSNAP[k8022SNAPLength];
} PACKED__;

View File

@ -23,6 +23,10 @@
#include <functional>
#ifdef __MINGW32__
#include "vm_alloc.h"
#endif
#if defined __GNUC__
#define HAVE_FAST_NV_MEM_FUN 1
#define MEM_FUN_WORDS 2
@ -91,11 +95,123 @@ template< class R, class T, class A >
class nv_mem_fun1_t : public std::binary_function<T, A, R> {
typedef R (T::*pmf_t)(A);
typedef R (* PF_CONVENTION pf_t)(T *, A x);
#ifdef __MINGW32__
typedef R (* default_call_conv_pf_t)(T *, A x);
#endif
pf_t pf;
public:
nv_mem_fun1_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
nv_mem_fun1_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {
#ifdef __MINGW32__
init_func();
#endif
}
R operator()(T *p, A x) const { return (*pf)(p, x); }
#ifdef __MINGW32__
#define NVMEMFUN_THUNK_DEBUG 0
private:
#define DO_CONVENTION_CALL_PF_PLACEHOLDER 0x12345678
#define DO_CONVENTION_CALL_STATICS
static bool do_convention_call_init_done;
static int do_convention_call_code_len;
static int do_convention_call_pf_offset;
unsigned char * do_convention_call_instance_copy;
static void init_do_convention_call() {
if (do_convention_call_init_done) return;
const int max_code_bytes = 100;
const unsigned char last_code_byte_value = 0xc3;
// figure out the size of the function
unsigned char * func_pos = (unsigned char *) &do_convention_call;
int i;
for (i = 0; i < max_code_bytes; i++) {
if (func_pos[i] == last_code_byte_value) {
break;
}
}
do_convention_call_code_len = i + 1;
#if NVMEMFUN_THUNK_DEBUG
printf("do_convention_call func size %d ", do_convention_call_code_len);
#endif
// find the position of the pf placeholder in the function
int placeholder_matches = 0;
for (i = 0; i < do_convention_call_code_len - 3; i++) {
pf_t * cur_ptr = (pf_t*)(func_pos + i);
if (*cur_ptr == (pf_t) DO_CONVENTION_CALL_PF_PLACEHOLDER) {
do_convention_call_pf_offset = i;
#if NVMEMFUN_THUNK_DEBUG
printf("ptr pos offset %x", (uint32)cur_ptr - (uint32)func_pos);
#endif
++placeholder_matches;
}
}
#if NVMEMFUN_THUNK_DEBUG
printf("\n");
fflush(stdout);
#endif
assert(placeholder_matches == 1);
do_convention_call_init_done = true;
}
void init_func() {
if (!do_convention_call_init_done) {
init_do_convention_call();
}
// copy do_convention_call and patch in the address of pf
do_convention_call_instance_copy = (unsigned char *) vm_acquire(do_convention_call_code_len);
// Thunk buffer needs to be around while default_call_conv_ptr() is still in use,
// longer than nv_mem_fun1_t lifetime
//FIXME track the lifetime of this
if (do_convention_call_instance_copy == NULL) return;
unsigned char * func_pos = (unsigned char *) &do_convention_call;
memcpy((void *)do_convention_call_instance_copy, func_pos, do_convention_call_code_len);
// replace byte sequence in buf copy
*(pf_t*)(do_convention_call_instance_copy + do_convention_call_pf_offset) = pf;
#if NVMEMFUN_THUNK_DEBUG
printf("patching do_convention_call to %x; func size %d ", do_convention_call_instance_copy, do_convention_call_code_len);
for (int i = 0 ; i < do_convention_call_code_len; i ++) {
printf("%02x ", do_convention_call_instance_copy[i]);
}
printf("\n");
fflush(stdout);
#endif
vm_protect(do_convention_call_instance_copy, do_convention_call_code_len, VM_PAGE_READ | VM_PAGE_EXECUTE);
}
// Cheesy thunk solution to adapt the calling convention:
// do_convention_call accepts the default calling convention and calls pf with PF_CONVENTION
// Each instance makes its own copy of do_convention_call in a buffer and patches the address of pf into it
static R do_convention_call(T * obj, A x) {
pf_t fn = (pf_t) DO_CONVENTION_CALL_PF_PLACEHOLDER;
return (*fn)(obj, x);
}
public:
default_call_conv_pf_t default_call_conv_ptr() const { return (default_call_conv_pf_t) do_convention_call_instance_copy; }
#else
pf_t ptr() const { return pf; }
#endif
};
template< class R, class T, class A >

View File

@ -151,9 +151,11 @@ public:
// Execute NATIVE_OP routine
void execute_native_op(uint32 native_op);
static void call_execute_native_op(powerpc_cpu * cpu, uint32 native_op);
// Execute EMUL_OP routine
void execute_emul_op(uint32 emul_op);
static void call_execute_emul_op(powerpc_cpu * cpu, uint32 emul_op);
// Execute 68k routine
void execute_68k(uint32 entry, M68kRegisters *r);
@ -170,6 +172,7 @@ public:
#endif
// Resource manager thunk
void get_resource(uint32 old_get_resource);
static void call_get_resource(powerpc_cpu * cpu, uint32 old_get_resource);
// Handle MacOS interrupt
void interrupt(uint32 entry);
@ -218,6 +221,10 @@ typedef bit_field< 19, 19 > FN_field;
typedef bit_field< 20, 25 > NATIVE_OP_field;
typedef bit_field< 26, 31 > EMUL_OP_field;
void sheepshaver_cpu::call_execute_emul_op(powerpc_cpu * cpu, uint32 emul_op) {
static_cast<sheepshaver_cpu *>(cpu)->execute_emul_op(emul_op);
}
// Execute EMUL_OP routine
void sheepshaver_cpu::execute_emul_op(uint32 emul_op)
{
@ -332,7 +339,7 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context)
};
uint32 old_get_resource = ReadMacInt32(get_resource_ptr[selector - NATIVE_GET_RESOURCE]);
typedef void (*func_t)(dyngen_cpu_base, uint32);
func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::get_resource).ptr();
func_t func = &sheepshaver_cpu::call_get_resource;
dg.gen_invoke_CPU_im(func, old_get_resource);
status = COMPILE_CODE_OK;
break;
@ -421,7 +428,7 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context)
// Invoke NativeOp handler
if (!FN_field::test(opcode)) {
typedef void (*func_t)(dyngen_cpu_base, uint32);
func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr();
func_t func = &sheepshaver_cpu::call_execute_native_op;
dg.gen_invoke_CPU_im(func, selector);
cg_context.done_compile = false;
status = COMPILE_CODE_OK;
@ -445,7 +452,7 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context)
#else
// Invoke EmulOp handler
typedef void (*func_t)(dyngen_cpu_base, uint32);
func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_emul_op).ptr();
func_t func = &sheepshaver_cpu::call_execute_emul_op;
dg.gen_invoke_CPU_im(func, emul_op);
cg_context.done_compile = false;
status = COMPILE_CODE_OK;
@ -685,6 +692,10 @@ inline void sheepshaver_cpu::execute_ppc(uint32 entry)
lr() = saved_lr;
}
void sheepshaver_cpu::call_get_resource(powerpc_cpu * cpu, uint32 old_get_resource) {
static_cast<sheepshaver_cpu *>(cpu)->get_resource(old_get_resource);
}
// Resource Manager thunk
inline void sheepshaver_cpu::get_resource(uint32 old_get_resource)
{
@ -897,14 +908,14 @@ void init_emul_op_trampolines(basic_dyngen & dg)
// EmulOp
emul_op_trampoline = dg.gen_start();
func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_emul_op).ptr();
func = &sheepshaver_cpu::call_execute_emul_op;
dg.gen_invoke_CPU_T0(func);
dg.gen_exec_return();
dg.gen_end();
// NativeOp
native_op_trampoline = dg.gen_start();
func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr();
func = &sheepshaver_cpu::call_execute_native_op;
dg.gen_invoke_CPU_T0(func);
dg.gen_exec_return();
dg.gen_end();
@ -1030,6 +1041,10 @@ void HandleInterrupt(powerpc_registers *r)
}
}
void sheepshaver_cpu::call_execute_native_op(powerpc_cpu * cpu, uint32 selector) {
static_cast<sheepshaver_cpu *>(cpu)->execute_native_op(selector);
}
// Execute NATIVE_OP routine
void sheepshaver_cpu::execute_native_op(uint32 selector)
{

View File

@ -64,6 +64,12 @@ int register_info_compare(const void *e1, const void *e2)
static int ppc_refcount = 0;
#ifdef DO_CONVENTION_CALL_STATICS
template<> bool nv_mem_fun1_t<void, powerpc_cpu, uint32>::do_convention_call_init_done = false;
template<> int nv_mem_fun1_t<void, powerpc_cpu, uint32>::do_convention_call_code_len = 0;
template<> int nv_mem_fun1_t<void, powerpc_cpu, uint32>::do_convention_call_pf_offset = 0;
#endif
void powerpc_cpu::set_register(int id, any_register const & value)
{
if (id >= powerpc_registers::GPR(0) && id <= powerpc_registers::GPR(31)) {
@ -542,7 +548,12 @@ bool powerpc_cpu::check_spcflags()
}
#if DYNGEN_DIRECT_BLOCK_CHAINING
void *powerpc_cpu::compile_chain_block(block_info *sbi)
void * powerpc_cpu::call_compile_chain_block(powerpc_cpu * the_cpu, block_info *sbi)
{
return the_cpu->compile_chain_block(sbi);
}
void * PF_CONVENTION powerpc_cpu::compile_chain_block(block_info *sbi)
{
// Block index is stuffed into the source basic block pointer,
// which is aligned at least on 4-byte boundaries
@ -719,7 +730,11 @@ void powerpc_cpu::execute(uint32 entry)
if (is_logging())
record_step(opcode);
#endif
#ifdef __MINGW32__
assert(ii->execute.default_call_conv_ptr() != 0);
#else
assert(ii->execute.ptr() != 0);
#endif
ii->execute(this, opcode);
#if PPC_EXECUTE_DUMP_STATE
if (dump_state)

View File

@ -371,8 +371,10 @@ private:
friend class powerpc_jit;
powerpc_jit codegen;
block_info *compile_block(uint32 entry);
static void call_do_record_step(powerpc_cpu * cpu, uint32 pc, uint32 opcode);
#if DYNGEN_DIRECT_BLOCK_CHAINING
void *compile_chain_block(block_info *sbi);
static void * call_compile_chain_block(powerpc_cpu * the_cpu, block_info *sbi);
#endif
#endif
@ -389,6 +391,7 @@ private:
// Instruction handlers
void execute_nop(uint32 opcode);
void execute_illegal(uint32 opcode);
static void call_execute_illegal(powerpc_cpu * cpu, uint32 opcode);
template< class RA, class RB, class RC, class CA, class OE, class Rc >
void execute_addition(uint32 opcode);
template< class OP, class RD, class RA, class RB, class RC, class OE, class Rc >
@ -453,6 +456,7 @@ private:
void execute_icbi(uint32 opcode);
void execute_isync(uint32 opcode);
void execute_invalidate_cache_range();
static void call_execute_invalidate_cache_range(powerpc_cpu * cpu);
template< class RA, class RB >
void execute_dcbz(uint32 opcode);
template< bool SL >

View File

@ -470,11 +470,21 @@ const powerpc_cpu::instr_info_t powerpc_cpu::powerpc_ii_table[] = {
PPC_I(FNMSUBS),
A_form, 59, 30, CFLOW_NORMAL
},
{ "fres",
EXECUTE_FP_ARITH(double, fres, RD, RB, NONE, NONE, RC_BIT_G, true),
PPC_I(FRES),
A_form, 59, 24, CFLOW_NORMAL
},
{ "frsp",
EXECUTE_1(fp_round, RC_BIT_G),
PPC_I(FRSP),
X_form, 63, 12, CFLOW_NORMAL
},
{ "frsqrte",
EXECUTE_FP_ARITH(double, frsqrte, RD, RB, NONE, NONE, RC_BIT_G, true),
PPC_I(FRSQRTE),
A_form, 63, 26, CFLOW_NORMAL
},
{ "fsel",
EXECUTE_FP_ARITH(double, fsel, RD, RA, RC, RB, RC_BIT_G, false),
PPC_I(FSEL),
@ -1551,7 +1561,7 @@ const powerpc_cpu::instr_info_t powerpc_cpu::powerpc_ii_table[] = {
VX_form, 4, 132, CFLOW_NORMAL
},
{ "vrsqrtefp",
EXECUTE_VECTOR_ARITH(frsqrt, V4SF, NONE, V4SF, NONE),
EXECUTE_VECTOR_ARITH(frsqrte, V4SF, NONE, V4SF, NONE),
PPC_I(VRSQRTEFP),
VX_form, 4, 330, CFLOW_NORMAL
},

View File

@ -90,6 +90,7 @@ static inline int ppc_to_native_rounding_mode(int round)
case 2: return FE_UPWARD;
case 3: return FE_DOWNWARD;
}
return FE_TONEAREST;
}
/**

View File

@ -99,7 +99,9 @@ enum powerpc_instruction {
PPC_I(FNMADDS),
PPC_I(FNMSUB),
PPC_I(FNMSUBS),
PPC_I(FRES),
PPC_I(FRSP),
PPC_I(FRSQRTE),
PPC_I(FSEL),
PPC_I(FSUB),
PPC_I(FSUBS),

View File

@ -36,6 +36,11 @@ powerpc_jit::powerpc_jit(dyngen_cpu_base cpu)
{
}
// An operand that refers to an address relative to the emulated machine
static x86_memory_operand vm_memory_operand(int32 d, int b, int i = X86_NOREG, int s = 1) {
return x86_memory_operand(d + VMBaseDiff, b, i, s);
}
bool powerpc_jit::initialize(void)
{
if (!powerpc_dyngen::initialize())
@ -239,21 +244,25 @@ bool powerpc_jit::initialize(void)
// Dispatch mid-level code generators
bool powerpc_jit::gen_vector_1(int mnemo, int vD)
{
if (jit_info[mnemo]->handler == (gen_handler_t)&powerpc_jit::gen_not_available) return false;
return (this->*((bool (powerpc_jit::*)(int, int))jit_info[mnemo]->handler))(mnemo, vD);
}
bool powerpc_jit::gen_vector_2(int mnemo, int vD, int vA, int vB)
{
if (jit_info[mnemo]->handler == (gen_handler_t)&powerpc_jit::gen_not_available) return false;
return (this->*((bool (powerpc_jit::*)(int, int, int, int))jit_info[mnemo]->handler))(mnemo, vD, vA, vB);
}
bool powerpc_jit::gen_vector_3(int mnemo, int vD, int vA, int vB, int vC)
{
if (jit_info[mnemo]->handler == (gen_handler_t)&powerpc_jit::gen_not_available) return false;
return (this->*((bool (powerpc_jit::*)(int, int, int, int, int))jit_info[mnemo]->handler))(mnemo, vD, vA, vB, vC);
}
bool powerpc_jit::gen_vector_compare(int mnemo, int vD, int vA, int vB, bool Rc)
{
if (jit_info[mnemo]->handler == (gen_handler_t)&powerpc_jit::gen_not_available) return false;
return (this->*((bool (powerpc_jit::*)(int, int, int, int, bool))jit_info[mnemo]->handler))(mnemo, vD, vA, vB, Rc);
}
@ -395,8 +404,8 @@ bool powerpc_jit::gen_x86_lvx(int mnemo, int vD, int rA, int rB)
gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID);
gen_and_32(x86_immediate_operand(-16), REG_T0_ID);
#if SIZEOF_VOID_P == 8
gen_mov_64(x86_memory_operand(0, REG_T0_ID), REG_T1_ID);
gen_mov_64(x86_memory_operand(8, REG_T0_ID), REG_T2_ID);
gen_mov_64(vm_memory_operand(0, REG_T0_ID), REG_T1_ID);
gen_mov_64(vm_memory_operand(8, REG_T0_ID), REG_T2_ID);
gen_bswap_64(REG_T1_ID);
gen_bswap_64(REG_T2_ID);
gen_rol_64(x86_immediate_operand(32), REG_T1_ID);
@ -404,14 +413,14 @@ bool powerpc_jit::gen_x86_lvx(int mnemo, int vD, int rA, int rB)
gen_mov_64(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 0, REG_CPU_ID));
gen_mov_64(REG_T2_ID, x86_memory_operand(xPPC_VR(vD) + 8, REG_CPU_ID));
#else
gen_mov_32(x86_memory_operand(0*4, REG_T0_ID), REG_T1_ID);
gen_mov_32(x86_memory_operand(1*4, REG_T0_ID), REG_T2_ID);
gen_mov_32(vm_memory_operand(0*4, REG_T0_ID), REG_T1_ID);
gen_mov_32(vm_memory_operand(1*4, REG_T0_ID), REG_T2_ID);
gen_bswap_32(REG_T1_ID);
gen_bswap_32(REG_T2_ID);
gen_mov_32(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 0*4, REG_CPU_ID));
gen_mov_32(REG_T2_ID, x86_memory_operand(xPPC_VR(vD) + 1*4, REG_CPU_ID));
gen_mov_32(x86_memory_operand(2*4, REG_T0_ID), REG_T1_ID);
gen_mov_32(x86_memory_operand(3*4, REG_T0_ID), REG_T2_ID);
gen_mov_32(vm_memory_operand(2*4, REG_T0_ID), REG_T1_ID);
gen_mov_32(vm_memory_operand(3*4, REG_T0_ID), REG_T2_ID);
gen_bswap_32(REG_T1_ID);
gen_bswap_32(REG_T2_ID);
gen_mov_32(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 2*4, REG_CPU_ID));
@ -435,8 +444,8 @@ bool powerpc_jit::gen_x86_stvx(int mnemo, int vS, int rA, int rB)
gen_and_32(x86_immediate_operand(-16), REG_T0_ID);
gen_rol_64(x86_immediate_operand(32), REG_T1_ID);
gen_rol_64(x86_immediate_operand(32), REG_T2_ID);
gen_mov_64(REG_T1_ID, x86_memory_operand(0, REG_T0_ID));
gen_mov_64(REG_T2_ID, x86_memory_operand(8, REG_T0_ID));
gen_mov_64(REG_T1_ID, vm_memory_operand(0, REG_T0_ID));
gen_mov_64(REG_T2_ID, vm_memory_operand(8, REG_T0_ID));
#else
gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 0*4, REG_CPU_ID), REG_T1_ID);
gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 1*4, REG_CPU_ID), REG_T2_ID);
@ -445,14 +454,14 @@ bool powerpc_jit::gen_x86_stvx(int mnemo, int vS, int rA, int rB)
gen_bswap_32(REG_T1_ID);
gen_bswap_32(REG_T2_ID);
gen_and_32(x86_immediate_operand(-16), REG_T0_ID);
gen_mov_32(REG_T1_ID, x86_memory_operand(0*4, REG_T0_ID));
gen_mov_32(REG_T2_ID, x86_memory_operand(1*4, REG_T0_ID));
gen_mov_32(REG_T1_ID, vm_memory_operand(0*4, REG_T0_ID));
gen_mov_32(REG_T2_ID, vm_memory_operand(1*4, REG_T0_ID));
gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 2*4, REG_CPU_ID), REG_T1_ID);
gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 3*4, REG_CPU_ID), REG_T2_ID);
gen_bswap_32(REG_T1_ID);
gen_bswap_32(REG_T2_ID);
gen_mov_32(REG_T1_ID, x86_memory_operand(2*4, REG_T0_ID));
gen_mov_32(REG_T2_ID, x86_memory_operand(3*4, REG_T0_ID));
gen_mov_32(REG_T1_ID, vm_memory_operand(2*4, REG_T0_ID));
gen_mov_32(REG_T2_ID, vm_memory_operand(3*4, REG_T0_ID));
#endif
return true;
}
@ -667,7 +676,7 @@ void powerpc_jit::gen_sse2_vsplat(int vD, int rValue)
}
// vspltisb
bool powerpc_jit::gen_sse2_vspltisb(int mnemo, int vD, int SIMM)
bool powerpc_jit::gen_sse2_vspltisb(int mnemo, int vD, int SIMM, int unused)
{
switch (SIMM) {
case 0:
@ -718,7 +727,7 @@ bool powerpc_jit::gen_sse2_vspltisb(int mnemo, int vD, int SIMM)
}
// vspltish
bool powerpc_jit::gen_sse2_vspltish(int mnemo, int vD, int SIMM)
bool powerpc_jit::gen_sse2_vspltish(int mnemo, int vD, int SIMM, int unused)
{
switch (SIMM) {
case 0:
@ -764,7 +773,7 @@ bool powerpc_jit::gen_sse2_vspltish(int mnemo, int vD, int SIMM)
}
// vspltisw
bool powerpc_jit::gen_sse2_vspltisw(int mnemo, int vD, int SIMM)
bool powerpc_jit::gen_sse2_vspltisw(int mnemo, int vD, int SIMM, int unused)
{
switch (SIMM) {
case 0:
@ -866,7 +875,7 @@ bool powerpc_jit::gen_ssse3_lvx(int mnemo, int vD, int rA, int rB)
gen_and_32(x86_immediate_operand(-16), REG_T0_ID);
x86_memory_operand vswapmask(gen_ssse3_vswap_mask(), X86_NOREG);
gen_movdqa(x86_memory_operand(0, REG_T0_ID), REG_V0_ID);
gen_movdqa(vm_memory_operand(0, REG_T0_ID), REG_V0_ID);
gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, vswapmask, REG_V0_ID);
gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID));
return true;
@ -883,7 +892,7 @@ bool powerpc_jit::gen_ssse3_stvx(int mnemo, int vS, int rA, int rB)
x86_memory_operand vswapmask(gen_ssse3_vswap_mask(), X86_NOREG);
gen_movdqa(x86_memory_operand(xPPC_VR(vS), REG_CPU_ID), REG_V0_ID);
gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, vswapmask, REG_V0_ID);
gen_movdqa(REG_V0_ID, x86_memory_operand(0, REG_T0_ID));
gen_movdqa(REG_V0_ID, vm_memory_operand(0, REG_T0_ID));
return true;
}

View File

@ -90,9 +90,9 @@ private:
bool gen_sse2_vsel(int mnemo, int vD, int vA, int vB, int vC);
bool gen_sse2_vsldoi(int mnemo, int vD, int vA, int vB, int SH);
void gen_sse2_vsplat(int vD, int rValue);
bool gen_sse2_vspltisb(int mnemo, int vD, int SIMM);
bool gen_sse2_vspltish(int mnemo, int vD, int SIMM);
bool gen_sse2_vspltisw(int mnemo, int vD, int SIMM);
bool gen_sse2_vspltisb(int mnemo, int vD, int SIMM, int unused);
bool gen_sse2_vspltish(int mnemo, int vD, int SIMM, int unused);
bool gen_sse2_vspltisw(int mnemo, int vD, int SIMM, int unused);
bool gen_sse2_vspltb(int mnemo, int vD, int UIMM, int vB);
bool gen_sse2_vsplth(int mnemo, int vD, int UIMM, int vB);
bool gen_sse2_vspltw(int mnemo, int vD, int UIMM, int vB);

View File

@ -153,7 +153,7 @@ DEFINE_OP2(fsubs, float, x - y);
DEFINE_OP1(exp2, float, exp2f(x));
DEFINE_OP1(log2, float, log2f(x));
DEFINE_OP1(fres, float, 1 / x);
DEFINE_OP1(frsqrt, float, 1 / sqrt(x));
DEFINE_OP1(frsqrte, float, 1 / sqrt(x));
DEFINE_OP1(frsim, float, floorf(x));
DEFINE_OP1(frsin, float, roundf(x));
DEFINE_OP1(frsip, float, ceilf(x));

View File

@ -125,6 +125,22 @@ static void disasm_translation(uint32 src_addr, uint32 src_len,
**/
#if PPC_ENABLE_JIT
void
powerpc_cpu::call_do_record_step(powerpc_cpu * cpu, uint32 param1, uint32 param2) {
cpu->do_record_step(param1, param2);
}
void
powerpc_cpu::call_execute_invalidate_cache_range(powerpc_cpu * cpu) {
cpu->execute_invalidate_cache_range();
}
void
powerpc_cpu::call_execute_illegal(powerpc_cpu * cpu, uint32 param1) {
cpu->execute_illegal(param1);
}
powerpc_cpu::block_info *
powerpc_cpu::compile_block(uint32 entry_point)
{
@ -169,7 +185,7 @@ powerpc_cpu::compile_block(uint32 entry_point)
#if PPC_FLIGHT_RECORDER
if (is_logging()) {
typedef void (*func_t)(dyngen_cpu_base, uint32, uint32);
func_t func = (func_t)nv_mem_fun((execute_pmf)&powerpc_cpu::do_record_step).ptr();
func_t func = &powerpc_cpu::call_do_record_step;
dg.gen_invoke_CPU_im_im(func, dpc, opcode);
}
#endif
@ -1120,7 +1136,7 @@ powerpc_cpu::compile_block(uint32 entry_point)
case PPC_I(ISYNC): // Instruction synchronize
{
typedef void (*func_t)(dyngen_cpu_base);
func_t func = (func_t)nv_mem_fun(&powerpc_cpu::execute_invalidate_cache_range).ptr();
func_t func = &powerpc_cpu::call_execute_invalidate_cache_range;
dg.gen_invoke_CPU(func);
break;
}
@ -1377,10 +1393,17 @@ powerpc_cpu::compile_block(uint32 entry_point)
case PPC_I(STVEWX):
case PPC_I(STVX):
case PPC_I(STVXL):
{
assert(vD_field::mask() == vS_field::mask());
assert(vA_field::mask() == rA_field::mask());
assert(vB_field::mask() == rB_field::mask());
// fall-through
const int vD = vD_field::extract(opcode);
const int vA = vA_field::extract(opcode);
const int vB = vB_field::extract(opcode);
if (!dg.gen_vector_2(ii->mnemo, vD, vA, vB))
goto do_generic;
break;
}
case PPC_I(VCMPEQFP):
case PPC_I(VCMPEQUB):
case PPC_I(VCMPEQUH):
@ -1488,10 +1511,14 @@ powerpc_cpu::compile_block(uint32 entry_point)
typedef void (*func_t)(dyngen_cpu_base, uint32);
func_t func;
do_generic:
#ifdef __MINGW32__
func = (func_t)ii->execute.default_call_conv_ptr();
#else
func = (func_t)ii->execute.ptr();
#endif
goto do_invoke;
do_illegal:
func = (func_t)nv_mem_fun(&powerpc_cpu::execute_illegal).ptr();
func = &powerpc_cpu::call_execute_illegal;
goto do_invoke;
do_invoke:
#if PPC_PROFILE_GENERIC_CALLS
@ -1554,7 +1581,7 @@ powerpc_cpu::compile_block(uint32 entry_point)
// Generate backpatch trampolines
if (use_direct_block_chaining) {
typedef void *(*func_t)(dyngen_cpu_base);
func_t func = (func_t)nv_mem_fun(&powerpc_cpu::compile_chain_block).ptr();
func_t func = (func_t)&powerpc_cpu::call_compile_chain_block;
for (int i = 0; i < block_info::MAX_TARGETS; i++) {
if (bi->li[i].jmp_pc != block_info::INVALID_PC) {
uint8 *p = dg.gen_align(16);

View File

@ -88,6 +88,7 @@ int mathlib_fpclassify (double x)
int mathlib_fpclassifyl(long double x)
{
unimplemented("fpclassifyl");
return -1;
}
@ -114,6 +115,7 @@ int mathlib_signbit (double x)
int mathlib_signbitl(long double x)
{
unimplemented("signbitl");
return -1;
}

View File

@ -327,6 +327,10 @@ uint32 TimeToMacTime(time_t t)
// Convert to number of seconds elapsed since 1-Jan-1904
#ifdef WIN32
if (t == -1) {
// failsafe as this will segfault
return 0;
}
struct tm *local = localtime(&t);
#else
struct tm result;