49 |
|
#endif |
50 |
|
|
51 |
|
#include "cpu_emulation.h" |
52 |
– |
#include "macos_util.h" |
52 |
|
#include "emul_op.h" |
53 |
|
#include "main.h" |
54 |
|
#include "disk.h" |
107 |
|
static struct stat root_stat; |
108 |
|
|
109 |
|
// File system ID/media type |
110 |
< |
const int16 MY_FSID = 'ba'; |
111 |
< |
const uint32 MY_MEDIA_TYPE = 'basi'; |
110 |
> |
const int16 MY_FSID = EMULATOR_ID_2; |
111 |
> |
const uint32 MY_MEDIA_TYPE = EMULATOR_ID_4; |
112 |
|
|
113 |
|
// CNID of root and root's parent |
114 |
|
const uint32 ROOT_ID = 2; |
276 |
|
} |
277 |
|
} |
278 |
|
|
280 |
– |
// Convert pascal string to C string |
281 |
– |
static void pstr2cstr(char *dst, const char *src) |
282 |
– |
{ |
283 |
– |
int size = *src++; |
284 |
– |
while (size--) { |
285 |
– |
char c = *src++; |
286 |
– |
// Note: we are converting Mac '/' characters to host ':' characters here |
287 |
– |
// '/' is not a path separator as this function is only used on object names |
288 |
– |
if (c == '/') |
289 |
– |
c = ':'; |
290 |
– |
*dst++ = c; |
291 |
– |
} |
292 |
– |
*dst = 0; |
293 |
– |
} |
294 |
– |
|
279 |
|
// Convert string (no length byte) to C string, length given separately |
280 |
|
static void strn2cstr(char *dst, const char *src, int size) |
281 |
|
{ |
407 |
|
// FSM present? |
408 |
|
r.d[0] = gestaltFSAttr; |
409 |
|
Execute68kTrap(0xa1ad, &r); // Gestalt() |
410 |
< |
D(bug("FSAttr %ld, %08lx\n", r.d[0], r.a[0])); |
410 |
> |
D(bug("FSAttr %d, %08x\n", r.d[0], r.a[0])); |
411 |
|
if ((r.d[0] & 0xffff) || !(r.a[0] & (1 << gestaltHasFileSystemManager))) { |
412 |
|
printf("WARNING: No FSM present, disabling ExtFS\n"); |
413 |
|
return; |
416 |
|
// Yes, version >=1.2? |
417 |
|
r.d[0] = gestaltFSMVersion; |
418 |
|
Execute68kTrap(0xa1ad, &r); // Gestalt() |
419 |
< |
D(bug("FSMVersion %ld, %08lx\n", r.d[0], r.a[0])); |
419 |
> |
D(bug("FSMVersion %d, %08x\n", r.d[0], r.a[0])); |
420 |
|
if ((r.d[0] & 0xffff) || (r.a[0] < 0x0120)) { |
421 |
|
printf("WARNING: FSM <1.2 found, disabling ExtFS\n"); |
422 |
|
return; |
686 |
|
} |
687 |
|
|
688 |
|
case ffsIDDiskMessage: { // Check if volume is handled by our FS |
689 |
< |
if (ReadMacInt16(paramBlock + ioVRefNum) == drive_number) |
689 |
> |
if ((int16)ReadMacInt16(paramBlock + ioVRefNum) == drive_number) |
690 |
|
return noErr; |
691 |
|
else |
692 |
|
return extFSErr; |
950 |
|
static int16 fs_mount_vol(uint32 pb) |
951 |
|
{ |
952 |
|
D(bug(" fs_mount_vol(%08lx), vRefNum %d\n", pb, ReadMacInt16(pb + ioVRefNum))); |
953 |
< |
if (ReadMacInt16(pb + ioVRefNum) == drive_number) |
953 |
> |
if ((int16)ReadMacInt16(pb + ioVRefNum) == drive_number) |
954 |
|
return noErr; |
955 |
|
else |
956 |
|
return extFSErr; |
1568 |
|
|
1569 |
|
// Find FCB by index |
1570 |
|
WriteMacInt16(pb + ioRefNum, 0); |
1571 |
< |
for (int i=0; i<ReadMacInt16(pb + ioFCBIndx); i++) { |
1571 |
> |
for (int i=0; i<(int)ReadMacInt16(pb + ioFCBIndx); i++) { |
1572 |
|
D(bug(" indexing FCBs\n")); |
1573 |
|
r.a[0] = vcb; |
1574 |
|
r.a[1] = pb + ioRefNum; |
1787 |
|
uint32 pos = lseek(fd, 0, SEEK_CUR); |
1788 |
|
WriteMacInt32(fcb + fcbCrPs, pos); |
1789 |
|
WriteMacInt32(pb + ioPosOffset, pos); |
1790 |
< |
if (actual != ReadMacInt32(pb + ioReqCount)) |
1790 |
> |
if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount)) |
1791 |
|
return actual < 0 ? read_err : eofErr; |
1792 |
|
else |
1793 |
|
return noErr; |
1840 |
|
uint32 pos = lseek(fd, 0, SEEK_CUR); |
1841 |
|
WriteMacInt32(fcb + fcbCrPs, pos); |
1842 |
|
WriteMacInt32(pb + ioPosOffset, pos); |
1843 |
< |
if (actual != ReadMacInt32(pb + ioReqCount)) |
1843 |
> |
if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount)) |
1844 |
|
return write_err; |
1845 |
|
else |
1846 |
|
return noErr; |