Merge remote-tracking branch 'upstream/master' into feature/mtrr

This commit is contained in:
Jasmine Iwanek
2022-11-26 14:53:41 -05:00
19 changed files with 1572 additions and 251 deletions

View File

@@ -1158,10 +1158,14 @@ EOF
# Run appimage-builder in extract-and-run mode for Docker compatibility.
# --appdir is a workaround for https://github.com/AppImageCrafters/appimage-builder/issues/270
project="$project" project_id="$project_id" project_version="$project_version" project_icon="$project_icon" arch_deb="$arch_deb" \
arch_appimage="$arch_appimage" appimage_path="$cwd/$package_name.AppImage" APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage \
--recipe AppImageBuilder-generated.yml --appdir "$(grep -oP '^\s+path: \K(.+)' AppImageBuilder-generated.yml)"
status=$?
for retry in 1 2 3 4 5
do
project="$project" project_id="$project_id" project_version="$project_version" project_icon="$project_icon" arch_deb="$arch_deb" \
arch_appimage="$arch_appimage" appimage_path="$cwd/$package_name.AppImage" APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage \
--recipe AppImageBuilder-generated.yml --appdir "$(grep -oP '^\s+path: \K(.+)' AppImageBuilder-generated.yml)"
status=$?
[ $status -eq 0 ] && break
done
# Remove appimage-builder binary on failure, just in case it's corrupted.
[ $status -ne 0 ] && rm -f "$appimage_builder_binary"

View File

@@ -89,9 +89,9 @@ enum {
};
enum {
VISO_FORMAT_HSF = 0, /* High Sierra */
VISO_FORMAT_ISO, /* ISO 9660 */
VISO_FORMAT_ISO_LFN /* ISO 9660 with Joliet and Rock Ridge */
VISO_FORMAT_ISO = 1, /* ISO 9660 (High Sierra if not set) */
VISO_FORMAT_JOLIET = 2, /* Joliet extensions (Microsoft) */
VISO_FORMAT_RR = 4 /* Rock Ridge extensions (*nix) */
};
typedef struct _viso_entry_ {
@@ -115,7 +115,7 @@ typedef struct _viso_entry_ {
typedef struct {
uint64_t vol_size_offsets[2], pt_meta_offsets[2];
int format;
int format, use_version_suffix : 1;
size_t metadata_sectors, all_sectors, entry_map_size, sector_size, file_fifo_pos;
uint8_t *metadata;
@@ -300,7 +300,7 @@ static int
viso_fill_fn_short(char *data, const viso_entry_t *entry, viso_entry_t **entries)
{
/* Get name and extension length. */
const char *ext_pos = S_ISDIR(entry->stats.st_mode) ? NULL : strrchr(entry->basename, '.');
const char *ext_pos = strrchr(entry->basename, '.');
int name_len, ext_len;
if (ext_pos) {
name_len = ext_pos - entry->basename;
@@ -444,7 +444,7 @@ viso_fill_time(uint8_t *data, time_t time, int format, int longform)
time_s->tm_mday = 1;
} else if (time_s->tm_year > (longform ? 8099 : 255)) {
time_s->tm_year = longform ? 8099 : 255;
time_s->tm_mon = 12;
time_s->tm_mon = 11;
time_s->tm_mday = 31;
time_s->tm_hour = 23;
time_s->tm_min = time_s->tm_sec = 59;
@@ -463,14 +463,14 @@ viso_fill_time(uint8_t *data, time_t time, int format, int longform)
*p++ = time_s->tm_min; /* minute */
*p++ = time_s->tm_sec; /* second */
}
if (format >= VISO_FORMAT_ISO)
if (format & VISO_FORMAT_ISO)
*p++ = tz_offset; /* timezone (ISO only) */
return p - data;
}
static int
viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, viso_t *viso, int type)
{
uint8_t *p = data, *q, *r;
@@ -482,11 +482,11 @@ viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
if (entry->stats.st_mtime < 0)
pclog("VISO: Warning: Windows returned st_mtime %lld on file [%s]\n", (long long) entry->stats.st_mtime, entry->path);
#endif
p += viso_fill_time(p, entry->stats.st_mtime, format, 0); /* time */
*p++ = S_ISDIR(entry->stats.st_mode) ? 0x02 : 0x00; /* flags */
p += viso_fill_time(p, entry->stats.st_mtime, viso->format, 0); /* time */
*p++ = S_ISDIR(entry->stats.st_mode) ? 0x02 : 0x00; /* flags */
VISO_SKIP(p, 2 + (format <= VISO_FORMAT_HSF)); /* file unit size (reserved on HSF), interleave gap size (HSF/ISO) and skip factor (HSF only) */
VISO_LBE_16(p, 1); /* volume sequence number */
VISO_SKIP(p, 2 + !(viso->format & VISO_FORMAT_ISO)); /* file unit size (reserved on HSF), interleave gap size (HSF/ISO) and skip factor (HSF only) */
VISO_LBE_16(p, 1); /* volume sequence number */
switch (type) {
case VISO_DIR_CURRENT:
@@ -496,7 +496,7 @@ viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
*p++ = (type == VISO_DIR_PARENT) ? 1 : 0; /* magic value corresponding to . or .. */
/* Fill Rock Ridge Extension Record for the root directory's . entry. */
if ((type == VISO_DIR_CURRENT_ROOT) && (format >= VISO_FORMAT_ISO_LFN)) {
if ((type == VISO_DIR_CURRENT_ROOT) && (viso->format & VISO_FORMAT_RR)) {
*p++ = 'E';
*p++ = 'R';
*p++ = 8 + (sizeof(rr_eid) - 1) + (sizeof(rr_edesc) - 1); /* length */
@@ -522,8 +522,8 @@ viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
*q = strlen(entry->name_short);
memcpy(p, entry->name_short, *q); /* file ID */
p += *q;
if ((format >= VISO_FORMAT_ISO) && !S_ISDIR(entry->stats.st_mode)) {
*p++ = ';'; /* version suffix for files (ISO only?) */
if (viso->use_version_suffix && !S_ISDIR(entry->stats.st_mode)) {
*p++ = ';'; /* version suffix for files (ISO only, except for Windows NT SETUPLDR.BIN El Torito hack) */
*p++ = '1';
*q += 2;
}
@@ -532,7 +532,7 @@ viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
*p++ = 0;
/* Fill Rock Ridge data. */
if (format >= VISO_FORMAT_ISO_LFN) {
if (viso->format & VISO_FORMAT_RR) {
*p++ = 'R'; /* RR = present Rock Ridge entries (only documented by RRIP revision 1.09!) */
*p++ = 'R';
*p++ = 5; /* length */
@@ -588,14 +588,14 @@ viso_fill_dir_record(uint8_t *data, viso_entry_t *entry, int format, int type)
*p++ = times; /* flags */
#ifdef st_birthtime
if (times & (1 << 0))
p += viso_fill_time(p, entry->stats.st_birthtime, format, 0); /* creation */
p += viso_fill_time(p, entry->stats.st_birthtime, viso->format, 0); /* creation */
#endif
if (times & (1 << 1))
p += viso_fill_time(p, entry->stats.st_mtime, format, 0); /* modify */
p += viso_fill_time(p, entry->stats.st_mtime, viso->format, 0); /* modify */
if (times & (1 << 2))
p += viso_fill_time(p, entry->stats.st_atime, format, 0); /* access */
p += viso_fill_time(p, entry->stats.st_atime, viso->format, 0); /* access */
if (times & (1 << 3))
p += viso_fill_time(p, entry->stats.st_ctime, format, 0); /* attributes */
p += viso_fill_time(p, entry->stats.st_ctime, viso->format, 0); /* attributes */
*r += p - r; /* add to length */
}
@@ -764,8 +764,9 @@ viso_init(const char *dirname, int *error)
*error = 1;
if (viso == NULL)
goto end;
viso->sector_size = VISO_SECTOR_SIZE;
viso->format = VISO_FORMAT_ISO_LFN;
viso->sector_size = VISO_SECTOR_SIZE;
viso->format = VISO_FORMAT_ISO | VISO_FORMAT_JOLIET | VISO_FORMAT_RR;
viso->use_version_suffix = (viso->format & VISO_FORMAT_ISO); /* cleared later if required */
/* Prepare temporary data buffers. */
data = calloc(2, viso->sector_size);
@@ -797,7 +798,6 @@ viso_init(const char *dirname, int *error)
if (!dir)
goto end;
strcpy(dir->path, dirname);
strcpy(dir->name_short, "[root]");
if (stat(dirname, &dir->stats) != 0) {
/* Use a blank structure if stat failed. */
memset(&dir->stats, 0x00, sizeof(struct stat));
@@ -805,7 +805,7 @@ viso_init(const char *dirname, int *error)
if (!S_ISDIR(dir->stats.st_mode)) /* root is not a directory */
goto end;
dir->parent = dir; /* for the root's path table and .. entries */
cdrom_image_viso_log("[%08X] %s => %s\n", dir, dir->path, dir->name_short);
cdrom_image_viso_log("[%08X] %s => [root]\n", dir, dir->path);
/* Traverse directories, starting with the root. */
viso_entry_t **dir_entries = NULL;
@@ -813,16 +813,16 @@ viso_init(const char *dirname, int *error)
while (dir) {
/* Open directory for listing. */
DIR *dirp = opendir(dir->path);
if (!dirp)
goto next_dir;
/* Iterate through this directory's children to determine the entry array size. */
size_t children_count = 3; /* include terminator, . and .. */
while ((readdir_entry = readdir(dirp))) {
/* Ignore . and .. pseudo-directories. */
if ((readdir_entry->d_name[0] == '.') && ((readdir_entry->d_name[1] == '\0') || ((readdir_entry->d_name[1] == '.') && (readdir_entry->d_name[2] == '\0'))))
continue;
children_count++;
if (dirp) { /* create empty directory if opendir failed */
while ((readdir_entry = readdir(dirp))) {
/* Ignore . and .. pseudo-directories. */
if ((readdir_entry->d_name[0] == '.') && ((readdir_entry->d_name[1] == '\0') || (*((uint16_t *) &readdir_entry->d_name[1]) == '.')))
continue;
children_count++;
}
}
/* Grow array if needed. */
@@ -859,77 +859,89 @@ viso_init(const char *dirname, int *error)
}
/* Iterate through this directory's children again, making the entries. */
rewinddir(dirp);
while ((readdir_entry = readdir(dirp))) {
/* Ignore . and .. pseudo-directories. */
if ((readdir_entry->d_name[0] == '.') && ((readdir_entry->d_name[1] == '\0') || ((readdir_entry->d_name[1] == '.') && (readdir_entry->d_name[2] == '\0'))))
continue;
if (dirp) {
rewinddir(dirp);
while ((readdir_entry = readdir(dirp))) {
/* Ignore . and .. pseudo-directories. */
if ((readdir_entry->d_name[0] == '.') && ((readdir_entry->d_name[1] == '\0') || (*((uint16_t *) &readdir_entry->d_name[1]) == '.')))
continue;
/* Add and fill entry. */
entry = dir_entries[children_count++] = (viso_entry_t *) calloc(1, sizeof(viso_entry_t) + dir_path_len + strlen(readdir_entry->d_name) + 2);
if (!entry)
break;
entry->parent = dir;
strcpy(entry->path, dir->path);
path_slash(&entry->path[dir_path_len]);
entry->basename = &entry->path[dir_path_len + 1];
strcpy(entry->basename, readdir_entry->d_name);
/* Add and fill entry. */
entry = dir_entries[children_count++] = (viso_entry_t *) calloc(1, sizeof(viso_entry_t) + dir_path_len + strlen(readdir_entry->d_name) + 2);
if (!entry)
break;
entry->parent = dir;
strcpy(entry->path, dir->path);
path_slash(&entry->path[dir_path_len]);
entry->basename = &entry->path[dir_path_len + 1];
strcpy(entry->basename, readdir_entry->d_name);
/* Stat this child. */
if (stat(entry->path, &entry->stats) != 0) {
/* Use a blank structure if stat failed. */
memset(&entry->stats, 0x00, sizeof(struct stat));
}
/* Handle file size and El Torito boot code. */
if (!S_ISDIR(entry->stats.st_mode)) {
/* Clamp to 4 GB - 1 byte. */
if (entry->stats.st_size > ((uint32_t) -1))
entry->stats.st_size = (uint32_t) -1;
/* Increase entry map size. */
viso->entry_map_size += entry->stats.st_size / viso->sector_size;
if (entry->stats.st_size % viso->sector_size)
viso->entry_map_size++; /* round up to the next sector */
/* Detect El Torito boot code file and set it accordingly. */
if (dir == eltorito_dir) {
if (!stricmp(readdir_entry->d_name, "Boot-NoEmul.img")) {
eltorito_type = 0x00;
have_eltorito_entry:
if (eltorito_entry)
eltorito_others_present = 1; /* flag that the boot code directory contains other files */
eltorito_entry = entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-1.2M.img")) {
eltorito_type = 0x01;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-1.44M.img")) {
eltorito_type = 0x02;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-2.88M.img")) {
eltorito_type = 0x03;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-HardDisk.img")) {
eltorito_type = 0x04;
goto have_eltorito_entry;
} else {
eltorito_others_present = 1; /* flag that the boot code directory contains other files */
}
/* Stat this child. */
if (stat(entry->path, &entry->stats) != 0) {
/* Use a blank structure if stat failed. */
memset(&entry->stats, 0x00, sizeof(struct stat));
}
} else if ((dir == viso->root_dir) && !stricmp(readdir_entry->d_name, "[BOOT]")) {
/* Set this as the directory containing El Torito boot code. */
eltorito_dir = entry;
eltorito_others_present = 0;
}
/* Set short filename. */
if (viso_fill_fn_short(entry->name_short, entry, dir_entries)) {
free(entry);
children_count--;
continue;
}
/* Handle file size and El Torito boot code. */
if (!S_ISDIR(entry->stats.st_mode)) {
/* Clamp file size to 4 GB - 1 byte. */
if (entry->stats.st_size > ((uint32_t) -1))
entry->stats.st_size = (uint32_t) -1;
cdrom_image_viso_log("[%08X] %s => [%-12s] %s\n", entry, dir->path, entry->name_short, entry->basename);
/* Increase entry map size. */
viso->entry_map_size += entry->stats.st_size / viso->sector_size;
if (entry->stats.st_size % viso->sector_size)
viso->entry_map_size++; /* round up to the next sector */
/* Detect El Torito boot code file and set it accordingly. */
if (dir == eltorito_dir) {
if (!stricmp(readdir_entry->d_name, "Boot-NoEmul.img")) {
eltorito_type = 0x00;
have_eltorito_entry:
if (eltorito_entry)
eltorito_others_present = 1; /* flag that the boot code directory contains other files */
eltorito_entry = entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-1.2M.img")) {
eltorito_type = 0x01;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-1.44M.img")) {
eltorito_type = 0x02;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-2.88M.img")) {
eltorito_type = 0x03;
goto have_eltorito_entry;
} else if (!stricmp(readdir_entry->d_name, "Boot-HardDisk.img")) {
eltorito_type = 0x04;
goto have_eltorito_entry;
} else {
eltorito_others_present = 1; /* flag that the boot code directory contains other files */
}
} else {
/* Disable version suffixes if this structure appears to contain the Windows NT
El Torito boot code, which is known not to tolerate suffixed file names. */
if (eltorito_dir && /* El Torito directory present? */
(eltorito_type == 0x00) && /* El Torito directory not checked yet, or confirmed to contain non-emulation boot code? */
(dir->parent == viso->root_dir) && /* one subdirectory deep? (I386 for instance) */
!stricmp(readdir_entry->d_name, "SETUPLDR.BIN")) /* SETUPLDR.BIN present? */
viso->use_version_suffix = 0;
}
} else if ((dir == viso->root_dir) && !stricmp(readdir_entry->d_name, "[BOOT]")) {
/* Set this as the directory containing El Torito boot code. */
eltorito_dir = entry;
eltorito_others_present = 0;
}
/* Set short filename. */
if (viso_fill_fn_short(entry->name_short, entry, dir_entries)) {
free(entry);
children_count--;
continue;
}
cdrom_image_viso_log("[%08X] %s => [%-12s] %s\n", entry, dir->path, entry->name_short, entry->basename);
}
} else {
cdrom_image_viso_log("VISO: Failed to enumerate [%s], will be empty\n", dir->path);
}
/* Add terminator. */
@@ -951,6 +963,8 @@ have_eltorito_entry:
next_dir:
/* Move on to the next directory. */
if (dirp)
closedir(dirp);
dir = dir->next_dir;
}
if (dir_entries)
@@ -964,21 +978,26 @@ next_dir:
the timezone offset for descriptors and file times to use. */
tzset();
time_t now = time(NULL);
tz_offset = (now - mktime(gmtime(&now))) / (3600 / 4);
if (viso->format & VISO_FORMAT_ISO) /* timezones are ISO only */
tz_offset = (now - mktime(gmtime(&now))) / (3600 / 4);
/* Get root directory basename for the volume ID. */
char *basename = path_get_filename(viso->root_dir->path);
if (!basename || (basename[0] == '\0'))
basename = EMU_NAME;
/* Determine whether or not we're working with 2 volume descriptors
(as well as 2 directory trees and 4 path tables) for Joliet. */
int max_vd = (viso->format & VISO_FORMAT_JOLIET) ? 1 : 0;
/* Write volume descriptors. */
for (int i = 0; i <= (viso->format >= VISO_FORMAT_ISO_LFN); i++) {
for (int i = 0; i <= max_vd; i++) {
/* Fill volume descriptor. */
p = data;
if (viso->format <= VISO_FORMAT_HSF)
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 1 + i; /* type */
memcpy(p, (viso->format <= VISO_FORMAT_HSF) ? "CDROM" : "CD001", 5); /* standard ID */
if (!(viso->format & VISO_FORMAT_ISO))
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 1 + i; /* type */
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
p += 5;
*p++ = 1; /* version */
*p++ = 0; /* unused */
@@ -1017,11 +1036,12 @@ next_dir:
/* Path table metadata is filled in later. */
viso->pt_meta_offsets[i] = ftello64(viso->tf.file) + (p - data);
VISO_SKIP(p, 24 + (16 * (viso->format <= VISO_FORMAT_HSF))); /* PT size, LE PT offset, optional LE PT offset (three on HSF), BE PT offset, optional BE PT offset (three on HSF) */
VISO_SKIP(p, 24 + (16 * !(viso->format & VISO_FORMAT_ISO))); /* PT size, LE PT offset, optional LE PT offset (three on HSF), BE PT offset, optional BE PT offset (three on HSF) */
viso->root_dir->dr_offsets[i] = ftello64(viso->tf.file) + (p - data);
p += viso_fill_dir_record(p, viso->root_dir, viso->format, VISO_DIR_CURRENT); /* root directory */
p += viso_fill_dir_record(p, viso->root_dir, viso, VISO_DIR_CURRENT); /* root directory */
int copyright_abstract_len = (viso->format & VISO_FORMAT_ISO) ? 37 : 32;
if (i) {
viso_write_wstring((uint16_t *) p, L"", 64, VISO_CHARSET_D); /* volume set ID */
p += 128;
@@ -1031,11 +1051,11 @@ next_dir:
p += 128;
viso_write_wstring((uint16_t *) p, EMU_NAME_W L" " EMU_VERSION_W L" VIRTUAL ISO", 64, VISO_CHARSET_A); /* application ID */
p += 128;
viso_write_wstring((uint16_t *) p, L"", (viso->format <= VISO_FORMAT_HSF) ? 16 : 18, VISO_CHARSET_D); /* copyright file ID */
p += (viso->format <= VISO_FORMAT_HSF) ? 32 : 37;
viso_write_wstring((uint16_t *) p, L"", (viso->format <= VISO_FORMAT_HSF) ? 16 : 18, VISO_CHARSET_D); /* abstract file ID */
p += (viso->format <= VISO_FORMAT_HSF) ? 32 : 37;
if (viso->format >= VISO_FORMAT_ISO) {
viso_write_wstring((uint16_t *) p, L"", copyright_abstract_len >> 1, VISO_CHARSET_D); /* copyright file ID */
p += copyright_abstract_len;
viso_write_wstring((uint16_t *) p, L"", copyright_abstract_len >> 1, VISO_CHARSET_D); /* abstract file ID */
p += copyright_abstract_len;
if (viso->format & VISO_FORMAT_ISO) {
viso_write_wstring((uint16_t *) p, L"", 18, VISO_CHARSET_D); /* bibliography file ID (ISO only) */
p += 37;
}
@@ -1048,11 +1068,11 @@ next_dir:
p += 128;
viso_write_string(p, EMU_NAME " " EMU_VERSION " VIRTUAL ISO", 128, VISO_CHARSET_A); /* application ID */
p += 128;
viso_write_string(p, "", (viso->format <= VISO_FORMAT_HSF) ? 32 : 37, VISO_CHARSET_D); /* copyright file ID */
p += (viso->format <= VISO_FORMAT_HSF) ? 32 : 37;
viso_write_string(p, "", (viso->format <= VISO_FORMAT_HSF) ? 32 : 37, VISO_CHARSET_D); /* abstract file ID */
p += (viso->format <= VISO_FORMAT_HSF) ? 32 : 37;
if (viso->format >= VISO_FORMAT_ISO) {
viso_write_string(p, "", copyright_abstract_len, VISO_CHARSET_D); /* copyright file ID */
p += copyright_abstract_len;
viso_write_string(p, "", copyright_abstract_len, VISO_CHARSET_D); /* abstract file ID */
p += copyright_abstract_len;
if (viso->format & VISO_FORMAT_ISO) {
viso_write_string(p, "", 37, VISO_CHARSET_D); /* bibliography file ID (ISO only) */
p += 37;
}
@@ -1078,10 +1098,10 @@ next_dir:
cdrom_image_viso_log("VISO: Writing El Torito boot descriptor for entry [%08X]\n", eltorito_entry);
p = data;
if (viso->format <= VISO_FORMAT_HSF)
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 0; /* type */
memcpy(p, (viso->format <= VISO_FORMAT_HSF) ? "CDROM" : "CD001", 5); /* standard ID */
if (!(viso->format & VISO_FORMAT_ISO))
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 0; /* type */
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
p += 5;
*p++ = 1; /* version */
@@ -1102,10 +1122,10 @@ next_dir:
/* Fill terminator. */
p = data;
if (viso->format <= VISO_FORMAT_HSF)
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 0xff; /* type */
memcpy(p, (viso->format <= VISO_FORMAT_HSF) ? "CDROM" : "CD001", 5); /* standard ID */
if (!(viso->format & VISO_FORMAT_ISO))
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
*p++ = 0xff; /* type */
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
p += 5;
*p++ = 1; /* version */
@@ -1181,7 +1201,7 @@ next_dir:
}
/* Write each path table. */
for (int i = 0; i <= ((viso->format >= VISO_FORMAT_ISO_LFN) ? 3 : 1); i++) {
for (int i = 0; i <= ((max_vd << 1) | 1); i++) {
cdrom_image_viso_log("VISO: Generating path table #%d:\n", i);
/* Save this path table's start offset. */
@@ -1211,7 +1231,7 @@ next_dir:
/* Fill path table entry. */
p = data;
if (viso->format <= VISO_FORMAT_HSF) {
if (!(viso->format & VISO_FORMAT_ISO)) {
*((uint32_t *) p) = 0; /* extent location (filled in later) */
p += 4;
*p++ = 0; /* extended attribute length */
@@ -1227,16 +1247,17 @@ next_dir:
*((uint16_t *) p) = (i & 1) ? cpu_to_be16(dir->parent->pt_idx) : cpu_to_le16(dir->parent->pt_idx); /* parent directory number */
p += 2;
if (dir == viso->root_dir) { /* directory ID and length */
data[5 * (viso->format <= VISO_FORMAT_HSF)] = 1;
*p = 0x00;
} else if (i & 2) {
data[5 * (viso->format <= VISO_FORMAT_HSF)] = viso_fill_fn_joliet(p, dir, 255);
} else {
data[5 * (viso->format <= VISO_FORMAT_HSF)] = strlen(dir->name_short);
memcpy(p, dir->name_short, data[5 * (viso->format <= VISO_FORMAT_HSF)]);
pt_temp = 5 * !(viso->format & VISO_FORMAT_ISO); /* directory ID length at offset 0 for ISO, 5 for HSF */
if (dir == viso->root_dir) { /* directory ID length then ID for root... */
data[pt_temp] = 1;
*p = 0x00;
} else if (i & 2) { /* ...or Joliet... */
data[pt_temp] = viso_fill_fn_joliet(p, dir, 255);
} else { /* ...or short name */
data[pt_temp] = strlen(dir->name_short);
memcpy(p, dir->name_short, data[pt_temp]);
}
p += data[5 * (viso->format <= VISO_FORMAT_HSF)];
p += data[pt_temp];
if ((p - data) & 1) /* padding for odd directory ID lengths */
*p++ = 0x00;
@@ -1269,7 +1290,7 @@ next_dir:
/* Write directory records for each type. */
int dir_type = VISO_DIR_CURRENT_ROOT;
for (int i = 0; i <= (viso->format >= VISO_FORMAT_ISO_LFN); i++) {
for (int i = 0; i <= max_vd; i++) {
cdrom_image_viso_log("VISO: Generating directory record set #%d:\n", i);
/* Go through directories. */
@@ -1302,7 +1323,7 @@ next_dir:
viso_pwrite(data, dir->pt_offsets[i << 1], 4, 1, viso->tf.file); /* little endian */
viso_pwrite(data + 4, dir->pt_offsets[(i << 1) | 1], 4, 1, viso->tf.file); /* big endian */
if (i == (viso->format >= VISO_FORMAT_ISO_LFN)) /* overwrite pt_offsets in the union if we no longer need them */
if (i == max_vd) /* overwrite pt_offsets in the union if we no longer need them */
dir->file = NULL;
/* Go through entries in this directory. */
@@ -1317,7 +1338,7 @@ next_dir:
((dir_type == VISO_DIR_PARENT) ? ".." : ((dir_type < VISO_DIR_PARENT) ? "." : (i ? entry->basename : entry->name_short))));
/* Fill directory record. */
viso_fill_dir_record(data, entry, viso->format, dir_type);
viso_fill_dir_record(data, entry, viso, dir_type);
/* Entries cannot cross sector boundaries, so pad to the next sector if needed. */
write = viso->sector_size - (ftello64(viso->tf.file) % viso->sector_size);
@@ -1456,7 +1477,7 @@ next_entry:
} else {
p = data;
VISO_LBE_32(p, viso->all_sectors * base_factor);
for (int i = 0; i <= (viso->format >= VISO_FORMAT_ISO_LFN); i++)
for (int i = 0; i <= max_vd; i++)
viso_pwrite(data, entry->dr_offsets[i] + 2, 8, 1, viso->tf.file);
}

View File

@@ -340,6 +340,7 @@ extern int machine_get_ram_granularity(int m);
extern int machine_get_type(int m);
extern void machine_close(void);
extern int machine_has_mouse(void);
extern int machine_is_sony(void);
extern uint8_t machine_get_p1(void);
extern void machine_load_p1(int m);

View File

@@ -0,0 +1,44 @@
/*
* 86Box An emulator of (mostly) x86-based PC systems and devices,
* using the ISA, EISA, VLB, MCA, and PCI system buses,
* roughly spanning the era between 1981 and 1995.
*
* This file is part of the 86Box Project.
*
* Implementation of the following network controller:
* - 3Com Etherlink 3c500/3c501 (ISA 8-bit).
*
*
*
* Based on @(#)Dev3C501.cpp Oracle (VirtualBox)
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Oracle
*
* Copyright 2022 TheCollector1995.
* Portions Copyright (C) 2022 Oracle and/or its affilitates.
*
* 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 NET_3C501_H
#define NET_3C501_H
extern const device_t threec501_device;
#endif /*NET_3C501_H*/

View File

@@ -66,6 +66,7 @@ extern void ad1848_write(uint16_t addr, uint8_t val, void *priv);
extern void ad1848_update(ad1848_t *ad1848);
extern void ad1848_speed_changed(ad1848_t *ad1848);
extern void ad1848_filter_cd_audio(int channel, double *buffer, void *priv);
extern void ad1848_filter_aux2(void* priv, double* out_l, double* out_r);
extern void ad1848_init(ad1848_t *ad1848, uint8_t type);

View File

@@ -147,6 +147,9 @@ typedef struct sb_t {
pnp_rom[512];
uint16_t opl_pnp_addr;
void *opl_mixer;
void (*opl_mix)(void*, double*, double*);
} sb_t;
extern void sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p);

View File

@@ -1385,10 +1385,12 @@ m24_kbd_init(m24_kbd_t *kbd)
m24_kbd_reset(kbd);
timer_add(&kbd->send_delay_timer, m24_kbd_poll, kbd, 1);
/* Tell mouse driver about our internal mouse. */
mouse_reset();
mouse_set_buttons(2);
mouse_set_poll(ms_poll, kbd);
if (mouse_type == MOUSE_TYPE_INTERNAL) {
/* Tell mouse driver about our internal mouse. */
mouse_reset();
mouse_set_buttons(2);
mouse_set_poll(ms_poll, kbd);
}
keyboard_set_table((kbd->id == 0x01) ? scancode_olivetti_m24_deluxe : scancode_olivetti_m240);
keyboard_set_is_amstrad(0);

View File

@@ -12211,3 +12211,9 @@ machine_has_mouse(void)
{
return (machines[machine].flags & MACHINE_MOUSE);
}
int
machine_is_sony(void)
{
return (!strcmp(machines[machine].internal_name, "pcv90"));
}

View File

@@ -13,8 +13,8 @@
# Copyright 2020,2021 David Hrdlička.
#
add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c503.c
net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c net_event.c)
add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c501.c
net_3c503.c net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c net_event.c)
option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF)
mark_as_advanced(SLIRP_EXTERNAL)

1223
src/network/net_3c501.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3065,6 +3065,8 @@ static const device_config_t pcnet_isa_config[] = {
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "IRQ 10", .value = 10 },
{ .description = "IRQ 11", .value = 11 },
{ .description = "" }
},
},
@@ -3124,6 +3126,8 @@ static const device_config_t pcnet_vlb_config[] = {
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "IRQ 10", .value = 10 },
{ .description = "IRQ 11", .value = 11 },
{ .description = "" }
},
},

View File

@@ -67,6 +67,7 @@
#include <86box/ui.h>
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_3c501.h>
#include <86box/net_3c503.h>
#include <86box/net_ne2000.h>
#include <86box/net_pcnet.h>
@@ -95,6 +96,7 @@ static const device_t net_none_device = {
static const device_t *net_cards[] = {
&net_none_device,
&threec501_device,
&threec503_device,
&pcnet_am79c960_device,
&pcnet_am79c961_device,

View File

@@ -30,6 +30,7 @@
#include <86box/device.h>
#include <86box/scsi.h>
#include <86box/scsi_device.h>
#include <86box/machine.h>
#include <86box/nvr.h>
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
@@ -2373,6 +2374,8 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
} else {
if (dev->early)
ide_padstr8(dev->buffer + idx, 8, "NEC"); /* Vendor */
else if (machine_is_sony())
ide_padstr8(dev->buffer + idx, 8, "SONY"); /* Vendor */
else
ide_padstr8(dev->buffer + idx, 8, "HITACHI"); /* Vendor */
}
@@ -2389,6 +2392,8 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
} else {
if (dev->early)
ide_padstr8(dev->buffer + idx, 40, "CD-ROM DRIVE:260"); /* Product */
else if (machine_is_sony())
ide_padstr8(dev->buffer + idx, 40, "CD-ROM CDU76"); /* Product */
else
ide_padstr8(dev->buffer + idx, 40, "CDR-8130"); /* Product */
}
@@ -2446,6 +2451,10 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
ide_padstr8(dev->buffer + 8, 8, "NEC"); /* Vendor */
ide_padstr8(dev->buffer + 16, 16, "CD-ROM DRIVE:260"); /* Product */
ide_padstr8(dev->buffer + 32, 4, "1.01"); /* Revision */
} else if (machine_is_sony()) {
ide_padstr8(dev->buffer + 8, 8, "SONY"); /* Vendor */
ide_padstr8(dev->buffer + 16, 16, "CD-ROM CDU76"); /* Product */
ide_padstr8(dev->buffer + 32, 4, "1.0i"); /* Revision */
} else {
ide_padstr8(dev->buffer + 8, 8, "HITACHI"); /* Vendor */
ide_padstr8(dev->buffer + 16, 16, "CDR-8130"); /* Product */
@@ -2749,6 +2758,9 @@ scsi_cdrom_identify(ide_t *ide, int ide_has_dma)
ide_padstr((char *) (ide->buffer + 23), ".110 ", 8); /* Firmware */
ide_padstr((char *) (ide->buffer + 27), "EN C DCR-MOD IREV2:06 ", 40); /* Model */
# endif
} else if (machine_is_sony()) {
ide_padstr((char *) (ide->buffer + 23), "1.0i ", 8); /* Firmware */
ide_padstr((char *) (ide->buffer + 27), "CD-ROM CDU76 ", 40); /* Model */
} else {
ide_padstr((char *) (ide->buffer + 23), "0020 ", 8); /* Firmware */
ide_padstr((char *) (ide->buffer + 27), "HITACHI CDR-8130 ", 40); /* Model */

View File

@@ -1354,22 +1354,7 @@ t128_read(uint32_t addr, void *priv)
ret = ncr_dev->t128.status;
ncr_log("T128 status read = %02x, cur bus = %02x, req = %02x, dma = %02x\n", ret, ncr->cur_bus, ncr->cur_bus & BUS_REQ, ncr->mode & MODE_DMA);
} else if (addr >= 0x1d00 && addr < 0x1e00) {
if (addr >= 0x1d00 && addr < 0x1d20)
ret = ncr_read(0, ncr_dev);
else if (addr >= 0x1d20 && addr < 0x1d40)
ret = ncr_read(1, ncr_dev);
else if (addr >= 0x1d40 && addr < 0x1d60)
ret = ncr_read(2, ncr_dev);
else if (addr >= 0x1d60 && addr < 0x1d80)
ret = ncr_read(3, ncr_dev);
else if (addr >= 0x1d80 && addr < 0x1da0)
ret = ncr_read(4, ncr_dev);
else if (addr >= 0x1da0 && addr < 0x1dc0)
ret = ncr_read(5, ncr_dev);
else if (addr >= 0x1dc0 && addr < 0x1de0)
ret = ncr_read(6, ncr_dev);
else if (addr >= 0x1de0 && addr < 0x1e00)
ret = ncr_read(7, ncr_dev);
ret = ncr_read((addr - 0x1d00) >> 5, ncr_dev);
} else if (addr >= 0x1e00 && addr < 0x2000) {
if (ncr_dev->t128.host_pos >= MIN(512, dev->buffer_length) || ncr->dma_mode != DMA_INITIATOR_RECEIVE) {
ret = 0xff;
@@ -1408,24 +1393,9 @@ t128_write(uint32_t addr, uint8_t val, void *priv)
}
ncr_dev->t128.ctrl = val;
ncr_log("T128 ctrl write = %02x\n", val);
} else if (addr >= 0x1d00 && addr < 0x1e00) {
if (addr >= 0x1d00 && addr < 0x1d20)
ncr_write(0, val, ncr_dev);
else if (addr >= 0x1d20 && addr < 0x1d40)
ncr_write(1, val, ncr_dev);
else if (addr >= 0x1d40 && addr < 0x1d60)
ncr_write(2, val, ncr_dev);
else if (addr >= 0x1d60 && addr < 0x1d80)
ncr_write(3, val, ncr_dev);
else if (addr >= 0x1d80 && addr < 0x1da0)
ncr_write(4, val, ncr_dev);
else if (addr >= 0x1da0 && addr < 0x1dc0)
ncr_write(5, val, ncr_dev);
else if (addr >= 0x1dc0 && addr < 0x1de0)
ncr_write(6, val, ncr_dev);
else if (addr >= 0x1de0 && addr < 0x1e00)
ncr_write(7, val, ncr_dev);
} else if (addr >= 0x1e00 && addr < 0x2000) {
} else if (addr >= 0x1d00 && addr < 0x1e00)
ncr_write((addr - 0x1d00) >> 5, val, ncr_dev);
else if (addr >= 0x1e00 && addr < 0x2000) {
if (ncr_dev->t128.host_pos < MIN(512, dev->buffer_length) && ncr->dma_mode == DMA_SEND) {
ncr_dev->t128.buffer[ncr_dev->t128.host_pos] = val;
ncr_dev->t128.host_pos++;

View File

@@ -378,24 +378,27 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
case 25:
return;
case 27:
if (ad1848->type != AD1848_TYPE_DEFAULT)
return;
break;
}
ad1848->regs[ad1848->index] = val;
if (updatefreq)
ad1848_updatefreq(ad1848);
if (ad1848->type >= AD1848_TYPE_CS4231) { /* TODO: configure CD volume for CS4248/AD1848 too */
temp = (ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4;
if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_l = 0;
else
ad1848->cd_vol_l = ad1848_vols_5bits_aux_gain[ad1848->regs[temp] & 0x1f];
temp++;
if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_r = 0;
else
ad1848->cd_vol_r = ad1848_vols_5bits_aux_gain[ad1848->regs[temp] & 0x1f];
}
temp = (ad1848->type < AD1848_TYPE_CS4231) ? 2 : ((ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4);
if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_l = 0;
else
ad1848->cd_vol_l = ad1848_vols_5bits_aux_gain[ad1848->regs[temp] & 0x1f];
temp++;
if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_r = 0;
else
ad1848->cd_vol_r = ad1848_vols_5bits_aux_gain[ad1848->regs[temp] & 0x1f];
break;
case 2:
@@ -599,6 +602,24 @@ ad1848_filter_cd_audio(int channel, double *buffer, void *priv)
*buffer = c;
}
void
ad1848_filter_aux2(void *priv, double *out_l, double *out_r)
{
ad1848_t *ad1848 = (ad1848_t *) priv;
if (ad1848->regs[4] & 0x80) {
*out_l = 0.0;
} else {
*out_l = ((*out_l) * ad1848_vols_5bits_aux_gain[ad1848->regs[4] & 0x1f]) / 65536.0;
}
if (ad1848->regs[5] & 0x80) {
*out_r = 0.0;
} else {
*out_r = ((*out_r) * ad1848_vols_5bits_aux_gain[ad1848->regs[5] & 0x1f]) / 65536.0;
}
}
void
ad1848_init(ad1848_t *ad1848, uint8_t type)
{

View File

@@ -320,12 +320,12 @@ ymfm_drv_read(uint16_t port, void *priv)
{
YMFMChipBase *drv = (YMFMChipBase *) priv;
if (port == 0x381) {
port += 4;
} /* Point to register read port. */
if (drv->flags() & FLAG_CYCLES) {
if ((port == 0x380) || (port == 0x381))
port |= 4;
/* Point to register read port. */
if (drv->flags() & FLAG_CYCLES)
cycles -= ((int) (isa_timing * 8));
}
uint8_t ret = drv->read(port);
drv->update();
@@ -339,9 +339,8 @@ ymfm_drv_write(uint16_t port, uint8_t val, void *priv)
{
YMFMChipBase *drv = (YMFMChipBase *) priv;
ymfm_log("YMFM write port %04x value = %02x\n", port, val);
if (port == 0x380 || port == 0x381) {
port += 4;
}
if ((port == 0x380) || (port == 0x381))
port |= 4;
drv->write(port, val);
drv->update();
}

View File

@@ -70,6 +70,18 @@ typedef struct optimc_t {
uint8_t regs[6];
} optimc_t, opti_82c929_t;
static void
optimc_filter_opl(void* priv, double* out_l, double* out_r)
{
optimc_t *optimc = (optimc_t *) priv;
if (optimc->cur_wss_enabled) {
*out_l /= optimc->sb->mixer_sbpro.fm_l;
*out_r /= optimc->sb->mixer_sbpro.fm_r;
ad1848_filter_aux2((void*)&optimc->ad1848, out_l, out_r);
}
}
static uint8_t
optimc_wss_read(uint16_t addr, void *priv)
{
@@ -141,41 +153,38 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
if (optimc->reg_enabled) {
switch (idx) {
case 0: /* MC1 */
{
optimc->regs[0] = val;
if (val != old) {
optimc->cur_mode = optimc->cur_wss_enabled = !!(val & 0x80);
io_removehandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc);
io_removehandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848);
switch ((val >> 4) & 0x3) {
case 0: /* WSBase = 0x530 */
{
optimc->cur_wss_addr = 0x530;
break;
}
case 1: /* WSBase = 0xE80 */
{
optimc->cur_wss_addr = 0xE80;
break;
}
case 2: /* WSBase = 0xF40 */
{
optimc->cur_wss_addr = 0xF40;
break;
}
case 3: /* WSBase = 0x604 */
{
optimc->cur_wss_addr = 0x604;
break;
}
}
io_sethandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc);
io_sethandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848);
optimc->regs[0] = val;
if (val != old) {
optimc->cur_mode = optimc->cur_wss_enabled = !!(val & 0x80);
gameport_remap(optimc->gameport, (optimc->regs[0] & 0x1) ? 0x00 : 0x200);
sound_set_cd_audio_filter(NULL, NULL);
if (optimc->cur_wss_enabled) /* WSS */
sound_set_cd_audio_filter(ad1848_filter_cd_audio, &optimc->ad1848);
else /* SBPro */
sound_set_cd_audio_filter(sbpro_filter_cd_audio, optimc->sb);
io_removehandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc);
io_removehandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848);
switch ((val >> 4) & 0x3) {
case 0: /* WSBase = 0x530 */
optimc->cur_wss_addr = 0x530;
break;
case 1: /* WSBase = 0xE80 */
optimc->cur_wss_addr = 0xE80;
break;
case 2: /* WSBase = 0xF40 */
optimc->cur_wss_addr = 0xF40;
break;
case 3: /* WSBase = 0x604 */
optimc->cur_wss_addr = 0x604;
break;
}
break;
io_sethandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc);
io_sethandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848);
gameport_remap(optimc->gameport, (optimc->regs[0] & 0x1) ? 0x00 : 0x200);
}
break;
case 1: /* MC2 */
optimc->regs[1] = val;
break;
@@ -263,10 +272,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
}
if (optimc->reg_enabled)
optimc->reg_enabled = 0;
if (addr == 0xF8F && (val == optimc->type || val == 0x00)) {
if (addr == 0xF8F && val == optimc->type && !optimc->reg_enabled) {
if ((addr == 0xF8F) && ((val == optimc->type) || (val == 0x00))) {
if ((addr == 0xF8F) && (val == optimc->type) && !optimc->reg_enabled)
optimc->reg_enabled = 1;
}
if (reg_enable_phase) {
switch (reg_enable_phase) {
case 1:
@@ -305,7 +313,8 @@ optimc_reg_read(uint16_t addr, void *p)
case 3: /* MC4 */
case 4: /* MC5 */
temp = optimc->regs[addr - 0xF8D];
case 5: /* MC6 (not readable) */
case 5: /* MC6 */
temp = optimc->regs[5];
break;
case 2: /* MC3 */
temp = (optimc->regs[2] & ~0x3) | 0x2;
@@ -333,14 +342,14 @@ optimc_init(const device_t *info)
optimc->cur_mpu401_addr = 0x330;
optimc->cur_mpu401_enabled = 1;
optimc->regs[0] = ((device_get_config_int("gameport")) ? 0x01 : 0x00);
optimc->regs[0] = 0x00;
optimc->regs[1] = 0x03;
optimc->regs[2] = 0x00;
optimc->regs[3] = 0x00;
optimc->regs[4] = 0x3F;
optimc->regs[5] = 0x83;
optimc->gameport = gameport_add(&gameport_device);
optimc->gameport = gameport_add(&gameport_pnp_device);
gameport_remap(optimc->gameport, (optimc->regs[0] & 0x1) ? 0x00 : 0x200);
if (info->local & 0x100)
@@ -365,19 +374,21 @@ optimc_init(const device_t *info)
sb_dsp_setdma8(&optimc->sb->dsp, optimc->cur_dma);
sb_ct1345_mixer_reset(optimc->sb);
optimc->sb->opl_mixer = optimc;
optimc->sb->opl_mix = optimc_filter_opl;
optimc->fm_type = (info->local & OPTIMC_OPL4) ? FM_YMF278B : FM_YMF262;
fm_driver_get(optimc->fm_type, &optimc->sb->opl);
io_sethandler(optimc->cur_addr + 0, 0x0004, optimc->sb->opl.read, NULL, NULL, optimc->sb->opl.write, NULL, NULL, optimc->sb->opl.priv);
io_sethandler(optimc->cur_addr + 8, 0x0002, optimc->sb->opl.read, NULL, NULL, optimc->sb->opl.write, NULL, NULL, optimc->sb->opl.priv);
io_sethandler(0x0388, 0x0004, optimc->sb->opl.read, NULL, NULL, optimc->sb->opl.write, NULL, NULL, optimc->sb->opl.priv);
if (optimc->fm_type == FM_YMF278B) {
if (optimc->fm_type == FM_YMF278B)
io_sethandler(0x380, 2, optimc->sb->opl.read, NULL, NULL, optimc->sb->opl.write, NULL, NULL, optimc->sb->opl.priv);
}
io_sethandler(optimc->cur_addr + 4, 0x0002, sb_ct1345_mixer_read, NULL, NULL, sb_ct1345_mixer_write, NULL, NULL, optimc->sb);
sound_add_handler(optimc_get_buffer, optimc);
sound_set_cd_audio_filter(sbpro_filter_cd_audio, optimc->sb);
sound_set_cd_audio_filter(sbpro_filter_cd_audio, optimc->sb); /* CD audio filter for the default context */
optimc->mpu = (mpu_t *) malloc(sizeof(mpu_t));
memset(optimc->mpu, 0, sizeof(mpu_t));
@@ -416,12 +427,6 @@ mirosound_pcm10_available(void)
static const device_config_t acermagic_s20_config[] = {
// clang-format off
{
.name = "gameport",
.description = "Gameport",
.type = CONFIG_BINARY,
.default_int = 0
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
@@ -466,4 +471,4 @@ const device_t mirosound_pcm10_device = {
.speed_changed = optimc_speed_changed,
.force_redraw = NULL,
.config = acermagic_s20_config
};
};

View File

@@ -290,6 +290,9 @@ sb_get_buffer_sbpro(int32_t *buffer, int len, void *p)
} else {
out_l = (((double) opl_buf[c]) * mixer->fm_l) * 0.7171630859375;
out_r = (((double) opl_buf[c + 1]) * mixer->fm_r) * 0.7171630859375;
if (sb->opl_mix && sb->opl_mixer) {
sb->opl_mix(sb->opl_mixer, &out_l, &out_r);
}
}
}

View File

@@ -647,7 +647,7 @@ NETOBJ := network.o \
arp_table.o bootp.o cksum.o dnssearch.o if.o ip_icmp.o ip_input.o \
ip_output.o mbuf.o misc.o sbuf.o slirp.o socket.o tcp_input.o \
tcp_output.o tcp_subr.o tcp_timer.o udp.o util.o version.o \
net_dp8390.o \
net_dp8390.o net_3c501.o \
net_3c503.o net_ne2000.o \
net_pcnet.o net_wd8003.o \
net_plip.o net_event.o