Merge remote-tracking branch 'origin/master' into feature/recompiler_improvements

This commit is contained in:
OBattler
2026-01-19 23:04:46 +01:00
104 changed files with 3337 additions and 1049 deletions

View File

@@ -332,7 +332,7 @@ struct accelKey {
char desc[64];
char seq[64];
};
#define NUM_ACCELS 10
#define NUM_ACCELS 14
extern struct accelKey acc_keys[NUM_ACCELS];
extern struct accelKey def_acc_keys[NUM_ACCELS];
extern int FindAccelerator(const char *name);

View File

@@ -206,6 +206,7 @@ extern void *device_get_priv(const device_t *dev);
extern int device_available(const device_t *dev);
extern void device_speed_changed(void);
extern void device_force_redraw(void);
extern const char *device_get_bus_name(const device_t *dev);
extern void device_get_name(const device_t *dev, int bus, char *name);
extern int device_has_config(const device_t *dev);

View File

@@ -90,6 +90,7 @@ typedef struct hdd_preset_t {
const char *name;
const char *internal_name;
const char *model;
const char *version;
uint32_t zones;
uint32_t avg_spt;
uint32_t heads;
@@ -99,7 +100,6 @@ typedef struct hdd_preset_t {
uint32_t max_multiple;
double full_stroke_ms;
double track_seek_ms;
const char *version_ex;
} hdd_preset_t;
typedef struct hdd_cache_seg_t {
@@ -188,7 +188,7 @@ typedef struct hard_disk_t {
const char *model;
const char *version_ex;
const char *version;
hdd_zone_t zones[HDD_MAX_ZONES];

View File

@@ -734,6 +734,7 @@ extern int machine_at_dell466np_init(const machine_t *);
extern int machine_at_valuepoint433_init(const machine_t *);
/* VLSI 82C480 */
extern int machine_at_monsoon_init(const machine_t *);
extern int machine_at_martin_init(const machine_t *);
/* m_at_socket3.c */
@@ -1205,6 +1206,7 @@ extern int machine_at_ma30d_init(const machine_t *);
/* i440EX */
extern int machine_at_brio83xx_init(const machine_t *);
extern int machine_at_p6i440e2_init(const machine_t *);
extern int machine_at_como_init(const machine_t *);
/* i440BX */
extern int machine_at_bf6_init(const machine_t *);
@@ -1223,6 +1225,10 @@ extern const device_t ga686_device;
#endif
extern int machine_at_ga686_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6117_device;
#endif
extern int machine_at_ms6117_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6119_device;
#endif
extern int machine_at_ms6119_init(const machine_t *);

View File

@@ -95,6 +95,7 @@ extern const device_t ami_1992_nvr_device;
extern const device_t ami_1994_nvr_device;
extern const device_t ami_1995_nvr_device;
extern const device_t via_nvr_device;
extern const device_t piix4_ami_1995_nvr_device;
extern const device_t p6rp4_nvr_device;
extern const device_t martin_nvr_device;
extern const device_t elt_nvr_device;

View File

@@ -151,6 +151,9 @@ extern void plat_resize_request(int x, int y, int monitor_index);
extern int plat_language_code(char *langcode);
extern void plat_language_code_r(int id, char *outbuf, int len);
extern void plat_get_cpu_string(char *outbuf, uint8_t len);
#ifdef _WIN32
extern void plat_get_system_directory(char *outbuf);
#endif
extern void plat_set_thread_name(void *thread, const char *name);
extern void plat_break(void);
extern void plat_send_to_clipboard(unsigned char *rgb, int width, int height);

View File

@@ -131,8 +131,6 @@ extern const device_t ad1816_device;
/* Aztech Sound Galaxy 16 */
extern const device_t azt2316a_device;
extern const device_t acermagic_s20_device;
extern const device_t mirosound_pcm10_device;
extern const device_t azt1605_device;
extern const device_t aztpr16_device;
@@ -231,6 +229,8 @@ extern const device_t entertainer_device;
extern const device_t mmb_device;
/* OPTi 82c93x */
extern const device_t acermagic_s20_device;
extern const device_t mirosound_pcm10_device;
extern const device_t opti_82c930_device;
extern const device_t opti_82c931_device;

View File

@@ -1,6 +1,14 @@
#ifndef _TIMER_H_
#define _TIMER_H_
#ifndef int128_t
#define int128_t __int128
#endif
#ifndef uint128_t
#define uint128_t unsigned __int128
#endif
extern uint64_t tsc;
/* Maximum period, currently 1 second. */
@@ -11,18 +19,6 @@ extern uint64_t tsc;
#define TIMER_SPLIT 2
#define TIMER_ENABLED 1
#pragma pack(push, 1)
typedef struct ts_struct_t {
uint32_t frac;
uint32_t integer;
} ts_struct_t;
#pragma pack(pop)
typedef union ts_t {
uint64_t ts64;
ts_struct_t ts32;
} ts_t;
/*Timers are based on the CPU Time Stamp Counter. Timer timestamps are in a
32:32 fixed point format, with the integer part compared against the TSC. The
fractional part is used when advancing the timestamp to ensure a more accurate
@@ -36,12 +32,8 @@ typedef union ts_t {
to repeat, the callback must call timer_advance_u64(). This is a change from
the old timer API.*/
typedef struct pc_timer_t {
#ifdef USE_PCEM_TIMER
uint32_t ts_integer;
uint64_t ts_integer;
uint32_t ts_frac;
#else
ts_t ts;
#endif
int flags; /* The flags are defined above. */
int in_callback;
double period; /* This is used for large period timers to count
@@ -60,7 +52,7 @@ extern "C" {
/*Timestamp of nearest enabled timer. CPU emulation must call timer_process()
when TSC matches or exceeds this.*/
extern uint32_t timer_target;
extern uint64_t timer_target;
/*Enable timer, without updating timestamp*/
extern void timer_enable(pc_timer_t *timer);
@@ -82,18 +74,31 @@ extern void timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *pri
extern uint64_t TIMER_USEC;
/*True if timer a expires before timer b*/
#define TIMER_LESS_THAN(a, b) ((int64_t) ((a)->ts.ts64 - (b)->ts.ts64) <= 0)
#define TIMER_LESS_THAN(a, b) ((int64_t) ((a)->ts_integer - (b)->ts_integer) <= 0)
/*True if timer a expires before 32 bit integer timestamp b*/
#define TIMER_LESS_THAN_VAL(a, b) ((int32_t) ((a)->ts.ts32.integer - (b)) <= 0)
#define TIMER_LESS_THAN_VAL(a, b) ((int64_t) ((a)->ts_integer - (b)) <= 0)
/*True if 32 bit integer timestamp a expires before 32 bit integer timestamp b*/
#define TIMER_VAL_LESS_THAN_VAL(a, b) ((int32_t) ((a) - (b)) <= 0)
#define TIMER_VAL_LESS_THAN_VAL(a, b) ((int64_t) ((a) - (b)) <= 0)
#ifndef printf
#include <stdio.h>
#endif
/*Advance timer by delay, specified in 32:32 format. This should be used to
resume a recurring timer in a callback routine*/
static __inline void
timer_advance_u64(pc_timer_t *timer, uint64_t delay)
{
timer->ts.ts64 += delay;
uint64_t int_delay = delay >> 32;
uint32_t frac_delay = delay & 0xffffffff;
if (int_delay & 0x0000000080000000ULL)
int_delay |= 0xffffffff00000000ULL;
if ((frac_delay + timer->ts_frac) < frac_delay)
timer->ts_integer++;
timer->ts_frac += frac_delay;
timer->ts_integer += int_delay;
timer_enable(timer);
}
@@ -103,9 +108,14 @@ timer_advance_u64(pc_timer_t *timer, uint64_t delay)
static __inline void
timer_set_delay_u64(pc_timer_t *timer, uint64_t delay)
{
timer->ts.ts64 = 0ULL;
timer->ts.ts32.integer = tsc;
timer->ts.ts64 += delay;
uint64_t int_delay = delay >> 32;
uint32_t frac_delay = delay & 0xffffffff;
if (int_delay & 0x0000000080000000ULL)
int_delay |= 0xffffffff00000000ULL;
timer->ts_frac = frac_delay;
timer->ts_integer = int_delay + (uint64_t)tsc;
timer_enable(timer);
}
@@ -125,21 +135,19 @@ timer_is_on(pc_timer_t *timer)
}
/*Return integer timestamp of timer*/
static __inline uint32_t
static __inline uint64_t
timer_get_ts_int(pc_timer_t *timer)
{
return timer->ts.ts32.integer;
return timer->ts_integer;
}
/*Return remaining time before timer expires, in us. If the timer has already
expired then return 0*/
static __inline uint32_t
static __inline uint64_t
timer_get_remaining_us(pc_timer_t *timer)
{
int64_t remaining;
if (timer->flags & TIMER_ENABLED) {
remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32));
int128_t remaining = (((uint128_t)timer->ts_integer << 32) | timer->ts_frac) - ((uint128_t)tsc << 32);
if (remaining < 0)
return 0;
@@ -151,13 +159,11 @@ timer_get_remaining_us(pc_timer_t *timer)
/*Return remaining time before timer expires, in 32:32 timestamp format. If the
timer has already expired then return 0*/
static __inline uint64_t
static __inline uint128_t
timer_get_remaining_u64(pc_timer_t *timer)
{
int64_t remaining;
if (timer->flags & TIMER_ENABLED) {
remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32));
int128_t remaining = (((uint128_t)timer->ts_integer << 32) | timer->ts_frac) - ((uint128_t)tsc << 32);
if (remaining < 0)
return 0;

View File

@@ -74,6 +74,13 @@ typedef union rgba_u {
#define FIFO_FULL ((voodoo->fifo_write_idx - voodoo->fifo_read_idx) >= FIFO_SIZE - 4)
#define FIFO_EMPTY (voodoo->fifo_read_idx == voodoo->fifo_write_idx)
#define VOODOO_BUF_FRONT 0
#define VOODOO_BUF_BACK 1
#define VOODOO_BUF_AUX 2
#define VOODOO_BUF_UNKNOWN 3
#define VOODOO_BUF_COUNT 4
#define VOODOO_BUF_NONE 0xff
#define FIFO_TYPE 0xff000000
#define FIFO_ADDR 0x00ffffff
@@ -98,6 +105,8 @@ typedef struct
{
uint32_t addr_type;
uint32_t val;
uint8_t target_buf;
uint8_t pad[3];
} fifo_entry_t;
typedef struct voodoo_params_t {
@@ -356,6 +365,8 @@ typedef struct voodoo_t {
event_t *wake_fifo_thread;
event_t *wake_main_thread;
event_t *fifo_not_full_event;
event_t *fifo_empty_event;
ATOMIC_INT fifo_empty_signaled;
event_t *render_not_full_event[4];
event_t *wake_render_thread[4];
@@ -399,6 +410,8 @@ typedef struct voodoo_t {
ATOMIC_INT cmd_written;
ATOMIC_INT cmd_written_fifo;
ATOMIC_INT cmd_written_fifo_2;
ATOMIC_INT pending_fb_writes_buf[VOODOO_BUF_COUNT];
ATOMIC_INT pending_draw_cmds_buf[VOODOO_BUF_COUNT];
voodoo_params_t params_buffer[PARAM_SIZE];
ATOMIC_INT params_read_idx[4];
@@ -627,6 +640,12 @@ typedef struct voodoo_t {
int fb_write_buffer;
int fb_draw_buffer;
int buffer_cutoff;
int queued_disp_buffer;
int queued_draw_buffer;
int queued_fb_write_buffer;
int queued_fb_draw_buffer;
uint32_t queued_lfbMode;
uint32_t queued_fbzMode;
uint32_t tile_base;
uint32_t tile_stride;
@@ -657,6 +676,32 @@ typedef struct voodoo_t {
uint64_t time;
int render_time[4];
uint64_t fifo_full_waits;
uint64_t fifo_full_wait_ticks;
uint64_t fifo_full_spin_checks;
uint64_t fifo_empty_waits;
uint64_t fifo_empty_wait_ticks;
uint64_t fifo_empty_spin_checks;
uint64_t render_waits;
uint64_t render_wait_ticks;
uint64_t render_wait_spin_checks;
uint64_t readl_fb_count;
uint64_t readl_fb_sync_count;
uint64_t readl_fb_nosync_count;
uint64_t readl_fb_relaxed_count;
uint64_t readl_fb_sync_buf[3];
uint64_t readl_fb_nosync_buf[3];
uint64_t readl_fb_relaxed_buf[3];
uint64_t readl_reg_count;
uint64_t readl_tex_count;
int wait_stats_enabled;
int wait_stats_explicit;
int lfb_relax_enabled;
int lfb_relax_full;
int lfb_relax_ignore_cmdfifo;
int lfb_relax_ignore_draw;
int lfb_relax_ignore_fb_writes;
int lfb_relax_front_sync;
int force_blit_count;
int can_blit;