mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-10 07:30:30 +00:00
- added external file system
- moved most init/deinit code to InitAll()/ExitAll() in main.cpp
This commit is contained in:
parent
c7e561c75b
commit
d92b13e550
@ -3,11 +3,17 @@ V0.7 -
|
|||||||
by an interrupt routine
|
by an interrupt routine
|
||||||
- localizable strings are now split into a common and a platform-
|
- localizable strings are now split into a common and a platform-
|
||||||
specific set
|
specific set
|
||||||
- AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation
|
- added external file system to access host OS files from the MacOS;
|
||||||
[Giacomo Magnini]
|
root directory is specified by the "extfs" prefs item
|
||||||
|
- moved most initialization/deinitialization code to InitAll() and
|
||||||
|
ExitAll() in main.cpp
|
||||||
- added patches for NetBSD [Bernd Sieker]
|
- added patches for NetBSD [Bernd Sieker]
|
||||||
- corrected TimerDateTime() in timer_unix.cpp and timer_beos.cpp
|
- corrected TimerDateTime() in timer_unix.cpp and timer_beos.cpp
|
||||||
[Toshimitsu Tanaka]
|
[Toshimitsu Tanaka]
|
||||||
|
- AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation
|
||||||
|
[Giacomo Magnini]
|
||||||
|
- Unix: compilation of cpuemu.cpp is now split in 8 parts
|
||||||
|
- Unix: volume list in GTK prefs editor is reorderable
|
||||||
|
|
||||||
V0.7 (release 0.7-2) - 6.Oct.1999
|
V0.7 (release 0.7-2) - 6.Oct.1999
|
||||||
- Added BasiliskII.spec for making RPMs [with assistance from
|
- Added BasiliskII.spec for making RPMs [with assistance from
|
||||||
|
@ -248,60 +248,16 @@ int main(void)
|
|||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check ROM version
|
|
||||||
if (!CheckROM()) {
|
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
QuitEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set CPU and FPU type
|
// Set CPU and FPU type
|
||||||
UWORD attn = SysBase->AttnFlags;
|
UWORD attn = SysBase->AttnFlags;
|
||||||
CPUType = attn & AFF_68040 ? 4 : (attn & AFF_68030 ? 3 : 2);
|
CPUType = attn & AFF_68040 ? 4 : (attn & AFF_68030 ? 3 : 2);
|
||||||
CPUIs68060 = attn & AFF_68060;
|
CPUIs68060 = attn & AFF_68060;
|
||||||
FPUType = attn & AFF_68881 ? 1 : 0;
|
FPUType = attn & AFF_68881 ? 1 : 0;
|
||||||
|
|
||||||
// Load XPRAM
|
// Initialize everything
|
||||||
XPRAMInit();
|
if (!InitAll())
|
||||||
|
|
||||||
// Set boot volume
|
|
||||||
int16 i16 = PrefsFindInt16("bootdrive");
|
|
||||||
XPRAM[0x78] = i16 >> 8;
|
|
||||||
XPRAM[0x79] = i16 & 0xff;
|
|
||||||
i16 = PrefsFindInt16("bootdriver");
|
|
||||||
XPRAM[0x7a] = i16 >> 8;
|
|
||||||
XPRAM[0x7b] = i16 & 0xff;
|
|
||||||
|
|
||||||
// Init drivers
|
|
||||||
SonyInit();
|
|
||||||
DiskInit();
|
|
||||||
CDROMInit();
|
|
||||||
SCSIInit();
|
|
||||||
|
|
||||||
// Init network
|
|
||||||
EtherInit();
|
|
||||||
|
|
||||||
// Init serial ports
|
|
||||||
SerialInit();
|
|
||||||
|
|
||||||
// Init Time Manager
|
|
||||||
TimerInit();
|
|
||||||
|
|
||||||
// Init clipboard
|
|
||||||
ClipInit();
|
|
||||||
|
|
||||||
// Init audio
|
|
||||||
AudioInit();
|
|
||||||
|
|
||||||
// Init video
|
|
||||||
if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC))
|
|
||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
|
|
||||||
// Install ROM patches
|
|
||||||
if (!PatchROM()) {
|
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
QuitEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move VBR away from 0 if neccessary
|
// Move VBR away from 0 if neccessary
|
||||||
MoveVBR();
|
MoveVBR();
|
||||||
|
|
||||||
@ -379,32 +335,8 @@ void __saveds QuitEmulator(void)
|
|||||||
// Remove trap handler
|
// Remove trap handler
|
||||||
MainTask->tc_TrapCode = OldTrapHandler;
|
MainTask->tc_TrapCode = OldTrapHandler;
|
||||||
|
|
||||||
// Save XPRAM
|
// Deinitialize everything
|
||||||
XPRAMExit();
|
ExitAll();
|
||||||
|
|
||||||
// Exit video
|
|
||||||
VideoExit();
|
|
||||||
|
|
||||||
// Exit audio
|
|
||||||
AudioExit();
|
|
||||||
|
|
||||||
// Exit clipboard
|
|
||||||
ClipExit();
|
|
||||||
|
|
||||||
// Exit Time Manager
|
|
||||||
TimerExit();
|
|
||||||
|
|
||||||
// Exit serial ports
|
|
||||||
SerialExit();
|
|
||||||
|
|
||||||
// Exit network
|
|
||||||
EtherExit();
|
|
||||||
|
|
||||||
// Exit drivers
|
|
||||||
SCSIExit();
|
|
||||||
CDROMExit();
|
|
||||||
DiskExit();
|
|
||||||
SonyExit();
|
|
||||||
|
|
||||||
// Delete RAM/ROM area
|
// Delete RAM/ROM area
|
||||||
if (RAMBaseHost)
|
if (RAMBaseHost)
|
||||||
|
@ -9,9 +9,9 @@ LIBS = LIB lib:debug.lib
|
|||||||
AFLAGS = CPU=68020
|
AFLAGS = CPU=68020
|
||||||
|
|
||||||
## Files
|
## Files
|
||||||
OBJS = prefs.o rom_patches.o slot_rom.o rsrc_patches.o emul_op.o macos_util.o \
|
OBJS = main.o prefs.o rom_patches.o slot_rom.o rsrc_patches.o emul_op.o macos_util.o \
|
||||||
xpram.o timer.o adb.o serial.o ether.o sony.o disk.o cdrom.o scsi.o \
|
xpram.o timer.o adb.o serial.o ether.o sony.o disk.o cdrom.o scsi.o \
|
||||||
video.o audio.o user_strings.o \
|
video.o audio.o extfs.o user_strings.o \
|
||||||
main_amiga.o asm_support.o prefs_amiga.o prefs_editor_amiga.o \
|
main_amiga.o asm_support.o prefs_amiga.o prefs_editor_amiga.o \
|
||||||
sys_amiga.o xpram_amiga.o timer_amiga.o clip_amiga.o serial_amiga.o \
|
sys_amiga.o xpram_amiga.o timer_amiga.o clip_amiga.o serial_amiga.o \
|
||||||
ether_amiga.o scsi_amiga.o audio_amiga.o video_amiga.o user_strings_amiga.o
|
ether_amiga.o scsi_amiga.o audio_amiga.o video_amiga.o user_strings_amiga.o
|
||||||
@ -24,6 +24,8 @@ $(APP): $(OBJS)
|
|||||||
clean:
|
clean:
|
||||||
-delete $(APP) $(OBJS)
|
-delete $(APP) $(OBJS)
|
||||||
|
|
||||||
|
main.o: /main.cpp
|
||||||
|
$(CC) $(INCLUDES) $(CFLAGS) /main.cpp
|
||||||
prefs.o: /prefs.cpp
|
prefs.o: /prefs.cpp
|
||||||
$(CC) $(INCLUDES) $(CFLAGS) /prefs.cpp
|
$(CC) $(INCLUDES) $(CFLAGS) /prefs.cpp
|
||||||
rom_patches.o: /rom_patches.cpp
|
rom_patches.o: /rom_patches.cpp
|
||||||
@ -58,6 +60,8 @@ video.o: /video.cpp
|
|||||||
$(CC) $(INCLUDES) $(CFLAGS) /video.cpp
|
$(CC) $(INCLUDES) $(CFLAGS) /video.cpp
|
||||||
audio.o: /audio.cpp
|
audio.o: /audio.cpp
|
||||||
$(CC) $(INCLUDES) $(CFLAGS) /audio.cpp
|
$(CC) $(INCLUDES) $(CFLAGS) /audio.cpp
|
||||||
|
extfs.o: /extfs.cpp
|
||||||
|
$(CC) $(INCLUDES) $(CFLAGS) /extfs.cpp
|
||||||
user_strings.o: /user_strings.cpp
|
user_strings.o: /user_strings.cpp
|
||||||
$(CC) $(INCLUDES) $(CFLAGS) /user_strings.cpp
|
$(CC) $(INCLUDES) $(CFLAGS) /user_strings.cpp
|
||||||
|
|
||||||
|
@ -54,6 +54,9 @@ typedef LONG loff_t;
|
|||||||
// Time data type for Time Manager emulation
|
// Time data type for Time Manager emulation
|
||||||
typedef struct timeval tm_time_t;
|
typedef struct timeval tm_time_t;
|
||||||
|
|
||||||
|
// Offset Mac->AmigaOS time in seconds
|
||||||
|
#define TIME_OFFSET 0x8b31ef80
|
||||||
|
|
||||||
// Endianess conversion (not needed)
|
// Endianess conversion (not needed)
|
||||||
#define ntohs(x) (x)
|
#define ntohs(x) (x)
|
||||||
#define ntohl(x) (x)
|
#define ntohl(x) (x)
|
||||||
|
@ -52,8 +52,6 @@ void Microseconds(uint32 &hi, uint32 &lo)
|
|||||||
* Return local date/time in Mac format (seconds since 1.1.1904)
|
* Return local date/time in Mac format (seconds since 1.1.1904)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uint32 TIME_OFFSET = 0x8b31ef80; // Offset Mac->Amiga time in seconds
|
|
||||||
|
|
||||||
uint32 TimerDateTime(void)
|
uint32 TimerDateTime(void)
|
||||||
{
|
{
|
||||||
ULONG secs;
|
ULONG secs;
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
user_string_def platform_strings[] = {
|
user_string_def platform_strings[] = {
|
||||||
// Common strings that have a platform-specific variant
|
// Common strings that have a platform-specific variant
|
||||||
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under AmigaOS. Basilisk II will try to unmount it."},
|
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under AmigaOS. Basilisk II will try to unmount it."},
|
||||||
|
{STR_EXTFS_CTRL, "Amiga Root"},
|
||||||
|
{STR_EXTFS_NAME, "Amiga Directory Tree"},
|
||||||
|
{STR_EXTFS_VOLUME_NAME, "Amiga"},
|
||||||
|
|
||||||
// Purely platform-specific strings
|
// Purely platform-specific strings
|
||||||
{STR_NO_PREPARE_EMUL_ERR, "PrepareEmul is not installed. Run PrepareEmul and then try again to start Basilisk II."},
|
{STR_NO_PREPARE_EMUL_ERR, "PrepareEmul is not installed. Run PrepareEmul and then try again to start Basilisk II."},
|
||||||
|
@ -39,13 +39,13 @@ else
|
|||||||
CPUSRCS = ../uae_cpu/basilisk_glue.cpp ../uae_cpu/newcpu.cpp \
|
CPUSRCS = ../uae_cpu/basilisk_glue.cpp ../uae_cpu/newcpu.cpp \
|
||||||
../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp cpuemu.cpp
|
../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp cpuemu.cpp
|
||||||
endif
|
endif
|
||||||
SRCS = main_beos.cpp ../prefs.cpp prefs_beos.cpp prefs_editor_beos.cpp sys_beos.cpp \
|
SRCS = ../main.cpp main_beos.cpp ../prefs.cpp prefs_beos.cpp prefs_editor_beos.cpp \
|
||||||
../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \
|
sys_beos.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp \
|
||||||
../macos_util.cpp ../xpram.cpp xpram_beos.cpp ../timer.cpp timer_beos.cpp \
|
../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_beos.cpp ../timer.cpp \
|
||||||
clip_beos.cpp ../adb.cpp ../serial.cpp serial_beos.cpp ../ether.cpp \
|
timer_beos.cpp clip_beos.cpp ../adb.cpp ../serial.cpp serial_beos.cpp \
|
||||||
ether_beos.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \
|
../ether.cpp ether_beos.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \
|
||||||
scsi_beos.cpp ../video.cpp video_beos.cpp ../audio.cpp audio_beos.cpp \
|
scsi_beos.cpp ../video.cpp video_beos.cpp ../audio.cpp audio_beos.cpp \
|
||||||
../user_strings.cpp user_strings_beos.cpp \
|
../extfs.cpp extfs_beos.cpp ../user_strings.cpp user_strings_beos.cpp \
|
||||||
$(CPUSRCS)
|
$(CPUSRCS)
|
||||||
|
|
||||||
# specify the resource files to use
|
# specify the resource files to use
|
||||||
|
437
BasiliskII/src/BeOS/extfs_beos.cpp
Normal file
437
BasiliskII/src/BeOS/extfs_beos.cpp
Normal file
@ -0,0 +1,437 @@
|
|||||||
|
/*
|
||||||
|
* extfs_beos.cpp - MacOS file system for access native file system access, BeOS specific stuff
|
||||||
|
*
|
||||||
|
* Basilisk II (C) 1997-1999 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 <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <fs_attr.h>
|
||||||
|
|
||||||
|
#include "sysdeps.h"
|
||||||
|
#include "extfs.h"
|
||||||
|
#include "extfs_defs.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Default Finder flags
|
||||||
|
const uint16 DEFAULT_FINDER_FLAGS = kHasBeenInited;
|
||||||
|
|
||||||
|
// Temporary buffer for transfers from/to kernel space
|
||||||
|
const int TMP_BUF_SIZE = 0x10000;
|
||||||
|
static uint8 *tmp_buf = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialization
|
||||||
|
*/
|
||||||
|
|
||||||
|
void extfs_init(void)
|
||||||
|
{
|
||||||
|
// Allocate temporary buffer
|
||||||
|
tmp_buf = new uint8[TMP_BUF_SIZE];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deinitialization
|
||||||
|
*/
|
||||||
|
|
||||||
|
void extfs_exit(void)
|
||||||
|
{
|
||||||
|
// Delete temporary buffer
|
||||||
|
delete[] tmp_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get/set finder type/creator for file specified by full path
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct mime2type {
|
||||||
|
const char *mime;
|
||||||
|
uint32 type;
|
||||||
|
uint32 creator;
|
||||||
|
bool reversible; // type -> mime translation possible
|
||||||
|
};
|
||||||
|
|
||||||
|
static const mime2type m2t_translation[] = {
|
||||||
|
{"application/x-compress", 'ZIVM', 'LZIV', true},
|
||||||
|
{"application/x-gzip", 'Gzip', 'Gzip', true},
|
||||||
|
{"application/x-macbinary", 'BINA', '????', false},
|
||||||
|
{"application/mac-binhex40", 'TEXT', 'SITx', false},
|
||||||
|
{"application/pdf", 'PDF ', 'CARO', true},
|
||||||
|
{"application/postscript", 'TEXT', 'ttxt', false},
|
||||||
|
{"application/x-stuffit", 'SIT!', 'SITx', true},
|
||||||
|
{"application/x-tar", 'TARF', 'TAR ', true},
|
||||||
|
{"application/x-uuencode", 'TEXT', 'SITx', false},
|
||||||
|
{"application/zip", 'ZIP ', 'ZIP ', true},
|
||||||
|
{"audio/x-8svx", '8SVX', 'SNDM', true},
|
||||||
|
{"audio/x-aifc", 'AIFC', 'TVOD', true},
|
||||||
|
{"audio/x-aiff", 'AIFF', 'TVOD', true},
|
||||||
|
{"audio/basic", 'ULAW', 'TVOD', true},
|
||||||
|
{"audio/x-midi", 'MIDI', 'TVOD', true},
|
||||||
|
{"audio/x-mpeg", 'MPG ', 'TVOD', true},
|
||||||
|
{"audio/x-wav", 'WAVE', 'TVOD', true},
|
||||||
|
{"image/x-bmp", 'BMPf', 'ogle', true},
|
||||||
|
{"image/gif", 'GIFf', 'ogle', true},
|
||||||
|
{"image/x-ilbm", 'ILBM', 'GKON', true},
|
||||||
|
{"image/jpeg", 'JPEG', 'ogle', true},
|
||||||
|
{"image/jpeg", 'JFIF', 'ogle', true},
|
||||||
|
{"image/x-photoshop", '8BPS', '8BIM', true},
|
||||||
|
{"image/pict", 'PICT', 'ogle', true},
|
||||||
|
{"image/png", 'PNGf', 'ogle', true},
|
||||||
|
{"image/x-sgi", '.SGI', 'ogle', true},
|
||||||
|
{"image/x-targa", 'TPIC', 'ogle', true},
|
||||||
|
{"image/tiff", 'TIFF', 'ogle', true},
|
||||||
|
{"text/html", 'TEXT', 'MOSS', false},
|
||||||
|
{"text/plain", 'TEXT', 'ttxt', true},
|
||||||
|
{"text/rtf", 'TEXT', 'MSWD', false},
|
||||||
|
{"text/x-source-code", 'TEXT', 'R*ch', false},
|
||||||
|
{"video/mpeg", 'MPEG', 'TVOD', true},
|
||||||
|
{"video/quicktime", 'MooV', 'TVOD', true},
|
||||||
|
{"video/x-flc", 'FLI ', 'TVOD', true},
|
||||||
|
{"video/x-msvideo", 'VfW ', 'TVOD', true},
|
||||||
|
{NULL, 0, 0, false} // End marker
|
||||||
|
};
|
||||||
|
|
||||||
|
void get_finder_type(const char *path, uint32 &type, uint32 &creator)
|
||||||
|
{
|
||||||
|
type = 0;
|
||||||
|
creator = 0;
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
int fd = open(path, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Read BeOS MIME type and close file
|
||||||
|
char mime[256];
|
||||||
|
ssize_t actual = fs_read_attr(fd, "BEOS:TYPE", B_MIME_STRING_TYPE, 0, mime, 256);
|
||||||
|
mime[255] = 0;
|
||||||
|
|
||||||
|
if (actual > 0) {
|
||||||
|
|
||||||
|
// Translate MIME type to MacOS type/creator
|
||||||
|
char mactype[4];
|
||||||
|
if (sscanf(mime, "application/x-MacOS-%c%c%c%c", mactype, mactype+1, mactype+2, mactype+3) == 4) {
|
||||||
|
|
||||||
|
// MacOS style type
|
||||||
|
memcpy(&type, mactype, 4);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// MIME string, look in table
|
||||||
|
for (int i=0; m2t_translation[i].mime; i++) {
|
||||||
|
if (!strcmp(mime, m2t_translation[i].mime)) {
|
||||||
|
type = m2t_translation[i].type;
|
||||||
|
creator = m2t_translation[i].creator;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override file type with MACOS:CREATOR attribute
|
||||||
|
fs_read_attr(fd, "MACOS:CREATOR", B_UINT32_TYPE, 0, &creator, 4);
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_finder_type(const char *path, uint32 type, uint32 creator)
|
||||||
|
{
|
||||||
|
// Open file
|
||||||
|
int fd = open(path, O_WRONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Set BEOS:TYPE attribute
|
||||||
|
if (type) {
|
||||||
|
bool written = false;
|
||||||
|
for (int i=0; m2t_translation[i].mime; i++) {
|
||||||
|
if (m2t_translation[i].type == type && m2t_translation[i].reversible) {
|
||||||
|
fs_write_attr(fd, "BEOS:TYPE", B_MIME_STRING_TYPE, 0, m2t_translation[i].mime, strlen(m2t_translation[i].mime) + 1);
|
||||||
|
written = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!written) {
|
||||||
|
char mime[256];
|
||||||
|
sprintf(mime, "application/x-MacOS-%c%c%c%c", type >> 24, type >> 16, type >> 8, type);
|
||||||
|
fs_write_attr(fd, "BEOS:TYPE", B_MIME_STRING_TYPE, 0, mime, strlen(mime) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set MACOS:CREATOR attribute
|
||||||
|
if (creator)
|
||||||
|
fs_write_attr(fd, "MACOS:CREATOR", B_UINT32_TYPE, 0, &creator, 4);
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get/set finder flags for file/dir specified by full path (MACOS:HFS_FLAGS attribute)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void get_finder_flags(const char *path, uint16 &flags)
|
||||||
|
{
|
||||||
|
flags = DEFAULT_FINDER_FLAGS; // Default
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
int fd = open(path, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Read MACOS:HFS_FLAGS attribute
|
||||||
|
fs_read_attr(fd, "MACOS:HFS_FLAGS", B_UINT16_TYPE, 0, &flags, 2);
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_finder_flags(const char *path, uint16 flags)
|
||||||
|
{
|
||||||
|
// Open file
|
||||||
|
int fd = open(path, O_WRONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Write MACOS:HFS_FLAGS attribute
|
||||||
|
if (flags != DEFAULT_FINDER_FLAGS)
|
||||||
|
fs_write_attr(fd, "MACOS:HFS_FLAGS", B_UINT16_TYPE, 0, &flags, 2);
|
||||||
|
else
|
||||||
|
fs_remove_attr(fd, "MACOS:HFS_FLAGS");
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resource fork emulation functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint32 get_rfork_size(const char *path)
|
||||||
|
{
|
||||||
|
// Open file
|
||||||
|
int fd = open(path, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Get size of MACOS:RFORK attribute
|
||||||
|
struct attr_info info;
|
||||||
|
if (fs_stat_attr(fd, "MACOS:RFORK", &info) < 0)
|
||||||
|
info.size = 0;
|
||||||
|
|
||||||
|
// Close file and return size
|
||||||
|
close(fd);
|
||||||
|
return info.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int open_rfork(const char *path, int flag)
|
||||||
|
{
|
||||||
|
// Open original file
|
||||||
|
int fd = open(path, flag);
|
||||||
|
if (fd < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Open temporary file for resource fork
|
||||||
|
char rname[L_tmpnam];
|
||||||
|
tmpnam(rname);
|
||||||
|
int rfd = open(rname, O_RDWR | O_CREAT | O_TRUNC, 0664);
|
||||||
|
if (rfd < 0) {
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
unlink(rname); // File will be deleted when closed
|
||||||
|
|
||||||
|
// Get size of MACOS:RFORK attribute
|
||||||
|
struct attr_info info;
|
||||||
|
if (fs_stat_attr(fd, "MACOS:RFORK", &info) < 0)
|
||||||
|
info.size = 0;
|
||||||
|
|
||||||
|
// Copy resource data from attribute to temporary file
|
||||||
|
if (info.size > 0) {
|
||||||
|
|
||||||
|
// Allocate buffer
|
||||||
|
void *buf = malloc(info.size);
|
||||||
|
if (buf == NULL) {
|
||||||
|
close(rfd);
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
fs_read_attr(fd, "MACOS:RFORK", B_RAW_TYPE, 0, buf, info.size);
|
||||||
|
write(rfd, buf, info.size);
|
||||||
|
lseek(rfd, 0, SEEK_SET);
|
||||||
|
|
||||||
|
// Free buffer
|
||||||
|
if (buf)
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close original file
|
||||||
|
close(fd);
|
||||||
|
return rfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_rfork(const char *path, int fd)
|
||||||
|
{
|
||||||
|
if (fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get size of temporary file
|
||||||
|
struct stat st;
|
||||||
|
if (fstat(fd, &st) < 0)
|
||||||
|
st.st_size = 0;
|
||||||
|
|
||||||
|
// Open original file
|
||||||
|
int ofd = open(path, O_WRONLY);
|
||||||
|
if (ofd > 0) {
|
||||||
|
|
||||||
|
// Copy resource data to MACOS:RFORK attribute
|
||||||
|
if (st.st_size > 0) {
|
||||||
|
|
||||||
|
// Allocate buffer
|
||||||
|
void *buf = malloc(st.st_size);
|
||||||
|
if (buf == NULL) {
|
||||||
|
close(ofd);
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
lseek(fd, 0, SEEK_SET);
|
||||||
|
read(fd, buf, st.st_size);
|
||||||
|
fs_write_attr(ofd, "MACOS:RFORK", B_RAW_TYPE, 0, buf, st.st_size);
|
||||||
|
|
||||||
|
// Free buffer
|
||||||
|
if (buf)
|
||||||
|
free(buf);
|
||||||
|
|
||||||
|
} else
|
||||||
|
fs_remove_attr(ofd, "MACOS:RFORK");
|
||||||
|
|
||||||
|
// Close original file
|
||||||
|
close(ofd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close temporary file
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read "length" bytes from file to "buffer",
|
||||||
|
* returns number of bytes read (or 0)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline ssize_t sread(int fd, void *buf, size_t count)
|
||||||
|
{
|
||||||
|
ssize_t res;
|
||||||
|
while ((res = read(fd, buf, count)) == B_INTERRUPTED) ;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t extfs_read(int fd, void *buffer, size_t length)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
// Buffer in kernel space?
|
||||||
|
size_t actual = 0;
|
||||||
|
if ((uint32)buffer < 0x80000000) {
|
||||||
|
|
||||||
|
// Yes, transfer via buffer
|
||||||
|
while (length) {
|
||||||
|
size_t transfer_size = (length > TMP_BUF_SIZE) ? TMP_BUF_SIZE : length;
|
||||||
|
ssize_t res = sread(fd, tmp_buf, transfer_size);
|
||||||
|
if (res >= 0) {
|
||||||
|
memcpy(buffer, tmp_buf, res);
|
||||||
|
buffer = (void *)((uint8 *)buffer + res);
|
||||||
|
length -= res;
|
||||||
|
actual += res;
|
||||||
|
}
|
||||||
|
if (res != transfer_size)
|
||||||
|
return actual;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// No, transfer directly
|
||||||
|
actual = sread(fd, buffer, length);
|
||||||
|
if (actual < 0)
|
||||||
|
actual = 0;
|
||||||
|
}
|
||||||
|
return actual;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write "length" bytes from "buffer" to file,
|
||||||
|
* returns number of bytes written (or 0)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline ssize_t swrite(int fd, void *buf, size_t count)
|
||||||
|
{
|
||||||
|
ssize_t res;
|
||||||
|
while ((res = write(fd, buf, count)) == B_INTERRUPTED) ;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t extfs_write(int fd, void *buffer, size_t length)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
// Buffer in kernel space?
|
||||||
|
size_t actual = 0;
|
||||||
|
if ((uint32)buffer < 0x80000000) {
|
||||||
|
|
||||||
|
// Yes, transfer via buffer
|
||||||
|
while (length) {
|
||||||
|
size_t transfer_size = (length > TMP_BUF_SIZE) ? TMP_BUF_SIZE : length;
|
||||||
|
memcpy(tmp_buf, buffer, transfer_size);
|
||||||
|
ssize_t res = swrite(fd, tmp_buf, transfer_size);
|
||||||
|
if (res >= 0) {
|
||||||
|
buffer = (void *)((uint8 *)buffer + res);
|
||||||
|
length -= res;
|
||||||
|
actual += res;
|
||||||
|
}
|
||||||
|
if (res != transfer_size)
|
||||||
|
return actual;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// No, transfer directly
|
||||||
|
actual = swrite(fd, buffer, length);
|
||||||
|
if (actual < 0)
|
||||||
|
actual = 0;
|
||||||
|
}
|
||||||
|
return actual;
|
||||||
|
}
|
@ -34,15 +34,7 @@
|
|||||||
#include "cpu_emulation.h"
|
#include "cpu_emulation.h"
|
||||||
#include "xpram.h"
|
#include "xpram.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "sony.h"
|
|
||||||
#include "disk.h"
|
|
||||||
#include "cdrom.h"
|
|
||||||
#include "scsi.h"
|
|
||||||
#include "audio.h"
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "serial.h"
|
|
||||||
#include "ether.h"
|
|
||||||
#include "clip.h"
|
|
||||||
#include "rom_patches.h"
|
#include "rom_patches.h"
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "prefs_editor.h"
|
#include "prefs_editor.h"
|
||||||
@ -276,86 +268,8 @@ void BasiliskII::StartEmulator(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check ROM version
|
// Initialize everything
|
||||||
if (!CheckROM()) {
|
if (!InitAll()) {
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set CPU and FPU type (UAE emulation)
|
|
||||||
switch (ROMVersion) {
|
|
||||||
case ROM_VERSION_64K:
|
|
||||||
case ROM_VERSION_PLUS:
|
|
||||||
case ROM_VERSION_CLASSIC:
|
|
||||||
CPUType = 0;
|
|
||||||
FPUType = 0;
|
|
||||||
TwentyFourBitAddressing = true;
|
|
||||||
break;
|
|
||||||
case ROM_VERSION_II:
|
|
||||||
CPUType = 2;
|
|
||||||
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
|
||||||
TwentyFourBitAddressing = true;
|
|
||||||
break;
|
|
||||||
case ROM_VERSION_32:
|
|
||||||
CPUType = 3;
|
|
||||||
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
|
||||||
TwentyFourBitAddressing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CPUIs68060 = false;
|
|
||||||
|
|
||||||
// Load XPRAM
|
|
||||||
XPRAMInit();
|
|
||||||
|
|
||||||
// Set boot volume
|
|
||||||
int16 i16 = PrefsFindInt16("bootdrive");
|
|
||||||
XPRAM[0x78] = i16 >> 8;
|
|
||||||
XPRAM[0x79] = i16 & 0xff;
|
|
||||||
i16 = PrefsFindInt16("bootdriver");
|
|
||||||
XPRAM[0x7a] = i16 >> 8;
|
|
||||||
XPRAM[0x7b] = i16 & 0xff;
|
|
||||||
|
|
||||||
// Start XPRAM watchdog thread
|
|
||||||
xpram_thread = spawn_thread(xpram_func, "XPRAM Watchdog", B_LOW_PRIORITY, this);
|
|
||||||
resume_thread(xpram_thread);
|
|
||||||
|
|
||||||
// Init drivers
|
|
||||||
SonyInit();
|
|
||||||
DiskInit();
|
|
||||||
CDROMInit();
|
|
||||||
SCSIInit();
|
|
||||||
|
|
||||||
// Init network
|
|
||||||
EtherInit();
|
|
||||||
|
|
||||||
// Init serial ports
|
|
||||||
SerialInit();
|
|
||||||
|
|
||||||
// Init Time Manager
|
|
||||||
TimerInit();
|
|
||||||
|
|
||||||
// Init clipboard
|
|
||||||
ClipInit();
|
|
||||||
|
|
||||||
// Init audio
|
|
||||||
AudioInit();
|
|
||||||
|
|
||||||
// Init video
|
|
||||||
if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC)) {
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
|
|
||||||
if (!Init680x0()) {
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Install ROM patches
|
|
||||||
if (!PatchROM()) {
|
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -366,6 +280,10 @@ void BasiliskII::StartEmulator(void)
|
|||||||
// Disallow quitting with Alt-Q from now on
|
// Disallow quitting with Alt-Q from now on
|
||||||
AllowQuitting = false;
|
AllowQuitting = false;
|
||||||
|
|
||||||
|
// Start XPRAM watchdog thread
|
||||||
|
xpram_thread = spawn_thread(xpram_func, "XPRAM Watchdog", B_LOW_PRIORITY, this);
|
||||||
|
resume_thread(xpram_thread);
|
||||||
|
|
||||||
// Start 60Hz interrupt
|
// Start 60Hz interrupt
|
||||||
tick_thread = spawn_thread(tick_func, "60Hz", B_REAL_TIME_PRIORITY, this);
|
tick_thread = spawn_thread(tick_func, "60Hz", B_REAL_TIME_PRIORITY, this);
|
||||||
resume_thread(tick_thread);
|
resume_thread(tick_thread);
|
||||||
@ -421,32 +339,8 @@ void BasiliskII::Quit(void)
|
|||||||
wait_for_thread(xpram_thread, &l);
|
wait_for_thread(xpram_thread, &l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save XPRAM
|
// Deinitialize everything
|
||||||
XPRAMExit();
|
ExitAll();
|
||||||
|
|
||||||
// Exit video
|
|
||||||
VideoExit();
|
|
||||||
|
|
||||||
// Exit audio
|
|
||||||
AudioExit();
|
|
||||||
|
|
||||||
// Exit clipboard
|
|
||||||
ClipExit();
|
|
||||||
|
|
||||||
// Exit Time Manager
|
|
||||||
TimerExit();
|
|
||||||
|
|
||||||
// Exit serial ports
|
|
||||||
SerialExit();
|
|
||||||
|
|
||||||
// Exit network
|
|
||||||
EtherExit();
|
|
||||||
|
|
||||||
// Exit drivers
|
|
||||||
SCSIExit();
|
|
||||||
CDROMExit();
|
|
||||||
DiskExit();
|
|
||||||
SonyExit();
|
|
||||||
|
|
||||||
// Delete ROM area
|
// Delete ROM area
|
||||||
if (rom_area >= 0)
|
if (rom_area >= 0)
|
||||||
|
@ -87,4 +87,5 @@ void SavePrefs(void)
|
|||||||
|
|
||||||
void AddPlatformPrefsDefaults(void)
|
void AddPlatformPrefsDefaults(void)
|
||||||
{
|
{
|
||||||
|
PrefsReplaceString("extfs", "/boot");
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,9 @@
|
|||||||
// Time data type for Time Manager emulation
|
// Time data type for Time Manager emulation
|
||||||
typedef bigtime_t tm_time_t;
|
typedef bigtime_t tm_time_t;
|
||||||
|
|
||||||
|
// Offset Mac->BeOS time in seconds
|
||||||
|
#define TIME_OFFSET 0x7c25b080
|
||||||
|
|
||||||
// 64 bit file offsets
|
// 64 bit file offsets
|
||||||
typedef off_t loff_t;
|
typedef off_t loff_t;
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ void Microseconds(uint32 &hi, uint32 &lo)
|
|||||||
* Return local date/time in Mac format (seconds since 1.1.1904)
|
* Return local date/time in Mac format (seconds since 1.1.1904)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->BeOS time in seconds
|
|
||||||
|
|
||||||
uint32 TimerDateTime(void)
|
uint32 TimerDateTime(void)
|
||||||
{
|
{
|
||||||
time_t utc_now = time(NULL);
|
time_t utc_now = time(NULL);
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
user_string_def platform_strings[] = {
|
user_string_def platform_strings[] = {
|
||||||
// Common strings that have a platform-specific variant
|
// 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_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
|
// Purely platform-specific strings
|
||||||
{STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). Basilisk II is not properly installed."},
|
{STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). Basilisk II is not properly installed."},
|
||||||
|
@ -26,12 +26,12 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
|
|||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
## Files
|
## Files
|
||||||
SRCS = main_unix.cpp ../prefs.cpp prefs_unix.cpp sys_unix.cpp ../rom_patches.cpp \
|
SRCS = ../main.cpp main_unix.cpp ../prefs.cpp prefs_unix.cpp sys_unix.cpp \
|
||||||
../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp ../macos_util.cpp \
|
../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \
|
||||||
../xpram.cpp xpram_unix.cpp ../timer.cpp timer_unix.cpp clip_unix.cpp \
|
../macos_util.cpp ../xpram.cpp xpram_unix.cpp ../timer.cpp timer_unix.cpp \
|
||||||
../adb.cpp ../serial.cpp serial_unix.cpp ../ether.cpp ../sony.cpp \
|
clip_unix.cpp ../adb.cpp ../serial.cpp serial_unix.cpp ../ether.cpp ../sony.cpp \
|
||||||
../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp video_x.cpp ../audio.cpp \
|
../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp video_x.cpp ../audio.cpp \
|
||||||
../user_strings.cpp user_strings_unix.cpp \
|
../extfs.cpp extfs_unix.cpp ../user_strings.cpp user_strings_unix.cpp \
|
||||||
$(SYSSRCS) $(CPUSRCS)
|
$(SYSSRCS) $(CPUSRCS)
|
||||||
APP = BasiliskII
|
APP = BasiliskII
|
||||||
|
|
||||||
|
200
BasiliskII/src/Unix/extfs_unix.cpp
Normal file
200
BasiliskII/src/Unix/extfs_unix.cpp
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
/*
|
||||||
|
* extfs_unix.cpp - MacOS file system for access native file system access, Unix specific stuff
|
||||||
|
*
|
||||||
|
* Basilisk II (C) 1997-1999 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 <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "sysdeps.h"
|
||||||
|
#include "extfs.h"
|
||||||
|
#include "extfs_defs.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Default Finder flags
|
||||||
|
const uint16 DEFAULT_FINDER_FLAGS = kHasBeenInited;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialization
|
||||||
|
*/
|
||||||
|
|
||||||
|
void extfs_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deinitialization
|
||||||
|
*/
|
||||||
|
|
||||||
|
void extfs_exit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get/set finder type/creator for file specified by full path
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct ext2type {
|
||||||
|
const char *ext;
|
||||||
|
uint32 type;
|
||||||
|
uint32 creator;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const ext2type e2t_translation[] = {
|
||||||
|
{".z", 'ZIVM', 'LZIV'},
|
||||||
|
{".gz", 'Gzip', 'Gzip'},
|
||||||
|
{".hqx", 'TEXT', 'SITx'},
|
||||||
|
{".pdf", 'PDF ', 'CARO'},
|
||||||
|
{".ps", 'TEXT', 'ttxt'},
|
||||||
|
{".sit", 'SIT!', 'SITx'},
|
||||||
|
{".tar", 'TARF', 'TAR '},
|
||||||
|
{".uu", 'TEXT', 'SITx'},
|
||||||
|
{".uue", 'TEXT', 'SITx'},
|
||||||
|
{".zip", 'ZIP ', 'ZIP '},
|
||||||
|
{".8svx", '8SVX', 'SNDM'},
|
||||||
|
{".aifc", 'AIFC', 'TVOD'},
|
||||||
|
{".aiff", 'AIFF', 'TVOD'},
|
||||||
|
{".au", 'ULAW', 'TVOD'},
|
||||||
|
{".mid", 'MIDI', 'TVOD'},
|
||||||
|
{".midi", 'MIDI', 'TVOD'},
|
||||||
|
{".mp2", 'MPG ', 'TVOD'},
|
||||||
|
{".mp3", 'MPG ', 'TVOD'},
|
||||||
|
{".wav", 'WAVE', 'TVOD'},
|
||||||
|
{".bmp", 'BMPf', 'ogle'},
|
||||||
|
{".gif", 'GIFf', 'ogle'},
|
||||||
|
{".lbm", 'ILBM', 'GKON'},
|
||||||
|
{".ilbm", 'ILBM', 'GKON'},
|
||||||
|
{".jpg", 'JPEG', 'ogle'},
|
||||||
|
{".jpeg", 'JPEG', 'ogle'},
|
||||||
|
{".pict", 'PICT', 'ogle'},
|
||||||
|
{".png", 'PNGf', 'ogle'},
|
||||||
|
{".sgi", '.SGI', 'ogle'},
|
||||||
|
{".tga", 'TPIC', 'ogle'},
|
||||||
|
{".tif", 'TIFF', 'ogle'},
|
||||||
|
{".tiff", 'TIFF', 'ogle'},
|
||||||
|
{".html", 'TEXT', 'MOSS'},
|
||||||
|
{".txt", 'TEXT', 'ttxt'},
|
||||||
|
{".rtf", 'TEXT', 'MSWD'},
|
||||||
|
{".c", 'TEXT', 'R*ch'},
|
||||||
|
{".cc", 'TEXT', 'R*ch'},
|
||||||
|
{".cpp", 'TEXT', 'R*ch'},
|
||||||
|
{".cxx", 'TEXT', 'R*ch'},
|
||||||
|
{".h", 'TEXT', 'R*ch'},
|
||||||
|
{".hh", 'TEXT', 'R*ch'},
|
||||||
|
{".hpp", 'TEXT', 'R*ch'},
|
||||||
|
{".hxx", 'TEXT', 'R*ch'},
|
||||||
|
{".s", 'TEXT', 'R*ch'},
|
||||||
|
{".i", 'TEXT', 'R*ch'},
|
||||||
|
{".mpg", 'MPEG', 'TVOD'},
|
||||||
|
{".mpeg", 'MPEG', 'TVOD'},
|
||||||
|
{".mov", 'MooV', 'TVOD'},
|
||||||
|
{".fli", 'FLI ', 'TVOD'},
|
||||||
|
{".avi", 'VfW ', 'TVOD'},
|
||||||
|
{NULL, 0, 0} // End marker
|
||||||
|
};
|
||||||
|
|
||||||
|
void get_finder_type(const char *path, uint32 &type, uint32 &creator)
|
||||||
|
{
|
||||||
|
type = 0;
|
||||||
|
creator = 0;
|
||||||
|
|
||||||
|
// Translate file name extension to MacOS type/creator
|
||||||
|
int path_len = strlen(path);
|
||||||
|
for (int i=0; e2t_translation[i].ext; i++) {
|
||||||
|
int ext_len = strlen(e2t_translation[i].ext);
|
||||||
|
if (path_len < ext_len)
|
||||||
|
continue;
|
||||||
|
if (!strcmp(path + path_len - ext_len, e2t_translation[i].ext)) {
|
||||||
|
type = e2t_translation[i].type;
|
||||||
|
creator = e2t_translation[i].creator;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_finder_type(const char *path, uint32 type, uint32 creator)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get/set finder flags for file/dir specified by full path (MACOS:HFS_FLAGS attribute)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void get_finder_flags(const char *path, uint16 &flags)
|
||||||
|
{
|
||||||
|
flags = DEFAULT_FINDER_FLAGS; // Default
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_finder_flags(const char *path, uint16 flags)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resource fork emulation functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint32 get_rfork_size(const char *path)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int open_rfork(const char *path, int flag)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_rfork(const char *path, int fd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read "length" bytes from file to "buffer",
|
||||||
|
* returns number of bytes read (or 0)
|
||||||
|
*/
|
||||||
|
|
||||||
|
size_t extfs_read(int fd, void *buffer, size_t length)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
return read(fd, buffer, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write "length" bytes from "buffer" to file,
|
||||||
|
* returns number of bytes written (or 0)
|
||||||
|
*/
|
||||||
|
|
||||||
|
size_t extfs_write(int fd, void *buffer, size_t length)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
return write(fd, buffer, length);
|
||||||
|
}
|
@ -27,18 +27,10 @@
|
|||||||
|
|
||||||
#include "cpu_emulation.h"
|
#include "cpu_emulation.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
#include "rom_patches.h"
|
||||||
#include "xpram.h"
|
#include "xpram.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "sony.h"
|
|
||||||
#include "disk.h"
|
|
||||||
#include "cdrom.h"
|
|
||||||
#include "scsi.h"
|
|
||||||
#include "audio.h"
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "serial.h"
|
|
||||||
#include "ether.h"
|
|
||||||
#include "clip.h"
|
|
||||||
#include "rom_patches.h"
|
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "prefs_editor.h"
|
#include "prefs_editor.h"
|
||||||
#include "macos_util.h"
|
#include "macos_util.h"
|
||||||
@ -46,7 +38,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 0
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
@ -207,83 +199,13 @@ int main(int argc, char **argv)
|
|||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check ROM version
|
// Initialize everything
|
||||||
if (!CheckROM()) {
|
if (!InitAll())
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
}
|
|
||||||
|
|
||||||
// Set CPU and FPU type (UAE emulation)
|
|
||||||
switch (ROMVersion) {
|
|
||||||
case ROM_VERSION_64K:
|
|
||||||
case ROM_VERSION_PLUS:
|
|
||||||
case ROM_VERSION_CLASSIC:
|
|
||||||
CPUType = 0;
|
|
||||||
FPUType = 0;
|
|
||||||
TwentyFourBitAddressing = true;
|
|
||||||
break;
|
|
||||||
case ROM_VERSION_II:
|
|
||||||
CPUType = 2;
|
|
||||||
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
|
||||||
TwentyFourBitAddressing = true;
|
|
||||||
break;
|
|
||||||
case ROM_VERSION_32:
|
|
||||||
CPUType = 3;
|
|
||||||
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
|
||||||
TwentyFourBitAddressing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CPUIs68060 = false;
|
|
||||||
|
|
||||||
// Load XPRAM
|
|
||||||
XPRAMInit();
|
|
||||||
|
|
||||||
// Set boot volume
|
|
||||||
int16 i16 = PrefsFindInt16("bootdrive");
|
|
||||||
XPRAM[0x78] = i16 >> 8;
|
|
||||||
XPRAM[0x79] = i16 & 0xff;
|
|
||||||
i16 = PrefsFindInt16("bootdriver");
|
|
||||||
XPRAM[0x7a] = i16 >> 8;
|
|
||||||
XPRAM[0x7b] = i16 & 0xff;
|
|
||||||
|
|
||||||
// Start XPRAM watchdog thread
|
// Start XPRAM watchdog thread
|
||||||
xpram_thread_active = (pthread_create(&xpram_thread, NULL, xpram_func, NULL) == 0);
|
xpram_thread_active = (pthread_create(&xpram_thread, NULL, xpram_func, NULL) == 0);
|
||||||
|
|
||||||
// Init drivers
|
|
||||||
SonyInit();
|
|
||||||
DiskInit();
|
|
||||||
CDROMInit();
|
|
||||||
SCSIInit();
|
|
||||||
|
|
||||||
// Init serial ports
|
|
||||||
SerialInit();
|
|
||||||
|
|
||||||
// Init network
|
|
||||||
EtherInit();
|
|
||||||
|
|
||||||
// Init Time Manager
|
|
||||||
TimerInit();
|
|
||||||
|
|
||||||
// Init clipboard
|
|
||||||
ClipInit();
|
|
||||||
|
|
||||||
// Init audio
|
|
||||||
AudioInit();
|
|
||||||
|
|
||||||
// Init video
|
|
||||||
if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC))
|
|
||||||
QuitEmulator();
|
|
||||||
|
|
||||||
// Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
|
|
||||||
if (!Init680x0())
|
|
||||||
QuitEmulator();
|
|
||||||
|
|
||||||
// Install ROM patches
|
|
||||||
if (!PatchROM()) {
|
|
||||||
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
|
||||||
QuitEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HAVE_TIMER_CREATE) && defined(_POSIX_REALTIME_SIGNALS)
|
#if defined(HAVE_TIMER_CREATE) && defined(_POSIX_REALTIME_SIGNALS)
|
||||||
// Start 60Hz timer
|
// Start 60Hz timer
|
||||||
sigemptyset(&timer_sa.sa_mask);
|
sigemptyset(&timer_sa.sa_mask);
|
||||||
@ -370,32 +292,8 @@ void QuitEmulator(void)
|
|||||||
pthread_join(xpram_thread, NULL);
|
pthread_join(xpram_thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save XPRAM
|
// Deinitialize everything
|
||||||
XPRAMExit();
|
ExitAll();
|
||||||
|
|
||||||
// Exit video
|
|
||||||
VideoExit();
|
|
||||||
|
|
||||||
// Exit audio
|
|
||||||
AudioExit();
|
|
||||||
|
|
||||||
// Exit clipboard
|
|
||||||
ClipExit();
|
|
||||||
|
|
||||||
// Exit Time Manager
|
|
||||||
TimerExit();
|
|
||||||
|
|
||||||
// Exit serial ports
|
|
||||||
SerialExit();
|
|
||||||
|
|
||||||
// Exit network
|
|
||||||
EtherExit();
|
|
||||||
|
|
||||||
// Exit drivers
|
|
||||||
SCSIExit();
|
|
||||||
CDROMExit();
|
|
||||||
DiskExit();
|
|
||||||
SonyExit();
|
|
||||||
|
|
||||||
// Delete ROM area
|
// Delete ROM area
|
||||||
delete[] ROMBaseHost;
|
delete[] ROMBaseHost;
|
||||||
|
@ -318,7 +318,7 @@ bool PrefsEditor(void)
|
|||||||
* "Volumes" pane
|
* "Volumes" pane
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static GtkWidget *volume_list;
|
static GtkWidget *volume_list, *w_extfs;
|
||||||
static int selected_volume;
|
static int selected_volume;
|
||||||
|
|
||||||
// Volume in list selected
|
// Volume in list selected
|
||||||
@ -420,6 +420,8 @@ static void read_volumes_settings(void)
|
|||||||
gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str);
|
gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str);
|
||||||
PrefsAddString("disk", str);
|
PrefsAddString("disk", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create "Volumes" pane
|
// Create "Volumes" pane
|
||||||
@ -455,6 +457,8 @@ static void create_volumes_pane(GtkWidget *top)
|
|||||||
make_button_box(box, 0, buttons);
|
make_button_box(box, 0, buttons);
|
||||||
make_separator(box);
|
make_separator(box);
|
||||||
|
|
||||||
|
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs");
|
||||||
|
|
||||||
static const opt_desc options[] = {
|
static const opt_desc options[] = {
|
||||||
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)},
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)},
|
||||||
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)},
|
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)},
|
||||||
|
@ -92,4 +92,5 @@ void SavePrefs(void)
|
|||||||
void AddPlatformPrefsDefaults(void)
|
void AddPlatformPrefsDefaults(void)
|
||||||
{
|
{
|
||||||
PrefsAddBool("keycodes", false);
|
PrefsAddBool("keycodes", false);
|
||||||
|
PrefsReplaceString("extfs", "/");
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,9 @@ typedef struct timespec tm_time_t;
|
|||||||
typedef struct timeval tm_time_t;
|
typedef struct timeval tm_time_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Offset Mac->Unix time in seconds */
|
||||||
|
#define TIME_OFFSET 0x7c25b080
|
||||||
|
|
||||||
/* UAE CPU data types */
|
/* UAE CPU data types */
|
||||||
#define uae_s8 int8
|
#define uae_s8 int8
|
||||||
#define uae_u8 uint8
|
#define uae_u8 uint8
|
||||||
|
@ -50,8 +50,6 @@ void Microseconds(uint32 &hi, uint32 &lo)
|
|||||||
* Return local date/time in Mac format (seconds since 1.1.1904)
|
* Return local date/time in Mac format (seconds since 1.1.1904)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->Unix time in seconds
|
|
||||||
|
|
||||||
uint32 TimerDateTime(void)
|
uint32 TimerDateTime(void)
|
||||||
{
|
{
|
||||||
time_t utc_now = time(NULL);
|
time_t utc_now = time(NULL);
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
user_string_def platform_strings[] = {
|
user_string_def platform_strings[] = {
|
||||||
// Common strings that have a platform-specific variant
|
// Common strings that have a platform-specific variant
|
||||||
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under Unix. Basilisk II will try to unmount it."},
|
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under Unix. Basilisk II will try to unmount it."},
|
||||||
|
{STR_EXTFS_CTRL, "Unix Root"},
|
||||||
|
{STR_EXTFS_NAME, "Unix Directory Tree"},
|
||||||
|
{STR_EXTFS_VOLUME_NAME, "Unix"},
|
||||||
|
|
||||||
// Purely platform-specific strings
|
// Purely platform-specific strings
|
||||||
{STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."},
|
{STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."},
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "ether.h"
|
#include "ether.h"
|
||||||
|
#include "extfs.h"
|
||||||
#include "emul_op.h"
|
#include "emul_op.h"
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
@ -492,6 +493,14 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||||||
r->d[0] = AudioDispatch(r->a[3], r->a[4]);
|
r->d[0] = AudioDispatch(r->a[3], r->a[4]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case M68K_EMUL_OP_EXTFS_COMM: // External file system routines
|
||||||
|
WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case M68K_EMUL_OP_EXTFS_HFS:
|
||||||
|
WriteMacInt16(r->a[7] + 20, ExtFSHFS(ReadMacInt32(r->a[7] + 16), ReadMacInt16(r->a[7] + 14), ReadMacInt32(r->a[7] + 10), ReadMacInt32(r->a[7] + 6), ReadMacInt16(r->a[7] + 4)));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode);
|
printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode);
|
||||||
printf("d0 %08lx d1 %08lx d2 %08lx d3 %08lx\n"
|
printf("d0 %08lx d1 %08lx d2 %08lx d3 %08lx\n"
|
||||||
|
2166
BasiliskII/src/extfs.cpp
Normal file
2166
BasiliskII/src/extfs.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -79,6 +79,8 @@ enum {
|
|||||||
M68K_EMUL_OP_PUT_SCRAP,
|
M68K_EMUL_OP_PUT_SCRAP,
|
||||||
M68K_EMUL_OP_CHECKLOAD,
|
M68K_EMUL_OP_CHECKLOAD,
|
||||||
M68K_EMUL_OP_AUDIO,
|
M68K_EMUL_OP_AUDIO,
|
||||||
|
M68K_EMUL_OP_EXTFS_COMM,
|
||||||
|
M68K_EMUL_OP_EXTFS_HFS,
|
||||||
M68K_EMUL_OP_MAX // highest number
|
M68K_EMUL_OP_MAX // highest number
|
||||||
};
|
};
|
||||||
|
|
||||||
|
45
BasiliskII/src/include/extfs.h
Normal file
45
BasiliskII/src/include/extfs.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* extfs.h - MacOS file system for access native file system access
|
||||||
|
*
|
||||||
|
* Basilisk II (C) 1997-1999 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 EXTFS_H
|
||||||
|
#define EXTFS_H
|
||||||
|
|
||||||
|
extern void ExtFSInit(void);
|
||||||
|
extern void ExtFSExit(void);
|
||||||
|
|
||||||
|
extern void InstallExtFS(void);
|
||||||
|
|
||||||
|
extern int16 ExtFSComm(uint16 message, uint32 paramBlock, uint32 globalsPtr);
|
||||||
|
extern int16 ExtFSHFS(uint32 vcb, uint16 selectCode, uint32 paramBlock, uint32 globalsPtr, int16 fsid);
|
||||||
|
|
||||||
|
// System specific and internal functions/data
|
||||||
|
extern void extfs_init(void);
|
||||||
|
extern void extfs_exit(void);
|
||||||
|
extern void get_finder_type(const char *path, uint32 &type, uint32 &creator);
|
||||||
|
extern void set_finder_type(const char *path, uint32 type, uint32 creator);
|
||||||
|
extern void get_finder_flags(const char *path, uint16 &flags);
|
||||||
|
extern void set_finder_flags(const char *path, uint16 flags);
|
||||||
|
extern uint32 get_rfork_size(const char *path);
|
||||||
|
extern int open_rfork(const char *path, int flag);
|
||||||
|
extern void close_rfork(const char *path, int fd);
|
||||||
|
extern size_t extfs_read(int fd, void *buffer, size_t length);
|
||||||
|
extern size_t extfs_write(int fd, void *buffer, size_t length);
|
||||||
|
|
||||||
|
#endif
|
559
BasiliskII/src/include/extfs_defs.h
Normal file
559
BasiliskII/src/include/extfs_defs.h
Normal file
@ -0,0 +1,559 @@
|
|||||||
|
/*
|
||||||
|
* extfs_defs.h - MacOS types and structures for external file system
|
||||||
|
*
|
||||||
|
* Basilisk II (C) 1997-1999 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 EXTFS_DEFS_H
|
||||||
|
#define EXTFS_DEFS_H
|
||||||
|
|
||||||
|
#include "macos_util.h"
|
||||||
|
|
||||||
|
// Gestalt selectors
|
||||||
|
enum {
|
||||||
|
gestaltFSAttr = 'fs ',
|
||||||
|
gestaltFullExtFSDispatching = 0,
|
||||||
|
gestaltHasFSSpecCalls = 1,
|
||||||
|
gestaltHasFileSystemManager = 2,
|
||||||
|
gestaltFSMDoesDynamicLoad = 3,
|
||||||
|
gestaltFSSupports4GBVols = 4,
|
||||||
|
gestaltFSSupports2TBVols = 5,
|
||||||
|
gestaltHasExtendedDiskInit = 6,
|
||||||
|
gestaltDTMgrSupportsFSM = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
gestaltFSMVersion = 'fsm '
|
||||||
|
};
|
||||||
|
|
||||||
|
// File attributes
|
||||||
|
enum {
|
||||||
|
faLocked = 0x01,
|
||||||
|
faRFOpen = 0x04,
|
||||||
|
faDFOpen = 0x08,
|
||||||
|
faIsDir = 0x10,
|
||||||
|
faOpen = 0x80
|
||||||
|
};
|
||||||
|
|
||||||
|
// Volume attributes
|
||||||
|
enum {
|
||||||
|
vaBusy = 0x40,
|
||||||
|
vaHardLock = 0x80,
|
||||||
|
vaSoftLock = 0x8000
|
||||||
|
};
|
||||||
|
|
||||||
|
// vMAttrib (GetVolParms) constants
|
||||||
|
enum {
|
||||||
|
kLimitFCBs = 1 << 31,
|
||||||
|
kLocalWList = 1 << 30,
|
||||||
|
kNoMiniFndr = 1 << 29,
|
||||||
|
kNoVNEdit = 1 << 28,
|
||||||
|
kNoLclSync = 1 << 27,
|
||||||
|
kTrshOffLine = 1 << 26,
|
||||||
|
kNoSwitchTo = 1 << 25,
|
||||||
|
kNoDeskItems = 1 << 20,
|
||||||
|
kNoBootBlks = 1 << 19,
|
||||||
|
kAccessCntl = 1 << 18,
|
||||||
|
kNoSysDir = 1 << 17,
|
||||||
|
kHasExtFSVol = 1 << 16,
|
||||||
|
kHasOpenDeny = 1 << 15,
|
||||||
|
kHasCopyFile = 1 << 14,
|
||||||
|
kHasMoveRename = 1 << 13,
|
||||||
|
kHasDesktopMgr = 1 << 12,
|
||||||
|
kHasShortName = 1 << 11,
|
||||||
|
kHasFolderLock = 1 << 10,
|
||||||
|
kHasPersonalAccessPrivileges = 1 << 9,
|
||||||
|
kHasUserGroupList = 1 << 8,
|
||||||
|
kHasCatSearch = 1 << 7,
|
||||||
|
kHasFileIDs = 1 << 6,
|
||||||
|
kHasBTreeMgr = 1 << 5,
|
||||||
|
kHasBlankAccessPrivileges = 1 << 4,
|
||||||
|
kSupportsAsyncRequests = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
fsUsrCNID = 16,
|
||||||
|
kHFSBit = 9,
|
||||||
|
kHFSMask = 0x0200,
|
||||||
|
kAsyncBit = 10,
|
||||||
|
kAsyncMask = 0x0400
|
||||||
|
};
|
||||||
|
|
||||||
|
// HFSCIProc selectCode values
|
||||||
|
enum {
|
||||||
|
kFSMOpen = 0xA000,
|
||||||
|
kFSMClose = 0xA001,
|
||||||
|
kFSMRead = 0xA002,
|
||||||
|
kFSMWrite = 0xA003,
|
||||||
|
kFSMGetVolInfo = 0xA007,
|
||||||
|
kFSMCreate = 0xA008,
|
||||||
|
kFSMDelete = 0xA009,
|
||||||
|
kFSMOpenRF = 0xA00A,
|
||||||
|
kFSMRename = 0xA00B,
|
||||||
|
kFSMGetFileInfo = 0xA00C,
|
||||||
|
kFSMSetFileInfo = 0xA00D,
|
||||||
|
kFSMUnmountVol = 0xA00E,
|
||||||
|
kFSMMountVol = 0xA00F,
|
||||||
|
kFSMAllocate = 0xA010,
|
||||||
|
kFSMGetEOF = 0xA011,
|
||||||
|
kFSMSetEOF = 0xA012,
|
||||||
|
kFSMFlushVol = 0xA013,
|
||||||
|
kFSMGetVol = 0xA014,
|
||||||
|
kFSMSetVol = 0xA015,
|
||||||
|
kFSMEject = 0xA017,
|
||||||
|
kFSMGetFPos = 0xA018,
|
||||||
|
kFSMOffline = 0xA035,
|
||||||
|
kFSMSetFilLock = 0xA041,
|
||||||
|
kFSMRstFilLock = 0xA042,
|
||||||
|
kFSMSetFilType = 0xA043,
|
||||||
|
kFSMSetFPos = 0xA044,
|
||||||
|
kFSMFlushFile = 0xA045,
|
||||||
|
kFSMOpenWD = 0x0001,
|
||||||
|
kFSMCloseWD = 0x0002,
|
||||||
|
kFSMCatMove = 0x0005,
|
||||||
|
kFSMDirCreate = 0x0006,
|
||||||
|
kFSMGetWDInfo = 0x0007,
|
||||||
|
kFSMGetFCBInfo = 0x0008,
|
||||||
|
kFSMGetCatInfo = 0x0009,
|
||||||
|
kFSMSetCatInfo = 0x000A,
|
||||||
|
kFSMSetVolInfo = 0x000B,
|
||||||
|
kFSMLockRng = 0x0010,
|
||||||
|
kFSMUnlockRng = 0x0011,
|
||||||
|
kFSMXGetVolInfo = 0x0012,
|
||||||
|
kFSMCreateFileIDRef = 0x0014,
|
||||||
|
kFSMDeleteFileIDRef = 0x0015,
|
||||||
|
kFSMResolveFileIDRef = 0x0016,
|
||||||
|
kFSMExchangeFiles = 0x0017,
|
||||||
|
kFSMCatSearch = 0x0018,
|
||||||
|
kFSMOpenDF = 0x001A,
|
||||||
|
kFSMMakeFSSpec = 0x001B,
|
||||||
|
kFSMDTGetPath = 0x0020,
|
||||||
|
kFSMDTCloseDown = 0x0021,
|
||||||
|
kFSMDTAddIcon = 0x0022,
|
||||||
|
kFSMDTGetIcon = 0x0023,
|
||||||
|
kFSMDTGetIconInfo = 0x0024,
|
||||||
|
kFSMDTAddAPPL = 0x0025,
|
||||||
|
kFSMDTRemoveAPPL = 0x0026,
|
||||||
|
kFSMDTGetAPPL = 0x0027,
|
||||||
|
kFSMDTSetComment = 0x0028,
|
||||||
|
kFSMDTRemoveComment = 0x0029,
|
||||||
|
kFSMDTGetComment = 0x002A,
|
||||||
|
kFSMDTFlush = 0x002B,
|
||||||
|
kFSMDTReset = 0x002C,
|
||||||
|
kFSMDTGetInfo = 0x002D,
|
||||||
|
kFSMDTOpenInform = 0x002E,
|
||||||
|
kFSMDTDelete = 0x002F,
|
||||||
|
kFSMGetVolParms = 0x0030,
|
||||||
|
kFSMGetLogInInfo = 0x0031,
|
||||||
|
kFSMGetDirAccess = 0x0032,
|
||||||
|
kFSMSetDirAccess = 0x0033,
|
||||||
|
kFSMMapID = 0x0034,
|
||||||
|
kFSMMapName = 0x0035,
|
||||||
|
kFSMCopyFile = 0x0036,
|
||||||
|
kFSMMoveRename = 0x0037,
|
||||||
|
kFSMOpenDeny = 0x0038,
|
||||||
|
kFSMOpenRFDeny = 0x0039,
|
||||||
|
kFSMGetXCatInfo = 0x003A,
|
||||||
|
kFSMGetVolMountInfoSize = 0x003F,
|
||||||
|
kFSMGetVolMountInfo = 0x0040,
|
||||||
|
kFSMVolumeMount = 0x0041,
|
||||||
|
kFSMShare = 0x0042,
|
||||||
|
kFSMUnShare = 0x0043,
|
||||||
|
kFSMGetUGEntry = 0x0044,
|
||||||
|
kFSMGetForeignPrivs = 0x0060,
|
||||||
|
kFSMSetForeignPrivs = 0x0061
|
||||||
|
};
|
||||||
|
|
||||||
|
// UTDetermineVol status values
|
||||||
|
enum {
|
||||||
|
dtmvError = 0,
|
||||||
|
dtmvFullPathname = 1,
|
||||||
|
dtmvVRefNum = 2,
|
||||||
|
dtmvWDRefNum = 3,
|
||||||
|
dtmvDriveNum = 4,
|
||||||
|
dtmvDefault = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
// Miscellaneous constants used by FSM
|
||||||
|
enum {
|
||||||
|
fsdVersion1 = 1,
|
||||||
|
fsmIgnoreFSID = 0xFFFE,
|
||||||
|
fsmGenericFSID = 0xFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
// compInterfMask bits common to all FSM components
|
||||||
|
enum {
|
||||||
|
fsmComponentEnableBit = 31,
|
||||||
|
fsmComponentEnableMask = (long)0x80000000,
|
||||||
|
fsmComponentBusyBit = 30,
|
||||||
|
fsmComponentBusyMask = 0x40000000
|
||||||
|
};
|
||||||
|
|
||||||
|
// compInterfMask bits specific to HFS component
|
||||||
|
enum {
|
||||||
|
hfsCIDoesHFSBit = 23,
|
||||||
|
hfsCIDoesHFSMask = 0x00800000,
|
||||||
|
hfsCIDoesAppleShareBit = 22,
|
||||||
|
hfsCIDoesAppleShareMask = 0x00400000,
|
||||||
|
hfsCIDoesDeskTopBit = 21,
|
||||||
|
hfsCIDoesDeskTopMask = 0x00200000,
|
||||||
|
hfsCIDoesDynamicLoadBit = 20,
|
||||||
|
hfsCIDoesDynamicLoadMask = 0x00100000,
|
||||||
|
hfsCIResourceLoadedBit = 19,
|
||||||
|
hfsCIResourceLoadedMask = 0x00080000,
|
||||||
|
hfsCIHasHLL2PProcBit = 18,
|
||||||
|
hfsCIHasHLL2PProcMask = 0x00040000,
|
||||||
|
hfsCIWantsDTSupportBit = 17,
|
||||||
|
hfsCIWantsDTSupportMask = 0x00020000
|
||||||
|
};
|
||||||
|
|
||||||
|
// FCBRec.fcbFlags bits
|
||||||
|
enum {
|
||||||
|
fcbWriteBit = 0,
|
||||||
|
fcbWriteMask = 0x01,
|
||||||
|
fcbResourceBit = 1,
|
||||||
|
fcbResourceMask = 0x02,
|
||||||
|
fcbWriteLockedBit = 2,
|
||||||
|
fcbWriteLockedMask = 0x04,
|
||||||
|
fcbSharedWriteBit = 4,
|
||||||
|
fcbSharedWriteMask = 0x10,
|
||||||
|
fcbFileLockedBit = 5,
|
||||||
|
fcbFileLockedMask = 0x20,
|
||||||
|
fcbOwnClumpBit = 6,
|
||||||
|
fcbOwnClumpMask = 0x40,
|
||||||
|
fcbModifiedBit = 7,
|
||||||
|
fcbModifiedMask = 0x80
|
||||||
|
};
|
||||||
|
|
||||||
|
// InformFSM messages
|
||||||
|
enum {
|
||||||
|
fsmNopMessage = 0,
|
||||||
|
fsmDrvQElChangedMessage = 1,
|
||||||
|
fsmGetFSIconMessage = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
// Messages passed to the fileSystemCommProc
|
||||||
|
enum {
|
||||||
|
ffsNopMessage = 0,
|
||||||
|
ffsGetIconMessage = 1,
|
||||||
|
ffsIDDiskMessage = 2,
|
||||||
|
ffsLoadMessage = 3,
|
||||||
|
ffsUnloadMessage = 4,
|
||||||
|
ffsIDVolMountMessage = 5,
|
||||||
|
ffsInformMessage = 6,
|
||||||
|
ffsGetIconInfoMessage = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
// Error codes from FSM functions
|
||||||
|
enum {
|
||||||
|
fsmFFSNotFoundErr = -431,
|
||||||
|
fsmBusyFFSErr = -432,
|
||||||
|
fsmBadFFSNameErr = -433,
|
||||||
|
fsmBadFSDLenErr = -434,
|
||||||
|
fsmDuplicateFSIDErr = -435,
|
||||||
|
fsmBadFSDVersionErr = -436,
|
||||||
|
fsmNoAlternateStackErr = -437,
|
||||||
|
fsmUnknownFSMMessageErr = -438
|
||||||
|
};
|
||||||
|
|
||||||
|
// paramBlock for ffsGetIconMessage and fsmGetFSIconMessage
|
||||||
|
enum {
|
||||||
|
kLargeIcon = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // FSMGetIconRec struct
|
||||||
|
iconBufferPtr = 2,
|
||||||
|
requestSize = 6,
|
||||||
|
actualSize = 10,
|
||||||
|
iconType = 14,
|
||||||
|
isEjectable = 15,
|
||||||
|
driveQElemPtr = 16,
|
||||||
|
fileSystemSpecPtr = 20
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // VolumeMountInfoHeader struct
|
||||||
|
vmiLength = 0,
|
||||||
|
vmiMedia = 2,
|
||||||
|
vmiFlags = 6,
|
||||||
|
SIZEOF_VolumeMountInfoHeader = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // GetVolParmsInfoBuffer struct
|
||||||
|
vMVersion = 0,
|
||||||
|
vMAttrib = 2,
|
||||||
|
vMLocalHand = 6,
|
||||||
|
vMServerAdr = 10,
|
||||||
|
vMVolumeGrade = 14,
|
||||||
|
vMForeignPrivID = 18,
|
||||||
|
SIZEOF_GetVolParmsInfoBuffer = 20
|
||||||
|
};
|
||||||
|
|
||||||
|
// Finder Flags
|
||||||
|
enum {
|
||||||
|
kIsOnDesk = 0x0001,
|
||||||
|
kColor = 0x000E,
|
||||||
|
kIsShared = 0x0040,
|
||||||
|
kHasBeenInited = 0x0100,
|
||||||
|
kHasCustomIcon = 0x0400,
|
||||||
|
kIsStationery = 0x0800,
|
||||||
|
kNameLocked = 0x1000,
|
||||||
|
kHasBundle = 0x2000,
|
||||||
|
kIsInvisible = 0x4000,
|
||||||
|
kIsAlias = 0x8000
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // FInfo struct
|
||||||
|
fdType = 0,
|
||||||
|
fdCreator = 4,
|
||||||
|
fdFlags = 8,
|
||||||
|
fdLocation = 10,
|
||||||
|
fdFldr = 14,
|
||||||
|
SIZEOF_FInfo = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // FXInfo struct
|
||||||
|
fdIconID = 0,
|
||||||
|
fdUnused = 2,
|
||||||
|
fdScript = 8,
|
||||||
|
fdXFlags = 9,
|
||||||
|
fdComment = 10,
|
||||||
|
fdPutAway = 12,
|
||||||
|
SIZEOF_FXInfo = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // HFileParam/HFileInfo struct
|
||||||
|
ioFRefNum = 24,
|
||||||
|
ioFVersNum = 26,
|
||||||
|
ioFDirIndex = 28,
|
||||||
|
ioFlAttrib = 30,
|
||||||
|
ioACUser = 31,
|
||||||
|
ioFlFndrInfo = 32,
|
||||||
|
ioDirID = 48,
|
||||||
|
ioFlStBlk = 52,
|
||||||
|
ioFlLgLen = 54,
|
||||||
|
ioFlPyLen = 58,
|
||||||
|
ioFlRStBlk = 62,
|
||||||
|
ioFlRLgLen = 64,
|
||||||
|
ioFlRPyLen = 68,
|
||||||
|
ioFlCrDat = 72,
|
||||||
|
ioFlMdDat = 76,
|
||||||
|
ioFlBkDat = 80,
|
||||||
|
ioFlXFndrInfo = 84,
|
||||||
|
ioFlParID = 100,
|
||||||
|
ioFlClpSiz = 104
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // DInfo struct
|
||||||
|
frRect = 0,
|
||||||
|
frFlags = 8,
|
||||||
|
frLocation = 10,
|
||||||
|
frView = 14,
|
||||||
|
SIZEOF_DInfo = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // DXInfo struct
|
||||||
|
frScroll = 0,
|
||||||
|
frOpenChain = 4,
|
||||||
|
frScript = 8,
|
||||||
|
frXFlags = 9,
|
||||||
|
frComment = 10,
|
||||||
|
frPutAway = 12,
|
||||||
|
SIZEOF_DXInfo = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // HDirParam/DirInfo struct
|
||||||
|
ioDrUsrWds = 32,
|
||||||
|
ioDrDirID = 48,
|
||||||
|
ioDrNmFls = 52,
|
||||||
|
ioDrCrDat = 72,
|
||||||
|
ioDrMdDat = 76,
|
||||||
|
ioDrBkDat = 80,
|
||||||
|
ioDrFndrInfo = 84,
|
||||||
|
ioDrParID = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // WDParam struct
|
||||||
|
ioWDIndex = 26,
|
||||||
|
ioWDProcID = 28,
|
||||||
|
ioWDVRefNum = 32,
|
||||||
|
ioWDDirID = 48,
|
||||||
|
SIZEOF_WDParam = 52
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // HVolumeParam struct
|
||||||
|
ioVolIndex = 28,
|
||||||
|
ioVCrDate = 30,
|
||||||
|
ioVLsMod = 34,
|
||||||
|
ioVAtrb = 38,
|
||||||
|
ioVNmFls = 40,
|
||||||
|
ioVBitMap = 42,
|
||||||
|
ioAllocPtr = 44,
|
||||||
|
ioVNmAlBlks = 46,
|
||||||
|
ioVAlBlkSiz = 48,
|
||||||
|
ioVClpSiz = 52,
|
||||||
|
ioAlBlSt = 56,
|
||||||
|
ioVNxtCNID = 58,
|
||||||
|
ioVFrBlk = 62,
|
||||||
|
ioVSigWord = 64,
|
||||||
|
ioVDrvInfo = 66,
|
||||||
|
ioVDRefNum = 68,
|
||||||
|
ioVFSID = 70,
|
||||||
|
ioVBkUp = 72,
|
||||||
|
ioVSeqNum = 76,
|
||||||
|
ioVWrCnt = 78,
|
||||||
|
ioVFilCnt = 82,
|
||||||
|
ioVDirCnt = 86,
|
||||||
|
ioVFndrInfo = 90
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // CMovePBRec struct
|
||||||
|
ioNewName = 28,
|
||||||
|
ioNewDirID = 36
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // FCBPBRec struct
|
||||||
|
ioFCBIndx = 28,
|
||||||
|
ioFCBFlNm = 32,
|
||||||
|
ioFCBFlags = 36,
|
||||||
|
ioFCBStBlk = 38,
|
||||||
|
ioFCBEOF = 40,
|
||||||
|
ioFCBPLen = 44,
|
||||||
|
ioFCBCrPs = 48,
|
||||||
|
ioFCBVRefNum = 52,
|
||||||
|
ioFCBClpSiz = 54,
|
||||||
|
ioFCBParID = 58
|
||||||
|
};
|
||||||
|
|
||||||
|
// Volume control block
|
||||||
|
enum { // VCB struct
|
||||||
|
vcbFlags = 6,
|
||||||
|
vcbSigWord = 8,
|
||||||
|
vcbCrDate = 10,
|
||||||
|
vcbLsMod = 14,
|
||||||
|
vcbAtrb = 18,
|
||||||
|
vcbNmFls = 20,
|
||||||
|
vcbVBMSt = 22,
|
||||||
|
vcbAllocPtr = 24,
|
||||||
|
vcbNmAlBlks = 26,
|
||||||
|
vcbAlBlkSiz = 28,
|
||||||
|
vcbClpSiz = 32,
|
||||||
|
vcbAlBlSt = 36,
|
||||||
|
vcbNxtCNID = 38,
|
||||||
|
vcbFreeBks = 42,
|
||||||
|
vcbVN = 44,
|
||||||
|
vcbDrvNum = 72,
|
||||||
|
vcbDRefNum = 74,
|
||||||
|
vcbFSID = 76,
|
||||||
|
vcbVRefNum = 78,
|
||||||
|
vcbMAdr = 80,
|
||||||
|
vcbBufAdr = 84,
|
||||||
|
vcbMLen = 88,
|
||||||
|
vcbDirIndex = 90,
|
||||||
|
vcbDirBlk = 92,
|
||||||
|
vcbVolBkUp = 94,
|
||||||
|
vcbVSeqNum = 98,
|
||||||
|
vcbWrCnt = 100,
|
||||||
|
vcbXTClpSiz = 104,
|
||||||
|
vcbCTClpSiz = 108,
|
||||||
|
vcbNmRtDirs = 112,
|
||||||
|
vcbFilCnt = 114,
|
||||||
|
vcbDirCnt = 118,
|
||||||
|
vcbFndrInfo = 122,
|
||||||
|
vcbVCSize = 154,
|
||||||
|
vcbVBMCSiz = 156,
|
||||||
|
vcbCtlCSiz = 158,
|
||||||
|
vcbXTAlBlks = 160,
|
||||||
|
vcbCTAlBlks = 162,
|
||||||
|
vcbXTRef = 164,
|
||||||
|
vcbCTRef = 166,
|
||||||
|
vcbCtlBuf = 168,
|
||||||
|
vcbDirIDM = 172,
|
||||||
|
vcbOffsM = 176,
|
||||||
|
SIZEOF_VCB = 178
|
||||||
|
};
|
||||||
|
|
||||||
|
// Working directory control block
|
||||||
|
enum { // WDCBRec struct
|
||||||
|
wdVCBPtr = 0,
|
||||||
|
wdDirID = 4,
|
||||||
|
wdCatHint = 8,
|
||||||
|
wdProcID = 12,
|
||||||
|
SIZEOF_WDCBRec = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
// File control block
|
||||||
|
enum { // FCBRec struct
|
||||||
|
fcbFlNm = 0,
|
||||||
|
fcbFlags = 4,
|
||||||
|
fcbTypByt = 5,
|
||||||
|
fcbSBlk = 6,
|
||||||
|
fcbEOF = 8,
|
||||||
|
fcbPLen = 12,
|
||||||
|
fcbCrPs = 16,
|
||||||
|
fcbVPtr = 20,
|
||||||
|
fcbBfAdr = 24,
|
||||||
|
fcbFlPos = 28,
|
||||||
|
fcbClmpSize = 30,
|
||||||
|
fcbBTCBPtr = 34,
|
||||||
|
fcbExtRec = 38,
|
||||||
|
fcbFType = 50,
|
||||||
|
fcbCatPos = 54,
|
||||||
|
fcbDirID = 58,
|
||||||
|
fcbCName = 62
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // ParsePathRec struct
|
||||||
|
ppNamePtr = 0,
|
||||||
|
ppStartOffset = 4,
|
||||||
|
ppComponentLength = 6,
|
||||||
|
ppMoreName = 8,
|
||||||
|
ppFoundDelimiter = 9,
|
||||||
|
SIZEOF_ParsePathRec = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // HFSCIRec struct
|
||||||
|
compInterfMask = 0,
|
||||||
|
compInterfProc = 4,
|
||||||
|
log2PhyProc = 8,
|
||||||
|
stackTop = 12,
|
||||||
|
stackSize = 16,
|
||||||
|
stackPtr = 20,
|
||||||
|
idSector = 28,
|
||||||
|
SIZEOF_HFSCIRec = 40
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // DICIRec struct
|
||||||
|
maxVolNameLength = 8,
|
||||||
|
blockSize = 10,
|
||||||
|
SIZEOF_DICIRec = 24
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // FSDRec struct
|
||||||
|
fsdLink = 0,
|
||||||
|
fsdLength = 4,
|
||||||
|
fsdVersion = 6,
|
||||||
|
fileSystemFSID = 8,
|
||||||
|
fileSystemName = 10,
|
||||||
|
fileSystemSpec = 42,
|
||||||
|
fileSystemGlobalsPtr = 112,
|
||||||
|
fileSystemCommProc = 116,
|
||||||
|
fsdHFSCI = 132,
|
||||||
|
fsdDICI = 172,
|
||||||
|
SIZEOF_FSDRec = 196
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -68,10 +68,24 @@ enum {
|
|||||||
closErr = -24,
|
closErr = -24,
|
||||||
abortErr = -27,
|
abortErr = -27,
|
||||||
notOpenErr = -28,
|
notOpenErr = -28,
|
||||||
|
dskFulErr = -34,
|
||||||
|
nsvErr = -35,
|
||||||
ioErr = -36,
|
ioErr = -36,
|
||||||
|
bdNamErr = -37,
|
||||||
|
fnOpnErr = -38,
|
||||||
|
eofErr = -39,
|
||||||
|
posErr = -40,
|
||||||
|
tmfoErr = -42,
|
||||||
|
fnfErr = -43,
|
||||||
wPrErr = -44,
|
wPrErr = -44,
|
||||||
|
fLckdErr = -45,
|
||||||
|
fBsyErr = -47,
|
||||||
|
dupFNErr = -48,
|
||||||
paramErr = -50,
|
paramErr = -50,
|
||||||
|
rfNumErr = -51,
|
||||||
|
permErr = -54,
|
||||||
nsDrvErr = -56,
|
nsDrvErr = -56,
|
||||||
|
extFSErr = -58,
|
||||||
noDriveErr = -64,
|
noDriveErr = -64,
|
||||||
offLinErr = -65,
|
offLinErr = -65,
|
||||||
noNybErr = -66,
|
noNybErr = -66,
|
||||||
@ -93,7 +107,8 @@ enum {
|
|||||||
fmt1Err = -82,
|
fmt1Err = -82,
|
||||||
fmt2Err = -83,
|
fmt2Err = -83,
|
||||||
verErr = -84,
|
verErr = -84,
|
||||||
memFullErr = -108
|
memFullErr = -108,
|
||||||
|
dirNFErr = -120
|
||||||
};
|
};
|
||||||
|
|
||||||
// Misc constants
|
// Misc constants
|
||||||
@ -156,7 +171,8 @@ enum { // IOParam struct
|
|||||||
ioActCount = 40,
|
ioActCount = 40,
|
||||||
ioPosMode = 44,
|
ioPosMode = 44,
|
||||||
ioPosOffset = 46,
|
ioPosOffset = 46,
|
||||||
ioWPosOffset = 46 // Wide positioning offset when ioPosMode has kWidePosOffsetBit set
|
ioWPosOffset = 46, // Wide positioning offset when ioPosMode has kWidePosOffsetBit set
|
||||||
|
SIZEOF_IOParam = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { // CntrlParam struct
|
enum { // CntrlParam struct
|
||||||
|
@ -38,7 +38,11 @@ struct M68kRegisters {
|
|||||||
uint16 sr;
|
uint16 sr;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Functions
|
// General functions
|
||||||
|
extern bool InitAll(void);
|
||||||
|
extern void ExitAll(void);
|
||||||
|
|
||||||
|
// Platform-specific functions
|
||||||
extern void FlushCodeCache(void *start, uint32 size); // Code was patched, flush caches if neccessary
|
extern void FlushCodeCache(void *start, uint32 size); // Code was patched, flush caches if neccessary
|
||||||
extern void QuitEmulator(void); // Quit emulator
|
extern void QuitEmulator(void); // Quit emulator
|
||||||
extern void ErrorAlert(const char *text); // Display error alert
|
extern void ErrorAlert(const char *text); // Display error alert
|
||||||
|
@ -83,6 +83,7 @@ enum {
|
|||||||
STR_BOOT_ANY_LAB,
|
STR_BOOT_ANY_LAB,
|
||||||
STR_BOOT_CDROM_LAB,
|
STR_BOOT_CDROM_LAB,
|
||||||
STR_NOCDROM_CTRL,
|
STR_NOCDROM_CTRL,
|
||||||
|
STR_EXTFS_CTRL,
|
||||||
STR_DEVICE_CTRL,
|
STR_DEVICE_CTRL,
|
||||||
STR_UNIT_CTRL,
|
STR_UNIT_CTRL,
|
||||||
STR_ADD_VOLUME_TITLE,
|
STR_ADD_VOLUME_TITLE,
|
||||||
@ -186,7 +187,11 @@ enum {
|
|||||||
STR_WINDOW_ITEM_ABOUT,
|
STR_WINDOW_ITEM_ABOUT,
|
||||||
STR_WINDOW_ITEM_REFRESH,
|
STR_WINDOW_ITEM_REFRESH,
|
||||||
STR_WINDOW_ITEM_MOUNT,
|
STR_WINDOW_ITEM_MOUNT,
|
||||||
STR_SUSPEND_WINDOW_TITLE
|
STR_SUSPEND_WINDOW_TITLE,
|
||||||
|
|
||||||
|
// External file system
|
||||||
|
STR_EXTFS_NAME = 5000,
|
||||||
|
STR_EXTFS_VOLUME_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
// Common and platform-specific string definitions
|
// Common and platform-specific string definitions
|
||||||
|
170
BasiliskII/src/main.cpp
Normal file
170
BasiliskII/src/main.cpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* main.cpp - Startup/shutdown code
|
||||||
|
*
|
||||||
|
* Basilisk II (C) 1997-1999 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 "cpu_emulation.h"
|
||||||
|
#include "xpram.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "sony.h"
|
||||||
|
#include "disk.h"
|
||||||
|
#include "cdrom.h"
|
||||||
|
#include "scsi.h"
|
||||||
|
#include "extfs.h"
|
||||||
|
#include "audio.h"
|
||||||
|
#include "video.h"
|
||||||
|
#include "serial.h"
|
||||||
|
#include "ether.h"
|
||||||
|
#include "clip.h"
|
||||||
|
#include "rom_patches.h"
|
||||||
|
#include "user_strings.h"
|
||||||
|
#include "prefs.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize everything, returns false on error
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool InitAll(void)
|
||||||
|
{
|
||||||
|
// Check ROM version
|
||||||
|
if (!CheckROM()) {
|
||||||
|
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if EMULATED_68K
|
||||||
|
// Set CPU and FPU type (UAE emulation)
|
||||||
|
switch (ROMVersion) {
|
||||||
|
case ROM_VERSION_64K:
|
||||||
|
case ROM_VERSION_PLUS:
|
||||||
|
case ROM_VERSION_CLASSIC:
|
||||||
|
CPUType = 0;
|
||||||
|
FPUType = 0;
|
||||||
|
TwentyFourBitAddressing = true;
|
||||||
|
break;
|
||||||
|
case ROM_VERSION_II:
|
||||||
|
CPUType = 2;
|
||||||
|
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
||||||
|
TwentyFourBitAddressing = true;
|
||||||
|
break;
|
||||||
|
case ROM_VERSION_32:
|
||||||
|
CPUType = 3;
|
||||||
|
FPUType = PrefsFindBool("fpu") ? 1 : 0;
|
||||||
|
TwentyFourBitAddressing = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CPUIs68060 = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Load XPRAM
|
||||||
|
XPRAMInit();
|
||||||
|
|
||||||
|
// Set boot volume
|
||||||
|
int16 i16 = PrefsFindInt16("bootdrive");
|
||||||
|
XPRAM[0x78] = i16 >> 8;
|
||||||
|
XPRAM[0x79] = i16 & 0xff;
|
||||||
|
i16 = PrefsFindInt16("bootdriver");
|
||||||
|
XPRAM[0x7a] = i16 >> 8;
|
||||||
|
XPRAM[0x7b] = i16 & 0xff;
|
||||||
|
|
||||||
|
// Init drivers
|
||||||
|
SonyInit();
|
||||||
|
DiskInit();
|
||||||
|
CDROMInit();
|
||||||
|
SCSIInit();
|
||||||
|
|
||||||
|
// Init external file system
|
||||||
|
ExtFSInit();
|
||||||
|
|
||||||
|
// Init serial ports
|
||||||
|
SerialInit();
|
||||||
|
|
||||||
|
// Init network
|
||||||
|
EtherInit();
|
||||||
|
|
||||||
|
// Init Time Manager
|
||||||
|
TimerInit();
|
||||||
|
|
||||||
|
// Init clipboard
|
||||||
|
ClipInit();
|
||||||
|
|
||||||
|
// Init audio
|
||||||
|
AudioInit();
|
||||||
|
|
||||||
|
// Init video
|
||||||
|
if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if EMULATED_68K
|
||||||
|
// Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
|
||||||
|
if (!Init680x0())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Install ROM patches
|
||||||
|
if (!PatchROM()) {
|
||||||
|
ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deinitialize everything
|
||||||
|
*/
|
||||||
|
|
||||||
|
void ExitAll(void)
|
||||||
|
{
|
||||||
|
// Save XPRAM
|
||||||
|
XPRAMExit();
|
||||||
|
|
||||||
|
// Exit video
|
||||||
|
VideoExit();
|
||||||
|
|
||||||
|
// Exit audio
|
||||||
|
AudioExit();
|
||||||
|
|
||||||
|
// Exit clipboard
|
||||||
|
ClipExit();
|
||||||
|
|
||||||
|
// Exit Time Manager
|
||||||
|
TimerExit();
|
||||||
|
|
||||||
|
// Exit serial ports
|
||||||
|
SerialExit();
|
||||||
|
|
||||||
|
// Exit network
|
||||||
|
EtherExit();
|
||||||
|
|
||||||
|
// Exit external file system
|
||||||
|
ExtFSExit();
|
||||||
|
|
||||||
|
// Exit drivers
|
||||||
|
SCSIExit();
|
||||||
|
CDROMExit();
|
||||||
|
DiskExit();
|
||||||
|
SonyExit();
|
||||||
|
}
|
@ -36,6 +36,7 @@ prefs_desc common_prefs_items[] = {
|
|||||||
{"disk", TYPE_STRING, true}, // Device/file names of Mac volumes (disk.cpp)
|
{"disk", TYPE_STRING, true}, // Device/file names of Mac volumes (disk.cpp)
|
||||||
{"floppy", TYPE_STRING, true}, // Device/file names of Mac floppy drives (sony.cpp)
|
{"floppy", TYPE_STRING, true}, // Device/file names of Mac floppy drives (sony.cpp)
|
||||||
{"cdrom", TYPE_STRING, true}, // Device/file names of Mac CD-ROM drives (cdrom.cpp)
|
{"cdrom", TYPE_STRING, true}, // Device/file names of Mac CD-ROM drives (cdrom.cpp)
|
||||||
|
{"extfs", TYPE_STRING, false}, // Root path of ExtFS (extfs.cpp)
|
||||||
{"scsi0", TYPE_STRING, false}, // SCSI targets for Mac SCSI ID 0..6 (scsi_*.cpp)
|
{"scsi0", TYPE_STRING, false}, // SCSI targets for Mac SCSI ID 0..6 (scsi_*.cpp)
|
||||||
{"scsi1", TYPE_STRING, false},
|
{"scsi1", TYPE_STRING, false},
|
||||||
{"scsi2", TYPE_STRING, false},
|
{"scsi2", TYPE_STRING, false},
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "cdrom.h"
|
#include "cdrom.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "extfs.h"
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "rom_patches.h"
|
#include "rom_patches.h"
|
||||||
|
|
||||||
@ -646,6 +647,9 @@ void PatchAfterStartup(void)
|
|||||||
r.a[0] = ROMBaseMac + memory_dispatch_offset;
|
r.a[0] = ROMBaseMac + memory_dispatch_offset;
|
||||||
r.d[0] = 0xa05c;
|
r.d[0] = 0xa05c;
|
||||||
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
|
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
|
||||||
|
|
||||||
|
// Install external file system
|
||||||
|
InstallExtFS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ user_string_def common_strings[] = {
|
|||||||
{STR_BOOT_ANY_LAB, "Any"},
|
{STR_BOOT_ANY_LAB, "Any"},
|
||||||
{STR_BOOT_CDROM_LAB, "CD-ROM"},
|
{STR_BOOT_CDROM_LAB, "CD-ROM"},
|
||||||
{STR_NOCDROM_CTRL, "Disable CD-ROM Driver"},
|
{STR_NOCDROM_CTRL, "Disable CD-ROM Driver"},
|
||||||
|
{STR_EXTFS_CTRL, "Host Root"},
|
||||||
{STR_DEVICE_CTRL, "Device"},
|
{STR_DEVICE_CTRL, "Device"},
|
||||||
{STR_UNIT_CTRL, "Unit"},
|
{STR_UNIT_CTRL, "Unit"},
|
||||||
{STR_ADD_VOLUME_TITLE, "Add Volume"},
|
{STR_ADD_VOLUME_TITLE, "Add Volume"},
|
||||||
@ -202,5 +203,8 @@ user_string_def common_strings[] = {
|
|||||||
{STR_WINDOW_ITEM_MOUNT, "Mount"},
|
{STR_WINDOW_ITEM_MOUNT, "Mount"},
|
||||||
{STR_SUSPEND_WINDOW_TITLE, "Basilisk II suspended. Press space to reactivate."},
|
{STR_SUSPEND_WINDOW_TITLE, "Basilisk II suspended. Press space to reactivate."},
|
||||||
|
|
||||||
|
{STR_EXTFS_NAME, "Host Directory Tree"},
|
||||||
|
{STR_EXTFS_VOLUME_NAME, "Host"},
|
||||||
|
|
||||||
{-1, NULL} // End marker
|
{-1, NULL} // End marker
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user