Commit Graph

245 Commits

Author SHA1 Message Date
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
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
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
dmac
9f58eb96dc Use relative mouse values when grabbed in sdl. 2017-07-16 12:07:08 +01:00
Alexei Svitkine
181634ab31 Fix more Xcode8 warnings and tweak project settings. 2016-12-17 23:31:03 -05:00
Alexei Svitkine
1f211fb37b fix some warnings in Xcode8 build 2016-12-17 22:04:57 -05:00
Ricky Zhang
10e4bba941
Add customized color depth in SDL. To change color depth, add bit of color depth as displaycolordepth prefs in .basilisk_ii_prefs. 2016-08-15 07:38:25 -04:00
Dave Vasilevsky
c2236350f4 Use constant for max volume 2015-12-27 22:42:37 -05:00
Dave Vasilevsky
4fa03d5fb1 Cleanups: Set to NULL after free, remove commented out code 2015-12-27 22:39:23 -05:00
Dave Vasilevsky
09a0525aac Enable audio volume in SDL
This is useful for keeping the volume of SS/B2 separate from that of the host machine. For example, you can mute a game in SS, while still playing music on your host.
2015-12-27 22:13:00 -05:00
James Touton
f066f5a4fd video_sdl compiles cleanly in MSVC.
Resolved a bunch of type conversion warnings.
2015-08-06 01:12:43 -07:00
Alexei Svitkine
6c8d16ef3a Fix issue where unminimizing a SheepShaver window on Mac OS X
results in redraw artifacts.
2015-06-30 15:01:51 -04:00
Alexei Svitkine
d3cb3ca95f Fix some warnings when building Xcode project. 2015-06-29 11:50:50 -04:00
Dave Vasilevsky
26d5f6b7f2 SDL: Allow fullscreen toggle in BasiliskII 2013-04-24 04:13:14 -04:00
Dave Vasilevsky
eceafc6200 SDL: Allow toggling fullscreen/windowed mode 2013-04-24 04:13:07 -04:00
Dave Vasilevsky
efae88ea7c SDL: Let video driver know about cursor type change 2013-04-24 04:12:06 -04:00
Dave Vasilevsky
ff423fe7c9 SDL: Let driver_base be reused in a different video mode
Split init() into one-time initialization, and adaptation to a new video mode.
2013-04-24 04:09:47 -04:00
Dave Vasilevsky
e9c913c4ae SDL: Completely collapse fullscreen/window drivers 2013-04-24 03:30:52 -04:00
Dave Vasilevsky
9e807c884c SDL: Move init() method into base 2013-04-24 03:30:52 -04:00
Dave Vasilevsky
19529cacd4 SDL: Remove useless virtual qualifiers 2013-04-24 03:30:52 -04:00
Dave Vasilevsky
14e6e654f0 SDL: Move mouse movement to base 2013-04-24 03:30:52 -04:00
Dave Vasilevsky
d0648a7039 SDL: Make VOSF update functions apply to driver_base
They don't use anything special from fullscreen/windowed derived classes.
Also, get rid of unneeded friend declarations.
2013-04-24 03:30:51 -04:00
Dave Vasilevsky
2a5100e8d2 SDL: Move destruction into base 2013-04-24 03:30:51 -04:00
Dave Vasilevsky
fed95369d1 SDL: Move window title setting to base 2013-04-24 03:30:51 -04:00
Dave Vasilevsky
b2e5125868 SDL: Move cursor initialization to base
Also decide in just one place whether to use hardware or software cursor.
2013-04-24 03:29:53 -04:00
Dave Vasilevsky
6eb54dccbe SDL: Move more initialization to base
Including blitter, gray ramp, frame buffer initialization.
2013-04-24 00:07:50 -04:00
Dave Vasilevsky
053308e4f9 SDL: Move VOSF initialization to base 2013-04-24 00:07:50 -04:00
Dave Vasilevsky
0c2658f4d1 SDL: Prepare to collapse fullscreen/window drivers
We want to have just one base driver that can handle both fullscreen and
windowed mode, so that we can easily switch between modes.

Create a virtual init() method to do construction, so we can move common code
from the derived classes into the base init().
2013-04-24 00:07:49 -04:00
Dave Vasilevsky
82adeb988b SDL: Remove unused method and ivars
mouse_last_x, mouse_last_y and driver_window::mouse_moved() look like remnants
of X11 video, they're never really used.
2013-04-24 00:07:49 -04:00
Dave Vasilevsky
94ebea3509 SDL: Don't uselessly free the_host_buffer
It always points to a member of an SDL_Surface, which is freed by SDL.
2013-04-24 00:07:43 -04:00
Dave Vasilevsky
c0d7aa0004 SDL: Remove old hack, reduce flicker
The old SDL_QuitSubsystem workaround is probably obsolete, and causes
flicker on resolution changes.
2013-04-24 00:04:49 -04:00
Dave Vasilevsky
02d844c6a7 SDL: Make non-Mac fullscreen cursor visible
Issue: https://github.com/cebix/macemu/issues/26

On non-Mac platforms, driver_fullscreen constructor sets up software cursor,
but switch_to_current_mode() ask for a hardware cursor, possibly due to a typo.
Neither one ends up being drawn, so the cursor goes invisible.

This change makes them agree to use a software cursor. We should eventually
move to just one place deciding which cursor to use, so they don't have to be
kept in sync.
2013-04-22 02:06:15 -04:00
Dave Vasilevsky
2fb9487933 Mac: Fix mouse grabbing
If mouse is grabbed on OS X, every time the mouse cursor icon changes the
cursor is recentered. Workaround similar to Windows in video_set_cursor().
2013-04-20 19:02:33 -04:00
Alexei Svitkine
be28a8e5d4 [Amadeusz Sławiński]
Fix crashes with SDL on Linux due to delayed cursor setting.
2012-06-18 19:31:50 -04:00
asvitkine
e4234d7cff pull latest SDLMain from SDL-1.2.15 2012-06-15 22:52:49 +00:00
asvitkine
93184352d4 fix some unused declaration warnings 2012-01-14 15:45:18 +00:00
asvitkine
e0c86f12f9 autorelease fix has landed upstream to SDL, remove our version of it 2012-01-04 22:52:05 +00:00
asvitkine
0604cce26b enable hardware cursor on SDL 1.2.15+ 2011-12-30 15:11:08 +00:00
asvitkine
dcf65b4d27 move NSAutoReleasePool_wrap() into its own file 2011-12-29 07:39:56 +00:00
asvitkine
45fbd1523f fix SDL leak by wrapping video_refresh() call with an NSAutoReleasePool 2011-12-28 22:15:11 +00:00
asvitkine
cb0d1a818d revert r1.39 - SDL 1.2.14 doesn't fix the hardware cursor :\ 2011-12-28 21:44:53 +00:00
asvitkine
67ce6f2bcf re-enable hardware cursor switching for SDL 1.2.14+, since the bug appears
to have been fixed
2011-12-28 21:35:42 +00:00
asvitkine
3d09f85dc9 fix some unused var/function warnings 2011-12-28 20:22:25 +00:00
asvitkine
90bdd12839 [Geoffrey Brown]
Add bin/cue support. The following should work:

1) Basilisk and SheepShaver with sdl-audio and bincue on linux and os x
2) SheepShaver with bincue and core audio on os x
2010-10-06 00:30:23 +00:00
asvitkine
64d95f756c [Edward Mendelson] Fix default keycode for ` key. 2010-08-23 23:51:34 +00:00
asvitkine
6e5d8e4e85 Revert previous patch, as it was causing issues (as per basilisk-devel discussions). 2010-01-15 01:58:28 +00:00
asvitkine
b6f9f38f98 [patch by Dave Vasilevsky]
Fix for bug: SheepShaver compiled with VOSF off will not display
fullscreen on OS X. The VM boots, but the display is entirely black.
This was expected, I suppose, since video_refresh_dga() didn't
actually attempt to draw anything!

The patch fixes this. Notes:
* video_refresh_window() now takes an argument of type driver_base,
since nothing specific to driver_window was used
* video_refresh_dga() can now call video_refresh_window_static()
* update_display_static_bbox() now respects the destination having a
different bytes-per-row from the source
* fullscreen modes are now created for all depths
2009-03-03 08:14:53 +00:00
asvitkine
da540a74f6 [patch by Mike Sliczniak]
Here is a patch to allow compiling of SS and B2 with an SDL Framework. You can
get this by downloading from:

http://www.libsdl.org/release/SDL-1.2.13.dmg

Here is how I tested on an intel 32-bit mac with Mac OS X 10.5.6:

SS ./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-framework --enable-sdl-framework-prefix=/Users/mzs/Library/Frameworks --enable-sdl-video --disable-sdl-audio --enable-addressing=real
--without-esd --without-gtk --without-mon --without-x

SS /autogen.sh --disable-standalone-gui --enable-vosf --disable-sdl-framework --disable-sdl-video --disable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --with-x

B2 ./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-framework --enable-sdl-framework-prefix=/Users/mzs/Library/Frameworks --enable-sdl-video --enable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x --enable-jit-compiler

B2 ./autogen.sh --disable-standalone-gui --enable-vosf --disable-sdl-framework --disable-sdl-video --disable-sdl-audio --enable-addressing=real --with-esd --without-gtk --without-mon --with-x --enable-jit-compiler

(esound does not really work on mac, it needs some better coreaudio patches.)

configure.ac for SS has two little additional fixes so that the Cocoa prefs gui
does not get built if you are building for X11 and so that you can use esd, sdl,
or coreaudio for sound.
2009-03-03 08:07:22 +00:00
asvitkine
1b9d155673 [patch by Mike Sliczniak]
This patch helps to keep the audio from breaking-up on slow machines when using
SDL audio. On those slow machines you do still get the break-up every so often
but the sound tends not to break-up nearly as often. It is much better on the
ears. Notably often the system beeps do not have a pause in them.
Slow machine is <= 1 GHz G4.
2009-02-19 06:42:01 +00:00
asvitkine
6dcddb92e6 [patch from Kelvin Delbarre]
This fixes the mapping of SDL mouse-button numbers to MacOS/ADB mouse-button numbers,
to correct the reversal of the middle and right buttons. Most useful in conjunction
with a multi-button mouse enabler such as TheMouse2B:

http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cfg/themouse-2b-11.hqx

... which can turn a right-click into a control-click.
2008-07-20 07:33:09 +00:00
asvitkine
c23511080e [patch from Kelvin Delbarre]
Software cursor mode is now supported, although currently the existing hardware
cursor mode is used whenever possible. (Software mode will be used if you are
running with a recent version of SDL's Quartz video driver, since a bug in SDL
1.2.11 and later prevents the hardware cursor from working properly with that
driver.)

In hardware cursor mode, the hot-spot is now determined heuristically. Formerly
it could not be determined and was always (1,1), an annoyance for many cursors
other than the arrow.

In hardware cursor mode, the cursor will now be hidden when requested by the
emulated OS (such as when you are typing in a text field).

In hardware cursor mode, some cursor image formats that the code does not handle
correctly will now be rejected, causing the emulated OS to revert temporarily to
software cursor mode. Formerly you would just end up with random garbage for a
cursor. This typically happened for grayscale or color cursors; rejecting images
with rowBytes != 2 eliminates the worst cases.
2008-06-25 02:52:52 +00:00
asvitkine
150a577e4e [patch from Kelvin Delbarre] If you move the mouse cursor in and out of the
SheepShaver window a number of times (somewhere around 30 or 40 times will do
it), SheepShaver appears to lock up. This occurs because SDL posts application
activate/deactivate events to its event queue when the mouse moves in/out of the
SheepShaver window, but these events are never consumed, and as a result, the
event queue fills up. Thereafter, no new events can be posted, and user inputs
are ignored. The fix is to consume SDL_ACTIVEEVENT in handle_events().
2008-06-20 00:45:27 +00:00
gbeauche
c8cb4879a4 Happy New Year! 2008-01-01 09:40:36 +00:00
gbeauche
0a7fe2eaf8 Workaround video mode switch problems. IOW, make sure to always allocate
the frame buffer at the same base address.
2007-06-14 14:45:54 +00:00
asvitkine
48907db336 Ok, now this works properly (Fix resolution switching without affecting audio). 2007-01-22 00:36:32 +00:00
asvitkine
268af8086b back out my previous change, it breaks audio 2007-01-22 00:32:25 +00:00
asvitkine
473a3f2e22 Fix for resolution switching corruption under SDL (Mac OS X). 2007-01-21 19:33:13 +00:00
gbeauche
7660affe77 Windows apparently needs an extra mouse event to make the new cursor image
visible.
2006-05-14 14:11:46 +00:00
gbeauche
3aa9d912b7 Fix build on Windows (<malloc.h> for alloca()) 2006-05-14 13:49:53 +00:00
gbeauche
98675da523 Fix NQD bounds checking -- don't overwrite the CLEAR Page Guard. 2006-05-14 08:32:05 +00:00
gbeauche
1470a8af13 NQD dirty boxes, SDL backend.
This reduces the number of Screen_fault_handler() calls by 80%. i.e. VOSF
is now viable on this turtle MacOS X. Besides, since there is no buffer
comparison, idle sleep can really be effective. SheepShaver in idle mode
on my PBG4 now goes below 8% of CPU resources instead of 70-80% with
bounding boxes based video refreshes.

Caveat: if your program doesn't use standard MacOS routines that call NQD,
then you can expect slower (visual) performance. However, I do think the
new default behavior (VOSF+NQD) is the most common.
2006-05-13 16:58:44 +00:00
gbeauche
3b07ba27e4 Introduce a new video refresh function that uses smaller bounding boxes.
This does not improve graphics performance but helps CPU because it reduces
the number of bytes transfered to actual screen. I saw an improvement by up
to 26% in frameskip 4 800x600x16 but also a hit by 3% with frameskip 0.

The next step is to use NQD bounding boxes to help detecting dirty areas.

So far, this is the best I can do without VOSF working (MacOS X performance
bugs -- pitifully slow Mach syscalls)
2006-05-11 07:51:32 +00:00
gbeauche
5019174a22 SDL Video updates:
- Properly handle migration from "screenmodes" and "windowmodes" to "screen"
- Fix has_mode() logic to really test for actual mode availability. i.e.
  no longer start in large screen mode if user specified a max size.
2006-05-09 21:41:02 +00:00
gbeauche
99241183a5 Fix pollmedia on Windows, it's no longer necessary to boot with a CD-ROM in
the drive to use it. Side effect: media can be changed without problems now
2006-03-28 07:01:19 +00:00
gbeauche
41fb85a3e7 Protect the SDL events queue when changing the cursor map in SheepShaver,
aka fix "Xlib: unexpected async reply" messages in SDL/x11 builds.
2005-11-29 23:20:31 +00:00
gbeauche
a7da877356 Remove obsolete Cygwin/X11 addressing hack. Fix DirectX fullscreen mode
with hardware surface. On the other hand, DIB (SDL_VIDEODRIVER=windib)
always seems the fastest on my system for both windowed and fullscreen
modes.
2005-11-21 23:38:46 +00:00
gbeauche
fe99211e75 Support USE_CPU_EMUL_SERVICES in SDL/video driver. Only trigger ethernet
interrupt in one_tick() if no pthreads at all are used, i.e. ether_dummy
is effective in that case. Otherwise, don't trigger ethernet again if
pthreads are available (and ether_unix) and cpu emul services are active.
2005-06-14 22:35:42 +00:00
gbeauche
57e618990c Add experimental fullscreen SDL video graphics. Map Windows keys to Option. 2005-06-06 21:20:28 +00:00
gbeauche
71c3199a42 Add "fbcon" keycodes (Linux Framebuffer Console) 2005-05-15 07:55:05 +00:00
gbeauche
5892c6c286 more sdl key conversions 2005-03-20 23:43:17 +00:00
gbeauche
ae6555fd46 SDL_ListModes() sometimes does not return a sorted list from largest to
smallest screen dimensions (e.g. on windows)
2005-03-19 05:34:15 +00:00
gbeauche
fcb323c511 Default to BasiliskII_keycodes file on Windows if user wants keycodes but
no keycodefile is specified
2005-03-17 00:19:39 +00:00
gbeauche
30632aed4f Happy New Year! 2005-01-30 21:42:16 +00:00
gbeauche
cfff01f846 fix parsing of the keycode table 2005-01-22 17:41:33 +00:00
gbeauche
08a3e449d3 Always use vm_acquire* to allocate frame buffers, so that cygwin/x86 version
can have a chance in case VOSF is not profitable (on video mode switches)
Improve video mode switches in SheepShaver/SDL, aka avoid crashes on win32
as there is apparently no thread canceleation algorithm used in SDL/win32.
2004-11-28 19:31:11 +00:00
gbeauche
87a73ed054 Windows keycodes 2004-11-14 23:01:18 +00:00
gbeauche
bfd1c7b659 Try to fix 16 bpp over 32 bpp on MacOS X. 2004-07-27 21:40:52 +00:00
gbeauche
eed5724b80 SDL audio support 2004-07-19 19:25:07 +00:00
gbeauche
585a96c8be NQD moved to SheepShaver src/gfxaccel.cpp 2004-07-02 06:08:01 +00:00
gbeauche
a4eb3b19ab Don't try to make a cast value an lvalue (Brian Johnson). Add some explicit
casts to (int) in order to avaoid this warning:
warning: comparison between `const enum video_depth' and `enum <anonymous>'
2004-06-29 21:50:23 +00:00
gbeauche
1d86d66bd7 SDL scancodes -> Mac keycodes translation file 2004-06-27 17:31:52 +00:00
gbeauche
b6e1e6e536 Force processing of modifier keys through SDL keysyms. Fix mapping of
Option & Command keys on MacOS X. Fix scroll lock on MacOS X too.
2004-06-27 17:31:21 +00:00
gbeauche
4ea24edaf3 Fix video_vosf_init() for BasiliskII/SDL 2004-06-26 17:20:35 +00:00
gbeauche
808b3e34c8 Add heuristic to deitermine run-time effect of VOSF acceleration, and
disable it if it turns out to not be profitable
2004-06-26 15:22:02 +00:00
gbeauche
46a9054861 Enable hardware cursor acceleration in SheepShaver/SDL version too. 2004-06-24 22:38:42 +00:00
gbeauche
3706fbc70d Try to get maximum display width by assuming that would match maximum
possible resolution for fullscreen+hwsurface. Fix, termination of VModes[].
Really handle "windowmodes" prefs item, but this needs code factoring.
2004-06-24 21:46:55 +00:00
gbeauche
2d05122bdb Initial SDL support for SheepShaver, though it seems to slow down the
emulator somehow. Also use better timing in redraw_func().
2004-06-24 15:25:57 +00:00
gbeauche
14587bed4d SDL_WaitThread() works better when the thread arg is valid. ;-) 2004-06-23 22:55:47 +00:00
gbeauche
6b903f3d18 Fix events processing on MacOS X, though mouse motion is still not smooth
enough.
2004-06-23 22:37:33 +00:00
gbeauche
7af8aaed40 Initial SDL support. 2004-06-23 13:47:20 +00:00