Merge commit '01f63e605a68856718dd16e07835cd2d61ba6727' into DavidLudwig_and_jvernet

This commit is contained in:
kanjitalk755 2018-06-14 17:33:25 +09:00
commit e01129b748
96 changed files with 9421 additions and 2127 deletions

29
.gitignore vendored
View File

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

0
BasiliskII/src/CrossPlatform/sigsegv.cpp Normal file → Executable file
View File

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

@ -22,6 +22,10 @@
#include "video.h"
#include "video_blit.h"
#if USE_SDL_VIDEO
#include <SDL.h>
#endif
#include <stdio.h>
#include <stdlib.h>
@ -519,12 +523,21 @@ bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_or
#else
const bool use_sdl_video = false;
#endif
#if REAL_ADDRESSING || DIRECT_ADDRESSING
#if REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO
if (mac_depth == 1 && !use_sdl_video && !visual_format.fullscreen) {
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines
Screen_blit = Blit_Copy_Raw;
#if __MACOSX__
// dludwig@pobox.com, HACK: This works on OSX (64-bit, at least), but not Linux (32-bit?). Why?
// To note, __MACOSX__ is an SDL-declared macro (for platform identification at compile time).
} else if (mac_depth == 16) {
Screen_blit = Blit_Copy_Raw;
#endif
} else {
// Compute RGB shift values

View File

@ -30,6 +30,12 @@
#include "util_windows.h"
#endif
// Import SDL-backend-specific functions
#ifdef USE_SDL_VIDEO
extern void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
extern void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects);
#endif
// Glue for SDL and X11 support
#ifdef TEST_VOSF_PERFORMANCE
#define MONITOR_INIT /* nothing */
@ -514,7 +520,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
VIDEO_DRV_UNLOCK_PIXELS;
#ifdef USE_SDL_VIDEO
SDL_UpdateRect(drv->s, 0, y1, VIDEO_MODE_X, height);
update_sdl_video(drv->s, 0, y1, VIDEO_MODE_X, height);
#else
if (VIDEO_DRV_HAVE_SHM)
XShmPutImage(x_display, VIDEO_DRV_WINDOW, VIDEO_DRV_GC, VIDEO_DRV_IMAGE, 0, y1, 0, y1, VIDEO_MODE_X, height, 0);
@ -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
BasiliskII/src/CrossPlatform/vm_alloc.cpp Normal file → Executable file
View File

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>BasiliskII</string>
<key>CFBundleGetInfoString</key>
<string>Basilisk II version 1.0, Copyright © 1997-2006 Christian Bauer et al. Mac OS X port 19</string>
<string>Basilisk II version 1.0, Copyright © 1997-2017 Christian Bauer et al. SDL2 port</string>
<key>CFBundleIconFile</key>
<string>BasiliskII.icns</string>
<key>CFBundleIdentifier</key>
@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>Basilisk II 1.0, Mac OS X port 19</string>
<string>Basilisk II 1.0, SDL2 port</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHelpFile</key>

View File

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

View File

@ -0,0 +1,822 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
#if ! USE_XCODE
// HACK, dludwig@pobox.com: Unless we are building with Xcode, use the
// config.h file that Autotools generates. This is located in
// BasiliskII/src/Unix/
#include "../Unix/config.h"
#else
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define is using ESD. */
/* #undef ENABLE_ESD */
/* Define if using DGA with framebuffer device. */
/* #define ENABLE_FBDEV_DGA 1 */
/* Define if using GTK. */
/* #undef ENABLE_GTK */
/* Define if using "mon". */
/* #undef ENABLE_MON */
/* Define if using native 68k mode. */
/* #undef ENABLE_NATIVE_M68K */
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
/* Define if your system supports TUN/TAP devices. */
/* #undef ENABLE_TUNTAP */
/* Define if using video enabled on SEGV signals. */
/* #undef ENABLE_VOSF */
#define ENABLE_VOSF 1
/* Define if using XFree86 DGA extension. */
/* #undef ENABLE_XF86_DGA */
/* Define if using XFree86 DGA extension. */
/* #define ENABLE_XF86_VIDMODE 1 */
/* Define to 1 if you have the `acoshl' function. */
#define HAVE_ACOSHL 1
/* Define to 1 if you have the `acosl' function. */
#define HAVE_ACOSL 1
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if you have <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_UAE 1
//#define FPU_IMPLEMENTATION 1
#endif

View File

@ -0,0 +1,33 @@
#!/bin/bash -e
#
# run_build68k_for_xcode.sh
#
# Generates files for 68k emulation, via UAE's virtual cpu, for use on Mac OS X hosts
#
if [ ! -d "$BUILT_PRODUCTS_DIR" ] || [ ! "$PROJECT_DIR" ]; then
echo "ERROR: $(basename $0) must be run from an Xcode 'External Build System' target"
exit 1
fi
# Log some debugging information
echo "1=$1"
echo "BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR"
echo "PROJECT_DIR=$PROJECT_DIR"
# Perform actions, given the passed-in build step
case "$1" in
"clean")
echo "Cleaning build68k output(s)"
rm -rf "$BUILT_PRODUCTS_DIR/build68k_output"
;;
"")
echo "Running build68k"
cd "$BUILT_PRODUCTS_DIR"
mkdir -p build68k_output
cd build68k_output
cat "$PROJECT_DIR/../uae_cpu/table68k" | "$BUILT_PRODUCTS_DIR/build68k" > "./defs68k.c"
ls -al
;;
esac

View File

@ -0,0 +1,33 @@
#!/bin/bash -e
#
# run_gemcpu_for_xcode.sh
#
# Generates files for 68k emulation, via UAE's virtual cpu, for use on Mac OS X hosts
#
if [ ! -d "$BUILT_PRODUCTS_DIR" ] || [ ! "$PROJECT_DIR" ]; then
echo "ERROR: $(basename $0) must be run from an Xcode 'External Build System' target"
exit 1
fi
# Log some debugging information
echo "1=$1"
echo "BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR"
echo "PROJECT_DIR=$PROJECT_DIR"
# Perform actions, given the passed-in build step
case "$1" in
"clean")
echo "Cleaning gencpu output(s)"
rm -rf "$BUILT_PRODUCTS_DIR/gencpu_output"
;;
"")
echo "Running gencpu"
cd "$BUILT_PRODUCTS_DIR"
mkdir -p gencpu_output
cd gencpu_output
"$BUILT_PRODUCTS_DIR/gencpu"
ls -al
;;
esac

View File

@ -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,

View File

@ -20,6 +20,11 @@
#include <Cocoa/Cocoa.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 +33,37 @@ void NSAutoReleasePool_wrap(void (*fn)(void))
fn();
[pool release];
}
void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() {
for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) {
if (menu_item.hasSubmenu) {
for (NSMenuItem * sub_item in menu_item.submenu.itemArray) {
sub_item.keyEquivalent = @"";
sub_item.keyEquivalentModifierMask = 0;
}
}
}
}
#if SDL_VERSION_ATLEAST(2,0,0)
bool is_fullscreen_osx(SDL_Window * window)
{
if (!window) {
return false;
}
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
if (!SDL_GetWindowWMInfo(window, &wmInfo)) {
return false;
}
const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
}
#endif
void set_menu_bar_visible_osx(bool visible)
{
[NSMenu setMenuBarVisible:(visible ? YES : NO)];
}

View File

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

View File

@ -28,6 +28,7 @@
#include <SDL_mutex.h>
#include <SDL_audio.h>
#include <SDL_version.h>
#define DEBUG 0
#include "debug.h"
@ -87,6 +88,7 @@ static bool open_sdl_audio(void)
}
SDL_AudioSpec audio_spec;
memset(&audio_spec, 0, sizeof(audio_spec));
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? AUDIO_U8 : AUDIO_S16MSB;
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
@ -99,14 +101,27 @@ static bool open_sdl_audio(void)
fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError());
return false;
}
#if SDL_VERSION_ATLEAST(2,0,0)
// HACK: workaround a bug in SDL pre-2.0.6 (reported via https://bugzilla.libsdl.org/show_bug.cgi?id=3710 )
// whereby SDL does not update audio_spec.size
if (audio_spec.size == 0) {
audio_spec.size = (SDL_AUDIO_BITSIZE(audio_spec.format) / 8) * audio_spec.channels * audio_spec.samples;
}
#endif
#if defined(BINCUE)
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels,
audio_spec.silence);
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
const char * driver_name = SDL_GetCurrentAudioDriver();
#else
char driver_name[32];
printf("Using SDL/%s audio output\n", SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1));
SDL_AudioDriverName(driver_name, sizeof(driver_name) - 1);
#endif
printf("Using SDL/%s audio output\n", driver_name ? driver_name : "");
silence_byte = audio_spec.silence;
SDL_PauseAudio(0);

View File

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

View File

@ -1,5 +1,5 @@
/*
* video_sdl.cpp - Video/graphics emulation, SDL specific stuff
* video_sdl.cpp - Video/graphics emulation, SDL 1.x specific stuff
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
@ -43,6 +43,8 @@
#include "sysdeps.h"
#include <SDL.h>
#if (SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0))
#include <SDL_mutex.h>
#include <SDL_thread.h>
#include <errno.h>
@ -584,6 +586,16 @@ static void migrate_screen_prefs(void)
#endif
}
void update_sdl_video(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
{
SDL_UpdateRect(screen, x, y, w, h);
}
void update_sdl_video(SDL_Surface *screen, int numrects, SDL_Rect *rects)
{
SDL_UpdateRects(screen, numrects, rects);
}
/*
* Display "driver" classes
@ -2223,7 +2235,7 @@ static int redraw_func(void *arg)
// Wait
next += VIDEO_REFRESH_DELAY;
int32 delay = int32(next - GetTicks_usec());
uint64 delay = int32(next - GetTicks_usec());
if (delay > 0)
Delay_usec(delay);
else if (delay < -VIDEO_REFRESH_DELAY)
@ -2269,3 +2281,5 @@ void video_set_dirty_area(int x, int y, int w, int h)
// XXX handle dirty bounding boxes for non-VOSF modes
}
#endif
#endif // ends: SDL version check

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -526,6 +526,7 @@ loff_t size_bincue(void *fh)
if (fh) {
return ((CueSheet *)fh)->length * COOKED_SECTOR_SIZE;
}
return 0;
}
bool readtoc_bincue(void *fh, unsigned char *toc)
@ -564,6 +565,7 @@ bool readtoc_bincue(void *fh, unsigned char *toc)
*toc++ = toc_size & 0xff;
return true;
}
return false;
}
bool GetPosition_bincue(void *fh, uint8 *pos)

100
BasiliskII/src/Unix/configure.ac Normal file → Executable file
View File

@ -36,6 +36,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphi
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], [])
dnl JIT compiler options.
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
@ -224,11 +225,11 @@ dnl We use mon if possible.
MONSRCS=
if [[ "x$WANT_MON" = "xyes" ]]; then
AC_MSG_CHECKING(for mon)
mon_srcdir=../../../cxmon/src
mon_srcdir=../../../mon/src
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
AC_MSG_RESULT(yes)
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c $mon_srcdir/disass/mips-dis.c $mon_srcdir/disass/mips-opc.c $mon_srcdir/disass/mips16-opc.c"
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
AC_CHECK_LIB(ncurses, tgetent, ,
[AC_CHECK_LIB(termcap, tgetent, ,
@ -250,7 +251,7 @@ AC_CHECK_LIB(rt, timer_create)
AC_CHECK_LIB(rt, shm_open)
AC_CHECK_LIB(m, cos)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES, $3=ACTION_IF_SUCCESSFUL, $4=ACTION_IF_UNSUCCESSFUL)
dnl AC_TRY_LINK uses main() but SDL needs main to take args,
dnl therefore main is undefined with #undef.
dnl Framework can be in an custom location.
@ -260,18 +261,16 @@ AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
ac_Framework, [
saved_LIBS="$LIBS"
LIBS="$LIBS -framework $1"
if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/$1.framework/Headers"
AC_TRY_LINK(
[$2
#undef main], [],
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
[AS_VAR_SET(ac_Framework, yes); $3], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"; $4]
)
])
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
@ -295,27 +294,58 @@ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
fi
if [[ "x$WANT_SDL" = "xyes" ]]; then
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL, [#include <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`
else
sdl_libs=`$sdl_config --libs`
fi
CFLAGS="$CFLAGS $sdl_cflags"
CXXFLAGS="$CXXFLAGS $sdl_cflags"
LIBS="$LIBS $sdl_libs"
else
WANT_SDL=no
WANT_SDL_VIDEO=no
WANT_SDL_AUDIO=no
SDL_SUPPORT="none"
TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then
TEMP_WANT_SDL_VERSION_MAJOR=2
fi
dnl use PKG_PROG_PKG_CONFIG to declare PKG_CONFIG variables. Otherwise,
dnl PKG_* macros may fail, without much explanation. The lack of this
dnl was causing --with-sdl1 to fail, as SDL 1.x could not be detected,
dnl as the 2nd call to PKG_CHECK_MODULES would fail, as $PKG_CONFIG
dnl never got defined (bizarrely-enough). -- dludwig@pobox.com
PKG_PROG_PKG_CONFIG
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
PKG_CHECK_MODULES([sdl2], [sdl2 >= 2.0], [
CFLAGS="$CFLAGS $sdl2_CFLAGS"
CXXFLAGS="$CXXFLAGS $sdl2_CFLAGS"
LIBS="$LIBS $sdl2_LIBS"
WANT_SDL_VERSION_MAJOR=2
], [
TEMP_WANT_SDL_VERSION_MAJOR=1
])
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then
PKG_CHECK_MODULES([sdl], [sdl >= 1.2], [
CFLAGS="$CFLAGS $sdl_CFLAGS"
CXXFLAGS="$CXXFLAGS $sdl_CFLAGS"
LIBS="$LIBS $sdl_LIBS"
WANT_SDL_VERSION_MAJOR=1
], [
WANT_SDL=no
WANT_SDL_VERSION_MAJOR=
])
fi
fi
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
@ -323,8 +353,8 @@ else
SDL_SUPPORT="none"
fi
dnl We need X11, if not using SDL or Mac GUI.
if [[ "x$WANT_SDL_VIDEO" = "xno" -a "x$WANT_MACOSX_GUI" = "xno" ]]; then
dnl We need X11, if not using SDL.
if [[ "x$WANT_SDL_VIDEO" = "xno" ]]; then
AC_PATH_XTRA
if [[ "x$no_x" = "xyes" ]]; then
AC_MSG_ERROR([You need X11 to run Basilisk II.])
@ -339,12 +369,10 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
AS_IF([test "x$have_bincue" = "xyes" ], [
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
DEFINES="$DEFINES -DBINCUE"
AC_SUBST(USE_BINCUE, yes)
else
AC_MSG_ERROR([You need SDL Audio to use BINCUE support.])
AC_SUBST(USE_BINCUE, no)
fi
], [AC_SUBST(USE_BINCUE, no)])
])
dnl LIBVHD
AS_IF([test "x$with_libvhd" = "xyes" ], [have_libvhd=yes], [have_libvhd=no])
@ -825,7 +853,7 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
fi
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
VIDEOSRCS="../SDL/video_sdl.cpp"
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp"
KEYCODES="../SDL/keycodes"
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
AC_MSG_CHECKING([whether __LP64__ is defined])
@ -906,9 +934,6 @@ dnl Check that the host supports TUN/TAP devices
AC_CACHE_CHECK([whether TUN/TAP is supported],
ac_cv_tun_tap_support, [
AC_TRY_COMPILE([
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
#include <linux/if.h>
#include <linux/if_tun.h>
@ -1301,7 +1326,7 @@ AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
dnl Resolve and set the proper sigsegv_recovery method...
if [[ "x$ac_cv_have_mach_exceptions" = "xyes" ]]; then
if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
sigsegv_recovery=mach
elif [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
sigsegv_recovery=win32
@ -1851,6 +1876,7 @@ echo
echo Mac OS X GUI ........................... : $WANT_MACOSX_GUI
echo Mac OS X Sound ......................... : $WANT_MACOSX_SOUND
echo SDL support ............................ : $SDL_SUPPORT
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
echo BINCUE support ......................... : $have_bincue
echo LIBVHD support ......................... : $have_libvhd
echo XFree86 DGA support .................... : $WANT_XF86_DGA

View File

@ -28,6 +28,7 @@
#ifdef USE_SDL
# include <SDL.h>
# include <SDL_main.h>
#endif
#ifndef USE_SDL_VIDEO
@ -437,6 +438,19 @@ int main(int argc, char **argv)
argv[i] = NULL;
PrintROMInfo = true;
}
#if defined(__APPLE__) && defined(__MACH__)
// Mac OS X likes to pass in various options of its own, when launching an app.
// Attempt to ignore these.
if (argv[i]) {
const char * mac_psn_prefix = "-psn_";
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
argv[i] = NULL;
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
argv[i] = NULL;
}
}
#endif
}
// Remove processed arguments
@ -520,6 +534,18 @@ int main(int argc, char **argv)
QuitEmulator();
}
atexit(SDL_Quit);
#if __MACOSX__
// On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK,
// except that it will also install keyboard shortcuts, such as Command + Q,
// which can interfere with keyboard shortcuts in the guest OS.
//
// HACK: disable these shortcuts, while leaving all other pieces of SDL2's
// menu bar in-place.
extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
#endif
#endif
// Init system routines

View File

@ -42,6 +42,9 @@ prefs_desc platform_prefs_items[] = {
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
#endif
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
#ifdef USE_SDL_VIDEO
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
#endif
{NULL, TYPE_END, false, NULL} // End of list
};

View File

@ -25,7 +25,7 @@
#error "Your compiler is not ANSI. Get a real one."
#endif
#include "config.h"
#include <config.h>
#include "user_strings_unix.h"
#ifndef STDC_HEADERS
@ -219,7 +219,7 @@ typedef uae_u32 uaecptr;
/* Timing functions */
extern uint64 GetTicks_usec(void);
extern void Delay_usec(uint32 usec);
extern void Delay_usec(uint64 usec);
/* Spinlocks */
#ifdef __GNUC__

View File

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

View File

@ -1,140 +1,140 @@

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

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -63,7 +63,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_windows.cpp ../timer.cpp \
timer_windows.cpp ../adb.cpp ../serial.cpp serial_windows.cpp \
../ether.cpp ether_windows.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp \
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp \
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp \
video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \
../extfs.cpp extfs_windows.cpp ../user_strings.cpp user_strings_windows.cpp \
vm_alloc.cpp sigsegv.cpp posix_emu.cpp util_windows.cpp \

View File

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

View File

@ -212,6 +212,26 @@ int main(int argc, char **argv)
char str[256];
bool cd_boot = false;
// Redirect stdout and stderr to a log file, for diagnostic purposes.
// Unbuffered file IO will be used (setup via setvbuf() calls), so as
// to write log file data ASAP, lest it get lost in case of program
// termination.
wchar_t logFileName[4096];
logFileName[0] = L'\0';
_wgetcwd(logFileName, SDL_arraysize(logFileName));
if (logFileName[0] != L'\0') {
SDL_wcslcat(logFileName, L"\\BasiliskII_log.txt", SDL_arraysize(logFileName));
FILE * fp;
fp = _wfreopen(logFileName, L"w", stdout);
if (fp) {
setvbuf(stdout, NULL, _IONBF, 0);
}
fp = _wfreopen(logFileName, L"w", stderr);
if (fp) {
setvbuf(stderr, NULL, _IONBF, 0);
}
}
// Initialize variables
RAMBaseHost = NULL;
ROMBaseHost = NULL;
@ -283,10 +303,6 @@ int main(int argc, char **argv)
QuitEmulator();
#endif
// FIXME: default to DIB driver
if (getenv("SDL_VIDEODRIVER") == NULL)
putenv("SDL_VIDEODRIVER=windib");
// Initialize SDL system
int sdl_flags = 0;
#ifdef USE_SDL_VIDEO
@ -400,7 +416,7 @@ int main(int argc, char **argv)
emul_thread = GetCurrentThread();
// SDL threads available, start 60Hz thread
tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, NULL)) != NULL);
tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, "Redraw Thread", NULL)) != NULL);
if (!tick_thread_active) {
sprintf(str, GetString(STR_TICK_THREAD_ERR), strerror(errno));
ErrorAlert(str);
@ -410,7 +426,7 @@ int main(int argc, char **argv)
// Start XPRAM watchdog thread
memcpy(last_xpram, XPRAM, XPRAM_SIZE);
xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, NULL)) != NULL);
xpram_thread_active = ((xpram_thread = SDL_CreateThread(xpram_func, "XPRAM Thread", NULL)) != NULL);
D(bug("XPRAM thread started\n"));
// Start 68k and jump to ROM boot routine
@ -625,11 +641,21 @@ static int tick_func(void *arg)
#ifdef USE_SDL_VIDEO
#include <SDL_syswm.h>
extern SDL_Window *sdl_window;
HWND GetMainWindowHandle(void)
{
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
return SDL_GetWMInfo(&wmInfo) ? wmInfo.window : NULL;
if (!sdl_window) {
return NULL;
}
if (!SDL_GetWindowWMInfo(sdl_window, &wmInfo)) {
return NULL;
}
if (wmInfo.subsystem != SDL_SYSWM_WINDOWS) {
return NULL;
}
return wmInfo.info.win.window;
}
#endif

View File

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

View File

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

View File

@ -22,8 +22,8 @@
#define VERSION_H
const int VERSION_MAJOR = 1;
const int VERSION_MINOR = 0;
const int VERSION_MINOR = 1;
#define VERSION_STRING "Basilisk II V1.0"
#define VERSION_STRING "Basilisk II V1.0 SDL2"
#endif

View File

@ -76,6 +76,9 @@ inline video_depth DepthModeForPixelDepth(int depth)
}
}
// Returns the name of a video_depth, or an empty string if the depth is unknown
const char * NameOfDepth(video_depth depth);
// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width
inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth)
{

View File

@ -68,6 +68,10 @@ prefs_desc common_prefs_items[] = {
{"jitinline", TYPE_BOOLEAN, false, "enable translation through constant jumps"},
{"jitblacklist", TYPE_STRING, false, "blacklist opcodes from translation"},
{"keyboardtype", TYPE_INT32, false, "hardware keyboard type"},
{"keycodes",TYPE_BOOLEAN,false,"use raw keycode"},
{"keycodefile",TYPE_STRING,"Keycode file"},
{"mousewheelmode",TYPE_BOOLEAN,"Use WheelMode"},
{"mousewheellines",TYPE_INT32,"wheel line nb"},
{NULL, TYPE_END, false, NULL} // End of list
};

View File

@ -1 +1,2 @@
qemu 0.9.0 (2007/02/05)
Plus 64 Bits Patchs

0
BasiliskII/src/slirp/bootp.c Normal file → Executable file
View File

2
BasiliskII/src/slirp/bootp.h Normal file → Executable file
View File

@ -115,7 +115,7 @@ struct bootp_t {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
void bootp_input(struct mbuf *m);

0
BasiliskII/src/slirp/cksum.c Normal file → Executable file
View File

0
BasiliskII/src/slirp/ctl.h Normal file → Executable file
View File

15
BasiliskII/src/slirp/debug.c Normal file → Executable file
View File

@ -16,6 +16,8 @@ int dostats = 0;
#endif
int slirp_debug = 0;
extern char *strerror _P((int));
/* Carry over one item from main.c so that the tty's restored.
* Only done when the tty being used is /dev/tty --RedWolf */
extern struct termios slirp_tty_settings;
@ -292,7 +294,6 @@ mbufstats()
void
sockstats()
{
char addr[INET_ADDRSTRLEN];
char buff[256];
int n;
struct socket *so;
@ -310,11 +311,9 @@ sockstats()
buff[17] = 0;
lprint("%s %3d %15s %5d ",
buff, so->s,
inet_ntop(AF_INET, &so->so_laddr, addr, sizeof(addr)),
ntohs(so->so_lport));
inet_ntoa(so->so_laddr), ntohs(so->so_lport));
lprint("%15s %5d %5d %5d\r\n",
inet_ntop(AF_INET, &so->so_faddr, addr, sizeof(addr)),
ntohs(so->so_fport),
inet_ntoa(so->so_faddr), ntohs(so->so_fport),
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
@ -326,11 +325,9 @@ sockstats()
buff[17] = 0;
lprint("%s %3d %15s %5d ",
buff, so->s,
inet_ntop(AF_INET, &so->so_laddr, addr, sizeof(addr)),
ntohs(so->so_lport));
inet_ntoa(so->so_laddr), ntohs(so->so_lport));
lprint("%15s %5d %5d %5d\r\n",
inet_ntop(AF_INET, &so->so_faddr, addr, sizeof(addr)),
ntohs(so->so_fport),
inet_ntoa(so->so_faddr), ntohs(so->so_fport),
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
}

22
BasiliskII/src/slirp/debug.h Normal file → Executable file
View File

@ -36,15 +36,15 @@ extern int slirp_debug;
#endif
void debug_init(char *, int);
//void ttystats(struct ttys *);
void allttystats(void);
void ipstats(void);
void vjstats(void);
void tcpstats(void);
void udpstats(void);
void icmpstats(void);
void mbufstats(void);
void sockstats(void);
void slirp_exit(int);
void debug_init _P((char *, int));
//void ttystats _P((struct ttys *));
void allttystats _P((void));
void ipstats _P((void));
void vjstats _P((void));
void tcpstats _P((void));
void udpstats _P((void));
void icmpstats _P((void));
void mbufstats _P((void));
void sockstats _P((void));
void slirp_exit _P((int));

0
BasiliskII/src/slirp/icmp_var.h Normal file → Executable file
View File

9
BasiliskII/src/slirp/if.c Normal file → Executable file
View File

@ -7,11 +7,11 @@
#include <slirp.h>
size_t if_mtu, if_mru;
int if_mtu, if_mru;
int if_comp;
int if_maxlinkhdr;
int if_queued = 0; /* Number of packets queued so far */
int if_thresh = 10; /* Number of packets queued before we start sending
int if_queued = 0; /* Number of packets queued so far */
int if_thresh = 10; /* Number of packets queued before we start sending
* (to prevent allocing too many mbufs) */
struct mbuf if_fastq; /* fast queue (for interactive data) */
@ -116,8 +116,7 @@ if_input(ttyp)
DEBUG_MISC((dfd, " read %d bytes\n", if_n));
if (if_n <= 0) {
int error = WSAGetLastError();
if (if_n == 0 || (error != WSAEINTR && error != EAGAIN)) {
if (if_n == 0 || (errno != EINTR && errno != EAGAIN)) {
if (ttyp->up)
link_up--;
tty_detached(ttyp, 0);

4
BasiliskII/src/slirp/if.h Normal file → Executable file
View File

@ -15,8 +15,8 @@
/* Needed for FreeBSD */
#undef if_mtu
extern size_t if_mtu;
extern size_t if_mru; /* MTU and MRU */
extern int if_mtu;
extern int if_mru; /* MTU and MRU */
extern int if_comp; /* Flags for compression */
extern int if_maxlinkhdr;
extern int if_queued; /* Number of packets queued so far */

70
BasiliskII/src/slirp/ip.h Normal file → Executable file
View File

@ -98,7 +98,7 @@ struct ip {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
#define IP_MAXPACKET 65535 /* maximum packet size */
@ -168,7 +168,7 @@ struct ip_timestamp {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
/* flag bits for ipt_flg */
@ -195,23 +195,19 @@ struct ip_timestamp {
#define IP_MSS 576 /* default maximum segment size */
#ifdef HAVE_SYS_TYPES32_H /* Overcome some Solaris 2.x junk */
#include <sys/types32.h>
#else
#if SIZEOF_CHAR_P == 4
typedef caddr_t caddr32_t;
struct mbuf_ptr {
struct mbuf *mptr;
uint32_t dummy;
};
#else
typedef u_int32_t caddr32_t;
#endif
#endif
#if SIZEOF_CHAR_P == 4
typedef struct ipq *ipqp_32;
typedef struct ipasfrag *ipasfragp_32;
#else
typedef caddr32_t ipqp_32;
typedef caddr32_t ipasfragp_32;
struct mbuf_ptr {
struct mbuf *mptr;
};
#endif
struct qlink {
void *next, *prev;
};
/*
* Overlay for ip header used by other protocols (tcp, udp).
@ -221,16 +217,16 @@ typedef caddr32_t ipasfragp_32;
#endif
struct ipovly {
caddr32_t ih_next, ih_prev; /* for protocol sequence q's */
struct mbuf_ptr ih_mbuf; /* backpointer to mbuf */
u_int8_t ih_x1; /* (unused) */
u_int8_t ih_pr; /* protocol */
u_int16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
} PACKED__;
} __attribute__((packed));
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
/*
@ -241,12 +237,13 @@ struct ipovly {
* size 28 bytes
*/
struct ipq {
ipqp_32 next,prev; /* to other reass headers */
struct qlink frag_link; /* to ip headers of fragments */
struct qlink ip_link; /* to other reass headers */
u_int8_t ipq_ttl; /* time for reass q to live */
u_int8_t ipq_p; /* protocol of this fragment */
u_int16_t ipq_id; /* sequence id for reassembly */
ipasfragp_32 ipq_next,ipq_prev;
/* to ip headers of fragments */
struct in_addr ipq_src,ipq_dst;
};
@ -256,29 +253,16 @@ struct ipq {
* Note: ipf_next must be at same offset as ipq_next above
*/
struct ipasfrag {
#ifdef WORDS_BIGENDIAN
u_char ip_v:4,
ip_hl:4;
#else
u_char ip_hl:4,
ip_v:4;
#endif
/* BUG : u_int changed to u_int8_t.
* sizeof(u_int)==4 on linux 2.0
*/
u_int8_t ipf_mff; /* XXX overlays ip_tos: use low bit
* to avoid destroying tos (PPPDTRuu);
* copied from (ip_off&IP_MF) */
u_int16_t ip_len;
u_int16_t ip_id;
u_int16_t ip_off;
u_int8_t ip_ttl;
u_int8_t ip_p;
u_int16_t ip_sum;
ipasfragp_32 ipf_next; /* next fragment */
ipasfragp_32 ipf_prev; /* previous fragment */
struct qlink ipf_link;
struct ip ipf_ip;
};
#define ipf_off ipf_ip.ip_off
#define ipf_tos ipf_ip.ip_tos
#define ipf_len ipf_ip.ip_len
#define ipf_next ipf_link.next
#define ipf_prev ipf_link.prev
/*
* Structure stored in mbuf in inpcb.ip_options
* and passed to ip_output when ip options are in use.

26
BasiliskII/src/slirp/ip_icmp.c Normal file → Executable file
View File

@ -77,7 +77,7 @@ icmp_input(m, hlen)
DEBUG_CALL("icmp_input");
DEBUG_ARG("m = %lx", (long )m);
DEBUG_ARG("m_len = %zu", m->m_len);
DEBUG_ARG("m_len = %d", m->m_len);
icmpstat.icps_received++;
@ -201,12 +201,12 @@ end_error:
#define ICMP_MAXDATALEN (IP_MSS-28)
void
icmp_error(
struct mbuf *msrc,
u_char type,
u_char code,
int minsize,
char *message)
icmp_error(msrc, type, code, minsize, message)
struct mbuf *msrc;
u_char type;
u_char code;
int minsize;
char *message;
{
unsigned hlen, shlen, s_ip_len;
register struct ip *ip;
@ -215,7 +215,7 @@ icmp_error(
DEBUG_CALL("icmp_error");
DEBUG_ARG("msrc = %lx", (long )msrc);
DEBUG_ARG("msrc_len = %zu", msrc->m_len);
DEBUG_ARG("msrc_len = %d", msrc->m_len);
if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error;
@ -223,9 +223,9 @@ icmp_error(
if(!msrc) goto end_error;
ip = mtod(msrc, struct ip *);
#if DEBUG
{ char bufa[INET_ADDRSTRLEN], bufb[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &ip->ip_src, bufa, sizeof(bufa));
inet_ntop(AF_INET, &ip->ip_dst, bufb, sizeof(bufb));
{ char bufa[20], bufb[20];
strcpy(bufa, inet_ntoa(ip->ip_src));
strcpy(bufb, inet_ntoa(ip->ip_dst));
DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb));
}
#endif
@ -244,7 +244,7 @@ icmp_error(
/* make a copy */
if(!(m=m_get())) goto end_error; /* get mbuf */
{ u_int new_m_size;
{ int new_m_size;
new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN;
if(new_m_size>m->m_size) m_inc(m, new_m_size);
}
@ -299,7 +299,7 @@ icmp_error(
/* fill in ip */
ip->ip_hl = hlen >> 2;
ip->ip_len = (u_int16_t)m->m_len;
ip->ip_len = m->m_len;
ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */

8
BasiliskII/src/slirp/ip_icmp.h Normal file → Executable file
View File

@ -95,7 +95,7 @@ struct icmp {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
/*
@ -161,8 +161,8 @@ struct icmp {
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
void icmp_input(struct mbuf *, int);
void icmp_error(struct mbuf *, u_char, u_char, int, char *);
void icmp_reflect(struct mbuf *);
void icmp_input _P((struct mbuf *, int));
void icmp_error _P((struct mbuf *, u_char, u_char, int, char *));
void icmp_reflect _P((struct mbuf *));
#endif

154
BasiliskII/src/slirp/ip_input.c Normal file → Executable file
View File

@ -38,6 +38,16 @@
* terms and conditions of the copyright.
*/
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>
#define container_of(ptr, type, member) ({ \
const typeof(((type *) 0)->member) *__mptr = (ptr); \
(type *) ((char *) __mptr - offsetof(type, member));})
#include <slirp.h>
#include "ip_icmp.h"
@ -52,7 +62,7 @@ struct ipq ipq;
void
ip_init()
{
ipq.next = ipq.prev = (ipqp_32)&ipq;
ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;
ip_id = tt.tv_sec & 0xffff;
udp_init();
tcp_init();
@ -68,11 +78,11 @@ ip_input(m)
struct mbuf *m;
{
register struct ip *ip;
u_int hlen;
int hlen;
DEBUG_CALL("ip_input");
DEBUG_ARG("m = %lx", (long)m);
DEBUG_ARG("m_len = %zu", m->m_len);
DEBUG_ARG("m_len = %d", m->m_len);
ipstat.ips_total++;
@ -155,18 +165,20 @@ ip_input(m)
*/
if (ip->ip_off &~ IP_DF) {
register struct ipq *fp;
struct qlink *l;
/*
* Look for queue of fragments
* of this datagram.
*/
for (fp = (struct ipq *) ipq.next; fp != &ipq;
fp = (struct ipq *) fp->next)
if (ip->ip_id == fp->ipq_id &&
ip->ip_src.s_addr == fp->ipq_src.s_addr &&
ip->ip_dst.s_addr == fp->ipq_dst.s_addr &&
ip->ip_p == fp->ipq_p)
for (l = ipq.ip_link.next; l != &ipq.ip_link; l = l->next) {
fp = container_of(l, struct ipq, ip_link);
if (ip->ip_id == fp->ipq_id &&
ip->ip_src.s_addr == fp->ipq_src.s_addr &&
ip->ip_dst.s_addr == fp->ipq_dst.s_addr &&
ip->ip_p == fp->ipq_p)
goto found;
fp = 0;
}
fp = NULL;
found:
/*
@ -176,9 +188,9 @@ ip_input(m)
*/
ip->ip_len -= hlen;
if (ip->ip_off & IP_MF)
((struct ipasfrag *)ip)->ipf_mff |= 1;
ip->ip_tos |= 1;
else
((struct ipasfrag *)ip)->ipf_mff &= ~1;
ip->ip_tos &= ~1;
ip->ip_off <<= 3;
@ -187,9 +199,9 @@ ip_input(m)
* or if this is not the first fragment,
* attempt reassembly; if it succeeds, proceed.
*/
if (((struct ipasfrag *)ip)->ipf_mff & 1 || ip->ip_off) {
if (ip->ip_tos & 1 || ip->ip_off) {
ipstat.ips_fragments++;
ip = ip_reass((struct ipasfrag *)ip, fp);
ip = ip_reass(ip, fp);
if (ip == 0)
return;
ipstat.ips_reassembled++;
@ -225,21 +237,21 @@ bad:
return;
}
#define iptofrag(P) ((struct ipasfrag *)(((char*)(P)) - sizeof(struct qlink)))
#define fragtoip(P) ((struct ip*)(((char*)(P)) + sizeof(struct qlink)))
/*
* Take incoming datagram fragment and try to
* reassemble it into whole datagram. If a chain for
* reassembly of this datagram already exists, then it
* is given as fp; otherwise have to make a chain.
*/
struct ip *
ip_reass(ip, fp)
register struct ipasfrag *ip;
register struct ipq *fp;
static struct ip *
ip_reass(register struct ip *ip, register struct ipq *fp)
{
register struct mbuf *m = dtom(ip);
register struct ipasfrag *q;
int hlen = ip->ip_hl << 2;
int i, next;
u_int16_t i, next;
DEBUG_CALL("ip_reass");
DEBUG_ARG("ip = %lx", (long)ip);
@ -261,13 +273,13 @@ ip_reass(ip, fp)
struct mbuf *t;
if ((t = m_get()) == NULL) goto dropfrag;
fp = mtod(t, struct ipq *);
insque_32(fp, &ipq);
insque(&fp->ip_link, &ipq.ip_link);
fp->ipq_ttl = IPFRAGTTL;
fp->ipq_p = ip->ip_p;
fp->ipq_id = ip->ip_id;
fp->ipq_next = fp->ipq_prev = (ipasfragp_32)fp;
fp->ipq_src = ((struct ip *)ip)->ip_src;
fp->ipq_dst = ((struct ip *)ip)->ip_dst;
fp->frag_link.next = fp->frag_link.prev = &fp->frag_link;
fp->ipq_src = ip->ip_src;
fp->ipq_dst = ip->ip_dst;
q = (struct ipasfrag *)fp;
goto insert;
}
@ -275,9 +287,9 @@ ip_reass(ip, fp)
/*
* Find a segment which begins after this one does.
*/
for (q = (struct ipasfrag *)fp->ipq_next; q != (struct ipasfrag *)fp;
q = (struct ipasfrag *)q->ipf_next)
if (q->ip_off > ip->ip_off)
for (q = fp->frag_link.next; q != (struct ipasfrag *)&fp->frag_link;
q = q->ipf_next)
if (q->ipf_off > ip->ip_off)
break;
/*
@ -285,9 +297,9 @@ ip_reass(ip, fp)
* our data already. If so, drop the data from the incoming
* segment. If it provides all of our data, drop us.
*/
if (q->ipf_prev != (ipasfragp_32)fp) {
i = ((struct ipasfrag *)(q->ipf_prev))->ip_off +
((struct ipasfrag *)(q->ipf_prev))->ip_len - ip->ip_off;
if (q->ipf_prev != &fp->frag_link) {
struct ipasfrag *pq = q->ipf_prev;
i = pq->ipf_off + pq->ipf_len - ip->ip_off;
if (i > 0) {
if (i >= ip->ip_len)
goto dropfrag;
@ -301,17 +313,18 @@ ip_reass(ip, fp)
* While we overlap succeeding segments trim them or,
* if they are completely covered, dequeue them.
*/
while (q != (struct ipasfrag *)fp && ip->ip_off + ip->ip_len > q->ip_off) {
i = (ip->ip_off + ip->ip_len) - q->ip_off;
if (i < q->ip_len) {
q->ip_len -= i;
q->ip_off += i;
while (q != (struct ipasfrag*)&fp->frag_link &&
ip->ip_off + ip->ip_len > q->ipf_off) {
i = (ip->ip_off + ip->ip_len) - q->ipf_off;
if (i < q->ipf_len) {
q->ipf_len -= i;
q->ipf_off += i;
m_adj(dtom(q), i);
break;
}
q = (struct ipasfrag *) q->ipf_next;
m_freem(dtom((struct ipasfrag *) q->ipf_prev));
ip_deq((struct ipasfrag *) q->ipf_prev);
q = q->ipf_next;
m_freem(dtom(q->ipf_prev));
ip_deq(q->ipf_prev);
}
insert:
@ -319,27 +332,26 @@ insert:
* Stick new segment in its place;
* check for complete reassembly.
*/
ip_enq(ip, (struct ipasfrag *) q->ipf_prev);
ip_enq(iptofrag(ip), q->ipf_prev);
next = 0;
for (q = (struct ipasfrag *) fp->ipq_next; q != (struct ipasfrag *)fp;
q = (struct ipasfrag *) q->ipf_next) {
if (q->ip_off != next)
for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link;
q = q->ipf_next) {
if (q->ipf_off != next)
return (0);
next += q->ip_len;
next += q->ipf_len;
}
if (((struct ipasfrag *)(q->ipf_prev))->ipf_mff & 1)
if (((struct ipasfrag *)(q->ipf_prev))->ipf_tos & 1)
return (0);
/*
* Reassembly is complete; concatenate fragments.
*/
q = (struct ipasfrag *) fp->ipq_next;
q = fp->frag_link.next;
m = dtom(q);
q = (struct ipasfrag *) q->ipf_next;
while (q != (struct ipasfrag *)fp) {
struct mbuf *t;
t = dtom(q);
while (q != (struct ipasfrag*)&fp->frag_link) {
struct mbuf *t = dtom(q);
q = (struct ipasfrag *) q->ipf_next;
m_cat(m, t);
}
@ -350,7 +362,7 @@ insert:
* dequeue and discard fragment reassembly header.
* Make header visible.
*/
ip = (struct ipasfrag *) fp->ipq_next;
q = fp->frag_link.next;
/*
* If the fragments concatenated to an mbuf that's
@ -361,24 +373,24 @@ insert:
*/
if (m->m_flags & M_EXT) {
int delta;
delta = (char *)ip - m->m_dat;
ip = (struct ipasfrag *)(m->m_ext + delta);
delta = (char *)q - m->m_dat;
q = (struct ipasfrag *)(m->m_ext + delta);
}
/* DEBUG_ARG("ip = %lx", (long)ip);
* ip=(struct ipasfrag *)m->m_data; */
ip = fragtoip(q);
ip->ip_len = next;
ip->ipf_mff &= ~1;
((struct ip *)ip)->ip_src = fp->ipq_src;
((struct ip *)ip)->ip_dst = fp->ipq_dst;
remque_32(fp);
ip->ip_tos &= ~1;
ip->ip_src = fp->ipq_src;
ip->ip_dst = fp->ipq_dst;
remque(&fp->ip_link);
(void) m_free(dtom(fp));
m = dtom(ip);
m->m_len += (ip->ip_hl << 2);
m->m_data -= (ip->ip_hl << 2);
return ((struct ip *)ip);
return ip;
dropfrag:
ipstat.ips_fragdropped++;
@ -396,13 +408,12 @@ ip_freef(fp)
{
register struct ipasfrag *q, *p;
for (q = (struct ipasfrag *) fp->ipq_next; q != (struct ipasfrag *)fp;
q = p) {
p = (struct ipasfrag *) q->ipf_next;
for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link; q = p) {
p = q->ipf_next;
ip_deq(q);
m_freem(dtom(q));
}
remque_32(fp);
remque(&fp->ip_link);
(void) m_free(dtom(fp));
}
@ -416,10 +427,10 @@ ip_enq(p, prev)
{
DEBUG_CALL("ip_enq");
DEBUG_ARG("prev = %lx", (long)prev);
p->ipf_prev = (ipasfragp_32) prev;
p->ipf_prev = prev;
p->ipf_next = prev->ipf_next;
((struct ipasfrag *)(prev->ipf_next))->ipf_prev = (ipasfragp_32) p;
prev->ipf_next = (ipasfragp_32) p;
((struct ipasfrag *)(prev->ipf_next))->ipf_prev = p;
prev->ipf_next = p;
}
/*
@ -441,20 +452,21 @@ ip_deq(p)
void
ip_slowtimo()
{
register struct ipq *fp;
struct qlink *l;
DEBUG_CALL("ip_slowtimo");
fp = (struct ipq *) ipq.next;
if (fp == 0)
l = ipq.ip_link.next;
if (l == 0)
return;
while (fp != &ipq) {
--fp->ipq_ttl;
fp = (struct ipq *) fp->next;
if (((struct ipq *)(fp->prev))->ipq_ttl == 0) {
while (l != &ipq.ip_link) {
struct ipq *fp = container_of(l, struct ipq, ip_link);
l = l->next;
if (--fp->ipq_ttl == 0) {
ipstat.ips_fragtimeout++;
ip_freef((struct ipq *) fp->prev);
ip_freef(fp);
}
}
}

9
BasiliskII/src/slirp/ip_output.c Normal file → Executable file
View File

@ -55,9 +55,8 @@ ip_output(so, m0)
{
register struct ip *ip;
register struct mbuf *m = m0;
register u_int hlen = sizeof(struct ip);
u_int len, off;
int error = 0;
register int hlen = sizeof(struct ip );
int len, off, error = 0;
DEBUG_CALL("ip_output");
DEBUG_ARG("so = %lx", (long)so);
@ -129,7 +128,7 @@ ip_output(so, m0)
*/
m0 = m;
mhlen = sizeof (struct ip);
for (off = hlen + len; off < ip->ip_len; off += len) {
for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) {
register struct ip *mhip;
m = m_get();
if (m == 0) {
@ -174,7 +173,7 @@ ip_output(so, m0)
* and updating header, then send each fragment (in order).
*/
m = m0;
m_adj(m, hlen + firstlen - ip->ip_len);
m_adj(m, hlen + firstlen - (u_int16_t)ip->ip_len);
ip->ip_len = htons((u_int16_t)m->m_len);
ip->ip_off = htons((u_int16_t)(ip->ip_off | IP_MF));
ip->ip_sum = 0;

0
BasiliskII/src/slirp/libslirp.h Normal file → Executable file
View File

0
BasiliskII/src/slirp/main.h Normal file → Executable file
View File

37
BasiliskII/src/slirp/mbuf.c Normal file → Executable file
View File

@ -24,16 +24,18 @@ int mbuf_alloced = 0;
struct mbuf m_freelist, m_usedlist;
int mbuf_thresh = 30;
int mbuf_max = 0;
size_t msize;
int msize;
void m_init()
void
m_init()
{
m_freelist.m_next = m_freelist.m_prev = &m_freelist;
m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist;
msize_init();
}
void msize_init()
void
msize_init()
{
/*
* Find a nice value for msize
@ -51,7 +53,8 @@ void msize_init()
* free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE,
* which tells m_free to actually free() it
*/
struct mbuf *m_get()
struct mbuf *
m_get()
{
register struct mbuf *m;
int flags = 0;
@ -86,7 +89,9 @@ end_error:
return m;
}
void m_free(struct mbuf *m)
void
m_free(m)
struct mbuf *m;
{
DEBUG_CALL("m_free");
@ -119,7 +124,9 @@ void m_free(struct mbuf *m)
* the other.. if result is too big for one mbuf, malloc()
* an M_EXT data segment
*/
void m_cat(register struct mbuf *m, register struct mbuf *n)
void
m_cat(m, n)
register struct mbuf *m, *n;
{
/*
* If there's no room, realloc
@ -135,7 +142,10 @@ void m_cat(register struct mbuf *m, register struct mbuf *n)
/* make m size bytes large */
void m_inc(struct mbuf *m, u_int size)
void
m_inc(m, size)
struct mbuf *m;
int size;
{
int datasize;
@ -169,7 +179,10 @@ void m_inc(struct mbuf *m, u_int size)
void m_adj(struct mbuf *m, int len)
void
m_adj(m, len)
struct mbuf *m;
int len;
{
if (m == NULL)
return;
@ -189,7 +202,9 @@ void m_adj(struct mbuf *m, int len)
* Copy len bytes from m, starting off bytes into n
*/
int
m_copy(struct mbuf *n, struct mbuf *m, u_int off, u_int len)
m_copy(n, m, off, len)
struct mbuf *n, *m;
int off, len;
{
if (len > M_FREEROOM(n))
return -1;
@ -205,7 +220,9 @@ m_copy(struct mbuf *n, struct mbuf *m, u_int off, u_int len)
* XXX This is a kludge, I should eliminate the need for it
* Fortunately, it's not used often
*/
struct mbuf *dtom(void *dat)
struct mbuf *
dtom(dat)
void *dat;
{
struct mbuf *m;

22
BasiliskII/src/slirp/mbuf.h Normal file → Executable file
View File

@ -63,11 +63,11 @@ struct m_hdr {
struct mbuf *mh_prevpkt; /* Flags aren't used in the output queue */
int mh_flags; /* Misc flags */
size_t mh_size; /* Size of data */
int mh_size; /* Size of data */
struct socket *mh_so;
caddr_t mh_data; /* Location of data */
size_t mh_len; /* Amount of data in this mbuf */
int mh_len; /* Amount of data in this mbuf */
};
/*
@ -130,14 +130,14 @@ extern int mbuf_alloced;
extern struct mbuf m_freelist, m_usedlist;
extern int mbuf_max;
void m_init(void);
void msize_init(void);
struct mbuf * m_get(void);
void m_free(struct mbuf *);
void m_cat(register struct mbuf *, register struct mbuf *);
void m_inc(struct mbuf *, u_int);
void m_adj(struct mbuf *, int);
int m_copy(struct mbuf *, struct mbuf *, u_int, u_int);
struct mbuf * dtom(void *);
void m_init _P((void));
void msize_init _P((void));
struct mbuf * m_get _P((void));
void m_free _P((struct mbuf *));
void m_cat _P((register struct mbuf *, register struct mbuf *));
void m_inc _P((struct mbuf *, int));
void m_adj _P((struct mbuf *, int));
int m_copy _P((struct mbuf *, struct mbuf *, int, int));
struct mbuf * dtom _P((void *));
#endif

192
BasiliskII/src/slirp/misc.c Normal file → Executable file
View File

@ -17,7 +17,10 @@ int x_port = -1;
int x_display = 0;
int x_screen = 0;
int show_x(char *buff, struct socket *inso)
int
show_x(buff, inso)
char *buff;
struct socket *inso;
{
if (x_port < 0) {
lprint("X Redir: X not being redirected.\r\n");
@ -37,7 +40,12 @@ int show_x(char *buff, struct socket *inso)
/*
* XXX Allow more than one X redirection?
*/
void redir_x(u_int32_t inaddr, int start_port, int display, int screen)
void
redir_x(inaddr, start_port, display, screen)
u_int32_t inaddr;
int start_port;
int display;
int screen;
{
int i;
@ -61,69 +69,44 @@ void redir_x(u_int32_t inaddr, int start_port, int display, int screen)
#endif
#ifndef HAVE_INET_ATON
int inet_aton(const char *cp, struct in_addr *ia)
int
inet_aton(cp, ia)
const char *cp;
struct in_addr *ia;
{
return inet_pton(AF_INET, cp, &ia->s_addr);
u_int32_t addr = inet_addr(cp);
if (addr == 0xffffffff)
return 0;
ia->s_addr = addr;
return 1;
}
#endif
/*
* Get our IP address and put it in our_addr
*/
void getouraddr()
void
getouraddr()
{
char buff[256];
if (gethostname(buff, sizeof(buff)) == 0)
{
struct addrinfo hints = { 0 };
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_INET;
struct addrinfo* ai;
if (getaddrinfo(buff, NULL, &hints, &ai) == 0)
{
our_addr = *(struct in_addr *)ai->ai_addr->sa_data;
freeaddrinfo(ai);
}
}
if (our_addr.s_addr == 0)
our_addr.s_addr = loopback_addr.s_addr;
struct hostent *he = NULL;
if (gethostname(buff,256) == 0)
he = gethostbyname(buff);
if (he)
our_addr = *(struct in_addr *)he->h_addr;
if (our_addr.s_addr == 0)
our_addr.s_addr = loopback_addr.s_addr;
}
#if SIZEOF_CHAR_P == 8
struct quehead_32 {
u_int32_t qh_link;
u_int32_t qh_rlink;
};
inline void insque_32(void *a, void *b)
{
register struct quehead_32 *element = (struct quehead_32 *) a;
register struct quehead_32 *head = (struct quehead_32 *) b;
element->qh_link = head->qh_link;
head->qh_link = (u_int32_t)element;
element->qh_rlink = (u_int32_t)head;
((struct quehead_32 *)(element->qh_link))->qh_rlink
= (u_int32_t)element;
}
inline void remque_32(void *a)
{
register struct quehead_32 *element = (struct quehead_32 *) a;
((struct quehead_32 *)(element->qh_link))->qh_rlink = element->qh_rlink;
((struct quehead_32 *)(element->qh_rlink))->qh_link = element->qh_link;
element->qh_rlink = 0;
}
#endif /* SIZEOF_CHAR_P == 8 */
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
void insque(void *a, void *b)
void
insque(a, b)
void *a, *b;
{
register struct quehead *element = (struct quehead *) a;
register struct quehead *head = (struct quehead *) b;
@ -134,7 +117,9 @@ void insque(void *a, void *b)
= (struct quehead *)element;
}
void remque(void *a)
void
remque(a)
void *a;
{
register struct quehead *element = (struct quehead *) a;
((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink;
@ -146,7 +131,13 @@ void remque(void *a)
/* #endif */
int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port)
int
add_exec(ex_ptr, do_pty, exec, addr, port)
struct ex_list **ex_ptr;
int do_pty;
char *exec;
int addr;
int port;
{
struct ex_list *tmp_ptr;
@ -175,7 +166,9 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port
extern int sys_nerr;
extern char *sys_errlist[];
char *strerror(int error)
char *
strerror(error)
int error;
{
if (error < sys_nerr)
return sys_errlist[error];
@ -188,7 +181,11 @@ char *strerror(int error)
#ifdef _WIN32
int fork_exec(struct socket *so, char *ex, int do_pty)
int
fork_exec(so, ex, do_pty)
struct socket *so;
char *ex;
int do_pty;
{
/* not implemented */
return 0;
@ -196,7 +193,9 @@ int fork_exec(struct socket *so, char *ex, int do_pty)
#else
int slirp_openpty(int *amaster, int *aslave)
int
slirp_openpty(amaster, aslave)
int *amaster, *aslave;
{
register int master, slave;
@ -270,7 +269,11 @@ int slirp_openpty(int *amaster, int *aslave)
* do_pty = 1 Fork/exec using slirp.telnetd
* do_ptr = 2 Fork/exec using pty
*/
int fork_exec(struct socket *so, char *ex, int do_pty)
int
fork_exec(so, ex, do_pty)
struct socket *so;
char *ex;
int do_pty;
{
int s;
struct sockaddr_in addr;
@ -426,7 +429,9 @@ int fork_exec(struct socket *so, char *ex, int do_pty)
#endif
#ifndef HAVE_STRDUP
char *strdup(const char *str)
char *
strdup(str)
const char *str;
{
char *bptr;
@ -438,7 +443,9 @@ char *strdup(const char *str)
#endif
#if 0
void snooze_hup(int num)
void
snooze_hup(num)
int num;
{
int s, ret;
#ifndef NO_UNIX_SOCKETS
@ -478,7 +485,8 @@ void snooze_hup(int num)
}
void snooze()
void
snooze()
{
sigset_t s;
int i;
@ -502,7 +510,9 @@ void snooze()
exit(255);
}
void relay(int s)
void
relay(s)
int s;
{
char buf[8192];
int n;
@ -562,14 +572,25 @@ void relay(int s)
}
#endif
int (*lprint_print)(void *, const char *, va_list);
int (*lprint_print) _P((void *, const char *, va_list));
char *lprint_ptr, *lprint_ptr2, **lprint_arg;
void lprint(const char *format, ...)
void
#ifdef __STDC__
lprint(const char *format, ...)
#else
lprint(va_alist) va_dcl
#endif
{
va_list args;
va_start(args, format);
#ifdef __STDC__
va_start(args, format);
#else
char *format;
va_start(args);
format = va_arg(args, char *);
#endif
#if 0
/* If we're printing to an sbuf, make sure there's enough room */
/* XXX +100? */
@ -618,7 +639,9 @@ void lprint(const char *format, ...)
va_end(args);
}
void add_emu(char *buff)
void
add_emu(buff)
char *buff;
{
u_int lport, fport;
u_int8_t tos = 0, emu = 0;
@ -710,24 +733,42 @@ void add_emu(char *buff)
* Some BSD-derived systems have a sprintf which returns char *
*/
int vsprintf_len(char *string, const char *format, va_list args)
int
vsprintf_len(string, format, args)
char *string;
const char *format;
va_list args;
{
vsprintf(string, format, args);
return strlen(string);
}
int sprintf_len(char *string, const char *format, ...)
int
#ifdef __STDC__
sprintf_len(char *string, const char *format, ...)
#else
sprintf_len(va_alist) va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start(args, format);
#else
char *string;
char *format;
va_start(args);
string = va_arg(args, char *);
format = va_arg(args, char *);
#endif
vsprintf(string, format, args);
va_end(args);
return strlen(string);
}
#endif
void u_sleep(int usec)
void
u_sleep(usec)
int usec;
{
struct timeval t;
fd_set fdset;
@ -744,7 +785,9 @@ void u_sleep(int usec)
* Set fd blocking and non-blocking
*/
void fd_nonblock(int fd)
void
fd_nonblock(fd)
int fd;
{
#if defined USE_FIONBIO && defined FIONBIO
ioctlsockopt_t opt = 1;
@ -759,7 +802,9 @@ void fd_nonblock(int fd)
#endif
}
void fd_block(int fd)
void
fd_block(fd)
int fd;
{
#if defined USE_FIONBIO && defined FIONBIO
ioctlsockopt_t opt = 0;
@ -779,8 +824,13 @@ void fd_block(int fd)
/*
* invoke RSH
*/
int rsh_exec(struct socket *so, struct socket *ns,
char *user, char *host, char *args)
int
rsh_exec(so,ns, user, host, args)
struct socket *so;
struct socket *ns;
char *user;
char *host;
char *args;
{
int fd[2];
int fd0[2];

38
BasiliskII/src/slirp/misc.h Normal file → Executable file
View File

@ -19,15 +19,15 @@ struct ex_list {
extern struct ex_list *exec_list;
extern u_int curtime, time_fasttimo, last_slowtimo, detach_time, detach_wait;
extern int (*lprint_print)(void *, const char *, va_list);
extern int (*lprint_print) _P((void *, const char *, va_list));
extern char *lprint_ptr, *lprint_ptr2, **lprint_arg;
extern struct sbuf *lprint_sb;
#ifndef HAVE_STRDUP
char *strdup(const char *);
char *strdup _P((const char *));
#endif
void do_wait(int);
void do_wait _P((int));
#define EMU_NONE 0x0
@ -67,21 +67,21 @@ extern struct emu_t *tcpemu;
extern int x_port, x_server, x_display;
int show_x(char *, struct socket *);
void redir_x(u_int32_t, int, int, int);
void getouraddr(void);
void slirp_insque(void *, void *);
void slirp_remque(void *);
int add_exec(struct ex_list **, int, char *, int, int);
int slirp_openpty(int *, int *);
int fork_exec(struct socket *, char *, int);
void snooze_hup(int);
void snooze(void);
void relay(int);
void add_emu(char *);
void u_sleep(int);
void fd_nonblock(int);
void fd_block(int);
int rsh_exec(struct socket *, struct socket *, char *, char *, char *);
int show_x _P((char *, struct socket *));
void redir_x _P((u_int32_t, int, int, int));
void getouraddr _P((void));
void slirp_insque _P((void *, void *));
void slirp_remque _P((void *));
int add_exec _P((struct ex_list **, int, char *, int, int));
int slirp_openpty _P((int *, int *));
int fork_exec _P((struct socket *, char *, int));
void snooze_hup _P((int));
void snooze _P((void));
void relay _P((int));
void add_emu _P((char *));
void u_sleep _P((int));
void fd_nonblock _P((int));
void fd_block _P((int));
int rsh_exec _P((struct socket *, struct socket *, char *, char *, char *));
#endif

35
BasiliskII/src/slirp/sbuf.c Normal file → Executable file
View File

@ -5,7 +5,7 @@
* terms and conditions of the copyright.
*/
#include <stdlib.h>
// #include <stdlib.h>
#include <slirp.h>
/* Done as a macro in socket.h */
@ -16,12 +16,17 @@
* }
*/
void sbfree(struct sbuf *sb)
void
sbfree(sb)
struct sbuf *sb;
{
free(sb->sb_data);
}
void sbdrop(struct sbuf *sb, u_int num)
void
sbdrop(sb, num)
struct sbuf *sb;
int num;
{
/*
* We can only drop how much we have
@ -36,7 +41,10 @@ void sbdrop(struct sbuf *sb, u_int num)
}
void sbreserve(struct sbuf *sb, size_t size)
void
sbreserve(sb, size)
struct sbuf *sb;
int size;
{
if (sb->sb_data) {
/* Already alloced, realloc if necessary */
@ -64,14 +72,17 @@ void sbreserve(struct sbuf *sb, size_t size)
* this prevents an unnecessary copy of the data
* (the socket is non-blocking, so we won't hang)
*/
void sbappend(struct socket *so, struct mbuf *m)
void
sbappend(so, m)
struct socket *so;
struct mbuf *m;
{
int ret = 0;
DEBUG_CALL("sbappend");
DEBUG_ARG("so = %lx", (long)so);
DEBUG_ARG("m = %lx", (long)m);
DEBUG_ARG("m->m_len = %zu", m->m_len);
DEBUG_ARG("m->m_len = %d", m->m_len);
/* Shouldn't happen, but... e.g. foreign host closes connection */
if (m->m_len <= 0) {
@ -123,7 +134,10 @@ void sbappend(struct socket *so, struct mbuf *m)
* Copy the data from m into sb
* The caller is responsible to make sure there's enough room
*/
void sbappendsb(struct sbuf *sb, struct mbuf *m)
void
sbappendsb(sb, m)
struct sbuf *sb;
struct mbuf *m;
{
int len, n, nn;
@ -159,7 +173,12 @@ void sbappendsb(struct sbuf *sb, struct mbuf *m)
* Don't update the sbuf rptr, this will be
* done in sbdrop when the data is acked
*/
void sbcopy(struct sbuf *sb, u_int off, u_int len, char *to)
void
sbcopy(sb, off, len, to)
struct sbuf *sb;
int off;
int len;
char *to;
{
char *from;

14
BasiliskII/src/slirp/sbuf.h Normal file → Executable file
View File

@ -8,8 +8,6 @@
#ifndef _SBUF_H_
#define _SBUF_H_
#include <stddef.h>
#define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
#define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
@ -23,11 +21,11 @@ struct sbuf {
char *sb_data; /* Actual data */
};
void sbfree(struct sbuf *);
void sbdrop(struct sbuf *, u_int);
void sbreserve(struct sbuf *, size_t);
void sbappend(struct socket *, struct mbuf *);
void sbappendsb(struct sbuf *, struct mbuf *);
void sbcopy(struct sbuf *, u_int, u_int, char *);
void sbfree _P((struct sbuf *));
void sbdrop _P((struct sbuf *, int));
void sbreserve _P((struct sbuf *, int));
void sbappend _P((struct socket *, struct mbuf *));
void sbappendsb _P((struct sbuf *, struct mbuf *));
void sbcopy _P((struct sbuf *, int, int, char *));
#endif

190
BasiliskII/src/slirp/slirp.c Normal file → Executable file
View File

@ -84,7 +84,7 @@ static int get_dns_addr(struct in_addr *pdns_addr)
static int get_dns_addr(struct in_addr *pdns_addr)
{
char buff[512];
char buff2[256+1];
char buff2[256];
FILE *f;
int found = 0;
struct in_addr tmp_addr;
@ -211,8 +211,8 @@ int slirp_select_fill(int *pnfds,
* in the fragment queue, or there are TCP connections active
*/
do_slowtimo = ((tcb.so_next != &tcb) ||
((struct ipasfrag *)&ipq != (struct ipasfrag *)ipq.next));
(&ipq.ip_link != ipq.ip_link.next));
for (so = tcb.so_next; so != &tcb; so = so_next) {
so_next = so->so_next;
@ -220,14 +220,14 @@ int slirp_select_fill(int *pnfds,
* See if we need a tcp_fasttimo
*/
if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
time_fasttimo = curtime; /* Flag when we want a fasttimo */
time_fasttimo = curtime; /* Flag when we want a fasttimo */
/*
* NOFDREF can include still connecting to local-host,
* newly socreated() sockets etc. Don't want to select these.
*/
if (so->so_state & SS_NOFDREF || so->s == -1)
continue;
continue;
/*
* Set for reading sockets which are accepting
@ -346,18 +346,18 @@ int slirp_select_fill(int *pnfds,
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
{
struct socket *so, *so_next;
int ret;
struct socket *so, *so_next;
int ret;
global_readfds = readfds;
global_writefds = writefds;
global_xfds = xfds;
global_readfds = readfds;
global_writefds = writefds;
global_xfds = xfds;
/* Update time */
updtime();
/*
* See if anything has timed out
* See if anything has timed out
*/
if (link_up) {
if (time_fasttimo && ((curtime - time_fasttimo) >= FAST_TIMO)) {
@ -370,7 +370,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
last_slowtimo = curtime;
}
}
/*
* Check sockets
*/
@ -380,21 +380,21 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
*/
for (so = tcb.so_next; so != &tcb; so = so_next) {
so_next = so->so_next;
/*
* FD_ISSET is meaningless on these sockets
* (and they can crash the program)
*/
if (so->so_state & SS_NOFDREF || so->s == -1)
continue;
continue;
/*
* Check for URG data
* This will soread as well, so no need to
* test for readfds below if this succeeds
*/
if (FD_ISSET(so->s, xfds))
sorecvoob(so);
sorecvoob(so);
/*
* Check sockets for reading
*/
@ -407,92 +407,86 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
continue;
} /* else */
ret = soread(so);
/* Output it if we read something */
if (ret > 0)
tcp_output(sototcpcb(so));
tcp_output(sototcpcb(so));
}
/*
* Check sockets for writing
*/
if (FD_ISSET(so->s, writefds)) {
/*
* Check for non-blocking, still-connecting sockets
*/
if (so->so_state & SS_ISFCONNECTING) {
/* Connected */
so->so_state &= ~SS_ISFCONNECTING;
ret = send(so->s, (char*)&ret, 0, 0);
if (ret < 0) {
/* XXXXX Must fix, zero bytes is a NOP */
int error = WSAGetLastError();
if (error == EAGAIN || error == WSAEWOULDBLOCK ||
error == WSAEINPROGRESS || error == WSAENOTCONN)
continue;
/* else failed */
so->so_state = SS_NOFDREF;
}
/* else so->so_state &= ~SS_ISFCONNECTING; */
/*
* Continue tcp_input
*/
tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
/* continue; */
}
else
ret = sowrite(so);
/*
* XXXXX If we wrote something (a lot), there
* could be a need for a window update.
* In the worst case, the remote will send
* a window probe to get things going again
*/
/*
* Check for non-blocking, still-connecting sockets
*/
if (so->so_state & SS_ISFCONNECTING) {
/* Connected */
so->so_state &= ~SS_ISFCONNECTING;
ret = send(so->s, &ret, 0, 0);
if (ret < 0) {
/* XXXXX Must fix, zero bytes is a NOP */
if (errno == EAGAIN || errno == EWOULDBLOCK ||
errno == EINPROGRESS || errno == ENOTCONN)
continue;
/* else failed */
so->so_state = SS_NOFDREF;
}
/* else so->so_state &= ~SS_ISFCONNECTING; */
/*
* Continue tcp_input
*/
tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
/* continue; */
} else
ret = sowrite(so);
/*
* XXXXX If we wrote something (a lot), there
* could be a need for a window update.
* In the worst case, the remote will send
* a window probe to get things going again
*/
}
/*
* Probe a still-connecting, non-blocking socket
* to check if it's still alive
*/
*/
#ifdef PROBE_CONN
if (so->so_state & SS_ISFCONNECTING) {
ret = recv(so->s, (char *)&ret, 0, 0);
if (ret < 0) {
/* XXX */
int error = WSAGetLastError();
if (error == EAGAIN || error == WSAEWOULDBLOCK ||
error == WSAEINPROGRESS || error == WSAENOTCONN)
continue; /* Still connecting, continue */
/* else failed */
so->so_state = SS_NOFDREF;
/* tcp_input will take care of it */
}
else {
ret = send(so->s, &ret, 0, 0);
if (ret < 0) {
/* XXX */
int error = WSAGetLastError();
if (error == EAGAIN || error == WSAEWOULDBLOCK ||
error == WSAEINPROGRESS || error == WSAENOTCONN)
continue;
/* else failed */
so->so_state = SS_NOFDREF;
}
else
so->so_state &= ~SS_ISFCONNECTING;
}
tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
} /* SS_ISFCONNECTING */
ret = recv(so->s, (char *)&ret, 0,0);
if (ret < 0) {
/* XXX */
if (errno == EAGAIN || errno == EWOULDBLOCK ||
errno == EINPROGRESS || errno == ENOTCONN)
continue; /* Still connecting, continue */
/* else failed */
so->so_state = SS_NOFDREF;
/* tcp_input will take care of it */
} else {
ret = send(so->s, &ret, 0,0);
if (ret < 0) {
/* XXX */
if (errno == EAGAIN || errno == EWOULDBLOCK ||
errno == EINPROGRESS || errno == ENOTCONN)
continue;
/* else failed */
so->so_state = SS_NOFDREF;
} else
so->so_state &= ~SS_ISFCONNECTING;
}
tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
} /* SS_ISFCONNECTING */
#endif
}
}
/*
* Now UDP sockets.
* Incoming packets are sent straight away, they're not buffered.
@ -500,27 +494,27 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
*/
for (so = udb.so_next; so != &udb; so = so_next) {
so_next = so->so_next;
if (so->s != -1 && FD_ISSET(so->s, readfds)) {
sorecvfrom(so);
}
sorecvfrom(so);
}
}
}
}
/*
* See if we can start outputting
*/
if (if_queued && link_up)
if_start();
if_start();
/* clear global file descriptor sets.
* these reside on the stack in vl.c
* so they're unusable if we're not in
* slirp_select_fill or slirp_select_poll.
*/
global_readfds = NULL;
global_writefds = NULL;
global_xfds = NULL;
global_readfds = NULL;
global_writefds = NULL;
global_xfds = NULL;
}
#define ETH_ALEN 6

133
BasiliskII/src/slirp/slirp.h Normal file → Executable file
View File

@ -22,12 +22,18 @@ typedef char *caddr_t;
typedef int socklen_t;
typedef unsigned long ioctlsockopt_t;
# include <windows.h>
# include <winsock2.h>
# include <WS2tcpip.h>
# include <sys/timeb.h>
# include <iphlpapi.h>
# define USE_FIONBIO 1
# define EWOULDBLOCK WSAEWOULDBLOCK
# define EINPROGRESS WSAEINPROGRESS
# define ENOTCONN WSAENOTCONN
# define EHOSTUNREACH WSAEHOSTUNREACH
# define ENETUNREACH WSAENETUNREACH
# define ECONNREFUSED WSAECONNREFUSED
/* Basilisk II Router defines those */
# define udp_read_completion slirp_udp_read_completion
@ -133,29 +139,35 @@ typedef u_int32_t uint32;
#include <arpa/inet.h>
#endif
#ifndef _P
#ifndef NO_PROTOTYPES
# define _P(x) x
#else
# define _P(x) ()
#endif
#endif
#ifdef GETTIMEOFDAY_ONE_ARG
#define gettimeofday(x, y) gettimeofday(x)
#endif
/* Systems lacking strdup() definition in <string.h>. */
#if defined(ultrix)
char *strdup(const char *);
char *strdup _P((const char *));
#endif
/* Systems lacking malloc() definition in <stdlib.h>. */
#if defined(ultrix) || defined(hcx)
void *malloc(size_t arg);
void free(void *ptr);
void *malloc _P((size_t arg));
void free _P((void *ptr));
#endif
#ifndef HAVE_INET_ATON
int inet_aton(const char *cp, struct in_addr *ia);
int inet_aton _P((const char *cp, struct in_addr *ia));
#endif
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
#endif
#ifndef NO_UNIX_SOCKETS
#include <sys/un.h>
#endif
@ -187,7 +199,11 @@ int inet_aton(const char *cp, struct in_addr *ia);
#include <ppp/slirppp.h>
#endif
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <sys/stat.h>
@ -204,13 +220,8 @@ int inet_aton(const char *cp, struct in_addr *ia);
#if defined __GNUC__
#define PACKED__ __attribute__ ((packed))
#elif defined _MSC_VER
#define PRAGMA_PACK_SUPPORTED 1
#define PACK_RESET
#define PACKED__
#elif defined __sgi
#define PRAGMA_PACK_SUPPORTED 1
#define PACK_RESET 0
#define PACKED__
#else
#error "Packed attribute or pragma shall be supported"
@ -246,49 +257,41 @@ extern struct ttys *ttys_unit[MAX_INTERFACES];
#endif
#ifndef FULL_BOLT
void if_start(void);
void if_start _P((void));
#else
void if_start(struct ttys *);
void if_start _P((struct ttys *));
#endif
#ifdef BAD_SPRINTF
# define vsprintf vsprintf_len
# define sprintf sprintf_len
extern int vsprintf_len(char *, const char *, va_list);
extern int sprintf_len(char *, const char *, ...);
extern int vsprintf_len _P((char *, const char *, va_list));
extern int sprintf_len _P((char *, const char *, ...));
#endif
#ifdef DECLARE_SPRINTF
# ifndef BAD_SPRINTF
extern int vsprintf(char *, const char *, va_list);
extern int vsprintf _P((char *, const char *, va_list));
# endif
extern int vfprintf(FILE *, const char *, va_list);
extern int vfprintf _P((FILE *, const char *, va_list));
#endif
#ifndef HAVE_STRERROR
extern char *strerror(int error);
extern char *strerror _P((int error));
#endif
#ifndef HAVE_INDEX
char *index(const char *, int);
char *index _P((const char *, int));
#endif
#ifndef HAVE_GETHOSTID
long gethostid(void);
long gethostid _P((void));
#endif
void lprint(const char *, ...);
void lprint _P((const char *, ...));
extern int do_echo;
#if SIZEOF_CHAR_P == 4
# define insque_32 insque
# define remque_32 remque
#else
extern inline void insque_32(void *, void *);
extern inline void remque_32(void *);
#endif
#ifndef _WIN32
#include <netdb.h>
#endif
@ -299,47 +302,48 @@ extern int do_echo;
int cksum(struct mbuf *m, int len);
/* if.c */
void if_init(void);
void if_output(struct socket *, struct mbuf *);
void if_init _P((void));
void if_output _P((struct socket *, struct mbuf *));
/* ip_input.c */
void ip_init(void);
void ip_input(struct mbuf *);
struct ip * ip_reass(register struct ipasfrag *, register struct ipq *);
void ip_freef(struct ipq *);
void ip_enq(register struct ipasfrag *, register struct ipasfrag *);
void ip_deq(register struct ipasfrag *);
void ip_slowtimo(void);
void ip_stripoptions(register struct mbuf *, struct mbuf *);
void ip_init _P((void));
void ip_input _P((struct mbuf *));
static struct ip *
ip_reass(register struct ip *ip, register struct ipq *);
void ip_freef _P((struct ipq *));
void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
void ip_deq _P((register struct ipasfrag *));
void ip_slowtimo _P((void));
void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
/* ip_output.c */
int ip_output(struct socket *, struct mbuf *);
int ip_output _P((struct socket *, struct mbuf *));
/* tcp_input.c */
int tcp_reass(register struct tcpcb *, register struct tcpiphdr *, struct mbuf *);
void tcp_input(register struct mbuf *, int, struct socket *);
void tcp_dooptions(struct tcpcb *, u_char *, int, struct tcpiphdr *);
void tcp_xmit_timer(register struct tcpcb *, int);
u_int tcp_mss(register struct tcpcb *, u_int);
int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *));
void tcp_input _P((register struct mbuf *, int, struct socket *));
void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *));
void tcp_xmit_timer _P((register struct tcpcb *, int));
int tcp_mss _P((register struct tcpcb *, u_int));
/* tcp_output.c */
int tcp_output(register struct tcpcb *);
void tcp_setpersist(register struct tcpcb *);
int tcp_output _P((register struct tcpcb *));
void tcp_setpersist _P((register struct tcpcb *));
/* tcp_subr.c */
void tcp_init(void);
void tcp_template(struct tcpcb *);
void tcp_respond(struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int);
struct tcpcb * tcp_newtcpcb(struct socket *);
struct tcpcb * tcp_close(register struct tcpcb *);
void tcp_drain(void);
void tcp_sockclosed(struct tcpcb *);
int tcp_fconnect(struct socket *);
void tcp_connect(struct socket *);
int tcp_attach(struct socket *);
u_int8_t tcp_tos(struct socket *);
int tcp_emu(struct socket *, struct mbuf *);
int tcp_ctl(struct socket *);
void tcp_init _P((void));
void tcp_template _P((struct tcpcb *));
void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
struct tcpcb * tcp_newtcpcb _P((struct socket *));
struct tcpcb * tcp_close _P((register struct tcpcb *));
void tcp_drain _P((void));
void tcp_sockclosed _P((struct tcpcb *));
int tcp_fconnect _P((struct socket *));
void tcp_connect _P((struct socket *));
int tcp_attach _P((struct socket *));
u_int8_t tcp_tos _P((struct socket *));
int tcp_emu _P((struct socket *, struct mbuf *));
int tcp_ctl _P((struct socket *));
struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
#ifdef USE_PPP
@ -355,4 +359,9 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif
#ifdef _WIN32
#undef errno
#define errno (WSAGetLastError())
#endif
#endif

8
BasiliskII/src/slirp/slirp_config.h Normal file → Executable file
View File

@ -40,6 +40,11 @@
*/
#undef USE_LOWCPU
/* Define this if your compiler doesn't like prototypes */
#ifndef __STDC__
#define NO_PROTOTYPES
#endif
/*********************************************************/
/*
* Autoconf defined configuration options
@ -72,6 +77,9 @@
/* Define if you have sys/stropts.h */
#undef HAVE_SYS_STROPTS_H
/* Define if your compiler doesn't like prototypes */
#undef NO_PROTOTYPES
/* Define if you don't have u_int32_t etc. typedef'd */
#undef NEED_TYPEDEFS
#ifdef __sun__

53
BasiliskII/src/slirp/socket.c Normal file → Executable file
View File

@ -14,12 +14,6 @@
#include <sys/filio.h>
#endif
#ifdef _WIN32
#define IS_EAGAIN(e) ((e) == WSAEINTR || (e) == EAGAIN)
#else
#define IS_EAGAIN(e) ((e) == EAGAIN)
#endif
void
so_init()
{
@ -103,12 +97,11 @@ int
soread(so)
struct socket *so;
{
int n, nn;
u_int lss, total;
int n, nn, lss, total;
struct sbuf *sb = &so->so_snd;
u_int len = sb->sb_datalen - sb->sb_cc;
int len = sb->sb_datalen - sb->sb_cc;
struct iovec iov[2];
u_int mss = so->so_tcpcb->t_maxseg;
int mss = so->so_tcpcb->t_maxseg;
DEBUG_CALL("soread");
DEBUG_ARG("so = %lx", (long )so);
@ -166,8 +159,7 @@ soread(so)
nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
#endif
if (nn <= 0) {
int error = WSAGetLastError();
if (nn < 0 && IS_EAGAIN(error))
if (nn < 0 && (errno == EINTR || errno == EAGAIN))
return 0;
else {
DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno)));
@ -305,7 +297,7 @@ sowrite(so)
{
int n,nn;
struct sbuf *sb = &so->so_rcv;
u_int len = sb->sb_cc;
int len = sb->sb_cc;
struct iovec iov[2];
DEBUG_CALL("sowrite");
@ -352,12 +344,9 @@ sowrite(so)
nn = send(so->s, iov[0].iov_base, iov[0].iov_len,0);
#endif
/* This should never happen, but people tell me it does *shrug* */
if (nn < 0) {
int error = WSAGetLastError();
if (IS_EAGAIN(error))
return 0;
}
if (nn < 0 && (errno == EAGAIN || errno == EINTR))
return 0;
if (nn <= 0) {
DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state = %x, errno = %d\n",
so->so_state, errno));
@ -416,9 +405,8 @@ sorecvfrom(so)
if(len == -1 || len == 0) {
u_char code=ICMP_UNREACH_PORT;
int error = WSAGetLastError();
if(error == WSAEHOSTUNREACH) code=ICMP_UNREACH_HOST;
else if(error == WSAENETUNREACH) code=ICMP_UNREACH_NET;
if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST;
else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET;
DEBUG_MISC((dfd," udp icmp rx errno = %d-%s\n",
errno,strerror(errno)));
@ -431,7 +419,7 @@ sorecvfrom(so)
udp_detach(so);
} else { /* A "normal" UDP packet */
struct mbuf *m;
u_int len;
int len;
ioctlsockopt_t n;
if (!(m = m_get())) return;
@ -454,14 +442,13 @@ sorecvfrom(so)
m->m_len = recvfrom(so->s, m->m_data, len, 0,
(struct sockaddr *)&addr, &addrlen);
DEBUG_MISC((dfd, " did recvfrom %zu, errno = %d-%s\n",
DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n",
m->m_len, errno,strerror(errno)));
if(m->m_len<0) {
u_char code=ICMP_UNREACH_PORT;
int error = WSAGetLastError();
if(error == WSAEHOSTUNREACH) code=ICMP_UNREACH_HOST;
else if(error == WSAENETUNREACH) code=ICMP_UNREACH_NET;
if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST;
else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET;
DEBUG_MISC((dfd," rx error, tx icmp ICMP_UNREACH:%i\n", code));
icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno));
@ -526,9 +513,7 @@ sosendto(so, m)
addr.sin_addr = so->so_faddr;
addr.sin_port = so->so_fport;
char addrstr[INET_ADDRSTRLEN];
DEBUG_MISC((dfd, " sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n",
ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr, addrstr, sizeof(addrstr))));
DEBUG_MISC((dfd, " sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr)));
/* Don't care what port we get */
ret = sendto(so->s, m->m_data, m->m_len, 0,
@ -599,12 +584,16 @@ solisten(port, laddr, lport, flags)
(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int error = WSAGetLastError(); /* Don't clobber the real reason we failed */
int tmperrno = errno; /* Don't clobber the real reason we failed */
close(s);
sofree(so);
/* Restore the real errno */
WSASetLastError(error);
#ifdef _WIN32
WSASetLastError(tmperrno);
#else
errno = tmperrno;
#endif
return NULL;
}
setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));

38
BasiliskII/src/slirp/socket.h Normal file → Executable file
View File

@ -81,24 +81,24 @@ struct iovec {
};
#endif
void so_init(void);
struct socket * solookup(struct socket *, struct in_addr, u_int, struct in_addr, u_int);
struct socket * socreate(void);
void sofree(struct socket *);
int soread(struct socket *);
void sorecvoob(struct socket *);
int sosendoob(struct socket *);
int sowrite(struct socket *);
void sorecvfrom(struct socket *);
int sosendto(struct socket *, struct mbuf *);
struct socket * solisten(u_int, u_int32_t, u_int, int);
void sorwakeup(struct socket *);
void sowwakeup(struct socket *);
void soisfconnecting(register struct socket *);
void soisfconnected(register struct socket *);
void sofcantrcvmore(struct socket *);
void sofcantsendmore(struct socket *);
void soisfdisconnected(struct socket *);
void sofwdrain(struct socket *);
void so_init _P((void));
struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
struct socket * socreate _P((void));
void sofree _P((struct socket *));
int soread _P((struct socket *));
void sorecvoob _P((struct socket *));
int sosendoob _P((struct socket *));
int sowrite _P((struct socket *));
void sorecvfrom _P((struct socket *));
int sosendto _P((struct socket *, struct mbuf *));
struct socket * solisten _P((u_int, u_int32_t, u_int, int));
void sorwakeup _P((struct socket *));
void sowwakeup _P((struct socket *));
void soisfconnecting _P((register struct socket *));
void soisfconnected _P((register struct socket *));
void sofcantrcvmore _P((struct socket *));
void sofcantsendmore _P((struct socket *));
void soisfdisconnected _P((struct socket *));
void sofwdrain _P((struct socket *));
#endif /* _SOCKET_H_ */

6
BasiliskII/src/slirp/tcp.h Normal file → Executable file
View File

@ -38,8 +38,8 @@ typedef u_int32_t tcp_seq;
#define PR_SLOWHZ 2 /* 2 slow timeouts per second (approx) */
#define PR_FASTHZ 5 /* 5 fast timeouts per second (not important) */
extern size_t tcp_rcvspace;
extern size_t tcp_sndspace;
extern int tcp_rcvspace;
extern int tcp_sndspace;
extern struct socket *tcp_last_so;
#define TCP_SNDSPACE 8192
@ -78,7 +78,7 @@ struct tcphdr {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
#include "tcp_var.h"

1060
BasiliskII/src/slirp/tcp_input.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

30
BasiliskII/src/slirp/tcp_output.c Normal file → Executable file
View File

@ -63,7 +63,9 @@ u_char tcp_outflags[TCP_NSTATES] = {
/*
* Tcp output routine: figure out what should be sent and send it.
*/
int tcp_output(register struct tcpcb *tp)
int
tcp_output(tp)
register struct tcpcb *tp;
{
register struct socket *so = tp->t_socket;
register long len, win;
@ -124,7 +126,7 @@ again:
* to send then the probe will be the FIN
* itself.
*/
if (off < (int)so->so_snd.sb_cc)
if (off < so->so_snd.sb_cc)
flags &= ~TH_FIN;
win = 1;
} else {
@ -199,12 +201,12 @@ again:
* taking into account that we are limited by
* TCP_MAXWIN << tp->rcv_scale.
*/
long adv = min(win, TCP_MAXWIN << tp->rcv_scale) -
long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) -
(tp->rcv_adv - tp->rcv_nxt);
if (adv >= (long)(2 * tp->t_maxseg))
if (adv >= (long) (2 * tp->t_maxseg))
goto send;
if (2 * adv >= (long)so->so_rcv.sb_datalen)
if (2 * adv >= (long) so->so_rcv.sb_datalen)
goto send;
}
@ -357,7 +359,7 @@ send:
*/
/* if (len <= MHLEN - hdrlen - max_linkhdr) { */
sbcopy(&so->so_snd, off, len, mtod(m, caddr_t) + hdrlen);
sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen);
m->m_len += len;
/* } else {
@ -433,12 +435,12 @@ send:
* Calculate receive window. Don't shrink window,
* but avoid silly window syndrome.
*/
if (win < (so->so_rcv.sb_datalen / 4) && win < tp->t_maxseg)
if (win < (long)(so->so_rcv.sb_datalen / 4) && win < (long)tp->t_maxseg)
win = 0;
if (win > (u_long) (TCP_MAXWIN << tp->rcv_scale))
win = (u_long) (TCP_MAXWIN << tp->rcv_scale);
if (win < (tp->rcv_adv - tp->rcv_nxt))
win = (tp->rcv_adv - tp->rcv_nxt);
if (win > (long)TCP_MAXWIN << tp->rcv_scale)
win = (long)TCP_MAXWIN << tp->rcv_scale;
if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
win = (long)(tp->rcv_adv - tp->rcv_nxt);
ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale));
if (SEQ_GT(tp->snd_up, tp->snd_una)) {
@ -528,7 +530,7 @@ send:
{
((struct ip *)ti)->ip_len = (u_int16_t) m->m_len;
((struct ip *)ti)->ip_len = m->m_len;
((struct ip *)ti)->ip_ttl = ip_defttl;
((struct ip *)ti)->ip_tos = so->so_iptos;
@ -579,7 +581,9 @@ out:
return (0);
}
void tcp_setpersist(register struct tcpcb *tp)
void
tcp_setpersist(tp)
register struct tcpcb *tp;
{
int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;

92
BasiliskII/src/slirp/tcp_subr.c Normal file → Executable file
View File

@ -46,13 +46,14 @@
int tcp_mssdflt = TCP_MSS;
int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
int tcp_do_rfc1323 = 0; /* Don't do rfc1323 performance enhancements */
size_t tcp_rcvspace; /* You may want to change this */
size_t tcp_sndspace; /* Keep small if you have an error prone link */
int tcp_rcvspace; /* You may want to change this */
int tcp_sndspace; /* Keep small if you have an error prone link */
/*
* Tcp initialization
*/
void tcp_init()
void
tcp_init()
{
tcp_iss = 1; /* wrong */
tcb.so_next = tcb.so_prev = &tcb;
@ -73,12 +74,14 @@ void tcp_init()
* necessary when the connection is used.
*/
/* struct tcpiphdr * */
void tcp_template(struct tcpcb *tp)
void
tcp_template(tp)
struct tcpcb *tp;
{
struct socket *so = tp->t_socket;
register struct tcpiphdr *n = &tp->t_template;
n->ti_next = n->ti_prev = 0;
n->ti_mbuf = NULL;
n->ti_x1 = 0;
n->ti_pr = IPPROTO_TCP;
n->ti_len = htons(sizeof (struct tcpiphdr) - sizeof (struct ip));
@ -110,8 +113,13 @@ void tcp_template(struct tcpcb *tp)
* In any case the ack and sequence number of the transmitted
* segment are as specified by the parameters.
*/
void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti,
register struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags)
void
tcp_respond(tp, ti, m, ack, seq, flags)
struct tcpcb *tp;
register struct tcpiphdr *ti;
register struct mbuf *m;
tcp_seq ack, seq;
int flags;
{
register int tlen;
int win = 0;
@ -156,7 +164,7 @@ void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti,
tlen += sizeof (struct tcpiphdr);
m->m_len = tlen;
ti->ti_next = ti->ti_prev = 0;
ti->ti_mbuf = 0;
ti->ti_x1 = 0;
ti->ti_seq = htonl(seq);
ti->ti_ack = htonl(ack);
@ -185,7 +193,9 @@ void tcp_respond(struct tcpcb *tp, register struct tcpiphdr *ti,
* empty reassembly queue and hooking it to the argument
* protocol control block.
*/
struct tcpcb *tcp_newtcpcb(struct socket *so)
struct tcpcb *
tcp_newtcpcb(so)
struct socket *so;
{
register struct tcpcb *tp;
@ -194,7 +204,7 @@ struct tcpcb *tcp_newtcpcb(struct socket *so)
return ((struct tcpcb *)0);
memset((char *) tp, 0, sizeof(struct tcpcb));
tp->seg_next = tp->seg_prev = (tcpiphdrp_32)tp;
tp->seg_next = tp->seg_prev = (struct tcpiphdr*)tp;
tp->t_maxseg = tcp_mssdflt;
tp->t_flags = tcp_do_rfc1323 ? (TF_REQ_SCALE|TF_REQ_TSTMP) : 0;
@ -258,7 +268,9 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
* discard internet protocol block
* wake up any sleepers
*/
struct tcpcb *tcp_close(register struct tcpcb *tp)
struct tcpcb *
tcp_close(tp)
register struct tcpcb *tp;
{
register struct tcpiphdr *t;
struct socket *so = tp->t_socket;
@ -268,11 +280,11 @@ struct tcpcb *tcp_close(register struct tcpcb *tp)
DEBUG_ARG("tp = %lx", (long )tp);
/* free the reassembly queue, if any */
t = (struct tcpiphdr *) tp->seg_next;
while (t != (struct tcpiphdr *)tp) {
t = (struct tcpiphdr *)t->ti_next;
m = (struct mbuf *) REASS_MBUF((struct tcpiphdr *)t->ti_prev);
remque_32((struct tcpiphdr *) t->ti_prev);
t = tcpfrag_list_first(tp);
while (!tcpfrag_list_end(t, tp)) {
t = tcpiphdr_next(t);
m = tcpiphdr_prev(t)->ti_mbuf;
remque(tcpiphdr2qlink(tcpiphdr_prev(t)));
m_freem(m);
}
/* It's static */
@ -294,7 +306,8 @@ struct tcpcb *tcp_close(register struct tcpcb *tp)
return ((struct tcpcb *)0);
}
void tcp_drain()
void
tcp_drain()
{
/* XXX */
}
@ -306,7 +319,10 @@ void tcp_drain()
#ifdef notdef
void tcp_quench(int i, int errno)
void
tcp_quench(i, errno)
int errno;
{
struct tcpcb *tp = intotcpcb(inp);
@ -330,7 +346,9 @@ void tcp_quench(int i, int errno)
* for peer to send FIN or not respond to keep-alives, etc.
* We can let the user exit from the close as soon as the FIN is acked.
*/
void tcp_sockclosed(struct tcpcb *tp)
void
tcp_sockclosed(tp)
struct tcpcb *tp;
{
DEBUG_CALL("tcp_sockclosed");
@ -371,7 +389,8 @@ void tcp_sockclosed(struct tcpcb *tp)
* nonblocking. Connect returns after the SYN is sent, and does
* not wait for ACK+SYN.
*/
int tcp_fconnect(struct socket *so)
int tcp_fconnect(so)
struct socket *so;
{
int ret=0;
@ -404,12 +423,10 @@ int tcp_fconnect(struct socket *so)
} else
addr.sin_addr = so->so_faddr;
addr.sin_port = so->so_fport;
char addrstr[INET_ADDRSTRLEN];
DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, "
"addr.sin_addr.s_addr=%.16s\n",
ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr,
addrstr, sizeof(addrstr))));
ntohs(addr.sin_port), inet_ntoa(addr.sin_addr)));
/* We don't care what port we get */
ret = connect(s,(struct sockaddr *)&addr,sizeof (addr));
@ -435,7 +452,9 @@ int tcp_fconnect(struct socket *so)
* the time it gets to accept(), so... We simply accept
* here and SYN the local-host.
*/
void tcp_connect(struct socket *inso)
void
tcp_connect(inso)
struct socket *inso;
{
struct socket *so;
struct sockaddr_in addr;
@ -467,7 +486,7 @@ void tcp_connect(struct socket *inso)
so->so_lport = inso->so_lport;
}
tcp_mss(sototcpcb(so), 0);
(void) tcp_mss(sototcpcb(so), 0);
if ((s = accept(inso->s,(struct sockaddr *)&addr,&addrlen)) < 0) {
tcp_close(sototcpcb(so)); /* This will sofree() as well */
@ -520,7 +539,9 @@ void tcp_connect(struct socket *inso)
/*
* Attach a TCPCB to a socket.
*/
int tcp_attach(struct socket *so)
int
tcp_attach(so)
struct socket *so;
{
if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL)
return -1;
@ -554,7 +575,9 @@ struct emu_t *tcpemu = 0;
/*
* Return TOS according to the above table
*/
u_int8_t tcp_tos(struct socket *so)
u_int8_t
tcp_tos(so)
struct socket *so;
{
int i = 0;
struct emu_t *emup;
@ -606,7 +629,10 @@ int do_echo = -1;
*
* NOTE: if you return 0 you MUST m_free() the mbuf!
*/
int tcp_emu(struct socket *so, struct mbuf *m)
int
tcp_emu(so, m)
struct socket *so;
struct mbuf *m;
{
u_int n1, n2, n3, n4, n5, n6;
char buff[256];
@ -807,7 +833,7 @@ int tcp_emu(struct socket *so, struct mbuf *m)
ns->so_laddr=so->so_laddr;
ns->so_lport=htons(port);
tcp_mss(sototcpcb(ns), 0);
(void) tcp_mss(sototcpcb(ns), 0);
ns->so_faddr=so->so_faddr;
ns->so_fport=htons(IPPORT_RESERVED-1); /* Use a fake port. */
@ -1034,7 +1060,7 @@ do_prompt:
* of the connection as a NUL-terminated decimal ASCII string.
*/
so->so_emu = 0;
for (lport = 0, i = 0; i < (int) (m->m_len-1); ++i) {
for (lport = 0, i = 0; i < m->m_len-1; ++i) {
if (m->m_data[i] < '0' || m->m_data[i] > '9')
return 1; /* invalid number */
lport *= 10;
@ -1219,7 +1245,9 @@ do_prompt:
* Return 0 if this connections is to be closed, 1 otherwise,
* return 2 if this is a command-line connection
*/
int tcp_ctl(struct socket *so)
int
tcp_ctl(so)
struct socket *so;
{
struct sbuf *sb = &so->so_snd;
int command;

0
BasiliskII/src/slirp/tcp_timer.c Normal file → Executable file
View File

8
BasiliskII/src/slirp/tcp_timer.h Normal file → Executable file
View File

@ -130,9 +130,9 @@ extern int tcp_backoff[];
struct tcpcb;
void tcp_fasttimo(void);
void tcp_slowtimo(void);
void tcp_canceltimers(struct tcpcb *);
struct tcpcb * tcp_timers(register struct tcpcb *, int);
void tcp_fasttimo _P((void));
void tcp_slowtimo _P((void));
void tcp_canceltimers _P((struct tcpcb *));
struct tcpcb * tcp_timers _P((register struct tcpcb *, int));
#endif

25
BasiliskII/src/slirp/tcp_var.h Normal file → Executable file
View File

@ -36,18 +36,12 @@
#include "tcpip.h"
#include "tcp_timer.h"
#if SIZEOF_CHAR_P == 4
typedef struct tcpiphdr *tcpiphdrp_32;
#else
typedef u_int32_t tcpiphdrp_32;
#endif
/*
* Tcp control block, one per tcp; fields:
*/
struct tcpcb {
tcpiphdrp_32 seg_next; /* sequencing queue */
tcpiphdrp_32 seg_prev;
struct tcpiphdr *seg_next; /* sequencing queue */
struct tcpiphdr *seg_prev;
short t_state; /* state of this connection */
short t_timer[TCPT_NTIMERS]; /* tcp timers */
short t_rxtshift; /* log(2) of rexmt exp. backoff */
@ -166,21 +160,6 @@ struct tcpcb {
#define TCP_REXMTVAL(tp) \
(((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar)
/* XXX
* We want to avoid doing m_pullup on incoming packets but that
* means avoiding dtom on the tcp reassembly code. That in turn means
* keeping an mbuf pointer in the reassembly queue (since we might
* have a cluster). As a quick hack, the source & destination
* port numbers (which are no longer needed once we've located the
* tcpcb) are overlayed with an mbuf pointer.
*/
#if SIZEOF_CHAR_P == 4
typedef struct mbuf *mbufp_32;
#else
typedef u_int32_t mbufp_32;
#endif
#define REASS_MBUF(ti) (*(mbufp_32 *)&((ti)->ti_t))
/*
* TCP statistics.
* Many of these should be kept per connection,

11
BasiliskII/src/slirp/tcpip.h Normal file → Executable file
View File

@ -40,8 +40,7 @@ struct tcpiphdr {
struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
};
#define ti_next ti_i.ih_next
#define ti_prev ti_i.ih_prev
#define ti_mbuf ti_i.ih_mbuf.mptr
#define ti_x1 ti_i.ih_x1
#define ti_pr ti_i.ih_pr
#define ti_len ti_i.ih_len
@ -58,6 +57,14 @@ struct tcpiphdr {
#define ti_sum ti_t.th_sum
#define ti_urp ti_t.th_urp
#define tcpiphdr2qlink(T) ((struct qlink*)(((char*)(T)) - sizeof(struct qlink)))
#define qlink2tcpiphdr(Q) ((struct tcpiphdr*)(((char*)(Q)) + sizeof(struct qlink)))
#define tcpiphdr_next(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->next)
#define tcpiphdr_prev(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->prev)
#define tcpfrag_list_first(T) qlink2tcpiphdr((T)->seg_next)
#define tcpfrag_list_end(F, T) (tcpiphdr2qlink(F) == (struct qlink*)(T))
#define tcpfrag_list_empty(T) ((T)->seg_next == (struct tcpiphdr*)(T))
/*
* Just a clean way to get to the first byte
* of the packet

3
BasiliskII/src/slirp/tftp.c Normal file → Executable file
View File

@ -127,6 +127,7 @@ static int tftp_send_error(struct tftp_session *spt,
struct sockaddr_in saddr, daddr;
struct mbuf *m;
struct tftp_t *tp;
int nobytes;
m = m_get();
@ -151,6 +152,8 @@ static int tftp_send_error(struct tftp_session *spt,
daddr.sin_addr = spt->client_ip;
daddr.sin_port = spt->client_port;
nobytes = 2;
m->m_len = sizeof(struct tftp_t) - 514 + 3 + strlen(msg) -
sizeof(struct ip) - sizeof(struct udphdr);

2
BasiliskII/src/slirp/tftp.h Normal file → Executable file
View File

@ -34,7 +34,7 @@ struct tftp_t {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
void tftp_input(struct mbuf *m);

17
BasiliskII/src/slirp/udp.c Normal file → Executable file
View File

@ -128,8 +128,7 @@ udp_input(m, iphlen)
* Checksum extended UDP header and data.
*/
if (udpcksum && uh->uh_sum) {
((struct ipovly *)ip)->ih_next = 0;
((struct ipovly *)ip)->ih_prev = 0;
memset(&((struct ipovly *)ip)->ih_mbuf, 0, sizeof(struct mbuf_ptr));
((struct ipovly *)ip)->ih_x1 = 0;
((struct ipovly *)ip)->ih_len = uh->uh_ulen;
/* keep uh_sum for ICMP reply
@ -272,10 +271,10 @@ int udp_output2(struct socket *so, struct mbuf *m,
* and addresses and length put into network format.
*/
ui = mtod(m, struct udpiphdr *);
ui->ui_next = ui->ui_prev = 0;
memset(&ui->ui_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr));
ui->ui_x1 = 0;
ui->ui_pr = IPPROTO_UDP;
ui->ui_len = htons((u_short) (m->m_len - sizeof(struct ip))); /* + sizeof (struct udphdr)); */
ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* + sizeof (struct udphdr)); */
/* XXXXX Check for from-one-location sockets, or from-any-location sockets */
ui->ui_src = saddr->sin_addr;
ui->ui_dst = daddr->sin_addr;
@ -291,7 +290,7 @@ int udp_output2(struct socket *so, struct mbuf *m,
if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0)
ui->ui_sum = 0xffff;
}
((struct ip *)ui)->ip_len = (u_int16_t) m->m_len;
((struct ip *)ui)->ip_len = m->m_len;
((struct ip *)ui)->ip_ttl = ip_defttl;
((struct ip *)ui)->ip_tos = iptos;
@ -338,10 +337,14 @@ udp_attach(so)
addr.sin_port = 0;
addr.sin_addr.s_addr = INADDR_ANY;
if(bind(so->s, (struct sockaddr *)&addr, sizeof(addr))<0) {
int error = WSAGetLastError();
int lasterrno=errno;
closesocket(so->s);
so->s=-1;
WSASetLastError(error);
#ifdef _WIN32
WSASetLastError(lasterrno);
#else
errno=lasterrno;
#endif
} else {
/* success, insert in queue */
so->so_expire = curtime + SO_EXPIRE;

21
BasiliskII/src/slirp/udp.h Normal file → Executable file
View File

@ -54,7 +54,7 @@ struct udphdr {
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_RESET)
#pragma pack(0)
#endif
/*
@ -64,8 +64,7 @@ struct udpiphdr {
struct ipovly ui_i; /* overlaid ip structure */
struct udphdr ui_u; /* udp header */
};
#define ui_next ui_i.ih_next
#define ui_prev ui_i.ih_prev
#define ui_mbuf ui_i.ih_mbuf.mptr
#define ui_x1 ui_i.ih_x1
#define ui_pr ui_i.ih_pr
#define ui_len ui_i.ih_len
@ -100,14 +99,14 @@ extern struct udpstat udpstat;
extern struct socket udb;
struct mbuf;
void udp_init(void);
void udp_input(register struct mbuf *, int);
int udp_output(struct socket *, struct mbuf *, struct sockaddr_in *);
int udp_attach(struct socket *);
void udp_detach(struct socket *);
u_int8_t udp_tos(struct socket *);
void udp_emu(struct socket *, struct mbuf *);
struct socket * udp_listen(u_int, u_int32_t, u_int, int);
void udp_init _P((void));
void udp_input _P((register struct mbuf *, int));
int udp_output _P((struct socket *, struct mbuf *, struct sockaddr_in *));
int udp_attach _P((struct socket *));
void udp_detach _P((struct socket *));
u_int8_t udp_tos _P((struct socket *));
void udp_emu _P((struct socket *, struct mbuf *));
struct socket * udp_listen _P((u_int, u_int32_t, u_int, int));
int udp_output2(struct socket *so, struct mbuf *m,
struct sockaddr_in *saddr, struct sockaddr_in *daddr,
int iptos);

View File

@ -173,7 +173,7 @@ void TimerReset(void)
int16 InsTime(uint32 tm, uint16 trap)
{
D(bug("InsTime %08lx, trap %04x\n", tm, trap));
WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x1fff | (trap << 4) & 0x6000);
WriteMacInt16(tm + qType, (ReadMacInt16(tm + qType) & 0x1fff) | ((trap << 4) & 0x6000));
if (find_desc(tm) >= 0)
printf("WARNING: InsTime(): Task re-inserted\n");
else {

View File

@ -2189,14 +2189,14 @@ static void gen_opcode (unsigned long int opcode)
case i_CINVA:
/* gb-- srcreg now contains the cache field */
printf ("\tif (srcreg&0x2)\n");
printf ("\t\tflush_icache(%d);\n", 30 + ((opcode >> 3) & 3));
printf ("\t\tflush_icache(%d);\n", (int)(30 + ((opcode >> 3) & 3)));
break;
case i_CPUSHL:
case i_CPUSHP:
case i_CPUSHA:
/* gb-- srcreg now contains the cache field */
printf ("\tif (srcreg&0x2)\n");
printf ("\t\tflush_icache(%d);\n", 40 + ((opcode >> 3) & 3));
printf ("\t\tflush_icache(%d);\n", (int)(40 + ((opcode >> 3) & 3)));
break;
case i_MOVE16:
if ((opcode & 0xfff8) == 0xf620) {

View File

@ -48,6 +48,23 @@ uint8 monitor_desc::next_slot_id = 0x80;
vector<monitor_desc *> VideoMonitors;
/*
* Converts a video_depth to a C-String name ("VDEPTH_1BIT", "VDEPTH_2BIT", etc.)
*/
const char * NameOfDepth(video_depth depth)
{
switch (depth) {
case VDEPTH_1BIT: return "VDEPTH_1BIT";
case VDEPTH_2BIT: return "VDEPTH_2BIT";
case VDEPTH_4BIT: return "VDEPTH_4BIT";
case VDEPTH_8BIT: return "VDEPTH_8BIT";
case VDEPTH_16BIT: return "VDEPTH_16BIT";
case VDEPTH_32BIT: return "VDEPTH_32BIT";
}
return "";
}
/*
* Find palette size for given color depth
*/

View File

@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string>SheepShaver.icns</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.SheepShaverLauncher</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -10,7 +10,7 @@
084186B10B3A0515004B1F63 /* VMSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 084186B00B3A0515004B1F63 /* VMSettingsController.mm */; };
088EBBB61B41AEBB0066D352 /* DiskType.m in Sources */ = {isa = PBXBuildFile; fileRef = 088EBBB51B41AEBB0066D352 /* DiskType.m */; };
08AAB16D102614D5007E1230 /* SheepShaver.icns in Resources */ = {isa = PBXBuildFile; fileRef = 08AAB16C102614D5007E1230 /* SheepShaver.icns */; };
08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */ = {isa = PBXBuildFile; fileRef = 08AAB1B11026168B007E1230 /* SheepShaver */; };
08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */ = {isa = PBXBuildFile; fileRef = 08AAB1B11026168B007E1230 /* SheepShaver */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
08B5FAFD102497FA0047FD1B /* VMSettingsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFB102497FA0047FD1B /* VMSettingsWindow.nib */; };
08B5FB01102498B00047FD1B /* VMListWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFF102498B00047FD1B /* VMListWindow.nib */; };
08B5FB221024FE320047FD1B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08B5FB211024FE320047FD1B /* AppController.mm */; };
@ -209,6 +209,9 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverLauncher" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
@ -310,11 +313,13 @@
PREFS_EDITOR,
STANDALONE_PREFS,
);
GCC_VERSION = 4.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_CFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverLauncher;
PRODUCT_NAME = SheepShaverLauncher;
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
@ -324,11 +329,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
ppc,
i386,
x86_64,
);
COPY_PHASE_STRIP = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
@ -337,15 +337,17 @@
PREFS_EDITOR,
STANDALONE_PREFS,
);
GCC_VERSION = 4.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
"GCC_VERSION[arch=x86_64]" = 4.2;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
"MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5;
OTHER_CFLAGS = "$(inherited)";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverLauncher;
PRODUCT_NAME = SheepShaverLauncher;
"SDKROOT[arch=x86_64]" = macosx10.6;
SDKROOT = macosx;
"SDKROOT[arch=x86_64]" = macosx10.13;
WRAPPER_EXTENSION = app;
};
name = Release;
@ -353,8 +355,33 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
};
@ -363,10 +390,33 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREFIX_HEADER = LauncherPrefix.h;
GCC_VERSION = 4.0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
};

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.SheepShaverPrefs</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -54,12 +54,12 @@ void prefs_exit()
return self;
}
- (int)numberOfRowsInTableView:(NSTableView *)aTable
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTable
{
return [diskArray count];
}
- (id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(int)aRow
- (id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow
{
return [diskArray objectAtIndex: aRow];
}

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
@ -161,10 +161,19 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverPrefs" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = en;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* SheepShaverPrefs */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* SheepShaverPrefs */,
);
@ -234,7 +243,9 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_CFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverPrefs;
PRODUCT_NAME = SheepShaverPrefs;
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
@ -243,10 +254,6 @@
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_MODEL_TUNING = G5;
@ -257,7 +264,9 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_CFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.SheepShaverPrefs;
PRODUCT_NAME = SheepShaverPrefs;
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
};
name = Release;
@ -265,20 +274,66 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
};
name = Release;
};

153
SheepShaver/src/Unix/configure.ac Normal file → Executable file
View File

@ -46,7 +46,7 @@ AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [d
esac],
[WANT_GTK="gtk2 gtk"])
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes or 'precompiled'], [DYNGEN_CC=$withval])
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval])
AC_ARG_WITH(bincue,
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
@ -72,6 +72,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphic
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], [])
dnl Checks for programs.
AC_PROG_CC
@ -144,7 +145,7 @@ dnl Checks for libraries.
AC_CHECK_LIB(posix4, sem_init)
AC_CHECK_LIB(m, cos)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES, $3=ACTION_IF_SUCCESSFUL, $4=ACTION_IF_UNSUCCESSFUL)
dnl AC_TRY_LINK uses main() but SDL needs main to take args,
dnl therefore main is undefined with #undef.
dnl Framework can be in an custom location.
@ -154,18 +155,16 @@ AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
ac_Framework, [
saved_LIBS="$LIBS"
LIBS="$LIBS -framework $1"
if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/$1.framework/Headers"
AC_TRY_LINK(
[$2
#undef main], [],
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
[AS_VAR_SET(ac_Framework, yes); $3], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"; $4]
)
])
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
@ -189,27 +188,65 @@ if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
fi
if [[ "x$WANT_SDL" = "xyes" ]]; then
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL, [#include <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`
TEMP_WANT_SDL_VERSION_MAJOR=$WANT_SDL_VERSION_MAJOR
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x" ]]; then
TEMP_WANT_SDL_VERSION_MAJOR=2
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
AC_PATH_PROG(sdl2_config, "sdl2-config")
if [[ -n "$sdl2_config" ]]; then
sdl2_cflags=`$sdl2_config --cflags`
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
sdl2_libs=`$sdl2_config --static-libs`
else
sdl2_libs=`$sdl2_config --libs`
fi
CFLAGS="$CFLAGS $sdl2_cflags"
CXXFLAGS="$CXXFLAGS $sdl2_cflags"
LIBS="$LIBS $sdl2_libs"
WANT_SDL_VERSION_MAJOR=2
else
sdl_libs=`$sdl_config --libs`
TEMP_WANT_SDL_VERSION_MAJOR=1
fi
fi
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x1" ]]; then
AC_PATH_PROG(sdl_config, "sdl-config")
if [[ -n "$sdl_config" ]]; then
sdl_cflags=`$sdl_config --cflags`
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
sdl_libs=`$sdl_config --static-libs`
else
sdl_libs=`$sdl_config --libs`
fi
CFLAGS="$CFLAGS $sdl_cflags"
CXXFLAGS="$CXXFLAGS $sdl_cflags"
LIBS="$LIBS $sdl_libs"
WANT_SDL_VERSION_MAJOR=1
else
WANT_SDL=no
WANT_SDL_VIDEO=no
WANT_SDL_AUDIO=no
fi
CFLAGS="$CFLAGS $sdl_cflags"
CXXFLAGS="$CXXFLAGS $sdl_cflags"
LIBS="$LIBS $sdl_libs"
else
WANT_SDL=no
WANT_SDL_VIDEO=no
WANT_SDL_AUDIO=no
SDL_SUPPORT="none"
fi
fi
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
@ -658,12 +695,10 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
AS_IF([test "x$have_bincue" = "xyes" ], [
if [[ "xOSX_CORE_AUDIO" = "xno" -a "x$WANT_SDL_AUDIO"="xno" ]]; then
AC_MSG_ERROR([You need SDL or OSX Core Audio to use BINCUE support.])
AC_SUBST(USE_BINCUE, no)
else
CPPFLAGS="$CPPFLAGS -DBINCUE $OSX_CORE_AUDIO"
AC_SUBST(USE_BINCUE, yes)
fi
], [AC_SUBST(USE_BINCUE, no)])
])
dnl LIBVHD
AS_IF([test "x$with_libvhd" = "xyes" ], [have_libvhd=yes], [have_libvhd=no])
@ -705,13 +740,10 @@ AC_SUBST(SLIRP_SRCS)
dnl SDL overrides
if [[ "x$WANT_SDL" = "xyes" ]]; then
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m"
fi
fi
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.])
VIDEOSRCS="../SDL/video_sdl.cpp"
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp"
KEYCODES="../SDL/keycodes"
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
AC_MSG_CHECKING([whether __LP64__ is defined])
@ -1435,17 +1467,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
[AC_MSG_RESULT(yes); HAVE_GCC30=yes],
[AC_MSG_RESULT(no)])
dnl Check for GCC 4.0 or higher.
HAVE_GCC40=no
AC_MSG_CHECKING(for GCC 4.0 or higher)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 4)
# error gcc < 4
typedef syntax error;
#endif
]])],
[AC_MSG_RESULT(yes); HAVE_GCC40=yes],
[AC_MSG_RESULT(no)])
dnl Check for ICC.
AC_MSG_CHECKING(for ICC)
HAVE_ICC=no
@ -1518,7 +1539,6 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then
dnl Enable JIT compiler, if possible
if [[ "x$WANT_JIT" = "xyes" ]]; then
ac_cv_use_dyngen_precompiled=no
AC_CACHE_CHECK([whether dyngen can be used],
ac_cv_use_dyngen, [
case $host_cpu:$ac_cv_object_format in
@ -1549,30 +1569,20 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then
esac
dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
if [[ -z "$DYNGEN_CC" ]]; then
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_GCC40" = "xno" -a "x$HAVE_ICC" = "xno" ]]; then
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
DYNGEN_CC=$CXX
elif command -v g++ >/dev/null; then
vers=`g++ -dumpversion`
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [[ $(version $vers) -ge $(version "2.7.0") ]] && [[ $(version $vers) -lt $(version "4.0.0") ]]; then
DYNGEN_CC="$gxx"
fi
else
for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
gxx="$p/g++"
if [[ -x "$gxx" ]]; then
DYNGEN_CC="$gxx"
fi
done
fi
fi
if [[ -z "$DYNGEN_CC" -o "x$DYNGEN_CC" = "xprecompiled" ]]; then
case $host_cpu in
i?86)
ac_cv_use_dyngen_precompiled=yes
;;
x86_64)
ac_cv_use_dyngen_precompiled=yes
;;
*)
ac_cv_use_dyngen=no
;;
esac
if [[ -z "$DYNGEN_CC" ]]; then
ac_cv_use_dyngen=no
fi
if [[ "x$ac_cv_use_dyngen_precompiled" = "xyes" ]]; then DYNGEN_CC=precompiled; fi
])
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
case $host_cpu in
@ -1589,17 +1599,10 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then
;;
esac
have_dyngen_gcc3=no
if [[ "$DYNGEN_CC" != "precompiled" ]]; then
case "x`$DYNGEN_CC -dumpversion`" in
x[12].*) ;;
x*) have_dyngen_gcc3=yes ;;
esac
else
case "x`$CXX -dumpversion`" in
x[12].*) ;;
x*) have_dyngen_gcc3=yes ;;
esac
fi
case "x`$DYNGEN_CC -dumpversion`" in
x[12].*) ;;
x*) have_dyngen_gcc3=yes ;;
esac
if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions"
else
@ -1683,7 +1686,6 @@ AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
dnl Generate Makefile.
AC_SUBST(PERL)
AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
AC_SUBST(USE_DYNGEN_PRECOMPILED, [$ac_cv_use_dyngen_precompiled])
AC_SUBST(DYNGENSRCS)
AC_SUBST(DYNGEN_CC)
AC_SUBST(DYNGEN_CFLAGS)
@ -1703,6 +1705,7 @@ echo
echo SheepShaver configuration summary:
echo
echo SDL support ...................... : $SDL_SUPPORT
echo SDL major-version ................ : $WANT_SDL_VERSION_MAJOR
echo BINCUE support ................... : $have_bincue
echo LIBVHD support ................... : $have_libvhd
echo FBDev DGA support ................ : $WANT_FBDEV_DGA

View File

@ -41,6 +41,9 @@ prefs_desc platform_prefs_items[] = {
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
#endif
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
#ifdef USE_SDL_VIDEO
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
#endif
{NULL, TYPE_END, false, NULL} // End of list
};

View File

@ -149,7 +149,7 @@ typedef long int32;
#error "No 4 byte type, you lose."
#endif
#if SIZEOF_LONG == 8
typedef unsigned long uint64;
typedef uint64_t uint64;
typedef long int64;
#define VAL64(a) (a ## l)
#define UVAL64(a) (a ## ul)
@ -429,7 +429,7 @@ typedef struct timeval tm_time_t;
// Timing functions
extern uint64 GetTicks_usec(void);
extern void Delay_usec(uint32 usec);
extern void Delay_usec(uint64 usec);
#ifdef HAVE_PTHREADS
// Setup pthread attributes

View File

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

View File

@ -0,0 +1,401 @@
/*
* timer_unix.cpp - Time Manager emulation, Unix specific stuff
*
* Basilisk II (C) 1997-2008 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "macos_util.h"
#include "timer.h"
#include <errno.h>
#define DEBUG 0
#include "debug.h"
// For NetBSD with broken pthreads headers
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
#if defined(__MACH__)
#include <mach/mach.h>
#include <mach/clock.h>
static clock_serv_t host_clock;
static bool host_clock_inited = false;
static inline void mach_current_time(tm_time_t &t) {
if(!host_clock_inited) {
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &host_clock);
host_clock_inited = true;
}
clock_get_time(host_clock, (mach_timespec_t *)&t);
}
#endif
/*
* Return microseconds since boot (64 bit)
*/
void Microseconds(uint32 &hi, uint32 &lo)
{
D(bug("Microseconds\n"));
#if defined(__MACH__)
tm_time_t t;
mach_current_time(t);
uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000;
#elif defined(HAVE_CLOCK_GETTIME)
struct timespec t;
clock_gettime(CLOCK_REALTIME, &t);
uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000;
#else
struct timeval t;
gettimeofday(&t, NULL);
uint64 tl = (uint64)t.tv_sec * 1000000 + t.tv_usec;
#endif
hi = tl >> 32;
lo = tl;
}
/*
* Return local date/time in Mac format (seconds since 1.1.1904)
*/
uint32 TimerDateTime(void)
{
return TimeToMacTime(time(NULL));
}
/*
* Get current time
*/
void timer_current_time(tm_time_t &t)
{
#if defined(__MACH__)
mach_current_time(t);
#elif defined(HAVE_CLOCK_GETTIME)
clock_gettime(CLOCK_REALTIME, &t);
#else
gettimeofday(&t, NULL);
#endif
}
/*
* Add times
*/
void timer_add_time(tm_time_t &res, tm_time_t a, tm_time_t b)
{
#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__)
res.tv_sec = a.tv_sec + b.tv_sec;
res.tv_nsec = a.tv_nsec + b.tv_nsec;
if (res.tv_nsec >= 1000000000) {
res.tv_sec++;
res.tv_nsec -= 1000000000;
}
#else
res.tv_sec = a.tv_sec + b.tv_sec;
res.tv_usec = a.tv_usec + b.tv_usec;
if (res.tv_usec >= 1000000) {
res.tv_sec++;
res.tv_usec -= 1000000;
}
#endif
}
/*
* Subtract times
*/
void timer_sub_time(tm_time_t &res, tm_time_t a, tm_time_t b)
{
#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__)
res.tv_sec = a.tv_sec - b.tv_sec;
res.tv_nsec = a.tv_nsec - b.tv_nsec;
if (res.tv_nsec < 0) {
res.tv_sec--;
res.tv_nsec += 1000000000;
}
#else
res.tv_sec = a.tv_sec - b.tv_sec;
res.tv_usec = a.tv_usec - b.tv_usec;
if (res.tv_usec < 0) {
res.tv_sec--;
res.tv_usec += 1000000;
}
#endif
}
/*
* Compare times (<0: a < b, =0: a = b, >0: a > b)
*/
int timer_cmp_time(tm_time_t a, tm_time_t b)
{
#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__)
if (a.tv_sec == b.tv_sec)
return a.tv_nsec - b.tv_nsec;
else
return a.tv_sec - b.tv_sec;
#else
if (a.tv_sec == b.tv_sec)
return a.tv_usec - b.tv_usec;
else
return a.tv_sec - b.tv_sec;
#endif
}
/*
* Convert Mac time value (>0: microseconds, <0: microseconds) to tm_time_t
*/
void timer_mac2host_time(tm_time_t &res, int32 mactime)
{
#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__)
if (mactime > 0) {
// Time in milliseconds
res.tv_sec = mactime / 1000;
res.tv_nsec = (mactime % 1000) * 1000000;
} else {
// Time in negative microseconds
res.tv_sec = -mactime / 1000000;
res.tv_nsec = (-mactime % 1000000) * 1000;
}
#else
if (mactime > 0) {
// Time in milliseconds
res.tv_sec = mactime / 1000;
res.tv_usec = (mactime % 1000) * 1000;
} else {
// Time in negative microseconds
res.tv_sec = -mactime / 1000000;
res.tv_usec = -mactime % 1000000;
}
#endif
}
/*
* Convert positive tm_time_t to Mac time value (>0: microseconds, <0: microseconds)
* A negative input value for hosttime results in a zero return value
* As long as the microseconds value fits in 32 bit, it must not be converted to milliseconds!
*/
int32 timer_host2mac_time(tm_time_t hosttime)
{
if (hosttime.tv_sec < 0)
return 0;
else {
#if defined(HAVE_CLOCK_GETTIME) || defined(__MACH__)
uint64 t = (uint64)hosttime.tv_sec * 1000000 + hosttime.tv_nsec / 1000;
#else
uint64 t = (uint64)hosttime.tv_sec * 1000000 + hosttime.tv_usec;
#endif
if (t > 0x7fffffff)
return t / 1000; // Time in milliseconds
else
return -t; // Time in negative microseconds
}
}
/*
* Get current value of microsecond timer
*/
uint64 GetTicks_usec(void)
{
#if defined(__MACH__)
tm_time_t t;
mach_current_time(t);
return (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000;
#elif defined(HAVE_CLOCK_GETTIME)
struct timespec t;
clock_gettime(CLOCK_REALTIME, &t);
return (uint64)t.tv_sec * 1000000 + t.tv_nsec / 1000;
#else
struct timeval t;
gettimeofday(&t, NULL);
return (uint64)t.tv_sec * 1000000 + t.tv_usec;
#endif
}
/*
* Delay by specified number of microseconds (<1 second)
* (adapted from SDL_Delay() source; this function is designed to provide
* the highest accuracy possible)
*/
#if defined(linux)
// Linux select() changes its timeout parameter upon return to contain
// the remaining time. Most other unixen leave it unchanged or undefined.
#define SELECT_SETS_REMAINING
#elif defined(__FreeBSD__) || defined(__sun__) || (defined(__MACH__) && defined(__APPLE__))
#define USE_NANOSLEEP
#elif defined(HAVE_PTHREADS) && defined(sgi)
// SGI pthreads has a bug when using pthreads+signals+nanosleep,
// so instead of using nanosleep, wait on a CV which is never signalled.
#include <pthread.h>
#define USE_COND_TIMEDWAIT
#endif
void Delay_usec(uint64 usec)
{
int was_error;
#if defined(USE_NANOSLEEP)
struct timespec elapsed, tv;
#elif defined(USE_COND_TIMEDWAIT)
// Use a local mutex and cv, so threads remain independent
pthread_cond_t delay_cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t delay_mutex = PTHREAD_MUTEX_INITIALIZER;
struct timespec elapsed;
uint64 future;
#else
struct timeval tv;
#ifndef SELECT_SETS_REMAINING
uint64 then, now, elapsed;
#endif
#endif
// Set the timeout interval - Linux only needs to do this once
#if defined(SELECT_SETS_REMAINING)
tv.tv_sec = 0;
tv.tv_usec = usec;
#elif defined(USE_NANOSLEEP)
elapsed.tv_sec = 0;
elapsed.tv_nsec = usec * 1000;
#elif defined(USE_COND_TIMEDWAIT)
future = GetTicks_usec() + usec;
elapsed.tv_sec = future / 1000000;
elapsed.tv_nsec = (future % 1000000) * 1000;
#else
then = GetTicks_usec();
#endif
do {
errno = 0;
#if defined(USE_NANOSLEEP)
tv.tv_sec = elapsed.tv_sec;
tv.tv_nsec = elapsed.tv_nsec;
was_error = nanosleep(&tv, &elapsed);
#elif defined(USE_COND_TIMEDWAIT)
was_error = pthread_mutex_lock(&delay_mutex);
was_error = pthread_cond_timedwait(&delay_cond, &delay_mutex, &elapsed);
was_error = pthread_mutex_unlock(&delay_mutex);
#else
#ifndef SELECT_SETS_REMAINING
// Calculate the time interval left (in case of interrupt)
now = GetTicks_usec();
elapsed = now - then;
then = now;
if (elapsed >= usec)
break;
usec -= elapsed;
tv.tv_sec = 0;
tv.tv_usec = usec;
#endif
was_error = select(0, NULL, NULL, NULL, &tv);
#endif
} while (was_error && (errno == EINTR));
}
/*
* Suspend emulator thread, virtual CPU in idle mode
*/
#ifdef HAVE_PTHREADS
#if defined(HAVE_PTHREAD_COND_INIT)
#define IDLE_USES_COND_WAIT 1
static pthread_mutex_t idle_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t idle_cond = PTHREAD_COND_INITIALIZER;
#elif defined(HAVE_SEM_INIT)
#define IDLE_USES_SEMAPHORE 1
#include <semaphore.h>
#ifdef HAVE_SPINLOCKS
static spinlock_t idle_lock = SPIN_LOCK_UNLOCKED;
#define LOCK_IDLE spin_lock(&idle_lock)
#define UNLOCK_IDLE spin_unlock(&idle_lock)
#else
static pthread_mutex_t idle_lock = PTHREAD_MUTEX_INITIALIZER;
#define LOCK_IDLE pthread_mutex_lock(&idle_lock)
#define UNLOCK_IDLE pthread_mutex_unlock(&idle_lock)
#endif
static sem_t idle_sem;
static int idle_sem_ok = -1;
#endif
#endif
void idle_wait(void)
{
#ifdef IDLE_USES_COND_WAIT
pthread_mutex_lock(&idle_lock);
pthread_cond_wait(&idle_cond, &idle_lock);
pthread_mutex_unlock(&idle_lock);
#else
#ifdef IDLE_USES_SEMAPHORE
LOCK_IDLE;
if (idle_sem_ok < 0)
idle_sem_ok = (sem_init(&idle_sem, 0, 0) == 0);
if (idle_sem_ok > 0) {
idle_sem_ok++;
UNLOCK_IDLE;
sem_wait(&idle_sem);
return;
}
UNLOCK_IDLE;
#endif
// Fallback: sleep 10 ms
Delay_usec(10000);
#endif
}
/*
* Resume execution of emulator thread, events just arrived
*/
void idle_resume(void)
{
#ifdef IDLE_USES_COND_WAIT
pthread_cond_signal(&idle_cond);
#else
#ifdef IDLE_USES_SEMAPHORE
LOCK_IDLE;
if (idle_sem_ok > 1) {
idle_sem_ok--;
UNLOCK_IDLE;
sem_post(&idle_sem);
return;
}
UNLOCK_IDLE;
#endif
#endif
}

View File

@ -65,7 +65,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \
../macos_util.cpp ../timer.cpp timer_windows.cpp ../xpram.cpp xpram_windows.cpp \
../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp ../dummy/scsi_dummy.cpp \
../gfxaccel.cpp ../video.cpp ../SDL/video_sdl.cpp video_blit.cpp \
../gfxaccel.cpp ../video.cpp ../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp video_blit.cpp \
../audio.cpp ../SDL/audio_sdl.cpp ../ether.cpp ether_windows.cpp \
../thunks.cpp ../serial.cpp serial_windows.cpp ../extfs.cpp extfs_windows.cpp \
about_window_windows.cpp ../user_strings.cpp user_strings_windows.cpp \

View File

@ -1 +0,0 @@
../../BasiliskII/src/adb.cpp

460
SheepShaver/src/adb.cpp Normal file
View File

@ -0,0 +1,460 @@
/*
* adb.cpp - ADB emulation (mouse/keyboard)
*
* Basilisk II (C) Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* SEE ALSO
* Inside Macintosh: Devices, chapter 5 "ADB Manager"
* Technote HW 01: "ADB - The Untold Story: Space Aliens Ate My Mouse"
*/
#include <stdlib.h>
#include "sysdeps.h"
#include "cpu_emulation.h"
#include "emul_op.h"
#include "main.h"
#include "prefs.h"
#include "video.h"
#include "adb.h"
#ifdef POWERPC_ROM
#include "thunks.h"
#endif
#define DEBUG 0
#include "debug.h"
// Global variables
static int mouse_x = 0, mouse_y = 0; // Mouse position
static int old_mouse_x = 0, old_mouse_y = 0;
static bool mouse_button[3] = {false, false, false}; // Mouse button states
static bool old_mouse_button[3] = {false, false, false};
static bool relative_mouse = false;
static uint8 key_states[16]; // Key states (Mac keycodes)
#define MATRIX(code) (key_states[code >> 3] & (1 << (~code & 7)))
// Keyboard event buffer (Mac keycodes with up/down flag)
const int KEY_BUFFER_SIZE = 16;
static uint8 key_buffer[KEY_BUFFER_SIZE];
static unsigned int key_read_ptr = 0, key_write_ptr = 0;
static uint8 mouse_reg_3[2] = {0x63, 0x01}; // Mouse ADB register 3
static uint8 key_reg_2[2] = {0xff, 0xff}; // Keyboard ADB register 2
static uint8 key_reg_3[2] = {0x62, 0x05}; // Keyboard ADB register 3
static uint8 m_keyboard_type = 0x05;
// ADB mouse motion lock (for platforms that use separate input thread)
static B2_mutex *mouse_lock;
/*
* Initialize ADB emulation
*/
void ADBInit(void)
{
mouse_lock = B2_create_mutex();
m_keyboard_type = (uint8)PrefsFindInt32("keyboardtype");
key_reg_3[1] = m_keyboard_type;
}
/*
* Exit ADB emulation
*/
void ADBExit(void)
{
if (mouse_lock) {
B2_delete_mutex(mouse_lock);
mouse_lock = NULL;
}
}
/*
* ADBOp() replacement
*/
void ADBOp(uint8 op, uint8 *data)
{
D(bug("ADBOp op %02x, data %02x %02x %02x\n", op, data[0], data[1], data[2]));
// ADB reset?
if ((op & 0x0f) == 0) {
mouse_reg_3[0] = 0x63;
mouse_reg_3[1] = 0x01;
key_reg_2[0] = 0xff;
key_reg_2[1] = 0xff;
key_reg_3[0] = 0x62;
key_reg_3[1] = m_keyboard_type;
return;
}
// Cut op into fields
uint8 adr = op >> 4;
uint8 cmd = (op >> 2) & 3;
uint8 reg = op & 3;
// Check which device was addressed and act accordingly
if (adr == (mouse_reg_3[0] & 0x0f)) {
// Mouse
if (cmd == 2) {
// Listen
switch (reg) {
case 3: // Address/HandlerID
if (data[2] == 0xfe) // Change address
mouse_reg_3[0] = (mouse_reg_3[0] & 0xf0) | (data[1] & 0x0f);
else if (data[2] == 1 || data[2] == 2 || data[2] == 4) // Change device handler ID
mouse_reg_3[1] = data[2];
else if (data[2] == 0x00) // Change address and enable bit
mouse_reg_3[0] = (mouse_reg_3[0] & 0xd0) | (data[1] & 0x2f);
break;
}
} else if (cmd == 3) {
// Talk
switch (reg) {
case 1: // Extended mouse protocol
data[0] = 8;
data[1] = 'a'; // Identifier
data[2] = 'p';
data[3] = 'p';
data[4] = 'l';
data[5] = 300 >> 8; // Resolution (dpi)
data[6] = 300 & 0xff;
data[7] = 1; // Class (mouse)
data[8] = 3; // Number of buttons
break;
case 3: // Address/HandlerID
data[0] = 2;
data[1] = (mouse_reg_3[0] & 0xf0) | (rand() & 0x0f);
data[2] = mouse_reg_3[1];
break;
default:
data[0] = 0;
break;
}
}
D(bug(" mouse reg 3 %02x%02x\n", mouse_reg_3[0], mouse_reg_3[1]));
} else if (adr == (key_reg_3[0] & 0x0f)) {
// Keyboard
if (cmd == 2) {
// Listen
switch (reg) {
case 2: // LEDs/Modifiers
key_reg_2[0] = data[1];
key_reg_2[1] = data[2];
break;
case 3: // Address/HandlerID
if (data[2] == 0xfe) // Change address
key_reg_3[0] = (key_reg_3[0] & 0xf0) | (data[1] & 0x0f);
else if (data[2] == 0x00) // Change address and enable bit
key_reg_3[0] = (key_reg_3[0] & 0xd0) | (data[1] & 0x2f);
break;
}
} else if (cmd == 3) {
// Talk
switch (reg) {
case 2: { // LEDs/Modifiers
uint8 reg2hi = 0xff;
uint8 reg2lo = key_reg_2[1] | 0xf8;
if (MATRIX(0x6b)) // Scroll Lock
reg2lo &= ~0x40;
if (MATRIX(0x47)) // Num Lock
reg2lo &= ~0x80;
if (MATRIX(0x37)) // Command
reg2hi &= ~0x01;
if (MATRIX(0x3a)) // Option
reg2hi &= ~0x02;
if (MATRIX(0x38)) // Shift
reg2hi &= ~0x04;
if (MATRIX(0x36)) // Control
reg2hi &= ~0x08;
if (MATRIX(0x39)) // Caps Lock
reg2hi &= ~0x20;
if (MATRIX(0x75)) // Delete
reg2hi &= ~0x40;
data[0] = 2;
data[1] = reg2hi;
data[2] = reg2lo;
break;
}
case 3: // Address/HandlerID
data[0] = 2;
data[1] = (key_reg_3[0] & 0xf0) | (rand() & 0x0f);
data[2] = key_reg_3[1];
break;
default:
data[0] = 0;
break;
}
}
D(bug(" keyboard reg 3 %02x%02x\n", key_reg_3[0], key_reg_3[1]));
} else // Unknown address
if (cmd == 3)
data[0] = 0; // Talk: 0 bytes of data
}
/*
* Mouse was moved (x/y are absolute or relative, depending on ADBSetRelMouseMode())
*/
void ADBMouseMoved(int x, int y)
{
B2_lock_mutex(mouse_lock);
if (relative_mouse) {
mouse_x += x; mouse_y += y;
} else {
mouse_x = x; mouse_y = y;
}
B2_unlock_mutex(mouse_lock);
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
/*
* Mouse button pressed
*/
void ADBMouseDown(int button)
{
mouse_button[button] = true;
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
/*
* Mouse button released
*/
void ADBMouseUp(int button)
{
mouse_button[button] = false;
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
/*
* Set mouse mode (absolute or relative)
*/
void ADBSetRelMouseMode(bool relative)
{
if (relative_mouse != relative) {
relative_mouse = relative;
mouse_x = mouse_y = 0;
}
}
/*
* Key pressed ("code" is the Mac key code)
*/
void ADBKeyDown(int code)
{
// Add keycode to buffer
key_buffer[key_write_ptr] = code;
key_write_ptr = (key_write_ptr + 1) % KEY_BUFFER_SIZE;
// Set key in matrix
key_states[code >> 3] |= (1 << (~code & 7));
// Trigger interrupt
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
/*
* Key released ("code" is the Mac key code)
*/
void ADBKeyUp(int code)
{
// Add keycode to buffer
key_buffer[key_write_ptr] = code | 0x80; // Key-up flag
key_write_ptr = (key_write_ptr + 1) % KEY_BUFFER_SIZE;
// Clear key in matrix
key_states[code >> 3] &= ~(1 << (~code & 7));
// Trigger interrupt
SetInterruptFlag(INTFLAG_ADB);
TriggerInterrupt();
}
/*
* ADB interrupt function (executed as part of 60Hz interrupt)
*/
void ADBInterrupt(void)
{
M68kRegisters r;
// Return if ADB is not initialized
uint32 adb_base = ReadMacInt32(0xcf8);
if (!adb_base || adb_base == 0xffffffff)
return;
uint32 tmp_data = adb_base + 0x163; // Temporary storage for faked ADB data
// Get mouse state
B2_lock_mutex(mouse_lock);
int mx = mouse_x;
int my = mouse_y;
if (relative_mouse)
mouse_x = mouse_y = 0;
bool mb[3] = {mouse_button[0], mouse_button[1], mouse_button[2]};
B2_unlock_mutex(mouse_lock);
uint32 key_base = adb_base + 4;
uint32 mouse_base = adb_base + 16;
if (relative_mouse) {
// Mouse movement (relative) and buttons
if (mx != 0 || my != 0 || mb[0] != old_mouse_button[0] || mb[1] != old_mouse_button[1] || mb[2] != old_mouse_button[2]) {
// Call mouse ADB handler
if (mouse_reg_3[1] == 4) {
// Extended mouse protocol
WriteMacInt8(tmp_data, 3);
WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mb[0] ? 0 : 0x80));
WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mb[1] ? 0 : 0x80));
WriteMacInt8(tmp_data + 3, ((my >> 3) & 0x70) | ((mx >> 7) & 0x07) | (mb[2] ? 0x08 : 0x88));
} else {
// 100/200 dpi mode
WriteMacInt8(tmp_data, 2);
WriteMacInt8(tmp_data + 1, (my & 0x7f) | (mb[0] ? 0 : 0x80));
WriteMacInt8(tmp_data + 2, (mx & 0x7f) | (mb[1] ? 0 : 0x80));
}
r.a[0] = tmp_data;
r.a[1] = ReadMacInt32(mouse_base);
r.a[2] = ReadMacInt32(mouse_base + 4);
r.a[3] = adb_base;
r.d[0] = (mouse_reg_3[0] << 4) | 0x0c; // Talk 0
Execute68k(r.a[1], &r);
old_mouse_button[0] = mb[0];
old_mouse_button[1] = mb[1];
old_mouse_button[2] = mb[2];
}
} else {
// Update mouse position (absolute)
if (mx != old_mouse_x || my != old_mouse_y) {
#ifdef POWERPC_ROM
static const uint8 proc_template[] = {
0x2f, 0x08, // move.l a0,-(sp)
0x2f, 0x00, // move.l d0,-(sp)
0x2f, 0x01, // move.l d1,-(sp)
0x70, 0x01, // moveq #1,d0 (MoveTo)
0xaa, 0xdb, // CursorDeviceDispatch
M68K_RTS >> 8, M68K_RTS & 0xff
};
BUILD_SHEEPSHAVER_PROCEDURE(proc);
r.a[0] = ReadMacInt32(mouse_base + 4);
r.d[0] = mx;
r.d[1] = my;
Execute68k(proc, &r);
#else
WriteMacInt16(0x82a, mx);
WriteMacInt16(0x828, my);
WriteMacInt16(0x82e, mx);
WriteMacInt16(0x82c, my);
WriteMacInt8(0x8ce, ReadMacInt8(0x8cf)); // CrsrCouple -> CrsrNew
#endif
old_mouse_x = mx;
old_mouse_y = my;
}
// Send mouse button events
if (mb[0] != old_mouse_button[0] || mb[1] != old_mouse_button[1] || mb[2] != old_mouse_button[2]) {
uint32 mouse_base = adb_base + 16;
// Call mouse ADB handler
if (mouse_reg_3[1] == 4) {
// Extended mouse protocol
WriteMacInt8(tmp_data, 3);
WriteMacInt8(tmp_data + 1, mb[0] ? 0 : 0x80);
WriteMacInt8(tmp_data + 2, mb[1] ? 0 : 0x80);
WriteMacInt8(tmp_data + 3, mb[2] ? 0x08 : 0x88);
} else {
// 100/200 dpi mode
WriteMacInt8(tmp_data, 2);
WriteMacInt8(tmp_data + 1, mb[0] ? 0 : 0x80);
WriteMacInt8(tmp_data + 2, mb[1] ? 0 : 0x80);
}
r.a[0] = tmp_data;
r.a[1] = ReadMacInt32(mouse_base);
r.a[2] = ReadMacInt32(mouse_base + 4);
r.a[3] = adb_base;
r.d[0] = (mouse_reg_3[0] << 4) | 0x0c; // Talk 0
Execute68k(r.a[1], &r);
old_mouse_button[0] = mb[0];
old_mouse_button[1] = mb[1];
old_mouse_button[2] = mb[2];
}
}
// Process accumulated keyboard events
while (key_read_ptr != key_write_ptr) {
// Read keyboard event
uint8 mac_code = key_buffer[key_read_ptr];
key_read_ptr = (key_read_ptr + 1) % KEY_BUFFER_SIZE;
// Call keyboard ADB handler
WriteMacInt8(tmp_data, 2);
WriteMacInt8(tmp_data + 1, mac_code);
WriteMacInt8(tmp_data + 2, mac_code == 0x7f ? 0x7f : 0xff); // Power key is special
r.a[0] = tmp_data;
r.a[1] = ReadMacInt32(key_base);
r.a[2] = ReadMacInt32(key_base + 4);
r.a[3] = adb_base;
r.d[0] = (key_reg_3[0] << 4) | 0x0c; // Talk 0
Execute68k(r.a[1], &r);
}
// Clear temporary data
WriteMacInt32(tmp_data, 0);
WriteMacInt32(tmp_data + 4, 0);
}