├── BasiliskII.spec ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile ├── README ├── TECH ├── TODO └── src ├── AmigaOS ├── BasiliskII.info ├── Makefile ├── asm_support.asm ├── audio_amiga.cpp ├── clip_amiga.cpp ├── ether_amiga.cpp ├── extfs_amiga.cpp ├── main_amiga.cpp ├── prefs_amiga.cpp ├── prefs_editor_amiga.cpp ├── scsi_amiga.cpp ├── serial_amiga.cpp ├── sys_amiga.cpp ├── sysdeps.h ├── timer_amiga.cpp ├── user_strings_amiga.cpp ├── user_strings_amiga.h ├── video_amiga.cpp └── xpram_amiga.cpp ├── BeOS ├── Makefile ├── SheepDriver │ ├── Makefile │ ├── sheep_driver.c │ └── sheep_driver.h ├── SheepNet │ ├── Makefile │ ├── sheep_net.cpp │ └── sheep_net.h ├── about_window.cpp ├── about_window.h ├── audio_beos.cpp ├── clip_beos.cpp ├── ether_beos.cpp ├── extfs_beos.cpp ├── main_beos.cpp ├── prefs_beos.cpp ├── prefs_editor_beos.cpp ├── scsi_beos.cpp ├── serial_beos.cpp ├── sys_beos.cpp ├── sysdeps.h ├── timer_beos.cpp ├── user_strings_beos.cpp ├── user_strings_beos.h ├── video_beos.cpp └── xpram_beos.cpp ├── CrossPlatform ├── sigsegv.cpp ├── sigsegv.h ├── video_blit.cpp ├── video_blit.h ├── video_vosf.h ├── vm_alloc.cpp └── vm_alloc.h ├── MacOSX ├── AudioBackEnd.cpp ├── AudioBackEnd.h ├── AudioDevice.cpp ├── AudioDevice.h ├── BasiliskII.icns ├── Controller.h ├── Controller.mm ├── Credits.html ├── Emulator.h ├── Emulator.mm ├── EmulatorView.h ├── EmulatorView.mm ├── English.lproj │ ├── InfoPlist.strings │ └── MainMenu.nib │ │ ├── Collapsed.tiff │ │ ├── Expanded.tiff │ │ ├── classes.nib │ │ ├── info.nib │ │ ├── objects.nib │ │ ├── resetH.tiff │ │ ├── resetN.tiff │ │ ├── shutdownH.tiff │ │ └── shutdownN.tiff ├── HowTo.html ├── Info.plist ├── MacOSX_sound_if.cpp ├── MacOSX_sound_if.h ├── Multiple-Windows │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ ├── MainMenu.nib │ │ │ ├── classes.nib │ │ │ ├── info.nib │ │ │ └── objects.nib │ │ └── Win512x342.nib │ │ │ ├── Collapsed.tiff │ │ │ ├── Expanded.tiff │ │ │ ├── classes.nib │ │ │ ├── info.nib │ │ │ ├── objects.nib │ │ │ ├── resetH.tiff │ │ │ ├── resetN.tiff │ │ │ ├── shutdownH.tiff │ │ │ └── shutdownN.tiff │ └── README ├── NNThread.h ├── NNThread.m ├── PrefsEditor.h ├── PrefsEditor.mm ├── ToDo.html ├── Versions.html ├── audio_defs_macosx.h ├── audio_macosx.cpp ├── autorelease.h ├── clip_macosx.cpp ├── clip_macosx64.mm ├── extfs_macosx.cpp ├── macos_util_macosx.h ├── main_macosx.h ├── main_macosx.mm ├── misc_macosx.h ├── misc_macosx.mm ├── prefs_macosx.cpp ├── sys_darwin.cpp ├── utils_macosx.h ├── utils_macosx.mm ├── video_macosx.h └── video_macosx.mm ├── SDL ├── SDLMain.h ├── SDLMain.m ├── audio_sdl.cpp ├── keycodes └── video_sdl.cpp ├── Unix ├── .gitignore ├── BasiliskII.1 ├── Darwin │ ├── gtk-osx.patch │ ├── lowmem.c │ ├── mkstandalone │ ├── pagezero.c │ └── testlmem.sh ├── FreeBSD │ ├── scsi_freebsd.cpp │ └── scsidump.cpp ├── Irix │ ├── README.networking │ ├── audio_irix.cpp │ └── unaligned.c ├── Linux │ ├── NetDriver │ │ ├── README.md │ │ └── sheep_net.c │ └── scsi_linux.cpp ├── Makefile.in ├── Solaris │ ├── audio_solaris.cpp │ └── which_sparc ├── acinclude.m4 ├── asm_support.s ├── audio_oss_esd.cpp ├── autogen.sh ├── bincue_unix.cpp ├── bincue_unix.h ├── clip_unix.cpp ├── config.guess ├── config.sub ├── configure.ac ├── cpr.sh ├── cpuemu_nf.cpp ├── cpustbl_nf.cpp ├── disk_sparsebundle.cpp ├── disk_unix.h ├── ether_unix.cpp ├── extfs_unix.cpp ├── fbdevices ├── install-sh ├── keycodes ├── ldscripts │ ├── freebsd-i386.ld │ ├── linux-i386.ld │ ├── linux-ppc.ld │ └── linux-x86_64.ld ├── m4 │ ├── egrep.m4 │ ├── esd.m4 │ ├── gettext.m4 │ ├── gtk-2.0.m4 │ └── gtk.m4 ├── main_unix.cpp ├── mkinstalldirs ├── posix_sem.cpp ├── prefs_editor_gtk.cpp ├── prefs_unix.cpp ├── rpc.h ├── rpc_unix.cpp ├── semaphore.h ├── serial_unix.cpp ├── sshpty.c ├── sshpty.h ├── strlcpy.c ├── strlcpy.h ├── sys_unix.cpp ├── sysdeps.h ├── timer_unix.cpp ├── tinyxml2.cpp ├── tinyxml2.h ├── tunconfig ├── user_strings_unix.cpp ├── user_strings_unix.h ├── vhd_unix.cpp ├── video_x.cpp └── xpram_unix.cpp ├── Windows ├── BasiliskII.DebugJIT.props ├── BasiliskII.ReleaseJIT.props ├── BasiliskII.ico ├── BasiliskII.props ├── BasiliskII.rc ├── BasiliskII.sln ├── BasiliskII.vcxproj ├── BasiliskII.vcxproj.filters ├── BasiliskIIGUI.ico ├── BasiliskIIGUI.rc ├── Makefile.in ├── b2ether │ ├── driver │ │ ├── DEBUG.H │ │ ├── MAKEFILE │ │ ├── OEMSETUP.INF │ │ ├── SOURCES │ │ ├── b2ether.c │ │ ├── b2ether.h │ │ ├── b2ether_openclose.c │ │ ├── b2ether_read.c │ │ └── b2ether_write.c │ ├── inc │ │ ├── b2ether_hl.h │ │ └── ntddpack.h │ ├── multiopt.h │ ├── nt5 │ │ ├── B2Win2k.inf │ │ ├── B2Win7Vista-x64.inf │ │ ├── MAKEFILE │ │ ├── NTDDPACK.H │ │ ├── SOURCES │ │ ├── b2ether.c │ │ ├── b2ether.h │ │ ├── b2ether.rc │ │ ├── b2ether64.sln │ │ ├── b2ether64.vcxproj │ │ ├── b2ether_openclose.c │ │ ├── b2ether_read.c │ │ └── b2ether_write.c │ └── packet32.cpp ├── build68k.vcxproj ├── build68k.vcxproj.filters ├── cd_defs.h ├── cdenable │ ├── cache.cpp │ ├── cache.h │ ├── cdenable.h │ ├── eject_nt.cpp │ ├── eject_nt.h │ ├── ntcd.cpp │ └── ntcd.h ├── clip_windows.cpp ├── config.h ├── configure.ac ├── ether_windows.cpp ├── ether_windows.h ├── extfs_windows.cpp ├── gencomp.vcxproj ├── gencomp.vcxproj.filters ├── gencpu.vcxproj ├── gencpu.vcxproj.filters ├── main_windows.cpp ├── posix_emu.cpp ├── posix_emu.h ├── prefs_editor_gtk.cpp ├── prefs_windows.cpp ├── router │ ├── arp.cpp │ ├── arp.h │ ├── dump.cpp │ ├── dump.h │ ├── dynsockets.cpp │ ├── dynsockets.h │ ├── ftp.cpp │ ├── ftp.h │ ├── icmp.cpp │ ├── icmp.h │ ├── iphelp.cpp │ ├── iphelp.h │ ├── ipsocket.cpp │ ├── ipsocket.h │ ├── mib │ │ ├── interfaces.cpp │ │ ├── interfaces.h │ │ ├── mibaccess.cpp │ │ └── mibaccess.h │ ├── router.cpp │ ├── router.h │ ├── router_types.h │ ├── tcp.cpp │ ├── tcp.h │ ├── udp.cpp │ └── udp.h ├── serial_windows.cpp ├── sys_windows.cpp ├── sysdeps.h ├── timer_windows.cpp ├── user_strings_windows.cpp ├── user_strings_windows.h ├── util_windows.cpp ├── util_windows.h └── xpram_windows.cpp ├── adb.cpp ├── audio.cpp ├── cdrom.cpp ├── disk.cpp ├── dummy ├── audio_dummy.cpp ├── clip_dummy.cpp ├── ether_dummy.cpp ├── prefs_dummy.cpp ├── prefs_editor_dummy.cpp ├── scsi_dummy.cpp ├── serial_dummy.cpp ├── user_strings_dummy.cpp └── xpram_dummy.cpp ├── emul_op.cpp ├── ether.cpp ├── extfs.cpp ├── guichan ├── guichan-gui.cpp ├── menuLoad_guichan.cpp ├── menuTabDisplaySound.cpp ├── menuTabMisc.cpp ├── menuTabNetwork.cpp ├── menuTabVolumes.cpp ├── rw_config.cpp └── rw_config.h ├── include ├── adb.h ├── audio.h ├── audio_defs.h ├── cdrom.h ├── clip.h ├── debug.h ├── disk.h ├── emul_op.h ├── ether.h ├── ether_defs.h ├── extfs.h ├── extfs_defs.h ├── macos_util.h ├── main.h ├── pict.h ├── prefs.h ├── prefs_editor.h ├── rom_patches.h ├── rsrc_patches.h ├── scsi.h ├── serial.h ├── serial_defs.h ├── slot_rom.h ├── sony.h ├── sys.h ├── timer.h ├── user_strings.h ├── version.h ├── video.h ├── video_defs.h └── xpram.h ├── macos_util.cpp ├── main.cpp ├── native_cpu └── cpu_emulation.h ├── pict.c ├── powerrom_cpu ├── cpu_emulation.h └── powerrom_cpu.cpp ├── prefs.cpp ├── prefs_items.cpp ├── rom_patches.cpp ├── rsrc_patches.cpp ├── scsi.cpp ├── serial.cpp ├── slirp ├── COPYRIGHT ├── arp_table.c ├── bootp.c ├── bootp.h ├── cksum.c ├── ctl.h ├── debug.h ├── dhcpv6.c ├── dhcpv6.h ├── dnssearch.c ├── if.c ├── if.h ├── ip.h ├── ip6.h ├── ip6_icmp.c ├── ip6_icmp.h ├── ip6_input.c ├── ip6_output.c ├── ip_icmp.c ├── ip_icmp.h ├── ip_input.c ├── ip_output.c ├── libslirp.h ├── main.h ├── mbuf.c ├── mbuf.h ├── misc.c ├── misc.h ├── ndp_table.c ├── net │ └── eth.h ├── qemu-common.h ├── qemu │ ├── atomic.h │ ├── bswap.h │ ├── compiler.h │ ├── osdep.h │ ├── queue.h │ └── typedefs.h ├── sbuf.c ├── sbuf.h ├── slirp.c ├── slirp.h ├── slirp_config.h ├── socket.c ├── socket.h ├── support.c ├── support.h ├── tcp.h ├── tcp_input.c ├── tcp_output.c ├── tcp_subr.c ├── tcp_timer.c ├── tcp_timer.h ├── tcp_var.h ├── tcpip.h ├── tftp.c ├── tftp.h ├── udp.c ├── udp.h └── udp6.c ├── slot_rom.cpp ├── sony.cpp ├── timer.cpp ├── uae_cpu ├── basilisk_glue.cpp ├── build68k.c ├── compiler │ ├── codegen_x86.cpp │ ├── codegen_x86.h │ ├── compemu.h │ ├── compemu_fpp.cpp │ ├── compemu_support.cpp │ ├── flags_x86.h │ ├── gencomp.c │ └── test_codegen_x86.cpp ├── cpu_emulation.h ├── cpuopti.c ├── fpu │ ├── core.h │ ├── exceptions.cpp │ ├── exceptions.h │ ├── flags.cpp │ ├── flags.h │ ├── fpu.h │ ├── fpu_ieee.cpp │ ├── fpu_ieee.h │ ├── fpu_uae.cpp │ ├── fpu_uae.h │ ├── fpu_x86.cpp │ ├── fpu_x86.h │ ├── fpu_x86_asm.h │ ├── impl.h │ ├── mathlib.cpp │ ├── mathlib.h │ ├── rounding.cpp │ ├── rounding.h │ └── types.h ├── gencpu.c ├── m68k.h ├── memory-mac.h ├── memory.cpp ├── newcpu.cpp ├── newcpu.h ├── noflags.h ├── readcpu.cpp ├── readcpu.h ├── spcflags.h └── table68k ├── user_strings.cpp ├── video.cpp └── xpram.cpp /BasiliskII.spec: -------------------------------------------------------------------------------- 1 | %define name BasiliskII 2 | %define version 1.0rc1 3 | %define release 1 4 | 5 | Summary: 68k Macintosh emulator 6 | Name: %{name} 7 | Version: %{version} 8 | Release: %{release} 9 | License: GPL 10 | Group: Applications/Emulators 11 | Source0: %{name}_src_30062005.tar.gz 12 | URL: http://www.uni-mainz.de/~bauec002/B2Main.html 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | 15 | # While the data file path (/usr/share/BasiliskII) is compiled into the 16 | # executable, the data files are not required for operation and their location 17 | # can be overridden with prefs items, so I consider this package to be 18 | # relocatable. 19 | Prefix: %{_prefix} 20 | 21 | %description 22 | Basilisk II is an Open Source 68k Macintosh emulator. That is, it enables 23 | you to run 68k MacOS software on you computer, even if you are using a 24 | different operating system. However, you still need a copy of MacOS and 25 | a Macintosh ROM image to use Basilisk II. 26 | 27 | Some features of Basilisk II: 28 | - Emulates either a Mac Classic (which runs MacOS 0.x thru 7.5) 29 | or a Mac II series machine (which runs MacOS 7.x, 8.0 and 8.1), 30 | depending on the ROM being used 31 | - Color video display 32 | - CD quality sound output 33 | - Floppy disk driver (only 1.44MB disks supported) 34 | - Driver for HFS partitions and hardfiles 35 | - CD-ROM driver with basic audio functions 36 | - Easy file exchange with the host OS via a "Host Directory Tree" icon 37 | on the Mac desktop 38 | - Ethernet driver 39 | - Serial drivers 40 | - SCSI Manager (old-style) emulation 41 | - Emulates extended ADB keyboard and 3-button mouse 42 | - Uses UAE 68k emulation or (under AmigaOS and NetBSD/m68k) real 68k 43 | processor 44 | 45 | %prep 46 | %setup -q 47 | 48 | %build 49 | cd src/Unix 50 | %configure 51 | make 52 | 53 | %install 54 | rm -rf ${RPM_BUILD_ROOT} 55 | cd src/Unix 56 | %makeinstall 57 | 58 | %clean 59 | rm -rf ${RPM_BUILD_ROOT} 60 | 61 | %files 62 | %defattr(-,root,root) 63 | %doc ChangeLog COPYING INSTALL README TECH TODO 64 | %{_bindir}/BasiliskII 65 | %{_mandir}/man1/BasiliskII.1* 66 | %config %{_datadir}/BasiliskII/keycodes 67 | %config %{_datadir}/BasiliskII/fbdevices 68 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/ChangeLog -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/README -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Bugs: 2 | - System 7.1 with Quadra900 ModelID (1MB ROM): 0x108 gets strange value 3 | - Apple Personal Diagnostics doesn't work with more than 1023 MB 4 | 5 | General: 6 | - Add support for 2MB ROMs (Quadra 840AV) 7 | - Add support for System 6.0.x 8 | - Sony: rdVerify, Tag Buffer 9 | - Disk: rdVerify 10 | - CD-ROM: track lists, positioning type 3, TOC type 4/5, ReadHeader/ReadMCN/ 11 | ReadISRC/ReadAudio/ReadAllSubcodes 12 | - Sound in 13 | - Video: multiple monitor support 14 | - More accurate Time Manager 15 | - Serial driver: XOn/XOff handshaking 16 | - Classic ROM: mouse button/movement is broken with ROM mouse handler 17 | - Classic ROM: sound output 18 | - Write a nice User's Manual with linuxdoc or something similar 19 | - Fix video mode switch to cope with different mac_frame_base 20 | (CrsrBase is overriden with the previous base after the mode switch) 21 | 22 | AmigaOS: 23 | - "Create Hardfile..." button 24 | - Support for ShapeShifter External Video Drivers 25 | - clip_amiga.cpp: clip AmigaOS->Basilisk 26 | - sys_amiga.cpp: MaxTransfer/BufMemType/TransferMask, SysAddCDROMPrefs(), 27 | SysFormat() 28 | - Patch 512K ROM for 68040/060 caches 29 | - Input handler instead of IDCMP? 30 | - Last sound buffer is not played 31 | - Sound output rate/bits/channels switching 32 | 33 | BeOS: 34 | - clip_beos.cpp: clip BeOS->Basilisk 35 | - Last sound buffer is not played 36 | - Sound output rate/bits/channels switching 37 | - Video depth/resolution switching 38 | 39 | Unix: 40 | - sys_unix.cpp: SysFormat(), SysIsFixedDisk(), SysIsDiskInserted(), 41 | prevent/allow for non-floppy/CDROM devices 42 | - ESD is also available on Solaris 43 | - display progress bar during disk file creation in prefs editor 44 | 45 | Mac OS X: 46 | - Sound 47 | - Cut and paste 48 | - Lots of other stuff. See src/MacOSX/ToDo.html 49 | 50 | Windows 51 | - main_windows.cpp: undo the SDL/DIB driver trick 52 | - video_windows.cpp: implement with DirectX 53 | - audio_windows.cpp, scsi_windows.cpp: merge from original Windows version 54 | -------------------------------------------------------------------------------- /src/AmigaOS/BasiliskII.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/AmigaOS/BasiliskII.info -------------------------------------------------------------------------------- /src/AmigaOS/Makefile: -------------------------------------------------------------------------------- 1 | # AmigaOS makefile for Basilisk II (GeekGadgets tool chain) 2 | 3 | ## System specific configuration 4 | CC = gcc 5 | CXX = c++ 6 | CXXFLAGS = -g -O1 -noixemul -m68020 -msmall-code -Wno-multichar 7 | CPPFLAGS = -I../include -I../native_cpu -I. 8 | DEFS = 9 | LDFLAGS = -noixemul 10 | LIBS = /gg/lib/libnix/swapstack.o 11 | AS = PhxAss 12 | ASFLAGS = OPT ! INCPATH GG:os-include FPU=1 13 | 14 | ## Files 15 | SRCS = ../main.cpp main_amiga.cpp ../prefs.cpp ../prefs_items.cpp \ 16 | prefs_amiga.cpp prefs_editor_amiga.cpp sys_amiga.cpp ../rom_patches.cpp \ 17 | ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \ 18 | ../macos_util.cpp ../xpram.cpp xpram_amiga.cpp ../timer.cpp \ 19 | timer_amiga.cpp clip_amiga.cpp ../adb.cpp ../serial.cpp \ 20 | serial_amiga.cpp ../ether.cpp ether_amiga.cpp ../sony.cpp ../disk.cpp \ 21 | ../cdrom.cpp ../scsi.cpp scsi_amiga.cpp ../video.cpp video_amiga.cpp \ 22 | ../audio.cpp audio_amiga.cpp ../extfs.cpp extfs_amiga.cpp \ 23 | ../user_strings.cpp user_strings_amiga.cpp asm_support.asm 24 | APP = BasiliskII 25 | 26 | ## Rules 27 | .PHONY: clean distclean 28 | .SUFFIXES: 29 | .SUFFIXES: .c .cpp .asm .o .h 30 | 31 | all: $(APP) 32 | 33 | OBJ_DIR = obj 34 | $(OBJ_DIR):: 35 | @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 36 | 37 | define SRCS_LIST_TO_OBJS 38 | $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ 39 | $(basename $(notdir $(file)))))) 40 | endef 41 | OBJS = $(SRCS_LIST_TO_OBJS) 42 | 43 | SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) 44 | VPATH := 45 | VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) 46 | 47 | $(APP): $(OBJ_DIR) $(OBJS) 48 | $(CXX) -o $(APP) $(LDFLAGS) $(LIBS) $(OBJS) 49 | 50 | clean: 51 | rm -f $(APP) $(OBJ_DIR)/* *~ *.bak obj.0000.* 52 | 53 | distclean: clean 54 | rm -rf $(OBJ_DIR) 55 | 56 | $(OBJ_DIR)/%.o : %.cpp 57 | $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ 58 | $(OBJ_DIR)/%.o : %.asm 59 | $(AS) $(ASFLAGS) $< TO $(OBJ_DIR)/$*.obj 60 | hunk2aout $(OBJ_DIR)/$*.obj >/dev/null 61 | mv obj.0000.* $@ 62 | 63 | #------------------------------------------------------------------------- 64 | # DO NOT DELETE THIS LINE -- make depend depends on it. 65 | -------------------------------------------------------------------------------- /src/AmigaOS/main_amiga.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/AmigaOS/main_amiga.cpp -------------------------------------------------------------------------------- /src/AmigaOS/prefs_amiga.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * prefs_amiga.cpp - Preferences handling, AmigaOS specifix stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | 23 | #include "sysdeps.h" 24 | #include "prefs.h" 25 | 26 | 27 | // Platform-specific preferences items 28 | prefs_desc platform_prefs_items[] = { 29 | {"sound", TYPE_STRING, false, "sound output mode description"}, 30 | {"scsimemtype", TYPE_INT32, false, "SCSI buffer memory type"}, 31 | {NULL, TYPE_END, false, NULL} // End of list 32 | }; 33 | 34 | 35 | // Prefs file name 36 | const char PREFS_FILE_NAME[] = "ENV:BasiliskII_prefs"; 37 | const char PREFS_FILE_NAME_ARC[] = "ENVARC:BasiliskII_prefs"; 38 | 39 | 40 | /* 41 | * Load preferences from settings file 42 | */ 43 | 44 | void LoadPrefs(void) 45 | { 46 | // Read preferences from settings file 47 | FILE *f = fopen(PREFS_FILE_NAME, "r"); 48 | if (f != NULL) { 49 | 50 | // Prefs file found, load settings 51 | LoadPrefsFromStream(f); 52 | fclose(f); 53 | 54 | } else { 55 | 56 | // No prefs file, save defaults 57 | SavePrefs(); 58 | } 59 | } 60 | 61 | 62 | /* 63 | * Save preferences to settings file 64 | */ 65 | 66 | void SavePrefs(void) 67 | { 68 | FILE *f; 69 | if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) { 70 | SavePrefsToStream(f); 71 | fclose(f); 72 | } 73 | if ((f = fopen(PREFS_FILE_NAME_ARC, "w")) != NULL) { 74 | SavePrefsToStream(f); 75 | fclose(f); 76 | } 77 | } 78 | 79 | 80 | /* 81 | * Add defaults of platform-specific prefs items 82 | * You may also override the defaults set in PrefsInit() 83 | */ 84 | 85 | void AddPlatformPrefsDefaults(void) 86 | { 87 | PrefsReplaceString("extfs", "WORK:"); 88 | PrefsAddInt32("scsimemtype", 0); 89 | } 90 | -------------------------------------------------------------------------------- /src/AmigaOS/sysdeps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sysdeps.h - System dependent definitions for AmigaOS 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef SYSDEPS_H 22 | #define SYSDEPS_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "user_strings_amiga.h" 33 | 34 | // Mac and host address space are the same 35 | #define REAL_ADDRESSING 1 36 | 37 | // Using 68k natively 38 | #define EMULATED_68K 0 39 | 40 | // Mac ROM is not write protected 41 | #define ROM_IS_WRITE_PROTECTED 0 42 | #define USE_SCRATCHMEM_SUBTERFUGE 1 43 | 44 | // ExtFS is supported 45 | #define SUPPORTS_EXTFS 1 46 | 47 | // mon is not supported 48 | #undef ENABLE_MON 49 | 50 | // Data types 51 | typedef unsigned char uint8; 52 | typedef signed char int8; 53 | typedef unsigned short uint16; 54 | typedef signed short int16; 55 | typedef unsigned long uint32; 56 | typedef signed long int32; 57 | typedef unsigned long long uint64; 58 | typedef signed long long int64; 59 | 60 | typedef unsigned long long loff_t; 61 | 62 | // Time data type for Time Manager emulation 63 | typedef struct timeval tm_time_t; 64 | 65 | // Endianess conversion (not needed) 66 | #define ntohs(x) (x) 67 | #define ntohl(x) (x) 68 | #define htons(x) (x) 69 | #define htonl(x) (x) 70 | 71 | // Some systems don't define this (ExecBase->AttnFlags) 72 | #ifndef AFF_68060 73 | #define AFF_68060 (1L<<7) 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/AmigaOS/user_strings_amiga.h: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_amiga.h - AmigaOS-specific localizable strings 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef USER_STRINGS_AMIGA_H 22 | #define USER_STRINGS_AMIGA_H 23 | 24 | enum { 25 | STR_NO_PREPARE_EMUL_ERR = 10000, 26 | STR_NO_GADTOOLS_LIB_ERR, 27 | STR_NO_IFFPARSE_LIB_ERR, 28 | STR_NO_ASL_LIB_ERR, 29 | STR_NO_TIMER_DEV_ERR, 30 | STR_NO_P96_MODE_ERR, 31 | STR_NO_VIDEO_MODE_ERR, 32 | STR_WRONG_SCREEN_DEPTH_ERR, 33 | STR_WRONG_SCREEN_FORMAT_ERR, 34 | STR_ENFORCER_RUNNING_ERR, 35 | 36 | STR_NOT_ETHERNET_WARN, 37 | STR_NO_MULTICAST_WARN, 38 | STR_NO_GTLAYOUT_LIB_WARN, 39 | STR_NO_AHI_WARN, 40 | STR_NO_AHI_CTRL_WARN, 41 | STR_NOT_ENOUGH_MEM_WARN, 42 | 43 | STR_AHI_MODE_CTRL, 44 | STR_SCSI_MEMTYPE_CTRL, 45 | STR_MEMTYPE_CHIP_LAB, 46 | STR_MEMTYPE_24BITDMA_LAB, 47 | STR_MEMTYPE_ANY_LAB, 48 | STR_SCSI_DEVICES_CTRL 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/AmigaOS/xpram_amiga.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram_amiga.cpp - XPRAM handling, AmigaOS specific stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | #define __USE_SYSBASE 23 | #include 24 | #include 25 | 26 | #include "sysdeps.h" 27 | #include "xpram.h" 28 | 29 | 30 | // XPRAM file name 31 | #if POWERPC_ROM 32 | static char XPRAM_FILE_NAME[] = "ENV:SheepShaver_NVRAM"; 33 | static char XPRAM_FILE_NAME_ARC[] = "ENVARC:SheepShaver_NVRAM"; 34 | #else 35 | static char XPRAM_FILE_NAME[] = "ENV:BasiliskII_XPRAM"; 36 | static char XPRAM_FILE_NAME_ARC[] = "ENVARC:BasiliskII_XPRAM"; 37 | #endif 38 | 39 | 40 | /* 41 | * Load XPRAM from settings file 42 | */ 43 | 44 | void LoadXPRAM(void) 45 | { 46 | BPTR fh; 47 | if ((fh = Open(XPRAM_FILE_NAME, MODE_OLDFILE)) != NULL) { 48 | Read(fh, XPRAM, XPRAM_SIZE); 49 | Close(fh); 50 | } 51 | } 52 | 53 | 54 | /* 55 | * Save XPRAM to settings file 56 | */ 57 | 58 | void SaveXPRAM(void) 59 | { 60 | BPTR fh; 61 | if ((fh = Open(XPRAM_FILE_NAME, MODE_NEWFILE)) != NULL) { 62 | Write(fh, XPRAM, XPRAM_SIZE); 63 | Close(fh); 64 | } 65 | if ((fh = Open(XPRAM_FILE_NAME_ARC, MODE_NEWFILE)) != NULL) { 66 | Write(fh, XPRAM, XPRAM_SIZE); 67 | Close(fh); 68 | } 69 | } 70 | 71 | 72 | /* 73 | * Delete PRAM file 74 | */ 75 | 76 | void ZapPRAM(void) 77 | { 78 | DeleteFile(XPRAM_FILE_NAME); 79 | DeleteFile(XPRAM_FILE_NAME_ARC); 80 | } 81 | -------------------------------------------------------------------------------- /src/BeOS/SheepDriver/sheep_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sheep_driver.h - Low memory and ROM access driver for SheepShaver and 3 | * Basilisk II on PowerPC systems 4 | * 5 | * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer 6 | * Basilisk II (C) 1997-2008 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef SHEEP_DRIVER_H 24 | #define SHEEP_DRIVER_H 25 | 26 | #include 27 | 28 | enum { 29 | SHEEP_UP = B_DEVICE_OP_CODES_END + 1, 30 | SHEEP_DOWN 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/BeOS/SheepNet/sheep_net.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sheep_net.h - Net server add-on for SheepShaver and Basilisk II 3 | * 4 | * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer 5 | * Basilisk II (C) 1997-2008 Christian Bauer 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef SHEEP_NET_H 23 | #define SHEEP_NET_H 24 | 25 | // Net buffer dimensions 26 | #define READ_PACKET_COUNT 10 27 | #define WRITE_PACKET_COUNT 10 28 | 29 | // Net packet 30 | struct net_packet { 31 | uint32 cmd; // Command 32 | uint32 length; // Data length 33 | uint32 card; // Network card ID 34 | uint32 reserved; 35 | uint8 data[1584]; 36 | }; 37 | 38 | // Net buffer (shared area) 39 | struct net_buffer { 40 | uint8 ether_addr[6]; // Ethernet address 41 | uint8 filler1[2]; 42 | sem_id read_sem; // Semaphore for read packets 43 | uint32 read_ofs; 44 | uint32 read_packet_size; 45 | uint32 read_packet_count; 46 | sem_id write_sem; // Semaphore for write packets 47 | uint32 write_ofs; 48 | uint32 write_packet_size; 49 | uint32 write_packet_count; 50 | uint8 filler[24]; 51 | net_packet read[READ_PACKET_COUNT]; 52 | net_packet write[WRITE_PACKET_COUNT]; 53 | }; 54 | 55 | // Packet commands 56 | #define SHEEP_PACKET 0 57 | #define ADD_MULTICAST 1 58 | #define REMOVE_MULTICAST 2 59 | #define ACTIVATE_SHEEP_NET 8 60 | #define DEACTIVATE_SHEEP_NET 9 61 | #define SHUTDOWN_SHEEP_NET 10 62 | 63 | #define IN_USE 1 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/BeOS/about_window.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * about_window.cpp - "About" window 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "sysdeps.h" 25 | #include "version.h" 26 | #include "user_strings.h" 27 | 28 | /* 29 | * Display "About" window 30 | */ 31 | 32 | void ShowAboutWindow(void) 33 | { 34 | char str[512]; 35 | sprintf(str, 36 | "Basilisk II\nVersion %d.%d\n\n" 37 | "Copyright " B_UTF8_COPYRIGHT " 1997-2008 Christian Bauer et al.\n" 38 | "E-mail: Christian.Bauer@uni-mainz.de\n" 39 | "http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" 40 | "Basilisk II comes with ABSOLUTELY NO\n" 41 | "WARRANTY. This is free software, and\n" 42 | "you are welcome to redistribute it\n" 43 | "under the terms of the GNU General\n" 44 | "Public License.\n", 45 | VERSION_MAJOR, VERSION_MINOR 46 | ); 47 | BAlert *about = new BAlert("", str, GetString(STR_OK_BUTTON), NULL, NULL, B_WIDTH_FROM_LABEL); 48 | BTextView *theText = about->TextView(); 49 | if (theText) { 50 | theText->SetStylable(true); 51 | theText->Select(0, 11); 52 | BFont ourFont; 53 | theText->SetFontAndColor(be_bold_font); 54 | theText->GetFontAndColor(2, &ourFont, NULL); 55 | ourFont.SetSize(24); 56 | theText->SetFontAndColor(&ourFont); 57 | } 58 | about->Go(); 59 | } 60 | -------------------------------------------------------------------------------- /src/BeOS/about_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * about_window.h - "About" window 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef ABOUT_WINDOW_H 22 | #define ABOUT_WINDOW_H 23 | 24 | // Display "About" window 25 | extern void ShowAboutWindow(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/BeOS/prefs_beos.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * prefs_beos.cpp - Preferences handling, BeOS specific stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "sysdeps.h" 27 | #include "prefs.h" 28 | #include "main.h" 29 | 30 | 31 | // Platform-specific preferences items 32 | prefs_desc platform_prefs_items[] = { 33 | {"powerrom", TYPE_STRING, false, "path of PowerMac ROM"}, 34 | {NULL, TYPE_END, false, NULL} // End of list 35 | }; 36 | 37 | 38 | // Preferences file name and path 39 | const char PREFS_FILE_NAME[] = "BasiliskII_prefs"; 40 | static BPath prefs_path; 41 | 42 | 43 | /* 44 | * Load preferences from settings file 45 | */ 46 | 47 | void LoadPrefs(const char* vmdir) 48 | { 49 | #if 0 50 | if (vmdir) { 51 | prefs_path.SetTo(vmdir); 52 | prefs_path.Append("prefs"); 53 | FILE *prefs = fopen(prefs_path.Path(), "r"); 54 | if (!prefs) { 55 | printf("No file at %s found.\n", prefs_path.Path()); 56 | exit(1); 57 | } 58 | LoadPrefsFromStream(prefs); 59 | fclose(prefs); 60 | return; 61 | } 62 | #endif 63 | 64 | // Construct prefs path 65 | find_directory(B_USER_SETTINGS_DIRECTORY, &prefs_path, true); 66 | prefs_path.Append(PREFS_FILE_NAME); 67 | 68 | // Read preferences from settings file 69 | FILE *f = fopen(prefs_path.Path(), "r"); 70 | if (f != NULL) { 71 | 72 | // Prefs file found, load settings 73 | LoadPrefsFromStream(f); 74 | fclose(f); 75 | 76 | } else { 77 | 78 | // No prefs file, save defaults 79 | SavePrefs(); 80 | } 81 | } 82 | 83 | 84 | /* 85 | * Save preferences to settings file 86 | */ 87 | 88 | void SavePrefs(void) 89 | { 90 | FILE *f; 91 | if ((f = fopen(prefs_path.Path(), "w")) != NULL) { 92 | SavePrefsToStream(f); 93 | fclose(f); 94 | } 95 | } 96 | 97 | 98 | /* 99 | * Add defaults of platform-specific prefs items 100 | * You may also override the defaults set in PrefsInit() 101 | */ 102 | 103 | void AddPlatformPrefsDefaults(void) 104 | { 105 | PrefsReplaceString("extfs", "/boot"); 106 | } 107 | -------------------------------------------------------------------------------- /src/BeOS/user_strings_beos.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_beos.cpp - BeOS-specific localizable strings 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | #include "user_strings.h" 23 | 24 | 25 | // Platform-specific string definitions 26 | user_string_def platform_strings[] = { 27 | // Common strings that have a platform-specific variant 28 | {STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under BeOS. Basilisk II will try to unmount it."}, 29 | {STR_EXTFS_CTRL, "BeOS Root"}, 30 | {STR_EXTFS_NAME, "BeOS Directory Tree"}, 31 | {STR_EXTFS_VOLUME_NAME, "BeOS"}, 32 | 33 | // Purely platform-specific strings 34 | {STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). Basilisk II is not properly installed."}, 35 | {STR_SHEEP_UP_ERR, "Cannot allocate Low Memory Globals: %s (%08x)."}, 36 | {STR_NO_KERNEL_DATA_ERR, "Cannot create Kernel Data area: %s (%08x)."}, 37 | {STR_NO_NET_ADDON_WARN, "The SheepShaver net server add-on cannot be found. Ethernet will not be available."}, 38 | {STR_NET_CONFIG_MODIFY_WARN, "To enable Ethernet networking for Basilisk II, your network configuration has to be modified and the network restarted. Do you want this to be done now (selecting \"Cancel\" will disable Ethernet under Basilisk II)?."}, 39 | {STR_NET_ADDON_INIT_FAILED, "SheepShaver net server add-on found\nbut there seems to be no network hardware.\nPlease check your network preferences."}, 40 | {STR_NET_ADDON_CLONE_FAILED, "Cloning of the network transfer area failed."}, 41 | {STR_VIDEO_FAILED, "Failed to set video mode."}, 42 | 43 | {-1, NULL} // End marker 44 | }; 45 | 46 | 47 | /* 48 | * Fetch pointer to string, given the string number 49 | */ 50 | 51 | const char *GetString(int num) 52 | { 53 | // First search for platform-specific string 54 | int i = 0; 55 | while (platform_strings[i].num >= 0) { 56 | if (platform_strings[i].num == num) 57 | return platform_strings[i].str; 58 | i++; 59 | } 60 | 61 | // Not found, search for common string 62 | i = 0; 63 | while (common_strings[i].num >= 0) { 64 | if (common_strings[i].num == num) 65 | return common_strings[i].str; 66 | i++; 67 | } 68 | return NULL; 69 | } 70 | -------------------------------------------------------------------------------- /src/BeOS/user_strings_beos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_beos.h - BeOS-specific localizable strings 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef USER_STRINGS_BEOS_H 22 | #define USER_STRINGS_BEOS_H 23 | 24 | enum { 25 | STR_NO_SHEEP_DRIVER_ERR = 10000, 26 | STR_SHEEP_UP_ERR, 27 | STR_NO_KERNEL_DATA_ERR, 28 | STR_NO_NET_ADDON_WARN, 29 | STR_NET_CONFIG_MODIFY_WARN, 30 | STR_NET_ADDON_INIT_FAILED, 31 | STR_NET_ADDON_CLONE_FAILED, 32 | STR_VIDEO_FAILED 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/BeOS/xpram_beos.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram_beos.cpp - XPRAM handling, BeOS specific stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "sysdeps.h" 25 | #include "xpram.h" 26 | 27 | 28 | // XPRAM file name and path 29 | #if POWERPC_ROM 30 | const char XPRAM_FILE_NAME[] = "SheepShaver_NVRAM"; 31 | #else 32 | const char XPRAM_FILE_NAME[] = "BasiliskII_XPRAM"; 33 | #endif 34 | static BPath xpram_path; 35 | 36 | 37 | /* 38 | * Load XPRAM from settings file 39 | */ 40 | 41 | void LoadXPRAM(const char *vmdir) 42 | { 43 | // Construct XPRAM path 44 | find_directory(B_USER_SETTINGS_DIRECTORY, &xpram_path, true); 45 | xpram_path.Append(XPRAM_FILE_NAME); 46 | 47 | // Load XPRAM from settings file 48 | int fd; 49 | if ((fd = open(xpram_path.Path(), O_RDONLY)) >= 0) { 50 | read(fd, XPRAM, XPRAM_SIZE); 51 | close(fd); 52 | } 53 | } 54 | 55 | 56 | /* 57 | * Save XPRAM to settings file 58 | */ 59 | 60 | void SaveXPRAM(void) 61 | { 62 | if (xpram_path.InitCheck() != B_NO_ERROR) 63 | return; 64 | int fd; 65 | if ((fd = open(xpram_path.Path(), O_WRONLY | O_CREAT, 0666)) >= 0) { 66 | write(fd, XPRAM, XPRAM_SIZE); 67 | close(fd); 68 | } 69 | } 70 | 71 | 72 | /* 73 | * Delete PRAM file 74 | */ 75 | 76 | void ZapPRAM(void) 77 | { 78 | // Construct PRAM path 79 | find_directory(B_USER_SETTINGS_DIRECTORY, &xpram_path, true); 80 | xpram_path.Append(XPRAM_FILE_NAME); 81 | 82 | // Delete file 83 | unlink(xpram_path.Path()); 84 | } 85 | -------------------------------------------------------------------------------- /src/MacOSX/AudioBackEnd.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/AudioBackEnd.cpp -------------------------------------------------------------------------------- /src/MacOSX/AudioBackEnd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/AudioBackEnd.h -------------------------------------------------------------------------------- /src/MacOSX/AudioDevice.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/AudioDevice.cpp -------------------------------------------------------------------------------- /src/MacOSX/AudioDevice.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/AudioDevice.h -------------------------------------------------------------------------------- /src/MacOSX/BasiliskII.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/BasiliskII.icns -------------------------------------------------------------------------------- /src/MacOSX/Controller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller.h - Simple application window management. 3 | * 4 | * $Id$ 5 | * 6 | * Basilisk II (C) 1997-2008 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #import 24 | #import "PrefsEditor.h" 25 | 26 | // If the application supports multiple windows, 27 | // ENABLE_MULTIPLE can be defined in config.h 28 | 29 | @interface Controller : NSApplication 30 | { 31 | #ifdef ENABLE_MULTIPLE 32 | NSMutableArray *emulators; // Array of created Emulators 33 | #endif 34 | IBOutlet Emulator *theEmulator; 35 | IBOutlet PrefsEditor *thePrefsEditor; 36 | } 37 | 38 | - (void) dispatchKeyEvent: (NSEvent *)event 39 | type: (NSEventType)type; 40 | - (void) dispatchEvent: (NSEvent *)event 41 | type: (NSEventType)type; 42 | 43 | 44 | - (IBAction) HelpHowTo: (id)sender; 45 | - (IBAction) HelpToDo: (id)sender; 46 | - (IBAction) HelpVersions: (id)sender; 47 | 48 | #ifdef ENABLE_MULTIPLE 49 | - (IBAction) NewEmulator: (id)sender; 50 | - (IBAction) PauseAll: (id)sender; 51 | - (IBAction) RunAll: (id)sender; 52 | - (IBAction) TerminateAll: (id)sender; 53 | #endif 54 | 55 | - (BOOL) isAnyEmulatorDisplayingSheets; 56 | - (BOOL) isAnyEmulatorRunning; 57 | - (short) emulatorCreatedCount; // If any emulator environments have been setup, count how many 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /src/MacOSX/Credits.html: -------------------------------------------------------------------------------- 1 | Basilisk II is an open source, 68k Mac. emulator. 2 |
3 | It enables you to run 68k MacOS software on your computer, even if you are using a different operating system (however, you do need a copy of the MacOS and a Macintosh ROM image to use it). 4 |
5 | The Official Basilisk II Home Page 6 |
7 | 8 | MacOS X (native windowing) port 9 |
10 | by Nigel Pearson <nigel@ind.tansu.com.au> 11 |
12 | -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | NSHumanReadableCopyright = "Copyright © 1997-2006 Christian Bauer et al. Freely distributable under the terms of the GNU GPL."; 4 | -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/Collapsed.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/Collapsed.tiff -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/Expanded.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/Expanded.tiff -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 3 11 521 240 0 4 1152 742 7 | IBEditorPositions 8 | 9 | 29 10 | 3 256 365 44 0 0 1152 746 11 | 12 | IBFramework Version 13 | 349.0 14 | IBLockedObjects 15 | 16 | 288 17 | 18 | IBOpenObjects 19 | 20 | 29 21 | 813 22 | 23 | IBSystem Version 24 | 7D24 25 | IBUserGuides 26 | 27 | VolumeSize 28 | 29 | guideLocations 30 | 31 | guidesLocked 32 | NO 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/objects.nib -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/resetH.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/resetH.tiff -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/resetN.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/resetN.tiff -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/shutdownH.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/shutdownH.tiff -------------------------------------------------------------------------------- /src/MacOSX/English.lproj/MainMenu.nib/shutdownN.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/English.lproj/MainMenu.nib/shutdownN.tiff -------------------------------------------------------------------------------- /src/MacOSX/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | BasiliskII 9 | CFBundleGetInfoString 10 | Basilisk II version 1.0, Copyright © 1997-2006 Christian Bauer et al. Mac OS X port 19 11 | CFBundleIconFile 12 | BasiliskII.icns 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | BasiliskII 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | Basilisk II 1.0, Mac OS X port 19 23 | CFBundleSignature 24 | ???? 25 | NSHelpFile 26 | README.txt 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | Controller 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/MacOSX/MacOSX_sound_if.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MacOSX_sound_if.h 3 | * BasiliskII 4 | * 5 | * Copyright 2006 Daniel Sumorok. All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #include "AudioBackEnd.h" 22 | #include "MacOSX_sound_if.h" 23 | 24 | OSXsoundOutput::OSXsoundOutput() : 25 | player(NULL), 26 | callback(NULL) { 27 | } 28 | 29 | void OSXsoundOutput::getMoreSamples(void *arg) { 30 | OSXsoundOutput *me; 31 | 32 | me = (OSXsoundOutput *)arg; 33 | 34 | if(me == NULL) { 35 | return; 36 | } 37 | 38 | if(me->callback == NULL) { 39 | return; 40 | } 41 | 42 | me->callback(); 43 | } 44 | 45 | int OSXsoundOutput::start(int bitsPerSample, int numChannels, int sampleRate) { 46 | stop(); 47 | player = new AudioBackEnd(bitsPerSample, numChannels, sampleRate); 48 | if(player != NULL) { 49 | player->setCallback(getMoreSamples, (void *)this); 50 | player->Start(); 51 | } 52 | return 0; 53 | } 54 | 55 | int OSXsoundOutput::stop() { 56 | if(player != NULL) { 57 | player->Stop(); 58 | delete player; 59 | player = NULL; 60 | } 61 | return 0; 62 | } 63 | 64 | OSXsoundOutput::~OSXsoundOutput() { 65 | stop(); 66 | } 67 | 68 | void OSXsoundOutput::setCallback(audioCallback fn) { 69 | callback = fn; 70 | } 71 | 72 | unsigned int OSXsoundOutput::bufferSizeFrames() { 73 | if(player != NULL) { 74 | return player->BufferSizeFrames(); 75 | } 76 | 77 | return 0; 78 | } 79 | 80 | int OSXsoundOutput::sendAudioBuffer(void *buffer, int numFrames) { 81 | if(player != NULL) { 82 | return player->sendAudioBuffer(buffer, numFrames); 83 | } 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /src/MacOSX/MacOSX_sound_if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MacOSX_sound_if.h 3 | * BasiliskII 4 | * 5 | * Copyright 2006 Daniel Sumorok. All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | typedef int (*audioCallback)(void); 23 | 24 | class AudioBackEnd; 25 | 26 | class OSXsoundOutput { 27 | private: 28 | static void getMoreSamples(void *arg); 29 | 30 | AudioBackEnd *player; 31 | audioCallback callback; 32 | public: 33 | OSXsoundOutput(); 34 | ~OSXsoundOutput(); 35 | int start(int bitsPerSample, int numChannels, int sampleRate); 36 | int stop(); 37 | int putBuffer(void *buffer, int numSamples); 38 | void setCallback(audioCallback fn); 39 | unsigned int bufferSizeFrames(); 40 | int sendAudioBuffer(void *buffer, int numFrames); 41 | }; 42 | -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "BasiliskII"; 4 | NSHumanReadableCopyright = "Copyright 1997-2001 Christian Bauer et al., Freely distributable under the terms of the GNU GPL"; 5 | -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 5 42 473 240 0 41 1024 705 7 | IBMainMenuLocation 8 | 0 702 365 44 0 42 1152 704 9 | IBUserGuides 10 | 11 | About 12 | 13 | guideLocations 14 | 15 | guidesLocked 16 | NO 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/MainMenu.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/MainMenu.nib/objects.nib -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/Collapsed.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/Collapsed.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/Expanded.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/Expanded.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {NewEmulator = id; ShowAbout = id; pauseAll = id; terminateAll = id; }; 5 | CLASS = Controller; 6 | LANGUAGE = ObjC; 7 | OUTLETS = {myEmulator = id; }; 8 | SUPERCLASS = NSObject; 9 | }, 10 | { 11 | ACTIONS = { 12 | Interrupt = id; 13 | PowerKey = id; 14 | Restart = id; 15 | Resume = id; 16 | Snapshot = id; 17 | SpeedChange = id; 18 | Suspend = id; 19 | Terminate = id; 20 | ToggleState = id; 21 | ZapPRAM = id; 22 | }; 23 | CLASS = Emulator; 24 | LANGUAGE = ObjC; 25 | OUTLETS = {barberPole = id; runOrPause = id; screen = id; speed = id; win = id; }; 26 | SUPERCLASS = NSObject; 27 | }, 28 | {CLASS = EmulatorView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 29 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 30 | ); 31 | IBVersion = 1; 32 | } -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 18 42 473 240 0 41 1024 705 7 | IBMainMenuLocation 8 | 0 702 365 44 0 41 1024 705 9 | IBUserGuides 10 | 11 | Window 12 | 13 | guideLocations 14 | 15 | guidesLocked 16 | NO 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/objects.nib -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/resetH.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/resetH.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/resetN.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/resetN.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/shutdownH.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/shutdownH.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/shutdownN.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/MacOSX/Multiple-Windows/English.lproj/Win512x342.nib/shutdownN.tiff -------------------------------------------------------------------------------- /src/MacOSX/Multiple-Windows/README: -------------------------------------------------------------------------------- 1 | This is a version of the interface that would allow multiple emulations to 2 | run side-by-side, in different windows. Currently, the uae_cpu engine is not 3 | re-entrant, and some of the Basilisk glue would not allow this, so this will 4 | probably never be used. I will save it here for educational purposes, and just 5 | in case this feature is ever needed. 6 | -------------------------------------------------------------------------------- /src/MacOSX/NNThread.h: -------------------------------------------------------------------------------- 1 | // 2 | // NNThread.h -Not Nextstep Thread? 3 | // Nigel's Nice Thread? 4 | // 5 | // Revision 1.2, Tuesday May 25 2004 6 | // 7 | // Created by Nigel Pearson on Tue Nov 28 2000. 8 | // Public Domain. No rights reserved. 9 | // 10 | 11 | // Define what flavour of threading to use: 12 | #define USE_NSTHREAD 13 | //#define USE_PTHREAD 14 | 15 | #import 16 | 17 | #import 18 | #import 19 | 20 | #ifdef USE_PTHREAD 21 | #include 22 | 23 | struct pthreadArgs // This duplicates most of the stuff in the NNThread object 24 | { 25 | id *object; 26 | SEL *sel; 27 | 28 | NSAutoreleasePool *pool; 29 | BOOL allocPool, 30 | *completed; 31 | }; 32 | #endif 33 | 34 | @interface NNThread : NSObject 35 | { 36 | id object; 37 | SEL sel; 38 | thread_t machThread; 39 | #ifdef USE_PTHREAD 40 | pthread_t pThread; 41 | struct pthreadArgs pthreadArgs; 42 | #endif 43 | NSAutoreleasePool *pool; 44 | BOOL allocPool, 45 | completed, 46 | suspended; 47 | } 48 | 49 | - (NNThread *) initWithAutoReleasePool; 50 | - (NNThread *) initSuspended: (BOOL) startSuspended 51 | withAutoreleasePool: (BOOL) allocatePool; 52 | 53 | - (void) perform: (SEL)action of: (id)receiver; 54 | - (void) resume; 55 | - (BOOL) start; 56 | - (void) suspend; 57 | - (void) terminate; 58 | 59 | @end 60 | 61 | typedef enum _NNTimeUnits 62 | { 63 | NNnanoSeconds = 1, 64 | NNmicroSeconds = 2, 65 | NNmilliSeconds = 3, 66 | NNseconds = 4 67 | } 68 | NNTimeUnits; 69 | 70 | #import 71 | 72 | @interface NNTimer : NNThread 73 | { 74 | struct timespec delay; 75 | BOOL repeating; 76 | id timerObject; 77 | SEL timerSel; 78 | } 79 | 80 | - (NNTimer *) initWithAutoRelPool; 81 | 82 | - (void) changeIntervalTo: (int)number units: (NNTimeUnits)units; 83 | - (void) invalidate; 84 | 85 | - (void) perform: (SEL)action of: (id)receiver 86 | after: (int)number units: (NNTimeUnits)units; 87 | 88 | - (void) repeat: (SEL)action of: (id)receiver 89 | every: (int)number units: (NNTimeUnits)units; 90 | 91 | @end -------------------------------------------------------------------------------- /src/MacOSX/audio_defs_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * audio_defs_macosx.h - Work around clashes with the enums in 5 | * Based on: 6 | * 7 | * audio_defs.h - Definitions for MacOS audio components 8 | * 9 | * Basilisk II (C) 1997-2008 Christian Bauer 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #ifndef AUDIO_DEFS_H 27 | #define AUDIO_DEFS_H 28 | 29 | #include "macos_util_macosx.h" 30 | 31 | enum { // ComponentResource struct 32 | componentType = 0, 33 | componentSubType = 4, 34 | componentManufacturer = 8, 35 | componentFlags = 12, 36 | componentFlagsMask = 16, 37 | componentResType = 20, 38 | componentResID = 24, 39 | componentNameType = 26, 40 | componentNameID = 30, 41 | componentInfoType = 32, 42 | componentInfoID = 36, 43 | componentIconType = 38, 44 | componentIconID = 42, 45 | componentVersion = 44, 46 | componentRegisterFlags = 48, 47 | componentIconFamily = 52, 48 | componentPFCount = 54, 49 | componentPFFlags = 58, 50 | componentPFResType = 62, 51 | componentPFResID = 66, 52 | componentPFPlatform = 68 53 | }; 54 | 55 | 56 | enum { // ComponentParameters struct 57 | cp_flags = 0, // call modifiers: sync/async, deferred, immed, etc 58 | cp_paramSize = 1, // size in bytes of actual parameters passed to this call 59 | cp_what = 2, // routine selector, negative for Component management calls 60 | cp_params = 4 // actual parameters for the indicated routine 61 | }; 62 | 63 | enum { // SoundComponentData struct 64 | scd_flags = 0, 65 | scd_format = 4, 66 | scd_numChannels = 8, 67 | scd_sampleSize = 10, 68 | scd_sampleRate = 12, 69 | scd_sampleCount = 16, 70 | scd_buffer = 20, 71 | scd_reserved = 24, 72 | SIZEOF_scd = 28 73 | }; 74 | 75 | enum { // SoundInfoList struct 76 | sil_count = 0, 77 | sil_infoHandle = 2 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/MacOSX/autorelease.h: -------------------------------------------------------------------------------- 1 | /* 2 | * autorelease.h - a macro wrapping autorelease pools for use with Objective-C++ source files. 3 | * 4 | * Expands to @autoreleasepool on clang, uses a little hack to emulate @autoreleasepool on gcc. 5 | * 6 | * (C) 2012 Charles Srstka 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #import 24 | 25 | #ifndef __Autorelease_H__ 26 | #define __Autorelease_H__ 27 | 28 | // just a little forward compatibility in case we ever support LLVM/clang 29 | #if __clang__ 30 | #define AUTORELEASE_POOL @autoreleasepool 31 | #else 32 | class Autorelease_Pool_Wrapper { 33 | public: 34 | Autorelease_Pool_Wrapper() { m_pool = [[NSAutoreleasePool alloc] init]; } 35 | ~Autorelease_Pool_Wrapper() { [m_pool drain]; } 36 | operator bool() const { return true; } 37 | private: 38 | NSAutoreleasePool *m_pool; 39 | }; 40 | 41 | #define POOL_NAME(x, y) x##_##y 42 | #define POOL_NAME2(x, y) POOL_NAME(x, y) 43 | #define AUTORELEASE_POOL if(Autorelease_Pool_Wrapper POOL_NAME2(pool, __LINE__) = Autorelease_Pool_Wrapper()) 44 | #endif // !__clang__ 45 | 46 | #endif // __Autorelease_H__ 47 | -------------------------------------------------------------------------------- /src/MacOSX/main_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * main_macosx.h - Prototypes for Mac OS X general definitions 3 | * 4 | * $Id$ 5 | * 6 | * Basilisk II (C) 1997-2008 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | bool InitEmulator (); 24 | void QuitEmuNoExit(); 25 | 26 | 27 | extern void ErrorAlert (const char *text); 28 | extern void WarningAlert(const char *text); 29 | extern bool ChoiceAlert (const char *text, const char *pos, const char *neg); 30 | -------------------------------------------------------------------------------- /src/MacOSX/misc_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * misc_macosx.h - Some prototypes of functions defined in misc_macosx.mm 5 | * 6 | * Basilisk II (C) 1997-2008 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #if defined(__APPLE__) && defined(__MACH__) 24 | // This means we are on Mac OS X of some sort 25 | #endif 26 | 27 | extern void ErrorSheet (NSString *msg, NSWindow *win), 28 | ErrorSheet (NSString *msg1, NSString *msg2, 29 | NSString *button, NSWindow *win), 30 | WarningSheet (NSString *message,NSWindow *win), 31 | WarningSheet (NSString *msg1, NSString *msg2, 32 | NSString *button, NSWindow *win), 33 | InfoSheet (NSString *msg, NSWindow *win), 34 | InfoSheet (NSString *msg1, NSString *msg2, 35 | NSString *button, NSWindow *win), 36 | EndSheet (NSWindow * window); 37 | 38 | extern int frequencyToTickDelay (float frequency); 39 | -------------------------------------------------------------------------------- /src/MacOSX/utils_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * utils_macosx.h - Mac OS X utility functions. 3 | * 4 | * Copyright (C) 2011 Alexei Svitkine 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef UTILS_MACOSX_H 22 | #define UTILS_MACOSX_H 23 | 24 | // Invokes the specified function with an NSAutoReleasePool in place. 25 | void NSAutoReleasePool_wrap(void (*fn)(void)); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/MacOSX/utils_macosx.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * utils_macosx.mm - Mac OS X utility functions. 3 | * 4 | * Copyright (C) 2011 Alexei Svitkine 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | #include "utils_macosx.h" 23 | 24 | // This is used from video_sdl.cpp. 25 | void NSAutoReleasePool_wrap(void (*fn)(void)) 26 | { 27 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 28 | fn(); 29 | [pool release]; 30 | } 31 | -------------------------------------------------------------------------------- /src/MacOSX/video_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * video_macosx.h - Some video constants and globals 3 | * 4 | * $Id$ 5 | * 6 | * Basilisk II (C) 1997-2008 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #import 24 | 25 | /* Set the strategy for drawing the bitmap in the Mac OS X window */ 26 | //#define CGDRAWBITMAP 27 | #if defined __i386__ 28 | #define CGIMAGEREF 29 | //#define NSBITMAP 30 | #else 31 | #define CGIMAGEREF 32 | //#define NSBITMAP 33 | #endif 34 | 35 | // Using Core Graphics is fastest when rendering 32bit data. 36 | // Using CGImageRefs allows us to use all the bitmaps that BasiliskII supports. 37 | // When both Basilisk II and OS X are set to 'Thousands', updating a 312x342 38 | // window happens at over 500fps under 10.2, and over 600fps on 10.3! 39 | 40 | /* When the BasiliskII video driver respects the alpha bits, set this to let us use */ 41 | /* kCGImageAlphaPremultipliedFirst, and to have nice rounded corners on the screen. */ 42 | //#define CG_USE_ALPHA 43 | /* At the moment, it writes in the full 32bits :-( */ 44 | 45 | 46 | #define MIN_WIDTH 512 47 | #define MIN_HEIGHT 384 48 | #define MIN_HEIGHTC 342 // For classic emulation 49 | 50 | #define MAX_WIDTH 1240 51 | #define MAX_HEIGHT 1024 52 | 53 | // Display types 54 | enum 55 | { 56 | DISPLAY_OPENGL, 57 | DISPLAY_SCREEN, 58 | DISPLAY_WINDOW 59 | }; 60 | 61 | 62 | extern uint8 display_type, 63 | frame_skip; 64 | extern uint16 init_width, 65 | init_height, 66 | init_depth; 67 | 68 | extern bool parse_screen_prefs (const char *); 69 | extern void resizeWinTo (const uint16, const uint16); 70 | 71 | #import 72 | #import "EmulatorView.h" 73 | 74 | extern NSWindow *the_win; 75 | extern EmulatorView *output; 76 | -------------------------------------------------------------------------------- /src/SDL/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #ifndef _SDLMain_h_ 9 | #define _SDLMain_h_ 10 | 11 | #import 12 | 13 | @interface SDLMain : NSObject 14 | @end 15 | 16 | #endif /* _SDLMain_h_ */ 17 | -------------------------------------------------------------------------------- /src/Unix/.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | obj/* 3 | BasiliskII 4 | 5 | # Autotools generated files 6 | Makefile 7 | aclocal.m4 8 | autom4te.cache/* 9 | config.h 10 | config.h.in 11 | config.log 12 | config.status 13 | configure 14 | 15 | # Generated files for CPU emulation 16 | cpudefs.cpp 17 | cpuemu.cpp 18 | cpustbl.cpp 19 | cputbl.h 20 | -------------------------------------------------------------------------------- /src/Unix/Darwin/mkstandalone: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # mkstandalone - Make a standalone bundle with GTK runtime 4 | # 5 | # Basilisk II (C) 1997-2006 Christian Bauer 6 | # 7 | # mkstandalone Copyright (C) 2006 Gwenole Beauchesne 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | 23 | PROG="${1%.app}" 24 | 25 | [ -n "$PROG" ] || { 26 | echo "Usage: ${0##*/} " 27 | exit 1 28 | } 29 | 30 | [ -d "$PROG.app" ] || { 31 | echo "ERROR: $PROG.app bundle does not exist" 32 | exit 1 33 | } 34 | 35 | [ -x "$PROG.app/Contents/MacOS/$PROG" ] || { 36 | echo "ERROR: $PROG.app is not a properly formed bundle" 37 | exit 1 38 | } 39 | 40 | echo "Processing bundle $PROG.app" 41 | 42 | FRAMEWORKS="GLib GDK GTK" 43 | 44 | rm -r -f $PROG.app/Contents/Frameworks 45 | mkdir -p $PROG.app/Contents/Frameworks 46 | 47 | int_args="" 48 | for fmk_path in `otool -L $PROG.app/Contents/MacOS/$PROG | \ 49 | sed -n '/ *\(\/.*\.framework\/.*\) ([^)]*)/s//\1/p'` 50 | do 51 | fmk_spath="${fmk_path%/Versions/*}" 52 | fmk="${fmk_spath%.framework}" 53 | fmk="${fmk##*/}" 54 | 55 | case " $FRAMEWORKS " in 56 | (*" $fmk "*) ;; 57 | (*) continue ;; 58 | esac 59 | 60 | echo " Linking in framework $fmk" 61 | fmk_dpath=$PROG.app/Contents/Frameworks/$fmk.framework 62 | rm -rf $fmk_dpath 63 | cp -Rf $fmk_spath $fmk_dpath 64 | find $fmk_dpath -name "*Headers*" | xargs rm -rf 65 | fmk_vpath="${fmk_path##*.framework/}" 66 | 67 | # change library dependency 68 | install_name_tool -change \ 69 | $fmk_spath/$fmk_vpath \ 70 | @executable_path/../Frameworks/$fmk.framework/$fmk_vpath \ 71 | $PROG.app/Contents/MacOS/$PROG 72 | 73 | # change shared library id name 74 | fmk_newid="@executable_path/../Frameworks/${fmk_path#*/Frameworks/}" 75 | install_name_tool -id $fmk_newid $fmk_dpath/$fmk_vpath 76 | 77 | # expand final install_name_tool args list 78 | int_args="$int_args -change $fmk_path $fmk_newid" 79 | 80 | # strip shared library 81 | strip -x $fmk_dpath/$fmk_vpath 82 | done 83 | 84 | # change remaining dependency libs names 85 | for f in $FRAMEWORKS; do 86 | install_name_tool $int_args $PROG.app/Contents/Frameworks/$f.framework/$f 87 | done 88 | 89 | exit 0 90 | -------------------------------------------------------------------------------- /src/Unix/Darwin/pagezero.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pagezero.c - test to see if low memory globals can be accessed 3 | * 4 | * Copyright (c) 2003 Michael Z. Sliczniak 5 | * 6 | * Basilisk II (C) 1997-2003 Christian Bauer 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | int 24 | main(int argc, const char *argv[]) 25 | { 26 | volatile char *pagezero = (void *)0; 27 | 28 | pagezero[0x1234] = pagezero[0x123]; 29 | 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /src/Unix/Darwin/testlmem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # testlmem.sh - test whether the Mach-O hack works 4 | # 5 | # Basilisk II (C) 1997-2005 Christian Bauer 6 | # 7 | # testlmem.sh Copyright (C) 2003 Michael Z. Sliczniak 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | 23 | PAGEZERO_SIZE=0x2000 24 | [[ -n "$1" ]] && PAGEZERO_SIZE=$1 25 | # You want all the output to go to stderr so that configure is quiet but 26 | # config.log is verbose. 27 | { echo 'building lowmem utility' && \ 28 | make -f /dev/null Darwin/lowmem && \ 29 | echo 'building pagezero test' && \ 30 | make -f /dev/null LDFLAGS="-pagezero_size $PAGEZERO_SIZE" Darwin/pagezero && \ 31 | echo 'enabling low memory globals in pagezero' && \ 32 | Darwin/lowmem Darwin/pagezero && \ 33 | echo 'running pagezero test' && \ 34 | Darwin/pagezero; } 1>&2 35 | -------------------------------------------------------------------------------- /src/Unix/Irix/unaligned.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Irix/unaligned.c - Optimized unaligned access for Irix 3 | * 4 | * Basilisk II (C) 1997-2005 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifdef sgi 22 | #include "sysdeps.h" 23 | 24 | /* Tell the compiler to pack data on 1-byte boundaries 25 | * (i.e. arbitrary alignment). Requires SGI MIPSPro compilers. */ 26 | #pragma pack(1) 27 | 28 | typedef struct _ual32 { 29 | uae_u32 v; 30 | } ual32_t; 31 | 32 | typedef struct _ual16 { 33 | uae_u16 v; 34 | } ual16_t; 35 | 36 | #pragma pack(0) 37 | 38 | /* The compiler is smart enough to inline these when you build with "-ipa" */ 39 | uae_u32 do_get_mem_long(uae_u32 *a) {return ((ual32_t *)a)->v;} 40 | uae_u32 do_get_mem_word(uae_u16 *a) {return ((ual16_t *)a)->v;} 41 | void do_put_mem_long(uae_u32 *a, uae_u32 v) {((ual32_t *)a)->v = v;} 42 | void do_put_mem_word(uae_u16 *a, uae_u32 v) {((ual16_t *)a)->v = v;} 43 | 44 | #endif /* sgi */ 45 | -------------------------------------------------------------------------------- /src/Unix/Linux/NetDriver/README.md: -------------------------------------------------------------------------------- 1 | # What 2 | ​ 3 | sheep_net is a character virtual device that bridge between BasiliskII and Physical Ethernet card(P) 4 | 5 | Here is logical diagram: 6 | 7 | Guest Mac OS in emulation (G) <==> Basilisk II (B) <==> /dev/sheep_net (S) <==> Physical Ethernet card on host (P) 8 | 9 | sheep_net module masquerade and de-masquerade MAC address on Ethernet frame so that Guest OS and host share the same MAC address with different IP. 10 | 11 | See details in [IP aliasing](https://en.wikipedia.org/wiki/IP_aliasing) 12 | 13 | # How 14 | ## How it works 15 | 16 | Sample Setting: 17 | 18 | Guest Mac OS IP: 192.168.2.2, Fake MAC address: 84:38:35:5e:c5:5b 19 | 20 | Host OS Physical Ethernet car IP: 192.168.2.3, physical MAC address: 84:38:35:5e:c5:5a 21 | 22 | From outside, we see 192.168.2.2 and 192.168.2.3 share the same physical MAC address: 84:38:35:5e:c5:5a 23 | 24 | From insides, sheep_net module masquerade and de-masquerade MAC address of Ethernet packet between Basilisk and 25 | 26 | ``` 27 | B ==> S ==> P: de-masquerade MAC, convert Fake to Physical 28 | B <== S <== P: masquerade MAC, convert Physical to Fake 29 | ``` 30 | 31 | ## How to compile 32 | ``` 33 | ​cd Linux/NetDriver 34 | make 35 | //create sheep_net device node 36 | sudo make dev 37 | sudo chown [user account] /dev/sheep_net 38 | sudo make install 39 | sudo modprobe sheep_net 40 | ``` 41 | 42 | ## How to use 43 | 1. Disable IP forwarding on host (Recommended: By disabling it, guest OS won't receive duplicate IP packet from host again.) 44 | 2. Disable firewall on host (Recommended: host may send ICMP host unreachable to gateway. Or you can disable ICMP sending from host by changing iptables.) 45 | 3. sudo modprobe sheep_net 46 | 4. sudo chown [user account] /dev/sheep_net 47 | 5. Launch BasiliskII, choose your physical Ethernet card interface in network tab 48 | -------------------------------------------------------------------------------- /src/Unix/Solaris/which_sparc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # which_sparc 4 | # 5 | # This script generates a program that tests for a SPARC processor class 6 | # Program returns: 7 | # 0 unknown SPARC processor 8 | # 8 SPARC V8 `compliant' processor (umul instruction is legal) 9 | # 9 SPARC V9 `compliant' processor (popc instruction is legal) 10 | # 11 | # The script prints: 12 | # "unknown SPARC architecture" 13 | # SPARC_V8 14 | # SPARC_V9 15 | # 16 | # I hope this works for other machines and OS. Tested machines are: 17 | # Sun Ultra 10 (Solaris 7), SPARC Station 5 (Solaris 2.5.1) 18 | # 19 | # Gwenole Beauchesne 20 | # gb@dial.oleane.com 21 | 22 | CC=gcc 23 | PROG=./conftest 24 | SOURCE=./conftest.c 25 | 26 | if [ ! -x $PROG ]; then 27 | cat > $SOURCE << EOF 28 | #include 29 | #include 30 | 31 | typedef unsigned int uint32; 32 | typedef uint32 (*sparc_code_func)(void); 33 | 34 | #define SPARC_UNKNOWN 0 35 | #define SPARC_V8 8 36 | #define SPARC_V9 9 37 | 38 | #define MAX_CODE_SIZE 16 39 | struct sparc_code_struct { 40 | int version; 41 | uint32 code[MAX_CODE_SIZE]; 42 | struct sparc_code_struct * next; 43 | }; 44 | typedef struct sparc_code_struct sparc_code_struct; 45 | 46 | static sparc_code_struct *current_test_code; 47 | 48 | static sparc_code_struct unknown_sparc_code = 49 | { 50 | SPARC_UNKNOWN, 51 | { 52 | 0x81C3E008, /* retl */ 53 | 0x01000000 /* nop */ 54 | } 55 | }; 56 | 57 | static sparc_code_struct sparc_v9_code = 58 | { 59 | SPARC_V9, 60 | { 61 | 0x81C3E008, /* retl */ 62 | 0x81702007 /* popc 7, %g0 */ 63 | } 64 | }; 65 | 66 | static sparc_code_struct sparc_v8_code = 67 | { 68 | SPARC_V8, 69 | { 70 | 0x90102002, /* mov 2, %o0 */ 71 | 0x81C3E008, /* retl */ 72 | 0x90520008 /* umul %o0, %o0, %o0 */ 73 | } 74 | }; 75 | 76 | static void test_sparc_code(int unused_int) 77 | { 78 | sparc_code_struct *tested_code = current_test_code; 79 | 80 | if (current_test_code == NULL) 81 | exit(SPARC_UNKNOWN); 82 | 83 | signal(SIGILL, test_sparc_code); 84 | current_test_code = current_test_code->next; 85 | (void) ((sparc_code_func)(tested_code->code))(); 86 | exit(tested_code->version); 87 | } 88 | 89 | int main(void) 90 | { 91 | sparc_v9_code.next = &sparc_v8_code; 92 | sparc_v8_code.next = &unknown_sparc_code; 93 | unknown_sparc_code.next = NULL; 94 | 95 | signal(SIGILL, test_sparc_code); 96 | current_test_code = &sparc_v9_code; 97 | raise(SIGILL); 98 | 99 | return 0; 100 | } 101 | EOF 102 | 103 | $CC -o $PROG $SOURCE 104 | if [ $? -ne 0 ]; then 105 | echo "Error: could not compile the test program" 106 | exit 1 107 | fi 108 | 109 | fi 110 | 111 | $PROG 112 | case $? in 113 | 0) echo "unknown SPARC architecture";; 114 | 8) echo "SPARC_V8";; 115 | 9) echo "SPARC_V9";; 116 | esac 117 | 118 | rm -f $PROG 119 | rm -f $SOURCE 120 | 121 | exit 0 122 | -------------------------------------------------------------------------------- /src/Unix/acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Additional macros for Basilisk II 2 | 3 | 4 | dnl Check for libgnomeui 5 | dnl B2_PATH_GNOMEUI([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 6 | dnl Test to see if libgnomeui is installed, and define GNOMEUI_CFLAGS, LIBS 7 | AC_DEFUN([B2_PATH_GNOMEUI], 8 | [dnl 9 | dnl Get the cflags and libraries from the gnome-config script 10 | dnl 11 | AC_ARG_WITH(gnome-config, 12 | [ --with-gnome-config=GNOME_CONFIG Location of gnome-config], 13 | GNOME_CONFIG="$withval") 14 | 15 | AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) 16 | AC_MSG_CHECKING(for libgnomeui) 17 | if test "$GNOME_CONFIG" = "no"; then 18 | AC_MSG_RESULT(no) 19 | ifelse([$2], , :, [$2]) 20 | else 21 | AC_MSG_RESULT(yes) 22 | GNOMEUI_CFLAGS=`$GNOME_CONFIG --cflags gnomeui` 23 | GNOMEUI_LIBS=`$GNOME_CONFIG --libs gnomeui` 24 | ifelse([$1], , :, [$1]) 25 | fi 26 | AC_SUBST(GNOMEUI_CFLAGS) 27 | AC_SUBST(GNOMEUI_LIBS) 28 | ]) 29 | -------------------------------------------------------------------------------- /src/Unix/autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | # This was lifted from the Gimp, and adapted slightly by 4 | # Christian Bauer. 5 | 6 | DIE=0 7 | 8 | PROG="Basilisk II" 9 | 10 | # Check how echo works in this /bin/sh 11 | case `echo -n` in 12 | -n) _echo_n= _echo_c='\c';; 13 | *) _echo_n=-n _echo_c=;; 14 | esac 15 | 16 | (autoconf --version) < /dev/null > /dev/null 2>&1 || { 17 | echo 18 | echo "You must have autoconf installed to compile $PROG." 19 | echo "Download the appropriate package for your distribution," 20 | echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" 21 | DIE=1 22 | } 23 | 24 | (aclocal --version) < /dev/null > /dev/null 2>&1 || { 25 | echo 26 | echo "**Error**: Missing aclocal. The version of automake" 27 | echo "installed doesn't appear recent enough." 28 | echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" 29 | echo "(or a newer version if it is available)" 30 | DIE=1 31 | } 32 | 33 | if test "$DIE" -eq 1; then 34 | exit 1 35 | fi 36 | 37 | if test -z "$ACLOCAL_FLAGS"; then 38 | ACLOCAL_FLAGS="-I `aclocal --print-ac-dir` -I `dirname $0`/m4" 39 | fi 40 | 41 | aclocalinclude="$ACLOCAL_FLAGS"; \ 42 | (echo $_echo_n " + Running aclocal: $_echo_c"; \ 43 | aclocal $aclocalinclude; \ 44 | echo "done.") && \ 45 | (echo $_echo_n " + Running autoheader: $_echo_c"; \ 46 | autoheader; \ 47 | echo "done.") && \ 48 | (echo $_echo_n " + Running autoconf: $_echo_c"; \ 49 | autoconf; \ 50 | echo "done.") 51 | 52 | rm -f config.cache 53 | 54 | if [ x"$NO_CONFIGURE" = "x" ]; then 55 | echo " + Running 'configure $@':" 56 | if [ -z "$*" ]; then 57 | echo " ** If you wish to pass arguments to ./configure, please" 58 | echo " ** specify them on the command line." 59 | fi 60 | ./configure "$@" 61 | fi 62 | -------------------------------------------------------------------------------- /src/Unix/bincue_unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bincue_unix.h -- support for cdrom image files in bin/cue format 3 | * 4 | * (C) 2010 Geoffrey Brown 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef BINCUE_H 22 | #define BINCUE_H 23 | 24 | extern void *open_bincue(const char *name); 25 | extern bool readtoc_bincue(void *, uint8 *); 26 | extern size_t read_bincue(void *, void *, loff_t, size_t); 27 | extern loff_t size_bincue(void *); 28 | extern void close_bincue(void *); 29 | 30 | extern bool GetPosition_bincue(void *, uint8 *); 31 | 32 | extern bool CDPlay_bincue(void *, uint8, uint8, 33 | uint8, uint8, uint8, uint8); 34 | extern bool CDPause_bincue(void *); 35 | extern bool CDResume_bincue(void *); 36 | extern bool CDStop_bincue(void *); 37 | 38 | #ifdef USE_SDL_AUDIO 39 | extern void OpenAudio_bincue(int, int, int, uint8); 40 | extern void MixAudio_bincue(uint8 *, int); 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/Unix/cpr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # A script to copy recursively ignoring detritus. 3 | # I based this off of a script I had that copied over ssh. 4 | # source can be a file or directory. 5 | # Mike Sliczniak 2009 6 | 7 | # Don't copy resource forks or extended attributes on Mac OS X 10.4. 8 | COPY_EXTENDED_ATTRIBUTES_DISABLE=true; export COPY_EXTENDED_ATTRIBUTES_DISABLE 9 | 10 | # Don't copy resource forks or extended attributes on Mac OS X 10.5. 11 | COPYFILE_DISABLE=true; export COPYFILE_DISABLE 12 | 13 | case $# in 14 | 2) 15 | ;; 16 | *) 17 | echo "Usage: cpr source destdir" >&2 18 | exit 2 19 | ;; 20 | esac 21 | 22 | # dir and base names of the source 23 | d=`dirname "$1"` || exit 24 | b=`basename "$1"` || exit 25 | 26 | # handle relative and absolute destination dirs 27 | case "$2" in 28 | /*) 29 | p=$2 30 | ;; 31 | *) 32 | p="$PWD"/"$2" 33 | ;; 34 | esac 35 | 36 | # cd into the source dir 37 | cd "$d" || exit 38 | 39 | # This is only for Mac OS X, but some systems do not have gtar, find 40 | # sometimes lacks -f, and other systems use test -a. 41 | 42 | # List all interesting files for tar to copy: 43 | # The first clause skips directories used for revision control. 44 | # The second clause ignores detritus files from revision control and OSs. 45 | # The third clause ignores ._ style files created by Mac OS X on file systems 46 | # that do not have native resource forks or extended attributes. It checks to 47 | # see that the file it is associated with exists. 48 | find -f "$b" \( \! \( -type d \( \ 49 | -name CVS -o -name RCS -o -name SCCS -o -name .git -o -name .svn \ 50 | \) -prune \) \) \ 51 | \ 52 | \( \! \( -type f \( \ 53 | -name .DS_Store -o -name Thumbs.db -o -name .cvsignore -o -name .gitignore \ 54 | \) \) \) \ 55 | \ 56 | \( \! \( \ 57 | -type f -name '._*' -execdir /bin/sh -c \ 58 | 'f=`echo "$1" | sed "s:^\._:./:"`; [ -e "$f" ]' /bin/sh '{}' \; \ 59 | \) \) -print0 | tar -c -f - --null -T - --no-recursion | tar -x -C "$p" -f - 60 | -------------------------------------------------------------------------------- /src/Unix/cpuemu_nf.cpp: -------------------------------------------------------------------------------- 1 | #define NOFLAGS 2 | #include "cpuemu.cpp" 3 | -------------------------------------------------------------------------------- /src/Unix/cpustbl_nf.cpp: -------------------------------------------------------------------------------- 1 | #define NOFLAGS 2 | #include "cpustbl.cpp" 3 | -------------------------------------------------------------------------------- /src/Unix/disk_unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * disk_unix.h - Generic disk interface 3 | * 4 | * Basilisk II (C) Dave Vasilevsky 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef DISK_UNIX_H 22 | #define DISK_UNIX_H 23 | 24 | #include "sysdeps.h" 25 | 26 | struct disk_generic { 27 | enum status { 28 | DISK_UNKNOWN, 29 | DISK_INVALID, 30 | DISK_VALID, 31 | }; 32 | 33 | disk_generic() { } 34 | virtual ~disk_generic() { }; 35 | 36 | virtual bool is_read_only() = 0; 37 | virtual size_t read(void *buf, loff_t offset, size_t length) = 0; 38 | virtual size_t write(void *buf, loff_t offset, size_t length) = 0; 39 | virtual loff_t size() = 0; 40 | }; 41 | 42 | typedef disk_generic::status (disk_factory)(const char *path, bool read_only, 43 | disk_generic **disk); 44 | 45 | extern disk_factory disk_sparsebundle_factory; 46 | extern disk_factory disk_vhd_factory; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Unix/fbdevices: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # device depth offset for mmap(2) 3 | # ------------------------------------------------------------------------------ 4 | 5 | # Frame buffers known to work 6 | cgsix 8 0x70016000 7 | tcx 8 0x00000000 8 | 9 | # Untested frame buffers 10 | cgthree 8 0x04000000 11 | cgtwo 8 0x00000000 12 | cgfour 8 0x00000000 13 | cgeight 24 0x00000000 14 | tcx 24 0x01000000 15 | -------------------------------------------------------------------------------- /src/Unix/m4/egrep.m4: -------------------------------------------------------------------------------- 1 | # AC_PROG_EGREP 2 | # ------------- 3 | # This is predefined starting with Autoconf 2.54, so this conditional 4 | # definition can be removed once we require Autoconf 2.54 or later. 5 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], 6 | [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], 7 | [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 8 | then ac_cv_prog_egrep='grep -E' 9 | else ac_cv_prog_egrep='egrep' 10 | fi]) 11 | EGREP=$ac_cv_prog_egrep 12 | AC_SUBST([EGREP]) 13 | ])]) 14 | -------------------------------------------------------------------------------- /src/Unix/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case "${1}" in 16 | -h | --help | --h* ) # -h for help 17 | echo "${usage}" 1>&2; exit 0 ;; 18 | -m ) # -m PERM arg 19 | shift 20 | test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } 21 | dirmode="${1}" 22 | shift ;; 23 | -- ) shift; break ;; # stop option processing 24 | -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option 25 | * ) break ;; # first non-opt arg 26 | esac 27 | done 28 | 29 | for file 30 | do 31 | if test -d "$file"; then 32 | shift 33 | else 34 | break 35 | fi 36 | done 37 | 38 | case $# in 39 | 0) exit 0 ;; 40 | esac 41 | 42 | case $dirmode in 43 | '') 44 | if mkdir -p -- . 2>/dev/null; then 45 | echo "mkdir -p -- $*" 46 | exec mkdir -p -- "$@" 47 | fi ;; 48 | *) 49 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 50 | echo "mkdir -m $dirmode -p -- $*" 51 | exec mkdir -m "$dirmode" -p -- "$@" 52 | fi ;; 53 | esac 54 | 55 | for file 56 | do 57 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 58 | shift 59 | 60 | pathcomp= 61 | for d 62 | do 63 | pathcomp="$pathcomp$d" 64 | case "$pathcomp" in 65 | -* ) pathcomp=./$pathcomp ;; 66 | esac 67 | 68 | if test ! -d "$pathcomp"; then 69 | echo "mkdir $pathcomp" 70 | 71 | mkdir "$pathcomp" || lasterr=$? 72 | 73 | if test ! -d "$pathcomp"; then 74 | errstatus=$lasterr 75 | else 76 | if test ! -z "$dirmode"; then 77 | echo "chmod $dirmode $pathcomp" 78 | 79 | lasterr="" 80 | chmod "$dirmode" "$pathcomp" || lasterr=$? 81 | 82 | if test ! -z "$lasterr"; then 83 | errstatus=$lasterr 84 | fi 85 | fi 86 | fi 87 | fi 88 | 89 | pathcomp="$pathcomp/" 90 | done 91 | done 92 | 93 | exit $errstatus 94 | 95 | # Local Variables: 96 | # mode: shell-script 97 | # sh-indentation: 3 98 | # End: 99 | # mkinstalldirs ends here 100 | -------------------------------------------------------------------------------- /src/Unix/prefs_editor_gtk.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/Unix/prefs_editor_gtk.cpp -------------------------------------------------------------------------------- /src/Unix/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef __SEMAPHORE_H 2 | #define __SEMAPHORE_H 3 | 4 | #define SEM_VALUE_MAX 64 5 | 6 | #if defined(c_plusplus) || defined(__cplusplus) 7 | extern "C" { 8 | #endif /* c_plusplus || __cplusplus */ 9 | 10 | /* MacOS X doesn't implement unnamed POSIX semaphores, event though 11 | the libc defines them! */ 12 | #if (defined(__MACH__) && defined(__APPLE__)) 13 | #include 14 | #include 15 | #include 16 | 17 | #define sem_t semaphore_t 18 | #define sem_init(SEM,UNUSED,VALUE) semaphore_create(current_task(), (SEM), SYNC_POLICY_FIFO, (VALUE)) 19 | #define sem_destroy(SEM) semaphore_destroy(current_task(), *(SEM)) 20 | #define sem_wait(SEM) semaphore_wait(*(SEM)) 21 | #define sem_post(SEM) semaphore_signal(*(SEM)) 22 | #else 23 | typedef struct psem { 24 | pthread_mutex_t sem_lock; 25 | int sem_value; 26 | int sem_waiting; 27 | } sem_t; 28 | 29 | int sem_init(sem_t* sem, int pshared, unsigned int value); 30 | int sem_destroy(sem_t* sem); 31 | sem_t sem_open(const char* name, int oflag, ...); 32 | int sem_close(sem_t* sem); 33 | int sem_unlink(const char* name); 34 | int sem_wait(sem_t* sem); 35 | int sem_trywait(sem_t* sem); 36 | int sem_post(sem_t* sem); 37 | int sem_getvalue(sem_t* sem, int* sval); 38 | #endif 39 | 40 | #if defined(c_plusplus) || defined(__cplusplus) 41 | }; 42 | #endif /* c_plusplus || __cplusplus */ 43 | 44 | #endif /* __SEMAPHORE_H */ 45 | -------------------------------------------------------------------------------- /src/Unix/sshpty.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: sshpty.h,v 1.4 2002/03/04 17:27:39 stevesk Exp $ */ 2 | 3 | /* 4 | * Author: Tatu Ylonen 5 | * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland 6 | * All rights reserved 7 | * Functions for allocating a pseudo-terminal and making it the controlling 8 | * tty. 9 | * 10 | * As far as I am concerned, the code I have written for this software 11 | * can be used freely for any purpose. Any derived versions of this 12 | * software must be clearly marked as such, and if the derived work is 13 | * incompatible with the protocol description in the RFC file, it must be 14 | * called by a name other than "ssh" or "Secure Shell". 15 | */ 16 | 17 | #ifndef SSHPTY_H 18 | #define SSHPTY_H 19 | 20 | int pty_allocate(int *, int *, char *, int); 21 | void pty_release(const char *); 22 | void pty_make_controlling_tty(int *, const char *); 23 | void pty_change_window_size(int, int, int, int, int); 24 | void pty_setowner(struct passwd *, const char *); 25 | 26 | #endif /* SSHPTY_H */ 27 | -------------------------------------------------------------------------------- /src/Unix/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1998 Todd C. Miller 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include "config.h" 31 | #ifndef HAVE_STRLCPY 32 | 33 | #if defined(LIBC_SCCS) && !defined(lint) 34 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; 35 | #endif /* LIBC_SCCS and not lint */ 36 | 37 | #include 38 | #include 39 | #include "strlcpy.h" 40 | 41 | /* 42 | * Copy src to string dst of size siz. At most siz-1 characters 43 | * will be copied. Always NUL terminates (unless siz == 0). 44 | * Returns strlen(src); if retval >= siz, truncation occurred. 45 | */ 46 | size_t 47 | strlcpy(dst, src, siz) 48 | char *dst; 49 | const char *src; 50 | size_t siz; 51 | { 52 | register char *d = dst; 53 | register const char *s = src; 54 | register size_t n = siz; 55 | 56 | /* Copy as many bytes as will fit */ 57 | if (n != 0 && --n != 0) { 58 | do { 59 | if ((*d++ = *s++) == 0) 60 | break; 61 | } while (--n != 0); 62 | } 63 | 64 | /* Not enough room in dst, add NUL and traverse rest of src */ 65 | if (n == 0) { 66 | if (siz != 0) 67 | *d = '\0'; /* NUL-terminate dst */ 68 | while (*s++) 69 | ; 70 | } 71 | 72 | return(s - src - 1); /* count does not include NUL */ 73 | } 74 | 75 | #endif /* !HAVE_STRLCPY */ 76 | -------------------------------------------------------------------------------- /src/Unix/strlcpy.h: -------------------------------------------------------------------------------- 1 | /* $Id$ */ 2 | 3 | #ifndef _BSD_STRLCPY_H 4 | #define _BSD_STRLCPY_H 5 | 6 | #include "config.h" 7 | #ifndef HAVE_STRLCPY 8 | #include 9 | size_t strlcpy(char *dst, const char *src, size_t siz); 10 | #endif /* !HAVE_STRLCPY */ 11 | 12 | #endif /* _BSD_STRLCPY_H */ 13 | -------------------------------------------------------------------------------- /src/Unix/user_strings_unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_unix.h - Unix-specific localizable strings 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef USER_STRINGS_UNIX_H 22 | #define USER_STRINGS_UNIX_H 23 | 24 | enum { 25 | STR_NO_XSERVER_ERR = 10000, 26 | STR_NO_XVISUAL_ERR, 27 | STR_UNSUPP_DEPTH_ERR, 28 | STR_NO_FBDEVICE_FILE_ERR, 29 | STR_FBDEV_NAME_ERR, 30 | STR_FBDEV_MMAP_ERR, 31 | STR_VOSF_INIT_ERR, 32 | STR_NO_DEV_ZERO_ERR, 33 | STR_LOW_MEM_MMAP_ERR, 34 | STR_SIGALTSTACK_ERR, 35 | STR_SIG_INSTALL_ERR, 36 | STR_TIMER_CREATE_ERR, 37 | STR_TIMER_SETTIME_ERR, 38 | STR_TICK_THREAD_ERR, 39 | 40 | STR_BLOCKING_NET_SOCKET_WARN, 41 | STR_NO_SHEEP_NET_DRIVER_WARN, 42 | STR_SHEEP_NET_ATTACH_WARN, 43 | STR_TUN_TAP_CONFIG_WARN, 44 | STR_SLIRP_NO_DNS_FOUND_WARN, 45 | STR_SCSI_DEVICE_OPEN_WARN, 46 | STR_SCSI_DEVICE_NOT_SCSI_WARN, 47 | STR_NO_AUDIO_DEV_WARN, 48 | STR_NO_AUDIO_WARN, 49 | STR_AUDIO_FORMAT_WARN, 50 | STR_KEYCODE_FILE_WARN, 51 | STR_KEYCODE_VENDOR_WARN, 52 | 53 | STR_PREFS_MENU_FILE_GTK, 54 | STR_PREFS_ITEM_START_GTK, 55 | STR_PREFS_ITEM_ZAP_PRAM_GTK, 56 | STR_PREFS_ITEM_SEPL_GTK, 57 | STR_PREFS_ITEM_QUIT_GTK, 58 | STR_HELP_MENU_GTK, 59 | STR_HELP_ITEM_ABOUT_GTK, 60 | 61 | STR_FBDEV_NAME_CTRL, 62 | STR_FBDEVICE_FILE_CTRL, 63 | STR_DSPDEVICE_FILE_CTRL, 64 | STR_MIXERDEVICE_FILE_CTRL, 65 | 66 | STR_BROWSE_CTRL, 67 | STR_BROWSE_TITLE, 68 | STR_INPUT_PANE_TITLE, 69 | STR_KEYCODES_CTRL, 70 | STR_KEYCODE_FILE_CTRL, 71 | STR_MOUSEWHEELMODE_CTRL, 72 | STR_MOUSEWHEELMODE_PAGE_LAB, 73 | STR_MOUSEWHEELMODE_CURSOR_LAB, 74 | STR_MOUSEWHEELLINES_CTRL, 75 | 76 | STR_IGNORESEGV_CTRL, 77 | 78 | STR_WINDOW_TITLE_GRABBED, 79 | 80 | STR_NO_B2_EXE_FOUND 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/Unix/xpram_unix.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram_unix.cpp - XPRAM handling, Unix specific stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | 23 | #include 24 | 25 | #include "xpram.h" 26 | 27 | 28 | // XPRAM file name and path 29 | #if POWERPC_ROM 30 | const char XPRAM_FILE_NAME[] = ".sheepshaver_nvram"; 31 | #else 32 | const char XPRAM_FILE_NAME[] = ".basilisk_ii_xpram"; 33 | #endif 34 | static char xpram_path[1024]; 35 | 36 | 37 | /* 38 | * Load XPRAM from settings file 39 | */ 40 | 41 | void LoadXPRAM(const char *vmdir) 42 | { 43 | if (vmdir) { 44 | #if POWERPC_ROM 45 | snprintf(xpram_path, sizeof(xpram_path), "%s/nvram", vmdir); 46 | #else 47 | snprintf(xpram_path, sizeof(xpram_path), "%s/xpram", vmdir); 48 | #endif 49 | } else { 50 | // Construct XPRAM path 51 | xpram_path[0] = 0; 52 | char *home = getenv("HOME"); 53 | if (home != NULL && strlen(home) < 1000) { 54 | strncpy(xpram_path, home, 1000); 55 | strcat(xpram_path, "/"); 56 | } 57 | strcat(xpram_path, XPRAM_FILE_NAME); 58 | } 59 | 60 | // Load XPRAM from settings file 61 | int fd; 62 | if ((fd = open(xpram_path, O_RDONLY)) >= 0) { 63 | read(fd, XPRAM, XPRAM_SIZE); 64 | close(fd); 65 | } 66 | } 67 | 68 | 69 | /* 70 | * Save XPRAM to settings file 71 | */ 72 | 73 | void SaveXPRAM(void) 74 | { 75 | int fd; 76 | if ((fd = open(xpram_path, O_WRONLY | O_CREAT, 0666)) >= 0) { 77 | write(fd, XPRAM, XPRAM_SIZE); 78 | close(fd); 79 | } 80 | } 81 | 82 | 83 | /* 84 | * Delete PRAM file 85 | */ 86 | 87 | void ZapPRAM(void) 88 | { 89 | // Construct PRAM path 90 | xpram_path[0] = 0; 91 | char *home = getenv("HOME"); 92 | if (home != NULL && strlen(home) < 1000) { 93 | strncpy(xpram_path, home, 1000); 94 | strcat(xpram_path, "/"); 95 | } 96 | strcat(xpram_path, XPRAM_FILE_NAME); 97 | 98 | // Delete file 99 | unlink(xpram_path); 100 | } 101 | -------------------------------------------------------------------------------- /src/Windows/BasiliskII.DebugJIT.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | $(ProjectDir)Debug\ 6 | 7 | 8 | 9 | 10 | 11 | $(ToolsDir) 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Windows/BasiliskII.ReleaseJIT.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | $(ProjectDir)Release\ 6 | 7 | 8 | 9 | 10 | 11 | $(ToolsDir) 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Windows/BasiliskII.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/Windows/BasiliskII.ico -------------------------------------------------------------------------------- /src/Windows/BasiliskII.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | $(OutDir) 6 | 7 | 8 | 9 | 10 | 11 | $(ToolsDir) 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Windows/BasiliskII.rc: -------------------------------------------------------------------------------- 1 | BasiliskII ICON PRELOAD "BasiliskII.ico" 2 | 3 | -------------------------------------------------------------------------------- /src/Windows/BasiliskIIGUI.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/Windows/BasiliskIIGUI.ico -------------------------------------------------------------------------------- /src/Windows/BasiliskIIGUI.rc: -------------------------------------------------------------------------------- 1 | BasiliskIIGUI ICON PRELOAD "BasiliskIIGUI.ico" 2 | 3 | -------------------------------------------------------------------------------- /src/Windows/b2ether/driver/DEBUG.H: -------------------------------------------------------------------------------- 1 | /* 2 | * b2ether driver -- derived from DDK packet driver sample 3 | * 4 | * Basilisk II (C) 1997-1999 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #if DBG 24 | 25 | #define IF_PACKETDEBUG(f) if (PacketDebugFlag & (f)) 26 | extern ULONG PacketDebugFlag; 27 | 28 | #define PACKET_DEBUG_LOUD 0x00000001 // debugging info 29 | #define PACKET_DEBUG_VERY_LOUD 0x00000002 // excessive debugging info 30 | 31 | #define PACKET_DEBUG_INIT 0x00000100 // init debugging info 32 | 33 | #define IF_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_LOUD ) { A } 34 | #define IF_VERY_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_VERY_LOUD ) { A } 35 | #define IF_INIT_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_INIT ) { A } 36 | 37 | #else 38 | 39 | #define IF_LOUD(A) 40 | #define IF_VERY_LOUD(A) 41 | #define IF_INIT_LOUD(A) 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/Windows/b2ether/driver/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the driver components of the Windows NT DDK 5 | # 6 | 7 | !INCLUDE $(NTMAKEENV)\makefile.def 8 | -------------------------------------------------------------------------------- /src/Windows/b2ether/driver/SOURCES: -------------------------------------------------------------------------------- 1 | # MYMODE must be set 2 | 3 | TARGETNAME=b2ether 4 | TARGETPATH=$(BASEDIR)\lib 5 | TARGETTYPE=DRIVER 6 | 7 | TARGETLIBS=$(BASEDIR)\lib\*\$(DDKBUILDENV)\ndis.lib 8 | INCLUDES=$(BASEDIR)\inc;$(BASEDIR)\src\network\inc;..\inc 9 | 10 | MSC_WARNING_LEVEL=/W3 /WX /FR /FAcs /D$(MYMODE) 11 | 12 | SOURCES=b2ether.c \ 13 | b2ether_openclose.c \ 14 | b2ether_read.c \ 15 | b2ether_write.c 16 | -------------------------------------------------------------------------------- /src/Windows/b2ether/inc/ntddpack.h: -------------------------------------------------------------------------------- 1 | // #include 2 | 3 | #ifndef __NTDDPACKET 4 | #define __NTDDPACKET 1 5 | 6 | // #include 7 | 8 | #define MAX_LINK_NAME_LENGTH 124 9 | 10 | #pragma pack(1) 11 | typedef struct _PACKET_OID_DATA { 12 | ULONG Oid; 13 | ULONG Length; 14 | UCHAR Data[1]; 15 | } ATTRIBUTE_PACKED PACKET_OID_DATA, *PPACKET_OID_DATA; 16 | #pragma pack() 17 | 18 | 19 | #define FILE_DEVICE_PROTOCOL 0x8000 20 | 21 | 22 | 23 | #define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) 24 | #define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) 25 | #define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) 26 | #define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) 27 | #define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) 28 | #define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) 29 | #define IOCTL_PROTOCOL_SELECT_BY_NAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) 30 | #define IOCTL_ENUM_ADAPTERS CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Windows/b2ether/multiopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * multiopt.h 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | enum { 24 | ETHER_MULTICAST_MAC, 25 | ETHER_MULTICAST_ALL, 26 | ETHER_MULTICAST_PROMISCUOUS 27 | }; 28 | -------------------------------------------------------------------------------- /src/Windows/b2ether/nt5/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the driver components of the Windows NT DDK 5 | # 6 | 7 | !INCLUDE $(NTMAKEENV)\makefile.def 8 | -------------------------------------------------------------------------------- /src/Windows/b2ether/nt5/NTDDPACK.H: -------------------------------------------------------------------------------- 1 | // #include 2 | 3 | #ifndef __NTDDPACKET 4 | #define __NTDDPACKET 1 5 | 6 | // #include 7 | 8 | #define MAX_LINK_NAME_LENGTH 124 9 | 10 | #pragma pack(1) 11 | typedef struct _PACKET_OID_DATA { 12 | ULONG Oid; 13 | ULONG Length; 14 | UCHAR Data[1]; 15 | } PACKET_OID_DATA, *PPACKET_OID_DATA; 16 | #pragma pack() 17 | 18 | 19 | #define FILE_DEVICE_PROTOCOL 0x8000 20 | 21 | 22 | 23 | #define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) 24 | #define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) 25 | #define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) 26 | #define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) 27 | #define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) 28 | #define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) 29 | #define IOCTL_PROTOCOL_SELECT_BY_NAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) 30 | #define IOCTL_ENUM_ADAPTERS CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Windows/b2ether/nt5/SOURCES: -------------------------------------------------------------------------------- 1 | # MYMODE must be set 2 | 3 | TARGETNAME=b2ether 4 | TARGETPATH=obj 5 | TARGETTYPE=DRIVER 6 | 7 | TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib 8 | C_DEFINES=$(C_DEFINES) -DNDIS50 9 | INCLUDES=$(BASEDIR)\inc;$(BASEDIR)\src\network\inc;..\inc 10 | 11 | MSC_WARNING_LEVEL=/W3 /WX /FR /FAcs /D$(MYMODE) 12 | 13 | SOURCES=b2ether.c \ 14 | b2ether_openclose.c \ 15 | b2ether_read.c \ 16 | b2ether_write.c \ 17 | b2ether.rc 18 | -------------------------------------------------------------------------------- /src/Windows/b2ether/nt5/b2ether.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define VER_FILETYPE VFT_DRV 5 | #define VER_FILESUBTYPE VFT2_DRV_NETWORK 6 | #define VER_FILEDESCRIPTION_STR "Basilisk II Protocol Driver" 7 | #define VER_INTERNALNAME_STR "B2ETHER.SYS" 8 | #define VER_ORIGINALFILENAME_STR "B2ETHER.SYS" 9 | 10 | #include "common.ver" 11 | -------------------------------------------------------------------------------- /src/Windows/b2ether/nt5/b2ether64.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "b2ether64", "b2ether64.vcxproj", "{F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Debug|Win32.Build.0 = Debug|Win32 16 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Debug|x64.ActiveCfg = Debug|x64 17 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Debug|x64.Build.0 = Debug|x64 18 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Release|Win32.ActiveCfg = Release|Win32 19 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Release|Win32.Build.0 = Release|Win32 20 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Release|x64.ActiveCfg = Release|x64 21 | {F7EA62B6-E0EC-4074-8A83-D0CBB1C990B4}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /src/Windows/build68k.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Windows/cdenable/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cache.cpp - simple floppy/cd cache for Win32 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #ifndef _CACHE_H_ 28 | #define _CACHE_H_ 29 | #define NBLOCKS 1000 30 | 31 | typedef struct { 32 | int inited; 33 | int res_count; 34 | int sector_size; 35 | char *blocks; 36 | int *block; 37 | DWORD *LRU; 38 | } cachetype; 39 | 40 | void cache_init( cachetype *cptr ); 41 | void cache_clear( cachetype *cptr ); 42 | void cache_final( cachetype *cptr ); 43 | int cache_get( cachetype *cptr, int block, char *buf ); 44 | void cache_put( cachetype *cptr, int block, char *buf, int ss ); 45 | void cache_remove( cachetype *cptr, int block, int ss ); 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | } // extern "C" 50 | #endif 51 | -------------------------------------------------------------------------------- /src/Windows/cdenable/cdenable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cdenable.h - cdenable.vxd definitions 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | // max read requests, if larger -> STATUS_INVALID_PARAMETER 24 | #define CDENABLE_MAX_TRANSFER_SIZE (0x10000) 25 | 26 | 27 | // A structure representing the instance information associated with 28 | // a particular device 29 | typedef struct _DEVICE_EXTENSION 30 | { 31 | // not needed. 32 | ULONG StateVariable; 33 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION; 34 | 35 | 36 | // Define the various device type values. Note that values used by Microsoft 37 | // Corporation are in the range 0-32767, and 32768-65535 are reserved for use 38 | // by customers. 39 | #define FILE_DEVICE_CDENABLE 0x00008301 40 | 41 | 42 | // Target NT version, internal version 43 | #define CDENABLE_CURRENT_VERSION 0x04000100 44 | 45 | 46 | // Macro definition for defining IOCTL and FSCTL function control codes. Note 47 | // that function codes 0-2047 are reserved for Microsoft Corporation, and 48 | // 2048-4095 are reserved for customers. 49 | #define CDENABLE_IOCTL_READ 0x830 50 | #define CDENABLE_IOCTL_GET_VERSION 0x831 51 | 52 | 53 | #define IOCTL_CDENABLE_READ CTL_CODE(FILE_DEVICE_CDENABLE, \ 54 | CDENABLE_IOCTL_READ, \ 55 | METHOD_BUFFERED, \ 56 | FILE_ANY_ACCESS) 57 | #define IOCTL_CDENABLE_GET_VERSION CTL_CODE(FILE_DEVICE_CDENABLE, \ 58 | CDENABLE_IOCTL_GET_VERSION, \ 59 | METHOD_BUFFERED, \ 60 | FILE_ANY_ACCESS) 61 | -------------------------------------------------------------------------------- /src/Windows/cdenable/eject_nt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eject_nt.cpp - cd eject routines for WinNT (derived from MS samples) 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _EJECT_NT_H_ 24 | #define _EJECT_NT_H_ 25 | 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | BOOL EjectVolume(TCHAR cDriveLetter,BOOL reload); 32 | 33 | HANDLE OpenVolume(TCHAR cDriveLetter); 34 | BOOL LockVolume(HANDLE hVolume); 35 | BOOL DismountVolume(HANDLE hVolume); 36 | BOOL PreventRemovalOfVolume(HANDLE hVolume, BOOL fPrevent); 37 | BOOL AutoEjectVolume(HANDLE hVolume,BOOL reload); 38 | BOOL CloseVolume(HANDLE hVolume); 39 | 40 | #ifdef __cplusplus 41 | } // extern "C" 42 | #endif 43 | 44 | #endif //_EJECT_NT_H_ 45 | -------------------------------------------------------------------------------- /src/Windows/ether_windows.h: -------------------------------------------------------------------------------- 1 | #ifndef _ETHER_WINDOWS_H_ 2 | #define _ETHER_WINDOWS_H_ 3 | 4 | void enqueue_packet( const uint8 *buf, int sz ); 5 | 6 | #ifdef SHEEPSHAVER 7 | extern uint8 ether_addr[6]; 8 | #endif 9 | 10 | #endif // _ETHER_WINDOWS_H_ 11 | -------------------------------------------------------------------------------- /src/Windows/gencomp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/Windows/gencpu.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/Windows/router/arp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * arp.h - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _ARP_H_ 24 | #define _ARP_H_ 25 | 26 | bool write_arp( arp_t *req, int len ); 27 | 28 | #endif // _ARP_H_ 29 | -------------------------------------------------------------------------------- /src/Windows/router/dump.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * dump.cpp - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include "sysdeps.h" 24 | #include "main.h" 25 | #include "dump.h" 26 | 27 | #if DEBUG 28 | #pragma optimize("",off) 29 | #endif 30 | 31 | #include "debug.h" 32 | 33 | 34 | void dump_bytes( uint8 *packet, int length ) 35 | { 36 | #if DEBUG 37 | char buf[1000], sm[10]; 38 | 39 | *buf = 0; 40 | 41 | if(length > 256) length = 256; 42 | 43 | for (int i=0; i= 0 && index < (int)ip_array_sz ? ip_array[index] : 0; 69 | } 70 | -------------------------------------------------------------------------------- /src/Windows/router/mib/interfaces.h: -------------------------------------------------------------------------------- 1 | /* 2 | * intercafes.h - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _INTERFACES_H_ 24 | #define _INTERFACES_H_ 25 | 26 | // A wrapper to the MibII class. Enumerates all ip interfaces 27 | // currently in this computer. The interface list is not static. 28 | 29 | void init_interfaces(); 30 | void final_interfaces(); 31 | 32 | int get_ip_count(); 33 | uint32 get_ip_by_index( int index ); 34 | 35 | #endif // _INTERFACES_H_ 36 | -------------------------------------------------------------------------------- /src/Windows/router/mib/mibaccess.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////// 2 | // FILE : MibAccess.h 3 | // 4 | // 5 | 6 | #ifndef _SNMP_ACCESS_H_ 7 | #define _SNMP_ACCESS_H_ 8 | 9 | #include 10 | #ifndef SNMP_FUNC_TYPE 11 | #define SNMP_FUNC_TYPE WINAPI 12 | #endif 13 | 14 | ////////////////////////////////////////////////////////////// 15 | // Definition of pointers to the four functions in the Mib Dll 16 | // 17 | typedef BOOL (WINAPI *pSnmpExtensionInit)( 18 | IN DWORD dwTimeZeroReference, 19 | OUT HANDLE *hPollForTrapEvent, 20 | OUT AsnObjectIdentifier *supportedView); 21 | 22 | typedef BOOL (WINAPI *pSnmpExtensionTrap)( 23 | OUT AsnObjectIdentifier *enterprise, 24 | OUT AsnInteger *genericTrap, 25 | OUT AsnInteger *specificTrap, 26 | OUT AsnTimeticks *timeStamp, 27 | OUT RFC1157VarBindList *variableBindings); 28 | 29 | typedef BOOL (WINAPI *pSnmpExtensionQuery)( 30 | IN BYTE requestType, 31 | IN OUT RFC1157VarBindList *variableBindings, 32 | OUT AsnInteger *errorStatus, 33 | OUT AsnInteger *errorIndex); 34 | 35 | typedef BOOL (WINAPI *pSnmpExtensionInitEx)(OUT AsnObjectIdentifier *supportedView); 36 | 37 | 38 | class MibExtLoad 39 | { 40 | public: 41 | MibExtLoad( LPCTSTR MibDllName, LPCTSTR SnmpDllName ); 42 | ~MibExtLoad(); 43 | BOOL Init(DWORD dwTimeZeroReference,HANDLE *hPollForTrapEvent,AsnObjectIdentifier *supportedView); 44 | BOOL InitEx(AsnObjectIdentifier *supportedView); 45 | BOOL Query(BYTE requestType,OUT RFC1157VarBindList *variableBindings, 46 | AsnInteger *errorStatus,AsnInteger *errorIndex); 47 | 48 | BOOL Trap(AsnObjectIdentifier *enterprise, AsnInteger *genericTrap, 49 | AsnInteger *specificTrap, AsnTimeticks *timeStamp, 50 | RFC1157VarBindList *variableBindings); 51 | 52 | public: 53 | HINSTANCE m_hInst; 54 | HINSTANCE m_hInst_snmputil; 55 | 56 | private: 57 | pSnmpExtensionInit m_Init; 58 | pSnmpExtensionInitEx m_InitEx; 59 | pSnmpExtensionQuery m_Query; 60 | pSnmpExtensionTrap m_Trap; 61 | 62 | public: 63 | VOID (SNMP_FUNC_TYPE *m_SnmpUtilVarBindFree) (SnmpVarBind *); 64 | SNMPAPI (SNMP_FUNC_TYPE *m_SnmpUtilOidNCmp) (AsnObjectIdentifier *, AsnObjectIdentifier *, UINT); 65 | SNMPAPI (SNMP_FUNC_TYPE *m_SnmpUtilOidCpy) (AsnObjectIdentifier *, AsnObjectIdentifier *); 66 | }; 67 | 68 | 69 | class MibII: public MibExtLoad 70 | { 71 | public: 72 | MibII( bool load_winsock ); 73 | ~MibII(); 74 | BOOL Init(); 75 | 76 | void GetIPAddress(UINT IpArray[],UINT &IpArraySize); 77 | void GetIPMask(UINT IpArray[],UINT &IpArraySize); 78 | 79 | protected: 80 | bool m_load_winsock; 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/Windows/router/router.h: -------------------------------------------------------------------------------- 1 | /* 2 | * router.h - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _ROUTER_H_ 24 | #define _ROUTER_H_ 25 | 26 | extern bool is_router_shutting_down; 27 | extern CRITICAL_SECTION router_section; 28 | 29 | // Increased by one for each ip packet sent to the emulated enet interface. 30 | extern uint16 next_ip_ident_number; 31 | 32 | // Used by incoming icmp packets and internal icmp messages. Host byte order. 33 | extern uint32 macos_ip_address; 34 | 35 | // The magic constant 36 | extern const uint8 router_mac_addr[6]; 37 | 38 | // Used by internal icmp messages. Host byte order. 39 | extern uint32 router_ip_address; 40 | 41 | // False under NT/Win2k if the user has no admin rights 42 | extern bool raw_sockets_available; 43 | 44 | 45 | 46 | // Interface exposed to ether_windows module. 47 | bool router_init(void); 48 | void router_final(void); 49 | 50 | // Both of these return true if the ethernet module should drop the packet. 51 | bool router_write_packet(uint8 *packet, int len); 52 | bool router_read_packet(uint8 *packet, int len); 53 | 54 | #endif // _ROUTER_H_ 55 | -------------------------------------------------------------------------------- /src/Windows/router/tcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * tcp.h - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _TCP_H_ 24 | #define _TCP_H_ 25 | 26 | void write_tcp( tcp_t *tcp, int len ); 27 | 28 | void init_tcp(); 29 | void final_tcp(); 30 | 31 | #endif // _TCP_H_ 32 | -------------------------------------------------------------------------------- /src/Windows/router/udp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * udp.h - ip router 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * Windows platform specific code copyright (C) Lauri Pesonen 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #ifndef _UDP_H_ 24 | #define _UDP_H_ 25 | 26 | void write_udp( udp_t *udp, int len ); 27 | 28 | void CALLBACK udp_read_completion( 29 | DWORD error, 30 | DWORD bytes_read, 31 | LPWSAOVERLAPPED lpOverlapped, 32 | DWORD flags 33 | ); 34 | 35 | void init_udp(); 36 | void final_udp(); 37 | 38 | #endif // _UDP_H_ 39 | -------------------------------------------------------------------------------- /src/Windows/user_strings_windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_windows.h - Windows-specific localizable strings 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef USER_STRINGS_WINDOWS_H 22 | #define USER_STRINGS_WINDOWS_H 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus >= 201103L || _MSC_VER >= 1600 26 | #include 27 | 28 | // Convert text to wide string, given the string number 29 | extern std::unique_ptr GetStringW(int num); 30 | #endif 31 | #endif 32 | 33 | enum { 34 | STR_NO_XVISUAL_ERR = 10000, 35 | STR_VOSF_INIT_ERR, 36 | STR_SIG_INSTALL_ERR, 37 | STR_TICK_THREAD_ERR, 38 | STR_SLIRP_NO_DNS_FOUND_WARN, 39 | STR_NO_AUDIO_WARN, 40 | STR_KEYCODE_FILE_WARN, 41 | STR_KEYCODE_VENDOR_WARN, 42 | STR_WINDOW_TITLE_GRABBED, 43 | STR_NO_WIN32_NT_4, 44 | 45 | STR_PREFS_MENU_FILE_GTK, 46 | STR_PREFS_ITEM_START_GTK, 47 | STR_PREFS_ITEM_ZAP_PRAM_GTK, 48 | STR_PREFS_ITEM_SEPL_GTK, 49 | STR_PREFS_ITEM_QUIT_GTK, 50 | STR_HELP_MENU_GTK, 51 | STR_HELP_ITEM_ABOUT_GTK, 52 | 53 | STR_ABOUT_BUTTON, 54 | STR_FILE_CTRL, 55 | STR_BROWSE_CTRL, 56 | STR_BROWSE_TITLE, 57 | STR_SERIAL_PANE_TITLE, 58 | STR_NETWORK_PANE_TITLE, 59 | STR_INPUT_PANE_TITLE, 60 | STR_KEYCODES_CTRL, 61 | STR_KEYCODE_FILE_CTRL, 62 | STR_MOUSEWHEELMODE_CTRL, 63 | STR_MOUSEWHEELMODE_PAGE_LAB, 64 | STR_MOUSEWHEELMODE_CURSOR_LAB, 65 | STR_MOUSEWHEELLINES_CTRL, 66 | STR_POLLMEDIA_CTRL, 67 | STR_EXTFS_ENABLE_CTRL, 68 | STR_EXTFS_DRIVES_CTRL, 69 | STR_ETHER_FTP_PORT_LIST_CTRL, 70 | STR_ETHER_TCP_PORT_LIST_CTRL, 71 | 72 | STR_IGNORESEGV_CTRL, 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/Windows/xpram_windows.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram_windows.cpp - XPRAM handling, Windows specific stuff 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | 23 | #include 24 | typedef std::basic_string tstring; 25 | 26 | #include "xpram.h" 27 | 28 | 29 | // XPRAM file name and path 30 | #if POWERPC_ROM 31 | const TCHAR XPRAM_FILE_NAME[] = TEXT("SheepShaver_nvram.dat"); 32 | #else 33 | const TCHAR XPRAM_FILE_NAME[] = TEXT("BasiliskII_xpram.dat"); 34 | #endif 35 | static tstring xpram_path; 36 | 37 | 38 | /* 39 | * Construct XPRAM path 40 | */ 41 | 42 | static void build_xpram_path(void) 43 | { 44 | xpram_path.clear(); 45 | int pwd_len = GetCurrentDirectory(0, NULL); 46 | TCHAR *pwd = new TCHAR[pwd_len]; 47 | if (GetCurrentDirectory(pwd_len, pwd) == pwd_len - 1) 48 | xpram_path = tstring(pwd) + TEXT('\\'); 49 | delete[] pwd; 50 | xpram_path += XPRAM_FILE_NAME; 51 | } 52 | 53 | 54 | /* 55 | * Load XPRAM from settings file 56 | */ 57 | 58 | void LoadXPRAM(const char *vmdir) 59 | { 60 | // Construct XPRAM path 61 | build_xpram_path(); 62 | 63 | // Load XPRAM from settings file 64 | HANDLE fh = CreateFile(xpram_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 65 | if (fh != INVALID_HANDLE_VALUE) { 66 | DWORD bytesRead; 67 | ReadFile(fh, XPRAM, XPRAM_SIZE, &bytesRead, NULL); 68 | CloseHandle(fh); 69 | } 70 | } 71 | 72 | 73 | /* 74 | * Save XPRAM to settings file 75 | */ 76 | 77 | void SaveXPRAM(void) 78 | { 79 | HANDLE fh = CreateFile(xpram_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 80 | if (fh != INVALID_HANDLE_VALUE) { 81 | DWORD bytesWritten; 82 | WriteFile(fh, XPRAM, XPRAM_SIZE, &bytesWritten, NULL); 83 | CloseHandle(fh); 84 | } 85 | } 86 | 87 | 88 | /* 89 | * Delete PRAM file 90 | */ 91 | 92 | void ZapPRAM(void) 93 | { 94 | // Construct PRAM path 95 | build_xpram_path(); 96 | 97 | // Delete file 98 | DeleteFile(xpram_path.c_str()); 99 | } 100 | -------------------------------------------------------------------------------- /src/dummy/clip_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * clip_dummy.cpp - Clipboard handling, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | 23 | #include "clip.h" 24 | #include "macos_util.h" 25 | 26 | #define DEBUG 0 27 | #include "debug.h" 28 | 29 | 30 | /* 31 | * Initialization 32 | */ 33 | 34 | void ClipInit(void) 35 | { 36 | } 37 | 38 | 39 | /* 40 | * Deinitialization 41 | */ 42 | 43 | void ClipExit(void) 44 | { 45 | } 46 | 47 | 48 | /* 49 | * Mac application reads clipboard 50 | */ 51 | 52 | void GetScrap(void **handle, uint32 type, int32 offset) 53 | { 54 | D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); 55 | } 56 | 57 | /* 58 | * ZeroScrap() is called before a Mac application writes to the clipboard; clears out the previous contents 59 | */ 60 | 61 | void ZeroScrap() 62 | { 63 | D(bug("ZeroScrap\n")); 64 | } 65 | 66 | /* 67 | * Mac application wrote to clipboard 68 | */ 69 | 70 | void PutScrap(uint32 type, void *scrap, int32 length) 71 | { 72 | D(bug("PutScrap type %08lx, data %08lx, length %ld\n", type, scrap, length)); 73 | if (length <= 0) 74 | return; 75 | 76 | switch (type) { 77 | case FOURCC('T','E','X','T'): 78 | D(bug(" clipping TEXT\n")); 79 | break; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/dummy/prefs_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * prefs_dummy.cpp - Preferences handling, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | 23 | #include 24 | #include 25 | 26 | #include "prefs.h" 27 | 28 | 29 | // Platform-specific preferences items 30 | prefs_desc platform_prefs_items[] = { 31 | {NULL, TYPE_END, false} // End of list 32 | }; 33 | 34 | 35 | // Prefs file name and path 36 | const char PREFS_FILE_NAME[] = "BasiliskII_Prefs"; 37 | 38 | 39 | /* 40 | * Load preferences from settings file 41 | */ 42 | 43 | void LoadPrefs(void) 44 | { 45 | // Read preferences from settings file 46 | FILE *f = fopen(PREFS_FILE_NAME, "r"); 47 | if (f != NULL) { 48 | 49 | // Prefs file found, load settings 50 | LoadPrefsFromStream(f); 51 | fclose(f); 52 | 53 | } else { 54 | 55 | // No prefs file, save defaults 56 | SavePrefs(); 57 | } 58 | } 59 | 60 | 61 | /* 62 | * Save preferences to settings file 63 | */ 64 | 65 | void SavePrefs(void) 66 | { 67 | FILE *f; 68 | if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) { 69 | SavePrefsToStream(f); 70 | fclose(f); 71 | } 72 | } 73 | 74 | 75 | /* 76 | * Add defaults of platform-specific prefs items 77 | * You may also override the defaults set in PrefsInit() 78 | */ 79 | 80 | void AddPlatformPrefsDefaults(void) 81 | { 82 | } 83 | -------------------------------------------------------------------------------- /src/dummy/prefs_editor_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * prefs_editor_dummy.cpp - Preferences editor, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | #include "prefs.h" 23 | #include "prefs_editor.h" 24 | #include "user_strings.h" 25 | 26 | 27 | /* 28 | * Show preferences editor 29 | * Returns true when user clicked on "Start", false otherwise 30 | */ 31 | 32 | bool PrefsEditor(void) 33 | { 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /src/dummy/scsi_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * scsi_dummy.cpp - SCSI Manager, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | #include "main.h" 23 | #include "scsi.h" 24 | 25 | #define DEBUG 0 26 | #include "debug.h" 27 | 28 | 29 | /* 30 | * Initialization 31 | */ 32 | 33 | void SCSIInit(void) 34 | { 35 | // Reset SCSI bus 36 | SCSIReset(); 37 | } 38 | 39 | 40 | /* 41 | * Deinitialization 42 | */ 43 | 44 | void SCSIExit(void) 45 | { 46 | } 47 | 48 | 49 | /* 50 | * Set SCSI command to be sent by scsi_send_cmd() 51 | */ 52 | 53 | void scsi_set_cmd(int cmd_length, uint8 *cmd) 54 | { 55 | } 56 | 57 | 58 | /* 59 | * Check for presence of SCSI target 60 | */ 61 | 62 | bool scsi_is_target_present(int id) 63 | { 64 | return false; 65 | } 66 | 67 | 68 | /* 69 | * Set SCSI target (returns false on error) 70 | */ 71 | 72 | bool scsi_set_target(int id, int lun) 73 | { 74 | return false; 75 | } 76 | 77 | 78 | /* 79 | * Send SCSI command to active target (scsi_set_command() must have been called), 80 | * read/write data according to S/G table (returns false on error) 81 | */ 82 | 83 | bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout) 84 | { 85 | return false; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/dummy/user_strings_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * user_strings_dummy.cpp - Localizable strings, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | #include "user_strings.h" 23 | 24 | 25 | // Platform-specific string definitions 26 | const user_string_def platform_strings[] = { 27 | {-1, NULL} // End marker 28 | }; 29 | 30 | 31 | /* 32 | * Fetch pointer to string, given the string number 33 | */ 34 | 35 | char *GetString(int num) 36 | { 37 | // First search for platform-specific string 38 | int i = 0; 39 | while (platform_strings[i].num >= 0) { 40 | if (platform_strings[i].num == num) 41 | return platform_strings[i].str; 42 | i++; 43 | } 44 | 45 | // Not found, search for common string 46 | i = 0; 47 | while (common_strings[i].num >= 0) { 48 | if (common_strings[i].num == num) 49 | return common_strings[i].str; 50 | i++; 51 | } 52 | return NULL; 53 | } 54 | -------------------------------------------------------------------------------- /src/dummy/xpram_dummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram_dummy.cpp - XPRAM handling, dummy implementation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "sysdeps.h" 22 | 23 | #include 24 | #include 25 | 26 | #include "xpram.h" 27 | 28 | 29 | // XPRAM file name and path 30 | const char XPRAM_FILE_NAME[] = "BasiliskII_XPRAM"; 31 | 32 | 33 | /* 34 | * Load XPRAM from settings file 35 | */ 36 | 37 | void LoadXPRAM(const char *vmdir) 38 | { 39 | FILE *f = fopen(XPRAM_FILE_NAME, "rb"); 40 | if (f != NULL) { 41 | fread(XPRAM, 256, 1, f); 42 | fclose(f); 43 | } 44 | } 45 | 46 | 47 | /* 48 | * Save XPRAM to settings file 49 | */ 50 | 51 | void SaveXPRAM(void) 52 | { 53 | FILE *f = fopen(XPRAM_FILE_NAME, "wb"); 54 | if (f != NULL) { 55 | fwrite(XPRAM, 256, 1, f); 56 | fclose(f); 57 | } 58 | } 59 | 60 | 61 | /* 62 | * Delete PRAM file 63 | */ 64 | 65 | void ZapPRAM(void) 66 | { 67 | remove(XPRAM_FILE_NAME); 68 | } 69 | -------------------------------------------------------------------------------- /src/guichan/rw_config.h: -------------------------------------------------------------------------------- 1 | 2 | /* What is being loaded */ 3 | #define MENU_ADD_VOLUME 1 4 | #define MENU_ADD_DIR 2 5 | #define MENU_SELECT_ROM 3 6 | 7 | extern int current_drive; 8 | extern char launchDir[300]; 9 | extern char currentDir[300]; -------------------------------------------------------------------------------- /src/include/adb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * adb.h - ADB emulation (mouse/keyboard) 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef ADB_H 22 | #define ADB_H 23 | 24 | extern void ADBInit(void); 25 | extern void ADBExit(void); 26 | 27 | extern void ADBOp(uint8 op, uint8 *data); 28 | 29 | extern void ADBMouseMoved(int x, int y); 30 | extern void ADBMouseDown(int button); 31 | extern void ADBMouseUp(int button); 32 | 33 | extern void ADBKeyDown(int code); 34 | extern void ADBKeyUp(int code); 35 | 36 | extern void ADBInterrupt(void); 37 | 38 | extern void ADBSetRelMouseMode(bool relative); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/include/cdrom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cdrom.h - CD-ROM driver 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef CDROM_H 22 | #define CDROM_H 23 | 24 | const int CDROMRefNum = -62; // RefNum of driver 25 | const uint16 CDROMDriverFlags = 0x6d04; // Driver flags 26 | 27 | extern const uint8 CDROMIcon[258]; // Icon data (copied to ROM by PatchROM()) 28 | 29 | extern uint32 CDROMIconAddr; // Icon address (Mac address space, set by PatchROM()) 30 | 31 | extern void CDROMInit(void); 32 | extern void CDROMExit(void); 33 | 34 | extern void CDROMInterrupt(void); 35 | 36 | extern bool CDROMMountVolume(void *fh); 37 | 38 | extern int16 CDROMOpen(uint32 pb, uint32 dce); 39 | extern int16 CDROMPrime(uint32 pb, uint32 dce); 40 | extern int16 CDROMControl(uint32 pb, uint32 dce); 41 | extern int16 CDROMStatus(uint32 pb, uint32 dce); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/include/clip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * clip.h - Clipboard handling 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef CLIP_H 22 | #define CLIP_H 23 | 24 | extern void ClipInit(void); 25 | extern void ClipExit(void); 26 | 27 | extern void ZeroScrap(); 28 | extern void PutScrap(uint32 type, void *scrap, int32 length); 29 | extern void GetScrap(void **handle, uint32 type, int32 offset); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/include/disk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * disk.h - Generic disk driver 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef DISK_H 22 | #define DISK_H 23 | 24 | const int DiskRefNum = -63; // RefNum of driver 25 | const uint16 DiskDriverFlags = 0x6f04; // Driver flags 26 | 27 | extern const uint8 DiskIcon[258]; // Icon data (copied to ROM by PatchROM()) 28 | 29 | extern uint32 DiskIconAddr; // Icon address (Mac address space, set by PatchROM()) 30 | 31 | extern void DiskInit(void); 32 | extern void DiskExit(void); 33 | 34 | extern void DiskInterrupt(void); 35 | 36 | extern bool DiskMountVolume(void *fh); 37 | 38 | extern int16 DiskOpen(uint32 pb, uint32 dce); 39 | extern int16 DiskPrime(uint32 pb, uint32 dce); 40 | extern int16 DiskControl(uint32 pb, uint32 dce); 41 | extern int16 DiskStatus(uint32 pb, uint32 dce); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/include/ether_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ether_defs.h - Definitions for MacOS Ethernet drivers 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef ETHER_DEFS_H 22 | #define ETHER_DEFS_H 23 | 24 | // Error codes 25 | enum { 26 | eMultiErr = -91, 27 | eLenErr = -92, 28 | lapProtErr = -94, 29 | excessCollsns = -95 30 | }; 31 | 32 | // Control codes 33 | enum { 34 | kENetSetGeneral = 253, 35 | kENetGetInfo = 252, 36 | kENetRdCancel = 251, 37 | kENetRead = 250, 38 | kENetWrite = 249, 39 | kENetDetachPH = 248, 40 | kENetAttachPH = 247, 41 | kENetAddMulti = 246, 42 | kENetDelMulti = 245 43 | }; 44 | 45 | enum { // EParamBlock struct 46 | eProtType = 28, 47 | ePointer = 30, 48 | eBuffSize = 34, 49 | eDataSize = 36, 50 | eMultiAddr = 28 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/include/extfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * extfs.h - MacOS file system for access native file system access 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef EXTFS_H 22 | #define EXTFS_H 23 | 24 | extern void ExtFSInit(void); 25 | extern void ExtFSExit(void); 26 | 27 | extern void InstallExtFS(void); 28 | 29 | extern int16 ExtFSComm(uint16 message, uint32 paramBlock, uint32 globalsPtr); 30 | extern int16 ExtFSHFS(uint32 vcb, uint16 selectCode, uint32 paramBlock, uint32 globalsPtr, int16 fsid); 31 | 32 | // System specific and internal functions/data 33 | extern void extfs_init(void); 34 | extern void extfs_exit(void); 35 | extern void add_path_component(char *path, const char *component); 36 | extern void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir); 37 | extern void set_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir); 38 | extern uint32 get_rfork_size(const char *path); 39 | extern int open_rfork(const char *path, int flag); 40 | extern void close_rfork(const char *path, int fd); 41 | extern ssize_t extfs_read(int fd, void *buffer, size_t length); 42 | extern ssize_t extfs_write(int fd, void *buffer, size_t length); 43 | extern bool extfs_remove(const char *path); 44 | extern bool extfs_rename(const char *old_path, const char *new_path); 45 | extern const char *host_encoding_to_macroman(const char *filename); // What if the guest OS is using MacJapanese or MacArabic? Oh well... 46 | extern const char *macroman_to_host_encoding(const char *filename); // What if the guest OS is using MacJapanese or MacArabic? Oh well... 47 | 48 | // Maximum length of full path name 49 | const int MAX_PATH_LENGTH = 1024; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/include/pict.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pict.h - convert an image to PICT. 3 | * 4 | * Currently creates a bitmap PICT resource; vector graphics are not preserved. 5 | * 6 | * By Charles Srstka. 7 | * 8 | * Public Domain. Do with it as you wish. 9 | * 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* 17 | * ConvertRGBAToPICT 18 | * 19 | * Converts image data, in 32-bit RGBA format, to PICT. 20 | * Calling it first with NULL for the buffer will cause it to return a suggested buffer size. 21 | * Returns the number of bytes actually written, or negative if something went wrong. 22 | * However, this usually just means the buffer wasn't large enough. 23 | */ 24 | 25 | ssize_t ConvertRGBAToPICT(uint8_t *buf, unsigned long bufSize, uint8_t *rgbaPixels, uint16_t width, uint16_t height); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/include/prefs_editor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * prefs_editor.h - Preferences editor 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef PREFS_EDITOR_H 22 | #define PREFS_EDITOR_H 23 | 24 | extern bool PrefsEditor(void); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/include/rom_patches.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rom_patches.h - ROM patches 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef ROM_PATCHES_H 22 | #define ROM_PATCHES_H 23 | 24 | // ROM version number, set by CheckROM() 25 | enum { 26 | ROM_VERSION_64K = 0x0000, // Original Macintosh (64KB) 27 | ROM_VERSION_PLUS = 0x0075, // Mac Plus ROMs (128KB) 28 | ROM_VERSION_CLASSIC = 0x0276, // SE/Classic ROMs (256/512KB) 29 | ROM_VERSION_II = 0x0178, // Not 32-bit clean Mac II ROMs (256KB) 30 | ROM_VERSION_32 = 0x067c // 32-bit clean Mac II ROMs (512KB/1MB) 31 | }; 32 | 33 | extern uint16 ROMVersion; 34 | 35 | // ROM offset of breakpoint, used by PatchROM() 36 | extern uint32 ROMBreakpoint; 37 | 38 | // ROM offset of UniversalInfo, set by PatchROM() 39 | extern uint32 UniversalInfo; 40 | 41 | // Mac address of PutScrap() patch 42 | extern uint32 PutScrapPatch; 43 | 44 | // Mac address of GetScrap() patch 45 | extern uint32 GetScrapPatch; 46 | 47 | // Flag: print ROM information in PatchROM() 48 | extern bool PrintROMInfo; 49 | 50 | extern bool CheckROM(void); 51 | extern bool PatchROM(void); 52 | extern void InstallDrivers(uint32 pb); 53 | extern void InstallSERD(void); 54 | extern void PatchAfterStartup(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/include/rsrc_patches.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rsrc_patches.h - Resource patches 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef RSRC_PATCHES_H 22 | #define RSRC_PATCHES_H 23 | 24 | extern void CheckLoad(uint32 type, int16 id, uint8 *p, uint32 size); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/include/scsi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * scsi.h - SCSI Manager 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef SCSI_H 22 | #define SCSI_H 23 | 24 | extern int16 SCSIReset(void); 25 | extern int16 SCSIGet(void); 26 | extern int16 SCSISelect(int id); 27 | extern int16 SCSICmd(int cmd_length, uint8 *cmd); 28 | extern int16 SCSIRead(uint32 tib); 29 | extern int16 SCSIWrite(uint32 tib); 30 | extern int16 SCSIComplete(uint32 timeout, uint32 message, uint32 stat); 31 | extern uint16 SCSIStat(void); 32 | extern int16 SCSIMgrBusy(void); 33 | 34 | // System specific and internal functions/data 35 | extern void SCSIInit(void); 36 | extern void SCSIExit(void); 37 | 38 | extern void scsi_set_cmd(int cmd_length, uint8 *cmd); 39 | extern bool scsi_is_target_present(int id); 40 | extern bool scsi_set_target(int id, int lun); 41 | extern bool scsi_send_cmd(size_t data_length, bool reading, int sg_index, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/include/slot_rom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * slot_rom.h - Slot declaration ROM 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef SLOT_ROM_H 22 | #define SLOT_ROM_H 23 | 24 | extern bool InstallSlotROM(void); 25 | extern void ChecksumSlotROM(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/include/sony.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sony.h - Replacement .Sony driver (floppy drives) 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef SONY_H 22 | #define SONY_H 23 | 24 | const int SonyRefNum = -5; // RefNum of driver 25 | const uint16 SonyDriverFlags = 0x6f00; // Driver flags 26 | 27 | extern const uint8 SonyDiskIcon[258]; // Icon data (copied to ROM by PatchROM()) 28 | extern const uint8 SonyDriveIcon[258]; 29 | 30 | extern uint32 SonyDiskIconAddr; // Icon addresses (Mac address space, set by PatchROM()) 31 | extern uint32 SonyDriveIconAddr; 32 | 33 | extern void SonyInit(void); 34 | extern void SonyExit(void); 35 | 36 | extern void SonyInterrupt(void); 37 | 38 | extern bool SonyMountVolume(void *fh); 39 | 40 | extern int16 SonyOpen(uint32 pb, uint32 dce); 41 | extern int16 SonyPrime(uint32 pb, uint32 dce); 42 | extern int16 SonyControl(uint32 pb, uint32 dce); 43 | extern int16 SonyStatus(uint32 pb, uint32 dce); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/include/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * timer.h - Time Manager emulation 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef TIMER_H 22 | #define TIMER_H 23 | 24 | extern void TimerInit(void); 25 | extern void TimerExit(void); 26 | extern void TimerReset(void); 27 | 28 | extern void TimerInterrupt(void); 29 | 30 | extern int16 InsTime(uint32 tm, uint16 trap); 31 | extern int16 RmvTime(uint32 tm); 32 | extern int16 PrimeTime(uint32 tm, int32 time); 33 | extern void Microseconds(uint32 &hi, uint32 &lo); 34 | 35 | extern uint32 TimerDateTime(void); 36 | 37 | // System specific and internal functions/data 38 | extern void timer_current_time(tm_time_t &t); 39 | extern void timer_add_time(tm_time_t &res, tm_time_t a, tm_time_t b); 40 | extern void timer_sub_time(tm_time_t &res, tm_time_t a, tm_time_t b); 41 | extern int timer_cmp_time(tm_time_t a, tm_time_t b); 42 | extern void timer_mac2host_time(tm_time_t &res, int32 mactime); 43 | extern int32 timer_host2mac_time(tm_time_t hosttime); 44 | 45 | // Suspend execution of emulator thread and resume it on events 46 | extern void idle_wait(void); 47 | extern void idle_resume(void); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/include/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * version.h - Version information 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef VERSION_H 22 | #define VERSION_H 23 | 24 | const int VERSION_MAJOR = 1; 25 | const int VERSION_MINOR = 0; 26 | 27 | #define VERSION_STRING "Basilisk II V1.0" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/include/xpram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram.h - XPRAM handling 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef XPRAM_H 22 | #define XPRAM_H 23 | 24 | #if POWERPC_ROM 25 | const int XPRAM_SIZE = 8192; 26 | #else 27 | const int XPRAM_SIZE = 256; 28 | #endif 29 | 30 | extern uint8 XPRAM[XPRAM_SIZE]; 31 | 32 | extern void XPRAMInit(const char *vmdir); 33 | extern void XPRAMExit(void); 34 | 35 | // System specific and internal functions/data 36 | extern void LoadXPRAM(const char *vmdir); 37 | extern void SaveXPRAM(void); 38 | extern void ZapPRAM(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/powerrom_cpu/cpu_emulation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cpu_emulation.h - Definitions for Basilisk II CPU emulation module (Apple PowerMac ROM 680x0 emulator version (BeOS/PPC)) 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef CPU_EMULATION_H 22 | #define CPU_EMULATION_H 23 | 24 | 25 | /* 26 | * Memory system 27 | */ 28 | 29 | // RAM and ROM pointers (allocated and set by main_*.cpp) 30 | extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 31 | extern uint8 *RAMBaseHost; // RAM base (host address space) 32 | extern uint32 RAMSize; // Size of RAM 33 | 34 | extern uint32 ROMBaseMac; // ROM base (Mac address space) 35 | extern uint8 *ROMBaseHost; // ROM base (host address space) 36 | extern uint32 ROMSize; // Size of ROM 37 | 38 | // Mac memory access functions 39 | static inline uint32 ReadMacInt32(uint32 addr) {return ntohl(*(uint32 *)addr);} 40 | static inline uint32 ReadMacInt16(uint32 addr) {return ntohs(*(uint16 *)addr);} 41 | static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;} 42 | static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = htonl(l);} 43 | static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = htons(w);} 44 | static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;} 45 | static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} 46 | static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} 47 | 48 | 49 | /* 50 | * 680x0 emulation 51 | */ 52 | 53 | // Initialization 54 | extern bool Init680x0(void); // This routine may want to look at CPUType/FPUType to set up the apropriate emulation 55 | extern void Exit680x0(void); 56 | 57 | // 680x0 emulation functions 58 | struct M68kRegisters; 59 | extern void Start680x0(void); // Reset and start 680x0 60 | extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine 61 | extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine 62 | 63 | // Interrupt functions 64 | extern void TriggerInterrupt(void); // Trigger interrupt (InterruptFlag must be set first) 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/slirp/ctl.h: -------------------------------------------------------------------------------- 1 | #define CTL_CMD 0 2 | #define CTL_EXEC 1 3 | #define CTL_ALIAS 2 4 | #define CTL_DNS 3 5 | 6 | #define CTL_SPECIAL "10.0.2.0" 7 | #define CTL_LOCAL "10.0.2.15" 8 | -------------------------------------------------------------------------------- /src/slirp/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | //#define DEBUG 1 9 | 10 | #ifdef DEBUG 11 | 12 | #define DBG_CALL 0x1 13 | #define DBG_MISC 0x2 14 | #define DBG_ERROR 0x4 15 | 16 | #define dfd stderr 17 | 18 | extern int slirp_debug; 19 | 20 | #define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); } 21 | #define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } 22 | #define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); } 23 | #define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); } 24 | #define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); } 25 | 26 | #else 27 | 28 | #define DEBUG_CALL(x) 29 | #define DEBUG_ARG(x, y) 30 | #define DEBUG_ARGS(x) 31 | #define DEBUG_MISC(x) 32 | #define DEBUG_ERROR(x) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/slirp/dhcpv6.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions and prototypes for SLIRP stateless DHCPv6 3 | * 4 | * Copyright 2016 Thomas Huth, Red Hat Inc. 5 | * 6 | * This work is licensed under the terms of the GNU GPL, version 2 7 | * or later. See the COPYING file in the top-level directory. 8 | */ 9 | #ifndef SLIRP_DHCPV6_H 10 | #define SLIRP_DHCPV6_H 11 | 12 | #define DHCPV6_SERVER_PORT 547 13 | 14 | #define ALLDHCP_MULTICAST { .s6_addr = \ 15 | { 0xff, 0x02, 0x00, 0x00,\ 16 | 0x00, 0x00, 0x00, 0x00,\ 17 | 0x00, 0x00, 0x00, 0x00,\ 18 | 0x00, 0x01, 0x00, 0x02 } } 19 | 20 | void dhcpv6_input(struct sockaddr_in6 *srcsas, struct mbuf *m); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/slirp/if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef IF_H 9 | #define IF_H 10 | 11 | #define IF_COMPRESS 0x01 /* We want compression */ 12 | #define IF_NOCOMPRESS 0x02 /* Do not do compression */ 13 | #define IF_AUTOCOMP 0x04 /* Autodetect (default) */ 14 | #define IF_NOCIDCOMP 0x08 /* CID compression */ 15 | 16 | #define IF_MTU 1500 17 | #define IF_MRU 1500 18 | #define IF_COMP IF_AUTOCOMP /* Flags for compression */ 19 | 20 | /* 2 for alignment, 14 for ethernet */ 21 | #define IF_MAXLINKHDR (2 + ETH_HLEN) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/slirp/ip6_input.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 3 | * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. 4 | */ 5 | 6 | #include "qemu/osdep.h" 7 | #include "slirp.h" 8 | #include "ip6_icmp.h" 9 | 10 | /* 11 | * IP initialization: fill in IP protocol switch table. 12 | * All protocols not implemented in kernel go to raw IP protocol handler. 13 | */ 14 | void ip6_init(Slirp *slirp) 15 | { 16 | icmp6_init(slirp); 17 | } 18 | 19 | void ip6_cleanup(Slirp *slirp) 20 | { 21 | icmp6_cleanup(slirp); 22 | } 23 | 24 | void ip6_input(struct mbuf *m) 25 | { 26 | struct ip6 *ip6; 27 | Slirp *slirp = m->slirp; 28 | 29 | if (!slirp->in6_enabled) { 30 | goto bad; 31 | } 32 | 33 | DEBUG_CALL("ip6_input"); 34 | DEBUG_ARG("m = %lx", (long)m); 35 | DEBUG_ARG("m_len = %d", m->m_len); 36 | 37 | if (m->m_len < sizeof(struct ip6)) { 38 | goto bad; 39 | } 40 | 41 | ip6 = mtod(m, struct ip6 *); 42 | 43 | if (ip6->ip_v != IP6VERSION) { 44 | goto bad; 45 | } 46 | 47 | if (ntohs(ip6->ip_pl) > IF_MTU) { 48 | icmp6_send_error(m, ICMP6_TOOBIG, 0); 49 | goto bad; 50 | } 51 | 52 | /* check ip_ttl for a correct ICMP reply */ 53 | if (ip6->ip_hl == 0) { 54 | icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS); 55 | goto bad; 56 | } 57 | 58 | /* 59 | * Switch out to protocol's input routine. 60 | */ 61 | switch (ip6->ip_nh) { 62 | case IPPROTO_TCP: 63 | NTOHS(ip6->ip_pl); 64 | tcp_input(m, sizeof(struct ip6), (struct socket *)NULL, AF_INET6); 65 | break; 66 | case IPPROTO_UDP: 67 | udp6_input(m); 68 | break; 69 | case IPPROTO_ICMPV6: 70 | icmp6_input(m); 71 | break; 72 | default: 73 | m_free(m); 74 | } 75 | return; 76 | bad: 77 | m_free(m); 78 | } 79 | -------------------------------------------------------------------------------- /src/slirp/ip6_output.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 3 | * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. 4 | */ 5 | 6 | #include "qemu/osdep.h" 7 | #include "qemu-common.h" 8 | #include "slirp.h" 9 | 10 | /* Number of packets queued before we start sending 11 | * (to prevent allocing too many mbufs) */ 12 | #define IF6_THRESH 10 13 | 14 | /* 15 | * IPv6 output. The packet in mbuf chain m contains a IP header 16 | */ 17 | int ip6_output(struct socket *so, struct mbuf *m, int fast) 18 | { 19 | struct ip6 *ip = mtod(m, struct ip6 *); 20 | 21 | DEBUG_CALL("ip6_output"); 22 | DEBUG_ARG("so = %lx", (long)so); 23 | DEBUG_ARG("m = %lx", (long)m); 24 | 25 | /* Fill IPv6 header */ 26 | ip->ip_v = IP6VERSION; 27 | ip->ip_hl = IP6_HOP_LIMIT; 28 | ip->ip_tc_hi = 0; 29 | ip->ip_tc_lo = 0; 30 | ip->ip_fl_hi = 0; 31 | ip->ip_fl_lo = 0; 32 | 33 | if (fast) { 34 | if_encap(m->slirp, m); 35 | } else { 36 | if_output(so, m); 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /src/slirp/libslirp.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBSLIRP_H 2 | #define LIBSLIRP_H 3 | 4 | #include "qemu-common.h" 5 | 6 | struct Slirp; 7 | typedef struct Slirp Slirp; 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | int get_dns_addr(struct in_addr *pdns_addr); 14 | int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); 15 | 16 | Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, 17 | struct in_addr vnetmask, struct in_addr vhost, 18 | bool in6_enabled, 19 | struct in6_addr vprefix_addr6, uint8_t vprefix_len, 20 | struct in6_addr vhost6, const char *vhostname, 21 | const char *tftp_path, const char *bootfile, 22 | struct in_addr vdhcp_start, struct in_addr vnameserver, 23 | struct in6_addr vnameserver6, const char **vdnssearch, 24 | void *opaque); 25 | void slirp_cleanup(Slirp *slirp); 26 | 27 | void slirp_select_poll(Slirp *slirp, fd_set *readfds, fd_set *writefds, fd_set *xfds); 28 | int slirp_select_fill(int *pnfds, 29 | fd_set *readfds, fd_set *writefds, fd_set *xfds); 30 | 31 | 32 | void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len); 33 | 34 | int slirp_redir(int is_udp, int host_port, 35 | struct in_addr guest_addr, int guest_port); 36 | 37 | void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); 38 | 39 | /* you must provide the following functions: */ 40 | 41 | int slirp_add_hostfwd(Slirp *slirp, int is_udp, 42 | struct in_addr host_addr, int host_port, 43 | struct in_addr guest_addr, int guest_port); 44 | int slirp_remove_hostfwd(Slirp *slirp, int is_udp, 45 | struct in_addr host_addr, int host_port); 46 | int slirp_add_exec(Slirp *slirp, int do_pty, const void *args, 47 | struct in_addr *guest_addr, int guest_port); 48 | 49 | //void slirp_connection_info(Slirp *slirp, Monitor *mon); 50 | 51 | void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, 52 | int guest_port, const uint8_t *buf, int size); 53 | size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr, 54 | int guest_port); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/slirp/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef SLIRP_MAIN_H 9 | #define SLIRP_MAIN_H 10 | 11 | #ifdef HAVE_SYS_SELECT_H 12 | #include 13 | #endif 14 | 15 | #define TOWRITEMAX 512 16 | 17 | extern int slirp_socket; 18 | extern int slirp_socket_unit; 19 | extern int slirp_socket_port; 20 | extern uint32_t slirp_socket_addr; 21 | extern char *slirp_socket_passwd; 22 | extern int ctty_closed; 23 | 24 | /* 25 | * Get the difference in 2 times from updtim() 26 | * Allow for wraparound times, "just in case" 27 | * x is the greater of the 2 (current time) and y is 28 | * what it's being compared against. 29 | */ 30 | #define TIME_DIFF(x,y) (x)-(y) < 0 ? ~0-(y)+(x) : (x)-(y) 31 | 32 | extern char *slirp_tty; 33 | extern char *exec_shell; 34 | extern u_int curtime; 35 | extern struct in_addr loopback_addr; 36 | extern unsigned long loopback_mask; 37 | extern char *username; 38 | extern char *socket_path; 39 | extern int towrite_max; 40 | extern int ppp_exit; 41 | extern int tcp_keepintvl; 42 | 43 | #define PROTO_SLIP 0x1 44 | #ifdef USE_PPP 45 | #define PROTO_PPP 0x2 46 | #endif 47 | 48 | int if_encap(Slirp *slirp, struct mbuf *ifm); 49 | ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/slirp/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef MISC_H 9 | #define MISC_H 10 | 11 | struct ex_list { 12 | int ex_pty; /* Do we want a pty? */ 13 | struct in_addr ex_addr; /* Server address */ 14 | int ex_fport; /* Port to telnet to */ 15 | const char *ex_exec; /* Command line of what to exec */ 16 | struct ex_list *ex_next; 17 | }; 18 | 19 | #define EMU_NONE 0x0 20 | 21 | /* TCP emulations */ 22 | #define EMU_CTL 0x1 23 | #define EMU_FTP 0x2 24 | #define EMU_KSH 0x3 25 | #define EMU_IRC 0x4 26 | #define EMU_REALAUDIO 0x5 27 | #define EMU_RLOGIN 0x6 28 | #define EMU_IDENT 0x7 29 | #define EMU_RSH 0x8 30 | 31 | #define EMU_NOCONNECT 0x10 /* Don't connect */ 32 | 33 | struct tos_t { 34 | uint16_t lport; 35 | uint16_t fport; 36 | uint8_t tos; 37 | uint8_t emu; 38 | }; 39 | 40 | struct emu_t { 41 | uint16_t lport; 42 | uint16_t fport; 43 | uint8_t tos; 44 | uint8_t emu; 45 | struct emu_t *next; 46 | }; 47 | 48 | struct slirp_quehead { 49 | struct slirp_quehead *qh_link; 50 | struct slirp_quehead *qh_rlink; 51 | }; 52 | 53 | void slirp_insque(void *, void *); 54 | void slirp_remque(void *); 55 | int add_exec(struct ex_list **, int, char *, struct in_addr, int); 56 | int fork_exec(struct socket *so, const char *ex, int do_pty); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/slirp/qemu-common.h: -------------------------------------------------------------------------------- 1 | #include "support.h" 2 | 3 | -------------------------------------------------------------------------------- /src/slirp/sbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef SBUF_H 9 | #define SBUF_H 10 | 11 | #define sbflush(sb) sbdrop((sb),(sb)->sb_cc) 12 | #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) 13 | 14 | struct sbuf { 15 | u_int sb_cc; /* actual chars in buffer */ 16 | u_int sb_datalen; /* Length of data */ 17 | char *sb_wptr; /* write pointer. points to where the next 18 | * bytes should be written in the sbuf */ 19 | char *sb_rptr; /* read pointer. points to where the next 20 | * byte should be read from the sbuf */ 21 | char *sb_data; /* Actual data */ 22 | }; 23 | 24 | void sbfree(struct sbuf *); 25 | void sbdrop(struct sbuf *, int); 26 | void sbreserve(struct sbuf *, int); 27 | void sbappend(struct socket *, struct mbuf *); 28 | void sbcopy(struct sbuf *, int, int, char *); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/slirp/slirp_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * User definable configuration options 3 | */ 4 | 5 | /* Define if you want the connection to be probed */ 6 | /* XXX Not working yet, so ignore this for now */ 7 | #undef PROBE_CONN 8 | 9 | /* Define to 1 if you want KEEPALIVE timers */ 10 | #define DO_KEEPALIVE 0 11 | 12 | /* Define this if you want slirp to write to the tty as fast as it can */ 13 | /* This should only be set if you are using load-balancing, slirp does a */ 14 | /* pretty good job on single modems already, and seting this will make */ 15 | /* interactive sessions less responsive */ 16 | /* XXXXX Talk about having fast modem as unit 0 */ 17 | #undef FULL_BOLT 18 | 19 | /*********************************************************/ 20 | /* 21 | * Autoconf defined configuration options 22 | * You shouldn't need to touch any of these 23 | */ 24 | 25 | /* Define if you have sys/ioctl.h */ 26 | #undef HAVE_SYS_IOCTL_H 27 | #ifndef _WIN32 28 | #define HAVE_SYS_IOCTL_H 29 | #endif 30 | 31 | /* Define if you have sys/filio.h */ 32 | #undef HAVE_SYS_FILIO_H 33 | #ifdef __APPLE__ 34 | #define HAVE_SYS_FILIO_H 35 | #endif 36 | 37 | /* Define if you have sys/bitypes.h */ 38 | #undef HAVE_SYS_BITYPES_H 39 | 40 | /* Define if the machine is big endian */ 41 | //#undef HOST_WORDS_BIGENDIAN 42 | 43 | /* Define if you have readv */ 44 | #undef HAVE_READV 45 | 46 | /* Define if iovec needs to be declared */ 47 | #undef DECLARE_IOVEC 48 | #ifdef _WIN32 49 | #define DECLARE_IOVEC 50 | #endif 51 | 52 | /* Define if you have a POSIX.1 sys/wait.h */ 53 | #undef HAVE_SYS_WAIT_H 54 | 55 | /* Define if you have sys/select.h */ 56 | #undef HAVE_SYS_SELECT_H 57 | #ifndef _WIN32 58 | #define HAVE_SYS_SELECT_H 59 | #endif 60 | 61 | /* Define if you have arpa/inet.h */ 62 | #undef HAVE_ARPA_INET_H 63 | #ifndef _WIN32 64 | #define HAVE_ARPA_INET_H 65 | #endif 66 | 67 | /* Define if you have sys/signal.h */ 68 | #undef HAVE_SYS_SIGNAL_H 69 | 70 | /* Define if you have sys/stropts.h */ 71 | #undef HAVE_SYS_STROPTS_H 72 | 73 | /* Define to sizeof(char *) */ 74 | #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) 75 | 76 | /* Define if you have inet_aton */ 77 | #undef HAVE_INET_ATON 78 | #ifndef _WIN32 79 | #define HAVE_INET_ATON 80 | #endif 81 | 82 | /* Define if you DON'T have unix-domain sockets */ 83 | #undef NO_UNIX_SOCKETS 84 | #ifdef _WIN32 85 | #define NO_UNIX_SOCKETS 86 | #endif 87 | -------------------------------------------------------------------------------- /src/slirp/support.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "qemu/osdep.h" 10 | #include "slirp.h" 11 | #include "main.h" 12 | #include "socket.h" 13 | 14 | int 15 | qemu_socket(int domain, int type, int protocol) 16 | { 17 | return socket(domain, type, protocol); 18 | } 19 | 20 | ssize_t 21 | qemu_recv(int sockfd, void *buf, size_t len, int flags) 22 | { 23 | return recv(sockfd, buf, len, flags); 24 | } 25 | 26 | int 27 | qemu_setsockopt(int sockfd, int level, int optname, 28 | const void *optval, socklen_t optlen) 29 | { 30 | return setsockopt(sockfd, level, optname, 31 | optval, optlen); 32 | } 33 | 34 | void 35 | qemu_set_nonblock(int fd) 36 | { 37 | int opt = 1; 38 | 39 | ioctl(fd, FIONBIO, &opt); 40 | } 41 | 42 | int 43 | socket_set_fast_reuse(int fd) 44 | { 45 | int opt = 1; 46 | return setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); 47 | } 48 | 49 | void 50 | socket_set_nodelay(int fd) 51 | { 52 | int opt = 1; 53 | setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,(char *)&opt,sizeof(int)); 54 | } 55 | 56 | ssize_t 57 | slirp_send(struct socket *so, const void *buf, size_t len, int flags) 58 | { 59 | return send(so->s, buf, len, flags); 60 | } 61 | 62 | void 63 | error_report(const char *fmt, ...) 64 | { 65 | va_list args; 66 | 67 | va_start (args, fmt); 68 | fprintf (stderr, fmt, args); 69 | va_end (args); 70 | } 71 | 72 | void 73 | g_warning(const char *fmt, ...) 74 | { 75 | va_list args; 76 | 77 | va_start (args, fmt); 78 | fprintf (stderr, fmt, args); 79 | va_end (args); 80 | } 81 | 82 | uint64_t 83 | qemu_clock_get_ns(int type) 84 | { 85 | struct timeval tv; 86 | 87 | gettimeofday(&tv, NULL); 88 | return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000); 89 | } 90 | 91 | uint64_t 92 | qemu_clock_get_ms(int type) 93 | { 94 | struct timeval tv; 95 | 96 | gettimeofday(&tv, NULL); 97 | return tv.tv_sec * 1000LL + (tv.tv_usec / 1000); 98 | } 99 | 100 | void * 101 | g_malloc0 (size_t sz) 102 | { 103 | void *ret = malloc (sz); 104 | if (ret) 105 | memset (ret, 0, sz); 106 | return ret; 107 | } 108 | -------------------------------------------------------------------------------- /src/slirp/support.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int 5 | qemu_socket(int domain, int type, int protocol); 6 | 7 | ssize_t 8 | qemu_recv(int sockfd, void *buf, size_t len, int flags); 9 | 10 | int 11 | qemu_setsockopt(int sockfd, int level, int optname, 12 | const void *optval, socklen_t optlen); 13 | 14 | void qemu_set_nonblock(int fd); 15 | 16 | int 17 | socket_set_fast_reuse(int fd); 18 | 19 | void 20 | socket_set_nodelay(int fd); 21 | 22 | void 23 | error_report(const char *format, ...); 24 | void 25 | g_warning(const char *format, ...); 26 | 27 | #define QEMU_CLOCK_REALTIME 0 28 | uint64_t 29 | qemu_clock_get_ns(int type); 30 | uint64_t 31 | qemu_clock_get_ms(int type); 32 | 33 | #define qemu_log_mask(a, b) 34 | 35 | #define g_assert_not_reached() 36 | #define g_malloc malloc 37 | #define g_free free 38 | #define g_strdup strdup 39 | 40 | #define pstrcpy(dest, len, src) strncpy(dest, src, len) 41 | 42 | #define g_new(type, num) malloc ((num) * sizeof(type)) 43 | 44 | #define ioctlsocket ioctl 45 | #define closesocket close 46 | 47 | void * 48 | g_malloc0 (size_t sz); 49 | -------------------------------------------------------------------------------- /src/slirp/tftp.h: -------------------------------------------------------------------------------- 1 | /* tftp defines */ 2 | 3 | #ifndef SLIRP_TFTP_H 4 | #define SLIRP_TFTP_H 5 | 6 | #define TFTP_SESSIONS_MAX 20 7 | 8 | #define TFTP_SERVER 69 9 | 10 | #define TFTP_RRQ 1 11 | #define TFTP_WRQ 2 12 | #define TFTP_DATA 3 13 | #define TFTP_ACK 4 14 | #define TFTP_ERROR 5 15 | #define TFTP_OACK 6 16 | 17 | #define TFTP_FILENAME_MAX 512 18 | 19 | struct tftp_t { 20 | struct udphdr udp; 21 | uint16_t tp_op; 22 | union { 23 | struct { 24 | uint16_t tp_block_nr; 25 | uint8_t tp_buf[512]; 26 | } tp_data; 27 | struct { 28 | uint16_t tp_error_code; 29 | uint8_t tp_msg[512]; 30 | } tp_error; 31 | char tp_buf[512 + 2]; 32 | } x; 33 | } __attribute__((packed)); 34 | 35 | struct tftp_session { 36 | Slirp *slirp; 37 | char *filename; 38 | int fd; 39 | 40 | struct sockaddr_storage client_addr; 41 | uint16_t client_port; 42 | uint32_t block_nr; 43 | 44 | int timestamp; 45 | }; 46 | 47 | void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/uae_cpu/compiler/flags_x86.h: -------------------------------------------------------------------------------- 1 | /* 2 | * compiler/flags_x86.h - Native flags definitions for IA-32 3 | * 4 | * Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer 5 | * 6 | * Adaptation for Basilisk II and improvements, copyright 2000-2005 7 | * Gwenole Beauchesne 8 | * 9 | * Basilisk II (C) 1997-2008 Christian Bauer 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #ifndef NATIVE_FLAGS_X86_H 27 | #define NATIVE_FLAGS_X86_H 28 | 29 | /* Native integer code conditions */ 30 | enum { 31 | NATIVE_CC_HI = 7, 32 | NATIVE_CC_LS = 6, 33 | NATIVE_CC_CC = 3, 34 | NATIVE_CC_CS = 2, 35 | NATIVE_CC_NE = 5, 36 | NATIVE_CC_EQ = 4, 37 | NATIVE_CC_VC = 11, 38 | NATIVE_CC_VS = 10, 39 | NATIVE_CC_PL = 9, 40 | NATIVE_CC_MI = 8, 41 | NATIVE_CC_GE = 13, 42 | NATIVE_CC_LT = 12, 43 | NATIVE_CC_GT = 15, 44 | NATIVE_CC_LE = 14 45 | }; 46 | 47 | #endif /* NATIVE_FLAGS_X86_H */ 48 | -------------------------------------------------------------------------------- /src/uae_cpu/fpu/fpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fpu/fpu.h - public header 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * MC68881/68040 fpu emulation 7 | * 8 | * Original UAE FPU, copyright 1996 Herman ten Brugge 9 | * Rewrite for x86, copyright 1999-2000 Lauri Pesonen 10 | * New framework, copyright 2000 Gwenole Beauchesne 11 | * Adapted for JIT compilation (c) Bernd Meyer, 2000 12 | * 13 | * This program is free software; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, write to the Free Software 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | */ 27 | 28 | #ifndef FPU_PUBLIC_HEADER_H 29 | #define FPU_PUBLIC_HEADER_H 30 | 31 | #ifndef FPU_DEBUG 32 | #define FPU_DEBUG 0 33 | #endif 34 | 35 | #if FPU_DEBUG 36 | #define fpu_debug(args) printf args; 37 | #define FPU_DUMP_REGISTERS 0 38 | #define FPU_DUMP_FIRST_BYTES 0 39 | #else 40 | #define fpu_debug(args) ; 41 | #undef FPU_DUMP_REGISTERS 42 | #undef FPU_DUMP_FIRST_BYTES 43 | #endif 44 | 45 | #include "sysdeps.h" 46 | #include "fpu/types.h" 47 | #include "fpu/core.h" 48 | 49 | #endif /* FPU_PUBLIC_HEADER_H */ 50 | -------------------------------------------------------------------------------- /src/uae_cpu/fpu/fpu_x86.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelya/BasiliskII-android/06a7bb327cea0de0265b98d16807ab679a2e6433/src/uae_cpu/fpu/fpu_x86.cpp -------------------------------------------------------------------------------- /src/uae_cpu/fpu/fpu_x86_asm.h: -------------------------------------------------------------------------------- 1 | #define DEFINE_X86_MACRO(name, value) \ 2 | asm(".local " #name "\n\t" #name " = " #value) 3 | 4 | DEFINE_X86_MACRO(BSUN, 0x00008000); 5 | DEFINE_X86_MACRO(SNAN, 0x00004000); 6 | DEFINE_X86_MACRO(OPERR, 0x00002000); 7 | DEFINE_X86_MACRO(OVFL, 0x00001000); 8 | DEFINE_X86_MACRO(UNFL, 0x00000800); 9 | DEFINE_X86_MACRO(DZ, 0x00000400); 10 | DEFINE_X86_MACRO(INEX2, 0x00000200); 11 | DEFINE_X86_MACRO(INEX1, 0x00000100); 12 | DEFINE_X86_MACRO(ACCR_IOP, 0x80); 13 | DEFINE_X86_MACRO(ACCR_OVFL, 0x40); 14 | DEFINE_X86_MACRO(ACCR_UNFL, 0x20); 15 | DEFINE_X86_MACRO(ACCR_DZ, 0x10); 16 | DEFINE_X86_MACRO(ACCR_INEX, 0x08); 17 | DEFINE_X86_MACRO(ROUND_CONTROL_MASK, 0x30); 18 | DEFINE_X86_MACRO(ROUND_TO_NEAREST, 0); 19 | DEFINE_X86_MACRO(ROUND_TO_ZERO, 0x10); 20 | DEFINE_X86_MACRO(ROUND_TO_NEGATIVE_INFINITY, 0x20); 21 | DEFINE_X86_MACRO(ROUND_TO_POSITIVE_INFINITY, 0x30); 22 | DEFINE_X86_MACRO(PRECISION_CONTROL_MASK, 0xC0); 23 | DEFINE_X86_MACRO(PRECISION_CONTROL_EXTENDED, 0); 24 | DEFINE_X86_MACRO(PRECISION_CONTROL_DOUBLE, 0x80); 25 | DEFINE_X86_MACRO(PRECISION_CONTROL_SINGLE, 0x40); 26 | DEFINE_X86_MACRO(PRECISION_CONTROL_UNDEFINED, 0xC0); 27 | DEFINE_X86_MACRO(CW_RESET, 0x0040); 28 | DEFINE_X86_MACRO(CW_FINIT, 0x037F); 29 | DEFINE_X86_MACRO(SW_RESET, 0x0000); 30 | DEFINE_X86_MACRO(SW_FINIT, 0x0000); 31 | DEFINE_X86_MACRO(TW_RESET, 0x5555); 32 | DEFINE_X86_MACRO(TW_FINIT, 0x0FFF); 33 | DEFINE_X86_MACRO(CW_X, 0x1000); 34 | DEFINE_X86_MACRO(CW_RC_ZERO, 0x0C00); 35 | DEFINE_X86_MACRO(CW_RC_UP, 0x0800); 36 | DEFINE_X86_MACRO(CW_RC_DOWN, 0x0400); 37 | DEFINE_X86_MACRO(CW_RC_NEAR, 0x0000); 38 | DEFINE_X86_MACRO(CW_PC_EXTENDED, 0x0300); 39 | DEFINE_X86_MACRO(CW_PC_DOUBLE, 0x0200); 40 | DEFINE_X86_MACRO(CW_PC_RESERVED, 0x0100); 41 | DEFINE_X86_MACRO(CW_PC_SINGLE, 0x0000); 42 | DEFINE_X86_MACRO(CW_PM, 0x0020); 43 | DEFINE_X86_MACRO(CW_UM, 0x0010); 44 | DEFINE_X86_MACRO(CW_OM, 0x0008); 45 | DEFINE_X86_MACRO(CW_ZM, 0x0004); 46 | DEFINE_X86_MACRO(CW_DM, 0x0002); 47 | DEFINE_X86_MACRO(CW_IM, 0x0001); 48 | DEFINE_X86_MACRO(SW_B, 0x8000); 49 | DEFINE_X86_MACRO(SW_C3, 0x4000); 50 | DEFINE_X86_MACRO(SW_TOP_7, 0x3800); 51 | DEFINE_X86_MACRO(SW_TOP_6, 0x3000); 52 | DEFINE_X86_MACRO(SW_TOP_5, 0x2800); 53 | DEFINE_X86_MACRO(SW_TOP_4, 0x2000); 54 | DEFINE_X86_MACRO(SW_TOP_3, 0x1800); 55 | DEFINE_X86_MACRO(SW_TOP_2, 0x1000); 56 | DEFINE_X86_MACRO(SW_TOP_1, 0x0800); 57 | DEFINE_X86_MACRO(SW_TOP_0, 0x0000); 58 | DEFINE_X86_MACRO(SW_C2, 0x0400); 59 | DEFINE_X86_MACRO(SW_C1, 0x0200); 60 | DEFINE_X86_MACRO(SW_C0, 0x0100); 61 | DEFINE_X86_MACRO(SW_ES, 0x0080); 62 | DEFINE_X86_MACRO(SW_SF, 0x0040); 63 | DEFINE_X86_MACRO(SW_PE, 0x0020); 64 | DEFINE_X86_MACRO(SW_UE, 0x0010); 65 | DEFINE_X86_MACRO(SW_OE, 0x0008); 66 | DEFINE_X86_MACRO(SW_ZE, 0x0004); 67 | DEFINE_X86_MACRO(SW_DE, 0x0002); 68 | DEFINE_X86_MACRO(SW_IE, 0x0001); 69 | DEFINE_X86_MACRO(X86_ROUNDING_MODE, 0x0C00); 70 | DEFINE_X86_MACRO(X86_ROUNDING_PRECISION, 0x0300); 71 | 72 | #undef DEFINE_X86_MACRO 73 | -------------------------------------------------------------------------------- /src/uae_cpu/fpu/rounding.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * fpu/rounding.cpp - system-dependant FPU rounding mode and precision 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * MC68881/68040 fpu emulation 7 | * 8 | * Original UAE FPU, copyright 1996 Herman ten Brugge 9 | * Rewrite for x86, copyright 1999-2000 Lauri Pesonen 10 | * New framework, copyright 2000 Gwenole Beauchesne 11 | * Adapted for JIT compilation (c) Bernd Meyer, 2000 12 | * 13 | * This program is free software; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, write to the Free Software 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | */ 27 | 28 | #undef PRIVATE 29 | #define PRIVATE /**/ 30 | 31 | #undef PUBLIC 32 | #define PUBLIC /**/ 33 | 34 | #undef FFPU 35 | #define FFPU /**/ 36 | 37 | #undef FPU 38 | #define FPU fpu. 39 | 40 | /* -------------------------------------------------------------------------- */ 41 | /* --- Native X86 Rounding Mode --- */ 42 | /* -------------------------------------------------------------------------- */ 43 | 44 | #ifdef FPU_USE_X86_ROUNDING_MODE 45 | const uae_u32 FFPU x86_control_word_rm_mac2host[] = { 46 | CW_RC_NEAR, 47 | CW_RC_ZERO, 48 | CW_RC_DOWN, 49 | CW_RC_UP 50 | }; 51 | #endif 52 | 53 | /* -------------------------------------------------------------------------- */ 54 | /* --- Native X86 Rounding Precision --- */ 55 | /* -------------------------------------------------------------------------- */ 56 | 57 | #ifdef FPU_USE_X86_ROUNDING_PRECISION 58 | const uae_u32 FFPU x86_control_word_rp_mac2host[] = { 59 | CW_PC_EXTENDED, 60 | CW_PC_SINGLE, 61 | CW_PC_DOUBLE, 62 | CW_PC_RESERVED 63 | }; 64 | #endif 65 | -------------------------------------------------------------------------------- /src/xpram.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xpram.cpp - XPRAM handling 3 | * 4 | * Basilisk II (C) 1997-2008 Christian Bauer 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | /* 22 | * SEE ALSO 23 | * Inside Macintosh: Operating System Utilities, chapter 7 "Parameter RAM Utilities" 24 | */ 25 | 26 | #include 27 | 28 | #include "sysdeps.h" 29 | #include "xpram.h" 30 | 31 | 32 | // Extended parameter RAM 33 | uint8 XPRAM[XPRAM_SIZE]; 34 | 35 | 36 | /* 37 | * Initialize XPRAM 38 | */ 39 | 40 | void XPRAMInit(const char *vmdir) 41 | { 42 | // Clear XPRAM 43 | memset(XPRAM, 0, XPRAM_SIZE); 44 | 45 | // Load XPRAM from settings file 46 | LoadXPRAM(vmdir); 47 | } 48 | 49 | 50 | /* 51 | * Deinitialize XPRAM 52 | */ 53 | 54 | void XPRAMExit(void) 55 | { 56 | // Save XPRAM to settings file 57 | SaveXPRAM(); 58 | } 59 | --------------------------------------------------------------------------------