Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -122,15 +122,15 @@ struct pcap_if {
|
||||
};
|
||||
|
||||
struct pcap_send_queue {
|
||||
u_int maxlen; /* Maximum size of the queue, in bytes. This
|
||||
unsigned int maxlen; /* Maximum size of the queue, in bytes. This
|
||||
variable contains the size of the buffer field. */
|
||||
u_int len; /* Current size of the queue, in bytes. */
|
||||
unsigned int len; /* Current size of the queue, in bytes. */
|
||||
char *buffer; /* Buffer containing the packets to be sent. */
|
||||
};
|
||||
|
||||
typedef struct pcap_send_queue pcap_send_queue;
|
||||
|
||||
typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes);
|
||||
typedef void (*pcap_handler)(unsigned char *user, const struct pcap_pkthdr *h, const unsigned char *bytes);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@@ -169,15 +169,15 @@ static int (*f_pcap_setnonblock)(void *, int, char *);
|
||||
static int (*f_pcap_set_immediate_mode)(void *, int);
|
||||
static int (*f_pcap_set_promisc)(void *, int);
|
||||
static int (*f_pcap_set_snaplen)(void *, int);
|
||||
static int (*f_pcap_dispatch)(void *, int, pcap_handler callback, u_char *user);
|
||||
static int (*f_pcap_dispatch)(void *, int, pcap_handler callback, unsigned char *user);
|
||||
static void *(*f_pcap_create)(const char *, char *);
|
||||
static int (*f_pcap_activate)(void *);
|
||||
static void *(*f_pcap_geterr)(void *);
|
||||
#ifdef _WIN32
|
||||
static HANDLE (*f_pcap_getevent)(void *);
|
||||
static int (*f_pcap_sendqueue_queue)(void *, void *, void *);
|
||||
static u_int (*f_pcap_sendqueue_transmit)(void *, void *, int sync);
|
||||
static void *(*f_pcap_sendqueue_alloc)(u_int memsize);
|
||||
static unsigned int (*f_pcap_sendqueue_transmit)(void *, void *, int sync);
|
||||
static void *(*f_pcap_sendqueue_alloc)(unsigned int memsize);
|
||||
static void (*f_pcap_sendqueue_destroy)(void *);
|
||||
#else
|
||||
static int (*f_pcap_get_selectable_fd)(void *);
|
||||
@@ -294,7 +294,7 @@ net_pcap_thread(void *priv)
|
||||
break;
|
||||
|
||||
case NET_EVENT_RX:
|
||||
f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap);
|
||||
f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (unsigned char *) pcap);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -341,7 +341,7 @@ net_pcap_thread(void *priv)
|
||||
}
|
||||
|
||||
if (pfd[NET_EVENT_RX].revents & POLLIN) {
|
||||
f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap);
|
||||
f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (unsigned char *) pcap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#include <pwd.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "macOSXGlue.h"
|
||||
#endif
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
@@ -41,10 +45,6 @@
|
||||
#include <86box/ui.h>
|
||||
#include <86box/gdbstub.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "macOSXGlue.h"
|
||||
#endif
|
||||
|
||||
static int first_use = 1;
|
||||
static uint64_t StartingTime;
|
||||
static uint64_t Frequency;
|
||||
@@ -191,6 +191,7 @@ dynld_module(const char *name, dllimp_t *table)
|
||||
{
|
||||
dllimp_t *imp;
|
||||
void *modhandle = dlopen(name, RTLD_LAZY | RTLD_GLOBAL);
|
||||
|
||||
if (modhandle) {
|
||||
for (imp = table; imp->name != NULL; imp++) {
|
||||
if ((*(void **) imp->func = dlsym(modhandle, imp->name)) == NULL) {
|
||||
@@ -199,6 +200,7 @@ dynld_module(const char *name, dllimp_t *table)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return modhandle;
|
||||
}
|
||||
|
||||
@@ -405,7 +407,7 @@ plat_mmap(size_t size, uint8_t executable)
|
||||
#if defined __APPLE__ && defined MAP_JIT
|
||||
void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE | (executable ? MAP_JIT : 0), -1, 0);
|
||||
#else
|
||||
void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
return (ret < 0) ? NULL : ret;
|
||||
}
|
||||
@@ -427,6 +429,7 @@ plat_get_ticks_common(void)
|
||||
{
|
||||
uint64_t EndingTime;
|
||||
uint64_t ElapsedMicroseconds;
|
||||
|
||||
if (first_use) {
|
||||
Frequency = SDL_GetPerformanceFrequency();
|
||||
StartingTime = SDL_GetPerformanceCounter();
|
||||
@@ -434,6 +437,7 @@ plat_get_ticks_common(void)
|
||||
}
|
||||
EndingTime = SDL_GetPerformanceCounter();
|
||||
ElapsedMicroseconds = ((EndingTime - StartingTime) * 1000000) / Frequency;
|
||||
|
||||
return ElapsedMicroseconds;
|
||||
}
|
||||
|
||||
@@ -458,11 +462,13 @@ plat_remove(char *path)
|
||||
void
|
||||
ui_sb_update_icon_state(int tag, int state)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
ui_sb_update_icon(int tag, int active)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
@@ -474,25 +480,26 @@ plat_delay_ms(uint32_t count)
|
||||
void
|
||||
ui_sb_update_tip(int arg)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
ui_sb_update_panes(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
ui_sb_update_text(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
path_get_dirname(char *dest, const char *path)
|
||||
{
|
||||
int c = (int) strlen(path);
|
||||
char *ptr;
|
||||
|
||||
ptr = (char *) path;
|
||||
char *ptr = (char *) path;
|
||||
|
||||
while (c > 0) {
|
||||
if (path[c] == '/' || path[c] == '\\') {
|
||||
@@ -511,6 +518,7 @@ volatile int cpu_thread_run = 1;
|
||||
void
|
||||
ui_sb_set_text_w(wchar_t *wstr)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -634,12 +642,16 @@ ui_msgbox_header(int flags, void *header, void *message)
|
||||
{
|
||||
SDL_MessageBoxData msgdata;
|
||||
SDL_MessageBoxButtonData msgbtn;
|
||||
|
||||
#if 0
|
||||
if (!header)
|
||||
header = (void *) (flags & MBX_ANSI) ? "86Box" : L"86Box";
|
||||
#endif
|
||||
if (header <= (void *) 7168)
|
||||
header = (void *) plat_get_string((int) header);
|
||||
header = (void *) plat_get_string((uintptr_t) header);
|
||||
if (message <= (void *) 7168)
|
||||
message = (void *) plat_get_string((int) message);
|
||||
message = (void *) plat_get_string((uintptr_t) message);
|
||||
|
||||
msgbtn.buttonid = 1;
|
||||
msgbtn.text = "OK";
|
||||
msgbtn.flags = 0;
|
||||
@@ -679,6 +691,7 @@ void
|
||||
plat_get_exe_name(char *s, int size)
|
||||
{
|
||||
char *basepath = SDL_GetBasePath();
|
||||
|
||||
snprintf(s, size, "%s%s", basepath, basepath[strlen(basepath) - 1] == '/' ? "86box" : "/86box");
|
||||
}
|
||||
|
||||
@@ -699,6 +712,7 @@ plat_power_off(void)
|
||||
void
|
||||
ui_sb_bugui(char *str)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
extern void sdl_blit(int x, int y, int w, int h);
|
||||
@@ -709,13 +723,17 @@ typedef struct mouseinputdata {
|
||||
int deltaz;
|
||||
int mousebuttons;
|
||||
} mouseinputdata;
|
||||
SDL_mutex *mousemutex;
|
||||
int real_sdl_w;
|
||||
int real_sdl_h;
|
||||
|
||||
SDL_mutex *mousemutex;
|
||||
int real_sdl_w;
|
||||
int real_sdl_h;
|
||||
|
||||
void
|
||||
ui_sb_set_ready(int ready)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
char *xargv[512];
|
||||
|
||||
// From musl.
|
||||
@@ -724,6 +742,7 @@ local_strsep(char **str, const char *sep)
|
||||
{
|
||||
char *s = *str;
|
||||
char *end;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
end = s + strcspn(s, sep);
|
||||
@@ -732,6 +751,7 @@ local_strsep(char **str, const char *sep)
|
||||
else
|
||||
end = 0;
|
||||
*str = end;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -761,6 +781,7 @@ plat_init_rom_paths(void)
|
||||
#ifndef __APPLE__
|
||||
if (getenv("XDG_DATA_HOME")) {
|
||||
char xdg_rom_path[1024] = { 0 };
|
||||
|
||||
strncpy(xdg_rom_path, getenv("XDG_DATA_HOME"), 1024);
|
||||
path_slash(xdg_rom_path);
|
||||
strncat(xdg_rom_path, "86Box/", 1024);
|
||||
@@ -774,6 +795,7 @@ plat_init_rom_paths(void)
|
||||
rom_add_path(xdg_rom_path);
|
||||
} else {
|
||||
char home_rom_path[1024] = { 0 };
|
||||
|
||||
snprintf(home_rom_path, 1024, "%s/.local/share/86Box/", getenv("HOME") ? getenv("HOME") : getpwuid(getuid())->pw_dir);
|
||||
|
||||
if (!plat_dir_check(home_rom_path))
|
||||
@@ -788,6 +810,7 @@ plat_init_rom_paths(void)
|
||||
char *xdg_rom_paths = strdup(getenv("XDG_DATA_DIRS"));
|
||||
char *xdg_rom_paths_orig = xdg_rom_paths;
|
||||
char *cur_xdg_rom_path = NULL;
|
||||
|
||||
if (xdg_rom_paths) {
|
||||
while (xdg_rom_paths[strlen(xdg_rom_paths) - 1] == ':') {
|
||||
xdg_rom_paths[strlen(xdg_rom_paths) - 1] = '\0';
|
||||
@@ -828,7 +851,9 @@ bool
|
||||
process_media_commands_3(uint8_t *id, char *fn, uint8_t *wp, int cmdargc)
|
||||
{
|
||||
bool err = false;
|
||||
|
||||
*id = atoi(xargv[1]);
|
||||
|
||||
if (xargv[2][0] == '\'' || xargv[2][0] == '"') {
|
||||
for (int curarg = 2; curarg < cmdargc; curarg++) {
|
||||
if (strlen(fn) + strlen(xargv[curarg]) >= PATH_MAX) {
|
||||
@@ -868,6 +893,7 @@ void (*f_rl_callback_handler_remove)(void) = NULL;
|
||||
#else
|
||||
# define LIBEDIT_LIBRARY "libedit.so"
|
||||
#endif
|
||||
|
||||
uint32_t
|
||||
timer_onesec(uint32_t interval, void *param)
|
||||
{
|
||||
@@ -882,6 +908,7 @@ monitor_thread(void *param)
|
||||
if (isatty(fileno(stdin)) && isatty(fileno(stdout))) {
|
||||
char *line = NULL;
|
||||
size_t n;
|
||||
|
||||
printf("86Box monitor console.\n");
|
||||
while (!exit_event) {
|
||||
if (feof(stdin))
|
||||
@@ -890,11 +917,12 @@ monitor_thread(void *param)
|
||||
line = f_readline("(86Box) ");
|
||||
else {
|
||||
printf("(86Box) ");
|
||||
getline(&line, &n, stdin);
|
||||
!getline(&line, &n, stdin);
|
||||
}
|
||||
if (line) {
|
||||
int cmdargc = 0;
|
||||
char *linecpy;
|
||||
|
||||
line[strcspn(line, "\r\n")] = '\0';
|
||||
linecpy = strdup(line);
|
||||
if (!linecpy) {
|
||||
@@ -989,6 +1017,7 @@ monitor_thread(void *param)
|
||||
memset(fn, 0, sizeof(fn));
|
||||
if (xargv[2][0] == '\'' || xargv[2][0] == '"') {
|
||||
int curarg = 2;
|
||||
|
||||
for (curarg = 2; curarg < cmdargc; curarg++) {
|
||||
if (strlen(fn) + strlen(xargv[curarg]) >= PATH_MAX) {
|
||||
err = true;
|
||||
@@ -1031,7 +1060,9 @@ monitor_thread(void *param)
|
||||
uint8_t wp;
|
||||
bool err = false;
|
||||
char fn[PATH_MAX];
|
||||
|
||||
memset(fn, 0, sizeof(fn));
|
||||
|
||||
if (!xargv[2] || !xargv[1]) {
|
||||
free(line);
|
||||
free(linecpy);
|
||||
@@ -1051,7 +1082,9 @@ monitor_thread(void *param)
|
||||
uint8_t wp;
|
||||
bool err = false;
|
||||
char fn[PATH_MAX];
|
||||
|
||||
memset(fn, 0, sizeof(fn));
|
||||
|
||||
if (!xargv[2] || !xargv[1]) {
|
||||
free(line);
|
||||
free(linecpy);
|
||||
@@ -1071,7 +1104,9 @@ monitor_thread(void *param)
|
||||
uint8_t wp;
|
||||
bool err = false;
|
||||
char fn[PATH_MAX];
|
||||
|
||||
memset(fn, 0, sizeof(fn));
|
||||
|
||||
if (!xargv[2] || !xargv[1]) {
|
||||
free(line);
|
||||
free(linecpy);
|
||||
@@ -1091,7 +1126,9 @@ monitor_thread(void *param)
|
||||
uint8_t wp;
|
||||
bool err = false;
|
||||
char fn[PATH_MAX];
|
||||
|
||||
memset(fn, 0, sizeof(fn));
|
||||
|
||||
if (!xargv[2] || !xargv[1]) {
|
||||
free(line);
|
||||
free(linecpy);
|
||||
@@ -1170,6 +1207,7 @@ main(int argc, char **argv)
|
||||
SDL_AddTimer(1000, timer_onesec, NULL);
|
||||
while (!is_quit) {
|
||||
static int mouse_inside = 0;
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
@@ -1244,6 +1282,7 @@ main(int argc, char **argv)
|
||||
case SDL_RENDER_TARGETS_RESET:
|
||||
{
|
||||
extern void sdl_reinit_texture(void);
|
||||
|
||||
sdl_reinit_texture();
|
||||
break;
|
||||
}
|
||||
@@ -1251,6 +1290,7 @@ main(int argc, char **argv)
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
uint16_t xtkey = 0;
|
||||
|
||||
switch (event.key.keysym.scancode) {
|
||||
default:
|
||||
xtkey = sdl_to_xt[event.key.keysym.scancode];
|
||||
@@ -1326,6 +1366,7 @@ plat_language_code(char *langcode)
|
||||
void
|
||||
plat_get_cpu_string(char *outbuf, uint8_t len) {
|
||||
char cpu_string[] = "Unknown";
|
||||
|
||||
strncpy(outbuf, cpu_string, len);
|
||||
}
|
||||
|
||||
@@ -1340,15 +1381,21 @@ plat_language_code_r(uint32_t lcid, char *outbuf, int len)
|
||||
void
|
||||
joystick_init(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
joystick_close(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
joystick_process(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
startblit(void)
|
||||
{
|
||||
@@ -1365,9 +1412,11 @@ endblit(void)
|
||||
void
|
||||
ui_sb_mt32lcd(char *str)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
ui_hard_reset_completed(void)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ int title_set = 0;
|
||||
int resize_pending = 0;
|
||||
int resize_w = 0;
|
||||
int resize_h = 0;
|
||||
static uint8_t interpixels[17842176];
|
||||
static void *pixeldata;
|
||||
|
||||
extern void RenderImGui(void);
|
||||
static void
|
||||
@@ -150,11 +150,15 @@ sdl_blit_shim(int x, int y, int w, int h, int monitor_index)
|
||||
params.y = y;
|
||||
params.w = w;
|
||||
params.h = h;
|
||||
|
||||
if (!(!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) || (monitor_index >= 1))
|
||||
video_copy(interpixels, &(buffer32->line[y][x]), h * 2048 * sizeof(uint32_t));
|
||||
if (screenshots)
|
||||
video_screenshot(interpixels, 0, 0, 2048);
|
||||
for (int row = 0; row < h; ++row)
|
||||
video_copy(&(((uint8_t *) pixeldata)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t));
|
||||
|
||||
if (monitors[monitor_index].mon_screenshots)
|
||||
video_screenshot((uint32_t *) pixeldata, 0, 0, 2048);
|
||||
blitreq = 1;
|
||||
|
||||
video_blit_complete_monitor(monitor_index);
|
||||
}
|
||||
|
||||
@@ -167,6 +171,7 @@ sdl_real_blit(SDL_Rect *r_src)
|
||||
int ret;
|
||||
int winx;
|
||||
int winy;
|
||||
|
||||
SDL_GL_GetDrawableSize(sdl_win, &winx, &winy);
|
||||
SDL_RenderClear(sdl_render);
|
||||
|
||||
@@ -213,7 +218,7 @@ sdl_blit(int x, int y, int w, int h)
|
||||
r_src.y = y;
|
||||
r_src.w = w;
|
||||
r_src.h = h;
|
||||
SDL_UpdateTexture(sdl_tex, &r_src, interpixels, 2048 * 4);
|
||||
SDL_UpdateTexture(sdl_tex, &r_src, pixeldata, 2048 * 4);
|
||||
blitreq = 0;
|
||||
|
||||
sdl_real_blit(&r_src);
|
||||
@@ -270,8 +275,6 @@ sdl_close(void)
|
||||
sdl_flags = -1;
|
||||
}
|
||||
|
||||
static int old_capture = 0;
|
||||
|
||||
void
|
||||
sdl_enable(int enable)
|
||||
{
|
||||
@@ -392,7 +395,6 @@ plat_vidapi(char *api)
|
||||
static int
|
||||
sdl_init_common(int flags)
|
||||
{
|
||||
wchar_t temp[128];
|
||||
SDL_version ver;
|
||||
|
||||
/* Get and log the version of the DLL we are using. */
|
||||
@@ -526,10 +528,13 @@ ui_window_title(wchar_t *str)
|
||||
void
|
||||
ui_init_monitor(int monitor_index)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
ui_deinit_monitor(int monitor_index)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -2427,16 +2427,6 @@ mach_out(uint16_t addr, uint8_t val, void *priv)
|
||||
svga_out(addr, val, svga);
|
||||
return;
|
||||
|
||||
case 0x3CF:
|
||||
if (svga->gdcaddr == 6) {
|
||||
uint8_t old_val = svga->gdcreg[6];
|
||||
svga->gdcreg[6] = val;
|
||||
if ((svga->gdcreg[6] & 0xc) != (old_val & 0xc))
|
||||
mach32_updatemapping(mach);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x3D4:
|
||||
svga->crtcreg = val & 0x3f;
|
||||
return;
|
||||
|
||||
@@ -246,10 +246,10 @@ typedef struct s3_t {
|
||||
uint8_t pix_trans[4];
|
||||
int ssv_state;
|
||||
|
||||
int cx, cy;
|
||||
int px, py;
|
||||
int sx, sy;
|
||||
int dx, dy;
|
||||
int16_t cx, cy;
|
||||
int16_t px, py;
|
||||
int16_t sx, sy;
|
||||
int16_t dx, dy;
|
||||
uint32_t src, dest, pattern;
|
||||
|
||||
int poly_cx, poly_cx2;
|
||||
@@ -262,7 +262,6 @@ typedef struct s3_t {
|
||||
uint32_t dat_buf;
|
||||
int dat_count;
|
||||
int b2e8_pix, temp_cnt;
|
||||
uint8_t cur_x_bit12, cur_y_bit12;
|
||||
int ssv_len;
|
||||
uint8_t ssv_dir;
|
||||
uint8_t ssv_draw;
|
||||
@@ -712,15 +711,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val)
|
||||
switch (port) {
|
||||
case 0x8148:
|
||||
case 0x82e8:
|
||||
s3->accel.cur_y_bitres = (s3->accel.cur_y_bitres & 0xff00) | val;
|
||||
s3->accel.cur_y = (s3->accel.cur_y & 0xf00) | val;
|
||||
s3->accel.poly_cy = s3->accel.cur_y;
|
||||
break;
|
||||
case 0x8149:
|
||||
case 0x82e9:
|
||||
s3->accel.cur_y_bitres = (s3->accel.cur_y_bitres & 0xff) | (val << 8);
|
||||
s3->accel.cur_y = (s3->accel.cur_y & 0xff) | ((val & 0x0f) << 8);
|
||||
s3->accel.cur_y_bit12 = val & 0x10;
|
||||
s3->accel.poly_cy = s3->accel.cur_y;
|
||||
break;
|
||||
case 0x814a:
|
||||
@@ -736,16 +732,13 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val)
|
||||
|
||||
case 0x8548:
|
||||
case 0x86e8:
|
||||
s3->accel.cur_x_bitres = (s3->accel.cur_x_bitres & 0xff00) | val;
|
||||
s3->accel.cur_x = (s3->accel.cur_x & 0xf00) | val;
|
||||
s3->accel.poly_cx = s3->accel.cur_x << 20;
|
||||
s3->accel.poly_x = s3->accel.poly_cx >> 20;
|
||||
break;
|
||||
case 0x8549:
|
||||
case 0x86e9:
|
||||
s3->accel.cur_x_bitres = (s3->accel.cur_x_bitres & 0xff) | (val << 8);
|
||||
s3->accel.cur_x = (s3->accel.cur_x & 0xff) | ((val & 0x0f) << 8);
|
||||
s3->accel.cur_x_bit12 = val & 0x10;
|
||||
s3->accel.poly_cx = s3->accel.poly_x = s3->accel.cur_x << 20;
|
||||
s3->accel.poly_x = s3->accel.poly_cx >> 20;
|
||||
break;
|
||||
@@ -884,14 +877,14 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val)
|
||||
s3->accel.short_stroke = (s3->accel.short_stroke & 0xff) | (val << 8);
|
||||
s3->accel.ssv_state = 1;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x & 0x7ff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0x7ff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
|
||||
if (s3->accel.cur_x & 0x800) {
|
||||
s3->accel.cx |= ~0x7ff;
|
||||
if (s3->accel.cur_x & 0x1000) {
|
||||
s3->accel.cx |= ~0xfff;
|
||||
}
|
||||
if (s3->accel.cur_y & 0x800) {
|
||||
s3->accel.cy |= ~0x7ff;
|
||||
if (s3->accel.cur_y & 0x1000) {
|
||||
s3->accel.cy |= ~0xfff;
|
||||
}
|
||||
|
||||
if (s3->accel.cmd & 0x1000) {
|
||||
@@ -1426,14 +1419,14 @@ s3_accel_out_fifo_w(s3_t *s3, uint16_t port, uint16_t val)
|
||||
s3->accel.short_stroke = val;
|
||||
s3->accel.ssv_state = 1;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x & 0x7ff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0x7ff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
|
||||
if (s3->accel.cur_x & 0x800) {
|
||||
s3->accel.cx |= ~0x7ff;
|
||||
if (s3->accel.cur_x & 0x1000) {
|
||||
s3->accel.cx |= ~0xfff;
|
||||
}
|
||||
if (s3->accel.cur_y & 0x800) {
|
||||
s3->accel.cy |= ~0x7ff;
|
||||
if (s3->accel.cur_y & 0x1000) {
|
||||
s3->accel.cy |= ~0xfff;
|
||||
}
|
||||
|
||||
if (s3->accel.cmd & 0x1000) {
|
||||
@@ -6380,14 +6373,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
|
||||
case 1: /*Draw line*/
|
||||
if (!cpu_input) {
|
||||
s3->accel.cx = s3->accel.cur_x & 0x7ff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0x7ff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
|
||||
if (s3->accel.cur_x & 0x800)
|
||||
s3->accel.cx |= ~0x7ff;
|
||||
if (s3->accel.cur_x & 0x1000)
|
||||
s3->accel.cx |= ~0xfff;
|
||||
|
||||
if (s3->accel.cur_y & 0x800)
|
||||
s3->accel.cy |= ~0x7ff;
|
||||
if (s3->accel.cur_y & 0x1000)
|
||||
s3->accel.cy |= ~0xfff;
|
||||
|
||||
s3->accel.sy = s3->accel.maj_axis_pcnt;
|
||||
|
||||
@@ -6615,14 +6608,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
{
|
||||
s3->accel.sx = s3->accel.maj_axis_pcnt & 0xfff;
|
||||
s3->accel.sy = s3->accel.multifunc[0] & 0xfff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0x7ff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0x7ff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
|
||||
if (s3->accel.cur_x & 0x800) {
|
||||
s3->accel.cx |= ~0x7ff;
|
||||
if (s3->accel.cur_x & 0x1000) {
|
||||
s3->accel.cx |= ~0xfff;
|
||||
}
|
||||
if (s3->accel.cur_y & 0x800) {
|
||||
s3->accel.cy |= ~0x7ff;
|
||||
if (s3->accel.cur_y & 0x1000) {
|
||||
s3->accel.cy |= ~0xfff;
|
||||
}
|
||||
|
||||
s3->accel.dest = dstbase + s3->accel.cy * s3->width;
|
||||
@@ -6844,14 +6837,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
if (s3->accel.desty_axstp & 0x800)
|
||||
s3->accel.dy |= ~0x7ff;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x & 0x7ff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0x7ff;
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
|
||||
if (s3->accel.cur_x & 0x800) {
|
||||
s3->accel.cx |= ~0x7ff;
|
||||
if (s3->accel.cur_x & 0x1000) {
|
||||
s3->accel.cx |= ~0xfff;
|
||||
}
|
||||
if (s3->accel.cur_y & 0x800) {
|
||||
s3->accel.cy |= ~0x7ff;
|
||||
if (s3->accel.cur_y & 0x1000) {
|
||||
s3->accel.cy |= ~0xfff;
|
||||
}
|
||||
|
||||
s3->accel.src = srcbase + s3->accel.cy * s3->width;
|
||||
@@ -7007,10 +7000,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
s3->accel.dy |= ~0xfff;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
if (s3->accel.cur_x_bit12)
|
||||
if (s3->accel.cur_x & 0x1000)
|
||||
s3->accel.cx |= ~0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
if (s3->accel.cur_y_bit12)
|
||||
if (s3->accel.cur_y & 0x1000)
|
||||
s3->accel.cy |= ~0xfff;
|
||||
|
||||
/*Align source with destination*/
|
||||
@@ -7132,10 +7125,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
s3->accel.dy |= ~0xfff;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x;
|
||||
if (s3->accel.cur_x_bit12)
|
||||
if (s3->accel.cur_x & 0x1000)
|
||||
s3->accel.cx |= ~0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y;
|
||||
if (s3->accel.cur_y_bit12)
|
||||
if (s3->accel.cur_y & 0x1000)
|
||||
s3->accel.cy |= ~0xfff;
|
||||
}
|
||||
|
||||
@@ -7323,10 +7316,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
|
||||
s3->accel.dy |= ~0xfff;
|
||||
|
||||
s3->accel.cx = s3->accel.cur_x & 0xfff;
|
||||
if (s3->accel.cur_x_bit12)
|
||||
if (s3->accel.cur_x & 0x1000)
|
||||
s3->accel.cx |= ~0xfff;
|
||||
s3->accel.cy = s3->accel.cur_y & 0xfff;
|
||||
if (s3->accel.cur_y_bit12)
|
||||
if (s3->accel.cur_y & 0x1000)
|
||||
s3->accel.cy |= ~0xfff;
|
||||
|
||||
s3->accel.px = s3->accel.pat_x & 0xfff;
|
||||
|
||||
Reference in New Issue
Block a user