Compare commits

...

881 Commits

Author SHA1 Message Date
kanjitalk755 d7c030312d Fix #198 2024-04-02 20:38:34 +09:00
kanjitalk755 be389a9f11 BII: add -fwrapv to subprojects 2024-04-01 22:38:07 +09:00
kanjitalk755 a07cc8ae56 BII: add -fwrapv compile flag (#197) 2024-04-01 18:35:53 +09:00
kanjitalk755 293ef33a28
Merge pull request #196 from schinkelg/master
Small leaks / bug fixes
2024-03-30 09:36:36 +09:00
kanjitalk755 979523b5ca Fix #195 2024-03-29 21:11:46 +09:00
Ger Schinkel 076390e911 Fixed potential array out of bounds condition when break would never trigger. 2024-03-29 12:44:46 +01:00
Ger Schinkel db897d0d42 Memory leak in Linux etherhelpertool.c. 2024-03-29 12:08:11 +01:00
kanjitalk755 e12789a57e Fix for LTO enabled environment by default 2024-03-23 12:44:16 +09:00
kanjitalk755 aa9f112de3
Merge pull request #192 from chenchijung/master
modify for workaround <cannot map RAM:No Error> caused by confliction…
2024-02-24 21:30:55 +09:00
chenchijung 784ac7bb7e fix ROMBase compare before assignment issue 2024-02-24 17:46:31 +08:00
chenchijung 45e3bd1d3e modify for workaround <cannot map RAM:No Error> caused by confliction with MSI afterburner or RIVA Tuner statistic tuner Server 2024-02-21 19:29:20 +08:00
kanjitalk755 08707d3a25 macOS: revert prefs and xpram(nvram) location 2024-02-10 11:20:17 +09:00
kanjitalk755 0a1d9c35bf SS: fix for linux/aarch64 2024-01-20 14:34:21 +09:00
kanjitalk755 3176aa887d Add prefs item init_grab 2024-01-11 11:00:04 +09:00
kanjitalk755 9088a674ad BII: fix linker command 2024-01-04 14:02:51 +09:00
kanjitalk755 1d8dd979ab Improved stability during reboot 2023-12-17 09:32:14 +09:00
kanjitalk755 1ddb7d3a42 Fix for 6K Retina 2023-12-16 10:01:31 +09:00
kanjitalk755 e059b64ac8 Fix ROM patch of ADB 2023-12-10 21:34:35 +09:00
kanjitalk755 b6d62c2f14 Add framework search path 2023-12-06 10:30:10 +09:00
kanjitalk755 9395e119af Fix for Xcode 15 2023-12-05 14:24:22 +09:00
kanjitalk755 021bb50149 SS: the hardware cursor can be used even when the magnification is not an integer when in fullscreen 2023-12-03 15:38:24 +09:00
kanjitalk755 3d49e9790b Update for SDL3 2023-11-26 09:48:26 +09:00
kanjitalk755 19308135c3 Update for SDL3 2023-10-18 10:46:13 +09:00
kanjitalk755 2533f7ac05 Fix control register number 2023-10-08 19:42:42 +09:00
kanjitalk755 9a7751f1a2 Prepare for SDL3 2023-09-13 20:45:03 +09:00
kanjitalk755 0942bdcbf9 test framebuffer handling 2023-08-25 19:50:04 +09:00
kanjitalk755 d2c2647e3a Fix window position 2023-08-23 20:23:08 +09:00
kanjitalk755 1d8e348e4b Set window position when switching to windowed mode 2023-08-23 10:58:23 +09:00
kanjitalk755 81bdda2a5b test fullscreen for Linux and Windows 2023-08-21 10:02:15 +09:00
kanjitalk755 e90180a2c3 check duplicate mount 2023-08-07 10:30:04 +09:00
kanjitalk755 a94a41885b drop and mount 2023-08-06 20:51:03 +09:00
kanjitalk755 6f94fdd7b0 allow unaligned lmw/stmw 2023-07-09 13:43:50 +09:00
kanjitalk755 51fc1905c4
Update README.md 2023-06-20 12:55:16 +09:00
kanjitalk755 c4c153c49c
Update README.md 2023-05-16 09:52:21 +09:00
kanjitalk755 d66da33874 SS, Windows: Fix Makefile 2023-05-03 17:47:06 +09:00
kanjitalk755 c4a22a51d6 Add a symbolic link 2023-05-02 18:08:17 +09:00
kanjitalk755 1199f8115e BII: High-precision timer backported from SS 2023-05-02 18:05:09 +09:00
kanjitalk755 ef3f61c30d
Update README.md 2023-04-04 14:35:55 +09:00
kanjitalk755 36de3833bf Changed Deployment Target 2023-04-04 14:30:15 +09:00
kanjitalk755 aa6f09ec7a
Update README.md 2023-04-03 18:03:57 +09:00
kanjitalk755 5739ba9e8a
Update README.md 2023-04-01 21:27:23 +09:00
kanjitalk755 cfec811999
Update README.md 2023-04-01 21:25:41 +09:00
kanjitalk755 5915d869fa
Merge pull request #159 from wezm/patch-1
Add missing semi-colon to prefs_editor_gtk.cpp
2023-03-26 15:49:57 +09:00
Wesley Moore 78a4e7212b
Add missing semi-colon to prefs_editor_gtk.cpp 2023-03-26 14:41:00 +11:00
kanjitalk755 92c4c72000 Fix for Raspberry Pi 1 2023-01-12 21:04:23 +09:00
kanjitalk755 0365386fa1 Fix for macOS Ventura 2022-12-22 09:05:57 +09:00
kanjitalk755 d6112f4a30 Fix audio volume and mute 2022-12-12 18:17:01 +09:00
kanjitalk755 ed3decddf1 Fix TAP component IDs 2022-12-03 21:55:10 +09:00
kanjitalk755 d4ec4e5323 Fix startup sound 2022-11-30 07:18:32 +09:00
kanjitalk755 1a2d818e47
Merge pull request #147 from robxnano/gtk2
Move to GTK 2
2022-10-18 12:48:38 +09:00
kanjitalk755 db877c0443
Merge pull request #146 from robxnano/unix2
More Unix support
2022-10-17 13:24:56 +09:00
robxnano 4217fc73cd OpenIndiana: Skip instruction fix
Fixes the register definitions so that instruction skip works.
Both Basilisk II and SheepShaver now work (without JIT) on
Solaris-based OSes such as OpenIndiana.
2022-10-15 00:20:15 +01:00
kanjitalk755 b3ebcd595c fix for macOS 2022-10-12 11:17:27 +09:00
kanjitalk755 3f7896976a
Merge pull request #145 from robxnano/unix
Restore support for various Unix OSes
2022-10-12 10:53:39 +09:00
robxnano ae9d917d5e Apply NetBSD pkgsrc patches
Patches obtained from
https://github.com/NetBSD/pkgsrc/blob/trunk/emulators/BasiliskII/
2022-10-11 19:31:36 +01:00
robxnano 0118e99764 Basilisk II: Skip test for -no-pie flag in macOS 2022-10-11 15:55:57 +01:00
robxnano cb67534d28 Changed conftests for disabling position-independent code
Basilisk II (Intel Mac): uses -Wl,-no_pie flag
Basilisk II (other): uses -no-pie flag if available
SheepShaver: Does not use either flag
2022-10-10 14:50:04 +01:00
robxnano f61701df3c Fixes for compatibility with older Linux versions
- Check for both -no_pie and -no-pie flags to disable
  position-independent code.
- Use AC_PROG_CC_C99 to force C99 standard.
2022-10-08 18:37:43 +01:00
robxnano 4b58ce3ea8 Added xpram_unix.cpp to SheepShaver "make links" 2022-10-08 17:55:42 +01:00
robxnano c727bc0df7 Added "Save Preferences" menu item 2022-10-08 16:38:01 +01:00
robxnano fdeb8617da Remove unnecessary warning if xpram file doesn't exist 2022-10-08 16:20:13 +01:00
robxnano 6da609938e Merge prefs_unix.cpp
Replaced SheepShaver's prefs_unix.cpp with a symlink to Basilisk II's
version, and used ifdefs to account for the remaining differences.
2022-10-08 16:18:36 +01:00
robxnano aaf67fd59a Fix for make uninstall without standalone GUI 2022-10-08 14:36:04 +01:00
robxnano af96a51acb GTK2: Replaced option menus with combo boxes
The old GtkOptionMenu widget is deprecated.
2022-10-08 14:04:20 +01:00
robxnano bf784a2c30 Removed obsolete version check 2022-10-08 12:29:02 +01:00
robxnano 094995722b Added register names for Linux x86_64 2022-10-08 03:08:55 +01:00
robxnano 604baaa289 Added registers for OpenIndiana x86_64 and other fixes
OpenIndiana/illumos is based on OpenSolaris 10 and
uses the Solaris code paths.
Current status:
Basilisk II: Working but cannot ignore illegal instructions
SheepShaver: Doesn't compile because of same problem
If the SIGSEGV skip instruction handler were fixed, both
programs would likely work.
2022-10-08 03:03:52 +01:00
robxnano 2a74fdaab6 Added registers for NetBSD x86_64 and other fixes
NetBSD current status:
Basilisk II: Builds and runs, but JIT doesn't work
SheepShaver: Doesn't work because of BSD mmap limitations
2022-10-08 01:33:44 +01:00
robxnano 1dd1d2713d Fixes for building on FreeBSD and other platforms
FreeBSD current status:
Basilisk II: Builds and runs successfully using gcc and gmake
SheepShaver: Doesn't work because FreeBSD doesn't support mapping
the zero memory page. SheepShaver would only work on *BSD if the
direct addressing mode worked.
2022-10-08 00:12:52 +01:00
robxnano 01ba8564ed Improved UI support on FreeBSD 2022-10-03 19:36:46 +01:00
robxnano d284e9976b GTK2: More fixes
- Fix JIT combo box error
- Make ignore illegal instructions checkbox visible but disabled
  if HAVE_SIGSEGV_SKIP_INSTRUCTION is not enabled
- Make file choosers open at the folder that was selected
2022-10-03 02:06:03 +01:00
robxnano 7482de353b Added sys/stat.h to sysdeps.h
Needed on BSD for S_* ioctl constants and macros
2022-10-01 20:21:37 +01:00
robxnano 3f00759e54 GTK2: Updated combo boxes with entries
The old GtkCombo widget was deprecated.
2022-10-01 20:07:52 +01:00
robxnano a9d1f35cdf GTK2: Replace file chooser dialogs and about dialogs
The GtkFileChooserDialog API makes it easier to select files and
folders. Additionally Browse buttons have been added to all file
entry fields.
2022-10-01 19:18:43 +01:00
robxnano 0083bc7ea7 Unix: Bump minimum GTK+ version to 2.6.4
GTK+ 1.2 is extremely outdated and no longer included in most
distributions. By removing support for it we can replace old
UI elements with more modern ones.
2022-10-01 14:58:44 +01:00
kanjitalk755 2fa17a0783
Merge pull request #144 from robxnano/xdg-dirs
Respect XDG Base Directory Specification
2022-10-01 10:19:33 +09:00
kanjitalk755 811dddf70b
Merge pull request #143 from robxnano/sdl1-fix
Further fixes
2022-10-01 09:18:11 +09:00
robxnano 29d0ea13ae Restored variable comments, fixed stray bracket 2022-09-30 23:34:47 +01:00
robxnano 249dfc84ae Revert "SDL2: Stop hotkey commands accepting both Alt and Super when swap_opt_cmd = true"
The previous revert failed.
This reverts commit e28a9fc3a9.
2022-09-30 23:31:41 +01:00
robxnano 4c1c549ed6 Revert SDL2 hotkey code to original version
This reverts commits 3b7a89aad9
and e28a9fc3a9.
2022-09-30 23:09:23 +01:00
robxnano 1b36e7e118 Unix: Added support for old prefs paths, refactored code
Improved the XDG_CONFIG_HOME implementation by adding fallback paths.
If a prefs file in the old location exists, this will be loaded ahead
of the new one. But if no existing file is found, a new one will be
created in the new config directory. Additionally new log messages
were added to show where the prefs file was loaded from.
2022-09-30 18:36:09 +01:00
Seg ffb525800b Implement XDG Base Directory Specification 2022-09-29 16:41:47 +01:00
robxnano 3b7a89aad9 Moved code to set hotkey down bools to kc_decode
- Now hotkey message should always match the actual key
2022-09-27 18:25:27 +01:00
robxnano 4724ce7aee Fix build when X11 fbdev is enabled 2022-09-26 22:47:25 +01:00
robxnano 95f1d46bae Implemented swap_opt_cmd and hotkey prefs for X11 video 2022-09-26 21:00:16 +01:00
robxnano 92778586de Fixes for building with X11 backend 2022-09-26 18:07:56 +01:00
robxnano 988eef8c5c Removed unused and redundant tests which were causing segmentation faults 2022-09-26 18:01:54 +01:00
robxnano cfb9d5a501 Force SDL to use X11 videodriver in SheepShaver
(fixes failure to launch when using Wayland)
2022-09-26 15:28:21 +01:00
robxnano 05adbff2f5
Merge branch 'kanjitalk755:master' into sdl1-fix 2022-09-10 13:34:38 +01:00
robxnano 1de48de65d Updated default keycodes 2022-09-07 15:25:31 +01:00
robxnano 36b2862d21 Ported hotkey and swap_opt_cmd preference support to SDL 1.2 2022-09-07 15:25:00 +01:00
robxnano e28a9fc3a9 SDL2: Stop hotkey commands accepting both Alt and Super when swap_opt_cmd = true 2022-09-07 13:23:57 +01:00
kanjitalk755 6edec590ab macOS: fix mouse grab message 2022-09-07 20:25:22 +09:00
kanjitalk755 75cdbd1d7b
Merge pull request #140 from robxnano/sdl1-fix
Fix building on SDL 1.2
2022-09-07 20:21:26 +09:00
robxnano bfad0d3bba Removed redundant code 2022-09-07 10:23:54 +01:00
robxnano dae2be8c48 ifdefs weren't placed correctly 2022-09-07 00:03:14 +01:00
robxnano 177a297527 Fixed string building for mouse grab hotkey message 2022-09-06 23:23:33 +01:00
robxnano b1ab353085 Fixed building BasiliskII with SDL 1.2 2022-09-05 23:32:05 +01:00
robxnano 4ac4cbba45 Re-enabled SDL 1.2 configure flag 2022-09-04 19:02:28 +01:00
robxnano ed86a18497 Used std::string to fix crash on grabbing mouse with Ctrl+F5 2022-09-03 15:05:56 +01:00
robxnano 481b675e1a Try to fix building on SDL 1.2 2022-09-03 14:31:30 +01:00
kanjitalk755 befe6d2db0
Merge pull request #137 from heavysink/master
BINCUE support for sheepshaver
2022-08-08 11:30:12 +09:00
heavysink 03ed87c966 Fix bincue support for sheepshaver 2022-08-07 18:36:17 -04:00
kanjitalk755 4b1bc7c38c fix multiple entry of "seriala" 2022-07-19 23:07:20 +09:00
kanjitalk755 756021f267 append build date at the end of help 2022-07-01 10:12:34 +09:00
kanjitalk755 5777129302
Update README.md 2022-06-22 22:25:08 +09:00
kanjitalk755 d9e0761bd9 BII and SS: linux arm64 2022-06-22 22:12:37 +09:00
kanjitalk755 11e88dd94f play startup sound also when reboot 2022-06-04 16:32:57 +09:00
kanjitalk755 41648c23c5
Merge pull request #132 from Korkman/master
Small fix for several Linux compilers
2022-06-04 15:17:49 +09:00
Korkman d36be9168d Revert codepage mistake 2022-06-03 20:54:43 +02:00
Korkman 4f94ef52c1 Fix building in Debian Buster, Ubuntu Jammy 2022-06-03 20:40:40 +02:00
kanjitalk755 f017f9df58 fix pref item "cdrom" 2022-06-02 20:36:31 +09:00
kanjitalk755 5900e4895a Modify pref items 2022-06-02 15:42:11 +09:00
kanjitalk755 9009a2741f skip checking STDC_HEADERS 2022-05-17 11:33:26 +09:00
kanjitalk755 d7e93d8f37 remove --with-sdl1 from configure.ac 2022-05-16 22:26:25 +09:00
kanjitalk755 2e9eea3201
Merge pull request #128 from webbedspace/master
Improved Windows icon with transparency
2022-05-05 18:59:51 +09:00
Leon d03303cdf7 Changes to Windows icon based on feedback. 2022-05-05 15:17:51 +10:00
Leon b4be0cdbb2 Improved Windows icon with partial transparency. 2022-05-04 17:27:20 +10:00
kanjitalk755 45578ddd45
Merge pull request #126 from schinkelg/kanjitalk755
Volume creation changes for the Unix GTK prefs editor.
2022-05-03 20:50:39 +09:00
Ger Schinkel e933e7885f Create files according to the process umask. 2022-05-03 08:08:36 +02:00
Ger Schinkel 2666bef882 Forgot Sheepshaver. Same fix. 2022-05-02 19:56:22 +02:00
Ger Schinkel 81ccbfa1e7 Volume creation changes. No longer dependent on dd system command. Does not overwrite existing files. Rudimentary file size checks. 2022-05-02 16:45:42 +02:00
kanjitalk755 a66b73a516
Merge pull request #125 from schinkelg/kanjitalk755
Fix interface sorting bug in Unix tree.
2022-04-30 09:37:04 +09:00
Ger Schinkel 425dac6a7c Fixed a bug where not all modems, printers and ethernet interfaces would get listed after sorting. 2022-04-29 13:49:29 +02:00
kanjitalk755 d4baa318e4
Merge pull request #123 from asvitkine/cleanz_it
Resolve more compiler warnings in Xcode projects.
2022-04-06 11:51:32 +09:00
asvitkine 1f5465ad77 Resolve more compiler warnings in Xcode projects. 2022-04-05 15:15:26 -04:00
kanjitalk755 fcf2c1d9b6
Merge pull request #122 from asvitkine/cleanz
Fix various compiler warnings with Xcode builds.
2022-04-05 15:14:57 +09:00
kanjitalk755 0f7f1543ed
Merge pull request #119 from asvitkine/cleanup_headers
Clean up forward declarations in favor of header files.
2022-04-05 14:05:14 +09:00
asvitkine 732029a512 Fix various compiler warnings with Xcode builds. 2022-04-04 23:44:30 -04:00
asvitkine 3b1868ae56 Fix typo 2022-04-04 22:37:53 -04:00
kanjitalk755 86665c4c30
Merge pull request #120 from asvitkine/fix_warnings
Fix some compile warnings with Xcode project build.
2022-04-05 10:24:49 +09:00
kanjitalk755 6285165090
Merge pull request #121 from asvitkine/remove_unused
Remove unused code.
2022-04-05 10:01:55 +09:00
asvitkine 789a39a2c6 Remove unused code. 2022-04-04 14:01:58 -04:00
asvitkine 2ea84d86c7 Fix some compile warnings with Xcode project build. 2022-04-04 13:53:53 -04:00
asvitkine e069d84f5b Clean up forward declarations in favor of header files. 2022-04-04 13:42:58 -04:00
kanjitalk755 f07b34a451 BII: additional delay test 2022-03-16 13:40:14 +09:00
kanjitalk755 33c3419b08 SS: append --config command line option 2022-01-26 13:43:08 +09:00
kanjitalk755 c359aabc2d Restore symlink 2022-01-24 16:04:03 +09:00
kanjitalk755 d993158df8 Delete vm_alloc.cpp 2022-01-24 16:00:43 +09:00
kanjitalk755 2a5ac90370 SS: Change ROM_BASE address 2022-01-24 15:57:36 +09:00
kanjitalk755 d05e5ab711 make swap_opt_cmd valid even if keycodes file is used 2022-01-18 11:45:55 +09:00
kanjitalk755 88a1fb2921
Merge pull request #111 from dougg3/windows_key_fix
Include scancode when reservewindowskey is enabled
2022-01-18 11:01:54 +09:00
Doug Brown 44f6eff928 Include scancode when reservewindowskey is enabled
Previously, only the keycode was being filled in. This worked in many
cases, but it turns out that the scancode is also important in order to
be compatible with some keycode mapping files.

See discussion:
https://www.emaculation.com/forum/viewtopic.php?p=72685
2022-01-16 17:30:54 -08:00
kanjitalk755 a3534d2eea
Merge pull request #110 from dougg3/windows_key
Add optional ability to intercept Windows key
2022-01-10 16:02:52 +09:00
Doug Brown f1502fb6bd Add optional ability to intercept Windows key
This allows you to use the Windows key as your option key, bypassing
Windows' various uses of the key for the start menu and keyboard
shortcuts. This is enabled with the "reservewindowskey" setting in
the prefs file, and a checkbox has been added to the settings GUI.
2022-01-09 11:43:33 -08:00
kanjitalk755 a5064455cb
Update README.md 2021-09-05 17:50:05 +09:00
kanjitalk755 f385c22ed2 fix for mounting CDROM after reboot 2021-08-30 22:20:26 +09:00
kanjitalk755 ad6047ea24
Update README.md 2021-08-05 09:55:23 +09:00
kanjitalk755 a722785575
Update README.md 2021-08-01 10:06:15 +09:00
kanjitalk755 b2df4fed1f fix for SDL 2.0.14 2021-08-01 09:55:43 +09:00
kanjitalk755 ab586a5a09 SS, x86_64: fix thousands colors mode 2021-06-30 22:00:59 +09:00
kanjitalk755 90edd35246 swap_opt_cmd assumes false if keycodes file used 2021-06-30 11:25:05 +09:00
kanjitalk755 cce0ed4c87 reverted vm_alloc.* 2021-06-24 14:27:39 +09:00
kanjitalk755 763fe81f0d revert 2021-06-24 14:26:16 +09:00
kanjitalk755 0538eb0cc0 BII,linux,x86_64: fixed JIT 2021-06-24 14:19:13 +09:00
kanjitalk755 56343905e3 adjust warning 2021-06-21 10:54:59 +09:00
kanjitalk755 ef2f8724fe
Update README.md 2021-06-13 23:57:02 +09:00
kanjitalk755 15f56749ba changed to use GMP/MPFR static libraries 2021-06-13 23:50:16 +09:00
kanjitalk755 ea3832423c
Merge pull request #92 from aarojun/extended_GUI
Add sdlrender & sdl_vsync settings to Windows GUI config
2021-05-28 15:17:43 +09:00
aarojun d346521b92 Fixed file read of sdlrender pref 2021-05-28 01:36:28 +03:00
aarojun 9621850735 Add Render Driver setting to GUI 2021-05-27 23:40:24 +03:00
aarojun 4d16bb88b4 Merge branch 'extended_GUI' of github.com:aarojun/macemu into extended_GUI 2021-05-27 17:17:33 +03:00
aarojun 42e70e85c6 Add sdl_vsync setting to GUI 2021-05-27 17:16:35 +03:00
aarojun 6385243609 Merge branch 'kanjitalk755:master' into extended_GUI 2021-05-27 15:33:11 +03:00
aarojun bdcc9d2da4 Keep refresh rate settings when dtype = fullscreen 2021-05-27 15:15:52 +03:00
kanjitalk755 1de3d694f2
Merge pull request #91 from aarojun/master
Add "sdl_vsync" pref in Windows (SDL_Renderer)
2021-05-27 20:55:01 +09:00
aarojun ac68d68920 Add sdl_vsync to pref items 2021-05-27 13:28:33 +03:00
aarojun 5d1bfd1059 Merge branch 'master' of https://github.com/aarojun/macemu 2021-05-27 06:40:56 +03:00
aarojun e9a9573a20 Make sdlrender & sdl_vsync defaults visible in config 2021-05-27 06:33:46 +03:00
aarojun c28a00f58a Add sdl_vsync option (vertical sync with SDL_Renderer) 2021-05-27 06:30:31 +03:00
kanjitalk755 420dc1d504 fixed startup sound 2021-05-16 14:46:58 +09:00
kanjitalk755 ba89fc7a72
Update README.md 2021-05-11 10:18:06 +09:00
kanjitalk755 78fdb44d02
Update README.md 2021-05-07 14:44:40 +09:00
kanjitalk755 bc9c7675f9 removed unnecessary files from the uae_cpu libraries 2021-05-07 14:29:27 +09:00
kanjitalk755 caf10f1223 BII(x86_64): re-enabled JIT compiler 2021-05-06 14:24:31 +09:00
kanjitalk755 5862662bc9 fix for Linux and Windows 2021-05-06 12:16:03 +09:00
kanjitalk755 e42b8f6076 rename new uae_cpu 2021-05-06 11:38:37 +09:00
kanjitalk755 ce00063701
Update README.md 2021-05-06 10:50:26 +09:00
kanjitalk755 164aa8c3fe copy codegen_x86.h from BasiliskII 2021-05-05 23:18:15 +09:00
kanjitalk755 9cf0c98dd6 delete simlink 2021-05-05 23:16:29 +09:00
kanjitalk755 1d710a0cad BII: disable JIT compiler 2021-05-05 22:15:43 +09:00
kanjitalk755 1aaeaf05c4 fixed merge error and deleted unnecessary files 2021-05-04 18:33:50 +09:00
kanjitalk755 65028aec4a Merge remote-tracking branch 'uyjulian/core_cleanup/BasiliskII/src/uae_cpu' into update_uae 2021-05-04 13:51:40 +09:00
kanjitalk755 8a28ad6e39 A workaround for Xcode 12.5 2021-04-30 10:07:28 +09:00
kanjitalk755 4f0743562e
Update README.md 2021-04-23 20:55:06 +09:00
kanjitalk755 49eee29597 Xcode: modified for building both x86_64 and arm64 2021-04-23 20:47:17 +09:00
kanjitalk755 20d2de95ce marged Jagmn's patch
https://emaculation.com/forum/viewtopic.php?p=70121#p70121
2021-04-23 10:19:48 +09:00
kanjitalk755 a39eff553c changed implementation of "name_encoding" 2021-04-21 21:29:05 +09:00
kanjitalk755 e750aecafe macOS: prefs item "name_encoding" 2021-04-16 10:54:04 +09:00
kanjitalk755 72989fffe2
Merge pull request #88 from codeandcreate/aarch64
applyed patches from https://github.com/oaguy1/macemu
2021-03-31 09:28:01 +09:00
Matthias Weiß 176da65363 applyed patches from https://github.com/oaguy1/macemu 2021-03-30 15:14:14 +02:00
kanjitalk755 8064215081 prefs item "sound_buffer" 2021-03-17 11:42:37 +09:00
kanjitalk755 7471c357c3 linux,Windows: fixed fullscreen 2021-03-04 14:29:02 +09:00
kanjitalk755 ce3e2f3693 prefs item "mousewheellines" accepts negative value 2021-03-03 14:59:37 +09:00
kanjitalk755 6d3fbba4cd Merge remote-tracking branch 'seghaxx/master'
# Conflicts:
#	BasiliskII/src/MacOSX/extfs_macosx.cpp
#	BasiliskII/src/SDL/video_sdl2.cpp
#	BasiliskII/src/Unix/configure.ac
2021-03-03 12:13:12 +09:00
kanjitalk755 65772919a1 specify OpenGL if non-Metal Mac 2021-02-28 18:56:58 +09:00
kanjitalk755 623abaa243 prefs item "title" 2021-02-27 18:29:57 +09:00
kanjitalk755 2e5654e583 SS: can use cxmon 2021-02-26 12:21:21 +09:00
kanjitalk755 2f1f196251 Merge branch 'test_fullscreen3' 2021-02-25 14:50:54 +09:00
kanjitalk755 39cbc73a9f added SDL version check 2021-02-25 14:49:54 +09:00
kanjitalk755 e75d2ca5d6 fix for g++ 2021-02-16 15:11:49 +09:00
kanjitalk755 09046e0a2f check Metal device 2021-02-14 16:25:02 +09:00
kanjitalk755 4cf65a3faf fixed initial window title 2021-02-10 22:12:38 +09:00
kanjitalk755 fbddf063cb fixed swapping opt and cmd key if keycode file is used 2021-02-07 09:34:22 +09:00
kanjitalk755 89e8a05815 startup sound 2021-02-06 13:06:13 +09:00
kanjitalk755 556ec0cf80 added port forwarding for Windows 2021-02-05 22:13:46 +09:00
kanjitalk755 8ebc4c90c3 SS: added pref keyword "redir" 2021-02-05 13:05:43 +09:00
kanjitalk755 73fc469c4c
Merge pull request #78 from mactcp/glenn_apfs-resfork
Improved fix for resource forks not being created on APFS volumes
2021-02-04 14:14:52 +09:00
Glenn Anderson 5620ef8c43 Improved fix for resource forks not being created on APFS volumes 2021-02-03 09:16:11 -08:00
kanjitalk755 b539de9753 SS: fixed minimum system version 2021-02-03 10:06:33 +09:00
kanjitalk755 3f4eed670f fix for SDL 2.0.14 2021-02-02 18:35:57 +09:00
kanjitalk755 0fd17a98ff BII: fixed thousands colors mode 2021-01-31 21:20:47 +09:00
Seg 69bf439fac Merge Travis CI config from emaculation/macemu 2020-12-30 07:59:53 -08:00
Seg 144b117886 Fix JIT enable logic 2020-12-30 07:54:21 -08:00
Seg 6d92f13bcd Don't use linker script on x86_64, there is no need for it and it
breaks flatpak builds
2020-12-30 07:33:52 -08:00
Seg cad8df587d Update config.guess and config.sub 2020-12-30 07:33:52 -08:00
Seg eb9142ac14 Fix crash on linux aarch64 2020-12-30 07:33:52 -08:00
Seg 0c8529eca1 Merge remote-tracking branch 'cebix/master' into kanjitalk755/master 2020-12-30 07:22:50 -08:00
kanjitalk755 436c5df15f fix CapsLock for linux 2020-12-17 22:25:48 +09:00
kanjitalk755 cadd3350ea
Merge pull request #72 from rakslice/x64_32_instruction_skip
X64 32-bit address instruction skip
2020-12-02 18:12:19 +09:00
rakslice f198632834 corresponding change for BII sigsegv.cpp 2020-12-01 23:33:38 -08:00
rakslice 85f8971d8d remove x64 instruction skip 32-bit address flag we don't need to save for anything 2020-12-01 19:55:45 -08:00
rakslice 497b5bc5a9 cleanup
(cherry picked from commit 72a1513a360118b03b7c29be519125f7d5f7cc8e)
2020-12-01 19:51:00 -08:00
rakslice e00c6f2091 ix86_instruction_skip: x86_64: handle address size prefix
(cherry picked from commit 05b3236afd71886826d6e4784ca4e708f67aaa80)
2020-12-01 19:50:19 -08:00
kanjitalk755 b6725730f5 for avoid errors in Xcode12.2, the target arm64 was excluded 2020-11-23 22:47:18 +09:00
kanjitalk755 6f6e9b8d82 for avoid errors in Xcode12.2, the target arm64 was excluded 2020-11-23 22:43:54 +09:00
asvitkine d684527b27
Merge pull request #220 from atsampson/fixsdl
Update SheepShaver for SDL2 support
2020-11-22 22:53:25 -05:00
asvitkine 6c38946bf0
Merge pull request #221 from atsampson/openpty
Use openpty if possible
2020-11-22 22:52:21 -05:00
kanjitalk755 0d213f9d00 avoid compile error in macOS 2020-11-20 18:46:45 +09:00
kanjitalk755 c151e24bb8
Merge pull request #71 from rakslice/host_dns_resolution_domains
slirp: Resolve DNS requests for a configurable set of domains using the host's name resolution
2020-11-20 18:33:10 +09:00
kanjitalk755 6a88d08551
Merge pull request #70 from rakslice/hardcursor_warp_fix
Fixes for cursor warping in "hardcursor" mode on Windows
2020-11-20 18:31:44 +09:00
kanjitalk755 a179f00a62
Merge pull request #69 from rakslice/sdlrender_pref_windows
Add "sdlrender" pref in Windows
2020-11-20 18:30:34 +09:00
rakslice 62081d50d1 fix typo 2020-11-19 21:28:05 -08:00
rakslice faeb5fa2e1 make sure response size assert applies in the empty response case; cleanup; add more comments 2020-11-19 18:29:06 -08:00
rakslice ff0a825356 note about the source of the commented structs 2020-11-19 16:38:05 -08:00
rakslice 6d74ff5600 fix calculated size 2020-11-19 15:54:10 -08:00
rakslice 5163e17f14 ignore upper case in pref 2020-11-19 15:43:10 -08:00
rakslice a1ef6be18a make locally resolved DNS domains configurable through host_domain pref (multi allowed); also match exact domain 2020-11-19 15:31:16 -08:00
rakslice a453ae105a slirp: resolve .local suffix DNS requests using the host's name resolution
(cherry picked from commit e2a6a4c1177e252bc38221c87bb99a599e8761a1)
2020-11-19 14:10:38 -08:00
rakslice d7215df688 put back spacing 2020-11-19 13:37:45 -08:00
rakslice cff2024c2e add sdlrender pref in SS windows
(cherry picked from commit bec7de6e8fd4d67993b1e22ad6d3560608671790)
2020-11-19 04:59:30 -08:00
rakslice 0df082d4e1 add sdlrender pref for BII/Windows
(cherry picked from commit 6d9018f5f401b13f1dea02a9368f201f49e66dbd)
2020-11-19 04:58:15 -08:00
rakslice 991496a4f4 Make the video_sdl2 warpmouse output a debug message
(cherry picked from commit 69574d53a9511b64092304f0969a31da4789051a)
2020-11-18 13:30:12 -08:00
rakslice c0ceb74931 fix mouse warp destination coordinates; don't warp mouse cursor when it is not on the mac screen
(cherry picked from commit aa92a09475b2a18f51d21f10f2acd4242205db6c)
2020-11-18 13:29:56 -08:00
kanjitalk755 d547db0648
Merge pull request #68 from rakslice/misaligned_rows_fix
Misaligned rows fix
2020-11-18 12:05:52 +09:00
kanjitalk755 d0b3dcd623
Merge pull request #67 from rakslice/mode_switching_fix
Fix for uninitialized value causing Quicktime image rendering to sometimes fail after mode changes
2020-11-18 12:05:31 +09:00
kanjitalk755 271b7322d3 Merge branch 'test_issue64' 2020-11-18 12:01:40 +09:00
rakslice 6b4cc38de6 Corresponding header change for BII; cleanup
(cherry picked from commit 36ccf8a46a72b6c970df04bd6ecc60efd0363476)
2020-11-17 05:23:16 -08:00
rakslice c8c1a76381 prevent truncating unaligned rows in non-vosf mode with 16 colors or less
(cherry picked from commit 9d6124871be79f5c3028ebe3f5d1068dbcea0c84)
2020-11-17 05:23:04 -08:00
rakslice af8e91f446 initialize vpPlaneBytes in GetVideoParameters response
(cherry picked from commit bf128df83fee799d1b36f0968bd78980dd2ffdc2)
2020-11-17 05:16:36 -08:00
kanjitalk755 b1a7f71ef4
Merge pull request #66 from rakslice/vosf_full_screen_fixes
VOSF full screen video problem fixes
2020-11-16 17:53:26 +09:00
rakslice a897561c11 remove duplicated function and fix BII 2020-11-15 12:53:54 -08:00
rakslice 85da18e38f fix for misaligned rows in screen buffer in VOSF full screen mode when screen buffer has slack and source doesn't
(cherry picked from commit cbca0b629f7b4fab0038a0d45c15a302c3216763)
2020-11-15 12:19:49 -08:00
rakslice c044312b3c In vosf full screen update use chunk size based on pixel size
(cherry picked from commit 108071e1a1ed9f43229fc81ca882fbb6c2de7eec)
2020-11-15 12:19:39 -08:00
rakslice 0a79f5d1b1 Merge branch 'kanjitalk755_master' of https://github.com/rakslice/macemu into kanjitalk755_master 2020-11-07 17:05:05 -08:00
kanjitalk755 6c20f2c4d9 fix for deadlock in timer 2020-11-07 11:52:24 +09:00
kanjitalk755 87d4660aa6 test for issue64 2020-10-28 12:57:28 +09:00
rakslice 0b9b6401d6
Merge pull request #42 from kanjitalk755/master
update kanjitalk755_master
2020-10-26 15:33:04 -07:00
kanjitalk755 3ce86cee1f
Merge pull request #63 from rakslice/slirp_critical_section_win
Windows: prevent calls to slirp functions from multiple threads concurrently
2020-10-26 21:53:38 +09:00
rakslice a14362b183 Windows: add a critical section for slirp calls to avoid unsafe use from multiple threads 2020-10-25 16:28:19 -07:00
kanjitalk755 cc5d99431f
Merge pull request #62 from rakslice/fix_audio
Fix for audio crashes on second playback
2020-10-23 12:27:01 +09:00
rakslice 1892cf0a7e remove errant return in audio component close handler 2020-10-22 15:47:33 -07:00
kanjitalk755 73f194f422 remove .travis.yml
reduce warnings
2020-10-16 19:17:58 +09:00
kanjitalk755 232efdaa8c change pref default (jit and ignoresegv) 2020-10-10 15:07:12 +09:00
kanjitalk755 edf8d14f09
Update README.md 2020-10-09 14:03:53 +09:00
kanjitalk755 83d7702f28 add gnome_keybindings.txt 2020-10-09 13:54:42 +09:00
kanjitalk755 43cb7718e6 ignore key repeat 2020-10-08 17:10:49 +09:00
kanjitalk755 d20ba5d179 test a pref item swap_opt_cmd 2020-10-06 15:38:35 +09:00
kanjitalk755 dd9cfec0e7 BII: JIT enabled 2020-10-06 15:10:21 +09:00
kanjitalk755 02c037b5cb
Merge pull request #57 from rakslice/newworld_cd_boot
Implement bootdriver pref on NewWorld by reordering the drive queue
2020-09-25 20:19:38 +09:00
rakslice ca9191fcb1 Fix whitespace 2020-09-24 19:44:33 -07:00
rakslice 561f1dfcde For NewWorld ROM, implement the bootdriver setting by reordering the drive queue once CD-ROM drives are added 2020-09-24 19:09:54 -07:00
kanjitalk755 9708089c1e
Merge pull request #56 from rakslice/win_cdrom
Fix for autodetected physical cdroms in Windows
2020-09-22 18:33:09 +09:00
rakslice 37b36ef332 actually use dynamically detected cdroms; if read via cdenable doesn't work use the logical drive handle instead 2020-09-21 20:33:26 -07:00
kanjitalk755 4e98699ee1 fix link file list of SS 2020-09-18 18:42:36 +09:00
kanjitalk755 be17ba9044 save initial gamma tables
change default gammaramp to off
2020-09-18 10:29:16 +09:00
kanjitalk755 7313b0284c BII: fix gamma ramp 2020-09-17 11:10:15 +09:00
kanjitalk755 d851a65548 fix gamma ramp when 16-bit color 2020-09-13 23:03:51 +09:00
Seth Polsley 6de9a5032d Splitting mac_pal and mac_gamma to always allow SDL gamma changes 2020-09-13 03:41:23 -05:00
kanjitalk755 21c16f991e switchable gamma ramp 2020-09-13 13:49:48 +09:00
kanjitalk755 3cf23176f6
Merge pull request #47 from spolsley/master
Restoring sound DRVR patch for New World ROMs
2020-09-12 19:03:03 +09:00
Seth Polsley 25e2d4af6f Removing vm_memcpy dependency for BII 2020-09-11 14:44:58 -05:00
Seth Polsley 40e2d3d84b Removing temp ignoresegv patch 2020-09-10 17:31:21 -05:00
Seth Polsley 833f21c225 Merge branch 'master' of https://github.com/kanjitalk755/macemu 2020-09-10 13:59:51 -05:00
Seth Polsley 2a904af8e7 Cleaner soundin driver implementation 2020-09-10 01:36:49 -05:00
Seth Polsley 177555e0d1 Loading soundin patch with resources writing to ROM 2020-09-10 00:51:24 -05:00
kanjitalk755 95437fbf89 fix BII build 2020-09-06 22:25:55 +09:00
kanjitalk755 09429e6021 SS: Patch the sound input driver if using New World ROM and ignore SEGV is false 2020-09-04 19:06:49 +09:00
Seth Polsley 07880c76ed Merge branch 'master' of https://github.com/kanjitalk755/macemu 2020-09-01 20:09:56 -05:00
kanjitalk755 98e12fbc2e BII: JIT 2020-09-01 22:25:04 +09:00
kanjitalk755 d58aa827a4 revert BII JIT 2020-08-30 22:25:47 +09:00
kanjitalk755 722b777ee8
Update README.md 2020-08-30 15:14:03 +09:00
kanjitalk755 3861177919 add pref item "mag_rate"
BII: JIT
2020-08-30 15:09:09 +09:00
kanjitalk755 6f87eaca84
Merge pull request #52 from rakslice/ac_fixes
Windows configure.ac fixes
2020-08-28 22:44:12 +09:00
rakslice 92a1ee2128 Windows configure.ac: fix broken SDL check with macro intended for configure script contents context being used in shell variable contents context 2020-08-28 03:09:37 -07:00
rakslice 4b93738773 Windows configure.ac: fix AC_CACHE_CHECK miss case with value with setting in side effecting AC_SUBST which won't get cached 2020-08-28 03:01:38 -07:00
kanjitalk755 ec032ffd75 provisional fix for SEGV 2020-08-28 14:06:29 +09:00
kanjitalk755 64b38dbec8 SS: fix double pref item (ignoresegv)
BII: fix for JIT
2020-08-24 11:51:31 +09:00
Adam Sampson 413190d12f Use openpty if possible.
The code this affects in sshpty.c originally came from OpenSSH, which
now uses openpty by preference when it's available. openpty is a
BSD-ism, but it's been provided by glibc on Linux with the BSD
semantics since 1998.
2020-08-23 17:26:15 +01:00
Adam Sampson 0eae77599e Update SheepShaver for SDL2 support.
This imports the SDL2-related changes from BasiliskII.
2020-08-23 16:59:42 +01:00
Adam Sampson 4da2082c07 The mono palette hack isn't needed for SheepShaver. 2020-08-23 16:47:48 +01:00
uyjulian bb5caf093a
Merge latest ARAnyM changes 2020-08-23 08:34:42 -05:00
kanjitalk755 565c133662
Merge pull request #48 from rakslice/gamma
Hook up Mac OS gamma settings in SS and with SDL1/SDL2
2020-08-19 19:18:47 +09:00
rakslice e5c4699923 put error message on stderr 2020-08-18 21:09:28 -07:00
rakslice 639f05da7e don't call SetWindowGammaRamp without sdl_window 2020-08-18 20:53:39 -07:00
Seth Polsley d853f9abae Restoring driver patch for sound id -16501 for New World ROMs 2020-08-18 14:47:03 -05:00
rakslice ba111a5cb7 Merge branch 'kanjitalk755_master' into gamma 2020-08-18 04:48:28 -07:00
rakslice bb080a262e repeat gamma entries to handle B2 thousands (16-bit) color mode; ignore its solid grey palettes such as those that happen during mode changes 2020-08-18 04:21:23 -07:00
rakslice b4b652d696 fix sdl error message output 2020-08-18 04:13:50 -07:00
rakslice d1fcff0a08 corresponding gamma change for sdl1 2020-08-18 03:28:43 -07:00
rakslice 792ad5ccff cleanup 2020-08-18 03:28:23 -07:00
rakslice ffee1ebad2 Add gamma support for direct color modes 2020-08-17 21:05:08 -07:00
kanjitalk755 6985ad67fe BII: prepare JIT 2020-08-13 21:00:42 +09:00
kanjitalk755 630f4ffafb fixed leak 2020-08-12 20:49:14 +09:00
kanjitalk755 1f2b35fef2 reserve framebuffer 2020-08-12 11:39:58 +09:00
kanjitalk755 d906fb23b0 CD fix
default palette
2020-08-10 13:01:22 +09:00
kanjitalk755 7c6b9a67f6 the first steps for Apple Silicon 2020-08-08 11:50:55 +09:00
kanjitalk755 1da83854b0 fix freezing bug on launch 2020-07-25 22:45:07 +09:00
asvitkine 29bb3d5a5a
Merge pull request #215 from rickyzhang82/pr-support-system6-vscreen
Port mini vMac guest OS screen ROM patch.
2020-07-15 22:57:38 -04:00
Ricky Zhang 13017f711f
Fix a weird whitespace.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 21:56:00 -04:00
Ricky Zhang 82524ba034
Unwrap the formula.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 21:54:06 -04:00
Ricky Zhang 2e96512f26
Fix if/else format.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 21:42:59 -04:00
Ricky Zhang 5f1b41eb42
Improve the comment readability.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 21:14:20 -04:00
Ricky Zhang 03ebc5375b
Fix comment.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 20:55:34 -04:00
asvitkine 8f12a0fffb
Merge pull request #216 from rickyzhang82/pr-add-xwidnow-to-travis
Beef up Travis CI with XWindows backend.
2020-07-15 20:18:36 -04:00
Ricky Zhang 7513fab5ad
Beef up Travis CI with XWindows backend.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 19:59:46 -04:00
Ricky Zhang 342fbbce34
Port mini vMac guest OS screen ROM patch.
- Added Mac SE 24 bit ROM screen patch from mini vMac.
  The guest OS resolution in System 6 can be defined
  at an arbitrary combination.
- Mac frame buffer base mapping is moved out from guest RAM.
  This creates more leg room for the host frame buffer.
- Enable System 6 vscreen support in SDL2. Passed build and test.
- Enable System 6 vscreen support in SDL1. Passed build and test.
- Eanble System 6 vscreen support in XWidnow. Passed build and test.

See my [screen cast demo here](https://youtu.be/aXzM8t_u3zI)

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-15 19:14:36 -04:00
kanjitalk755 5b31736785
Merge pull request #45 from spolsley/cdaudio_test
Cross Platform Bin/Cue Support for CD Audio
2020-07-15 14:37:46 +09:00
Seth Polsley 478fc39650 Setting optimization level 2020-07-14 23:07:46 -05:00
Seth Polsley d7fb0ac298 Audio CD format as default and update based on data mode 2020-07-14 19:13:33 -05:00
Seth Polsley 8124b61d2b Enable optimization by fixing inits and access bounds 2020-07-14 16:48:06 -05:00
Seth Polsley 4191a86895 Removing recovered references to coreaudio, not needed for sdl2 builds 2020-07-13 01:25:37 -05:00
Seth Polsley c7a7e034ed Cleaning associated xcode project files 2020-07-13 01:16:25 -05:00
Seth Polsley 2c8678417c Remove coreaudio embed from BII builds since using SDL2 audio 2020-07-12 23:34:19 -05:00
Seth Polsley 059d88ce75 Removing more unused dependencies for Mac build 2020-07-12 22:22:25 -05:00
Seth Polsley 12ac0d3032 Cleaning up frameworks in Sheepshaver build 2020-07-12 17:10:28 -05:00
Seth Polsley ed5f7f22b8 Removing coreaudio dependency, using SDL for current builds 2020-07-12 17:08:40 -05:00
Seth Polsley 7441d04a28 Minor cleanup of bincue vars 2020-07-12 16:54:40 -05:00
Seth Polsley 3e32a6da32 Enforce only one player at a time, pause any other 2020-07-10 17:02:04 -05:00
Seth Polsley 47fca465ba Remove the one dependency on unicode for reading rom file 2020-07-07 01:05:41 -05:00
Seth Polsley 084a8fbd74 Does Win BII need Unicode? removing... no others have it and prefer to add it to both sheep and BII together 2020-07-07 00:18:18 -05:00
Seth Polsley 1775fb3776 Adding bincue flag in configure 2020-07-06 22:02:19 -05:00
Seth Polsley 80399941b2 Cleaning up build scripts with Bincue for Windows and *nix 2020-07-06 18:47:26 -05:00
Seth Polsley a5e7e80cda updated makefile template for bincue 2020-07-06 02:19:49 -05:00
Seth Polsley c3ccdcec5d Updated links for bincue under Windows 2020-07-06 02:09:47 -05:00
Seth Polsley 30cf26e1f6 Windows bincue support 2020-07-06 00:04:08 -05:00
Seth Polsley 66a69dc79b Refactoring to handle crossplatform bincue support 2020-07-05 23:54:53 -05:00
asvitkine 6d522db16c
Merge pull request #212 from rickyzhang82/pr-fix-sdl2-for-system-6
Patch SDL2 for System 6 24bit ROM
2020-07-05 19:41:46 -04:00
asvitkine 245da3b142
Merge pull request #213 from rickyzhang82/pr-add-autogen-for-cxmon
Add autogen for cxmon
2020-07-05 19:40:32 -04:00
Ricky Zhang 89bcd3dc3e Add autogen for cxmon
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-05 17:56:44 -04:00
Ricky Zhang 2595059146
Fix a minor bug for B/W palette.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-04 16:47:58 -04:00
Ricky Zhang bae7a4d16b
Explained why the magic number used in 24bit ROM frame mapping.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-04 14:45:21 -04:00
Ricky Zhang e63c6b91dc
Patch SDL2 palette for 24bit ROM.
24bit ROM doesn't invoke video driver control. Therefore, a manual step
is required to add a black & white palette for guest_surface in SDL2.

Please check out [the screen cast here](https://youtu.be/br5Hjt9F6X4).

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-04 14:22:33 -04:00
Ricky Zhang 40f6c77775
Move the RAM debug message to the proper place.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-03 19:42:55 -04:00
Ricky Zhang 7e83b9c49e Fix Indentations.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-03 19:42:10 -04:00
asvitkine a21ad0d7c4
Merge pull request #211 from rickyzhang82/pr-fix-indentation
Fix indentation.
2020-07-03 17:05:58 -04:00
Ricky Zhang 98f3cab953 Fix indentation.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-03 10:00:15 -04:00
asvitkine ef57fd2c5f
Merge pull request #210 from rickyzhang82/pr-enhance-sdl2-scale-up
Enhanced scale up and scale down in SDL2.
2020-07-02 20:15:37 -04:00
Ricky Zhang 6f4da45eeb Enhanced scale up and scale down in SDL2.
- Enable window mode to be resizable.
- When restore the window, restore the scale ratio to 1.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-07-02 18:35:18 -04:00
asvitkine 864b4a1652
Merge pull request #206 from rickyzhang82/pr-fix-framebuffer-bug
Abort when frame buffer memory allocation fails.
2020-07-01 21:36:25 -04:00
asvitkine b49d9b7485
Merge pull request #205 from rickyzhang82/pr-fix-mac-hang
For Darwin, the default addressing mode is memory banks.
2020-07-01 21:35:47 -04:00
asvitkine 03f5cc8c79
Merge pull request #209 from rickyzhang82/pr-travis-ci
Beef up CI test cases
2020-07-01 21:35:22 -04:00
Ricky Zhang 0b38469385 Add Mac OS X CI.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-30 21:20:22 -04:00
Ricky Zhang d30528795b
Beef up CI build cases.
- Add addressing modes direct and memory banks.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-30 20:43:54 -04:00
Ricky Zhang bdf5a276d3
Abort when frame buffer memory allocation fails.
- Remove unused code in vm_acquire_framebuffer function.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-30 18:25:50 -04:00
Ricky Zhang 56665d30a3
For Darwin, the default addressing mode is memory banks.
When the host OS is Mac OS X, direct addressing in BII doesn't guarantee
that the allocated memory for frame buffer base address in the host
(FrameBaseHost) satisfies the following conditions:

- FrameBaseHost > RamBaseHost
- (FrameBaseHost - RamBaseHost) + Frame_Size < 4GiB
where RamBaseHost refers to the emulated RAM base address in the host.

This may cause the random hang problem where the allocated frame address
failed to meet the conditions above.

Because the direct addressing mapping is a simple math:

RamAddrMac = RamAddrHost - RamBaseHost.

See details: https://github.com/cebix/macemu/issues/203

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-30 18:07:25 -04:00
asvitkine 16081b2878
Merge pull request #202 from rickyzhang82/pr-enable-sdl2
Enable SDL2 for Linux and Mac OS X
2020-06-29 22:15:43 -04:00
Ricky Zhang 18701c97df
Fix year in project
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-29 22:10:27 -04:00
Ricky Zhang 8e88e462ee
Fix code review issues.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-28 18:42:14 -04:00
Ricky Zhang e6cd178881
Point CI status to upstream-master branch.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-28 10:29:52 -04:00
Ricky Zhang 1bfb0e94a3
Back out the hack from kanjitalk755
Remove the unused header.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-27 12:13:51 -04:00
Ricky Zhang 9ef2f87adb
Add CI for SDL1 and SDL2.
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-27 00:17:25 -04:00
Ricky Zhang dc8bb7e2a3
Back out the hack from kanjitalk755
- In 8 bit color game, the hack crashed the app.
- After backing out the hack, I can play 256 color game with displaycolordepth 8.
- By default, the displaycolordepth is 0.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-25 16:56:40 -04:00
Ricky Zhang d28599f49d
Backport MacOSX support.
- video_sdl2 for Mac OS X requires MacOSX update.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-25 15:50:40 -04:00
Ricky Zhang a46759990d
Backport SDL2 features from https://github.com/kanjitalk755/macemu
By default, without providing `with-sdl2` in configure it uses SDL1.
Users need to explicitly request SDL2.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
2020-06-25 15:28:41 -04:00
asvitkine 5cbf07e9f5
Merge pull request #201 from rickyzhang82/pr-revert-broken-commit
Revert "Merge pull request #190 from fragglet/patch-1"
2020-06-25 10:24:37 -04:00
Ricky Zhang b0bdceac34 Revert "Merge pull request #190 from fragglet/patch-1"
This reverts commit a4a2c88ed7, reversing
changes made to 1918557e78.
2020-06-25 09:43:20 -04:00
asvitkine b2d281e5ab
Merge pull request #200 from aviallon/patch-int-narrowing
Fix build fail under GCC 10
2020-06-20 13:48:03 -04:00
Antoine Viallon f13f25db3e
Fix build fail under GCC 10
GCC fails to build because of -Wnarrowing
2020-06-20 19:19:49 +02:00
kanjitalk755 607f4ed354 avoid compile error in g++10 2020-06-03 19:10:08 +09:00
kanjitalk755 9895200f79 fixed video contstants 2020-06-02 22:49:03 +09:00
Seth Polsley 23da9e72eb Fix handling of nocdrom 2020-05-25 18:55:56 -05:00
Seth Polsley bebeacc895 adding adb back for build, fixing automerge problem 2020-05-25 16:52:45 -05:00
Seth Polsley 8e110b063c Merge branch 'master' into cdaudio_test 2020-05-25 16:31:02 -05:00
Seth Polsley eb722fc799 Merge remote-tracking branch 'upstream/master' 2020-05-25 16:21:28 -05:00
Seth Polsley 7eb7a477d0 clang debug flag adjustment 2020-05-25 15:58:15 -05:00
kanjitalk755 a01387b1af prefs item "sdlrender" 2020-05-18 17:39:05 +09:00
kanjitalk755 a528b0a40f BII: fixed writing xpram file 2020-05-16 21:18:16 +09:00
asvitkine cbad6f95ea
Merge pull request #196 from b01t/fix_warnings
Fix compile time warning on enum compare
2020-05-05 17:50:41 -04:00
asvitkine 9a905723db
Merge pull request #198 from rillig/patch-1
src/Unix/Darwin/testlmem.sh: make code shorter
2020-05-05 17:50:15 -04:00
Roland Illig 8a4b84b9d7
src/Unix/Darwin/testlmem.sh: make code shorter
The old code used the `[[` shell keyword, which is only available in bash.
The interpreter in line 1 is `/bin/sh` though.
This confused my shell portability check in pkgsrc, since that check neither guesses the target platform from the filename, nor assumes that `/bin/sh` is actually bash, even though this may be true on macOS.

The change makes the code shorter with the well-known `${var:-default}` pattern.
Since `$1` is now only accessed when it is defined, this allows the program to have a `set -eu` at the top.
This in turn would make all the `&&` redundant since it applies automatic error checking.

The `{ ... } 1>&2` could also be replaced with a single `exec 1>&2` at the top.
2020-05-05 19:48:35 +02:00
asvitkine 7790aa7e0c
Merge pull request #195 from b01t/master
Add the strings from commit 00f02d9d0c
2020-04-12 20:06:18 -04:00
bolt 5670c82b0d Fix compile time warning on enum compare 2020-04-09 15:22:00 +02:00
bolt c6e1af7ff4 Fix compile time warning on enum compare 2020-04-09 15:07:29 +02:00
bolt 767b97311b Add the strings from commit 00f02d9d0c to user_strings.h 2020-04-09 14:50:07 +02:00
kanjitalk755 617a723a16
Merge pull request #40 from emendelson/master
New icons; removed unused icon code
2020-03-27 23:27:43 +09:00
emendelson 0e01e5c91e New icons; removed unused icon code
Replace (again) the Windows and MacOS icons and remove the c-file icons and the reference to them in the source.
2020-03-26 20:27:24 -04:00
kanjitalk755 27d3d93b7c
Merge pull request #39 from emendelson/master
Updated icons; add Windows medium icon
2020-03-24 09:15:23 +09:00
kanjitalk755 c0dfecdd1a fix error for linux build 2020-03-23 11:58:42 +09:00
emendelson 8ca7815baf Updated icons; add Windows medium icon
Replace the existing icons with the 7/8 design; add a 48x48 icon for the Windows build.
2020-03-22 14:00:18 -04:00
kanjitalk755 946f4bb77d BII/SS common: read keycodes, if failed, read BasiliskII_keycodes 2020-03-21 19:48:58 +09:00
kanjitalk755 b3c4d46ca9 changed default keycodes file name 2020-03-21 10:21:53 +09:00
kanjitalk755 ecef51bc47 fixed keycodes file name (SS)
fixed capslock (Windows)
2020-03-19 11:10:02 +09:00
kanjitalk755 c4956c40f8
Update README.md 2020-03-18 15:29:20 +09:00
kanjitalk755 6fe0d3ab7c SS Windows: enabled JIT compiler by default 2020-03-18 15:27:54 +09:00
kanjitalk755 573adb507f
Merge pull request #37 from rakslice/sheepshaver_mingw32_jit
SS mingw32 JIT & GTK prefs GUI fixes
2020-03-18 15:13:23 +09:00
rakslice 9dabd45086 bump dyngen output for updated bswap_16 2020-03-17 19:37:58 -07:00
rakslice 2a6dc7e328 clean up some warnings 2020-03-17 18:47:02 -07:00
rakslice 40cb4bf236 implementing bswap_16 to avoid incorrect result from cygwin 1.7 gcc 3.4.4 built dyngen for lhz 2020-03-17 18:46:40 -07:00
rakslice 12f8469172 fix clean of dyngen binary 2020-03-17 18:21:36 -07:00
rakslice d936e9938d SS: Fix JIT on minwg32
- add wrappers with default calling convention for powerpc_cpu member functions used through nv_mem_fun ptr()
** explicit wrappers for member functions that were used explicitly
** dynamic wrapper generator in nv_mem_fun1_t for member functions used dynamically via the instruction table
- add missing direct addressing (non-zero constant offset to Mac memory) support in lvx and stvx implementations
- fix mismatched parameter lists between powerpc_jit member functions and the calls they get through the jit_info table to fix problems at -O2
2020-03-17 17:45:38 -07:00
rakslice a667dc9787 SS: add pregenerated dyngen output from cygwin; on cygwin run the dyngen, otherwise on Windows use this pregenerated dyngen 2020-03-17 16:31:00 -07:00
rakslice ef2f205d6b Remove frsqrte dyngen op def because do_frsqrte is missing 2020-03-17 16:24:14 -07:00
rakslice cd269a9ce1 In SheepShaver GUI don't show JIT checkbox in non-JIT build 2020-03-17 16:24:07 -07:00
rakslice f1b0a20b37 get prefs_editor_gtk building in mingw32 2020-03-17 16:13:44 -07:00
rakslice aeb585527d changes for buildability under MSYS2 mingw32 2020-03-17 15:11:12 -07:00
asvitkine a4a2c88ed7
Merge pull request #190 from fragglet/patch-1
configure: Enable /dev/ptmx for Linux, Darwin.
2020-03-15 19:04:20 -04:00
asvitkine 1918557e78
Merge pull request #192 from anabate123/patch-1
Added more Mac models to the ModelID string
2020-03-15 19:04:08 -04:00
anabate123 00f02d9d0c
Added more Mac models to the ModelID string 2020-03-14 18:59:27 -04:00
kanjitalk755 59ce931955 fixed destroying bridge 2020-03-08 12:33:44 +09:00
kanjitalk755 f9eae2025f SS: Added etherhelper (Xcode only) 2020-03-06 19:10:01 +09:00
kanjitalk755 7062e864c8 Fixed SS build 2020-03-06 10:38:56 +09:00
kanjitalk755 e4ee28b199 Supports etherhelper (Xcode only) 2020-03-05 16:07:59 +09:00
kanjitalk755 0ad7a968ba Merge remote-tracking branch 'dsumorok/master' 2020-03-05 15:53:44 +09:00
kanjitalk755 1601829d22 BII: changed monitor default 2020-02-17 11:54:48 +09:00
kanjitalk755 ef1569b4d1
Merge pull request #35 from rakslice/extfs_fixes
mingw32: Fix truncated extfs volume name, crash due to icon date issue
2020-02-13 18:18:43 +09:00
Andrew Tonner 831e7a2268 Merge fixes to SheepShaver 2020-02-12 21:29:44 -08:00
Andrew Tonner 8b44b00da3 In extfs icon creation, ensure that the times on the host file are set correctly; actually allocate space for the other HInfo that set_finfo reads, such as the times 2020-02-12 16:28:00 -08:00
Andrew Tonner 837c82d8b8 expect TCHAR returns from RegQueryValueEx now that we are potentially building with _UNICODE 2020-02-12 16:16:31 -08:00
Andrew Tonner 07e9db881c failsafe for localtime(-1) on Windows to avoid segfault 2020-02-12 16:13:26 -08:00
kanjitalk755 7c61312974
Merge pull request #34 from rakslice/ether_rx_while_unloaded_crash_fix
SS Windows: Don't try to receive frames when eth is unloaded on the MacOS side
2020-02-12 10:11:11 +09:00
Andrew Tonner 744df7adf3 Don't try to receive frames when eth is unloaded on the MacOS side as it will call uninitialized vectors 2020-02-11 06:38:01 -08:00
kanjitalk755 28e0485156 SS: deleted sigsegv.cpp and lowmem.c from list of "make links" 2020-02-10 21:48:32 +09:00
kanjitalk755 7b13571587 Merge branch 'test_keymap' 2020-02-10 09:58:54 +09:00
kanjitalk755 c4570fe272 Merge branch 'test_notX' 2020-02-08 19:21:14 +09:00
kanjitalk755 6d2acbb07b revert Makefile.in 2020-02-07 17:57:44 +09:00
kanjitalk755 d83c53437e
Merge pull request #31 from rakslice/adb_button_buffer_rebase
ADB mouse event buffering proposed by OulanB
2020-02-07 11:36:45 +09:00
kanjitalk755 ccf38a4005 condition modified 2020-02-07 11:16:59 +09:00
Andrew Tonner f86b9b2abd Actually remove the commented-out code 2020-02-06 18:14:16 -08:00
Andrew Tonner bb69145861 OulanB's adb button buffer proposed change 2020-02-06 18:12:23 -08:00
kanjitalk755 1a875b1c10 in case backend is not X 2020-02-07 11:04:02 +09:00
Seth Polsley 899734d81d Removing core audio flag for BII builds 2020-02-05 04:30:17 -06:00
kanjitalk755 57b3f7cf21 keymap test 2020-02-05 15:22:58 +09:00
kanjitalk755 c23967b03b
Merge pull request #27 from rakslice/prefs_double_fix
add missing common prefs multiple values; remove duplicate unix platform prefs
2020-02-05 08:52:55 +09:00
rakslice eb35678f0d add missing common prefs multiple values; remove platform prefs from unix that are common prefs 2020-02-04 06:25:12 -08:00
kanjitalk755 19033a4a39 same fix for SS 2020-02-01 20:44:32 +09:00
kanjitalk755 f5b277548b test for #24 2020-01-31 23:31:38 +09:00
kanjitalk755 7ad9ab0da2
Update README.md 2020-01-29 11:22:52 +09:00
kanjitalk755 2e001f465e fixed autoconf build for macOS 2020-01-28 22:33:13 +09:00
Simon Howard 507508b66d
configure: Enable /dev/ptmx for Linux, Darwin.
Both of these systems have /dev/ptmx for creating pseudoterminals.
OS X Leopard (10.5) added it in 2007, and Linux has had support for
it since v2.1 (1998).

This fixes a bug with pseudoterminal creation on Linux and macOS
where a new pseudoterminal cannot be created because the wrong
method is being used to find one.
2020-01-25 01:05:52 -05:00
uyjulian 36b6d0769b
Zero out memory 2020-01-22 02:41:06 -06:00
uyjulian cfcfde0480
Use locking on idle wait cond 2020-01-22 02:35:48 -06:00
uyjulian 63ddee1be1
Set areg 7 to 0x2000 on m68k reset 2020-01-22 02:35:11 -06:00
kanjitalk755 193a7d56c5
Update README.md 2020-01-22 10:51:16 +09:00
kanjitalk755 b5fbba6e53 fix for New Build System (Xcode10+) 2020-01-22 10:48:34 +09:00
uyjulian 9dc485c56a
Sync with latest ARAnyM changes 2020-01-12 09:50:04 -06:00
uyjulian 67dd2e6676
Disable PIE, add sanity check for >4GB 2020-01-12 09:45:10 -06:00
kanjitalk755 71cbb23b42 fix for writing resource fork on APFS 2020-01-12 19:59:51 +09:00
Seth Polsley 35439819d3 Best guess audio CD from data calls to allow multiple discs and testing different interface identifiers 2020-01-08 03:02:08 -06:00
Seth Polsley 281a8a9f68 Added support for mounting multiple bin/cue files 2020-01-06 15:50:53 -06:00
kanjitalk755 18a908c770
Merge pull request #22 from jmaebe/fres
Add FP fres instruction emulation
2019-12-28 09:35:46 +09:00
Jonas Maebe a84735d3e9 Add FP fres instruction emulation 2019-12-27 16:58:50 +01:00
kanjitalk755 02c0627452
Merge pull request #21 from jmaebe/frsqrte-fpscr
frsqrte updates fpscr
2019-12-27 21:47:01 +09:00
Jonas Maebe 9817848482 frsqrte updates fpscr 2019-12-26 13:57:19 +01:00
kanjitalk755 ae6d8239db
Merge pull request #20 from jmaebe/frsqrte
Add FP frsqrte instruction emulation
2019-12-26 08:25:38 +09:00
Jonas Maebe 75b333f805 Add FP frsqrte instruction emulation
Also renamed the frsqrt opcode to frsqrte to match the manuals (the vector
version is also an estimate)
2019-12-23 18:19:49 +01:00
kanjitalk755 45f57ceca1
Update README.md 2019-12-10 11:06:33 +09:00
kanjitalk755 f07cc69531 BII: Reverted to JIT disabled 2019-12-09 10:37:18 +09:00
Seth Polsley 28cd764a31 Turn off 3d sound CD emulation since only stereo output at the moment 2019-11-10 18:58:35 -06:00
Seth Polsley 447c7b365d Better AudioPlay support and CDScan implemented 2019-11-10 18:24:35 -06:00
Seth Polsley 9a18393fc5 testing track position hack which makes more games work with mixed-mode 2019-11-10 05:00:01 -06:00
Seth Polsley 539e436893 testing with no sound input patch 2019-11-09 03:28:20 -06:00
Seth Polsley 35e6d4fcdf Minor compatibility change for BII support 2019-11-05 02:18:11 -06:00
Seth Polsley f7da6ba4e5 Cleaned up unused code for sound in traps 2019-11-05 01:40:53 -06:00
Seth Polsley 2ba2d12f8b Scratch work in audio.cpp to re-implement driver logic in trapped-out code, but working due to change in rscr patcher 2019-11-05 01:20:21 -06:00
kanjitalk755 f171c611c2 Adjust preprocessor definitions 2019-10-26 20:47:06 +09:00
kanjitalk755 8e9fa50385
Update README.md 2019-10-24 11:36:51 +09:00
kanjitalk755 96a42689fd BII JIT 2019-10-24 11:23:07 +09:00
kanjitalk755 858f8257a6 Fix for SDL2.0.10 2019-10-20 15:35:50 +09:00
kanjitalk755 977056a075 Use fpu_ieee instead of fpu_uae
Minimize BasiliskII.app/Contents/Resources
2019-10-14 14:54:32 +09:00
uyjulian 03fc337242
uae_cpu is based upon ARAnyM sources 2019-09-02 14:40:01 -05:00
uyjulian 28bc58ccd2
Use release configuration by default 2019-09-01 17:01:25 -05:00
uyjulian 48a41966fd
Sync with ARAnyM compiler sources 2019-09-01 16:56:03 -05:00
uyjulian 730ca109b7
Remove SDL1 support; add SDL2 support from kanjitalk755 repository 2019-09-01 14:51:28 -05:00
uyjulian fcdfd2f799
Cleanup of sysdeps header file 2019-09-01 14:37:24 -05:00
kanjitalk755 a489b71bb2 Added bundle identifier for BII 2019-07-17 12:06:35 +09:00
kanjitalk755 6bfe17c3fc
Merge pull request #16 from GuiltyDoggy/guiltydoggy
Added Bundle Identifier
2019-07-17 11:52:52 +09:00
Yosuke Matsumura 2a691ce7d4 Added Bundle Identifier 2019-07-16 10:21:32 -05:00
Seth c369f2048d Merge remote-tracking branch 'upstream/master' 2019-07-09 16:12:29 -05:00
Seth c7594f569a Adding CD scan stub 2019-07-09 16:10:20 -05:00
kanjitalk755 5a8498b557 Add entitlement for Hardened Runtime 2019-07-07 01:36:58 +09:00
Seth 64d6c0668f Added helper functions and strings so BII compiles with bin/cue support 2019-06-16 12:52:29 -05:00
Seth e4c34683a4 CD volume control enabled 2019-06-13 22:46:44 -05:00
Seth ff2dc11f09 Extended mode and sector size support 2019-06-13 13:31:36 -05:00
Seth 2bcfae861f Switch to SDL AudioStream to convert CD Audio 2019-06-13 12:59:49 -05:00
kanjitalk755 b62e20838c disable mouse grab if hard-cursor used 2019-05-03 18:50:41 +09:00
asvitkine 01052ca89d
Merge pull request #181 from atsampson/scsifix
Remove obsolete sg.h workaround.
2019-04-05 01:12:49 -04:00
asvitkine 9a3bd0b258
Merge pull request #183 from phcoder/master
sigsegv.cpp: Add addr32 decode
2019-04-05 01:12:11 -04:00
Seth a25325fc7d Snapshot of working bincue build, although no audio plays yet; saving all files in case xcode messes something up and needs reverting 2019-04-04 03:41:09 -05:00
Seth 1824cd8dc4 Reverting video_sdl2 to fixed branch (automerge picked up erroneous old version) 2019-04-03 22:19:57 -05:00
Seth b5cec617eb Merge remote-tracking branch 'upstream/master' 2019-04-03 12:41:45 -05:00
kanjitalk755 4603bd305c fix cursor for high DPI
ignore Alt+F4 for all platform
2019-04-01 12:29:42 +09:00
kanjitalk755 7131e8205d Windows: ignore Alt+F4 2019-03-30 13:23:52 +09:00
kanjitalk755 62deb590a6 fixed hot spot 2019-03-29 12:59:13 +09:00
kanjitalk755 2d76498256 hard cursor in full screen mode 2019-03-28 14:32:16 +09:00
Vladimir Serbinenko 6267af0315 sigsegv.cpp: Add addr32 decode
With this fix I can compile with ./configure --enable-addressing=direct,0x100000
and then I don't need to change vm.mmap_min_addr and hence without root
privileges
2019-03-21 15:13:53 +01:00
kanjitalk755 a0ccde82e2
Merge pull request #15 from DrLex0/custom_icon_for_sheepvm
Custom icon for SheepVM
2019-03-10 11:58:52 +09:00
Alexander Thomas 5867b3f4c2 Custom icon for SheepVM 2019-03-09 17:13:29 +01:00
kanjitalk755 c3e312f717
Merge pull request #13 from DrLex0/fix_header_search_paths
Fix header search paths for kpx_cpu
2019-02-28 12:08:28 +09:00
Alexander Thomas 1647ba7b6f Fix header search paths for kpx_cpu
They were still pointing to SDL.framework, not SDL2.
2019-02-27 18:41:00 +01:00
kanjitalk755 a8bb4790df
Merge pull request #12 from spolsley/mutex_test
SDL mutex deadlock and video fix, try 2
2019-02-27 15:09:06 +09:00
Seth 1889560d1f deadlock and video fix comments tidied 2019-02-26 21:02:57 -06:00
Seth 537412b959 trying to remove graphical anomalies, alternative deadlock fix branch 2019-02-26 13:21:31 -06:00
kanjitalk755 1b6a63edf7 alternative PR#11 2019-02-26 14:57:02 +09:00
Seth Polsley d9ba646899 Moving SDL video mutex lock to avoid deadlock between buffering and drawing threads 2019-02-25 18:43:34 -06:00
kanjitalk755 f67fe9671b SDL2.framework relative path -> absolute path 2019-02-25 18:39:25 +09:00
kanjitalk755 6751b6d668
Merge pull request #10 from DrLex0/better_video_modes_handling
Improve video mode handling
2019-02-24 12:05:00 +09:00
kanjitalk755 723bd9be42
Merge pull request #9 from DrLex0/high_resolution_sdl2_rendering
Enable high-resolution SDL2 rendering.
2019-02-24 11:56:41 +09:00
Alexander Thomas f91d6d9622 Improve video mode handling
Instead of using a generic list and then filtering 512x384 in SheepShaver,
start with the correct list right away. This avoids SS unexpectedly
refusing to run at 512x384.
2019-02-24 00:29:41 +01:00
Alexander Thomas 0fe02268f7 Enable high-resolution SDL2 rendering.
Combined with 'scale_nearest true', this offers sharp graphics on retina
displays.
2019-02-23 20:10:11 +01:00
kanjitalk755 ab0948d02e BII/SS fix scroll wheel 2019-02-20 18:34:53 +09:00
kanjitalk755 dce4a951bb invert sign of yearofs and dayofs 2019-02-10 11:10:23 +09:00
kanjitalk755 2eed2f0af8
Merge pull request #8 from DrLex0/day_offset_prefs_item
Add prefs item "dayofs" for finer-grained time offset
2019-02-10 10:33:48 +09:00
Alexander Thomas 64e408ced6 Add prefs item "dayofs" for finer-grained time offset 2019-02-09 22:44:43 +01:00
kanjitalk755 e676dbf839 BII/SS pref item "yearofs" 2019-02-05 18:44:24 +09:00
kanjitalk755 e3c8cd9ffb
Merge pull request #7 from lubert/retina
Add high resolution flag to SheepShaver plist template
2019-02-03 10:18:51 +09:00
kanjitalk755 6f8cada7db SS preference disable minimize button 2019-02-03 09:50:11 +09:00
lubert e430013bd2 Add high resolution flag to SheepShaver plist template 2019-02-02 10:39:41 -08:00
kanjitalk755 805ba753b2 SS preference "Save and Quit" button 2019-02-02 19:53:00 +09:00
kanjitalk755 10de3e7239 static link (BII/SS Windows) 2019-01-20 19:11:43 +09:00
kanjitalk755 03a92c7815 append pref item cpuclock 2019-01-16 19:44:09 +09:00
kanjitalk755 d736cc58de add pref items for scaling 2019-01-12 18:22:51 +09:00
Adam Sampson 668c2ba107 Remove obsolete sg.h workaround.
This is no longer necessary as of glibc 2.2 (released in November 2000),
and it causes breakage when /usr/include/linux is installed using a
symlink-based system like stow.
2018-10-31 12:43:55 +00:00
asvitkine 143b0827dd
Merge pull request #180 from atsampson/vdefix
Make vdeplug support optional.
2018-10-31 08:40:58 -04:00
Adam Sampson 5d77f86575 Make vdeplug support optional.
Linking with -lvdeplug without checking whether it exists causes
failures from later configure tests; this makes it an optional
dependency in the same way as other libraries.
2018-10-31 12:36:35 +00:00
asvitkine 507813529e
Merge pull request #179 from MSharq/MSharq
added VDE functionality
2018-10-29 20:58:20 -04:00
MSharq e583d05868 fixed vde_sock pointer 2018-10-29 21:14:25 +01:00
MSharq 242e8af3a7 fixed a bug 2018-10-29 15:44:53 +01:00
MSharq 2bc581d4f6 fixed indentation ether_unix 2018-10-28 19:42:04 +01:00
MSharq cf406ec953 fixed indentation ether_unix 2018-10-28 19:40:08 +01:00
Christian Bauer 76c5a97efe Fix libreadline detection. 2018-10-28 13:28:06 +01:00
kanjitalk755 3db0cf3d0b modified for Xcode10 2018-10-28 14:56:55 +09:00
Christian Bauer ddf1bcf094 Fix const-ness of main() parameters. 2018-10-27 22:48:58 +02:00
MSharq 0c622863cf fixed a bug 2018-10-23 15:37:09 +02:00
MSharq 30fdd103a2 changed vde switch to vde_switch in the usage function 2018-10-20 15:11:40 +02:00
MSharq 50c98de60f a few indentation fixes 2018-10-20 15:07:38 +02:00
MSharq 320fae37a4 printfs for the selected ethernet device 2018-10-20 11:37:07 +02:00
MSharq e4332cc72a added the printf statement for all Ethernet devices 2018-10-20 11:18:08 +02:00
asvitkine 5f04c95b79
adding static to VDECONN
Co-Authored-By: MSharq <mdshrq7@gmail.com>
2018-10-20 09:59:57 +02:00
asvitkine f7023246d9
Update BasiliskII/src/Unix/ether_unix.cpp
Co-Authored-By: MSharq <mdshrq7@gmail.com>
2018-10-20 09:49:42 +02:00
MSharq 90b65715ae added VDE functionality 2018-09-28 16:14:14 +02:00
kanjitalk755 61b454b68a rollback caps lock 2018-07-13 18:38:53 +09:00
kanjitalk755 97f642676b fix caps lock again
symlink adb.cpp
2018-07-13 15:44:37 +09:00
kanjitalk755 d1104b1f20 delete SheepShaver/src/adb.cpp 2018-07-13 15:41:35 +09:00
kanjitalk755 bdd101e951 fix caps lock 2018-07-11 17:50:57 +09:00
kanjitalk755 e760d289b2 SS adjust minimum ramsize 2018-07-09 19:24:52 +09:00
kanjitalk755 93fb08d8ce BII fix pref item ramsize 2018-07-08 19:43:36 +09:00
kanjitalk755 e690b631da BII enable --config argument
SS delete dead links
2018-07-06 19:33:30 +09:00
kanjitalk755 a943d981c4 introduce my repo 2018-07-01 22:50:33 +09:00
kanjitalk755 8f2660a7de redraw when palette changed
modify keymap
2018-06-29 19:31:45 +09:00
kanjitalk755 8f0df8ec70 fix double free in SDL 2018-06-28 18:58:55 +09:00
kanjitalk755 63fa75adf0 fixed ramsize in preferences editor 2018-06-27 23:25:33 +09:00
kanjitalk755 700b57d758 added pref item "hotkey"
added MB notation pref item "ramsize"
2018-06-27 19:13:30 +09:00
kanjitalk755 52fe2290fe Linux: change configure defaults to SDL2
MinGW: change SDL1 to SDL2
2018-06-26 21:00:52 +09:00
kanjitalk755 01a375eefc minor fix 2018-06-25 22:43:19 +09:00
kanjitalk755 afa52545ff fix include for mingw32 build 2018-06-24 23:08:36 +09:00
kanjitalk755 949e07e4eb fix for linux build 2018-06-23 14:59:07 +09:00
kanjitalk755 9c0886b2b8 set version to 2.5 2018-06-21 22:55:35 +09:00
kanjitalk755 a76069f879 View menu removed 2018-06-21 15:21:56 +09:00
kanjitalk755 6039a60549 fix merge error 2018-06-20 21:26:11 +09:00
kanjitalk755 d8290af331 Merge branch 'mingw32' 2018-06-20 19:34:06 +09:00
kanjitalk755 226f667b36 mingw32 JIT build (but crashes) 2018-06-20 10:26:37 +09:00
kanjitalk755 0e06d9358b refactor pref menu 2018-06-19 19:07:14 +09:00
kanjitalk755 418d92dafe BII buildable 2018-06-19 13:36:27 +09:00
kanjitalk755 1cd716ee8e Merge commit 'da46a07b7c25996aeda2cf8b49d3b9bf2e08c46f' into mingw32 2018-06-19 10:33:33 +09:00
kanjitalk755 7f8ddaeacf in case using SDL1
fix merge error of configure.ac
2018-06-18 18:42:19 +09:00
kanjitalk755 1393625c15 search path for embedded framework 2018-06-17 00:01:06 +09:00
kanjitalk755 7a3b70153c Embed SDL2.framework 2018-06-16 23:45:04 +09:00
kanjitalk755 ccb11c0d7a fixed initial chdir 2018-06-16 21:42:43 +09:00
kanjitalk755 03dda6db82 host menu re-correct 2018-06-16 17:38:57 +09:00
kanjitalk755 f053fda3c8 fix for sheepvm 2018-06-16 13:33:13 +09:00
kanjitalk755 8d89152b79 set current directory 2018-06-15 21:57:59 +09:00
kanjitalk755 51e08e9b76 BII clipboard-exchange enabled 2018-06-15 16:47:07 +09:00
kanjitalk755 27e9a0c79a delete SheepShaver/src/MacOSX/clip_macosx64.mm 2018-06-15 16:41:45 +09:00
kanjitalk755 51491dd03f pref menu enabled 2018-06-15 14:52:28 +09:00
kanjitalk755 33a5112968 remove keyboard shortcut of host menu 2018-06-14 22:03:17 +09:00
kanjitalk755 a98054215e SDL related fix
update project files
add a pref
2018-06-14 18:26:27 +09:00
kanjitalk755 e01129b748 Merge commit '01f63e605a68856718dd16e07835cd2d61ba6727' into DavidLudwig_and_jvernet 2018-06-14 17:33:25 +09:00
kanjitalk755 06c7fc3a7e delete SheepShaver/src/slirp/* 2018-06-14 17:19:30 +09:00
kanjitalk755 d247c35d58 Merge commit '2e302d60a337daa252c6992335e6365a9beac83f' 2018-06-08 14:11:27 +09:00
kanjitalk755 693343e73d screen width&height of pref issue fixed 2018-06-08 14:00:59 +09:00
uyjulian 8c0a84c536
Removed more unused files 2018-06-07 15:06:41 -05:00
uyjulian e99d4e579c
Remove low memory globals hack (it doesn't work) 2018-06-07 15:01:48 -05:00
kanjitalk755 cc058a1881 clipboard-exchange enabled 2018-06-07 22:30:06 +09:00
kanjitalk755 bb4611b465 clip_macosx64.mm copied from BasiliskII 2018-06-07 22:23:22 +09:00
kanjitalk755 685ce533f8 delete symlink 2018-06-07 22:21:31 +09:00
uyjulian 8353a9ed44
Hope it works 2018-06-06 23:11:08 -05:00
uyjulian 77e20bda2a
Back to BasiliskII uae_cpu but with ARAnyM JIT 2018-04-22 20:39:37 -05:00
uyjulian 1758ef58b5
Port of CPU code from ARAnyM (currently hangs) 2018-04-15 20:23:12 -05:00
uyjulian 1bf6e93461
Downgraded emulated UAE cpu 2018-04-15 17:33:50 -05:00
uyjulian 023251dee1
Get rid of cxmon and SheepShaver (focus is on BasiliskII) 2018-04-15 16:00:38 -05:00
uyjulian 76d285a6f2
Convert buildsystem to CMake 2018-04-15 15:59:59 -05:00
uyjulian c4b1b1937e
Remove support for all other platforms other than macOS 2018-04-15 11:17:57 -05:00
asvitkine 2e302d60a3
Merge pull request #163 from atmaxinger/fix-devpollcdrom
Mac GUI: don't show /dev/poll/cdrom if it is configured as cdrom
2018-02-25 12:51:13 -05:00
atmaxinger e791a1fdd6 fix identation 2018-02-25 17:44:08 +01:00
atmaxinger 4f14c44837 Fix formatting 2018-02-25 17:01:12 +01:00
atmaxinger a2e163fea9 fix whitespaces 2018-02-22 23:08:57 +01:00
atmaxinger f25821d067 Fix CD ROM entries appearing multiple times 2018-02-22 23:06:23 +01:00
atmaxinger 515746d584 Only remove item at index 2018-02-22 11:32:57 +01:00
atmaxinger f2fcfffabb Always save the cdrom entries from /dev/ 2018-02-22 11:11:11 +01:00
atmaxinger 4ba1c48ec8 Always write /dev/poll/cdrom to preferences 2018-02-22 10:36:36 +01:00
atmaxinger 85bcff03d4 Block all CDROMs in /dev/ 2018-02-21 16:24:20 +01:00
atmaxinger 787661f80f Always save the default entry "cdrom /dev/poll/cdrom" 2018-02-21 15:24:29 +01:00
atmaxinger 3931036d87
Fix whitespace 2018-02-20 12:39:59 +01:00
atmaxinger 581ce7d971 Mac GUI: don't show /dev/poll/cdrom if it is configured as cdrom 2018-02-20 11:54:55 +01:00
jvernet 01f63e605a Merge branch 'master' of https://github.com/DavidLudwig/macemu 2018-01-31 19:39:26 +01:00
jvernet ea626e216d icns 2018-01-02 17:01:45 +01:00
Alexei Svitkine 588a2ae9cd don't try to run diskutil eject (null) 2018-01-01 15:42:53 -05:00
asvitkine 62eaaee1b2
Merge pull request #161 from dcoshea/X11-icon
Basilisk II: Add icons for X11 based on the MacOS X icons (fixes #160).
2017-12-31 01:43:05 -05:00
David O'Shea 9e2fc30ecd Basilisk II: Add icons for X11 based on the MacOS X icons (fixes #160).
Note that it appears that a 'make clean' may be required due to the
change in user_strings_unix.h failing to cause all of the modules that
include it to be rebuilt.
2017-12-31 12:10:30 +10:30
asvitkine ff129e8649
Merge pull request #158 from rickyzhang82/pr-travis-ci
Add Travis CI configuration file and README.md status.
2017-12-28 20:43:13 -05:00
asvitkine b54b25f67d
Merge pull request #159 from dcoshea/README-Linux-bridging
Basilisk II: Update README to cover bridging tun interfaces.
2017-12-28 20:42:39 -05:00
David O'Shea 802224630d Basilisk II: Update README to cover bridging tun interfaces.
Now that issue #154 has been fixed, when Basilisk II is configured to
use "tun" for networking, the generated tunN interface can be bridged,
enabling AppleTalk frames to be forwarded without the Linux host
needing to be able to route AppleTalk.

This commit updates the README to discuss this possibility and briefly
outline how it can be achieved.  A number of spelling corrections and
other minor clarifications are made in the same area.
2017-12-29 11:49:37 +10:30
Ricky Zhang 8c64ebfd03 Add Travis CI configuration file and README.md status. 2017-12-28 20:06:35 -05:00
asvitkine 461332cbf7
Merge pull request #157 from dcoshea/issue-154
Avoid an all-zero Ethernet/MAC address when using TUN/TAP (fixes #154).
2017-12-28 13:31:41 -05:00
asvitkine 86c5613701
Merge pull request #155 from dcoshea/issue-153
Fix TUN/TAP detection on CentOS 7 (#include <sys/socket.h>) (fixes #153).
2017-12-28 13:31:00 -05:00
asvitkine 3bcb0d4556
Merge pull request #156 from dcoshea/issue-152
Fix link error due to missing X11 libraries (fixes #152).
2017-12-28 13:29:58 -05:00
David O'Shea 385b49ba8e Avoid an all-zero Ethernet/MAC address when using TUN/TAP (fixes #154).
Previously, when "ether tun" configuration was used on a Linux host,
packets were sent with Ethernet/MAC address 00:00:00:00:00:00.  Under
CentOS 7 at least, this did not appear to cause any issues where the
tun interface on the host was configured with an IP address, but when
an attempt was made to bridge the tun interface, it was no longer
possible to establish IP communication between the emulated machine
and either the Linux host or a Windows NT Server 4 VM.

This fix causes an Ethernet/MAC address to be generated in the same
way when using TUN/TAP as is done for ethertap.
2017-12-28 22:49:01 +10:30
David O'Shea 3f2dbbac29 Fix link error due to missing X11 libraries (fixes #152).
c18d6fa removed a space from BasiliskII/src/Unix/configure.ac, which
caused "configure" to fail to properly determine the correct set of
libraries to link against when using X11, which caused linking to
fail.  This fix restores the missing space.
2017-12-28 22:42:51 +10:30
David O'Shea bbd3d3f57c Fix TUN/TAP detection on CentOS 7 (#include <sys/socket.h>) (fixes #153).
Previously, "checking whether TUN/TAP is supported..." in "configure"
failed to detect TUN/TAP support due to compile errors due to "struct
sockaddr" not being defined.  This fix causes sys/socket.h to be
#included if it exists.
2017-12-28 22:28:05 +10:30
Alexei Svitkine 1c9b21f580 Fix JIT support on macOS. This was broken by a copy-paste error
in b5820d8059.
2017-12-15 16:42:49 -05:00
Alexei Svitkine 1669960afd Merge branch 'master' of https://github.com/cebix/macemu 2017-12-10 11:28:05 -05:00
Alexei Svitkine b0c859031a Merge branch 'master' of https://github.com/cebix/macemu 2017-12-10 11:28:00 -05:00
Alexei Svitkine c161ca5b8b clean up disabled / non-working modes out of video_macosx.mm/.h 2017-12-10 11:28:00 -05:00
Alexei Svitkine 3b77a377c2 fix colors in b2 video_macosx.mm code 2017-12-10 11:28:00 -05:00
Alexei Svitkine e1c0a08957 clean up some code 2017-12-10 11:28:00 -05:00
Alexei Svitkine e29cc81dbf clean up some code 2017-12-10 11:27:59 -05:00
Alexei Svitkine d17ef870f7 Fix SDL support message in configure based on detection logic. 2017-12-10 11:27:59 -05:00
Alexei Svitkine cd60ce9421 remove stray non-ascii chars at start of mon_cmd.cpp 2017-12-10 11:27:59 -05:00
Alexei Svitkine 3ac2640c79 Make Basilisk's configure.ac's SDL detection logic match SS's. 2017-12-10 11:27:59 -05:00
Alexei Svitkine c41b849ecf clean up disabled / non-working modes out of video_macosx.mm/.h 2017-12-10 11:27:56 -05:00
Alexei Svitkine ba0ed857d7 fix colors in b2 video_macosx.mm code 2017-12-10 11:27:48 -05:00
Alexei Svitkine 364cf2085e clean up some code 2017-12-10 11:27:43 -05:00
Alexei Svitkine bb2a197c98 clean up some code 2017-12-10 11:27:32 -05:00
Alexei Svitkine 8a6a9db6d5 Fix SDL support message in configure based on detection logic. 2017-12-10 11:27:23 -05:00
Alexei Svitkine 89e4234975 remove stray non-ascii chars at start of mon_cmd.cpp 2017-12-10 11:27:16 -05:00
Alexei Svitkine 0e8e0b51b7 Make Basilisk's configure.ac's SDL detection logic match SS's. 2017-12-10 11:27:12 -05:00
Alexei Svitkine c18d6fa923 fix configure X check to not trigger if using mac gui and some
more warning fixes
2017-12-10 11:27:08 -05:00
Alexei Svitkine a472d9ab63 fix some format warnings 2017-12-10 11:27:08 -05:00
Alexei Svitkine 75324c10d0 silence some more warnings 2017-12-10 11:27:08 -05:00
Alexei Svitkine b150b42fc6 Fix some string conversion warnings. 2017-12-10 11:27:08 -05:00
Alexei Svitkine 1503c84266 Merge branch 'master' of https://github.com/cebix/macemu 2017-12-10 11:27:08 -05:00
asvitkine a1a48c1479 Merge pull request #145 from zydeco/master
fix for extfs on 64-bit macOS/iOS
2017-12-10 11:27:07 -05:00
Jesús A. Álvarez e44a75d7eb fix indentation 2017-12-10 11:27:07 -05:00
Jesús A. Álvarez db72f9142e fix for extfs on 64-bit macOS/iOS 2017-12-10 11:27:07 -05:00
Alexei Svitkine 1e4e7179d4 more changes needed to move STR_WINDOW_TITLE_GRABBED cross-platform code 2017-12-10 11:27:03 -05:00
Alexei Svitkine bc7edbc677 move STR_WINDOW_TITLE_GRABBED to user_strings.h and fix header
guard for user_strings_unix.h
2017-12-10 11:26:26 -05:00
Alexei Svitkine 0ec153e733 Merge branch 'master' of https://github.com/cebix/macemu 2017-12-10 11:21:02 -05:00
Alexei Svitkine d693c8d6c8 clean up disabled / non-working modes out of video_macosx.mm/.h 2017-12-10 11:20:39 -05:00
Alexei Svitkine 34624eee4b fix colors in b2 video_macosx.mm code 2017-12-10 11:20:35 -05:00
Alexei Svitkine af642edc16 clean up some code 2017-12-10 11:20:27 -05:00
Alexei Svitkine 93d6a4527e clean up some code 2017-12-10 11:20:23 -05:00
Alexei Svitkine f99fc0ec71 Fix SDL support message in configure based on detection logic. 2017-12-10 11:20:17 -05:00
Alexei Svitkine f22a1eecef remove stray non-ascii chars at start of mon_cmd.cpp 2017-12-10 11:20:11 -05:00
Alexei Svitkine e42a40f832 Make Basilisk's configure.ac's SDL detection logic match SS's. 2017-12-10 11:19:53 -05:00
kanjitalk755 f96c92ad51 SheepShaver/src/slirp/* copied from jvernet/macemu 2017-12-09 21:24:46 +09:00
kanjitalk755 87ddeb520b delete symlink SheepShaver/src/slirp 2017-12-09 21:23:54 +09:00
kanjitalk755 aa24dbc3df revert BasiliskII/src/slirp/* 2017-12-09 21:10:30 +09:00
Alexei Svitkine 182a7aeadb clean up disabled / non-working modes out of video_macosx.mm/.h 2017-12-03 15:59:14 -05:00
Alexei Svitkine a78c76f762 fix colors in b2 video_macosx.mm code 2017-12-03 15:44:31 -05:00
Alexei Svitkine eab9d9029f clean up some code 2017-12-03 15:39:51 -05:00
Alexei Svitkine c0200eede4 clean up some code 2017-12-03 15:32:04 -05:00
Alexei Svitkine ee5b726d73 Fix SDL support message in configure based on detection logic. 2017-12-03 14:54:50 -05:00
Alexei Svitkine dc65a48d32 remove stray non-ascii chars at start of mon_cmd.cpp 2017-12-03 13:43:03 -05:00
Alexei Svitkine d77e529ce9 Make Basilisk's configure.ac's SDL detection logic match SS's. 2017-12-02 15:34:18 -05:00
Alexei Svitkine 404c5f1fd6 fix configure X check to not trigger if using mac gui and some
more warning fixes
2017-12-02 13:27:14 -05:00
Alexei Svitkine fc082509a6 fix some format warnings 2017-12-02 12:39:30 -05:00
Alexei Svitkine fc0d7dcdde silence some more warnings 2017-12-02 12:27:27 -05:00
Alexei Svitkine 57131adacc Fix some string conversion warnings. 2017-12-02 12:21:13 -05:00
Alexei Svitkine 87cfc1639a Merge branch 'master' of https://github.com/cebix/macemu 2017-12-02 11:36:45 -05:00
Alexei Svitkine c9717bf331 Fix window redraw on macOS when un-minimizing. 2017-12-02 11:35:23 -05:00
asvitkine 5edd297ad9
Merge pull request #145 from zydeco/master
fix for extfs on 64-bit macOS/iOS
2017-11-30 23:03:54 -05:00
Jesús A. Álvarez 33b061f0f4 fix indentation 2017-11-30 18:03:43 +01:00
Jesús A. Álvarez 7df78acb40 fix for extfs on 64-bit macOS/iOS 2017-11-28 22:53:29 +01:00
Alexei Svitkine dcbbf18bb7 more changes needed to move STR_WINDOW_TITLE_GRABBED cross-platform code 2017-11-25 13:52:40 -05:00
Alexei Svitkine 9c041ee2dc move STR_WINDOW_TITLE_GRABBED to user_strings.h and fix header
guard for user_strings_unix.h
2017-11-25 13:45:49 -05:00
Alexei Svitkine 2bdbd22e85 Fix setting window title on Mac Sierra when grabbing mouse. 2017-11-25 10:36:00 -05:00
Alexei Svitkine 7378a62032 Set Xcode to use tabs. 2017-11-25 10:27:00 -05:00
Alexei Svitkine 5256a8e6f1 Revert of 9f58eb96dc. Causes issues
with mouse coordinates under Sierra.
2017-11-25 09:40:00 -05:00
David Ludwig 28206248d4 bug-fix: crash on startup, when passing in single-parameter, command-line args 2017-11-07 17:57:41 -05:00
jvernet b904304e89 Try to fix build error on SheepShaver XCode Project 2017-10-09 22:19:16 +02:00
jvernet e6808d6556 timer symlink ?? 2017-10-09 22:18:17 +02:00
jvernet d3fc193d66 Slirp 64 bits
- Slirp 64 Bits
- added to the basilisk XCode Project
2017-10-09 21:45:44 +02:00
jvernet b2f4de5a89 SheepShaver Pref Editor Udate 2017-10-05 22:20:15 +02:00
jvernet f8e69c4fb8 Remove slirp debug message 2017-10-05 19:31:26 +02:00
jvernet 38c6541edc 64 Bits Slirp
At least it will not crash anymore
2017-10-05 19:15:27 +02:00
jvernet dc0663b72d Revert "64 bits slirp ?"
This reverts commit 000ec0f135.
2017-10-04 18:22:53 +02:00
jvernet 605c811a4a Revert "SLIRP 0.9.1"
This reverts commit 4682bb80a1.
2017-10-04 18:22:48 +02:00
jvernet c20d9d3c52 Revert "SLIRP 0.10.1"
This reverts commit ef4725552e.
2017-10-04 18:22:40 +02:00
jvernet ef4725552e SLIRP 0.10.1
64 Bits clean ?
2017-10-03 22:37:31 +02:00
jvernet 4682bb80a1 SLIRP 0.9.1 2017-10-03 22:34:56 +02:00
jvernet 000ec0f135 64 bits slirp ? 2017-10-03 22:33:01 +02:00
jvernet 7b8beab25a Basilisk Macbook Keycode
French Macbook Keycode file
2017-10-03 21:41:12 +02:00
jvernet 34765ae740 Added pref items
{"keycodes",
	{"keycodefile",
	{"mousewheelmode",
	{"mousewheellines"
to have again international keyboard
2017-10-03 21:39:30 +02:00
jvernet 1316b64bb7 Some Warning removed and 64bits 2017-10-03 21:37:24 +02:00
jvernet 54ea054993 XCode 9 Project 2017-10-03 21:32:48 +02:00
David Ludwig 7a52abd378 bug-fix: video_sdl2.cpp would not compile in pre-C++11 2017-09-12 22:15:46 -04:00
David Ludwig 4e5e3377f1 Perf: re-enable VOSF on Xcode-made, OSX-host builds 2017-09-12 18:35:24 -04:00
David Ludwig ef26204e6d Perf: make SDL2 backend update less pixels, when updating internal textures and surface(s) 2017-09-12 17:31:05 -04:00
David Ludwig 50986dcf46 Perf: make SDL2 use an ARGB8888 texture, which is natively supported via some GPUs + drivers, such as on OSX. This can remove an extraneous pixel-format conversion. 2017-09-10 14:34:13 -04:00
David Ludwig 449936e461 SheepShaver: added --sdlrender option, when on Unix 2017-09-10 15:19:50 +00:00
David Ludwig 1b08f2e9d3 BasiliskII: minor formatting tweak to configure.ac 2017-09-10 10:49:26 -04:00
David Ludwig 83096e1ca7 SheepShaver: added --with-sdl1 to configure script 2017-09-10 10:48:56 -04:00
David Ludwig 252890ebd0 BasiliskII: misc fixes when building on OSX, via Autotools 2017-09-10 10:19:17 -04:00
David Ludwig 78e3cbc8cb fixed compile-time warnings in video_sdl2.cpp 2017-09-09 16:49:09 +00:00
David Ludwig 1eb824a04e added pref, "sdlrender", which can force a specific, SDL2 renderer (software can be faster in some cases, such as on VirtualBox hosts) 2017-09-09 16:48:30 +00:00
David Ludwig cbda5759bb added --with-sdl1 option to configure scripts, to force the use of SDL 1.x, over SDL 2.x 2017-09-09 15:15:28 +00:00
David Ludwig 20ad70cb35 unset the executable bit from video_sdl2.cpp 2017-09-09 01:09:13 +00:00
David Ludwig 1c0e8655dc for non-OSX hosts, make GNU Autotools revert to using SDL 1.x, if SDL 2.x can't be found 2017-09-08 23:43:01 +00:00
David Ludwig 68ee5f23f9 make video_sdl*.cpp's header-comments refer to the versions of SDL that they target 2017-09-04 12:49:54 -04:00
David Ludwig 8940880794 make build scripts reference both video_sdl.cpp and video_sdl2.cpp 2017-09-04 12:44:34 -04:00
David Ludwig a646f6dc3f added compile-time checks for SDL version, when compiling video_sdl*.cpp 2017-09-04 12:28:25 -04:00
David Ludwig f8682679c2 moved SDL2 video code to video_sdl2.cpp; restored SDL1 implementation of video_sdl.cpp 2017-09-04 12:18:52 -04:00
David Ludwig 22eaa317a8 reverted to SDL 1.x compatible audio APIs (which still work in SDL2) 2017-09-04 12:13:50 -04:00
David Ludwig 573ffee8b1 fixed issue #31, "on multi-monitor OS X host: cursor can get locked to fullscreen display for guest OS" 2017-09-04 11:41:26 -04:00
David Ludwig 7a36983f11 fixed issue #27: on OS X host, mouse can get locked to portion of fullscreen display 2017-09-02 15:54:33 -04:00
David Ludwig 0f8f30f639 Basilisk II, bug-fix: switching to fullscreen, via Ctrl+Enter, on a non-primary host display, could cause mouse cursor to jump to a different display
This bug was observed occurring on an OSX 10.12 host.
2017-09-02 15:36:56 -04:00
David Ludwig cd57af7795 Basilisk II, bug-fix: on Mac, mouse-grabbing via Ctrl+F5 wasn't changing the title of the window 2017-09-02 10:58:53 -04:00
David Ludwig bcd784d7c4 SheepShaver: make Autotools use SDL2 2017-09-01 18:48:40 -04:00
David Ludwig dbd997fa47 fixed issue #20: GTK preference UI was broken in both Linux and Mac OS X 2017-08-30 12:17:37 -04:00
David Ludwig 1983aa1652 try making sure that the bincue sources use the correct, SDL2 audio device ID. Untested! 2017-08-27 18:11:48 -04:00
David Ludwig d5e68ceebf use SDL2's preferred/non-legacy means of opening, and working with, an audio device 2017-08-27 18:05:13 -04:00
David Ludwig 145ca0c210 fixed issue #15: BasiliskII: running an autotools build breaks ability to build with Xcode 2017-08-27 17:37:20 -04:00
David Ludwig 51a9eeae76 fixed issue #14: Basilisk II: make Xcode generate UAE's CPU-emulation sources at build-time 2017-08-27 17:05:02 -04:00
David Ludwig eb36b34106 Sheepshaver: misc, runtime fixes on OSX hosts 2017-08-25 17:19:36 -04:00
David Ludwig e55df3de96 build SheepShaver against SDL2, when using its Xcode 8 project file 2017-08-25 17:01:31 -04:00
David Ludwig 3bae0bbda9 commented on use of SDL_SetRelativeMouseMode 2017-08-23 20:56:54 -04:00
David Ludwig 7767f128e5 fixed issue #19: on OS X, display can slide around if initial clicks are near top of screen 2017-08-23 20:52:30 -04:00
David Ludwig 5d4560c1a7 fixed issue #21, "BasiliskII, Win32: resizing a window does not stretch screen" 2017-08-19 17:45:26 -04:00
David Ludwig e49cd855c2 made windowed-mode windows be resize-able/scale-able - guest OS display size is retained, though 2017-08-15 21:47:45 -04:00
David Ludwig 109bc3979b implemented issue #7: output stdout and stderr to a log file; removed output redirection to win32 console, which was buggy 2017-08-15 21:41:59 -04:00
David Ludwig 6abc599ddf added code to help debug issue #6: made Win32 app show stdout and stderr, if and when it is run from a command prompt window 2017-08-14 21:14:34 -04:00
David Ludwig b9c9687153 bug-fix: anti-aliasing not always working 2017-08-14 14:50:05 -04:00
David Ludwig 2d035eb3e9 bug-fix: mouse cursor could get locked to top-left corner, when in fullscreen 2017-08-14 14:49:29 -04:00
David Ludwig f7fceaf096 fix Issue #18: 512x384 guest display leads to app exit-on-startup 2017-08-14 14:44:09 -04:00
David Ludwig 9116cae283 apply anti-aliasing where available and appropriate 2017-08-14 14:41:04 -04:00
David Ludwig 0e5ce49f46 fixed issue #9: maintain guest OS' aspect ratio, when in fullscreen 2017-08-14 14:26:54 -04:00
David Ludwig 80a30aeca1 HACK fix for Issue #17: Thousands of Colors not working on OSX 2017-08-14 14:08:30 -04:00
David Ludwig 53cadd7fd0 restored OSX 'DEBUG' macro to DEBUG=1 2017-08-14 13:57:11 -04:00
David Ludwig 6600081b29 build fix for OSX + Xcode 2017-08-14 13:56:36 -04:00
David Ludwig 0a7640070a finished fixing issue #16: fixed Thousands of Colors on Linux 2017-08-14 13:45:15 -04:00
David Ludwig 09c100ff42 partial fix for issue #16: color is incorrect on Linux
Thousands of Colors mode is still broken, however, Millions of Colors does work, which did not before this commit.
2017-08-14 12:48:36 -04:00
David Ludwig d871b70240 fixed issue #12: make autotools test for SDL2 2017-08-14 12:28:10 -04:00
David Ludwig 99f50637e1 possible fix for Issue #13: replace SDL_CreateRGBSurfaceWithFormat calls with older + backwards-compatible SDL_CreateRGBSurface calls 2017-08-14 12:01:34 -04:00
David Ludwig 1a59a5e6f4 Merge branch 'master' of https://github.com/cebix/macemu 2017-08-14 11:35:43 -04:00
David Ludwig c6fefd0750 fixed issue #1: SDL2 backend did not support 2 or 4 bit color, in guest OS 2017-08-10 12:31:41 -04:00
David Ludwig 251c185dcd renamed variables in SDL2 backend, for improved readability 2017-08-10 10:57:58 -04:00
David Ludwig e0cdbe2a30 added "idlewait" support to SDL2 backend 2017-08-01 18:07:23 -04:00
David Ludwig eadd2951b7 added gitignore settings for Jetbrains' IDEs 2017-08-01 18:07:23 -04:00
David Ludwig 8874ba549f added missing MSVC post-build script 2017-07-23 21:05:08 -04:00
David Ludwig 8705276206 updated Windows + MSVC support with SDL2 support 2017-07-23 20:49:29 -04:00
David Ludwig 54e03d9647 bug-fix, Issue #2: prevent SDL2 from installing keyboard shortcuts (Command+Q, etc.) on OSX hosts, as they interfere with guest OS use 2017-07-23 16:23:51 -04:00
David Ludwig 1190a2b127 bug-fix, Issue #4: prevent guest OS from causing desktop/Spaces switches on OS X host 2017-07-23 15:22:00 -04:00
David Ludwig 84282f4525 bug-fix: buffer-overflow in SDL2 audio code 2017-07-23 15:13:50 -04:00
David Ludwig 6e36c8dd30 include SDL2 as a git submodule, currently using v2.0.5; make Mac builds (of Basilisk II) build SDL
This should help with debugging windowing system issues, which may reside in SDL, which SDL may not provide adequate diagnostic info, or which Basilisk may not report
2017-07-23 14:09:19 -04:00
David Ludwig a3f3d4f5d2 dropped Mac OS X deployment target down to 10.7 (from 10.12) 2017-07-22 22:01:13 -04:00
David Ludwig 3d0ea018ed bug-fix: OS X app would not launch, when run from the Finder 2017-07-22 21:49:54 -04:00
David Ludwig a1a85a9315 bug-fix: don't double-free the inner SDL_Surface, when the guest OS switches video modes 2017-07-22 21:31:06 -04:00
David Ludwig e3a687ff1e updated copyright to 2017 (from 2006); added SDL2 port credit 2017-07-22 21:20:46 -04:00
David Ludwig ad747d2049 use HOME/.basilisk_ii_xpram for saving + restoring XPRAM 2017-07-22 21:16:32 -04:00
David Ludwig b62b8fe5ad read/write preferences from HOME/.basilisk_ii_prefs 2017-07-22 21:09:53 -04:00
David Ludwig 1d5b8e95af use the host-OS' desktop resolution, when entering full-screen. This enables use of Mac OS X's "Spaces" feature, when going to fullscreen. 2017-07-22 20:40:31 -04:00
David Ludwig cb982ee2ed use SDL 2.0.5+, rather than SDL 1.x
This change may end up being a bit slower on some systems, as the SDL backend will now render its content to two, new, SDL_Surfaces: one of which is in the guest OS' resolution, the other of which is application defined.

SDL2's SDL_Render API is used, which exposes some rudimentary elements of GPU + texture-based programming.  Basilisk II now maintains a single 'SDL_Texture' object, which is an SDL representation of a GPU texture.  The 'outer' surface will be used to update this texture, as requests to redraw are made.

TODO: look into removing the 'outer' SDL surface, and see if we can just copy the 'inner' surface to the SDL_Texture.
TODO: the entire SDL_Texture is updated, any time a request is made to draw.  Look into minimizing this a bit.
2017-07-22 20:29:30 -04:00
David Ludwig 9128314cb8 Basilisk II compiles on Xcode 8, as a 64-bit Mac app
SDL 1.x is used for display, rather than Mac OS X specific backend.  If time permits, I'll port it to SDL 2, if only to reduce Basilisk's overall code foot-print.

Lots of features are apt to be disabled, as many 'dummy' backends were used.

Video-depths other than 1-bit or 32-bit are untested, and in some cases (4-bit, at least) are currently non-functional.  This is due to a partial re-write of the SDL backend's blitting code, which was non-functional when low-bit-depths were used.

The SDL backend was also rewired, on OSX, to not attempt to align the display buffer on page-boundaries.  So far, this doesn't seem to cause any notice-able problems, however, that's only using limited knowledge and testing (System 7.5.x does boot and display at 640x480, though!).  The original display-buffer allocation code was failing to run, in some cases.

Preferences are, on Mac, currently hardcoded to be accessed at /tmp/BasiliskII/BasiliskII_Prefs.  The folder, "/tmp/BasiliskII/", may be a symbolic link to elsewhere, though.
2017-07-22 17:43:42 -04:00
Andrew Tonner da46a07b7c appveyor CI: Try build number with git commit 2017-01-23 00:46:19 -08:00
Andrew Tonner 6c8c55c5e2 bump build version names 2017-01-23 00:43:14 -08:00
Andrew Tonner 9a76eace57 appveyor CI: don't cache mingw metadata as this includes package installation status; only cache package files proper 2017-01-23 00:40:54 -08:00
Andrew Tonner 8bfa98f972 appveyor CI: fix build output path for archiving 2017-01-23 00:02:30 -08:00
Andrew Tonner 36bddb6ded Merge branch 'windows_build_script' into ci_build 2017-01-22 23:26:46 -08:00
Andrew Tonner 3a742ae3f2 python build script: symlink m4 dir before autogen that requires it 2017-01-22 23:26:36 -08:00
Andrew Tonner 902450a6e7 Merge branch 'windows_build_script' into ci_build 2017-01-22 23:01:18 -08:00
Andrew Tonner 2e7771a4ae python build script: put showing environment after the GTK install so we can double check the paths 2017-01-22 23:01:08 -08:00
Andrew Tonner 71192179e5 Merge branch 'windows_build_script' into ci_build 2017-01-22 22:15:41 -08:00
Andrew Tonner 2f8c7f441c python build script: set ACLOCAL_PATH for gtk 2017-01-22 22:15:29 -08:00
Andrew Tonner dc2c146002 Merge branch 'windows_build_script' into ci_build
Conflicts:
	SheepShaver/src/Windows/build_on_msys.py
2017-01-22 21:12:54 -08:00
Andrew Tonner 519276d788 python build script: added gtk donwload/install 2017-01-22 21:11:01 -08:00
Andrew Tonner fcfa19ca27 python build scripts: URLs cleanup 2017-01-22 21:10:22 -08:00
Andrew Tonner b8b7b96a1c put build tools first in the path rather than last 2017-01-22 21:10:07 -08:00
Andrew Tonner cc7a0df0c5 python build scripts: URLs cleanup 2017-01-22 21:08:55 -08:00
Andrew Tonner d2e8b4283f put build tools first in the path rather than last 2017-01-22 19:39:16 -08:00
Andrew Tonner 0df6ef8d28 appveyor CI: show build environment in this build 2017-01-22 19:16:08 -08:00
Andrew Tonner 21c5d11e06 Merge branch 'windows_build_script' into ci_build 2017-01-22 18:48:52 -08:00
Andrew Tonner c4c61cec64 python build script: adding sed and grep I'm using from msys to packages list 2017-01-22 18:48:39 -08:00
Andrew Tonner 58114327c9 appveyor CI: save mingw-get cache between builds 2017-01-22 18:24:39 -08:00
Andrew Tonner eab21be5e3 Revert "appveyor CI: use default mingw path to hopefully save us some downloads every run"
This reverts commit 9a5b6ae3b3.
2017-01-22 18:02:45 -08:00
Andrew Tonner 9a5b6ae3b3 appveyor CI: use default mingw path to hopefully save us some downloads every run 2017-01-22 18:00:02 -08:00
Andrew Tonner a64bf7a0c5 Merge branch 'windows_build_script' into ci_build 2017-01-22 17:49:08 -08:00
Andrew Tonner f2238fe3e7 python build script: option to use a specific mingw path 2017-01-22 17:48:56 -08:00
Andrew Tonner 65da666052 add explicit --build option for appveyor CI because config.guess is failing there 2017-01-22 16:50:34 -08:00
Andrew Tonner 42d627ccb5 Merge branch 'windows_build_script' into ci_build 2017-01-22 16:49:35 -08:00
Andrew Tonner e3fe441709 python build script: build arg for passing --build to configure scripts 2017-01-22 16:49:23 -08:00
Andrew Tonner 8548644595 don't show "Will install to" output if that is disabled 2017-01-22 16:28:32 -08:00
Andrew Tonner c4903326ab appveyor CI build script first cut 2017-01-22 16:27:03 -08:00
Andrew Tonner 7c01c27e02 python build script: option to add an additional PATH entry with highest priority for building 2017-01-22 16:08:03 -08:00
Andrew Tonner bab9a35ff2 python build script: fix for top Makefile changes 2017-01-22 15:25:02 -08:00
Andrew Tonner 4326182b02 python build script: fix for fresh install 2017-01-22 15:08:33 -08:00
Andrew Tonner cc0c168685 when making links, if the link already exists as a directory, remove the directory first 2017-01-22 15:07:47 -08:00
Andrew Tonner 4715db8f28 top level script should make sure directories it wants to put symlinks in exist 2017-01-22 00:58:09 -08:00
Andrew Tonner fa9b425541 python build script: remove old config.status before rebuilding 2017-01-20 13:27:25 -08:00
Andrew Tonner bab9820231 slirp: more changes to prevent a crash in the soread without so_tcpcb case 2017-01-20 13:27:00 -08:00
Andrew Tonner 68353ca6b1 fix for null deref in slirp soread when the so doesn't have a tcpcb yet 2017-01-20 02:05:55 -08:00
Andrew Tonner 52a36f24bb guard against the slirp queues null deref on dequeues I've seen in the debugger 2017-01-20 01:33:20 -08:00
Andrew Tonner bdd2ee1190 python build script: do make clean if we reconfigured 2017-01-19 21:38:37 -08:00
Andrew Tonner 69a3c31fff Add configure option to disable VOSF; add it to python build script 2017-01-19 21:38:21 -08:00
Andrew Tonner 1229eb0ea9 if the originals for any symlinked dirs (which are just copies under msys/mingw) have been updated, delete the copies and make links again 2017-01-19 21:14:46 -08:00
Andrew Tonner 2f9bc272be ws2 defines and missing prototypes for building withmingw32 2017-01-19 21:12:35 -08:00
Andrew Tonner d3b56d8e32 Fix for intermittent cursor snapping: don't attempt to warp the cursor when it's not in the window 2017-01-19 05:14:20 -08:00
Andrew Tonner d8f5d43a9c python build script: when getting modified time for a directory, also check contents' times 2017-01-19 05:13:01 -08:00
Andrew Tonner 21a6d39d4b python build script: jit option 2017-01-19 05:12:03 -08:00
Andrew Tonner 8c3f1fa0c3 gitignore dyngen and output files 2017-01-18 21:14:02 -08:00
Andrew Tonner dae89116e7 python build script: option to copy the supplied precompiled dyngen output files instead of running dyngen 2017-01-18 21:11:21 -08:00
Andrew Tonner 1af0c4685a python build script: give a better error message when there is a syntax error in the JSON cache file 2017-01-18 19:57:34 -08:00
Andrew Tonner 8259c00929 gitignore cleanup 2017-01-18 19:34:33 -08:00
Andrew Tonner 9efd46d396 build script pep-8 2017-01-18 19:31:27 -08:00
Andrew Tonner bd3fecc780 build script cleanup & renames & updating TODOs; cleanup gitignore 2017-01-18 19:29:13 -08:00
Andrew Tonner e303e314f5 use explicit __thiscall calling convention for member function casts on mingw32 2017-01-18 19:11:19 -08:00
Andrew Tonner ffd6294943 build script comments & todos & cleanup 2017-01-18 19:01:49 -08:00
Andrew Tonner 7ef9f10712 don't undef __STRICT_ANSI__ since it's not necessary with gnu++11 2017-01-18 19:00:42 -08:00
Andrew Tonner 83ea8b0779 Merge remote-tracking branch 'cebix/master' into windows_build_script_test_merge 2017-01-18 16:49:19 -08:00
Andrew Tonner b90b67971c fpclassify return type may vary 2017-01-18 16:01:52 -08:00
Andrew Tonner 5c264434e7 disable obsolete cd driver warning 2017-01-18 15:57:36 -08:00
Andrew Tonner aabd23408d option to run a shell command 2017-01-18 15:02:20 -08:00
Andrew Tonner 17b977b6ad fix silly name of inline bswap 16 2017-01-18 14:48:02 -08:00
Andrew Tonner e0783e5c20 add option to copy sheepshaver exe after build 2017-01-18 14:47:21 -08:00
Andrew Tonner fa8c87acff add LDFLAGS for static libgcc and stdc++ so we don't need dlls for those 2017-01-18 14:46:55 -08:00
Andrew Tonner 0ffa196f29 remove PASCAL undef 2017-01-18 14:44:33 -08:00
Andrew Tonner daac4f58ec reverse serial_windows.cpp symlink removal 2017-01-18 04:52:19 -08:00
Andrew Tonner dc54a5eceb missed commits 2017-01-18 04:51:34 -08:00
Andrew Tonner b74ae092c9 builds on mingw32 without jit, still untested 2017-01-18 04:41:40 -08:00
Dan Sumorok dee3f7e1c5 Added tap/bridge support to ether helper. 2016-03-19 19:17:48 -04:00
Dan Sumorok 1d84d40518 Linux etherhelper build updates. 2016-03-16 18:40:33 -04:00
Dan Sumorok 7710322fd3 Linux etherhelper support. 2016-03-15 20:03:59 -04:00
Dave Vasilevsky f64b888f78 Make dyngen_barrier() stronger on x86
GCC 5 will optimize out an empty 'asm volatile' in op_sraw_T0_T1, and then give us multiple return points. Add a nop so it doesn't do this, at the cost of lower code density.
2015-12-28 23:28:17 -05:00
Dave Vasilevsky c91ef547bd Allow building with GCC 5
* Disable -freorder-blocks-and-partition, since it can override -fno-reorder-blocks
* Disable look-header copying, since it tends to cause early returns
* Disable argument pushing, we don't want to change esp
2015-12-28 23:26:19 -05:00
Dan Sumorok fcc1598086 Add no_pie linker flag for Mac OS X 10.6 and later. 2015-01-14 19:23:26 -05:00
Dan Sumorok b8fb05fbd0 Minor build fixes
Removed OS X -no_pie linker flag
Fixed copy/paste error in ether helper help string
Added missing distclean targets.
2014-12-31 09:36:17 -05:00
Dan Sumorok 24005dc4ed Merge remote-tracking branch 'us/master' into mergetest 2014-12-30 09:16:27 -05:00
Dan Sumorok b1270264a1 Changed page zero size to 4 kB to fix problem on OS X 10.10. 2014-11-29 19:45:47 -05:00
Dan Sumorok 4f162dc6e3 Minor build fixes. 2014-11-29 19:25:31 -05:00
Dan Sumorok 3c6788fd26 Tweak of the linker commands. 2013-07-08 06:51:24 -04:00
Dan Sumorok c01bd008db Hack to load code below 4GB, and to make 32-bit vm allocates work. 2013-07-06 17:09:37 -04:00
Dan Sumorok 1c99d52b91 Added missing file. 2013-06-28 07:12:38 -04:00
Dan Sumorok c4276955ba Fixed some 64-bit releated problems on os x. 2013-06-28 07:11:52 -04:00
Dan Sumorok 45a34e2763 Merge branch 'master' into asc 2013-06-22 12:43:52 -04:00
Dan Sumorok b609065bc4 Always start sound. 2013-06-22 12:43:41 -04:00
Dan Sumorok 3583b00a77 Copy etherhelpertool into application bundle.
Ignore -psn_ command line argument so OS X application bundle
can be launched.
2013-06-21 18:59:04 -04:00
Dan Sumorok e08090095f Fixed compile error when asc emu is not enabled. 2013-06-19 19:09:40 -04:00
Dan Sumorok 9aec39d3cb Added extra ifdefs. 2013-06-18 07:02:42 -04:00
Dan Sumorok b7cfe89445 More asc fixes. 2013-06-15 16:21:26 -04:00
Dan Sumorok ce68f366cb Added asc.c, and asc.h.
Don't stop sound if we don't have to.
2013-06-09 19:34:19 -04:00
Dan Sumorok eedf6880db A bit of apple sound chip support. 2013-06-09 16:27:24 -04:00
Dan Sumorok 8a02128473 More changes of etherslave to etherhelper. 2013-05-29 19:42:59 -04:00
Dan Sumorok 5db556214c Renamed "etherslave" to "etherhelper". 2013-05-29 19:30:51 -04:00
Dan Sumorok fc8835aa6f Added more debug output.
No longer add ethernet interface to bridge if bridge already exists.
2013-05-29 07:00:44 -04:00
Dan Sumorok 8f863effbc Added error messages. 2013-05-28 19:33:12 -04:00
Dan Sumorok 5aa782acc0 Changed ethernet address when using tap interface. 2013-05-27 13:55:38 -04:00
Dan Sumorok f994087291 More work on new tap interface. 2013-05-26 20:58:03 -04:00
Dan Sumorok 19b53082a3 Added tap support to etherslave tool. 2013-05-25 22:01:21 -04:00
Dan Sumorok c939be2d2d Removed objective-c from runtool source so it can be built with
newer (not from Apple) versions of gcc.
2013-05-25 10:48:15 -04:00
Dan Sumorok 531b1d7df4 Merge branch 'etherslave'
Conflicts:
	BasiliskII/src/Unix/configure.ac
2013-05-14 06:39:11 -04:00
Dan Sumorok 0e667be7be Merge branch 'osx-video-fix' 2013-05-14 06:37:47 -04:00
Dan Sumorok 15e47a1f07 Merge branch 'buildfix' 2013-05-14 06:37:35 -04:00
Dan Sumorok 241162f261 Fixed code that removed 15-bit color mode.
15-bit color mode is now removed on all platforms.
The removal of 15-bit color mode now happens before the sort.
Updated a variable name.
Changed list length calculation to use C++'s clever pointer
subtraction.
2013-05-05 16:20:37 -04:00
Dan Sumorok e91a03f40f Added clean rule for etherslavetool. 2013-05-05 14:20:33 -04:00
Dan Sumorok 57b9ad0d95 Remove 15 bit video for OS X. This mode doesn't seem to work.
This also fixes 2-bit, 4-bit, and 8-bit modes.
2013-05-05 14:11:09 -04:00
Dan Sumorok f1c78e659c More coding style updates. 2013-05-04 20:37:29 -04:00
Dan Sumorok 01ba04139f Updated coding style. 2013-05-04 20:36:11 -04:00
Dan Sumorok 94b790728e Added file-level comments. 2013-05-01 06:54:20 -04:00
Dan Sumorok cf3b2786ae Revert previous changes. Changes have been moved to branches. 2013-05-01 06:39:15 -04:00
Dan Sumorok a250b40c80 Added new etherlave network option for OS X. 2013-04-30 20:46:31 -04:00
Daniel Sumorok 772bb53d88 Added etherslave network option of OS X that uses bpf to read
and write raw ethernet frames.

Separated out OSX video and sound options so you build with gtk
video but with OS X sound support.

Changed ordering native video modes are searched to work around
an issue on OS X with 16-bit color under xwindows.
2013-04-28 20:35:07 -04:00
271 changed files with 87557 additions and 11739 deletions

31
.gitignore vendored
View File

@ -6,3 +6,34 @@
# Mac OS X metadata
*.DS_Store
#
# Xcode gitignore settings are from https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
#
## Xcode, Build generated
build/
DerivedData/
## Xcode, Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
xcschemes/
project.xcworkspace/
## Xcode, Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
#
# JetBrains IDE settings
#
*.idea

View File

@ -442,25 +442,43 @@ ether <ethernet card description>
instead of sending packets via physical media writes them to
the user space program.
Prerequesties:
Prerequisites:
- Make sure the "tun" kernel module is loaded
# modprobe tun
- Make sure IP Fordwarding is enabled on your system
# echo 1 >/proc/sys/net/ipv4/ip_forward
A virtual network configuration script is required and the
# modprobe tun
- If you wish to route IP packets from Basilisk II, make sure
IP Forwarding is enabled on your system (not required for
bridging)
# echo 1 >/proc/sys/net/ipv4/ip_forward
A virtual network configuration script is required in order
to configure the tunN interface after it is created, and the
default is /usr/local/BasiliskII/tunconfig unless you specify
a different file with the "etherconfig" item.
This script requires you that "sudo" is properly configured
The default "tunconfig" script configures the tunN interface
for IP NAT. It requires that "sudo" is properly configured
so that "/sbin/ifconfig" and "/sbin/iptables" can be executed
as root. Otherwise, you can still write a helper script which
invokes your favorite program to enhance a user priviledges.
invokes your favorite program to elevate user privileges.
e.g. in a KDE environment, kdesu can be used as follows:
#!/bin/sh
exec /usr/bin/kdesu -c /path/to/tunconfig $1 $2
As an alternative to configuring IP on the tunN interface,
you may attach it to a bridge, which will enable AppleTalk
frames to be forwarded without Linux needing to route them.
No tunconfig-like script is provided to configure bridging,
but you may simply configure "etherconfig /bin/true" to skip
the automatic configuration and then configure bridging
manually once Basilisk II has started, e.g.:
# ifconfig tun0 up
# brctl addif bridge1 tun0
4. Access the network through the user mode network stack.
(the code and this documentation come from QEMU)

View File

@ -274,13 +274,20 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_REGISTER_FILE ((unsigned long *)SIGSEGV_CONTEXT_REGS), SIGSEGV_SPARC_GWINDOWS, SIGSEGV_SPARC_RWINDOW
#define SIGSEGV_SKIP_INSTRUCTION sparc_skip_instruction
#endif
#if defined(__i386__)
#if (defined(i386) || defined(__i386__))
#include <sys/regset.h>
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[EIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#if (defined(x86_64) || defined(__x86_64__))
#include <sys/regset.h>
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if (defined(i386) || defined(__i386__))
@ -302,6 +309,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_EIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#elif (defined(x86_64) || defined(__x86_64__))
#include <sys/ucontext.h>
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.__gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_RIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#if (defined(powerpc) || defined(__powerpc__))
#include <sys/ucontext.h>
@ -323,12 +336,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#endif
#if (defined(i386) || defined(__i386__))
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[14] /* should use REG_EIP instead */
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_EIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#elif (defined(x86_64) || defined(__x86_64__))
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[16] /* should use REG_RIP instead */
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#elif (defined(ia64) || defined(__ia64__))
@ -346,6 +359,11 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.arm_pc)
#define SIGSEGV_REGISTER_FILE (&SIGSEGV_CONTEXT_REGS.arm_r0)
#define SIGSEGV_SKIP_INSTRUCTION arm_skip_instruction
#elif (defined(aarch64) || defined(__aarch64__))
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext)
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.pc)
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&SIGSEGV_CONTEXT_REGS.regs)
#define SIGSEGV_SKIP_INSTRUCTION aarch64_skip_instruction
#elif (defined(mips) || defined(__mips__))
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext)
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.pc)
@ -747,38 +765,37 @@ handleExceptions(void *priv)
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
// Decode and skip X86 instruction
#if (defined(i386) || defined(__i386__) || defined(_M_IX86)) || (defined(__x86_64__) || defined(_M_X64))
#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64))
#if defined(__linux__)
enum {
#if (defined(i386) || defined(__i386__))
X86_REG_EIP = 14,
X86_REG_EAX = 11,
X86_REG_ECX = 10,
X86_REG_EDX = 9,
X86_REG_EBX = 8,
X86_REG_ESP = 7,
X86_REG_EBP = 6,
X86_REG_ESI = 5,
X86_REG_EDI = 4
#endif
#if defined(__x86_64__)
X86_REG_R8 = 0,
X86_REG_R9 = 1,
X86_REG_R10 = 2,
X86_REG_R11 = 3,
X86_REG_R12 = 4,
X86_REG_R13 = 5,
X86_REG_R14 = 6,
X86_REG_R15 = 7,
X86_REG_EDI = 8,
X86_REG_ESI = 9,
X86_REG_EBP = 10,
X86_REG_EBX = 11,
X86_REG_EDX = 12,
X86_REG_EAX = 13,
X86_REG_ECX = 14,
X86_REG_ESP = 15,
X86_REG_EIP = 16
X86_REG_EIP = REG_EIP,
X86_REG_EAX = REG_EAX,
X86_REG_ECX = REG_ECX,
X86_REG_EDX = REG_EDX,
X86_REG_EBX = REG_EBX,
X86_REG_ESP = REG_ESP,
X86_REG_EBP = REG_EBP,
X86_REG_ESI = REG_ESI,
X86_REG_EDI = REG_EDI
#elif (defined(x86_64) || defined(__x86_64__))
X86_REG_R8 = REG_R8,
X86_REG_R9 = REG_R9,
X86_REG_R10 = REG_R10,
X86_REG_R11 = REG_R11,
X86_REG_R12 = REG_R12,
X86_REG_R13 = REG_R13,
X86_REG_R14 = REG_R14,
X86_REG_R15 = REG_R15,
X86_REG_EDI = REG_RDI,
X86_REG_ESI = REG_RSI,
X86_REG_EBP = REG_RBP,
X86_REG_EBX = REG_RBX,
X86_REG_EDX = REG_RDX,
X86_REG_EAX = REG_RAX,
X86_REG_ECX = REG_RCX,
X86_REG_ESP = REG_RSP,
X86_REG_EIP = REG_RIP
#endif
};
#endif
@ -794,6 +811,24 @@ enum {
X86_REG_EBP = _REG_EBP,
X86_REG_ESI = _REG_ESI,
X86_REG_EDI = _REG_EDI
#elif (defined(x86_64) || defined(__x86_64__))
X86_REG_EIP = _REG_RIP,
X86_REG_EAX = _REG_RAX,
X86_REG_ECX = _REG_RCX,
X86_REG_EDX = _REG_RDX,
X86_REG_EBX = _REG_RBX,
X86_REG_ESP = _REG_RSP,
X86_REG_EBP = _REG_RBP,
X86_REG_ESI = _REG_RSI,
X86_REG_EDI = _REG_RDI,
X86_REG_R8 = _REG_R8,
X86_REG_R9 = _REG_R9,
X86_REG_R10 = _REG_R10,
X86_REG_R11 = _REG_R11,
X86_REG_R12 = _REG_R12,
X86_REG_R13 = _REG_R13,
X86_REG_R14 = _REG_R14,
X86_REG_R15 = _REG_R15
#endif
};
#endif
@ -809,8 +844,7 @@ enum {
X86_REG_EBP = 2,
X86_REG_ESI = 1,
X86_REG_EDI = 0
#endif
#if (defined(x86_64) || defined(__x86_64__))
#elif (defined(x86_64) || defined(__x86_64__))
X86_REG_EDI = 0,
X86_REG_ESI = 1,
X86_REG_EDX = 2,
@ -833,7 +867,7 @@ enum {
#endif
#if defined(__OpenBSD__)
enum {
#if defined(__i386__)
#if (defined(i386) || defined(__i386__))
// EDI is the first register we consider
#define OREG(REG) offsetof(struct sigcontext, sc_##REG)
#define DREG(REG) ((OREG(REG) - OREG(edi)) / 4)
@ -854,7 +888,7 @@ enum {
#if defined(__sun__)
// Same as for Linux, need to check for x86-64
enum {
#if defined(__i386__)
#if (defined(i386) || defined(__i386__))
X86_REG_EIP = EIP,
X86_REG_EAX = EAX,
X86_REG_ECX = ECX,
@ -864,6 +898,24 @@ enum {
X86_REG_EBP = EBP,
X86_REG_ESI = ESI,
X86_REG_EDI = EDI
#elif (defined(x86_64) || defined(__x86_64__))
X86_REG_R8 = REG_R8,
X86_REG_R9 = REG_R9,
X86_REG_R10 = REG_R10,
X86_REG_R11 = REG_R11,
X86_REG_R12 = REG_R12,
X86_REG_R13 = REG_R13,
X86_REG_R14 = REG_R14,
X86_REG_R15 = REG_R15,
X86_REG_EDI = REG_RDI,
X86_REG_ESI = REG_RSI,
X86_REG_EBP = REG_RBP,
X86_REG_EBX = REG_RBX,
X86_REG_EDX = REG_RDX,
X86_REG_EAX = REG_RAX,
X86_REG_ECX = REG_RCX,
X86_REG_ESP = REG_RSP,
X86_REG_EIP = REG_RIP
#endif
};
#endif
@ -1018,6 +1070,15 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs)
transfer_size = SIZE_WORD;
}
#if defined(__x86_64__) || defined(_M_X64)
// Address size override
if (*eip == 0x67) {
// 32-bit address
eip++;
len++;
}
#endif
// REX prefix
#if defined(__x86_64__) || defined(_M_X64)
struct rex_t {
@ -2499,6 +2560,22 @@ static bool arm_skip_instruction(unsigned long * regs)
}
#endif
#ifdef _STRUCT_ARM_THREAD_STATE64
static bool aarch64_skip_instruction(unsigned long *regs) {
_STRUCT_ARM_THREAD_STATE64 *ts = (_STRUCT_ARM_THREAD_STATE64 *)regs;
if (!ts->__pc) return false;
ts->__pc += 4;
return true;
}
#endif
#ifdef __linux__
static bool aarch64_skip_instruction(unsigned long *regs) {
unsigned long long *r = (unsigned long long *)regs;
if (!r[32]) return false;
r[32] += 4;
return true;
}
#endif
// Fallbacks
#ifndef SIGSEGV_FAULT_ADDRESS_FAST
@ -3230,7 +3307,7 @@ static sigsegv_return_t sigsegv_insn_handler(sigsegv_info_t *sip)
// More sophisticated tests for instruction skipper
static bool arch_insn_skipper_tests()
{
#if (defined(i386) || defined(__i386__)) || (defined(__x86_64__) || defined(_M_X64))
#if (defined(i386) || defined(__i386__) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64))
static const unsigned char code[] = {
0x8a, 0x00, // mov (%eax),%al
0x8a, 0x2c, 0x18, // mov (%eax,%ebx,1),%ch
@ -3244,7 +3321,7 @@ static bool arch_insn_skipper_tests()
0x8b, 0x0c, 0x18, // mov (%eax,%ebx,1),%ecx
0x89, 0x00, // mov %eax,(%eax)
0x89, 0x0c, 0x18, // mov %ecx,(%eax,%ebx,1)
#if defined(__x86_64__) || defined(_M_X64)
#if defined(x86_64) || defined(__x86_64__) || defined(_M_X64)
0x44, 0x8a, 0x00, // mov (%rax),%r8b
0x44, 0x8a, 0x20, // mov (%rax),%r12b
0x42, 0x8a, 0x3c, 0x10, // mov (%rax,%r10,1),%dil

View File

@ -105,6 +105,22 @@ extern "C" {
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#define SIGSEGV_REGISTER_FILE ((SIGSEGV_REGISTER_TYPE *)&SIP->thr_state.MACH_FIELD_NAME(rax)) /* RAX is the first GPR we consider */
#endif
#ifdef __aarch64__
#if __DARWIN_UNIX03 && defined _STRUCT_ARM_THREAD_STATE64
#define MACH_FIELD_NAME(X) __CONCAT(__,X)
#endif
#define SIGSEGV_EXCEPTION_STATE_TYPE arm_exception_state64_t
#define SIGSEGV_EXCEPTION_STATE_FLAVOR ARM_EXCEPTION_STATE64
#define SIGSEGV_EXCEPTION_STATE_COUNT ARM_EXCEPTION_STATE64_COUNT
#define SIGSEGV_FAULT_ADDRESS SIP->exc_state.MACH_FIELD_NAME(far)
#define SIGSEGV_THREAD_STATE_TYPE arm_thread_state64_t
#define SIGSEGV_THREAD_STATE_FLAVOR ARM_THREAD_STATE64
#define SIGSEGV_THREAD_STATE_COUNT ARM_THREAD_STATE64_COUNT
#define SIGSEGV_REGISTER_FILE ((SIGSEGV_REGISTER_TYPE *)&SIP->thr_state.MACH_FIELD_NAME(x[0])) /* x[0] is the first GPR we consider */
#define SIGSEGV_SKIP_INSTRUCTION aarch64_skip_instruction
#endif
#ifdef __x86_64__
#define SIGSEGV_FAULT_ADDRESS_FAST (((uint64_t)code[1])|0x100000000)
#else

19
BasiliskII/src/CrossPlatform/video_blit.cpp Normal file → Executable file
View File

@ -22,6 +22,10 @@
#include "video.h"
#include "video_blit.h"
#if USE_SDL_VIDEO
#include <SDL.h>
#endif
#include <stdio.h>
#include <stdlib.h>
@ -301,6 +305,7 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length)
#define FB_DEPTH 24
#include "video_blit.h"
#if !(REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO)
/* -------------------------------------------------------------------------- */
/* --- 1-bit indexed to 8-bit color mode conversion --- */
/* -------------------------------------------------------------------------- */
@ -321,6 +326,7 @@ static void Blit_Expand_1_To_8_Color(uint8 * dest, const uint8 * p, uint32 lengt
*q++ = CONVERT_BW(c & 1);
}
}
#endif
/* -------------------------------------------------------------------------- */
/* --- 1/2/4-bit indexed to 8-bit mode conversion --- */
@ -503,7 +509,11 @@ static Screen_blit_func_info Screen_blitters[] = {
{ 16, 0x00f800, 0x0007e0, 0x00001f, Blit_RGB565_NBO , Blit_RGB565_OBO }, // OK (NBO)
{ 24, 0xff0000, 0x00ff00, 0x0000ff, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
{ 24, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT
#ifdef ENABLE_VOSF
{ 32, 0xff0000, 0x00ff00, 0x0000ff, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
#else
{ 32, 0xff000000, 0x00ff0000, 0x0000ff00, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
#endif
{ 32, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT
#endif
{ 32, 0xff00, 0xff0000, 0xff000000, Blit_Copy_Raw , Blit_Copy_Raw } // OK
@ -519,12 +529,19 @@ bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_or
#else
const bool use_sdl_video = false;
#endif
#if REAL_ADDRESSING || DIRECT_ADDRESSING
#if REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO
if (mac_depth == 1 && !use_sdl_video && !visual_format.fullscreen) {
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines
Screen_blit = Blit_Copy_Raw;
#if !DIRECT_ADDRESSING && defined(__aarch64__)
} else if (mac_depth == 16) {
Screen_blit = Blit_Copy_Raw;
#endif
} else {
// Compute RGB shift values

View File

@ -30,6 +30,12 @@
#include "util_windows.h"
#endif
// Import SDL-backend-specific functions
#ifdef USE_SDL_VIDEO
extern void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
extern void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects);
#endif
// Glue for SDL and X11 support
#ifdef TEST_VOSF_PERFORMANCE
#define MONITOR_INIT /* nothing */
@ -514,7 +520,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
VIDEO_DRV_UNLOCK_PIXELS;
#ifdef USE_SDL_VIDEO
SDL_UpdateRect(drv->s, 0, y1, VIDEO_MODE_X, height);
update_sdl_video(drv->s, 0, y1, VIDEO_MODE_X, height);
#else
if (VIDEO_DRV_HAVE_SHM)
XShmPutImage(x_display, VIDEO_DRV_WINDOW, VIDEO_DRV_GC, VIDEO_DRV_IMAGE, 0, y1, 0, y1, VIDEO_MODE_X, height, 0);
@ -534,6 +540,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
#ifndef TEST_VOSF_PERFORMANCE
#if REAL_ADDRESSING || DIRECT_ADDRESSING
static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
{
VIDEO_MODE_INIT;
@ -558,7 +565,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
i2 += scr_bytes_per_row;
}
#ifdef USE_SDL_VIDEO
SDL_UpdateRect(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y);
update_sdl_video(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y);
#endif
VIDEO_DRV_UNLOCK_PIXELS;
return;
@ -568,8 +575,10 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
const uint32 n_pixels = 64;
const uint32 n_chunks = VIDEO_MODE_X / n_pixels;
const uint32 n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels);
const uint32 src_chunk_size = src_bytes_per_row / n_chunks;
const uint32 dst_chunk_size = dst_bytes_per_row / n_chunks;
const uint32 src_chunk_size = TrivialBytesPerRow(n_pixels, VIDEO_MODE_DEPTH);
const uint32 dst_chunk_size = TrivialBytesPerRow(n_pixels, DepthModeForPixelDepth(VIDEO_DRV_DEPTH));
assert(src_chunk_size * n_chunks <= src_bytes_per_row);
assert(dst_chunk_size * n_chunks <= dst_bytes_per_row);
const uint32 src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size);
const uint32 dst_chunk_size_left = dst_bytes_per_row - (n_chunks * dst_chunk_size);
@ -637,8 +646,6 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
memcpy(the_buffer_copy + i1, the_buffer + i1, src_chunk_size_left);
Screen_blit(the_host_buffer + i2, the_buffer + i1, src_chunk_size_left);
}
i1 += src_chunk_size_left;
i2 += dst_chunk_size_left;
#ifdef USE_SDL_VIDEO
const int x = n_chunks * n_pixels;
if (x < bb[bbi].x) {
@ -652,7 +659,8 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
bb[bbi].w = x + n_pixels_left - bb[bbi].x;
#endif
}
i2 += scr_bytes_left;
i1 += src_chunk_size_left;
i2 += dst_chunk_size_left + scr_bytes_left;
#ifdef USE_SDL_VIDEO
bb[bbi].h++;
if (bb[bbi].w && (j == y1 || j == y2 - 1 || j == y2)) {
@ -664,7 +672,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
#endif
}
#ifdef USE_SDL_VIDEO
SDL_UpdateRects(drv->s, bbi, bb);
update_sdl_video(drv->s, bbi, bb);
#endif
VIDEO_DRV_UNLOCK_PIXELS;
}

36
BasiliskII/src/CrossPlatform/vm_alloc.cpp Normal file → Executable file
View File

@ -37,6 +37,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include "vm_alloc.h"
#if defined(__APPLE__) && defined(__MACH__)
@ -71,7 +72,7 @@ typedef unsigned long vm_uintptr_t;
#ifndef MAP_32BIT
#define MAP_32BIT 0
#endif
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#define FORCE_MAP_32BIT MAP_FIXED
#else
#define FORCE_MAP_32BIT MAP_32BIT
@ -86,7 +87,7 @@ typedef unsigned long vm_uintptr_t;
#define MAP_EXTRA_FLAGS (MAP_32BIT)
#ifdef HAVE_MMAP_VM
#if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) || HAVE_LINKER_SCRIPT
#if (defined(__linux__) && defined(__i386__)) || defined(__sun__) || defined(__FreeBSD__) || defined(__NetBSD__) || HAVE_LINKER_SCRIPT
/* Force a reasonnable address below 0x80000000 on x86 so that we
don't get addresses above when the program is run on AMD64.
NOTE: this is empirically determined on Linux/x86. */
@ -222,6 +223,21 @@ void vm_exit(void)
#endif
}
static void *reserved_buf;
static const size_t RESERVED_SIZE = 80 * 1024 * 1024; // for 6K Retina
void *vm_acquire_reserved(size_t size) {
assert(reserved_buf && size <= RESERVED_SIZE);
return reserved_buf;
}
int vm_init_reserved(void *hostAddress) {
int result = vm_acquire_fixed(hostAddress, RESERVED_SIZE);
if (result >= 0)
reserved_buf = hostAddress;
return result;
}
/* Allocate zero-filled memory of SIZE bytes. The mapping is private
and default protection bits are read / write. The return value
is the actual mapping address chosen or VM_MAP_FAILED for errors. */
@ -243,22 +259,30 @@ void * vm_acquire(size_t size, int options)
#if defined(HAVE_MACH_VM)
// vm_allocate() returns a zero-filled memory region
kern_return_t ret_code = vm_allocate(mach_task_self(), (vm_address_t *)&addr, size, TRUE);
kern_return_t ret_code = vm_allocate(mach_task_self(), (vm_address_t *)&addr, reserved_buf ? size : size + RESERVED_SIZE, TRUE);
if (ret_code != KERN_SUCCESS) {
errno = vm_error(ret_code);
return VM_MAP_FAILED;
}
if (!reserved_buf)
reserved_buf = (char *)addr + size;
#elif defined(HAVE_MMAP_VM)
int fd = zero_fd;
int the_map_flags = translate_map_flags(options) | map_flags;
#ifdef __aarch64__
if ((addr = mmap((caddr_t)next_address, reserved_buf ? size : size + RESERVED_SIZE, VM_PAGE_DEFAULT, the_map_flags, fd, 0)) == (void *)MAP_FAILED)
return VM_MAP_FAILED;
if (!reserved_buf)
reserved_buf = (char *)addr + size;
#else
if ((addr = mmap((caddr_t)next_address, size, VM_PAGE_DEFAULT, the_map_flags, fd, 0)) == (void *)MAP_FAILED)
return VM_MAP_FAILED;
#endif
#if USE_JIT
// Sanity checks for 64-bit platforms
if (sizeof(void *) == 8 && (options & VM_MAP_32BIT) && !((char *)addr <= (char *)0xffffffff))
return VM_MAP_FAILED;
#endif
next_address = (char *)addr + size;
#elif defined(HAVE_WIN32_VM)
int alloc_type = MEM_RESERVE | MEM_COMMIT;

View File

@ -99,6 +99,10 @@ extern void vm_exit(void);
extern void * vm_acquire(size_t size, int options = VM_MAP_DEFAULT);
extern void * vm_acquire_reserved(size_t size);
extern int vm_init_reserved(void * host_address);
/* Allocate zero-filled memory at exactly ADDR (which must be page-aligned).
Returns 0 if successful, -1 on errors. */

View File

@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -51,23 +51,23 @@ void AudioDevice::Init(AudioDeviceID devid, bool isInput)
UInt32 propsize;
propsize = sizeof(UInt32);
verify_noerr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertySafetyOffset, &propsize, &mSafetyOffset));
__Verify_noErr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertySafetyOffset, &propsize, &mSafetyOffset));
propsize = sizeof(UInt32);
verify_noerr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, &propsize, &mBufferSizeFrames));
__Verify_noErr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, &propsize, &mBufferSizeFrames));
propsize = sizeof(AudioStreamBasicDescription);
verify_noerr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyStreamFormat, &propsize, &mFormat));
__Verify_noErr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyStreamFormat, &propsize, &mFormat));
}
void AudioDevice::SetBufferSize(UInt32 size)
{
UInt32 propsize = sizeof(UInt32);
verify_noerr(AudioDeviceSetProperty(mID, NULL, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, propsize, &size));
__Verify_noErr(AudioDeviceSetProperty(mID, NULL, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, propsize, &size));
propsize = sizeof(UInt32);
verify_noerr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, &propsize, &mBufferSizeFrames));
__Verify_noErr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyBufferFrameSize, &propsize, &mBufferSizeFrames));
}
int AudioDevice::CountChannels()
@ -92,6 +92,6 @@ int AudioDevice::CountChannels()
char * AudioDevice::GetName(char *buf, UInt32 maxlen)
{
verify_noerr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyDeviceName, &maxlen, buf));
__Verify_noErr(AudioDeviceGetProperty(mID, 0, mIsInput, kAudioDevicePropertyDeviceName, &maxlen, buf));
return buf;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:BasiliskII.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,576 @@
# /usr/share/BasiliskII/keycodes
#
# Basilisk II (C) 1997-2005 Christian Bauer
#
# This file is used to translate the (server-specific) scancodes to
# Mac keycodes depending on the window server being used.
#
# The format of this file is as follows:
#
# sdl <driver string>
# <SDL scancode> <Mac keycode>
# <SDL scancode> <Mac keycode>
# <SDL scancode> <Mac keycode>
# ...
# sdl <driver string>
# <SDL scancode> <Mac keycode>
# <SDL scancode> <Mac keycode>
# ...
#
# The "driver string" must match the first part of the SDL driver vendor
# description as reported by SDL_VideoDriverName(). If a match is found,
# the keycode translation table is constructed from the following
# lines. Each line contains an SDL scancode followed by its associated
# Mac keycode. Both keycodes have to be given in decimal. Lines
# beginning with "#" or ";" are treated as comments and ignored.
#
#
# Cocoa French Keyboard
#
sdl cocoa
41 53 # Esc
58 122 # F1
59 120 # F2
60 99 # F3
61 118 # F4
62 96 # F5
63 97 # F6
64 98 # F7
65 100 # F8
66 101 # F9
67 109 # F10
68 103 # F11
69 111 # F12
70 105 # F13/PrintScrn
71 107 # F14/Scroll Lock
72 113 # F15/Pause
53 10 # `
30 18 # 1
31 19 # 2
32 20 # 3
33 21 # 4
34 23 # 5
35 22 # 6
36 26 # 7
37 28 # 8
38 25 # 9
39 29 # 0
45 27 # -
46 24 # =
42 51 # Backspace
73 114 # Help/Insert
74 115 # Home
75 116 # Page Up
83 71 # Num Lock
81 81 # KP =
84 75 # KP /
85 67 # KP *
43 48 # Tab
20 12 # Q
26 13 # W
8 14 # E
21 15 # R
23 17 # T
28 16 # Y
24 32 # U
12 34 # I
18 31 # O
19 35 # P
47 33 # [
48 30 # ]
40 36 # Return
76 117 # Delete
77 119 # End
78 121 # Page Down
95 89 # KP 7
96 91 # KP 8
97 92 # KP 9
86 78 # KP -
130 57 # Caps Lock
4 0 # A
22 1 # S
7 2 # D
9 3 # F
10 5 # G
11 4 # H
13 38 # J
14 40 # K
15 37 # L
51 41 # ;
52 39 # '
49 42 # \
92 86 # KP 4
93 87 # KP 5
94 88 # KP 6
87 69 # KP +
56 56 # Shift
100 50 # International SDL_NONUSBACKSLASH
29 6 # Z
27 7 # X
6 8 # C
25 9 # V
5 11 # B
17 45 # N
16 46 # M
54 43 # ,
55 47 # .
56 44 # /
82 62 # Cursor Up
80 59 # Cursor Left
81 61 # Cursor Down
79 60 # Cursor Right
83 83 # KP 1
84 84 # KP 2
85 85 # KP 3
76 76 # KP Enter
228 54 # Ctrl
226 58 # Option
227 55 # Command
224 54 # Ctrl Left
230 58 # Right Alt->option
231 55 # Right cmd
44 49 # Space
82 82 # KP 0
65 65 # KP .
#
# X11 server
#
sdl x11
sdl dga
9 53 # Esc
67 122 # F1
68 120 # F2
69 99 # F3
70 118 # F4
71 96 # F5
72 97 # F6
73 98 # F7
74 100 # F8
75 101 # F9
76 109 # F10
95 103 # F11
96 111 # F12
111 105 # PrintScrn
78 107 # Scroll Lock
110 113 # Pause
49 10 # `
10 18 # 1
11 19 # 2
12 20 # 3
13 21 # 4
14 23 # 5
15 22 # 6
16 26 # 7
17 28 # 8
18 25 # 9
19 29 # 0
20 27 # -
21 24 # =
22 51 # Backspace
106 114 # Insert
97 115 # Home
99 116 # Page Up
77 71 # Num Lock
112 75 # KP /
63 67 # KP *
82 78 # KP -
23 48 # Tab
24 12 # Q
25 13 # W
26 14 # E
27 15 # R
28 17 # T
29 16 # Y
30 32 # U
31 34 # I
32 31 # O
33 35 # P
34 33 # [
35 30 # ]
36 36 # Return
107 117 # Delete
103 119 # End
105 121 # Page Down
79 89 # KP 7
80 91 # KP 8
81 92 # KP 9
86 69 # KP +
66 57 # Caps Lock
38 0 # A
39 1 # S
40 2 # D
41 3 # F
42 5 # G
43 4 # H
44 38 # J
45 40 # K
46 37 # L
47 41 # ;
48 39 # '
83 86 # KP 4
84 87 # KP 5
85 88 # KP 6
50 56 # Shift Left
94 50 # International
52 6 # Z
53 7 # X
54 8 # C
55 9 # V
56 11 # B
57 45 # N
58 46 # M
59 43 # ,
60 47 # .
61 44 # /
62 56 # Shift Right
51 42 # \
98 62 # Cursor Up
87 83 # KP 1
88 84 # KP 2
89 85 # KP 3
108 76 # KP Enter
37 54 # Ctrl Left
115 58 # Logo Left (-> Option)
64 55 # Alt Left (-> Command)
65 49 # Space
113 55 # Alt Right (-> Command)
116 58 # Logo Right (-> Option)
117 50 # Menu (-> International)
109 54 # Ctrl Right
100 59 # Cursor Left
104 61 # Cursor Down
102 60 # Cursor Right
90 82 # KP 0
91 65 # KP .
#
# Linux Framebuffer Console
#
sdl fbcon
1 53 # Esc
59 122 # F1
60 120 # F2
61 99 # F3
62 118 # F4
63 96 # F5
64 97 # F6
65 98 # F7
66 100 # F8
67 101 # F9
68 109 # F10
87 103 # F11
88 111 # F12
99 105 # PrintScrn
70 107 # Scroll Lock
119 113 # Pause
41 10 # `
2 18 # 1
3 19 # 2
4 20 # 3
5 21 # 4
6 23 # 5
7 22 # 6
8 26 # 7
9 28 # 8
10 25 # 9
11 29 # 0
12 27 # -
13 24 # =
14 51 # Backspace
110 114 # Insert
102 115 # Home
104 116 # Page Up
69 71 # Num Lock
98 75 # KP /
55 67 # KP *
74 78 # KP -
15 48 # Tab
16 12 # Q
17 13 # W
18 14 # E
19 15 # R
20 17 # T
21 16 # Y
22 32 # U
23 34 # I
24 31 # O
25 35 # P
26 33 # [
27 30 # ]
28 36 # Return
111 117 # Delete
107 119 # End
109 121 # Page Down
71 89 # KP 7
72 91 # KP 8
73 92 # KP 9
78 69 # KP +
58 57 # Caps Lock
30 0 # A
31 1 # S
32 2 # D
33 3 # F
34 5 # G
35 4 # H
36 38 # J
37 40 # K
38 37 # L
39 41 # ;
40 39 # '
75 86 # KP 4
76 87 # KP 5
77 88 # KP 6
42 56 # Shift Left
86 50 # International
44 6 # Z
45 7 # X
46 8 # C
47 9 # V
48 11 # B
49 45 # N
50 46 # M
51 43 # ,
52 47 # .
53 44 # /
54 56 # Shift Right
43 42 # \
103 62 # Cursor Up
79 83 # KP 1
80 84 # KP 2
81 85 # KP 3
96 76 # KP Enter
29 54 # Ctrl Left
125 58 # Logo Left (-> Option)
56 55 # Alt Left (-> Command)
57 49 # Space
100 55 # Alt Right (-> Command)
126 58 # Logo Right (-> Option)
97 54 # Ctrl Right
105 59 # Cursor Left
108 61 # Cursor Down
106 60 # Cursor Right
82 82 # KP 0
83 65 # KP .
#
# Quartz (1:1 translation actually)
#
sdl Quartz
41 53 # Esc
58 122 # F1
59 120 # F2
60 99 # F3
61 118 # F4
62 96 # F5
63 97 # F6
64 98 # F7
65 100 # F8
66 101 # F9
67 109 # F10
68 103 # F11
69 111 # F12
70 105 # F13/PrintScrn
71 107 # F14/Scroll Lock
72 113 # F15/Pause
52 10 # `
30 18 # 1
31 19 # 2
32 20 # 3
33 21 # 4
34 23 # 5
35 22 # 6
36 26 # 7
37 28 # 8
38 25 # 9
39 29 # 0
45 27 # -
24 24 # =
42 51 # Backspace
114 114 # Help/Insert
74 115 # Home
75 116 # Page Up
83 71 # Num Lock
81 81 # KP =
84 75 # KP /
85 67 # KP *
48 48 # Tab
20 12 # Q
26 13 # W
8 14 # E
21 15 # R
23 17 # T
28 16 # Y
24 32 # U
12 34 # I
18 31 # O
19 35 # P
47 33 # [
48 30 # ]
40 36 # Return
117 117 # Delete
119 119 # End
121 121 # Page Down
95 89 # KP 7
96 91 # KP 8
97 92 # KP 9
86 78 # KP -
57 57 # Caps Lock
4 0 # A
22 1 # S
7 2 # D
9 3 # F
10 5 # G
11 4 # H
13 38 # J
14 40 # K
15 37 # L
51 41 # ;
52 39 # '
49 42 # \
92 86 # KP 4
93 87 # KP 5
94 88 # KP 6
87 69 # KP +
56 56 # Shift
100 50 # International SDL_NONUSBACKSLASH
29 6 # Z
27 7 # X
6 8 # C
25 9 # V
5 11 # B
17 45 # N
16 46 # M
54 43 # ,
55 47 # .
56 44 # /
126 62 # Cursor Up
123 59 # Cursor Left
125 61 # Cursor Down
124 60 # Cursor Right
83 83 # KP 1
84 84 # KP 2
85 85 # KP 3
76 76 # KP Enter
228 54 # Ctrl
226 58 # Option
227 55 # Command
224 54 # Ctrl Left
230 58 # Right Alt->option
231 55 # Right cmd
44 49 # Space
82 82 # KP 0
65 65 # KP .
#
# Windows
#
sdl windib
sdl directx
1 53 # Esc
59 122 # F1
60 120 # F2
61 99 # F3
62 118 # F4
63 96 # F5
64 97 # F6
65 98 # F7
66 100 # F8
67 101 # F9
68 109 # F10
87 103 # F11
88 111 # F12
183 105 # PrintScrn
70 107 # Scroll Lock
197 113 # Pause
41 10 # `
2 18 # 1
3 19 # 2
4 20 # 3
5 21 # 4
6 23 # 5
7 22 # 6
8 26 # 7
9 28 # 8
10 25 # 9
11 29 # 0
12 27 # -
13 24 # =
14 51 # Backspace
210 114 # Insert
199 115 # Home
75 116 # Page Up
69 71 # Num Lock
181 75 # KP /
55 67 # KP *
74 78 # KP -
15 48 # Tab
16 12 # Q
17 13 # W
18 14 # E
19 15 # R
20 17 # T
21 16 # Y
22 32 # U
23 34 # I
24 31 # O
25 35 # P
26 33 # [
27 30 # ]
28 36 # Return
211 117 # Delete
207 119 # End
209 121 # Page Down
71 89 # KP 7
72 91 # KP 8
73 92 # KP 9
78 69 # KP +
58 57 # Caps Lock
30 0 # A
31 1 # S
32 2 # D
33 3 # F
34 5 # G
35 4 # H
36 38 # J
37 40 # K
38 37 # L
39 41 # ;
40 39 # '
75 86 # KP 4
76 87 # KP 5
77 88 # KP 6
225 56 # Shift Left
100 50 # International
44 6 # Z
45 7 # X
46 8 # C
47 9 # V
48 11 # B
49 45 # N
50 46 # M
51 43 # ,
52 47 # .
53 44 # /
229 56 # Shift Right
43 42 # \
200 62 # Cursor Up
79 83 # KP 1
80 84 # KP 2
81 85 # KP 3
156 76 # KP Enter
224 54 # Ctrl Left
227 58 # Logo Left (-> Option)
226 55 # Alt Left (-> Command)
57 49 # Space
230 55 # Alt Right (-> Command)
231 58 # Logo Right (-> Option)
221 50 # Menu (-> International)
157 54 # Ctrl Right
80 59 # Cursor Left
81 61 # Cursor Down
79 60 # Cursor Right
98 82 # KP 0
99 65 # KP .

View File

@ -4,8 +4,14 @@ It enables you to run 68k MacOS software on your computer, even if you are using
<CENTER>
<A HREF="http://basilisk.cebix.net">The Official Basilisk II Home Page</A>
</CENTER>
<BR>
<RIGHT>
MacOS X (native windowing) port
<BR>
by Nigel Pearson &lt;nigel@ind.tansu.com.au&gt;
<BR>
<BR>
SDL2 port
<BR>
by David Ludwig &lt;dludwig@pobox.com&gt;
</RIGHT>

View File

@ -1,3 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 1997-2006 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";
NSHumanReadableCopyright = "Copyright © 1997-2017 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";

View File

@ -1,5 +1,5 @@
<?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>
@ -7,11 +7,11 @@
<key>CFBundleExecutable</key>
<string>BasiliskII</string>
<key>CFBundleGetInfoString</key>
<string>Basilisk II version 1.0, Copyright © 1997-2006 Christian Bauer et al. Mac OS X port 19</string>
<string>Basilisk II version 1.0, Copyright © 1997-2017 Christian Bauer et al. SDL2 port</string>
<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>
@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>Basilisk II 1.0, Mac OS X port 19</string>
<string>Basilisk II 1.0, SDL2 port</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHelpFile</key>

View File

@ -18,6 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MACOSX_SOUND_IF
#define MACOSX_SOUND_IF
typedef int (*audioCallback)(void);
@ -39,3 +41,5 @@ class OSXsoundOutput {
unsigned int bufferSizeFrames();
int sendAudioBuffer(void *buffer, int numFrames);
};
#endif

View File

@ -0,0 +1,29 @@
SRC = $(PROJECT_DIR)/../uae_cpu
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output
VPATH = $(SRC) $(SRC)/compiler
CFLAGS = -DUSE_XCODE=1 -DUSE_JIT_FPU -I. -I../uae_cpu -I../UNIX
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
all: $(DST)/gencpu $(DST)/gencomp
cd $(DST); ./gencpu; ./gencomp
$(DST)/gencpu: $(addprefix $(DST)/, defs68k.o readcpu.o gencpu.o)
$(CXX) $(CXXFLAGS) -o $@ $^
$(DST)/gencomp: $(addprefix $(DST)/, defs68k.o readcpu.o gencomp.o)
$(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

@ -0,0 +1,29 @@
SRC = $(PROJECT_DIR)/../uae_cpu_2021
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output_2021
VPATH = $(SRC) $(SRC)/compiler
CFLAGS = -DUSE_XCODE=1 -DUSE_JIT_FPU -I. -I../uae_cpu_2021 -I../UNIX
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
all: $(DST)/gencpu $(DST)/gencomp
cd $(DST); ./gencpu; ./gencomp
$(DST)/gencpu: $(addprefix $(DST)/, defs68k.o readcpu.o gencpu.o)
$(CXX) $(CXXFLAGS) -o $@ $^
$(DST)/gencomp: $(addprefix $(DST)/, defs68k.o readcpu.o gencomp.o)
$(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

@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef USE_SDL_AUDIO
#include "sysdeps.h"
#include <sys/ioctl.h>
@ -269,3 +271,5 @@ static int audioInt(void)
TriggerInterrupt();
return 0;
}
#endif

View File

@ -100,7 +100,8 @@ void GetScrap(void **handle, uint32 type, int32 offset)
{
#if defined(__LP64__)
D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset));
#warning Carbon scrapbook function are not implemented in 64-bit mode
#error Carbon scrapbook function are not implemented in 64-bit mode
#error Use clip_macosx64.mm instead.
#else
D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset));
ScrapRef theScrap;
@ -177,7 +178,8 @@ void ZeroScrap()
void PutScrap(uint32 type, void *scrap, int32 length)
{
#if defined(__LP64__)
#warning Carbon scrapbook function are not implemented in 64-bit mode
#error Carbon scrapbook function are not implemented in 64-bit mode
#error Use clip_macosx64.mm instead.
D(bug("PutScrap type %4.4s, data %08lx, length %ld\n", &type, scrap, length));
#else
static bool clear = true;

View File

@ -59,12 +59,6 @@ static bool should_clear = false;
static NSMutableDictionary *g_macScrap;
// flavor UTIs
static NSString * const UTF16_TEXT_FLAVOR_NAME = @"public.utf16-plain-text";
static NSString * const TEXT_FLAVOR_NAME = @"com.apple.traditional-mac-plain-text";
static NSString * const STYL_FLAVOR_NAME = @"net.cebix.basilisk.styl-data";
// font face types
enum {
@ -234,8 +228,8 @@ static NSData *ConvertToMacTextEncoding(NSAttributedString *aStr, NSArray **styl
[[aStr string] getCharacters:chars range:NSMakeRange(0, length)];
NSUInteger unicodeLength = length * sizeof(unichar);
NSUInteger bufLen = unicodeLength * 2;
ByteCount unicodeLength = length * sizeof(unichar);
ByteCount bufLen = unicodeLength * 2;
uint8_t buf[bufLen];
ByteCount bytesRead;
@ -807,6 +801,8 @@ static NSData *ConvertToMacTEXTAndStyl(NSAttributedString *aStr, NSData **outSty
ScriptCode script = [[eachRun objectForKey:@"script"] shortValue];
NSDictionary *attrs = [eachRun objectForKey:@"attributes"];
if (![attrs count]) continue;
int32_t startChar = CFSwapInt32HostToBig((int32_t)offset);
[stylData appendBytes:&startChar length:4];
@ -1124,7 +1120,7 @@ static void ConvertHostPasteboardToMacScrap()
NSData *textData = MacTEXTAndStylDataFromPasteboard(g_pboard, &stylData);
if (textData) {
if (stylData)
if (stylData && [stylData length] > 2)
WriteDataToMacClipboard(stylData, TYPE_STYL);
WriteDataToMacClipboard(textData, TYPE_TEXT);

View File

@ -0,0 +1,850 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
#if ! USE_XCODE
// HACK, dludwig@pobox.com: Unless we are building with Xcode, use the
// config.h file that Autotools generates. This is located in
// BasiliskII/src/Unix/
#include "../Unix/config.h"
#else
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define is using ESD. */
/* #undef ENABLE_ESD */
/* Define if using DGA with framebuffer device. */
/* #define ENABLE_FBDEV_DGA 1 */
/* Define if using GTK. */
/* #undef ENABLE_GTK */
/* Define if using "mon". */
/* #undef ENABLE_MON */
/* Define if using native 68k mode. */
/* #undef ENABLE_NATIVE_M68K */
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
/* Define if your system supports TUN/TAP devices. */
/* #undef ENABLE_TUNTAP */
/* Define if using video enabled on SEGV signals. */
/* #undef ENABLE_VOSF */
/* Define if using XFree86 DGA extension. */
/* #undef ENABLE_XF86_DGA */
/* Define if using XFree86 DGA extension. */
/* #define ENABLE_XF86_VIDMODE 1 */
/* Define to 1 if you have the `acoshl' function. */
#define HAVE_ACOSHL 1
/* Define to 1 if you have the `acosl' function. */
#define HAVE_ACOSL 1
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <argz.h> header file. */
/* #undef HAVE_ARGZ_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `asinhl' function. */
#define HAVE_ASINHL 1
/* Define to 1 if you have the `asinl' function. */
#define HAVE_ASINL 1
/* Define if your system has <asm/ucontext.h> header. */
/* #undef HAVE_ASM_UCONTEXT */
/* Define to 1 if you have the `asprintf' function. */
#define HAVE_ASPRINTF 1
/* Define to 1 if you have the `atanh' function. */
#define HAVE_ATANH 1
/* Define to 1 if you have the `atanhl' function. */
#define HAVE_ATANHL 1
/* Define to 1 if you have the `atanl' function. */
#define HAVE_ATANL 1
/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
#define HAVE_AVAILABILITYMACROS_H 1
/* Define to 1 if the system has the type `caddr_t'. */
#define HAVE_CADDR_T 1
/* Define to 1 if you have the `ceill' function. */
#define HAVE_CEILL 1
/* Define to 1 if you have the `cfmakeraw' function. */
#define HAVE_CFMAKERAW 1
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the `coshl' function. */
#define HAVE_COSHL 1
/* Define to 1 if you have the `cosl' function. */
#define HAVE_COSL 1
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
/* #undef HAVE_DCGETTEXT */
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
don't. */
#define HAVE_DECL_FEOF_UNLOCKED 1
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
you don't. */
#define HAVE_DECL_FGETS_UNLOCKED 0
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#define HAVE_DECL_GETC_UNLOCKED 1
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
don't. */
#define HAVE_DECL__SNPRINTF 0
/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
don't. */
#define HAVE_DECL__SNWPRINTF 0
/* Define if you have /dev/ptmx */
/* #undef HAVE_DEV_PTMX */
/* Define if you have /dev/ptc */
/* #undef HAVE_DEV_PTS_AND_PTC */
/* Define to 1 if you have the `expl' function. */
#define HAVE_EXPL 1
/* Define to 1 if you have the `fabsl' function. */
#define HAVE_FABSL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the <floatingpoint.h> header file. */
/* #undef HAVE_FLOATINGPOINT_H */
/* Define to 1 if you have the `floorl' function. */
#define HAVE_FLOORL 1
/* Define if framework AppKit is available. */
#define HAVE_FRAMEWORK_APPKIT 1
/* Define if framework Carbon is available. */
#define HAVE_FRAMEWORK_CARBON 1
/* Define if framework CoreFoundation is available. */
#define HAVE_FRAMEWORK_COREFOUNDATION 1
/* Define if framework IOKit is available. */
#define HAVE_FRAMEWORK_IOKIT 1
/* Define if framework SDL is available. */
/* #undef HAVE_FRAMEWORK_SDL */
/* Define to 1 if you have the `fwprintf' function. */
#define HAVE_FWPRINTF 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getegid' function. */
#define HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define if the GNU gettext() function is already present or preinstalled. */
/* #undef HAVE_GETTEXT */
/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1
/* Define if libgnomeui is available. */
/* #undef HAVE_GNOMEUI */
/* Define to 1 if you have the <history.h> header file. */
/* #undef HAVE_HISTORY_H */
/* Define if you have the iconv() function. */
#define HAVE_ICONV 1
/* Define to 1 if you have the <ieee754.h> header file. */
/* #undef HAVE_IEEE754_H */
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
#define HAVE_INTMAX_T 1
/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
#define HAVE_INTTYPES_H 1
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
declares uintmax_t. */
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
/* Define to 1 if you have the <IOKit/storage/IOBlockStorageDevice.h> header
file. */
#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDEVICE_H 1
/* Define to 1 if you have the `isinf' function. */
#define HAVE_ISINF 1
/* Define to 1 if you have the `isinfl' function. */
/* #undef HAVE_ISINFL */
/* Define to 1 if you have the `isnan' function. */
#define HAVE_ISNAN 1
/* Define to 1 if you have the `isnanl' function. */
/* #undef HAVE_ISNANL */
/* Define to 1 if you have the `isnormal' function. */
/* #undef HAVE_ISNORMAL */
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#define HAVE_LANGINFO_CODESET 1
/* Define if your <locale.h> file defines LC_MESSAGES. */
#define HAVE_LC_MESSAGES 1
/* Define to 1 if you have the `curses' library (-lcurses). */
/* #undef HAVE_LIBCURSES */
/* Define to 1 if you have the `Hcurses' library (-lHcurses). */
/* #undef HAVE_LIBHCURSES */
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `ncurses' library (-lncurses). */
/* #undef HAVE_LIBNCURSES */
/* Define to 1 if you have the `posix4' library (-lposix4). */
/* #undef HAVE_LIBPOSIX4 */
/* Define to 1 if you have the `readline' library (-lreadline). */
/* #undef HAVE_LIBREADLINE */
/* Define to 1 if you have the `rt' library (-lrt). */
/* #undef HAVE_LIBRT */
/* Define to 1 if you have the `termcap' library (-ltermcap). */
/* #undef HAVE_LIBTERMCAP */
/* Define to 1 if you have the `terminfo' library (-lterminfo). */
/* #undef HAVE_LIBTERMINFO */
/* Define to 1 if you have the `termlib' library (-ltermlib). */
/* #undef HAVE_LIBTERMLIB */
/* Define to 1 if you have the `vhd' library (-lvhd). */
/* #undef HAVE_LIBVHD */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if there is a linker script to relocate the executable above
0x70000000. */
/* #undef HAVE_LINKER_SCRIPT */
/* Define to 1 if you have the <linux/if.h> header file. */
/* #undef HAVE_LINUX_IF_H */
/* Define to 1 if you have the <linux/if_tun.h> header file. */
/* #undef HAVE_LINUX_IF_TUN_H */
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if the system has the type `loff_t'. */
/* #undef HAVE_LOFF_T */
/* Define to 1 if you have the `log10l' function. */
#define HAVE_LOG10L 1
/* Define to 1 if you have the <login.h> header file. */
/* #undef HAVE_LOGIN_H */
/* Define to 1 if you have the `logl' function. */
#define HAVE_LOGL 1
/* Define if you have the 'long double' type. */
#define HAVE_LONG_DOUBLE 1
/* Define if you have the 'long long' type. */
#define HAVE_LONG_LONG 1
/* Define if your system supports Mach exceptions. */
#define HAVE_MACH_EXCEPTIONS 1
/* Define to 1 if you have the <mach/mach.h> header file. */
#define HAVE_MACH_MACH_H 1
/* Define to 1 if you have the `mach_task_self' function. */
#define HAVE_MACH_TASK_SELF 1
/* Define if your system has a working vm_allocate()-based memory allocator.
*/
#define HAVE_MACH_VM 1
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */
/* #undef HAVE_MEMPCPY */
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.
*/
/* #undef HAVE_MMAP_ANON */
/* Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with
MAP_ANONYMOUS works. */
/* #undef HAVE_MMAP_ANONYMOUS */
/* Define if your system has a working mmap()-based memory allocator. */
/* #undef HAVE_MMAP_VM */
/* Define to 1 if you have the `mprotect' function. */
#define HAVE_MPROTECT 1
/* Define to 1 if you have the `munmap' function. */
#define HAVE_MUNMAP 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef HAVE_NAN_H */
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the <net/if_tun.h> header file. */
/* #undef HAVE_NET_IF_TUN_H */
/* Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for
sshpty.c). */
/* #undef HAVE_NEWS4 */
/* Define to 1 if you have the <nl_types.h> header file. */
#define HAVE_NL_TYPES_H 1
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define if your printf() function supports format strings with positions. */
#define HAVE_POSIX_PRINTF 1
/* Define to 1 if you have the `powl' function. */
#define HAVE_POWL 1
/* Define if pthreads are available. */
#define HAVE_PTHREADS 1
/* Define to 1 if you have the `pthread_cancel' function. */
#define HAVE_PTHREAD_CANCEL 1
/* Define to 1 if you have the `pthread_cond_init' function. */
#define HAVE_PTHREAD_COND_INIT 1
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
#define HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1
/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */
#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1
/* Define to 1 if you have the `pthread_mutexattr_settype' function. */
#define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
/* Define to 1 if you have the `pthread_testcancel' function. */
#define HAVE_PTHREAD_TESTCANCEL 1
/* Define to 1 if you have the <pty.h> header file. */
/* #undef HAVE_PTY_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
/* Define to 1 if you have the <readline.h> header file. */
/* #undef HAVE_READLINE_H */
/* Define to 1 if you have the <readline/history.h> header file. */
#define HAVE_READLINE_HISTORY_H 1
/* Define to 1 if you have the <readline/readline.h> header file. */
#define HAVE_READLINE_READLINE_H 1
/* Define to 1 if you have the `sem_init' function. */
#define HAVE_SEM_INIT 1
/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* Define if we know a hack to replace siginfo_t->si_addr member. */
/* #undef HAVE_SIGCONTEXT_SUBTERFUGE */
/* Define if your system supports extended signals. */
/* #undef HAVE_SIGINFO_T */
//#define HAVE_SIGINFO_T 1
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the `signbit' function. */
/* #undef HAVE_SIGNBIT */
/* Define if we can ignore the fault (instruction skipping in SIGSEGV
handler). */
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
/* Define to 1 if you have the `sinhl' function. */
#define HAVE_SINHL 1
/* Define to 1 if you have the `sinl' function. */
#define HAVE_SINL 1
/* Define if slirp library is supported */
#define HAVE_SLIRP 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `sqrtl' function. */
#define HAVE_SQRTL 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
uintmax_t. */
#define HAVE_STDINT_H_WITH_UINTMAX 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */
#define HAVE_STPCPY 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if you have the <sys/bitypes.h> header file. */
/* #undef HAVE_SYS_BITYPES_H */
/* Define to 1 if you have the <sys/bsdtty.h> header file. */
/* #undef HAVE_SYS_BSDTTY_H */
/* Define to 1 if you have the <sys/filio.h> header file. */
#define HAVE_SYS_FILIO_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/stropts.h> header file. */
/* #undef HAVE_SYS_STROPTS_H */
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the `tanhl' function. */
#define HAVE_TANHL 1
/* Define to 1 if you have the `tanl' function. */
#define HAVE_TANL 1
/* Define to 1 if you have the `task_self' function. */
/* #undef HAVE_TASK_SELF */
/* Define to 1 if you have the `timer_create' function. */
/* #undef HAVE_TIMER_CREATE */
/* Define to 1 if you have the `tsearch' function. */
#define HAVE_TSEARCH 1
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
#define HAVE_UINTMAX_T 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the 'unsigned long long' type. */
#define HAVE_UNSIGNED_LONG_LONG 1
/* Define to 1 if you have the <util.h> header file. */
#define HAVE_UTIL_H 1
/* Define to 1 if you have the `vhangup' function. */
/* #undef HAVE_VHANGUP */
/* Define to 1 if you have the `vm_allocate' function. */
#define HAVE_VM_ALLOCATE 1
/* Define to 1 if you have the `vm_deallocate' function. */
#define HAVE_VM_DEALLOCATE 1
/* Define to 1 if you have the `vm_protect' function. */
#define HAVE_VM_PROTECT 1
/* Define if you have the 'wchar_t' type. */
#define HAVE_WCHAR_T 1
/* Define to 1 if you have the `wcslen' function. */
#define HAVE_WCSLEN 1
/* Define if your system supports Windows exceptions. */
/* #undef HAVE_WIN32_EXCEPTIONS */
/* Define if you have the 'wint_t' type. */
#define HAVE_WINT_T 1
/* Define to 1 if you have the `_getpty' function. */
/* #undef HAVE__GETPTY */
/* Define to 1 if you have the `__argz_count' function. */
/* #undef HAVE___ARGZ_COUNT */
/* Define to 1 if you have the `__argz_next' function. */
/* #undef HAVE___ARGZ_NEXT */
/* Define to 1 if you have the `__argz_stringify' function. */
/* #undef HAVE___ARGZ_STRINGIFY */
/* Define to 1 if you have the `__fsetlocking' function. */
/* #undef HAVE___FSETLOCKING */
/* Define to the floating point format of the host machine. */
#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT
/* Define to 1 if the host machine stores floating point numbers in memory
with the word containing the sign bit at the lowest address, or to 0 if it
does it the other way around. This macro should not be defined if the
ordering is the same as for multi-word integers. */
/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST
/* Define if integer division by zero raises signal SIGFPE. */
#define INTDIV0_RAISES_SIGFPE 0
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Define this program name. */
#define PACKAGE "Basilisk II"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "Christian.Bauer@uni-mainz.de"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Basilisk II"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Basilisk II 1.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "BasiliskII"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.0"
/* Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this
system. */
/* #undef PAGEZERO_HACK */
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
/* #undef PRI_MACROS_BROKEN */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define if your system requires sigactions to be reinstalled. */
/* #undef SIGACTION_NEED_REINSTALL */
/* Define if your system requires signals to be reinstalled. */
/* #undef SIGNAL_NEED_REINSTALL */
/* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8
/* The size of `float', as computed by sizeof. */
#define SIZEOF_FLOAT 4
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
/* The size of `long double', as computed by sizeof. */
#ifdef CPU_x86_64
#define SIZEOF_LONG_DOUBLE 16
#else
#define SIZEOF_LONG_DOUBLE 8
#endif
/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8
/* Define as the maximum value of type 'size_t', if the system doesn't define
it. */
/* #undef SIZE_MAX */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define if BSD-style non-blocking I/O is to be used */
/* #undef USE_FIONBIO */
/* Define to enble SDL support */
#define USE_SDL 1
/* Define to enable SDL audio support */
#define USE_SDL_AUDIO 1
/* Define to enable SDL video graphics support */
#define USE_SDL_VIDEO 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Define this program version. */
#define VERSION "1.0"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define as the type of the result of subtracting two pointers, if the system
doesn't define it. */
/* #undef ptrdiff_t */
/* Define to empty if the C compiler doesn't support this keyword. */
/* #undef signed */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to 'int' if <sys/types.h> doesn't define. */
/* #undef socklen_t */
/* Define to unsigned long or unsigned long long if <stdint.h> and
<inttypes.h> don't define. */
/* #undef uintmax_t */
#ifndef CPU_x86_64
#define UPDATE_UAE
#endif
#ifdef UPDATE_UAE
#define DIRECT_ADDRESSING 1
#define CPU_64_BIT
#define USE_INLINING
#ifdef CPU_x86_64
#define FPU_IEEE
#define WINUAE_ARANYM
#else
#define FPU_MPFR
#endif
#else
#define FPU_IEEE
#endif
#if USE_JIT
#define DIRECT_ADDRESSING 1
#define USE_JIT_FPU
#define X86_64_ASSEMBLY
#define OPTIMIZED_FLAGS
#endif
#define ENABLE_MACOSX_ETHERHELPER
#define BINCUE 1
#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 || flag == O_RDWR)) fd = open(rsrc_path, flag | O_CREAT); // for APFS
return fd;
}
@ -418,9 +420,9 @@ void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir)
// No native Finder info, translate file name extension to MacOS type/creator
if (!is_dir) {
int path_len = strlen(path);
size_t path_len = strlen(path);
for (int i=0; e2t_translation[i].ext; i++) {
int ext_len = strlen(e2t_translation[i].ext);
size_t ext_len = strlen(e2t_translation[i].ext);
if (path_len < ext_len)
continue;
if (!strcmp(path + path_len - ext_len, e2t_translation[i].ext)) {
@ -624,11 +626,11 @@ const char *convert_string(const char *str, CFStringEncoding from, CFStringEncod
// Convert from the host OS filename encoding to MacRoman
const char *host_encoding_to_macroman(const char *filename)
{
return convert_string(filename, kCFStringEncodingUTF8, kCFStringEncodingMacRoman);
return convert_string(filename, kCFStringEncodingUTF8, PrefsFindInt32("name_encoding"));
}
// Convert from MacRoman to host OS filename encoding
const char *macroman_to_host_encoding(const char *filename)
{
return convert_string(filename, kCFStringEncodingMacRoman, kCFStringEncodingUTF8);
return convert_string(filename, PrefsFindInt32("name_encoding"), kCFStringEncodingUTF8);
}

View File

@ -176,7 +176,7 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
#endif
VideoQuitFullScreen();
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
QuitEmulator();
@ -550,7 +550,7 @@ static void sigint_handler(...)
extern void m68k_dumpstate(uaecptr *nextpc);
m68k_dumpstate(&nextpc);
VideoQuitFullScreen();
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
QuitEmulator();
}

View File

@ -0,0 +1,135 @@
/*
* 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};
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

@ -256,10 +256,10 @@ void DarwinAddFloppyPrefs(void)
}
// Iterate through each floppy
while ( nextFloppy = IOIteratorNext(allFloppies))
while ((nextFloppy = IOIteratorNext(allFloppies)))
{
char bsdPath[MAXPATHLEN];
long size;
long size = 0;
Boolean gotSize = FALSE;
CFTypeRef sizeAsCFNumber =
IORegistryEntryCreateCFProperty(nextFloppy,
@ -333,7 +333,7 @@ void DarwinAddSerialPrefs(void)
}
// Iterate through each modem
while ( nextModem = IOIteratorNext(allModems))
while ((nextModem = IOIteratorNext(allModems)))
{
char bsdPath[MAXPATHLEN];
CFTypeRef bsdPathAsCFString =
@ -350,8 +350,9 @@ void DarwinAddSerialPrefs(void)
{
D(bug("Modem BSD path: %s\n", bsdPath));
// Note that if there are multiple modems, we only get the last
// Note that if there are multiple modems, we only get the first
PrefsAddString("seriala", bsdPath);
break;
}
else
D(bug("Could not get BSD device path for modem\n"));

View File

@ -0,0 +1,489 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
E4C1B4A32642B05A00EB55A0 /* compemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49A2642B05A00EB55A0 /* compemu.cpp */; };
E4C1B4A42642B05A00EB55A0 /* compstbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */; };
E4C1B4A52642B05A00EB55A0 /* comptbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C1B49C2642B05A00EB55A0 /* comptbl.h */; };
E4C1B4A62642B05A00EB55A0 /* cpuemu_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49D2642B05A00EB55A0 /* cpuemu_nf.cpp */; };
E4C1B4A72642B05A00EB55A0 /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */; };
E4C1B4A82642B05A00EB55A0 /* cpustbl_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */; };
E4C1B4A92642B05A00EB55A0 /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */; };
E4C1B4AA2642B05A00EB55A0 /* cputbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C1B4A12642B05A00EB55A0 /* cputbl.h */; };
E4C1B4AB2642B05A00EB55A0 /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B4A22642B05A00EB55A0 /* defs68k.c */; };
E4F537C92642A8BA008B27DF /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */; };
E4F537CD2642A8C2008B27DF /* cpu_emulation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537CB2642A8C2008B27DF /* cpu_emulation.h */; };
E4F537DB2642A8CC008B27DF /* m68k.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D02642A8CC008B27DF /* m68k.h */; };
E4F537DC2642A8CC008B27DF /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D12642A8CC008B27DF /* memory.cpp */; };
E4F537DD2642A8CC008B27DF /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D22642A8CC008B27DF /* memory.h */; };
E4F537DE2642A8CC008B27DF /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D32642A8CC008B27DF /* newcpu.cpp */; };
E4F537DF2642A8CC008B27DF /* newcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D42642A8CC008B27DF /* newcpu.h */; };
E4F537E02642A8CC008B27DF /* noflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D52642A8CC008B27DF /* noflags.h */; };
E4F537E12642A8CC008B27DF /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D62642A8CC008B27DF /* readcpu.cpp */; };
E4F537E22642A8CC008B27DF /* readcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D72642A8CC008B27DF /* readcpu.h */; };
E4F537E32642A8CC008B27DF /* spcflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D82642A8CC008B27DF /* spcflags.h */; };
E4F537EE2642A8E8008B27DF /* codegen_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537E62642A8E8008B27DF /* codegen_x86.h */; };
E4F537EF2642A8E8008B27DF /* compemu_fpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */; };
E4F537F02642A8E8008B27DF /* compemu_support.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537E82642A8E8008B27DF /* compemu_support.cpp */; };
E4F537F12642A8E8008B27DF /* compemu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537E92642A8E8008B27DF /* compemu.h */; };
E4F537F22642A8E8008B27DF /* flags_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537EA2642A8E8008B27DF /* flags_x86.h */; };
E4F537F32642A8E8008B27DF /* gencomp.c in Sources */ = {isa = PBXBuildFile; fileRef = E4F537EB2642A8E8008B27DF /* gencomp.c */; };
E4F538092642A904008B27DF /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537F62642A904008B27DF /* core.h */; };
E4F5380A2642A904008B27DF /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537F72642A904008B27DF /* exceptions.cpp */; };
E4F5380B2642A904008B27DF /* exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537F82642A904008B27DF /* exceptions.h */; };
E4F5380C2642A904008B27DF /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537F92642A904008B27DF /* flags.cpp */; };
E4F5380D2642A904008B27DF /* flags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537FA2642A904008B27DF /* flags.h */; };
E4F5380E2642A904008B27DF /* fpu_ieee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537FB2642A904008B27DF /* fpu_ieee.cpp */; };
E4F5380F2642A904008B27DF /* fpu_ieee.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537FC2642A904008B27DF /* fpu_ieee.h */; };
E4F538152642A904008B27DF /* fpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538022642A904008B27DF /* fpu.h */; };
E4F538162642A904008B27DF /* impl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538032642A904008B27DF /* impl.h */; };
E4F538172642A904008B27DF /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F538042642A904008B27DF /* mathlib.cpp */; };
E4F538182642A904008B27DF /* mathlib.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538052642A904008B27DF /* mathlib.h */; };
E4F538192642A904008B27DF /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F538062642A904008B27DF /* rounding.cpp */; };
E4F5381A2642A904008B27DF /* rounding.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538072642A904008B27DF /* rounding.h */; };
E4F5381B2642A904008B27DF /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538082642A904008B27DF /* types.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
E4C1B49A2642B05A00EB55A0 /* compemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu.cpp; path = gencpu_output/compemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compstbl.cpp; path = gencpu_output/compstbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B49C2642B05A00EB55A0 /* comptbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = comptbl.h; path = gencpu_output/comptbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B49D2642B05A00EB55A0 /* 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; };
E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl_nf.cpp; path = gencpu_output/cpustbl_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B4A12642B05A00EB55A0 /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
E4C1B4A22642B05A00EB55A0 /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libuae_cpu_x86_64.a; sourceTree = BUILT_PRODUCTS_DIR; };
E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basilisk_glue.cpp; path = ../uae_cpu/basilisk_glue.cpp; sourceTree = "<group>"; };
E4F537CB2642A8C2008B27DF /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpu_emulation.h; path = ../uae_cpu/cpu_emulation.h; sourceTree = "<group>"; };
E4F537D02642A8CC008B27DF /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m68k.h; path = ../uae_cpu/m68k.h; sourceTree = "<group>"; };
E4F537D12642A8CC008B27DF /* memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memory.cpp; path = ../uae_cpu/memory.cpp; sourceTree = "<group>"; };
E4F537D22642A8CC008B27DF /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = memory.h; path = ../uae_cpu/memory.h; sourceTree = "<group>"; };
E4F537D32642A8CC008B27DF /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = newcpu.cpp; path = ../uae_cpu/newcpu.cpp; sourceTree = "<group>"; };
E4F537D42642A8CC008B27DF /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = newcpu.h; path = ../uae_cpu/newcpu.h; sourceTree = "<group>"; };
E4F537D52642A8CC008B27DF /* noflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = noflags.h; path = ../uae_cpu/noflags.h; sourceTree = "<group>"; };
E4F537D62642A8CC008B27DF /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = readcpu.cpp; path = ../uae_cpu/readcpu.cpp; sourceTree = "<group>"; };
E4F537D72642A8CC008B27DF /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = readcpu.h; path = ../uae_cpu/readcpu.h; sourceTree = "<group>"; };
E4F537D82642A8CC008B27DF /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spcflags.h; path = ../uae_cpu/spcflags.h; sourceTree = "<group>"; };
E4F537D92642A8CC008B27DF /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = table68k; path = ../uae_cpu/table68k; sourceTree = "<group>"; };
E4F537E62642A8E8008B27DF /* codegen_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codegen_x86.h; path = ../uae_cpu/compiler/codegen_x86.h; sourceTree = "<group>"; };
E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu_fpp.cpp; path = ../uae_cpu/compiler/compemu_fpp.cpp; sourceTree = "<group>"; };
E4F537E82642A8E8008B27DF /* compemu_support.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu_support.cpp; path = ../uae_cpu/compiler/compemu_support.cpp; sourceTree = "<group>"; };
E4F537E92642A8E8008B27DF /* compemu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compemu.h; path = ../uae_cpu/compiler/compemu.h; sourceTree = "<group>"; };
E4F537EA2642A8E8008B27DF /* flags_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags_x86.h; path = ../uae_cpu/compiler/flags_x86.h; sourceTree = "<group>"; };
E4F537EB2642A8E8008B27DF /* gencomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gencomp.c; path = ../uae_cpu/compiler/gencomp.c; sourceTree = "<group>"; };
E4F537F62642A904008B27DF /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../uae_cpu/fpu/core.h; sourceTree = "<group>"; };
E4F537F72642A904008B27DF /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exceptions.cpp; path = ../uae_cpu/fpu/exceptions.cpp; sourceTree = "<group>"; };
E4F537F82642A904008B27DF /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exceptions.h; path = ../uae_cpu/fpu/exceptions.h; sourceTree = "<group>"; };
E4F537F92642A904008B27DF /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flags.cpp; path = ../uae_cpu/fpu/flags.cpp; sourceTree = "<group>"; };
E4F537FA2642A904008B27DF /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags.h; path = ../uae_cpu/fpu/flags.h; sourceTree = "<group>"; };
E4F537FB2642A904008B27DF /* fpu_ieee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fpu_ieee.cpp; path = ../uae_cpu/fpu/fpu_ieee.cpp; sourceTree = "<group>"; };
E4F537FC2642A904008B27DF /* fpu_ieee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu_ieee.h; path = ../uae_cpu/fpu/fpu_ieee.h; sourceTree = "<group>"; };
E4F538022642A904008B27DF /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu.h; path = ../uae_cpu/fpu/fpu.h; sourceTree = "<group>"; };
E4F538032642A904008B27DF /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = impl.h; path = ../uae_cpu/fpu/impl.h; sourceTree = "<group>"; };
E4F538042642A904008B27DF /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlib.cpp; path = ../uae_cpu/fpu/mathlib.cpp; sourceTree = "<group>"; };
E4F538052642A904008B27DF /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlib.h; path = ../uae_cpu/fpu/mathlib.h; sourceTree = "<group>"; };
E4F538062642A904008B27DF /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rounding.cpp; path = ../uae_cpu/fpu/rounding.cpp; sourceTree = "<group>"; };
E4F538072642A904008B27DF /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rounding.h; path = ../uae_cpu/fpu/rounding.h; sourceTree = "<group>"; };
E4F538082642A904008B27DF /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../uae_cpu/fpu/types.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
E4F537BD2642A86D008B27DF /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
E4C1B4982642AF3400EB55A0 /* generated */ = {
isa = PBXGroup;
children = (
E4C1B49A2642B05A00EB55A0 /* compemu.cpp */,
E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */,
E4C1B49C2642B05A00EB55A0 /* comptbl.h */,
E4C1B49D2642B05A00EB55A0 /* cpuemu_nf.cpp */,
E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */,
E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */,
E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */,
E4C1B4A12642B05A00EB55A0 /* cputbl.h */,
E4C1B4A22642B05A00EB55A0 /* defs68k.c */,
);
name = generated;
sourceTree = "<group>";
};
E4F537B72642A86D008B27DF = {
isa = PBXGroup;
children = (
E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */,
E4F537E42642A8D2008B27DF /* compiler */,
E4F537CB2642A8C2008B27DF /* cpu_emulation.h */,
E4F537F52642A8ED008B27DF /* fpu */,
E4F537D02642A8CC008B27DF /* m68k.h */,
E4F537D12642A8CC008B27DF /* memory.cpp */,
E4F537D22642A8CC008B27DF /* memory.h */,
E4F537D32642A8CC008B27DF /* newcpu.cpp */,
E4F537D42642A8CC008B27DF /* newcpu.h */,
E4F537D52642A8CC008B27DF /* noflags.h */,
E4F537D62642A8CC008B27DF /* readcpu.cpp */,
E4F537D72642A8CC008B27DF /* readcpu.h */,
E4F537D82642A8CC008B27DF /* spcflags.h */,
E4F537D92642A8CC008B27DF /* table68k */,
E4C1B4982642AF3400EB55A0 /* generated */,
E4F537C12642A86D008B27DF /* Products */,
);
sourceTree = "<group>";
};
E4F537C12642A86D008B27DF /* Products */ = {
isa = PBXGroup;
children = (
E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */,
);
name = Products;
sourceTree = "<group>";
};
E4F537E42642A8D2008B27DF /* compiler */ = {
isa = PBXGroup;
children = (
E4F537E62642A8E8008B27DF /* codegen_x86.h */,
E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */,
E4F537E82642A8E8008B27DF /* compemu_support.cpp */,
E4F537E92642A8E8008B27DF /* compemu.h */,
E4F537EA2642A8E8008B27DF /* flags_x86.h */,
E4F537EB2642A8E8008B27DF /* gencomp.c */,
);
name = compiler;
sourceTree = "<group>";
};
E4F537F52642A8ED008B27DF /* fpu */ = {
isa = PBXGroup;
children = (
E4F537F62642A904008B27DF /* core.h */,
E4F537F72642A904008B27DF /* exceptions.cpp */,
E4F537F82642A904008B27DF /* exceptions.h */,
E4F537F92642A904008B27DF /* flags.cpp */,
E4F537FA2642A904008B27DF /* flags.h */,
E4F537FB2642A904008B27DF /* fpu_ieee.cpp */,
E4F537FC2642A904008B27DF /* fpu_ieee.h */,
E4F538022642A904008B27DF /* fpu.h */,
E4F538032642A904008B27DF /* impl.h */,
E4F538042642A904008B27DF /* mathlib.cpp */,
E4F538052642A904008B27DF /* mathlib.h */,
E4F538062642A904008B27DF /* rounding.cpp */,
E4F538072642A904008B27DF /* rounding.h */,
E4F538082642A904008B27DF /* types.h */,
);
name = fpu;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
E4F537BE2642A86D008B27DF /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
E4F538182642A904008B27DF /* mathlib.h in Headers */,
E4F538152642A904008B27DF /* fpu.h in Headers */,
E4F5380F2642A904008B27DF /* fpu_ieee.h in Headers */,
E4F537F12642A8E8008B27DF /* compemu.h in Headers */,
E4F538092642A904008B27DF /* core.h in Headers */,
E4C1B4AA2642B05A00EB55A0 /* cputbl.h in Headers */,
E4F5381B2642A904008B27DF /* types.h in Headers */,
E4F537DF2642A8CC008B27DF /* newcpu.h in Headers */,
E4F5380D2642A904008B27DF /* flags.h in Headers */,
E4F537E22642A8CC008B27DF /* readcpu.h in Headers */,
E4F5381A2642A904008B27DF /* rounding.h in Headers */,
E4C1B4A52642B05A00EB55A0 /* comptbl.h in Headers */,
E4F5380B2642A904008B27DF /* exceptions.h in Headers */,
E4F537E32642A8CC008B27DF /* spcflags.h in Headers */,
E4F537DB2642A8CC008B27DF /* m68k.h in Headers */,
E4F537F22642A8E8008B27DF /* flags_x86.h in Headers */,
E4F538162642A904008B27DF /* impl.h in Headers */,
E4F537CD2642A8C2008B27DF /* cpu_emulation.h in Headers */,
E4F537EE2642A8E8008B27DF /* codegen_x86.h in Headers */,
E4F537DD2642A8CC008B27DF /* memory.h in Headers */,
E4F537E02642A8CC008B27DF /* noflags.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
E4F537BF2642A86D008B27DF /* uae_cpu_x86_64 */ = {
isa = PBXNativeTarget;
buildConfigurationList = E4F537C42642A86D008B27DF /* Build configuration list for PBXNativeTarget "uae_cpu_x86_64" */;
buildPhases = (
E4C1B4992642AF5100EB55A0 /* ShellScript */,
E4F537BC2642A86D008B27DF /* Sources */,
E4F537BD2642A86D008B27DF /* Frameworks */,
E4F537BE2642A86D008B27DF /* Headers */,
);
buildRules = (
);
dependencies = (
);
name = uae_cpu_x86_64;
productName = uae_cpu;
productReference = E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
E4F537B82642A86D008B27DF /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
TargetAttributes = {
E4F537BF2642A86D008B27DF = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = E4F537BB2642A86D008B27DF /* Build configuration list for PBXProject "uae_cpu" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = E4F537B72642A86D008B27DF;
productRefGroup = E4F537C12642A86D008B27DF /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
E4F537BF2642A86D008B27DF /* uae_cpu_x86_64 */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
E4C1B4992642AF5100EB55A0 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
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,
$BUILT_PRODUCTS_DIR/gencpu_output/compemu.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/compstbl.cpp,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -f Makefile.gencpu\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E4F537BC2642A86D008B27DF /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E4C1B4A62642B05A00EB55A0 /* cpuemu_nf.cpp in Sources */,
E4C1B4A32642B05A00EB55A0 /* compemu.cpp in Sources */,
E4F538192642A904008B27DF /* rounding.cpp in Sources */,
E4F537E12642A8CC008B27DF /* readcpu.cpp in Sources */,
E4F5380C2642A904008B27DF /* flags.cpp in Sources */,
E4F537EF2642A8E8008B27DF /* compemu_fpp.cpp in Sources */,
E4F538172642A904008B27DF /* mathlib.cpp in Sources */,
E4F537F02642A8E8008B27DF /* compemu_support.cpp in Sources */,
E4F537DC2642A8CC008B27DF /* memory.cpp in Sources */,
E4C1B4A42642B05A00EB55A0 /* compstbl.cpp in Sources */,
E4C1B4AB2642B05A00EB55A0 /* defs68k.c in Sources */,
E4C1B4A92642B05A00EB55A0 /* cpustbl.cpp in Sources */,
E4F537C92642A8BA008B27DF /* basilisk_glue.cpp in Sources */,
E4F537F32642A8E8008B27DF /* gencomp.c in Sources */,
E4F5380E2642A904008B27DF /* fpu_ieee.cpp in Sources */,
E4C1B4A72642B05A00EB55A0 /* cpuemu.cpp in Sources */,
E4C1B4A82642B05A00EB55A0 /* cpustbl_nf.cpp in Sources */,
E4F537DE2642A8CC008B27DF /* newcpu.cpp in Sources */,
E4F5380A2642A904008B27DF /* exceptions.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
E4F537C22642A86D008B27DF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
E4F537C32642A86D008B27DF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
E4F537C52642A86D008B27DF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"USE_XCODE=1",
CPU_x86_64,
JIT,
"USE_JIT=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_UNUSED_VARIABLE = NO;
HEADER_SEARCH_PATHS = (
../CrossPlatform,
../include,
../MacOSX,
../uae_cpu,
../Unix,
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_CFLAGS = "-fwrapv";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
E4F537C62642A86D008B27DF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"USE_XCODE=1",
CPU_x86_64,
JIT,
"USE_JIT=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_UNUSED_VARIABLE = NO;
HEADER_SEARCH_PATHS = (
../CrossPlatform,
../include,
../MacOSX,
../uae_cpu,
../Unix,
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_CFLAGS = "-fwrapv";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
E4F537BB2642A86D008B27DF /* Build configuration list for PBXProject "uae_cpu" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E4F537C22642A86D008B27DF /* Debug */,
E4F537C32642A86D008B27DF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E4F537C42642A86D008B27DF /* Build configuration list for PBXNativeTarget "uae_cpu_x86_64" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E4F537C52642A86D008B27DF /* Debug */,
E4F537C62642A86D008B27DF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E4F537B82642A86D008B27DF /* Project object */;
}

View File

@ -0,0 +1,429 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
E41D7AAA2642C070005E8093 /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AA82642C070005E8093 /* basilisk_glue.cpp */; };
E41D7AAE2642C07C005E8093 /* cpu_emulation.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AAC2642C07C005E8093 /* cpu_emulation.h */; };
E41D7AAF2642C07C005E8093 /* cpummu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AAD2642C07C005E8093 /* cpummu.h */; };
E41D7ABB2642C087005E8093 /* m68k.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB12642C087005E8093 /* m68k.h */; };
E41D7ABC2642C087005E8093 /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB22642C087005E8093 /* memory.h */; };
E41D7ABD2642C087005E8093 /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AB32642C087005E8093 /* newcpu.cpp */; };
E41D7ABE2642C087005E8093 /* newcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB42642C087005E8093 /* newcpu.h */; };
E41D7ABF2642C087005E8093 /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AB52642C087005E8093 /* readcpu.cpp */; };
E41D7AC02642C087005E8093 /* readcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB62642C087005E8093 /* readcpu.h */; };
E41D7AC12642C087005E8093 /* registers.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB72642C087005E8093 /* registers.h */; };
E41D7AC22642C087005E8093 /* spcflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB82642C087005E8093 /* spcflags.h */; };
E41D7AD82642C0A4005E8093 /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC42642C0A4005E8093 /* core.h */; };
E41D7AD92642C0A4005E8093 /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AC52642C0A4005E8093 /* exceptions.cpp */; };
E41D7ADA2642C0A4005E8093 /* exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC62642C0A4005E8093 /* exceptions.h */; };
E41D7ADB2642C0A4005E8093 /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AC72642C0A4005E8093 /* flags.cpp */; };
E41D7ADC2642C0A4005E8093 /* flags.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC82642C0A4005E8093 /* flags.h */; };
E41D7ADF2642C0A4005E8093 /* fpu_mpfr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */; };
E41D7AE52642C0A4005E8093 /* fpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD12642C0A4005E8093 /* fpu.h */; };
E41D7AE62642C0A4005E8093 /* impl.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD22642C0A4005E8093 /* impl.h */; };
E41D7AE72642C0A4005E8093 /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AD32642C0A4005E8093 /* mathlib.cpp */; };
E41D7AE82642C0A4005E8093 /* mathlib.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD42642C0A4005E8093 /* mathlib.h */; };
E41D7AE92642C0A4005E8093 /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AD52642C0A4005E8093 /* rounding.cpp */; };
E41D7AEA2642C0A4005E8093 /* rounding.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD62642C0A4005E8093 /* rounding.h */; };
E41D7AEB2642C0A4005E8093 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD72642C0A4005E8093 /* types.h */; };
E4FC27512642C45E00C64E21 /* cpufunctbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */; };
E4FC27522642C45E00C64E21 /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274D2642C45E00C64E21 /* cpuemu.cpp */; };
E4FC27532642C45E00C64E21 /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274E2642C45E00C64E21 /* cpustbl.cpp */; };
E4FC27542642C45E00C64E21 /* cputbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4FC274F2642C45E00C64E21 /* cputbl.h */; };
E4FC27552642C45E00C64E21 /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E4FC27502642C45E00C64E21 /* defs68k.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libuae_cpu_arm64.a; sourceTree = BUILT_PRODUCTS_DIR; };
E41D7AA82642C070005E8093 /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basilisk_glue.cpp; path = ../uae_cpu_2021/basilisk_glue.cpp; sourceTree = "<group>"; };
E41D7AAC2642C07C005E8093 /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpu_emulation.h; path = ../uae_cpu_2021/cpu_emulation.h; sourceTree = "<group>"; };
E41D7AAD2642C07C005E8093 /* cpummu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpummu.h; path = ../uae_cpu_2021/cpummu.h; sourceTree = "<group>"; };
E41D7AB12642C087005E8093 /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m68k.h; path = ../uae_cpu_2021/m68k.h; sourceTree = "<group>"; };
E41D7AB22642C087005E8093 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = memory.h; path = ../uae_cpu_2021/memory.h; sourceTree = "<group>"; };
E41D7AB32642C087005E8093 /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = newcpu.cpp; path = ../uae_cpu_2021/newcpu.cpp; sourceTree = "<group>"; };
E41D7AB42642C087005E8093 /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = newcpu.h; path = ../uae_cpu_2021/newcpu.h; sourceTree = "<group>"; };
E41D7AB52642C087005E8093 /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = readcpu.cpp; path = ../uae_cpu_2021/readcpu.cpp; sourceTree = "<group>"; };
E41D7AB62642C087005E8093 /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = readcpu.h; path = ../uae_cpu_2021/readcpu.h; sourceTree = "<group>"; };
E41D7AB72642C087005E8093 /* registers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = registers.h; path = ../uae_cpu_2021/registers.h; sourceTree = "<group>"; };
E41D7AB82642C087005E8093 /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spcflags.h; path = ../uae_cpu_2021/spcflags.h; sourceTree = "<group>"; };
E41D7AB92642C087005E8093 /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = table68k; path = ../uae_cpu_2021/table68k; sourceTree = "<group>"; };
E41D7AC42642C0A4005E8093 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../uae_cpu_2021/fpu/core.h; sourceTree = "<group>"; };
E41D7AC52642C0A4005E8093 /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exceptions.cpp; path = ../uae_cpu_2021/fpu/exceptions.cpp; sourceTree = "<group>"; };
E41D7AC62642C0A4005E8093 /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exceptions.h; path = ../uae_cpu_2021/fpu/exceptions.h; sourceTree = "<group>"; };
E41D7AC72642C0A4005E8093 /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flags.cpp; path = ../uae_cpu_2021/fpu/flags.cpp; sourceTree = "<group>"; };
E41D7AC82642C0A4005E8093 /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags.h; path = ../uae_cpu_2021/fpu/flags.h; sourceTree = "<group>"; };
E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fpu_mpfr.cpp; path = ../uae_cpu_2021/fpu/fpu_mpfr.cpp; sourceTree = "<group>"; };
E41D7AD12642C0A4005E8093 /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu.h; path = ../uae_cpu_2021/fpu/fpu.h; sourceTree = "<group>"; };
E41D7AD22642C0A4005E8093 /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = impl.h; path = ../uae_cpu_2021/fpu/impl.h; sourceTree = "<group>"; };
E41D7AD32642C0A4005E8093 /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlib.cpp; path = ../uae_cpu_2021/fpu/mathlib.cpp; sourceTree = "<group>"; };
E41D7AD42642C0A4005E8093 /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlib.h; path = ../uae_cpu_2021/fpu/mathlib.h; sourceTree = "<group>"; };
E41D7AD52642C0A4005E8093 /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rounding.cpp; path = ../uae_cpu_2021/fpu/rounding.cpp; sourceTree = "<group>"; };
E41D7AD62642C0A4005E8093 /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rounding.h; path = ../uae_cpu_2021/fpu/rounding.h; sourceTree = "<group>"; };
E41D7AD72642C0A4005E8093 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../uae_cpu_2021/fpu/types.h; sourceTree = "<group>"; };
E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpufunctbl.cpp; path = gencpu_output_2021/cpufunctbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4FC274D2642C45E00C64E21 /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output_2021/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4FC274E2642C45E00C64E21 /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output_2021/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4FC274F2642C45E00C64E21 /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output_2021/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
E4FC27502642C45E00C64E21 /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output_2021/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
E41D7A9E2642C004005E8093 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
E41D7A982642C004005E8093 = {
isa = PBXGroup;
children = (
E41D7AA82642C070005E8093 /* basilisk_glue.cpp */,
E41D7AC32642C08E005E8093 /* fpu */,
E41D7AAC2642C07C005E8093 /* cpu_emulation.h */,
E41D7AAD2642C07C005E8093 /* cpummu.h */,
E41D7AB12642C087005E8093 /* m68k.h */,
E41D7AB22642C087005E8093 /* memory.h */,
E41D7AB32642C087005E8093 /* newcpu.cpp */,
E41D7AB42642C087005E8093 /* newcpu.h */,
E41D7AB52642C087005E8093 /* readcpu.cpp */,
E41D7AB62642C087005E8093 /* readcpu.h */,
E41D7AB72642C087005E8093 /* registers.h */,
E41D7AB82642C087005E8093 /* spcflags.h */,
E41D7AB92642C087005E8093 /* table68k */,
E4FC274B2642C44A00C64E21 /* generated */,
E41D7AA22642C004005E8093 /* Products */,
);
sourceTree = "<group>";
};
E41D7AA22642C004005E8093 /* Products */ = {
isa = PBXGroup;
children = (
E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */,
);
name = Products;
sourceTree = "<group>";
};
E41D7AC32642C08E005E8093 /* fpu */ = {
isa = PBXGroup;
children = (
E41D7AC42642C0A4005E8093 /* core.h */,
E41D7AC52642C0A4005E8093 /* exceptions.cpp */,
E41D7AC62642C0A4005E8093 /* exceptions.h */,
E41D7AC72642C0A4005E8093 /* flags.cpp */,
E41D7AC82642C0A4005E8093 /* flags.h */,
E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */,
E41D7AD12642C0A4005E8093 /* fpu.h */,
E41D7AD22642C0A4005E8093 /* impl.h */,
E41D7AD32642C0A4005E8093 /* mathlib.cpp */,
E41D7AD42642C0A4005E8093 /* mathlib.h */,
E41D7AD52642C0A4005E8093 /* rounding.cpp */,
E41D7AD62642C0A4005E8093 /* rounding.h */,
E41D7AD72642C0A4005E8093 /* types.h */,
);
name = fpu;
sourceTree = "<group>";
};
E4FC274B2642C44A00C64E21 /* generated */ = {
isa = PBXGroup;
children = (
E4FC274D2642C45E00C64E21 /* cpuemu.cpp */,
E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */,
E4FC274E2642C45E00C64E21 /* cpustbl.cpp */,
E4FC274F2642C45E00C64E21 /* cputbl.h */,
E4FC27502642C45E00C64E21 /* defs68k.c */,
);
path = generated;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
E41D7A9F2642C004005E8093 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
E41D7AE82642C0A4005E8093 /* mathlib.h in Headers */,
E41D7ADA2642C0A4005E8093 /* exceptions.h in Headers */,
E41D7ABB2642C087005E8093 /* m68k.h in Headers */,
E41D7AC02642C087005E8093 /* readcpu.h in Headers */,
E41D7AEA2642C0A4005E8093 /* rounding.h in Headers */,
E41D7AAE2642C07C005E8093 /* cpu_emulation.h in Headers */,
E41D7AC22642C087005E8093 /* spcflags.h in Headers */,
E41D7AE52642C0A4005E8093 /* fpu.h in Headers */,
E41D7AAF2642C07C005E8093 /* cpummu.h in Headers */,
E41D7AC12642C087005E8093 /* registers.h in Headers */,
E41D7AD82642C0A4005E8093 /* core.h in Headers */,
E4FC27542642C45E00C64E21 /* cputbl.h in Headers */,
E41D7ABE2642C087005E8093 /* newcpu.h in Headers */,
E41D7AE62642C0A4005E8093 /* impl.h in Headers */,
E41D7ABC2642C087005E8093 /* memory.h in Headers */,
E41D7AEB2642C0A4005E8093 /* types.h in Headers */,
E41D7ADC2642C0A4005E8093 /* flags.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
E41D7AA02642C004005E8093 /* uae_cpu_arm64 */ = {
isa = PBXNativeTarget;
buildConfigurationList = E41D7AA52642C004005E8093 /* Build configuration list for PBXNativeTarget "uae_cpu_arm64" */;
buildPhases = (
E4FC27492642C2E600C64E21 /* ShellScript */,
E41D7A9D2642C004005E8093 /* Sources */,
E41D7A9E2642C004005E8093 /* Frameworks */,
E41D7A9F2642C004005E8093 /* Headers */,
);
buildRules = (
);
dependencies = (
);
name = uae_cpu_arm64;
productName = uae_cpu_2021;
productReference = E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
E41D7A992642C004005E8093 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
TargetAttributes = {
E41D7AA02642C004005E8093 = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = E41D7A9C2642C004005E8093 /* Build configuration list for PBXProject "uae_cpu_2021" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = E41D7A982642C004005E8093;
productRefGroup = E41D7AA22642C004005E8093 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
E41D7AA02642C004005E8093 /* uae_cpu_arm64 */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
E4FC27492642C2E600C64E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpuemu.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpufunctbl.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpustbl.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cputbl.h,
$BUILT_PRODUCTS_DIR/gencpu_output_2021/defs68k.c,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make -f Makefile.gencpu_2021\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E41D7A9D2642C004005E8093 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E4FC27512642C45E00C64E21 /* cpufunctbl.cpp in Sources */,
E41D7ADB2642C0A4005E8093 /* flags.cpp in Sources */,
E41D7ADF2642C0A4005E8093 /* fpu_mpfr.cpp in Sources */,
E41D7ABD2642C087005E8093 /* newcpu.cpp in Sources */,
E4FC27552642C45E00C64E21 /* defs68k.c in Sources */,
E41D7AE72642C0A4005E8093 /* mathlib.cpp in Sources */,
E4FC27522642C45E00C64E21 /* cpuemu.cpp in Sources */,
E4FC27532642C45E00C64E21 /* cpustbl.cpp in Sources */,
E41D7AD92642C0A4005E8093 /* exceptions.cpp in Sources */,
E41D7AAA2642C070005E8093 /* basilisk_glue.cpp in Sources */,
E41D7ABF2642C087005E8093 /* readcpu.cpp in Sources */,
E41D7AE92642C0A4005E8093 /* rounding.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
E41D7AA32642C004005E8093 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
E41D7AA42642C004005E8093 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
E41D7AA62642C004005E8093 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"USE_XCODE=1",
);
HEADER_SEARCH_PATHS = (
/usr/local/include,
../CrossPlatform,
../include,
../MacOSX,
../uae_cpu_2021,
../Unix,
);
OTHER_CFLAGS = "-fwrapv";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = arm64;
};
name = Debug;
};
E41D7AA72642C004005E8093 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = "USE_XCODE=1";
HEADER_SEARCH_PATHS = (
/usr/local/include,
../CrossPlatform,
../include,
../MacOSX,
../uae_cpu_2021,
../Unix,
);
OTHER_CFLAGS = "-fwrapv";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = arm64;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
E41D7A9C2642C004005E8093 /* Build configuration list for PBXProject "uae_cpu_2021" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E41D7AA32642C004005E8093 /* Debug */,
E41D7AA42642C004005E8093 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E41D7AA52642C004005E8093 /* Build configuration list for PBXNativeTarget "uae_cpu_arm64" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E41D7AA62642C004005E8093 /* Debug */,
E41D7AA72642C004005E8093 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E41D7A992642C004005E8093 /* Project object */;
}

View File

@ -24,4 +24,17 @@
// Invokes the specified function with an NSAutoReleasePool in place.
void NSAutoReleasePool_wrap(void (*fn)(void));
#ifdef USE_SDL
#if SDL_VERSION_ATLEAST(2,0,0)
void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
bool is_fullscreen_osx(SDL_Window * window);
#endif
#endif
void set_menu_bar_visible_osx(bool visible);
void set_current_directory();
bool MetalIsAvailable();
#endif

View File

@ -19,8 +19,17 @@
*/
#include <Cocoa/Cocoa.h>
#include "sysdeps.h"
#include <SDL.h>
#include "utils_macosx.h"
#if SDL_VERSION_ATLEAST(2,0,0)
#include <SDL_syswm.h>
#endif
#include <sys/sysctl.h>
#include <Metal/Metal.h>
// This is used from video_sdl.cpp.
void NSAutoReleasePool_wrap(void (*fn)(void))
{
@ -28,3 +37,64 @@ void NSAutoReleasePool_wrap(void (*fn)(void))
fn();
[pool release];
}
#if SDL_VERSION_ATLEAST(2,0,0)
void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() {
for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) {
if (menu_item.hasSubmenu) {
for (NSMenuItem * sub_item in menu_item.submenu.itemArray) {
sub_item.keyEquivalent = @"";
sub_item.keyEquivalentModifierMask = 0;
}
}
if ([menu_item.title isEqualToString:@"View"]) {
[[NSApp mainMenu] removeItem:menu_item];
break;
}
}
}
bool is_fullscreen_osx(SDL_Window * window)
{
if (!window) {
return false;
}
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_PropertiesID props = SDL_GetWindowProperties(window);
NSWindow *nswindow = (NSWindow *)SDL_GetProperty(props, "SDL.window.cocoa.window", NULL);
#else
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
NSWindow *nswindow = SDL_GetWindowWMInfo(window, &wmInfo) ? wmInfo.info.cocoa.window : nil;
#endif
const NSWindowStyleMask styleMask = [nswindow styleMask];
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
}
#endif
void set_menu_bar_visible_osx(bool visible)
{
[NSMenu setMenuBarVisible:(visible ? YES : NO)];
}
void set_current_directory()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
chdir([[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] UTF8String]);
[pool release];
}
bool MetalIsAvailable() {
const int EL_CAPITAN = 15; // Darwin major version of El Capitan
char s[16];
size_t size = sizeof(s);
int v;
if (sysctlbyname("kern.osrelease", s, &size, NULL, 0) || sscanf(s, "%d", &v) != 1 || v < EL_CAPITAN) return false;
id<MTLDevice> dev = MTLCreateSystemDefaultDevice();
bool r = dev != nil;
[dev release];
return r;
}

View File

@ -22,16 +22,6 @@
#import <video.h>
/* Set the strategy for drawing the bitmap in the Mac OS X window */
//#define CGDRAWBITMAP
#if defined __i386__
#define CGIMAGEREF
//#define NSBITMAP
#else
#define CGIMAGEREF
//#define NSBITMAP
#endif
// Using Core Graphics is fastest when rendering 32bit data.
// Using CGImageRefs allows us to use all the bitmaps that BasiliskII supports.
// When both Basilisk II and OS X are set to 'Thousands', updating a 312x342

View File

@ -371,16 +371,11 @@ class OSX_monitor : public monitor_desc
bool init_window(const video_mode &mode);
#ifdef CGIMAGEREF
CGColorSpaceRef colourSpace;
uint8 *colourTable;
CGImageRef imageRef;
CGDataProviderRef provider;
short x, y, bpp, depth, bpr;
#endif
#ifdef NSBITMAP
NSBitmapImageRep *bitmap;
#endif
void *the_buffer;
@ -397,24 +392,17 @@ OSX_monitor :: OSX_monitor (const vector<video_mode> &available_modes,
uint32 default_id)
: monitor_desc (available_modes, default_depth, default_id)
{
#ifdef CGIMAGEREF
colourSpace = nil;
colourTable = (uint8 *) malloc(256 * 3);
imageRef = nil;
provider = nil;
#endif
#ifdef NSBITMAP
bitmap = nil;
#endif
newMode = originalMode = nil;
the_buffer = NULL;
theDisplay = nil;
};
// Should also have a destructor which does
//#ifdef CGIMAGEREF
// free(colourTable);
//#endif
// Set Mac frame layout and base address (uses the_buffer/MacFrameBaseMac)
@ -422,17 +410,10 @@ void
OSX_monitor::set_mac_frame_buffer(const video_mode mode)
{
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
switch ( mode.depth )
{
// case VDEPTH_15BIT:
case VDEPTH_16BIT: MacFrameLayout = FLAYOUT_HOST_555; break;
// case VDEPTH_24BIT:
case VDEPTH_32BIT: MacFrameLayout = FLAYOUT_HOST_888; break;
default : MacFrameLayout = FLAYOUT_DIRECT;
}
set_mac_frame_base(MacFrameBaseMac);
// Set variables used by UAE memory banking
MacFrameLayout = FLAYOUT_DIRECT;
MacFrameBaseHost = (uint8 *) the_buffer;
MacFrameSize = mode.bytes_per_row * mode.y;
InitFrameBufferMapping();
@ -508,7 +489,6 @@ OSX_monitor::init_window(const video_mode &mode)
unsigned char *offsetBuffer = (unsigned char *) the_buffer;
offsetBuffer += 1; // OS X NSBitmaps are RGBA, but Basilisk generates ARGB
#ifdef CGIMAGEREF
switch ( mode.depth )
{
case VDEPTH_1BIT: bpp = 1; break;
@ -578,61 +558,6 @@ OSX_monitor::init_window(const video_mode &mode)
// CGDataProviderRef provider, const float decode[], bool shouldInterpolate);
#endif
return true;
#endif
#ifndef CGIMAGEREF
short bitsPer, samplesPer; // How big is each Pixel?
if ( mode.depth == VDEPTH_1BIT )
bitsPer = 1;
else
bitsPer = 8;
if ( mode.depth == VDEPTH_32BIT )
samplesPer = 3;
else
samplesPer = 1;
#endif
#ifdef NSBITMAP
bitmap = [NSBitmapImageRep alloc];
bitmap = [bitmap initWithBitmapDataPlanes: (unsigned char **) &offsetBuffer
pixelsWide: mode.x
pixelsHigh: mode.y
bitsPerSample: bitsPer
samplesPerPixel: samplesPer
hasAlpha: NO
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: mode.bytes_per_row
bitsPerPixel: bits_from_depth(mode.depth)];
if ( ! bitmap )
{
ErrorAlert("Could not allocate an NSBitmapImageRep");
return false;
}
[output readyToDraw: bitmap
imageWidth: mode.x
imageHeight: mode.y];
#endif
#ifdef CGDRAWBITMAP
[output readyToDraw: offsetBuffer
width: mode.x
height: mode.y
bps: bitsPer
spp: samplesPer
bpp: bits_from_depth(mode.depth)
bpr: mode.bytes_per_row
isPlanar: NO
hasAlpha: NO];
#endif
return true;
}
@ -787,13 +712,11 @@ bool VideoInit(bool classic)
case DISPLAY_OPENGL:
// Same as window depths and sizes?
case DISPLAY_WINDOW:
#ifdef CGIMAGEREF
add_standard_modes(VDEPTH_1BIT);
add_standard_modes(VDEPTH_2BIT);
add_standard_modes(VDEPTH_4BIT);
add_standard_modes(VDEPTH_8BIT);
add_standard_modes(VDEPTH_16BIT);
#endif
add_standard_modes(VDEPTH_32BIT);
break;
}
@ -866,14 +789,9 @@ OSX_monitor::video_close()
[output disableDrawing];
// Free frame buffer stuff
#ifdef CGIMAGEREF
CGImageRelease(imageRef);
CGColorSpaceRelease(colourSpace);
CGDataProviderRelease(provider);
#endif
#ifdef NSBITMAP
[bitmap release];
#endif
free(the_buffer);
break;
@ -936,7 +854,6 @@ OSX_monitor::set_palette(uint8 *pal, int num)
CGPaletteRelease(CGpal);
}
#ifdef CGIMAGEREF
if ( display_type != DISPLAY_WINDOW )
return;
@ -988,7 +905,6 @@ OSX_monitor::set_palette(uint8 *pal, int num)
CGColorSpaceRelease(oldColourSpace);
CGImageRelease(oldImageRef);
#endif
}
@ -1035,7 +951,6 @@ OSX_monitor::switch_to_current_mode(void)
failure = "Could not get base address of screen";
}
#ifdef CGIMAGEREF
// Clean up the old CGImageRef stuff
else if ( display_type == DISPLAY_WINDOW && imageRef )
{
@ -1054,7 +969,6 @@ OSX_monitor::switch_to_current_mode(void)
else
failure = "Could not video_open() requested mode";
}
#endif
else if ( ! video_open(mode) )
failure = "Could not video_open() requested mode";

View File

@ -6,6 +6,8 @@
*/
#include "SDL.h"
#if (SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)) // SDLMain.m is not needed in SDL 2.x
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
@ -379,3 +381,4 @@ int main (int argc, char **argv)
return 0;
}
#endif // ends: SDL version check

View File

@ -28,12 +28,16 @@
#include <SDL_mutex.h>
#include <SDL_audio.h>
#include <SDL_version.h>
#include <SDL_timer.h>
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define DEBUG 0
#include "debug.h"
#if defined(BINCUE)
#include "bincue_unix.h"
#include "bincue.h"
#endif
@ -48,11 +52,14 @@ static int audio_channel_count_index = 0;
static SDL_sem *audio_irq_done_sem = NULL; // Signal from interrupt to streaming thread: data block read
static uint8 silence_byte; // Byte value to use to fill sound buffers with silence
static uint8 *audio_mix_buf = NULL;
static int audio_volume = SDL_MIX_MAXVOLUME;
static bool audio_mute = false;
static int main_volume = MAC_MAX_VOLUME;
static int speaker_volume = MAC_MAX_VOLUME;
static bool main_mute = false;
static bool speaker_mute = false;
// Prototypes
static void stream_func(void *arg, uint8 *stream, int stream_len);
static int get_audio_volume();
/*
@ -87,10 +94,11 @@ static bool open_sdl_audio(void)
}
SDL_AudioSpec audio_spec;
memset(&audio_spec, 0, sizeof(audio_spec));
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? AUDIO_U8 : AUDIO_S16MSB;
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
audio_spec.samples = 4096;
audio_spec.samples = 4096 >> PrefsFindInt32("sound_buffer");
audio_spec.callback = stream_func;
audio_spec.userdata = NULL;
@ -99,14 +107,27 @@ static bool open_sdl_audio(void)
fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError());
return false;
}
#if SDL_VERSION_ATLEAST(2,0,0)
// HACK: workaround a bug in SDL pre-2.0.6 (reported via https://bugzilla.libsdl.org/show_bug.cgi?id=3710 )
// whereby SDL does not update audio_spec.size
if (audio_spec.size == 0) {
audio_spec.size = (SDL_AUDIO_BITSIZE(audio_spec.format) / 8) * audio_spec.channels * audio_spec.samples;
}
#endif
#if defined(BINCUE)
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels,
audio_spec.silence);
audio_spec.silence, get_audio_volume());
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
const char * driver_name = SDL_GetCurrentAudioDriver();
#else
char driver_name[32];
printf("Using SDL/%s audio output\n", SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1));
SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1);
#endif
printf("Using SDL/%s audio output\n", driver_name ? driver_name : "");
silence_byte = audio_spec.silence;
SDL_PauseAudio(0);
@ -213,7 +234,7 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
// Get size of audio data
uint32 apple_stream_info = ReadMacInt32(audio_data + adatStreamInfo);
if (apple_stream_info && !audio_mute) {
if (apple_stream_info && !main_mute && !speaker_mute) {
int work_size = ReadMacInt32(apple_stream_info + scd_sampleCount) * (AudioStatus.sample_size >> 3) * AudioStatus.channels;
D(bug("stream: work_size %d\n", work_size));
if (work_size > stream_len)
@ -224,7 +245,7 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
// Send data to audio device
Mac2Host_memcpy(audio_mix_buf, ReadMacInt32(apple_stream_info + scd_buffer), work_size);
memset((uint8 *)stream, silence_byte, stream_len);
SDL_MixAudio(stream, audio_mix_buf, work_size, audio_volume);
SDL_MixAudio(stream, audio_mix_buf, work_size, get_audio_volume());
D(bug("stream: data written\n"));
@ -234,11 +255,13 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
} else {
// Audio not active, play silence
silence: memset(stream, silence_byte, stream_len);
silence: memset(stream, silence_byte, stream_len);
}
#if defined(BINCUE)
MixAudio_bincue(stream, stream_len);
MixAudio_bincue(stream, stream_len, get_audio_volume());
#endif
}
@ -302,43 +325,84 @@ bool audio_set_channels(int index)
bool audio_get_main_mute(void)
{
return audio_mute;
return main_mute;
}
uint32 audio_get_main_volume(void)
{
uint32 chan = (audio_volume * MAC_MAX_VOLUME / SDL_MIX_MAXVOLUME);
uint32 chan = main_volume;
return (chan << 16) + chan;
}
bool audio_get_speaker_mute(void)
{
return audio_mute;
return speaker_mute;
}
uint32 audio_get_speaker_volume(void)
{
return audio_get_main_volume();
uint32 chan = speaker_volume;
return (chan << 16) + chan;
}
void audio_set_main_mute(bool mute)
{
audio_mute = mute;
main_mute = mute;
}
void audio_set_main_volume(uint32 vol)
{
// We only have one-channel volume right now.
uint32 avg = ((vol >> 16) + (vol & 0xffff)) / 2;
if (avg > MAC_MAX_VOLUME)
avg = MAC_MAX_VOLUME;
audio_volume = avg * SDL_MIX_MAXVOLUME / MAC_MAX_VOLUME;
main_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
if (main_volume > MAC_MAX_VOLUME)
main_volume = MAC_MAX_VOLUME;
}
void audio_set_speaker_mute(bool mute)
{
speaker_mute = mute;
}
void audio_set_speaker_volume(uint32 vol)
{
// We only have one-channel volume right now.
speaker_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
if (speaker_volume > MAC_MAX_VOLUME)
speaker_volume = MAC_MAX_VOLUME;
}
static int get_audio_volume() {
return main_volume * speaker_volume * SDL_MIX_MAXVOLUME / (MAC_MAX_VOLUME * MAC_MAX_VOLUME);
}
#if SDL_VERSION_ATLEAST(2,0,0)
static int play_startup(void *arg) {
SDL_AudioSpec wav_spec;
Uint8 *wav_buffer;
Uint32 wav_length;
if (SDL_LoadWAV("startup.wav", &wav_spec, &wav_buffer, &wav_length)) {
SDL_AudioSpec obtained;
SDL_AudioDeviceID deviceId = SDL_OpenAudioDevice(NULL, 0, &wav_spec, &obtained, 0);
if (deviceId) {
SDL_QueueAudio(deviceId, wav_buffer, wav_length);
SDL_PauseAudioDevice(deviceId, 0);
while (SDL_GetQueuedAudioSize(deviceId)) SDL_Delay(10);
SDL_Delay(500);
SDL_CloseAudioDevice(deviceId);
}
else printf("play_startup: Audio driver failed to initialize\n");
SDL_FreeWAV(wav_buffer);
}
return 0;
}
void PlayStartupSound() {
SDL_CreateThread(play_startup, "", NULL);
}
#else
void PlayStartupSound() {
// Not implemented
}
#endif
#endif // SDL_VERSION_ATLEAST

View File

@ -0,0 +1,388 @@
/*
* audio_sdl3.cpp - Audio support, SDL implementation
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "cpu_emulation.h"
#include "main.h"
#include "prefs.h"
#include "user_strings.h"
#include "audio.h"
#include "audio_defs.h"
#include <SDL_mutex.h>
#include <SDL_audio.h>
#include <SDL_version.h>
#include <SDL_timer.h>
#if SDL_VERSION_ATLEAST(3, 0, 0)
#include <SDL_init.h>
#include <queue>
#define DEBUG 0
#include "debug.h"
#if defined(BINCUE)
#include "bincue.h"
#endif
#define MAC_MAX_VOLUME 0x0100
// The currently selected audio parameters (indices in audio_sample_rates[] etc. vectors)
static int audio_sample_rate_index = 0;
static int audio_sample_size_index = 0;
static int audio_channel_count_index = 0;
// Global variables
static SDL_Semaphore *audio_irq_done_sem = NULL; // Signal from interrupt to streaming thread: data block read
static uint8 silence_byte; // Byte value to use to fill sound buffers with silence
static int main_volume = MAC_MAX_VOLUME;
static int speaker_volume = MAC_MAX_VOLUME;
static bool main_mute = false;
static bool speaker_mute = false;
volatile static bool playing_startup, exit_startup;
SDL_AudioSpec audio_spec;
// Prototypes
static void SDLCALL stream_func(void *arg, SDL_AudioStream *stream, int additional_amount, int total_amount);
static int get_audio_volume();
/*
* Initialization
*/
// Set AudioStatus to reflect current audio stream format
static void set_audio_status_format(void)
{
AudioStatus.sample_rate = audio_sample_rates[audio_sample_rate_index];
AudioStatus.sample_size = audio_sample_sizes[audio_sample_size_index];
AudioStatus.channels = audio_channel_counts[audio_channel_count_index];
}
// Init SDL audio system
static bool open_sdl_audio(void)
{
// SDL supports a variety of twisted little audio formats, all different
if (audio_sample_sizes.empty()) {
audio_sample_rates.push_back(11025 << 16);
audio_sample_rates.push_back(22050 << 16);
audio_sample_rates.push_back(44100 << 16);
audio_sample_sizes.push_back(8);
audio_sample_sizes.push_back(16);
audio_channel_counts.push_back(1);
audio_channel_counts.push_back(2);
// Default to highest supported values
audio_sample_rate_index = (int)audio_sample_rates.size() - 1;
audio_sample_size_index = (int)audio_sample_sizes.size() - 1;
audio_channel_count_index = (int)audio_channel_counts.size() - 1;
}
//memset(&audio_spec, 0, sizeof(audio_spec));
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? SDL_AUDIO_U8 : SDL_AUDIO_S16BE;
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
// Open the audio device, forcing the desired format
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &audio_spec, stream_func, NULL);
if (stream == NULL) {
fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError());
return false;
}
silence_byte = SDL_GetSilenceValueForFormat(audio_spec.format);
#if defined(BINCUE)
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels, silence_byte, get_audio_volume());
#endif
printf("Using SDL/%s audio output\n", SDL_GetCurrentAudioDriver());
audio_frames_per_block = 4096 >> PrefsFindInt32("sound_buffer");
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
return true;
}
static bool open_audio(void)
{
// Try to open SDL audio
if (!open_sdl_audio()) {
WarningAlert(GetString(STR_NO_AUDIO_WARN));
return false;
}
// Device opened, set AudioStatus
set_audio_status_format();
// Everything went fine
audio_open = true;
return true;
}
void AudioInit(void)
{
// Init audio status and feature flags
AudioStatus.sample_rate = 44100 << 16;
AudioStatus.sample_size = 16;
AudioStatus.channels = 2;
AudioStatus.mixer = 0;
AudioStatus.num_sources = 0;
audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut;
// Sound disabled in prefs? Then do nothing
if (PrefsFindBool("nosound"))
return;
// Init semaphore
audio_irq_done_sem = SDL_CreateSemaphore(0);
// Open and initialize audio device
open_audio();
}
/*
* Deinitialization
*/
static void close_audio(void)
{
exit_startup = true;
while (playing_startup)
SDL_Delay(10);
exit_startup = false;
// Close audio device
SDL_QuitSubSystem(SDL_INIT_AUDIO);
audio_open = false;
}
void AudioExit(void)
{
// Close audio device
close_audio();
// Delete semaphore
if (audio_irq_done_sem)
SDL_DestroySemaphore(audio_irq_done_sem);
}
/*
* First source added, start audio stream
*/
void audio_enter_stream()
{
}
/*
* Last source removed, stop audio stream
*/
void audio_exit_stream()
{
}
/*
* Streaming function
*/
static void SDLCALL stream_func(void *, SDL_AudioStream *stream, int stream_len, int /*total_amount*/)
{
static std::queue<uint8> q;
if (AudioStatus.num_sources) {
while (q.size() < stream_len) {
// Trigger audio interrupt to get new buffer
D(bug("stream: triggering irq\n"));
SetInterruptFlag(INTFLAG_AUDIO);
TriggerInterrupt();
D(bug("stream: waiting for ack\n"));
SDL_WaitSemaphore(audio_irq_done_sem);
D(bug("stream: ack received\n"));
// Get size of audio data
uint32 apple_stream_info = ReadMacInt32(audio_data + adatStreamInfo);
if (apple_stream_info && !main_mute && !speaker_mute) {
int work_size = ReadMacInt32(apple_stream_info + scd_sampleCount) * (AudioStatus.sample_size >> 3) * AudioStatus.channels;
uint8 buf[work_size];
Mac2Host_memcpy(buf, ReadMacInt32(apple_stream_info + scd_buffer), work_size);
for (int i = 0; i < work_size; i++) q.push(buf[i]);
}
else {
while (!q.empty()) q.pop();
break;
}
}
}
uint8 src[stream_len], dst[stream_len];
for (int i = 0; i < stream_len; i++)
if (q.empty()) src[i] = silence_byte;
else {
src[i] = q.front();
q.pop();
}
memset(dst, silence_byte, stream_len);
//SDL_AudioSpec audio_spec;
//int r = SDL_GetAudioStreamFormat(stream, NULL, &audio_spec);// little endianが帰ってくる
SDL_MixAudioFormat(dst, src, audio_spec.format, stream_len, get_audio_volume());
#if defined(BINCUE)
MixAudio_bincue(dst, stream_len, get_audio_volume());
#endif
SDL_PutAudioStreamData(stream, dst, stream_len);
}
/*
* MacOS audio interrupt, read next data block
*/
void AudioInterrupt(void)
{
D(bug("AudioInterrupt\n"));
// Get data from apple mixer
if (AudioStatus.mixer) {
M68kRegisters r;
r.a[0] = audio_data + adatStreamInfo;
r.a[1] = AudioStatus.mixer;
Execute68k(audio_data + adatGetSourceData, &r);
D(bug(" GetSourceData() returns %08lx\n", r.d[0]));
} else
WriteMacInt32(audio_data + adatStreamInfo, 0);
// Signal stream function
SDL_PostSemaphore(audio_irq_done_sem);
D(bug("AudioInterrupt done\n"));
}
/*
* Set sampling parameters
* "index" is an index into the audio_sample_rates[] etc. vectors
* It is guaranteed that AudioStatus.num_sources == 0
*/
bool audio_set_sample_rate(int index)
{
close_audio();
audio_sample_rate_index = index;
return open_audio();
}
bool audio_set_sample_size(int index)
{
close_audio();
audio_sample_size_index = index;
return open_audio();
}
bool audio_set_channels(int index)
{
close_audio();
audio_channel_count_index = index;
return open_audio();
}
/*
* Get/set volume controls (volume values received/returned have the left channel
* volume in the upper 16 bits and the right channel volume in the lower 16 bits;
* both volumes are 8.8 fixed point values with 0x0100 meaning "maximum volume"))
*/
bool audio_get_main_mute(void)
{
return main_mute;
}
uint32 audio_get_main_volume(void)
{
uint32 chan = main_volume;
return (chan << 16) + chan;
}
bool audio_get_speaker_mute(void)
{
return speaker_mute;
}
uint32 audio_get_speaker_volume(void)
{
uint32 chan = speaker_volume;
return (chan << 16) + chan;
}
void audio_set_main_mute(bool mute)
{
main_mute = mute;
}
void audio_set_main_volume(uint32 vol)
{
// We only have one-channel volume right now.
main_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
if (main_volume > MAC_MAX_VOLUME)
main_volume = MAC_MAX_VOLUME;
}
void audio_set_speaker_mute(bool mute)
{
speaker_mute = mute;
}
void audio_set_speaker_volume(uint32 vol)
{
// We only have one-channel volume right now.
speaker_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
if (speaker_volume > MAC_MAX_VOLUME)
speaker_volume = MAC_MAX_VOLUME;
}
static int get_audio_volume() {
return main_volume * speaker_volume * SDL_MIX_MAXVOLUME / (MAC_MAX_VOLUME * MAC_MAX_VOLUME);
}
static int play_startup(void *arg) {
SDL_AudioSpec wav_spec;
Uint8 *wav_buffer;
Uint32 wav_length;
if (!playing_startup && !SDL_LoadWAV("startup.wav", &wav_spec, &wav_buffer, &wav_length)) {
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &wav_spec, NULL, NULL);
if (stream) {
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
SDL_PutAudioStreamData(stream, wav_buffer, wav_length);
playing_startup = true;
while (!exit_startup && SDL_GetAudioStreamAvailable(stream)) SDL_Delay(10);
if (!exit_startup) SDL_Delay(500);
SDL_DestroyAudioStream(stream);
}
else printf("play_startup: Audio driver failed to initialize\n");
SDL_free(wav_buffer);
playing_startup = false;
}
return 0;
}
void PlayStartupSound() {
SDL_CreateThread(play_startup, "play_startup", NULL);
}
#endif // SDL_VERSION_ATLEAST

View File

@ -352,6 +352,113 @@ sdl Quartz
82 82 # KP 0
65 65 # KP .
#
# cocoa (SDL2)
#
sdl cocoa
53 53 # Esc
122 122 # F1
120 120 # F2
99 99 # F3
118 118 # F4
96 96 # F5
97 97 # F6
98 98 # F7
100 100 # F8
101 101 # F9
109 109 # F10
103 103 # F11
111 111 # F12
105 105 # F13/PrintScrn
107 107 # F14/Scroll Lock
113 113 # F15/Pause
10 10 # `
18 18 # 1
19 19 # 2
20 20 # 3
21 21 # 4
23 23 # 5
22 22 # 6
26 26 # 7
28 28 # 8
25 25 # 9
29 29 # 0
27 27 # -
24 24 # =
51 51 # Backspace
114 114 # Help/Insert
115 115 # Home
116 116 # Page Up
71 71 # Num Lock
81 81 # KP =
75 75 # KP /
67 67 # KP *
48 48 # Tab
12 12 # Q
13 13 # W
14 14 # E
15 15 # R
17 17 # T
16 16 # Y
32 32 # U
34 34 # I
31 31 # O
35 35 # P
33 33 # [
30 30 # ]
36 36 # Return
117 117 # Delete
119 119 # End
121 121 # Page Down
89 89 # KP 7
91 91 # KP 8
92 92 # KP 9
78 78 # KP -
57 57 # Caps Lock
0 0 # A
1 1 # S
2 2 # D
3 3 # F
5 5 # G
4 4 # H
38 38 # J
40 40 # K
37 37 # L
41 41 # ;
39 39 # '
42 42 # \
86 86 # KP 4
87 87 # KP 5
88 88 # KP 6
69 69 # KP +
56 56 # Shift
50 50 # International
6 6 # Z
7 7 # X
8 8 # C
9 9 # V
11 11 # B
45 45 # N
46 46 # M
43 43 # ,
47 47 # .
44 44 # /
126 62 # Cursor Up
123 59 # Cursor Left
125 61 # Cursor Down
124 60 # Cursor Right
83 83 # KP 1
84 84 # KP 2
85 85 # KP 3
76 76 # KP Enter
54 54 # Ctrl
58 58 # Option
55 55 # Command
54 54 # Ctrl Left
49 49 # Space
82 82 # KP 0
65 65 # KP .
#
# Windows
#

View File

@ -0,0 +1,108 @@
/*
* prefs_sdl.cpp - Preferences handling, SDL2 implementation
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <SDL.h>
#include "prefs.h"
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
{NULL, TYPE_END, false} // End of list
};
// Prefs file name and path
const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs";
std::string UserPrefsPath;
/*
* Load preferences from settings file
*/
void LoadPrefs(const char * vmdir) // TODO: load prefs from 'vmdir'
{
// Build a full-path to the settings file
char prefs_path[4096];
if (!vmdir) {
vmdir = SDL_getenv("HOME");
}
if (!vmdir) {
vmdir = "./";
}
SDL_snprintf(prefs_path, sizeof(prefs_path), "%s/%s", vmdir, PREFS_FILE_NAME);
// Read preferences from settings file
FILE *f = fopen(UserPrefsPath.empty() ? prefs_path : UserPrefsPath.c_str(), "r");
if (f != NULL) {
// Prefs file found, load settings
LoadPrefsFromStream(f);
fclose(f);
} else {
#ifdef __linux__
PrefsAddString("cdrom", "/dev/cdrom");
#endif
// No prefs file, save defaults
SavePrefs();
}
}
/*
* Save preferences to settings file
*/
void SavePrefs(void)
{
// Build a full-path to the settings file
char prefs_path[4096];
const char * dir = SDL_getenv("HOME");
if (!dir) {
dir = "./";
}
SDL_snprintf(prefs_path, sizeof(prefs_path), "%s/%s", dir, PREFS_FILE_NAME);
FILE *f;
if ((f = fopen(UserPrefsPath.empty() ? prefs_path : UserPrefsPath.c_str(), "w")) != NULL) {
SavePrefsToStream(f);
fclose(f);
}
}
/*
* Add defaults of platform-specific prefs items
* You may also override the defaults set in PrefsInit()
*/
void AddPlatformPrefsDefaults(void)
{
}

View File

@ -1,5 +1,5 @@
/*
* video_sdl.cpp - Video/graphics emulation, SDL specific stuff
* video_sdl.cpp - Video/graphics emulation, SDL 1.x specific stuff
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
@ -43,10 +43,13 @@
#include "sysdeps.h"
#include <SDL.h>
#if (SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0))
#include <SDL_mutex.h>
#include <SDL_thread.h>
#include <errno.h>
#include <vector>
#include <string>
#ifdef WIN32
#include <malloc.h> /* alloca() */
@ -86,7 +89,7 @@ static int display_type = DISPLAY_WINDOW; // See enum above
#endif
// Constants
#ifdef WIN32
#if defined(WIN32) || __MACOSX__
const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
#else
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
@ -116,7 +119,9 @@ static bool use_vosf = false; // Flag: VOSF enabled
static const bool use_vosf = false; // VOSF not possible
#endif
static bool ctrl_down = false; // Flag: Ctrl key pressed
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
static bool caps_on = false; // Flag: Caps Lock on
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
@ -153,6 +158,11 @@ static SDL_mutex *frame_buffer_lock = NULL;
#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock)
#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock)
// Previously set gamma tables
static uint16 last_gamma_red[256];
static uint16 last_gamma_green[256];
static uint16 last_gamma_blue[256];
// Video refresh function
static void VideoRefreshInit(void);
static void (*video_refresh)(void);
@ -358,6 +368,7 @@ public:
virtual void switch_to_current_mode(void);
virtual void set_palette(uint8 *pal, int num);
virtual void set_gamma(uint8 *gamma, int num);
bool video_open(void);
void video_close(void);
@ -455,15 +466,9 @@ static inline int sdl_display_height(void)
return height;
}
// Check wether specified mode is available
// Check whether specified mode is available
static bool has_mode(int type, int width, int height, int depth)
{
#ifdef SHEEPSHAVER
// Filter out Classic resolutions
if (width == 512 && height == 384)
return false;
#endif
// Filter out out-of-bounds resolutions
if (width > sdl_display_width() || height > sdl_display_height())
return false;
@ -519,12 +524,26 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth)
}
// Set window name and class
static void set_window_name(int name)
static void set_window_name(bool mouse_grabbed)
{
const char *title = PrefsFindString("title");
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
int grabbed = 0;
if (mouse_grabbed)
{
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
int hotkey = PrefsFindInt32("hotkey");
hotkey = hotkey ? hotkey : 1;
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
}
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
if (vi && vi->wm_available) {
const char *str = GetString(name);
SDL_WM_SetCaption(str, str);
if (vi && vi->wm_available)
{
//The icon name should stay the same
SDL_WM_SetCaption(s.c_str(), GetString(STR_WINDOW_TITLE));
}
}
@ -584,6 +603,16 @@ static void migrate_screen_prefs(void)
#endif
}
void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
{
SDL_UpdateRect(screen, x, y, w, h);
}
void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects)
{
SDL_UpdateRects(screen, numrects, rects);
}
/*
* Display "driver" classes
@ -725,7 +754,7 @@ void driver_base::adapt_to_video_mode() {
SDL_ShowCursor(hardware_cursor);
// Set window name/class
set_window_name(STR_WINDOW_TITLE);
set_window_name(false);
// Everything went well
init_ok = true;
@ -1042,6 +1071,19 @@ bool VideoInit(bool classic)
int h;
int resolution_id;
}
#ifdef SHEEPSHAVER
// Omit Classic resolutions
video_modes[] = {
{ -1, -1, 0x80 },
{ 640, 480, 0x81 },
{ 800, 600, 0x82 },
{ 1024, 768, 0x83 },
{ 1152, 870, 0x84 },
{ 1280, 1024, 0x85 },
{ 1600, 1200, 0x86 },
{ 0, }
};
#else
video_modes[] = {
{ -1, -1, 0x80 },
{ 512, 384, 0x80 },
@ -1053,6 +1095,7 @@ bool VideoInit(bool classic)
{ 1600, 1200, 0x86 },
{ 0, }
};
#endif
video_modes[0].w = default_width;
video_modes[0].h = default_height;
@ -1279,8 +1322,8 @@ void VideoVBL(void)
// Setting the window name must happen on the main thread, else it doesn't work on
// some platforms - e.g. macOS Sierra.
if (mouse_grabbed_window_name_status != mouse_grabbed) {
set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE);
mouse_grabbed_window_name_status = mouse_grabbed;
set_window_name(mouse_grabbed);
mouse_grabbed_window_name_status = mouse_grabbed;
}
// Temporarily give up frame buffer lock (this is the point where
@ -1308,7 +1351,7 @@ void VideoInterrupt(void)
// Setting the window name must happen on the main thread, else it doesn't work on
// some platforms - e.g. macOS Sierra.
if (mouse_grabbed_window_name_status != mouse_grabbed) {
set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE);
set_window_name(mouse_grabbed);
mouse_grabbed_window_name_status = mouse_grabbed;
}
@ -1343,9 +1386,51 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
{
const VIDEO_MODE &mode = get_current_mode();
// FIXME: how can we handle the gamma ramp?
if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT)
if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT) {
// handle the gamma ramp
if (pal[0] == 127 && pal[num_in*3-1] == 127) // solid grey
return; // ignore
uint16 red[256];
uint16 green[256];
uint16 blue[256];
int repeats = 256 / num_in;
for (int i = 0; i < num_in; i++) {
for (int j = 0; j < repeats; j++) {
red[i*repeats + j] = pal[i*3 + 0] << 8;
green[i*repeats + j] = pal[i*3 + 1] << 8;
blue[i*repeats + j] = pal[i*3 + 2] << 8;
}
}
// fill remaining entries (if any) with last value
for (int i = num_in * repeats; i < 256; i++) {
red[i] = pal[(num_in - 1) * 3] << 8;
green[i] = pal[(num_in - 1) * 3 + 1] << 8;
blue[i] = pal[(num_in - 1) * 3 + 2] << 8;
}
bool changed = (memcmp(red, last_gamma_red, 512) != 0 ||
memcmp(green, last_gamma_green, 512) != 0 ||
memcmp(blue, last_gamma_blue, 512) != 0);
if (changed) {
int result = SDL_SetGammaRamp(red, green, blue);
if (result < 0) {
fprintf(stderr, "SDL_SetGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
}
memcpy(last_gamma_red, red, 512);
memcpy(last_gamma_green, green, 512);
memcpy(last_gamma_blue, blue, 512);
}
return;
}
LOCK_PALETTE;
@ -1385,6 +1470,10 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
UNLOCK_PALETTE;
}
void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in)
{
// Not implemented
}
/*
* Switch video mode
@ -1544,11 +1633,29 @@ static bool is_modifier_key(SDL_KeyboardEvent const & e)
return false;
}
static bool is_ctrl_down(SDL_keysym const & ks)
static bool is_hotkey_down(SDL_keysym const & ks)
{
return ctrl_down || (ks.mod & KMOD_CTRL);
int hotkey = PrefsFindInt32("hotkey");
if (!hotkey) hotkey = 1;
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
(opt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
(cmd_down || (ks.mod & KMOD_META) || !(hotkey & 4));
}
static int modify_opt_cmd(int code) {
static bool f, c;
if (!f) {
f = true;
c = PrefsFindBool("swap_opt_cmd");
}
if (c) {
switch (code) {
case 0x37: return 0x3a;
case 0x3a: return 0x37;
}
}
return code;
}
/*
* Translate key event to Mac keycode, returns -1 if no keycode was found
@ -1608,8 +1715,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_ctrl_down(ks)) {if (!key_down) drv->suspend(); return -2;} else return 0x30;
case SDLK_RETURN: if (is_ctrl_down(ks)) {if (!key_down) toggle_fullscreen = true; return -2;} else return 0x24;
case SDLK_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_SPACE: return 0x31;
case SDLK_BACKSPACE: return 0x33;
@ -1624,19 +1731,9 @@ static int kc_decode(SDL_keysym const & ks, bool key_down)
case SDLK_RCTRL: return 0x36;
case SDLK_LSHIFT: return 0x38;
case SDLK_RSHIFT: return 0x38;
#if (defined(__APPLE__) && defined(__MACH__))
case SDLK_LALT: return 0x3a;
case SDLK_RALT: return 0x3a;
case SDLK_LMETA: return 0x37;
case SDLK_RMETA: return 0x37;
#else
case SDLK_LALT: return 0x37;
case SDLK_RALT: return 0x37;
case SDLK_LMETA: return 0x3a;
case SDLK_RMETA: return 0x3a;
#endif
case SDLK_LSUPER: return 0x3a; // "Windows" key
case SDLK_RSUPER: return 0x3a;
case SDLK_LALT: case SDLK_RALT: return 0x3a;
case SDLK_LMETA: case SDLK_RMETA: return 0x37;
case SDLK_LSUPER: case SDLK_RSUPER: return 0x37; // "Windows" key
case SDLK_MENU: return 0x32;
case SDLK_CAPSLOCK: return 0x39;
case SDLK_NUMLOCK: return 0x47;
@ -1646,13 +1743,13 @@ 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_ctrl_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 -2;} else return 0x35;
case SDLK_F1: if (is_ctrl_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case SDLK_F1: if (is_hotkey_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case SDLK_F2: return 0x78;
case SDLK_F3: return 0x63;
case SDLK_F4: return 0x76;
case SDLK_F5: if (is_ctrl_down(ks)) {if (!key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
case SDLK_F5: if (is_hotkey_down(ks)) {if (!key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
case SDLK_F6: return 0x61;
case SDLK_F7: return 0x62;
case SDLK_F8: return 0x64;
@ -1775,6 +1872,15 @@ static void handle_events(void)
code = event2keycode(event.key, true);
if (code >= 0) {
if (!emul_suspended) {
if (code == 0x36) {
ctrl_down = true;
} else if (code == 0x3a) {
opt_down = true;
code = modify_opt_cmd(code);
} else if (code == 0x37) {
cmd_down = true;
code = modify_opt_cmd(code);
}
if (code == 0x39) { // Caps Lock pressed
if (caps_on) {
ADBKeyUp(code);
@ -1785,8 +1891,6 @@ static void handle_events(void)
}
} else
ADBKeyDown(code);
if (code == 0x36)
ctrl_down = true;
} else {
if (code == 0x31)
drv->resume(); // Space wakes us up
@ -1802,6 +1906,15 @@ static void handle_events(void)
} else
code = event2keycode(event.key, false);
if (code >= 0) {
if (code == 0x36) {
ctrl_down = false;
} else if (code == 0x3a) {
opt_down = false;
code = modify_opt_cmd(code);
} else if (code == 0x37) {
cmd_down = false;
code = modify_opt_cmd(code);
}
if (code == 0x39) { // Caps Lock released
if (caps_on) {
ADBKeyUp(code);
@ -1812,8 +1925,6 @@ static void handle_events(void)
}
} else
ADBKeyUp(code);
if (code == 0x36)
ctrl_down = false;
}
break;
}
@ -2269,3 +2380,12 @@ void video_set_dirty_area(int x, int y, int w, int h)
// XXX handle dirty bounding boxes for non-VOSF modes
}
#endif
#ifdef SHEEPSHAVER
void video_set_gamma(int n_colors)
{
// Not supported in SDL 1.2
}
#endif
#endif // ends: SDL version check

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
/*
* xpram_sdl.cpp - XPRAM handling, SDL implementation
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
#include "xpram.h"
// XPRAM file name and path
const char XPRAM_FILE_NAME[] = ".basilisk_ii_xpram";
/*
* Load XPRAM from settings file
*/
void LoadXPRAM(const char *dir)
{
// Build a full-path to the file
char full_path[4096];
if (!dir) {
dir = SDL_getenv("HOME");
}
if (!dir) {
dir = "./";
}
SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME);
// Open the XPRAM file
FILE *f = fopen(full_path, "rb");
if (f != NULL) {
fread(XPRAM, 256, 1, f);
fclose(f);
}
}
/*
* Save XPRAM to settings file
*/
void SaveXPRAM(void)
{
// Build a full-path to the file
char full_path[4096];
const char *dir = SDL_getenv("HOME");
if (!dir) {
dir = "./";
}
SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME);
// Save the XPRAM file
FILE *f = fopen(full_path, "wb");
if (f != NULL) {
fwrite(XPRAM, 256, 1, f);
fclose(f);
}
}
/*
* Delete PRAM file
*/
void ZapPRAM(void)
{
// Build a full-path to the file
char full_path[4096];
const char *dir = SDL_getenv("HOME");
if (!dir) {
dir = "./";
}
SDL_snprintf(full_path, sizeof(full_path), "%s/%s", dir, XPRAM_FILE_NAME);
// Delete the XPRAM file
remove(full_path);
}

View File

@ -19,6 +19,7 @@ cpustbl.cpp
cputbl.h
cpuemu_nf.cpp
cpustbl_nf.cpp
cpufunctbl.cpp
patches/*
.pc*

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

@ -1 +0,0 @@
../../../../../SheepShaver/src/Unix/config.h

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(incoming);
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

@ -100,7 +100,7 @@ define GUI_SRCS_LIST_TO_OBJS
endef
GUI_OBJS = $(GUI_SRCS_LIST_TO_OBJS)
ifeq ($(USE_BINCUE),yes)
GUI_OBJS += bincue_unix.o
GUI_OBJS += bincue.o
endif
GUI_SRCS := $(GUI_SRCS:%=@top_srcdir@/%)
@ -161,7 +161,9 @@ installdirs:
uninstall:
rm -f $(DESTDIR)$(bindir)/$(APP)$(EXEEXT)
rm -f $(DESTDIR)$(bindir)/$(GUI_APP)$(EXEEXT)
if test -f "$(GUI_APP_EXE)"; then \
rm -f $(DESTDIR)$(bindir)/$(GUI_APP_EXE); \
fi
rm -f $(DESTDIR)$(man1dir)/$(APP).1
rm -f $(DESTDIR)$(datadir)/$(APP)/keycodes
rm -f $(DESTDIR)$(datadir)/$(APP)/fbdevices
@ -212,13 +214,16 @@ $(OBJ_DIR)/gencpu$(EXEEXT): $(OBJ_DIR)/gencpu.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/
$(OBJ_DIR)/gencomp$(EXEEXT): $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o
$(CXX) $(LDFLAGS) -o $(OBJ_DIR)/gencomp$(EXEEXT) $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o
cpudefs.cpp: $(OBJ_DIR)/build68k$(EXEEXT) @top_srcdir@/../uae_cpu/table68k
$(OBJ_DIR)/build68k$(EXEEXT) <@top_srcdir@/../uae_cpu/table68k >cpudefs.cpp
UAE_PATH = @UAE_PATH@
cpudefs.cpp: $(OBJ_DIR)/build68k$(EXEEXT) @top_srcdir@/$(UAE_PATH)/table68k
$(OBJ_DIR)/build68k$(EXEEXT) <@top_srcdir@/$(UAE_PATH)/table68k >cpudefs.cpp
cpustbl.cpp: cpuemu.cpp
cpustbl_nf.cpp: cpustbl.cpp
compstbl.cpp: compemu.cpp
cputbl.h: cpuemu.cpp
comptbl.h: compemu.cpp
cpufunctbl.cpp: cputbl.h
cpuemu.cpp: $(OBJ_DIR)/gencpu$(EXEEXT)
$(OBJ_DIR)/gencpu$(EXEEXT)

View File

@ -1,28 +0,0 @@
# serial 1
dnl Additional macros for Basilisk II
dnl Check for libgnomeui
dnl B2_PATH_GNOMEUI([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test to see if libgnomeui is installed, and define GNOMEUI_CFLAGS, LIBS
AC_DEFUN([B2_PATH_GNOMEUI],
[dnl
dnl Get the cflags and libraries from the gnome-config script
dnl
AC_ARG_WITH(gnome-config,
[ --with-gnome-config=GNOME_CONFIG Location of gnome-config],
GNOME_CONFIG="$withval")
AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
AC_MSG_CHECKING(for libgnomeui)
if test "$GNOME_CONFIG" = "no"; then
AC_MSG_RESULT(no)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(yes)
GNOMEUI_CFLAGS=`$GNOME_CONFIG --cflags gnomeui`
GNOMEUI_LIBS=`$GNOME_CONFIG --libs gnomeui`
ifelse([$1], , :, [$1])
fi
AC_SUBST(GNOMEUI_CFLAGS)
AC_SUBST(GNOMEUI_LIBS)
])

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,17 +28,19 @@ dnl Video options.
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(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=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])
dnl SDL options.
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=yes])
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=yes])
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], [])
AC_ARG_WITH(sdl3, [ --with-sdl3 use SDL 3.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=3], [])
dnl JIT compiler options.
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
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.
@ -74,13 +76,11 @@ dnl External packages.
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]],
[case "$withval" in
gtk1) WANT_GTK="gtk";;
gtk|gtk2) WANT_GTK="$withval";;
yes) WANT_GTK="gtk2 gtk";;
yes|gtk2) WANT_GTK="gtk2";;
*) 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])
[WANT_GTK="gtk2"])
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]))
@ -88,6 +88,11 @@ AC_ARG_WITH(bincue,
AC_ARG_WITH(libvhd,
AS_HELP_STRING([--with-libvhd], [Enable VHD disk images]))
AC_ARG_WITH(vdeplug,
AS_HELP_STRING([--with-vdeplug], [Enable VDE virtual network support]),
[],
[with_vdeplug=yes])
dnl Cross Compiling results in 'guesses' being made about the target system. These defaults are oftetimes incorrect.
dnl The following Environment variables allow you to configure the default guess value for each option in the configure script.
@ -212,7 +217,7 @@ if [[ "x$HAVE_I386" = "xyes" ]]; then
fi
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_CXX
@ -250,7 +255,7 @@ AC_CHECK_LIB(rt, timer_create)
AC_CHECK_LIB(rt, shm_open)
AC_CHECK_LIB(m, cos)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES, $3=ACTION_IF_SUCCESSFUL, $4=ACTION_IF_UNSUCCESSFUL)
dnl AC_TRY_LINK uses main() but SDL needs main to take args,
dnl therefore main is undefined with #undef.
dnl Framework can be in an custom location.
@ -260,18 +265,16 @@ AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
ac_Framework, [
saved_LIBS="$LIBS"
LIBS="$LIBS -framework $1"
if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/$1.framework/Headers"
AC_TRY_LINK(
[$2
#undef main], [],
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
[AS_VAR_SET(ac_Framework, yes); $3], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"; $4]
)
])
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
@ -295,26 +298,76 @@ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
fi
if [[ "x$WANT_SDL" = "xyes" ]]; then
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>])
TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then
TEMP_WANT_SDL_VERSION_MAJOR=2
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL2, [#include <SDL.h>], [
WANT_SDL_VERSION_MAJOR=2
], [
TEMP_WANT_SDL_VERSION_MAJOR=1
])
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>], [
WANT_SDL_VERSION_MAJOR=1
])
fi
else
ac_cv_framework_SDL=no
fi
if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then
PKG_CHECK_MODULES([sdl], [sdl >= 1.2], [
CFLAGS="$CFLAGS $sdl_CFLAGS"
CXXFLAGS="$CXXFLAGS $sdl_CFLAGS"
LIBS="$LIBS $sdl_LIBS"
], [
WANT_SDL=no
])
TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then
TEMP_WANT_SDL_VERSION_MAJOR=2
fi
dnl use PKG_PROG_PKG_CONFIG to declare PKG_CONFIG variables. Otherwise,
dnl PKG_* macros may fail, without much explanation. The lack of this
dnl was causing --with-sdl1 to fail, as SDL 1.x could not be detected,
dnl as the 2nd call to PKG_CHECK_MODULES would fail, as $PKG_CONFIG
dnl never got defined (bizarrely-enough). -- dludwig@pobox.com
PKG_PROG_PKG_CONFIG
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x3" ]]; then
PKG_CHECK_MODULES([sdl3], [sdl3 >= 3.0], [
CXXFLAGS="$CXXFLAGS $sdl3_CFLAGS"
CXXFLAGS+=`echo " $sdl3_CFLAGS" | sed -e 's/\(-I.*include\)/\1\/SDL3/'`
LIBS="$LIBS $sdl3_LIBS"
WANT_SDL_VERSION_MAJOR=3
], [
TEMP_WANT_SDL_VERSION_MAJOR=1
])
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
PKG_CHECK_MODULES([sdl2], [sdl2 >= 2.0], [
CXXFLAGS="$CXXFLAGS $sdl2_CFLAGS"
LIBS="$LIBS $sdl2_LIBS"
WANT_SDL_VERSION_MAJOR=2
], [
TEMP_WANT_SDL_VERSION_MAJOR=1
])
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then
PKG_CHECK_MODULES([sdl], [sdl >= 1.2], [
CFLAGS="$CFLAGS $sdl_CFLAGS"
CXXFLAGS="$CXXFLAGS $sdl_CFLAGS"
LIBS="$LIBS $sdl_LIBS"
WANT_SDL_VERSION_MAJOR=1
], [
WANT_SDL=no
WANT_SDL_VERSION_MAJOR=
])
fi
fi
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
else
SDL_SUPPORT="none"
fi
dnl We need X11, if not using SDL.
if [[ "x$WANT_SDL_VIDEO" = "xno" ]]; then
dnl We need X11, if not using SDL or Mac GUI.
if [[ "x$WANT_SDL_VIDEO" = "xno" -a "x$WANT_MACOSX_GUI" = "xno" ]]; then
AC_PATH_XTRA
if [[ "x$no_x" = "xyes" ]]; then
AC_MSG_ERROR([You need X11 to run Basilisk II.])
@ -329,6 +382,7 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
AS_IF([test "x$have_bincue" = "xyes" ], [
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
DEFINES="$DEFINES -DBINCUE"
CPPFLAGS="$CPPFLAGS -DBINCUE"
AC_SUBST(USE_BINCUE, yes)
else
AC_MSG_ERROR([You need SDL Audio to use BINCUE support.])
@ -406,41 +460,13 @@ fi
dnl We use GTK+ if possible.
UISRCS=../dummy/prefs_editor_dummy.cpp
case "x$WANT_GTK" in
xgtk2*)
AM_PATH_GTK_2_0(1.3.15, [
if [[ "x$WANT_GTK" = "xgtk2" ]]; then
AM_PATH_GTK_2_0(2.6.4, [
GUI_CFLAGS="$GTK_CFLAGS"
GUI_LIBS="$GTK_LIBS"
WANT_GTK=gtk2
], [
case "x${WANT_GTK}x" in
*gtkx)
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
WANT_GTK=gtk
;;
*)
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
WANT_GTK=no
;;
esac
])
;;
esac
if [[ "x$WANT_GTK" = "xgtk" ]]; then
AM_PATH_GTK(1.2.0, [
GUI_CFLAGS="$GTK_CFLAGS"
GUI_LIBS="$GTK_LIBS"
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
dnl includes <libintl.h>
AM_GNU_GETTEXT
B2_PATH_GNOMEUI([
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS"
], [])
], [
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
AC_MSG_WARN([Could not find GTK+ 2.0, disabling user interface.])
WANT_GTK=no
])
fi
@ -548,7 +574,8 @@ dnl Check for headers and functions related to pty support (sshpty.c)
dnl From openssh-3.2.2p1 configure.ac
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
AC_CHECK_FUNCS(_getpty vhangup strlcpy)
AC_SEARCH_LIBS([openpty], [util bsd])
AC_CHECK_FUNCS(_getpty openpty vhangup strlcpy)
case "$host" in
*-*-hpux10.26)
@ -571,11 +598,13 @@ mips-sony-bsd|mips-sony-newsos4)
;;
*-*-darwin*)
no_dev_ptmx=1
LIBS="$LIBS -lstdc++"
;;
*-*-freebsd*)
no_dev_ptmx=1
;;
*-*-netbsd*)
no_dev_ptmx=1
;;
esac
if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
@ -685,6 +714,7 @@ AC_CHECK_FRAMEWORK(AppKit, [])
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
AC_CHECK_FRAMEWORK(Metal, [])
dnl Select system-dependant source files.
SERIALSRC=serial_unix.cpp
@ -728,8 +758,11 @@ netbsd*)
ETHERSRC=ether_unix.cpp
;;
solaris*)
AUDIOSRC=Solaris/audio_solaris.cpp
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
dnl Needed for sys/socket.h
LIBS="$LIBS -lsocket -lnsl"
dnl Needed for SDL2
CXXFLAGS="$CXXFLAGS -std=c++11"
;;
irix*)
AUDIOSRC=Irix/audio_irix.cpp
@ -782,6 +815,13 @@ if [[ -n "$CAN_SLIRP" ]]; then
fi
AC_SUBST(SLIRP_SRCS)
dnl Is libvdeplug available?
have_vdeplug=no
AS_IF([test "x$with_vdeplug" = "xyes"], [
have_vdeplug=yes
AC_CHECK_LIB(vdeplug, vde_close, [], [have_vdeplug=no])
])
if [[ "x$WANT_MACOSX_GUI" = "xyes" ]]; then
CPPFLAGS="$CPPFLAGS -I../MacOSX"
LIBS="$LIBS -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
@ -815,7 +855,7 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
fi
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
VIDEOSRCS="../SDL/video_sdl.cpp"
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp ../SDL/video_sdl3.cpp "
KEYCODES="../SDL/keycodes"
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
AC_MSG_CHECKING([whether __LP64__ is defined])
@ -841,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"
@ -849,13 +892,13 @@ elif [[ "x$WANT_MACOSX_GUI" != "xyes" ]]; then
fi
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
AUDIOSRC="../SDL/audio_sdl.cpp"
AUDIOSRC="../SDL/audio_sdl.cpp ../SDL/audio_sdl3.cpp"
fi
dnl BINCUE overrides
if [[ "x$have_bincue" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS bincue_unix.cpp"
EXTRASYSSRCS="$EXTRASYSSRCS bincue.cpp"
fi
dnl libvhd overrides
@ -896,6 +939,9 @@ dnl Check that the host supports TUN/TAP devices
AC_CACHE_CHECK([whether TUN/TAP is supported],
ac_cv_tun_tap_support, [
AC_TRY_COMPILE([
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
#include <linux/if.h>
#include <linux/if_tun.h>
@ -904,6 +950,9 @@ AC_CACHE_CHECK([whether TUN/TAP is supported],
#include <net/if.h>
#include <net/if_tun.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
], [
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
@ -1061,42 +1110,37 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
fi dnl HAVE_MMAP_VM
if [[ "$OS_TYPE" != "darwin" ]]; then
dnl Check if we can disable position-independent code
AC_CACHE_CHECK([whether the compiler supports -no-pie],
ac_cv_no_pie, [
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -no-pie"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],[
ac_cv_no_pie="yes"],[
ac_cv_no_pie="no"
])
if [[ "$ac_cv_no_pie" = "no" ]]; then
LDFLAGS="$saved_LDFLAGS"
fi
])
fi
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
ac_cv_pagezero_hack, [
ac_cv_pagezero_hack=no
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
case $target_os:$target_cpu in
darwin*:x86_64)
ac_cv_pagezero_hack=yes
dnl might as well skip the test for mmap-able low memory
ac_cv_can_map_lm=no
fi
;;
esac
])
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
dnl Check if we can mmap 0x2000 bytes from 0x0000
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
ac_cv_can_map_lm, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#include "../CrossPlatform/vm_alloc.cpp"
int main(void) { /* returns 0 if we could map the lowmem globals */
volatile char * lm = 0;
if (vm_init() < 0) exit(1);
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
lm[0] = 'z';
if (vm_release((char *)lm, 0x2000) < 0) exit(1);
vm_exit(); exit(0);
}
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
dnl When cross-compiling, do not assume anything.
ac_cv_can_map_lm="$BII_CROSS_MAP_LOW_AREA"
)
AC_LANG_RESTORE
]
)
dnl Check signal handlers need to be reinstalled
AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
ac_cv_signal_need_reinstall, [
@ -1181,6 +1225,11 @@ AC_CACHE_CHECK([whether your system supports Mach exceptions],
AC_LANG_RESTORE
]
)
case $target_os:$target_cpu in
darwin*:arm) ac_cv_have_mach_exceptions=yes;;
esac
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
[Define if your system supports Mach exceptions.])
@ -1288,7 +1337,7 @@ AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
dnl Resolve and set the proper sigsegv_recovery method...
if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
if [[ "x$ac_cv_have_mach_exceptions" = "xyes" ]]; then
sigsegv_recovery=mach
elif [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
sigsegv_recovery=win32
@ -1317,6 +1366,11 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
AC_LANG_RESTORE
]
)
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
ac_cv_have_skip_instruction=yes
fi
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
@ -1332,11 +1386,10 @@ AC_PATH_PROG([BLESS], "true")
dnl Check for linker script support
case $target_os:$target_cpu in
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
#darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
esac
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
AC_CACHE_CHECK([whether linker script is usable],
@ -1371,17 +1424,12 @@ else
for am in $ADDRESSING_TEST_ORDER; do
case $am in
real)
dnl Requires ability to mmap() Low Memory globals
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
continue
fi
dnl Requires VOSF screen updates
if [[ "x$CAN_VOSF" = "xno" ]]; then
continue
fi
dnl Real addressing will probably work.
ADDRESSING_MODE="real"
WANT_VOSF=yes dnl we can use VOSF and we need it actually
DEFINES="$DEFINES -DREAL_ADDRESSING"
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
BLESS=Darwin/lowmem
@ -1393,7 +1441,6 @@ else
dnl Requires VOSF screen updates
if [[ "x$CAN_VOSF" = "xyes" ]]; then
ADDRESSING_MODE="direct"
WANT_VOSF=yes dnl we can use VOSF and we need it actually
DEFINES="$DEFINES -DDIRECT_ADDRESSING"
break
fi
@ -1416,7 +1463,15 @@ fi
dnl Banked Memory Addressing mode is not supported by the JIT compiler
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
AC_MSG_WARN([The JIT Compiler requires Direct Addressing, disabling])
WANT_JIT="no"
fi
if [[ "x$OS_TYPE" = "xdarwin" ]]; then
WANT_VOSF=no
if [[ "$target_cpu" != "arm" ]]; then
LDFLAGS="$LDFLAGS -Wl,-no_pie -pagezero_size 0x1000"
fi
fi
dnl Enable VOSF screen updates with this feature is requested and feasible
@ -1592,9 +1647,15 @@ elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
CPUSRCS="asm_support.s"
fi
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
UAE_PATH="../uae_cpu_2021"
else
UAE_PATH="../uae_cpu"
fi
dnl Enable JIT compiler, if possible.
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" = "xyes" ]]; then
JITSRCS="$JITSRCS $UAE_PATH/compiler/compemu_support.cpp $UAE_PATH/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
@ -1642,7 +1703,19 @@ cat > conftest.$ac_ext <<EOF
#include "confdefs.h"
$1
]EOF
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fno-lto"
gcc_ac_compile_ok=0
if AC_TRY_EVAL(ac_compile); then
gcc_ac_compile_ok=1
else
CFLAGS=$ac_save_CFLAGS
if AC_TRY_EVAL(ac_compile); then
gcc_ac_compile_ok=1
fi
fi
CFLAGS=$ac_save_CFLAGS
if test "$gcc_ac_compile_ok" = 1; then
od -c conftest.o |
sed ['s/^[0-7]*[ ]*/ /
s/\*/./g
@ -1764,9 +1837,16 @@ for fpe in $FPE_CORE_TEST_ORDER; do
ieee)
case $ac_cv_c_float_format in
IEEE*)
FPE_CORE="IEEE fpu core"
DEFINES="$DEFINES -DFPU_IEEE"
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
FPE_CORE="IEEE fpu core (MPFR)"
DEFINES="$DEFINES -DFPU_MPFR"
FPUSRCS="$UAE_PATH/fpu/fpu_mpfr.cpp"
LIBS="$LIBS -lmpfr -lgmp"
else
FPE_CORE="IEEE fpu core"
DEFINES="$DEFINES -DFPU_IEEE"
FPUSRCS="$UAE_PATH/fpu/fpu_ieee.cpp"
fi
dnl Math functions not mandated by C99 standard
AC_CHECK_FUNCS(isnanl isinfl)
dnl Math functions required by C99 standard, but probably not
@ -1784,14 +1864,14 @@ for fpe in $FPE_CORE_TEST_ORDER; do
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
FPE_CORE="i387 fpu core"
DEFINES="$DEFINES -DFPU_X86"
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
FPUSRCS="$UAE_PATH/fpu/fpu_x86.cpp"
break
fi
;;
uae)
FPE_CORE="uae fpu core"
DEFINES="$DEFINES -DFPU_UAE"
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
FPUSRCS="$UAE_PATH/fpu/fpu_uae.cpp"
break
;;
*)
@ -1809,8 +1889,12 @@ AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
dnl UAE CPU sources for all non-m68k-native architectures.
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
CPUINCLUDES="-I../uae_cpu"
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
CPUINCLUDES="-I$UAE_PATH"
CPUSRCS="$UAE_PATH/basilisk_glue.cpp $UAE_PATH/memory.cpp $UAE_PATH/newcpu.cpp $UAE_PATH/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
CPUSRCS="$CPUSRCS cpufunctbl.cpp"
DEFINES="$DEFINES -DUPDATE_UAE"
fi
fi
dnl Or if we have -IPA (MIPSPro compilers)
@ -1821,6 +1905,9 @@ if [[ "x$HAVE_IPA" = "xyes" ]]; then
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
fi
CFLAGS="$CFLAGS -fwrapv"
CXXFLAGS="$CXXFLAGS -fwrapv"
dnl Generate Makefile.
AC_SUBST(DEFINES)
AC_SUBST(SYSSRCS)
@ -1828,6 +1915,7 @@ AC_SUBST(CPUINCLUDES)
AC_SUBST(CPUSRCS)
AC_SUBST(BLESS)
AC_SUBST(KEYCODES)
AC_SUBST(UAE_PATH)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
@ -1838,8 +1926,10 @@ echo
echo Mac OS X GUI ........................... : $WANT_MACOSX_GUI
echo Mac OS X Sound ......................... : $WANT_MACOSX_SOUND
echo SDL support ............................ : $SDL_SUPPORT
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
echo BINCUE support ......................... : $have_bincue
echo LIBVHD support ......................... : $have_libvhd
echo VDE support ............................ : $have_vdeplug
echo XFree86 DGA support .................... : $WANT_XF86_DGA
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA

View File

@ -39,8 +39,28 @@
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#ifdef __sun__
#define BSD_COMP 1
#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,8 +69,9 @@
#include <stdio.h>
#include <signal.h>
#include <map>
#include <string>
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__FreeBSD__) || defined (__sun__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
#include <net/if.h>
#endif
@ -69,6 +90,12 @@
#include "ctl.h"
#endif
#ifdef HAVE_LIBVDEPLUG
extern "C" {
#include <libvdeplug.h>
}
#endif
#include "cpu_emulation.h"
#include "main.h"
#include "macos_util.h"
@ -93,9 +120,18 @@ enum {
NET_IF_SHEEPNET,
NET_IF_ETHERTAP,
NET_IF_TUNTAP,
NET_IF_SLIRP
NET_IF_SLIRP,
NET_IF_VDE,
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";
@ -115,6 +151,9 @@ static pthread_t slirp_thread; // Slirp reception thread
static bool slirp_thread_active = false; // Flag: Slirp reception threadinstalled
static int slirp_output_fd = -1; // fd of slirp output pipe
static int slirp_input_fds[2] = { -1, -1 }; // fds of slirp input pipe
#ifdef HAVE_LIBVDEPLUG
static VDECONN *vde_conn;
#endif
#ifdef SHEEPSHAVER
static bool net_open = false; // Flag: initialization succeeded, network device open
static uint8 ether_addr[6]; // Our Ethernet address
@ -122,6 +161,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 +179,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,23 +284,44 @@ 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;
// Determine Ethernet device type
net_if_type = -1;
if (strncmp(name, "tap", 3) == 0)
if (strncmp(name, "tap", 3) == 0) {
net_if_type = NET_IF_ETHERTAP;
printf("selected Ethernet device type tap\n");
}
#if ENABLE_TUNTAP
else if (strcmp(name, "tun") == 0)
else if (strcmp(name, "tun") == 0) {
net_if_type = NET_IF_TUNTAP;
printf("selected Ethernet device type tun\n");
}
#endif
#ifdef HAVE_SLIRP
else if (strcmp(name, "slirp") == 0)
else if (strcmp(name, "slirp") == 0) {
net_if_type = NET_IF_SLIRP;
printf("selected Ethernet device type slirp\n");
}
#endif
else
#ifdef HAVE_LIBVDEPLUG
else if (strcmp(name, "vde") == 0) {
net_if_type = NET_IF_VDE;
printf("selected Ethernet device type VDE\n");
}
#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;
printf("selected Ethernet device type sheep_net\n");
}
// Don't raise SIGPIPE, let errno be set to EPIPE
struct sigaction sigpipe_sa;
@ -300,8 +370,55 @@ 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);
}
if (net_if_type != NET_IF_SLIRP) {
#endif
}
#ifdef HAVE_LIBVDEPLUG
//vde switch information
int port = 0;
char *init_group = NULL;
mode_t mode = 0700;
struct vde_open_args args = {
.port = port,
.group = init_group,
.mode = mode,
};
if (net_if_type == NET_IF_VDE) {
/* calling vde open to open the vde connection to the vde switch */
vde_conn = vde_open(vde_sock, (char *)"macemu", &args);
if (!vde_conn) {
D(bug("VDE open failed\n"));
return -1;
} else {
/* for select/poll when this fd receive data, there are
* packets to recv(call vde_recv) */
fd = vde_datafd(vde_conn);
}
}
#endif
if (net_if_type != NET_IF_SLIRP && net_if_type != NET_IF_VDE) {
fd = open(dev_name, O_RDWR);
if (fd < 0) {
sprintf(str, GetString(STR_NO_SHEEP_NET_DRIVER_WARN), dev_name, strerror(errno));
@ -371,7 +488,7 @@ bool ether_init(void)
#endif
// Get Ethernet address
if (net_if_type == NET_IF_ETHERTAP) {
if (net_if_type == NET_IF_ETHERTAP || net_if_type == NET_IF_TUNTAP) {
pid_t p = getpid(); // If configured for multicast, ethertap requires that the lower 32 bit of the Ethernet address are our PID
ether_addr[0] = 0xfe;
ether_addr[1] = 0xfd;
@ -387,6 +504,15 @@ bool ether_init(void)
ether_addr[3] = 0x12;
ether_addr[4] = 0x34;
ether_addr[5] = 0x56;
#endif
#ifdef HAVE_LIBVDEPLUG
} else if (net_if_type == NET_IF_VDE) {
ether_addr[0] = 0x52;
ether_addr[1] = 0x54;
ether_addr[2] = 0x00;
ether_addr[3] = 0x12;
ether_addr[4] = 0x34;
ether_addr[5] = 0x56;
#endif
} else
ioctl(fd, SIOCGIFADDR, ether_addr);
@ -453,6 +579,11 @@ void ether_exit(void)
if (slirp_output_fd > 0)
close(slirp_output_fd);
#ifdef HAVE_LIBVDEPLUG
// Close vde_connection
if (net_if_type == NET_IF_VDE)
vde_close(vde_conn);
#endif
#if STATISTICS
// Show statistics
printf("%ld messages put on write queue\n", num_wput);
@ -750,6 +881,40 @@ static int16 ether_do_write(uint32 arg)
write(slirp_input_fd, packet, len);
return noErr;
} else
#endif
#ifdef HAVE_LIBVDEPLUG
if (net_if_type == NET_IF_VDE) {
if (fd == -1) { // which means vde service is not running
D(bug("WARNING: Couldn't transmit VDE packet\n"));
return excessCollsns;
}
if (vde_conn == NULL) {
D(bug("WARNING: vde_conn is NULL\n"));
return -1;
}
do {
len = vde_send(vde_conn, packet, sizeof(packet), 0);
} while (len < 0);
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 +1049,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"));
@ -924,14 +1096,33 @@ void ether_do_interrupt(void)
} else
#endif
{
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
unsigned short *pkt_len;
uint32 p = packet;
// Read packet from sheep_net device
#if defined(__linux__)
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
#else
length = read(fd, Mac2HostAddr(packet), 1514);
pkt_len = (unsigned short *)packet_buffer;
length = *pkt_len;
memcpy(Mac2HostAddr(packet), pkt_len + 1, length);
ether_dispatch_packet(p, length);
break;
} else
#endif
{
#ifdef HAVE_LIBVDEPLUG
if (net_if_type == NET_IF_VDE) {
length = vde_recv(vde_conn, Mac2HostAddr(packet), 1514, 0);
} else
#endif
{
// Read packet from sheep_net device
#if defined(__linux__)
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
#else
length = read(fd, Mac2HostAddr(packet), 1514);
#endif
}
if (length < 14)
break;
@ -1049,3 +1240,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

View File

@ -2,29 +2,696 @@
#
# Basilisk II (C) 1997-2005 Christian Bauer
#
# This file is used to translate the (server-specific) X11 keycodes to Mac
# keycodes depending on the X11 server being used.
# This file is used to translate the (server-specific) scancodes to
# Mac keycodes depending on the window server being used.
#
# The format of this file is as follows:
#
# sdl <driver string>
# <SDL scancode> <Mac keycode>
# <SDL scancode> <Mac keycode>
# <SDL scancode> <Mac keycode>
# ...
# <vendor string>
# <X11 keycode> <Mac keycode>
# <X11 keycode> <Mac keycode>
# <X11 keycode> <Mac keycode>
# ...
# <vendor string>
# <X11 keycode> <Mac keycode>
# <X11 keycode> <Mac keycode>
# ...
#
# The "vendor string" must match the first part of the X11 server vendor
# description as reported by ServerVendor(). If a match is found, the keycode
# translation table is constructed from the following lines. Each line
# contains an X11 keycode followed by its associated Mac keycode. Both
# keycodes have to be given in decimal. Lines beginning with "#" or ";" are
# treated as comments and ignored.
# The "driver string" must match the first part of the SDL driver
# vendor description as reported by SDL_VideoDriverName(), while the
# "vendor string" must match the first part of the X11 server vendor
# description as reported by ServerVendor(). If a match is found,
# the keycode translation table is constructed from the following
# lines. Each line contains an SDL scancode or X11 keycode followed
# by its associated Mac keycode. Both keycodes have to be given in
# decimal. Lines beginning with "#" or ";" are treated as comments
# and ignored.
#
#
# X11 server
# X.Org
# Wayland
#
sdl x11
sdl wayland
sdl dga
The X.Org Foundation
9 53 # Esc
67 122 # F1
68 120 # F2
69 99 # F3
70 118 # F4
71 96 # F5
72 97 # F6
73 98 # F7
74 100 # F8
75 101 # F9
76 109 # F10
95 103 # F11
96 111 # F12
111 105 # PrintScrn
78 107 # Scroll Lock
110 113 # Pause
49 50 # `
10 18 # 1
11 19 # 2
12 20 # 3
13 21 # 4
14 23 # 5
15 22 # 6
16 26 # 7
17 28 # 8
18 25 # 9
19 29 # 0
20 27 # -
21 24 # =
22 51 # Backspace
106 114 # Insert
97 115 # Home
99 116 # Page Up
77 71 # Num Lock
112 75 # KP /
63 67 # KP *
82 78 # KP -
23 48 # Tab
24 12 # Q
25 13 # W
26 14 # E
27 15 # R
28 17 # T
29 16 # Y
30 32 # U
31 34 # I
32 31 # O
33 35 # P
34 33 # [
35 30 # ]
36 36 # Return
107 117 # Delete
103 119 # End
105 121 # Page Down
79 89 # KP 7
80 91 # KP 8
81 92 # KP 9
86 69 # KP +
66 57 # Caps Lock
38 0 # A
39 1 # S
40 2 # D
41 3 # F
42 5 # G
43 4 # H
44 38 # J
45 40 # K
46 37 # L
47 41 # ;
48 39 # '
83 86 # KP 4
84 87 # KP 5
85 88 # KP 6
50 56 # Shift Left
94 50 # International
52 6 # Z
53 7 # X
54 8 # C
55 9 # V
56 11 # B
57 45 # N
58 46 # M
59 43 # ,
60 47 # .
61 44 # /
62 56 # Shift Right
51 42 # \
98 62 # Cursor Up
87 83 # KP 1
88 84 # KP 2
89 85 # KP 3
108 76 # KP Enter
37 54 # Ctrl Left
115 58 # Logo Left (-> Option)
64 55 # Alt Left (-> Command)
65 49 # Space
113 55 # Alt Right (-> Command)
116 58 # Logo Right (-> Option)
117 50 # Menu (-> International)
109 54 # Ctrl Right
100 59 # Cursor Left
104 61 # Cursor Down
102 60 # Cursor Right
90 82 # KP 0
91 65 # KP .
#
# Linux Framebuffer Console
#
sdl fbcon
1 53 # Esc
59 122 # F1
60 120 # F2
61 99 # F3
62 118 # F4
63 96 # F5
64 97 # F6
65 98 # F7
66 100 # F8
67 101 # F9
68 109 # F10
87 103 # F11
88 111 # F12
99 105 # PrintScrn
70 107 # Scroll Lock
119 113 # Pause
41 50 # `
2 18 # 1
3 19 # 2
4 20 # 3
5 21 # 4
6 23 # 5
7 22 # 6
8 26 # 7
9 28 # 8
10 25 # 9
11 29 # 0
12 27 # -
13 24 # =
14 51 # Backspace
110 114 # Insert
102 115 # Home
104 116 # Page Up
69 71 # Num Lock
98 75 # KP /
55 67 # KP *
74 78 # KP -
15 48 # Tab
16 12 # Q
17 13 # W
18 14 # E
19 15 # R
20 17 # T
21 16 # Y
22 32 # U
23 34 # I
24 31 # O
25 35 # P
26 33 # [
27 30 # ]
28 36 # Return
111 117 # Delete
107 119 # End
109 121 # Page Down
71 89 # KP 7
72 91 # KP 8
73 92 # KP 9
78 69 # KP +
58 57 # Caps Lock
30 0 # A
31 1 # S
32 2 # D
33 3 # F
34 5 # G
35 4 # H
36 38 # J
37 40 # K
38 37 # L
39 41 # ;
40 39 # '
75 86 # KP 4
76 87 # KP 5
77 88 # KP 6
42 56 # Shift Left
86 50 # International
44 6 # Z
45 7 # X
46 8 # C
47 9 # V
48 11 # B
49 45 # N
50 46 # M
51 43 # ,
52 47 # .
53 44 # /
54 56 # Shift Right
43 42 # \
103 62 # Cursor Up
79 83 # KP 1
80 84 # KP 2
81 85 # KP 3
96 76 # KP Enter
29 54 # Ctrl Left
125 58 # Logo Left (-> Option)
56 55 # Alt Left (-> Command)
57 49 # Space
100 55 # Alt Right (-> Command)
126 58 # Logo Right (-> Option)
97 54 # Ctrl Right
105 59 # Cursor Left
108 61 # Cursor Down
106 60 # Cursor Right
82 82 # KP 0
83 65 # KP .
#
# Quartz (1:1 translation actually)
#
sdl Quartz
53 53 # Esc
122 122 # F1
120 120 # F2
99 99 # F3
118 118 # F4
96 96 # F5
97 97 # F6
98 98 # F7
100 100 # F8
101 101 # F9
109 109 # F10
103 103 # F11
111 111 # F12
105 105 # F13/PrintScrn
107 107 # F14/Scroll Lock
113 113 # F15/Pause
10 10 # `
18 18 # 1
19 19 # 2
20 20 # 3
21 21 # 4
23 23 # 5
22 22 # 6
26 26 # 7
28 28 # 8
25 25 # 9
29 29 # 0
27 27 # -
24 24 # =
51 51 # Backspace
114 114 # Help/Insert
115 115 # Home
116 116 # Page Up
71 71 # Num Lock
81 81 # KP =
75 75 # KP /
67 67 # KP *
48 48 # Tab
12 12 # Q
13 13 # W
14 14 # E
15 15 # R
17 17 # T
16 16 # Y
32 32 # U
34 34 # I
31 31 # O
35 35 # P
33 33 # [
30 30 # ]
36 36 # Return
117 117 # Delete
119 119 # End
121 121 # Page Down
89 89 # KP 7
91 91 # KP 8
92 92 # KP 9
78 78 # KP -
57 57 # Caps Lock
0 0 # A
1 1 # S
2 2 # D
3 3 # F
5 5 # G
4 4 # H
38 38 # J
40 40 # K
37 37 # L
41 41 # ;
39 39 # '
42 42 # \
86 86 # KP 4
87 87 # KP 5
88 88 # KP 6
69 69 # KP +
56 56 # Shift
50 50 # International
6 6 # Z
7 7 # X
8 8 # C
9 9 # V
11 11 # B
45 45 # N
46 46 # M
43 43 # ,
47 47 # .
44 44 # /
126 62 # Cursor Up
123 59 # Cursor Left
125 61 # Cursor Down
124 60 # Cursor Right
83 83 # KP 1
84 84 # KP 2
85 85 # KP 3
76 76 # KP Enter
54 54 # Ctrl
58 58 # Option
55 55 # Command
54 54 # Ctrl Left
49 49 # Space
82 82 # KP 0
65 65 # KP .
#
# cocoa (SDL2)
#
sdl cocoa
41 53 # Esc
58 122 # F1
59 120 # F2
60 99 # F3
61 118 # F4
62 96 # F5
63 97 # F6
64 98 # F7
65 100 # F8
66 101 # F9
67 109 # F10
68 103 # F11
69 111 # F12
70 105 # F13/PrintScrn
71 107 # F14/Scroll Lock
72 113 # F15/Pause
53 10 # `
30 18 # 1
31 19 # 2
32 20 # 3
33 21 # 4
34 23 # 5
35 22 # 6
36 26 # 7
37 28 # 8
38 25 # 9
39 29 # 0
45 27 # -
46 24 # =
42 51 # Backspace
73 114 # Help/Insert
74 115 # Home
75 116 # Page Up
83 71 # Num Lock
103 81 # KP =
84 75 # KP /
85 67 # KP *
43 48 # Tab
20 12 # Q
26 13 # W
8 14 # E
21 15 # R
23 17 # T
28 16 # Y
24 32 # U
12 34 # I
18 31 # O
19 35 # P
47 33 # [
48 30 # ]
40 36 # Return
76 117 # Delete
77 119 # End
78 121 # Page Down
95 89 # KP 7
96 91 # KP 8
97 92 # KP 9
86 78 # KP -
57 57 # Caps Lock
4 0 # A
22 1 # S
7 2 # D
9 3 # F
10 5 # G
11 4 # H
13 38 # J
14 40 # K
15 37 # L
51 41 # ;
52 39 # '
49 42 # \
92 86 # KP 4
93 87 # KP 5
94 88 # KP 6
87 69 # KP +
100 50 # International
29 6 # Z
27 7 # X
6 8 # C
25 9 # V
5 11 # B
17 45 # N
16 46 # M
54 43 # ,
55 47 # .
56 44 # /
82 62 # Cursor Up
80 59 # Cursor Left
81 61 # Cursor Down
79 60 # Cursor Right
89 83 # KP 1
90 84 # KP 2
91 85 # KP 3
88 76 # KP Enter
225 56 # Shift Left
224 54 # Ctrl Left
226 58 # Option Left
227 55 # Command Left
44 49 # Space
231 55 # Command Right
230 58 # Option Right
228 54 # Ctrl Right
229 56 # Shift Right
98 82 # KP 0
99 65 # KP .
#
# Windows (SDL2)
#
sdl windows
41 53 # Esc
58 122 # F1
59 120 # F2
60 99 # F3
61 118 # F4
62 96 # F5
63 97 # F6
64 98 # F7
65 100 # F8
66 101 # F9
67 109 # F10
68 103 # F11
69 111 # F12
70 105 # F13/PrintScrn
71 107 # F14/Scroll Lock
72 113 # F15/Pause
53 50 # `
30 18 # 1
31 19 # 2
32 20 # 3
33 21 # 4
34 23 # 5
35 22 # 6
36 26 # 7
37 28 # 8
38 25 # 9
39 29 # 0
45 27 # -
46 24 # =
42 51 # Backspace
73 114 # Help/Insert
74 115 # Home
75 116 # Page Up
83 71 # Num Lock
103 81 # KP =
84 75 # KP /
85 67 # KP *
43 48 # Tab
20 12 # Q
26 13 # W
8 14 # E
21 15 # R
23 17 # T
28 16 # Y
24 32 # U
12 34 # I
18 31 # O
19 35 # P
47 33 # [
48 30 # ]
40 36 # Return
76 117 # Delete
77 119 # End
78 121 # Page Down
95 89 # KP 7
96 91 # KP 8
97 92 # KP 9
86 78 # KP -
57 57 # Caps Lock
4 0 # A
22 1 # S
7 2 # D
9 3 # F
10 5 # G
11 4 # H
13 38 # J
14 40 # K
15 37 # L
51 41 # ;
52 39 # '
49 42 # \
92 86 # KP 4
93 87 # KP 5
94 88 # KP 6
87 69 # KP +
100 50 # International
29 6 # Z
27 7 # X
6 8 # C
25 9 # V
5 11 # B
17 45 # N
16 46 # M
54 43 # ,
55 47 # .
56 44 # /
82 62 # Cursor Up
80 59 # Cursor Left
81 61 # Cursor Down
79 60 # Cursor Right
89 83 # KP 1
90 84 # KP 2
91 85 # KP 3
88 76 # KP Enter
225 56 # Shift Left
224 58 # Ctrl Left (--> Option)
# 227 # Logo Left
226 55 # Alt Left (--> Command)
44 49 # Space
230 58 # Alt Right (--> Option)
# 231 # Logo Right
101 50 # Menu (--> International)
228 54 # Ctrl Right
229 56 # Shift Right
98 82 # KP 0
99 65 # KP .
#
# Windows
#
sdl windib
sdl directx
1 53 # Esc
59 122 # F1
60 120 # F2
61 99 # F3
62 118 # F4
63 96 # F5
64 97 # F6
65 98 # F7
66 100 # F8
67 101 # F9
68 109 # F10
87 103 # F11
88 111 # F12
183 105 # PrintScrn
70 107 # Scroll Lock
197 113 # Pause
41 50 # `
2 18 # 1
3 19 # 2
4 20 # 3
5 21 # 4
6 23 # 5
7 22 # 6
8 26 # 7
9 28 # 8
10 25 # 9
11 29 # 0
12 27 # -
13 24 # =
14 51 # Backspace
210 114 # Insert
199 115 # Home
201 116 # Page Up
69 71 # Num Lock
181 75 # KP /
55 67 # KP *
74 78 # KP -
15 48 # Tab
16 12 # Q
17 13 # W
18 14 # E
19 15 # R
20 17 # T
21 16 # Y
22 32 # U
23 34 # I
24 31 # O
25 35 # P
26 33 # [
27 30 # ]
28 36 # Return
211 117 # Delete
207 119 # End
209 121 # Page Down
71 89 # KP 7
72 91 # KP 8
73 92 # KP 9
78 69 # KP +
58 57 # Caps Lock
30 0 # A
31 1 # S
32 2 # D
33 3 # F
34 5 # G
35 4 # H
36 38 # J
37 40 # K
38 37 # L
39 41 # ;
40 39 # '
75 86 # KP 4
76 87 # KP 5
77 88 # KP 6
42 56 # Shift Left
86 50 # International
44 6 # Z
45 7 # X
46 8 # C
47 9 # V
48 11 # B
49 45 # N
50 46 # M
51 43 # ,
52 47 # .
53 44 # /
54 56 # Shift Right
43 42 # \
200 62 # Cursor Up
79 83 # KP 1
80 84 # KP 2
81 85 # KP 3
156 76 # KP Enter
29 54 # Ctrl Left
219 58 # Logo Left (-> Option)
56 55 # Alt Left (-> Command)
57 49 # Space
184 55 # Alt Right (-> Command)
220 58 # Logo Right (-> Option)
221 50 # Menu (-> International)
157 54 # Ctrl Right
203 59 # Cursor Left
208 61 # Cursor Down
205 60 # Cursor Right
82 82 # KP 0
83 65 # KP .
#
# XFree86
#

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

@ -28,6 +28,10 @@
#ifdef USE_SDL
# include <SDL.h>
# include <SDL_main.h>
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define __MACOS__ __MACOSX__
#endif
#endif
#ifndef USE_SDL_VIDEO
@ -42,6 +46,10 @@
# include <sys/mman.h>
#endif
#if __MACOS__
# include "utils_macosx.h"
#endif
#if !EMULATED_68K && defined(__NetBSD__)
# include <m68k/sync_icache.h>
# include <m68k/frame.h>
@ -59,8 +67,8 @@ struct sigstate {
#ifdef ENABLE_GTK
# include <gtk/gtk.h>
# include <gdk/gdk.h>
# ifdef HAVE_GNOMEUI
# include <gnome.h>
# if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
# include <X11/Xlib.h>
# endif
#endif
@ -90,8 +98,13 @@ using std::string;
#include "rpc.h"
#if USE_JIT
#ifdef UPDATE_UAE
extern void (*flush_icache)(void); // from compemu_support.cpp
extern bool UseJIT;
#else
extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_support.cpp
#endif
#endif
#ifdef ENABLE_MON
# include "mon.h"
@ -207,6 +220,8 @@ static void sigill_handler(int sig, int code, struct sigcontext *scp);
extern "C" void EmulOpTrampoline(void);
#endif
// vde switch variable
char* vde_sock;
/*
* Ersatz functions
@ -236,11 +251,12 @@ void *vm_acquire_mac(size_t size)
return vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
}
#if REAL_ADDRESSING
static int vm_acquire_mac_fixed(void *addr, size_t size)
{
return vm_acquire_fixed(addr, size, VM_MAP_DEFAULT | VM_MAP_32BIT);
}
#endif
/*
* SIGSEGV handler
@ -283,16 +299,21 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
fprintf(stderr, "\n");
#if EMULATED_68K
uaecptr nextpc;
#ifdef UPDATE_UAE
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
m68k_dumpstate(stderr, &nextpc);
#else
extern void m68k_dumpstate(uaecptr *nextpc);
m68k_dumpstate(&nextpc);
#endif
#endif
#if USE_JIT && JIT_DEBUG
extern void compiler_dumpstate(void);
compiler_dumpstate();
#endif
VideoQuitFullScreen();
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
QuitEmulator();
@ -358,6 +379,16 @@ void cpu_do_check_ticks(void)
if (emulated_ticks <= 0)
emulated_ticks += emulated_ticks_quantum;
}
#else
uint16 emulated_ticks;
void cpu_do_check_ticks(void)
{
static int delay = -1;
if (delay < 0)
delay = PrefsFindInt32("delay");
if (delay)
usleep(delay);
}
#endif
@ -374,15 +405,20 @@ static void usage(const char *prg_name)
" --display STRING\n X display to use\n"
" --break ADDRESS\n set ROM breakpoint in hexadecimal\n"
" --loadbreak FILE\n load breakpoint from FILE\n"
" --rominfo\n dump ROM information\n", prg_name
" --rominfo\n dump ROM information\n"
" --switch SWITCH_PATH\n vde_switch address\n", prg_name
);
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
PrefsPrintUsage();
printf("\nBuild Date: %s\n", __DATE__);
exit(0);
}
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];
@ -436,7 +472,28 @@ int main(int argc, char **argv)
} else if (strcmp(argv[i], "--rominfo") == 0) {
argv[i] = NULL;
PrintROMInfo = true;
} else if (strcmp(argv[i], "--switch") == 0) {
argv[i] = NULL;
if (argv[++i] == NULL) {
printf("switch address not defined\n");
usage(argv[0]);
}
vde_sock = argv[i];
argv[i] = NULL;
}
#if defined(__APPLE__) && defined(__MACH__)
// Mac OS X likes to pass in various options of its own, when launching an app.
// Attempt to ignore these.
if (argv[i]) {
const char * mac_psn_prefix = "-psn_";
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
argv[i] = NULL;
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
argv[i] = NULL;
}
}
#endif
}
// Remove processed arguments
@ -463,16 +520,9 @@ int main(int argc, char **argv)
#ifdef ENABLE_GTK
if (!gui_connection) {
#ifdef HAVE_GNOMEUI
// Init GNOME/GTK
char version[16];
sprintf(version, "%d.%d", VERSION_MAJOR, VERSION_MINOR);
gnome_init("Basilisk II", version, argc, argv);
#else
// Init GTK
gtk_set_locale();
gtk_init(&argc, &argv);
#endif
}
#endif
@ -520,6 +570,17 @@ int main(int argc, char **argv)
QuitEmulator();
}
atexit(SDL_Quit);
#if __MACOS__ && SDL_VERSION_ATLEAST(2,0,0)
// On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK,
// except that it will also install keyboard shortcuts, such as Command + Q,
// which can interfere with keyboard shortcuts in the guest OS.
//
// HACK: disable these shortcuts, while leaving all other pieces of SDL2's
// menu bar in-place.
disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
#endif
#endif
// Init system routines
@ -541,7 +602,11 @@ int main(int argc, char **argv)
sigsegv_set_dump_state(sigsegv_dump_state);
// Read RAM size
RAMSize = PrefsFindInt32("ramsize") & 0xfff00000; // Round down to 1MB boundary
RAMSize = PrefsFindInt32("ramsize");
if (RAMSize <= 1000) {
RAMSize *= 1024 * 1024;
}
RAMSize &= 0xfff00000; // Round down to 1MB boundary
if (RAMSize < 1024*1024) {
WarningAlert(GetString(STR_SMALL_RAM_WARN));
RAMSize = 1024*1024;
@ -629,9 +694,12 @@ int main(int argc, char **argv)
RAMBaseMac = Host2MacAddr(RAMBaseHost);
ROMBaseMac = Host2MacAddr(ROMBaseHost);
#endif
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
#if __MACOS__
extern void set_current_directory();
set_current_directory();
#endif
// Get rom file path from preferences
const char *rom_path = PrefsFindString("rom");
@ -689,6 +757,9 @@ int main(int argc, char **argv)
QuitEmulator();
D(bug("Initialization complete\n"));
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
#if !EMULATED_68K
// (Virtual) supervisor mode, disable interrupts
EmulatedSR = 0x2700;
@ -937,8 +1008,12 @@ void FlushCodeCache(void *start, uint32 size)
{
#if USE_JIT
if (UseJIT)
#ifdef UPDATE_UAE
flush_icache();
#else
flush_icache_range((uint8 *)start, size);
#endif
#endif
#if !EMULATED_68K && defined(__NetBSD__)
m68k_sync_icache(start, size);
#endif
@ -954,11 +1029,16 @@ static void sigint_handler(...)
{
#if EMULATED_68K
uaecptr nextpc;
#ifdef UPDATE_UAE
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
m68k_dumpstate(stderr, &nextpc);
#else
extern void m68k_dumpstate(uaecptr *nextpc);
m68k_dumpstate(&nextpc);
#endif
#endif
VideoQuitFullScreen();
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
QuitEmulator();
}
@ -1188,13 +1268,15 @@ static void one_tick(...)
}
#ifdef USE_PTHREADS_SERVICES
bool tick_inhibit;
static void *tick_func(void *arg)
{
uint64 start = GetTicks_usec();
int64 ticks = 0;
uint64 next = GetTicks_usec();
uint64 next = start;
while (!tick_thread_cancel) {
one_tick();
if (!tick_inhibit)
one_tick();
next += 16625;
int64 delay = next - GetTicks_usec();
if (delay > 0)
@ -1203,8 +1285,10 @@ static void *tick_func(void *arg)
next = GetTicks_usec();
ticks++;
}
#if DEBUG
uint64 end = GetTicks_usec();
D(bug("%lld ticks in %lld usec = %f ticks/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
#endif
return NULL;
}
#endif
@ -1505,7 +1589,7 @@ ill: printf("SIGILL num %d, code %d\n", sig, code);
VideoQuitFullScreen();
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
QuitEmulator();

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* prefs_unix.cpp - Preferences handling, Unix specific stuff
*
* Basilisk II (C) 1997-2008 Christian Bauer
* Basilisk II, SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* 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
@ -19,35 +19,251 @@
*/
#include "sysdeps.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <string>
using std::string;
#include "prefs.h"
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
#ifdef SHEEPSHAVER
{"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"},
{"etherconfig", TYPE_STRING, false, "path of network config script"},
{"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"},
#else
{"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"},
#endif
{"dsp", TYPE_STRING, false, "audio output (dsp) device name"},
{"mixer", TYPE_STRING, false, "audio mixer device name"},
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
#endif
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
#ifdef USE_SDL_VIDEO
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
#endif
{NULL, TYPE_END, false, NULL} // End of list
};
#ifdef __linux__
// Standard file names and paths
#ifdef SHEEPSHAVER
static const char PREFS_FILE_NAME[] = "/.sheepshaver_prefs";
static const char XDG_PREFS_FILE_NAME[] = "/prefs";
static const char XPRAM_FILE_NAME[] = "/.sheepshaver_nvram";
static const char XDG_XPRAM_FILE_NAME[] = "/nvram";
static const char XDG_CONFIG_SUBDIR[] = "/SheepShaver";
#else
static const char PREFS_FILE_NAME[] = "/.basilisk_ii_prefs";
static const char XDG_PREFS_FILE_NAME[] = "/prefs";
static const char XPRAM_FILE_NAME[] = "/.basilisk_ii_xpram";
static const char XDG_XPRAM_FILE_NAME[] = "/xpram";
static const char XDG_CONFIG_SUBDIR[] = "/BasiliskII";
#endif
// Prefs file name and path
const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs";
string UserPrefsPath;
static string home_dir;
static string xdg_config_dir;
static string prefs_name;
extern string xpram_name;
static string get_xdg_config_dir(void)
{
char *env;
if (env = getenv("XDG_CONFIG_HOME"))
return string(env) + XDG_CONFIG_SUBDIR;
if (env = getenv("HOME"))
return string(env) + "/.config" + XDG_CONFIG_SUBDIR;
return "";
}
static string get_home_dir(void)
{
char *env;
if(env = getenv("HOME"))
return string(env);
return "."; // last resort, use the current directory
}
static string get_dir(string *path)
{
int pos = path->find_last_of('/');
if (pos == 0)
return ""; // file is in root folder
if (pos == std::string::npos)
return "."; // file is in current folder
return path->substr(0, pos);
}
static void exit_if_dir(const string& path)
{
struct stat info;
if (stat(path.c_str(), &info) != 0){
return;
}
if ((info.st_mode & S_IFDIR) != 0)
{
fprintf(stderr, "ERROR: Cannot open %s (Is a directory)\n", prefs_name.c_str());
exit(1);
}
}
static bool load_prefs_file(const string& path, bool exit_on_failure)
{
exit_if_dir(path);
FILE *prefs = fopen(path.c_str(), "r");
if (prefs != NULL)
{
LoadPrefsFromStream(prefs);
fclose(prefs);
printf("Using prefs file at %s\n", prefs_name.c_str());
return true;
}
else if (exit_on_failure)
{
fprintf(stderr, "ERROR: Could not load prefs file from %s (%s)\n",
path.c_str(), strerror(errno));
exit(1);
}
return false;
}
/*
* Look for prefs file in the following locations (in order of priority):
* 1. From vmdir/.basilisk_ii_prefs if a vmdir has been specified
* 2. From path specified with --config command line
* 3. From $HOME/.basilisk_ii_prefs if it exists
* 4. From $XDG_CONFIG_HOME/BasiliskII/prefs if it exists
* 5. Create a new prefs file at $XDG_CONFIG_HOME/BasiliskII/prefs
* (or the equivalent paths for SheepShaver)
* If $XDG_CONFIG_HOME doesn't exist, $HOME/.config is used instead,
* in accordance with XDG Base Directory Specification:
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
*/
void LoadPrefs(const char* vmdir)
{
home_dir = get_home_dir();
xdg_config_dir = get_xdg_config_dir();
// vmdir was specified on the command line
if (vmdir)
{
prefs_name = string(vmdir) + XDG_PREFS_FILE_NAME;
xpram_name = string(vmdir) + XDG_XPRAM_FILE_NAME;
if (load_prefs_file(prefs_name, true))
return;
}
// --config was specified
if (!UserPrefsPath.empty())
{
prefs_name = UserPrefsPath;
xpram_name = get_dir(&prefs_name) + XPRAM_FILE_NAME;
if (load_prefs_file(prefs_name, true))
return;
}
// Load .basilisk_ii_prefs from $HOME if it exists
if (!home_dir.empty())
{
prefs_name = home_dir + PREFS_FILE_NAME;
xpram_name = home_dir + XPRAM_FILE_NAME;
if (load_prefs_file(prefs_name, false))
return;
}
// If no other prefs file exists, try the $XDG_CONFIG_HOME directory
if (!xdg_config_dir.empty())
{
prefs_name = xdg_config_dir + XDG_PREFS_FILE_NAME;
xpram_name = xdg_config_dir + XDG_XPRAM_FILE_NAME;
if (load_prefs_file(prefs_name, false))
return;
}
// No prefs file, save defaults in $XDG_CONFIG_HOME directory
//#ifdef __linux__
PrefsAddString("cdrom", "/dev/cdrom");
//#endif
printf("No prefs file found, creating new one at %s\n", prefs_name.c_str());
SavePrefs();
}
static bool is_dir(const string& path)
{
struct stat info;
if (stat(path.c_str(), &info) != 0){
return false;
}
return (info.st_mode & S_IFDIR) != 0;
}
static bool create_directories(const string& path, mode_t mode)
{
if (mkdir(path.c_str(), mode) == 0)
return true;
switch (errno)
{
case ENOENT:
{
int pos = path.find_last_of('/');
if (pos == std::string::npos)
return false;
if (!create_directories(path.substr(0,pos),mode))
return false;
}
return 0 == mkdir(path.c_str(),mode);
case EEXIST:
return is_dir(path);
default:
return false;
}
}
/*
* Save preferences to settings file
*/
void SavePrefs(void)
{
FILE *f;
string prefs_dir = get_dir(&prefs_name);
if (!prefs_dir.empty() && !is_dir(prefs_dir))
{
create_directories(prefs_dir, 0700);
}
if ((f = fopen(prefs_name.c_str(), "w")) != NULL)
{
SavePrefsToStream(f);
fclose(f);
}
else
{
fprintf(stderr, "WARNING: Unable to save %s (%s)\n",
prefs_name.c_str(), strerror(errno));
}
}
#else // __linux__
// Prefs file name and path
#ifdef SHEEPSHAVER
static const char PREFS_FILE_NAME[] = ".sheepshaver_prefs";
#else
static const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs";
#endif
string UserPrefsPath;
static string prefs_path;
@ -88,7 +304,9 @@ void LoadPrefs(const char *vmdir)
fclose(f);
} else {
//#ifdef __linux__
// PrefsAddString("cdrom", "/dev/cdrom");
//#endif
// No prefs file, save defaults
SavePrefs();
}
@ -109,6 +327,9 @@ void SavePrefs(void)
}
#endif // __linux__
/*
* Add defaults of platform-specific prefs items
* You may also override the defaults set in PrefsInit()
@ -121,22 +342,28 @@ void AddPlatformPrefsDefaults(void)
PrefsReplaceInt32("mousewheelmode", 1);
PrefsReplaceInt32("mousewheellines", 3);
#ifdef __linux__
if (access("/dev/sound/dsp", F_OK) == 0) {
if (access("/dev/sound/dsp", F_OK) == 0)
{
PrefsReplaceString("dsp", "/dev/sound/dsp");
} else {
}
else
{
PrefsReplaceString("dsp", "/dev/dsp");
}
if (access("/dev/sound/mixer", F_OK) == 0) {
if (access("/dev/sound/mixer", F_OK) == 0)
{
PrefsReplaceString("mixer", "/dev/sound/mixer");
} else {
}
else
{
PrefsReplaceString("mixer", "/dev/mixer");
}
#elif defined (__NetBSD__)
PrefsReplaceString("dsp", "/dev/audio");
PrefsReplaceString("mixer", "/dev/mixer");
#else
PrefsReplaceString("dsp", "/dev/dsp");
PrefsReplaceString("mixer", "/dev/mixer");
#endif
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
PrefsAddBool("ignoresegv", false);
#endif
PrefsAddBool("idlewait", true);
}

View File

@ -21,12 +21,18 @@
#include "sysdeps.h"
#include <sys/ioctl.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#include <sys/stat.h>
#include <sys/wait.h>
#include <pthread.h>
#include <semaphore.h>
#include <termios.h>
#include <errno.h>
#ifdef __linux__
#include <linux/lp.h>
#include <linux/major.h>
@ -648,16 +654,16 @@ bool XSERDPort::configure(uint16 config)
// Set number of data bits
switch (config & 0x0c00) {
case data5:
mode.c_cflag = mode.c_cflag & ~CSIZE | CS5;
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS5;
break;
case data6:
mode.c_cflag = mode.c_cflag & ~CSIZE | CS6;
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS6;
break;
case data7:
mode.c_cflag = mode.c_cflag & ~CSIZE | CS7;
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS7;
break;
case data8:
mode.c_cflag = mode.c_cflag & ~CSIZE | CS8;
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS8;
break;
}

View File

@ -22,6 +22,11 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
#include <ctype.h>
#include <errno.h>
#include <fcntl.h> /* For O_NONBLOCK */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
@ -45,10 +50,6 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
# include <sys/bsdtty.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> /* For S_* constants and macros */
#endif
#ifndef _PATH_TTY
# define _PATH_TTY "/dev/tty"
#endif
@ -73,7 +74,12 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
#define fatal(x) do { printf("Fatal error: %s", x); return 0; } while(0)
#endif /* not in BasiliskII */
#ifdef __sun__
#define mysig_t void*
#else
#define mysig_t sig_t
#endif
#define mysignal signal
#include <signal.h>

45
BasiliskII/src/Unix/sys_unix.cpp Normal file → Executable file
View File

@ -59,7 +59,7 @@
#include "disk_unix.h"
#if defined(BINCUE)
#include "bincue_unix.h"
#include "bincue.h"
#endif
@ -369,6 +369,9 @@ void SysAddCDROMPrefs(void)
closedir(cd_dir);
}
}
#elif defined __FreeBSD__
if (access("/cdrom", F_OK) == 0)
PrefsAddString("cdrom", "/cdrom");
#elif defined __MACOSX__
// There is no predefined path for CD-ROMs on MacOS X. Rather, we
// define a single fake CD-ROM entry for the emulated MacOS.
@ -396,8 +399,8 @@ void SysAddSerialPrefs(void)
PrefsAddString("serialb", "/dev/tts/1");
}
#elif defined(__FreeBSD__)
PrefsAddString("seriala", "/dev/cuaa0");
PrefsAddString("serialb", "/dev/cuaa1");
PrefsAddString("seriala", "/dev/cuau0");
PrefsAddString("serialb", "/dev/cuau1");
#elif defined(__NetBSD__)
PrefsAddString("seriala", "/dev/tty00");
PrefsAddString("serialb", "/dev/tty01");
@ -537,14 +540,14 @@ static mac_file_handle *open_filehandle(const char *name)
return fh;
}
void *Sys_open(const char *name, bool read_only)
void *Sys_open(const char *name, bool read_only, bool is_cdrom)
{
bool is_file = strncmp(name, "/dev/", 5) != 0;
#if defined(__FreeBSD__)
// SCSI IDE
bool is_cdrom = strncmp(name, "/dev/cd", 7) == 0 || strncmp(name, "/dev/acd", 8) == 0;
is_cdrom |= strncmp(name, "/dev/cd", 7) == 0 || strncmp(name, "/dev/acd", 8) == 0;
#else
bool is_cdrom = strncmp(name, "/dev/cd", 7) == 0;
is_cdrom |= strncmp(name, "/dev/cd", 7) == 0;
#endif
bool is_floppy = strncmp(name, "/dev/fd", 7) == 0;
@ -883,10 +886,12 @@ void SysEject(void *arg)
// Try to use "diskutil eject" but it can take up to 5
// seconds to complete
static const char eject_cmd[] = "/usr/sbin/diskutil eject %s 2>&1 >/dev/null";
char *cmd = (char *)alloca(strlen(eject_cmd) + strlen(fh->ioctl_name) + 1);
sprintf(cmd, eject_cmd, fh->ioctl_name);
system(cmd);
if (fh->ioctl_name) {
static const char eject_cmd[] = "/usr/sbin/diskutil eject %s 2>&1 >/dev/null";
char *cmd = (char *)alloca(strlen(eject_cmd) + strlen(fh->ioctl_name) + 1);
sprintf(cmd, eject_cmd, fh->ioctl_name);
system(cmd);
}
}
fh->is_media_present = false;
}
@ -1405,8 +1410,13 @@ bool SysCDScan(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, bool reve
mac_file_handle *fh = (mac_file_handle *)arg;
if (!fh)
return false;
// Not supported under Linux
#if defined(BINCUE)
if (fh->is_bincue)
return CDScan_bincue(fh->bincue_fd,start_m,start_s,start_f,reverse);
#endif
// Not supported outside bincue
return false;
}
@ -1420,6 +1430,11 @@ void SysCDSetVolume(void *arg, uint8 left, uint8 right)
mac_file_handle *fh = (mac_file_handle *)arg;
if (!fh)
return;
#if defined(BINCUE)
if (fh->is_bincue)
CDSetVol_bincue(fh->bincue_fd,left,right);
#endif
if (fh->is_cdrom) {
#if defined(__linux__)
@ -1448,6 +1463,12 @@ void SysCDGetVolume(void *arg, uint8 &left, uint8 &right)
return;
left = right = 0;
#if defined(BINCUE)
if (fh->is_bincue)
CDGetVol_bincue(fh->bincue_fd,&left,&right);
#endif
if (fh->is_cdrom) {
#if defined(__linux__)
cdrom_volctrl vol;

View File

@ -25,12 +25,12 @@
#error "Your compiler is not ANSI. Get a real one."
#endif
#include "config.h"
#include <config.h>
#include "user_strings_unix.h"
#ifndef STDC_HEADERS
#error "You don't have ANSI C header files."
#endif
//#ifndef STDC_HEADERS
//#error "You don't have ANSI C header files."
//#endif
#ifdef HAVE_UNISTD_H
# include <sys/types.h>
@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_PTHREADS
# include <pthread.h>
@ -51,6 +52,10 @@
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> /* For S_* constants and macros */
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@ -117,11 +122,6 @@
#ifdef HAVE_PTHREADS
#define USE_PTHREADS_SERVICES
#endif
#if EMULATED_68K
#if defined(__NetBSD__)
#define USE_CPU_EMUL_SERVICES
#endif
#endif
#ifdef USE_CPU_EMUL_SERVICES
#undef USE_PTHREADS_SERVICES
#endif
@ -219,7 +219,7 @@ typedef uae_u32 uaecptr;
/* Timing functions */
extern uint64 GetTicks_usec(void);
extern void Delay_usec(uint32 usec);
extern void Delay_usec(uint64 usec);
/* Spinlocks */
#ifdef __GNUC__
@ -424,30 +424,17 @@ static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {uint8 *b = (uint8 *)a
#if defined(__i386__) || defined(__x86_64__)
/* Intel x86 */
#define X86_PPRO_OPT
static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;}
#ifdef X86_PPRO_OPT
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;}
#else
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;}
#endif
#define HAVE_GET_WORD_UNSWAPPED
#define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a)))
static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
#ifdef X86_PPRO_OPT
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;}
#else
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
#endif
#define HAVE_OPTIMIZED_BYTESWAP_32
/* bswap doesn't affect condition codes */
static inline uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;}
#define HAVE_OPTIMIZED_BYTESWAP_16
#ifdef X86_PPRO_OPT
static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;}
#else
static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;}
#endif
#elif defined(CPU_CAN_ACCESS_UNALIGNED)
@ -503,4 +490,21 @@ static inline uae_u32 do_byteswap_16(uae_u32 v)
#endif
#define REGPARAM2
#ifndef UNUSED
#define UNUSED(x) ((void)x)
#endif
#define unlikely(x) __builtin_expect(!!(x), 0)
#define ALWAYS_INLINE inline __attribute__((always_inline))
#define memptr uint32
// High-precision timing
#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP)
#define PRECISE_TIMING 1
#define PRECISE_TIMING_POSIX 1
#elif defined(HAVE_PTHREADS) && defined(__MACH__)
#define PRECISE_TIMING 1
#define PRECISE_TIMING_MACH 1
#endif
#endif

View File

@ -44,8 +44,8 @@ static inline void mach_current_time(tm_time_t &t) {
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &host_clock);
host_clock_inited = true;
}
clock_get_time(host_clock, &t);
clock_get_time(host_clock, (mach_timespec_t *)&t);
}
#endif
@ -264,7 +264,7 @@ uint64 GetTicks_usec(void)
#define USE_COND_TIMEDWAIT
#endif
void Delay_usec(uint32 usec)
void Delay_usec(uint64 usec)
{
int was_error;

View File

@ -38,6 +38,7 @@ user_string_def platform_strings[] = {
{STR_FBDEV_NAME_ERR, "The %s frame buffer is not supported in %d bit mode."},
{STR_FBDEV_MMAP_ERR, "Cannot mmap() the frame buffer memory (%s)."},
{STR_VOSF_INIT_ERR, "Cannot initialize Video on SEGV signals."},
{STR_X_ICON_ATOM_ALLOC_ERR, "Failed to allocate X Atom. Icon will not be set."},
{STR_NO_DEV_ZERO_ERR, "Cannot open /dev/zero (%s)."},
{STR_LOW_MEM_MMAP_ERR, "Cannot map Low Memory Globals (%s)."},
{STR_SIGALTSTACK_ERR, "Cannot install alternate signal stack (%s)."},
@ -61,6 +62,7 @@ user_string_def platform_strings[] = {
{STR_PREFS_MENU_FILE_GTK, "/_File"},
{STR_PREFS_ITEM_START_GTK, "/File/_Start Basilisk II"},
{STR_PREFS_ITEM_SAVE_GTK, "/File/Save _Preferences"},
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
{STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
{STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit Basilisk II"},
@ -72,7 +74,8 @@ user_string_def platform_strings[] = {
{STR_DSPDEVICE_FILE_CTRL, "Audio Output Device"},
{STR_MIXERDEVICE_FILE_CTRL, "Audio Mixer Device"},
{STR_BROWSE_TITLE, "Browse file"},
{STR_BROWSE_TITLE, "Select File"},
{STR_BROWSE_FOLDER_TITLE, "Select Folder"},
{STR_BROWSE_CTRL, "Browse..."},
{STR_INPUT_PANE_TITLE, "Keyboard/Mouse"},
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
@ -84,10 +87,24 @@ user_string_def platform_strings[] = {
{STR_IGNORESEGV_CTRL, "Ignore Illegal Memory Accesses"},
{STR_WINDOW_TITLE_GRABBED, "Basilisk II (mouse grabbed, press Ctrl-F5 to release)"},
{STR_NO_B2_EXE_FOUND, "Could not start %s (%s)."},
{STR_ABOUT_COPYRIGHT, "© 1997-2008 Christian Bauer et al."},
{STR_ABOUT_LICENSE, "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.\n\n\
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.\n\n\
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"},
{STR_ABOUT_COMMENTS, "Open source 68k Mac emulator"},
{STR_ABOUT_WEBSITE, "http://basilisk.cebix.net"},
{STR_ABOUT_WEBSITE_LABEL, "Website"},
{-1, NULL} // End marker
};

View File

@ -29,6 +29,7 @@ enum {
STR_FBDEV_NAME_ERR,
STR_FBDEV_MMAP_ERR,
STR_VOSF_INIT_ERR,
STR_X_ICON_ATOM_ALLOC_ERR,
STR_NO_DEV_ZERO_ERR,
STR_LOW_MEM_MMAP_ERR,
STR_SIGALTSTACK_ERR,
@ -52,6 +53,7 @@ enum {
STR_PREFS_MENU_FILE_GTK,
STR_PREFS_ITEM_START_GTK,
STR_PREFS_ITEM_SAVE_GTK,
STR_PREFS_ITEM_ZAP_PRAM_GTK,
STR_PREFS_ITEM_SEPL_GTK,
STR_PREFS_ITEM_QUIT_GTK,
@ -65,6 +67,7 @@ enum {
STR_BROWSE_CTRL,
STR_BROWSE_TITLE,
STR_BROWSE_FOLDER_TITLE,
STR_INPUT_PANE_TITLE,
STR_KEYCODES_CTRL,
STR_KEYCODE_FILE_CTRL,
@ -75,9 +78,13 @@ enum {
STR_IGNORESEGV_CTRL,
STR_WINDOW_TITLE_GRABBED,
STR_NO_B2_EXE_FOUND,
STR_NO_B2_EXE_FOUND
STR_ABOUT_COPYRIGHT,
STR_ABOUT_LICENSE,
STR_ABOUT_COMMENTS,
STR_ABOUT_WEBSITE,
STR_ABOUT_WEBSITE_LABEL
};
#endif

View File

@ -29,6 +29,7 @@
#include "sysdeps.h"
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
@ -36,6 +37,7 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <string>
#include <algorithm>
@ -112,7 +114,9 @@ static bool use_vosf = true; // Flag: VOSF enabled
static const bool use_vosf = false; // VOSF not possible
#endif
static bool ctrl_down = false; // Flag: Ctrl key pressed
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
static bool caps_on = false; // Flag: Caps Lock on
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
@ -214,6 +218,7 @@ public:
virtual void switch_to_current_mode(void);
virtual void set_palette(uint8 *pal, int num);
virtual void set_gamma(uint8 *gamma, int num);
bool video_open(void);
void video_close(void);
@ -224,6 +229,30 @@ public:
* Utility functions
*/
static bool is_hotkey_down()
{
int hotkey = PrefsFindInt32("hotkey");
if (!hotkey) hotkey = 1;
return (ctrl_down || !(hotkey & 1)) &&
(opt_down || !(hotkey & 2)) &&
(cmd_down || !(hotkey & 4));
}
static int modify_opt_cmd(int code) {
static bool f, c;
if (!f) {
f = true;
c = PrefsFindBool("swap_opt_cmd");
}
if (c) {
switch (code) {
case 0x37: return 0x3a;
case 0x3a: return 0x37;
}
}
return code;
}
// Map video_mode depth ID to numerical depth value
static inline int depth_of_video_mode(video_mode const & mode)
{
@ -438,8 +467,35 @@ static void set_window_name(Window w, int name)
XClassHint *hints;
hints = XAllocClassHint();
if (hints) {
hints->res_name = "BasiliskII";
hints->res_class = "BasiliskII";
hints->res_name = (char*) GetString(STR_WINDOW_TITLE);
hints->res_class = (char*) GetString(STR_WINDOW_TITLE);
XSetClassHint(x_display, w, hints);
XFree(hints);
}
}
// Set window name and class (ported from SDL implementation)
static void set_window_name(Window w, bool mouse_grabbed) {
const char *title = PrefsFindString("title");
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
if (mouse_grabbed)
{
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
int hotkey = PrefsFindInt32("hotkey");
hotkey = hotkey ? hotkey : 1;
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
}
XStoreName(x_display, w, s.c_str());
XSetIconName(x_display, w, GetString(STR_WINDOW_TITLE));
XClassHint *hints;
hints = XAllocClassHint();
if (hints) {
hints->res_name = (char*) GetString(STR_WINDOW_TITLE);
hints->res_class = (char*) GetString(STR_WINDOW_TITLE);
XSetClassHint(x_display, w, hints);
XFree(hints);
}
@ -731,7 +787,7 @@ driver_window::driver_window(X11_monitor_desc &m)
D(bug(" window created\n"));
// Set window name/class
set_window_name(w, STR_WINDOW_TITLE);
set_window_name(w, mouse_grabbed);
// Indicate that we want keyboard input
set_window_focus(w);
@ -887,7 +943,7 @@ void driver_window::grab_mouse(void)
Delay_usec(100000);
}
if (result == GrabSuccess) {
XStoreName(x_display, w, GetString(STR_WINDOW_TITLE_GRABBED));
set_window_name(w, true);
ADBSetRelMouseMode(mouse_grabbed = true);
disable_mouse_accel();
}
@ -898,7 +954,7 @@ void driver_window::ungrab_mouse(void)
{
if (mouse_grabbed) {
XUngrabPointer(x_display, CurrentTime);
XStoreName(x_display, w, GetString(STR_WINDOW_TITLE));
set_window_name(w, false);
ADBSetRelMouseMode(mouse_grabbed = false);
restore_mouse_accel();
}
@ -968,9 +1024,13 @@ driver_dga::~driver_dga()
// Suspend emulation
void driver_dga::suspend(void)
{
// Release ctrl key
// Release hotkeys
ADBKeyUp(0x36);
ctrl_down = false;
ADBKeyUp(0x37);
cmd_down = false;
ADBKeyUp(0x3a);
opt_down = false;
// Lock frame buffer (this will stop the MacOS thread)
LOCK_FRAME_BUFFER;
@ -1148,7 +1208,7 @@ driver_fbdev::driver_fbdev(X11_monitor_desc &m) : driver_dga(m)
&wattr);
// Set window name/class
set_window_name(w, STR_WINDOW_TITLE);
set_window_name(w, false);
// Indicate that we want keyboard input
set_window_focus(w);
@ -1285,7 +1345,7 @@ driver_xf86dga::driver_xf86dga(X11_monitor_desc &m)
(color_class == DirectColor ? CWColormap : 0), &wattr);
// Set window name/class
set_window_name(w, STR_WINDOW_TITLE);
set_window_name(w, false);
// Indicate that we want keyboard input
set_window_focus(w);
@ -1695,7 +1755,7 @@ bool VideoInit(bool classic)
default_width = -1; default_height = -1; // use entire screen
#endif
#ifdef ENABLE_XF86_DGA
} else if (has_dga && sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) {
} else if (has_dga & sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) {
display_type = DISPLAY_DGA;
#endif
}
@ -1930,6 +1990,10 @@ void X11_monitor_desc::set_palette(uint8 *pal, int num_in)
UNLOCK_PALETTE;
}
void X11_monitor_desc::set_gamma(uint8* gamma, int num)
{
// Not implemented
}
/*
* Switch video mode
@ -2006,7 +2070,7 @@ static int kc_decode(KeySym ks, bool key_down)
case XK_period: case XK_greater: return 0x2f;
case XK_slash: case XK_question: return 0x2c;
case XK_Tab: if (ctrl_down) {if (key_down) drv->suspend(); return -2;} else return 0x30;
case XK_Tab: if (is_hotkey_down()) {if (key_down) drv->suspend(); return -2;} else return 0x30;
case XK_Return: return 0x24;
case XK_space: return 0x31;
case XK_BackSpace: return 0x33;
@ -2027,10 +2091,10 @@ static int kc_decode(KeySym ks, bool key_down)
case XK_Control_R: return 0x36;
case XK_Shift_L: return 0x38;
case XK_Shift_R: return 0x38;
case XK_Alt_L: return 0x37;
case XK_Alt_R: return 0x37;
case XK_Meta_L: return 0x3a;
case XK_Meta_R: return 0x3a;
case XK_Alt_L: return 0x3a;
case XK_Alt_R: return 0x3a;
case XK_Meta_L: return 0x37;
case XK_Meta_R: return 0x37;
case XK_Menu: return 0x32;
case XK_Caps_Lock: return 0x39;
case XK_Num_Lock: return 0x47;
@ -2040,13 +2104,13 @@ static int kc_decode(KeySym ks, bool key_down)
case XK_Left: return 0x3b;
case XK_Right: return 0x3c;
case XK_Escape: if (ctrl_down) {if (key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
case XK_Escape: if (is_hotkey_down()) {if (key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
case XK_F1: if (ctrl_down) {if (key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case XK_F1: if (is_hotkey_down()) {if (key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case XK_F2: return 0x78;
case XK_F3: return 0x63;
case XK_F4: return 0x76;
case XK_F5: if (ctrl_down) {if (key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
case XK_F5: if (is_hotkey_down()) {if (key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
case XK_F6: return 0x61;
case XK_F7: return 0x62;
case XK_F8: return 0x64;
@ -2182,12 +2246,23 @@ static void handle_events(void)
// Keyboard
case KeyPress: {
int code = -1;
int code = event2keycode(event.xkey, true);
if(!emul_suspended)
{
if (code == 0x36) {
ctrl_down = true;
} else if (code == 0x3a) {
opt_down = true;
code = modify_opt_cmd(code);
} else if (code == 0x37) {
cmd_down = true;
code = modify_opt_cmd(code);
}
}
if (use_keycodes) {
if (event2keycode(event.xkey, true) != -2) // This is called to process the hotkeys
if (code != -2) // This is called to process the hotkeys
code = keycode_table[event.xkey.keycode & 0xff];
} else
code = event2keycode(event.xkey, true);
}
if (code >= 0) {
if (!emul_suspended) {
if (code == 0x39) { // Caps Lock pressed
@ -2200,8 +2275,6 @@ static void handle_events(void)
}
} else
ADBKeyDown(code);
if (code == 0x36)
ctrl_down = true;
} else {
if (code == 0x31)
drv->resume(); // Space wakes us up
@ -2210,16 +2283,25 @@ static void handle_events(void)
break;
}
case KeyRelease: {
int code = -1;
int code = event2keycode(event.xkey, false);
if(!emul_suspended)
{
if (code == 0x36) {
ctrl_down = false;
} else if (code == 0x3a) {
opt_down = false;
code = modify_opt_cmd(code);
} else if (code == 0x37) {
cmd_down = false;
code = modify_opt_cmd(code);
}
}
if (use_keycodes) {
if (event2keycode(event.xkey, false) != -2) // This is called to process the hotkeys
if (code != -2) // This is called to process the hotkeys
code = keycode_table[event.xkey.keycode & 0xff];
} else
code = event2keycode(event.xkey, false);
}
if (code >= 0 && code != 0x39) { // Don't propagate Caps Lock releases
ADBKeyUp(code);
if (code == 0x36)
ctrl_down = false;
}
break;
}
@ -2274,10 +2356,10 @@ static void update_display_dynamic(int ticker, driver_window *drv)
y2s = sm_uptd[ticker % 8];
y2a = 8;
for (i = 0; i < 6; i++) {
max_box = sm_no_boxes[i];
if (ticker % (2 << i))
break;
}
max_box = sm_no_boxes[i];
if (y2a) {
for (y1=0; y1<16; y1++) {

View File

@ -20,11 +20,68 @@
#include "sysdeps.h"
#include <stdlib.h>
#include <string>
using std::string;
#include "xpram.h"
#ifdef __linux__
// XPRAM file name, set by LoadPrefs() in prefs_unix.cpp
string xpram_name;
/*
* Load XPRAM from settings file
*/
void LoadXPRAM(const char* vmdir)
{
assert(!xpram_name.empty());
int fd;
if ((fd = open(xpram_name.c_str(), O_RDONLY)) >= 0)
{
read(fd, XPRAM, XPRAM_SIZE);
close(fd);
}
}
/*
* Save XPRAM to settings file
*/
void SaveXPRAM(void)
{
assert(!xpram_name.empty());
int fd;
if ((fd = open(xpram_name.c_str(), O_WRONLY | O_CREAT, 0666)) >= 0)
{
write(fd, XPRAM, XPRAM_SIZE);
close(fd);
}
else
{
fprintf(stderr, "WARNING: Unable to save %s (%s)\n",
xpram_name.c_str(), strerror(errno));
}
}
/*
* Delete PRAM file
*/
void ZapPRAM(void)
{
// Delete file
assert(!xpram_name.empty());
unlink(xpram_name.c_str());
}
#else // __linux__
// XPRAM file name and path
#if POWERPC_ROM
const char XPRAM_FILE_NAME[] = ".sheepshaver_nvram";
@ -98,3 +155,7 @@ void ZapPRAM(void)
// Delete file
unlink(xpram_path);
}
#endif // __linux__

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@ -1,140 +1,140 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasiliskII", "BasiliskII.vcxproj", "{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}"
ProjectSection(ProjectDependencies) = postProject
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48} = {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04} = {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build68k", "build68k.vcxproj", "{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpu", "gencpu.vcxproj", "{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}"
ProjectSection(ProjectDependencies) = postProject
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencomp", "gencomp.vcxproj", "{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}"
ProjectSection(ProjectDependencies) = postProject
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "..\..\..\..\SDL-1.2.15\VisualC\SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "..\..\..\..\SDL-1.2.15\VisualC\SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug JIT|x64 = Debug JIT|x64
Debug JIT|x86 = Debug JIT|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release JIT|x64 = Release JIT|x64
Release JIT|x86 = Release JIT|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.ActiveCfg = Debug JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.Build.0 = Debug JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.ActiveCfg = Debug JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.Build.0 = Debug JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.ActiveCfg = Debug|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.Build.0 = Debug|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.ActiveCfg = Debug|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.Build.0 = Debug|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.ActiveCfg = Release JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.Build.0 = Release JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.ActiveCfg = Release JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.Build.0 = Release JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.ActiveCfg = Release|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.Build.0 = Release|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.ActiveCfg = Release|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.Build.0 = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.ActiveCfg = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.Build.0 = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.ActiveCfg = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.Build.0 = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.ActiveCfg = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.Build.0 = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.ActiveCfg = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.Build.0 = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.ActiveCfg = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.Build.0 = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.ActiveCfg = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.Build.0 = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.ActiveCfg = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.Build.0 = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.ActiveCfg = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.Build.0 = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.ActiveCfg = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.Build.0 = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.ActiveCfg = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.Build.0 = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.ActiveCfg = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.Build.0 = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.ActiveCfg = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.Build.0 = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.ActiveCfg = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.Build.0 = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.ActiveCfg = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.Build.0 = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.ActiveCfg = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.Build.0 = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.ActiveCfg = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.Build.0 = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.ActiveCfg = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.Build.0 = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.ActiveCfg = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.Build.0 = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.ActiveCfg = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.Build.0 = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.ActiveCfg = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.Build.0 = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.ActiveCfg = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.Build.0 = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.ActiveCfg = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.Build.0 = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.ActiveCfg = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.Build.0 = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.ActiveCfg = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.Build.0 = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.ActiveCfg = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.Build.0 = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.ActiveCfg = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.Build.0 = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.ActiveCfg = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.Build.0 = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.ActiveCfg = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.Build.0 = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.Build.0 = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.Build.0 = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.ActiveCfg = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.Build.0 = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.ActiveCfg = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.Build.0 = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.ActiveCfg = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.Build.0 = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.ActiveCfg = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.Build.0 = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.ActiveCfg = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.Build.0 = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.ActiveCfg = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasiliskII", "BasiliskII.vcxproj", "{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}"
ProjectSection(ProjectDependencies) = postProject
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48} = {1A9EA738-8DA7-422F-9E0D-BE92893C0E48}
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04} = {95933FE9-C27C-41F0-B4AF-EAAADE94FD04}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build68k", "build68k.vcxproj", "{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpu", "gencpu.vcxproj", "{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}"
ProjectSection(ProjectDependencies) = postProject
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencomp", "gencomp.vcxproj", "{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}"
ProjectSection(ProjectDependencies) = postProject
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0} = {7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "..\..\..\external\SDL\VisualC\SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "..\..\..\external\SDL\VisualC\SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug JIT|x64 = Debug JIT|x64
Debug JIT|x86 = Debug JIT|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release JIT|x64 = Release JIT|x64
Release JIT|x86 = Release JIT|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.ActiveCfg = Debug JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x64.Build.0 = Debug JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.ActiveCfg = Debug JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug JIT|x86.Build.0 = Debug JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.ActiveCfg = Debug|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x64.Build.0 = Debug|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.ActiveCfg = Debug|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Debug|x86.Build.0 = Debug|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.ActiveCfg = Release JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x64.Build.0 = Release JIT|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.ActiveCfg = Release JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release JIT|x86.Build.0 = Release JIT|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.ActiveCfg = Release|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x64.Build.0 = Release|x64
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.ActiveCfg = Release|Win32
{1AAA5D96-9498-4EB5-A436-0143E2B7A0B0}.Release|x86.Build.0 = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.ActiveCfg = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x64.Build.0 = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.ActiveCfg = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug JIT|x86.Build.0 = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.ActiveCfg = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x64.Build.0 = Debug|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.ActiveCfg = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Debug|x86.Build.0 = Debug|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.ActiveCfg = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x64.Build.0 = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.ActiveCfg = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release JIT|x86.Build.0 = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.ActiveCfg = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x64.Build.0 = Release|x64
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.ActiveCfg = Release|Win32
{7BCEAB0D-0C62-46E1-BA1E-AF42798B67D0}.Release|x86.Build.0 = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.ActiveCfg = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x64.Build.0 = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.ActiveCfg = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug JIT|x86.Build.0 = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.ActiveCfg = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x64.Build.0 = Debug|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.ActiveCfg = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Debug|x86.Build.0 = Debug|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.ActiveCfg = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x64.Build.0 = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.ActiveCfg = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release JIT|x86.Build.0 = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.ActiveCfg = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x64.Build.0 = Release|x64
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.ActiveCfg = Release|Win32
{1A9EA738-8DA7-422F-9E0D-BE92893C0E48}.Release|x86.Build.0 = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.ActiveCfg = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x64.Build.0 = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.ActiveCfg = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug JIT|x86.Build.0 = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.ActiveCfg = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x64.Build.0 = Debug|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.ActiveCfg = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Debug|x86.Build.0 = Debug|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.ActiveCfg = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x64.Build.0 = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.ActiveCfg = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release JIT|x86.Build.0 = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.ActiveCfg = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x64.Build.0 = Release|x64
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.ActiveCfg = Release|Win32
{95933FE9-C27C-41F0-B4AF-EAAADE94FD04}.Release|x86.Build.0 = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.ActiveCfg = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x64.Build.0 = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.ActiveCfg = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug JIT|x86.Build.0 = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.ActiveCfg = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x86.Build.0 = Debug|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.ActiveCfg = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x64.Build.0 = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.ActiveCfg = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release JIT|x86.Build.0 = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.ActiveCfg = Release|Win32
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x86.Build.0 = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.ActiveCfg = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x64.Build.0 = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.ActiveCfg = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug JIT|x86.Build.0 = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.ActiveCfg = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x86.Build.0 = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.ActiveCfg = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x64.Build.0 = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release JIT|x86.Build.0 = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -270,6 +270,9 @@
<ClCompile Include="..\SDL\video_sdl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SDL\video_sdl2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\dummy\scsi_dummy.cpp">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -0,0 +1,7 @@
@echo off
set SOLUTION_DIR=%~1
set PLATFORM=%~2
set CONFIGURATION=%~3
set CONFIGURATION=%CONFIGURATION: JIT=%
set OUT_DIR=%~4
xcopy /y "%SOLUTION_DIR%%PLATFORM%\%CONFIGURATION%\SDL2.dll" "%OUT_DIR%"

18
BasiliskII/src/Windows/Makefile.in Executable file → Normal file
View File

@ -31,6 +31,8 @@ SLIRP_SRCS = \
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c
SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=$(OBJ_DIR)/slirp-%.o)
USE_BINCUE = @USE_BINCUE@
LN_S = @LN_S@
WINDRES = @WINDRES@
CC = @CC@
@ -39,9 +41,10 @@ CFLAGS = @CFLAGS@ $(SDL_CFLAGS)
CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS)
CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../CrossPlatform @CPUINCLUDES@ -I../slirp
DEFS = @DEFS@ @DEFINES@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ -lwsock32 -liphlpapi
LDFLAGS = @LDFLAGS@ -Wl,-Bstatic
LIBS = @LIBS@ -lws2_32 -lwsock32 -liphlpapi
CPUSRCS = @CPUSRCS@
EXTRASRCS = @EXTRASRCS@
HOST_CC = gcc
HOST_CXX = g++
@ -63,12 +66,13 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_windows.cpp ../timer.cpp \
timer_windows.cpp ../adb.cpp ../serial.cpp serial_windows.cpp \
../ether.cpp ether_windows.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp \
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp \
video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp \
../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp ../SDL/video_sdl3.cpp \
video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp ../SDL/audio_sdl3.cpp clip_windows.cpp \
../extfs.cpp extfs_windows.cpp ../user_strings.cpp user_strings_windows.cpp \
vm_alloc.cpp sigsegv.cpp posix_emu.cpp util_windows.cpp \
../dummy/prefs_editor_dummy.cpp BasiliskII.rc \
$(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(SLIRP_OBJS)
$(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(EXTRASRCS) $(SLIRP_OBJS)
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 \
@ -118,7 +122,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 +153,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

@ -26,7 +26,6 @@
#include <windowsx.h>
#include <winioctl.h>
#include "cpu_emulation.h"
typedef unsigned long ULONG_PTR, *PULONG_PTR;
// VC6 does not have this, Platform SDK has.
// In case of errors, try to comment out, the needed

72
BasiliskII/src/Windows/configure.ac Executable file → Normal file
View File

@ -11,9 +11,6 @@ dnl Aliases for PACKAGE and VERSION macros.
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
dnl SDL options.
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
dnl JIT compiler options.
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
@ -35,6 +32,10 @@ AC_ARG_ENABLE(fpe,
dnl External packages.
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=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
AC_ARG_WITH(bincue,
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
dnl Addressing modes.
AC_ARG_ENABLE(addressing,
@ -49,6 +50,8 @@ AC_ARG_ENABLE(addressing,
[ ADDRESSING_TEST_ORDER="direct banks"
])
AC_ARG_WITH(sdl3, [ --with-sdl3 use SDL 3.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=3], [WANT_SDL_VERSION_MAJOR=2])
dnl Canonical system information.
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
@ -85,6 +88,14 @@ AC_SUBST(WANT_GTK)
dnl We use 64-bit file size support if possible.
AC_SYS_LARGEFILE
dnl BINCUE
AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
AS_IF([test "x$have_bincue" = "xyes" ], [
DEFINES="$DEFINES -DBINCUE"
CPPFLAGS="$CPPFLAGS -DBINCUE"
AC_SUBST(USE_BINCUE, yes)
], [AC_SUBST(USE_BINCUE, no)])
dnl Checks for header files.
AC_HEADER_STDC
@ -131,7 +142,7 @@ AC_CACHE_CHECK([whether VirtualProtect works],
#define HAVE_WIN32_VM 1
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_$test_def
#include "../Unix/vm_alloc.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
], ac_cv_VirtualProtect_works=no, rm -f core,
dnl When cross-compiling, assume it works
ac_cv_VirtualProtect_works="yes"
@ -141,7 +152,7 @@ AC_CACHE_CHECK([whether VirtualProtect works],
#define HAVE_WIN32_VM 1
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_RDWR_WRITE
#include "../Unix/vm_alloc.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
], , ac_cv_VirtualProtect_works=no,
dnl When cross-compiling, assume it works
ac_cv_VirtualProtect_works="yes"
@ -163,8 +174,8 @@ AC_CACHE_CHECK([whether your system supports Windows exceptions],
AC_TRY_RUN([
#define HAVE_WIN32_EXCEPTIONS 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "../Unix/vm_alloc.cpp"
#include "../Unix/sigsegv.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
#include "../CrossPlatform/sigsegv.cpp"
],
ac_cv_have_win32_exceptions=yes,
ac_cv_have_win32_exceptions=no,
@ -188,8 +199,8 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
AC_TRY_RUN([
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "../Unix/vm_alloc.cpp"
#include "../Unix/sigsegv.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
#include "../CrossPlatform/sigsegv.cpp"
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
dnl When cross-compiling, do not assume anything.
ac_cv_have_skip_instruction=no
@ -200,8 +211,12 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
dnl We really want VOSF (Video on SEGV Signals) screen updates acceleration
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
dnl Enable VOSF screen updates with this feature is requested
if [[ "x$WANT_VOSF" = "xyes" ]]; then
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
else
WANT_VOSF=no
fi
dnl Determine the addressing mode to use
ADDRESSING_MODE=""
@ -269,10 +284,13 @@ if [[ "x$HAVE_GCC30" = "xyes" ]]; then
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
ac_cv_gcc_no_strict_aliasing, [
AC_TRY_COMPILE([],[],
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
[ac_cv_gcc_no_strict_aliasing=yes],
[ac_cv_gcc_no_strict_aliasing=no])
])
CFLAGS="$SAVED_CFLAGS"
if test "x$ac_cv_gcc_no_strict_aliasing" = xyes; then
AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")
fi
fi
dnl Select appropriate CPU source and REGPARAM define.
@ -304,6 +322,11 @@ elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
fi
fi
dnl BINCUE overrides
if [[ "x$have_bincue" = "xyes" ]]; then
EXTRASRCS="$EXTRASRCS bincue.cpp"
fi
dnl Enable JIT compiler, if possible.
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
@ -524,19 +547,15 @@ CPUINCLUDES="-I../uae_cpu"
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
dnl We really want SDL for now
AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])])
SDL_CFLAGS=`$sdl_config --cflags`
AC_SUBST(SDL_CFLAGS)
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
SDL_LIBS=`$sdl_config --static-libs`
sdl_prefix=`$sdl_config --exec-prefix`
if [[ -n "$sdl_prefix" ]]; then
SDL_LIBS=`echo "$SDL_LIBS" | sed -e "s,-l\(SDLmain\|SDL\),$sdl_prefix/lib/lib\1.a,g"`
fi
SDL_LIBS="$SDL_LIBS -lwinmm"
if [[ "x$WANT_SDL_VERSION_MAJOR" = "x3" ]]; then
SDL_CFLAGS=`pkg-config sdl3 --cflags`
SDL_CFLAGS+=`echo " $SDL_CFLAGS" | sed -e 's/\(-I.*include\)/\1\/SDL3/'`
SDL_LIBS=`pkg-config sdl3 --libs | sed -e 's/-lSDL3/-lSDL3.dll/'`
else
SDL_LIBS=`$sdl_config --libs`
SDL_CFLAGS=`sdl2-config --cflags`
SDL_LIBS=`sdl2-config --static-libs`
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
@ -548,10 +567,14 @@ if [[ "x$HAVE_GCC27" = "xyes" ]]; then
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
fi
CFLAGS="$CFLAGS -fwrapv"
CXXFLAGS="$CXXFLAGS -fwrapv"
dnl Generate Makefile.
AC_SUBST(DEFINES)
AC_SUBST(CPUINCLUDES)
AC_SUBST(CPUSRCS)
AC_SUBST(EXTRASRCS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
@ -559,11 +582,14 @@ dnl Print summary.
echo
echo Basilisk II configuration summary:
echo
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
echo Use JIT compiler ....................... : $WANT_JIT
echo JIT debug mode ......................... : $WANT_JIT_DEBUG
echo Floating-Point emulation core .......... : $FPE_CORE
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
echo Addressing mode ........................ : $ADDRESSING_MODE
echo BINCUE support ......................... : $have_bincue
echo GTK user interface ..................... : $WANT_GTK
echo Enable VOSF ............................ : $WANT_VOSF
echo
echo "Configuration done. Now type \"make\" (or \"gmake\")."

View File

@ -39,7 +39,10 @@
#include "ether_windows.h"
#include "router/router.h"
#include "util_windows.h"
// somehow util_windows undefines min
#define min(x,y) ((x) < (y) ? (x) : (y))
#include "libslirp.h"
#include "ctl.h"
// Define to let the slirp library determine the right timeout for select()
#define USE_SLIRP_TIMEOUT 1
@ -99,6 +102,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
@ -134,6 +145,8 @@ static LPPACKET send_queue = 0;
static CRITICAL_SECTION wpool_csection;
static LPPACKET write_packet_pool = 0;
// Calling slirp functions from multiple threads concurrently is unsafe; guard it
static CRITICAL_SECTION slirp_single_call_csection;
// Try to deal with echos. Protected by fetch_csection.
@ -188,6 +201,8 @@ static int16 ether_do_add_multicast(uint8 *addr);
static int16 ether_do_del_multicast(uint8 *addr);
static int16 ether_do_write(uint32 arg);
static void ether_do_interrupt(void);
static void slirp_add_redirs();
static int slirp_add_redir(const char *redir_str);
/*
@ -251,6 +266,7 @@ bool ether_init(void)
WarningAlert(GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
return false;
}
slirp_add_redirs();
}
// Open ethernet device
@ -406,6 +422,8 @@ bool ether_init(void)
InitializeCriticalSectionAndSpinCount( &send_csection, 5000 );
InitializeCriticalSectionAndSpinCount( &wpool_csection, 5000 );
InitializeCriticalSection( &slirp_single_call_csection );
ether_th = (HANDLE)_beginthreadex( 0, 0, ether_thread_feed_int, 0, 0, &ether_tid );
if (!ether_th) {
D(bug("Failed to create ethernet thread\n"));
@ -555,6 +573,7 @@ void ether_exit(void)
DeleteCriticalSection( &queue_csection );
DeleteCriticalSection( &send_csection );
DeleteCriticalSection( &wpool_csection );
DeleteCriticalSection( &slirp_single_call_csection );
D(bug("Freeing read packets\n"));
free_read_packets();
@ -1008,7 +1027,9 @@ unsigned int WINAPI ether_thread_write_packets(void *arg)
}
break;
case NET_IF_SLIRP:
EnterCriticalSection( &slirp_single_call_csection );
slirp_input((uint8 *)Packet->Buffer, Packet->Length);
LeaveCriticalSection( &slirp_single_call_csection );
Packet->bIoComplete = TRUE;
recycle_write_packet(Packet);
break;
@ -1362,7 +1383,9 @@ unsigned int WINAPI slirp_receive_func(void *arg)
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&xfds);
EnterCriticalSection( &slirp_single_call_csection );
timeout = slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
LeaveCriticalSection( &slirp_single_call_csection );
#if ! USE_SLIRP_TIMEOUT
timeout = 10000;
#endif
@ -1378,8 +1401,11 @@ unsigned int WINAPI slirp_receive_func(void *arg)
tv.tv_usec = timeout;
ret = select(0, &rfds, &wfds, &xfds, &tv);
}
if (ret >= 0)
if (ret >= 0) {
EnterCriticalSection( &slirp_single_call_csection );
slirp_select_poll(&rfds, &wfds, &xfds);
LeaveCriticalSection( &slirp_single_call_csection );
}
}
D(bug("slirp_receive_func exit\n"));
@ -1569,10 +1595,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"));
}
@ -1612,6 +1644,97 @@ static void ether_do_interrupt(void)
}
}
// Helper function for port forwarding
static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
{
const char *p, *p1;
int len;
p = *pp;
p1 = strchr(p, sep);
if (!p1)
return -1;
len = p1 - p;
p1++;
if (buf_size > 0) {
if (len > buf_size - 1)
len = buf_size - 1;
memcpy(buf, p, len);
buf[len] = '\0';
}
*pp = p1;
return 0;
}
// Set up port forwarding for slirp
static void slirp_add_redirs()
{
int index = 0;
const char *str;
while ((str = PrefsFindString("redir", index++)) != NULL) {
slirp_add_redir(str);
}
}
// Add a port forward/redirection for slirp
static int slirp_add_redir(const char *redir_str)
{
// code adapted from qemu source
struct in_addr guest_addr = {0};
int host_port, guest_port;
const char *p;
char buf[256];
int is_udp;
char *end;
char str[256];
p = redir_str;
if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
if (!strcmp(buf, "tcp") || buf[0] == '\0') {
is_udp = 0;
} else if (!strcmp(buf, "udp")) {
is_udp = 1;
} else {
goto fail_syntax;
}
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
host_port = strtol(buf, &end, 0);
if (*end != '\0' || host_port < 1 || host_port > 65535) {
goto fail_syntax;
}
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
// 0.0.0.0 doesn't seem to work, so default to a client address
// if none is specified
if (buf[0] == '\0' ?
!inet_pton(AF_INET, CTL_LOCAL, &guest_addr) :
!inet_pton(AF_INET, buf, &guest_addr)) {
goto fail_syntax;
}
guest_port = strtol(p, &end, 0);
if (*end != '\0' || guest_port < 1 || guest_port > 65535) {
goto fail_syntax;
}
if (slirp_redir(is_udp, host_port, guest_addr, guest_port) < 0) {
sprintf(str, "could not set up host forwarding rule '%s'", redir_str);
WarningAlert(str);
return -1;
}
return 0;
fail_syntax:
sprintf(str, "invalid host forwarding rule '%s'", redir_str);
WarningAlert(str);
return -1;
}
#if DEBUG
#pragma optimize("",on)
#endif

106
BasiliskII/src/Windows/main_windows.cpp Executable file → Normal file
View File

@ -61,6 +61,11 @@ extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_suppo
#define DEBUG 0
#include "debug.h"
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define SDL_Mutex SDL_mutex
#define SDL_EVENT_KEY_UP SDL_KEYUP
#define SDL_EVENT_KEY_DOWN SDL_KEYDOWN
#endif
// Constants
const TCHAR ROM_FILE_NAME[] = TEXT("ROM");
@ -86,7 +91,7 @@ static bool tick_thread_active = false; // Flag: 60Hz thread installed
static volatile bool tick_thread_cancel = false; // Flag: Cancel 60Hz thread
static SDL_Thread *tick_thread; // 60Hz thread
static SDL_mutex *intflag_lock = NULL; // Mutex to protect InterruptFlags
static SDL_Mutex *intflag_lock = NULL; // Mutex to protect InterruptFlags
#define LOCK_INTFLAGS SDL_LockMutex(intflag_lock)
#define UNLOCK_INTFLAGS SDL_UnlockMutex(intflag_lock)
@ -98,11 +103,14 @@ uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped
#endif
static HHOOK keyboard_hook; // Hook for intercepting windows key events
// Prototypes
static int xpram_func(void *arg);
static int tick_func(void *arg);
static void one_tick(...);
static LRESULT CALLBACK low_level_keyboard_hook(int nCode, WPARAM wParam, LPARAM lParam);
/*
@ -181,12 +189,22 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
#endif
VideoQuitFullScreen();
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
QuitEmulator();
#endif
}
uint16 emulated_ticks;
void cpu_do_check_ticks(void)
{
static int delay = -1;
if (delay < 0)
delay = PrefsFindInt32("delay");
if (delay)
usleep(delay);
}
/*
* Main program
@ -204,6 +222,7 @@ static void usage(const char *prg_name)
);
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
PrefsPrintUsage();
printf("\nBuild Date: %s\n", __DATE__);
exit(0);
}
@ -283,9 +302,11 @@ int main(int argc, char **argv)
QuitEmulator();
#endif
// FIXME: default to DIB driver
if (getenv("SDL_VIDEODRIVER") == NULL)
putenv("SDL_VIDEODRIVER=windib");
// Install keyboard hook to block Windows key if enabled in prefs
if (PrefsFindBool("reservewindowskey"))
{
keyboard_hook = SetWindowsHookEx(WH_KEYBOARD_LL, low_level_keyboard_hook, GetModuleHandle(NULL), 0);
}
// Initialize SDL system
int sdl_flags = 0;
@ -323,7 +344,11 @@ int main(int argc, char **argv)
sigsegv_set_dump_state(sigsegv_dump_state);
// Read RAM size
RAMSize = PrefsFindInt32("ramsize") & 0xfff00000; // Round down to 1MB boundary
RAMSize = PrefsFindInt32("ramsize");
if (RAMSize <= 1000) {
RAMSize *= 1024 * 1024;
}
RAMSize &= 0xfff00000; // Round down to 1MB boundary
if (RAMSize < 1024*1024) {
WarningAlert(GetString(STR_SMALL_RAM_WARN));
RAMSize = 1024*1024;
@ -361,10 +386,10 @@ int main(int argc, char **argv)
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
// Get rom file path from preferences
auto rom_path = tstr(PrefsFindString("rom"));
const char* rom_path = PrefsFindString("rom");
// Load Mac ROM
HANDLE rom_fh = CreateFile(rom_path ? rom_path.get() : ROM_FILE_NAME,
HANDLE rom_fh = CreateFile((rom_path != NULL) ? rom_path : ROM_FILE_NAME,
GENERIC_READ,
FILE_SHARE_READ, NULL,
OPEN_EXISTING,
@ -400,7 +425,7 @@ int main(int argc, char **argv)
emul_thread = GetCurrentThread();
// SDL threads available, start 60Hz thread
tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, NULL)) != NULL);
tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, "Redraw Thread", NULL)) != NULL);
if (!tick_thread_active) {
sprintf(str, GetString(STR_TICK_THREAD_ERR), strerror(errno));
ErrorAlert(str);
@ -410,7 +435,7 @@ int main(int argc, char **argv)
// Start XPRAM watchdog thread
memcpy(last_xpram, XPRAM, XPRAM_SIZE);
xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, NULL)) != NULL);
xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, "XPRAM Thread", NULL)) != NULL);
D(bug("XPRAM thread started\n"));
// Start 68k and jump to ROM boot routine
@ -500,7 +525,7 @@ void FlushCodeCache(void *start, uint32 size)
struct B2_mutex {
B2_mutex() { m = SDL_CreateMutex(); }
~B2_mutex() { if (m) SDL_DestroyMutex(m); }
SDL_mutex *m;
SDL_Mutex *m;
};
B2_mutex *B2_create_mutex(void)
@ -598,13 +623,15 @@ static void one_tick(...)
}
}
bool tick_inhibit;
static int tick_func(void *arg)
{
uint64 start = GetTicks_usec();
int64 ticks = 0;
uint64 next = GetTicks_usec();
while (!tick_thread_cancel) {
one_tick();
if (!tick_inhibit)
one_tick();
next += 16625;
int64 delay = next - GetTicks_usec();
if (delay > 0)
@ -624,12 +651,25 @@ static int tick_func(void *arg)
*/
#ifdef USE_SDL_VIDEO
#if SDL_VERSION_ATLEAST(3, 0, 0)
#include <SDL_video.h>
#else
#include <SDL_syswm.h>
#endif
extern SDL_Window *sdl_window;
HWND GetMainWindowHandle(void)
{
if (!sdl_window) {
return NULL;
}
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_PropertiesID props = SDL_GetWindowProperties(sdl_window);
return (HWND)SDL_GetProperty(props, "SDL.window.cocoa.window", NULL);
#else
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
return SDL_GetWMInfo(&wmInfo) ? wmInfo.window : NULL;
return SDL_GetWindowWMInfo(sdl_window, &wmInfo) ? wmInfo.info.win.window : NULL;
#endif
}
#endif
@ -701,3 +741,43 @@ bool ChoiceAlert(const char *text, const char *pos, const char *neg)
printf(GetString(STR_SHELL_WARNING_PREFIX), text);
return false; //!!
}
/*
* Low level keyboard hook allowing us to intercept events involving the Windows key
*/
static LRESULT CALLBACK low_level_keyboard_hook(int nCode, WPARAM wParam, LPARAM lParam)
{
// Not a relevant event, immediately pass it on
if (nCode != HC_ACTION)
return CallNextHookEx(keyboard_hook, nCode, wParam, lParam);
KBDLLHOOKSTRUCT *p = (KBDLLHOOKSTRUCT *)lParam;
switch (wParam) {
case WM_KEYDOWN:
case WM_KEYUP:
// Intercept left/right windows keys when we have keyboard focus so Windows doesn't handle them
if (p->vkCode == VK_LWIN || p->vkCode == VK_RWIN) {
bool intercept_event = false;
#ifdef USE_SDL_VIDEO
if (sdl_window && (SDL_GetWindowFlags(sdl_window) & SDL_WINDOW_INPUT_FOCUS)) {
intercept_event = true;
}
#endif
// If we've determined we should intercept the event, intercept it. But pass the event onto SDL so Basilisk handles it.
if (intercept_event) {
SDL_Event e;
memset(&e, 0, sizeof(e));
e.type = (wParam == WM_KEYDOWN) ? SDL_EVENT_KEY_DOWN : SDL_EVENT_KEY_UP;
e.key.keysym.sym = (p->vkCode == VK_LWIN) ? SDLK_LGUI : SDLK_RGUI;
e.key.keysym.scancode = (p->vkCode == VK_LWIN) ? SDL_SCANCODE_LGUI : SDL_SCANCODE_RGUI;
SDL_PushEvent(&e);
return 1;
}
}
break;
}
// If we fall here, we weren't supposed to intercept it.
return CallNextHookEx(keyboard_hook, nCode, wParam, lParam);
}

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
}
/*
@ -951,30 +975,14 @@ static int dis_width, dis_height;
// Hide/show graphics widgets
static void hide_show_graphics_widgets(void)
{
switch (display_type) {
case DISPLAY_WINDOW:
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip);
break;
case DISPLAY_SCREEN:
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip);
break;
}
}
// "Window" video type selected
static void mn_window(...)
{
display_type = DISPLAY_WINDOW;
hide_show_graphics_widgets();
}
static void mn_window(...) {display_type = DISPLAY_WINDOW;}
// "Fullscreen" video type selected
static void mn_fullscreen(...)
{
display_type = DISPLAY_SCREEN;
hide_show_graphics_widgets();
PrefsReplaceInt32("frameskip", 1);
}
static void mn_fullscreen(...) {display_type = DISPLAY_SCREEN;}
// "5 Hz".."60Hz" selected
static void mn_5hz(...) {PrefsReplaceInt32("frameskip", 12);}
@ -1006,6 +1014,33 @@ static void tb_nosound(GtkWidget *widget)
set_graphics_sensitive();
}
// SDL Graphics
#ifdef USE_SDL_VIDEO
// SDL Renderer Render Driver
enum {
RENDER_SOFTWARE = 0,
RENDER_OPENGL = 1,
RENDER_DIRECT3D = 2
};
GtkWidget *w_render_driver;
GtkWidget *l_render_driver;
static int render_driver;
static int sdl_vsync;
// Render Driver selected
static void mn_sdl_software(...) {render_driver = RENDER_SOFTWARE;}
static void mn_sdl_opengl(...) {render_driver = RENDER_OPENGL;}
static void mn_sdl_direct3d(...) {render_driver = RENDER_DIRECT3D;}
// SDL Renderer Vertical Sync
static void tb_sdl_vsync(GtkWidget *widget)
{
PrefsReplaceBool("sdl_vsync", GTK_TOGGLE_BUTTON(widget)->active);
}
#endif
// Read graphics preferences
static void parse_graphics_prefs(void)
{
@ -1025,6 +1060,40 @@ static void parse_graphics_prefs(void)
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2)
display_type = DISPLAY_SCREEN;
}
#ifdef USE_SDL_VIDEO
render_driver = RENDER_SOFTWARE;
const char *drv = PrefsFindString("sdlrender");
if (drv && drv[0]) {
if (strcmp(drv, "software") == 0)
render_driver = RENDER_SOFTWARE;
else if (strcmp(drv, "opengl") == 0)
render_driver = RENDER_OPENGL;
else if (strcmp(drv, "direct3d") == 0)
render_driver = RENDER_DIRECT3D;
}
#endif
}
static void read_SDL_graphics_settings(void)
{
const char *rpref;
switch (render_driver) {
case RENDER_SOFTWARE:
rpref = "software";
break;
case RENDER_OPENGL:
rpref = "opengl";
break;
case RENDER_DIRECT3D:
rpref = "direct3d";
break;
default:
PrefsRemoveItem("sdlrender");
return;
}
PrefsReplaceString("sdlrender", rpref);
}
// Read settings from widgets and set preferences
@ -1051,6 +1120,10 @@ static void read_graphics_settings(void)
return;
}
PrefsReplaceString("screen", pref);
#ifdef USE_SDL_VIDEO
read_SDL_graphics_settings();
#endif
}
// Create "Graphics/Sound" pane
@ -1160,6 +1233,39 @@ static void create_graphics_pane(GtkWidget *top)
make_checkbox(box, STR_GFXACCEL_CTRL, "gfxaccel", GTK_SIGNAL_FUNC(tb_gfxaccel));
#endif
#ifdef USE_SDL_VIDEO
make_separator(box);
table = make_table(box, 2, 5);
l_render_driver = gtk_label_new(GetString(STR_GRAPHICS_SDL_RENDER_DRIVER_CTRL));
gtk_widget_show(l_render_driver);
gtk_table_attach(GTK_TABLE(table), l_render_driver, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
w_render_driver = gtk_option_menu_new();
gtk_widget_show(w_render_driver);
menu = gtk_menu_new();
add_menu_item(menu, STR_SOFTWARE_LAB, GTK_SIGNAL_FUNC(mn_sdl_software));
add_menu_item(menu, STR_OPENGL_LAB, GTK_SIGNAL_FUNC(mn_sdl_opengl));
add_menu_item(menu, STR_DIRECT3D_LAB, GTK_SIGNAL_FUNC(mn_sdl_direct3d));
switch (render_driver) {
case RENDER_SOFTWARE:
gtk_menu_set_active(GTK_MENU(menu), 0);
break;
case RENDER_OPENGL:
gtk_menu_set_active(GTK_MENU(menu), 1);
break;
case RENDER_DIRECT3D:
gtk_menu_set_active(GTK_MENU(menu), 2);
break;
}
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_render_driver), menu);
gtk_table_attach(GTK_TABLE(table), w_render_driver, 1, 2, 0, 1, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
opt = make_checkbox(box, STR_GRAPHICS_SDL_VSYNC_CTRL, "sdl_vsync", GTK_SIGNAL_FUNC(tb_sdl_vsync));
#endif
make_separator(box);
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
@ -1192,6 +1298,12 @@ static void tb_keycodes(GtkWidget *widget)
set_input_sensitive();
}
// "Reserve Windows Key" button toggled
static void tb_reservewindowskey(GtkWidget *widget)
{
PrefsReplaceBool("reservewindowskey", GTK_TOGGLE_BUTTON(widget)->active);
}
// "Mouse Wheel Mode" selected
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();}
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();}
@ -1239,6 +1351,8 @@ static void create_input_pane(GtkWidget *top)
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
g_object_set_data(G_OBJECT(w_keycode_file), "chooser_button", button);
make_checkbox(box, STR_RESERVE_WINDOWS_KEY_CTRL, "reservewindowskey", GTK_SIGNAL_FUNC(tb_reservewindowskey));
make_separator(box);
static const opt_desc options[] = {
@ -1466,24 +1580,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 +1606,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 +1850,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 +1935,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

@ -35,9 +35,6 @@ prefs_desc platform_prefs_items[] = {
{"keycodefile", TYPE_STRING, false, "path of keycode translation 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"},
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
#endif
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
{"enableextfs", TYPE_BOOLEAN, false, "enable extfs system"},
{"debugextfs", TYPE_BOOLEAN, false, "debug extfs system"},
@ -52,6 +49,12 @@ prefs_desc platform_prefs_items[] = {
{"tcp_port", TYPE_STRING, false, "TCP ports list"},
{"portfile0", TYPE_STRING, false, "output file for serial port 0"},
{"portfile1", TYPE_STRING, false, "output file for serial port 1"},
#ifdef USE_SDL_VIDEO
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
{"sdl_vsync", TYPE_BOOLEAN, false, "Make SDL_Renderer vertical sync frames to host (eg. with software renderer)"},
#endif
{"reservewindowskey", TYPE_BOOLEAN, false, "block Windows key from activating start menu"},
{NULL, TYPE_END, false, NULL} // End of list
};
@ -123,9 +126,6 @@ void AddPlatformPrefsDefaults(void)
PrefsReplaceString("extdrives", "CDEFGHIJKLMNOPQRSTUVWXYZ");
PrefsReplaceInt32("mousewheelmode", 1);
PrefsReplaceInt32("mousewheellines", 3);
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
PrefsAddBool("ignoresegv", false);
#endif
PrefsAddBool("idlewait", true);
PrefsReplaceBool("etherpermanentaddress", true);
PrefsReplaceInt32("ethermulticastmode", 0);
@ -134,4 +134,9 @@ void AddPlatformPrefsDefaults(void)
PrefsReplaceString("serialb", "COM2");
PrefsReplaceString("portfile0", "C:\\B2TEMP0.OUT");
PrefsReplaceString("portfile1", "C:\\B2TEMP1.OUT");
#ifdef USE_SDL_VIDEO
PrefsReplaceString("sdlrender", "software");
PrefsReplaceBool("sdl_vsync", false);
#endif
PrefsAddBool("reservewindowskey", false);
}

View File

@ -28,6 +28,8 @@
#include "main.h"
#include "util_windows.h"
// somehow util_windows undefines min
#define min(x,y) ((x) < (y) ? (x) : (y))
#include "macos_util.h"
#include "prefs.h"
#include "serial.h"
@ -310,12 +312,12 @@ open_error:
if (input_thread_active) {
TerminateThread(input_thread_active,0);
CloseHandle(input_signal);
input_thread_active = false;
input_thread_active = 0;
}
if (output_thread_active) {
TerminateThread(output_thread_active,0);
CloseHandle(output_signal);
output_thread_active = false;
output_thread_active = 0;
}
if(fd != INVALID_HANDLE_VALUE) {
CloseHandle(fd);
@ -674,13 +676,13 @@ int16 XSERDPort::close()
if (input_thread_active) {
quitting = true;
ReleaseSemaphore(input_signal,1,NULL);
input_thread_active = false;
input_thread_active = 0;
CloseHandle(input_signal);
}
if (output_thread_active) {
quitting = true;
ReleaseSemaphore(output_signal,1,NULL);
output_thread_active = false;
output_thread_active = 0;
// bugfix: was: CloseHandle(&output_signal);
CloseHandle(output_signal);
}

View File

@ -40,6 +40,10 @@ using std::min;
#include "cdenable/cache.h"
#include "cdenable/eject_nt.h"
#if defined(BINCUE)
#include "bincue.h"
#endif
#define DEBUG 0
#include "debug.h"
@ -56,6 +60,12 @@ struct file_handle {
loff_t file_size; // Size of file data (only valid if is_file is true)
cachetype cache;
bool is_media_present;
#if defined(BINCUE)
bool is_bincue; // Flag: BIN CUE file
void *bincue_fd;
file_handle() {is_bincue = false;} // default bincue false
#endif
};
// Open file handles
@ -74,7 +84,7 @@ static char *sector_buffer = NULL;
// Prototypes
static bool is_cdrom_readable(file_handle *fh);
static DWORD file_offset_read(HANDLE fh, loff_t offset, int count, char *buf);
/*
* Initialization
@ -256,12 +266,42 @@ void SysAddSerialPrefs(void)
* Can't give too much however, would be annoying, this is difficult..
*/
static inline int cd_read_with_retry(file_handle *fh, ULONG LBA, int count, char *buf )
static inline int cd_read_with_retry(file_handle *fh, ULONG offset, int count, char *buf )
{
if (!fh || !fh->fh)
return 0;
return CdenableSysReadCdBytes(fh->fh, LBA, count, buf);
DWORD bytes_read = CdenableSysReadCdBytes(fh->fh, offset, count, buf);
if (bytes_read == 0) {
// fall back to logical volume handle read in the case where there's no cdenable
bytes_read = file_offset_read(fh->fh, offset, count, buf);
}
return bytes_read;
}
/*
* Generic offset read function for a file or a device that behaves like one
*/
static DWORD file_offset_read(HANDLE fh, loff_t offset, int count, char *buf)
{
// Seek to position
LONG lo = (LONG)offset;
LONG hi = (LONG)(offset >> 32);
DWORD r = SetFilePointer(fh, lo, &hi, FILE_BEGIN);
if (r == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
return 0;
}
DWORD bytes_read;
// Read data
if (ReadFile(fh, buf, count, &bytes_read, NULL) == 0)
bytes_read = 0;
return bytes_read;
}
static int cd_read(file_handle *fh, cachetype *cptr, ULONG LBA, int count, char *buf)
@ -406,7 +446,7 @@ static bool is_read_only_path(const TCHAR *name)
* Open file/device, create new file handle (returns NULL on error)
*/
void *Sys_open(const char *path_name, bool read_only)
void *Sys_open(const char *path_name, bool read_only, bool is_cdrom)
{
file_handle * fh = NULL;
@ -462,6 +502,11 @@ void *Sys_open(const char *path_name, bool read_only)
read_only = true;
// Open file
#if defined(BINCUE)
void *binfd = open_bincue(name); // check if bincue
#endif
HANDLE h = CreateFile(
name,
read_only ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
@ -486,6 +531,16 @@ void *Sys_open(const char *path_name, bool read_only)
fh->is_floppy = false;
fh->is_cdrom = false;
#if defined(BINCUE)
if (binfd) {
fh->bincue_fd = binfd;
fh->is_bincue = true;
fh->is_media_present = true;
sys_add_file_handle(fh);
return fh;
}
#endif
// Detect disk image file layout
loff_t size = GetFileSize(h, NULL);
DWORD bytes_read;
@ -517,6 +572,11 @@ void Sys_close(void *arg)
sys_remove_file_handle(fh);
#if defined(BINCUE)
if (fh->is_bincue)
close_bincue(fh->bincue_fd);
#endif
if (fh->is_cdrom) {
cache_final(&fh->cache);
SysAllowRemoval((void *)fh);
@ -543,19 +603,15 @@ size_t Sys_read(void *arg, void *buffer, loff_t offset, size_t length)
if (!fh)
return 0;
#if defined(BINCUE)
if (fh->is_bincue)
return read_bincue(fh->bincue_fd, buffer, offset, length);
#endif
DWORD bytes_read = 0;
if (fh->is_file) {
// Seek to position
LONG lo = (LONG)offset;
LONG hi = (LONG)(offset >> 32);
DWORD r = SetFilePointer(fh->fh, lo, &hi, FILE_BEGIN);
if (r == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
return 0;
// Read data
if (ReadFile(fh->fh, buffer, length, &bytes_read, NULL) == 0)
bytes_read = 0;
bytes_read = file_offset_read(fh->fh, offset, length, (char *)buffer);
}
else if (fh->is_cdrom) {
int bytes_left, try_bytes, got_bytes;
@ -623,6 +679,11 @@ loff_t SysGetFileSize(void *arg)
if (!fh)
return true;
#if defined(BINCUE)
if (fh->is_bincue)
return size_bincue(fh->bincue_fd);
#endif
if (fh->is_file)
return fh->file_size;
else if (fh->is_cdrom)
@ -644,6 +705,13 @@ void SysEject(void *arg)
if (!fh)
return;
#if defined(BINCUE)
if (fh->is_bincue) {
fh->is_media_present = false;
return;
}
#endif
if (fh->is_cdrom && fh->fh) {
fh->is_media_present = false;
// Commented out because there was some problems, but can't remember
@ -782,16 +850,26 @@ void SysAllowRemoval(void *arg)
bool SysCDReadTOC(void *arg, uint8 *toc)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
DWORD dummy;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_READ_TOC,
NULL, 0,
toc, min((int)sizeof(CDROM_TOC), 804),
&dummy,
NULL) != FALSE;
#if defined(BINCUE)
if (fh->is_bincue)
return readtoc_bincue(fh->bincue_fd, toc);
#endif
if (fh->is_cdrom) {
DWORD dummy;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_READ_TOC,
NULL, 0,
toc, min((int)sizeof(CDROM_TOC), 804),
&dummy,
NULL) != FALSE;
} else
return false;
}
@ -802,26 +880,34 @@ bool SysCDReadTOC(void *arg, uint8 *toc)
bool SysCDGetPosition(void *arg, uint8 *pos)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
SUB_Q_CHANNEL_DATA q_data;
#if defined(BINCUE)
if (fh->is_bincue)
return GetPosition_bincue(fh->bincue_fd, pos);
#endif
CDROM_SUB_Q_DATA_FORMAT q_format;
q_format.Format = IOCTL_CDROM_CURRENT_POSITION;
q_format.Track = 0; // used only by ISRC reads
if (fh->is_cdrom) {
SUB_Q_CHANNEL_DATA q_data;
DWORD dwBytesReturned = 0;
bool ok = DeviceIoControl(fh->fh,
IOCTL_CDROM_READ_Q_CHANNEL,
&q_format, sizeof(CDROM_SUB_Q_DATA_FORMAT),
&q_data, sizeof(SUB_Q_CHANNEL_DATA),
&dwBytesReturned,
NULL) != FALSE;
if (ok)
memcpy(pos, &q_data.CurrentPosition, sizeof(SUB_Q_CURRENT_POSITION));
CDROM_SUB_Q_DATA_FORMAT q_format;
q_format.Format = IOCTL_CDROM_CURRENT_POSITION;
q_format.Track = 0; // used only by ISRC reads
return ok;
DWORD dwBytesReturned = 0;
bool ok = DeviceIoControl(fh->fh,
IOCTL_CDROM_READ_Q_CHANNEL,
&q_format, sizeof(CDROM_SUB_Q_DATA_FORMAT),
&q_data, sizeof(SUB_Q_CHANNEL_DATA),
&dwBytesReturned,
NULL) != FALSE;
if (ok)
memcpy(pos, &q_data.CurrentPosition, sizeof(SUB_Q_CURRENT_POSITION));
return ok;
} else
return false;
}
@ -832,24 +918,32 @@ bool SysCDGetPosition(void *arg, uint8 *pos)
bool SysCDPlay(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, uint8 end_m, uint8 end_s, uint8 end_f)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
CDROM_PLAY_AUDIO_MSF msf;
msf.StartingM = start_m;
msf.StartingS = start_s;
msf.StartingF = start_f;
msf.EndingM = end_m;
msf.EndingS = end_s;
msf.EndingF = end_f;
#if defined(BINCUE)
if (fh->is_bincue)
return CDPlay_bincue(fh->bincue_fd, start_m, start_s, start_f, end_m, end_s, end_f);
#endif
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_PLAY_AUDIO_MSF,
&msf, sizeof(CDROM_PLAY_AUDIO_MSF),
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
if (fh->is_cdrom) {
CDROM_PLAY_AUDIO_MSF msf;
msf.StartingM = start_m;
msf.StartingS = start_s;
msf.StartingF = start_f;
msf.EndingM = end_m;
msf.EndingS = end_s;
msf.EndingF = end_f;
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_PLAY_AUDIO_MSF,
&msf, sizeof(CDROM_PLAY_AUDIO_MSF),
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
} else
return false;
}
@ -860,16 +954,24 @@ bool SysCDPlay(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, uint8 end
bool SysCDPause(void *arg)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_PAUSE_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
#if defined(BINCUE)
if (fh->is_bincue)
return CDPause_bincue(fh->bincue_fd);
#endif
if (fh->is_cdrom) {
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_PAUSE_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
} else
return false;
}
@ -880,15 +982,23 @@ bool SysCDPause(void *arg)
bool SysCDResume(void *arg)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_RESUME_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned, NULL) != FALSE;
#if defined(BINCUE)
if (fh->is_bincue)
return CDResume_bincue(fh->bincue_fd);
#endif
if (fh->is_cdrom) {
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_RESUME_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned, NULL) != FALSE;
} else
return false;
}
@ -899,16 +1009,24 @@ bool SysCDResume(void *arg)
bool SysCDStop(void *arg, uint8 lead_out_m, uint8 lead_out_s, uint8 lead_out_f)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_STOP_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
#if defined(BINCUE)
if (fh->is_bincue)
return CDStop_bincue(fh->bincue_fd);
#endif
if (fh->is_cdrom) {
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_STOP_AUDIO,
NULL, 0,
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
} else
return false;
}
@ -919,21 +1037,30 @@ bool SysCDStop(void *arg, uint8 lead_out_m, uint8 lead_out_s, uint8 lead_out_f)
bool SysCDScan(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, bool reverse)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return false;
CDROM_SEEK_AUDIO_MSF msf;
msf.M = start_m;
msf.S = start_s;
msf.F = start_f;
#if defined(BINCUE)
if (fh->is_bincue)
return CDScan_bincue(fh->bincue_fd,start_m,start_s,start_f,reverse);
#endif
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_SEEK_AUDIO_MSF,
&msf, sizeof(CDROM_SEEK_AUDIO_MSF),
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
if (fh->is_cdrom) {
CDROM_SEEK_AUDIO_MSF msf;
msf.M = start_m;
msf.S = start_s;
msf.F = start_f;
DWORD dwBytesReturned = 0;
return DeviceIoControl(fh->fh,
IOCTL_CDROM_SEEK_AUDIO_MSF,
&msf, sizeof(CDROM_SEEK_AUDIO_MSF),
NULL, 0,
&dwBytesReturned,
NULL) != FALSE;
} else
return false;
}
@ -944,22 +1071,30 @@ bool SysCDScan(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, bool reve
void SysCDSetVolume(void *arg, uint8 left, uint8 right)
{
file_handle *fh = (file_handle *)arg;
if (!fh || !fh->fh || !fh->is_cdrom)
if (!fh)
return;
VOLUME_CONTROL vc;
vc.PortVolume[0] = left;
vc.PortVolume[1] = right;
vc.PortVolume[2] = left;
vc.PortVolume[3] = right;
#if defined(BINCUE)
if (fh->is_bincue)
CDSetVol_bincue(fh->bincue_fd,left,right);
#endif
DWORD dwBytesReturned = 0;
DeviceIoControl(fh->fh,
IOCTL_CDROM_SET_VOLUME,
&vc, sizeof(VOLUME_CONTROL),
NULL, 0,
&dwBytesReturned,
NULL);
if (fh->is_cdrom) {
VOLUME_CONTROL vc;
vc.PortVolume[0] = left;
vc.PortVolume[1] = right;
vc.PortVolume[2] = left;
vc.PortVolume[3] = right;
DWORD dwBytesReturned = 0;
DeviceIoControl(fh->fh,
IOCTL_CDROM_SET_VOLUME,
&vc, sizeof(VOLUME_CONTROL),
NULL, 0,
&dwBytesReturned,
NULL);
}
}
@ -974,21 +1109,27 @@ void SysCDGetVolume(void *arg, uint8 &left, uint8 &right)
return;
left = right = 0;
if (!fh->fh || !fh->is_cdrom)
return;
VOLUME_CONTROL vc;
memset(&vc, 0, sizeof(vc));
#if defined(BINCUE)
if (fh->is_bincue)
CDGetVol_bincue(fh->bincue_fd,&left,&right);
#endif
if (fh->is_cdrom) {
DWORD dwBytesReturned = 0;
if (DeviceIoControl(fh->fh,
IOCTL_CDROM_GET_VOLUME,
NULL, 0,
&vc, sizeof(VOLUME_CONTROL),
&dwBytesReturned,
NULL))
{
left = vc.PortVolume[0];
right = vc.PortVolume[1];
VOLUME_CONTROL vc;
memset(&vc, 0, sizeof(vc));
DWORD dwBytesReturned = 0;
if (DeviceIoControl(fh->fh,
IOCTL_CDROM_GET_VOLUME,
NULL, 0,
&vc, sizeof(VOLUME_CONTROL),
&dwBytesReturned,
NULL))
{
left = vc.PortVolume[0];
right = vc.PortVolume[1];
}
}
}

View File

@ -28,9 +28,9 @@
#include "config.h"
#include "user_strings_windows.h"
#ifndef STDC_HEADERS
#error "You don't have ANSI C header files."
#endif
//#ifndef STDC_HEADERS
//#error "You don't have ANSI C header files."
//#endif
#ifndef WIN32
#define WIN32
@ -220,7 +220,6 @@ static inline int spin_trylock(spinlock_t *lock)
}
#endif
#define X86_PPRO_OPT
#define HAVE_OPTIMIZED_BYTESWAP_32
#define HAVE_OPTIMIZED_BYTESWAP_16
@ -234,24 +233,12 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v) {return _byteswap_ushort(v);}
#else
/* Intel x86 */
static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;}
#ifdef X86_PPRO_OPT
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;}
#else
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;}
#endif
static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
#ifdef X86_PPRO_OPT
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;}
#else
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
#endif
/* bswap doesn't affect condition codes */
static inline uae_u32 do_byteswap_32_g(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;}
#ifdef X86_PPRO_OPT
static inline uae_u32 do_byteswap_16_g(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;}
#else
static inline uae_u32 do_byteswap_16_g(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;}
#endif
#endif
#define HAVE_GET_WORD_UNSWAPPED
@ -331,6 +318,8 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v)
#ifdef _MSC_VER
#define ATTRIBUTE_PACKED
#else
#define ATTRIBUTE_PACKED __attribute__((__packed__))
#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[] = {
@ -37,7 +37,6 @@ user_string_def platform_strings[] = {
{STR_NO_AUDIO_WARN, "No audio device found, audio output will be disabled."},
{STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
{STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
{STR_WINDOW_TITLE_GRABBED, "Basilisk II (mouse grabbed, press Ctrl-F5 to release)"},
{STR_NO_WIN32_NT_4, "Basilisk II does not run on Windows NT versions less than 4.0"},
{STR_PREFS_MENU_FILE_GTK, "/_File"},
@ -57,6 +56,7 @@ user_string_def platform_strings[] = {
{STR_INPUT_PANE_TITLE, "Keyboard/Mouse"},
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
{STR_KEYCODE_FILE_CTRL, "Keycode Translation File"},
{STR_RESERVE_WINDOWS_KEY_CTRL, "Reserve Windows Key"},
{STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"},
{STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"},
{STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"},
@ -82,7 +82,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
@ -119,14 +123,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

@ -39,7 +39,6 @@ enum {
STR_NO_AUDIO_WARN,
STR_KEYCODE_FILE_WARN,
STR_KEYCODE_VENDOR_WARN,
STR_WINDOW_TITLE_GRABBED,
STR_NO_WIN32_NT_4,
STR_PREFS_MENU_FILE_GTK,
@ -59,6 +58,7 @@ enum {
STR_INPUT_PANE_TITLE,
STR_KEYCODES_CTRL,
STR_KEYCODE_FILE_CTRL,
STR_RESERVE_WINDOWS_KEY_CTRL,
STR_MOUSEWHEELMODE_CTRL,
STR_MOUSEWHEELMODE_PAGE_LAB,
STR_MOUSEWHEELMODE_CURSOR_LAB,

View File

@ -271,7 +271,8 @@ bool check_drivers(void)
else {
TCHAR str[256];
_sntprintf(str, lengthof(str), TEXT("The CD-ROM driver file \"%s\" is missing."), path);
WarningAlert(str);
//WarningAlert(str);
}
return true;
@ -400,7 +401,7 @@ const TCHAR *ether_guid_to_name(const TCHAR *guid)
#define ADAPTER_KEY TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
const _TCHAR * tap_component_ids[] = { TEXT("tap0801"), TEXT("tap0901"), 0 };
const _TCHAR * tap_component_ids[] = { TEXT("root\\tap0801"), TEXT("root\\tap0901"), 0 };
const TCHAR *ether_tap_devices(void)
{

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
@ -152,7 +157,7 @@ void ADBOp(uint8 op, uint8 *data)
break;
case 3: // Address/HandlerID
data[0] = 2;
data[1] = mouse_reg_3[0] & 0xf0 | (rand() & 0x0f);
data[1] = (mouse_reg_3[0] & 0xf0) | (rand() & 0x0f);
data[2] = mouse_reg_3[1];
break;
default:
@ -211,7 +216,7 @@ void ADBOp(uint8 op, uint8 *data)
}
case 3: // Address/HandlerID
data[0] = 2;
data[1] = key_reg_3[0] & 0xf0 | (rand() & 0x0f);
data[1] = (key_reg_3[0] & 0xf0) | (rand() & 0x0f);
data[2] = key_reg_3[1];
break;
default:
@ -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;
}
}
}
@ -340,41 +353,45 @@ void ADBInterrupt(void)
int my = mouse_y;
if (relative_mouse)
mouse_x = mouse_y = 0;
bool mb[3] = {mouse_button[0], mouse_button[1], mouse_button[2]};
B2_unlock_mutex(mouse_lock);
uint32 key_base = adb_base + 4;
uint32 mouse_base = adb_base + 16;
if (relative_mouse) {
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 +422,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

@ -31,6 +31,8 @@
#include "main.h"
#include "audio.h"
#include "audio_defs.h"
#include "user_strings.h"
#include "cdrom.h"
#define DEBUG 0
#include "debug.h"
@ -51,6 +53,9 @@ static int open_count = 0; // Open/close nesting count
bool AudioAvailable = false; // Flag: audio output available (from the software point of view)
int SoundInSource = 2;
int SoundInPlaythrough = 7;
int SoundInGain = 65536; // FIXED 4-byte from 0.5 to 1.5; this is middle value (1) as int
/*
* Reset audio emulation
@ -406,8 +411,8 @@ adat_error: printf("FATAL: audio component data block initialization error\n");
// Close Apple Mixer
r.a[0] = AudioStatus.mixer;
Execute68k(audio_data + adatCloseMixer, &r);
D(bug(" CloseMixer() returns %08lx, mixer %08lx\n", r.d[0], AudioStatus.mixer));
AudioStatus.mixer = 0;
return r.d[0];
}
r.a[0] = audio_data;
Execute68kTrap(0xa01f, &r); // DisposePtr()
@ -533,7 +538,7 @@ delegate: // Delegate call to Apple Mixer
}
}
// not currently using these functions
/*
* Sound input driver Open() routine
*/
@ -553,7 +558,20 @@ int16 SoundInPrime(uint32 pb, uint32 dce)
{
D(bug("SoundInPrime\n"));
//!!
return paramErr;
uint16 code = ReadMacInt16(pb + csCode);
D(bug("SoundInControl %d\n", code));
if (code == 1) {
D(bug(" SoundInKillIO\n"));
//!!
return noErr;
}
if (code != 2)
return -231; // siUnknownInfoType
return noErr;
}
@ -574,12 +592,39 @@ int16 SoundInControl(uint32 pb, uint32 dce)
if (code != 2)
return -231; // siUnknownInfoType
uint32 *param = (uint32 *)Mac2HostAddr(pb + csParam);
uint32 selector = param[0];
D(bug(" selector %c%c%c%c\n", selector >> 24, selector >> 16, selector >> 8, selector));
uint32 selector = ReadMacInt32(pb + csParam); // 4-byte selector (should match via FOURCC above)
switch (selector) {
case siInitializeDriver: {
// If possible, the driver initializes the device to a sampling rate of 22 kHz, a sample size of 8 bits, mono recording, no compression, automatic gain control on, and all other features off.
return noErr;
}
case siCloseDriver: {
// The sound input device driver should stop any recording in progress, deallocate the input hardware, and initialize local variables to default settings.
return noErr;
}
case siInputSource: {
SoundInSource = ReadMacInt16(pb + csParam + 4);
return noErr;
}
case siPlayThruOnOff: {
SoundInPlaythrough = ReadMacInt16(pb + csParam + 4);
return noErr;
}
case siOptionsDialog: {
return noErr;
}
case siInputGain: {
SoundInGain = ReadMacInt32(pb + csParam + 4);
return noErr;
}
default:
return -231; // siUnknownInfoType
}
@ -590,58 +635,187 @@ int16 SoundInControl(uint32 pb, uint32 dce)
* Sound input driver Status() routine
*/
int16 SoundInStatus(uint32 pb, uint32 dce)
int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parameter block (pb) and A1 to device control entry (dce)
{
uint16 code = ReadMacInt16(pb + csCode);
D(bug("SoundInStatus %d\n", code));
if (code != 2)
return -231; // siUnknownInfoType
// two choices on return
// 1: if under 18 bytes, place # of bytes at (pb+csParam) and write from (pb+csParam+4) on
// 2: if over 18 bytes, place 0 at (pb+csParam) and directly write into address pointed to by (pb+csParam+4)
uint32 selector = ReadMacInt32(pb + csParam); // 4-byte selector (should match via FOURCC above)
uint32 bufferptr = ReadMacInt32(pb + csParam + 4); // 4-byte address to the buffer in vm memory
uint32 *param = (uint32 *)Mac2HostAddr(pb + csParam);
uint32 selector = param[0];
D(bug(" selector %c%c%c%c\n", selector >> 24, selector >> 16, selector >> 8, selector));
switch (selector) {
#if 0
case siDeviceName: {
const char *str = GetString(STR_SOUND_IN_NAME);
param[0] = 0;
memcpy((void *)param[1], str, strlen(str));
case siDeviceName: { // return name in STR255 format
const uint8 str[] = { // size 9
0x08, // 1-byte length
0x42, 0x75, // Bu
0x69, 0x6c, // il
0x74, 0x2d, // t-
0x69, 0x6e // in
};
// const uint8 str[] = { // size 12
// 0x0b, // 1-byte length
// 0x53, 0x68, // Sh
// 0x65, 0x65, // ee
// 0x70, 0x73, // ps
// 0x68, 0x61, // ha
// 0x76, 0x65, // ve
// 0x72 // r
// };
WriteMacInt32(pb + csParam, 0); // response will be written directly into buffer
Host2Mac_memcpy(bufferptr, str, sizeof(str));
return noErr;
}
case siDeviceIcon: {
// todo: add soundin ICN, borrow from CD ROM for now
WriteMacInt32(pb + csParam, 0);
M68kRegisters r;
static const uint8 proc[] = {
0x55, 0x8f, // subq.l #2,sp
0xa9, 0x94, // CurResFile
0x42, 0x67, // clr.w -(sp)
0xa9, 0x98, // UseResFile
0x59, 0x8f, // subq.l #4,sp
0x48, 0x79, 0x49, 0x43, 0x4e, 0x23, // move.l #'ICN#',-(sp)
0x3f, 0x3c, 0xbf, 0x76, // move.w #-16522,-(sp)
0xa9, 0xa0, // GetResource
0x24, 0x5f, // move.l (sp)+,a2
0xa9, 0x98, // UseResFile
0x20, 0x0a, // move.l a2,d0
0x66, 0x04, // bne 1
0x70, 0x00, // moveq #0,d0
M68K_RTS >> 8, M68K_RTS & 0xff,
0x2f, 0x0a, //1 move.l a2,-(sp)
0xa9, 0x92, // DetachResource
0x20, 0x4a, // move.l a2,a0
0xa0, 0x4a, // HNoPurge
0x70, 0x01, // moveq #1,d0
M68K_RTS >> 8, M68K_RTS & 0xff
};
Execute68k(Host2MacAddr((uint8 *)proc), &r);
if (r.d[0]) {
param[0] = 4; // Length of returned data
param[1] = r.a[2]; // Handle to icon suite
return noErr;
} else
return -192; // resNotFound
r.d[0] = sizeof(CDROMIcon);
Execute68kTrap(0xa122, &r); // NewHandle()
uint32 h = r.a[0];
if (h == 0)
return memFullErr;
WriteMacInt32(bufferptr, h);
uint32 sp = ReadMacInt32(h);
Host2Mac_memcpy(sp, CDROMIcon, sizeof(CDROMIcon));
return noErr;
// 68k code causes crash in sheep and link error in basilisk
// M68kRegisters r;
// static const uint8 proc[] = {
// 0x55, 0x8f, // subq.l #2,sp
// 0xa9, 0x94, // CurResFile
// 0x42, 0x67, // clr.w -(sp)
// 0xa9, 0x98, // UseResFile
// 0x59, 0x8f, // subq.l #4,sp
// 0x48, 0x79, 0x49, 0x43, 0x4e, 0x23, // move.l #'ICN#',-(sp)
// 0x3f, 0x3c, 0xbf, 0x76, // move.w #-16522,-(sp)
// 0xa9, 0xa0, // GetResource
// 0x24, 0x5f, // move.l (sp)+,a2
// 0xa9, 0x98, // UseResFile
// 0x20, 0x0a, // move.l a2,d0
// 0x66, 0x04, // bne 1
// 0x70, 0x00, // moveq #0,d0
// M68K_RTS >> 8, M68K_RTS & 0xff,
// 0x2f, 0x0a, //1 move.l a2,-(sp)
// 0xa9, 0x92, // DetachResource
// 0x20, 0x4a, // move.l a2,a0
// 0xa0, 0x4a, // HNoPurge
// 0x70, 0x01, // moveq #1,d0
// M68K_RTS >> 8, M68K_RTS & 0xff
// };
// Execute68k(Host2MacAddr((uint8 *)proc), &r);
// if (r.d[0]) {
// WriteMacInt32(pb + csParam, 4); // Length of returned data
// WriteMacInt32(pb + csParam + 4, r.a[2]); // Handle to icon suite
// return noErr;
// } else
// return -192; // resNotFound
}
#endif
case siInputSource: {
// return -231 if only 1 or index of current source if more
WriteMacInt32(pb + csParam, 2);
WriteMacInt16(pb + csParam + 4, SoundInSource); // index of selected source
return noErr;
}
case siInputSourceNames: {
// return -231 if only 1 or handle to STR# resource if more
const uint8 str[] = {
0x00, 0x02, // 2-byte count of #strings
// byte size indicator (up to 255 length supported)
0x0a, // size is 10
0x4d, 0x69, // Mi
0x63, 0x72, // cr
0x6f, 0x70, // op
0x68, 0x6f, // ho
0x6e, 0x65, // ne
0x0b, // size is 11
0x49, 0x6e, // start of string in ASCII, In
0x74, 0x65, // te
0x72, 0x6e, // rn
0x61, 0x6c, // al
0x20, 0x43, // C
0x44, // D
};
WriteMacInt32(pb + csParam, 0);
M68kRegisters r;
r.d[0] = sizeof(str);
Execute68kTrap(0xa122, &r); // NewHandle()
uint32 h = r.a[0];
if (h == 0)
return memFullErr;
WriteMacInt32(bufferptr, h);
uint32 sp = ReadMacInt32(h);
Host2Mac_memcpy(sp, str, sizeof(str));
return noErr;
}
case siOptionsDialog: {
// 0 if no options box supported and 1 if so
WriteMacInt32(pb + csParam, 2); // response not in buffer, need to copy integer
WriteMacInt16(pb + csParam + 4, 1); // Integer data type
return noErr;
}
case siPlayThruOnOff: {
// playthrough volume, 0 is off and 7 is max
WriteMacInt32(pb + csParam, 2);
WriteMacInt16(pb + csParam + 4, SoundInPlaythrough);
return noErr;
}
case siNumberChannels: {
// 1 is mono and 2 is stereo
WriteMacInt32(pb + csParam, 2);
WriteMacInt16(pb + csParam + 4, 2);
return noErr;
}
case siSampleRate: {
WriteMacInt32(pb + csParam, 0);
WriteMacInt32(bufferptr, 0xac440000); // 44100.00000 Hz, of Fixed data type
return noErr;
}
case siSampleRateAvailable: {
WriteMacInt32(pb + csParam, 0);
M68kRegisters r;
r.d[0] = 4;
Execute68kTrap(0xa122, &r); // NewHandle()
uint32 h = r.a[0];
if (h == 0)
return memFullErr;
WriteMacInt16(bufferptr, 1); // 1 sample rate available
WriteMacInt32(bufferptr + 2, h); // handle to sample rate list
uint32 sp = ReadMacInt32(h);
WriteMacInt32(sp, 0xac440000); // 44100.00000 Hz, of Fixed data type
return noErr;
}
case siInputGain: {
WriteMacInt32(pb + csParam, 4);
WriteMacInt32(pb + csParam + 4, SoundInGain);
return noErr;
}
default:
return -231; // siUnknownInfoType
}

View File

@ -41,6 +41,8 @@
#include <sys/stat.h>
#include <errno.h>
#include <vector>
#ifdef OSX_CORE_AUDIO
#include "../MacOSX/MacOSX_sound_if.h"
static int bincue_core_audio_callback(void);
@ -51,15 +53,20 @@ static int bincue_core_audio_callback(void);
#include <SDL_audio.h>
#endif
#include "bincue_unix.h"
#ifdef WIN32
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
#endif
#include "bincue.h"
#define DEBUG 0
#include "debug.h"
#define MAXTRACK 100
#define MAXLINE 512
#define CD_FRAMES 75
#define RAW_SECTOR_SIZE 2352
#define COOKED_SECTOR_SIZE 2048
//#define RAW_SECTOR_SIZE 2352
//#define COOKED_SECTOR_SIZE 2048
// Bits of Track Control Field -- These are standard for scsi cd players
@ -91,6 +98,7 @@ typedef struct {
unsigned int length; // Track length in frames
loff_t fileoffset; // Track frame start within file
unsigned int pregap; // Silence in frames to generate
unsigned int postgap; // Silence in frames to generate at end
unsigned char tcf; // Track control field
} Track;
@ -99,10 +107,13 @@ typedef struct {
unsigned int length; // file length in frames
int binfh; // binary file handle
int tcnt; // number of tracks
Track tracks[MAXTRACK];
Track tracks[MAXTRACK]; // Track management
int raw_sector_size; // Raw bytes to read per sector
int cooked_sector_size; // Actual data bytes per sector (depends on Mode)
int header_size; // Number of bytes used in header
} CueSheet;
typedef struct {
typedef struct CDPlayer {
CueSheet *cs; // cue sheet to play from
int audiofh; // file handle for audio data
unsigned int audioposition; // current position from audiostart (bytes)
@ -110,10 +121,17 @@ typedef struct {
unsigned int audioend; // end position if playing (frames)
unsigned int silence; // pregap (silence) bytes
unsigned char audiostatus; // See defines above for status
uint8 volume_left; // CD player volume (left)
uint8 volume_right; // CD player volume (right)
uint8 volume_mono; // CD player single-channel volume
loff_t fileoffset; // offset from file beginning to audiostart
bool audio_enabled = false; // audio initialized for this player?
#ifdef OSX_CORE_AUDIO
OSXsoundOutput soundoutput;
#endif
#ifdef USE_SDL_AUDIO
SDL_AudioStream *stream;
#endif
} CDPlayer;
// Minute,Second,Frame data type
@ -127,15 +145,24 @@ typedef struct {
static unsigned int totalPregap;
static unsigned int prestart;
// Audio System State
// Audio System Variables
static bool audio_enabled = false;
static uint8 silence_byte;
// CD Player state. Note only one player is supported !
// CD Player state; multiple players supported through vectors
static CDPlayer player;
std::vector<CDPlayer*> players;
CDPlayer* currently_playing = NULL;
CDPlayer* CSToPlayer(CueSheet* cs)
{
for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
if (cs == (*it)->cs) // look for cuesheet matching existing player
return *it;
return NULL; // if no player with the cuesheet found, return null player
}
static void FramesToMSF(unsigned int frames, MSF *msf)
{
@ -181,7 +208,7 @@ static bool AddTrack(CueSheet *cs)
}
}
curr->fileoffset = curr->start * RAW_SECTOR_SIZE;
curr->fileoffset = curr->start * cs->raw_sector_size;
// now we patch up the indicated time
@ -236,6 +263,11 @@ static bool ParseCueSheet(FILE *fh, CueSheet *cs, const char *cuefile)
totalPregap = 0;
prestart = 0;
// Use Audio CD settings by default, otherwise data mode will be specified
cs->raw_sector_size = 2352;
cs->cooked_sector_size = 2352;
cs->header_size = 0;
while (fgets(line, MAXLINE, fh) != NULL) {
Track *curr = &cs->tracks[cs->tcnt];
@ -294,11 +326,24 @@ static bool ParseCueSheet(FILE *fh, CueSheet *cs, const char *cuefile)
}
curr->number = i_track;
// parse track type
// parse track type and update sector size for data discs if applicable
field = strtok(NULL, " \t\n\r");
if (!strcmp("MODE1/2352", field)) {
if (!strcmp("MODE1/2352", field)) { // red-book CD-ROM standard
curr->tcf = DATA;
cs->raw_sector_size = 2352;
cs->cooked_sector_size = 2048;
cs->header_size = 16; // remaining 288 bytes for error detection
} else if (!strcmp("MODE2/2352", field)) { // yellow-book CD-ROM standard
curr->tcf = DATA;
cs->raw_sector_size = 2352;
cs->cooked_sector_size = 2336; // no error bytes at end
cs->header_size = 16;
} else if (!strcmp("MODE1/2048", field)) { // pure data CD-ROM
curr->tcf = DATA;
cs->raw_sector_size = 2048;
cs->cooked_sector_size = 2048;
cs->header_size = 0; // no header or error bytes
} else if (!strcmp("AUDIO", field)) {
curr->tcf = AUDIO;
} else {
@ -342,8 +387,18 @@ static bool ParseCueSheet(FILE *fh, CueSheet *cs, const char *cuefile)
}
curr->pregap = MSFToFrames(msf);
} else if (!strcmp("POSTGAP", keyword)) {
MSF msf;
char *field = strtok(NULL, " \t\n\r");
if (3 != sscanf(field, "%d:%d:%d",
&msf.m, &msf.s, &msf.f)) {
D(bug("Expected postgap frame\n"));
goto fail;
}
curr->postgap = MSFToFrames(msf);
// Ignored directives
} else if (!strcmp("TITLE", keyword)) {
} else if (!strcmp("PERFORMER", keyword)) {
} else if (!strcmp("REM", keyword)) {
@ -377,8 +432,12 @@ static bool LoadCueSheet(const char *cuefile, CueSheet *cs)
if (!ParseCueSheet(fh, cs, cuefile)) goto fail;
// Open bin file and find length
if ((binfh = open(cs->binfile,O_RDONLY)) < 0) {
#ifdef WIN32
binfh = open(cs->binfile,O_RDONLY|O_BINARY);
#else
binfh = open(cs->binfile,O_RDONLY);
#endif
if (binfh < 0) {
D(bug("Can't read bin file %s\n", cs->binfile));
goto fail;
}
@ -392,7 +451,7 @@ static bool LoadCueSheet(const char *cuefile, CueSheet *cs)
tlast = &cs->tracks[cs->tcnt - 1];
tlast->length = buf.st_size/RAW_SECTOR_SIZE
tlast->length = buf.st_size/cs->raw_sector_size
- tlast->start + totalPregap;
if (tlast->length < 0) {
@ -402,7 +461,7 @@ static bool LoadCueSheet(const char *cuefile, CueSheet *cs)
// save bin file length and pointer
cs->length = buf.st_size/RAW_SECTOR_SIZE;
cs->length = buf.st_size/cs->raw_sector_size;
cs->binfh = binfh;
fclose(fh);
@ -423,45 +482,65 @@ static bool LoadCueSheet(const char *cuefile, CueSheet *cs)
void *open_bincue(const char *name)
{
CueSheet *cs;
if (player.cs == NULL) {
cs = (CueSheet *) malloc(sizeof(CueSheet));
if (!cs) {
D(bug("malloc failed\n"));
return NULL;
}
if (LoadCueSheet(name, cs)) {
player.cs = cs;
#ifdef OSX_CORE_AUDIO
audio_enabled = true;
#endif
if (audio_enabled)
player.audiostatus = CDROM_AUDIO_NO_STATUS;
else
player.audiostatus = CDROM_AUDIO_INVALID;
player.audiofh = dup(cs->binfh);
return cs;
}
else
free(cs);
CueSheet *cs = (CueSheet *) malloc(sizeof(CueSheet));
if (!cs) {
D(bug("malloc failed\n"));
return NULL;
}
if (LoadCueSheet(name, cs)) {
CDPlayer *player = (CDPlayer *) malloc(sizeof(CDPlayer));
player->cs = cs;
player->volume_left = 0;
player->volume_right = 0;
player->volume_mono = 0;
#ifdef OSX_CORE_AUDIO
player->audio_enabled = true;
#endif
if (player->audio_enabled)
player->audiostatus = CDROM_AUDIO_NO_STATUS;
else
player->audiostatus = CDROM_AUDIO_INVALID;
player->audiofh = dup(cs->binfh);
// add to list of available CD players
players.push_back(player);
return cs;
}
else
free(cs);
return NULL;
}
void close_bincue(void *fh)
{
CueSheet *cs = (CueSheet *) fh;
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
free(cs);
#ifdef USE_SDL_AUDIO
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define SDL_DestroyAudioStream SDL_FreeAudioStream
#endif
if (player->stream) // if audiostream has been opened, free it as well
SDL_DestroyAudioStream(player->stream);
#endif
free(player);
}
}
/*
* File read (cooked)
* Data are stored in raw sectors of which only COOKED_SECTOR_SIZE
* bytes are valid -- the remaining include 16 bytes at the beginning
* bytes are valid -- the remaining include header bytes at the beginning
* of each raw sector and RAW_SECTOR_SIZE - COOKED_SECTOR_SIZE - bytes
* at the end
* at the end for error correction
*
* The actual number of bytes used for header, raw, cooked, error depend
* on mode specified in the cuesheet
*
* We assume that a read request can land in the middle of
* sector. We compute the byte address of that sector (sec)
@ -473,20 +552,20 @@ void close_bincue(void *fh)
size_t read_bincue(void *fh, void *b, loff_t offset, size_t len)
{
CueSheet *cs = (CueSheet *) fh;
size_t bytes_read = 0; // bytes read so far
unsigned char *buf = (unsigned char *) b; // target buffer
unsigned char secbuf[RAW_SECTOR_SIZE]; // temporary buffer
unsigned char secbuf[cs->raw_sector_size]; // temporary buffer
off_t sec = ((offset/COOKED_SECTOR_SIZE) * RAW_SECTOR_SIZE);
off_t secoff = offset % COOKED_SECTOR_SIZE;
off_t sec = ((offset/cs->cooked_sector_size) * cs->raw_sector_size);
off_t secoff = offset % cs->cooked_sector_size;
// sec contains location (in bytes) of next raw sector to read
// secoff contains offset within that sector at which to start
// reading since we can request a read that starts in the middle
// of a sector
CueSheet *cs = (CueSheet *) fh;
if (cs == NULL || lseek(cs->binfh, sec, SEEK_SET) < 0) {
return -1;
}
@ -495,19 +574,19 @@ size_t read_bincue(void *fh, void *b, loff_t offset, size_t len)
// bytes available in next raw sector or len (bytes)
// we want whichever is less
size_t available = COOKED_SECTOR_SIZE - secoff;
size_t available = cs->cooked_sector_size - secoff;
available = (available > len) ? len : available;
// read the next raw sector
if (read(cs->binfh, secbuf, RAW_SECTOR_SIZE) != RAW_SECTOR_SIZE) {
if (read(cs->binfh, secbuf, cs->raw_sector_size) != cs->raw_sector_size) {
return bytes_read;
}
// copy cooked sector bytes (skip first 16)
// copy cooked sector bytes (skip header if needed, typically 16 bytes)
// we want out of those available
bcopy(&secbuf[16+secoff], &buf[bytes_read], available);
bcopy(&secbuf[cs->header_size+secoff], &buf[bytes_read], available);
// next sector we start at the beginning
@ -524,8 +603,9 @@ size_t read_bincue(void *fh, void *b, loff_t offset, size_t len)
loff_t size_bincue(void *fh)
{
if (fh) {
return ((CueSheet *)fh)->length * COOKED_SECTOR_SIZE;
return ((CueSheet *)fh)->length * ((CueSheet *)fh)->cooked_sector_size;
}
return 0;
}
bool readtoc_bincue(void *fh, unsigned char *toc)
@ -564,25 +644,28 @@ bool readtoc_bincue(void *fh, unsigned char *toc)
*toc++ = toc_size & 0xff;
return true;
}
return false;
}
bool GetPosition_bincue(void *fh, uint8 *pos)
{
CueSheet *cs = (CueSheet *) fh;
if (cs && player.cs == cs) {
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
MSF abs, rel;
int fpos = player.audioposition / RAW_SECTOR_SIZE + player.audiostart;
int fpos = player->audioposition / cs->raw_sector_size + player->audiostart;
int trackno = PositionToTrack(cs, fpos);
if (!audio_enabled)
if (!(player->audio_enabled))
return false;
FramesToMSF(fpos, &abs);
if (trackno < cs->tcnt) {
// compute position relative to start of frame
unsigned int position = player.audioposition/RAW_SECTOR_SIZE +
player.audiostart - player.cs->tracks[trackno].start;
unsigned int position = player->audioposition/cs->raw_sector_size +
player->audiostart - player->cs->tracks[trackno].start;
FramesToMSF(position, &rel);
}
@ -590,7 +673,7 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
FramesToMSF(0, &rel);
*pos++ = 0;
*pos++ = player.audiostatus;
*pos++ = player->audiostatus;
*pos++ = 0;
*pos++ = 12; // Sub-Q data length
*pos++ = 0;
@ -606,7 +689,7 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
*pos++ = rel.m;
*pos++ = rel.s;
*pos++ = rel.f;
*pos++ = 0;
// *pos++ = 0;
// D(bug("CDROM position %02d:%02d:%02d track %02d\n", abs.m, abs.s, abs.f, trackno));
return true;
}
@ -614,14 +697,26 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
return false;
}
void CDPause_playing(CDPlayer* player) {
if (currently_playing && currently_playing != player) {
currently_playing->audiostatus = CDROM_AUDIO_PAUSED;
currently_playing = NULL;
}
}
bool CDPause_bincue(void *fh)
{
CueSheet *cs = (CueSheet *) fh;
if (cs && cs == player.cs) {
if (player.audiostatus == CDROM_AUDIO_PLAY) {
player.audiostatus = CDROM_AUDIO_PAUSED;
return true;
}
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
// Pause another player if needed
CDPause_playing(player);
// doesn't matter if it was playing, just ensure it's now paused
player->audiostatus = CDROM_AUDIO_PAUSED;
currently_playing = NULL;
return true;
}
return false;
}
@ -629,13 +724,19 @@ bool CDPause_bincue(void *fh)
bool CDStop_bincue(void *fh)
{
CueSheet *cs = (CueSheet *) fh;
if (cs && cs == player.cs) {
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
// Pause another player if needed
CDPause_playing(player);
#ifdef OSX_CORE_AUDIO
player.soundoutput.stop();
player->soundoutput.stop();
#endif
if (player.audiostatus != CDROM_AUDIO_INVALID)
player.audiostatus = CDROM_AUDIO_NO_STATUS;
if (player->audiostatus != CDROM_AUDIO_INVALID)
player->audiostatus = CDROM_AUDIO_NO_STATUS;
currently_playing = NULL;
return true;
}
return false;
@ -644,11 +745,16 @@ bool CDStop_bincue(void *fh)
bool CDResume_bincue(void *fh)
{
CueSheet *cs = (CueSheet *) fh;
if (cs && cs == player.cs) {
if (player.audiostatus == CDROM_AUDIO_PAUSED) {
player.audiostatus = CDROM_AUDIO_PLAY;
return true;
}
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
// Pause another player if needed
CDPause_playing(player);
// doesn't matter if it was paused, just ensure this one plays now
player->audiostatus = CDROM_AUDIO_PLAY;
currently_playing = player;
return true;
}
return false;
}
@ -656,75 +762,130 @@ bool CDResume_bincue(void *fh)
bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
uint8 end_m, uint8 end_s, uint8 end_f)
{
CueSheet *cs = (CueSheet *)fh;
if (cs && cs == player.cs) {
CueSheet *cs = (CueSheet *) fh;
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
// Pause another player if needed
CDPause_playing(player);
int track;
MSF msf;
#ifdef USE_SDL_AUDIO
#if defined(USE_SDL_AUDIO) && !SDL_VERSION_ATLEAST(3, 0, 0)
SDL_LockAudio();
#endif
player.audiostatus = CDROM_AUDIO_NO_STATUS;
player->audiostatus = CDROM_AUDIO_NO_STATUS;
player.audiostart = (start_m * 60 * CD_FRAMES) +
player->audiostart = (start_m * 60 * CD_FRAMES) +
(start_s * CD_FRAMES) + start_f;
player.audioend = (end_m * 60 * CD_FRAMES) + (end_s * CD_FRAMES) + end_f;
player->audioend = (end_m * 60 * CD_FRAMES) + (end_s * CD_FRAMES) + end_f;
track = PositionToTrack(player.cs, player.audiostart);
track = PositionToTrack(player->cs, player->audiostart);
if (track < player.cs->tcnt) {
player.audioposition = 0;
if (track < player->cs->tcnt) {
player->audioposition = 0;
// here we need to compute silence
if (player.audiostart - player.cs->tracks[track].start >
player.cs->tracks[track].pregap)
player.silence = 0;
if (player->audiostart - player->cs->tracks[track].start >
player->cs->tracks[track].pregap)
player->silence = 0;
else
player.silence = (player.cs->tracks[track].pregap -
player.audiostart +
player.cs->tracks[track].start) * RAW_SECTOR_SIZE;
player->silence = (player->cs->tracks[track].pregap -
player->audiostart +
player->cs->tracks[track].start) * cs->raw_sector_size;
player.fileoffset = player.cs->tracks[track].fileoffset;
player->fileoffset = player->cs->tracks[track].fileoffset;
D(bug("file offset %d\n", (unsigned int) player.fileoffset));
D(bug("file offset %d\n", (unsigned int) player->fileoffset));
// fix up file offset if beyond the silence bytes
if (!player.silence) // not at the beginning
player.fileoffset += (player.audiostart -
player.cs->tracks[track].start -
player.cs->tracks[track].pregap) * RAW_SECTOR_SIZE;
if (!player->silence) // not at the beginning
player->fileoffset += (player->audiostart -
player->cs->tracks[track].start -
player->cs->tracks[track].pregap) * cs->raw_sector_size;
FramesToMSF(player.cs->tracks[track].start, &msf);
FramesToMSF(player->cs->tracks[track].start, &msf);
D(bug("CDPlay_bincue track %02d start %02d:%02d:%02d silence %d",
player.cs->tracks[track].number, msf.m, msf.s, msf.f,
player.silence/RAW_SECTOR_SIZE));
player->cs->tracks[track].number, msf.m, msf.s, msf.f,
player->silence/cs->raw_sector_size));
D(bug(" Stop %02u:%02u:%02u\n", end_m, end_s, end_f));
}
else
D(bug("CDPlay_bincue: play beyond last track !\n"));
#ifdef USE_SDL_AUDIO
#if defined(USE_SDL_AUDIO) && !SDL_VERSION_ATLEAST(3, 0, 0)
SDL_UnlockAudio();
#endif
if (audio_enabled) {
player.audiostatus = CDROM_AUDIO_PLAY;
if (player->audio_enabled) {
player->audiostatus = CDROM_AUDIO_PLAY;
#ifdef OSX_CORE_AUDIO
D(bug("starting os x sound"));
player.soundoutput.setCallback(bincue_core_audio_callback);
player->soundoutput.setCallback(bincue_core_audio_callback);
// should be from current track !
player.soundoutput.start(16, 2, 44100);
player->soundoutput.start(16, 2, 44100);
#endif
currently_playing = player;
return true;
}
}
return false;
}
static uint8 *fill_buffer(int stream_len)
bool CDScan_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f, bool reverse) {
CueSheet *cs = (CueSheet *) fh;
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
uint8 scanrate = 8; // 8x scan default but could use different value or make configurable
MSF msf;
msf.m = start_m; msf.s = start_s; msf.f = start_f;
int current_frame = MSFToFrames(msf);
if (reverse) {
msf.s -= scanrate;
int goto_frame = MSFToFrames(msf);
player->audioposition -= (current_frame - goto_frame) * player->cs->raw_sector_size;
}
else {
msf.s += scanrate;
int goto_frame = MSFToFrames(msf);
player->audioposition += (goto_frame - current_frame) * player->cs->raw_sector_size;
}
return true;
}
return false;
}
void CDSetVol_bincue(void* fh, uint8 left, uint8 right) {
CueSheet *cs = (CueSheet *) fh;
CDPlayer *player = CSToPlayer(cs);
if (cs && player) {
// Convert from classic Mac's 0-255 to 0-128;
// calculate mono mix as well in place of panning
player->volume_left = (left*128)/255;
player->volume_right = (right*128)/255;
player->volume_mono = (player->volume_left + player->volume_right)/2; // use avg
}
}
void CDGetVol_bincue(void* fh, uint8* left, uint8* right) {
CueSheet *cs = (CueSheet *) fh;
CDPlayer *player = CSToPlayer(cs);
if (cs && player) { // Convert from 0-128 to 0-255 scale
*left = (player->volume_left*255)/128;
*right = (player->volume_right*255)/128;
}
}
static uint8 *fill_buffer(int stream_len, CDPlayer* player)
{
static uint8 *buf = 0;
static int bufsize = 0;
@ -743,44 +904,44 @@ static uint8 *fill_buffer(int stream_len)
}
memset(buf, silence_byte, stream_len);
if (player->audiostatus == CDROM_AUDIO_PLAY) {
int remaining_silence = player->silence - player->audioposition;
if (player.audiostatus == CDROM_AUDIO_PLAY) {
int remaining_silence = player.silence - player.audioposition;
if (player.audiostart + player.audioposition/RAW_SECTOR_SIZE
>= player.audioend) {
player.audiostatus = CDROM_AUDIO_COMPLETED;
if (player->audiostart + player->audioposition/player->cs->raw_sector_size
>= player->audioend) {
player->audiostatus = CDROM_AUDIO_COMPLETED;
return buf;
}
if (remaining_silence >= stream_len) {
player.audioposition += stream_len;
player->audioposition += stream_len;
return buf;
}
if (remaining_silence > 0) {
offset += remaining_silence;
player.audioposition += remaining_silence;
player->audioposition += remaining_silence;
}
int ret = 0;
int available = ((player.audioend - player.audiostart) *
RAW_SECTOR_SIZE) - player.audioposition;
int available = ((player->audioend - player->audiostart) *
player->cs->raw_sector_size) - player->audioposition;
if (available > (stream_len - offset))
available = stream_len - offset;
if (lseek(player.audiofh,
player.fileoffset + player.audioposition - player.silence,
if (lseek(player->audiofh,
player->fileoffset + player->audioposition - player->silence,
SEEK_SET) < 0)
return NULL;
if (available < 0) {
player.audioposition += available; // correct end !;
player->audioposition += available; // correct end !;
available = 0;
}
if ((ret = read(player.audiofh, &buf[offset], available)) >= 0) {
player.audioposition += ret;
ssize_t ret = 0;
if ((ret = read(player->audiofh, &buf[offset], available)) >= 0) {
player->audioposition += ret;
offset += ret;
available -= ret;
}
@ -788,33 +949,73 @@ static uint8 *fill_buffer(int stream_len)
while (offset < stream_len) {
buf[offset++] = silence_byte;
if (available-- > 0){
player.audioposition++;
player->audioposition++;
}
}
}
}
return buf;
}
#ifdef USE_SDL_AUDIO
void MixAudio_bincue(uint8 *stream, int stream_len)
void MixAudio_bincue(uint8 *stream, int stream_len, int volume)
{
if (audio_enabled && (player.audiostatus == CDROM_AUDIO_PLAY)) {
uint8 *buf = fill_buffer(stream_len);
if (buf)
SDL_MixAudio(stream, buf, stream_len, SDL_MIX_MAXVOLUME);
if (currently_playing) {
CDPlayer *player = currently_playing;
if (player->audiostatus == CDROM_AUDIO_PLAY) {
uint8 *buf = fill_buffer(stream_len, player);
#if SDL_VERSION_ATLEAST(3, 0, 0)
if (buf)
SDL_PutAudioStreamData(player->stream, buf, stream_len);
int avail = SDL_GetAudioStreamAvailable(player->stream);
if (avail >= stream_len) {
extern SDL_AudioSpec audio_spec;
uint8 converted[stream_len];
SDL_GetAudioStreamData(player->stream, converted, stream_len);
SDL_MixAudioFormat(stream, converted, audio_spec.format, stream_len, player->volume_mono);
}
#else
if (buf)
SDL_AudioStreamPut(player->stream, buf, stream_len);
int avail = SDL_AudioStreamAvailable(player->stream);
if (avail >= stream_len) {
uint8 converted[stream_len];
SDL_AudioStreamGet(player->stream, converted, stream_len);
SDL_MixAudio(stream, converted, stream_len, player->volume_mono);
}
#endif
}
}
}
void OpenAudio_bincue(int freq, int format, int channels, uint8 silence)
void OpenAudio_bincue(int freq, int format, int channels, uint8 silence, int volume)
{
if (freq == 44100 && format == AUDIO_S16MSB && channels == 2) {
audio_enabled = true;
silence_byte = silence;
}
else {
D(bug("unexpected frequency %d , format %d, or channels %d\n",
freq, format, channels));
// setup silence at init
silence_byte = silence;
// init players
for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
{
CDPlayer *player = *it;
// set player volume based on SDL volume
player->volume_left = player->volume_right = player->volume_mono = volume;
// audio stream handles converting cd audio to destination output
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_AudioSpec src = { SDL_AUDIO_S16LE, 2, 44100 }, dst = { (SDL_AudioFormat)format, channels, freq };
player->stream = SDL_CreateAudioStream(&src, &dst);
#else
player->stream = SDL_NewAudioStream(AUDIO_S16LSB, 2, 44100, format, channels, freq);
#endif
if (player->stream == NULL) {
D(bug("Failed to open CD player audio stream using SDL!"));
}
else {
player->audio_enabled = true;
}
}
}
#endif
@ -822,13 +1023,18 @@ void OpenAudio_bincue(int freq, int format, int channels, uint8 silence)
#ifdef OSX_CORE_AUDIO
static int bincue_core_audio_callback(void)
{
int frames = player.soundoutput.bufferSizeFrames();
uint8 *buf = fill_buffer(frames*4);
for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
{
CDPlayer *player = *it;
int frames = player->soundoutput.bufferSizeFrames();
uint8 *buf = fill_buffer(frames*4);
// D(bug("Audio request %d\n", stream_len));
// D(bug("Audio request %d\n", stream_len));
player.soundoutput.sendAudioBuffer((void *) buf, (buf ? frames : 0));
player->soundoutput.sendAudioBuffer((void *) buf, (buf ? frames : 0));
return 1;
return 1;
}
}
#endif

View File

@ -32,6 +32,7 @@
#include <string.h>
#include <vector>
#include <map>
#ifndef NO_STD_NAMESPACE
using std::vector;
@ -58,7 +59,7 @@ const uint8 CDROMIcon[258] = {
0x8a, 0xaa, 0xaa, 0xe4, 0x8d, 0x55, 0x55, 0xc4, 0x86, 0xaa, 0xab, 0xc4, 0x83, 0x55, 0x57, 0x84,
0x81, 0xaa, 0xaf, 0x04, 0x80, 0xf5, 0x7e, 0x04, 0x80, 0x3f, 0xf8, 0x04, 0x80, 0x0f, 0xe0, 0x04,
0xff, 0xff, 0xff, 0xfc, 0x80, 0x00, 0x00, 0x04, 0x80, 0x1f, 0xf0, 0x04, 0x7f, 0xff, 0xff, 0xf8,
0x3f, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc,
0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc,
0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc,
@ -67,7 +68,7 @@ const uint8 CDROMIcon[258] = {
0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc,
0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc,
0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xf8,
0, 0
};
@ -103,7 +104,7 @@ static const uint8 bin2bcd[256] = {
};
static const uint8 bcd2bin[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -124,11 +125,11 @@ static const uint8 bcd2bin[256] = {
// Struct for each drive
struct cdrom_drive_info {
cdrom_drive_info() : num(0), fh(NULL), start_byte(0), status(0) {}
cdrom_drive_info(void *fh_) : num(0), fh(fh_), start_byte(0), status(0) {}
cdrom_drive_info() : num(0), fh(NULL), start_byte(0), status(0), drop(false) {}
cdrom_drive_info(void *fh_) : num(0), fh(fh_), start_byte(0), status(0), drop(false) {}
void close_fh(void) { SysAllowRemoval(fh); Sys_close(fh); }
int num; // Drive number
void *fh; // File handle
int block_size; // CD-ROM block size
@ -136,26 +137,33 @@ struct cdrom_drive_info {
loff_t start_byte; // Start of HFS partition on disk
bool to_be_mounted; // Flag: drive must be mounted in accRun
bool mount_non_hfs; // Flag: Issue disk-inserted events for non-HFS disks
uint8 toc[804]; // TOC of currently inserted disk
uint8 lead_out[3]; // MSF address of lead-out track
uint8 stop_at[3]; // MSF address of audio play stopping point
uint8 start_at[3]; // MSF address of position set by track search or audio play
uint8 play_mode; // Audio play mode
uint8 play_order; // Play mode order (normal, shuffle, program)
bool repeat; // Repeat flag
uint8 power_mode; // Power mode
uint32 status; // Mac address of drive status record
bool drop;
};
// List of drives handled by this driver
typedef vector<cdrom_drive_info> drive_vec;
static drive_vec drives;
int last_drive_num; // track last drive called to support multiple audio CDs
// Icon address (Mac address space, set by PatchROM())
uint32 CDROMIconAddr;
// Flag: Control(accRun) has been called, interrupt routine is now active
static bool acc_run_called = false;
static std::map<int, void *> remount_map;
/*
* Get pointer to drive info or drives.end() if not found
@ -165,8 +173,10 @@ static drive_vec::iterator get_drive_info(int num)
{
drive_vec::iterator info, end = drives.end();
for (info = drives.begin(); info != end; ++info) {
if (info->num == num)
if (info->num == num) {
last_drive_num = num;
return info;
}
}
return info;
}
@ -181,23 +191,25 @@ static void find_hfs_partition(cdrom_drive_info &info)
info.start_byte = 0;
uint8 *map = new uint8[512];
D(bug("Looking for HFS partitions on CD-ROM...\n"));
// Search first 64 blocks for HFS partition
for (int i=0; i<64; i++) {
if (Sys_read(info.fh, map, i * 512, 512) != 512)
break;
D(bug(" block %d, signature '%c%c' (%02x%02x)\n", i, map[0], map[1], map[0], map[1]));
// Not a partition map block? Then look at next block
uint16 sig = (map[0] << 8) | map[1];
if (sig != 0x504d)
continue;
// Partition map block found, Apple HFS partition?
if (strcmp((char *)(map + 48), "Apple_HFS") == 0) {
info.start_byte = (loff_t)((map[8] << 24) | (map[9] << 16) | (map[10] << 8) | map[11]) << 9;
#if DEBUG
uint32 num_blocks = (map[12] << 24) | (map[13] << 16) | (map[14] << 8) | map[15];
D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, num_blocks));
#endif
break;
}
}
@ -214,7 +226,7 @@ static void read_toc(cdrom_drive_info &info)
// Read TOC
memset(info.toc, 0, sizeof(info.toc));
SysCDReadTOC(info.fh, info.toc);
#if DEBUG
// Dump TOC for debugging
D(bug(" TOC:\n %02x%02x%02x%02x : %d bytes, first track = %d, last track = %d\n", info.toc[0], info.toc[1], info.toc[2], info.toc[3], (info.toc[0] << 8) | info.toc[1], info.toc[2], info.toc[3]));
@ -226,7 +238,12 @@ static void read_toc(cdrom_drive_info &info)
break;
}
#endif
// Default start
info.start_at[0] = 0;
info.start_at[1] = 0;
info.start_at[2] = 0;
// Find lead-out track
info.lead_out[0] = 0;
info.lead_out[1] = 0;
@ -287,20 +304,35 @@ static bool position2msf(const cdrom_drive_info &info, uint16 postype, uint32 po
void CDROMInit(void)
{
// No drives specified in prefs? Then add defaults
if (PrefsFindString("cdrom", 0) == NULL)
SysAddCDROMPrefs();
SysAddCDROMPrefs();
// Add drives specified in preferences
int index = 0;
const char *str;
while ((str = PrefsFindString("cdrom", index++)) != NULL) {
void *fh = Sys_open(str, true);
void *fh = Sys_open(str, true, true);
if (fh)
drives.push_back(cdrom_drive_info(fh));
}
if (!drives.empty()) { // set to first drive by default
last_drive_num = drives.begin()->num;
}
else {
last_drive_num = 0;
}
}
void CDROMDrop(const char *path) {
if (!drives.empty()) {
cdrom_drive_info &info = drives.back();
if (!info.drop) {
info.fh = Sys_open(path, true, true);
if (info.fh)
info.drop = true;
}
}
}
/*
* Deinitialization
@ -338,6 +370,17 @@ bool CDROMMountVolume(void *fh)
return false;
}
void CDROMRemount() {
for (std::map<int, void *>::iterator i = remount_map.begin(); i != remount_map.end(); ++i)
for (drive_vec::iterator info = drives.begin(); info != drives.end(); ++info)
if (info->num == i->first) {
last_drive_num = i->first;
info->fh = i->second;
break;
}
remount_map.clear();
}
/*
* Mount volumes for which the to_be_mounted flag is set
@ -348,15 +391,15 @@ static void mount_mountable_volumes(void)
{
drive_vec::iterator info, end = drives.end();
for (info = drives.begin(); info != end; ++info) {
// Disk in drive?
if (ReadMacInt8(info->status + dsDiskInPlace) == 0) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
CDROMMountVolume(info->fh);
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
@ -377,25 +420,27 @@ static void mount_mountable_volumes(void)
int16 CDROMOpen(uint32 pb, uint32 dce)
{
D(bug("CDROMOpen\n"));
// Set up DCE
WriteMacInt32(dce + dCtlPosition, 0);
acc_run_called = false;
// Install drives
drive_vec::iterator info, end = drives.end();
for (info = drives.begin(); info != end; ++info) {
info->num = FindFreeDriveNumber(1);
info->to_be_mounted = false;
if (info->fh) {
info->mount_non_hfs = true;
info->block_size = 512;
info->twok_offset = -1;
info->play_mode = 0x09;
info->play_order = 0;
info->repeat = 0;
info->power_mode = 0;
// Allocate drive status record
M68kRegisters r;
r.d[0] = SIZEOF_DrvSts;
@ -404,12 +449,12 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
continue;
info->status = r.a[0];
D(bug(" DrvSts at %08lx\n", info->status));
// Set up drive status
WriteMacInt8(info->status + dsWriteProt, 0x80);
WriteMacInt8(info->status + dsInstalled, 1);
WriteMacInt8(info->status + dsSides, 1);
// Disk in drive?
if (SysIsDiskInserted(info->fh)) {
SysPreventRemoval(info->fh);
@ -418,7 +463,7 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
find_hfs_partition(*info);
info->to_be_mounted = true;
}
// Add drive to drive queue
D(bug(" adding drive %d\n", info->num));
r.d[0] = (info->num << 16) | (CDROMRefNum & 0xffff);
@ -426,6 +471,9 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
Execute68kTrap(0xa04e, &r); // AddDrive()
}
}
CDROMOpenDone();
return noErr;
}
@ -437,14 +485,14 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
int16 CDROMPrime(uint32 pb, uint32 dce)
{
WriteMacInt32(pb + ioActCount, 0);
// Drive valid and disk inserted?
drive_vec::iterator info = get_drive_info(ReadMacInt16(pb + ioVRefNum));
if (info == drives.end())
return nsDrvErr;
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
// Get parameters
void *buffer = Mac2HostAddr(ReadMacInt32(pb + ioBuffer));
size_t length = ReadMacInt32(pb + ioReqCount);
@ -452,17 +500,17 @@ int16 CDROMPrime(uint32 pb, uint32 dce)
if ((length & (info->block_size - 1)) || (position & (info->block_size - 1)))
return paramErr;
info->twok_offset = (position + info->start_byte) & 0x7ff;
size_t actual = 0;
if ((ReadMacInt16(pb + ioTrap) & 0xff) == aRdCmd) {
// Read
actual = Sys_read(info->fh, buffer, position + info->start_byte, length);
if (actual != length) {
// Read error, tried to read HFS root block?
if (length == 0x200 && position == 0x400) {
// Yes, fake (otherwise audio CDs won't get mounted)
memset(buffer, 0, 0x200);
actual = 0x200;
@ -473,7 +521,7 @@ int16 CDROMPrime(uint32 pb, uint32 dce)
} else {
return wPrErr;
}
// Update ParamBlock and DCE
WriteMacInt32(pb + ioActCount, actual);
WriteMacInt32(dce + dCtlPosition, ReadMacInt32(dce + dCtlPosition) + actual);
@ -489,34 +537,37 @@ int16 CDROMControl(uint32 pb, uint32 dce)
{
uint16 code = ReadMacInt16(pb + csCode);
D(bug("CDROMControl %d\n", code));
// General codes
switch (code) {
case 1: // KillIO
return noErr;
case 65: { // Periodic action (accRun, "insert" disks on startup)
mount_mountable_volumes();
WriteMacInt16(dce + dCtlFlags, ReadMacInt16(dce + dCtlFlags) & ~0x2000); // Disable periodic action
acc_run_called = true;
return noErr;
}
case 81: // Set poll freq
WriteMacInt16(dce + dCtlDelay, ReadMacInt16(pb + csParam));
return noErr;
}
// Drive valid?
drive_vec::iterator info = get_drive_info(ReadMacInt16(pb + ioVRefNum));
if (info == drives.end()) {
if (drives.empty()) {
return nsDrvErr;
} else {
info = drives.begin(); // This is needed for Apple's Audio CD program
// Audio calls tend to end up without correct reference
// Real mac would just play first disc, but we can guess correct one from last data call
info = get_drive_info(last_drive_num);
if (info == drives.end()) return nsDrvErr;
}
}
// Drive-specific codes
switch (code) {
case 5: // VerifyTheDisc
@ -524,28 +575,60 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return noErr;
else
return offLinErr;
case 6: // FormatTheDisc
return writErr;
case 7: // EjectTheDisc
if (ReadMacInt8(info->status + dsDiskInPlace) > 0) {
SysAllowRemoval(info->fh);
SysEject(info->fh);
if (info->drop) {
SysAllowRemoval(info->fh);
SysEject(info->fh);
info->twok_offset = -1;
info->close_fh();
info->drop = false;
}
else remount_map.insert(std::make_pair(ReadMacInt16(pb + ioVRefNum), info->fh));
info->fh = NULL;
WriteMacInt8(info->status + dsDiskInPlace, 0);
info->twok_offset = -1;
return noErr;
} else {
return offLinErr;
}
return noErr;
case 21: // GetDriveIcon
case 22: // GetMediaIcon
WriteMacInt32(pb + csParam, CDROMIconAddr);
return noErr;
case 23: // GetDriveInfo
WriteMacInt32(pb + csParam, 0x00000b01); // Unspecified external removable SCSI disk
return noErr;
// TODO: revist this section, is it necessary with DriverGestalt also in Status section?
case 43: { // DriverGestalt
int selector = ReadMacInt32(pb + csParam);
switch (selector) {
case FOURCC('v','e','r','s'):
WriteMacInt32(pb + csParam + 4, 0x05208000); // vers 5.2.0
break;
case FOURCC('d','e','v','t'):
WriteMacInt32(pb + csParam + 4, FOURCC('c','d','r','m'));
break;
case FOURCC('i','n','t','f'):
case FOURCC('d','A','P','I'):
WriteMacInt32(pb + csParam + 4, FOURCC('a','t','p','i'));
break;
case FOURCC('s','y','n','c'):
WriteMacInt32(pb + csParam + 4, 1); // true/false = sync/async
break;
case FOURCC('c','d','3','d'):
WriteMacInt32(pb + csParam + 4, 0);
break;
}
return noErr;
}
case 70: { // SetPowerMode
uint8 mode = ReadMacInt8(pb + csParam);
if (mode > 3) {
@ -555,11 +638,11 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return noErr;
}
}
case 76: // ModifyPostEvent
info->mount_non_hfs = ReadMacInt16(pb + csParam) != 0;
return noErr;
case 79: { // Change block size
uint16 size = ReadMacInt16(pb + csParam);
D(bug(" change block size to %d bytes\n", size));
@ -570,7 +653,7 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return noErr;
}
}
case 80: // SetUserEject
if (ReadMacInt8(info->status + dsDiskInPlace) > 0) {
if (ReadMacInt16(pb + csParam) == 1)
@ -581,11 +664,11 @@ int16 CDROMControl(uint32 pb, uint32 dce)
} else {
return offLinErr;
}
case 100: { // ReadTOC
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
int action = ReadMacInt16(pb + csParam);
D(bug(" read TOC %d\n", action));
switch (action) {
@ -594,26 +677,26 @@ int16 CDROMControl(uint32 pb, uint32 dce)
WriteMacInt8(pb + csParam + 1, bin2bcd[info->toc[3]]);
WriteMacInt16(pb + csParam + 2, 0);
break;
case 2: // Get lead out MSF starting address
WriteMacInt8(pb + csParam, bin2bcd[info->lead_out[0]]);
WriteMacInt8(pb + csParam + 1, bin2bcd[info->lead_out[1]]);
WriteMacInt8(pb + csParam + 2, bin2bcd[info->lead_out[2]]);
WriteMacInt8(pb + csParam + 3, 0);
break;
case 3: { // Get track starting address
uint32 buf = ReadMacInt32(pb + csParam + 2);
uint16 buf_size = ReadMacInt16(pb + csParam + 6);
int track = bcd2bin[ReadMacInt8(pb + csParam + 8)];
// Search start track in TOC
int i;
for (i=4; i<804; i+=8) {
if (info->toc[i+2] == track)
break;
}
// Fill buffer
if (i != 804) {
while (buf_size > 0) {
@ -621,18 +704,91 @@ int16 CDROMControl(uint32 pb, uint32 dce)
WriteMacInt8(buf, bin2bcd[info->toc[i+5]]); buf++; // M
WriteMacInt8(buf, bin2bcd[info->toc[i+6]]); buf++; // S
WriteMacInt8(buf, bin2bcd[info->toc[i+7]]); buf++; // F
// Lead-Out? Then stop
if (info->toc[i+2] == 0xaa)
break;
buf_size -= 4;
i += 8;
}
}
break;
}
case 4: { // Type 4 TOC for non-AppleCD SC
uint32 buf = ReadMacInt32(pb + csParam + 2);
uint16 buf_size = 512; // buffer must be 512 bytes for this TOC type
// start filling buffer
WriteMacInt8(buf, 0); buf++; // first byte reserved for 0
buf_size--;
int i = 4;
// in TOC, first 4 are session and/or track number; so tracks start at i = 4
// (info->toc[2] is first track num and info->toc[3] is last num)
// each track entry is 8 bytes:
// 0: unused, 1: control, 2: tracknum, 3: unused
// 4: unused, 5: MIN, 6: SEC, 7: FRAME
// entry for point A0 (first track num)
WriteMacInt8(buf, info->toc[i+1] & 0x0f); buf++; // control field
WriteMacInt8(buf, bin2bcd[info->toc[2]]); buf++; // track number
WriteMacInt8(buf, bin2bcd[info->toc[i+5]]); buf++; // PMIN
WriteMacInt8(buf, bin2bcd[info->toc[i+6]]); buf++; // PSEC
WriteMacInt8(buf, bin2bcd[info->toc[i+7]]); buf++; // PFRAME
buf_size -= 5; // every 8 bits written decreases byte buffer size by 1
// entry for point A1 (last track)
int buf_a1 = buf; // save for filling last track num
buf += 5; buf_size -= 5;
// entry for point A2 (address of start of lead out)
int buf_a2 = buf; // save for filling at end
buf += 5; buf_size -= 5;
// Fill buffer
while (i <= 804 && buf_size > 1) { // index 511 never used
// Lead out? then fill a2 and stop
if (info->toc[i+2] == 0xaa) {
// entry for point a2
WriteMacInt8(buf_a2, info->toc[i+1] & 0x0f); // Control
WriteMacInt8(buf_a2 + 1, bin2bcd[info->toc[i+2]]); // tracknum
WriteMacInt8(buf_a2 + 2, bin2bcd[info->lead_out[0]]); // M, same as toc[i+5]
WriteMacInt8(buf_a2 + 3, bin2bcd[info->lead_out[1]]); // S
WriteMacInt8(buf_a2 + 4, bin2bcd[info->lead_out[2]]); // F
break;
}
WriteMacInt8(buf, info->toc[i+1] & 0x0f); buf++; // Control
WriteMacInt8(buf, bin2bcd[info->toc[i+2]]); buf++; // tracknum
WriteMacInt8(buf, bin2bcd[info->toc[i+5]]); buf++; // M
WriteMacInt8(buf, bin2bcd[info->toc[i+6]]); buf++; // S
WriteMacInt8(buf, bin2bcd[info->toc[i+7]]); buf++; // F
// Last track? fill a1 as well
if (info->toc[i+2] == info->toc[3]) {
// entry for point a1
WriteMacInt8(buf_a1, info->toc[i+1] & 0x0f); // Control
WriteMacInt8(buf_a1 + 1, bin2bcd[info->toc[3]]); // tracknum
WriteMacInt8(buf_a1 + 2, bin2bcd[info->toc[i+5]]); // M
WriteMacInt8(buf_a1 + 3, bin2bcd[info->toc[i+6]]); // S
WriteMacInt8(buf_a1 + 4, bin2bcd[info->toc[i+7]]); // F
}
buf_size -= 5;
i += 8;
}
// fill rest of buffer with zeroes
while (buf_size > 0) {
WriteMacInt8(buf, 0); buf++;
buf_size--;
}
break;
}
case 5: // Get session information
WriteMacInt16(pb + csParam, 1); // First session number
WriteMacInt16(pb + csParam + 2, 1); // Last session number
@ -642,20 +798,20 @@ int16 CDROMControl(uint32 pb, uint32 dce)
WriteMacInt8(pb + csParam + 8, bin2bcd[info->toc[10]]); // S
WriteMacInt8(pb + csParam + 9, bin2bcd[info->toc[11]]); // F
break;
default:
printf("FATAL: .AppleCD/Control(100): unimplemented TOC type\n");
return paramErr;
}
return noErr;
}
case 101: { // ReadTheQSubcode
if (ReadMacInt8(info->status + dsDiskInPlace) == 0) {
Mac_memset(pb + csParam, 0, 10);
return offLinErr;
}
uint8 pos[16];
if (SysCDGetPosition(info->fh, pos)) {
uint32 p = pb + csParam;
@ -674,51 +830,51 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return ioErr;
}
}
case 102: // ReadHeader
printf("FATAL: .AppleCD/Control(102): unimplemented call\n");
return controlErr;
case 103: { // AudioTrackSearch
D(bug(" AudioTrackSearch postype %d, pos %08x, hold %d\n", ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), ReadMacInt16(pb + csParam + 6)));
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
uint8 start_m, start_s, start_f;
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
return paramErr;
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2]))
if (!SysCDPlay(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], info->stop_at[0], info->stop_at[1], info->stop_at[2]))
return paramErr;
if (ReadMacInt16(pb + csParam + 6) == 0) // Hold
SysCDPause(info->fh);
return noErr;
}
case 104: // AudioPlay
D(bug(" AudioPlay postype %d, pos %08lx, hold %d\n", ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), ReadMacInt16(pb + csParam + 6)));
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
if (ReadMacInt16(pb + csParam + 6)) {
// Given stopping address
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2]))
return paramErr;
} else {
// Given starting address
uint8 start_m, start_s, start_f;
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
return paramErr;
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2]))
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
return paramErr;
}
// Still need to process the AudioPlay command
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f;
if (!SysCDPlay(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], info->stop_at[0], info->stop_at[1], info->stop_at[2]))
return paramErr;
return noErr;
case 105: // AudioPause
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
switch (ReadMacInt32(pb + csParam)) {
case 0:
if (!SysCDResume(info->fh))
@ -732,12 +888,12 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return paramErr;
}
return noErr;
case 106: // AudioStop
D(bug(" AudioStop postype %d, pos %08lx\n", ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2)));
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
if (ReadMacInt16(pb + csParam) == 0 && ReadMacInt32(pb + csParam + 2) == 0) {
// Stop immediately
if (!SysCDStop(info->fh, info->lead_out[0], info->lead_out[1], info->lead_out[2]))
@ -748,15 +904,15 @@ int16 CDROMControl(uint32 pb, uint32 dce)
return paramErr;
}
return noErr;
case 107: { // AudioStatus
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
uint8 pos[16];
if (!SysCDGetPosition(info->fh, pos))
return paramErr;
uint32 p = pb + csParam;
switch (pos[1]) {
case 0x11:
@ -783,34 +939,33 @@ int16 CDROMControl(uint32 pb, uint32 dce)
WriteMacInt8(p, bin2bcd[pos[11]]); p++; // F (abs)
return noErr;
}
case 108: { // AudioScan
if (ReadMacInt8(info->status + dsDiskInPlace) == 0)
return offLinErr;
uint8 start_m, start_s, start_f;
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f))
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, info->start_at[0], info->start_at[1], info->start_at[2]))
return paramErr;
if (!SysCDScan(info->fh, start_m, start_s, start_f, ReadMacInt16(pb + csParam + 6) != 0)) {
if (!SysCDScan(info->fh, info->start_at[0], info->start_at[1], info->start_at[2], ReadMacInt16(pb + csParam + 6) != 0)) {
return paramErr;
} else {
return noErr;
}
}
case 109: // AudioControl
SysCDSetVolume(info->fh, ReadMacInt8(pb + csParam), ReadMacInt8(pb + csParam + 1));
return noErr;
case 110: // ReadMCN
printf("FATAL: .AppleCD/Control(110): unimplemented call\n");
return controlErr;
case 111: // ReadISRC
printf("FATAL: .AppleCD/Control(111): unimplemented call\n");
return controlErr;
case 112: { // ReadAudioVolume
uint8 left = 0, right = 0;
SysCDGetVolume(info->fh, left, right);
@ -818,43 +973,50 @@ int16 CDROMControl(uint32 pb, uint32 dce)
WriteMacInt8(pb + csParam + 1, right);
return noErr;
}
case 113: // GetSpindleSpeed
WriteMacInt16(pb + csParam, 0xff);
return noErr;
case 114: // SetSpindleSpeed
return noErr;
case 115: // ReadAudio
printf("FATAL: .AppleCD/Control(115): unimplemented call\n");
return controlErr;
case 116: // ReadAllSubcodes
printf("FATAL: .AppleCD/Control(116): unimplemented call\n");
return controlErr;
case 122: // SetTrackList
printf("FATAL: .AppleCD/Control(122): unimplemented call\n");
return controlErr;
case 123: // GetTrackList
printf("FATAL: .AppleCD/Control(123): unimplemented call\n");
return controlErr;
case 124: // GetTrackIndex
printf("FATAL: .AppleCD/Control(124): unimplemented call\n");
return controlErr;
case 125: // SetPlayMode
D(bug(" SetPlayMode %04x\n", ReadMacInt16(pb + csParam)));
printf("FATAL: .AppleCD/Control(125): unimplemented call\n");
return controlErr;
case 126: // GetPlayMode (Apple's Audio CD program needs this)
WriteMacInt16(pb + csParam, 0);
// repeat flag (0 is off, 1 is on)
info->repeat = ReadMacInt8(pb + csParam);
// playmode (0 is normal, 1 is shuffle, 2 is program mode)
info->play_order = ReadMacInt8(pb + csParam + 1);
// D(bug(" SetPlayMode %04x\n", ReadMacInt16(pb + csParam)));
// printf("FATAL: .AppleCD/Control(125): unimplemented call\n");
return noErr;
case 126: // GetPlayMode (Apple's Audio CD program needs this)
// repeat flag
WriteMacInt8(pb + csParam, bcd2bin[info->repeat]);
// playmode
WriteMacInt8(pb + csParam + 1, bcd2bin[info->play_order]);
return noErr;
default:
printf("WARNING: Unknown CDROMControl(%d)\n", code);
return controlErr;
@ -871,7 +1033,7 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
drive_vec::iterator info = get_drive_info(ReadMacInt16(pb + ioVRefNum));
uint16 code = ReadMacInt16(pb + csCode);
D(bug("CDROMStatus %d\n", code));
// General codes (we can get these even if the drive was invalid)
switch (code) {
case 43: { // DriverGestalt
@ -885,10 +1047,12 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
WriteMacInt32(pb + csParam + 4, FOURCC('c','d','r','m'));
break;
case FOURCC('i','n','t','f'): // Interface type
WriteMacInt32(pb + csParam + 4, EMULATOR_ID_4);
// WriteMacInt32(pb + csParam + 4, EMULATOR_ID_4);
WriteMacInt32(pb + csParam + 4, FOURCC('a','t','p','i'));
break;
case FOURCC('s','y','n','c'): // Only synchronous operation?
WriteMacInt32(pb + csParam + 4, 0x01000000);
// WriteMacInt32(pb + csParam + 4, 1);
break;
case FOURCC('b','o','o','t'): // Boot ID
if (info != drives.end())
@ -912,12 +1076,15 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
case FOURCC('v','m','o','p'): // Virtual memory attributes
WriteMacInt32(pb + csParam + 4, 0); // Drive not available for VM
break;
case FOURCC('c', 'd', '3', 'd'):
WriteMacInt16(pb + csParam + 4, 0);
break;
default:
return statusErr;
}
return noErr;
}
case 97: { // WhoIsThere
uint8 drives_present = 0;
drive_vec::iterator info, end = drives.end();
@ -929,15 +1096,17 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
return noErr;
}
}
// Drive valid?
if (info == drives.end()) {
if (drives.empty())
if (drives.empty()) {
return nsDrvErr;
else
info = drives.begin(); // This is needed for Apple's Audio CD program
} else {
info = get_drive_info(last_drive_num);
if (info == drives.end()) return nsDrvErr;
}
}
// Drive-specific codes
switch (code) {
case 6: // Return format list
@ -950,15 +1119,15 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
} else {
return paramErr;
}
case 8: // DriveStatus
Mac2Mac_memcpy(pb + csParam, info->status, 22);
return noErr;
case 70: // GetPowerMode
WriteMacInt16(pb + csParam, info->power_mode << 8);
return noErr;
case 95: // Get2KOffset
if (info->twok_offset > 0) {
WriteMacInt16(pb + csParam, info->twok_offset);
@ -966,24 +1135,24 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
} else {
return statusErr;
}
case 96: // Get drive type
WriteMacInt16(pb + csParam, 3); // Apple CD 300 or newer
return noErr;
case 98: // Get block size
WriteMacInt16(pb + csParam, info->block_size);
return noErr;
case 120: // Return device ident
WriteMacInt32(pb + csParam, 0);
return noErr;
case 121: // Get CD features
WriteMacInt16(pb + csParam, 0x0200); // 300 KB/s
WriteMacInt16(pb + csParam + 2, 0x0c00); // SCSI-2, stereo
return noErr;
default:
printf("WARNING: Unknown CDROMStatus(%d)\n", code);
return statusErr;
@ -999,6 +1168,6 @@ void CDROMInterrupt(void)
{
if (!acc_run_called)
return;
mount_mountable_volumes();
}

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "prefs.h"
@ -33,14 +34,20 @@ prefs_desc platform_prefs_items[] = {
// Prefs file name and path
#if defined(__APPLE__) && defined(__MACH__)
const char PREFS_FILE_NAME[] = "/tmp/BasiliskII/BasiliskII_Prefs"; // HACK: for now, just load stuff from a fixed dir, inside /tmp
#else
const char PREFS_FILE_NAME[] = "BasiliskII_Prefs";
#endif
std::string UserPrefsPath;
/*
* Load preferences from settings file
*/
void LoadPrefs(void)
void LoadPrefs(const char * vmdir) // TODO: load prefs from 'vmdir'
{
// Read preferences from settings file
FILE *f = fopen(PREFS_FILE_NAME, "r");

View File

@ -23,7 +23,7 @@
// Platform-specific string definitions
const user_string_def platform_strings[] = {
user_string_def platform_strings[] = {
{-1, NULL} // End marker
};
@ -32,7 +32,7 @@ const user_string_def platform_strings[] = {
* Fetch pointer to string, given the string number
*/
char *GetString(int num)
const char *GetString(int num)
{
// First search for platform-specific string
int i = 0;

View File

@ -49,6 +49,9 @@
#define DEBUG 0
#include "debug.h"
extern bool tick_inhibit;
void PlayStartupSound();
/*
* Execute EMUL_OP opcode (called by 68k emulator or Illegal Instruction trap handler)
@ -70,7 +73,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->sr);
VideoQuitFullScreen();
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
QuitEmulator();
@ -83,10 +86,14 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
case M68K_EMUL_OP_RESET: { // MacOS reset
D(bug("*** RESET ***\n"));
tick_inhibit = true;
CDROMRemount(); // for System 7.x
TimerReset();
EtherReset();
AudioReset();
#ifdef USE_SDL_AUDIO
PlayStartupSound();
#endif
// Create BootGlobs at top of memory
Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096);
uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c;
@ -107,6 +114,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->a[1] = ROMBaseMac + UniversalInfo; // UniversalInfo
r->a[6] = boot_globs; // BootGlobs
r->a[7] = RAMBaseMac + 0x10000; // Boot stack
tick_inhibit = false;
break;
}
@ -114,7 +122,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
bool is_read = (r->d[1] & 0x80) != 0;
if ((r->d[1] & 0x78) == 0x38) {
// XPRAM
uint8 reg = (r->d[1] << 5) & 0xe0 | (r->d[1] >> 10) & 0x1f;
uint8 reg = ((r->d[1] << 5) & 0xe0) | ((r->d[1] >> 10) & 0x1f);
if (is_read) {
r->d[2] = XPRAM[reg];
bool localtalk = !(XPRAM[0xe0] || XPRAM[0xe1]); // LocalTalk enabled?
@ -453,7 +461,9 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
if (HasMacStarted()) {
// Mac has started, execute all 60Hz interrupt functions
#if !PRECISE_TIMING
TimerInterrupt();
#endif
VideoInterrupt();
// Call DoVBLTask(0)
@ -485,7 +495,12 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
ClearInterruptFlag(INTFLAG_ETHER);
EtherInterrupt();
}
#if PRECISE_TIMING
if (InterruptFlags & INTFLAG_TIMER) {
ClearInterruptFlag(INTFLAG_TIMER);
TimerInterrupt();
}
#endif
if (InterruptFlags & INTFLAG_AUDIO) {
ClearInterruptFlag(INTFLAG_AUDIO);
AudioInterrupt();
@ -575,7 +590,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr);
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
break;
@ -592,7 +607,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr);
#ifdef ENABLE_MON
char *arg[4] = {"mon", "-m", "-r", NULL};
const char *arg[4] = {"mon", "-m", "-r", NULL};
mon(3, arg);
#endif
QuitEmulator();

View File

@ -106,7 +106,7 @@ static uint32 fs_data = 0; // Mac address of global data
static char FS_NAME[32], VOLUME_NAME[32];
// This directory is our root (read from prefs)
static const char *RootPath;
static char RootPath[MAX_PATH_LENGTH];
static bool ready = false;
static struct stat root_stat;
@ -175,9 +175,9 @@ static uint32 next_cnid = fsUsrCNID; // Next available CNID
#if defined __APPLE__ && defined __MACH__
struct crtimebuf {
unsigned long length;
struct timespec crtime;
};
u_int32_t length;
struct timespec crtime;
} __attribute__((aligned(4), packed));
static uint32 do_get_creation_time(const char *path)
{
@ -196,7 +196,7 @@ static uint32 get_creation_time(const char *path)
{
if (path == NULL)
return 0;
if (path == RootPath) {
if (!strcmp(path, RootPath)) {
static uint32 root_crtime = UINT_MAX;
if (root_crtime == UINT_MAX)
root_crtime = do_get_creation_time(path);
@ -435,7 +435,11 @@ void ExtFSInit(void)
p->guest_name[31] = 0;
// Find path for root
if ((RootPath = PrefsFindString("extfs")) != NULL) {
*RootPath = 0;
const char *path = PrefsFindString("extfs");
if (path != NULL) {
strncpy(RootPath, path, MAX_PATH_LENGTH - 1);
RootPath[MAX_PATH_LENGTH - 1] = 0;
if (stat(RootPath, &root_stat))
return;
if (!S_ISDIR(root_stat.st_mode))

View File

@ -72,14 +72,21 @@ const uint32 siHardwareMute = FOURCC('h','m','u','t'); // mute state of all ha
const uint32 siHardwareVolume = FOURCC('h','v','o','l'); // volume level of all hardware
const uint32 siHardwareVolumeSteps = FOURCC('h','s','t','p'); // number of volume steps for hardware
const uint32 siHardwareBusy = FOURCC('h','w','b','s'); // sound hardware is in use
const uint32 siHardwareFormat = FOURCC('h','w','f','m'); // hardware format
const uint32 siHeadphoneMute = FOURCC('p','m','u','t'); // mute state of headphone
const uint32 siHeadphoneVolume = FOURCC('p','v','o','l'); // volume level of headphone
const uint32 siHeadphoneVolumeSteps = FOURCC('h','d','s','t'); // number of volume steps for headphone
const uint32 siSpeakerMute = FOURCC('s','m','u','t'); // mute state of all built-in speakers
const uint32 siSpeakerVolume = FOURCC('s','v','o','l'); // volume level of built-in speaker
const uint32 siDeviceName = FOURCC('n','a','m','e');
const uint32 siDeviceIcon = FOURCC('i','c','o','n');
const uint32 siHardwareFormat = FOURCC('h','w','f','m');
const uint32 siDeviceName = FOURCC('n','a','m','e'); // sound input name
const uint32 siDeviceIcon = FOURCC('i','c','o','n'); // sound input icon resource location
const uint32 siInputSourceNames = FOURCC('s','n','a','m'); // sound input source names
const uint32 siInputSource = FOURCC('s','o','u','r'); // sound input source selector
const uint32 siInputGain = FOURCC('g','a','i','n'); // sound input gain
const uint32 siOptionsDialog = FOURCC('o','p','t','d'); // display options dialog box
const uint32 siPlayThruOnOff = FOURCC('p','l','t','h'); // play-through state
const uint32 siInitializeDriver = FOURCC('i','n','i','t'); // open sound input device
const uint32 siCloseDriver = FOURCC('c','l','o','s'); // close sound input device
enum { // ComponentResource struct
componentType = 0,

View File

@ -1,5 +1,5 @@
/*
* bincue_unix.h -- support for cdrom image files in bin/cue format
* bincue.h -- support for cdrom image files in bin/cue format
*
* (C) 2010 Geoffrey Brown
*
@ -34,10 +34,13 @@ extern bool CDPlay_bincue(void *, uint8, uint8,
extern bool CDPause_bincue(void *);
extern bool CDResume_bincue(void *);
extern bool CDStop_bincue(void *);
extern bool CDScan_bincue(void *, uint8, uint8, uint8, bool);
extern void CDSetVol_bincue(void *, uint8, uint8);
extern void CDGetVol_bincue(void *, uint8 *, uint8 *);
#ifdef USE_SDL_AUDIO
extern void OpenAudio_bincue(int, int, int, uint8);
extern void MixAudio_bincue(uint8 *, int);
extern void OpenAudio_bincue(int, int, int, uint8, int);
extern void MixAudio_bincue(uint8 *, int, int);
#endif
#endif

View File

@ -40,4 +40,9 @@ extern int16 CDROMPrime(uint32 pb, uint32 dce);
extern int16 CDROMControl(uint32 pb, uint32 dce);
extern int16 CDROMStatus(uint32 pb, uint32 dce);
extern void CDROMOpenDone(void); // Called by CDROMOpen() once drives have been to the drive queue
void CDROMDrop(const char *path);
void CDROMRemount();
#endif

View File

@ -30,6 +30,8 @@
#include <sys/types.h>
#include <sys/timeb.h>
#include "main.h"
static inline void _cdecl vwinbug(const char *s, va_list vargs)
{
char msg[1024], date[50], hours[50];

Some files were not shown because too many files have changed in this diff Show More