Merge branch '86Box:master' into master

This commit is contained in:
starfrost
2025-03-15 13:37:54 +00:00
committed by GitHub
20 changed files with 284 additions and 170 deletions

View File

@@ -213,6 +213,7 @@ int hook_enabled = 1; /* (C) Keyboar
int test_mode = 0; /* (C) Test mode */
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */
int sound_muted = 0; /* (C) Is sound muted? */
int inhibit_multimedia_keys; /* (C) Inhibit multimedia keys on Windows. */
int other_ide_present = 0; /* IDE controllers from non-IDE cards are
present */

View File

@@ -108,6 +108,10 @@ endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid voodoo plat ui)
if(HAIKU)
target_link_libraries(86Box be)
endif()
if(WIN32 AND ARCH STREQUAL "i386")
if(MINGW)
target_link_options(86Box PRIVATE "LINKER:--large-address-aware")

View File

@@ -46,6 +46,7 @@
cdrom_t cdrom[CDROM_NUM] = { 0 };
int cdrom_interface_current;
int cdrom_assigned_letters = 0;
#ifdef ENABLE_CDROM_LOG
int cdrom_do_log = ENABLE_CDROM_LOG;
@@ -2795,6 +2796,8 @@ cdrom_global_init(void)
void
cdrom_hard_reset(void)
{
cdrom_assigned_letters = 0;
for (uint8_t i = 0; i < CDROM_NUM; i++) {
cdrom_t *dev = &cdrom[i];
@@ -2825,6 +2828,7 @@ cdrom_hard_reset(void)
}
dev->cd_status = CD_STATUS_EMPTY;
dev->host_letter = 0xff;
if (strlen(dev->image_path) > 0) {
#ifdef _WIN32

View File

@@ -59,6 +59,7 @@
listings on forums, as VIA's datasheets are not very helpful regarding those. */
#define VIA_PIPC_586A 0x05862500
#define VIA_PIPC_586B 0x05864700
#define VIA_PIPC_586 0x0586
#define VIA_PIPC_596A 0x05960900
#define VIA_PIPC_596B 0x05962300
#define VIA_PIPC_596 0x0596
@@ -414,7 +415,7 @@ pipc_reset_hard(void *priv)
dev->power_regs[0x34] = 0x68;
dev->power_regs[0x40] = 0x20;
dev->power_regs[0x42] = ((dev->local >> 16) == VIA_PIPC_596) ? 0x50 : 0x00;
dev->power_regs[0x42] = ((dev->local >> 16) == VIA_PIPC_586) ? 0x00 : 0x50;
acpi_set_irq_line(dev->acpi, 0x00);
dev->power_regs[0x48] = 0x01;
@@ -1596,7 +1597,7 @@ pipc_reset(void *priv)
pipc_write(pm_func, 0x48, 0x01, priv);
pipc_write(pm_func, 0x49, 0x00, priv);
dev->power_regs[0x42] = ((dev->local >> 16) == VIA_PIPC_596) ? 0x50 : 0x00;
dev->power_regs[0x42] = ((dev->local >> 16) == VIA_PIPC_586) ? 0x00 : 0x50;
acpi_set_irq_line(dev->acpi, 0x00);
pipc_write(1, 0x04, 0x80, priv);

View File

@@ -131,6 +131,8 @@ load_general(void)
video_filter_method = ini_section_get_int(cat, "video_filter_method", 1);
inhibit_multimedia_keys = ini_section_get_int(cat, "inhibit_multimedia_keys", 0);
force_43 = !!ini_section_get_int(cat, "force_43", 0);
scale = ini_section_get_int(cat, "scale", 1);
if (scale > 9)
@@ -1900,6 +1902,10 @@ save_general(void)
const char *va_name;
ini_section_set_int(cat, "inhibit_multimedia_keys", inhibit_multimedia_keys);
if (inhibit_multimedia_keys == 0)
ini_section_delete_var(cat, "inhibit_multimedia_keys");
ini_section_set_int(cat, "sound_muted", sound_muted);
if (sound_muted == 0)
ini_section_delete_var(cat, "sound_muted");

View File

@@ -3948,12 +3948,15 @@ pentium_invalid_wrmsr:
/* Test Data */
case 0x03:
msr.tr3 = EAX;
break;
/* Test Address */
case 0x04:
msr.tr4 = EAX;
break;
/* Test Command/Status */
case 0x05:
msr.tr5 = EAX & 0x008f0f3b;
break;
/* Time Stamp Counter */
case 0x10:
timer_set_new_tsc(EAX | ((uint64_t) EDX << 32));

View File

@@ -107,6 +107,7 @@ extern uint64_t instru_run_ms;
#define window_y monitor_settings[0].mon_window_y
#define window_w monitor_settings[0].mon_window_w
#define window_h monitor_settings[0].mon_window_h
extern int inhibit_multimedia_keys; /* (C) Inhibit multimedia keys on Windows. */
extern int window_remember;
extern int vid_resize; /* (C) allow resizing */
extern int invert_display; /* (C) invert the display */

View File

@@ -335,6 +335,8 @@ typedef struct cdrom {
uint8_t subch_buffer[96];
int cdrom_sector_size;
/* Only used on Windows hosts for disc change notifications. */
uint8_t host_letter;
/* Needs some extra breathing space in case of overflows. */
uint8_t raw_buffer[4096];
@@ -437,6 +439,8 @@ extern int cdrom_is_empty(const uint8_t id);
extern void cdrom_eject(const uint8_t id);
extern void cdrom_reload(const uint8_t id);
extern int cdrom_assigned_letters;
#ifdef __cplusplus
}
#endif

View File

@@ -2141,3 +2141,6 @@ msgstr ""
msgid "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P Dot-Matrix Printer."
msgstr ""
msgid "Inhibit multimedia keys on Windows"
msgstr ""

View File

@@ -17,9 +17,12 @@ extern "C"
#include <86box/config.h>
#include <86box/qt-glslp-parser.h>
#include <86box/path.h>
#include <86box/plat.h>
extern void startblit();
extern void endblit();
extern ssize_t local_getline(char **buf, size_t *bufsiz, FILE *fp);
extern char* trim(char* str);
}
#define safe_strncpy(a, b, n) \
@@ -81,14 +84,38 @@ static int endswith(const char *str, const char *ext) {
return 0;
}
static int
glsl_detect_bom(const char *fn)
{
FILE *fp;
unsigned char bom[4] = { 0, 0, 0, 0 };
fp = plat_fopen(fn, "rb");
if (fp == NULL)
return 0;
(void) !fread(bom, 1, 3, fp);
if (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) {
fclose(fp);
return 1;
}
fclose(fp);
return 0;
}
static char *load_file(const char *fn) {
FILE *f = fopen(fn, "rb");
int bom = glsl_detect_bom(fn);
FILE *f = plat_fopen(fn, "rb");
if (!f)
return 0;
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
if (bom) {
fsize -= 3;
fseek(f, 3, SEEK_SET);
}
char *data = (char*)malloc(fsize + 1);
fread(data, fsize, 1, f);
@@ -131,13 +158,19 @@ static int get_parameters(glslp_t *glsl) {
int i;
struct parameter p;
for (i = 0; i < glsl->num_shaders; ++i) {
size_t size = 0;
char* line = NULL;
struct shader *shader = &glsl->shaders[i];
FILE *f = fopen(shader->shader_fn, "rb");
int bom = glsl_detect_bom(shader->shader_fn);
FILE *f = plat_fopen(shader->shader_fn, "rb");
if (!f)
return 0;
char line[1024];
while (fgets(line, sizeof(line) - 1, f) && glsl->num_parameters < MAX_PARAMETERS) {
if (bom) {
fseek(f, 3, SEEK_SET);
}
while (local_getline(&line, &size, f) != -1 && glsl->num_parameters < MAX_PARAMETERS) {
line[strcspn(line, "\r\n")] = '\0';
trim(line);
int num = sscanf(line, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f", p.id, p.description,
&p.default_value, &p.min, &p.max, &p.step);
if (num < 5)

View File

@@ -226,7 +226,30 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
detection; rest can't be reliably detected. */
DWORD vkCode = lpKdhs->vkCode;
bool up = !!(lpKdhs->flags & LLKHF_UP);
ret = CallNextHookEx(NULL, nCode, wParam, lParam);;
if (inhibit_multimedia_keys
&& (lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE
|| lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK
|| lpKdhs->vkCode == VK_MEDIA_PREV_TRACK
|| lpKdhs->vkCode == VK_VOLUME_DOWN
|| lpKdhs->vkCode == VK_VOLUME_UP
|| lpKdhs->vkCode == VK_VOLUME_MUTE
|| lpKdhs->vkCode == VK_MEDIA_STOP
|| lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT
|| lpKdhs->vkCode == VK_LAUNCH_MAIL
|| lpKdhs->vkCode == VK_LAUNCH_APP1
|| lpKdhs->vkCode == VK_LAUNCH_APP2
|| lpKdhs->vkCode == VK_HELP
|| lpKdhs->vkCode == VK_BROWSER_BACK
|| lpKdhs->vkCode == VK_BROWSER_FORWARD
|| lpKdhs->vkCode == VK_BROWSER_FAVORITES
|| lpKdhs->vkCode == VK_BROWSER_HOME
|| lpKdhs->vkCode == VK_BROWSER_REFRESH
|| lpKdhs->vkCode == VK_BROWSER_SEARCH
|| lpKdhs->vkCode == VK_BROWSER_STOP))
ret = TRUE;
else
ret = CallNextHookEx(NULL, nCode, wParam, lParam);
switch (vkCode)
{
@@ -349,6 +372,27 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
ret = TRUE;
else if ((lpKdhs->scanCode >= 0x5b) && (lpKdhs->scanCode <= 0x5d) && (lpKdhs->flags & LLKHF_EXTENDED))
ret = TRUE;
else if (inhibit_multimedia_keys
&& (lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE
|| lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK
|| lpKdhs->vkCode == VK_MEDIA_PREV_TRACK
|| lpKdhs->vkCode == VK_VOLUME_DOWN
|| lpKdhs->vkCode == VK_VOLUME_UP
|| lpKdhs->vkCode == VK_VOLUME_MUTE
|| lpKdhs->vkCode == VK_MEDIA_STOP
|| lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT
|| lpKdhs->vkCode == VK_LAUNCH_MAIL
|| lpKdhs->vkCode == VK_LAUNCH_APP1
|| lpKdhs->vkCode == VK_LAUNCH_APP2
|| lpKdhs->vkCode == VK_HELP
|| lpKdhs->vkCode == VK_BROWSER_BACK
|| lpKdhs->vkCode == VK_BROWSER_FORWARD
|| lpKdhs->vkCode == VK_BROWSER_FAVORITES
|| lpKdhs->vkCode == VK_BROWSER_HOME
|| lpKdhs->vkCode == VK_BROWSER_REFRESH
|| lpKdhs->vkCode == VK_BROWSER_SEARCH
|| lpKdhs->vkCode == VK_BROWSER_STOP))
ret = TRUE;
else
ret = CallNextHookEx(NULL, nCode, wParam, lParam);

View File

@@ -107,6 +107,7 @@ const char* fragment_shader_default_tex_src =
"void main()\n"
"{\n"
" color = texture(Texture, texCoord);\n"
" color.a = 1.0;\n"
"}\n";
const char* vertex_shader_default_color_src =
@@ -141,6 +142,7 @@ const char* fragment_shader_default_color_src =
"void main()\n"
"{\n"
" outColor = color;\n"
" outColor.a = 1.0;\n"
"}\n";
static inline int
@@ -1391,6 +1393,10 @@ OpenGLRenderer::render()
glw.glBindTexture(GL_TEXTURE_2D, scene_texture.id);
scene_texture.min_filter = scene_texture.mag_filter = video_filter_method ? GL_LINEAR : GL_NEAREST;
active_shader->scene.fbo.texture.min_filter = active_shader->scene.fbo.texture.mag_filter = video_filter_method ? GL_LINEAR : GL_NEAREST;
glw.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, video_filter_method ? GL_LINEAR : GL_NEAREST);
glw.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, video_filter_method ? GL_LINEAR : GL_NEAREST);
glw.glBindTexture(GL_TEXTURE_2D, active_shader->scene.fbo.texture.id);
glw.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, video_filter_method ? GL_LINEAR : GL_NEAREST);
glw.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, video_filter_method ? GL_LINEAR : GL_NEAREST);
glw.glBindTexture(GL_TEXTURE_2D, 0);

View File

@@ -63,6 +63,7 @@ OpenGLShaderManagerDialog::OpenGLShaderManagerDialog(QWidget *parent)
} else {
ui->buttonConfigure->setEnabled(false);
}
ui->buttonAdd->setDisabled(ui->shaderListWidget->count() >= MAX_USER_SHADERS);
} else {
ui->buttonRemove->setDisabled(true);
ui->buttonMoveUp->setDisabled(true);
@@ -177,6 +178,7 @@ void OpenGLShaderManagerDialog::on_buttonAdd_clicked()
item->setData(Qt::UserRole + 2, (qulonglong)(uintptr_t)shaderfile);
if (ui->shaderListWidget->count()) {
ui->shaderListWidget->setCurrentRow(ui->shaderListWidget->count() - 1);
ui->buttonAdd->setDisabled(ui->shaderListWidget->count() >= MAX_USER_SHADERS);
}
} else {
QMessageBox::critical(this, tr("GLSL error"), tr("Could not load filename %1").arg(res));
@@ -197,6 +199,7 @@ void OpenGLShaderManagerDialog::on_buttonRemove_clicked()
on_shaderListWidget_currentRowChanged(ui->shaderListWidget->currentRow());
}
ui->buttonAdd->setDisabled(ui->shaderListWidget->count() >= MAX_USER_SHADERS);
}
void OpenGLShaderManagerDialog::on_OpenGLShaderManagerDialog_accepted()

View File

@@ -18,6 +18,11 @@
* Copyright 2021-2022 Cacodemon345
* Copyright 2021-2022 Teemu Korhonen
*/
#ifdef __HAIKU__
#include <OS.h>
#endif
#include <cstdio>
#include <mutex>
@@ -828,6 +833,8 @@ plat_set_thread_name(void *thread, const char *name)
pthread_setname_np(truncated);
# elif defined(Q_OS_NETBSD)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
# elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
# elif defined(Q_OS_OPENBSD)
pthread_set_name_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
# else

View File

@@ -115,14 +115,19 @@ ProgSettings::ProgSettings(QWidget *parent)
mouseSensitivity = mouse_sensitivity;
ui->horizontalSlider->setValue(mouseSensitivity * 100.);
ui->openDirUsrPath->setChecked(open_dir_usr_path > 0);
ui->checkBoxMultimediaKeys->setChecked(inhibit_multimedia_keys);
#ifndef Q_OS_WINDOWS
ui->checkBoxMultimediaKeys->setHidden(true);
#endif
}
void
ProgSettings::accept()
{
strcpy(icon_set, ui->comboBox->currentData().toString().toUtf8().data());
lang_id = ui->comboBoxLanguage->currentData().toUInt();
open_dir_usr_path = ui->openDirUsrPath->isChecked() ? 1 : 0;
lang_id = ui->comboBoxLanguage->currentData().toUInt();
open_dir_usr_path = ui->openDirUsrPath->isChecked() ? 1 : 0;
inhibit_multimedia_keys = ui->checkBoxMultimediaKeys->isChecked();
loadTranslators(QCoreApplication::instance());
reloadStrings();

View File

@@ -27,8 +27,122 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
<enum>QLayout::SizeConstraint::SetFixedSize</enum>
</property>
<item row="9" column="0">
<widget class="QCheckBox" name="openDirUsrPath">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Select media images from program working directory</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxLanguage">
<property name="maxVisibleItems">
<number>30</number>
</property>
<item>
<property name="text">
<string>(System Default)</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pushButtonLanguage">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Icon set:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QSlider" name="horizontalSlider">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>20</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="comboBox">
<property name="editable">
@@ -51,13 +165,6 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Icon set:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButton">
<property name="text">
@@ -65,77 +172,6 @@
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QSlider" name="horizontalSlider">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>20</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxLanguage">
<property name="maxVisibleItems">
<number>30</number>
</property>
<item>
<property name="text">
<string>(System Default)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pushButtonLanguage">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
@@ -143,39 +179,10 @@
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="openDirUsrPath">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item row="10" column="0">
<widget class="QCheckBox" name="checkBoxMultimediaKeys">
<property name="text">
<string>Select media images from program working directory</string>
<string>Inhibit multimedia keys on Windows</string>
</property>
</widget>
</item>

View File

@@ -157,27 +157,16 @@ WindowsRawInputFilter::~WindowsRawInputFilter()
static void
notify_drives(ULONG unitmask, int empty)
{
char p[1024] = { 0 };
if (unitmask & cdrom_assigned_letters) for (int i = 0; i < CDROM_NUM; i++) {
cdrom_t *dev = &(cdrom[i]);
for (int i = 0; i < 26; ++i) {
if (unitmask & 0x1) {
cdrom_t *dev = NULL;
sprintf(p, "ioctl://\\\\.\\%c:", 'A' + i);
for (int i = 0; i < CDROM_NUM; i++)
if (!stricmp(cdrom[i].image_path, p)) {
dev = &(cdrom[i]);
if (empty)
cdrom_set_empty(dev);
else
cdrom_update_status(dev);
// pclog("CD-ROM %i : Drive notified of media %s\n",
// dev->id, empty ? "removal" : "change");
}
if ((dev->host_letter != 0xff) &&
(unitmask & (1 << dev->host_letter))) {
if (empty)
cdrom_set_empty(dev);
else
cdrom_update_status(dev);
}
unitmask = unitmask >> 1;
}
}

View File

@@ -748,6 +748,11 @@ ioctl_close(void *local)
log_close(ioctl->log);
ioctl->log = NULL;
cdrom_assigned_letters &= ~(1 << ioctl->dev->host_letter);
ioctl->dev->host_letter = 0xff;
free(ioctl);
}
static void
@@ -788,19 +793,22 @@ ioctl_open(cdrom_t *dev, const char *drv)
ioctl_t *ioctl = (ioctl_t *) calloc(1, sizeof(ioctl_t));
if (ioctl != NULL) {
char n[1024] = { 0 };
char n[1024] = { 0 };
sprintf(n, "CD-ROM %i IOCtl", dev->id + 1);
ioctl->log = log_open(n);
ioctl->log = log_open(n);
memset(ioctl->path, 0x00, sizeof(ioctl->path));
wsprintf(ioctl->path, L"%S", &(drv[8]));
ioctl_log(ioctl->log, "Path is %S\n", ioctl->path);
ioctl->dev = dev;
ioctl->dev = dev;
dev->ops = &ioctl_ops;
dev->ops = &ioctl_ops;
dev->host_letter = (drv[12] & 0xdf) - 0x41;
cdrom_assigned_letters |= (1 << dev->host_letter);
ioctl_load(ioctl);
}

View File

@@ -678,13 +678,8 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev)
dev->callback += period;
scsi_cdrom_set_callback(dev);
return;
case 0x43:
dev->drv->seek_diff = dev->drv->seek_pos + 150;
dev->drv->seek_pos = 0;
fallthrough;
case 0x08:
case 0x28:
case 0x42: case 0x44:
case 0xa8:
/* Seek time is in us. */
period = cdrom_seek_time(dev->drv);
@@ -698,7 +693,7 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev)
dev->callback += period;
fallthrough;
case 0x25:
// case 0x42 ... 0x44:
case 0x42 ... 0x44:
case 0x51 ... 0x52:
case 0xad:
case 0xb8 ... 0xb9:
@@ -707,11 +702,6 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev)
dev->callback += 40.0;
/* Account for seek time. */
/* 44100 * 16 bits * 2 channels = 176400 bytes per second */
/*
TODO: This is a bit of a lie - the actual period is closer to
75 * 2448 bytes per second, because the subchannel data
has to be read as well.
*/
bytes_per_second = 176400.0;
bytes_per_second *= (double) dev->drv->cur_speed;
break;
@@ -740,19 +730,7 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev)
period = 1000000.0 / bytes_per_second;
scsi_cdrom_log(dev->log, "Byte transfer period: %" PRIu64 " us\n",
(uint64_t) period);
switch (cmd) {
default:
period = period * (double) (dev->packet_len);
break;
case 0x42: case 0x44:
/* READ SUBCHANNEL or READ HEADER - period of 1 entire sector. */
period = period * 2352.0;
break;
case 0x43:
/* READ TOC - period of 175 entire frames. */
period = period * 150.0 * 2352.0;
break;
}
period = period * (double) (dev->packet_len);
scsi_cdrom_log(dev->log, "Sector transfer period: %" PRIu64 " us\n",
(uint64_t) period);
dev->callback += period;

View File

@@ -2,6 +2,9 @@
# define _FILE_OFFSET_BITS 64
# define _LARGEFILE64_SOURCE 1
#endif
#ifdef __HAIKU__
#include <OS.h>
#endif
#include <SDL.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -1398,16 +1401,20 @@ plat_set_thread_name(void *thread, const char *name)
if (thread) /* Apple pthread can only set self's name */
return;
char truncated[64];
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
char truncated[64];
#elif defined(__HAIKU__)
char truncated[32];
#else
char truncated[16];
#endif
strncpy(truncated, name, sizeof(truncated) - 1);
#ifdef __APPLE__
pthread_setname_np(truncated);
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
#else
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
#endif