Get rid of cxmon and SheepShaver (focus is on BasiliskII)

This commit is contained in:
uyjulian 2018-04-15 16:00:38 -05:00
parent 76d285a6f2
commit 023251dee1
No known key found for this signature in database
GPG Key ID: FEA459A8CA14685B
430 changed files with 0 additions and 107195 deletions

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,104 +0,0 @@
# Makefile for creating SheepShaver distributions
# Written in 1999 by Christian Bauer <Christian.Bauer@uni-mainz.de>
VERSION := 2.3
VERNAME := SheepShaver-$(VERSION)
CVSDATE := $(shell date "+%Y%m%d")
SRCARCHIVE := $(VERNAME)-$(CVSDATE).tar.gz
TMPDIR := $(shell date +/tmp/build%m%s)
ISODATE := $(shell date "+%Y-%m-%d %H:%M")
DOCS := NEWS
SRCS := src
# Where Basilisk II directory can be found
B2_TOPDIR := ../BasiliskII
default: help
help:
@echo "This top-level Makefile is for creating SheepShaver distributions."
@echo "The following targets are available:"
@echo " tarball source tarball ($(SRCARCHIVE))"
@echo " links create links to Basilisk II sources"
clean:
-rm -f $(SRCARCHIVE)
#
# Source tarball
#
tarball: $(SRCARCHIVE)
$(SRCARCHIVE): $(SRCS) $(DOCS)
-rm -rf $(TMPDIR)
mkdir $(TMPDIR)
cd $(TMPDIR); cvs export -D "$(ISODATE)" BasiliskII SheepShaver
cd $(TMPDIR)/SheepShaver/src/Unix && mkdir Darwin
cd $(TMPDIR)/SheepShaver && make links
cd $(TMPDIR)/SheepShaver/src/Unix && NO_CONFIGURE=1 ./autogen.sh
cd $(TMPDIR)/SheepShaver/src/Windows && NO_CONFIGURE=1 ../Unix/autogen.sh
rm $(TMPDIR)/SheepShaver/Makefile
cp -aL $(TMPDIR)/SheepShaver $(TMPDIR)/$(VERNAME)
cd $(TMPDIR); tar cfz $@ $(VERNAME)
mv $(TMPDIR)/$@ .
rm -rf $(TMPDIR)
#
# Links to Basilisk II sources
#
links:
@list='adb.cpp audio.cpp cdrom.cpp disk.cpp extfs.cpp pict.c \
prefs.cpp scsi.cpp sony.cpp xpram.cpp \
include/adb.h include/audio.h include/audio_defs.h \
include/cdrom.h include/clip.h include/debug.h include/disk.h \
include/extfs.h include/extfs_defs.h include/pict.h \
include/prefs.h include/scsi.h include/serial.h \
include/serial_defs.h include/sony.h include/sys.h \
include/timer.h include/xpram.h \
BeOS/audio_beos.cpp BeOS/extfs_beos.cpp BeOS/scsi_beos.cpp \
BeOS/serial_beos.cpp BeOS/sys_beos.cpp BeOS/timer_beos.cpp \
BeOS/xpram_beos.cpp BeOS/SheepDriver BeOS/SheepNet \
CrossPlatform/sigsegv.h CrossPlatform/sigsegv.cpp CrossPlatform/vm_alloc.h CrossPlatform/vm_alloc.cpp \
CrossPlatform/video_vosf.h CrossPlatform/video_blit.h CrossPlatform/video_blit.cpp \
Unix/audio_oss_esd.cpp Unix/bincue_unix.cpp Unix/bincue_unix.h \
Unix/vhd_unix.cpp \
Unix/extfs_unix.cpp Unix/serial_unix.cpp \
Unix/sshpty.h Unix/sshpty.c Unix/strlcpy.h Unix/strlcpy.c \
Unix/sys_unix.cpp Unix/timer_unix.cpp Unix/xpram_unix.cpp \
Unix/semaphore.h Unix/posix_sem.cpp Unix/config.sub Unix/config.guess Unix/m4 \
Unix/keycodes Unix/tunconfig Unix/clip_unix.cpp Unix/Irix/audio_irix.cpp \
Unix/Linux/scsi_linux.cpp Unix/Linux/NetDriver Unix/ether_unix.cpp \
Unix/rpc.h Unix/rpc_unix.cpp Unix/ldscripts \
Unix/tinyxml2.h Unix/tinyxml2.cpp Unix/disk_unix.h \
Unix/disk_sparsebundle.cpp Unix/Darwin/mkstandalone \
Unix/Darwin/lowmem.c Unix/Darwin/pagezero.c Unix/Darwin/testlmem.sh \
dummy/audio_dummy.cpp dummy/clip_dummy.cpp dummy/serial_dummy.cpp \
dummy/prefs_editor_dummy.cpp dummy/scsi_dummy.cpp SDL slirp \
MacOSX/sys_darwin.cpp MacOSX/clip_macosx.cpp MacOSX/clip_macosx64.mm \
MacOSX/macos_util_macosx.h Unix/cpr.sh \
MacOSX/extfs_macosx.cpp Windows/clip_windows.cpp \
MacOSX/MacOSX_sound_if.cpp MacOSX/MacOSX_sound_if.h \
MacOSX/AudioBackEnd.cpp MacOSX/AudioBackEnd.h \
MacOSX/AudioDevice.cpp MacOSX/AudioDevice.h MacOSX/audio_macosx.cpp \
MacOSX/utils_macosx.mm MacOSX/utils_macosx.h \
Windows/cd_defs.h Windows/cdenable Windows/extfs_windows.cpp \
Windows/posix_emu.cpp Windows/posix_emu.h Windows/sys_windows.cpp \
Windows/timer_windows.cpp Windows/util_windows.cpp \
Windows/util_windows.h Windows/xpram_windows.cpp \
Windows/kernel_windows.h Windows/kernel_windows.cpp \
Windows/serial_windows.cpp Windows/router Windows/b2ether \
Windows/ether_windows.h Windows/ether_windows.cpp \
Windows/serial_windows.cpp Windows/prefs_editor_gtk.cpp \
uae_cpu/compiler/codegen_x86.h'; \
PREFIX="../"; case $(B2_TOPDIR) in /*) PREFIX="";; esac; \
for i in $$list; do \
if test "$$i" != "\\"; then \
echo $$i; o=$$i; \
case $$i in *codegen_x86.h) o=kpx_cpu/src/cpu/jit/x86/codegen_x86.h;; esac; \
SUB=`echo $$o | sed 's;[^/]*/;../;g' | sed 's;[^/]*$$;;'` ;\
ln -sf "$$PREFIX$$SUB$(B2_TOPDIR)/src/$$i" src/$$o; \
fi; \
done; \
ln -sf ../../../../../SheepShaver/src/Unix/config.h $(B2_TOPDIR)/src/Unix/Linux/NetDriver/config.h

View File

@ -1,105 +0,0 @@
SheepShaver NEWS -- history of user-visible changes. 2006-05-14
Copyright (C) 1997-2006 Christian Bauer and Marc Hellwig
Version 2.3 (snapshot) - 14.May.2006
* Handle up to 1 GB of Mac memory
* Improve SLiRP network emulation performance
* Fix Native QuickDraw acceleration
* Fix a crash during MacOS 9 installation
* Fix a crash in the AppleShare extension
* Fix support for MacOS 7.5.3 Revision 2.2
* Fix gigantic window dimensions on first boot
* Fix extfs volume name to "Unix" (Toshimitsu Tanaka)
* Fix unaligned accesses in SLiRP network emulation (Brian J. Johnson)
* Initial port to IRIX/mips
* MacOS X:
o Port to MacOS X for Intel, including the JIT
o Add a primitive graphical preferences editor
o Add support for run-time CD-ROM auto-detection
o Fix clipboard (copy/paste of text from/to the host OS)
o Fix extfs to preserve native folder attributes
o Fix extfs to handle file/folder creation times
o Fix SLiRP network emulation (workaround MacOS X bugs)
o Improve overall performance on PowerPC (by a factor 2)
* Windows:
o Add SLiRP network emulation ("ether slirp")
o Add TAP-Win32 network emulation ("ether tap")
o Fix CD-ROM auto-detection ("pollmedia" now works)
o Fix idle sleep ("idlewait" now works)
o Fix native cursor to be updated as soon as MacOS modified it
o Improve GUI for network configuration
Version 2.3 (snapshot) - 30.Nov.2005
* Add fullscreen DGA mode via fbdev in Linux
* Add "screen" prefs item a-la Basilisk II
* Add missing lvsl/lvsr instructions in AltiVec emulation (Adobe FrameMaker)
* Add support for old toolchain (gcc "2.96", glibc 2.2)
* Add user-space network emulation ("ether slirp" in prefs file)
* Add Ethernet and Serial support to Windows
* Add GTK+2 based GUI to Windows
* Add initial port to Darwin/x86 with JIT
* Improve portability of FPU emulation code to non C99 capable systems
* Improve interrupt processing in emulated mode
* Improve idle wait on Linux platforms
* Properly fail to load MacOS < 8.1 with NewWorld ROMs
* Fix native execution in Linux/PowerPC
* Fix PowerPC test-and-set implementation (fix clipboard)
* Fix Ethernet support in Linux, avoid hangs
* Fix occasional hangs during interrupt processing
* Fix High Resolution Timing code for Linux
* Fix support for 4+ GB hard disk images
* Fix SDL/x11 native cursor acceleration
* Fix sheep_net driver to properly work with Linux kernels up to 2.6.11
Version 2.3 (snapshot) - 21.Mar.2005
* Implement high-precision timings on POSIX systems
* Add other SDL keysym translations
* Add some SSE2 optimizations to the AltiVec emulation core
* Add port to FreeBSD 5.3 and NetBSD 2.0 systems (x86 tested)
* Add initial port to Windows with SDL graphics
* Fix interrupt handling, registers are now fully preserved
* Fix support for native execution on recent Linux/PPC systems
* Fix support for Gossamer ROMs (PowerMac G3 Beige)
* Fix crash in Apple Personal Diagnostics on MacOS 9
* Fix crash in Power Management on MacOS 9
Version 2.3 (snapshot) - 07.Jul.2004
* Add support for MacOS 9.0.4
* Add native port to MacOS X with SDL graphics
* Fix timebase emulation. UpTime() is now more accurate
* Fix hardware cursor acceleration in X11
* Fix 'r' and <ctrl> key mappings for Apple X11 servers
* Fix video thread cancellation on MacOS X
* Fix detection of PowerPC 750FX and 970 processors
Version 2.3 (snapshot) - 09.Jun.2004
* Improve generic JIT engine to reach around 1/8-th of native speeds
* Improve 68k audio processing with "reentrant" JIT generated code
* Add Native QuickDraw acceleration for BitBlt (srcCopy) and FillRect
* Add TUN/TAP device support on Linux systems
* Add run-time depth switching. Support at least 1-bpp screens
* Add "idlewait" option to pause SheepShaver when MacOS is idle
* Fix ethernet support on little endian and 64-bit systems
* Fix initialization of NVRAM on first-time use
Version 2.3 (snapshot) - 25.Feb.2004
* Improved generic JIT, FPU instructions are now translated
* Add AltiVec emulation, emulated CPU is now a PowerPC 7400 (G4)
* Add initial port to MacOS X with an X11 server
Version 2.3 (snapshot) - 14.Jan.2004
* Fix several CPU emulation bugs, extended testsuite
* Fix FPU emulation, "scrollbar" & Graphing Calculator bugs are gone
* Add support for 64-bit platforms, more precisely AMD64 with JIT
* Add support for copy-paste of text on Unix/X11 systems
* Add support for wheel mice
* Better support for PowerMac PCI ROMs with more generic patches
* Better support for audio output (with pre-G3 PowerMac PCI ROMs)
* Improve native Linux/PPC port
Version 2.3 (snapshot) - 25.Nov.2003
* Initial public release with PowerPC CPU emulator for testing
Version 2.2 (release) - 04.Feb.2002
* Source released under GPL
* Integrated code from Basilisk II

View File

@ -1,24 +0,0 @@
<HTML>
<HEAD>
<TITLE>Acknowledgements</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Acknowledgements</H1>
The following persons/companies deserve special thanks from us as they
made a significant contribution to the development of SheepShaver:
<P>
<UL>
<LI><A HREF="http://www.be.com/">Be Inc.</A>, and especially Dominic Giampaolo, for their support
<LI>Tai Kahn from the <A HREF="http://www.ecafenet.com/">eCafe Network</A> for hosting the <A HREF="http://www.sheepshaver.com/">SheepShaver web site</A>
<LI>Tinic Uro for the SheepShaver icon
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,47 +0,0 @@
<HTML>
<HEAD>
<TITLE>Contact Information</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Contact Information and Copyright</H1>
SheepShaver was brought to you by
<UL>
<LI><A HREF="mailto:Christian.Bauer@uni-mainz.de">Christian Bauer</A> (kernel, disk I/O)
<LI><A HREF="mailto:Marc.Hellwig@uni-mainz.de">Marc Hellwig</A> (graphics, sound, networking)
</UL>
<H3><IMG SRC="iconsmall.gif" ALIGN=MIDDLE>SheepShaver WWW Site:</H3>
<BLOCKQUOTE>
<A HREF="http://www.sheepshaver.com/">www.sheepshaver.com</A><BR>
</BLOCKQUOTE>
<H3>EMail:</H3>
<BLOCKQUOTE>
<A HREF="mailto:Christian.Bauer@uni-mainz.de">Christian.Bauer@uni-mainz.de</A><BR>
</BLOCKQUOTE>
<H3>License</H3>
<P>SheepShaver is available under the terms of the GNU General Public License.
See the file "COPYING" that is included in the distribution for details.
<P>&copy; Copyright 1997-2004 Christian Bauer and Marc Hellwig
<P>Names of hardware and software items mentioned in this manual and
in program texts are in most cases registered trade marks of the respective
companies and not marked as such. So the lack of such a note may not be
used as an indication that these names are free.
<P>SheepShaver is not designed, intended, or authorized for use as a component
in systems intended for surgical implant within the body, or other applications intended
to support or sustain life, or for any other application in which the failure of SheepShaver
could create a situation where personal injury or death may occur (so-called "killer application").
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,59 +0,0 @@
<HTML>
<HEAD>
<TITLE>Revision History</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>SheepShaver Revision History</H1>
<H2>V2.2 (04-Feb-2002)</H2>
<UL>
<LI>Integrated code from Basilisk II
<LI>Source released under GPL
</UL>
<H2>V2.1 (31-Mar-2001)</H2>
<UL>
<LI>Support for MacOS 8.5 and 8.6
<LI>Support for G3 ROMs
<LI>It's possible to select which video modes are to be used by MacOS
<LI>SheepShaver will not use up all CPU time when "nothing" is running
<LI>More stable networking
<LI>16 and 32 bit window modes
<LI>Small bug fixes
</UL>
<H2>V2.0 (20-Jan-1999)</H2>
<UL>
<LI>"BeOS" icon on the Mac desktop to access files on BeOS volumes from Mac applications.
<LI>Handling of removable media (i.e. automatic detection of disk insertion)
<LI>More flexible parallel port selection on BeBox
<LI>Greatly improved Time Manager (higher accuracy)
<LI>Fixed "audio lags"
<LI>Option to ignore illegal memory accesses
<LI>Adapted for (and requires) BeOS R4
<LI>MacOS 7.5.5/7.6/7.6.1 run better on some systems
<LI>Small bug fixes
</UL>
<H2>V1.1 (13-Jul-1998)</H2>
<UL>
<LI>Support for more machine types (esp. PowerMac 4400)
<LI>Corrected time zone handling
<LI>Volume list in preferences handles dropped volumes and files
<LI>BeBox: 16/24 bit modes have correct colors with a Millennium II
<LI>Video/SetEntries didn't set last palette entry
<LI>Mac programs trying to use the (non-existant) SCSI Manager shouldn't crash any longer
</UL>
<H2>V1.0 (18-May-1998)</H2>
<UL>
<LI>Initial release
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,28 +0,0 @@
<HTML>
<HEAD>
<TITLE>The SheepShaver User's Guide</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1><IMG SRC="icon.gif" ALIGN=MIDDLE>SheepShaver V2.2 Installation and User's Guide (BeOS)</H1>
<H2>Contents</H2>
<UL>
<LI><A HREF="introduction.html">Introduction</A>
<LI><A HREF="installation.html">Installation</A>
<LI><A HREF="quickstart.html">Quick Start</A>
<LI><A HREF="settings.html">Setting up SheepShaver</A>
<LI><A HREF="using.html">Using SheepShaver</A>
<LI><A HREF="troubleshooting.html">Troubleshooting</A>
<LI><A HREF="acknowledgements.html">Acknowledgements</A>
<LI><A HREF="contact.html">Contact Information and Copyright</A>
<LI><A HREF="history.html">Revision History</A>
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,25 +0,0 @@
<HTML>
<HEAD>
<TITLE>Installation</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Installation</H1>
You need BeOS/PowerPC R4. R3 or earlier versions will not work.
<OL>
<LI>Unpack the SheepShaver package (if you are reading this, you probably have already done this)
<LI>On a BeBox, you need a copy of a PCI PowerMac ROM (4MB) in a file
called "ROM" in the same folder SheepShaver is in (but you can select a different
location in the settings window). SheepShaver can also use the "Mac OS ROM" file
that comes with MacOS 8.5/8.6 (look in the System Folder on your MacOS CD). In
order to legally use SheepShaver, you have to own the ROM the image file was taken from.
</OL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,45 +0,0 @@
<HTML>
<HEAD>
<TITLE>Introduction</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Introduction</H1>
SheepShaver is a MacOS run-time environment for BeOS that allows you
to run MacOS applications at native speed inside the BeOS multitasking
environment on PowerPC-based BeOS systems. This means that both BeOS
and MacOS applications can run at the same time and data can be exchanged
between them.
<P>SheepShaver is neither a MacOS replacement nor an emulator. It runs an
unmodified PowerPC MacOS under control of the BeOS at full speed without
any kind of emulation. So it also uses the MacOS 68k emulator to run 68k
applications. In this way, SheepShaver is comparable to the "Blue Box" of
Apple's Rhapsody operating system.
<H2>Some of SheepShaver's features:</H2>
<UL>
<LI>Compatibility: SheepShaver runs MacOS 7.5.2 thru 8.6 with all system
extensions like AppleGuide, AppleScript, QuickTime, QuickTime VR,
QuickDraw 3D, Open Transport, PPP, Language Kits, ColorSync, etc.
<LI>Graphics: The MacOS user interface is displayed in a BeOS window or
full-screen (with QuickDraw acceleration) in resolutions up to
1600x1200 in 24 bit.
<LI>Sound: CD-quality stereo sound output
<LI>Networking: SheepShaver supports Internet and LAN networking via
Ethernet and PPP with all Open Transport compatible MacOS applications.
<LI>Volumes: Any HFS or HFS+ volume can be used with SheepShaver (this
includes Zip/Jaz/SyQuest drives etc.). It also features a built-in
CD-ROM driver and a driver for HD floppy disks.
<LI>Data Exchange: You can access BeOS files from the MacOS via a "BeOS"
icon on the Mac desktop and copy and paste text between BeOS and MacOS
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,38 +0,0 @@
<HTML>
<HEAD>
<TITLE>Quick Start</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Quick Start</H1>
The following is a step-by-step guide that shows you how to get SheepShaver
up and running in the quickest possible way. We assume that you are running
on a PowerMac that already has MacOS installed on a partition of your hard drive
and that you have booted into BeOS.
<P>
<OL>
<LI>Double-click the SheepShaver icon. The "SheepShaver Settings" window will appear.
<LI>Click on "Start". SheepShaver will try to detect on which partition MacOS is installed and should then start booting MacOS.
<LI>If this is the first time you start SheepShaver you will be asked if you want your
network configuration to be modified to enable Ethernet networking under SheepShaver.
If you want to use Ethernet with SheepShaver you should press "OK" (this will change the
file <CODE>/boot/home/config/settings/network</CODE>; a backup of the the original file will
be stored in <CODE>network.orig</CODE>).
<LI>To quit SheepShaver, select "Shutdown" from the Finder's "Special" menu.
</OL>
<H3>One word of caution:</H3>
Volumes which are used by SheepShaver must not also be mounted under BeOS
while SheepShaver is running. <STRONG>You will lose data and corrupt the
volume if you do this! Don't press the "Mount all disks now" button in the
BeOS "Disk Mount Settings" window while SheepShaver is running!</STRONG>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -1,127 +0,0 @@
<HTML>
<HEAD>
<TITLE>Setting up SheepShaver</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Setting up SheepShaver</H1>
In the "SheepShaver Settings" window that pops up when you double-click on
the SheepShaver icon, you can configure certain features of SheepShaver.
When you click on <B>"Start"</B>, the current settings are saved to disk and will be
available next time you start SheepShaver.
<P>The settings are divided into four groups: Volumes, Graphics/Sound, Serial/Network and Memory/Misc.
<H2>Volumes</H2>
<IMG SRC="volumes.gif">
<P>The main part of the volumes pane is a <B>list</B> that contains all volumes to be mounted
by SheepShaver. If this list is empty, SheepShaver will try to detect and mount all HFS partitions
it can find. CD-ROM drives are always automatically detected and used.
<P>SheepShaver can use HFS partitions, whole HFS formatted drives, and it can also
emulate hard disks in single BeOS files ("hardfiles").
<P>To add a Mac volume to the list, mount it on the BeOS side, click on <B>"Add..."</B>, go to the "Disks"
level in the topmost popup menu of the file panel, click once on the volume you want and
click on "Add". A line beginning with "/dev/disk/" should then appear in the volume list.
After adding volumes to the list, you should unmount them on the BeOS side again.To remove
a Mac volume, select it in the list and click on <B>"Remove"</B>.
<P>You can create a new, empty hardfile by clicking on <B>"Create..."</B>. Enter the file
name and the size of the hardfile and click on "Create". The hardfile will be created (this may
take some seconds) and added to the volume list. The so-created hardfile will have to be
formatted under MacOS before you can store something in it. If you start up SheepShaver,
the Finder will display a message about an "unreadable" volume being found and give you the
option to format it.
<P>Double-clicking on an entry in the volume list will add or remove a "*" in front of the
device name. Volumes marked with a "*" are read-only for the MacOS under SheepShaver.
<P>SheepShaver will show a "BeOS" disk icon on the Mac desktop that allows access to BeOS
files from Mac applications. In <B>"BeOS Root"</B> you specify which BeOS directory will
be at the root of this virtual "BeOS" disk. You can enter a path name here or drag and drop a
Tracker folder onto it. The default setting of "/boot" means that the "BeOS" icon in the MacOS
Finder will correspond to your BeOS boot volume. If you want to access files on other BeOS
volumes, you should enter "/" here. The "BeOS" disk will then contain folders for each BeOS
volume (among other things). The MacOS will create files and folders like "Desktop", "Trash",
"OpenFolderListDF" etc. in the directory you specify as "BeOS Root". If they annoy you, you
can delete them.
<P>To boot from CD-ROM, set the <B>"Boot From"</B> setting to <B>"CD-ROM"</B>.
The <B>"Disable CD-ROM Driver"</B> box is used to disable SheepShaver's built-in CD-ROM driver.
This is currently of not much use and you should leave the box unselected.
<H2>Graphics/Sound</H2>
<IMG SRC="graphics.gif">
<P>WIth <B>"Window Refresh Rate"</B> you can set the refresh rate of the MacOS window.
Higher rates mean faster screen updates and less "sluggish" behaviour, but also require more CPU time.
<P>The <B>"QuickDraw Acceleration"</B> box should always be enabled. It allows for faster graphics in
full-screen modes. But if your machine uses the "IXMicro" BeOS video driver, you have to disable the
QuickDraw acceleration or full-screen modes won't work (this is because of BeOS bug #981112-032247).
<P>The main part of the window is occupied by a list of checkboxes that allows you to select
which <B>graphics modes</B> are available for displaying the MacOS desktop. You can, for
example, disable the modes that your monitor or graphics card can't display, or disable the
window modes when you want to run some Mac programs in full-screen mode that would otherwise
erroneously switch to a window mode. The actual mode to be used is selected in the "Monitors"
control panel under MacOS.
<P>The <B>"Disable Sound Output"</B> box allows you to disable all sound output by SheepShaver.
This is useful if the sound takes too much CPU time on your machine or to get rid of warning
messages if SheepShaver can't use your audio hardware.
<H2>Serial/Network</H2>
<IMG SRC="serial.gif">
<P>You can select to which ports the MacOS <B>modem and printer ports</B> are redirected.
This doesn't make much sense on a PowerMac, but on a BeBox you can assign the modem
and printer ports to any of the four serial ports (or com3/com4) or even parallel ports of
the BeBox (useful for printing if you have Mac drivers for parallel printers, like the PowerPrint
package from <A HREF="http://www.gdt.com">www.gdt.com</A>).
<P>If you don't want SheepShaver's Ethernet support to be enabled for some reason, you
can use the <B>"Disable Ethernet"</B> checkbox to disable it (this will also get rid of the annoying
"no network hardware" messages if your Mac is not equipped with Ethernet).
<H2>Memory/Misc</H2>
<IMG SRC="memory.gif">
<P>With <B>"MacOS RAM Size"</B> you select how much RAM will be available to the MacOS
(and all MacOS applications running under it). SheepShaver uses the BeOS virtual memory system,
so you can select more RAM than you physically have in your machine. The MacOS virtual memory
system is not available under SheepShaver (i.e. if you have 32MB of RAM in your computer and
select 64MB to be used for MacOS in the SheepShaver settings, MacOS will behave as if it's running on
a computer that has 64MB of RAM but no virtual memory).
<P>The <B>"Ignore Illegal Memory Accesses"</B> option is there to make some broken Mac
programs work that access addresses where there is no RAM or ROM. With this option unchecked,
SheepShaver will in this case display an error message and quit. When the option is activated,
SheepShaver will try to continue as if the illegal access never happened (writes are ignored, reads
return 0). This may or may not make the program work (when a program performs an illegal access,
it is most likely that something else went wrong). When a Mac program behaves strangely or hangs,
you can quit SheepShaver, uncheck this option and retry. If you get an "illegal access" message,
you will know that something is broken.
<P>If the <B>"Don't Use CPU When Idle"</B> option is enabled, SheepShaver will try to reduce
CPU usage to a minimum when the MacOS is doing "nothing" but waiting for user input. This doesn't
work with all programs and it may confuse the timing of some games but in general you should
leave it enabled.
<P><B>"ROM File"</B> specifies the path name of the Mac ROM file to be used. If it is left
blank, SheepShaver expects the ROM file to be called "ROM" and be in the same directory as
the SheepShaver application.
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,79 +0,0 @@
<HTML>
<HEAD>
<TITLE>Troubleshooting</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Troubleshooting</H1>
<H2>SheepShaver doesn't boot</H2>
SheepShaver should boot all MacOS versions &gt;=7.5.2, except MacOS X. However,
your mileage may vary. If it doesn't boot, try again with extensions disabled
(by pressing the shift key) and then remove some of these extensions:
"MacOS Licensing Extension", Speed Doubler, 68k FPU extensions and MacsBug.
<H2>The colors are wrong in 16 or 32 bit graphics modes</H2>
If you're running SheepShaver on a BeBox, the only graphics modes that have
the right colors are the 8 bit modes (this is actually a hardware problem
and has to do with frame buffers being little-endian on the BeBox), unless
you are using a Matrox Milennium I/II.
<P>You should also be aware that not all graphics cards support 16 bit modes
under BeOS (especially S3 cards don't). Check the BeOS "Screen" preferences
application to see if your card does.
<H2>SheepShaver appears to be very slow</H2>
<UL>
<LI>Don't use the window modes, the fullscreen modes are much faster.
<LI>If you nevertheless want (or have) to use a window mode, you should set the
color depth in MacOS to the same as the BeOS workspace you are running SheepShaver on
(e.g. if you are on a 16-bit workspace, set the color depth in MacOS to "Thousands").
Also, set the window refresh rate to a low value (high values like 30Hz will make SheepShaver
(and BeOS) slower, not faster!).
</UL>
<H2>Full-screen mode doesn't work</H2>
If your machine uses the "IXMicro" BeOS video driver (TwinTurbo cards), you
will have to disable the "QuickDraw Acceleration" in the "Video" pane of the
SheepShaver settings.
<H2>Ethernet doesn't work</H2>
<UL>
<LI>Is the Ethernet set up under BeOS? Ethernet will not work in SheepShaver if you didn't set it up in the BeOS "Network" preferences.
<LI>If you're using TCP/IP on the MacOS side, you have to set up different IP addresses for the BeOS and for the MacOS.
<LI>Try disabling AppleTalk in the BeOS Network preferences (there might be conflicts between BeOS AppleTalk and SheepShaver networking).
</UL>
<H2>SheepShaver crashes, but yesterday it worked</H2>
Try the "Zap PRAM File" item in the main menu of the SheepShaver preferences editor.
When you are using a ROM file and switching to a different ROM version, you <B>have</B>
to zap the PRAM file or SheepShaver might behave very weird.
<H2>Known incompatibilities</H2>
<UL>
<LI>MacOS programs or drivers which access Mac hardware directly are not supported by SheepShaver.
<LI>Speed Doubler, RAM Doubler, 68k FPU emulators and similar programs don't run under SheepShaver.
<LI>MacsBug is not compatible with SheepShaver.
<LI>If you want to run RealPC on a BeBox, you have to disable one CPU in the "Pulse" application or it will crash.
</UL>
<H2>Known bugs</H2>
<UL>
<LI>The QuickTime 2.5 Cinepak codec crashes the emulator.
<LI>Programs that use InputSprockets crash the emulator when in window mode.
<LI>The mouse cursor hotspot in window mode is not correct.
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,76 +0,0 @@
<HTML>
<HEAD>
<TITLE>Using SheepShaver</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Using SheepShaver</H1>
<H2>Changing the display mode</H2>
SheepShaver can display the MacOS user interface in a BeOS window or full-screen
(much faster) in several resolutions and color depths. You select the display mode
as usual under MacOS in the "Monitors" control panel (under System 7.x, click on "Options").
The "75Hz" modes are full-screen modes, the "60Hz" modes are window modes
(this doesn't mean that the video refresh rate is 75 or 60Hz in the respective modes;
the rate displayed has no meaning; it's simply there to distinguish full screen modes
from window modes).
<H2>Window mode</H2>
The SheepShaver window has a menu at the bottom that allows you to change the
graphics refresh rate and to mount floppy disks (see below). The window refresh is
disabled as long as the "Scroll Lock" key is pressed (the graphics output is then frozen).
<H2>Full-screen mode</H2>
The full-screen mode uses a whole BeOS workspace for displaying the MacOS user
interface. You can switch workspaces with Command-F1/F2/F3/etc. Please note that
the MacOS (and all MacOS applications) will be suspended when you switch to a different
workspace. It will only be resumed when you go back to the SheepShaver workspace.
<H2>Networking</H2>
SheepShaver only supports Ethernet networking (and PPP via the serial
ports). If there are multiple Ethernet cards installed, only the first
card will be used. The Ethernet support is implemented at the data-link
level. This implies that the "Mac" and the "Be" side must have two different
network addresses.
<H2>Using floppy disks</H2>
Floppy disks are not automatically detected when they are inserted. They have to be
mounted explicitly. After inserting a floppy disk, select the "Mount Floppy" item in the
"SheepShaver" menu (when running in window mode), or press Ctrl-F1 (when running in
full-screen mode). BeBox users should note that floppy disks also have to be unmounted
under MacOS before ejecting them from the drive.
<H2>Accessing BeOS files</H2>
SheepShaver will display a "BeOS" disk icon on the Mac desktop that allows you
to access any BeOS files/folders which are in the directory specified as "BeOS Root"
in the "Volumes" pane of the SheepShaver settings. You can open and save files on the
"BeOS" disk from Mac applications, copy, move or rename files from the Finder etc.
Putting files/folder to the trash may however not always work. SheepShaver translates
some BeOS file types to MacOS types and vice versa, so e.g. JPEG and PDF files will
show up the correct icons in the Finder. To store Mac resources and other additional
data, SheepShaver uses the following BeOS file attributes:
<UL>
<LI><CODE>MACOS:RFORK</CODE> contains the complete Mac resource fork of the file
<LI><CODE>MACOS:HFS_FLAGS</CODE> contains Finder flags
<LI><CODE>MACOS:CREATOR</CODE> contains the MacOS creator application ID
</UL>
<H2>Copying text via the clipboard</H2>
SheepShaver tries to keep the BeOS and MacOS clipboards synchronized. That means,
when you copy a piece of text under BeOS, you can paste it into a MacOS application
and vice versa.
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -1,24 +0,0 @@
<HTML>
<HEAD>
<TITLE>Acknowledgements</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Acknowledgements</H1>
The following persons/companies deserve special thanks from us as they
made a significant contribution to the development of SheepShaver:
<P>
<UL>
<LI><A HREF="http://www.linuxppc.com/">LinuxPPC, Inc.</A>, for supporting the development of this program
<LI>Tai Kahn from the <A HREF="http://www.ecafenet.com/">eCafe Network</A> for hosting the <A HREF="http://www.sheepshaver.com/">SheepShaver web site</A>
<LI>Tinic Uro for the SheepShaver icon
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,47 +0,0 @@
<HTML>
<HEAD>
<TITLE>Contact Information</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Contact Information and Copyright</H1>
SheepShaver was brought to you by
<UL>
<LI><A HREF="mailto:Christian.Bauer@uni-mainz.de">Christian Bauer</A> (kernel, disk I/O)
<LI><A HREF="mailto:Marc.Hellwig@uni-mainz.de">Marc Hellwig</A> (graphics, sound, networking)
</UL>
<H3><IMG SRC="iconsmall.gif" ALIGN=MIDDLE>SheepShaver WWW Site:</H3>
<BLOCKQUOTE>
<A HREF="http://www.sheepshaver.com/">www.sheepshaver.com</A><BR>
</BLOCKQUOTE>
<H3>EMail:</H3>
<BLOCKQUOTE>
<A HREF="mailto:sheep@sheepshaver.com">sheep@sheepshaver.com</A><BR>
</BLOCKQUOTE>
<H3>License</H3>
<P>SheepShaver is available under the terms of the GNU General Public License.
See the file "COPYING" that is included in the distribution for details.
<P>&copy; Copyright 1997-2004 Christian Bauer and Marc Hellwig
<P>Names of hardware and software items mentioned in this manual and
in program texts are in most cases registered trade marks of the respective
companies and not marked as such. So the lack of such a note may not be
used as an indication that these names are free.
<P>SheepShaver is not designed, intended, or authorized for use as a component
in systems intended for surgical implant within the body, or other applications intended
to support or sustain life, or for any other application in which the failure of SheepShaver
could create a situation where personal injury or death may occur (so-called "killer application").
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,25 +0,0 @@
<HTML>
<HEAD>
<TITLE>Revision History</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>SheepShaver Revision History</H1>
<H2>V2.2 (04-Feb-2002)</H2>
<UL>
<LI>Integrated code from Basilisk II
<LI>Source released under GPL
</UL>
<H2>V2.1 (31-Mar-2001)</H2>
<UL>
<LI>Initial Linux PPC release
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,28 +0,0 @@
<HTML>
<HEAD>
<TITLE>The SheepShaver User's Guide</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1><IMG SRC="icon.gif" ALIGN=MIDDLE>SheepShaver V2.2 Installation and User's Guide (Linux)</H1>
<H2>Contents</H2>
<UL>
<LI><A HREF="introduction.html">Introduction</A>
<LI><A HREF="installation.html">Installation</A>
<LI><A HREF="quickstart.html">Quick Start</A>
<LI><A HREF="settings.html">Setting up SheepShaver</A>
<LI><A HREF="using.html">Using SheepShaver</A>
<LI><A HREF="troubleshooting.html">Troubleshooting</A>
<LI><A HREF="acknowledgements.html">Acknowledgements</A>
<LI><A HREF="contact.html">Contact Information and Copyright</A>
<LI><A HREF="history.html">Revision History</A>
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,25 +0,0 @@
<HTML>
<HEAD>
<TITLE>Installation</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Installation</H1>
You need at least a 2.2.x kernel, glibc 2.1 and GTK+ 1.2. Earlier versions will not work.
<OL>
<LI>Unpack the SheepShaver archive (if you are reading this, you probably have already done this)
<LI>Even when running on a PowerMac, you need a copy of a PCI PowerMac ROM (4MB) in
a file called "ROM" in the same folder SheepShaver is in (but you can select a different location
in the settings window). SheepShaver can also use the "Mac OS ROM" file that comes with
MacOS 8.5/8.6 (look in the System Folder on your MacOS CD). In order to legally use SheepShaver,
you have to own the ROM the image file was taken from.
</OL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,44 +0,0 @@
<HTML>
<HEAD>
<TITLE>Introduction</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Introduction</H1>
SheepShaver is a MacOS run-time environment for Linux that allows you
to run MacOS applications at native speed inside the Linux multitasking
environment on PowerPC-based Linux systems. This means that both Linux
and MacOS applications can run at the same time and data can be exchanged
between them.
<P>SheepShaver is neither a MacOS replacement nor an emulator. It runs an
unmodified PowerPC MacOS under control of Linux at full speed without any
kind of emulation. So it also uses the MacOS 68k emulator to run 68k
applications. In this way, SheepShaver is comparable to the "Blue Box" of
Apple's Rhapsody operating system.
<H2>Some of SheepShaver's features:</H2>
<UL>
<LI>Compatibility: SheepShaver runs MacOS 7.5.2 thru 8.6 with all system
extensions like AppleGuide, AppleScript, QuickTime, QuickTime VR,
QuickDraw 3D, Open Transport, PPP, Language Kits, ColorSync, etc.
<LI>Graphics: The MacOS user interface is displayed in an X11 window or
full-screen (requires DGA)
<LI>Sound: CD-quality stereo sound output
<LI>Networking: SheepShaver supports Internet and LAN networking via
Ethernet and PPP with all Open Transport compatible MacOS applications.
<LI>Volumes: Any HFS or HFS+ volume can be used with SheepShaver (this
includes Zip/Jaz/SyQuest drives etc.). It also features a built-in
CD-ROM driver and a driver for HD floppy disks.
<LI>Data Exchange: You can access Linux files from the MacOS via a "Linux"
icon on the Mac desktop and copy and paste text between Linux and MacOS
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -1,39 +0,0 @@
<HTML>
<HEAD>
<TITLE>Quick Start</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Quick Start</H1>
The following is a step-by-step guide that shows you how to get SheepShaver
up and running in the quickest possible way. We assume that you are running
on a PowerMac that already has MacOS installed on a partition of your hard drive
and that you have booted into Linux.
<P>
<OL>
<LI>Start the "SheepShaver" program. The "SheepShaver Settings" window will appear.
<LI>Click on "Start". SheepShaver will try to detect on which partition MacOS is installed and should then start booting MacOS.
<LI>To quit SheepShaver, select "Shutdown" from the Finder's "Special" menu.
</OL>
When SheepShaver hangs or crashes in fullscreen mode, pressing Ctrl-Esc should
quit it and restore the display.
<P>In fullscreen mode, press Ctrl-Tab to suspend SheepShaver and return to the
normal X11 destop. Press space inside the "SheepShaver suspended" window to
reactivate it.
<H3>One word of caution:</H3>
Volumes which are used by SheepShaver must not also be mounted under Linux
while SheepShaver is running. <STRONG>You will lose data and corrupt the
volume if you do this!</STRONG>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,117 +0,0 @@
<HTML>
<HEAD>
<TITLE>Setting up SheepShaver</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Setting up SheepShaver</H1>
In the "SheepShaver Settings" window that pops up when you start SheepShaver,
you can configure certain features of SheepShaver. When you click on <B>"Start"</B>,
the current settings are saved to disk and will be available next time you start
SheepShaver.
<P>The settings are divided into four groups: Volumes, Graphics/Sound, Serial/Network and Memory/Misc.
<H2>Volumes</H2>
<IMG SRC="volumes.gif">
<P>The main part of the volumes pane is a <B>list</B> that contains all volumes to be mounted
by SheepShaver. If this list is empty, SheepShaver will try to detect and mount all
HFS partitions it can find. A CD-ROM drive is always automatically detected and used.
<P>SheepShaver can use HFS partitions, whole HFS formatted drives, and it can also
emulate hard disks in single Linux files ("hardfiles").
<P>To add a Mac volume to the list, click on <B>"Add..."</B>, go to the "/dev" directory
in the file panel, click once on the partition you want and click on "OK". The selected
partition device name should then appear in the volume list. After adding volumes to
the list, you should unmount them on the Linux side. To remove a Mac volume, select it
in the list and click on <B>"Remove"</B>.
<P>You can create a new, empty hardfile by clicking on <B>"Create..."</B>. Enter the file
name and the size of the hardfile and click on "Create". The hardfile will be created (this may
take some seconds) and added to the volume list. The so-created hardfile will have to be
formatted under MacOS before you can store something in it. If you start up SheepShaver,
the Finder will display a message about an "unreadable" volume being found and give you the
option to format it.
<P>Double-clicking on an entry in the volume list will add or remove a "*" in front of the
device name. Volumes marked with a "*" are read-only for the MacOS under SheepShaver.
<P>SheepShaver will show a "Linux" disk icon on the Mac desktop that allows access to Linux
files from Mac applications. In <B>"Linux Root"</B> you specify which Linux directory will
be at the root of this virtual "Linux" disk. The default setting of "/" means that the
"Linux" icon in the MacOS Finder will correspond to your Linux root directory. The MacOS
will try to create files and folders like "Desktop", "Trash", "OpenFolderListDF" etc.
in the directory you specify as "Linux Root" (provided that you have access rights
to that directory). If they annoy you, you can delete them.
<P>To boot from CD-ROM, set the <B>"Boot From"</B> setting to <B>"CD-ROM"</B>.
The <B>"Disable CD-ROM Driver"</B> box is used to disable SheepShaver's built-in CD-ROM driver.
This is currently of not much use and you should leave the box unselected.
<H2>Graphics/Sound</H2>
<IMG SRC="graphics.gif">
<P>With <B>"Window Refresh Rate"</B> you can set the refresh rate of the MacOS window.
Higher rates mean faster screen updates and less "sluggish" behaviour, but also require more CPU time.
<P>The <B>"Enabled Video Modes"</B> controls allow you to select which graphics modes
are available for displaying the MacOS desktop. You can, for example, disable the window modes
when you want to run some Mac programs in full-screen mode that would otherwise erroneously
switch to a window mode. If your X server doesn't support DGA you should disable the Fullscreen
mode. The actual mode to be used is selected in the "Monitors" control panel under MacOS. The
color depth is always that of the X11 screen and cannot be changed.
<P>The <B>"Disable Sound Output"</B> box allows you to disable all sound output by SheepShaver.
This is useful if the sound takes too much CPU time on your machine or to get rid of warning
messages if SheepShaver can't use your audio hardware.
<H2>Serial/Network</H2>
<IMG SRC="serial.gif">
<P>You can select to which devices the MacOS <B>modem and printer ports</B> are redirected.
You can assign them to any serial ports you have (/dev/ttyS*), or even to parallel
ports (/dev/lp*, useful for printing if you have Mac drivers for parallel printers,
like the PowerPrint package from <A HREF="http://www.gdt.com">www.gdt.com</A>).
<P>With <B>"Ethernet Interface"</B> you select which Ethernet card is to be used for
networking. It can either be the name of a real Ethernet card (e.g. "eth0") or of an ethertap
interface (e.g. "tap0"). Using a real Ethernet card requires the "sheep_net" driver to be installed
and accessible. See <A HREF="using.html">Using SheepShaver</A> for more
information about setting up networking.
<H2>Memory/Misc</H2>
<IMG SRC="memory.gif">
<P>With <B>"MacOS RAM Size"</B> you select how much RAM will be available to the MacOS
(and all MacOS applications running under it). SheepShaver uses the Linux virtual memory system,
so you can select more RAM than you physically have in your machine. The MacOS virtual memory
system is not available under SheepShaver (i.e. if you have 32MB of RAM in your computer and
select 64MB to be used for MacOS in the SheepShaver settings, MacOS will behave as if it's running on
a computer that has 64MB of RAM but no virtual memory).
<P><B>"ROM File"</B> specifies the path name of the Mac ROM file to be used. If it is left
blank, SheepShaver expects the ROM file to be called "ROM" and be in the same directory as
the SheepShaver application.
<P>The <B>"Ignore Illegal Memory Accesses"</B> option is there to make some broken Mac
programs work that access addresses where there is no RAM or ROM. With this option unchecked,
SheepShaver will in this case display an error message and quit. When the option is activated,
SheepShaver will try to continue as if the illegal access never happened (writes are ignored, reads
return 0). This may or may not make the program work (when a program performs an illegal access,
it is most likely that something else went wrong). When a Mac program behaves strangely or hangs,
you can quit SheepShaver, uncheck this option and retry. If you get an "illegal access" message,
you will know that something is broken.
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,65 +0,0 @@
<HTML>
<HEAD>
<TITLE>Troubleshooting</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Troubleshooting</H1>
<H2>SheepShaver doesn't boot</H2>
SheepShaver should boot all MacOS versions &gt;=7.5.2, except MacOS X. However,
your mileage may vary. If it doesn't boot, try again with extensions disabled
(by pressing the shift key) and then remove some of these extensions:
"MacOS Licensing Extension", Speed Doubler, 68k FPU extensions and MacsBug.
<H2>The colors are wrong in 16 or 32 bit graphics modes</H2>
If you're running SheepShaver on a something other than a PowerMac, it may be
that 16 or 32 bit graphics modes show false colors due to the frame buffer being
little-endian. Apart from patching the X server, there's unfortunately nothing
that you or SheepShaver can do about this.
<H2>Full-screen mode doesn't work</H2>
Some X servers on Linux PPC don't support DGA and full-screen mode cannot be used
with these (in this case, you should disable it in the "Graphics" settings). If you
are seeing a message like "cannot map /dev/kmem (permission denied)", you have to
either run SheepShaver as root (not recommended) or give yourself appropriate access
rights to /dev/kmem if you can login as root.
<H2>Ethernet doesn't work</H2>
<UL>
<LI>You have to either install the sheep_net driver or configure the ethertap device in the Linux kernel to use Ethernet. See <A HREF="using.html">Using SheepShaver</A> for more information.
<LI>If you're using TCP/IP on the MacOS side, you have to set up different IP addresses for Linux and for the MacOS.
</UL>
<H2>SheepShaver crashes, but yesterday it worked</H2>
Try the "Zap PRAM File" item in the main menu of the SheepShaver preferences editor.
When you are using a ROM file and switching to a different ROM version, you <B>have</B>
to zap the PRAM file or SheepShaver might behave very weird.
<H2>Known incompatibilities</H2>
<UL>
<LI>MacOS programs or drivers which access Mac hardware directly are not supported by SheepShaver.
<LI>Speed Doubler, RAM Doubler, 68k FPU emulators and similar programs don't run under SheepShaver.
<LI>MacsBug is not compatible with SheepShaver.
</UL>
<H2>Known bugs</H2>
<UL>
<LI>The QuickTime 2.5 Cinepak codec crashes the emulator.
<LI>Programs that use InputSprockets crash the emulator when in window mode.
<LI>The mouse cursor hotspot in window mode is not correct.
</UL>
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,113 +0,0 @@
<HTML>
<HEAD>
<TITLE>Using SheepShaver</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Using SheepShaver</H1>
<H2>Changing the display mode</H2>
SheepShaver can display the MacOS user interface in an X11 window or full-screen
(much faster). You select the display mode as usual under MacOS in the "Monitors"
control panel (under System 7.x, click on "Options"). The "75Hz" modes are full-screen
modes, the "60Hz" modes are window modes (this doesn't mean that the video refresh
rate is 75 or 60Hz in the respective modes; the rate displayed has no meaning; it's
simply there to distinguish full screen modes from window modes).
<H2>Full-screen mode</H2>
The full-screen mode uses the whole X11 screen for displaying the MacOS user interface.
You can temporarily switch back to the X11 desktop by pressing Ctrl-Tab. The MacOS (and
all MacOS applications) will now be suspended. You can resume SheepShaver by activating
the "SheepShaver suspended" window and pressing the space key. Using full-screen mode
requires a DGA capable X server.
<H2>Networking</H2>
There are three approaches to networking with SheepShaver:
<OL>
<LI>Direct access to an Ethernet card via the "sheep_net" driver.
In this case, the "ethernet card description" must be the name
of a real Ethernet card, e.g. "eth0". It also requires the "sheep_net"
driver to be installed and accessible. This approach will allow you
to run all networking protocols under MacOS (TCP/IP, AppleTalk, IPX
etc.) but there is no connection between Linux networking and MacOS
networking. MacOS will only be able to talk to other machines on
the Ethernet, but not to other networks that your Linux box routes
(e.g. a second Ethernet or a PPP connection to the Internet).
<LI>Putting SheepShaver on a virtual Ethernet via the "ethertap" device.
In this case, the "ethernet card description" must be the name
of an ethertap interface, e.g. "tap0". It also requires that you
configure your kernel to enable routing and the ethertap device:
under "Networking options", enable "Kernel/User netlink socket" and
"Netlink device emulation", under "Network device support", activate
"Ethertap network tap". You also have to modify <CODE>devices/net/ethertap.c</CODE>
a bit before compiling the new kernel:
<UL>
<LI>insert <CODE>#define CONFIG_ETHERTAP_MC 1</CODE> near the top (after the <CODE>#include</CODE> lines)
<LI>comment out the line <CODE>dev->flags|=IFF_NOARP;</CODE> in <CODE>ethertap_probe()</CODE>
</UL>
<P>
Next, see <CODE>/usr/src/linux/Documentation/networking/ethertap.txt</CODE> for
information on how to set up <CODE>/dev/tap*</CODE> device nodes and activate the
ethertap interface. Under MacOS, select an IP address that is on the
virtual network and set the default gateway to the IP address of the
ethertap interface. This approach will let you access all networks
that your Linux box has access to (especially, if your Linux box has
a dial-up Internet connection and is configured for IP masquerading,
you can access the Internet from MacOS). The drawback is that you
can only use network protocols that Linux can route, so you have to
install and configure netatalk if you want to use AppleTalk. Here is
an example <CODE>/etc/atalk/atalkd.conf</CODE> for a LAN:
<PRE>
eth0 -seed -phase 2 -net 1 -addr 1.47 -zone "Ethernet"
tap0 -seed -phase 2 -net 2 -addr 2.47 -zone "Sheepnet"
</PRE>
(the "47" is an arbitrary node number). This will set up a zone
"Ethernet" (net 1) for the Ethernet and a zone "Sheepnet" (net 2)
for the internal network connection of the ethertap interface.
MacOS should automatically recognize the nets and zones upon startup.
If you are in an existing AppleTalk network, you should contact
your network administrator about the nets and zones you can use
(instead of the ones given in the example above).
<LI>Networking protocols for serial connections (PPP and SLIP, for example)
can be used provided that you have the appropriate MacOS system components
installed (e.g. Open Transport/PPP).
</OL>
<H2>Using floppy disks</H2>
Floppy disks are not automatically detected when they are inserted. They have to be
mounted explicitly: after inserting a floppy disk, press Ctrl-F1.
<H2>Accessing Linux files</H2>
SheepShaver will display a "Linux" disk icon on the Mac desktop that allows you
to access any Linux files which are in the directory specified as "Linux Root"
in the "Volumes" pane of the SheepShaver settings. You can open and save files on the
"Linux" disk from Mac applications, copy, move or rename files from the Finder etc.
SheepShaver translates some file name extensions to MacOS types and vice versa,
so e.g. *.jpg and *.pdf files will show the correct icons in the Finder. MacOS
resources and Finder attributes are stored in hidden <CODE>.rsrc</CODE> and
<CODE>.finf</CODE> directories.
<H2>Copying text via the clipboard</H2>
SheepShaver tries to keep the Linux and MacOS clipboards synchronized. That means,
when you copy a piece of text under Linux, you can paste it into a MacOS application
and vice versa.
<HR>
<ADDRESS>
SheepShaver User's Guide
</ADDRESS>
</BODY>
</HTML>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,28 +0,0 @@
====== PowerPC Emulator Testsuite ======
The PowerPC Emulator Tester is a self-contained testsuite I wrote for the [[en:projects:sheepshaver|SheepShaver]] emulation engine. It was a very handy tool during the development of the SheepShaver PowerPC Emulator and considerably reduced debugging time when AltiVec emulation was added. I hope this would be useful to other PowerPC Emulator authors. The code is distributed under the terms of the [[http://www.gnu.org/copyleft/gpl.html|GNU General Public License]] (GPL).
It's not terrific code and can largely be improved and cleaned up, but it provides reasonnable information to chase down a bug.
See [[#links|links]] for other testsuites. As of **2006/07/04**, the current SheepShaver CVS branch contains a more accurate FPU emulation engine. It passes VEX tests with more precision & exception bits. All the following glibc tests pass on PPC: ''test-fenv'', ''test-arith{,f}'', ''test-{float,double}''. Almost all of them pass on x86-64 too (modulo a few errors in ''test-float''), provided that GCC >= 4.0.1 is used. The more accurate engine is enabled with ''PPC_ENABLE_FPU_EXCEPTIONS''.
===== Features =====
* Self-contained. No guest OS nor any complicated run-time environment is required. Your CPU emulator simply needs to support a special opcode (''0x18000000'', OP=6) that terminates execution of the current basic block.
* Supports several CPU cores: SheepShaver, [[http://microlib.org/projects/ppc750sim/|Microlib PPC 750 Simulator]], [[http://model3emu.sourceforge.net/|Sega Model 3 Arcade Emulator]], [[http://www.qemu.org/|QEMU]].
* Supports the AltiVec ISA.
* Generates more than 2 million tests with specific values to trigger condition codes changes, unspecified results (matches a PowerPC 7410, aka my Powerbook G4).
===== Downloads =====
* The primary source is available in SheepShaver CVS.
* It is recommended that you first run the tester on a native PowerPC platform to generate a results file. For reference, here is the [[this>projects/ppctester/files/ppc-testresults.dat.bz2|PowerPC Emulator Tester results file]] I use for SheepShaver. This was generated with AltiVec tests enabled. This is for revision 1.30+ of the file. md5sum is: ''3e29432abb6e21e625a2eef8cf2f0840''.
===== Links =====
* [[http://www.valgrind.org/|Valgrind]] contains an interesting testsuite for the VEX.
* [[http://perso.magic.fr/l_indien/qemu-ppc/|Qemu-PPC]] contains part of the original ALU tests used in VEX.

View File

@ -1,256 +0,0 @@
/*
* Ethernet.cpp - SheepShaver ethernet PCI driver stub
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include <stddef.h>
#include "xlowmem.h"
#include "ether_defs.h"
/*
* Driver Description structure
*/
struct DriverDescription {
uint32 driverDescSignature;
uint32 driverDescVersion;
char nameInfoStr[32];
uint32 version;
uint32 driverRuntime;
char driverName[32];
uint32 driverDescReserved[8];
uint32 nServices;
uint32 serviceCategory;
uint32 serviceType;
uint32 serviceVersion;
};
#pragma export on
DriverDescription TheDriverDescription = {
'mtej',
0,
"\pSheepShaver Ethernet",
0x01008000, // V1.0.0final
4, // kDriverIsUnderExpertControl
"\penet",
0, 0, 0, 0, 0, 0, 0, 0,
1,
'otan',
0x000a0b01, // Ethernet, Framing: Ethernet/EthernetIPX/802.2, IsDLPI
0x01000000, // V1.0.0
};
#pragma export off
/*
* install_info and related structures
*/
static int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds);
static int ether_close(queue_t *rdq, int flag, void *creds);
static int ether_wput(queue_t *q, msgb *mp);
static int ether_wsrv(queue_t *q);
static int ether_rput(queue_t *q, msgb *mp);
static int ether_rsrv(queue_t *q);
struct ot_module_info {
uint16 mi_idnum;
char *mi_idname;
int32 mi_minpsz; // Minimum packet size
int32 mi_maxpsz; // Maximum packet size
uint32 mi_hiwat; // Queue hi-water mark
uint32 mi_lowat; // Queue lo-water mark
};
static ot_module_info module_information = {
kEnetModuleID,
"SheepShaver Ethernet",
0,
kEnetTSDU,
6000,
5000
};
typedef int (*putp_t)(queue_t *, msgb *);
typedef int (*srvp_t)(queue_t *);
typedef int (*openp_t)(queue_t *, void *, int, int, void *);
typedef int (*closep_t)(queue_t *, int, void *);
struct qinit {
putp_t qi_putp;
srvp_t qi_srvp;
openp_t qi_qopen;
closep_t qi_qclose;
void *qi_qadmin;
struct ot_module_info *qi_minfo;
void *qi_mstat;
};
static qinit read_side = {
NULL,
ether_rsrv,
ether_open,
ether_close,
NULL,
&module_information,
NULL
};
static qinit write_side = {
ether_wput,
NULL,
ether_open,
ether_close,
NULL,
&module_information,
NULL
};
struct streamtab {
struct qinit *st_rdinit;
struct qinit *st_wrinit;
struct qinit *st_muxrinit;
struct qinit *st_muxwinit;
};
static streamtab the_streamtab = {
&read_side,
&write_side,
NULL,
NULL
};
struct install_info {
struct streamtab *install_str;
uint32 install_flags;
uint32 install_sqlvl;
char *install_buddy;
void *ref_load;
uint32 ref_count;
};
enum {
kOTModIsDriver = 0x00000001,
kOTModUpperIsDLPI = 0x00002000,
SQLVL_MODULE = 3,
};
static install_info the_install_info = {
&the_streamtab,
kOTModIsDriver /*| kOTModUpperIsDLPI */,
SQLVL_MODULE,
NULL,
NULL,
0
};
// Prototypes for exported functions
extern "C" {
#pragma export on
extern uint32 ValidateHardware(void *theID);
extern install_info* GetOTInstallInfo();
extern uint8 InitStreamModule(void *theID);
extern void TerminateStreamModule(void);
#pragma export off
}
/*
* Validate that our hardware is available (always available)
*/
uint32 ValidateHardware(void *theID)
{
return 0;
}
/*
* Return pointer to install_info structure
*/
install_info *GetOTInstallInfo(void)
{
return &the_install_info;
}
/*
* Init module
*/
asm uint8 InitStreamModule(register void *theID)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_INIT
mtctr r0
bctr
}
/*
* Terminate module
*/
asm void TerminateStreamModule(void)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_TERM
mtctr r0
bctr
}
/*
* DLPI functions
*/
static asm int ether_open(register queue_t *rdq, register void *dev, register int flag, register int sflag, register void *creds)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_OPEN
mtctr r0
bctr
}
static asm int ether_close(register queue_t *rdq, register int flag, register void *creds)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_CLOSE
mtctr r0
bctr
}
static asm int ether_wput(register queue_t *q, register msgb *mp)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_WPUT
mtctr r0
bctr
}
static asm int ether_rsrv(register queue_t *q)
{
lwz r2,XLM_TOC
lwz r0,XLM_ETHER_RSRV
mtctr r0
bctr
}

View File

@ -1,25 +0,0 @@
all: ../../EthernetDriverStub.i ../../VideoDriverStub.i
clean:
-rm *.o hexconv Ethernet Video
../../EthernetDriverStub.i: Ethernet hexconv
hexconv $< $@
../../VideoDriverStub.i: Video hexconv
hexconv $< $@
hexconv: hexconv.cpp
mwcc -o hexconv hexconv.cpp
Ethernet.o: Ethernet.cpp
mwcc -I.. -I../../include -o $@ -c $<
Video.o: Video.cpp
mwcc -I.. -I../../include -o $@ -c $<
Ethernet: Ethernet.o
mwldppc -xms -export pragma -nostdentry -nostdlib -o $@ $<
Video: Video.o
mwldppc -xms -export pragma -nostdentry -nostdlib -o $@ $<

View File

@ -1,78 +0,0 @@
/*
* Video.cpp - SheepShaver video PCI driver stub
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "xlowmem.h"
/*
* Driver Description structure
*/
struct DriverDescription {
uint32 driverDescSignature;
uint32 driverDescVersion;
char nameInfoStr[32];
uint32 version;
uint32 driverRuntime;
char driverName[32];
uint32 driverDescReserved[8];
uint32 nServices;
uint32 serviceCategory;
uint32 serviceType;
uint32 serviceVersion;
};
#pragma export on
struct DriverDescription TheDriverDescription = {
'mtej',
0,
"\pvideo",
0x01008000, // V1.0.0final
6, // kDriverIsUnderExpertControl, kDriverIsOpenedUponLoad
"\pDisplay_Video_Apple_Sheep",
0, 0, 0, 0, 0, 0, 0, 0,
1,
'ndrv',
'vido',
0x01000000, // V1.0.0
};
#pragma export off
// Prototypes for exported functions
extern "C" {
#pragma export on
extern int16 DoDriverIO(void *spaceID, void *commandID, void *commandContents, uint32 commandCode, uint32 commandKind);
#pragma export off
}
/*
* Do driver IO
*/
asm int16 DoDriverIO(void *spaceID, void *commandID, void *commandContents, uint32 commandCode, uint32 commandKind)
{
lwz r2,XLM_TOC
lwz r0,XLM_VIDEO_DOIO
mtctr r0
bctr
}

View File

@ -1,34 +0,0 @@
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc != 3) {
printf("Usage: %s <raw file> <C source>\n", argv[0]);
return 0;
}
FILE *fin = fopen(argv[1], "rb");
if (fin == NULL) {
printf("Can't open '%s' for reading\n", argv[1]);
return 0;
}
FILE *fout = fopen(argv[2], "w");
if (fout == NULL) {
printf("Can't open '%s' for writing\n", argv[2]);
return 0;
}
unsigned char buf[16];
while (!feof(fin)) {
fprintf(fout, "\t");
int actual = fread(buf, 1, 16, fin);
for (int i=0; i<actual; i++)
fprintf(fout, "0x%02x, ", buf[i]);
fprintf(fout, "\n");
}
fclose(fin);
fclose(fout);
return 0;
}

View File

@ -1,117 +0,0 @@
## BeOS Generic Makefile v2.1 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= SheepShaver
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= APP
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= ../main.cpp main_beos.cpp ../prefs.cpp ../prefs_items.cpp prefs_beos.cpp \
prefs_editor_beos.cpp sys_beos.cpp ../rom_patches.cpp ../rsrc_patches.cpp \
../emul_op.cpp ../name_registry.cpp ../macos_util.cpp ../timer.cpp \
timer_beos.cpp ../xpram.cpp xpram_beos.cpp ../adb.cpp clip_beos.cpp \
../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp scsi_beos.cpp \
../video.cpp video_beos.cpp ../audio.cpp audio_beos.cpp ../ether.cpp \
ether_beos.cpp ../serial.cpp serial_beos.cpp ../extfs.cpp extfs_beos.cpp \
about_window_beos.cpp ../user_strings.cpp user_strings_beos.cpp ../thunks.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS= SheepShaver.rsrc
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= be tracker game media translation textencoding device GL
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS = ../include SheepDriver SheepNet
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS =
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS = -prefix BeHeaders
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine

View File

@ -1,110 +0,0 @@
## BeOS Generic Makefile v2.1 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= NetPeek
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= APP
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= NetPeek.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS=
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS = ../ ../../include ../NetAddOn
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS =
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine

View File

@ -1,49 +0,0 @@
/*
* NetPeek.cpp - Utility program for monitoring SheepNet add-on
*/
#include "sysdeps.h"
#include "sheep_net.h"
#include <stdio.h>
static area_id buffer_area; // Packet buffer area
static net_buffer *net_buffer_ptr; // Pointer to packet buffer
int main(void)
{
area_id handler_buffer;
if ((handler_buffer = find_area("packet buffer")) < B_NO_ERROR) {
printf("Can't find packet buffer\n");
return 10;
}
if ((buffer_area = clone_area("local packet buffer", &net_buffer_ptr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, handler_buffer)) < B_NO_ERROR) {
printf("Can't clone packet buffer\n");
return 10;
}
uint8 *p = net_buffer_ptr->ether_addr;
printf("Ethernet address : %02x %02x %02x %02x %02x %02x\n", p[0], p[1], p[2], p[3], p[4], p[5]);
printf("read_sem : %d\n", net_buffer_ptr->read_sem);
printf("read_ofs : %d\n", net_buffer_ptr->read_ofs);
printf("read_packet_size : %d\n", net_buffer_ptr->read_packet_size);
printf("read_packet_count : %d\n", net_buffer_ptr->read_packet_count);
printf("write_sem : %d\n", net_buffer_ptr->write_sem);
printf("write_ofs : %d\n", net_buffer_ptr->write_ofs);
printf("write_packet_size : %d\n", net_buffer_ptr->write_packet_size);
printf("write_packet_count: %d\n", net_buffer_ptr->write_packet_count);
printf("\nRead packets:\n");
for (int i=0; i<READ_PACKET_COUNT; i++) {
net_packet *p = &net_buffer_ptr->read[i];
printf("cmd : %08lx\n", p->cmd);
printf("length: %d\n", p->length);
}
printf("\nWrite packets:\n");
for (int i=0; i<WRITE_PACKET_COUNT; i++) {
net_packet *p = &net_buffer_ptr->write[i];
printf("cmd : %08lx\n", p->cmd);
printf("length: %d\n", p->length);
}
return 0;
}

View File

@ -1,110 +0,0 @@
## BeOS Generic Makefile v2.1 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= SaveROM
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= APP
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= SaveROM.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS= SaveROM.rsrc
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS = ../ ../../include ../NetAddOn
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS =
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine

View File

@ -1,8 +0,0 @@
"SaveROM" is a program that allows you to save the ROM of
a PowerMac running under BeOS to a file.
1. Copy "sheep_driver" to ~/config/add-ons/kernel/drivers.
2. Double-click the "SaveROM" icon.
This will create a file called "ROM" which should be 4MB
in size.

View File

@ -1,128 +0,0 @@
/*
* SaveROM - Save Mac ROM to file
*
* Copyright (C) 1998-2004 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <AppKit.h>
#include <InterfaceKit.h>
#include <StorageKit.h>
#include <stdio.h>
#include <unistd.h>
// Constants
const char APP_SIGNATURE[] = "application/x-vnd.cebix-SaveROM";
const char ROM_FILE_NAME[] = "ROM";
// Global variables
static uint8 buf[0x400000];
// Application object
class SaveROM : public BApplication {
public:
SaveROM() : BApplication(APP_SIGNATURE)
{
// Find application directory and cwd to it
app_info the_info;
GetAppInfo(&the_info);
BEntry the_file(&the_info.ref);
BEntry the_dir;
the_file.GetParent(&the_dir);
BPath the_path;
the_dir.GetPath(&the_path);
chdir(the_path.Path());
}
virtual void ReadyToRun(void);
};
/*
* Create application object and start it
*/
int main(int argc, char **argv)
{
SaveROM *the_app = new SaveROM();
the_app->Run();
delete the_app;
return 0;
}
/*
* Display error alert
*/
static void ErrorAlert(const char *text)
{
BAlert *alert = new BAlert("SaveROM Error", text, "Quit", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go();
}
/*
* Display OK alert
*/
static void InfoAlert(const char *text)
{
BAlert *alert = new BAlert("SaveROM Message", text, "Quit", NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT);
alert->Go();
}
/*
* Main program
*/
void SaveROM::ReadyToRun(void)
{
int fd = open("/dev/sheep", 0);
if (fd < 0) {
ErrorAlert("Cannot open '/dev/sheep'.");
goto done;
}
if (read(fd, buf, 0x400000) != 0x400000) {
ErrorAlert("Cannot read ROM.");
close(fd);
goto done;
}
FILE *f = fopen(ROM_FILE_NAME, "wb");
if (f == NULL) {
ErrorAlert("Cannot open ROM file.");
close(fd);
goto done;
}
if (fwrite(buf, 1, 0x400000, f) != 0x400000) {
ErrorAlert("Cannot write ROM.");
fclose(f);
close(fd);
goto done;
}
InfoAlert("ROM saved.");
fclose(f);
close(fd);
done:
PostMessage(B_QUIT_REQUESTED);
}

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/SheepDriver

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/SheepNet

View File

@ -1,289 +0,0 @@
/*
* about_window_beos.cpp - "About" window, BeOS implementation
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <GLView.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include "about_window.h"
#include "video.h"
#include "version.h"
#include "user_strings.h"
// About window dimensions
static const BRect about_frame = BRect(0, 0, 383, 99);
// Special colors
const rgb_color fill_color = {216, 216, 216, 0};
// SheepShaver icon
static const uint8 sheep_icon[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xda, 0x15, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xff, 0x00, 0x00, 0x00, 0x16, 0xda, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16,
0x00, 0x1d, 0xda, 0x1e, 0x1e, 0x1e, 0xda, 0x16, 0x00, 0x00, 0x16, 0xda, 0x16, 0xda, 0x08, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x00, 0x0b, 0xff, 0xff, 0x11, 0x00, 0xda,
0x1d, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0x16, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xff,
0xff, 0x0b, 0x00, 0x00, 0x16, 0x16, 0x00, 0x12, 0xfd, 0x1d, 0x0b, 0x00, 0x00, 0x1d, 0xfd, 0x1d,
0xfd, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x3f, 0xda, 0x3f, 0xda, 0x15, 0x00, 0xff, 0xff, 0xff,
0x16, 0x00, 0x17, 0x16, 0x00, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x16, 0x0f, 0x0b, 0x1d,
0x1e, 0xfd, 0x1e, 0xda, 0x1e, 0xda, 0x3f, 0xda, 0x3f, 0xda, 0x1d, 0x5a, 0x15, 0xff, 0xff, 0xff,
0x05, 0x17, 0x16, 0x00, 0x12, 0x1d, 0x00, 0x1d, 0xfd, 0x00, 0xfd, 0x00, 0x00, 0x16, 0x0b, 0x00,
0x00, 0x0e, 0x1d, 0x3f, 0xda, 0x3f, 0xda, 0x1d, 0xda, 0x1b, 0x5a, 0x1b, 0x0f, 0x1d, 0xff, 0xff,
0xff, 0x05, 0x00, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x00, 0x0f, 0x14, 0x14,
0x16, 0x00, 0x15, 0xfd, 0x1d, 0xda, 0x1b, 0xda, 0x1b, 0x5a, 0x1b, 0x5a, 0x0f, 0x14, 0xff, 0xff,
0xff, 0xff, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x12, 0x00, 0x16, 0x00, 0x0f,
0x00, 0x1b, 0xfd, 0x1e, 0xfd, 0x1b, 0xda, 0x1b, 0x5a, 0x1b, 0x5a, 0x1b, 0x5a, 0x14, 0xff, 0xff,
0xff, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x12, 0x00, 0x16, 0x1b, 0x16, 0x0e,
0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0x5a, 0x18, 0x00, 0x00, 0x5a, 0x1b, 0x00, 0xff, 0xff,
0xff, 0x00, 0xfd, 0x14, 0xfd, 0x14, 0xfd, 0x1d, 0xfd, 0x12, 0x00, 0x16, 0xfd, 0x1b, 0xfd, 0x1b,
0xfd, 0x1b, 0xfd, 0x1e, 0xfd, 0x1b, 0x5a, 0x18, 0x5a, 0x00, 0x00, 0x1b, 0x9b, 0x00, 0xff, 0xff,
0xff, 0x00, 0x0f, 0xfd, 0x1d, 0xfd, 0x0f, 0xfd, 0x12, 0x00, 0x16, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd,
0x1b, 0xfd, 0x18, 0xfd, 0x1b, 0xf9, 0x18, 0x5a, 0x00, 0x12, 0x00, 0x9b, 0x1b, 0x00, 0xff, 0xff,
0xff, 0x00, 0xfd, 0x0a, 0x0a, 0x0a, 0xfd, 0x10, 0x00, 0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd, 0x18,
0xfd, 0x15, 0xfa, 0x15, 0xf9, 0x18, 0x15, 0x00, 0x12, 0x9b, 0x00, 0x1b, 0x9b, 0x00, 0x15, 0x15,
0xff, 0xff, 0x00, 0xfd, 0x1d, 0xfd, 0x1d, 0x00, 0x16, 0x00, 0x1b, 0xfd, 0x1b, 0xfd, 0x15, 0xfd,
0x15, 0xfa, 0x15, 0xf9, 0x15, 0x16, 0x00, 0x0f, 0x9b, 0x12, 0x00, 0x9b, 0x1b, 0x00, 0x15, 0x15,
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x1d, 0x00, 0xfa, 0x1e, 0x00, 0x1e, 0xfa, 0x15,
0xfa, 0x15, 0x16, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x12, 0x15, 0x15,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1d, 0xf9, 0x00, 0x3f, 0xfa, 0x00, 0xfa, 0x1b, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x12, 0x15, 0x15, 0x15, 0x15,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf9, 0x1d, 0x00, 0xf9, 0x1b, 0x00, 0x1b, 0xf9, 0x00,
0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1d, 0xf9, 0x00, 0x3f, 0xf9, 0x00, 0xf9, 0x1b, 0x00,
0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x16, 0x1d, 0x00, 0xf9, 0x1b, 0x00, 0x1b, 0xf9, 0x00,
0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x00, 0x16, 0xf9, 0x00, 0x1b, 0x16, 0x00,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x16, 0x00, 0x16, 0x00, 0x16,
0x15, 0x15, 0x15, 0x15, 0x00, 0x00, 0x15, 0x00, 0x0a, 0x19, 0x0a, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x00, 0x00, 0x00, 0x16, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x15, 0x00, 0x19, 0x1c, 0x18, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00,
0x0f, 0xff, 0xff, 0xff, 0x00, 0x18, 0x11, 0x00, 0x15, 0x00, 0x1c, 0x18, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0x00, 0x00, 0x0b, 0x0b,
0x00, 0x00, 0x0f, 0xff, 0x12, 0x00, 0x18, 0x19, 0x00, 0x15, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0x00, 0x14, 0x1e, 0xfd, 0x01, 0xfd, 0x14,
0xfa, 0xf9, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x19, 0x1c, 0x00, 0x18, 0x1c, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0xfd, 0x1e, 0xf9, 0x1e, 0xfa, 0x1e, 0xf9,
0x14, 0xfa, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1c, 0x00, 0x18, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0x1e, 0xf9, 0x14, 0xfa, 0x1e, 0xf9, 0x1e,
0xfd, 0x1e, 0x00, 0x15, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0xfd, 0x1e, 0xfd, 0x14, 0xfd, 0x1e, 0xfd,
0x1e, 0x01, 0x00, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x1c, 0x00, 0x15,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0xfa, 0x01, 0xf9, 0x1e, 0xf9, 0x14,
0x14, 0x00, 0x0f, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x15, 0x15,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0f, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// View class
class AboutViewT : public BView {
public:
AboutViewT(BRect r) : BView(r, "", B_FOLLOW_NONE, B_WILL_DRAW) {}
virtual void Draw(BRect update)
{
char str[256];
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR);
SetFont(be_bold_font);
SetDrawingMode(B_OP_OVER);
MovePenTo(20, 20);
DrawString(str);
SetFont(be_plain_font);
MovePenTo(20, 40);
DrawString(GetString(STR_ABOUT_TEXT2));
MovePenTo(20, 60);
DrawString(B_UTF8_COPYRIGHT "1997-2008 Christian Bauer and Marc Hellwig");
}
virtual void MouseDown(BPoint point)
{
Window()->PostMessage(B_QUIT_REQUESTED);
}
};
// 3D view class
class AboutView3D : public BGLView {
public:
AboutView3D(BRect r) : BGLView(r, "", B_FOLLOW_NONE, 0, BGL_RGB | BGL_DOUBLE)
{
rot_x = rot_y = 0;
if (!VideoSnapshot(64, 64, texture)) {
uint8 *p = texture;
const uint8 *q = sheep_icon;
const color_map *cm = system_colors();
for (int i=0; i<32*32; i++) {
uint8 red = cm->color_list[*q].red;
uint8 green = cm->color_list[*q].green;
uint8 blue = cm->color_list[*q++].blue;
p[0] = p[3] = p[64*3] = p[65*3] = red;
p[1] = p[4] = p[64*3+1] = p[65*3+1] = green;
p[2] = p[5] = p[64*3+2] = p[65*3+2] = blue;
p += 6;
if ((i & 31) == 31)
p += 64*3;
}
}
}
virtual void AttachedToWindow(void)
{
BGLView::AttachedToWindow();
LockGL();
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glShadeModel(GL_SMOOTH);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(30, 1, 0.5, 20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLfloat light_color[4] = {1, 1, 1, 1};
GLfloat light_dir[4] = {1, 2, 1.5, 1};
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color);
glLightfv(GL_LIGHT0, GL_POSITION, light_dir);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, 4, 64, 64, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
glEnable(GL_TEXTURE_2D);
UnlockGL();
tick_thread_active = true;
tick_thread = spawn_thread(tick_func, "OpenGL Animation", B_NORMAL_PRIORITY, this);
resume_thread(tick_thread);
}
virtual void DetachedFromWindow(void)
{
status_t l;
tick_thread_active = false;
wait_for_thread(tick_thread, &l);
BGLView::DetachedFromWindow();
}
virtual void Draw(BRect update)
{
LockGL();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glNormal3d(0, 0, 1);
glTexCoord2f(0, 0);
glVertex3d(-1, 1, 0);
glTexCoord2f(1, 0);
glVertex3d(1, 1, 0);
glTexCoord2f(1, 1);
glVertex3d(1, -1, 0);
glTexCoord2f(0, 1);
glVertex3d(-1, -1, 0);
glEnd();
SwapBuffers();
UnlockGL();
}
static status_t tick_func(void *arg)
{
AboutView3D *obj = (AboutView3D *)arg;
while (obj->tick_thread_active) {
obj->rot_x += 2;
obj->rot_y += 2;
obj->LockGL();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -5);
glRotatef(obj->rot_x, 1, 0, 0);
glRotatef(obj->rot_y, 0, 1, 0);
obj->UnlockGL();
if (obj->LockLooperWithTimeout(20000) == B_OK) {
obj->Draw(obj->Bounds());
obj->UnlockLooper();
}
snooze(16667);
}
return 0;
}
private:
thread_id tick_thread;
bool tick_thread_active;
float rot_x, rot_y;
uint8 texture[64*64*3];
};
// Window class
class AboutWindowT : public BWindow {
public:
AboutWindowT() : BWindow(about_frame, NULL, B_MODAL_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK)
{
Lock();
MoveTo(100, 100);
BRect r = Bounds();
r.right = 100;
AboutView3D *view_3d = new AboutView3D(r);
AddChild(view_3d);
r = Bounds();
r.left = 100;
AboutViewT *view = new AboutViewT(r);
AddChild(view);
view->SetHighColor(0, 0, 0);
view->SetViewColor(fill_color);
view->MakeFocus();
Unlock();
Show();
}
};
/*
* Open "About" window
*/
void OpenAboutWindow(void)
{
new AboutWindowT;
}

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/audio_beos.cpp

View File

@ -1,374 +0,0 @@
/*
* clip_beos.cpp - Clipboard handling, BeOS implementation
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <support/UTF8.h>
#include "clip.h"
#include "main.h"
#include "cpu_emulation.h"
#include "emul_op.h"
#define DEBUG 0
#include "debug.h"
// Global variables
static bool we_put_this_data = false; // Flag for PutScrap(): the data was put by GetScrap(), don't bounce it back to the Be side
static BTranslatorRoster *roster;
static float input_cap = 0;
static translator_info input_info;
static float output_cap = 0;
static translator_id output_trans = 0;
/*
* Clipboard manager thread (for calling clipboard functions; this is not safe
* under R4 when running on the MacOS stack in kernel space)
*/
// Message constants
const uint32 MSG_QUIT_CLIP_MANAGER = 'quit';
const uint32 MSG_PUT_TEXT = 'ptxt';
static thread_id cm_thread = -1;
static sem_id cm_done_sem = -1;
// Argument passing
static void *cm_scrap;
static int32 cm_length;
static status_t clip_manager(void *arg)
{
for (;;) {
// Receive message
thread_id sender;
uint32 code = receive_data(&sender, NULL, 0);
D(bug("Clipboard manager received %08lx\n", code));
switch (code) {
case MSG_QUIT_CLIP_MANAGER:
return 0;
case MSG_PUT_TEXT:
if (be_clipboard->Lock()) {
be_clipboard->Clear();
BMessage *clipper = be_clipboard->Data();
// Convert text from Mac charset to UTF-8
int32 dest_length = cm_length * 3;
int32 state = 0;
char *inbuf = new char[cm_length];
memcpy(inbuf, cm_scrap, cm_length); // Copy to user space
char *outbuf = new char[dest_length];
if (convert_to_utf8(B_MAC_ROMAN_CONVERSION, inbuf, &cm_length, outbuf, &dest_length, &state) == B_OK) {
for (int i=0; i<dest_length; i++)
if (outbuf[i] == 13)
outbuf[i] = 10;
// Add text to Be clipboard
clipper->AddData("text/plain", B_MIME_TYPE, outbuf, dest_length);
be_clipboard->Commit();
} else {
D(bug(" text conversion failed\n"));
}
delete[] outbuf;
delete[] inbuf;
be_clipboard->Unlock();
}
break;
}
// Acknowledge
release_sem(cm_done_sem);
}
}
/*
* Initialize clipboard
*/
void ClipInit(void)
{
// check if there is a translator that can handle the pict datatype
roster = BTranslatorRoster::Default();
int32 num_translators, i,j;
translator_id *translators;
const char *translator_name, *trans_info;
int32 translator_version;
const translation_format *t_formats;
long t_num;
roster->GetAllTranslators(&translators, &num_translators);
for (i=0;i<num_translators;i++) {
roster->GetTranslatorInfo(translators[i], &translator_name,
&trans_info, &translator_version);
D(bug("found translator %s: %s (%.2f)\n", translator_name, trans_info,
translator_version/100.));
// does this translator support the pict datatype ?
roster->GetInputFormats(translators[i], &t_formats,&t_num);
//printf(" supports %d input formats \n",t_num);
for (j=0;j<t_num;j++) {
if (!strcmp (t_formats[j].MIME,"image/pict")) {
// matching translator found
if (t_formats[j].capability>input_cap) {
input_info.type = t_formats[j].type;
input_info.group = t_formats[j].group;
input_info.quality = t_formats[j].quality;
input_info.capability = t_formats[j].capability;
strcpy(input_info.MIME,t_formats[j].MIME);
strcpy(input_info.name,t_formats[j].name);
input_info.translator=translators[i];
input_cap = t_formats[j].capability;
}
D(bug("matching input translator found:type:%c%c%c%c group:%c%c%c%c quality:%f capability:%f MIME:%s name:%s\n",
t_formats[j].type>>24,t_formats[j].type>>16,t_formats[j].type>>8,t_formats[j].type,
t_formats[j].group>>24,t_formats[j].group>>16,t_formats[j].group>>8,t_formats[j].group,
t_formats[j].quality,
t_formats[j].capability,t_formats[j].MIME,
t_formats[j].name));
}
}
roster->GetOutputFormats(translators[i], &t_formats,&t_num);
//printf("and %d output formats \n",t_num);
for (j=0;j<t_num;j++) {
if (!strcmp (t_formats[j].MIME,"image/pict")) {
if (t_formats[j].capability>output_cap) {
output_trans = translators[i];
output_cap = t_formats[j].capability;
}
D(bug("matching output translator found:type:%c%c%c%c group:%c%c%c%c quality:%f capability:%f MIME:%s name:%s\n",
t_formats[j].type>>24,t_formats[j].type>>16,t_formats[j].type>>8,t_formats[j].type,
t_formats[j].group>>24,t_formats[j].group>>16,t_formats[j].group>>8,t_formats[j].group,
t_formats[j].quality,
t_formats[j].capability,t_formats[j].MIME,
t_formats[j].name));
}
}
}
delete [] translators; // clean up our droppings
// Start clipboard manager thread
cm_done_sem = create_sem(0, "Clipboard Manager Done");
cm_thread = spawn_thread(clip_manager, "Clipboard Manager", B_NORMAL_PRIORITY, NULL);
resume_thread(cm_thread);
}
/*
* Deinitialize clipboard
*/
void ClipExit(void)
{
// Stop clipboard manager
if (cm_thread > 0) {
status_t l;
send_data(cm_thread, MSG_QUIT_CLIP_MANAGER, NULL, 0);
while (wait_for_thread(cm_thread, &l) == B_INTERRUPTED) ;
}
// Delete semaphores
delete_sem(cm_done_sem);
}
/*
* Mac application wrote to clipboard
*/
void PutScrap(uint32 type, void *scrap, int32 length)
{
D(bug("PutScrap type %08lx, data %p, length %ld\n", type, scrap, length));
if (we_put_this_data) {
we_put_this_data = false;
return;
}
if (length <= 0)
return;
switch (type) {
case 'TEXT':
D(bug(" clipping TEXT\n"));
cm_scrap = scrap;
cm_length = length;
while (send_data(cm_thread, MSG_PUT_TEXT, NULL, 0) == B_INTERRUPTED) ;
while (acquire_sem(cm_done_sem) == B_INTERRUPTED) ;
break;
case 'PICT':
D(bug(" clipping PICT\n"));
//!! this has to be converted to use the Clipboard Manager
#if 0
if (be_clipboard->Lock()) {
be_clipboard->Clear();
BMessage *clipper = be_clipboard->Data();
// Waaaah! This crashes!
if (input_cap > 0) { // if there is an converter for PICT datatype convert data to bitmap.
BMemoryIO *in_buffer = new BMemoryIO(scrap, length);
BMallocIO *out_buffer = new BMallocIO();
status_t result=roster->Translate(in_buffer,&input_info,NULL,out_buffer,B_TRANSLATOR_BITMAP);
clipper->AddData("image/x-be-bitmap", B_MIME_TYPE, out_buffer->Buffer(), out_buffer->BufferLength());
D(bug("conversion result:%08x buffer_size:%d\n",result,out_buffer->BufferLength()));
delete in_buffer;
delete out_buffer;
}
clipper->AddData("image/pict", B_MIME_TYPE, scrap, length);
be_clipboard->Commit();
be_clipboard->Unlock();
}
#endif
break;
}
}
/*
* Mac application zeroes clipboard
*/
void ZeroScrap()
{
}
/*
* Mac application reads clipboard
*/
void GetScrap(void **handle, uint32 type, int32 offset)
{
M68kRegisters r;
D(bug("GetScrap handle %p, type %08lx, offset %ld\n", handle, type, offset));
return; //!! GetScrap is currently broken (should use Clipboard Manager)
//!! replace with clipboard notification in BeOS R4.1
switch (type) {
case 'TEXT':
D(bug(" clipping TEXT\n"));
if (be_clipboard->Lock()) {
BMessage *clipper = be_clipboard->Data();
char *clip;
ssize_t length;
// Check if we already copied this data
if (clipper->HasData("application/x-SheepShaver-cookie", B_MIME_TYPE))
return;
bigtime_t cookie = system_time();
clipper->AddData("application/x-SheepShaver-cookie", B_MIME_TYPE, &cookie, sizeof(bigtime_t));
// No, is there text in it?
if (clipper->FindData("text/plain", B_MIME_TYPE, &clip, &length) == B_OK) {
D(bug(" text/plain found\n"));
// Convert text from UTF-8 to Mac charset
int32 src_length = length;
int32 dest_length = length;
int32 state = 0;
char *outbuf = new char[dest_length];
if (convert_from_utf8(B_MAC_ROMAN_CONVERSION, clip, &src_length, outbuf, &dest_length, &state) == B_OK) {
for (int i=0; i<dest_length; i++)
if (outbuf[i] == 10)
outbuf[i] = 13;
// Add text to Mac clipboard
static uint16 proc[] = {
0x598f, // subq.l #4,sp
0xa9fc, // ZeroScrap()
0x2f3c, 0, 0, // move.l #length,-(sp)
0x2f3c, 'TE', 'XT', // move.l #'TEXT',-(sp)
0x2f3c, 0, 0, // move.l #outbuf,-(sp)
0xa9fe, // PutScrap()
0x588f, // addq.l #4,sp
M68K_RTS
};
*(int32 *)(proc + 3) = dest_length;
*(char **)(proc + 9) = outbuf;
we_put_this_data = true;
Execute68k((uint32)proc, &r);
} else {
D(bug(" text conversion failed\n"));
}
delete[] outbuf;
}
be_clipboard->Commit();
be_clipboard->Unlock();
}
break;
case 'PICT':
D(bug(" clipping PICT\n"));
if (be_clipboard->Lock()) {
BMessage *clipper = be_clipboard->Data();
char *clip;
ssize_t length;
// Check if we already copied this data
if (clipper->HasData("application/x-SheepShaver-cookie", B_MIME_TYPE))
return;
bigtime_t cookie = system_time();
clipper->AddData("application/x-SheepShaver-cookie", B_MIME_TYPE, &cookie, sizeof(bigtime_t));
static uint16 proc2[] = {
0x598f, // subq.l #4,sp
0xa9fc, // ZeroScrap()
0x2f3c, 0, 0, // move.l #length,-(sp)
0x2f3c, 'PI', 'CT', // move.l #'PICT',-(sp)
0x2f3c, 0, 0, // move.l #buf,-(sp)
0xa9fe, // PutScrap()
0x588f, // addq.l #4,sp
M68K_RTS
};
// No, is there a pict ?
if (clipper->FindData("image/pict", B_MIME_TYPE, &clip, &length) == B_OK ) {
D(bug(" image/pict found\n"));
// Add pict to Mac clipboard
*(int32 *)(proc2 + 3) = length;
*(char **)(proc2 + 9) = clip;
we_put_this_data = true;
Execute68k((uint32)proc2, &r);
#if 0
// No, is there a bitmap ?
} else if (clipper->FindData("image/x-be-bitmap", B_MIME_TYPE, &clip, &length) == B_OK || output_cap > 0) {
D(bug(" image/x-be-bitmap found\nstarting conversion to PICT\n"));
BMemoryIO *in_buffer = new BMemoryIO(clip, length);
BMallocIO *out_buffer = new BMallocIO();
status_t result=roster->Translate(output_trans,in_buffer,NULL,out_buffer,'PICT');
D(bug("result of conversion:%08x buffer_size:%d\n",result,out_buffer->BufferLength()));
// Add pict to Mac clipboard
*(int32 *)(proc2 + 3) = out_buffer->BufferLength();
*(char **)(proc2 + 9) = (char *)out_buffer->Buffer();
we_put_this_data = true;
Execute68k(proc2, &r);
delete in_buffer;
delete out_buffer;
#endif
}
be_clipboard->Commit();
be_clipboard->Unlock();
}
break;
}
}

View File

@ -1,400 +0,0 @@
/*
* ether_beos.cpp - SheepShaver Ethernet Device Driver (DLPI), BeOS specific stuff
*
* SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "ether.h"
#include "ether_defs.h"
#include "prefs.h"
#include "xlowmem.h"
#include "main.h"
#include "user_strings.h"
#include "sheep_net.h"
#define DEBUG 0
#include "debug.h"
#define STATISTICS 0
#define MONITOR 0
// Global variables
static thread_id read_thread; // Packet receiver thread
static bool ether_thread_active = true; // Flag for quitting the receiver thread
static area_id buffer_area; // Packet buffer area
static net_buffer *net_buffer_ptr; // Pointer to packet buffer
static sem_id read_sem, write_sem; // Semaphores to trigger packet reading/writing
static uint32 rd_pos; // Current read position in packet buffer
static uint32 wr_pos; // Current write position in packet buffer
static bool net_open = false; // Flag: initialization succeeded, network device open
// Prototypes
static status_t AO_receive_thread(void *data);
/*
* Initialize ethernet
*/
void EtherInit(void)
{
// Do nothing if the user disabled the network
if (PrefsFindBool("nonet"))
return;
// find net-server team
i_wanna_try_that_again:
bool found_add_on = false;
team_info t_info;
int32 t_cookie = 0;
image_info i_info;
int32 i_cookie = 0;
while (get_next_team_info(&t_cookie, &t_info) == B_NO_ERROR) {
if (strstr(t_info.args,"net_server")!=NULL) {
// check if sheep_net add-on is loaded
while (get_next_image_info(t_info.team,&i_cookie,&i_info) == B_NO_ERROR) {
if (strstr(i_info.name,"sheep_net")!=NULL) {
found_add_on = true;
break;
}
}
}
if (found_add_on) break;
}
if (!found_add_on) {
// Search for sheep_net in network config file
char str[1024];
bool sheep_net_found = false;
FILE *fin = fopen("/boot/home/config/settings/network", "r");
while (!feof(fin)) {
fgets(str, 1024, fin);
if (strstr(str, "PROTOCOLS"))
if (strstr(str, "sheep_net"))
sheep_net_found = true;
}
fclose(fin);
// It was found, so something else must be wrong
if (sheep_net_found) {
WarningAlert(GetString(STR_NO_NET_ADDON_WARN));
return;
}
// Not found, inform the user
if (!ChoiceAlert(GetString(STR_NET_CONFIG_MODIFY_WARN), GetString(STR_OK_BUTTON), GetString(STR_CANCEL_BUTTON)))
return;
// Change the network config file and restart the network
fin = fopen("/boot/home/config/settings/network", "r");
FILE *fout = fopen("/boot/home/config/settings/network.2", "w");
bool global_found = false;
bool modified = false;
while (!feof(fin)) {
str[0] = 0;
fgets(str, 1024, fin);
if (!global_found && strstr(str, "GLOBAL:")) {
global_found = true;
} else if (global_found && !modified && strstr(str, "PROTOCOLS")) {
str[strlen(str)-1] = 0;
strcat(str, " sheep_net\n");
modified = true;
} else if (global_found && !modified && strlen(str) > 2 && str[strlen(str) - 2] == ':') {
fputs("\tPROTOCOLS = sheep_net\n", fout);
modified = true;
}
fputs(str, fout);
}
if (!modified)
fputs("\tPROTOCOLS = sheep_net\n", fout);
fclose(fout);
fclose(fin);
remove("/boot/home/config/settings/network.orig");
rename("/boot/home/config/settings/network", "/boot/home/config/settings/network.orig");
rename("/boot/home/config/settings/network.2", "/boot/home/config/settings/network");
app_info ai;
if (be_roster->GetAppInfo("application/x-vnd.Be-NETS", &ai) == B_OK) {
BMessenger msg(NULL, ai.team);
if (msg.IsValid()) {
while (be_roster->IsRunning("application/x-vnd.Be-NETS")) {
msg.SendMessage(B_QUIT_REQUESTED);
snooze(500000);
}
}
}
BPath path;
find_directory(B_BEOS_BOOT_DIRECTORY, &path);
path.Append("Netscript");
char *argv[3] = {"/bin/sh", (char *)path.Path(), NULL};
thread_id net_server = load_image(2, argv, environ);
resume_thread(net_server);
status_t l;
wait_for_thread(net_server, &l);
goto i_wanna_try_that_again;
}
// Set up communications with add-on
area_id handler_buffer;
if ((handler_buffer = find_area("packet buffer")) < B_NO_ERROR) {
WarningAlert(GetString(STR_NET_ADDON_INIT_FAILED));
return;
}
if ((buffer_area = clone_area("local packet buffer", &net_buffer_ptr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, handler_buffer)) < B_NO_ERROR) {
D(bug("EtherInit: couldn't clone packet area\n"));
WarningAlert(GetString(STR_NET_ADDON_CLONE_FAILED));
return;
}
if ((read_sem = create_sem(0, "ether read")) < B_NO_ERROR) {
printf("FATAL: can't create Ethernet semaphore\n");
return;
}
net_buffer_ptr->read_sem = read_sem;
write_sem = net_buffer_ptr->write_sem;
read_thread = spawn_thread(AO_receive_thread, "ether read", B_URGENT_DISPLAY_PRIORITY, NULL);
resume_thread(read_thread);
for (int i=0; i<WRITE_PACKET_COUNT; i++)
net_buffer_ptr->write[i].cmd = IN_USE | (ACTIVATE_SHEEP_NET << 8);
rd_pos = wr_pos = 0;
release_sem(write_sem);
// Everything OK
net_open = true;
}
/*
* Exit ethernet
*/
void EtherExit(void)
{
if (net_open) {
// Close communications with add-on
for (int i=0; i<WRITE_PACKET_COUNT; i++)
net_buffer_ptr->write[i].cmd = IN_USE | (DEACTIVATE_SHEEP_NET << 8);
release_sem(write_sem);
// Quit receiver thread
ether_thread_active = false;
status_t result;
release_sem(read_sem);
while (wait_for_thread(read_thread, &result) == B_INTERRUPTED) ;
delete_sem(read_sem);
delete_area(buffer_area);
}
#if STATISTICS
// Show statistics
printf("%ld messages put on write queue\n", num_wput);
printf("%ld error acks\n", num_error_acks);
printf("%ld packets transmitted (%ld raw, %ld normal)\n", num_tx_packets, num_tx_raw_packets, num_tx_normal_packets);
printf("%ld tx packets dropped because buffer full\n", num_tx_buffer_full);
printf("%ld packets received\n", num_rx_packets);
printf("%ld packets passed upstream (%ld Fast Path, %ld normal)\n", num_rx_fastpath + num_unitdata_ind, num_rx_fastpath, num_unitdata_ind);
printf("EtherIRQ called %ld times\n", num_ether_irq);
printf("%ld rx packets dropped due to low memory\n", num_rx_no_mem);
printf("%ld rx packets dropped because no stream found\n", num_rx_dropped);
printf("%ld rx packets dropped because stream not ready\n", num_rx_stream_not_ready);
printf("%ld rx packets dropped because no memory for unitdata_ind\n", num_rx_no_unitdata_mem);
#endif
}
/*
* Ask add-on for ethernet hardware address
*/
void AO_get_ethernet_address(uint32 arg)
{
uint8 *addr = Mac2HostAddr(arg);
if (net_open) {
OTCopy48BitAddress(net_buffer_ptr->ether_addr, addr);
} else {
addr[0] = 0x12;
addr[1] = 0x34;
addr[2] = 0x56;
addr[3] = 0x78;
addr[4] = 0x9a;
addr[5] = 0xbc;
}
D(bug("AO_get_ethernet_address: got address %02x%02x%02x%02x%02x%02x\n", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]));
}
/*
* Tell add-on to enable multicast address
*/
void AO_enable_multicast(uint32 addr)
{
D(bug("AO_enable_multicast\n"));
if (net_open) {
net_packet *p = &net_buffer_ptr->write[wr_pos];
if (p->cmd & IN_USE) {
D(bug("WARNING: couldn't enable multicast address\n"));
} else {
Mac2host_memcpy(p->data, addr, 6);
p->length = 6;
p->cmd = IN_USE | (ADD_MULTICAST << 8);
wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT;
release_sem(write_sem);
}
}
}
/*
* Tell add-on to disable multicast address
*/
void AO_disable_multicast(uint32 addr)
{
D(bug("AO_disable_multicast\n"));
if (net_open) {
net_packet *p = &net_buffer_ptr->write[wr_pos];
if (p->cmd & IN_USE) {
D(bug("WARNING: couldn't enable multicast address\n"));
} else {
Mac2host_memcpy(p->data, addr, 6);
p->length = 6;
p->cmd = IN_USE | (REMOVE_MULTICAST << 8);
wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT;
release_sem(write_sem);
}
D(bug("WARNING: couldn't disable multicast address\n"));
}
}
/*
* Tell add-on to transmit one packet
*/
void AO_transmit_packet(uint32 mp_arg)
{
D(bug("AO_transmit_packet\n"));
if (net_open) {
net_packet *p = &net_buffer_ptr->write[wr_pos];
if (p->cmd & IN_USE) {
D(bug("WARNING: couldn't transmit packet (buffer full)\n"));
num_tx_buffer_full++;
} else {
D(bug(" write packet pos %d\n", i));
num_tx_packets++;
// Copy packet to buffer
uint8 *start;
uint8 *bp = start = p->data;
mblk_t *mp = Mac2HostAddr(mp_arg);
while (mp) {
uint32 size = mp->b_wptr - mp->b_rptr;
memcpy(bp, mp->b_rptr, size);
bp += size;
mp = mp->b_cont;
}
#if MONITOR
bug("Sending Ethernet packet:\n");
for (int i=0; i<(uint32)(bp - start); i++) {
bug("%02lx ", start[i]);
}
bug("\n");
#endif
// Notify add-on
p->length = (uint32)(bp - start);
p->cmd = IN_USE | (SHEEP_PACKET << 8);
wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT;
release_sem(write_sem);
}
}
}
/*
* Packet reception thread
*/
static status_t AO_receive_thread(void *data)
{
while (ether_thread_active) {
if (net_buffer_ptr->read[rd_pos].cmd & IN_USE) {
if (ether_driver_opened) {
D(bug(" packet received, triggering Ethernet interrupt\n"));
SetInterruptFlag(INTFLAG_ETHER);
TriggerInterrupt();
}
}
acquire_sem_etc(read_sem, 1, B_TIMEOUT, 25000);
}
return 0;
}
/*
* Ethernet interrupt
*/
void EtherIRQ(void)
{
D(bug("EtherIRQ\n"));
num_ether_irq++;
OTEnterInterrupt();
// Send received packets to OpenTransport
net_packet *p = &net_buffer_ptr->read[rd_pos];
while (p->cmd & IN_USE) {
if ((p->cmd >> 8) == SHEEP_PACKET) {
num_rx_packets++;
D(bug(" read packet pos %d\n", i));
uint32 size = p->length;
#if MONITOR
bug("Receiving Ethernet packet:\n");
for (int i=0; i<size; i++) {
bug("%02lx ", p->data[i]);
}
bug("\n");
#endif
// Wrap packet in message block
//!! maybe use esballoc()
mblk_t *mp;
if ((mp = allocb(size, 0)) != NULL) {
D(bug(" packet data at %p\n", (void *)mp->b_rptr));
memcpy(mp->b_rptr, p->data, size);
mp->b_wptr += size;
ether_packet_received(mp);
} else {
D(bug("WARNING: Cannot allocate mblk for received packet\n"));
num_rx_no_mem++;
}
}
p->cmd = 0; // Free packet
rd_pos = (rd_pos + 1) % READ_PACKET_COUNT;
p = &net_buffer_ptr->read[rd_pos];
}
OTLeaveInterrupt();
}

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/extfs_beos.cpp

File diff suppressed because it is too large Load Diff

View File

@ -1,112 +0,0 @@
/*
* prefs_beos.cpp - Preferences handling, BeOS specific things
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <StorageKit.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "sysdeps.h"
#include "prefs.h"
#include "main.h"
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
{"bitbang", TYPE_BOOLEAN, false, "draw Mac desktop directly on screen in window mode"},
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
{NULL, TYPE_END, false, NULL} // End of list
};
// Preferences file name and path
const char PREFS_FILE_NAME[] = "SheepShaver_prefs";
static BPath prefs_path;
// Modification date of prefs file
time_t PrefsFileDate = 0;
/*
* Load preferences from settings file
*/
void LoadPrefs(const char *vmdir)
{
// Construct prefs path
find_directory(B_USER_SETTINGS_DIRECTORY, &prefs_path, true);
prefs_path.Append(PREFS_FILE_NAME);
// Read preferences from settings file
FILE *f = fopen(prefs_path.Path(), "r");
if (f == NULL) // Not found in settings directory, look in app directory
f = fopen(PREFS_FILE_NAME, "r");
if (f != NULL) {
LoadPrefsFromStream(f);
struct stat s;
fstat(fileno(f), &s);
PrefsFileDate = s.st_ctime;
fclose(f);
} else {
// No prefs file, save defaults
SavePrefs();
PrefsFileDate = real_time_clock();
}
}
/*
* Save preferences to settings file
*/
void SavePrefs(void)
{
FILE *f;
if ((f = fopen(prefs_path.Path(), "w")) != NULL) {
SavePrefsToStream(f);
fclose(f);
}
}
/*
* Add defaults of platform-specific prefs items
* You may also override the defaults set in PrefsInit()
*/
void AddPlatformPrefsDefaults(void)
{
PrefsReplaceString("extfs", "/boot");
PrefsAddInt32("windowmodes",
B_8_BIT_640x480 | B_15_BIT_640x480 | B_32_BIT_640x480 |
B_8_BIT_800x600 | B_15_BIT_800x600 | B_32_BIT_800x600
);
PrefsAddInt32("screenmodes",
B_8_BIT_640x480 | B_15_BIT_640x480 | B_32_BIT_640x480 |
B_8_BIT_800x600 | B_15_BIT_800x600 | B_32_BIT_800x600 |
B_8_BIT_1024x768 | B_15_BIT_1024x768
);
PrefsAddBool("bitbang", false);
PrefsAddBool("idlewait", true);
}

View File

@ -1,877 +0,0 @@
/*
* prefs_editor_beos.cpp - Preferences editor, BeOS implementation
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <SerialPort.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fs_info.h>
#include "prefs_editor.h"
#include "prefs.h"
#include "main.h"
#include "cdrom.h"
#include "xpram.h"
#include "about_window.h"
#include "user_strings.h"
// Special colors
const rgb_color fill_color = {216, 216, 216, 0};
const rgb_color slider_fill_color = {102, 152, 255, 0};
// Window messages
const uint32 MSG_OK = 'okok'; // "Start" clicked
const uint32 MSG_CANCEL = 'cncl'; // "Quit" clicked
const uint32 MSG_ZAP_PRAM = 'zprm';
const int NUM_PANES = 4;
const uint32 MSG_VOLUME_SELECTED = 'volu'; // "Volumes" pane
const uint32 MSG_VOLUME_INVOKED = 'voli';
const uint32 MSG_ADD_VOLUME = 'addv';
const uint32 MSG_CREATE_VOLUME = 'crev';
const uint32 MSG_REMOVE_VOLUME = 'remv';
const uint32 MSG_ADD_VOLUME_PANEL = 'advp';
const uint32 MSG_CREATE_VOLUME_PANEL = 'crvp';
const uint32 MSG_DEVICE_NAME = 'devn';
const uint32 MSG_BOOT_ANY = 'bany';
const uint32 MSG_BOOT_CDROM = 'bcdr';
const uint32 MSG_NOCDROM = 'nocd';
const uint32 MSG_REF_5HZ = ' 5Hz'; // "Graphics" pane
const uint32 MSG_REF_7_5HZ = ' 7Hz';
const uint32 MSG_REF_10HZ = '10Hz';
const uint32 MSG_REF_15HZ = '15Hz';
const uint32 MSG_REF_30HZ = '30Hz';
const uint32 MSG_GFXACCEL = 'gfac';
const uint32 MSG_WINDOW_MODE = 'wmod';
const uint32 MSG_SCREEN_MODE = 'smod';
const uint32 MSG_NOSOUND = 'nosn';
const uint32 MSG_SER_A = 'sera'; // "Serial"/"Network" pane
const uint32 MSG_SER_B = 'serb';
const uint32 MSG_NONET = 'noet';
const uint32 MSG_RAMSIZE = 'rmsz'; // "Memory" pane
const uint32 MSG_IGNORESEGV = 'isgv';
const uint32 MSG_IDLEWAIT = 'idlw';
// RAM size slider class
class RAMSlider : public BSlider {
public:
RAMSlider(BRect frame, const char *name, const char *label, BMessage *message,
int32 minValue, int32 maxValue, thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode = B_FOLLOW_LEFT |
B_FOLLOW_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW |
B_FRAME_EVENTS) : BSlider(frame, name, label, message, minValue, maxValue, thumbType, resizingMode, flags)
{
update_text = (char *)malloc(256);
}
virtual ~RAMSlider()
{
if (update_text)
free(update_text);
}
virtual char *UpdateText(void) const
{
if (update_text) {
sprintf(update_text, GetString(STR_RAMSIZE_FMT), Value());
}
return update_text;
}
private:
char *update_text;
};
// Volumes list view class
class VolumeListView : public BListView {
public:
VolumeListView(BRect frame, const char *name, list_view_type type = B_SINGLE_SELECTION_LIST, uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE)
: BListView(frame, name, type, resizeMask, flags)
{}
// Handle dropped files and volumes
virtual void MessageReceived(BMessage *msg)
{
if (msg->what == B_SIMPLE_DATA) {
BMessage msg2(MSG_ADD_VOLUME_PANEL);
entry_ref ref;
for (int i=0; msg->FindRef("refs", i, &ref) == B_NO_ERROR; i++)
msg2.AddRef("refs", &ref);
Window()->PostMessage(&msg2);
} else
BListView::MessageReceived(msg);
}
};
// Number-entry BTextControl
class NumberControl : public BTextControl {
public:
NumberControl(BRect frame, float divider, const char *name, const char *label, long value, BMessage *message)
: BTextControl(frame, name, label, NULL, message, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE)
{
SetDivider(divider);
for (int c=0; c<256; c++)
if (!isdigit(c) && c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW)
((BTextView *)ChildAt(0))->DisallowChar(c);
SetValue(value);
}
// Set integer value
void SetValue(long value)
{
char str[32];
sprintf(str, "%ld", value);
SetText(str);
}
// Get integer value
long Value(void)
{
return atol(Text());
}
};
// Path-entry BTextControl
class PathControl : public BTextControl {
public:
PathControl(bool dir_ctrl_, BRect frame, const char *name, const char *label, const char *text, BMessage *message) : BTextControl(frame, name, label, text, message), dir_ctrl(dir_ctrl_)
{
for (int c=0; c<' '; c++)
if (c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW)
((BTextView *)ChildAt(0))->DisallowChar(c);
}
virtual void MessageReceived(BMessage *msg)
{
if (msg->what == B_SIMPLE_DATA) {
entry_ref the_ref;
BEntry the_entry;
// Look for dropped refs
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR) {
if (the_entry.SetTo(&the_ref) == B_NO_ERROR && (dir_ctrl&& the_entry.IsDirectory() || !dir_ctrl && the_entry.IsFile())) {
BPath the_path;
the_entry.GetPath(&the_path);
SetText(the_path.Path());
}
} else
BTextControl::MessageReceived(msg);
MakeFocus();
} else
BTextControl::MessageReceived(msg);
}
private:
bool dir_ctrl;
};
// Preferences window class
class PrefsWindow : public BWindow {
public:
PrefsWindow(uint32 msg);
virtual ~PrefsWindow();
virtual void MessageReceived(BMessage *msg);
private:
BView *create_volumes_pane(void);
BView *create_graphics_pane(void);
BView *create_serial_pane(void);
BView *create_memory_pane(void);
uint32 ok_message;
bool send_quit_on_close;
BMessenger this_messenger;
BView *top;
BRect top_frame;
BTabView *pane_tabs;
BView *panes[NUM_PANES];
int current_pane;
VolumeListView *volume_list;
BCheckBox *nocdrom_checkbox;
BCheckBox *gfxaccel_checkbox;
BCheckBox *nosound_checkbox;
BCheckBox *nonet_checkbox;
BCheckBox *ignoresegv_checkbox;
BCheckBox *idlewait_checkbox;
RAMSlider *ramsize_slider;
PathControl *extfs_control;
PathControl *rom_control;
BFilePanel *add_volume_panel;
BFilePanel *create_volume_panel;
uint32 max_ramsize; // In MB
};
/*
* Show preferences editor
* When the user clicks on "OK", the message given as parameter is sent
* to the application; if he clicks on "Quit", B_QUIT_REQUESTED is sent
*/
void PrefsEditor(uint32 msg)
{
new PrefsWindow(msg);
}
/*
* Preferences window constructor
*/
PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 289), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this)
{
int i;
ok_message = msg;
send_quit_on_close = true;
// Move window to right position
Lock();
MoveTo(80, 80);
// Set up menus
BMenuBar *bar = new BMenuBar(Bounds(), "menu");
BMenu *menu = new BMenu(GetString(STR_PREFS_MENU));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ABOUT), new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_START), new BMessage(MSG_OK)));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ZAP_PRAM), new BMessage(MSG_ZAP_PRAM)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_QUIT), new BMessage(MSG_CANCEL), 'Q'));
bar->AddItem(menu);
AddChild(bar);
SetKeyMenuBar(bar);
int mbar_height = bar->Bounds().bottom + 1;
// Resize window to fit menu bar
ResizeBy(0, mbar_height);
// Light gray background
BRect b = Bounds();
top = new BView(BRect(0, mbar_height, b.right, b.bottom), "top", B_FOLLOW_NONE, B_WILL_DRAW);
AddChild(top);
top->SetViewColor(fill_color);
top_frame = top->Bounds();
// Create panes
panes[0] = create_volumes_pane();
panes[1] = create_graphics_pane();
panes[2] = create_serial_pane();
panes[3] = create_memory_pane();
// Prefs item tab view
pane_tabs = new BTabView(BRect(10, 10, top_frame.right-10, top_frame.bottom-50), "items", B_WIDTH_FROM_LABEL);
for (i=0; i<NUM_PANES; i++)
pane_tabs->AddTab(panes[i]);
top->AddChild(pane_tabs);
volume_list->Select(0);
// Create volume file panels
add_volume_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_ADD_VOLUME_PANEL));
add_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_ADD_VOLUME_PANEL_BUTTON));
add_volume_panel->Window()->SetTitle(GetString(STR_ADD_VOLUME_TITLE));
create_volume_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_CREATE_VOLUME_PANEL));
create_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_CREATE_VOLUME_PANEL_BUTTON));
create_volume_panel->Window()->SetTitle(GetString(STR_CREATE_VOLUME_TITLE));
create_volume_panel->Window()->Lock();
BView *background = create_volume_panel->Window()->ChildAt(0);
background->FindView("PoseView")->ResizeBy(0, -30);
background->FindView("VScrollBar")->ResizeBy(0, -30);
background->FindView("CountVw")->MoveBy(0, -30);
BView *v = background->FindView("HScrollBar");
if (v)
v->MoveBy(0, -30);
else {
i = 0;
while ((v = background->ChildAt(i++)) != NULL) {
if (v->Name() == NULL || v->Name()[0] == 0) {
v->MoveBy(0, -30); // unnamed horizontal scroll bar
break;
}
}
}
BView *filename = background->FindView("text view");
BRect fnr(filename->Frame());
fnr.OffsetBy(0, -30);
NumberControl *nc = new NumberControl(fnr, 80, "hardfile_size", GetString(STR_HARDFILE_SIZE_CTRL), 40, NULL);
background->AddChild(nc);
create_volume_panel->Window()->Unlock();
// "Start" button
BButton *button = new BButton(BRect(20, top_frame.bottom-35, 90, top_frame.bottom-10), "start", GetString(STR_START_BUTTON), new BMessage(MSG_OK));
top->AddChild(button);
SetDefaultButton(button);
// "Quit" button
top->AddChild(new BButton(BRect(top_frame.right-90, top_frame.bottom-35, top_frame.right-20, top_frame.bottom-10), "cancel", GetString(STR_QUIT_BUTTON), new BMessage(MSG_CANCEL)));
Unlock();
Show();
}
/*
* Preferences window destructor
*/
PrefsWindow::~PrefsWindow()
{
delete add_volume_panel;
if (send_quit_on_close)
be_app->PostMessage(B_QUIT_REQUESTED);
}
/*
* Create "Volumes" pane
*/
BView *PrefsWindow::create_volumes_pane(void)
{
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_VOLUMES_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
pane->SetViewColor(fill_color);
float right = pane->Bounds().right-10;
const char *str;
int32 index = 0;
volume_list = new VolumeListView(BRect(15, 10, pane->Bounds().right-30, 108), "volumes");
while ((str = PrefsFindString("disk", index++)) != NULL)
volume_list->AddItem(new BStringItem(str));
volume_list->SetSelectionMessage(new BMessage(MSG_VOLUME_SELECTED));
volume_list->SetInvocationMessage(new BMessage(MSG_VOLUME_INVOKED));
pane->AddChild(new BScrollView("volumes_border", volume_list, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));
pane->AddChild(new BButton(BRect(10, 113, pane->Bounds().right/3, 133), "add_volume", GetString(STR_ADD_VOLUME_BUTTON), new BMessage(MSG_ADD_VOLUME)));
pane->AddChild(new BButton(BRect(pane->Bounds().right/3, 113, pane->Bounds().right*2/3, 133), "create_volume", GetString(STR_CREATE_VOLUME_BUTTON), new BMessage(MSG_CREATE_VOLUME)));
pane->AddChild(new BButton(BRect(pane->Bounds().right*2/3, 113, pane->Bounds().right-11, 133), "remove_volume", GetString(STR_REMOVE_VOLUME_BUTTON), new BMessage(MSG_REMOVE_VOLUME)));
extfs_control = new PathControl(true, BRect(10, 145, right, 160), "extfs", GetString(STR_EXTFS_CTRL), PrefsFindString("extfs"), NULL);
extfs_control->SetDivider(90);
pane->AddChild(extfs_control);
BMenuField *menu_field;
BPopUpMenu *menu = new BPopUpMenu("");
menu_field = new BMenuField(BRect(10, 165, right, 180), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu);
menu_field->SetDivider(90);
menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY)));
menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM)));
pane->AddChild(menu_field);
int16 i16 = PrefsFindInt32("bootdriver");
BMenuItem *item;
if (i16 == 0) {
if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL)
item->SetMarked(true);
} else if (i16 == CDROMRefNum) {
if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL)
item->SetMarked(true);
}
nocdrom_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM));
pane->AddChild(nocdrom_checkbox);
nocdrom_checkbox->SetValue(PrefsFindBool("nocdrom") ? B_CONTROL_ON : B_CONTROL_OFF);
return pane;
}
/*
* Create "Graphics/Sound" pane
*/
struct video_mode_box {
uint32 mode;
int mode_string_id, bit_string_id;
float left, top;
BCheckBox *box;
};
const int NUM_WINDOW_MODES = 6;
const int NUM_SCREEN_MODES = 18;
static video_mode_box window_mode_boxes[NUM_SCREEN_MODES] = {
{B_8_BIT_640x480, STR_W_640x480_CTRL, STR_8_BIT_CTRL, 140, 48, NULL},
{B_15_BIT_640x480, STR_W_640x480_CTRL, STR_16_BIT_CTRL, 220, 48, NULL},
{B_32_BIT_640x480, STR_W_640x480_CTRL, STR_32_BIT_CTRL, 300, 48, NULL},
{B_8_BIT_800x600, STR_W_800x600_CTRL, STR_8_BIT_CTRL, 140, 65, NULL},
{B_15_BIT_800x600, STR_W_800x600_CTRL, STR_16_BIT_CTRL, 220, 65, NULL},
{B_32_BIT_800x600, STR_W_800x600_CTRL, STR_32_BIT_CTRL, 300, 65, NULL},
};
static video_mode_box screen_mode_boxes[NUM_SCREEN_MODES] = {
{B_8_BIT_640x480, STR_640x480_CTRL, STR_8_BIT_CTRL, 140, 82, NULL},
{B_15_BIT_640x480, STR_640x480_CTRL, STR_16_BIT_CTRL, 220, 82, NULL},
{B_32_BIT_640x480, STR_640x480_CTRL, STR_32_BIT_CTRL, 300, 82, NULL},
{B_8_BIT_800x600, STR_800x600_CTRL, STR_8_BIT_CTRL, 140, 99, NULL},
{B_15_BIT_800x600, STR_800x600_CTRL, STR_16_BIT_CTRL, 220, 99, NULL},
{B_32_BIT_800x600, STR_800x600_CTRL, STR_32_BIT_CTRL, 300, 99, NULL},
{B_8_BIT_1024x768, STR_1024x768_CTRL, STR_8_BIT_CTRL, 140, 116, NULL},
{B_15_BIT_1024x768, STR_1024x768_CTRL, STR_16_BIT_CTRL, 220, 116, NULL},
{B_32_BIT_1024x768, STR_1024x768_CTRL, STR_32_BIT_CTRL, 300, 116, NULL},
{B_8_BIT_1152x900, STR_1152x900_CTRL, STR_8_BIT_CTRL, 140, 133, NULL},
{B_15_BIT_1152x900, STR_1152x900_CTRL, STR_16_BIT_CTRL, 220, 133, NULL},
{B_32_BIT_1152x900, STR_1152x900_CTRL, STR_32_BIT_CTRL, 300, 133, NULL},
{B_8_BIT_1280x1024, STR_1280x1024_CTRL, STR_8_BIT_CTRL, 140, 150, NULL},
{B_15_BIT_1280x1024, STR_1280x1024_CTRL, STR_16_BIT_CTRL, 220, 150, NULL},
{B_32_BIT_1280x1024, STR_1280x1024_CTRL, STR_32_BIT_CTRL, 300, 150, NULL},
{B_8_BIT_1600x1200, STR_1600x1200_CTRL, STR_8_BIT_CTRL, 140, 167, NULL},
{B_15_BIT_1600x1200, STR_1600x1200_CTRL, STR_16_BIT_CTRL, 220, 167, NULL},
{B_32_BIT_1600x1200, STR_1600x1200_CTRL, STR_32_BIT_CTRL, 300, 167, NULL}
};
BView *PrefsWindow::create_graphics_pane(void)
{
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_GRAPHICS_SOUND_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
pane->SetViewColor(fill_color);
float right = pane->Bounds().right-10;
BMenuField *menu_field;
BPopUpMenu *menu = new BPopUpMenu("");
menu_field = new BMenuField(BRect(10, 5, right, 20), "frameskip", GetString(STR_FRAMESKIP_CTRL), menu);
menu_field->SetDivider(120);
menu->AddItem(new BMenuItem(GetString(STR_REF_5HZ_LAB), new BMessage(MSG_REF_5HZ)));
menu->AddItem(new BMenuItem(GetString(STR_REF_7_5HZ_LAB), new BMessage(MSG_REF_7_5HZ)));
menu->AddItem(new BMenuItem(GetString(STR_REF_10HZ_LAB), new BMessage(MSG_REF_10HZ)));
menu->AddItem(new BMenuItem(GetString(STR_REF_15HZ_LAB), new BMessage(MSG_REF_15HZ)));
menu->AddItem(new BMenuItem(GetString(STR_REF_30HZ_LAB), new BMessage(MSG_REF_30HZ)));
pane->AddChild(menu_field);
int32 i32 = PrefsFindInt32("frameskip");
BMenuItem *item;
if (i32 == 12) {
if ((item = menu->FindItem(GetString(STR_REF_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (i32 == 8) {
if ((item = menu->FindItem(GetString(STR_REF_7_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (i32 == 6) {
if ((item = menu->FindItem(GetString(STR_REF_10HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (i32 == 4) {
if ((item = menu->FindItem(GetString(STR_REF_15HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (i32 == 2) {
if ((item = menu->FindItem(GetString(STR_REF_30HZ_LAB))) != NULL)
item->SetMarked(true);
}
gfxaccel_checkbox = new BCheckBox(BRect(10, 25, right, 40), "gfxaccel", GetString(STR_GFXACCEL_CTRL), new BMessage(MSG_GFXACCEL));
pane->AddChild(gfxaccel_checkbox);
gfxaccel_checkbox->SetValue(PrefsFindBool("gfxaccel") ? B_CONTROL_ON : B_CONTROL_OFF);
uint32 window_modes = PrefsFindInt32("windowmodes");
for (int i=0; i<NUM_WINDOW_MODES; i++) {
video_mode_box *p = window_mode_boxes + i;
if (p->bit_string_id == STR_8_BIT_CTRL) {
BStringView *text = new BStringView(BRect(10, p->top, 120, p->top + 15), "", GetString(p->mode_string_id));
pane->AddChild(text);
}
p->box = new BCheckBox(BRect(p->left, p->top, p->left + 80, p->top + 15), "", GetString(p->bit_string_id), new BMessage(MSG_WINDOW_MODE));
pane->AddChild(p->box);
p->box->SetValue(window_modes & p->mode ? B_CONTROL_ON : B_CONTROL_OFF);
}
uint32 screen_modes = PrefsFindInt32("screenmodes");
for (int i=0; i<NUM_SCREEN_MODES; i++) {
video_mode_box *p = screen_mode_boxes + i;
if (p->bit_string_id == STR_8_BIT_CTRL) {
BStringView *text = new BStringView(BRect(10, p->top, 120, p->top + 15), "", GetString(p->mode_string_id));
pane->AddChild(text);
}
p->box = new BCheckBox(BRect(p->left, p->top, p->left + 80, p->top + 15), "", GetString(p->bit_string_id), new BMessage(MSG_SCREEN_MODE));
pane->AddChild(p->box);
p->box->SetValue(screen_modes & p->mode ? B_CONTROL_ON : B_CONTROL_OFF);
}
nosound_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nosound", GetString(STR_NOSOUND_CTRL), new BMessage(MSG_NOSOUND));
pane->AddChild(nosound_checkbox);
nosound_checkbox->SetValue(PrefsFindBool("nosound") ? B_CONTROL_ON : B_CONTROL_OFF);
return pane;
}
/*
* Create "Serial/Network" pane
*/
static void add_serial_names(BPopUpMenu *menu, uint32 msg)
{
BSerialPort *port = new BSerialPort;
char name[B_PATH_NAME_LENGTH];
for (int i=0; i<port->CountDevices(); i++) {
port->GetDeviceName(i, name);
menu->AddItem(new BMenuItem(name, new BMessage(msg)));
}
if (SysInfo.platform_type == B_BEBOX_PLATFORM) {
BDirectory dir;
BEntry entry;
dir.SetTo("/dev/parallel");
if (dir.InitCheck() == B_NO_ERROR) {
dir.Rewind();
while (dir.GetNextEntry(&entry) >= 0) {
if (!entry.IsDirectory()) {
entry.GetName(name);
menu->AddItem(new BMenuItem(name, new BMessage(msg)));
}
}
}
}
delete port;
}
static void set_serial_label(BPopUpMenu *menu, const char *prefs_name)
{
const char *str;
BMenuItem *item;
if ((str = PrefsFindString(prefs_name)) != NULL)
if ((item = menu->FindItem(str)) != NULL)
item->SetMarked(true);
}
BView *PrefsWindow::create_serial_pane(void)
{
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_SERIAL_NETWORK_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
pane->SetViewColor(fill_color);
float right = pane->Bounds().right-10;
BMenuField *menu_field;
BPopUpMenu *menu_a = new BPopUpMenu("");
add_serial_names(menu_a, MSG_SER_A);
menu_field = new BMenuField(BRect(10, 5, right, 20), "seriala", GetString(STR_SERPORTA_CTRL), menu_a);
menu_field->SetDivider(90);
pane->AddChild(menu_field);
set_serial_label(menu_a, "seriala");
BPopUpMenu *menu_b = new BPopUpMenu("");
add_serial_names(menu_b, MSG_SER_B);
menu_field = new BMenuField(BRect(10, 26, right, 41), "serialb", GetString(STR_SERPORTB_CTRL), menu_b);
menu_field->SetDivider(90);
pane->AddChild(menu_field);
set_serial_label(menu_b, "serialb");
nonet_checkbox = new BCheckBox(BRect(10, 47, right, 62), "nonet", GetString(STR_NONET_CTRL), new BMessage(MSG_NONET));
pane->AddChild(nonet_checkbox);
nonet_checkbox->SetValue(PrefsFindBool("nonet") ? B_CONTROL_ON : B_CONTROL_OFF);
return pane;
}
/*
* Create "Memory/Misc" pane
*/
BView *PrefsWindow::create_memory_pane(void)
{
char str[256], str2[256];
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_MEMORY_MISC_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
pane->SetViewColor(fill_color);
float right = pane->Bounds().right-10;
BEntry entry("/boot/var/swap");
off_t swap_space;
if (entry.GetSize(&swap_space) == B_NO_ERROR)
max_ramsize = swap_space / (1024 * 1024) - 8;
else
max_ramsize = SysInfo.max_pages * B_PAGE_SIZE / (1024 * 1024) - 8;
int32 value = PrefsFindInt32("ramsize") / (1024 * 1024);
ramsize_slider = new RAMSlider(BRect(10, 5, right, 55), "ramsize", GetString(STR_RAMSIZE_SLIDER), new BMessage(MSG_RAMSIZE), 8, max_ramsize, B_TRIANGLE_THUMB);
ramsize_slider->SetValue(value);
ramsize_slider->UseFillColor(true, &slider_fill_color);
sprintf(str, GetString(STR_RAMSIZE_FMT), 8);
sprintf(str2, GetString(STR_RAMSIZE_FMT), max_ramsize);
ramsize_slider->SetLimitLabels(str, str2);
pane->AddChild(ramsize_slider);
ignoresegv_checkbox = new BCheckBox(BRect(10, 60, right, 75), "ignoresegv", GetString(STR_IGNORESEGV_CTRL), new BMessage(MSG_IGNORESEGV));
pane->AddChild(ignoresegv_checkbox);
ignoresegv_checkbox->SetValue(PrefsFindBool("ignoresegv") ? B_CONTROL_ON : B_CONTROL_OFF);
idlewait_checkbox = new BCheckBox(BRect(10, 80, right, 95), "idlewait", GetString(STR_IDLEWAIT_CTRL), new BMessage(MSG_IDLEWAIT));
pane->AddChild(idlewait_checkbox);
idlewait_checkbox->SetValue(PrefsFindBool("idlewait") ? B_CONTROL_ON : B_CONTROL_OFF);
rom_control = new PathControl(false, BRect(10, 100, right, 115), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL);
rom_control->SetDivider(117);
pane->AddChild(rom_control);
return pane;
}
/*
* Message from controls/menus received
*/
void PrefsWindow::MessageReceived(BMessage *msg)
{
switch (msg->what) {
case MSG_OK: // "Start" button clicked
PrefsReplaceString("extfs", extfs_control->Text());
const char *str = rom_control->Text();
if (strlen(str))
PrefsReplaceString("rom", str);
else
PrefsRemoveItem("rom");
SavePrefs();
send_quit_on_close = false;
PostMessage(B_QUIT_REQUESTED);
be_app->PostMessage(ok_message);
break;
case MSG_CANCEL: // "Quit" button clicked
send_quit_on_close = false;
PostMessage(B_QUIT_REQUESTED);
be_app->PostMessage(B_QUIT_REQUESTED);
break;
case B_ABOUT_REQUESTED: // "About" menu item selected
OpenAboutWindow();
break;
case MSG_ZAP_PRAM: // "Zap PRAM File" menu item selected
ZapPRAM();
break;
case MSG_VOLUME_INVOKED: { // Double-clicked on volume name, toggle read-only flag
int selected = volume_list->CurrentSelection();
if (selected >= 0) {
const char *str = PrefsFindString("disk", selected);
BStringItem *item = (BStringItem *)volume_list->RemoveItem(selected);
delete item;
char newstr[256];
if (str[0] == '*')
strcpy(newstr, str+1);
else {
strcpy(newstr, "*");
strcat(newstr, str);
}
PrefsReplaceString("disk", newstr, selected);
volume_list->AddItem(new BStringItem(newstr), selected);
volume_list->Select(selected);
}
break;
}
case MSG_ADD_VOLUME:
add_volume_panel->Show();
break;
case MSG_CREATE_VOLUME:
create_volume_panel->Show();
break;
case MSG_ADD_VOLUME_PANEL: {
entry_ref ref;
if (msg->FindRef("refs", &ref) == B_NO_ERROR) {
BEntry entry(&ref, true);
BPath path;
entry.GetPath(&path);
if (entry.IsFile()) {
PrefsAddString("disk", path.Path());
volume_list->AddItem(new BStringItem(path.Path()));
} else if (entry.IsDirectory()) {
BVolume volume;
if (path.Path()[0] == '/' && strchr(path.Path()+1, '/') == NULL && entry.GetVolume(&volume) == B_NO_ERROR) {
int32 i = 0;
dev_t d;
fs_info info;
while ((d = next_dev(&i)) >= 0) {
fs_stat_dev(d, &info);
if (volume.Device() == info.dev) {
PrefsAddString("disk", info.device_name);
volume_list->AddItem(new BStringItem(info.device_name));
}
}
}
}
}
break;
}
case MSG_CREATE_VOLUME_PANEL: {
entry_ref dir;
if (msg->FindRef("directory", &dir) == B_NO_ERROR) {
BEntry entry(&dir, true);
BPath path;
entry.GetPath(&path);
path.Append(msg->FindString("name"));
create_volume_panel->Window()->Lock();
BView *background = create_volume_panel->Window()->ChildAt(0);
NumberControl *v = (NumberControl *)background->FindView("hardfile_size");
int size = v->Value();
char cmd[1024];
sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", path.Path(), size);
int ret = system(cmd);
if (ret == 0) {
PrefsAddString("disk", path.Path());
volume_list->AddItem(new BStringItem(path.Path()));
} else {
sprintf(cmd, GetString(STR_CREATE_VOLUME_WARN), strerror(ret));
WarningAlert(cmd);
}
}
break;
}
case MSG_REMOVE_VOLUME: {
int selected = volume_list->CurrentSelection();
if (selected >= 0) {
PrefsRemoveItem("disk", selected);
BStringItem *item = (BStringItem *)volume_list->RemoveItem(selected);
delete item;
volume_list->Select(selected);
}
break;
}
case MSG_BOOT_ANY:
PrefsReplaceInt32("bootdriver", 0);
break;
case MSG_BOOT_CDROM:
PrefsReplaceInt32("bootdriver", CDROMRefNum);
break;
case MSG_NOCDROM:
PrefsReplaceBool("nocdrom", nocdrom_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_GFXACCEL:
PrefsReplaceBool("gfxaccel", gfxaccel_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_NOSOUND:
PrefsReplaceBool("nosound", nosound_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_WINDOW_MODE: {
BCheckBox *source = NULL;
msg->FindPointer("source", &source);
if (source == NULL)
break;
for (int i=0; i<NUM_WINDOW_MODES; i++) {
video_mode_box *p = window_mode_boxes + i;
if (p->box == source) {
if (p->box->Value() == B_CONTROL_ON)
PrefsReplaceInt32("windowmodes", PrefsFindInt32("windowmodes") | p->mode);
else
PrefsReplaceInt32("windowmodes", PrefsFindInt32("windowmodes") & ~(p->mode));
break;
}
}
break;
}
case MSG_SCREEN_MODE: {
BCheckBox *source = NULL;
msg->FindPointer("source", &source);
if (source == NULL)
break;
for (int i=0; i<NUM_SCREEN_MODES; i++) {
video_mode_box *p = screen_mode_boxes + i;
if (p->box == source) {
if (p->box->Value() == B_CONTROL_ON)
PrefsReplaceInt32("screenmodes", PrefsFindInt32("screenmodes") | p->mode);
else
PrefsReplaceInt32("screenmodes", PrefsFindInt32("screenmodes") & ~(p->mode));
break;
}
}
break;
}
case MSG_REF_5HZ:
PrefsReplaceInt32("frameskip", 12);
break;
case MSG_REF_7_5HZ:
PrefsReplaceInt32("frameskip", 8);
break;
case MSG_REF_10HZ:
PrefsReplaceInt32("frameskip", 6);
break;
case MSG_REF_15HZ:
PrefsReplaceInt32("frameskip", 4);
break;
case MSG_REF_30HZ:
PrefsReplaceInt32("frameskip", 2);
break;
case MSG_SER_A: {
BMenuItem *source = NULL;
msg->FindPointer("source", &source);
if (source)
PrefsReplaceString("seriala", source->Label());
break;
}
case MSG_SER_B: {
BMenuItem *source = NULL;
msg->FindPointer("source", &source);
if (source)
PrefsReplaceString("serialb", source->Label());
break;
}
case MSG_NONET:
PrefsReplaceBool("nonet", nonet_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_IGNORESEGV:
PrefsReplaceBool("ignoresegv", ignoresegv_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_IDLEWAIT:
PrefsReplaceBool("idlewait", idlewait_checkbox->Value() == B_CONTROL_ON);
break;
case MSG_RAMSIZE:
PrefsReplaceInt32("ramsize", ramsize_slider->Value() * 1024 * 1024);
break;
default:
BWindow::MessageReceived(msg);
}
}

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/scsi_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/serial_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/sys_beos.cpp

View File

@ -1,74 +0,0 @@
/*
* sysdeps.h - System dependent definitions for BeOS
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SYSDEPS_H
#define SYSDEPS_H
// Do we have std namespace?
#ifdef __POWERPC__
#define NO_STD_NAMESPACE
#endif
#include <assert.h>
#include <sys/types.h>
#include <KernelKit.h>
#include "user_strings_beos.h"
// Are we using a PPC emulator or the real thing?
#ifdef __POWERPC__
#define EMULATED_PPC 0
#define WORDS_BIGENDIAN 1
#define SYSTEM_CLOBBERS_R2 1
#else
#define EMULATED_PPC 1
#undef WORDS_BIGENDIAN
#endif
// High precision timing
#define PRECISE_TIMING 1
#define PRECISE_TIMING_BEOS 1
#define POWERPC_ROM 1
// Time data type for Time Manager emulation
typedef bigtime_t tm_time_t;
// 64 bit file offsets
typedef off_t loff_t;
// Data types
typedef uint32 uintptr;
typedef int32 intptr;
// Timing functions
extern void Delay_usec(uint32 usec);
// Macro for calling MacOS routines
#define CallMacOS(type, proc) (*(type)proc)()
#define CallMacOS1(type, proc, arg1) (*(type)proc)(arg1)
#define CallMacOS2(type, proc, arg1, arg2) (*(type)proc)(arg1, arg2)
#define CallMacOS3(type, proc, arg1, arg2, arg3) (*(type)proc)(arg1, arg2, arg3)
#define CallMacOS4(type, proc, arg1, arg2, arg3, arg4) (*(type)proc)(arg1, arg2, arg3, arg4)
#define CallMacOS5(type, proc, arg1, arg2, arg3, arg4, arg5) (*(type)proc)(arg1, arg2, arg3, arg4, arg5)
#define CallMacOS6(type, proc, arg1, arg2, arg3, arg4, arg5, arg6) (*(type)proc)(arg1, arg2, arg3, arg4, arg5, arg6)
#define CallMacOS7(type, proc, arg1, arg2, arg3, arg4, arg5, arg6, arg7) (*(type)proc)(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#endif

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/timer_beos.cpp

View File

@ -1,73 +0,0 @@
/*
* user_strings_beos.cpp - Localizable strings, BeOS specific strings
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "user_strings.h"
// Platform-specific string definitions
user_string_def platform_strings[] = {
// Common strings that have a platform-specific variant
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under BeOS. Basilisk II will try to unmount it."},
{STR_EXTFS_CTRL, "BeOS Root"},
{STR_EXTFS_NAME, "BeOS Directory Tree"},
{STR_EXTFS_VOLUME_NAME, "BeOS"},
// Purely platform-specific strings
{STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). SheepShaver is not properly installed."},
{STR_NO_RAM_AREA_ERR, "Not enough memory to create RAM area: %s (%08x)."},
{STR_NO_ROM_AREA_ERR, "Not enough memory to create ROM area."},
{STR_NO_SHEEP_MEM_AREA_ERR, "Not enough memory to create SheepShaver area."},
{STR_SHEEP_UP_ERR, "Cannot allocate Low Memory Globals: %s (%08x)."},
{STR_NO_NET_ADDON_WARN, "The SheepShaver net server add-on cannot be found. Ethernet will not be available."},
{STR_NET_CONFIG_MODIFY_WARN, "To enable Ethernet networking for SheepShaver, 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 SheepShaver)?."},
{STR_NET_ADDON_INIT_FAILED, "SheepShaver net server add-on found\nbut there seems to be no network hardware.\nPlease check your network preferences."},
{STR_NET_ADDON_CLONE_FAILED, "Cloning of the network transfer area failed."},
{STR_NO_SHEEP_MEM_AREA_ERR, "Cannot create SheepShaver Globals area: %s (%08x)."},
{STR_NO_DR_CACHE_AREA_ERR, "Cannot create DR Cache area: %s (%08x)."},
{STR_NO_DR_EMULATOR_AREA_ERR, "Cannot create DR Emulator area: %s (%08x)."},
{-1, NULL} // End marker
};
/*
* Fetch pointer to string, given the string number
*/
const char *GetString(int num)
{
// First search for platform-specific string
int i = 0;
while (platform_strings[i].num >= 0) {
if (platform_strings[i].num == num)
return platform_strings[i].str;
i++;
}
// Not found, search for common string
i = 0;
while (common_strings[i].num >= 0) {
if (common_strings[i].num == num)
return common_strings[i].str;
i++;
}
return NULL;
}

View File

@ -1,37 +0,0 @@
/*
* user_strings_beos.h - BeOS-specific localizable strings
*
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef USER_STRINGS_BEOS_H
#define USER_STRINGS_BEOS_H
enum {
STR_NO_SHEEP_DRIVER_ERR = 10000,
STR_NO_ROM_AREA_ERR,
STR_SHEEP_UP_ERR,
STR_NO_NET_ADDON_WARN,
STR_NET_CONFIG_MODIFY_WARN,
STR_NET_ADDON_INIT_FAILED,
STR_NET_ADDON_CLONE_FAILED,
STR_NO_SHEEP_MEM_AREA_ERR,
STR_NO_DR_CACHE_AREA_ERR,
STR_NO_DR_EMULATOR_AREA_ERR
};
#endif

View File

@ -1,787 +0,0 @@
/*
* video_beos.cpp - Video/graphics emulation, BeOS specific things
*
* SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include "video.h"
#include "video_defs.h"
#include "main.h"
#include "adb.h"
#include "prefs.h"
#include "user_strings.h"
#include "about_window.h"
#include "version.h"
#define DEBUG 0
#include "debug.h"
// Global variables
static sem_id video_lock = -1; // Protection during mode changes
static sem_id mac_os_lock = -1; // This is used to stop the MacOS thread when the SheepShaver workspace is switched out
// Prototypes
static filter_result filter_func(BMessage *msg, BHandler **target, BMessageFilter *filter);
// From sys_beos.cpp
extern void SysCreateVolumeMenu(BMenu *menu, uint32 msg);
extern void SysMountVolume(const char *name);
#include "video_window.h"
#include "video_screen.h"
/*
* Display manager thread (for opening and closing windows and screens;
* this is not safe under R4 when running on the MacOS stack in kernel
* space)
*/
// Message constants
const uint32 MSG_OPEN_WINDOW = 'owin';
const uint32 MSG_CLOSE_WINDOW = 'cwin';
const uint32 MSG_OPEN_SCREEN = 'oscr';
const uint32 MSG_CLOSE_SCREEN = 'cscr';
const uint32 MSG_QUIT_DISPLAY_MANAGER = 'quit';
static thread_id dm_thread = -1;
static sem_id dm_done_sem = -1;
static status_t display_manager(void *arg)
{
for (;;) {
// Receive message
thread_id sender;
uint32 code = receive_data(&sender, NULL, 0);
D(bug("Display manager received %08lx\n", code));
switch (code) {
case MSG_QUIT_DISPLAY_MANAGER:
return 0;
case MSG_OPEN_WINDOW:
D(bug("Opening window\n"));
the_window = new MacWindow(BRect(0, 0, VModes[cur_mode].viXsize-1, VModes[cur_mode].viYsize-1));
D(bug("Opened\n"));
break;
case MSG_CLOSE_WINDOW:
if (the_window != NULL) {
D(bug("Posting quit to window\n"));
the_window->PostMessage(B_QUIT_REQUESTED);
D(bug("Posted, waiting\n"));
while (the_window)
snooze(200000);
D(bug("Window closed\n"));
}
break;
case MSG_OPEN_SCREEN: {
D(bug("Opening screen\n"));
long scr_mode = 0;
switch (VModes[cur_mode].viAppleMode) {
case APPLE_8_BIT:
switch (VModes[cur_mode].viAppleID) {
case APPLE_640x480:
scr_mode = B_8_BIT_640x480;
break;
case APPLE_800x600:
scr_mode = B_8_BIT_800x600;
break;
case APPLE_1024x768:
scr_mode = B_8_BIT_1024x768;
break;
case APPLE_1152x900:
scr_mode = B_8_BIT_1152x900;
break;
case APPLE_1280x1024:
scr_mode = B_8_BIT_1280x1024;
break;
case APPLE_1600x1200:
scr_mode = B_8_BIT_1600x1200;
break;
}
break;
case APPLE_16_BIT:
switch (VModes[cur_mode].viAppleID) {
case APPLE_640x480:
scr_mode = B_15_BIT_640x480;
break;
case APPLE_800x600:
scr_mode = B_15_BIT_800x600;
break;
case APPLE_1024x768:
scr_mode = B_15_BIT_1024x768;
break;
case APPLE_1152x900:
scr_mode = B_15_BIT_1152x900;
break;
case APPLE_1280x1024:
scr_mode = B_15_BIT_1280x1024;
break;
case APPLE_1600x1200:
scr_mode = B_15_BIT_1600x1200;
break;
}
break;
case APPLE_32_BIT:
switch (VModes[cur_mode].viAppleID) {
case APPLE_640x480:
scr_mode = B_32_BIT_640x480;
break;
case APPLE_800x600:
scr_mode = B_32_BIT_800x600;
break;
case APPLE_1024x768:
scr_mode = B_32_BIT_1024x768;
break;
case APPLE_1152x900:
scr_mode = B_32_BIT_1152x900;
break;
case APPLE_1280x1024:
scr_mode = B_32_BIT_1280x1024;
break;
case APPLE_1600x1200:
scr_mode = B_32_BIT_1600x1200;
break;
}
break;
}
the_screen = new MacScreen(GetString(STR_WINDOW_TITLE), scr_mode);
D(bug("Opened, error %08lx\n", screen_error));
if (screen_error != B_NO_ERROR) {
D(bug("Error, posting quit to screen\n"));
the_screen->PostMessage(B_QUIT_REQUESTED);
D(bug("Posted, waiting\n"));
while (the_screen)
snooze(200000);
D(bug("Screen closed\n"));
break;
}
// Wait for video mem access
D(bug("Showing screen\n"));
the_screen->Show();
D(bug("Shown, waiting for frame buffer access\n"));
while (!drawing_enable)
snooze(200000);
D(bug("Access granted\n"));
break;
}
case MSG_CLOSE_SCREEN:
if (the_screen != NULL) {
D(bug("Posting quit to screen\n"));
the_screen->PostMessage(B_QUIT_REQUESTED);
D(bug("Posted, waiting\n"));
while (the_screen)
snooze(200000);
D(bug("Screen closed\n"));
}
break;
}
// Acknowledge
release_sem(dm_done_sem);
}
}
/*
* Open display (window or screen)
*/
static void open_display(void)
{
D(bug("entering open_display()\n"));
display_type = VModes[cur_mode].viType;
if (display_type == DIS_SCREEN) {
while (send_data(dm_thread, MSG_OPEN_SCREEN, NULL, 0) == B_INTERRUPTED) ;
while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ;
} else if (display_type == DIS_WINDOW) {
while (send_data(dm_thread, MSG_OPEN_WINDOW, NULL, 0) == B_INTERRUPTED) ;
while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ;
}
D(bug("exiting open_display()\n"));
}
/*
* Close display
*/
static void close_display(void)
{
D(bug("entering close_display()\n"));
if (display_type == DIS_SCREEN) {
while (send_data(dm_thread, MSG_CLOSE_SCREEN, NULL, 0) == B_INTERRUPTED) ;
while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ;
} else if (display_type == DIS_WINDOW) {
while (send_data(dm_thread, MSG_CLOSE_WINDOW, NULL, 0) == B_INTERRUPTED) ;
while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ;
}
D(bug("exiting close_display()\n"));
}
/*
* Initialization
*/
static void add_mode(VideoInfo *&p, uint32 allow, uint32 test, long apple_mode, long apple_id, int type)
{
if (allow & test) {
p->viType = type;
switch (apple_id) {
case APPLE_W_640x480:
case APPLE_640x480:
p->viXsize = 640;
p->viYsize = 480;
break;
case APPLE_W_800x600:
case APPLE_800x600:
p->viXsize = 800;
p->viYsize = 600;
break;
case APPLE_1024x768:
p->viXsize = 1024;
p->viYsize = 768;
break;
case APPLE_1152x900:
p->viXsize = 1152;
p->viYsize = 900;
break;
case APPLE_1280x1024:
p->viXsize = 1280;
p->viYsize = 1024;
break;
case APPLE_1600x1200:
p->viXsize = 1600;
p->viYsize = 1200;
break;
}
switch (apple_mode) {
case APPLE_8_BIT:
p->viRowBytes = p->viXsize;
break;
case APPLE_16_BIT:
p->viRowBytes = p->viXsize * 2;
break;
case APPLE_32_BIT:
p->viRowBytes = p->viXsize * 4;
break;
}
p->viAppleMode = apple_mode;
p->viAppleID = apple_id;
p++;
}
}
bool VideoInit(void)
{
// Init variables, create semaphores
private_data = NULL;
cur_mode = 0; // Window 640x480
video_lock = create_sem(1, "Video Lock");
mac_os_lock = create_sem(0, "MacOS Frame Buffer Lock");
dm_done_sem = create_sem(0, "Display Manager Done");
// Construct video mode table
VideoInfo *p = VModes;
uint32 window_modes = PrefsFindInt32("windowmodes");
uint32 screen_modes = PrefsFindInt32("screenmodes");
if (window_modes == 0 && screen_modes == 0)
window_modes |= B_8_BIT_640x480 | B_8_BIT_800x600; // Allow at least 640x480 and 800x600 window modes
add_mode(p, window_modes, B_8_BIT_640x480, APPLE_8_BIT, APPLE_W_640x480, DIS_WINDOW);
add_mode(p, window_modes, B_8_BIT_800x600, APPLE_8_BIT, APPLE_W_800x600, DIS_WINDOW);
add_mode(p, window_modes, B_15_BIT_640x480, APPLE_16_BIT, APPLE_W_640x480, DIS_WINDOW);
add_mode(p, window_modes, B_15_BIT_800x600, APPLE_16_BIT, APPLE_W_800x600, DIS_WINDOW);
add_mode(p, window_modes, B_32_BIT_640x480, APPLE_32_BIT, APPLE_W_640x480, DIS_WINDOW);
add_mode(p, window_modes, B_32_BIT_800x600, APPLE_32_BIT, APPLE_W_800x600, DIS_WINDOW);
add_mode(p, screen_modes, B_8_BIT_640x480, APPLE_8_BIT, APPLE_640x480, DIS_SCREEN);
add_mode(p, screen_modes, B_8_BIT_800x600, APPLE_8_BIT, APPLE_800x600, DIS_SCREEN);
add_mode(p, screen_modes, B_8_BIT_1024x768, APPLE_8_BIT, APPLE_1024x768, DIS_SCREEN);
add_mode(p, screen_modes, B_8_BIT_1152x900, APPLE_8_BIT, APPLE_1152x900, DIS_SCREEN);
add_mode(p, screen_modes, B_8_BIT_1280x1024, APPLE_8_BIT, APPLE_1280x1024, DIS_SCREEN);
add_mode(p, screen_modes, B_8_BIT_1600x1200, APPLE_8_BIT, APPLE_1600x1200, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_640x480, APPLE_16_BIT, APPLE_640x480, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_800x600, APPLE_16_BIT, APPLE_800x600, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_1024x768, APPLE_16_BIT, APPLE_1024x768, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_1152x900, APPLE_16_BIT, APPLE_1152x900, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_1280x1024, APPLE_16_BIT, APPLE_1280x1024, DIS_SCREEN);
add_mode(p, screen_modes, B_15_BIT_1600x1200, APPLE_16_BIT, APPLE_1600x1200, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_640x480, APPLE_32_BIT, APPLE_640x480, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_800x600, APPLE_32_BIT, APPLE_800x600, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_1024x768, APPLE_32_BIT, APPLE_1024x768, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_1152x900, APPLE_32_BIT, APPLE_1152x900, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_1280x1024, APPLE_32_BIT, APPLE_1280x1024, DIS_SCREEN);
add_mode(p, screen_modes, B_32_BIT_1600x1200, APPLE_32_BIT, APPLE_1600x1200, DIS_SCREEN);
p->viType = DIS_INVALID; // End marker
p->viRowBytes = 0;
p->viXsize = p->viYsize = 0;
p->viAppleMode = 0;
p->viAppleID = 0;
// Start display manager thread
dm_thread = spawn_thread(display_manager, "Display Manager", B_NORMAL_PRIORITY, NULL);
resume_thread(dm_thread);
// Open window/screen
open_display();
if (display_type == DIS_SCREEN && the_screen == NULL) {
char str[256];
sprintf(str, GetString(STR_FULL_SCREEN_ERR), strerror(screen_error), screen_error);
ErrorAlert(str);
return false;
}
return true;
}
/*
* Deinitialization
*/
void VideoExit(void)
{
if (dm_thread >= 0) {
// Close display
acquire_sem(video_lock);
close_display();
if (private_data != NULL) {
delete private_data->gammaTable;
delete private_data;
}
// Stop display manager
status_t l;
send_data(dm_thread, MSG_QUIT_DISPLAY_MANAGER, NULL, 0);
while (wait_for_thread(dm_thread, &l) == B_INTERRUPTED) ;
}
// Delete semaphores
delete_sem(video_lock);
delete_sem(mac_os_lock);
delete_sem(dm_done_sem);
}
/*
* Close screen in full-screen mode
*/
void VideoQuitFullScreen(void)
{
D(bug("VideoQuitFullScreen()\n"));
if (display_type == DIS_SCREEN) {
acquire_sem(video_lock);
close_display();
release_sem(video_lock);
}
}
/*
* Execute video VBL routine
*/
void VideoVBL(void)
{
release_sem(mac_os_lock);
if (private_data != NULL && private_data->interruptsEnabled)
VSLDoInterruptService(private_data->vslServiceID);
while (acquire_sem(mac_os_lock) == B_INTERRUPTED) ;
}
/*
* Filter function for receiving mouse and keyboard events
*/
#define MENU_IS_POWER 0
// Be -> Mac raw keycode translation table
static const uint8 keycode2mac[0x80] = {
0xff, 0x35, 0x7a, 0x78, 0x63, 0x76, 0x60, 0x61, // inv Esc F1 F2 F3 F4 F5 F6
0x62, 0x64, 0x65, 0x6d, 0x67, 0x6f, 0x69, 0x6b, // F7 F8 F9 F10 F11 F12 F13 F14
0x71, 0x0a, 0x12, 0x13, 0x14, 0x15, 0x17, 0x16, // F15 ` 1 2 3 4 5 6
0x1a, 0x1c, 0x19, 0x1d, 0x1b, 0x18, 0x33, 0x72, // 7 8 9 0 - = BSP INS
0x73, 0x74, 0x47, 0x4b, 0x43, 0x4e, 0x30, 0x0c, // HOM PUP NUM / * - TAB Q
0x0d, 0x0e, 0x0f, 0x11, 0x10, 0x20, 0x22, 0x1f, // W E R T Y U I O
0x23, 0x21, 0x1e, 0x2a, 0x75, 0x77, 0x79, 0x59, // P [ ] \ DEL END PDN 7
0x5b, 0x5c, 0x45, 0x39, 0x00, 0x01, 0x02, 0x03, // 8 9 + CAP A S D F
0x05, 0x04, 0x26, 0x28, 0x25, 0x29, 0x27, 0x24, // G H J K L ; ' RET
0x56, 0x57, 0x58, 0x38, 0x06, 0x07, 0x08, 0x09, // 4 5 6 SHL Z X C V
0x0b, 0x2d, 0x2e, 0x2b, 0x2f, 0x2c, 0x38, 0x3e, // B N M , . / SHR CUP
0x53, 0x54, 0x55, 0x4c, 0x36, 0x37, 0x31, 0x37, // 1 2 3 ENT CTL ALT SPC ALT
0x36, 0x3b, 0x3d, 0x3c, 0x52, 0x41, 0x3a, 0x3a, // CTR CLF CDN CRT 0 . CMD CMD
#if MENU_IS_POWER
0x7f, 0x32, 0x51, 0x7f, 0xff, 0xff, 0xff, 0xff, // MNU EUR = POW inv inv inv inv
#else
0x32, 0x32, 0x51, 0x7f, 0xff, 0xff, 0xff, 0xff, // MNU EUR = POW inv inv inv inv
#endif
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff // inv inv inv inv inv inv inv inv
};
static const uint8 modifier2mac[0x20] = {
#if MENU_IS_POWER
0x38, 0x37, 0x36, 0x39, 0x6b, 0x47, 0x3a, 0x7f, // SHF CMD inv CAP F14 NUM OPT MNU
#else
0x38, 0x37, 0x36, 0x39, 0x6b, 0x47, 0x3a, 0x32, // SHF CMD CTR CAP F14 NUM OPT MNU
#endif
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff // inv inv inv inv inv inv inv inv
};
static filter_result filter_func(BMessage *msg, BHandler **target, BMessageFilter *filter)
{
// msg->PrintToStream();
switch (msg->what) {
case B_KEY_DOWN:
case B_KEY_UP: {
uint32 be_code = msg->FindInt32("key") & 0xff;
uint32 mac_code = keycode2mac[be_code];
// Intercept Ctrl-F1 (mount floppy disk shortcut)
uint32 mods = msg->FindInt32("modifiers");
if (be_code == 0x02 && (mods & B_CONTROL_KEY))
SysMountVolume("/dev/disk/floppy/raw");
if (mac_code == 0xff)
return B_DISPATCH_MESSAGE;
if (msg->what == B_KEY_DOWN)
ADBKeyDown(mac_code);
else
ADBKeyUp(mac_code);
return B_SKIP_MESSAGE;
}
case B_MODIFIERS_CHANGED: {
uint32 mods = msg->FindInt32("modifiers");
uint32 old_mods = msg->FindInt32("be:old_modifiers");
uint32 changed = mods ^ old_mods;
uint32 mask = 1;
for (int i=0; i<32; i++, mask<<=1)
if (changed & mask) {
uint32 mac_code = modifier2mac[i];
if (mac_code == 0xff)
continue;
if (mods & mask)
ADBKeyDown(mac_code);
else
ADBKeyUp(mac_code);
}
return B_SKIP_MESSAGE;
}
case B_MOUSE_MOVED: {
BPoint point;
msg->FindPoint("where", &point);
ADBMouseMoved(int(point.x), int(point.y));
return B_DISPATCH_MESSAGE; // Otherwise BitmapView::MouseMoved() wouldn't be called
}
case B_MOUSE_DOWN: {
uint32 buttons = msg->FindInt32("buttons");
if (buttons & B_PRIMARY_MOUSE_BUTTON)
ADBMouseDown(0);
if (buttons & B_SECONDARY_MOUSE_BUTTON)
ADBMouseDown(1);
if (buttons & B_TERTIARY_MOUSE_BUTTON)
ADBMouseDown(2);
return B_SKIP_MESSAGE;
}
case B_MOUSE_UP: // B_MOUSE_UP means "all buttons released"
ADBMouseUp(0);
ADBMouseUp(1);
ADBMouseUp(2);
return B_SKIP_MESSAGE;
default:
return B_DISPATCH_MESSAGE;
}
}
/*
* Install graphics acceleration
*/
// Rectangle blitting
static void accl_bitblt(accl_params *p)
{
D(bug("accl_bitblt\n"));
// Get blitting parameters
int16 src_X = p->src_rect[1] - p->src_bounds[1];
int16 src_Y = p->src_rect[0] - p->src_bounds[0];
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1];
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0];
int16 width = p->dest_rect[3] - p->dest_rect[1] - 1;
int16 height = p->dest_rect[2] - p->dest_rect[0] - 1;
D(bug(" src X %d, src Y %d, dest X %d, dest Y %d\n", src_X, src_Y, dest_X, dest_Y));
D(bug(" width %d, height %d\n", width, height));
// And perform the blit
bitblt_hook(src_X, src_Y, dest_X, dest_Y, width, height);
}
static bool accl_bitblt_hook(accl_params *p)
{
D(bug("accl_draw_hook %p\n", p));
// Check if we can accelerate this bitblt
if (p->src_base_addr == screen_base && p->dest_base_addr == screen_base &&
display_type == DIS_SCREEN && bitblt_hook != NULL &&
((uint32 *)p)[0x18 >> 2] + ((uint32 *)p)[0x128 >> 2] == 0 &&
((uint32 *)p)[0x130 >> 2] == 0 &&
p->transfer_mode == 0 &&
p->src_row_bytes > 0 && ((uint32 *)p)[0x15c >> 2] > 0) {
// Yes, set function pointer
p->draw_proc = (uint32)accl_bitblt;
return true;
}
return false;
}
// Rectangle filling/inversion
static void accl_fillrect8(accl_params *p)
{
D(bug("accl_fillrect8\n"));
// Get filling parameters
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1];
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0];
int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1;
int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1;
uint8 color = p->pen_mode == 8 ? p->fore_pen : p->back_pen;
D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y));
D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max));
// And perform the fill
fillrect8_hook(dest_X, dest_Y, dest_X_max, dest_Y_max, color);
}
static void accl_fillrect32(accl_params *p)
{
D(bug("accl_fillrect32\n"));
// Get filling parameters
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1];
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0];
int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1;
int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1;
uint32 color = p->pen_mode == 8 ? p->fore_pen : p->back_pen;
D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y));
D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max));
// And perform the fill
fillrect32_hook(dest_X, dest_Y, dest_X_max, dest_Y_max, color);
}
static void accl_invrect(accl_params *p)
{
D(bug("accl_invrect\n"));
// Get inversion parameters
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1];
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0];
int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1;
int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1;
D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y));
D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max));
//!!?? pen_mode == 14
// And perform the inversion
invrect_hook(dest_X, dest_Y, dest_X_max, dest_Y_max);
}
static bool accl_fillrect_hook(accl_params *p)
{
D(bug("accl_fillrect_hook %p\n", p));
// Check if we can accelerate this fillrect
if (p->dest_base_addr == screen_base && ((uint32 *)p)[0x284 >> 2] != 0 && display_type == DIS_SCREEN) {
if (p->transfer_mode == 8) {
// Fill
if (p->dest_pixel_size == 8 && fillrect8_hook != NULL) {
p->draw_proc = (uint32)accl_fillrect8;
return true;
} else if (p->dest_pixel_size == 32 && fillrect32_hook != NULL) {
p->draw_proc = (uint32)accl_fillrect32;
return true;
}
} else if (p->transfer_mode == 10 && invrect_hook != NULL) {
// Invert
p->draw_proc = (uint32)accl_invrect;
return true;
}
}
return false;
}
// Dummy for testing
/*
static void do_nothing(accl_params *p) {}
static bool accl_foobar_hook(accl_params *p)
{
printf("accl_foobar_hook %p\n", p);
printf(" src_base_addr %p, dest_base_addr %p\n", p->src_base_addr, p->dest_base_addr);
printf(" src_row_bytes %d, dest_row_bytes %d\n", p->src_row_bytes, p->dest_row_bytes);
printf(" src_pixel_size %d, dest_pixel_size %d\n", p->src_pixel_size, p->dest_pixel_size);
printf(" src_bounds (%d,%d,%d,%d), dest_bounds (%d,%d,%d,%d)\n", p->src_bounds[0], p->src_bounds[1], p->src_bounds[2], p->src_bounds[3], p->dest_bounds[0], p->dest_bounds[1], p->dest_bounds[2], p->dest_bounds[3]);
printf(" src_rect (%d,%d,%d,%d), dest_rect (%d,%d,%d,%d)\n", p->src_rect[0], p->src_rect[1], p->src_rect[2], p->src_rect[3], p->dest_rect[0], p->dest_rect[1], p->dest_rect[2], p->dest_rect[3]);
printf(" transfer mode %d\n", p->transfer_mode);
printf(" pen mode %d\n", p->pen_mode);
printf(" fore_pen %08x, back_pen %08x\n", p->fore_pen, p->back_pen);
printf(" val1 %08x, val2 %08x\n", ((uint32 *)p)[0x18 >> 2], ((uint32 *)p)[0x128 >> 2]);
printf(" val3 %08x\n", ((uint32 *)p)[0x130 >> 2]);
printf(" val4 %08x\n", ((uint32 *)p)[0x15c >> 2]);
printf(" val5 %08x\n", ((uint32 *)p)[0x160 >> 2]);
printf(" val6 %08x\n", ((uint32 *)p)[0x1b4 >> 2]);
printf(" val7 %08x\n", ((uint32 *)p)[0x284 >> 2]);
p->draw_proc = (uint32)do_nothing;
return true;
}
static struct accl_hook_info foobar_hook_info = {(uint32)accl_foobar_hook, (uint32)accl_sync_hook, 6};
*/
// Wait for graphics operation to finish
static bool accl_sync_hook(void *arg)
{
D(bug("accl_sync_hook %p\n", arg));
if (sync_hook != NULL)
sync_hook();
return true;
}
static struct accl_hook_info bitblt_hook_info = {(uint32)accl_bitblt_hook, (uint32)accl_sync_hook, ACCL_BITBLT};
static struct accl_hook_info fillrect_hook_info = {(uint32)accl_fillrect_hook, (uint32)accl_sync_hook, ACCL_FILLRECT};
void VideoInstallAccel(void)
{
// Install acceleration hooks
if (PrefsFindBool("gfxaccel")) {
D(bug("Video: Installing acceleration hooks\n"));
NQDMisc(6, (uintptr)&bitblt_hook_info);
NQDMisc(6, (uintptr)&fillrect_hook_info);
}
}
/*
* Change video mode
*/
int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr)
{
/* return if no mode change */
if ((csSave->saveData == ReadMacInt32(ParamPtr + csData)) &&
(csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr;
/* first find video mode in table */
for (int i=0; VModes[i].viType != DIS_INVALID; i++) {
if ((ReadMacInt16(ParamPtr + csMode) == VModes[i].viAppleMode) &&
(ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) {
csSave->saveMode = ReadMacInt16(ParamPtr + csMode);
csSave->saveData = ReadMacInt32(ParamPtr + csData);
csSave->savePage = ReadMacInt16(ParamPtr + csPage);
while (acquire_sem(video_lock) == B_INTERRUPTED) ;
DisableInterrupt();
/* close old display */
close_display();
/* open new display */
cur_mode = i;
open_display();
/* opening the screen failed? Then bail out */
if (display_type == DIS_SCREEN && the_screen == NULL) {
release_sem(video_lock);
ErrorAlert(GetString(STR_FULL_SCREEN_ERR));
QuitEmulator();
}
WriteMacInt32(ParamPtr + csBaseAddr, screen_base);
csSave->saveBaseAddr=screen_base;
csSave->saveData=VModes[cur_mode].viAppleID;/* First mode ... */
csSave->saveMode=VModes[cur_mode].viAppleMode;
EnableInterrupt();
release_sem(video_lock);
return noErr;
}
}
return paramErr;
}
/*
* Set color palette
*/
void video_set_palette(void)
{
if (display_type == DIS_SCREEN && the_screen != NULL)
the_screen->palette_changed = true;
else { // remap colors to BeOS-Palette
BScreen screen;
for (int i=0;i<256;i++)
remap_mac_be[i]=screen.IndexForColor(mac_pal[i].red,mac_pal[i].green,mac_pal[i].blue);
}
}
/*
* Can we set the MacOS cursor image into the window?
*/
bool video_can_change_cursor(void)
{
return (display_type != DIS_SCREEN);
}
/*
* Set cursor image for window
*/
void video_set_cursor(void)
{
the_window->cursor_changed = true; // Inform window (don't set cursor directly because this may run at interrupt (i.e. signal handler) time)
}
/*
* Record dirty area from NQD
*/
void video_set_dirty_area(int x, int y, int w, int h)
{
}

View File

@ -1,262 +0,0 @@
/*
* video_screen.h - Full screen video modes
*
* SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
static bool drawing_enable = false; // This flag indicated if the access to the screen is allowed
static int page_num; // Index of the currently displayed buffer
// Blitter functions
typedef void (*bitblt_ptr)(int32, int32, int32, int32, int32, int32);
static bitblt_ptr bitblt_hook;
typedef void (*fillrect8_ptr)(int32, int32, int32, int32, uint8);
static fillrect8_ptr fillrect8_hook;
typedef void (*fillrect32_ptr)(int32, int32, int32, int32, uint32);
static fillrect32_ptr fillrect32_hook;
typedef void (*invrect_ptr)(int32, int32, int32, int32);
static invrect_ptr invrect_hook;
typedef void (*sync_ptr)(void);
static sync_ptr sync_hook;
class MacScreen : public BWindowScreen {
public:
MacScreen(const char *name, uint32 space);
virtual ~MacScreen();
virtual void Quit(void);
virtual void ScreenConnected(bool active);
bool palette_changed;
private:
static status_t tick_func(void *arg);
BView *view; // Main view for GetMouse()
uint8 *frame_backup; // Frame buffer backup when switching from/to different workspace
bool quitting; // Flag for ScreenConnected: We are quitting, don't pause emulator thread
bool first; // Flag for ScreenConnected: This is the first time we become active
thread_id tick_thread;
bool tick_thread_active;
};
// Pointer to our screen
static MacScreen *the_screen = NULL;
// Error code from BWindowScreen constructor
static status_t screen_error;
// to enable debugger mode.
#define SCREEN_DEBUG false
/*
* Screen constructor
*/
MacScreen::MacScreen(const char *name, uint32 space) : BWindowScreen(name, space, &screen_error, SCREEN_DEBUG), tick_thread(-1)
{
D(bug("Screen constructor\n"));
// Set all variables
frame_backup = NULL;
palette_changed = false;
quitting = false;
first = true;
drawing_enable = false;
ADBSetRelMouseMode(true);
// Create view to poll the mouse
view = new BView (BRect(0,0,VModes[cur_mode].viXsize-1,VModes[cur_mode].viYsize-1),NULL,B_FOLLOW_NONE,0);
AddChild(view);
// Start 60Hz interrupt
tick_thread_active = true;
tick_thread = spawn_thread(tick_func, "Polling sucks...", B_DISPLAY_PRIORITY, this);
RegisterThread(tick_thread);
resume_thread(tick_thread);
// Add filter for keyboard and mouse events
BMessageFilter *filter = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, filter_func);
AddCommonFilter(filter);
D(bug("Screen constructor done\n"));
}
/*
* Screen destructor
*/
MacScreen::~MacScreen()
{
D(bug("Screen destructor, quitting tick thread\n"));
// Stop 60Hz interrupt
if (tick_thread > 0) {
status_t l;
tick_thread_active = false;
while (wait_for_thread(tick_thread, &l) == B_INTERRUPTED) ;
}
D(bug("tick thread quit\n"));
// Tell the emulator that we're done
the_screen = NULL;
D(bug("Screen destructor done\n"));
}
/*
* Screen closed
*/
void MacScreen::Quit(void)
{
// Tell ScreenConnected() that we are quitting
quitting = true;
D(bug("MacScreen::Quit(), disconnecting\n"));
Disconnect();
D(bug("disconnected\n"));
BWindowScreen::Quit();
}
/*
* Screen connected/disconnected
*/
void MacScreen::ScreenConnected(bool active)
{
D(bug("ScreenConnected(%d)\n", active));
graphics_card_info *info = CardInfo();
D(bug(" card_info %p\n", info));
if (active) {
// Read graphics parameters
D(bug(" active\n"));
screen_base = (uint32)info->frame_buffer;
D(bug(" screen_base %p\n", screen_base));
VModes[cur_mode].viRowBytes = info->bytes_per_row;
D(bug(" xmod %d\n", info->bytes_per_row));
// Get acceleration functions
if (PrefsFindBool("gfxaccel")) {
bitblt_hook = (bitblt_ptr)CardHookAt(7);
D(bug(" bitblt_hook %p\n", bitblt_hook));
fillrect8_hook = (fillrect8_ptr)CardHookAt(5);
D(bug(" fillrect8_hook %p\n", fillrect8_hook));
fillrect32_hook = (fillrect32_ptr)CardHookAt(6);
D(bug(" fillrect32_hook %p\n", fillrect32_hook));
invrect_hook = (invrect_ptr)CardHookAt(11);
D(bug(" invrect_hook %p\n", invrect_hook));
sync_hook = (sync_ptr)CardHookAt(10);
D(bug(" sync_hook %p\n", sync_hook));
} else {
bitblt_hook = NULL;
fillrect8_hook = NULL;
fillrect32_hook = NULL;
invrect_hook = NULL;
sync_hook = NULL;
}
// The first time we got the screen, we need to init the Window
if (first) {
D(bug(" first time\n"));
first = false;
page_num = 0; // current display : page 0
} else { // we get our screen back
D(bug(" not first time\n"));
// copy from backup bitmap to framebuffer
memcpy((void *)screen_base, frame_backup, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
// delete backup bitmap
delete[] frame_backup;
frame_backup = NULL;
// restore palette
if (info->bits_per_pixel == 8)
SetColorList(mac_pal);
// restart emul thread
release_sem(mac_os_lock);
}
// allow the drawing in the frame buffer
D(bug(" enabling frame buffer access\n"));
drawing_enable = true;
video_activated = true;
} else {
drawing_enable = false; // stop drawing.
video_activated = false;
if (!quitting) {
// stop emul thread
acquire_sem(mac_os_lock);
// create bitmap and store frame buffer into
frame_backup = new uint8[VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize];
memcpy(frame_backup, (void *)screen_base, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
}
}
D(bug("ScreenConnected() done\n"));
}
/*
* 60Hz interrupt routine
*/
status_t MacScreen::tick_func(void *arg)
{
MacScreen *obj = (MacScreen *)arg;
while (obj->tick_thread_active) {
// Wait
snooze(16667);
// Workspace activated? Then poll the mouse and change the palette if needed
if (video_activated) {
BPoint pt;
uint32 button = 0;
if (obj->LockWithTimeout(200000) == B_OK) {
if (obj->palette_changed) {
obj->palette_changed = false;
obj->SetColorList(mac_pal);
}
obj->view->GetMouse(&pt, &button);
obj->Unlock();
set_mouse_position(320, 240);
ADBMouseMoved(int(pt.x) - 320, int(pt.y) - 240);
if (button & B_PRIMARY_MOUSE_BUTTON)
ADBMouseDown(0);
if (!(button & B_PRIMARY_MOUSE_BUTTON))
ADBMouseUp(0);
if (button & B_SECONDARY_MOUSE_BUTTON)
ADBMouseDown(1);
if (!(button & B_SECONDARY_MOUSE_BUTTON))
ADBMouseUp(1);
if (button & B_TERTIARY_MOUSE_BUTTON)
ADBMouseDown(2);
if (!(button & B_TERTIARY_MOUSE_BUTTON))
ADBMouseUp(2);
}
}
}
return 0;
}

View File

@ -1,523 +0,0 @@
/*
* video_window.h - Window video modes
*
* SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <DirectWindow.h>
// Messages
static const uint32 MSG_REDRAW = 'draw';
static const uint32 MSG_ABOUT_REQUESTED = B_ABOUT_REQUESTED;
static const uint32 MSG_REF_5HZ = ' 5Hz';
static const uint32 MSG_REF_7_5HZ = ' 7Hz';
static const uint32 MSG_REF_10HZ = '10Hz';
static const uint32 MSG_REF_15HZ = '15Hz';
static const uint32 MSG_REF_30HZ = '30Hz';
static const uint32 MSG_REF_60HZ = '60Hz';
static const uint32 MSG_MOUNT = 'moun';
static bool mouse_in_view; // Flag: Mouse pointer within bitmap view
// From sys_beos.cpp
extern void SysCreateVolumeMenu(BMenu *menu, uint32 msg);
extern void SysMountVolume(const char *name);
/*
* A simple view class for blitting a bitmap on the screen
*/
class BitmapView : public BView {
public:
BitmapView(BRect frame, BBitmap *bitmap) : BView(frame, "bitmap", B_FOLLOW_NONE, B_WILL_DRAW)
{
the_bitmap = bitmap;
}
virtual void Draw(BRect update)
{
if (the_bitmap)
DrawBitmap(the_bitmap, update, update);
}
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
private:
BBitmap *the_bitmap;
};
/*
* Window class
*/
class MacWindow : public BDirectWindow {
public:
MacWindow(BRect frame);
virtual ~MacWindow();
virtual void MessageReceived(BMessage *msg);
virtual void DirectConnected(direct_buffer_info *info);
virtual void WindowActivated(bool active);
int32 frame_skip;
bool cursor_changed; // Flag: set new cursor image in tick function
private:
static status_t tick_func(void *arg);
BitmapView *main_view;
BBitmap *the_bitmap;
uint8 *the_buffer;
uint32 old_scroll_lock_state;
thread_id tick_thread;
bool tick_thread_active;
bool supports_direct_mode;
bool bit_bang;
sem_id drawing_sem;
color_space mode;
void *bits;
int32 bytes_per_row;
color_space pixel_format;
bool unclipped;
};
// Pointer to our window
static MacWindow *the_window = NULL;
/*
* Window constructor
*/
MacWindow::MacWindow(BRect frame) : BDirectWindow(frame, GetString(STR_WINDOW_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE)
{
D(bug("Window constructor\n"));
supports_direct_mode = SupportsWindowMode();
cursor_changed = false;
bit_bang = supports_direct_mode && PrefsFindBool("bitbang");
// Move window to right position
Lock();
MoveTo(80, 60);
// Allocate bitmap
{
BScreen scr(this);
mode = B_COLOR_8_BIT;
switch (VModes[cur_mode].viAppleMode) {
case APPLE_8_BIT:
mode = B_COLOR_8_BIT;
bit_bang = false;
break;
case APPLE_16_BIT:
mode = B_RGB_16_BIT;
if (scr.ColorSpace() != B_RGB15_BIG && scr.ColorSpace() != B_RGBA15_BIG)
bit_bang = false;
break;
case APPLE_32_BIT:
mode = B_RGB_32_BIT;
if (scr.ColorSpace() != B_RGB32_BIG && scr.ColorSpace() != B_RGBA32_BIG)
bit_bang = false;
break;
}
}
if (bit_bang) {
the_bitmap = NULL;
the_buffer = NULL;
} else {
the_bitmap = new BBitmap(frame, mode);
the_buffer = new uint8[VModes[cur_mode].viRowBytes * (VModes[cur_mode].viYsize + 2)]; // ("height + 2" for safety)
screen_base = (uint32)the_buffer;
}
// Create bitmap view
main_view = new BitmapView(frame, the_bitmap);
AddChild(main_view);
main_view->MakeFocus();
// Read frame skip prefs
frame_skip = PrefsFindInt32("frameskip");
// Set up menus
BRect bounds = Bounds();
bounds.OffsetBy(0, bounds.IntegerHeight() + 1);
BMenuItem *item;
BMenuBar *bar = new BMenuBar(bounds, "menu");
BMenu *menu = new BMenu(GetString(STR_WINDOW_MENU));
menu->AddItem(new BMenuItem(GetString(STR_WINDOW_ITEM_ABOUT), new BMessage(MSG_ABOUT_REQUESTED)));
menu->AddItem(new BSeparatorItem);
BMenu *submenu = new BMenu(GetString(STR_WINDOW_ITEM_REFRESH));
submenu->AddItem(new BMenuItem(GetString(STR_REF_5HZ_LAB), new BMessage(MSG_REF_5HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_7_5HZ_LAB), new BMessage(MSG_REF_7_5HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_10HZ_LAB), new BMessage(MSG_REF_10HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_15HZ_LAB), new BMessage(MSG_REF_15HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_30HZ_LAB), new BMessage(MSG_REF_30HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_60HZ_LAB), new BMessage(MSG_REF_60HZ)));
submenu->SetRadioMode(true);
if (frame_skip == 12) {
if ((item = submenu->FindItem(GetString(STR_REF_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 8) {
if ((item = submenu->FindItem(GetString(STR_REF_7_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 6) {
if ((item = submenu->FindItem(GetString(STR_REF_10HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 4) {
if ((item = submenu->FindItem(GetString(STR_REF_15HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 2) {
if ((item = submenu->FindItem(GetString(STR_REF_30HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 1) {
if ((item = submenu->FindItem(GetString(STR_REF_60HZ_LAB))) != NULL)
item->SetMarked(true);
}
menu->AddItem(submenu);
submenu = new BMenu(GetString(STR_WINDOW_ITEM_MOUNT));
SysCreateVolumeMenu(submenu, MSG_MOUNT);
menu->AddItem(submenu);
bar->AddItem(menu);
AddChild(bar);
SetKeyMenuBar(bar);
int mbar_height = bar->Frame().IntegerHeight() + 1;
// Resize window to fit menu bar
ResizeBy(0, mbar_height);
// Set mouse mode and scroll lock state
ADBSetRelMouseMode(false);
mouse_in_view = true;
old_scroll_lock_state = modifiers() & B_SCROLL_LOCK;
if (old_scroll_lock_state)
SetTitle(GetString(STR_WINDOW_TITLE_FROZEN));
else
SetTitle(GetString(STR_WINDOW_TITLE));
// Clear Mac cursor image
memset(MacCursor + 4, 0, 64);
// Keep window aligned to 8-byte frame buffer boundaries for faster blitting
SetWindowAlignment(B_BYTE_ALIGNMENT, 8);
// Create drawing semaphore (for direct mode)
drawing_sem = create_sem(0, "direct frame buffer access");
// Start 60Hz interrupt
tick_thread_active = true;
tick_thread = spawn_thread(tick_func, "Window Redraw", B_DISPLAY_PRIORITY, this);
resume_thread(tick_thread);
// Add filter for keyboard and mouse events
BMessageFilter *filter = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, filter_func);
main_view->AddFilter(filter);
// Show window
Unlock();
Show();
Sync();
D(bug("Window constructor done\n"));
}
/*
* Window destructor
*/
MacWindow::~MacWindow()
{
// Restore cursor
mouse_in_view = false;
be_app->SetCursor(B_HAND_CURSOR);
// Hide window
D(bug("Window destructor, hiding window\n"));
Hide();
Sync();
// Stop 60Hz interrupt
D(bug("Quitting tick thread\n"));
status_t l;
tick_thread_active = false;
delete_sem(drawing_sem);
while (wait_for_thread(tick_thread, &l) == B_INTERRUPTED) ;
D(bug("tick thread quit\n"));
// dispose allocated memory
delete the_bitmap;
delete[] the_buffer;
// Tell emulator that we're done
the_window = NULL;
D(bug("Window destructor done\n"));
}
/*
* Window connected/disconnected
*/
void MacWindow::DirectConnected(direct_buffer_info *info)
{
D(bug("DirectConnected, state %d\n", info->buffer_state));
switch (info->buffer_state & B_DIRECT_MODE_MASK) {
case B_DIRECT_STOP:
acquire_sem(drawing_sem);
break;
case B_DIRECT_MODIFY:
acquire_sem(drawing_sem);
case B_DIRECT_START:
bits = (void *)((uint8 *)info->bits + info->window_bounds.top * info->bytes_per_row + info->window_bounds.left * info->bits_per_pixel / 8);
bytes_per_row = info->bytes_per_row;
pixel_format = info->pixel_format;
unclipped = false;
if (info->clip_list_count == 1)
if (memcmp(&info->clip_bounds, &info->window_bounds, sizeof(clipping_rect)) == 0)
unclipped = true;
if (bit_bang) {
screen_base = (uint32)bits;
VModes[cur_mode].viRowBytes = bytes_per_row;
}
release_sem(drawing_sem);
break;
}
D(bug("DirectConnected done\n"));
}
/*
* Handles redraw messages
*/
void MacWindow::MessageReceived(BMessage *msg)
{
BMessage *msg2;
switch (msg->what) {
case MSG_REDRAW: {
// Prevent backlog of messages
MessageQueue()->Lock();
while ((msg2 = MessageQueue()->FindMessage(MSG_REDRAW, 0)) != NULL) {
MessageQueue()->RemoveMessage(msg2);
delete msg2;
}
MessageQueue()->Unlock();
// Convert Mac screen buffer to BeOS palette and blit
uint32 length = VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize;
if (mode == B_COLOR_8_BIT) {
// Palette conversion
uint8 *source = the_buffer - 1;
uint8 *dest = (uint8 *)the_bitmap->Bits() - 1;
for (int i=0; i<length; i++)
*++dest = remap_mac_be[*++source];
} else if (mode == B_RGB_16_BIT) {
// Endianess conversion
uint16 *source = (uint16 *)the_buffer;
uint16 *dest = (uint16 *)the_bitmap->Bits() - 1;
for (int i=0; i<length/2; i++)
*++dest = __lhbrx(source++, 0);
} else if (mode == B_RGB_32_BIT) {
// Endianess conversion
uint32 *source = (uint32 *)the_buffer;
uint32 *dest = (uint32 *)the_bitmap->Bits() - 1;
for (int i=0; i<length/4; i++)
*++dest = __lwbrx(source++, 0);
}
BRect update_rect = BRect(0, 0, VModes[cur_mode].viXsize-1, VModes[cur_mode].viYsize-1);
main_view->DrawBitmapAsync(the_bitmap, update_rect, update_rect);
break;
}
case MSG_ABOUT_REQUESTED:
OpenAboutWindow();
break;
case MSG_REF_5HZ:
PrefsReplaceInt32("frameskip", frame_skip = 12);
break;
case MSG_REF_7_5HZ:
PrefsReplaceInt32("frameskip", frame_skip = 8);
break;
case MSG_REF_10HZ:
PrefsReplaceInt32("frameskip", frame_skip = 6);
break;
case MSG_REF_15HZ:
PrefsReplaceInt32("frameskip", frame_skip = 4);
break;
case MSG_REF_30HZ:
PrefsReplaceInt32("frameskip", frame_skip = 2);
break;
case MSG_REF_60HZ:
PrefsReplaceInt32("frameskip", frame_skip = 1);
break;
case MSG_MOUNT: {
BMenuItem *source = NULL;
msg->FindPointer("source", (void **)&source);
if (source)
SysMountVolume(source->Label());
break;
}
default:
BDirectWindow::MessageReceived(msg);
}
}
/*
* Window activated/deactivated
*/
void MacWindow::WindowActivated(bool active)
{
video_activated = active;
if (active)
frame_skip = PrefsFindInt32("frameskip");
else
frame_skip = 12; // 5Hz in background
BDirectWindow::WindowActivated(active);
}
/*
* 60Hz interrupt routine
*/
status_t MacWindow::tick_func(void *arg)
{
MacWindow *obj = (MacWindow *)arg;
static int tick_counter = 0;
while (obj->tick_thread_active) {
// Wait
snooze(16667);
// Refresh window
if (!obj->bit_bang)
tick_counter++;
if (tick_counter >= obj->frame_skip) {
tick_counter = 0;
// Window title is determined by Scroll Lock state
uint32 scroll_lock_state = modifiers() & B_SCROLL_LOCK;
if (scroll_lock_state != obj->old_scroll_lock_state) {
if (scroll_lock_state)
obj->SetTitle(GetString(STR_WINDOW_TITLE_FROZEN));
else
obj->SetTitle(GetString(STR_WINDOW_TITLE));
obj->old_scroll_lock_state = scroll_lock_state;
}
// Refresh display unless Scroll Lock is down
if (!scroll_lock_state) {
// If direct frame buffer access is supported and the content area is completely visible,
// convert the Mac screen buffer directly. Otherwise, send a message to the window to do
// it into a bitmap
if (obj->supports_direct_mode) {
if (acquire_sem_etc(obj->drawing_sem, 1, B_TIMEOUT, 200000) == B_NO_ERROR) {
if (obj->unclipped && obj->mode == B_COLOR_8_BIT && obj->pixel_format == B_CMAP8) {
uint8 *source = obj->the_buffer - 1;
uint8 *dest = (uint8 *)obj->bits;
uint32 bytes_per_row = obj->bytes_per_row;
int xsize = VModes[cur_mode].viXsize;
int ysize = VModes[cur_mode].viYsize;
for (int y=0; y<ysize; y++) {
uint32 *p = (uint32 *)dest - 1;
for (int x=0; x<xsize/4; x++) {
uint32 c = remap_mac_be[*++source] << 24;
c |= remap_mac_be[*++source] << 16;
c |= remap_mac_be[*++source] << 8;
c |= remap_mac_be[*++source];
*++p = c;
}
dest += bytes_per_row;
}
} else if (obj->unclipped && obj->mode == B_RGB_16_BIT && (obj->pixel_format == B_RGB15_BIG || obj->pixel_format == B_RGBA15_BIG)) {
uint8 *source = obj->the_buffer;
uint8 *dest = (uint8 *)obj->bits;
uint32 sbpr = VModes[cur_mode].viRowBytes;
uint32 dbpr = obj->bytes_per_row;
int xsize = VModes[cur_mode].viXsize;
int ysize = VModes[cur_mode].viYsize;
for (int y=0; y<ysize; y++) {
memcpy(dest, source, xsize * 2);
source += sbpr;
dest += dbpr;
}
} else if (obj->unclipped && obj->mode == B_RGB_32_BIT && (obj->pixel_format == B_RGB32_BIG || obj->pixel_format == B_RGBA32_BIG)) {
uint8 *source = obj->the_buffer;
uint8 *dest = (uint8 *)obj->bits;
uint32 sbpr = VModes[cur_mode].viRowBytes;
uint32 dbpr = obj->bytes_per_row;
int xsize = VModes[cur_mode].viXsize;
int ysize = VModes[cur_mode].viYsize;
for (int y=0; y<ysize; y++) {
memcpy(dest, source, xsize * 4);
source += sbpr;
dest += dbpr;
}
} else
obj->PostMessage(MSG_REDRAW);
release_sem(obj->drawing_sem);
}
} else
obj->PostMessage(MSG_REDRAW);
}
}
// Set new cursor image if desired
if (obj->cursor_changed) {
if (mouse_in_view)
be_app->SetCursor(MacCursor);
obj->cursor_changed = false;
}
}
return 0;
}
/*
* Mouse moved
*/
void BitmapView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
{
switch (transit) {
case B_ENTERED_VIEW:
mouse_in_view = true;
be_app->SetCursor(MacCursor);
break;
case B_EXITED_VIEW:
mouse_in_view = false;
be_app->SetCursor(B_HAND_CURSOR);
break;
}
}

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/xpram_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/sigsegv.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/sigsegv.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_blit.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_blit.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_vosf.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/vm_alloc.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/vm_alloc.h

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

View File

@ -1,308 +0,0 @@
/*
* Ethernet.cpp - SheepShaver ethernet PCI driver stub
*
* SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdeps.h"
#include <stddef.h>
#include "xlowmem.h"
#include "ether_defs.h"
// Macro for tail-calling native code from assembly functions
#define ASM_TAIL_CALL_NATIVE(NAME) \
lwz r0,XLM_##NAME(r0) ;\
lwz r2,XLM_TOC(r0) ;\
mtctr r0 ;\
bctr
// Macro for calling native code from assembly functions
#define ASM_CALL_NATIVE(NAME) \
mflr r0 ;\
stw r2,12(r1) ;\
stw r0,8(r1) ;\
stwu r1,-64(r1) ;\
lwz r0,XLM_##NAME(r0) ;\
lwz r2,XLM_TOC(r0) ;\
mtlr r0 ;\
blrl ;\
lwz r0,64+8(r1) ;\
lwz r2,64+12(r1) ;\
mtlr r0 ;\
addi r1,r1,64 ;\
blr
/*
* Driver Description structure
*/
struct DriverDescription {
uint32 driverDescSignature;
uint32 driverDescVersion;
char nameInfoStr[32];
uint32 version;
uint32 driverRuntime;
char driverName[32];
uint32 driverDescReserved[8];
uint32 nServices;
uint32 serviceCategory;
uint32 serviceType;
uint32 serviceVersion;
};
#pragma export on
DriverDescription TheDriverDescription = {
'mtej',
0,
"\pSheepShaver Ethernet",
0x01008000, // V1.0.0final
4, // kDriverIsUnderExpertControl
"\penet",
0, 0, 0, 0, 0, 0, 0, 0,
1,
'otan',
0x000a0b01, // Ethernet, Framing: Ethernet/EthernetIPX/802.2, IsDLPI
0x01000000, // V1.0.0
};
#pragma export off
/*
* install_info and related structures
*/
#ifdef BUILD_ETHER_FULL_DRIVER
#define ETHERDECL extern
#else
#define ETHERDECL static
#endif
ETHERDECL int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds);
ETHERDECL int ether_close(queue_t *rdq, int flag, void *creds);
ETHERDECL int ether_wput(queue_t *q, msgb *mp);
ETHERDECL int ether_wsrv(queue_t *q);
ETHERDECL int ether_rput(queue_t *q, msgb *mp);
ETHERDECL int ether_rsrv(queue_t *q);
struct ot_module_info {
uint16 mi_idnum;
char *mi_idname;
int32 mi_minpsz; // Minimum packet size
int32 mi_maxpsz; // Maximum packet size
uint32 mi_hiwat; // Queue hi-water mark
uint32 mi_lowat; // Queue lo-water mark
};
static ot_module_info module_information = {
kEnetModuleID,
"SheepShaver Ethernet",
0,
kEnetTSDU,
6000,
5000
};
typedef int (*putp_t)(queue_t *, msgb *);
typedef int (*srvp_t)(queue_t *);
typedef int (*openp_t)(queue_t *, void *, int, int, void *);
typedef int (*closep_t)(queue_t *, int, void *);
struct qinit {
putp_t qi_putp;
srvp_t qi_srvp;
openp_t qi_qopen;
closep_t qi_qclose;
void *qi_qadmin;
struct ot_module_info *qi_minfo;
void *qi_mstat;
};
static qinit read_side = {
NULL,
ether_rsrv,
ether_open,
ether_close,
NULL,
&module_information,
NULL
};
static qinit write_side = {
ether_wput,
NULL,
ether_open,
ether_close,
NULL,
&module_information,
NULL
};
struct streamtab {
struct qinit *st_rdinit;
struct qinit *st_wrinit;
struct qinit *st_muxrinit;
struct qinit *st_muxwinit;
};
static streamtab the_streamtab = {
&read_side,
&write_side,
NULL,
NULL
};
struct install_info {
struct streamtab *install_str;
uint32 install_flags;
uint32 install_sqlvl;
char *install_buddy;
void *ref_load;
uint32 ref_count;
};
enum {
kOTModIsDriver = 0x00000001,
kOTModUpperIsDLPI = 0x00002000,
SQLVL_MODULE = 3,
};
static install_info the_install_info = {
&the_streamtab,
kOTModIsDriver /*| kOTModUpperIsDLPI */,
SQLVL_MODULE,
NULL,
NULL,
0
};
// Prototypes for exported functions
extern "C" {
#pragma export on
extern uint32 ValidateHardware(void *theID);
extern install_info* GetOTInstallInfo();
extern uint8 InitStreamModule(void *theID);
extern void TerminateStreamModule(void);
#pragma export off
}
/*
* Validate that our hardware is available (always available)
*/
uint32 ValidateHardware(void *theID)
{
return 0;
}
/*
* Return pointer to install_info structure
*/
install_info *GetOTInstallInfo(void)
{
return &the_install_info;
}
/*
* Init module
*/
#ifdef BUILD_ETHER_FULL_DRIVER
asm bool NativeInitStreamModule(register void *theID)
{
ASM_CALL_NATIVE(ETHER_INIT)
}
#else
asm uint8 InitStreamModule(register void *theID)
{
ASM_TAIL_CALL_NATIVE(ETHER_INIT)
}
#endif
/*
* Terminate module
*/
#ifdef BUILD_ETHER_FULL_DRIVER
asm void NativeTerminateStreamModule(void)
{
ASM_CALL_NATIVE(ETHER_TERM)
}
#else
asm void TerminateStreamModule(void)
{
ASM_TAIL_CALL_NATIVE(ETHER_TERM)
}
#endif
/*
* DLPI functions
*/
#ifndef BUILD_ETHER_FULL_DRIVER
static asm int ether_open(register queue_t *rdq, register void *dev, register int flag, register int sflag, register void *creds)
{
ASM_TAIL_CALL_NATIVE(ETHER_OPEN)
}
static asm int ether_close(register queue_t *rdq, register int flag, register void *creds)
{
ASM_TAIL_CALL_NATIVE(ETHER_CLOSE)
}
static asm int ether_wput(register queue_t *q, register msgb *mp)
{
ASM_TAIL_CALL_NATIVE(ETHER_WPUT)
}
static asm int ether_rsrv(register queue_t *q)
{
ASM_TAIL_CALL_NATIVE(ETHER_RSRV)
}
#endif
/*
* Hooks to add-on low-level functions
*/
asm void AO_get_ethernet_address(register uint32)
{
ASM_CALL_NATIVE(ETHER_AO_GET_HWADDR)
}
asm void AO_enable_multicast(register uint32 addr)
{
ASM_CALL_NATIVE(ETHER_AO_ADD_MULTI)
}
asm void AO_disable_multicast(register uint32 addr)
{
ASM_CALL_NATIVE(ETHER_AO_DEL_MULTI)
}
asm void AO_transmit_packet(register uint32 mp)
{
ASM_CALL_NATIVE(ETHER_AO_SEND_PACKET)
}

View File

@ -1 +0,0 @@
#ifndef CPU_EMULATION_H #define CPU_EMULATION_H static inline uint32 ReadMacInt32(uint32 addr) {return *(uint32 *)addr;} static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} static inline void *Mac2Host_memcpy(uint8 *dst, uint32 src, size_t n) {return memcpy(dst,Mac2HostAddr(src),n);} #endif /* CPU_EMULATION */

View File

@ -1 +0,0 @@
#ifndef DEBUG_H #define DEBUG_H #define D(x) #include <stdio.h> #define bug printf #endif /* DEBUG_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,113 +0,0 @@
/*
* ether.h - SheepShaver Ethernet Device Driver
*
* SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ETHER_H
#define ETHER_H
struct queue;
struct msgb;
typedef struct queue queue_t;
typedef struct msgb mblk_t;
// Prototypes for exported functions
extern "C" {
#pragma export on
extern uint32 ValidateHardware(void *theID);
struct install_info;
extern install_info* GetOTInstallInfo();
extern uint8 InitStreamModule(void *theID);
extern void TerminateStreamModule(void);
#pragma export off
}
extern bool NativeInitStreamModule(void *);
extern void NativeTerminateStreamModule(void);
extern int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds);
extern int ether_close(queue_t *rdq, int flag, void *creds);
extern int ether_wput(queue_t *q, mblk_t *mp);
extern int ether_rsrv(queue_t *q);
// System specific and internal functions/data
extern void EtherInit(void);
extern void EtherExit(void);
extern void EtherIRQ(void);
extern void AO_get_ethernet_address(uint32 addr);
extern void AO_enable_multicast(uint32 addr);
extern void AO_disable_multicast(uint32 addr);
extern void AO_transmit_packet(uint32 mp);
extern mblk_t *allocb(size_t size, int pri);
extern void OTEnterInterrupt(void);
extern void OTLeaveInterrupt(void);
extern void ether_dispatch_packet(uint32 p, uint32 length);
extern void ether_packet_received(mblk_t *mp);
extern bool ether_driver_opened;
// Ethernet packet allocator (optimized for 32-bit platforms in real addressing mode)
class EthernetPacket {
#if SIZEOF_VOID_P == 4 && REAL_ADDRESSING
uint8 packet[1516];
public:
uint32 addr(void) const { return (uint32)packet; }
#else
uint32 packet;
public:
EthernetPacket();
~EthernetPacket();
uint32 addr(void) const { return packet; }
#endif
};
// Copy packet data from message block to linear buffer (must hold at
// least 1514 bytes), returns packet length
static inline int ether_msgb_to_buffer(uint32 mp, uint8 *p)
{
int len = 0;
while (mp) {
uint32 size = ReadMacInt32(mp + 16) - ReadMacInt32(mp + 12);
Mac2Host_memcpy(p, ReadMacInt32(mp + 12), size);
len += size;
p += size;
mp = ReadMacInt32(mp + 8);
}
return len;
}
extern int32 num_wput;
extern int32 num_error_acks;
extern int32 num_tx_packets;
extern int32 num_tx_raw_packets;
extern int32 num_tx_normal_packets;
extern int32 num_tx_buffer_full;
extern int32 num_rx_packets;
extern int32 num_ether_irq;
extern int32 num_unitdata_ind;
extern int32 num_rx_fastpath;
extern int32 num_rx_no_mem;
extern int32 num_rx_dropped;
extern int32 num_rx_stream_not_ready;
extern int32 num_rx_no_unitdata_mem;
#endif

View File

@ -1,552 +0,0 @@
/*
* ether_defs.h - Definitions for DLPI Ethernet Driver
*
* SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ETHER_DEFS_H
#define ETHER_DEFS_H
#if __MWERKS__ && __POWERPC__
#ifndef PRAGMA_ALIGN_SUPPORTED
#define PRAGMA_ALIGN_SUPPORTED 1
#endif
#define PACKED__
#else
#define PACKED__ __attribute__ ((packed))
#endif
/*
* Macros
*/
// Get pointer to the read queue, assumes 'q' is a write queue ptr
#define RD(q) (&q[-1])
// Get pointer to the write queue, assumes 'q' is a read queue ptr
#define WR(q) (&q[1])
#define OTCompare48BitAddresses(p1, p2) \
(*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \
*(const uint16*)(((const uint8*)(p1))+4) == *(const uint16*)(((const uint8*)(p2))+4) )
#define OTCopy48BitAddress(p1, p2) \
(*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \
*(uint16*)(((uint8*)(p2))+4) = *(const uint16*)(((const uint8*)(p1))+4) )
#define OTClear48BitAddress(p1) \
(*(uint32*)((uint8*)(p1)) = 0, \
*(uint16*)(((uint8*)(p1))+4) = 0 )
#define OTCompare8022SNAP(p1, p2) \
(*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \
*(((const uint8*)(p1))+4) == *(((const uint8*)(p2))+4) )
#define OTCopy8022SNAP(p1, p2) \
(*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \
*(((uint8*)(p2))+4) = *(((const uint8*)(p1))+4) )
#define OTIs48BitBroadcastAddress(p1) \
(*(uint32*)((uint8*)(p1)) == 0xffffffff && \
*(uint16*)(((uint8*)(p1))+4) == 0xffff )
#define OTSet48BitBroadcastAddress(p1) \
(*(uint32*)((uint8*)(p1)) = 0xffffffff, \
*(uint16*)(((uint8*)(p1))+4) = 0xffff )
#define OTIs48BitZeroAddress(p1) \
(*(uint32*)((uint8*)(p1)) == 0 && \
*(uint16*)(((uint8*)(p1))+4) == 0 )
/*
* Constants
*/
enum {
// Address and packet lengths
kEnetPhysicalAddressLength = 6,
k8022SAPLength = 1,
k8022DLSAPLength = 2,
k8022SNAPLength = 5,
kMaxBoundAddrLength = 6 + 2 + 5, // addr/SAP/SNAP
kEnetAndSAPAddressLength = kEnetPhysicalAddressLength + k8022DLSAPLength,
kEnetPacketHeaderLength = (2 * kEnetPhysicalAddressLength) + k8022DLSAPLength,
k8022BasicHeaderLength = 3, // SSAP/DSAP/Control
k8022SNAPHeaderLength = k8022SNAPLength + k8022BasicHeaderLength,
kMinDIXSAP = 1501,
kEnetTSDU = 1514,
// Special addresses
kSNAPSAP = 0xaa,
kMax8022SAP = 0xfe,
k8022GlobalSAP = 0xff,
kIPXSAP = 0xff,
// DLPI interface states
DL_UNBOUND = 0,
// Message types
M_DATA = 0,
M_PROTO = 1,
M_IOCTL = 14,
M_IOCACK = 129,
M_IOCNAK = 130,
M_PCPROTO = 131, // priority message
M_FLUSH = 134,
FLUSHDATA = 0,
FLUSHALL = 1,
FLUSHR = 1,
FLUSHW = 2,
FLUSHRW = 3,
// DLPI primitives
DL_INFO_REQ = 0,
DL_BIND_REQ = 1,
DL_PEER_BIND = 1,
DL_HIERARCHICAL_BIND = 2,
DL_UNBIND_REQ = 2,
DL_INFO_ACK = 3,
DL_BIND_ACK = 4,
DL_ERROR_ACK = 5,
DL_OK_ACK = 6,
DL_UNITDATA_REQ = 7,
DL_UNITDATA_IND = 8,
DL_UDERROR_IND = 9,
DL_SUBS_UNBIND_REQ = 21,
DL_SUBS_BIND_REQ = 27,
DL_SUBS_BIND_ACK = 28,
DL_ENABMULTI_REQ = 29,
DL_DISABMULTI_REQ = 30,
DL_PHYS_ADDR_REQ = 49,
DL_PHYS_ADDR_ACK = 50,
DL_FACT_PHYS_ADDR = 1,
DL_CURR_PHYS_ADDR = 2,
// DLPI states
DL_IDLE = 3,
// DLPI error codes
DL_BADADDR = 1, // improper address format
DL_OUTSTATE = 3, // improper state
DL_SYSERR = 4, // UNIX system error
DL_UNSUPPORTED = 7, // service unsupported
DL_BADPRIM = 9, // primitive unknown
DL_NOTSUPPORTED = 18, // primitive not implemented
DL_TOOMANY = 19, // limit exceeded
// errnos
MAC_ENXIO = 6,
MAC_ENOMEM = 12,
MAC_EINVAL = 22,
// Various DLPI constants
DL_CLDLS = 2, // connectionless data link service
DL_STYLE1 = 0x500,
DL_VERSION_2 = 2,
DL_CSMACD = 0,
DL_ETHER = 4,
DL_UNKNOWN = -1,
// ioctl() codes
I_OTSetFramingType = (('O' << 8) | 2),
kOTGetFramingValue = -1,
kOTFramingEthernet = 1,
kOTFramingEthernetIPX = 2,
kOTFramingEthernet8023 = 4,
kOTFraming8022 = 8,
I_OTSetRawMode = (('O' << 8) | 3),
DL_IOC_HDR_INFO = (('l' << 8) | 10),
// Buffer allocation priority
BPRI_LO = 1,
BPRI_HI = 3,
// Misc constants
kEnetModuleID = 7101
};
enum EAddrType {
keaStandardAddress = 0,
keaMulticast,
keaBroadcast,
keaBadAddress
};
/*
* Data member wrappers
*/
// Forward declarations
struct datab;
struct msgb;
struct queue;
struct multicast_node;
struct DLPIStream;
// Optimize for 32-bit big endian targets
#if defined(WORDS_BIGENDIAN) && (SIZEOF_VOID_P == 4)
// Predefined member types
typedef int8 nw_int8;
typedef int16 nw_int16;
typedef int32 nw_int32;
typedef uint8 nw_uint8;
typedef uint16 nw_uint16;
typedef uint32 nw_uint32;
typedef int nw_bool;
typedef uint8 * nw_uint8_p;
typedef void * nw_void_p;
typedef datab * nw_datab_p;
typedef msgb * nw_msgb_p;
typedef queue * nw_queue_p;
typedef multicast_node *nw_multicast_node_p;
typedef DLPIStream * nw_DLPIStream_p;
#else
// Big-endian memory accessor
template< int nbytes >
struct nw_memory_helper;
template<>
struct nw_memory_helper<1> {
static inline uint8 load(void *ptr) { return *((uint8 *)ptr); }
static inline void store(void *ptr, uint8 val) { *((uint8 *)ptr) = val; }
};
template<>
struct nw_memory_helper<2> {
static inline uint16 load(void *ptr) { return ntohs(*((uint16 *)ptr)); }
static inline void store(void *ptr, uint16 val) { *((uint16 *)ptr) = htons(val); }
};
template<>
struct nw_memory_helper<4> {
static inline uint32 load(void *ptr) { return ntohl(*((uint32 *)ptr)); }
static inline void store(void *ptr, uint32 val) { *((uint32 *)ptr) = htonl(val); }
};
// Scalar data member wrapper (specialise for pointer member types?)
template< class type, class public_type >
class nw_scalar_member_helper {
uint8 _pad[sizeof(type)];
public:
operator public_type () const {
return (public_type)(uintptr)nw_memory_helper<sizeof(type)>::load((void *)this);
}
public_type operator -> () const {
return this->operator public_type ();
}
nw_scalar_member_helper<type, public_type> & operator = (public_type val) {
nw_memory_helper<sizeof(type)>::store((void *)this, (type)(uintptr)val);
return *this;
}
nw_scalar_member_helper<type, public_type> & operator += (int val) {
*this = *this + val;
return *this;
}
nw_scalar_member_helper<type, public_type> & operator -= (int val) {
*this = *this - val;
return *this;
}
nw_scalar_member_helper<type, public_type> & operator &= (int val) {
*this = *this & val;
return *this;
}
nw_scalar_member_helper<type, public_type> & operator |= (int val) {
*this = *this | val;
return *this;
}
};
// Predefined member types
typedef nw_scalar_member_helper<uint8, int8> nw_int8;
typedef nw_scalar_member_helper<uint16, int16> nw_int16;
typedef nw_scalar_member_helper<uint32, int32> nw_int32;
typedef nw_scalar_member_helper<uint8, uint8> nw_uint8;
typedef nw_scalar_member_helper<uint16, uint16> nw_uint16;
typedef nw_scalar_member_helper<uint32, uint32> nw_uint32;
typedef nw_scalar_member_helper<int, bool> nw_bool;
typedef nw_scalar_member_helper<uint32, uint8 *> nw_uint8_p;
typedef nw_scalar_member_helper<uint32, void *> nw_void_p;
typedef nw_scalar_member_helper<uint32, datab *> nw_datab_p;
typedef nw_scalar_member_helper<uint32, msgb *> nw_msgb_p;
typedef nw_scalar_member_helper<uint32, queue *> nw_queue_p;
typedef nw_scalar_member_helper<uint32, multicast_node *> nw_multicast_node_p;
typedef nw_scalar_member_helper<uint32, DLPIStream *> nw_DLPIStream_p;
#endif
/*
* Structures
*/
// Data block
struct datab {
nw_datab_p db_freep;
nw_uint8_p db_base;
nw_uint8_p db_lim;
nw_uint8 db_ref;
nw_uint8 db_type;
// ...
};
// Message block
struct msgb {
nw_msgb_p b_next;
nw_msgb_p b_prev;
nw_msgb_p b_cont;
nw_uint8_p b_rptr;
nw_uint8_p b_wptr;
nw_datab_p b_datap;
// ...
};
// Queue (full structure required because of size)
struct queue {
nw_void_p q_qinfo;
nw_msgb_p q_first;
nw_msgb_p q_last;
nw_queue_p q_next;
nw_queue_p q_link;
nw_DLPIStream_p q_ptr;
nw_uint32 q_count;
nw_int32 q_minpsz;
nw_int32 q_maxpsz;
nw_uint32 q_hiwat;
nw_uint32 q_lowat;
nw_void_p q_bandp;
nw_uint16 q_flag;
nw_uint8 q_nband;
uint8 _q_pad1[1];
nw_void_p q_osx;
nw_queue_p q_ffcp;
nw_queue_p q_bfcp;
};
typedef struct queue queue_t;
// M_IOCTL parameters
struct iocblk {
nw_int32 ioc_cmd;
nw_void_p ioc_cr;
nw_uint32 ioc_id;
nw_uint32 ioc_count;
nw_int32 ioc_error;
nw_int32 ioc_rval;
int32 _ioc_filler[4];
};
// Priority specification
struct dl_priority_t {
nw_int32 dl_min, dl_max;
};
// DPLI primitives
struct dl_info_req_t {
nw_uint32 dl_primitive; // DL_INFO_REQ
};
struct dl_info_ack_t {
nw_uint32 dl_primitive; // DL_INFO_ACK
nw_uint32 dl_max_sdu;
nw_uint32 dl_min_sdu;
nw_uint32 dl_addr_length;
nw_uint32 dl_mac_type;
nw_uint32 dl_reserved;
nw_uint32 dl_current_state;
nw_int32 dl_sap_length;
nw_uint32 dl_service_mode;
nw_uint32 dl_qos_length;
nw_uint32 dl_qos_offset;
nw_uint32 dl_qos_range_length;
nw_uint32 dl_qos_range_offset;
nw_uint32 dl_provider_style;
nw_uint32 dl_addr_offset;
nw_uint32 dl_version;
nw_uint32 dl_brdcst_addr_length;
nw_uint32 dl_brdcst_addr_offset;
nw_uint32 dl_growth;
};
struct dl_bind_req_t {
nw_uint32 dl_primitive; // DL_BIND_REQ
nw_uint32 dl_sap;
nw_uint32 dl_max_conind;
nw_uint16 dl_service_mode;
nw_uint16 dl_conn_mgmt;
nw_uint32 dl_xidtest_flg;
};
struct dl_bind_ack_t {
nw_uint32 dl_primitive; // DL_BIND_ACK
nw_uint32 dl_sap;
nw_uint32 dl_addr_length;
nw_uint32 dl_addr_offset;
nw_uint32 dl_max_conind;
nw_uint32 dl_xidtest_flg;
};
struct dl_error_ack_t {
nw_uint32 dl_primitive; // DL_ERROR_ACK
nw_uint32 dl_error_primitive;
nw_uint32 dl_errno;
nw_uint32 dl_unix_errno;
};
struct dl_ok_ack_t {
nw_uint32 dl_primitive; // DL_ERROR_ACK
nw_uint32 dl_correct_primitive;
};
struct dl_unitdata_req_t {
nw_uint32 dl_primitive; // DL_UNITDATA_REQ
nw_uint32 dl_dest_addr_length;
nw_uint32 dl_dest_addr_offset;
dl_priority_t dl_priority;
};
struct dl_unitdata_ind_t {
nw_uint32 dl_primitive; // DL_UNITDATA_IND
nw_uint32 dl_dest_addr_length;
nw_uint32 dl_dest_addr_offset;
nw_uint32 dl_src_addr_length;
nw_uint32 dl_src_addr_offset;
nw_uint32 dl_group_address;
};
struct dl_uderror_ind_t {
nw_uint32 dl_primitive; // DL_UDERROR_IND
nw_uint32 dl_dest_addr_length;
nw_uint32 dl_dest_addr_offset;
nw_uint32 dl_unix_errno;
nw_uint32 dl_errno;
};
struct dl_subs_bind_req_t {
nw_uint32 dl_primitive; // DL_SUBS_BIND_REQ
nw_uint32 dl_subs_sap_offset;
nw_uint32 dl_subs_sap_length;
nw_uint32 dl_subs_bind_class;
};
struct dl_subs_bind_ack_t {
nw_uint32 dl_primitive; // DL_SUBS_BIND_ACK
nw_uint32 dl_subs_sap_offset;
nw_uint32 dl_subs_sap_length;
};
struct dl_subs_unbind_req_t {
nw_uint32 dl_primitive; // DL_SUBS_UNBIND_REQ
nw_uint32 dl_subs_sap_offset;
nw_uint32 dl_subs_sap_length;
};
struct dl_enabmulti_req_t {
nw_uint32 dl_primitive; // DL_ENABMULTI_REQ
nw_uint32 dl_addr_length;
nw_uint32 dl_addr_offset;
};
struct dl_disabmulti_req_t {
nw_uint32 dl_primitive; // DL_DISABMULTI_REQ
nw_uint32 dl_addr_length;
nw_uint32 dl_addr_offset;
};
struct dl_phys_addr_req_t {
nw_uint32 dl_primitive; // DL_PHYS_ADDR_REQ
nw_uint32 dl_addr_type;
};
struct dl_phys_addr_ack_t {
nw_uint32 dl_primitive; // DL_PHYS_ADDR_ACK
nw_uint32 dl_addr_length;
nw_uint32 dl_addr_offset;
};
// Parameters for I_OTSetRawMode/kOTSetRecvMode ioctl()
struct dl_recv_control_t {
nw_uint32 dl_primitive;
nw_uint32 dl_flags;
nw_uint32 dl_truncation_length;
};
union DL_primitives {
nw_uint32 dl_primitive;
dl_info_req_t info_req;
dl_info_ack_t info_ack;
dl_bind_req_t bind_req;
dl_bind_ack_t bind_ack;
dl_error_ack_t error_ack;
dl_ok_ack_t ok_ack;
dl_unitdata_req_t unitdata_req;
dl_unitdata_ind_t unitdata_ind;
dl_uderror_ind_t uderror_ind;
dl_subs_bind_req_t subs_bind_req;
dl_subs_bind_ack_t subs_bind_ack;
dl_subs_unbind_req_t subs_unbind_req;
dl_enabmulti_req_t enabmulti_req;
dl_disabmulti_req_t disabmulti_req;
dl_phys_addr_req_t phys_addr_req;
dl_phys_addr_ack_t phys_addr_ack;
};
#ifdef PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
// Packet headers
struct EnetPacketHeader {
uint8 fDestAddr[6];
uint8 fSourceAddr[6];
nw_uint16 fProto;
} PACKED__;
struct T8022Header {
uint8 fDSAP;
uint8 fSSAP;
uint8 fCtrl;
} PACKED__;
struct T8022SNAPHeader {
uint8 fDSAP;
uint8 fSSAP;
uint8 fCtrl;
uint8 fSNAP[k8022SNAPLength];
} PACKED__;
struct T8022FullPacketHeader {
EnetPacketHeader fEnetPart;
T8022SNAPHeader f8022Part;
} PACKED__;
struct T8022AddressStruct {
uint8 fHWAddr[6];
nw_uint16 fSAP;
uint8 fSNAP[k8022SNAPLength];
} PACKED__;
#ifdef PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#endif

View File

@ -1 +0,0 @@
#include "sysdeps.h" #include "macos_util.h" #include "xlowmem.h" #include <string.h> #include <MacTypes.h> #include <CodeFragments.h> #define DEBUG 0 #include "debug.h" /* * Find symbol in shared library (using CFM) * lib and sym must be Pascal strings! */ typedef OpaqueCFragConnectionID * ConnectionID; typedef unsigned char SymClass; static uint32 FindLibSymbol(Str63 lib, Str255 sym) { ConnectionID conn_id = 0; Ptr main_addr = NULL; Str255 err = ""; Ptr sym_addr = NULL; SymClass sym_class = 0; int16 res; res = GetSharedLibrary(lib, FOURCC('p','w','p','c'), 1, &conn_id, &main_addr, err); D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id, main_addr)); if (res) return NULL; res = FindSymbol(conn_id, sym, &sym_addr, &sym_class); D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr, sym_class));//!!?? CloseConnection(&conn_id); if (res) return NULL; else return (uint32)sym_addr; } uint32 FindLibSymbol(char *lib_name, char *sym_name) { Str63 lib; memcpy(&lib[0], lib_name, lib_name[0]+1); Str255 sym; memcpy(&sym[0], sym_name, sym_name[0]+1); return FindLibSymbol(lib, sym); } /* * Memory allocators in MacOS system heap zone */ uint32 Mac_sysalloc(uint32 size) { return (uint32)NewPtrSys(size); } void Mac_sysfree(uint32 addr) { DisposePtr((char *)addr); } /* * Glue for calling MacOS routines */ #define prolog ;\ mflr r0 ;\ stw r0,8(r1) ;\ stw r2,12(r1) ;\ stwu r1,-64(r1) ;\ lwz r0,0(r3) ;\ lwz r2,4(r3) ;\ mtctr r0 #define epilog ;\ bctrl ;\ lwz r0,64+8(r1) ;\ lwz r2,64+12(r1);\ mtlr r0 ;\ addi r1,r1,64 ;\ blr asm uint32 call_macos(register uint32 tvect) { prolog epilog } asm uint32 call_macos1(register uint32 tvect, register uint32 arg1) { prolog mr r3,r4 epilog } asm uint32 call_macos2(register uint32 tvect, register uint32 arg1, register uint32 arg2) { prolog mr r3,r4 mr r4,r5 epilog } asm uint32 call_macos3(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3) { prolog mr r3,r4 mr r4,r5 mr r5,r6 epilog } asm uint32 call_macos4(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 epilog } asm uint32 call_macos5(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 epilog } asm uint32 call_macos6(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5, register uint32 arg6) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 mr r8,r9 epilog } asm uint32 call_macos7(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5, register uint32 arg6, register uint32 arg7) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 mr r8,r9 mr r9,r10 epilog } /* * Some standard C library implementations */ extern "C" void *memcpy(void *dest, const void *src, size_t n); void *memcpy(void *dest, const void *src, size_t n) { BlockMoveData(src, dest, n); return dest; } extern "C" void *memset(void *s, int c, size_t n); void *memset(void *s, int c, size_t n) { if (c == 0) BlockZero(s, n); else { char *p = (char *)s; n++; while (--n) *p++ = c; } return s; } extern "C" int memcmp(const void *s1, const void *s2, size_t n); int memcmp(const void *s1, const void *s2, size_t n) { const unsigned char *d = (const unsigned char *)s1; const unsigned char *s = (const unsigned char *)s2; n++; while (--n) { int r; if (r = (*d - *s)) return r; ++d; ++s; } return 0; } extern "C" int printf(const char *format, ...); int printf(const char *format, ...) { return 0; }

View File

@ -1 +0,0 @@
#ifndef MACOS_UTIL_H #define MACOS_UTIL_H // Macro for calling MacOS routines #define CallMacOS(type, tvect) call_macos((uintptr)tvect) #define CallMacOS1(type, tvect, arg1) call_macos1((uintptr)tvect, (uintptr)arg1) #define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uintptr)tvect, (uintptr)arg1, (uintptr)arg2) #define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3) #define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4) #define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5) #define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6) #define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6, (uintptr)arg7) #ifdef __cplusplus extern "C" { #endif extern uint32 call_macos(uint32 tvect); extern uint32 call_macos1(uint32 tvect, uint32 arg1); extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2); extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3); extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4); extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5); extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6); extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7); #ifdef __cplusplus } #endif // Construct four-character-code from string #define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) extern uint32 FindLibSymbol(char *lib, char *sym); // Find symbol in shared library extern uint32 Mac_sysalloc(uint32 size); // Allocate block in MacOS system heap zone extern void Mac_sysfree(uint32 addr); // Release block occupied by the nonrelocatable block p #endif /* MACOS_UTIL_H */

View File

@ -1 +0,0 @@
#ifndef SYSDEPS_H #define SYSDEPS_H #include <Memory.h> #define SIZEOF_VOID_P 4 #define WORDS_BIGENDIAN 1 #define REAL_ADDRESSING 1 /* Define to build the Ethernet driver completly in MacOS space */ #define BUILD_ETHER_FULL_DRIVER 1 #define ntohl(x) ((uint32)(x)) #define ntohs(x) ((uint16)(x)) #define assert(expr) typedef int bool; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef uint32 uintptr; #endif /* SYSDEPS_H */

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