From: Toni Wilen Date: Sat, 23 Aug 2008 08:09:27 +0000 (+0300) Subject: imported winuaesrc1520b2.zip X-Git-Tag: 2100~124 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=62a868470efc3c29c263c0ce4348c9282c45a5ea;p=francis%2Fwinuae.git imported winuaesrc1520b2.zip --- diff --git a/bsdsocket.c b/bsdsocket.c index 9b3b51b8..5a655375 100755 --- a/bsdsocket.c +++ b/bsdsocket.c @@ -1498,8 +1498,10 @@ void bsdlib_install (void) sockdata->sockpoolids[i] = UNIQUE_ID; } - if (!init_socket_layer ()) + if (!init_socket_layer ()) { + write_log ("bsdsocket initialization failed\n"); return; + } resname = ds ("bsdsocket.library"); resid = ds ("UAE bsdsocket.library 4.1"); @@ -1576,6 +1578,8 @@ void bsdlib_install (void) dl (*sockfuncvecs); org (end); + + write_log ("bsdsocked.library installed\n"); } #endif /* ! BSDSOCKET */ diff --git a/expansion.c b/expansion.c index 366c41ec..ad720ab4 100755 --- a/expansion.c +++ b/expansion.c @@ -1192,6 +1192,7 @@ static void allocate_expamem (void) static uaecptr check_boot_rom (void) { + int i; uaecptr b = RTAREA_DEFAULT; addrbank *ab; @@ -1204,8 +1205,10 @@ static uaecptr check_boot_rom (void) if (valid_address (RTAREA_DEFAULT, 65536)) b = RTAREA_BACKUP; } - if (nr_directory_units ()) + if (nr_directory_units (NULL)) return b; + if (nr_directory_units (&currprefs)) + return b; if (currprefs.socket_emu) return b; if (currprefs.uaeserial) diff --git a/filesys.c b/filesys.c index 9ce07820..8de94e8f 100755 --- a/filesys.c +++ b/filesys.c @@ -156,12 +156,19 @@ int nr_units (void) return cnt; } -int nr_directory_units (void) +int nr_directory_units (struct uae_prefs *p) { int i, cnt = 0; - for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { - if (mountinfo.ui[i].open && mountinfo.ui[i].controller == 0) - cnt++; + if (p) { + for (i = 0; i < p->mountitems; i++) { + if (p->mountconfig[i].controller == 0) + cnt++; + } + } else { + for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { + if (mountinfo.ui[i].open && mountinfo.ui[i].controller == 0) + cnt++; + } } return cnt; } diff --git a/include/autoconf.h b/include/autoconf.h index 564f7e44..df32f408 100755 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -43,7 +43,7 @@ extern uaecptr filesys_initcode; extern int is_hardfile (int unit_no); extern int nr_units (void); -extern int nr_directory_units (void); +extern int nr_directory_units (struct uae_prefs*); extern uaecptr need_uae_boot_rom (void); struct mountedinfo diff --git a/include/options.h b/include/options.h index 1a7eff6a..b9d51e3c 100755 --- a/include/options.h +++ b/include/options.h @@ -343,6 +343,8 @@ struct uae_prefs { int input_joymouse_deadzone; int input_joystick_deadzone; int input_joymouse_speed; + int input_analog_joystick_mult; + int input_analog_joystick_offset; int input_autofire_framecnt; int input_mouse_speed; struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; diff --git a/inputdevice.c b/inputdevice.c index 389f594c..40b67e7c 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -388,7 +388,13 @@ static int cd32_pad_enabled[2]; static int parport_joystick_enabled; static int oldmx[4], oldmy[4]; static int oleft[4], oright[4], otop[4], obot[4]; -static int potgo_hsync; + +uae_u16 potgo_value; +static int pot_cap[2][2]; +static uae_u8 pot_dat[2][2]; +static int pot_dat_act[2][2]; +static int analog_port[2][2]; +#define POTDAT_DELAY 8 static int use_joysticks[MAX_INPUT_DEVICES]; static int use_mice[MAX_INPUT_DEVICES]; @@ -573,6 +579,8 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f) cfgfile_write (f, "input.joymouse_speed_digital=%d\n", p->input_joymouse_speed); cfgfile_write (f, "input.joymouse_deadzone=%d\n", p->input_joymouse_deadzone); cfgfile_write (f, "input.joystick_deadzone=%d\n", p->input_joystick_deadzone); + cfgfile_write (f, "input.analog_joystick_multiplier=%d\n", p->input_analog_joystick_mult); + cfgfile_write (f, "input.analog_joystick_offset=%d\n", p->input_analog_joystick_offset); cfgfile_write (f, "input.mouse_speed=%d\n", p->input_mouse_speed); cfgfile_write (f, "input.autofire=%d\n", p->input_autofire_framecnt); for (id = 1; id <= MAX_INPUT_SETTINGS; id++) { @@ -655,6 +663,10 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) pr->input_mouse_speed = atol (value); if (!strcasecmp (p, "autofire")) pr->input_autofire_framecnt = atol (value); + if (!strcasecmp (p, "analog_joystick_multiplier")) + pr->input_analog_joystick_mult = atol (value); + if (!strcasecmp (p, "analog_joystick_offset")) + pr->input_analog_joystick_offset = atol (value); idnum = atol (p); if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS) @@ -1297,31 +1309,6 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (currprefs.cs_cdtvcd) { - /* CDTV P9 is not floating */ - if (!(potgo_value & p9dir)) - potgor |= p9dat; - } - - if (mouse_port[i]) { - /* official Commodore mouse has pull-up resistors in button lines - * NOTE: 3rd party mice may not have pullups! */ - if (!(potgo_value & p5dir)) - potgor |= p5dat; - if (!(potgo_value & p9dir)) - potgor |= p9dat; - } - - if (potgo_hsync < 0) { - /* first 10 or so lines after potgo has started - * forces input-lines to zero - */ - if (!(potgo_value & p5dir)) - potgor &= ~p5dat; - if (!(potgo_value & p9dir)) - potgor &= ~p9dat; - } - if (cd32_pad_enabled[i]) { /* p5 is floating in input-mode */ potgor &= ~p5dat; @@ -1337,52 +1324,85 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) potgor &= ~p9dat; } else { - if (getbuttonstate (i, JOYBUTTON_3)) - potgor &= ~p5dat; - if (getbuttonstate (i, JOYBUTTON_2)) - potgor &= ~p9dat; + potgor &= ~p5dat; + if (pot_cap[i][0] > 100) + potgor |= p5dat; + potgor &= ~p9dat; + if (pot_cap[i][1] > 100) + potgor |= p9dat; } } return potgor; } -uae_u16 potgo_value; -static uae_u16 potdats[2]; static int inputdelay; +static void charge_cap (int joy, int idx, int charge) +{ + if (charge < -1 || charge > 1) + charge = charge * 80; + pot_cap[joy][idx] += charge; + if (pot_cap[joy][idx] < 0) + pot_cap[joy][idx] = 0; + if (pot_cap[joy][idx] > 511) + pot_cap[joy][idx] = 511; +} + +static int calcexp (int v) +{ + return v; +} + void inputdevice_hsync (void) { - int joy; + int joy, i; for (joy = 0; joy < 2; joy++) { - if (potgo_hsync >= 0) { - int active; - - active = 0; - if ((potgo_value >> 9) & 1) /* output? */ - active = ((potgo_value >> 8) & 1) ? 0 : 1; - if (potgo_hsync < joydirpot[joy][0]) - active = 1; - if (getbuttonstate (joy, JOYBUTTON_3)) - active = 1; - if (active) - potdats[joy] = ((potdats[joy] + 1) & 0xFF) | (potdats[joy] & 0xFF00); - - active = 0; - if ((potgo_value >> 11) & 1) /* output? */ - active = ((potgo_value >> 10) & 1) ? 0 : 1; - if (potgo_hsync < joydirpot[joy][1]) - active = 1; - if (getbuttonstate (joy, JOYBUTTON_2)) - active = 1; - if (active) - potdats[joy] += 0x100; - } - } - potgo_hsync++; - if (potgo_hsync > 255) - potgo_hsync = 255; + for (i = 0; i < 2; i++) { + int charge = 0; + uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */ + uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */ + + if (analog_port[joy][i] && pot_cap[joy][i] < calcexp (joydirpot[joy][i])) + charge = 1; // slow charge via pot variable resistor + if (!(potgo_value & pdir)) { // input? + if (pot_dat_act[joy][i]) + pot_dat[joy][i]++; + /* first 8 lines after potgo has started = discharge cap */ + if (pot_dat_act[joy][i] == 1) { + if (pot_dat[joy][i] < POTDAT_DELAY) { + charge = -2; /* fast discharge delay */ + } else { + pot_dat_act[joy][i] = 2; + pot_dat[joy][i] = 0; + } + } + if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= calcexp (joydirpot[joy][i])) + pot_dat_act[joy][i] = 0; + } else { // output? + charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */ + if ((potgo_value & pdat) && (potgo_value & pdir)) + pot_dat_act[joy][i] = 0; // instant stop if output+high + } + if (getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2)) + charge = -2; // button press overrides everything + + if (currprefs.cs_cdtvcd) { + /* CDTV P9 is not floating */ + if (!(potgo_value & pdir) && i == 1 && charge == 0) + charge = 2; + } + /* official Commodore mouse has pull-up resistors in button lines + * NOTE: 3rd party mice may not have pullups! */ + if (mouse_port[joy]) { + if (charge == 0) + charge = 2; + } + + charge_cap (joy, i, charge); + } + } #ifdef CATWEASEL catweasel_hsync (); @@ -1396,13 +1416,21 @@ void inputdevice_hsync (void) } } +static uae_u16 POTDAT (int joy) +{ + uae_u16 v = (pot_dat[joy][0] << 8) | pot_dat[joy][1]; + if (inputdevice_logging & 16) + write_log ("POTDAT%d: %04X %08X\n", joy, v, M68K_GETPC); + return v; +} + uae_u16 POT0DAT (void) { - return potdats[0]; + return POTDAT (0); } uae_u16 POT1DAT (void) { - return potdats[1]; + return POTDAT (1); } /* direction=input, data pin floating, last connected logic level or previous status @@ -1414,10 +1442,10 @@ uae_u16 POT1DAT (void) void POTGO (uae_u16 v) { - int i; + int i, j; if (inputdevice_logging & 16) - write_log ("POTGO_W: %04X %p\n", v, M68K_GETPC); + write_log ("POTGO_W: %04X %08X\n", v, M68K_GETPC); #ifdef DONGLE_DEBUG if (notinrom ()) write_log ("POTGO %04X %s\n", v, debuginfo(0)); @@ -1441,8 +1469,12 @@ void POTGO (uae_u16 v) } } if (v & 1) { - potdats[0] = potdats[1] = 0; - potgo_hsync = -15; + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + pot_dat_act[i][j] = 1; + pot_dat[i][j] = 0; + } + } } } @@ -1454,7 +1486,7 @@ uae_u16 POTGOR (void) write_log ("POTGOR %04X %s\n", v, debuginfo(0)); #endif if (inputdevice_logging & 16) - write_log ("POTGO_R: %04X %d %p\n", v, cd32_shifter[1], M68K_GETPC); + write_log ("POTGO_R: %04X %08X %d\n", v, M68K_GETPC, cd32_shifter[1]); return v; } @@ -1644,7 +1676,7 @@ void inputdevice_handle_inputcode (void) sound_volume (1); break; case AKS_VOLMUTE: - sound_mute (0); + sound_mute (-1); break; case AKS_MVOLDOWN: master_sound_volume (-1); @@ -1881,7 +1913,9 @@ int handle_input_event (int nr, int state, int max, int autofire) } if (ie->data & IE_INVERT) state = -state; - state = state / 256 + 128; + state = state / (312 * 100 / currprefs.input_analog_joystick_mult) + (128 * currprefs.input_analog_joystick_mult / 100) + currprefs.input_analog_joystick_offset; + if (state < 0) + state = 0; joydirpot[joy][unit] = state; } else { @@ -1950,6 +1984,9 @@ void inputdevice_vsync (void) struct input_queue_struct *iq; int i; + if (inputdevice_logging & 32) + write_log ("*\n"); + for (i = 0; i < INPUT_QUEUE_SIZE; i++) { iq = &input_queue[i]; if (iq->framecnt > 0) { @@ -2228,6 +2265,27 @@ static int ismouse (int ei) return 0; } +static int isanalog (int ei) +{ + if (ei == INPUTEVENT_JOY1_HORIZ_POT || ei == INPUTEVENT_JOY1_HORIZ_POT_INV) { + analog_port[0][0] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY1_VERT_POT || ei == INPUTEVENT_JOY1_VERT_POT_INV) { + analog_port[0][1] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY2_HORIZ_POT || ei == INPUTEVENT_JOY2_HORIZ_POT_INV) { + analog_port[1][0] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY2_VERT_POT || ei == INPUTEVENT_JOY2_VERT_POT_INV) { + analog_port[1][1] = 1; + return 1; + } + return 0; +} + static void scanevents(struct uae_prefs *p) { int i, j, k, ei; @@ -2238,6 +2296,14 @@ static void scanevents(struct uae_prefs *p) cd32_pad_enabled[0] = cd32_pad_enabled[1] = 0; parport_joystick_enabled = 0; mouse_port[0] = mouse_port[1] = 0; + + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + analog_port[i][j] = 0; + joydirpot[i][j] = (128 * currprefs.input_analog_joystick_mult / 100) + currprefs.input_analog_joystick_offset; + } + } + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) joydir[i] = 0; @@ -2275,6 +2341,7 @@ static void scanevents(struct uae_prefs *p) iscd32 (ei); isparport (ei); ismouse (ei); + isanalog (ei); if (ei > 0) use_joysticks[i] = 1; } @@ -2283,6 +2350,7 @@ static void scanevents(struct uae_prefs *p) iscd32 (ei); isparport (ei); ismouse (ei); + isanalog (ei); if (ei > 0) use_mice[i] = 1; } @@ -2628,6 +2696,8 @@ void inputdevice_default_prefs (struct uae_prefs *p) p->input_joymouse_deadzone = 33; p->input_joystick_deadzone = 33; p->input_joymouse_speed = 10; + p->input_analog_joystick_mult = 100; + p->input_analog_joystick_offset = 0; p->input_mouse_speed = 100; p->input_autofire_framecnt = 10; for (i = 0; i <= MAX_INPUT_SETTINGS; i++) { diff --git a/od-win32/bsdsock.c b/od-win32/bsdsock.c index 6941a721..109fd143 100755 --- a/od-win32/bsdsock.c +++ b/od-win32/bsdsock.c @@ -182,14 +182,13 @@ static int mySockStartup(void) return result; } -int init_socket_layer(void) +int init_socket_layer (void) { int result = 0; deinit_socket_layer (); if (currprefs.socket_emu) { if((result = mySockStartup())) { - if(bsd->hSockThread == NULL) { WNDCLASS wc; // Set up an invisible window and dummy wndproc @@ -824,7 +823,6 @@ static BOOL HandleStuff(void) BOOL quit = FALSE; SB = NULL; BOOL handled = TRUE; - int rv; if (bsd->hSockReq) { // 100ms sleepiness might need some tuning... diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index feee5791..c2afc830 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -1297,10 +1297,19 @@ int D3D_locktexture (void) return 0; } + locked.pBits = NULL; + locked.Pitch = 0; hr = IDirect3DTexture9_LockRect (texture, 0, &locked, NULL, D3DLOCK_NO_DIRTY_UPDATE); if (FAILED (hr)) { - write_log ("IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); - D3D_unlocktexture (); + if (hr != D3DERR_DRIVERINTERNALERROR) { + write_log ("IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); + D3D_unlocktexture (); + return 0; + } + } + if (locked.pBits == NULL || locked.Pitch == 0) { + write_log ("IDirect3DTexture9_LockRect return NULL texture\n"); + D3D_unlocktexture (); return 0; } gfxvidinfo.bufmem = locked.pBits; diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 51a04103..9cc048bb 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -3716,18 +3716,20 @@ static void statusline (uae_u8 *dst) static void flushpixels (void) { int i; - int rowwidth_src = picasso96_state.Width * picasso96_state.BytesPerPixel; uae_u8 *src = p96ram_start + natmem_offset; int off = picasso96_state.XYOffset - gfxmem_start; uae_u8 *src_start = src + (off & ~gwwpagemask); - uae_u8 *src_end = src + ((off + rowwidth_src * picasso96_state.Height + gwwpagesize - 1) & ~gwwpagemask); + uae_u8 *src_end = src + ((off + picasso96_state.BytesPerRow * picasso96_state.Height + gwwpagesize - 1) & ~gwwpagemask); int maxy = -1; int miny = picasso96_state.Height - 1; int lock = 0; uae_u8 *dst = NULL; ULONG_PTR gwwcnt; - - +#if 0 + write_log ("%dx%d %dx%d %dx%d\n", picasso96_state.Width, picasso96_state.Width, + picasso96_state.VirtualWidth, picasso96_state.VirtualHeight, + picasso_vidinfo.width, picasso_vidinfo.height); +#endif if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end) return; diff --git a/od-win32/win32.c b/od-win32/win32.c index 606b0f8e..73752297 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -1178,9 +1178,12 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_WINDOWPOSCHANGED: WIN32GFX_WindowMove (); - if (hAmigaWnd && isfullscreen () <= 0 && GetWindowRect (hAmigaWnd, &amigawin_rect)) { - DWORD aw = amigawin_rect.right - amigawin_rect.left; - DWORD ah = amigawin_rect.bottom - amigawin_rect.top; + if (hAmigaWnd && isfullscreen () <= 0) { + DWORD aw, ah; + if (!IsIconic (hWnd)) + GetWindowRect (hAmigaWnd, &amigawin_rect); + aw = amigawin_rect.right - amigawin_rect.left; + ah = amigawin_rect.bottom - amigawin_rect.top; if (in_sizemove > 0) break; diff --git a/od-win32/win32.h b/od-win32/win32.h index f231125e..3256499f 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -16,8 +16,8 @@ #define GETBDD(x) ((x) % 100) #define WINUAEBETA 1 -#define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 8, 17) +#define WINUAEPUBLICBETA 2 +#define WINUAEDATE MAKEBD(2008, 8, 23) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index cec27c43..c0707b98 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -9580,7 +9580,7 @@ static void enable_for_hw3ddlg (HWND hDlg) ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0); } -static void makefilter(char *s, int x, int flags) +static void makefilter (char *s, int x, int flags) { sprintf (s, "%dx", x); if ((flags & (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) == (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) { @@ -9632,6 +9632,19 @@ static int *filtervars[] = { &workprefs.gfx_filter_keep_aspect, &workprefs.gfx_filter_aspect, NULL }; +static int *filtervars2[] = { + NULL, &currprefs.gfx_filter_filtermode, + &currprefs.gfx_filter_vert_zoom, &currprefs.gfx_filter_horiz_zoom, + &currprefs.gfx_filter_vert_zoom_mult, &currprefs.gfx_filter_horiz_zoom_mult, + &currprefs.gfx_filter_vert_offset, &currprefs.gfx_filter_horiz_offset, + &currprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlineratio, + &currprefs.gfx_resolution, &currprefs.gfx_linedbl, &currprefs.gfx_correct_aspect, + &currprefs.gfx_xcenter, &currprefs.gfx_ycenter, + &currprefs.gfx_filter_luminance, &currprefs.gfx_filter_contrast, &currprefs.gfx_filter_saturation, + &currprefs.gfx_filter_gamma, &currprefs.gfx_filter_blur, &currprefs.gfx_filter_noise, + &currprefs.gfx_filter_keep_aspect, &currprefs.gfx_filter_aspect, + NULL + }; struct filterpreset { char *name; @@ -9932,6 +9945,8 @@ static void filter_preset (HWND hDlg, WPARAM wParam) *t++ = 0; for (i = 0; filtervars[i]; i++) { *(filtervars[i]) = atol(s); + if (filtervars2[i]) + *(filtervars2[i]) = *(filtervars[i]); s = t; t = strchr (s, ','); if (!t) @@ -9942,11 +9957,11 @@ static void filter_preset (HWND hDlg, WPARAM wParam) } end: regclosetree (fkey); + enable_for_hw3ddlg (hDlg); if (load) { values_to_hw3ddlg (hDlg); SendMessage (hDlg, WM_HSCROLL, 0, 0); } - enable_for_hw3ddlg (hDlg); } static void filter_handle (HWND hDlg) @@ -10036,7 +10051,9 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM case IDC_FILTERPRESETLOAD: case IDC_FILTERPRESETSAVE: case IDC_FILTERPRESETDELETE: + recursive--; filter_preset (hDlg, wParam); + recursive++; break; case IDC_FILTERENABLE: filter_handle (hDlg); diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 8535eca8..bad3c1df 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -86,13 +86,13 @@