Merge remote-tracking branch 'origin/master' into cdrom_changes

This commit is contained in:
OBattler
2025-03-14 19:42:50 +01:00
6 changed files with 58 additions and 6 deletions

View File

@@ -102,6 +102,10 @@ endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd utils 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

@@ -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

@@ -17,6 +17,7 @@ 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();
@@ -81,14 +82,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,12 +156,15 @@ static int get_parameters(glslp_t *glsl) {
int i;
struct parameter p;
for (i = 0; i < glsl->num_shaders; ++i) {
char line[1024];
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];
if (bom) {
fseek(f, 3, SEEK_SET);
}
while (fgets(line, sizeof(line) - 1, f) && glsl->num_parameters < MAX_PARAMETERS) {
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);

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

@@ -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