From ac3422a778dae79a9c11544e8c6cc033eec293b0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 27 Feb 2007 19:28:04 +0200 Subject: [PATCH] imported winuaesrc1400b9.zip --- cdtv.c | 17 ++++++++++------- cfgfile.c | 2 +- debug.c | 10 +++++++++- filesys.c | 10 ++++++---- inputdevice.c | 21 +++++++++++---------- od-win32/blkdev_win32_ioctl.c | 1 - od-win32/mman.c | 19 +++++++++++++++++++ od-win32/win32.c | 9 +++++---- od-win32/win32.h | 4 ++-- od-win32/win32gui.c | 9 +++++---- od-win32/winuaechangelog.txt | 18 ++++++++++++++++++ 11 files changed, 86 insertions(+), 34 deletions(-) diff --git a/cdtv.c b/cdtv.c index d1e1a976..21ee3dff 100755 --- a/cdtv.c +++ b/cdtv.c @@ -544,10 +544,9 @@ static void *dev_thread (void *p) for (;;) { uae_u32 b = read_comm_pipe_u32_blocking (&requests); - if (unitnum < 0) { - thread_alive = -1; - return NULL; - } + if (unitnum < 0) + continue; + switch (b) { case 0x100: @@ -572,6 +571,9 @@ static void *dev_thread (void *p) case 0x103: // unpause sys_command_cd_pause (DF_IOCTL, unitnum, 0); break; + case 0x104: // stop + cdaudiostop(); + break; case 0x110: // do_play! do_play(); break; @@ -1059,10 +1061,8 @@ static void open_unit(void) int first = -1; int cdtvunit = -1, audiounit = -1; - if (unitnum >= 0) { - cdaudiostop(); + if (unitnum >= 0) sys_command_close (DF_IOCTL, unitnum); - } unitnum = -1; cdtv_reset(); if (!device_func_init(DEVICE_TYPE_ANY)) { @@ -1230,6 +1230,7 @@ uae_u8 cdtv_battram_read (int addr) void cdtv_free (void) { if (thread_alive > 0) { + write_comm_pipe_u32 (&requests, 0x0104, 1); write_comm_pipe_u32 (&requests, 0xffff, 1); while (thread_alive > 0) sleep_millis(10); @@ -1251,6 +1252,8 @@ void cdtv_init (void) while (!thread_alive) sleep_millis(10); } + write_comm_pipe_u32 (&requests, 0x0104, 1); + configured = 0; tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0; diff --git a/cfgfile.c b/cfgfile.c index 28641b43..af6e8698 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -2825,7 +2825,7 @@ static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck) if (!configure_rom (p, roms, romcheck)) return 0; p->bogomem_size = 0; - p->chipmem_size = 0x200000; + p->chipmem_size = 0x100000; p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; p->cs_cdtvcd = p->cs_cdtvram = 1; if (config > 0) diff --git a/debug.c b/debug.c index 68c48924..1837fa02 100755 --- a/debug.c +++ b/debug.c @@ -47,6 +47,7 @@ int debug_sprite_mask = 0xff; static uaecptr debug_copper_pc; extern int audio_channel_mask; +extern int inputdevice_logging; static FILE *logfile; @@ -113,6 +114,7 @@ static char help[] = { " sm Enable or disable sprites\n" " di [] Break on disk access. R=DMA read,W=write,RW=both,P=PIO\n" " Also enables extended disk logging\n" + " dj [] Enable joystick/mouse input debugging\n" " dm Dump current address space map\n" " q Quit the emulator. You don't want to use this command.\n\n" }; @@ -1909,7 +1911,13 @@ static void debug_1 (void) if (*inptr == 'i') { next_char(&inptr); disk_debug(&inptr); - } else if(*inptr == 'm') { + } else if(*inptr == 'j') { + inptr++; + inputdevice_logging = 1 | 2; + if (more_params(&inptr)) + inputdevice_logging = readint(&inptr); + console_out("input logging level %d\n", inputdevice_logging); + } else if(*inptr == 'm') { memory_map_dump_2(0); } else { uae_u32 daddr; diff --git a/filesys.c b/filesys.c index 880e6d6f..6ccf9697 100755 --- a/filesys.c +++ b/filesys.c @@ -1739,6 +1739,10 @@ static void free_lock (Unit *unit, uaecptr lock) break; current = next; } + if (!current) { + write_log("tried to unlock non-existing lock %x\n", lock); + return; + } put_long (current << 2, get_long (lock)); } lock -= 4; @@ -1847,14 +1851,13 @@ action_dup_lock (Unit *unit, dpacket packet) static void action_lock_from_fh (Unit *unit, dpacket packet) { - uaecptr out; Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); TRACE(("ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet))); if (k == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); return; } - out = action_dup_lock_2 (unit, packet, k->aino->uniq); + action_dup_lock_2 (unit, packet, k->aino->uniq); } /* convert time_t to/from AmigaDOS time */ @@ -2361,9 +2364,8 @@ action_fh_from_lock (Unit *unit, dpacket packet) /* I don't think I need to play with shlock count here, because I'm opening from an existing lock ??? */ - /* Is this right? I don't completely understand how this works. Do I - also need to free_lock() my lock, since nobody else is going to? */ de_recycle_aino (unit, aino); + free_lock (unit, lock); /* lock must be unlocked */ PUT_PCK_RES1 (packet, DOS_TRUE); /* PUT_PCK_RES2 (packet, k->uniq); - this shouldn't be necessary, try without it */ } diff --git a/inputdevice.c b/inputdevice.c index 668589a8..325916ac 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -46,7 +46,6 @@ #include "autoconf.h" int inputdevice_logging = 0; -static int potgo_logging = 0; #define DIR_LEFT 1 #define DIR_RIGHT 2 @@ -1056,7 +1055,7 @@ int getjoystate (int joy) int left = 0, right = 0, top = 0, bot = 0; uae_u16 v = 0; - if (inputdevice_logging > 2) + if (inputdevice_logging & 2) write_log("JOY%dDAT %x\n", joy, m68k_getpc(®s)); readinput (); if (joydir[joy] & DIR_LEFT) @@ -1119,7 +1118,8 @@ void JOYTEST (uae_u16 v) mouse_frame_y[0] = mouse_y[0]; mouse_frame_x[1] = mouse_x[1]; mouse_frame_y[1] = mouse_y[1]; -// write_log ("%d:%04.4X %p\n",vpos,v,m68k_getpc()); + if (inputdevice_logging & 2) + write_log ("JOYTEST: %04.4X PC=%x\n", v , M68K_GETPC); } static uae_u8 parconvert (uae_u8 v, int jd, int shift) @@ -1180,7 +1180,8 @@ uae_u8 handle_joystick_buttons (uae_u8 dra) but |= 0x40 << i; } } - //write_log("%02.2X:%02.2X %x\n", dra, but, M68K_GETPC); + if (inputdevice_logging & 4) + write_log("BFE001: %02.2X:%02.2X %x\n", dra, but, M68K_GETPC); return but; } @@ -1330,8 +1331,8 @@ void POTGO (uae_u16 v) { int i; - if (potgo_logging) - write_log ("W:%d: %04.4X %p\n", vpos, v, M68K_GETPC); + if (inputdevice_logging & 16) + write_log ("POTGO_W: %04.4X %p\n", v, M68K_GETPC); #ifdef DONGLE_DEBUG if (notinrom ()) write_log ("POTGO %04.4X %s\n", v, debuginfo(0)); @@ -1367,8 +1368,8 @@ uae_u16 POTGOR (void) if (notinrom ()) write_log ("POTGOR %04.4X %s\n", v, debuginfo(0)); #endif - if (potgo_logging) - write_log("R:%d:%04.4X %d %p\n", vpos, v, cd32_shifter[1], M68K_GETPC); + if (inputdevice_logging & 16) + write_log("POTGO_R: %04.4X %d %p\n", v, cd32_shifter[1], M68K_GETPC); return v; } @@ -1447,7 +1448,7 @@ void inputdevice_do_keyboard (int code, int state) uae_reset (r); } record_key ((uae_u8)((key << 1) | (key >> 7))); - if (inputdevice_logging > 0) + if (inputdevice_logging & 1) write_log("Amiga key %02.2X %d\n", key & 0x7f, key >> 7); return; } @@ -1625,7 +1626,7 @@ int handle_input_event (int nr, int state, int max, int autofire) if (nr <= 0) return 0; ie = &events[nr]; - if (inputdevice_logging > 0) + if (inputdevice_logging & 1) write_log("'%s' %d %d\n", ie->name, state, max); if (autofire) { if (state) diff --git a/od-win32/blkdev_win32_ioctl.c b/od-win32/blkdev_win32_ioctl.c index 05bbe843..91434b67 100755 --- a/od-win32/blkdev_win32_ioctl.c +++ b/od-win32/blkdev_win32_ioctl.c @@ -33,7 +33,6 @@ struct dev_info_ioctl { int type; int blocksize; int mciid; - int mcimode; CDROM_TOC toc; UINT errormode; int playend; diff --git a/od-win32/mman.c b/od-win32/mman.c index 4612032c..fc652d10 100755 --- a/od-win32/mman.c +++ b/od-win32/mman.c @@ -149,6 +149,24 @@ void init_shm(void) void mapped_free(uae_u8 *mem) { shmpiece *x = shm_start; + + if (!p96mode && mem == p96fakeram) { + xfree (p96fakeram); + p96fakeram = NULL; + while(x) { + struct shmid_ds blah; + if (mem == x->native_address) { + int shmid = x->id; + shmids[shmid].key = -1; + shmids[shmid].name[0] = '\0'; + shmids[shmid].size = 0; + shmids[shmid].attached = 0; + } + x = x->next; + } + return; + } + while(x) { if(mem == x->native_address) shmdt(x->native_address); @@ -250,6 +268,7 @@ void *shmat(int shmid, void *shmaddr, int shmflg) shmaddr = natmem_offset + p96ram_start; } else { p96ram_start = currprefs.z3fastmem_start + ((currprefs.z3fastmem_size + 0xffffff) & ~0xffffff); + shmaddr = natmem_offset + p96ram_start; VirtualFree(shmaddr, os_winnt ? size : 0, os_winnt ? MEM_DECOMMIT : MEM_RELEASE); xfree(p96fakeram); result = p96fakeram = xcalloc (size + 4096, 1); diff --git a/od-win32/win32.c b/od-win32/win32.c index 74a18186..6080f13b 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -7,8 +7,7 @@ * Copyright 1997-1999 Brian King */ -/* Uncomment this line if you want the logs time-stamped */ -/* #define TIMESTAMP_LOGS */ +//#define MEMDEBUG #include "sysconfig.h" @@ -2717,8 +2716,10 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR //tmp &= 0xffff; tmp |= _CRTDBG_CHECK_ALWAYS_DF; tmp |= _CRTDBG_CHECK_CRT_DF; - //tmp |=_CRTDBG_CHECK_EVERY_16_DF; - //tmp |= _CRTDBG_DELAY_FREE_MEM_DF; +#ifdef MEMDEBUG + tmp |=_CRTDBG_CHECK_EVERY_16_DF; + tmp |= _CRTDBG_DELAY_FREE_MEM_DF; +#endif _CrtSetDbgFlag(tmp); } #endif diff --git a/od-win32/win32.h b/od-win32/win32.h index 55ec845a..5a9bd5ed 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 8 +#define WINUAEBETA 9 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2007, 2, 24) +#define WINUAEDATE MAKEBD(2007, 2, 27) #define IHF_WINDOWHIDDEN 6 #define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU) diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 3469c70f..b9a92c05 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -5684,11 +5684,12 @@ static void values_from_sounddlg (HWND hDlg) workprefs.sound_stereo_swap_ahi = (SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_GETCURSEL, 0, 0) & 2) ? 1 : 0; idx = SendDlgItemMessage (hDlg, IDC_SOUNDDRIVE, CB_GETCURSEL, 0, 0); - if (idx >= 0) { + if (idx != CB_ERR && idx >= 0) { LRESULT res = SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_GETCURSEL, 0, 0); - if (res >= 0) { - if (res > DS_BUILD_IN_SOUNDS + 2) { - int j = res - (DS_BUILD_IN_SOUNDS + 2 + 1); + if (res != CB_ERR && res >= 0) { + int xtra = driveclick_pcdrivemask ? 2 : 0; + if (res > DS_BUILD_IN_SOUNDS + xtra) { + int j = res - (DS_BUILD_IN_SOUNDS + xtra + 1); char *p = drivesounds; while (j-- > 0) p += strlen (p) + 1; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 419e9a21..c7c79b93 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,22 @@ +Beta 9: (RC 2) + +- non-ASPI CDTV CD audio didn't always stop when exiting/reseting +- added dj [] command to debugger. Enable joystick/mouse + input logging +- CDTV quickstart chip ram size set to correct 1M (correct config + is more important than workaround for one game) +- Fixed another filesystem lock leak in ACTION_FH_FROM_LOCK + (dos.library/OpenFromLock()) +- do not allow unlocking of non-existing locks in filesystem. + Previously it caused random memory corruption and also triggered + following (previously unknown) 1.0b2 issue: + "added workaround for AMOS filesystem emulation incompatibility + (infinite loop in filesystem code) Reason for freeze unknown, + proper fix unknown.. (filesystem emulation is confusing..)" +- external drive sound selection GUI didn't work if fdrawcmd.sys + was not installed + Beta 8: (RC 1) - uaehf.device unit >=30 crash fixed -- 2.47.3