diff --git a/src/86box.c b/src/86box.c index 9d0f25705..5fba2cadc 100644 --- a/src/86box.c +++ b/src/86box.c @@ -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 */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb3bf9f50..94dc6a61a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index aea1afb94..c20e18db8 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -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 diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index f7f5bf208..6b855f5aa 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -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); diff --git a/src/config.c b/src/config.c index f68b23c37..3bb9fb59a 100644 --- a/src/config.c +++ b/src/config.c @@ -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"); diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index e6a22394a..c4d084947 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -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)); diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 768ca6267..40e1f7927 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -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 */ diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 7c028d7d6..805f08b10 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -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 diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index 65cc32f85..93a47a1cb 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -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 "" diff --git a/src/qt/qt_glsl_parser.cpp b/src/qt/qt_glsl_parser.cpp index 9a0a0fc03..fa45267a7 100644 --- a/src/qt/qt_glsl_parser.cpp +++ b/src/qt/qt_glsl_parser.cpp @@ -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) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 627455948..2e0ce33e0 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -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); diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 70c70527a..b465bfddd 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -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); diff --git a/src/qt/qt_openglshadermanagerdialog.cpp b/src/qt/qt_openglshadermanagerdialog.cpp index 7f8a19414..72f58f9cb 100644 --- a/src/qt/qt_openglshadermanagerdialog.cpp +++ b/src/qt/qt_openglshadermanagerdialog.cpp @@ -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() diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index ee8d8842a..ebd6dc30c 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -18,6 +18,11 @@ * Copyright 2021-2022 Cacodemon345 * Copyright 2021-2022 Teemu Korhonen */ + +#ifdef __HAIKU__ +#include +#endif + #include #include @@ -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 diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index 9e1f8c168..6ec76a290 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -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(); diff --git a/src/qt/qt_progsettings.ui b/src/qt/qt_progsettings.ui index ac4327341..dc5674425 100644 --- a/src/qt/qt_progsettings.ui +++ b/src/qt/qt_progsettings.ui @@ -27,8 +27,122 @@ - QLayout::SetFixedSize + QLayout::SizeConstraint::SetFixedSize + + + + <html><head/><body><p>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.</p></body></html> + + + Select media images from program working directory + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + 30 + + + + (System Default) + + + + + + + + Default + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Orientation::Horizontal + + + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok + + + + + + + Icon set: + + + + + + + Language: + + + + + + + 10 + + + 200 + + + 10 + + + 20 + + + 100 + + + Qt::Orientation::Horizontal + + + @@ -51,13 +165,6 @@ - - - - Icon set: - - - @@ -65,77 +172,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - 10 - - - 200 - - - 10 - - - 20 - - - 100 - - - Qt::Horizontal - - - - - - - 30 - - - - (System Default) - - - - - - - - Language: - - - - - - - Default - - - @@ -143,39 +179,10 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>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.</p></body></html> - + + - Select media images from program working directory + Inhibit multimedia keys on Windows diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index 13e0ec9a7..8a2841f97 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -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; } } diff --git a/src/qt/win_cdrom_ioctl.c b/src/qt/win_cdrom_ioctl.c index 621cf0b76..309f861e0 100644 --- a/src/qt/win_cdrom_ioctl.c +++ b/src/qt/win_cdrom_ioctl.c @@ -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); } diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index cc9cc40c1..e16b16e7c 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -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; diff --git a/src/unix/unix.c b/src/unix/unix.c index 33b78ddb1..81312d25d 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -2,6 +2,9 @@ # define _FILE_OFFSET_BITS 64 # define _LARGEFILE64_SOURCE 1 #endif +#ifdef __HAIKU__ +#include +#endif #include #include #include @@ -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