Merge branch '86Box:master' into ad1816

This commit is contained in:
win2kgamer
2025-12-22 19:03:33 -06:00
committed by GitHub
84 changed files with 3892 additions and 548 deletions

View File

@@ -47,7 +47,7 @@
/* Recently used images */
#define MAX_PREV_IMAGES 10
#define MAX_IMAGE_PATH_LEN 2048
#define MAX_IMAGE_PATH_LEN 4096
/* Max UUID Length */
#define MAX_UUID_LEN 64

View File

@@ -21,7 +21,7 @@ extern "C" {
#define CART_IMAGE_HISTORY 10
extern char cart_fns[2][512];
extern char cart_fns[2][MAX_IMAGE_PATH_LEN];
extern char *cart_image_history[2][CART_IMAGE_HISTORY];
extern void cart_load(int drive, char *fn);

View File

@@ -157,7 +157,7 @@ void pc_cas_advance(pc_cassette_t *cas);
extern pc_cassette_t *cassette;
extern char cassette_fname[512];
extern char cassette_fname[MAX_IMAGE_PATH_LEN];
extern char cassette_mode[512];
extern char * cassette_image_history[CASSETTE_IMAGE_HISTORY];
extern unsigned long cassette_pos;

View File

@@ -323,8 +323,8 @@ typedef struct cdrom {
void *priv;
char image_path[1024];
char prev_image_path[1280];
char image_path[MAX_IMAGE_PATH_LEN];
char prev_image_path[MAX_IMAGE_PATH_LEN + 256];
uint32_t sound_on;
uint32_t cdrom_capacity;

View File

@@ -26,6 +26,12 @@
#define SEEK_RECALIBRATE -999
#define DEFAULT_SEEK_TIME_MS 10.0
/* BIOS boot status - used to detect POST vs normal operation */
typedef enum {
BIOS_BOOT_POST = 0, /* System is in POST (Power-On Self Test) */
BIOS_BOOT_NORMAL = 1 /* POST complete, normal operation */
} bios_boot_status_t;
#ifdef __cplusplus
extern "C" {
#endif
@@ -90,7 +96,7 @@ typedef struct DRIVE {
} DRIVE;
extern DRIVE drives[FDD_NUM];
extern char floppyfns[FDD_NUM][512];
extern char floppyfns[FDD_NUM][MAX_IMAGE_PATH_LEN];
extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY];
extern pc_timer_t fdd_poll_time[FDD_NUM];
extern int ui_writeprot[FDD_NUM];
@@ -118,6 +124,12 @@ extern int fdd_hole(int drive);
extern void fdd_stop(int drive);
extern void fdd_do_writeback(int drive);
/* BIOS boot status functions */
extern bios_boot_status_t fdd_get_boot_status(void);
extern void fdd_set_boot_status(bios_boot_status_t status);
extern void fdd_boot_status_reset(void);
extern int fdd_is_post_complete(void);
extern int motorspin;
extern uint64_t motoron[FDD_NUM];

View File

@@ -16,6 +16,7 @@
#define EMU_FDD_AUDIO_H
#include <stdint.h>
#include <86box/fdd.h>
#ifdef __cplusplus
extern "C" {
@@ -29,6 +30,9 @@ extern "C" {
/* Maximum number of simultaneous seek sounds per drive */
#define MAX_CONCURRENT_SEEKS 8
/* Number of BIOS vendors (for BIOS-specific samples) */
#define BIOS_VENDOR_COUNT 7
/* Audio sample configuration structure */
typedef struct {
char filename[512];
@@ -45,7 +49,15 @@ typedef struct {
audio_sample_config_t spindlemotor_stop;
audio_sample_config_t seek_up[MAX_SEEK_SAMPLES];
audio_sample_config_t seek_down[MAX_SEEK_SAMPLES];
double seek_time_ms[MAX_SEEK_SAMPLES]; /* Seek time in milliseconds for each track count */
audio_sample_config_t post_seek_up[MAX_SEEK_SAMPLES];
audio_sample_config_t post_seek_down[MAX_SEEK_SAMPLES];
/* BIOS vendor-specific POST seek samples [vendor][track] */
audio_sample_config_t bios_post_seek_up[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES];
audio_sample_config_t bios_post_seek_down[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES];
double seek_time_ms[MAX_SEEK_SAMPLES];
double post_seek_time_ms[MAX_SEEK_SAMPLES];
/* BIOS vendor-specific POST seek times [vendor][track] */
double bios_post_seek_time_ms[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES];
int total_tracks; /* 40 or 80 */
} fdd_audio_profile_config_t;
@@ -76,6 +88,45 @@ typedef struct {
uint32_t data_size;
} wav_header_t;
/* Audio sample structure */
typedef struct {
char filename[512];
int16_t *buffer;
int samples;
float volume;
} audio_sample_t;
typedef struct {
int position;
int active;
} single_step_state_t;
/* Multi-track seek audio state */
typedef struct {
int position;
int active;
int duration_samples;
int from_track;
int to_track;
int track_diff;
audio_sample_t *sample_to_play;
} multi_seek_state_t;
/* Drive type specific audio samples */
typedef struct {
audio_sample_t spindlemotor_start;
audio_sample_t spindlemotor_loop;
audio_sample_t spindlemotor_stop;
/* Individual seek samples for each track count (indexed 0-78 for 1-79 tracks) */
audio_sample_t seek_up[MAX_SEEK_SAMPLES];
audio_sample_t seek_down[MAX_SEEK_SAMPLES];
audio_sample_t post_seek_up[MAX_SEEK_SAMPLES];
audio_sample_t post_seek_down[MAX_SEEK_SAMPLES];
/* BIOS vendor-specific POST seek samples [vendor][track] */
audio_sample_t bios_post_seek_up[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES];
audio_sample_t bios_post_seek_down[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES];
} drive_audio_samples_t;
/* Fade duration: 75ms at 48kHz = 3600 samples */
#define FADE_DURATION_MS 75
#define FADE_SAMPLES (48000 * FADE_DURATION_MS / 1000)
@@ -89,6 +140,8 @@ extern const char* fdd_audio_get_profile_internal_name(int id);
extern int fdd_audio_get_profile_by_internal_name(const char *internal_name);
extern double fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down);
extern void load_profile_samples(int profile_id);
extern int fdd_get_audio_profile(int drive);
extern bios_boot_status_t fdd_get_boot_status(void);
#else

View File

@@ -161,7 +161,7 @@ typedef struct hard_disk_t {
void *priv;
char fn[1024]; /* Name of current image file */
char fn[MAX_IMAGE_PATH_LEN]; /* Name of current image file */
/* Differential VHD parent file */
char vhd_parent[1280];

View File

@@ -113,8 +113,8 @@ typedef struct mo_drive_t {
FILE *fp;
void *priv;
char image_path[1024];
char prev_image_path[1024];
char image_path[MAX_IMAGE_PATH_LEN];
char prev_image_path[MAX_IMAGE_PATH_LEN + 256];
char *image_history[MO_IMAGE_HISTORY];

View File

@@ -69,19 +69,10 @@ extern int strnicmp(const char *s1, const char *s2, size_t n);
# define fseeko64 fseeko
# define ftello64 ftello
# define off64_t off_t
#elif defined(_MSC_VER)
// # define fopen64 fopen
# define fseeko64 _fseeki64
# define ftello64 _ftelli64
# define off64_t off_t
#endif
#ifdef _MSC_VER
# define UNUSED(arg) arg
#else
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused)) arg
#endif
/* Return the size (in wchar's) of a wchar_t array. */
#define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t))
@@ -90,28 +81,23 @@ extern int strnicmp(const char *s1, const char *s2, size_t n);
# include <atomic>
# define atomic_flag_t std::atomic_flag
# define atomic_bool_t std::atomic_bool
extern "C" {
#else
# include <stdatomic.h>
# define atomic_flag_t atomic_flag
# define atomic_bool_t atomic_bool
#endif
#if defined(_MSC_VER)
# define ssize_t intptr_t
#endif
#ifdef _MSC_VER
# define fallthrough do {} while (0) /* fallthrough */
#if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
#else
# if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
# else
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
#endif
#endif
/* Global variables residing in the platform module. */

View File

@@ -16,18 +16,16 @@
#define EMU_PLAT_FALLTHROUGH_H
#ifndef EMU_PLAT_H
#ifdef _MSC_VER
# define fallthrough do {} while (0) /* fallthrough */
#if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
#else
# if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
# else
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
#endif
#endif
#endif /*EMU_PLAT_FALLTHROUGH_H*/

View File

@@ -19,12 +19,9 @@
#define EMU_PLAT_UNUSED_H
#ifndef EMU_PLAT_H
#ifdef _MSC_VER
# define UNUSED(arg) arg
#else
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused)) arg
#endif
#endif
#endif
#endif /*EMU_PLAT_UNUSED_H*/

View File

@@ -91,8 +91,8 @@ typedef struct rdisk_drive_t {
FILE *fp;
void *priv;
char image_path[1024];
char prev_image_path[1024];
char image_path[MAX_IMAGE_PATH_LEN];
char prev_image_path[MAX_IMAGE_PATH_LEN + 256];
char *image_history[RDISK_IMAGE_HISTORY];

View File

@@ -18,6 +18,7 @@
// Defines
#define MDA_CRTC_NUM_REGISTERS 32
#define MDA_VRAM 0x1000
// Enums & structures

View File

@@ -8,11 +8,7 @@
#ifndef VIDEO_VOODOO_CODEGEN_X86_64_H
#define VIDEO_VOODOO_CODEGEN_X86_64_H
#ifdef _MSC_VER
# include <intrin.h>
#else
# include <xmmintrin.h>
#endif
#include <xmmintrin.h>
#define BLOCK_NUM 8
#define BLOCK_MASK (BLOCK_NUM - 1)
@@ -653,14 +649,15 @@ codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *pa
static inline void
voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int depthop)
{
int block_pos = 0;
int z_skip_pos = 0;
int a_skip_pos = 0;
int amask_skip_pos = 0;
int chroma_skip_pos = 0;
int depth_jump_pos = 0;
int depth_jump_pos2 = 0;
int loop_jump_pos = 0;
int block_pos = 0;
int z_skip_pos = 0;
int a_skip_pos = 0;
int amask_skip_pos = 0;
int stipple_skip_pos = 0;
int chroma_skip_pos = 0;
int depth_jump_pos = 0;
int depth_jump_pos2 = 0;
int loop_jump_pos = 0;
#if 0
xmm_01_w = (__m128i)0x0001000100010001ull;
xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull;
@@ -766,6 +763,69 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addquad((uint64_t) (uintptr_t) &i_00_ff_w);
loop_jump_pos = block_pos;
if (params->fbzMode & FBZ_STIPPLE) {
/* Stipple enabled. */
if (params->fbzMode & FBZ_STIPPLE_PATT) {
/* x64's BT instruction is too slow. So use TEST instead. */
addbyte(0x4c); /* MOV RBX, R14(real_y)*/
addbyte(0x89);
addbyte(0xf3);
addbyte(0x83); /* AND EBX, 3 */
addbyte(0xe3);
addbyte(0x03);
addbyte(0xc1); /* SHL EBX, 3 */
addbyte(0xe3);
addbyte(0x03);
addbyte(0x8b); /*MOV EAX, state->x[EDI]*/
addbyte(0x87);
addlong(offsetof(voodoo_state_t, x));
addbyte(0xf7); /* NOT EAX */
addbyte(0xd0);
addbyte(0x83); /* AND EAX, 7 */
addbyte(0xe0);
addbyte(0x07);
addbyte(0x09); /* OR EAX, EBX */
addbyte(0xc3);
addbyte(0x88); /* MOV CL, AL */
addbyte(0xc1);
addbyte(0xb8); /* MOV EAX, 1*/
addlong(1);
addbyte(0xd3); /* SHL EAX, CL */
addbyte(0xe0);
addbyte(0x85); /* TEST state->stipple[EDI], EAX */
addbyte(0x87);
addlong(offsetof(voodoo_state_t, stipple));
addbyte(0x0f); /* JZ stipple_skip_pos */
addbyte(0x84);
stipple_skip_pos = block_pos;
addlong(0);
} else {
addbyte(0xd1); /* ROR state->stipple[EDI], 1*/
addbyte(0x8f);
addlong(offsetof(voodoo_state_t, stipple));
addbyte(0xf7); /* TEST state->stipple[EDI], 0x80000000 */
addbyte(0x87);
addlong(offsetof(voodoo_state_t, stipple));
addlong(0x80000000);
addbyte(0x0f); /* JZ stipple_skip_pos */
addbyte(0x84);
stipple_skip_pos = block_pos;
addlong(0);
}
}
addbyte(0x4c); /*MOV RSI, R15*/
addbyte(0x89);
addbyte(0xfe);
@@ -3190,6 +3250,8 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
*(uint32_t *) &code_block[chroma_skip_pos] = (block_pos - chroma_skip_pos) - 4;
if (amask_skip_pos)
*(uint32_t *) &code_block[amask_skip_pos] = (block_pos - amask_skip_pos) - 4;
if (stipple_skip_pos)
*(uint32_t *) &code_block[stipple_skip_pos] = (block_pos - stipple_skip_pos) - 4;
addbyte(0x4c); /*MOV RSI, R15*/
addbyte(0x89);

View File

@@ -8,11 +8,7 @@
#ifndef VIDEO_VOODOO_CODEGEN_X86_H
#define VIDEO_VOODOO_CODEGEN_X86_H
#ifdef _MSC_VER
# include <intrin.h>
#else
# include <xmmintrin.h>
#endif
#include <xmmintrin.h>
#define BLOCK_NUM 8
#define BLOCK_MASK (BLOCK_NUM - 1)

View File

@@ -667,6 +667,8 @@ typedef struct voodoo_t {
struct voodoo_set_t *set;
uint32_t launch_pending;
uint8_t fifo_thread_run;
uint8_t render_thread_run[4];

View File

@@ -358,6 +358,7 @@ enum {
enum {
FBZ_CHROMAKEY = (1 << 1),
FBZ_STIPPLE = (1 << 2),
FBZ_W_BUFFER = (1 << 3),
FBZ_DEPTH_ENABLE = (1 << 4),
@@ -366,6 +367,8 @@ enum {
FBZ_DEPTH_WMASK = (1 << 10),
FBZ_DITHER_2x2 = (1 << 11),
FBZ_STIPPLE_PATT = (1 << 12),
FBZ_ALPHA_MASK = (1 << 13),
FBZ_DRAW_FRONT = 0x0000,

View File

@@ -58,6 +58,21 @@ enum {
VIDEO_AGP
};
typedef enum video_font_format_e
{
FONT_FORMAT_MDA = 0,
FONT_FORMAT_PC200 = 1,
FONT_FORMAT_CGA = 2,
FONT_FORMAT_WY700 = 3,
FONT_FORMAT_MDSI_GENIUS = 4,
FONT_FORMAT_TOSHIBA_3100E = 5,
FONT_FORMAT_KSC6501 = 6,
FONT_FORMAT_SIGMA = 7,
FONT_FORMAT_PC1512_T1000 = 8,
FONT_FORMAT_IM1024 = 9,
FONT_FORMAT_PRAVETZ = 10,
} video_font_format;
#define VIDEO_FLAG_TYPE_CGA 0
#define VIDEO_FLAG_TYPE_MDA 1
#define VIDEO_FLAG_TYPE_SPECIAL 2
@@ -202,8 +217,6 @@ extern int video_fullscreen;
extern int video_fullscreen_scale;
extern uint8_t fontdat[2048][8]; /* IBM CGA font */
extern uint8_t fontdatm[2048][16]; /* IBM MDA font */
extern uint8_t fontdat2[2048][8]; /* IBM CGA 2nd instance font */
extern uint8_t fontdatm2[2048][16]; /* IBM MDA 2nd instance font */
extern uint8_t fontdatw[512][32]; /* Wyse700 font */
extern uint8_t fontdat8x12[256][16]; /* MDSI Genius font */
extern uint8_t fontdat12x18[256][36]; /* IM1024 font */
@@ -253,9 +266,6 @@ extern int video_get_video_from_internal_name(char *s);
extern int video_card_get_flags(int card);
extern int video_is_mda(void);
extern int video_is_cga(void);
extern int video_is_ega_vga(void);
extern int video_is_8514(void);
extern int video_is_xga(void);
extern void video_inform_monitor(int type, const video_timings_t *ptr, int monitor_index);
extern int video_get_type_monitor(int monitor_index);
@@ -288,12 +298,8 @@ extern uint8_t video_force_resize_get_monitor(int monitor_index);
extern void video_force_resize_set_monitor(uint8_t res, int monitor_index);
extern void video_update_timing(void);
extern void loadfont_ex(char *fn, int format, int offset);
extern void loadfont(char *fn, int format);
extern int get_actual_size_x(void);
extern int get_actual_size_y(void);
#define LOAD_FONT_NO_OFFSET 0
extern void video_load_font(char *fn, int format, int offset);
extern uint32_t video_color_transform(uint32_t color);
#define video_inform(type, video_timings_ptr) video_inform_monitor(type, video_timings_ptr, monitor_index_global)