mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-11 10:30:09 +00:00
Merge pull request #202 from rickyzhang82/pr-enable-sdl2
Enable SDL2 for Linux and Mac OS X
This commit is contained in:
commit
16081b2878
30
.travis.yml
30
.travis.yml
@ -3,18 +3,36 @@ language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env :
|
||||
- SDL_MAJOR_VERSION=1
|
||||
- os: linux
|
||||
dist: bionic
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env :
|
||||
- SDL_MAJOR_VERSION=2
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl1.2-dev
|
||||
- libsdl1.2-dev
|
||||
- libgtk2.0-dev
|
||||
- libsdl2-dev
|
||||
|
||||
script:
|
||||
- cd BasiliskII/src/Unix
|
||||
- NO_CONFIGURE=1 ./autogen.sh
|
||||
- ./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon
|
||||
- make -j 4
|
||||
- ERR_CODE=0
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
cd BasiliskII/src/Unix;
|
||||
NO_CONFIGURE=1 ./autogen.sh;
|
||||
if [[ $SDL_MAJOR_VERSION == *"1"* ]]; then
|
||||
./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon;
|
||||
make -j 4 || ERR_CODE=$?;
|
||||
else
|
||||
./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon --with-sdl2;
|
||||
make -j 4 || ERR_CODE=$?;
|
||||
fi
|
||||
fi
|
||||
- (exit $ERR_CODE)
|
||||
|
@ -524,7 +524,6 @@ bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_or
|
||||
|
||||
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines
|
||||
Screen_blit = Blit_Copy_Raw;
|
||||
|
||||
} else {
|
||||
|
||||
// Compute RGB shift values
|
||||
|
@ -30,6 +30,12 @@
|
||||
#include "util_windows.h"
|
||||
#endif
|
||||
|
||||
// Import SDL-backend-specific functions
|
||||
#ifdef USE_SDL_VIDEO
|
||||
extern void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
|
||||
extern void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects);
|
||||
#endif
|
||||
|
||||
// Glue for SDL and X11 support
|
||||
#ifdef TEST_VOSF_PERFORMANCE
|
||||
#define MONITOR_INIT /* nothing */
|
||||
@ -514,7 +520,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
|
||||
VIDEO_DRV_UNLOCK_PIXELS;
|
||||
|
||||
#ifdef USE_SDL_VIDEO
|
||||
SDL_UpdateRect(drv->s, 0, y1, VIDEO_MODE_X, height);
|
||||
update_sdl_video(drv->s, 0, y1, VIDEO_MODE_X, height);
|
||||
#else
|
||||
if (VIDEO_DRV_HAVE_SHM)
|
||||
XShmPutImage(x_display, VIDEO_DRV_WINDOW, VIDEO_DRV_GC, VIDEO_DRV_IMAGE, 0, y1, 0, y1, VIDEO_MODE_X, height, 0);
|
||||
@ -558,7 +564,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
||||
i2 += scr_bytes_per_row;
|
||||
}
|
||||
#ifdef USE_SDL_VIDEO
|
||||
SDL_UpdateRect(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y);
|
||||
update_sdl_video(drv->s, 0, 0, VIDEO_MODE_X, VIDEO_MODE_Y);
|
||||
#endif
|
||||
VIDEO_DRV_UNLOCK_PIXELS;
|
||||
return;
|
||||
@ -664,7 +670,7 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_SDL_VIDEO
|
||||
SDL_UpdateRects(drv->s, bbi, bb);
|
||||
update_sdl_video(drv->s, bbi, bb);
|
||||
#endif
|
||||
VIDEO_DRV_UNLOCK_PIXELS;
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
Binary file not shown.
1164
BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj
Normal file
1164
BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
7
BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:BasiliskII.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
576
BasiliskII/src/MacOSX/BasiliskII_keycodes
Normal file
576
BasiliskII/src/MacOSX/BasiliskII_keycodes
Normal 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 .
|
@ -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 <nigel@ind.tansu.com.au>
|
||||
<BR>
|
||||
<BR>
|
||||
SDL2 port
|
||||
<BR>
|
||||
by David Ludwig <dludwig@pobox.com>
|
||||
</RIGHT>
|
||||
|
@ -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-2020 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";
|
||||
|
@ -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-2020 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>
|
||||
|
27
BasiliskII/src/MacOSX/Makefile.gencpu
Normal file
27
BasiliskII/src/MacOSX/Makefile.gencpu
Normal file
@ -0,0 +1,27 @@
|
||||
SRC = $(PROJECT_DIR)/../uae_cpu
|
||||
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output
|
||||
VPATH = $(SRC)
|
||||
CFLAGS = -DUSE_XCODE=1 -I. -I../uae_cpu -I../UNIX
|
||||
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
|
||||
OBJS = $(addprefix $(DST)/, defs68k.o gencpu.o readcpu.o)
|
||||
|
||||
all: $(DST)/gencpu
|
||||
cd $(DST); ./gencpu
|
||||
|
||||
$(DST)/gencpu: $(OBJS)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
$(DST)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(DST)/%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(DST)/defs68k.c: $(DST)/build68k
|
||||
$< < $(SRC)/table68k > $@
|
||||
|
||||
$(DST)/build68k: $(SRC)/build68k.c
|
||||
mkdir -p $(DST)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:; rm -fr $(DST)
|
@ -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;
|
||||
|
@ -234,8 +234,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 +807,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 +1126,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);
|
||||
|
820
BasiliskII/src/MacOSX/config.h
Normal file
820
BasiliskII/src/MacOSX/config.h
Normal file
@ -0,0 +1,820 @@
|
||||
/* 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. */
|
||||
#define SIZEOF_LONG_DOUBLE 16
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#define SIZEOF_VOID_P 8
|
||||
|
||||
/* Define as the maximum value of type 'size_t', if the system doesn't define
|
||||
it. */
|
||||
/* #undef SIZE_MAX */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <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 */
|
||||
|
||||
#define FPU_IEEE
|
||||
|
||||
#endif
|
580
BasiliskII/src/MacOSX/etherhelpertool.c
Normal file
580
BasiliskII/src/MacOSX/etherhelpertool.c
Normal 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);
|
||||
}
|
||||
}
|
@ -251,7 +251,10 @@ static int open_rsrc(const char *path, int flag)
|
||||
char rsrc_path[MAX_PATH_LENGTH];
|
||||
make_rsrc_path(path, rsrc_path);
|
||||
|
||||
return open(rsrc_path, flag);
|
||||
int fd = open(rsrc_path, flag);
|
||||
if (fd < 0 && flag == O_WRONLY)
|
||||
fd = open(rsrc_path, O_WRONLY | O_CREAT); // for APFS
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +259,7 @@ void DarwinAddFloppyPrefs(void)
|
||||
while ((nextFloppy = IOIteratorNext(allFloppies)))
|
||||
{
|
||||
char bsdPath[MAXPATHLEN];
|
||||
long size;
|
||||
long size = 0;
|
||||
Boolean gotSize = FALSE;
|
||||
CFTypeRef sizeAsCFNumber =
|
||||
IORegistryEntryCreateCFProperty(nextFloppy,
|
||||
|
@ -19,7 +19,13 @@
|
||||
*/
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include "sysdeps.h"
|
||||
#include "utils_macosx.h"
|
||||
#include <SDL.h>
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include <SDL_syswm.h>
|
||||
#endif
|
||||
|
||||
// This is used from video_sdl.cpp.
|
||||
void NSAutoReleasePool_wrap(void (*fn)(void))
|
||||
@ -28,3 +34,49 @@ 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;
|
||||
}
|
||||
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
if (!SDL_GetWindowWMInfo(window, &wmInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
|
||||
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_menu_bar_visible_osx(bool visible)
|
||||
{
|
||||
[NSMenu setMenuBarVisible:(visible ? YES : NO)];
|
||||
}
|
||||
|
||||
void set_current_directory()
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
chdir([[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] UTF8String]);
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ static bool open_sdl_audio(void)
|
||||
}
|
||||
|
||||
SDL_AudioSpec audio_spec;
|
||||
memset(&audio_spec, 0, sizeof(audio_spec));
|
||||
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
|
||||
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? AUDIO_U8 : AUDIO_S16MSB;
|
||||
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
|
||||
@ -99,14 +100,27 @@ static bool open_sdl_audio(void)
|
||||
fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SDL2
|
||||
// HACK: workaround a bug in SDL pre-2.0.6 (reported via https://bugzilla.libsdl.org/show_bug.cgi?id=3710 )
|
||||
// whereby SDL does not update audio_spec.size
|
||||
if (audio_spec.size == 0) {
|
||||
audio_spec.size = (SDL_AUDIO_BITSIZE(audio_spec.format) / 8) * audio_spec.channels * audio_spec.samples;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BINCUE)
|
||||
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels,
|
||||
audio_spec.silence);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SDL2
|
||||
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);
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
@ -39,9 +39,9 @@
|
||||
* - Backport hw cursor acceleration to Basilisk II?
|
||||
* - Factor out code
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#ifdef ENABLE_SDL1
|
||||
#include <SDL.h>
|
||||
#include <SDL_mutex.h>
|
||||
#include <SDL_thread.h>
|
||||
@ -455,7 +455,7 @@ 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
|
||||
@ -584,6 +584,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
|
||||
@ -2269,3 +2279,4 @@ void video_set_dirty_area(int x, int y, int w, int h)
|
||||
// XXX handle dirty bounding boxes for non-VOSF modes
|
||||
}
|
||||
#endif
|
||||
#endif //ifdef ENABLE_SDL1
|
||||
|
2723
BasiliskII/src/SDL/video_sdl2.cpp
Normal file
2723
BasiliskII/src/SDL/video_sdl2.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphi
|
||||
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
|
||||
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
|
||||
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
|
||||
AC_ARG_WITH(sdl2, [ --with-sdl2 use SDL 2.x, rather than SDL 1.x [default=no]], [WANT_SDL_VERSION_MAJOR=2], [WANT_SDL_VERSION_MAJOR=1])
|
||||
|
||||
dnl JIT compiler options.
|
||||
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
|
||||
@ -255,7 +256,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.
|
||||
@ -265,18 +266,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],
|
||||
@ -300,27 +299,66 @@ 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
|
||||
AC_PATH_PROG(sdl_config, "sdl-config")
|
||||
if [[ -n "$sdl_config" ]]; then
|
||||
sdl_cflags=`$sdl_config --cflags`
|
||||
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
|
||||
sdl_libs=`$sdl_config --static-libs`
|
||||
if [[ "x$WANT_SDL_VERSION_MAJOR" = "x1" ]]; then
|
||||
AC_DEFINE(ENABLE_SDL1, 1, [Define if using SDL1.])
|
||||
AC_PATH_PROG(sdl_config, "sdl-config")
|
||||
if [[ -n "$sdl_config" ]]; then
|
||||
sdl_cflags=`$sdl_config --cflags`
|
||||
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
|
||||
sdl_libs=`$sdl_config --static-libs`
|
||||
else
|
||||
sdl_libs=`$sdl_config --libs`
|
||||
fi
|
||||
CFLAGS="$CFLAGS $sdl_cflags"
|
||||
CXXFLAGS="$CXXFLAGS $sdl_cflags"
|
||||
LIBS="$LIBS $sdl_libs"
|
||||
else
|
||||
sdl_libs=`$sdl_config --libs`
|
||||
WANT_SDL=no
|
||||
WANT_SDL_VIDEO=no
|
||||
WANT_SDL_AUDIO=no
|
||||
SDL_SUPPORT="none"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "x$WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
|
||||
AC_DEFINE(ENABLE_SDL2, 1, [Define if using SDL2.])
|
||||
AC_PATH_PROG(sdl_config, "sdl2-config")
|
||||
if [[ -n "$sdl_config" ]]; then
|
||||
sdl_cflags=`$sdl_config --cflags`
|
||||
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
|
||||
sdl_libs=`$sdl_config --static-libs`
|
||||
else
|
||||
sdl_libs=`$sdl_config --libs`
|
||||
fi
|
||||
CFLAGS="$CFLAGS $sdl_cflags"
|
||||
CXXFLAGS="$CXXFLAGS $sdl_cflags"
|
||||
LIBS="$LIBS $sdl_libs"
|
||||
else
|
||||
WANT_SDL=no
|
||||
WANT_SDL_VIDEO=no
|
||||
WANT_SDL_AUDIO=no
|
||||
SDL_SUPPORT="none"
|
||||
fi
|
||||
CFLAGS="$CFLAGS $sdl_cflags"
|
||||
CXXFLAGS="$CXXFLAGS $sdl_cflags"
|
||||
LIBS="$LIBS $sdl_libs"
|
||||
else
|
||||
WANT_SDL=no
|
||||
WANT_SDL_VIDEO=no
|
||||
WANT_SDL_AUDIO=no
|
||||
SDL_SUPPORT="none"
|
||||
fi
|
||||
fi
|
||||
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
|
||||
@ -448,7 +486,7 @@ if [[ "x$WANT_GTK" = "xgtk" ]]; then
|
||||
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
|
||||
AM_GNU_GETTEXT([external])
|
||||
B2_PATH_GNOMEUI([
|
||||
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
|
||||
@ -837,7 +875,7 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
|
||||
fi
|
||||
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
|
||||
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
|
||||
VIDEOSRCS="../SDL/video_sdl.cpp"
|
||||
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp"
|
||||
KEYCODES="../SDL/keycodes"
|
||||
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
|
||||
AC_MSG_CHECKING([whether __LP64__ is defined])
|
||||
@ -863,6 +901,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"
|
||||
@ -1863,6 +1904,7 @@ echo
|
||||
echo Mac OS X GUI ........................... : $WANT_MACOSX_GUI
|
||||
echo Mac OS X Sound ......................... : $WANT_MACOSX_SOUND
|
||||
echo SDL support ............................ : $SDL_SUPPORT
|
||||
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
|
||||
echo BINCUE support ......................... : $have_bincue
|
||||
echo LIBVHD support ......................... : $have_libvhd
|
||||
echo VDE support ............................ : $have_vdeplug
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#ifdef USE_SDL
|
||||
# include <SDL.h>
|
||||
# include <SDL_main.h>
|
||||
#endif
|
||||
|
||||
#ifndef USE_SDL_VIDEO
|
||||
@ -62,6 +63,9 @@ struct sigstate {
|
||||
# ifdef HAVE_GNOMEUI
|
||||
# include <gnome.h>
|
||||
# endif
|
||||
# if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
|
||||
# include <X11/Xlib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_XF86_DGA
|
||||
@ -386,6 +390,9 @@ static void usage(const char *prg_name)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if defined(ENABLE_GTK) && !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
|
||||
XInitThreads();
|
||||
#endif
|
||||
const char *vmdir = NULL;
|
||||
char str[256];
|
||||
|
||||
@ -448,6 +455,19 @@ int main(int argc, char **argv)
|
||||
vde_sock = argv[i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
|
||||
#if __MACOSX__
|
||||
// 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
|
||||
@ -531,6 +551,18 @@ int main(int argc, char **argv)
|
||||
QuitEmulator();
|
||||
}
|
||||
atexit(SDL_Quit);
|
||||
|
||||
#if __MACOSX__ && 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.
|
||||
extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
|
||||
disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Init system routines
|
||||
@ -643,6 +675,11 @@ int main(int argc, char **argv)
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
#if __MACOSX__
|
||||
extern void set_current_directory();
|
||||
set_current_directory();
|
||||
#endif
|
||||
|
||||
// Get rom file path from preferences
|
||||
const char *rom_path = PrefsFindString("rom");
|
||||
|
||||
|
@ -243,6 +243,11 @@ enum {
|
||||
STR_WINDOW_TITLE = 4000,
|
||||
STR_WINDOW_TITLE_FROZEN,
|
||||
STR_WINDOW_TITLE_GRABBED,
|
||||
STR_WINDOW_TITLE_GRABBED0,
|
||||
STR_WINDOW_TITLE_GRABBED1,
|
||||
STR_WINDOW_TITLE_GRABBED2,
|
||||
STR_WINDOW_TITLE_GRABBED3,
|
||||
STR_WINDOW_TITLE_GRABBED4,
|
||||
STR_WINDOW_MENU = 4050,
|
||||
STR_WINDOW_ITEM_ABOUT,
|
||||
STR_WINDOW_ITEM_REFRESH,
|
||||
|
@ -255,6 +255,16 @@ user_string_def common_strings[] = {
|
||||
{STR_WINDOW_TITLE, "Basilisk II"},
|
||||
{STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"},
|
||||
{STR_WINDOW_TITLE_GRABBED, "Basilisk II (mouse grabbed, press Ctrl-F5 to release)"},
|
||||
{STR_WINDOW_TITLE_GRABBED0, "Basilisk II (mouse grabbed, press "},
|
||||
{STR_WINDOW_TITLE_GRABBED1, "Ctrl-"},
|
||||
#ifdef __MACOSX__
|
||||
{STR_WINDOW_TITLE_GRABBED2, "Opt-"},
|
||||
{STR_WINDOW_TITLE_GRABBED3, "Cmd-"},
|
||||
#else
|
||||
{STR_WINDOW_TITLE_GRABBED2, "Alt-"},
|
||||
{STR_WINDOW_TITLE_GRABBED3, "Win-"},
|
||||
#endif
|
||||
{STR_WINDOW_TITLE_GRABBED4, "F5 to release)"},
|
||||
{STR_WINDOW_MENU, "Basilisk II"},
|
||||
{STR_WINDOW_ITEM_ABOUT, "About Basilisk II" ELLIPSIS},
|
||||
{STR_WINDOW_ITEM_REFRESH, "Refresh Rate"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user