#define UNIQUE_ID (-1)
/* ObtainSocket()/ReleaseSocket() public socket pool */
-long sockpoolids[SOCKPOOLSIZE];
-SOCKET_TYPE sockpoolsocks[SOCKPOOLSIZE];
-uae_u32 sockpoolflags[SOCKPOOLSIZE];
+struct sockd {
+ long sockpoolids[SOCKPOOLSIZE];
+ SOCKET_TYPE sockpoolsocks[SOCKPOOLSIZE];
+ uae_u32 sockpoolflags[SOCKPOOLSIZE];
+};
-long curruniqid = 65536;
+static long curruniqid = 65536;
+static struct sockd *sockdata;
/* Memory-related helper functions */
STATIC_INLINE void memcpyha (uae_u32 dst, const char *src, int size)
}
BOOL checksd(SB, int sd)
- {
- int iCounter;
- SOCKET s;
+{
+ int iCounter;
+ SOCKET s;
s = getsock(sb,sd);
- if (s != INVALID_SOCKET)
- {
- for (iCounter = 1; iCounter <= sb->dtablesize; iCounter++)
- {
- if (iCounter != sd)
- {
- if (getsock(sb,iCounter) == s)
- {
- releasesock(sb,sd);
- return TRUE;
- }
- }
- }
- for (iCounter = 0; iCounter < SOCKPOOLSIZE; iCounter++)
- {
- if (s == sockpoolsocks[iCounter])
- return TRUE;
- }
+ if (s != INVALID_SOCKET) {
+ for (iCounter = 1; iCounter <= sb->dtablesize; iCounter++) {
+ if (iCounter != sd) {
+ if (getsock(sb,iCounter) == s) {
+ releasesock(sb,sd);
+ return TRUE;
}
- TRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
- return FALSE;
+ }
+ }
+ for (iCounter = 0; iCounter < SOCKPOOLSIZE; iCounter++) {
+ if (s == sockdata->sockpoolsocks[iCounter])
+ return TRUE;
}
+ }
+ TRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
+ return FALSE;
+}
void setsd(SB, int sd, SOCKET_TYPE s)
{
int i;
for (i = 0; i < SOCKPOOLSIZE; i++)
- if (sockpoolids[i] == id)
+ if (sockdata->sockpoolids[i] == id)
return i;
return -1;
TRACE (("[invalid key]\n"));
return -1;
}
- s = sockpoolsocks[i];
+ s = sockdata->sockpoolsocks[i];
sd = getsd (sb, s);
TRACE (("%d\n", sd));
if (sd != -1) {
- sb->ftable[sd - 1] = sockpoolflags[i];
- sockpoolids[i] = UNIQUE_ID;
+ sb->ftable[sd - 1] = sockdata->sockpoolflags[i];
+ sockdata->sockpoolids[i] = UNIQUE_ID;
return sd - 1;
}
write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
return -1;
}
- sockpoolids[i] = id;
- sockpoolsocks[i] = s;
- sockpoolflags[i] = flags;
+ sockdata->sockpoolids[i] = id;
+ sockdata->sockpoolsocks[i] = s;
+ sockdata->sockpoolflags[i] = flags;
TRACE (("id %d s 0x%x\n", id,s));
} else {
write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
return -1;
}
- sockpoolids[i] = id;
- sockpoolsocks[i] = s;
- sockpoolflags[i] = flags;
+ sockdata->sockpoolids[i] = id;
+ sockdata->sockpoolsocks[i] = s;
+ sockdata->sockpoolflags[i] = flags;
TRACE (("id %d s 0x%x\n", id,s));
return 0x7f000001;
}
-const char *errortexts[] =
+static const char *errortexts[] =
{"No error", "Operation not permitted", "No such file or directory",
"No such process", "Interrupted system call", "Input/output error", "Device not configured",
"Argument list too long", "Exec format error", "Bad file descriptor", "No child processes",
"RPC prog. not avail", "Program version wrong", "Bad procedure for program", "No locks available",
"Function not implemented", "Inappropriate file type or format", "PError 0"};
-uae_u32 errnotextptrs[sizeof (errortexts) / sizeof (*errortexts)];
-uae_u32 number_sys_error = sizeof (errortexts) / sizeof (*errortexts);
+static uae_u32 errnotextptrs[sizeof (errortexts) / sizeof (*errortexts)];
+static const uae_u32 number_sys_error = sizeof (errortexts) / sizeof (*errortexts);
-const char *herrortexts[] =
+static const char *herrortexts[] =
{"No error", "Unknown host", "Host name lookup failure", "Unknown server error",
"No address associated with name"};
-uae_u32 herrnotextptrs[sizeof (herrortexts) / sizeof (*herrortexts)];
-uae_u32 number_host_error = sizeof (herrortexts) / sizeof (*herrortexts);
+static uae_u32 herrnotextptrs[sizeof (herrortexts) / sizeof (*herrortexts)];
+static const uae_u32 number_host_error = sizeof (herrortexts) / sizeof (*herrortexts);
static const char * const strErr = "Errlist lookup error";
-uae_u32 strErrptr;
+static uae_u32 strErrptr;
#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_IGNORE (1L) /* ignore this item, not end of array */
#define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems */
#define TAG_SKIP (3L) /* skip this and the next ti_Data items */
-#define TAG_USER ((uae_u32)(1L<<31))
+#define TAG_USER ((uae_u32)(1L << 31))
#define SBTF_VAL 0x0000
#define SBTF_REF 0x8000
#define SBTB_CODE 1
#define SBTS_CODE 0x3FFF
-#define SBTM_CODE(tag) ((((UWORD)(tag))>>SBTB_CODE) & SBTS_CODE)
+#define SBTM_CODE(tag) ((((UWORD)(tag)) >> SBTB_CODE) & SBTS_CODE)
#define SBTF_GET 0x0
#define SBTF_SET 0x1
#define SBTM_GETREF(code) \
SB, *nsb;
int i;
+ if (!SockLibBase)
+ return;
+
SockLibBase = 0;
for (sb = socketbases; sb; sb = nsb) {
sbsigqueue = NULL;
for (i = 0; i < SOCKPOOLSIZE; i++) {
- if (sockpoolids[i] != UNIQUE_ID) {
- sockpoolids[i] = UNIQUE_ID;
- host_closesocketquick (sockpoolsocks[i]);
+ if (sockdata->sockpoolids[i] != UNIQUE_ID) {
+ sockdata->sockpoolids[i] = UNIQUE_ID;
+ host_closesocketquick (sockdata->sockpoolsocks[i]);
}
}
uae_u32 func_place, data_place, init_place;
int i;
+ if (!sockdata)
+ sockdata = xcalloc (sizeof (struct sockd), 1);
if (!init_socket_layer ())
return;
- memset (sockpoolids, UNIQUE_ID, sizeof (sockpoolids));
+ for (i = 0; i < SOCKPOOLSIZE; i++)
+ sockdata->sockpoolids[i] = UNIQUE_ID;
resname = ds ("bsdsocket.library");
resid = ds ("UAE bsdsocket.library 4.1");
strcpy (p->path_floppy, "./");
strcpy (p->path_hardfile, "./");
- strcpy (p->prtname, DEFPRTNAME);
- strcpy (p->sername, DEFSERNAME);
+ p->prtname[0] = 0;
+ p->sername[0] = 0;
p->cpu_level = 0;
p->m68k_speed = 0;
strcpy (p->romextfile, "");
strcpy (p->flashfile, "");
strcpy (p->cartfile, "");
- strcpy (p->prtname, DEFPRTNAME);
- strcpy (p->sername, DEFSERNAME);
+ p->prtname[0] = 0;
+ p->sername[0] = 0;
target_default_options (p, 1);
}
char buffer[1000];
va_start (parms, format);
- _vsnprintf( buffer, sizeof (buffer) -1, format, parms );
+ _vsnprintf(buffer, sizeof (buffer) - 1, format, parms );
va_end (parms);
if (nomore) {
write_log(buffer);
{
static int warned = 10;
- if (warned < 0)
- return;
- warned--;
write_log("%s: vpos=%d until_hpos=%d\n",
error, vpos, until_hpos);
write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04.4X ci2=%04.4X\n",
cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2);
- write_log("cstate=%d ip=%08.8X\n",
- cop_state.state,cop_state.ip);
+ write_log("cstate=%d ip=%x SPCFLAGS=%x\n",
+ cop_state.state, cop_state.ip, regs.spcflags);
}
static void update_copper (int until_hpos)
return;
if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
- dump_copper ("error2",until_hpos);
+ dump_copper ("error2", until_hpos);
copper_enabled_thisline = 0;
+ cop_state.state = COP_stop;
+ unset_special(®s, SPCFLAG_COPPER);
return;
}
if (i < max)
a2 = mem_banks[i];
if (a1 != a2) {
- int k, mirrored, size;
+ int k, mirrored, size, size_out;
+ char size_ext;
uae_u8 *caddr;
char *name;
char tmp[MAX_DPATH];
k++;
}
size = (i - j) << (16 - 10);
- sprintf (txt, "%08.8X %7dK/%d = %7dK %s", j << 16, size, mirrored, mirrored ? size / mirrored : size, name);
+ size_out = size;
+ size_ext = 'K';
+ if (j >= 256) {
+ size_out /= 1024;
+ size_ext = 'M';
+ }
+ sprintf (txt, "%08.8X %7d%c/%d = %7d%c %s", j << 16, size_out, size_ext,
+ mirrored, mirrored ? size_out / mirrored : size_out, size_ext, name);
tmp[0] = 0;
if (a1->flags == ABFLAG_ROM && mirrored) {
PUT_PCK_RES1 (packet, DOS_TRUE);
}
+int get_native_path(uae_u32 lock, char *out)
+{
+ int i = 0;
+ for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+ if (current_mountinfo.ui[i].self) {
+ uae_u32 err;
+ a_inode *a = lookup_aino (current_mountinfo.ui[i].self, get_long ((lock << 2) + 4));
+ if (a) {
+ strcpy (out, a->nname);
+ return 0;
+ }
+ }
+ }
+ return -1;
+}
+
static void action_examine_object (Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
extern char *hdf_getnameharddrive (int index, int flags);
extern int hdf_init (void);
extern int isspecialdrive(const char *name);
+extern int get_native_path(uae_u32 lock, char *out);
\ No newline at end of file
{
uae_int_requested = 1;
set_uae_int_flag ();
- INTREQ (0x8000 | 0x0008);
}
if (iq->framecnt > 0) {
iq->framecnt--;
if (iq->framecnt == 0) {
- if (iq->state) iq->state = 0; else iq->state = iq->storedstate;
+ if (iq->state)
+ iq->state = 0;
+ else
+ iq->state = iq->storedstate;
handle_input_event (iq->event, iq->state, iq->max, 0);
iq->framecnt = iq->nextframecnt;
}
}
}
mouseupdate (100);
- inputdelay = uaerand () % (maxvpos - 1);
+ inputdelay = uaerand () % (maxvpos == 0 ? 1 : maxvpos - 1);
idev[IDTYPE_MOUSE].read ();
input_read = 1;
input_vpos = 0;
}
}
} else
- write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n",namelen);
+ write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n", namelen);
}
TRACE(("%d\n",sb->sb_errno));
}
realpt = get_real_address(msg);
if (to) {
- if (tolen > sizeof buf) write_log("BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n",tolen);
+ if (tolen > sizeof buf) write_log("BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n", tolen);
else {
memcpy(buf,get_real_address(to),tolen);
// some Amiga software sets this field to bogus values
if (s != INVALID_SOCKET) {
if (len > sizeof buf) {
- write_log("BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n",len);
+ write_log("BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n", len);
len = sizeof buf;
}
if (level == IPPROTO_IP && optname == 2) { // IP_HDRINCL emulated by icmp.dll
}
if (level == SOL_SOCKET && optname == SO_LINGER) {
((LINGER *)buf)->l_onoff = get_long(optval);
- ((LINGER *)buf)->l_linger = get_long(optval+4);
+ ((LINGER *)buf)->l_linger = get_long(optval + 4);
} else {
if (len == 4)
*(long *)buf = get_long(optval);
else if (len == 2)
*(short *)buf = get_word(optval);
else
- write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n",level,optname);
+ write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
}
// handle SO_EVENTMASK
else if (len == 2)
put_word(optval,*(short *)buf);
else
- write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n",level,optname);
+ write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
}
// put_long(optlen,len); // some programs pass the actual length instead of a pointer to the length, so...
success = -1;
break;
default:
- write_log("BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n",request);
+ write_log("BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n", request);
bsdsocklib_seterrno(sb,22); // EINVAL
break;
}
}
if (nfds > sb->dtablesize) {
- write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n",nfds,sb->dtablesize);
+ write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n", nfds, sb->dtablesize);
nfds = sb->dtablesize;
}
fd_set_win->fd_array[fd_set_win->fd_count++] = s;
if (fd_set_win->fd_count >= FD_SETSIZE) {
- write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n",nfds,FD_SETSIZE);
+ write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n", nfds, FD_SETSIZE);
return;
}
}
*/
if (sb->needAbort) {
if ((newsock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == INVALID_SOCKET)
- write_log("BSDSOCK: ERROR - Cannot create socket: %d\n",WSAGetLastError());
+ write_log("BSDSOCK: ERROR - Cannot create socket: %d\n", WSAGetLastError());
shutdown(sb->sockAbort,1);
if (newsock != sb->sockAbort) {
shutdown(sb->sockAbort,1);
bsd->gt->hGetThreads[i] = THREAD(thread_get, &i);
if (bsd->gt->hGetEvents[i] == NULL || bsd->gt->hGetThreads[i] == NULL) {
bsd->gt->hGetThreads[i] = 0;
- write_log("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",GetLastError());
+ write_log("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n", GetLastError());
bsdsocklib_seterrno(sb, 12); // ENOMEM
sb->resultval = -1;
return;
sb->servent = uae_AllocMem(context, size, 0);
if (!sb->servent) {
- write_log("BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n",type ? "port" : "name",size);
+ write_log("BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n", type ? "port" : "name", size);
bsdsocklib_seterrno(sb, 12); // ENOMEM
return;
}
#include <windows.h>
#include "fdrawcmd.h"
-int driveclick_pcdrivenum, driveclick_pcdrivemask;
+int driveclick_pcdrivemask;
#define DC_PIPE_SIZE 100
static smp_comm_pipe dc_pipe[DC_PIPE_SIZE];
if (detected)
return;
detected = 1;
- if (driveclick_fdrawcmd_open(0)) {
+ if (driveclick_fdrawcmd_open(0))
driveclick_pcdrivemask |= 1;
- driveclick_pcdrivenum++;
- }
driveclick_fdrawcmd_close(0);
- if (driveclick_fdrawcmd_open(1)) {
+ if (driveclick_fdrawcmd_open(1))
driveclick_pcdrivemask |= 2;
- driveclick_pcdrivenum++;
- }
driveclick_fdrawcmd_close(1);
}
total64 = memstatsex.ullAvailPageFile + memstatsex.ullAvailPhys;
}
}
- if (totalphys64 >= (uae_u64)1800 * 1024 * 1024 && max_allowed_mman < 1024)
- max_allowed_mman = 1024;
}
size64 = 16 * 1024 * 1024;
int isprinter (void)
{
- if (!strcasecmp(currprefs.prtname,"none"))
+ if (!currprefs.prtname[0])
return 0;
if (!memcmp(currprefs.prtname,"LPT", 3)) {
paraport_open (currprefs.prtname);
static int first;
closeprinter ();
- if (!strcasecmp(currprefs.prtname,"none"))
+ if (!currprefs.prtname[0])
return;
if (currprefs.parallel_postscript_emulation) {
sprintf (buf, "\\.\\\\%s", sername);
- if (!(writeevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
+ if (!(writeevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
write_log ("SERIAL: Failed to create event!\n");
return 0;
}
void uae_set_thread_priority (int pri)
{
/* workaround for filesystem emulation freeze with some dual core systems */
- SetThreadAffinityMask(GetCurrentThread(), cpu_affinity);
+ //SetThreadAffinityMask(GetCurrentThread(), cpu_affinity);
}
#define IDC_T1 1551
#define IDC_T2 1552
#define IDC_T3 1553
-#define IDC_SHARED 1553
+#define IDC_SER_SHARED 1553
#define IDC_T4 1554
#define IDC_SER_CTSRTS 1554
#define IDC_T5 1555
-#define IDC_SERIAL_DIRECT 1555
+#define IDC_SER_DIRECT 1555
#define IDC_T6 1556
#define IDC_PSPRINTER 1556
#define IDC_T7 1557
#define IDC_PSPRINTERDETECT 1557
#define IDC_T8 1558
-#define IDC_SHARED2 1558
#define IDC_UAESERIAL 1558
#define IDC_T9 1559
#define IDC_T10 1560
EDITTEXT IDC_PS_PARAMS,120,50,169,12,ES_AUTOHSCROLL
GROUPBOX "Serial Port",IDC_SERIALFRAME,4,72,292,48
COMBOBOX IDC_SERIAL,19,84,95,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Shared",IDC_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,132,83,48,13
+ CONTROL "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,132,83,48,13
CONTROL "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,185,83,53,12
- CONTROL "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SERIAL_DIRECT,
+ CONTROL "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,
"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,243,83,46,12
GROUPBOX "MIDI",IDC_MIDIFRAME,4,123,292,33
RTEXT "Out:",IDC_MIDI,10,134,34,15,SS_CENTERIMAGE
#define OPTIONSFILENAME "default.uae"
-#define DEFPRTNAME "none"
-#define DEFSERNAME "none"
cfgfile_target_write (f, "logfile=%s\n", p->win32_logfile ? "true" : "false");
cfgfile_target_write (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false");
cfgfile_target_write (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false");
- cfgfile_target_write (f, "serial_port=%s\n", p->use_serial ? p->sername : "none" );
+ cfgfile_target_write (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none" );
cfgfile_target_write (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" );
cfgfile_target_write (f, "active_priority=%d\n", priorities[p->win32_active_priority].value);
|| cfgfile_intval (option, value, "midiout_device", &p->win32_midioutdev, 1)
|| cfgfile_intval (option, value, "midiin_device", &p->win32_midiindev, 1)
|| cfgfile_intval (option, value, "soundcard", &p->win32_soundcard, 1)
- || cfgfile_string (option, value, "serial_port", &p->sername[0], 256)
- || cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)
|| cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
|| cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
|| cfgfile_yesno (option, value, "powersavedisabled", &p->win32_powersavedisabled)
return 1;
}
- if (p->sername[0] == 'n')
- p->use_serial = 0;
- else
- p->use_serial = 1;
+ if (cfgfile_string (option, value, "serial_port", &p->sername[0], 256)) {
+ if (!strcmp(p->sername, "none"))
+ p->sername[0] = 0;
+ if (p->sername[0])
+ p->use_serial = 1;
+ else
+ p->use_serial = 0;
+ return 1;
+ }
+
+ if (cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)) {
+ if (!strcmp(p->prtname, "none"))
+ p->prtname[0] = 0;
+ return 1;
+ }
i = 0;
while (obsolete[i]) {
thread = GetCurrentThread();
original_affinity = SetThreadAffinityMask(thread, 1);
+ SetThreadAffinityMask(thread, original_affinity);
#if 0
CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 3
+#define WINUAEBETA 4
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2006, 12, 6)
+#define WINUAEDATE MAKEBD(2006, 12, 16)
#define IHF_WINDOWHIDDEN 6
-#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU )
+#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
extern HMODULE hUIDLL;
extern HWND hAmigaWnd, hMainWnd, hHiddenWnd;
#define CONFIG_HOST "Host"
#define CONFIG_HARDWARE "Hardware"
+static char szNone[MAX_DPATH];
+
static int allow_quit;
static int restart_requested;
static int full_property_sheet = 1;
#define MIN_SOUND_MEM 0
#define MAX_SOUND_MEM 6
-static char szNone[ MAX_DPATH ] = "None";
-
struct romscandata {
HKEY fkey;
int got;
}
if (workprefs.dfxclick[idx] < 0) {
p = drivesounds;
- i = DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum + 1;
+ i = DS_BUILD_IN_SOUNDS + 2 + 1;
while (p && p[0]) {
if (!strcmpi (p, workprefs.dfxclickexternal[idx])) {
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, i, 0);
if (idx >= 0) {
LRESULT res = SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_GETCURSEL, 0, 0);
if (res >= 0) {
- if (res > DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum) {
- int j = res - (DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum + 1);
+ if (res > DS_BUILD_IN_SOUNDS + 2) {
+ int j = res - (DS_BUILD_IN_SOUNDS + 2 + 1);
char *p = drivesounds;
while (j-- > 0)
p += strlen (p) + 1;
EnableWindow(GetDlgItem(hDlg, IDC_UAESERIAL), FALSE);
#else
v = workprefs.use_serial ? TRUE : FALSE;
- EnableWindow(GetDlgItem(hDlg, IDC_SHARED), v);
+ EnableWindow(GetDlgItem(hDlg, IDC_SER_SHARED), v);
EnableWindow(GetDlgItem(hDlg, IDC_SER_CTSRTS), v);
- EnableWindow(GetDlgItem(hDlg, IDC_SERIAL_DIRECT), v);
+ EnableWindow(GetDlgItem(hDlg, IDC_SER_DIRECT), v);
EnableWindow(GetDlgItem(hDlg, IDC_UAESERIAL), full_property_sheet);
#endif
#if !defined (PARALLEL_PORT)
}
item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
- if(item != CB_ERR)
- {
+ if(item != CB_ERR) {
int got = 0;
strcpy (tmp, workprefs.prtname);
if (item > 0) {
}
}
if (!got)
- strcpy( workprefs.prtname, "none" );
+ workprefs.prtname[0] = 0;
#ifdef PARALLEL_PORT
if (strcmp (workprefs.prtname, tmp))
closeprinter ();
workprefs.win32_midioutdev = SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_GETCURSEL, 0, 0);
workprefs.win32_midioutdev -= 2;
- if( bNoMidiIn )
- {
+ if( bNoMidiIn) {
workprefs.win32_midiindev = -1;
- }
- else
- {
+ } else {
workprefs.win32_midiindev = SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_GETCURSEL, 0, 0);
}
- EnableWindow(GetDlgItem( hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L);
- switch( item )
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- workprefs.use_serial = 1;
- strcpy (workprefs.sername, comports[item - 1]);
- break;
-
- default:
- workprefs.use_serial = 0;
- strcpy(workprefs.sername, "none");
- break;
+ if (item != CB_ERR) {
+ workprefs.use_serial = 1;
+ strcpy (workprefs.sername, comports[item - 1]);
+ } else {
+ workprefs.use_serial = 0;
+ workprefs.sername[0] = 0;
}
- workprefs.uaeserial = 0;
- if (IsDlgButtonChecked (hDlg, IDC_UAESERIAL))
- workprefs.uaeserial = 1;
workprefs.serial_demand = 0;
- if (IsDlgButtonChecked (hDlg, IDC_SHARED))
+ if (IsDlgButtonChecked (hDlg, IDC_SER_SHARED))
workprefs.serial_demand = 1;
workprefs.serial_hwctsrts = 0;
if (IsDlgButtonChecked (hDlg, IDC_SER_CTSRTS))
workprefs.serial_hwctsrts = 1;
workprefs.serial_direct = 0;
- if (IsDlgButtonChecked (hDlg, IDC_SERIAL_DIRECT))
+ if (IsDlgButtonChecked (hDlg, IDC_SER_DIRECT))
workprefs.serial_direct = 1;
+
+ workprefs.uaeserial = 0;
+ if (IsDlgButtonChecked (hDlg, IDC_UAESERIAL))
+ workprefs.uaeserial = 1;
+
GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, sizeof workprefs.ghostscript_parameters);
v = GetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, &success, FALSE);
if (success)
{
LRESULT result = 0;
- if( strcmp (workprefs.prtname, "none"))
- {
+ if(workprefs.prtname[0]) {
int i, got = 1;
char tmp[10];
- result = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname );
+ result = SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname);
for (i = 0; i < 4; i++) {
sprintf (tmp, "LPT%d", i + 1);
if (!strcmp (tmp, workprefs.prtname)) {
break;
}
}
- if( result < 0 || got == 0)
- {
+ if(result < 0 || got == 0) {
// Warn the user that their printer-port selection is not valid on this machine
- char szMessage[ MAX_DPATH ];
- WIN32GUI_LoadUIString( IDS_INVALIDPRTPORT, szMessage, MAX_DPATH );
- pre_gui_message (szMessage);
-
+ char szMessage[MAX_DPATH];
+ WIN32GUI_LoadUIString(IDS_INVALIDPRTPORT, szMessage, MAX_DPATH);
+ pre_gui_message (szMessage);
// Disable the invalid parallel-port selection
- strcpy( workprefs.prtname, "none" );
-
+ workprefs.prtname[0] = 0;
result = 0;
}
}
EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
CheckDlgButton(hDlg, IDC_UAESERIAL, workprefs.uaeserial);
- CheckDlgButton(hDlg, IDC_SHARED, workprefs.serial_demand);
+ CheckDlgButton(hDlg, IDC_SER_SHARED, workprefs.serial_demand);
CheckDlgButton(hDlg, IDC_SER_CTSRTS, workprefs.serial_hwctsrts);
- CheckDlgButton(hDlg, IDC_SERIAL_DIRECT, workprefs.serial_direct);
+ CheckDlgButton(hDlg, IDC_SER_DIRECT, workprefs.serial_direct);
- if(strcasecmp(workprefs.sername, "none") == 0) {
+ if(!workprefs.sername[0]) {
SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L);
workprefs.use_serial = 0;
} else {
- int t = (workprefs.sername[0] == '\0' ? 0 : workprefs.sername[3] - '0');
int i;
LRESULT result = -1;
for (i = 0; i < MAX_SERIALS; i++) {
break;
}
}
- if(result < 0) {
- if (t > 0) {
- // Warn the user that their COM-port selection is not valid on this machine
- char szMessage[MAX_DPATH];
- WIN32GUI_LoadUIString(IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
- pre_gui_message (szMessage);
-
- // Select "none" as the COM-port
- SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);
- }
+ if(result < 0 && workprefs.sername[0]) {
+ // Warn the user that their COM-port selection is not valid on this machine
+ char szMessage[MAX_DPATH];
+ WIN32GUI_LoadUIString(IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
+ pre_gui_message (szMessage);
+ // Select "none" as the COM-port
+ SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);
// Disable the chosen serial-port selection
- strcpy( workprefs.sername, "none" );
+ workprefs.sername[0] = 0;
workprefs.use_serial = 0;
} else {
workprefs.use_serial = 1;
joy0previous = joy1previous = -1;
SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone );
+ SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone);
portcnt = 0;
- for( port = 0; port < MAX_SERIALS; port++ )
- {
- sprintf( comports[portcnt], "COM%d", port );
- if( GetDefaultCommConfig( comports[portcnt], &cc, &size ) )
- {
- SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++] );
+ for(port = 0; port < MAX_SERIALS; port++) {
+ sprintf(comports[portcnt], "COM%d", port);
+ if(GetDefaultCommConfig(comports[portcnt], &cc, &size)) {
+ SendDlgItemMessage(hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++]);
}
+ write_log("%d:%d\n",port, GetLastError());
}
SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone );
- if( !pInfo ) {
+ SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
+ if(!pInfo) {
int flags = PRINTER_ENUM_LOCAL | (os_winnt ? PRINTER_ENUM_CONNECTIONS : 0);
DWORD needed = 0;
- EnumPrinters( flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters );
+ EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters);
if (needed > 0) {
DWORD size = needed;
pInfo = calloc(1, size);
dwEnumeratedPrinters = 0;
- EnumPrinters( flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters );
+ EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters);
}
if (dwEnumeratedPrinters == 0) {
free (pInfo);
}
}
if (pInfo) {
- for( port = 0; port < (int)dwEnumeratedPrinters; port++ )
- SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName );
+ for(port = 0; port < (int)dwEnumeratedPrinters; port++)
+ SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName);
} else {
- EnableWindow( GetDlgItem( hDlg, IDC_PRINTERLIST ), FALSE );
+ EnableWindow(GetDlgItem(hDlg, IDC_PRINTERLIST), FALSE);
}
if (paraport_mask) {
int mask = paraport_mask;
}
}
- SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L );
- SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone );
- if( ( numdevs = midiOutGetNumDevs() ) == 0 )
- {
- EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
- }
- else
- {
- char szMidiOut[ MAX_DPATH ];
- WIN32GUI_LoadUIString( IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH );
- SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut );
+ SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L);
+ SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
+ if((numdevs = midiOutGetNumDevs()) == 0) {
+ EnableWindow(GetDlgItem(hDlg, IDC_MIDIOUTLIST), FALSE);
+ } else {
+ char szMidiOut[MAX_DPATH];
+ WIN32GUI_LoadUIString(IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH);
+ SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut);
- for( port = 0; port < numdevs; port++ )
- {
- if( midiOutGetDevCaps( port, &midiOutCaps, sizeof( midiOutCaps ) ) == MMSYSERR_NOERROR )
- {
- SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname );
- }
+ for(port = 0; port < numdevs; port++) {
+ if(midiOutGetDevCaps(port, &midiOutCaps, sizeof(midiOutCaps)) == MMSYSERR_NOERROR)
+ SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname);
}
- EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE );
+ EnableWindow(GetDlgItem(hDlg, IDC_MIDIOUTLIST), TRUE);
}
- SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L );
- if( ( numdevs = midiInGetNumDevs() ) == 0 )
- {
- EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
+ SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L);
+ if((numdevs = midiInGetNumDevs()) == 0) {
+ EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST), FALSE);
bNoMidiIn = TRUE;
- }
- else
- {
- for( port = 0; port < numdevs; port++ )
- {
- if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR )
- {
- SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname );
- }
+ } else {
+ for(port = 0; port < numdevs; port++) {
+ if(midiInGetDevCaps(port, &midiInCaps, sizeof(midiInCaps)) == MMSYSERR_NOERROR)
+ SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname);
}
}
}
default_prefs (&workprefs, 0);
WIN32GUI_LoadUIString (IDS_NONE, szNone, MAX_DPATH);
-
prefs_to_gui (&changed_prefs);
if (!init_called) {
- uaeserial.device tweaks
- added more logging to RDB parser
-- 1G Z3 fast RAM allowed (only if NT-based Windows and >=2G RAM)
- do not reopen DirectSound when losing/gaining focus
-- reverted DirectSound initialization to pre-1.3.3 version, perhaps
- it helps with VIA AC97 pitch change issue..
+- DirectSound initialization changes
+- drivesound disk selection menu selected wrong entry in some cases
+- rare divide by zero error when running Amiga program tries to
+ program 1 line tall display mode
+- final MSVC 2005 SP1 installed
+- dual core/SMP hardfile freeze fix (RD)
+- bsdsocket bug fix that could have caused buffer overflows
Beta 3:
#include "debug.h"
#include "gensound.h"
#include "picasso96.h"
+#include "filesys.h"
/*
* Returns UAE Version
return 0; // OSDEP_minimize_uae();
}
+static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
+{
+ char tmp[MAX_DPATH];
+ int v, i;
+
+ if (mode)
+ return -1;
+ /* receive native path from lock
+ * p1 = dos.library:Lock, p2 = buffer, p3 = max buffer size
+ */
+ v = get_native_path (p1, tmp);
+ if (v)
+ return v;
+ for (i = 0; i <= strlen(tmp) && i < p3 - 1; i++) {
+ put_byte (p2 + i, tmp[i]);
+ put_byte (p2 + i + 1, 0);
+ }
+ return 0;
+}
+
static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
{
#define ARG0 (get_long (m68k_areg (&context->regs, 7) + 4))
#ifdef DEBUGGER
case 84: return mmu_init (ARG1, ARG2, ARG3);
#endif
+ case 85: return native_dos_op (ARG1, ARG2, ARG3, ARG4);
}
return 0;
}
};
struct devstruct {
+ int open;
int unit;
int uniq;
int exclusive;
int thread_running;
uae_sem_t sync_sem;
- int brk;
void *sysdata;
};
static void dev_close_3 (struct devstruct *dev)
{
uaeser_close (dev->sysdata);
- dev->unit = -1;
+ dev->open = 0;
xfree (dev->sysdata);
write_comm_pipe_u32 (&dev->requests, 0, 1);
}
return 5;
}
baud = get_long (req + io_Baud);
- dev->brk = get_long (req + io_BrkTime);
v = get_byte (req + io_SerFlags);
if (v & SERF_EOFMODE) {
write_log ("UAESER: SERF_EOFMODE not supported\n");
return openfail (ioreq, -6); /* busy */
}
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- if (devst[i].unit == -1)
+ if (!devst[i].open)
break;
}
dev = &devst[i];
return openfail (ioreq, 32); /* badunitnum */
}
dev->unit = unit;
+ dev->open = 1;
dev->uniq = ++uniq;
dev->exclusive = (get_word(ioreq + io_SerFlags) & SERF_SHARED) ? 0 : 1;
put_long (ioreq + 24, dev->uniq);
switch (command)
{
+ case SDCMD_BREAK:
+ if (ar == dev->ar) {
+ uaeser_break (dev->sysdata, get_long (request + io_BrkTime));
+ io_done = 1;
+ }
+ break;
case CMD_READ:
if (sigmask & 1) {
addr = memmap(io_data, io_length);
async = 1;
break;
case SDCMD_BREAK:
- uaeser_break (dev->sysdata, dev->brk);
+ if (get_byte (request + io_SerFlags) & SERF_QUEUEDBRK) {
+ async = 1;
+ } else {
+ uaeser_break (dev->sysdata, get_long (request + io_BrkTime));
+ }
break;
case CMD_CLEAR:
uaeser_clearbuffers(dev->sysdata);
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
dev = &devst[i];
- if (dev->unit >= 0) {
+ if (dev->open) {
while (dev->ar)
abort_async (dev, dev->ar->request);
+ dev_close_3 (dev);
+ uae_sem_wait (&dev->sync_sem);
}
memset (dev, 0, sizeof (struct devstruct));
- dev->unit = -1;
}
}
uaecptr uaeserialdev_startup (uaecptr resaddr)
{
- int i;
- struct devstruct *dev;
-
if (!currprefs.uaeserial)
return resaddr;
if (log_uaeserial)
write_log ("uaeserialdev_startup(0x%x)\n", resaddr);
- for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- dev = &devst[i];
- dev->unit = -1;
- dev->brk = 250000;
- }
/* Build a struct Resident. This will set up and initialize
* the serial.device */
put_word(resaddr + 0x0, 0x4AFC);