unlocksigqueue ();
if (sts)
- uae_Signal(ot, sts);
+ uae_Signal (ot, sts);
#endif
}
for (sb = sbsigqueue; sb; sb = sb->nextsig) {
if (sb->dosignal == 1) {
- uae_Signal(sb->ownertask, sb->sigstosend);
+ uae_Signal (sb->ownertask, sb->sigstosend);
sb->sigstosend = 0;
}
sb->dosignal = 0;
return adkcon;
}
-STATIC_INLINE int GETVPOS(void)
+STATIC_INLINE int GETVPOS (void)
{
return lightpen_triggered > 0 ? vpos_lpen : (((bplcon0 & 2) && !currprefs.genlock) ? vpos_previous : vpos);
}
-STATIC_INLINE int GETHPOS(void)
+STATIC_INLINE int GETHPOS (void)
{
return lightpen_triggered > 0 ? hpos_lpen : (((bplcon0 & 2) && !currprefs.genlock) ? hpos_previous : current_hpos ());
}
write_log ("vposr %x at %x\n", vp, m68k_getpc (®s));
#endif
if (currprefs.cpu_model >= 68020)
- hsyncdelay();
+ hsyncdelay ();
return vp;
}
static void VPOSW (uae_u16 v)
STATIC_INLINE uae_u16 VHPOSR (void)
{
- uae_u16 vp = GETVPOS();
- uae_u16 hp = GETHPOS();
+ uae_u16 vp = GETVPOS ();
+ uae_u16 hp = GETHPOS ();
vp <<= 8;
- vp |= hp;
+ vp |= hp ^ 1; // hack..
if (currprefs.cpu_model >= 68020)
hsyncdelay ();
return vp;
#ifdef PICASSO96
picasso_handle_vsync ();
#endif
+ {
+ void ahi_vsync (void);
+ ahi_vsync ();
+ }
if (quit_program > 0) {
/* prevent possible infinite loop at wait_cycles().. */
hsync_counter++;
//copper_check (2);
+#if 0
+ {
+ static int skip;
+ if (M68K_GETPC >= 0x0C0D7A2 && M68K_GETPC < 0x00C0D7B2 && vpos == 0xf3) {
+ if (!skip)
+ activate_debugger ();
+ skip = 1;
+ }
+ if (vpos != 0xf3)
+ skip = 0;
+ }
+#endif
}
static void MISC_handler(void)
eventtab[ev_misc].active = 1;
eventtab[ev_misc].oldcycles = ct;
eventtab[ev_misc].evtime = ct + mintime;
- events_schedule();
+ events_schedule ();
}
recursive--;
}
decide_fetch (hpos);
}
-STATIC_INLINE void dma_cycle(void)
+STATIC_INLINE void dma_cycle (void)
{
int hpos;
static int bnasty;
/* bus was allocated to dma channel, wait for next cycle.. */
}
bnasty = 0;
- alloc_cycle(hpos, CYCLE_CPU);
+ alloc_cycle (hpos, CYCLE_CPU);
}
uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode)
char nc;
ignore_ws (c);
- while (isxdigit(nc = **c)) {
+ while (isxdigit (nc = **c)) {
(*c)++;
val *= 16;
- nc = toupper(nc);
- if (isdigit(nc)) {
+ nc = toupper (nc);
+ if (isdigit (nc)) {
val += nc - '0';
} else {
val += nc - 'A' + 10;
ignore_ws (c);
if (**c == '-')
negative = 1, (*c)++;
- while (isdigit(nc = **c)) {
+ while (isdigit (nc = **c)) {
(*c)++;
val *= 10;
val += nc - '0';
char nc;
ignore_ws (c);
- nc = toupper(**c);
+ nc = toupper (**c);
if (nc == '!') {
(*c)++;
*val = readintx (c);
*val = readhexx (c);
return 1;
}
- if (nc == '0' && toupper((*c)[1]) == 'X') {
+ if (nc == '0' && toupper ((*c)[1]) == 'X') {
(*c)+= 2;
*val = readhexx (c);
return 1;
int addrcnt, cnt;
char v;
- v = toupper(**c);
+ v = toupper (**c);
if(!memtmp || v == 'S') {
maxdiff = 0x10000;
if (**c)
(*c)++;
- ignore_ws(c);
+ ignore_ws (c);
if ((**c) == '1' || (**c) == '2') {
size = **c - '0';
(*c)++;
}
- if (more_params(c))
+ if (more_params (c))
maxdiff = readint(c);
if (!memtmp || v == 'S') {
first = 1;
- xfree(memtmp);
+ xfree (memtmp);
memsize = 0;
addr = 0xffffffff;
- while ((addr = nextaddr(addr, &end)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, &end)) != 0xffffffff) {
memsize += end - addr;
addr = end - 1;
}
memsize2 = (memsize + 7) / 8;
- memtmp = (uae_u8*)xmalloc (memsize + memsize2);
+ memtmp = xmalloc (memsize + memsize2);
if (!memtmp)
return;
memset (memtmp + memsize, 0xff, memsize2);
p1 = memtmp;
addr = 0xffffffff;
- while ((addr = nextaddr(addr, &end)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, &end)) != 0xffffffff) {
for (i = addr; i < end; i++)
*p1++ = get_byte (i);
addr = end - 1;
addrcnt = 0;
cnt = 0;
addr = 0xffffffff;
- while ((addr = nextaddr(addr, NULL)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, NULL)) != 0xffffffff) {
uae_s32 b, b2;
int doremove = 0;
int addroff = addrcnt >> 3;
} else {
p1[addrcnt] = b >> 8;
p1[addrcnt + 1] = b >> 0;
- addr = nextaddr(addr, NULL);
+ addr = nextaddr (addr, NULL);
if (addr == 0xffffffff)
break;
addrcnt += 2;
console_out_f ("%d addresses found\n", cnt);
if (cnt <= MAX_CHEAT_VIEW) {
- clearcheater();
+ clearcheater ();
cnt = 0;
addrcnt = 0;
addr = 0xffffffff;
int addroff = addrcnt >> 3;
int addrmask = (size == 1 ? 1 : 3) << (addrcnt & 7);
if (p2[addroff] & addrmask)
- addcheater(addr, size);
+ addcheater (addr, size);
addrcnt += size;
cnt++;
}
- listcheater(1, size);
+ listcheater (1, size);
} else {
console_out ("Now continue with 'g' and use 'D' again after you have lost another life\n");
}
memsize = 0;
addr = 0xffffffff;
- while ((addr = nextaddr(addr, &end)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, &end)) != 0xffffffff) {
memsize += end - addr;
addr = end - 1;
}
- if (toupper(**c) == 'L') {
- listcheater(1, size);
+ if (toupper (**c) == 'L') {
+ listcheater (1, size);
return;
}
ignore_ws (c);
- if (!more_params(c)) {
+ if (!more_params (c)) {
first = 1;
console_out ("search reset\n");
xfree (vlist);
listsize = memsize;
- vlist = (uae_u8*)xcalloc (listsize >> 3, 1);
+ vlist = xcalloc (listsize >> 3, 1);
return;
}
val = readint (c);
size = 4;
}
ignore_ws (c);
- if (more_params(c))
- size = readint(c);
+ if (more_params (c))
+ size = readint (c);
if (size > 4)
size = 4;
if (size < 1)
if (vlist == NULL) {
listsize = memsize;
- vlist = (uae_u8*)xcalloc (listsize >> 3, 1);
+ vlist = xcalloc (listsize >> 3, 1);
}
count = 0;
vcnt = 0;
- clearcheater();
+ clearcheater ();
addr = 0xffffffff;
prevmemcnt = memcnt = 0;
- while ((addr = nextaddr(addr, &end)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, &end)) != 0xffffffff) {
if (addr + size < end) {
for (i = 0; i < size; i++) {
int shift = (size - i - 1) * 8;
uae_u8 c = 3;
uaecptr addr, end;
- illgdebug = (uae_u8*)xcalloc (0x01000000, 1);
- illghdebug = (uae_u8*)xcalloc(65536, 1);
+ illgdebug = xcalloc (0x01000000, 1);
+ illghdebug = xcalloc (65536, 1);
if (!illgdebug || !illghdebug) {
illg_free();
return;
}
addr = 0xffffffff;
- while ((addr = nextaddr(addr, &end)) != 0xffffffff) {
+ while ((addr = nextaddr (addr, &end)) != 0xffffffff) {
if (end < 0x01000000) {
memset (illgdebug + addr, c, end - addr);
} else {
illg_debug_do (addr, rwi, size, val);
addr = munge24 (addr);
if (smc_table && (rwi >= 2))
- smc_detector(addr, rwi, size, valp);
+ smc_detector (addr, rwi, size, valp);
for (i = 0; i < MEMWATCH_TOTAL; i++) {
struct memwatch_node *m = &mwnodes[i];
uaecptr addr2 = m->addr;
if (!m->frozen && m->val_enabled) {
int trigger = 0;
- uae_u32 mask = ((1 << (m->size * 8)) - 1);
+ uae_u32 mask = (1 << (m->size * 8)) - 1;
+ int scnt = size;
for (;;) {
- if ((m->val & mask) == (val & mask))
+ if (((m->val & mask) & m->valmask) == ((val & mask) & m->valmask))
trigger = 1;
if (mask & 0x80000000)
break;
- if (m->size == 1)
+ if (m->size == 1) {
mask <<= 8;
- else if (m->size == 2)
+ scnt--;
+ } else if (m->size == 2) {
mask <<= 16;
+ scnt -= 2;
+ }
+ if (scnt <= 0)
+ break;
}
if (!trigger)
continue;
{
int off = debug_mem_off (addr);
uae_u32 v = 0;
- if (!mmu_hit(addr, 4, 0, &v))
- v = debug_mem_banks[off]->lget(addr);
+ if (!mmu_hit (addr, 4, 0, &v))
+ v = debug_mem_banks[off]->lget (addr);
return v;
}
static uae_u32 REGPARAM2 mmu_wget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v = 0;
- if (!mmu_hit(addr, 2, 0, &v))
- v = debug_mem_banks[off]->wget(addr);
+ if (!mmu_hit (addr, 2, 0, &v))
+ v = debug_mem_banks[off]->wget (addr);
return v;
}
static uae_u32 REGPARAM2 mmu_bget (uaecptr addr)
int off = debug_mem_off (addr);
uae_u32 v = 0;
if (!mmu_hit(addr, 1, 0, &v))
- v = debug_mem_banks[off]->bget(addr);
+ v = debug_mem_banks[off]->bget (addr);
return v;
}
static void REGPARAM2 mmu_lput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (!mmu_hit(addr, 4, 1, &v))
- debug_mem_banks[off]->lput(addr, v);
+ if (!mmu_hit (addr, 4, 1, &v))
+ debug_mem_banks[off]->lput (addr, v);
}
static void REGPARAM2 mmu_wput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (!mmu_hit(addr, 2, 1, &v))
- debug_mem_banks[off]->wput(addr, v);
+ if (!mmu_hit (addr, 2, 1, &v))
+ debug_mem_banks[off]->wput (addr, v);
}
static void REGPARAM2 mmu_bput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (!mmu_hit(addr, 1, 1, &v))
- debug_mem_banks[off]->bput(addr, v);
+ if (!mmu_hit (addr, 1, 1, &v))
+ debug_mem_banks[off]->bput (addr, v);
}
static uae_u32 REGPARAM2 debug_lget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
- v = debug_mem_banks[off]->lget(addr);
+ v = debug_mem_banks[off]->lget (addr);
memwatch_func (addr, 1, 4, &v);
return v;
}
{
int off = debug_mem_off (addr);
uae_u32 v = 0;
- if (!mmu_hit(addr, 4, 4, &v))
- v = debug_mem_banks[off]->lgeti(addr);
+ if (!mmu_hit (addr, 4, 4, &v))
+ v = debug_mem_banks[off]->lgeti (addr);
return v;
}
static uae_u32 REGPARAM2 mmu_wgeti (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v = 0;
- if (!mmu_hit(addr, 2, 4, &v))
- v = debug_mem_banks[off]->wgeti(addr);
+ if (!mmu_hit (addr, 2, 4, &v))
+ v = debug_mem_banks[off]->wgeti (addr);
return v;
}
{
int off = debug_mem_off (addr);
uae_u32 v;
- v = debug_mem_banks[off]->wget(addr);
+ v = debug_mem_banks[off]->wget (addr);
memwatch_func (addr, 1, 2, &v);
return v;
}
{
int off = debug_mem_off (addr);
uae_u32 v;
- v = debug_mem_banks[off]->bget(addr);
+ v = debug_mem_banks[off]->bget (addr);
memwatch_func (addr, 1, 1, &v);
return v;
}
{
int off = debug_mem_off (addr);
uae_u32 v;
- v = debug_mem_banks[off]->lgeti(addr);
+ v = debug_mem_banks[off]->lgeti (addr);
memwatch_func (addr, 4, 4, &v);
return v;
}
{
int off = debug_mem_off (addr);
uae_u32 v;
- v = debug_mem_banks[off]->wgeti(addr);
+ v = debug_mem_banks[off]->wgeti (addr);
memwatch_func (addr, 4, 2, &v);
return v;
}
{
int off = debug_mem_off (addr);
if (memwatch_func (addr, 2, 4, &v))
- debug_mem_banks[off]->lput(addr, v);
+ debug_mem_banks[off]->lput (addr, v);
}
static void REGPARAM2 debug_wput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
if (memwatch_func (addr, 2, 2, &v))
- debug_mem_banks[off]->wput(addr, v);
+ debug_mem_banks[off]->wput (addr, v);
}
static void REGPARAM2 debug_bput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
if (memwatch_func (addr, 2, 1, &v))
- debug_mem_banks[off]->bput(addr, v);
+ debug_mem_banks[off]->bput (addr, v);
}
static int REGPARAM2 debug_check (uaecptr addr, uae_u32 size)
{
int i, as;
addrbank *a1, *a2;
- deinitialize_memwatch();
+ deinitialize_memwatch ();
as = currprefs.address_space_24 ? 256 : 65536;
- debug_mem_banks = (addrbank**)xmalloc (sizeof (addrbank*) * as);
- debug_mem_area = (addrbank*)xmalloc (sizeof (addrbank) * as);
+ debug_mem_banks = xmalloc (sizeof (addrbank*) * as);
+ debug_mem_area = xmalloc (sizeof (addrbank) * as);
for (i = 0; i < as; i++) {
a1 = debug_mem_banks[i] = debug_mem_area + i;
a2 = mem_banks[i];
struct memwatch_node *mwn;
if (buf)
- memset(buf, 0, bufsize);
+ memset (buf, 0, bufsize);
for (i = 0; i < MEMWATCH_TOTAL; i++) {
if ((num >= 0 && num == i) || (num < 0)) {
mwn = &mwnodes[i];
char *buf;
int multiplier = num < 0 ? MEMWATCH_TOTAL : 1;
- buf = (char*)malloc(50 * multiplier);
+ buf = malloc (50 * multiplier);
if (!buf)
return;
memwatch_dump2 (buf, 50 * multiplier, num);
- f_out(stdout, "%s", buf);
- free(buf);
+ f_out (stdout, "%s", buf);
+ xfree (buf);
}
static void memwatch (char **c)
mwn->size = 1;
mwn->rwi = 7;
mwn->val_enabled = 0;
+ mwn->valmask = 0xffffffff;
mwn->frozen = 0;
mwn->modval_written = 0;
ignore_ws (c);
len = 2;
else
len = 1;
- if (more_params(c)) {
- ignore_ws(c);
+ if (more_params (c)) {
+ ignore_ws (c);
len = readint (c);
}
if (len == 4) {
console_out_f ("Wrote %X (%u) at %08X.%c\n", val, val, addr, cc);
}
-static uae_u8 *dump_xlate(uae_u32 addr)
+static uae_u8 *dump_xlate (uae_u32 addr)
{
- if (!mem_banks[addr >> 16]->check(addr, 1))
+ if (!mem_banks[addr >> 16]->check (addr, 1))
return NULL;
- return mem_banks[addr >> 16]->xlateaddr(addr);
+ return mem_banks[addr >> 16]->xlateaddr (addr);
}
static void memory_map_dump_2 (int log)
name = "<none>";
k = j;
- caddr = dump_xlate(k << 16);
+ caddr = dump_xlate (k << 16);
mirrored = caddr ? 1 : 0;
k++;
while (k < i && caddr) {
- if (dump_xlate(k << 16) == caddr)
+ if (dump_xlate (k << 16) == caddr)
mirrored++;
k++;
}
tmp[0] = 0;
if (a1->flags == ABFLAG_ROM && mirrored) {
- char *p = txt + strlen(txt);
- uae_u32 crc = get_crc32(a1->xlateaddr(j << 16), (size * 1024) / mirrored);
- struct romdata *rd = getromdatabycrc(crc);
+ char *p = txt + strlen (txt);
+ uae_u32 crc = get_crc32 (a1->xlateaddr(j << 16), (size * 1024) / mirrored);
+ struct romdata *rd = getromdatabycrc (crc);
sprintf(p, " (%08.8X)", crc);
if (rd) {
tmp[0] = '=';
- getromname(rd, tmp + 1);
- strcat(tmp,"\n");
+ getromname (rd, tmp + 1);
+ strcat (tmp,"\n");
}
}
- strcat(txt,"\n");
+ strcat (txt,"\n");
if (log)
write_log (txt);
else
memory_map_dump_2 (1);
}
-STATIC_INLINE uaecptr BPTR2APTR(uaecptr addr)
+STATIC_INLINE uaecptr BPTR2APTR (uaecptr addr)
{
return addr << 2;
}
-static char* BSTR2CSTR(uae_u8 *bstr)
+static char* BSTR2CSTR (uae_u8 *bstr)
{
- char *cstr = (char*)xmalloc(bstr[0] + 1);
+ char *cstr = xmalloc (bstr[0] + 1);
if (cstr) {
- memcpy(cstr, bstr + 1, bstr[0]);
+ memcpy (cstr, bstr + 1, bstr[0]);
cstr[bstr[0]] = 0;
}
return cstr;
}
-static void print_task_info(uaecptr node)
+static void print_task_info (uaecptr node)
{
int process = get_byte (node + 8) == 13 ? 1 : 0;
console_out_f ("%08X: %08X", node, 0);
int i;
if (more_params (c)) {
- char nc = toupper((*c)[0]);
+ char nc = toupper ((*c)[0]);
if (nc == 'S') {
next_char (c);
sr_bpvalue = sr_bpmask = 0;
static int process_breakpoint(char **c)
{
processptr = 0;
- xfree(processname);
+ xfree (processname);
processname = NULL;
if (!more_params (c))
return 0;
if (**c == '\"') {
- processname = (char*)xmalloc(200);
- next_string(c, processname, 200, 0);
+ processname = xmalloc (200);
+ next_string (c, processname, 200, 0);
} else {
- processptr = readhex(c);
+ processptr = readhex (c);
}
do_skip = 1;
skipaddr_doskip = 1;
char *p = NULL;
archivehd = -1;
- if (my_existsfile(rootdir))
+ if (my_existsfile (rootdir))
archivehd = 1;
- else if (my_existsdir(rootdir))
+ else if (my_existsdir (rootdir))
archivehd = 0;
if ((!volname || strlen (volname) == 0) && rootdir && archivehd >= 0) {
else
nvol = my_strdup ("");
}
- stripsemicolon(nvol);
+ stripsemicolon (nvol);
xfree (p);
return nvol;
}
unit->rootnode.mountcount = unit->mountcount;
}
-static int filesys_isvolume(Unit *unit)
+static int filesys_isvolume (Unit *unit)
{
return get_byte (unit->volume + 44);
}
-static void clear_exkeys(Unit *unit)
+static void clear_exkeys (Unit *unit)
{
int i;
a_inode *a;
return 0;
if (u->reinsertdelay)
return -1;
- if (is_hardfile(nr) != FILESYS_VIRTUAL)
+ if (is_hardfile (nr) != FILESYS_VIRTUAL)
return 0;
if (filesys_isvolume (u)) {
filesys_delayed_change (u, 50, rootdir, volume, readonly, flags);
clear_exkeys (u);
xfree (u->ui.rootdir);
ui->rootdir = u->ui.rootdir = my_strdup (rootdir);
- flush_cache(u, -1);
+ flush_cache (u, -1);
if (set_filesys_volume (rootdir, &flags, &readonly, &emptydrive, &u->zarchive) < 0)
return 0;
if (emptydrive)
uci->readonly = ui->readonly = u->ui.readonly = readonly;
put_byte (u->volume + 44, 0);
put_byte (u->volume + 172 - 32, 1);
- uae_Signal (get_long(u->volume + 176 - 32), 1 << 17);
+ uae_Signal (get_long (u->volume + 176 - 32), 1 << 17);
return 100 + nr;
}
uaecptr addr;
int size;
int rwi;
- uae_u32 val;
+ uae_u32 val, valmask;
int val_enabled;
uae_u32 modval;
int modval_written;
extern uae_u16 inprec_pu16(void);
extern uae_u32 inprec_pu32(void);
extern int inprec_pstr(char*);
+
+extern int inputdevice_testread (char *name);
+extern int inputdevice_istest (void);
int win32_rtgmatchdepth;
int win32_rtgscaleifsmall;
int win32_rtgallowscaling;
+ int win32_rtgscaleaspectratio;
int win32_borderless;
int win32_ctrl_F11_is_quit;
int win32_automount_removable;
static struct uae_input_device2 mice2[MAX_INPUT_DEVICES];
static int input_acquired;
+static int testmode;
static uae_u8 *inprec_buffer, *inprec_p;
static struct zfile *inprec_zf;
custom = id->custom[i + offset][j];
if (custom == NULL && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if (id->eventid[i + offset][k] > 0)
+ if (id->eventid[i + offset][k] > 0 || id->custom[i + offset][k] != NULL)
break;
}
if (k == MAX_INPUT_SUB_EVENT)
evt = kbr->eventid[i][j];
if (custom == NULL && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if (kbr->eventid[i][k] > 0) break;
+ if (kbr->eventid[i][k] > 0 || kbr->custom[i][k] != NULL) break;
}
if (k == MAX_INPUT_SUB_EVENT)
break;
if (use_keyboards[i])
idev[IDTYPE_KEYBOARD].acquire (i, 0);
}
- if (!input_acquired)
- write_log ("input devices acquired (%s)\n", allmode ? "all" : "selected only");
+// if (!input_acquired)
+// write_log ("input devices acquired (%s)\n", allmode ? "all" : "selected only");
input_acquired = 1;
}
{
int i;
- if (input_acquired)
- write_log ("input devices unacquired\n");
+// if (input_acquired)
+// write_log ("input devices unacquired\n");
input_acquired = 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++)
idev[IDTYPE_JOYSTICK].unacquire (i);
idev[IDTYPE_KEYBOARD].unacquire (i);
}
+static void testrecord (int type, int num, int wtype, int wnum, int state)
+{
+ char tmp[2000];
+ tmp[0] = 0;
+ wnum += idev[type].get_widget_first (num, wtype);
+ idev[type].get_widget_type (num, wnum, tmp, NULL);
+ write_log ("%s: %s %d\n", idev[type].get_friendlyname (num), tmp, state);
+}
+
+int inputdevice_istest (void)
+{
+ return testmode;
+}
+
+int inputdevice_testread (char *name)
+{
+ testmode = 1;
+ idev[IDTYPE_KEYBOARD].read ();
+ idev[IDTYPE_JOYSTICK].read ();
+ idev[IDTYPE_MOUSE].read ();
+ testmode = 0;
+ return 0;
+}
+
static int ignoreoldinput (int joy)
{
if (!use_joysticks[joy])
return 0;
}
-void do_fake_joystick(int nr, int *fake)
+void do_fake_joystick (int nr, int *fake)
{
struct uae_input_device *id1;
struct uae_input_device2 *id2;
void setmousebuttonstate (int mouse, int button, int state)
{
+ if (testmode) {
+ testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_BUTTON, button, state);
+ return;
+ }
setbuttonstateall (&mice[mouse], &mice2[mouse], button, state);
}
int deadzone = currprefs.input_joymouse_deadzone * max / 100;
int i, v1, v2;
+ if (testmode) {
+ testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_AXIS, axis, state);
+ return;
+ }
v1 = state;
v2 = id2->states[axis];
if (v1 < deadzone && v1 > -deadzone)
}
int getjoystickstate(int joy)
{
+ if (testmode)
+ return 1;
return joysticks[joy].enabled;
}
static double fract1[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
static double fract2[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
+ if (testmode) {
+ testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, data);
+ return;
+ }
if (!mice[mouse].enabled)
return;
d = 0;
handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0);
mousehack_helper ();
}
-int getmousestate(int joy)
+int getmousestate (int joy)
{
+ if (testmode)
+ return 1;
return mice[joy].enabled;
}
m68kpc_offset += 2;
} else if (lookup->mnemo == i_MVMEL) {
newpc = m68k_getpc (®s) + m68kpc_offset;
+ m68kpc_offset += 2;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
strcat (instrname, ",");
- movemout (instrname, get_iword_1 (m68kpc_offset), dp->dmode);
- m68kpc_offset += 2;
+ movemout (instrname, get_iword_1 (m68kpc_offset - 2), dp->dmode);
} else if (lookup->mnemo == i_MVMLE) {
- movemout (instrname, get_iword_1 (m68kpc_offset), dp->dmode);
+ m68kpc_offset += 2;
+ movemout (instrname, get_iword_1 (m68kpc_offset - 2), dp->dmode);
strcat (instrname, ",");
newpc = m68k_getpc (®s) + m68kpc_offset;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
- m68kpc_offset += 2;
} else {
if (dp->suse) {
newpc = m68k_getpc (®s) + m68kpc_offset;
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
+#include <math.h>
+#include <process.h>
#include "sysdeps.h"
#include "options.h"
#include "newcpu.h"
#include "autoconf.h"
#include "traps.h"
+#include "threaddep/thread.h"
+#include "native2amiga.h"
#include "od-win32/win32.h"
#include "sounddep/sound.h"
#include "ahidsound_new.h"
#include <ksmedia.h>
+static int ahi_debug = 1;
+
+#define UAE_MAXCHANNELS 24
+#define UAE_MAXSOUNDS 256
+
+#define ub_Flags 34
+#define ub_Pad1 (ub_Flags + 1)
+#define ub_Pad2 (ub_Pad1 + 1)
+#define ub_SysLib (ub_Pad2 + 2)
+#define ub_SegList (ub_SysLib + 4)
+#define ub_DOSBase (ub_SegList + 4)
+#define ub_AHIFunc (ub_DOSBase + 4)
+
+#define pub_Index 0
+#define pub_Base (pub_Index + 4)
+#define pub_audioctrl (pub_Base + 4)
+#define pub_FuncTask (pub_audioctrl + 4)
+#define pub_WaitMask (pub_FuncTask + 4)
+#define pub_WaitSigBit (pub_WaitMask + 4)
+#define pub_FuncMode (pub_WaitSigBit +4)
+#define pub_TaskMode (pub_FuncMode + 2)
+#define pub_ChannelSignal (pub_TaskMode + 2)
+
#define ahiac_AudioCtrl 0
#define ahiac_Flags ahiac_AudioCtrl + 4
#define ahiac_SoundFunc ahiac_Flags + 4
#define AHIE_UNKNOWN (5UL) /* Error, but unknown */
#define AHIE_HALFDUPLEX (6UL) /* CMD_WRITE/CMD_READ failure */
-#define MAX_SAMPLES 64
-
struct dssample {
int num;
LPDIRECTSOUNDBUFFER8 dsb;
LPDIRECTSOUNDBUFFER8 dsbback;
+ LPDIRECTSOUNDNOTIFY dsnotify;
+ HANDLE notifyevent;
int ch, chout;
int bitspersample;
int bitspersampleout;
- int freq;
- int volume;
int bytespersample;
int bytespersampleout;
+ int frequency;
+ int volume;
+ int panning;
uae_u32 addr;
uae_u32 len;
uae_u32 type;
int streaming;
+ int ready; // 1 = playing, -1 = set
+ int channel;
+};
+
+struct dschannel {
+ int frequency;
+ int volume;
+ int panning;
+ struct dssample *ds;
};
struct DSAHI {
+ uae_u32 audioctrl;
uae_u32 audioid;
int mixfreq;
int channels;
int anticlicksamples;
int enabledisable;
struct dssample *sample;
+ struct dschannel *channel;
int playing, recording;
int cansurround;
+ evt evttime;
+ volatile int thread;
+ HANDLE threadevent;
};
static struct DSAHI dsahi[1];
+
+#define GETAHI (&dsahi[get_long(get_long(audioctrl + ahiac_DriverData) + pub_Index)])
+#define GETSAMPLE (dsahip && sound >= 0 && sound < UAE_MAXSOUNDS ? &dsahip->sample[sound] : NULL)
+#define GETCHANNEL (dsahip && channel >= 0 && channel < UAE_MAXCHANNELS ? &dsahip->channel[channel] : NULL)
+
static int default_freq = 44100;
static uae_u32 xahi_author, xahi_copyright, xahi_version, xahi_output;
}
}
+
+static int sendsignal (struct DSAHI *dsahip)
+{
+ uae_u32 audioctrl = dsahip->audioctrl;
+ uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData);
+ uae_u32 task, signalmask;
+ uae_s16 taskmode = get_word (puaebase + pub_TaskMode);
+ task = get_long (puaebase + pub_FuncTask);
+ signalmask = get_long (puaebase + pub_WaitMask);
+
+ if (!dsahip->playing)
+ return 0;
+ if (taskmode <= 0)
+ return 0;
+ if (dsahip->enabledisable)
+ return 0;
+ uae_Signal (task, signalmask);
+ return 1;
+}
+
+static void setchannelevent (struct DSAHI *dsahip, struct dschannel *dc)
+{
+ uae_u32 audioctrl = dsahip->audioctrl;
+ uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData);
+ int ch = dc - &dsahip->channel[0];
+
+ //write_log ("AHI: channel signal %d\n", ch);
+ put_long (puaebase + pub_ChannelSignal, get_long (puaebase + pub_ChannelSignal) | (1 << ch));
+ sendsignal (dsahip);
+}
+
+static void evtfunc (uae_u32 v)
+{
+ struct DSAHI *dsahip = &dsahi[v];
+ uae_u32 audioctrl = dsahip->audioctrl;
+ uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData);
+
+ put_word (puaebase + pub_FuncMode, get_word (puaebase + pub_FuncMode) | 1);
+ if (sendsignal (dsahip))
+ event2_newevent2 (dsahip->evttime, v, evtfunc);
+}
+
+static void setevent (struct DSAHI *dsahip)
+{
+ uae_u32 audioctrl = dsahip->audioctrl;
+ uae_u32 freq = get_long (audioctrl + ahiac_PlayerFreq);
+ double f;
+ uae_u32 cycles;
+ evt t;
+
+ f = ((double)(freq >> 16)) + ((double)(freq & 0xffff)) / 65536.0;
+ write_log ("AHI: playerfunc freq = %.2fHz\n", f);
+ cycles = maxhpos * maxvpos * vblank_hz;
+ t = (evt)(cycles / f);
+ dsahip->evttime = t;
+ event2_newevent2 (t, dsahip - &dsahi[0], evtfunc);
+}
+
+
+
static LPDIRECTSOUND8 lpDS;
extern GUID sound_device_guid[];
const static GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001,0x0000,0x0010,
#define KSAUDIO_SPEAKER_QUAD_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
+
+static void ds_freebuffer (struct DSAHI *ahidsp, struct dssample *ds)
+{
+ if (!ds)
+ return;
+ if (ds->dsb)
+ IDirectSoundBuffer8_Release (ds->dsb);
+ if (ds->dsbback)
+ IDirectSoundBuffer8_Release (ds->dsbback);
+ if (ds->dsnotify)
+ IDirectSoundNotify_Release (ds->dsnotify);
+ if (ds->notifyevent)
+ CloseHandle (ds->notifyevent);
+ memset (ds, 0, sizeof (struct dssample));
+ ds->channel = -1;
+}
+
static void ds_free (struct DSAHI *dsahip)
{
int i;
for (i = 0; i < dsahip->sounds; i++) {
struct dssample *ds = &dsahip->sample[i];
- if (ds->dsb)
- IDirectSoundBuffer8_Release (ds->dsb);
- memset (ds, 0, sizeof (ds));
+ ds_freebuffer (dsahip, ds);
}
if (lpDS)
IDirectSound_Release (lpDS);
lpDS = NULL;
+ if (dsahip->thread) {
+ dsahip->thread = -1;
+ SetEvent (dsahip->threadevent);
+ while (dsahip->thread)
+ Sleep (2);
+ }
+}
+
+static unsigned __stdcall waitthread (void *f)
+{
+ struct DSAHI *dsahip = f;
+
+ dsahip->thread = 1;
+ while (dsahip->thread > 0) {
+ HANDLE handles[UAE_MAXCHANNELS + 1];
+ int channelindex[UAE_MAXCHANNELS + 1];
+ DWORD ob;
+ int maxnum = UAE_MAXCHANNELS + 1;
+ int num = 0;
+ int i;
+
+ handles[num++] = dsahip->threadevent;
+ if (dsahip->playing) {
+ for (i = 0; i < UAE_MAXSOUNDS && num < maxnum; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ if (ds->channel >= 0 && ds->notifyevent) {
+ handles[num] = ds->notifyevent;
+ channelindex[num] = ds->channel;
+ num++;
+ }
+ }
+ }
+ //write_log ("AHI: WFMO %d\n", num);
+ ob = WaitForMultipleObjects (num, handles, FALSE, INFINITE);
+ if (ob == WAIT_OBJECT_0)
+ continue;
+ if (ob >= WAIT_OBJECT_0 + 1 && ob < WAIT_OBJECT_0 + num) {
+ int ch;
+ ob -= WAIT_OBJECT_0;
+ ch = channelindex[ob];
+ setchannelevent (dsahip, &dsahip->channel[ch]);
+ }
+ }
+ dsahip->thread = 0;
+ return 0;
}
DWORD fillsupportedmodes (LPDIRECTSOUND8 lpDS, int freq, struct dsaudiomodes *dsam);
static int ds_init (struct DSAHI *dsahip)
{
+ unsigned int ta;
int freq = 48000;
DSCAPS DSCaps;
HRESULT hr;
write_log ("AHI: maximum supported frequency: %d\n", maxfreq);
}
}
+ if (ahi_debug)
+ write_log ("AHI: DSOUND initialized\n");
+
+ dsahip->thread = -1;
+ dsahip->threadevent = CreateEvent (NULL, FALSE, FALSE, NULL);
+ _beginthreadex (NULL, 0, waitthread, dsahip, 0, &ta);
+
return 1;
error:
+ if (ahi_debug)
+ write_log ("AHI: DSOUND initialization failed\n");
ds_free (dsahip);
return 0;
}
+static void ds_play (struct DSAHI *dsahip, struct dssample *ds)
+{
+ HRESULT hr;
+ DWORD status;
+
+ if (ahi_debug)
+ write_log ("AHI: ds_play(%d)\n", ds->num);
+ hr = IDirectSoundBuffer8_GetStatus (ds->dsb, &status);
+ if (FAILED (hr)) {
+ write_log ("AHI: IDirectSoundBuffer8_GetStatus() failed, %s\n", DXError (hr));
+ } else {
+ if (!(status & DSBSTATUS_PLAYING))
+ setchannelevent (dsahip, &dsahip->channel[ds->channel]);
+ }
+ hr = IDirectSoundBuffer8_Play (ds->dsb, 0, 0, DSBPLAY_LOOPING);
+ if (FAILED (hr))
+ write_log ("AHI: IDirectSoundBuffer8_Play() failed, %s\n", DXError (hr));
+ if (ds->dsbback) {
+ hr = IDirectSoundBuffer8_Play (ds->dsbback, 0, 0, DSBPLAY_LOOPING);
+ if (FAILED (hr))
+ write_log ("AHI: IDirectSoundBuffer8_PlayBack() failed, %s\n", DXError (hr));
+ }
+ ds->ready = -1;
+}
+
static void ds_setvolume (struct dssample *ds, int volume, int panning)
{
HRESULT hr;
LONG vol, pan;
+ // weird AHI features:
// negative pan = output from surround speakers!
// negative volume = invert sample data!! (not yet emulated)
vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (abs (volume) / 65536.0)));
write_log ("AHI: SetVolumeBack(%d,%d) failed: %s\n", ds->num, vol, DXError (hr));
}
}
+ ds->volume = volume;
+ ds->panning = panning;
}
-static void ds_setfreq (struct dssample *ds, int freq)
+static void ds_setfreq (struct DSAHI *dsahip, struct dssample *ds, int frequency)
{
HRESULT hr;
- if (freq == 0) {
+ if (frequency == 0) {
hr = IDirectSoundBuffer8_Stop (ds->dsb);
if (ds->dsbback)
hr = IDirectSoundBuffer8_Stop (ds->dsbback);
} else {
- if (ds->freq == 0) {
- hr = IDirectSoundBuffer8_Play (ds->dsb, 0, 0, 0);
- if (ds->dsbback)
- hr = IDirectSoundBuffer8_Play (ds->dsbback, 0, 0, 0);
- }
- hr = IDirectSoundBuffer8_SetFrequency (ds->dsb, freq);
+ hr = IDirectSoundBuffer8_SetFrequency (ds->dsb, frequency);
if (FAILED (hr))
- write_log ("AHI: SetFrequency(%d,%d) failed: %s\n", ds->num, freq, DXError (hr));
+ write_log ("AHI: SetFrequency(%d,%d) failed: %s\n", ds->num, frequency, DXError (hr));
if (ds->dsbback) {
- hr = IDirectSoundBuffer8_SetFrequency (ds->dsbback, freq);
+ hr = IDirectSoundBuffer8_SetFrequency (ds->dsbback, frequency);
if (FAILED (hr))
- write_log ("AHI: SetFrequencyBack(%d,%d) failed: %s\n", ds->num, freq, DXError (hr));
+ write_log ("AHI: SetFrequencyBack(%d,%d) failed: %s\n", ds->num, frequency, DXError (hr));
}
+ if (ds->frequency == 0)
+ ds_play (dsahip, ds);
}
- ds->freq = freq;
+ ds->frequency = frequency;
}
+#define US(x) ((x))
+
static void copysampledata (struct dssample *ds, void *srcp, void *dstp, int dstsize, int offset, int srcsize)
{
int i, j;
uae_u8 *src = (uae_u8*)srcp;
uae_u8 *dst = (uae_u8*)dstp;
+ int och = ds->chout;
+ int ich = ds->ch;
src += offset * ds->ch * ds->bytespersample;
if (dstsize < srcsize)
switch (ds->type)
{
case AHIST_M8S:
+ for (i = 0; i < srcsize; i++) {
+ dst[i * 4 + 0] = US (src[i]);
+ dst[i * 4 + 1] = US (src[i]);
+ dst[i * 4 + 2] = US (src[i]);
+ dst[i * 4 + 3] = US (src[i]);
+ }
+ break;
case AHIST_S8S:
for (i = 0; i < srcsize; i++) {
- dst[i * 2 + 0] = src[i];
- dst[i * 2 + 1] = src[i];
+ dst[i * 4 + 0] = src[i * 2 + 0];
+ dst[i * 4 + 1] = src[i * 2 + 0];
+ dst[i * 4 + 2] = src[i * 2 + 1];
+ dst[i * 4 + 3] = src[i * 2 + 1];
}
break;
case AHIST_M16S:
for (i = 0; i < srcsize; i++) {
- dst[i * 2 + 0] = src[i * 2 + 1];
- dst[i * 2 + 1] = src[i * 2 + 0];
+ dst[i * 4 + 0] = src[i * 2 + 1];
+ dst[i * 4 + 1] = src[i * 2 + 0];
+ dst[i * 4 + 2] = src[i * 2 + 1];
+ dst[i * 4 + 3] = src[i * 2 + 0];
}
break;
case AHIST_S16S:
break;
case AHIST_M32S:
for (i = 0; i < srcsize; i++) {
- dst[i * 2 + 0] = src[i * 4 + 3];
- dst[i * 2 + 1] = src[i * 4 + 2];
+ dst[i * 4 + 0] = src[i * 4 + 3];
+ dst[i * 4 + 1] = src[i * 4 + 2];
+ dst[i * 4 + 2] = src[i * 4 + 3];
+ dst[i * 4 + 3] = src[i * 4 + 2];
}
break;
case AHIST_S32S:
}
break;
case AHIST_L7_1:
- if (ds->ch == ds->chout) {
+ if (ds->chout == 8) {
for (i = 0; i < srcsize; i++) {
for (j = 0; j < 8; j++) {
dst[j * 4 + 0] = src[j * 4 + 2];
}
}
-static void copysample (struct dssample *ds, LPDIRECTSOUNDBUFFER8 dsb, uae_u32 offset, uae_u32 length)
+static void clearsample (struct dssample *ds, LPDIRECTSOUNDBUFFER8 dsb, int dstlength)
+{
+ HRESULT hr;
+ void *buffer1;
+ DWORD size1, outlen;
+
+ if (!dsb)
+ return;
+ outlen = dstlength * ds->bytespersampleout * ds->chout;
+ hr = IDirectSoundBuffer8_Lock (dsb, 0, outlen, &buffer1, &size1, NULL, NULL, 0);
+ if (hr == DSERR_BUFFERLOST) {
+ IDirectSoundBuffer_Restore (dsb);
+ hr = IDirectSoundBuffer8_Lock (dsb, 0, outlen, &buffer1, &size1, NULL, NULL, 0);
+ }
+ if (FAILED (hr))
+ return;
+ memset (buffer1, 0, size1);
+ IDirectSoundBuffer8_Unlock (dsb, buffer1, size1, NULL, 0);
+}
+
+static void copysample (struct dssample *ds, LPDIRECTSOUNDBUFFER8 dsb, int dstoffset, int dstlength, uae_u32 srcoffset, uae_u32 srclength)
{
HRESULT hr;
- void *buffer;
- DWORD size;
+ void *buffer1, *buffer2;
+ DWORD size1, size2, outoffset, outlen;
uae_u32 addr;
if (!dsb)
return;
- hr = IDirectSoundBuffer8_Lock (dsb, 0, ds->len, &buffer, &size, NULL, NULL, 0);
+ outlen = dstlength * ds->bytespersampleout * ds->chout;
+ outoffset = dstoffset * ds->bytespersampleout * ds->chout;
+ hr = IDirectSoundBuffer8_Lock (dsb, outoffset, outlen, &buffer1, &size1, &buffer2, &size2, 0);
if (hr == DSERR_BUFFERLOST) {
IDirectSoundBuffer_Restore (dsb);
- hr = IDirectSoundBuffer8_Lock (dsb, 0, ds->len, &buffer, &size, NULL, NULL, 0);
+ hr = IDirectSoundBuffer8_Lock (dsb, outoffset, outlen, &buffer1, &size1, &buffer2, &size2, 0);
}
if (FAILED (hr))
return;
- memset (buffer, 0, size);
if (ds->addr == 0 && ds->len == 0xffffffff)
- addr = offset;
+ addr = srcoffset;
else
addr = ds->addr;
- if (valid_address (addr + offset * ds->ch * ds->bytespersample, length * ds->ch * ds->bytespersample))
- copysampledata (ds, get_real_address (addr), buffer, size, offset, length);
- IDirectSoundBuffer8_Unlock (dsb, buffer, size, NULL, 0);
+ if (valid_address (addr + srcoffset * ds->ch * ds->bytespersample, srclength * ds->ch * ds->bytespersample)) {
+ uae_u8 *naddr = get_real_address (addr);
+ int part1 = size1 / (ds->bytespersampleout * ds->chout);
+ int part2 = size2 / (ds->bytespersampleout * ds->chout);
+ copysampledata (ds, naddr, buffer1, part1, srcoffset, srclength);
+ srcoffset += part1;
+ srclength -= part1;
+ if (srclength != 0)
+ copysampledata (ds, naddr, buffer2, part2, srcoffset, srclength);
+ }
+ IDirectSoundBuffer8_Unlock (dsb, buffer1, size1, buffer2, size2);
}
-static void ds_setsound (struct DSAHI *dsahip, struct dssample *ds, int offset, int length)
+void ahi_vsync (void)
{
- HRESULT hr;
+ struct DSAHI *dsahip = &dsahi[0];
+ int i;
+
if (!dsahip->playing)
return;
- copysample (ds, ds->dsb, offset, length);
- copysample (ds, ds->dsbback, offset, length);
+ for (i = 0; i < UAE_MAXCHANNELS; i++) {
+ HRESULT hr;
+ DWORD playc, writec;
+ struct dssample *ds = dsahip->channel[i].ds;
+
+ if (ds == NULL)
+ continue;
+ if (ds->type != AHIST_DYNAMICSAMPLE)
+ continue;
+ hr = IDirectSoundBuffer8_GetCurrentPosition (ds->dsb, &playc, &writec);
+ if (FAILED (hr)) {
+ write_log ("AHI: GetCurrentPosition(%d) failed, %s\n", ds->channel, DXError (hr));
+ continue;
+ }
+ write_log ("AHI: ch=%d writec=%d\n", ds->channel, writec / (ds->bytespersampleout * ds->chout));
+ copysample (ds, ds->dsb,
+ writec / (ds->bytespersampleout * ds->chout),
+ ds->len - 1000,
+ writec / (ds->bytespersampleout * ds->chout),
+ ds->len - 1000);
+ }
+}
+
+static void ds_stop (struct dssample *ds)
+{
+ HRESULT hr;
+
+ if (!ds->ready)
+ return;
+ if (ahi_debug)
+ write_log ("AHI: ds_stop(%d)\n", ds->num);
+ hr = IDirectSoundBuffer8_Stop (ds->dsb);
+ if (FAILED (hr))
+ write_log ("AHI: IDirectSoundBuffer8_Stop() failed, %s\n", DXError (hr));
+ if (ds->dsbback) {
+ hr = IDirectSoundBuffer8_Stop (ds->dsbback);
+ if (FAILED (hr))
+ write_log ("AHI: IDirectSoundBuffer8_StopBack() failed, %s\n", DXError (hr));
+ }
+ ds->ready = 1;
+}
+
+static void ds_setsound (struct DSAHI *dsahip, struct dssample *ds, int offset, int length)
+{
+ HRESULT hr;
+
+ clearsample (ds, ds->dsb, ds->len);
+ clearsample (ds, ds->dsbback, ds->len);
+ copysample (ds, ds->dsb, 0, ds->len, offset, length);
+ copysample (ds, ds->dsbback, 0, ds->len, offset, length);
hr = IDirectSoundBuffer8_SetCurrentPosition (ds->dsb, 0);
if (FAILED (hr))
write_log ("AHI: IDirectSoundBuffer8_SetCurrentPosition() failed, %s\n", DXError (hr));
- hr = IDirectSoundBuffer8_Play (ds->dsb, 0, 0, 0);
- if (FAILED (hr))
- write_log ("AHI: IDirectSoundBuffer8_Play() failed, %s\n", DXError (hr));
if (ds->dsbback) {
hr = IDirectSoundBuffer8_SetCurrentPosition (ds->dsbback, 0);
if (FAILED (hr))
write_log ("AHI: IDirectSoundBuffer8_SetCurrentPositionBack() failed, %s\n", DXError (hr));
- hr = IDirectSoundBuffer8_Play (ds->dsbback, 0, 0, 0);
- if (FAILED (hr))
- write_log ("AHI: IDirectSoundBuffer8_PlayBack() failed, %s\n", DXError (hr));
}
}
-
-static void ds_freebuffer (struct DSAHI *ahidsp, struct dssample *ds)
-{
- if (!ds)
- return;
- if (ds->dsb)
- IDirectSoundBuffer8_Release (ds->dsb);
- if (ds->dsbback)
- IDirectSoundBuffer8_Release (ds->dsbback);
- ds->dsb = NULL;
- ds->dsbback = NULL;
-}
-
-static int ds_allocbuffer (struct DSAHI *ahidsp, struct dssample *ds, int type, uae_u32 addr, uae_u32 len)
+static int ds_allocbuffer (struct DSAHI *ahidsp, struct dssample *ds, int type, uae_u32 len)
{
HRESULT hr;
DSBUFFERDESC dd;
LPDIRECTSOUNDBUFFER pdsb;
LPDIRECTSOUNDBUFFER8 pdsb8;
int round, chround;
- int channels[] = { 8, 6, 2, 0 };
+ int channels[] = { 2, 4, 6, 8 };
int ch, chout, bps, bpsout;
+ DSBPOSITIONNOTIFY pn[1];
if (!ds)
return 0;
break;
case AHIST_L7_1:
ch = 8;
+ channels[0] = 6;
+ channels[1] = 8;
+ channels[2] = 0;
break;
default:
return 0;
default:
return 0;
}
+ if (ahi_debug)
+ write_log ("AHI: AllocBuffer ch=%d,bps=%d\n", ch, bps);
+ pdsb = NULL;
bpsout = 16;
for (chround = 0; channels[chround]; chround++) {
chout = channels[chround];
DWORD ksmode = 0;
pdsb = NULL;
- memset (&wavfmt, 0, sizeof (WAVEFORMATEXTENSIBLE));
- wavfmt.Format.nChannels = ch;
- wavfmt.Format.nSamplesPerSec = default_freq;
- wavfmt.Format.wBitsPerSample = bps;
if (supportedmodes[round].ch != chout)
continue;
+ memset (&wavfmt, 0, sizeof (WAVEFORMATEXTENSIBLE));
+ wavfmt.Format.nChannels = chout;
+ wavfmt.Format.nSamplesPerSec = default_freq;
+ wavfmt.Format.wBitsPerSample = bpsout;
if (chout <= 2) {
wavfmt.Format.wFormatTag = WAVE_FORMAT_PCM;
} else {
wavfmt.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wavfmt.Format.cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX);
wavfmt.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
- wavfmt.Samples.wValidBitsPerSample = bps;
+ wavfmt.Samples.wValidBitsPerSample = bpsout;
wavfmt.dwChannelMask = supportedmodes[round].ksmode;
}
- wavfmt.Format.nBlockAlign = bps / 8 * wavfmt.Format.nChannels;
+ wavfmt.Format.nBlockAlign = bpsout / 8 * wavfmt.Format.nChannels;
wavfmt.Format.nAvgBytesPerSec = wavfmt.Format.nBlockAlign * wavfmt.Format.nSamplesPerSec;
- dd.dwSize = sizeof (dd);
- dd.dwBufferBytes = len * bps / 8 * chout;
+ memset (&dd, 0, sizeof dd);
+ dd.dwSize = sizeof dd;
+ dd.dwBufferBytes = len * bpsout / 8 * chout;
dd.lpwfxFormat = &wavfmt.Format;
- dd.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS;
+ dd.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY;
dd.dwFlags |= DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY;
dd.dwFlags |= chout >= 4 ? DSBCAPS_LOCHARDWARE : DSBCAPS_LOCSOFTWARE;
dd.guid3DAlgorithm = GUID_NULL;
}
}
write_log ("AHI: DS sound buffer failed (ch=%d,bps=%d): %s\n",
- ch, bps, DXError (hr));
+ chout, bpsout, DXError (hr));
}
if (pdsb)
break;
}
if (pdsb == NULL)
goto error;
+
hr = IDirectSound_QueryInterface (pdsb, &IID_IDirectSoundBuffer8, (LPVOID*)&pdsb8);
if (FAILED (hr)) {
- write_log ("AHI: Secondary QueryInterface() failure: %s\n", DXError (hr));
+ write_log ("AHI: Secondary QueryInterface(IID_IDirectSoundBuffer8) failure: %s\n", DXError (hr));
goto error;
}
+
IDirectSound_Release (pdsb);
ds->dsb = pdsb8;
+ hr = IDirectSoundBuffer8_QueryInterface (pdsb, &IID_IDirectSoundNotify8, (void**)&ds->dsnotify);
+ if (FAILED (hr)) {
+ write_log ("AHI: Secondary QueryInterface(IID_IDirectSoundNotify8) failure: %s\n", DXError (hr));
+ goto error;
+ }
+ ds->notifyevent = CreateEvent (NULL, FALSE, FALSE, NULL);
+ pn[0].dwOffset = 0;
+ pn[0].hEventNotify = ds->notifyevent;
+ hr = IDirectSoundNotify_SetNotificationPositions (ds->dsnotify, 1, pn);
+ if (FAILED (hr)) {
+ write_log ("AHI: Secondary SetNotificationPositions() failure: %s\n", DXError (hr));
+ goto error;
+ }
+
+
if (chout > 2) {
// create "surround" sound buffer
hr = IDirectSound_CreateSoundBuffer (lpDS, &dd, &pdsb, NULL);
ds->chout = chout;
ds->bytespersample = bps / 8;
ds->bytespersampleout = bpsout / 8;
- ds->freq = default_freq;
- ds->addr = addr;
- ds->len = len;
- ds->type = type;
+
+ SetEvent (ahidsp->threadevent);
return 1;
return 0;
}
+static uae_u32 init (TrapContext *ctx)
+{
+ xahi_author = ds ("Toni Wilen");
+ xahi_copyright = ds ("GPL");
+ xahi_version = ds ("uae2 0.1 (xx.xx.2008)\r\n");
+ xahi_output = ds ("Default Output");
+ return 1;
+}
static uae_u32 AHIsub_AllocAudio (TrapContext *ctx)
{
+ int i;
uae_u32 tags = m68k_areg (&ctx->regs, 1);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
+ uae_u32 pbase = get_long (audioctrl + ahiac_DriverData);
uae_u32 tag, data;
uae_u32 ret = AHISF_KNOWSTEREO | AHISF_KNOWHIFI;
struct DSAHI *dsahip = &dsahi[0];
- put_long (audioctrl + ahiac_DriverData, dsahip - dsahi);
+ if (ahi_debug)
+ write_log ("AHI: AllocAudio(%08x,%08x)\n", tags, audioctrl);
+
+ put_long (pbase + pub_Index, dsahip - dsahi);
+ dsahip->audioctrl = audioctrl;
if (!ds_init (dsahip))
return AHISF_ERROR;
+ dsahip->sounds = UAE_MAXSOUNDS;
+ dsahip->channels = UAE_MAXCHANNELS;
+
if (dsahip->cansurround)
ret |= AHISF_KNOWMULTICHANNEL;
while ((tag = gettag (&tags, &data))) {
+ if (ahi_debug)
+ write_log ("- TAG %08x=%d: %08x=%u\n", tag, tag & 0x7fff, data, data);
switch (tag)
{
case AHIA_Sounds:
ds_free (dsahip);
return AHISF_ERROR;
}
- dsahip->sample = xmalloc (sizeof (struct dssample) * dsahip->sounds);
- xahi_author = ds ("Toni Wilen");
- xahi_copyright = ds ("GPL");
- xahi_version = ds ("uae2 0.1 (22.06.2008)\r\n");
- xahi_output = ds ("Default Output");
+ dsahip->sample = xcalloc (sizeof (struct dssample), dsahip->sounds);
+ dsahip->channel = xcalloc (sizeof (struct dschannel), dsahip->channels);
+ for (i = 0; i < dsahip->channels; i++) {
+ struct dschannel *dc = &dsahip->channel[i];
+ }
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ ds->channel = -1;
+ ds->num = -1;
+ }
return ret;
}
-#define GETAHI (&dsahi[get_long(audioctrl + ahiac_DriverData)])
-#define GETSAMPLE (dsahip ? &dsahip->sample[channel] : NULL)
-
static void AHIsub_Disable (TrapContext *ctx)
{
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ if (ahi_debug)
+ write_log ("AHI: Disable(%08x)\n", audioctrl);
dsahip->enabledisable++;
}
{
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ if (ahi_debug)
+ write_log ("AHI: Enable(%08x)\n", audioctrl);
dsahip->enabledisable--;
+ if (dsahip->enabledisable == 0 && dsahip->playing)
+ setevent (dsahip);
}
static void AHIsub_FreeAudio (TrapContext *ctx)
{
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
+ uae_u32 pbase = get_long (audioctrl + ahiac_DriverData);
struct DSAHI *dsahip = GETAHI;
- put_long (audioctrl + ahiac_DriverData, -1);
+ if (ahi_debug)
+ write_log ("AHI: FreeAudio(%08x)\n", audioctrl);
+ put_long (pbase + pub_Index, -1);
+ if (dsahip) {
+ xfree (dsahip->channel);
+ xfree (dsahip->sample);
+ memset (dsahip, 0, sizeof (struct DSAHI));
+ }
}
static uae_u32 frequencies[] = { 48000, 44100 };
#define MAX_FREQUENCIES (sizeof (frequencies) / sizeof (uae_u32))
-static uae_u32 AHIsub_GetAttr (TrapContext *ctx)
+static uae_u32 getattr2 (struct DSAHI *dsahip, uae_u32 attribute, uae_u32 argument, uae_u32 def)
{
- uae_u32 attribute = m68k_dreg (&ctx->regs, 0);
- uae_u32 argument = m68k_dreg (&ctx->regs, 1);
- uae_u32 def = m68k_dreg (&ctx->regs, 2);
- uae_u32 taglist = m68k_areg (&ctx->regs, 1);
- uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
- struct DSAHI *dsahip = GETAHI;
int i;
-
+
switch (attribute)
{
case AHIDB_Bits:
case AHIDB_Version:
return xahi_version;
case AHIDB_Record:
- return FALSE;
+ return TRUE;
case AHIDB_Realtime:
return TRUE;
case AHIDB_Outputs:
case AHIDB_MultiChannel:
return dsahip->cansurround;
case AHIDB_MaxChannels:
- return 32;
+ return UAE_MAXCHANNELS;
+ case AHIDB_FullDuplex:
+ return 1;
default:
return def;
}
}
+static uae_u32 AHIsub_GetAttr (TrapContext *ctx)
+{
+ uae_u32 attribute = m68k_dreg (&ctx->regs, 0);
+ uae_u32 argument = m68k_dreg (&ctx->regs, 1);
+ uae_u32 def = m68k_dreg (&ctx->regs, 2);
+ uae_u32 taglist = m68k_areg (&ctx->regs, 1);
+ uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
+ struct DSAHI *dsahip = GETAHI;
+ uae_u32 v;
+
+ v = getattr2 (dsahip, attribute, argument, def);
+ if (ahi_debug)
+ write_log ("AHI: GetAttr(%08x=%d,%08x,%08x)=%08x\n", attribute, (attribute & 0x7fff), argument, def, v);
+
+ return v;
+}
+
static uae_u32 AHIsub_HardwareControl (TrapContext *ctx)
{
uae_u32 attribute = m68k_dreg (&ctx->regs, 0);
uae_u32 argument = m68k_dreg (&ctx->regs, 1);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ if (ahi_debug)
+ write_log ("AHI: HardwareControl(%08x,%08x,%08x)\n", attribute, argument, audioctrl);
return 0;
}
uae_u32 flags = m68k_dreg (&ctx->regs, 0);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ int i;
+
+ if (ahi_debug)
+ write_log ("AHI: Play(%08x,%08x)\n",
+ flags, audioctrl);
if (flags & AHISF_PLAY)
dsahip->playing = 1;
if (flags & AHISF_RECORD)
dsahip->recording = 1;
+ if (dsahip->playing) {
+ setevent (dsahip);
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ if (ds->ready > 0 && ds->channel >= 0) {
+ struct dschannel *dc = &dsahip->channel[ds->channel];
+ ds_setvolume (ds, dc->volume, dc->panning);
+ ds->frequency = 0;
+ ds_setfreq (dsahip, ds, dc->frequency); // this also starts playback
+ }
+ }
+ }
return 0;
}
uae_u32 flags = m68k_dreg (&ctx->regs, 0);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ int i;
+
+ if (ahi_debug)
+ write_log ("AHI: Stop(%08x,%08x)\n",
+ flags, audioctrl);
if (flags & AHISF_PLAY)
dsahip->playing = 0;
if (flags & AHISF_RECORD)
dsahip->recording = 0;
+ if (!dsahip->playing) {
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ if (ds->ready)
+ ds_stop (ds);
+ }
+ }
return 0;
}
uae_u32 flags = m68k_dreg (&ctx->regs, 0);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+ if (ahi_debug)
+ write_log ("AHI: Update(%08x,%08x)\n", flags, audioctrl);
+ setevent (dsahip);
return 0;
}
static uae_u32 AHIsub_SetVol (TrapContext *ctx)
{
- uae_u32 channel = m68k_dreg (&ctx->regs, 0);
+ int i;
+ uae_u16 channel = m68k_dreg (&ctx->regs, 0);
uae_u32 volume = m68k_dreg (&ctx->regs, 1);
uae_u32 pan = m68k_dreg (&ctx->regs, 2);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
uae_u32 flags = m68k_dreg (&ctx->regs, 3);
struct DSAHI *dsahip = GETAHI;
- struct dssample *ds = GETSAMPLE;
- if (ds)
- ds_setvolume (ds, volume, pan);
+ struct dschannel *dc = GETCHANNEL;
+
+ if (ahi_debug)
+ write_log ("AHI: SetVol(%d,%d,%08x,%08x)\n",
+ channel, pan, audioctrl, flags);
+ if (dc) {
+ dc->volume = volume;
+ dc->panning = pan;
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ if (ds->channel == channel)
+ ds_setvolume (ds, volume, pan);
+ }
+ }
return 0;
}
static uae_u32 AHIsub_SetFreq (TrapContext *ctx)
{
- uae_u32 channel = m68k_dreg (&ctx->regs, 0);
- uae_u32 freq = m68k_dreg (&ctx->regs, 1);
+ int i;
+ uae_u16 channel = m68k_dreg (&ctx->regs, 0);
+ uae_u32 frequency = m68k_dreg (&ctx->regs, 1);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
uae_u32 flags = m68k_dreg (&ctx->regs, 3);
struct DSAHI *dsahip = GETAHI;
- struct dssample *ds = GETSAMPLE;
- if (ds)
- ds_setfreq (ds, freq);
+ struct dschannel *dc = GETCHANNEL;
+
+ if (ahi_debug)
+ write_log ("AHI: SetFreq(%d,%d,%08x,%08x)\n",
+ channel, frequency, audioctrl, flags);
+ if (dc) {
+ dc->frequency = frequency;
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds = &dsahip->sample[i];
+ if (ds->channel == channel)
+ ds_setfreq (dsahip, ds, frequency);
+ }
+ }
return 0;
}
static uae_u32 AHIsub_SetSound (TrapContext *ctx)
{
- uae_u32 channel = m68k_dreg (&ctx->regs, 0);
- uae_u32 sound = m68k_dreg (&ctx->regs, 1);
+ int i;
+ uae_u16 channel = m68k_dreg (&ctx->regs, 0);
+ uae_u16 sound = m68k_dreg (&ctx->regs, 1);
uae_u32 offset = m68k_dreg (&ctx->regs, 2);
uae_u32 length = m68k_dreg (&ctx->regs, 3);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
uae_u32 flags = m68k_dreg (&ctx->regs, 4);
struct DSAHI *dsahip = GETAHI;
struct dssample *ds = GETSAMPLE;
- if (ds)
+ struct dschannel *dc = GETCHANNEL;
+
+ if (ahi_debug)
+ write_log ("AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n",
+ channel, sound, offset, length, audioctrl, flags);
+ dc->ds = NULL;
+ if (sound == 0xffff) {
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds2 = &dsahip->sample[i];
+ if (ds2->channel == channel) {
+ ds_stop (ds2);
+ ds2->channel = -1;
+
+ }
+ }
+ } else if (ds) {
+ length = abs (length);
+ if (length == 0)
+ length = ds->len;
+ ds->ready = 1;
+ ds->channel = channel;
+ dc->ds = ds;
+ for (i = 0; i < dsahip->sounds; i++) {
+ struct dssample *ds2 = &dsahip->sample[i];
+ if (ds2 != ds && ds2->channel == channel) {
+ ds_stop (ds2);
+ ds2->channel = -1;
+ }
+ }
ds_setsound (dsahip, ds, offset, length);
+ if (dsahip->playing)
+ ds_play (dsahip, ds);
+ }
return 0;
}
uae_u32 effect = m68k_areg (&ctx->regs, 0);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
+
+ if (ahi_debug)
+ write_log ("AHI: SetEffect(%08x,%08x)\n", effect, audioctrl);
return 0;
}
int sampletype = get_long (info + ahisi_Type);
uae_u32 addr = get_long (info + ahisi_Address);
uae_u32 len = get_long (info + ahisi_Length);
- if (sound >= 0 && sound < MAX_SAMPLES && sound < dsahip->sounds) {
+ struct dssample *ds = GETSAMPLE;
+
+ if (ahi_debug)
+ write_log ("AHI: LoadSound(%d,%d,%08x,%08x,SMP=%d,ADDR=%08x,LEN=%d)\n",
+ sound, type, info, audioctrl, sampletype, addr, len);
+
+ if (ds) {
+ ds->num = sound;
if (!dsahip->cansurround && type == AHIST_L7_1)
return AHIE_BADSOUNDTYPE;
- if (ds_allocbuffer (dsahip, &dsahip->sample[sound], type, addr, len))
+ ds->addr = addr;
+ ds->type = type;
+ ds->len = len;
+ ds->frequency = 0;
+ if (ds_allocbuffer (dsahip, ds, type, len))
ret = AHIE_OK;
}
return ret;
uae_u16 sound = m68k_dreg (&ctx->regs, 0);
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
- if (sound >= 0 && sound < MAX_SAMPLES)
- ds_freebuffer (dsahip, &dsahip->sample[sound]);
+ struct dssample *ds = GETSAMPLE;
+
+ if (ahi_debug)
+ write_log ("AHI: UnloadSound(%d,%08x)\n",
+ sound, audioctrl);
+ if (ds)
+ ds_freebuffer (dsahip, ds);
return AHIE_OK;
}
{
uae_u32 ret = 0;
uae_u32 sp = m68k_areg (&ctx->regs, 7);
- uae_u32 offset = get_word (sp);
+ uae_u32 offset = get_long (sp + 4);
+
+ if (ahi_debug)
+ write_log ("AHI: %d\n", offset);
+
switch (offset)
{
+ case 0xffffffff:
+ ret = init (ctx);
+ break;
case 0:
ret = AHIsub_AllocAudio (ctx);
break;
#include <winioctl.h>
#include <ntddkbd.h>
#endif
+#include <setupapi.h>
+#include <devguid.h>
#include "win32.h"
static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode, winmousewheelbuttonstart;
static int normalkb, superkb, rawkb;
-int no_rawinput, dinput_enum_all;
+int no_rawinput;
+int rawkeyboard;
+int dinput_enum_all;
int dinput_winmouse (void)
{
static void unregister_rawinput (void)
{
+ rawinput_registered = 0;
}
static int register_rawinput (void)
{
- RAWINPUTDEVICE rid[1];
+ int num;
+ RAWINPUTDEVICE rid[2];
if (!rawinput_available)
return 0;
memset (rid, 0, sizeof (rid));
+ num = 0;
/* mouse */
- rid[0].usUsagePage = 1;
- rid[0].usUsage = 2;
- rid[0].dwFlags = 0;
-#if 0
+ if (rawmouse) {
+ rid[num].usUsagePage = 1;
+ rid[num].usUsage = 2;
+ rid[num].dwFlags = RIDEV_INPUTSINK;
+ rid[num].hwndTarget = hAmigaWnd;
+ num++;
+ }
/* keyboard */
- rid[1].usUsagePage = 1;
- rid[1].usUsage = 6;
- rid[1].dwFlags = 0;
-#endif
-
- if (pRegisterRawInputDevices(rid, sizeof (rid) / sizeof (RAWINPUTDEVICE), sizeof (RAWINPUTDEVICE)) == FALSE) {
+ if (rawkb) {
+ rid[num].usUsagePage = 1;
+ rid[num].usUsage = 6;
+ rid[num].dwFlags = RIDEV_INPUTSINK;
+ rid[num].hwndTarget = hAmigaWnd;
+ num++;
+ }
+ if (!num)
+ return 0;
+ write_log ("%d\n", num);
+ if (pRegisterRawInputDevices(rid, num, sizeof (RAWINPUTDEVICE)) == FALSE) {
write_log ("RAWINPUT registration failed %d\n", GetLastError ());
return 0;
}
return 1;
}
-static void cleardid(struct didata *did)
+static void cleardid (struct didata *did)
{
int i;
memset (did, 0, sizeof (*did));
}
}
+
+#define MAX_KEYCODES 256
+static uae_u8 di_keycodes[MAX_INPUT_DEVICES][MAX_KEYCODES];
+static int keyboard_german;
+
+static int keyhack (int scancode,int pressed, int num)
+{
+ static byte backslashstate,apostrophstate;
+
+#ifdef RETROPLATFORM
+ if (rp_checkesc (scancode, di_keycodes[num], pressed, num))
+ return -1;
+#endif
+
+ //check ALT-F4
+ if (pressed && !di_keycodes[num][DIK_F4] && scancode == DIK_F4 && di_keycodes[num][DIK_LALT] && !currprefs.win32_ctrl_F11_is_quit) {
+#ifdef RETROPLATFORM
+ if (rp_close ())
+ return -1;
+#endif
+ uae_quit ();
+ return -1;
+ }
+#ifdef SINGLEFILE
+ if (pressed && scancode == DIK_ESCAPE) {
+ uae_quit ();
+ return -1;
+ }
+#endif
+
+ // release mouse if TAB and ALT is pressed
+ if (pressed && di_keycodes[num][DIK_LALT] && scancode == DIK_TAB) {
+ disablecapture ();
+ return -1;
+ }
+
+ if (!keyboard_german || currprefs.input_selected_setting > 0)
+ return scancode;
+
+ //This code look so ugly because there is no Directinput
+ //key for # (called numbersign on win standard message)
+ //available
+ //so here need to change qulifier state and restore it when key
+ //is release
+ if (scancode == DIK_BACKSLASH) // The # key
+ {
+ if (di_keycodes[num][DIK_LSHIFT] || di_keycodes[num][DIK_RSHIFT] || apostrophstate)
+ {
+ if (pressed)
+ { apostrophstate=1;
+ inputdevice_translatekeycode (num, DIK_RSHIFT, 0);
+ inputdevice_translatekeycode (num, DIK_LSHIFT, 0);
+ return 13; // the german ' key
+ }
+ else
+ {
+ //best is add a real keystatecheck here but it still work so
+ apostrophstate = 0;
+ inputdevice_translatekeycode (num, DIK_LALT,0);
+ inputdevice_translatekeycode (num, DIK_LSHIFT,0);
+ inputdevice_translatekeycode (num, 4, 0); // release also the # key
+ return 13;
+ }
+
+ }
+ if (pressed)
+ {
+ inputdevice_translatekeycode (num, DIK_LALT, 1);
+ inputdevice_translatekeycode (num, DIK_LSHIFT,1);
+ return 4; // the german # key
+ }
+ else
+ {
+ inputdevice_translatekeycode (num, DIK_LALT, 0);
+ inputdevice_translatekeycode (num, DIK_LSHIFT, 0);
+ // Here is the same not nice but do the job
+ return 4; // the german # key
+
+ }
+ }
+ if ((di_keycodes[num][DIK_RALT]) || (backslashstate)) {
+ switch (scancode)
+ {
+ case 12:
+ if (pressed)
+ {
+ backslashstate=1;
+ inputdevice_translatekeycode (num, DIK_RALT, 0);
+ return DIK_BACKSLASH;
+ }
+ else
+ {
+ backslashstate=0;
+ return DIK_BACKSLASH;
+ }
+ }
+ }
+ return scancode;
+}
+
static int initialize_catweasel(void)
{
int j, i;
return 0;
}
+static void rawinputfixname (const char *name, const char *friendlyname)
+{
+ int i, ii, j;
+ char tmp[MAX_DPATH];
+
+ sprintf (tmp, "\\\\?\\%s", name);
+ for (i = 4; i < strlen (tmp); i++) {
+ if (tmp[i] == '\\')
+ tmp[i] = '#';
+ tmp[i] = toupper (tmp[i]);
+ }
+ for (ii = 0; ii < 2; ii++) {
+ for (i = 0; i < (ii == 0 ? num_mouse : num_keyboard); i++) {
+ struct didata *did = ii == 0 ? &di_mouse[i] : &di_keyboard[i];
+ char tmp2[MAX_DPATH];
+ if (!did->rawinput)
+ continue;
+ for (j = 0; j < strlen (did->configname); j++)
+ tmp2[j] = toupper (did->configname[j]);
+ tmp2[j] = 0;
+ if (strlen (tmp2) >= strlen (tmp) && !memcmp (tmp2, tmp, strlen (tmp))) {
+ xfree (did->name);
+ xfree (did->sortname);
+ did->name = my_strdup (friendlyname);
+ did->sortname = my_strdup (friendlyname);
+ write_log ("'%s' ('%s')\n", did->name, did->configname);
+ }
+ }
+ }
+}
+
+static void rawinputfriendlynames (void)
+{
+ HDEVINFO di;
+ int i, ii;
+
+ for (ii = 0; ii < 2; ii++) {
+ di = SetupDiGetClassDevs (ii == 0 ? &GUID_DEVCLASS_MOUSE : &GUID_DEVCLASS_KEYBOARD, NULL, NULL, DIGCF_PRESENT);
+ if (di != INVALID_HANDLE_VALUE) {
+ SP_DEVINFO_DATA dd;
+ dd.cbSize = sizeof dd;
+ for (i = 0; SetupDiEnumDeviceInfo (di, i, &dd); i++) {
+ char buf[MAX_DPATH];
+ DWORD size = 0;
+ if (SetupDiGetDeviceInstanceId (di, &dd, buf, sizeof buf , &size)) {
+ char fname[MAX_DPATH];
+ DWORD dt;
+ fname[0] = 0;
+ size = 0;
+ if (!SetupDiGetDeviceRegistryProperty (di, &dd,
+ SPDRP_FRIENDLYNAME, &dt, (PBYTE)fname, sizeof fname, &size)) {
+ size = 0;
+ SetupDiGetDeviceRegistryProperty (di, &dd,
+ SPDRP_DEVICEDESC, &dt, (PBYTE)fname, sizeof fname, &size);
+ }
+ if (size > 0 && fname[0])
+ rawinputfixname (buf, fname);
+ }
+ }
+ SetupDiDestroyDeviceInfoList (di);
+ }
+ }
+}
+
static int initialize_rawinput (void)
{
RAWINPUTDEVICELIST *ridl = 0;
HANDLE h = ridl[i].hDevice;
int type = ridl[i].dwType;
- if (/* type == RIM_TYPEKEYBOARD || */ type == RIM_TYPEMOUSE) {
+ if (type == RIM_TYPEKEYBOARD && !rawkeyboard)
+ continue;
+
+ if (type == RIM_TYPEKEYBOARD || type == RIM_TYPEMOUSE) {
struct didata *did = type == RIM_TYPEMOUSE ? di_mouse : di_keyboard;
PRID_DEVICE_INFO rdi;
int v, j;
} else if (did == di_keyboard) {
if (rnum_kb < 2)
continue;
- if (num_keyboard >= MAX_INPUT_DEVICES)
+ if (num_keyboard >= MAX_INPUT_DEVICES - 1)
continue;
did += num_keyboard;
num_keyboard++;
write_log ("type=%d sub=%d mode=%d fkeys=%d indicators=%d tkeys=%d",
rdik->dwType, rdik->dwSubType, rdik->dwKeyboardMode,
rdik->dwNumberOfFunctionKeys, rdik->dwNumberOfIndicators, rdik->dwNumberOfKeysTotal);
+
}
}
}
+ rawinputfriendlynames ();
+
xfree (ridl);
xfree (buf);
if (rnum_raw > 0)
rm->lLastY,
rm->ulExtraInformation, num < num_mouse ? num + 1 : -1);
#endif
- if (num == num_mouse) {
+ if (num == num_mouse)
return;
- }
if (focus) {
if (mouseactive || isfullscreen () > 0) {
}
} else if (raw->header.dwType == RIM_TYPEKEYBOARD) {
-#ifdef DI_DEBUG2
+ int istest = inputdevice_istest ();
+ PRAWKEYBOARD rk = &raw->data.keyboard;
+ uae_u8 scancode = (rk->MakeCode & 0x7f) | ((rk->Flags & RI_KEY_E0) ? 0x80 : 0x00);
+ int pressed = (rk->Flags & RI_KEY_BREAK) ? 1 : 0;
+
+ #ifdef DI_DEBUG2
write_log ("HANDLE=%x CODE=%x Flags=%x VK=%x MSG=%x EXTRA=%x\n",
raw->header.hDevice,
raw->data.keyboard.MakeCode,
raw->data.keyboard.Message,
raw->data.keyboard.ExtraInformation);
#endif
+ if (scancode == DIK_F12 && pressed) {
+ inputdevice_add_inputcode (AKS_ENTERGUI, 1);
+ return;
+ }
+
+ for (num = 0; num < num_keyboard; num++) {
+ did = &di_keyboard[num];
+ if (!did->disabled && did->rawinput == raw->header.hDevice)
+ break;
+ }
+ if (num == num_keyboard)
+ return;
+ if (scancode == 0xaa)
+ return;
+ if (!istest)
+ scancode = keyhack (scancode, pressed, num);
+ if (scancode < 0)
+ return;
+ di_keycodes[num][scancode] = pressed;
+ if (istest) {
+ inputdevice_do_keyboard (scancode, pressed);
+ } else {
+ if (stopoutput == 0)
+ my_kbd_handler (num, scancode, pressed);
+ }
}
}
IDirectInput8_EnumDevices (g_lpdi, DI8DEVCLASS_GAMECTRL, di_enumcallback, 0, DIEDFL_ATTACHEDONLY);
}
write_log ("RawInput enumeration..\n");
- initialize_rawinput();
+ initialize_rawinput ();
write_log ("Windowsmouse initialization..\n");
- initialize_windowsmouse();
+ initialize_windowsmouse ();
write_log ("Catweasel joymouse initialization..\n");
- initialize_catweasel();
+ initialize_catweasel ();
write_log ("end\n");
sortdd (di_joystick, num_joystick, DID_JOYSTICK);
HRESULT hr;
int i, j, k;
int fs = isfullscreen() > 0 ? 1 : 0;
+ int istest = inputdevice_istest ();
if (IGNOREEVERYTHING)
return;
#ifdef DI_DEBUG2
write_log ("MOUSE: %d OFF=%d DATA=%d STATE=%d\n", i, dimofs, data, state);
#endif
- if (focus) {
- if (mouseactive || fs) {
+ if (istest || focus) {
+ if (istest || mouseactive || fs) {
for (k = 0; k < did->axles; k++) {
if (did->axismappings[k] == dimofs)
setmousestate (i, k, data, 0);
}
}
}
- if (currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) {
+ if (!istest && currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) {
if (isfullscreen () > 0)
minimizewindow ();
if (mouseactive)
return IDEV_WIDGET_KEY;
}
-static int keyboard_german;
-
static BYTE ledkeystate[256];
static uae_u32 get_leds (void)
IDirectInputDevice8_Release (di_keyboard[i].lpdi);
di_keyboard[i].lpdi = 0;
}
+ superkb = normalkb = rawkb = 0;
di_free ();
}
-#define MAX_KEYCODES 256
-static uae_u8 di_keycodes[MAX_INPUT_DEVICES][MAX_KEYCODES];
static uae_u32 kb_do_refresh;
int ispressed (int key)
}
-static int keyhack (int scancode,int pressed, int num)
-{
- static byte backslashstate,apostrophstate;
-
-#ifdef RETROPLATFORM
- if (rp_checkesc (scancode, di_keycodes[num], pressed, num))
- return -1;
-#endif
-
- //check ALT-F4
- if (pressed && !di_keycodes[num][DIK_F4] && scancode == DIK_F4 && di_keycodes[num][DIK_LALT] && !currprefs.win32_ctrl_F11_is_quit) {
-#ifdef RETROPLATFORM
- if (rp_close ())
- return -1;
-#endif
- uae_quit ();
- return -1;
- }
-#ifdef SINGLEFILE
- if (pressed && scancode == DIK_ESCAPE) {
- uae_quit ();
- return -1;
- }
-#endif
-
- // release mouse if TAB and ALT is pressed
- if (pressed && di_keycodes[num][DIK_LALT] && scancode == DIK_TAB) {
- disablecapture ();
- return -1;
- }
-
- if (!keyboard_german || currprefs.input_selected_setting > 0)
- return scancode;
-
- //This code look so ugly because there is no Directinput
- //key for # (called numbersign on win standard message)
- //available
- //so here need to change qulifier state and restore it when key
- //is release
- if (scancode == DIK_BACKSLASH) // The # key
- {
- if (di_keycodes[num][DIK_LSHIFT] || di_keycodes[num][DIK_RSHIFT] || apostrophstate)
- {
- if (pressed)
- { apostrophstate=1;
- inputdevice_translatekeycode (num, DIK_RSHIFT, 0);
- inputdevice_translatekeycode (num, DIK_LSHIFT, 0);
- return 13; // the german ' key
- }
- else
- {
- //best is add a real keystatecheck here but it still work so
- apostrophstate = 0;
- inputdevice_translatekeycode (num, DIK_LALT,0);
- inputdevice_translatekeycode (num, DIK_LSHIFT,0);
- inputdevice_translatekeycode (num, 4, 0); // release also the # key
- return 13;
- }
-
- }
- if (pressed)
- {
- inputdevice_translatekeycode (num, DIK_LALT, 1);
- inputdevice_translatekeycode (num, DIK_LSHIFT,1);
- return 4; // the german # key
- }
- else
- {
- inputdevice_translatekeycode (num, DIK_LALT, 0);
- inputdevice_translatekeycode (num, DIK_LSHIFT, 0);
- // Here is the same not nice but do the job
- return 4; // the german # key
-
- }
- }
- if ((di_keycodes[num][DIK_RALT]) || (backslashstate)) {
- switch (scancode)
- {
- case 12:
- if (pressed)
- {
- backslashstate=1;
- inputdevice_translatekeycode (num, DIK_RALT, 0);
- return DIK_BACKSLASH;
- }
- else
- {
- backslashstate=0;
- return DIK_BACKSLASH;
- }
- }
- }
- return scancode;
-}
-
static void read_kb (void)
{
DIDEVICEOBJECTDATA didod[DI_KBBUFFER];
HRESULT hr;
LPDIRECTINPUTDEVICE8 lpdi;
int i, j;
+ int istest = inputdevice_istest ();
if (IGNOREEVERYTHING)
return;
for (j = 0; j < elements; j++) {
int scancode = didod[j].dwOfs;
int pressed = (didod[j].dwData & 0x80) ? 1 : 0;
- scancode = keyhack (scancode, pressed, i);
+ if (!istest)
+ scancode = keyhack (scancode, pressed, i);
if (scancode < 0)
continue;
di_keycodes[i][scancode] = pressed;
- if (stopoutput == 0)
- my_kbd_handler (i, scancode, pressed);
+ if (istest) {
+ inputdevice_do_keyboard (scancode, pressed);
+ } else {
+ if (stopoutput == 0)
+ my_kbd_handler (i, scancode, pressed);
+ }
}
} else if (hr == DIERR_INPUTLOST) {
acquire (lpdi, "keyboard");
kb_do_refresh = ~0;
di_keyboard[num].acquired = -1;
if (acquire (lpdi, "keyboard")) {
- if (di_keyboard[num].superdevice)
+ if (di_keyboard[num].rawinput)
+ rawkb++;
+ else if (di_keyboard[num].superdevice)
superkb++;
else
normalkb++;
di_keyboard[num].acquired = 1;
}
+ if (rawkb)
+ register_rawinput ();
return di_keyboard[num].acquired > 0 ? 1 : 0;
}
unacquire (lpdi, "keyboard");
if (di_keyboard[num].acquired) {
- if (di_keyboard[num].superdevice)
+ if (di_keyboard[num].rawinput)
+ rawkb--;
+ else if (di_keyboard[num].superdevice)
superkb--;
else
normalkb--;
// dxdata.statusheight = TD_TOTAL_HEIGHT;
dxdata.cursorwidth = 48;
dxdata.cursorheight = 48;
- dxdata.maxwidth = 16384;
- dxdata.maxheight = 16384;
if (!d3ddone) {
d3dDLL = LoadLibrary ("D3D9.DLL");
if (d3dDLL) {
#include "threaddep/thread.h"
#include "serial.h"
#include "savestate.h"
+#include "ahidsound_new.h"
#include <Ghostscript/errors.h>
#include <Ghostscript/iapi.h>
uaecptr a = here (); //this install the ahisound
org (rtarea_base + 0xFFC0);
calltrap (deftrapres (ahi_demux, 0, "ahi_winuae"));
- dw (0x4e75);// rts
+ dw (RTS);
org (a);
+ init_ahi_v2 ();
}
}
void *arg;
};
-static unsigned __stdcall thread_init(void *f)
+static unsigned __stdcall thread_init (void *f)
{
struct thparms *thp = f;
void *(*fp)(void*) = thp->f;
#define IDC_RTG_24BIT 1789
#define IDC_RTG_32BIT 1790
#define IDC_DD_SURFACETYPE 1791
-#define IDC_RTG_LEDS 1791
+#define IDC_RTG_SCALE_ALLOW 1791
+#define IDC_RTG_SCALE_ASPECTRATIO 1792
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
#define IDC_RTG_32BIT 1790
#define IDC_DD_SURFACETYPE 1791
#define IDC_RTG_SCALE_ALLOW 1791
+#define IDC_RTG_SCALE_ASPECTRATIO 1792
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
RTEXT "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,25,98,53,10,SS_NOTIFY | SS_CENTERIMAGE
CONTROL "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,94,60,20
EDITTEXT IDC_P96RAM,152,97,34,12,ES_CENTER | ES_READONLY
- GROUPBOX "Advanced Memory Settings",-1,13,171,275,65
- RTEXT "Motherboard RAM (Low area):",-1,39,190,129,10,SS_CENTERIMAGE
- CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,186,59,20
- EDITTEXT IDC_MBRAM1,243,189,34,12,ES_CENTER | ES_READONLY
- RTEXT "Motherboard RAM (High area):",-1,39,215,129,10,SS_CENTERIMAGE
- CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,211,59,20
- EDITTEXT IDC_MBRAM2,243,214,34,12,ES_CENTER | ES_READONLY
- GROUPBOX "RTG Graphics Card Settings",-1,14,81,275,87
+ GROUPBOX "Advanced Memory Settings",-1,13,179,275,57
+ RTEXT "Motherboard RAM (Low area):",-1,39,194,129,10,SS_CENTERIMAGE
+ CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,190,59,20
+ EDITTEXT IDC_MBRAM1,243,193,34,12,ES_CENTER | ES_READONLY
+ RTEXT "Motherboard RAM (High area):",-1,39,217,129,10,SS_CENTERIMAGE
+ CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,213,59,20
+ EDITTEXT IDC_MBRAM2,243,216,34,12,ES_CENTER | ES_READONLY
+ GROUPBOX "RTG Graphics Card Settings",-1,14,81,275,95
CONTROL "Scale if smaller than display size setting",IDC_RTG_SCALE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,134,162,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,128,162,10
CONTROL "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,119,163,10
- COMBOBOX IDC_RTG_8BIT,211,101,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_RTG_16BIT,211,117,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_RTG_24BIT,211,133,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_RTG_32BIT,211,149,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- CONTROL "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,148,162,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,116,163,10
+ COMBOBOX IDC_RTG_8BIT,211,107,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_RTG_16BIT,211,123,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_RTG_24BIT,211,139,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_RTG_32BIT,211,155,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,140,162,10
+ COMBOBOX IDC_RTG_SCALE_ASPECTRATIO,131,155,57,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Scale aspect ratio",-1,24,156,99,10,SS_CENTERIMAGE
END
IDD_CPU DIALOGEX 0, 0, 300, 226
int rp_rpescapeholdtime = 600;
int rp_screenmode = 0;
int rp_inputmode = 0;
-int log_rp = 0;
+int log_rp = 1;
static int max_horiz_dbl = RES_HIRES;
static int max_vert_dbl = 1;
write_log ("RPPOST: pInfo == NULL!\n");
return FALSE;
}
- if (uMessage == RPIPCGM_DEVICESEEK)
+ if (uMessage == RPIPCGM_DEVICESEEK || uMessage == RPIPCGM_DEVICEACTIVITY)
dolog = 0;
recursive++;
cnt++;
#include "rp.h"
#endif
-extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
+extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput, rawkeyboard;
int log_scsi, log_net, uaelib_debug;
int pissoff_value = 25000;
p->win32_rtgmatchdepth = 1;
p->win32_rtgscaleifsmall = 1;
p->win32_rtgallowscaling = 0;
+ p->win32_rtgscaleaspectratio = -1;
}
if (type == 1 || type == 0) {
p->win32_uaescsimode = get_aspi (p->win32_uaescsimode);
cfgfile_target_dwrite (f, "rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? "true" : "false" );
cfgfile_target_dwrite (f, "rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? "true" : "false" );
cfgfile_target_dwrite (f, "rtg_scale_allow=%s\n", p->win32_rtgallowscaling ? "true" : "false" );
+ cfgfile_target_dwrite (f, "rtg_scale_aspect_ratio=%d:%d\n",
+ p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio >> 8) : -1,
+ p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio & 0xff) : -1);
cfgfile_target_dwrite (f, "borderless=%s\n", p->win32_borderless ? "true" : "false" );
cfgfile_target_dwrite (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]);
cfgfile_target_dwrite (f, "soundcard=%d\n", p->win32_soundcard );
int target_parse_option (struct uae_prefs *p, char *option, char *value)
{
+ char tmpbuf[CONFIG_BLEN];
int i, v;
int result = (cfgfile_yesno (option, value, "middle_mouse", &p->win32_middle_mouse)
|| cfgfile_yesno (option, value, "map_drives", &p->win32_automount_drives)
return 1;
}
+ if (cfgfile_string (option, value, "rtg_scale_aspect_ratio", tmpbuf, sizeof tmpbuf)) {
+ int v1, v2;
+ char *s;
+
+ p->win32_rtgscaleaspectratio = -1;
+ v1 = atol (tmpbuf);
+ s = strchr (tmpbuf, ':');
+ if (s) {
+ v2 = atol (s + 1);
+ if (v1 < 0 || v2 < 0)
+ p->win32_rtgscaleaspectratio = -1;
+ else if (v1 == 0 || v2 == 0)
+ p->win32_rtgscaleaspectratio = 0;
+ else
+ p->win32_rtgscaleaspectratio = (v1 << 8) | v2;
+ }
+ return 1;
+ }
+
if (cfgfile_strval (option, value, "uaescsimode", &p->win32_uaescsimode, scsimode, 0))
return 1;
no_rawinput = 1;
continue;
}
+ if (!strcmp (arg, "-rawkeyboard")) {
+ rawkeyboard = 1;
+ continue;
+ }
if (!strcmp (arg, "-scsilog")) {
log_scsi = 1;
continue;
enumeratedisplays (multi_display);
write_log ("Sorting devices and modes..\n");
sortdisplays ();
+ write_log ("Display buffer mode = %d\n", ddforceram);
write_log ("done\n");
memset (&devmode, 0, sizeof(devmode));
#define GETBDD(x) ((x) % 100)
#define WINUAEBETA 1
-#define WINUAEPUBLICBETA 3
-#define WINUAEDATE MAKEBD(2008, 6, 28)
+#define WINUAEPUBLICBETA 4
+#define WINUAEDATE MAKEBD(2008, 7, 2)
#define WINUAEEXTRA ""
#define WINUAEREV ""
if (scalepicasso) {
int srcratio, dstratio;
SetRect (&sr, 0, 0, picasso96_state.Width, picasso96_state.Height);
- srcratio = picasso96_state.Width * 256 / picasso96_state.Height;
- dstratio = currentmode->native_width * 256 / currentmode->native_height;
+ if (currprefs.win32_rtgscaleaspectratio < 0) {
+ // automatic
+ srcratio = picasso96_state.Width * 256 / picasso96_state.Height;
+ dstratio = currentmode->native_width * 256 / currentmode->native_height;
+ } else if (currprefs.win32_rtgscaleaspectratio == 0) {
+ // none
+ srcratio = dstratio = 0;
+ } else {
+ // manual
+ if (isfullscreen () == 0) {
+ dstratio = currentmode->native_width * 256 / currentmode->native_height;
+ srcratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff);
+ } else {
+ srcratio = picasso96_state.Width * 256 / picasso96_state.Height;
+ dstratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff);
+ }
+ }
if (srcratio == dstratio) {
SetRect (&dr, 0, 0, currentmode->native_width, currentmode->native_height);
} else if (srcratio > dstratio) {
c |= currprefs.win32_rtgmatchdepth != changed_prefs.win32_rtgmatchdepth ? 2 : 0;
c |= currprefs.win32_rtgscaleifsmall != changed_prefs.win32_rtgscaleifsmall ? 8 : 0;
c |= currprefs.win32_rtgallowscaling != changed_prefs.win32_rtgallowscaling ? 8 : 0;
+ c |= currprefs.win32_rtgscaleaspectratio != changed_prefs.win32_rtgscaleaspectratio ? 8 : 0;
if (display_change_requested || c)
{
currprefs.win32_rtgmatchdepth = changed_prefs.win32_rtgmatchdepth;
currprefs.win32_rtgscaleifsmall = changed_prefs.win32_rtgscaleifsmall;
currprefs.win32_rtgallowscaling = changed_prefs.win32_rtgallowscaling;
+ currprefs.win32_rtgscaleaspectratio = changed_prefs.win32_rtgscaleaspectratio;
inputdevice_unacquire ();
if ((c & 16) || ((c & 8) && keepfsmode)) {
nw = rc.right - rc.left;
nh = rc.bottom - rc.top;
}
+ write_log ("%d %d %d %d\n", x, y, w, h);
+ write_log ("%d %d %d %d\n", nx, ny, nw, nh);
if (w != nw || h != nh || x != nx || y != ny) {
w = nw;
h = nh;
x = nx;
y = ny;
in_sizemove++;
- if (hMainWnd && !fsw && !dxfs) {
+ if (hMainWnd && !fsw && !dxfs && !rp_isactive ()) {
GetWindowRect (hMainWnd, &r);
x = r.left;
y = r.top;
ew (hDlg, IDC_RTG_MATCH_DEPTH, rtg2);
ew (hDlg, IDC_RTG_SCALE, rtg2);
ew (hDlg, IDC_RTG_SCALE_ALLOW, rtg2);
+ ew (hDlg, IDC_RTG_SCALE_ASPECTRATIO, rtg2);
}
static void values_to_memorydlg (HWND hDlg)
CheckDlgButton (hDlg, IDC_RTG_SCALE, workprefs.win32_rtgscaleifsmall);
CheckDlgButton (hDlg, IDC_RTG_SCALE_ALLOW, workprefs.win32_rtgallowscaling);
CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth);
-// CheckDlgButton (hDlg, IDC_RTG_LEDS, (workprefs.leds_on_screen & STATUSLINE_RTG) ? 1 : 0);
+ //CheckDlgButton (hDlg, IDC_RTG_LEDS, (workprefs.leds_on_screen & STATUSLINE_RTG) ? 1 : 0);
+
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_SETCURSEL,
+ (workprefs.win32_rtgscaleaspectratio == 0) ? 0 :
+ (workprefs.win32_rtgscaleaspectratio == 4 * 256 + 3) ? 2 :
+ (workprefs.win32_rtgscaleaspectratio == 15 * 256 + 9) ? 3 :
+ (workprefs.win32_rtgscaleaspectratio == 16 * 256 + 9) ? 4 :
+ (workprefs.win32_rtgscaleaspectratio == 16 * 256 + 10) ? 5 : 1, 0);
mem_size = 0;
switch (workprefs.mbresmem_low_size) {
SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM));
SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_RESETCONTENT, 0, 0);
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"Disabled");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"Automatic");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"4:3");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"15:9");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"16:9");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"16:10");
case WM_USER:
recursive++;
uae_u32 mask = workprefs.picasso96_modeflags;
switch (LOWORD (wParam))
{
+ case IDC_RTG_SCALE_ASPECTRATIO:
+ v = SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_GETCURSEL, 0, 0L);
+ if (v != CB_ERR) {
+ if (v == 0)
+ workprefs.win32_rtgscaleaspectratio = 0;
+ if (v == 1)
+ workprefs.win32_rtgscaleaspectratio = -1;
+ if (v == 2)
+ workprefs.win32_rtgscaleaspectratio = 4 * 256 + 3;
+ if (v == 3)
+ workprefs.win32_rtgscaleaspectratio = 15 * 256 + 9;
+ if (v == 4)
+ workprefs.win32_rtgscaleaspectratio = 16 * 256 + 9;
+ if (v == 5)
+ workprefs.win32_rtgscaleaspectratio = 16 * 256 + 10;
+ }
+ break;
case IDC_RTG_8BIT:
v = SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR) {
}
}
-static void init_inputdlg( HWND hDlg )
+static void init_inputdlg (HWND hDlg)
{
int i;
- DWORD size = sizeof(COMMCONFIG);
char buf[100], txt[100];
SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_RESETCONTENT, 0, 0L);
init_inputdlg (hDlg);
}
+#if 0
+static void input_copy (HWND hDlg)
+{
+ char buf[2000];
+ inputdevice_acquire (1);
+ for (;;) {
+ focus = 1;
+ inputdevice_testread (buf);
+ focus = 0;
+ Sleep (100);
+ }
+ inputdevice_unacquire ();
+}
+
+#else
static void input_copy (HWND hDlg)
{
int dst = workprefs.input_selected_setting;
inputdevice_copy_single_config (&workprefs, (int)src, workprefs.input_selected_setting, input_selected_device);
init_inputdlg (hDlg);
}
+#endif
static void input_toggleautofire (void)
{
+Beta 4:
+
+- input panel custom events in slots 2+ were not saved if previous
+ slot was empty
+- debugger memwatch points were still broken in byte and word modes
+- debugger movem was disassembled incorrectly (wrong source/dest
+ address shown) if addressing mode was not address register relative
+- raw mouse friendly names added (was easier said than done..),
+ defaults to old-style "RAW Mouse" if name can't be found
+- directdraw max surface size driver workaround fixed
+- game Lancaster ce-mode blank-screen tweak
+
Beta 3:
- corrected directinput keyboard enumeration, possible fix for
#endif
-static uaecptr res_init, res_name, res_id;
+static uaecptr res_init, res_name, res_id, base;
-static uae_u32 REGPARAM2 res_getfunc (TrapContext *context)
+static uae_u32 REGPARAM2 res_getfunc (TrapContext *ctx)
{
- uaecptr funcname = m68k_areg (&context->regs, 0);
+ uaecptr funcname = m68k_areg (&ctx->regs, 0);
char tmp[256];
if (funcname == 0)
return 0;
return find_trap (tmp);
}
-static uae_u32 REGPARAM2 res_initcode (TrapContext *context)
+static uae_u32 REGPARAM2 res_initcode (TrapContext *ctx)
{
- uaecptr base = m68k_dreg (&context->regs, 0);
- uaecptr rb = base + SIZEOF_LIBRARY;
+ uaecptr rb;
+ base = m68k_dreg (&ctx->regs, 0);
+ rb = base + SIZEOF_LIBRARY;
put_word (rb + 0, UAEMAJOR);
put_word (rb + 2, UAEMINOR);
put_word (rb + 4, UAESUBREV);
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "RDSK", 4))
return ZFILE_HDFRDB;
+ if (!memcmp (buf, "DOS", 3))
+ return ZFILE_HDF;
if (ext != NULL) {
if (strcasecmp (ext, "hdf") == 0)
return ZFILE_HDF;