mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-23 04:30:10 +00:00
- imported fixed UAE FPU from Lauri
- extfs.cpp: fixed bug with fsResolveWDCB in fs_get_wd_info() - ExtFS: MAX_PATH_LENGTH is global, removed third parameter to add_path_component() - rom_patches.cpp: added print_rom_info() - Unix: added "-rominfo" command line argument - extfs_unix.cpp: supports finder info and resource forks - prefs_editor_gtk.cpp: tab widget is no longer scrollable
This commit is contained in:
parent
7856a8a42c
commit
bf765a5be8
@ -1,4 +1,5 @@
|
||||
V0.8 -
|
||||
- fixed many UAE FPU bugs [Lauri Pesonen]
|
||||
- added replacement for BlockMove() trap
|
||||
- removed Windows sources from the source archive; a version of
|
||||
these that actually compiles and works can be downloaded from
|
||||
@ -6,6 +7,7 @@ V0.8 -
|
||||
- fixed one possible source of "unimplemented trap" errors on MacOS
|
||||
bootup
|
||||
- medium removal is allowed in CDROMExit()
|
||||
- extfs.cpp: fixed bug with fsResolveWDCB in fs_get_wd_info()
|
||||
- Unix: added support for ESD audio output; merged with OSS audio
|
||||
and put in a new "audio_oss_esd.cpp" file which is also used under
|
||||
FreeBSD 3.x
|
||||
@ -13,6 +15,10 @@ V0.8 -
|
||||
- Unix: cleaned up the configure script
|
||||
- Unix: ROM breakpoint can be specified with "-break" command line
|
||||
argument
|
||||
- Unix: "-rominfo" command line argument to print information
|
||||
about ROM version and tables
|
||||
- Unix: ExtFS supports resource forks and Finder info (these are
|
||||
kept in hidden ".finf" and ".rsrc" directories)
|
||||
- Unix/audio_oss_esd.cpp: AudioStatus is re-set after determining
|
||||
audio device capabilities (actual sample rate is also determined)
|
||||
[Alexander R. Pruss]
|
||||
|
@ -44,6 +44,7 @@ user_string_def platform_strings[] = {
|
||||
{STR_NO_GTLAYOUT_LIB_WARN, "Cannot open gtlayout.library V39. The preferences editor GUI will not be available."},
|
||||
{STR_NO_AHI_WARN, "Cannot open ahi.device V2. Audio output will be disabled."},
|
||||
{STR_NO_AHI_CTRL_WARN, "Cannot open AHI control structure. Audio output will be disabled."},
|
||||
{STR_AHI_MODE_CTRL, "AHI Mode"},
|
||||
|
||||
{-1, NULL} // End marker
|
||||
};
|
||||
|
@ -30,11 +30,14 @@ enum {
|
||||
STR_NO_P96_MODE_ERR,
|
||||
STR_WRONG_SCREEN_DEPTH_ERR,
|
||||
STR_WRONG_SCREEN_FORMAT_ERR,
|
||||
|
||||
STR_NOT_ETHERNET_WARN,
|
||||
STR_NO_MULTICAST_WARN,
|
||||
STR_NO_GTLAYOUT_LIB_WARN,
|
||||
STR_NO_AHI_WARN,
|
||||
STR_NO_AHI_CTRL_WARN
|
||||
STR_NO_AHI_CTRL_WARN,
|
||||
|
||||
STR_AHI_MODE_CTRL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@ Basilisk II \- a free, portable Mac II emulator
|
||||
.IR display-name ]
|
||||
[\-break
|
||||
.IR offset ]
|
||||
[\-rominfo]
|
||||
.SH DESCRIPTION
|
||||
.B Basilisk II
|
||||
is an attempt at creating a free, portable 68k Mac emulator.
|
||||
@ -18,7 +19,11 @@ specifies the display to use; see
|
||||
.BR X (1)
|
||||
.TP
|
||||
.BI "\-break " offset
|
||||
specifies a ROM offset where a breakpoint will be placed
|
||||
specifies a ROM offset where a breakpoint will be placed (for debugging)
|
||||
.TP
|
||||
.B \-rominfo
|
||||
causes Basilisk II to print some information about the ROM being used on
|
||||
startup (for debugging)
|
||||
.SH FILES
|
||||
.TP
|
||||
.I /usr/share/BasiliskII/keycodes
|
||||
|
@ -60,14 +60,92 @@ void extfs_exit(void)
|
||||
* Add component to path name
|
||||
*/
|
||||
|
||||
void add_path_component(char *path, const char *component, int max_len)
|
||||
void add_path_component(char *path, const char *component)
|
||||
{
|
||||
int l = strlen(path);
|
||||
if (l < max_len-1 && path[l-1] != '/') {
|
||||
if (l < MAX_PATH_LENGTH-1 && path[l-1] != '/') {
|
||||
path[l] = '/';
|
||||
path[l+1] = 0;
|
||||
}
|
||||
strncat(path, component, max_len-1);
|
||||
strncat(path, component, MAX_PATH_LENGTH-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finder info and resource forks are kept in helper files
|
||||
*
|
||||
* Finder info:
|
||||
* /path/.finf/file
|
||||
* Resource fork:
|
||||
* /path/.rsrc/file
|
||||
*/
|
||||
|
||||
// Layout of Finder info helper files (all fields big-endian)
|
||||
struct finf_struct {
|
||||
uint32 type;
|
||||
uint32 creator;
|
||||
uint16 flags;
|
||||
};
|
||||
|
||||
static void make_helper_path(const char *src, char *dest, const char *add, bool only_dir = false)
|
||||
{
|
||||
dest[0] = 0;
|
||||
|
||||
// Get pointer to last component of path
|
||||
const char *last_part = strrchr(src, '/');
|
||||
if (last_part)
|
||||
last_part++;
|
||||
else
|
||||
last_part = src;
|
||||
|
||||
// Copy everything before
|
||||
strncpy(dest, src, last_part-src);
|
||||
dest[last_part-src] = 0;
|
||||
|
||||
// Add additional component
|
||||
strncat(dest, add, MAX_PATH_LENGTH-1);
|
||||
|
||||
// Add last component
|
||||
if (!only_dir)
|
||||
strncat(dest, last_part, MAX_PATH_LENGTH-1);
|
||||
}
|
||||
|
||||
static int create_helper_dir(const char *path, const char *add)
|
||||
{
|
||||
char helper_dir[MAX_PATH_LENGTH];
|
||||
make_helper_path(path, helper_dir, add, true);
|
||||
return mkdir(helper_dir, 0755);
|
||||
}
|
||||
|
||||
static int open_helper(const char *path, const char *add, int flag)
|
||||
{
|
||||
char helper_path[MAX_PATH_LENGTH];
|
||||
make_helper_path(path, helper_path, add);
|
||||
|
||||
if ((flag & O_RDWR) || (flag && O_WRONLY))
|
||||
flag |= O_CREAT;
|
||||
int fd = open(helper_path, flag, 0644);
|
||||
if (fd < 0) {
|
||||
if (errno == ENOENT && (flag & O_CREAT)) {
|
||||
// One path component was missing, probably the helper
|
||||
// directory. Try to create it and re-open the file.
|
||||
int ret = create_helper_dir(path, add);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
fd = open(helper_path, flag, 0644);
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static int open_finf(const char *path, int flag)
|
||||
{
|
||||
return open_helper(path, ".finf/", flag);
|
||||
}
|
||||
|
||||
static int open_rsrc(const char *path, int flag)
|
||||
{
|
||||
return open_helper(path, ".rsrc/", flag);
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +219,24 @@ void get_finder_type(const char *path, uint32 &type, uint32 &creator)
|
||||
type = 0;
|
||||
creator = 0;
|
||||
|
||||
// Translate file name extension to MacOS type/creator
|
||||
// Open Finder info file
|
||||
int fd = open_finf(path, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
|
||||
// Read file
|
||||
finf_struct finf;
|
||||
if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) {
|
||||
|
||||
// Type/creator are in Finder info file, return them
|
||||
type = ntohl(finf.type);
|
||||
creator = ntohl(finf.creator);
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
// No Finder info file, 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);
|
||||
@ -157,20 +252,66 @@ void get_finder_type(const char *path, uint32 &type, uint32 &creator)
|
||||
|
||||
void set_finder_type(const char *path, uint32 type, uint32 creator)
|
||||
{
|
||||
// Open Finder info file
|
||||
int fd = open_finf(path, O_RDWR);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
// Read file
|
||||
finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS};
|
||||
read(fd, &finf, sizeof(finf_struct));
|
||||
|
||||
// Set Finder flags
|
||||
finf.type = htonl(type);
|
||||
finf.creator = htonl(creator);
|
||||
|
||||
// Update file
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
write(fd, &finf, sizeof(finf_struct));
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get/set finder flags for file/dir specified by full path (MACOS:HFS_FLAGS attribute)
|
||||
* Get/set finder flags for file/dir specified by full path
|
||||
*/
|
||||
|
||||
void get_finder_flags(const char *path, uint16 &flags)
|
||||
{
|
||||
flags = DEFAULT_FINDER_FLAGS; // Default
|
||||
|
||||
// Open Finder info file
|
||||
int fd = open_finf(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
// Read Finder flags
|
||||
finf_struct finf;
|
||||
if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct))
|
||||
flags = ntohs(finf.flags);
|
||||
|
||||
// Close file
|
||||
close(fd);
|
||||
}
|
||||
|
||||
void set_finder_flags(const char *path, uint16 flags)
|
||||
{
|
||||
// Open Finder info file
|
||||
int fd = open_finf(path, O_RDWR);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
// Read file
|
||||
finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS};
|
||||
read(fd, &finf, sizeof(finf_struct));
|
||||
|
||||
// Set Finder flags
|
||||
finf.flags = htons(flags);
|
||||
|
||||
// Update file
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
write(fd, &finf, sizeof(finf_struct));
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
@ -180,16 +321,27 @@ void set_finder_flags(const char *path, uint16 flags)
|
||||
|
||||
uint32 get_rfork_size(const char *path)
|
||||
{
|
||||
return 0;
|
||||
// Open resource file
|
||||
int fd = open_rsrc(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
// Get size
|
||||
off_t size = lseek(fd, 0, SEEK_END);
|
||||
|
||||
// Close file and return size
|
||||
close(fd);
|
||||
return size < 0 ? 0 : size;
|
||||
}
|
||||
|
||||
int open_rfork(const char *path, int flag)
|
||||
{
|
||||
return -1;
|
||||
return open_rsrc(path, flag);
|
||||
}
|
||||
|
||||
void close_rfork(const char *path, int fd)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,6 +143,8 @@ int main(int argc, char **argv)
|
||||
x_display_name = argv[i];
|
||||
else if (strcmp(argv[i], "-break") == 0 && ++i < argc)
|
||||
ROMBreakpoint = strtol(argv[i], NULL, 0);
|
||||
else if (strcmp(argv[i], "-rominfo") == 0)
|
||||
PrintROMInfo = true;
|
||||
}
|
||||
|
||||
// Open display
|
||||
|
@ -291,7 +291,7 @@ bool PrefsEditor(void)
|
||||
GtkWidget *notebook = gtk_notebook_new();
|
||||
gtk_widget_show(notebook);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
|
||||
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);
|
||||
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0);
|
||||
|
||||
create_volumes_pane(notebook);
|
||||
@ -933,6 +933,12 @@ static GtkWidget *w_keycode_file;
|
||||
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);}
|
||||
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);}
|
||||
|
||||
// "FPU Emulation" button toggled
|
||||
static void tb_fpu(GtkWidget *widget)
|
||||
{
|
||||
PrefsReplaceBool("fpu", GTK_TOGGLE_BUTTON(widget)->active);
|
||||
}
|
||||
|
||||
// "Use Raw Keycodes" button toggled
|
||||
static void tb_keycodes(GtkWidget *widget)
|
||||
{
|
||||
@ -1016,6 +1022,8 @@ static void create_memory_pane(GtkWidget *top)
|
||||
|
||||
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom");
|
||||
|
||||
make_checkbox(box, STR_FPU_CTRL, "fpu", GTK_SIGNAL_FUNC(tb_fpu));
|
||||
|
||||
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
|
||||
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
|
||||
}
|
||||
|
@ -120,6 +120,8 @@ typedef struct timeval tm_time_t;
|
||||
#define uae_u16 uint16
|
||||
#define uae_s32 int32
|
||||
#define uae_u32 uint32
|
||||
#define uae_s64 int64
|
||||
#define uae_u64 uint64
|
||||
typedef uae_u32 uaecptr;
|
||||
|
||||
/* Alignment restrictions */
|
||||
|
@ -56,6 +56,8 @@ user_string_def platform_strings[] = {
|
||||
{STR_HELP_MENU_GTK, "/_Help"},
|
||||
{STR_HELP_ITEM_ABOUT_GTK, "/Help/_About Basilisk II"},
|
||||
|
||||
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
||||
{STR_KEYCODE_FILE_CTRL, "Keycode Translation File"},
|
||||
{STR_FBDEV_NAME_CTRL, "Frame Buffer Name"},
|
||||
{STR_FBDEVICE_FILE_CTRL, "Frame Buffer Spec File"},
|
||||
|
||||
|
@ -47,6 +47,8 @@ enum {
|
||||
STR_HELP_MENU_GTK,
|
||||
STR_HELP_ITEM_ABOUT_GTK,
|
||||
|
||||
STR_KEYCODES_CTRL,
|
||||
STR_KEYCODE_FILE_CTRL,
|
||||
STR_FBDEV_NAME_CTRL,
|
||||
STR_FBDEVICE_FILE_CTRL
|
||||
};
|
||||
|
@ -430,7 +430,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
||||
r->d[0] = 0;
|
||||
break;
|
||||
default:
|
||||
printf("FATAL: MemoryDispatch(%d): unimplemented selector\n", sel);
|
||||
printf("WARNING: MemoryDispatch(%d): unimplemented selector\n", sel);
|
||||
r->d[0] = (uint32)-502;
|
||||
break;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ enum {
|
||||
fsAllocateVCB = 562, // UTAllocateVCB(uint16 *sysVCBLength{a0}, uint32 *vcb{a1})
|
||||
fsAddNewVCB = 578, // UTAddNewVCB(int drive_number{d0}, int16 *vRefNum{a1}, uint32 vcb{a1})
|
||||
fsDetermineVol = 594, // UTDetermineVol(uint32 pb{a0}, int16 *status{a1}, int16 *more_matches{a2}, int16 *vRefNum{a3}, uint32 *vcb{a4})
|
||||
fsResolveWDCB = 614, // UTResolveWDCB(int16 vRefNum{d0}, uint32 *wdcb{a0})
|
||||
fsResolveWDCB = 614, // UTResolveWDCB(uint32 procID{d0}, int16 index{d1}, int16 vRefNum{d0}, uint32 *wdcb{a0})
|
||||
fsGetDefaultVol = 632, // UTGetDefaultVol(uint32 wdpb{a0})
|
||||
fsGetPathComponentName = 644, // UTGetPathComponentName(uint32 rec{a0})
|
||||
fsParsePathname = 656, // UTParsePathname(uint32 *start{a0}, uint32 name{a1})
|
||||
@ -201,12 +201,11 @@ static FSItem *find_fsitem(const char *name, FSItem *parent)
|
||||
* Get full path (->full_path) for given FSItem
|
||||
*/
|
||||
|
||||
const int MAX_PATH_LENGTH = 1024;
|
||||
static char full_path[MAX_PATH_LENGTH];
|
||||
|
||||
static void add_path_comp(const char *s)
|
||||
{
|
||||
add_path_component(full_path, s, MAX_PATH_LENGTH);
|
||||
add_path_component(full_path, s);
|
||||
}
|
||||
|
||||
static void get_path_for_fsitem(FSItem *p)
|
||||
@ -463,9 +462,9 @@ void InstallExtFS(void)
|
||||
if (p - fs_data != fsResolveWDCB)
|
||||
goto fsdat_error;
|
||||
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
|
||||
WriteMacInt16(p, 0x42a7); p+= 2; // clr.l -(sp)
|
||||
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
|
||||
WriteMacInt16(p, 0x3f00); p+= 2; // move.w d0,-(sp)
|
||||
WriteMacInt16(p, 0x2f00); p+= 2; // move.l d0,-(sp)
|
||||
WriteMacInt16(p, 0x3f01); p+= 2; // move.w d1,-(sp)
|
||||
WriteMacInt16(p, 0x3f02); p+= 2; // move.w d2,-(sp)
|
||||
WriteMacInt16(p, 0x2f08); p+= 2; // move.l a0,-(sp)
|
||||
WriteMacInt16(p, 0x700e); p+= 2; // UTResolveWDCB
|
||||
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
|
||||
@ -733,7 +732,9 @@ static int16 get_current_dir(uint32 pb, uint32 dirID, uint32 ¤t_dir, bool
|
||||
current_dir = dirID;
|
||||
else {
|
||||
D(bug(" resolving WDCB\n"));
|
||||
r.d[0] = ReadMacInt16(pb + ioVRefNum);
|
||||
r.d[0] = 0;
|
||||
r.d[1] = 0;
|
||||
r.d[2] = ReadMacInt16(pb + ioVRefNum);
|
||||
r.a[0] = fs_data + fsReturn;
|
||||
Execute68k(fs_data + fsResolveWDCB, &r);
|
||||
uint32 wdcb = ReadMacInt32(fs_data + fsReturn);
|
||||
@ -1153,7 +1154,7 @@ static int16 fs_get_file_info(uint32 pb, bool hfs, uint32 dirID)
|
||||
D(bug(" fs_get_file_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), dirID));
|
||||
|
||||
FSItem *fs_item;
|
||||
int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex);
|
||||
int16 dir_index = ReadMacInt16(pb + ioFDirIndex);
|
||||
if (dir_index <= 0) { // Query item specified by ioDirID and ioNamePtr
|
||||
|
||||
// Find FSItem for given file
|
||||
@ -1274,7 +1275,7 @@ static int16 fs_get_cat_info(uint32 pb)
|
||||
D(bug(" fs_get_cat_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID)));
|
||||
|
||||
FSItem *fs_item;
|
||||
int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex);
|
||||
int16 dir_index = ReadMacInt16(pb + ioFDirIndex);
|
||||
if (dir_index < 0) { // Query directory specified by ioDirID
|
||||
|
||||
// Find FSItem for directory
|
||||
@ -2007,7 +2008,7 @@ static int16 fs_open_wd(uint32 pb)
|
||||
D(bug(" allocating WDCB\n"));
|
||||
r.a[0] = pb;
|
||||
Execute68k(fs_data + fsAllocateWDCB, &r);
|
||||
D(bug(" UTAllocateWDCB returned %d\n", r.d[0]));
|
||||
D(bug(" UTAllocateWDCB returned %d, refNum is %d\n", r.d[0], ReadMacInt16(pb + ioVRefNum)));
|
||||
return r.d[0];
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ extern int16 ExtFSHFS(uint32 vcb, uint16 selectCode, uint32 paramBlock, uint32 g
|
||||
// System specific and internal functions/data
|
||||
extern void extfs_init(void);
|
||||
extern void extfs_exit(void);
|
||||
extern void add_path_component(char *path, const char *component, int max_len);
|
||||
extern void add_path_component(char *path, const char *component);
|
||||
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);
|
||||
@ -43,4 +43,7 @@ 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);
|
||||
|
||||
// Maximum length of full path name
|
||||
const int MAX_PATH_LENGTH = 1024;
|
||||
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ enum {
|
||||
|
||||
extern uint16 ROMVersion;
|
||||
|
||||
// ROM offset of breakpoint
|
||||
// ROM offset of breakpoint, used by PatchROM()
|
||||
extern uint32 ROMBreakpoint;
|
||||
|
||||
// ROM offset of UniversalInfo, set by PatchROM()
|
||||
@ -41,6 +41,9 @@ extern uint32 UniversalInfo;
|
||||
// Mac address of PutScrap() patch
|
||||
extern uint32 PutScrapPatch;
|
||||
|
||||
// Flag: print ROM information in PatchROM()
|
||||
extern bool PrintROMInfo;
|
||||
|
||||
extern bool CheckROM(void);
|
||||
extern bool PatchROM(void);
|
||||
extern void InstallDrivers(uint32 pb);
|
||||
|
@ -160,7 +160,6 @@ enum {
|
||||
STR_24_BIT_1280x1024_LAB,
|
||||
STR_24_BIT_1600x1200_LAB,
|
||||
STR_SOUND_CTRL,
|
||||
STR_AHI_MODE_CTRL,
|
||||
STR_NOSOUND_CTRL,
|
||||
|
||||
STR_SERIAL_NETWORK_PANE_TITLE = 3500, // Serial/Networking pane
|
||||
@ -177,8 +176,7 @@ enum {
|
||||
STR_MODELID_5_LAB,
|
||||
STR_MODELID_14_LAB,
|
||||
STR_ROM_FILE_CTRL,
|
||||
STR_KEYCODES_CTRL,
|
||||
STR_KEYCODE_FILE_CTRL,
|
||||
STR_FPU_CTRL,
|
||||
|
||||
// Mac window
|
||||
STR_WINDOW_TITLE = 4000,
|
||||
|
@ -38,12 +38,11 @@
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
// Breakpoint (offset into ROM)
|
||||
uint32 ROMBreakpoint = 0; // 0 = disabled, 0x2310 = CritError
|
||||
|
||||
// Global variables
|
||||
uint32 UniversalInfo; // ROM offset of UniversalInfo
|
||||
uint32 PutScrapPatch; // Mac address of PutScrap() patch
|
||||
uint32 UniversalInfo; // ROM offset of UniversalInfo
|
||||
uint32 PutScrapPatch; // Mac address of PutScrap() patch
|
||||
uint32 ROMBreakpoint = 0; // ROM offset of breakpoint (0 = disabled, 0x2310 = CritError)
|
||||
bool PrintROMInfo = false; // Flag: print ROM information in PatchROM()
|
||||
|
||||
static uint32 sony_offset; // ROM offset of .Sony driver
|
||||
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers)
|
||||
@ -140,6 +139,161 @@ again:
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print ROM information to stream,
|
||||
*/
|
||||
|
||||
static void list_rom_resources(void)
|
||||
{
|
||||
printf("ROM Resources:\n");
|
||||
printf("Offset\t Type\tID\tSize\tName\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
uint32 lp = ROMBaseMac + ReadMacInt32(ROMBaseMac + 0x1a);
|
||||
uint32 rsrc_ptr = ReadMacInt32(lp);
|
||||
|
||||
for (;;) {
|
||||
lp = ROMBaseMac + rsrc_ptr;
|
||||
uint32 data = ReadMacInt32(lp + 12);
|
||||
|
||||
char name[32];
|
||||
int name_len = ReadMacInt8(lp + 23), i;
|
||||
for (i=0; i<name_len; i++)
|
||||
name[i] = ReadMacInt8(lp + 24 + i);
|
||||
name[i] = 0;
|
||||
|
||||
printf("%08x %c%c%c%c\t%d\t%d\t%s\n", data, ReadMacInt8(lp + 16), ReadMacInt8(lp + 17), ReadMacInt8(lp + 18), ReadMacInt8(lp + 19), ReadMacInt16(lp + 20), ReadMacInt32(ROMBaseMac + data - 8), name);
|
||||
|
||||
rsrc_ptr = ReadMacInt32(lp + 8);
|
||||
if (!rsrc_ptr)
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// Mapping of Model IDs to Model names
|
||||
struct mac_desc {
|
||||
char *name;
|
||||
int32 id;
|
||||
};
|
||||
|
||||
static mac_desc MacDesc[] = {
|
||||
{"Classic" , 1},
|
||||
{"Mac XL" , 2},
|
||||
{"Mac 512KE" , 3},
|
||||
{"Mac Plus" , 4},
|
||||
{"Mac SE" , 5},
|
||||
{"Mac II" , 6},
|
||||
{"Mac IIx" , 7},
|
||||
{"Mac IIcx" , 8},
|
||||
{"Mac SE/030" , 9},
|
||||
{"Mac Portable" , 10},
|
||||
{"Mac IIci" , 11},
|
||||
{"Mac IIfx" , 13},
|
||||
{"Mac Classic" , 17},
|
||||
{"Mac IIsi" , 18},
|
||||
{"Mac LC" , 19},
|
||||
{"Quadra 900" , 20},
|
||||
{"PowerBook 170" , 21},
|
||||
{"Quadra 700" , 22},
|
||||
{"Classic II" , 23},
|
||||
{"PowerBook 100" , 24},
|
||||
{"PowerBook 140" , 25},
|
||||
{"Quadra 950" , 26},
|
||||
{"Mac LCIII/Performa 450", 27},
|
||||
{"PowerBook Duo 210" , 29},
|
||||
{"Centris 650" , 30},
|
||||
{"PowerBook Duo 230" , 32},
|
||||
{"PowerBook 180" , 33},
|
||||
{"PowerBook 160" , 34},
|
||||
{"Quadra 800" , 35},
|
||||
{"Quadra 650" , 36},
|
||||
{"Mac LCII" , 37},
|
||||
{"PowerBook Duo 250" , 38},
|
||||
{"Mac IIvi" , 44},
|
||||
{"Mac IIvm/Performa 600", 45},
|
||||
{"Mac IIvx" , 48},
|
||||
{"Color Classic/Performa 250", 49},
|
||||
{"PowerBook 165c" , 50},
|
||||
{"Centris 610" , 52},
|
||||
{"Quadra 610" , 53},
|
||||
{"PowerBook 145" , 54},
|
||||
{"Mac LC520" , 56},
|
||||
{"Quadra/Centris 660AV" , 60},
|
||||
{"Performa 46x" , 62},
|
||||
{"PowerBook 180c" , 71},
|
||||
{"PowerBook 520/520c/540/540c", 72},
|
||||
{"PowerBook Duo 270c" , 77},
|
||||
{"Quadra 840AV" , 78},
|
||||
{"Performa 550" , 80},
|
||||
{"PowerBook 165" , 84},
|
||||
{"PowerBook 190" , 85},
|
||||
{"Mac TV" , 88},
|
||||
{"Mac LC475/Performa 47x", 89},
|
||||
{"Mac LC575" , 92},
|
||||
{"Quadra 605" , 94},
|
||||
{"Quadra 630" , 98},
|
||||
{"Mac LC580" , 99},
|
||||
{"PowerBook Duo 280" , 102},
|
||||
{"PowerBook Duo 280c" , 103},
|
||||
{"PowerBook 150" , 115},
|
||||
{"unknown", -1}
|
||||
};
|
||||
|
||||
static void print_universal_info(uint32 info)
|
||||
{
|
||||
uint8 id = ReadMacInt8(info + 18);
|
||||
uint16 hwcfg = ReadMacInt16(info + 16);
|
||||
uint16 rom85 = ReadMacInt16(info + 20);
|
||||
|
||||
// Find model name
|
||||
char *name = "unknown";
|
||||
for (int i=0; MacDesc[i].id >= 0; i++)
|
||||
if (MacDesc[i].id == id + 6) {
|
||||
name = MacDesc[i].name;
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%08x %02x\t%04x\t%04x\t%s\n", info - ROMBaseMac, id, hwcfg, rom85, name);
|
||||
}
|
||||
|
||||
static void list_universal_infos(void)
|
||||
{
|
||||
uint32 ofs = 0x3000;
|
||||
for (int i=0; i<0x2000; i+=2, ofs+=2)
|
||||
if (ReadMacInt32(ROMBaseMac + ofs) == 0xdc000505) {
|
||||
ofs -= 16;
|
||||
uint32 q;
|
||||
for (q=ofs; q > 0 && ReadMacInt32(ROMBaseMac + q) != ofs - q; q-=4) ;
|
||||
if (q > 0) {
|
||||
printf("Universal Table at %08x:\n", q);
|
||||
printf("Offset\t ID\tHWCfg\tROM85\tModel\n");
|
||||
printf("------------------------------------------------\n");
|
||||
while (ofs = ReadMacInt32(ROMBaseMac + q)) {
|
||||
print_universal_info(ROMBaseMac + ofs + q);
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void print_rom_info(void)
|
||||
{
|
||||
printf("\nROM Info:\n");
|
||||
printf("Checksum : %08x\n", ReadMacInt32(ROMBaseMac));
|
||||
printf("Version : %04x\n", ROMVersion);
|
||||
printf("Sub Version : %04x\n", ReadMacInt16(ROMBaseMac + 18));
|
||||
printf("Resource Map: %08x\n", ReadMacInt32(ROMBaseMac + 26));
|
||||
printf("Trap Tables : %08x\n\n", ReadMacInt32(ROMBaseMac + 34));
|
||||
if (ROMVersion == ROM_VERSION_32) {
|
||||
list_rom_resources();
|
||||
list_universal_infos();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Driver stubs
|
||||
*/
|
||||
@ -1442,11 +1596,9 @@ static bool patch_rom_32(void)
|
||||
|
||||
bool PatchROM(void)
|
||||
{
|
||||
// Print ROM info
|
||||
D(bug("ROM Info:\n"));
|
||||
D(bug("Checksum: %08lx\n", ReadMacInt32(ROMBaseMac)));
|
||||
D(bug("Version: %04x\n", ROMVersion));
|
||||
D(bug("Sub Version: %04x\n", ReadMacInt16(ROMBaseMac + 18)));
|
||||
// Print some information about the ROM
|
||||
if (PrintROMInfo)
|
||||
print_rom_info();
|
||||
|
||||
// Patch ROM depending on version
|
||||
switch (ROMVersion) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -175,7 +175,6 @@ user_string_def common_strings[] = {
|
||||
{STR_24_BIT_1280x1024_LAB, "1280x1024, 24 Bit"},
|
||||
{STR_24_BIT_1600x1200_LAB, "1600x1200, 24 Bit"},
|
||||
{STR_SOUND_CTRL, "Sound"},
|
||||
{STR_AHI_MODE_CTRL, "AHI Mode"},
|
||||
{STR_NOSOUND_CTRL, "Disable Sound Output"},
|
||||
|
||||
{STR_SERIAL_NETWORK_PANE_TITLE, "Serial/Network"},
|
||||
@ -192,8 +191,7 @@ user_string_def common_strings[] = {
|
||||
{STR_MODELID_5_LAB, "Mac IIci (MacOS 7.x)"},
|
||||
{STR_MODELID_14_LAB, "Quadra 900 (MacOS 8.x)"},
|
||||
{STR_ROM_FILE_CTRL, "ROM File"},
|
||||
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
||||
{STR_KEYCODE_FILE_CTRL, "Keycode Translation File"},
|
||||
{STR_FPU_CTRL, "FPU Emulation"},
|
||||
|
||||
{STR_WINDOW_TITLE, "Basilisk II"},
|
||||
{STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"},
|
||||
|
Loading…
Reference in New Issue
Block a user