cfgfile_write (f, L"mbresmem_size", L"%d", p->mbresmem_high_size / 0x100000);
cfgfile_write (f, L"z3mem_size", L"%d", p->z3fastmem_size / 0x100000);
cfgfile_write (f, L"z3mem2_size", L"%d", p->z3fastmem2_size / 0x100000);
- cfgfile_write (f, L"z3chipmem_size", L"%d", p->z3chipmem_size / 0x100000);
cfgfile_write (f, L"z3mem_start", L"0x%x", p->z3fastmem_start);
cfgfile_write (f, L"bogomem_size", L"%d", p->bogomem_size / 0x40000);
cfgfile_write (f, L"gfxcard_size", L"%d", p->gfxmem_size / 0x100000);
cfgfile_write (f, L"chipmem_size", L"%d", p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
+ cfgfile_dwrite (f, L"megachipmem_size", L"%d", p->z3chipmem_size / 0x100000);
if (p->m68k_speed > 0)
cfgfile_write (f, L"finegrain_cpu_speed", L"%d", p->m68k_speed);
|| cfgfile_intval (option, value, L"mbresmem_size", &p->mbresmem_high_size, 0x100000)
|| cfgfile_intval (option, value, L"z3mem_size", &p->z3fastmem_size, 0x100000)
|| cfgfile_intval (option, value, L"z3mem2_size", &p->z3fastmem2_size, 0x100000)
- || cfgfile_intval (option, value, L"z3chipmem_size", &p->z3chipmem_size, 0x100000)
+ || cfgfile_intval (option, value, L"megachipmem_size", &p->z3chipmem_size, 0x100000)
|| cfgfile_intval (option, value, L"z3mem_start", &p->z3fastmem_start, 1)
|| cfgfile_intval (option, value, L"bogomem_size", &p->bogomem_size, 0x40000)
|| cfgfile_intval (option, value, L"gfxcard_size", &p->gfxmem_size, 0x100000)
if (expamem[0] & add_memory) {
// Z3 RAM expansion
p2 = 0;
- while (!p2 && z3num < 3) {
+ while (!p2 && z3num < 2) {
if (z3num == 0 && currprefs.z3fastmem_size)
p2 = z3fastmem_start >> 16;
else if (z3num == 1 && currprefs.z3fastmem2_size)
p2 = z3fastmem2_start >> 16;
- else if (z3num == 2 && currprefs.z3chipmem_size)
- p2 = z3chipmem_start >> 16;
if (!p2)
z3num++;
}
addrbank z3chipmem_bank = {
z3chipmem_lget, z3chipmem_wget, z3chipmem_bget,
z3chipmem_lput, z3chipmem_wput, z3chipmem_bput,
- z3chipmem_xlate, z3chipmem_check, NULL, L"ZorroIII FakeChipRAM",
+ z3chipmem_xlate, z3chipmem_check, NULL, L"MegaChipRAM",
z3chipmem_lget, z3chipmem_wget, ABFLAG_RAM
};
{
expamem_map_z3fastmem_2 (&z3fastmem2_bank, &z3fastmem2_start, currprefs.z3fastmem2_size, allocated_z3fastmem2, 0);
}
-static void expamem_map_z3chipmem (void)
-{
- expamem_map_z3fastmem_2 (&z3chipmem_bank, &z3chipmem_start, currprefs.z3chipmem_size, allocated_z3chipmem, 1);
-}
-
static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 size, uae_u32 allocated)
{
{
expamem_init_z3fastmem_2 (&z3fastmem2_bank, z3fastmem2_start, currprefs.z3fastmem2_size, allocated_z3fastmem2);
}
-static void expamem_init_z3chipmem (void)
-{
- expamem_init_z3fastmem_2 (&z3chipmem_bank, z3chipmem_start, currprefs.z3chipmem_size, allocated_z3chipmem);
-}
#ifdef PICASSO96
/*
currprefs.gfxmem_size = changed_prefs.gfxmem_size;
currprefs.z3chipmem_size = changed_prefs.z3chipmem_size;
+ z3chipmem_start = currprefs.z3fastmem_start;
+ z3fastmem_start = currprefs.z3fastmem_start;
+ if (currprefs.z3chipmem_size)
+ z3fastmem_start += currprefs.z3chipmem_size + 16 * 1024 * 1024;
+ z3fastmem2_start = currprefs.z3fastmem_start + currprefs.z3fastmem_size;
+
if (allocated_fastmem != currprefs.fastmem_size) {
free_fastmemory ();
allocated_fastmem = currprefs.fastmem_size;
if (allocated_z3chipmem) {
z3chipmem = mapped_malloc (allocated_z3chipmem, L"z3_chip");
if (z3chipmem == 0) {
- write_log (L"Out of memory for 32 bit fake chip memory.\n");
+ write_log (L"Out of memory for 32 bit chip memory.\n");
allocated_z3chipmem = 0;
}
}
card_map[cardno++] = expamem_map_fastcard;
}
- z3fastmem_start = currprefs.z3fastmem_start;
- z3fastmem2_start = currprefs.z3fastmem_start + currprefs.z3fastmem_size;
if (z3fastmem != NULL) {
z3num = 0;
if (kickstart_version >= 36) {
map_banks (&z3fastmem2_bank, z3fastmem2_start >> 16, currprefs.z3fastmem2_size >> 16, allocated_z3fastmem2);
}
}
- z3chipmem_start = z3fastmem2_start + currprefs.z3fastmem2_size;
- if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size)
- z3chipmem_start += 16 * 1024 * 1024;
- if (z3chipmem != NULL) {
- z3num = 0;
- if (kickstart_version >= 36) {
- card_init[cardno] = expamem_init_z3chipmem;
- card_map[cardno++] = expamem_map_z3chipmem;
- }
+ if (z3chipmem != NULL)
map_banks (&z3chipmem_bank, z3chipmem_start >> 16, currprefs.z3chipmem_size >> 16, allocated_z3chipmem);
- }
#ifdef CDTV
if (currprefs.cs_cdtvcd) {
card_init[cardno] = expamem_init_cdtv;
; jsr -$007e(a6) ; Enable
-filesys_dev_storeinfo ; add >2MB chip RAM to memory list
+filesys_dev_storeinfo
moveq #3,d4 ; MEMF_CHIP | MEMF_PUBLIC
cmp.w #36,20(a6)
bcs.s FSIN_ksold
or.w #256,d4 ; MEMF_LOCAL
FSIN_ksold
+ ; add >2MB-6MB chip RAM to memory list
move.w #$FF80,d0
bsr.w getrtbase
jsr (a0)
jsr -618(a6) ; AddMemList
FSIN_chip_done
- ; patch >8MB Z3 FakeChipRAM memory type to Chip
+ ; add MegaChipRAM
move.w #$FF80,d0
bsr.w getrtbase
jsr (a0) ; d1 = size, a1 = start address
- move.l d1,d2
beq.s FSIN_fchip_done
- move.l a1,a2
- jsr -$0078(a6) ; Disable
- lea 322(a6),a0 ; MemHeader
-FSIN_scanfchip:
- move.l (a0),a0 ; first MemList
- tst.l (a0)
- bne.s FSIN_fchip_found
- ; not in memlist, AddMem() it
- move.l a2,a0
- move.l d2,d0
+ move.l a1,a0
+ move.l d1,d0
move.l d4,d1
moveq #-5,d2
lea fchipname(pc),a1
jsr -618(a6) ; AddMemList
- bra.s FSIN_fchip_done2
-FSIN_fchip_found
- move.l 20(a0),d0 ; mh_Lower
- clr.w d0
- cmp.l d0,a2
- bne.s FSIN_scanfchip
- move.w 14(a0),d0 ; attributes
- and.w #~4,d0 ; MEMF_FAST
- or.w d4,d0
- move.w d0,14(a0)
- lea fchipname(pc),a1
- move.l a1,10(a0)
-FSIN_fchip_done2
- jsr -$007e(a6) ; Enable
FSIN_fchip_done
lea fstaskname(pc),a0
gfxlibname: dc.b 'graphics.library',0
explibname: dc.b 'expansion.library',0
fsresname: dc.b 'FileSystem.resource',0
-fchipname: dc.b 'z3chip memory',0
+fchipname: dc.b 'megachip memory',0
END
db(0x00); db(0x00); db(0x00); db(0x10); db(0x00); db(0x00); db(0x00); db(0x00);
- db(0x00); db(0x00); db(0x00); db(0x09); db(0x60); db(0x00); db(0x0a); db(0x82);
- db(0x00); db(0x00); db(0x08); db(0x64); db(0x00); db(0x00); db(0x00); db(0xd0);
- db(0x00); db(0x00); db(0x02); db(0x8c); db(0x00); db(0x00); db(0x00); db(0x24);
- db(0x00); db(0x00); db(0x03); db(0x48); db(0x00); db(0x00); db(0x0e); db(0x54);
- db(0x00); db(0x00); db(0x12); db(0xe4); db(0x43); db(0xfa); db(0x17); db(0xba);
+ db(0x00); db(0x00); db(0x00); db(0x09); db(0x60); db(0x00); db(0x0a); db(0x4a);
+ db(0x00); db(0x00); db(0x08); db(0x2c); db(0x00); db(0x00); db(0x00); db(0xd0);
+ db(0x00); db(0x00); db(0x02); db(0x54); db(0x00); db(0x00); db(0x00); db(0x24);
+ db(0x00); db(0x00); db(0x03); db(0x10); db(0x00); db(0x00); db(0x0e); db(0x1c);
+ db(0x00); db(0x00); db(0x12); db(0xac); db(0x43); db(0xfa); db(0x17); db(0x82);
db(0x4e); db(0xae); db(0xff); db(0xa0); db(0x20); db(0x40); db(0x20); db(0x28);
db(0x00); db(0x16); db(0x20); db(0x40); db(0x4e); db(0x90); db(0x4e); db(0x75);
db(0x48); db(0xe7); db(0xe0); db(0xe2); db(0x2c); db(0x78); db(0x00); db(0x04);
db(0x20); db(0x68); db(0x00); db(0x02); db(0x2f); db(0x08); db(0x4e); db(0x90);
db(0x20); db(0x5f); db(0x58); db(0x8f); db(0x48); db(0xe7); db(0xff); db(0x7e);
db(0x22); db(0x4e); db(0x20); db(0x08); db(0x30); db(0x7c); db(0xff); db(0xb8);
- db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x12); db(0x36);
- db(0x61); db(0x00); db(0x15); db(0xe8); db(0x4c); db(0xdf); db(0x7e); db(0xff);
- db(0x4e); db(0x75); db(0x00); db(0x00); db(0x08); db(0x00); db(0x00); db(0x02);
+ db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x11); db(0xfe);
+ db(0x61); db(0x00); db(0x15); db(0xb0); db(0x4c); db(0xdf); db(0x7e); db(0xff);
+ db(0x4e); db(0x75); db(0x4e); db(0xae); db(0x08); db(0x00); db(0x00); db(0x02);
db(0x67); db(0x06); db(0x4e); db(0xb9); db(0x00); db(0xf0); db(0x00); db(0x00);
- db(0x4e); db(0xf9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x00); db(0x00);
+ db(0x4e); db(0xf9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x28); db(0x40);
db(0x48); db(0xe7); db(0xff); db(0xfe); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x30); db(0x3c); db(0xff); db(0xfc); db(0x61); db(0x00); db(0x0b); db(0xe2);
- db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x17); db(0x2b); db(0x70); db(0x24);
+ db(0x30); db(0x3c); db(0xff); db(0xfc); db(0x61); db(0x00); db(0x0b); db(0xaa);
+ db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x16); db(0xf3); db(0x70); db(0x24);
db(0x7a); db(0x01); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x4a); db(0x80);
- db(0x66); db(0x0c); db(0x43); db(0xfa); db(0x17); db(0x1b); db(0x70); db(0x00);
+ db(0x66); db(0x0c); db(0x43); db(0xfa); db(0x16); db(0xe3); db(0x70); db(0x00);
db(0x7a); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x28); db(0x40);
db(0x4a); db(0xad); db(0x01); db(0x0c); db(0x67); db(0x5a); db(0x20); db(0x3c);
db(0x00); db(0x00); db(0x02); db(0x2c); db(0x22); db(0x3c); db(0x00); db(0x01);
db(0x27); db(0x4c); db(0x01); db(0x9c); db(0x7c); db(0x00); db(0xbc); db(0xad);
db(0x01); db(0x0c); db(0x64); db(0x2c); db(0x2f); db(0x06); db(0x7e); db(0x01);
db(0x4a); db(0x45); db(0x67); db(0x04); db(0x08); db(0xc7); db(0x00); db(0x02);
- db(0x2f); db(0x0b); db(0x20); db(0x4b); db(0x61); db(0x00); db(0x07); db(0x2e);
+ db(0x2f); db(0x0b); db(0x20); db(0x4b); db(0x61); db(0x00); db(0x06); db(0xf6);
db(0x26); db(0x5f); db(0x0c); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe);
db(0x67); db(0x08); db(0x48); db(0x46); db(0x52); db(0x46); db(0x48); db(0x46);
db(0x60); db(0xdc); db(0x2c); db(0x1f); db(0x52); db(0x46); db(0x60); db(0xce);
db(0x2c); db(0x78); db(0x00); db(0x04); db(0x22); db(0x4c); db(0x4e); db(0xae);
db(0xfe); db(0x62); db(0x78); db(0x03); db(0x0c); db(0x6e); db(0x00); db(0x24);
db(0x00); db(0x14); db(0x65); db(0x04); db(0x00); db(0x44); db(0x01); db(0x00);
- db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0b); db(0x42);
+ db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0b); db(0x0a);
db(0x4e); db(0x90); db(0x22); db(0x04); db(0x74); db(0xf6); db(0x20); db(0x7c);
db(0x00); db(0x20); db(0x00); db(0x00); db(0x90); db(0x88); db(0x65); db(0x08);
db(0x67); db(0x06); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfd); db(0x96);
- db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0b); db(0x22);
- db(0x4e); db(0x90); db(0x24); db(0x01); db(0x67); db(0x46); db(0x24); db(0x49);
- db(0x4e); db(0xae); db(0xff); db(0x88); db(0x41); db(0xee); db(0x01); db(0x42);
- db(0x20); db(0x50); db(0x4a); db(0x90); db(0x66); db(0x12); db(0x20); db(0x4a);
- db(0x20); db(0x02); db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa);
- db(0x16); db(0x75); db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x60); db(0x20);
- db(0x20); db(0x28); db(0x00); db(0x14); db(0x42); db(0x40); db(0xb5); db(0xc0);
- db(0x66); db(0xde); db(0x30); db(0x28); db(0x00); db(0x0e); db(0x02); db(0x40);
- db(0xff); db(0xfb); db(0x80); db(0x44); db(0x31); db(0x40); db(0x00); db(0x0e);
- db(0x43); db(0xfa); db(0x16); db(0x53); db(0x21); db(0x49); db(0x00); db(0x0a);
- db(0x4e); db(0xae); db(0xff); db(0x82); db(0x41); db(0xfa); db(0x15); db(0xc6);
+ db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0a); db(0xea);
+ db(0x4e); db(0x90); db(0x67); db(0x10); db(0x20); db(0x49); db(0x20); db(0x01);
+ db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa); db(0x16); db(0x4f);
+ db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x41); db(0xfa); db(0x15); db(0xc6);
db(0x43); db(0xfa); db(0x00); db(0x54); db(0x70); db(0x0a); db(0x61); db(0x00);
db(0x0b); db(0xa4); db(0x22); db(0x40); db(0x72); db(0x01); db(0x30); db(0x3c);
db(0xff); db(0x48); db(0x61); db(0x00); db(0x0a); db(0xbc); db(0x4e); db(0x90);
db(0x60); db(0x00); db(0xff); db(0x74); db(0x30); db(0x3c); db(0xff); db(0x50);
db(0x61); db(0x00); db(0x09); db(0x86); db(0x70); db(0x04); db(0x4e); db(0x90);
db(0x70); db(0x01); db(0x4c); db(0xdf); db(0x04); db(0x00); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0xc0); db(0xc0); db(0x61); db(0x00); db(0xfc); db(0xea);
+ db(0x48); db(0xe7); db(0xc0); db(0xc0); db(0x61); db(0x00); db(0xfd); db(0x22);
db(0x70); db(0x1a); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40); db(0x41); db(0xfa);
db(0x14); db(0x45); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa);
db(0xff); db(0x18); db(0x61); db(0x00); db(0x03); db(0x9c); db(0x4e); db(0x90);
db(0x20); db(0x03); db(0x16); db(0x29); db(0x00); db(0x4f); db(0x4a); db(0x80);
db(0x66); db(0x1a); db(0x27); db(0x7c); db(0x00); db(0x00); db(0x17); db(0x70);
- db(0x00); db(0x14); db(0x41); db(0xfa); db(0xf6); db(0xc0); db(0x20); db(0x08);
+ db(0x00); db(0x14); db(0x41); db(0xfa); db(0xf6); db(0xf8); db(0x20); db(0x08);
db(0xe4); db(0x88); db(0x27); db(0x40); db(0x00); db(0x20); db(0x70); db(0xff);
db(0x27); db(0x40); db(0x00); db(0x24); db(0x08); db(0x07); db(0x00); db(0x00);
db(0x67); db(0x3a); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0x14);
db(0x24); db(0x51); db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e);
db(0x06); db(0x86); db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a);
db(0x66); db(0xec); db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75);
- db(0x41); db(0xfa); db(0xf3); db(0x32); db(0x02); db(0x80); db(0x00); db(0x00);
+ db(0x41); db(0xfa); db(0xf3); db(0x6a); db(0x02); db(0x80); db(0x00); db(0x00);
db(0xff); db(0xff); db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x20); db(0x88);
db(0x58); db(0x90); db(0x42); db(0xa8); db(0x00); db(0x04); db(0x21); db(0x48);
db(0x00); db(0x08); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22);
db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79);
db(0x00); db(0x46); db(0x69); db(0x6c); db(0x65); db(0x53); db(0x79); db(0x73);
db(0x74); db(0x65); db(0x6d); db(0x2e); db(0x72); db(0x65); db(0x73); db(0x6f);
- db(0x75); db(0x72); db(0x63); db(0x65); db(0x00); db(0x7a); db(0x33); db(0x63);
- db(0x68); db(0x69); db(0x70); db(0x20); db(0x6d); db(0x65); db(0x6d); db(0x6f);
- db(0x72); db(0x79); db(0x00); db(0x00); db(0x00); db(0x00); db(0x03); db(0xf2);
+ db(0x75); db(0x72); db(0x63); db(0x65); db(0x00); db(0x6d); db(0x65); db(0x67);
+ db(0x61); db(0x63); db(0x68); db(0x69); db(0x70); db(0x20); db(0x6d); db(0x65);
+ db(0x6d); db(0x6f); db(0x72); db(0x79); db(0x00); db(0x00); db(0x00); db(0x00);
+ db(0x00); db(0x00); db(0x03); db(0xf2);
extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, const TCHAR *name, int port);
extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, int flags, int port, int sub);
-extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, int *port, TCHAR *name, TCHAR *custom, int sub);
+extern int inputdevice_get_mapping (int devnum, int num, int *pflags, int *port, TCHAR *name, TCHAR *custom, int sub);
extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum);
extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum);
#define MAX_INPUT_SETTINGS 4
#define GAMEPORT_INPUT_SETTINGS 3 // last slot is for gameport panel mappings
#define MAX_INPUT_SUB_EVENT 4
-#define MAX_INPUT_SIMULTANEOUS_KEYS 4
+#define SPARE_SUB_EVENT 4
struct uae_input_device {
TCHAR *name;
TCHAR *configname;
- uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
- TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
- uae_u16 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
- uae_s16 extra[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS];
- uae_s8 port[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS];
+ uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT + 1];
+ TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT + 1];
+ uae_u16 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT + 1];
+ uae_s8 port[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT + 1];
+ uae_s16 extra[MAX_INPUT_DEVICE_EVENTS];
uae_s8 enabled;
};
return true;
}
+static bool write_slot (TCHAR *p, struct uae_input_device *uid, int i, int j)
+{
+ bool ok = false;
+ if (uid->custom[i][j] && _tcslen (uid->custom[i][j]) > 0) {
+ _stprintf (p, L"'%s'.%d", uid->custom[i][j], uid->flags[i][j] & ID_FLAG_SAVE_MASK);
+ ok = true;
+ } else if (uid->eventid[i][j] > 0) {
+ _stprintf (p, L"%s.%d", events[uid->eventid[i][j]].confname, uid->flags[i][j] & ID_FLAG_SAVE_MASK);
+ ok = true;
+ } else {
+ _tcscat (p, L"NULL");
+ }
+ return ok;
+}
+
+static struct inputdevice_functions *getidf (int devnum);
+
+static void kbrlabel (TCHAR *s)
+{
+ while (*s) {
+ *s = _totupper (*s);
+ if (*s == ' ')
+ *s = '_';
+ s++;
+ }
+}
+
static void write_config2 (struct zfile *f, int idnum, int i, int offset, TCHAR *tmp1, struct uae_input_device *id)
{
TCHAR tmp2[200], tmp3[200], *p;
int evt, got, j, k;
TCHAR *custom;
+ int slotorder1[] = { 0, 1, 2, 3 };
+ int slotorder2[] = { 4, 1, 2, 3 };
+ int *slotorder;
+ int io = i + offset;
p = tmp2;
got = 0;
+
+ slotorder = slotorder1;
+ // if gameports non-custom mapping in slot0 -> save slot4 as slot0
+ if (id->port[io][0] && !(id->flags[io][0] & ID_FLAG_GAMEPORTSCUSTOM))
+ slotorder = slotorder2;
+
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
- evt = id->eventid[i + offset][j];
- custom = id->custom[i + offset][j];
+
+ evt = id->eventid[io][slotorder[j]];
+ custom = id->custom[io][slotorder[j]];
if (custom == NULL && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if (id->eventid[i + offset][k] > 0 || id->custom[i + offset][k] != NULL)
+ if (id->eventid[io][slotorder[k]] > 0 || id->custom[io][slotorder[k]] != NULL)
break;
}
if (k == MAX_INPUT_SUB_EVENT)
break;
}
- if (id->port[i + offset][0] > 0 && !(id->flags[i + offset][0] & ID_FLAG_GAMEPORTSCUSTOM))
- break;
+ if (id->port[io][0] > 0) {
+ if (!(id->flags[io][0] & ID_FLAG_GAMEPORTSCUSTOM) && id->port[io][SPARE_SUB_EVENT] == 0)
+ break;
+ }
if (p > tmp2) {
*p++ = ',';
*p = 0;
}
- bool ok = false;
- if (custom && _tcslen (custom) > 0) {
- _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & ID_FLAG_SAVE_MASK);
- ok = true;
- } else if (evt <= 0) {
- _stprintf (p, L"NULL");
- } else {
- _stprintf (p, L"%s.%d", events[evt].confname, id->flags[i + offset][j] & ID_FLAG_SAVE_MASK);
- ok = true;
- }
+ bool ok = write_slot (p, id, io, slotorder[j]);
p += _tcslen (p);
if (ok) {
- if (id->port[i + offset][j] > 0) {
- _stprintf (p, L".%d", id->port[i + offset][j] - 1);
+ if (id->port[io][slotorder[j]] > 0) {
+ _stprintf (p, L".%d", id->port[io][slotorder[j]] - 1);
p += _tcslen (p);
+ if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && id->port[io][SPARE_SUB_EVENT] && slotorder == slotorder1) {
+ *p++ = '.';
+ write_slot (p, id, io, SPARE_SUB_EVENT);
+ p += _tcslen (p);
+ }
}
}
}
}
}
-static struct inputdevice_functions *getidf (int devnum);
-
-static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf)
-{
- TCHAR tmp1[MAX_DPATH];
- int i;
-
- if (!write_config_head (f, idnum, devnum, name, id, idf))
- return;
-
- _stprintf (tmp1, L"%s.%d.axis.", name, devnum);
- for (i = 0; i < ID_AXIS_TOTAL; i++)
- write_config2 (f, idnum, i, ID_AXIS_OFFSET, tmp1, id);
- _stprintf (tmp1, L"%s.%d.button." ,name, devnum);
- for (i = 0; i < ID_BUTTON_TOTAL; i++)
- write_config2 (f, idnum, i, ID_BUTTON_OFFSET, tmp1, id);
-}
-
-static void kbrlabel (TCHAR *s)
-{
- while (*s) {
- *s = _totupper (*s);
- if (*s == ' ')
- *s = '_';
- s++;
- }
-}
-
static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae_input_device *kbr, struct inputdevice_functions *idf)
{
- TCHAR tmp1[200], tmp2[200], tmp3[200], tmp4[200], *p;
+ TCHAR tmp1[200], tmp2[200], tmp3[200], tmp4[200], tmp5[200], *p;
int i, j, k, evt, skip;
+ int slotorder1[] = { 0, 1, 2, 3 };
+ int slotorder2[] = { 4, 1, 2, 3 };
+ int *slotorder;
if (!keyboard_default)
return;
return;
i = 0;
- while (i < MAX_INPUT_DEVICE_EVENTS && kbr->extra[i][0] >= 0) {
+ while (i < MAX_INPUT_DEVICE_EVENTS && kbr->extra[i] >= 0) {
+
+ slotorder = slotorder1;
+ // if gameports non-custom mapping in slot0 -> save slot4 as slot0
+ if (kbr->port[i][0] && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM))
+ slotorder = slotorder2;
+
skip = 0;
k = 0;
while (keyboard_default[k].scancode >= 0) {
- if (keyboard_default[k].scancode == kbr->extra[i][0]) {
+ if (keyboard_default[k].scancode == kbr->extra[i]) {
skip = 1;
for (j = 1; j < MAX_INPUT_SUB_EVENT; j++) {
- if ((kbr->flags[i][j] & ID_FLAG_SAVE_MASK) != 0 || kbr->eventid[i][j] > 0)
+ if ((kbr->flags[i][slotorder[j]] & ID_FLAG_SAVE_MASK) != 0 || kbr->eventid[i][slotorder[j]] > 0)
skip = 0;
}
- if (keyboard_default[k].evt != kbr->eventid[i][0] || keyboard_default[k].flags != (kbr->flags[i][0] & ID_FLAG_SAVE_MASK))
+ if (keyboard_default[k].evt != kbr->eventid[i][slotorder[0]] || keyboard_default[k].flags != (kbr->flags[i][slotorder[0]] & ID_FLAG_SAVE_MASK))
skip = 0;
break;
}
k++;
}
- if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM))
+ bool isdefaultspare =
+ kbr->port[i][SPARE_SUB_EVENT] &&
+ keyboard_default[k].evt == kbr->eventid[i][SPARE_SUB_EVENT] && keyboard_default[k].flags == (kbr->flags[i][SPARE_SUB_EVENT] & ID_FLAG_SAVE_MASK);
+
+ if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM) && (kbr->port[i][SPARE_SUB_EVENT] == 0 || isdefaultspare))
skip = 1;
if (kbr->eventid[i][0] == 0 && (kbr->flags[i][0] & ID_FLAG_SAVE_MASK) == 0 && keyboard_default[k].scancode < 0)
skip = 1;
p = tmp2;
p[0] = 0;
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
- TCHAR *custom = kbr->custom[i][j];
- evt = kbr->eventid[i][j];
+ TCHAR *custom = kbr->custom[i][slotorder[j]];
+ evt = kbr->eventid[i][slotorder[j]];
if (custom == NULL && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if (kbr->eventid[i][k] > 0 || kbr->custom[i][k] != NULL)
+ if (kbr->eventid[i][slotorder[k]] > 0 || kbr->custom[i][slotorder[k]] != NULL)
break;
}
if (k == MAX_INPUT_SUB_EVENT)
*p++ = ',';
*p = 0;
}
- bool ok = false;
- if (custom && _tcslen (custom) > 0) {
- _stprintf (p, L"'%s'.%d", custom, kbr->flags[i][j] & ID_FLAG_SAVE_MASK);
- ok = true;
- } else if (evt > 0) {
- _stprintf (p, L"%s.%d", events[evt].confname, kbr->flags[i][j] & ID_FLAG_SAVE_MASK);
- ok = true;
- } else {
- _tcscat (p, L"NULL");
- }
- p += _tcslen(p);
+ bool ok = write_slot (p, kbr, i, slotorder[j]);
+ p += _tcslen (p);
if (ok) {
- if (kbr->port[i][j] > 0) {
- _stprintf (p, L".%d", kbr->port[i][j] - 1);
+ // save port number + SPARE SLOT if needed
+ if (kbr->port[i][slotorder[j]] > 0 && (kbr->flags[i][slotorder[j]] & ID_FLAG_GAMEPORTSCUSTOM)) {
+ _stprintf (p, L".%d", kbr->port[i][slotorder[j]] - 1);
p += _tcslen (p);
+ if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && kbr->port[i][SPARE_SUB_EVENT] && !isdefaultspare && slotorder == slotorder1) {
+ *p++ = '.';
+ write_slot (p, kbr, i, SPARE_SUB_EVENT);
+ p += _tcslen (p);
+ }
}
}
}
- _stprintf (tmp3, L"%d", kbr->extra[i][0]);
+ idf->get_widget_type (devnum, i, tmp5, NULL);
+ p = tmp5 + _tcslen (tmp5) + 1;
+ _stprintf (tmp3, L"%d%s%s", kbr->extra[i], p[0] ? L"." : L"", p[0] ? p : L"");
kbrlabel (tmp3);
_stprintf (tmp1, L"keyboard.%d.button.%s", devnum, tmp3);
_stprintf (tmp4, L"input.%d.%s", idnum + 1, tmp1);
}
}
+static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf)
+{
+ TCHAR tmp1[MAX_DPATH];
+ int i;
+
+ if (!write_config_head (f, idnum, devnum, name, id, idf))
+ return;
+
+ _stprintf (tmp1, L"%s.%d.axis.", name, devnum);
+ for (i = 0; i < ID_AXIS_TOTAL; i++)
+ write_config2 (f, idnum, i, ID_AXIS_OFFSET, tmp1, id);
+ _stprintf (tmp1, L"%s.%d.button." ,name, devnum);
+ for (i = 0; i < ID_BUTTON_TOTAL; i++)
+ write_config2 (f, idnum, i, ID_BUTTON_OFFSET, tmp1, id);
+}
+
void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
{
int i, id;
if (*p == 0)
return 0;
i = 0;
- while (*p != 0 && *p !='.' && *p != ',')
+ while (*p != 0 && *p !='.' && *p != ',' && i < 1000 - 1)
str[i++] = *p++;
if (*p == '.' || *p == ',')
p++;
static void set_kbr_default_event (struct uae_input_device *kbr, struct uae_input_device_kbr_default *trans, int num)
{
for (int i = 0; trans[i].scancode >= 0; i++) {
- if (kbr->extra[num][0] == trans[i].scancode) {
+ if (kbr->extra[num] == trans[i].scancode) {
int k;
for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {
if (kbr->eventid[num][k] == 0)
kbr = &p->keyboard_settings[index][j];
for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
memset (kbr, 0, sizeof (struct uae_input_device));
- kbr->extra[i][0] = -1;
+ kbr->extra[i] = -1;
}
if (j < id->get_num ()) {
if (input_get_default_keyboard (j))
kbr->enabled = 1;
for (i = 0; i < id->get_widget_num (j); i++) {
id->get_widget_type (j, i, 0, &scancode);
- kbr->extra[i][0] = scancode;
+ kbr->extra[i] = scancode;
set_kbr_default_event (kbr, trans, i);
}
}
id->name = n;
}
+
+static bool readslot (TCHAR *parm, int num, int joystick, int button, struct uae_input_device *id, int keynum, int subnum, struct inputevent *ie, int flags, int port, TCHAR *custom)
+{
+ int mask;
+
+ if (custom == NULL && ie->name == NULL) {
+ if (!_tcscmp (parm, L"NULL")) {
+ if (joystick < 0) {
+ id->eventid[keynum][subnum] = 0;
+ id->flags[keynum][subnum] = 0;
+ } else if (button) {
+ id->eventid[num + ID_BUTTON_OFFSET][subnum] = 0;
+ id->flags[num + ID_BUTTON_OFFSET][subnum] = 0;
+ } else {
+ id->eventid[num + ID_AXIS_OFFSET][subnum] = 0;
+ id->flags[num + ID_AXIS_OFFSET][subnum] = 0;
+ }
+ }
+ return false;
+ }
+ if (joystick < 0) {
+ if (!(ie->allow_mask & AM_K))
+ return false;
+ id->eventid[keynum][subnum] = ie - events;
+ id->flags[keynum][subnum] = flags;
+ id->port[keynum][subnum] = port;
+ xfree (id->custom[keynum][subnum]);
+ id->custom[keynum][subnum] = custom;
+ } else if (button) {
+ if (joystick)
+ mask = AM_JOY_BUT;
+ else
+ mask = AM_MOUSE_BUT;
+ if (!(ie->allow_mask & mask))
+ return false;
+ id->eventid[num + ID_BUTTON_OFFSET][subnum] = ie - events;
+ id->flags[num + ID_BUTTON_OFFSET][subnum] = flags;
+ id->port[num + ID_BUTTON_OFFSET][subnum] = port;
+ xfree (id->custom[num + ID_BUTTON_OFFSET][subnum]);
+ id->custom[num + ID_BUTTON_OFFSET][subnum] = custom;
+ } else {
+ if (joystick)
+ mask = AM_JOY_AXIS;
+ else
+ mask = AM_MOUSE_AXIS;
+ if (!(ie->allow_mask & mask))
+ return false;
+ id->eventid[num + ID_AXIS_OFFSET][subnum] = ie - events;
+ id->flags[num + ID_AXIS_OFFSET][subnum] = flags;
+ id->port[num + ID_AXIS_OFFSET][subnum] = port;
+ xfree (id->custom[num + ID_AXIS_OFFSET][subnum]);
+ id->custom[num + ID_AXIS_OFFSET][subnum] = custom;
+ }
+ return true;
+}
+
+static struct inputevent *readevent (TCHAR *name, TCHAR **customp)
+{
+ int i = 1;
+ while (events[i].name) {
+ if (!_tcscmp (events[i].confname, name))
+ return &events[i];
+ i++;
+ }
+ if (_tcslen (name) > 2 && name[0] == '\'' && name[_tcslen (name) - 1] == '\'') {
+ TCHAR *custom = my_strdup (name + 1);
+ custom[_tcslen (custom) - 1] = 0;
+ *customp = custom;
+ }
+ return &events[0];
+}
+
void read_inputdevice_config (struct uae_prefs *pr, TCHAR *option, TCHAR *value)
{
struct uae_input_device *id = 0;
struct inputevent *ie;
- int devnum, num, button, joystick, flags, port, i, subnum, idnum, keynum;
- int mask;
+ int devnum, num, button, joystick, subnum, idnum, keynum;
TCHAR *p, *p2, *custom;
option += 6; /* "input." */
if (idnum == GAMEPORT_INPUT_SETTINGS && id->enabled == 0)
return;
+ button = 0;
+ keynum = 0;
if (joystick < 0) {
num = getnum (&p);
for (keynum = 0; keynum < MAX_INPUT_DEVICE_EVENTS; keynum++) {
- if (id->extra[keynum][0] == num)
+ if (id->extra[keynum] == num)
break;
}
if (keynum >= MAX_INPUT_DEVICE_EVENTS)
custom = NULL;
for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) {
+ int flags, port;
xfree (custom);
custom = NULL;
p2 = getstring (&p);
if (!p2)
break;
- i = 1;
- while (events[i].name) {
- if (!_tcscmp (events[i].confname, p2))
- break;
- i++;
- }
- ie = &events[i];
- if (!ie->name) {
- ie = &events[0];
- if (_tcslen (p2) > 2 && p2[0] == '\'' && p2[_tcslen (p2) - 1] == '\'') {
- custom = my_strdup (p2 + 1);
- custom[_tcslen (custom) - 1] = 0;
- }
- }
+ ie = readevent (p2, &custom);
flags = 0;
port = 0;
if (p[-1] == '.')
if (p[-1] == '.') {
port = getnum (&p) + 1;
}
+ if (idnum == GAMEPORT_INPUT_SETTINGS && port == 0)
+ continue;
+ if (p[-1] == '.' && idnum != GAMEPORT_INPUT_SETTINGS) {
+ p2 = getstring (&p);
+ if (p2) {
+ int flags2 = 0;
+ if (p[-1] == '.')
+ flags2 = getnum (&p);
+ TCHAR *custom2 = NULL;
+ struct inputevent *ie2 = readevent (p2, &custom2);
+ readslot (p2, num, joystick, button, id, keynum, SPARE_SUB_EVENT, ie2, flags2, MAX_JPORTS + 1, custom2);
+ }
+ }
+
while (*p != 0) {
if (p[-1] == ',')
break;
p++;
}
-
- if (custom == NULL && ie->name == NULL) {
- if (!_tcscmp(p2, L"NULL")) {
- if (joystick < 0) {
- id->eventid[keynum][subnum] = 0;
- id->flags[keynum][subnum] = 0;
- } else if (button) {
- id->eventid[num + ID_BUTTON_OFFSET][subnum] = 0;
- id->flags[num + ID_BUTTON_OFFSET][subnum] = 0;
- } else {
- id->eventid[num + ID_AXIS_OFFSET][subnum] = 0;
- id->flags[num + ID_AXIS_OFFSET][subnum] = 0;
- }
- }
+ if (!readslot (p2, num, joystick, button, id, keynum, subnum, ie, flags, port, custom))
continue;
- }
- if (joystick < 0) {
- if (!(ie->allow_mask & AM_K))
- continue;
- id->eventid[keynum][subnum] = ie - events;
- id->flags[keynum][subnum] = flags;
- id->port[keynum][subnum] = port;
- xfree (id->custom[keynum][subnum]);
- id->custom[keynum][subnum] = custom;
- } else if (button) {
- if (joystick)
- mask = AM_JOY_BUT;
- else
- mask = AM_MOUSE_BUT;
- if (!(ie->allow_mask & mask))
- continue;
- id->eventid[num + ID_BUTTON_OFFSET][subnum] = ie - events;
- id->flags[num + ID_BUTTON_OFFSET][subnum] = flags;
- id->port[num + ID_BUTTON_OFFSET][subnum] = port;
- xfree (id->custom[num + ID_BUTTON_OFFSET][subnum]);
- id->custom[num + ID_BUTTON_OFFSET][subnum] = custom;
- } else {
- if (joystick)
- mask = AM_JOY_AXIS;
- else
- mask = AM_MOUSE_AXIS;
- if (!(ie->allow_mask & mask))
- continue;
- id->eventid[num + ID_AXIS_OFFSET][subnum] = ie - events;
- id->flags[num + ID_AXIS_OFFSET][subnum] = flags;
- id->port[num + ID_AXIS_OFFSET][subnum] = port;
- xfree (id->custom[num + ID_AXIS_OFFSET][subnum]);
- id->custom[num + ID_AXIS_OFFSET][subnum] = custom;
- }
custom = NULL;
}
xfree (custom);
use_keyboards[i] = 0;
if (keyboards[i].enabled && i < idev[IDTYPE_KEYBOARD].get_num()) {
j = 0;
- while (j < MAX_INPUT_DEVICE_EVENTS && keyboards[i].extra[j][0] >= 0) {
+ while (j < MAX_INPUT_DEVICE_EVENTS && keyboards[i].extra[j] >= 0) {
use_keyboards[i] = 1;
for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {
ei = keyboards[i].eventid[j][k];
ismouse (ei);
isdigitalbutton (ei);
if (ei > 0)
- scancodeused[i][keyboards[i].extra[j][k]] = ei;
+ scancodeused[i][keyboards[i].extra[j]] = ei;
}
j++;
}
while (kb[j] >= 0 && srcmap[k] >= 0) {
int id = kb[j];
for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
- if (uid->extra[l][0] == id) {
+ if (uid->extra[l] == id) {
avail++;
if (uid->eventid[l][0] == srcmap[k])
found++;
k++;
}
for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
- if (uid->extra[l][0] == id) {
+ if (uid->extra[l] == id) {
uid->eventid[l][0] = evt;
break;
}
}
}
+static void sparerestore (struct uae_input_device *uid, int num, int sub)
+{
+ uid->eventid[num][sub] = uid->eventid[num][SPARE_SUB_EVENT];
+ uid->flags[num][sub] = uid->flags[num][SPARE_SUB_EVENT];
+ uid->custom[num][sub] = uid->custom[num][SPARE_SUB_EVENT];
+ uid->eventid[num][SPARE_SUB_EVENT] = 0;
+ uid->flags[num][SPARE_SUB_EVENT] = 0;
+ uid->port[num][SPARE_SUB_EVENT] = 0;
+ uid->custom[num][SPARE_SUB_EVENT] = 0;
+}
+
+static void sparecopy (struct uae_input_device *uid, int num, int sub)
+{
+ uid->eventid[num][SPARE_SUB_EVENT] = uid->eventid[num][sub];
+ uid->flags[num][SPARE_SUB_EVENT] = uid->flags[num][sub];
+ uid->port[num][SPARE_SUB_EVENT] = MAX_JPORTS + 1;
+ xfree (uid->custom[num][SPARE_SUB_EVENT]);
+ uid->custom[num][SPARE_SUB_EVENT] = uid->custom[num][sub];
+ uid->custom[num][sub] = NULL;
+}
+
static void setcompakb (int *kb, int *srcmap, int index, int af)
{
int j, k;
for (int m = 0; m < MAX_INPUT_DEVICES; m++) {
struct uae_input_device *uid = &keyboards[m];
for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
- if (uid->extra[l][0] == id) {
+ if (uid->extra[l] == id) {
+ sparecopy (uid, l, 0);
uid->eventid[l][0] = srcmap[k];
uid->flags[l][0] = 0;
uid->port[l][0] = index + 1;
xfree (uid[num].custom[i][j]);
uid[num].custom[i][j] = NULL;
uid[num].port[i][j] = 0;
+ if (uid[num].port[i][SPARE_SUB_EVENT])
+ sparerestore (&uid[num], i, j);
}
}
}
xfree (uid[num].custom[i][j]);
uid[num].custom[i][j] = NULL;
uid[num].port[i][j] = 0;
- if (j == 0)
+ if (uid[num].port[i][SPARE_SUB_EVENT]) {
+ sparerestore (&uid[num], i, j);
+ } else if (j == 0) {
set_kbr_default_event (&uid[num], keyboard_default, i);
+ }
}
}
}
int sub = 0;
if (inputdevice_get_widget_type (devnum, num, NULL) != IDEV_WIDGET_KEY) {
for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
- if (!inputdevice_get_mapped_name (devnum, num, NULL, NULL, NULL, NULL, sub))
+ if (!inputdevice_get_mapping (devnum, num, NULL, NULL, NULL, NULL, sub))
break;
}
}
joysticks = prefs->joystick_settings[prefs->input_selected_setting];
mice = prefs->mouse_settings[prefs->input_selected_setting];
keyboards = prefs->keyboard_settings[prefs->input_selected_setting];
- if (prefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS)
+ if (prefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) {
+ int xflags, xport;
+ TCHAR xname[MAX_DPATH], xcustom[MAX_DPATH];
+ inputdevice_get_mapping (devnum, num, &xflags, &xport, xname, xcustom, 0);
+ if (xport == 0)
+ inputdevice_set_mapping (devnum, num, xname, xcustom, xflags, MAX_JPORTS + 1, SPARE_SUB_EVENT);
inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM, port + 1, 0);
+ }
return true;
}
if (!keyboards)
return -1;
- for (j = 0; na->extra[j][0]; j++) {
- if (na->extra[j][0] == INPUTEVENT_KEY_CAPS_LOCK) {
+ for (j = 0; na->extra[j]; j++) {
+ if (na->extra[j] == INPUTEVENT_KEY_CAPS_LOCK) {
for (i = 0; capstable[i]; i += 2) {
- if (na->extra[j][0] == capstable[i]) {
+ if (na->extra[j] == capstable[i]) {
if (oldcaps != capstable[i + 1]) {
oldcaps = capstable[i + 1];
inputdevice_translatekeycode (0, capstable[i], oldcaps ? -1 : 0);
if (!keyboards || scancode < 0)
return handled;
j = 0;
- while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j][0] >= 0) {
- if (na->extra[j][0] == scancode) {
+ while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) {
+ if (na->extra[j] == scancode) {
for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {/* send key release events in reverse order */
int autofire = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
int toggle = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_TOGGLE) ? 1 : 0;
}
// return mapped event from devnum/num/sub
-int inputdevice_get_mapped_name (int devnum, int num, int *pflags, int *pport, TCHAR *name, TCHAR *custom, int sub)
+int inputdevice_get_mapping (int devnum, int num, int *pflags, int *pport, TCHAR *name, TCHAR *custom, int sub)
{
const struct inputdevice_functions *idf = getidf (devnum);
const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
} else {
struct uae_input_device *na = &keyboards[num];
int j = 0;
- while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j][0] >= 0) {
- if (na->extra[j][0] == wnum) {
+ while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) {
+ if (na->extra[j] == wnum) {
wnum = j;
break;
}
j++;
}
- if (j >= MAX_INPUT_DEVICE_EVENTS || na->extra[j][0] < 0)
+ if (j >= MAX_INPUT_DEVICE_EVENTS || na->extra[j] < 0)
type = -1;
}
}
TCHAR *name;
TCHAR *sortname;
TCHAR *configname;
+ int vid, pid;
int connection;
LPDIRECTINPUTDEVICE8 lpdi;
}
-#define RDP_DEVICE1 L"\\??\\Root#RDP_"
-#define RDP_DEVICE2 L"\\\\?\\Root#RDP_"
+#define RDP_DEVICE1 L"\\??\\Root#"
+#define RDP_DEVICE2 L"\\\\?\\Root#"
static int rdpdevice(TCHAR *buf)
{
if (_tcslen (tmp2) >= _tcslen (tmp) && !_tcsncmp (tmp2, tmp, _tcslen (tmp))) {
xfree (did->name);
xfree (did->sortname);
- did->name = my_strdup (friendlyname);
- did->sortname = my_strdup (friendlyname);
+ if (did->vid > 0 && did->pid > 0)
+ _stprintf (tmp, L"%s [%04X/%04X]", friendlyname, did->vid, did->pid);
+ else
+ _stprintf (tmp, L"%s", friendlyname);
+ did->name = my_strdup (tmp);
+ did->sortname = my_strdup (tmp);
write_log (L"'%s' ('%s')\n", did->name, did->configname);
}
}
L""
};
+static void getvidpid2 (TCHAR *devname, int *id, TCHAR *str)
+{
+ TCHAR *s = _tcsstr (devname, str);
+ if (!s)
+ return;
+ int val = -1;
+ _stscanf (s + _tcslen (str), L"%X", &val);
+ *id = val;
+}
+
+static void getvidpid (TCHAR *devname, int *vid, int *pid)
+{
+ *vid = *pid = -1;
+ getvidpid2 (devname, vid, L"VID_");
+ getvidpid2 (devname, pid, L"PID_");
+}
+
static int initialize_rawinput (void)
{
RAWINPUTDEVICELIST *ridl = 0;
rnum_raw++;
cleardid (did);
- _stprintf (tmp, L"%s", type == RIM_TYPEMOUSE ? L"RAW Mouse" : L"RAW Keyboard");
+ getvidpid (buf, &did->vid, &did->pid);
+ if (did->vid > 0 && did->pid > 0)
+ _stprintf (tmp, L"%s (%04X/%04X)", type == RIM_TYPEMOUSE ? L"RAW Mouse" : L"RAW Keyboard", did->vid, did->pid);
+ else
+ _stprintf (tmp, L"%s", type == RIM_TYPEMOUSE ? L"RAW Mouse" : L"RAW Keyboard");
did->name = my_strdup (tmp);
did->rawinput = h;
did->connection = DIDC_RAW;
static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code)
{
- if (name)
+ if (name) {
_stprintf (name, L"[%02X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]);
+ name += _tcslen (name) + 1;
+ _tcscpy (name, di_keyboard[kb].buttonname[num]);
+ }
if (code)
*code = di_keyboard[kb].buttonmappings[num];
return IDEV_WIDGET_KEY;
static void setid (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt)
{
+ // wrong place!
+ uid->eventid[slot][SPARE_SUB_EVENT] = uid->eventid[slot][sub];
+ uid->flags[slot][SPARE_SUB_EVENT] = uid->flags[slot][sub];
+ uid->port[slot][SPARE_SUB_EVENT] = MAX_JPORTS + 1;
+ xfree (uid->custom[slot][SPARE_SUB_EVENT]);
+ uid->custom[slot][SPARE_SUB_EVENT] = uid->custom[slot][sub];
+ uid->custom[slot][sub] = NULL;
+
uid[i].eventid[slot][sub] = evt;
uid[i].port[slot][sub] = port + 1;
}
#if defined (D3D) && defined (GFXFILTER)
#define EFFECT_VERSION 2
+#define D3DX9DLL L"d3dx9_43.dll"
#include "options.h"
#include "xwin.h"
if (d3d_yesno > 0)
return 1;
d3d_yesno = -1;
- h = LoadLibrary (L"d3dx9_42.dll");
+ h = LoadLibrary (D3DX9DLL);
if (h != NULL) {
FreeLibrary (h);
d3dx = Direct3DCreate9 (D3D_SDK_VERSION);
return errmsg;
}
- d3dx = LoadLibrary (L"d3dx9_42.dll");
+ d3dx = LoadLibrary (D3DX9DLL);
if (d3dx == NULL) {
- _tcscpy (errmsg, L"Direct3D: August 2009 or newer DirectX Runtime required.\n\nhttp://go.microsoft.com/fwlink/?linkid=56513");
+ _tcscpy (errmsg, L"Direct3D: June 2010 or newer DirectX Runtime required.\n\nhttp://go.microsoft.com/fwlink/?linkid=56513");
if (isfullscreen () <= 0)
ShellExecute(NULL, L"open", L"http://go.microsoft.com/fwlink/?linkid=56513", NULL, NULL, SW_SHOWNORMAL);
return errmsg;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, L"z3")) {
- shmaddr=natmem_offset + currprefs.z3fastmem_start;
+ shmaddr=natmem_offset + z3fastmem_start;
if (!currprefs.z3fastmem2_size)
size += BARRIER;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, L"z3_2")) {
- shmaddr=natmem_offset + currprefs.z3fastmem_start + currprefs.z3fastmem_size;
+ shmaddr=natmem_offset + z3fastmem_start + currprefs.z3fastmem_size;
size += BARRIER;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, L"z3_chip")) {
- uae_u32 l = currprefs.z3fastmem_start + currprefs.z3fastmem_size + currprefs.z3fastmem2_size;
- if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size)
- l += 16 * 1024 * 1024;
- shmaddr=natmem_offset + l;
+ shmaddr=natmem_offset + z3chipmem_start;
size += BARRIER;
got = TRUE;
}
RTEXT "Chip:",IDC_STATIC,19,25,32,15,SS_CENTERIMAGE\r
RTEXT "Slow:",IDC_STATIC,144,25,32,15,SS_CENTERIMAGE\r
RTEXT "Z3 Fast:",IDC_STATIC,144,49,32,15,SS_CENTERIMAGE\r
- RTEXT "Z3 Chip:",IDC_STATIC,123,73,54,15,SS_CENTERIMAGE\r
+ RTEXT "32-bit Chip:",IDC_STATIC,99,73,78,15,SS_CENTERIMAGE\r
CONTROL "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,71,60,20\r
EDITTEXT IDC_Z3CHIPRAM,243,76,34,12,ES_CENTER | ES_READONLY\r
END\r
FONT 8, "MS Sans Serif", 0, 0, 0x1\r
BEGIN\r
CONTROL "List1",IDC_INPUTLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,22,290,146\r
- COMBOBOX IDC_INPUTTYPE,5,5,98,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
- COMBOBOX IDC_INPUTDEVICE,109,5,167,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+ COMBOBOX IDC_INPUTTYPE,5,5,77,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+ COMBOBOX IDC_INPUTDEVICE,87,5,190,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
CONTROL "",IDC_INPUTDEVICEDISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,282,8,9,8\r
COMBOBOX IDC_INPUTAMIGACNT,5,174,24,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
COMBOBOX IDC_INPUTAMIGA,33,174,202,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"7"
-#define WINUAEDATE MAKEBD(2010, 6, 6)
+#define WINUAEBETA L"8"
+#define WINUAEDATE MAKEBD(2010, 6, 9)
#define WINUAEEXTRA L""
#define WINUAEREV L""
#define USS_FORMAT_STRING_SAVE L"(*.uss)\0*.uss\0"
#define HDF_FORMAT_STRING L"(*.hdf;*.vhd;*.rdf;*.hdz;*.rdz)\0*.hdf;*.vhd;*.rdf;*.hdz;*.rdz\0"
#define INP_FORMAT_STRING L"(*.inp)\0*.inp\0"
-#define CD_FORMAT_STRING L"(*.cue;*.iso)\0*.cue;*.iso\0"
+#define CD_FORMAT_STRING L"(*.cue;*.iso)\0*.cue;*.iso;" ARCHIVE_STRING L"\0"
#define CONFIG_HOST L"Host"
#define CONFIG_HARDWARE L"Hardware"
TCHAR custom[MAX_DPATH];
TCHAR af[32], toggle[32];
- inputdevice_get_mapped_name (input_selected_device, index, &flags, &port, name, custom, input_selected_sub_num);
+ inputdevice_get_mapping (input_selected_device, index, &flags, &port, name, custom, input_selected_sub_num);
if (flags & IDEV_MAPPED_AUTOFIRE_SET)
WIN32GUI_LoadUIString (IDS_YES, af, sizeof af / sizeof (TCHAR));
else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
ListView_SetItemText (list, index, 3, toggle);
sub = 0;
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
- if (inputdevice_get_mapped_name (input_selected_device, index, &flags, NULL, name, custom, i) || custom[0])
+ if (inputdevice_get_mapping (input_selected_device, index, &flags, NULL, name, custom, i) || custom[0])
sub++;
}
_stprintf (name, L"%d", sub);
for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) {
for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
int port;
- if (inputdevice_get_mapped_name (devnum, j, &flags, &port, NULL, NULL, sub) == evtnum) {
+ if (inputdevice_get_mapping (devnum, j, &flags, &port, NULL, NULL, sub) == evtnum) {
if (!port)
continue;
inputdevice_get_widget_type (devnum, j, name);
SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_ADDSTRING, 0, (LPARAM)tmp1);
index = 0; af = 0; port = 0;
if (input_selected_widget >= 0) {
- inputdevice_get_mapped_name (input_selected_device, input_selected_widget, NULL, &port, name1, custom1, input_selected_sub_num);
+ inputdevice_get_mapping (input_selected_device, input_selected_widget, NULL, &port, name1, custom1, input_selected_sub_num);
cnt = 2;
while(inputdevice_iterate (input_selected_device, input_selected_widget, name2, &aftmp)) {
xfree (eventnames[cnt]);
TCHAR custom1[MAX_DPATH];
int flags;
custom1[0] = 0;
- inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ inputdevice_get_mapping (input_selected_device, input_selected_widget,
&flags, NULL, NULL, custom1, input_selected_sub_num);
if (_tcslen (custom1) > 0 || newcustom) {
if (askinputcustom (hDlg, custom1, sizeof custom1 / sizeof (TCHAR), IDS_SB_CUSTOMEVENT)) {
int flags;
TCHAR custom[MAX_DPATH];
custom[0] = 0;
- inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ inputdevice_get_mapping (input_selected_device, input_selected_widget,
&flags, NULL, 0, custom, input_selected_sub_num);
if (input_selected_event != 1)
custom[0] = 0;
TCHAR custom[MAX_DPATH];
if (input_selected_device < 0 || input_selected_widget < 0)
return;
- evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ evt = inputdevice_get_mapping (input_selected_device, input_selected_widget,
&flags, NULL, name, custom, input_selected_sub_num);
if (evt <= 0)
return;
TCHAR custom[MAX_DPATH];
if (input_selected_device < 0 || input_selected_widget < 0)
return;
- evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ evt = inputdevice_get_mapping (input_selected_device, input_selected_widget,
&flags, NULL, name, custom, input_selected_sub_num);
if (evt <= 0)
return;
<OutputFile>d:\amiga\winuae.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
- <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Debug/winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
- <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Release/winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
- <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\FullRelease/winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
+Beta 8:
+
+- Z3Chip is not a Z3 board anymore, now also compatible with KS 1.x (32-bit addressing
+ capable CPU required)
+- rawkeyboard RIDEV_NOHOTKEYS flag was missing (Disables Windows keys etc..)
+- GamePorts remap/test GUI updated
+- GamePorts remap when in Configuration#x mode didn't update GamePorts input mappings
+- data in GamePorts overwritten Configuration#x slot 1 is stored in hidden slot 5, also
+ saved to configuration when needed (not backwards compatible with old versions). Now
+ you can load old configurations in Configuration#x mode, set GamePorts to <none> without
+ losing original input configuration data in slot 1.
+- added key label to keyboard configuration data, not used for anything yet (compatible with
+ old versions, old versions simply ignore it)
+- added supported archive extensions to CD image dialog's file type list
+- DX SDK updated (June 2010), d3dx9_xx.dll version bump -> DX runtime update required...
+- added stupid looking vid and pid values to rawinput keyboards and mice, makes it possible
+ to distinguish multiple mouse or keyboard.. (instead of "HID Keyboard Device [n]" x N that
+ change position if you remove or add any keyboard-like device, including bar code readers)
+
+Important: if you have configurations with Configuration#1-3 set, please do following tests:
+(There is no way I can test all possible combinations)
+
+Test 1: Load configuration file, set both mouse and joystick port to <none>. Check that all
+mappings are still 100% correct. NOTE: remember that Keyboard* and Mouse* are gone if you have
+rawinput compatible mouse and keyboard (most likely). Keyboard or mouse mappings disappearing
+due to this rawinput change is not a bug.
+
+Test 2: Play with Game Ports mouse and joystick settings, add random custom mappings, whatever
+(You can keep checking Input panel if you want) and then set them back to <none>. Mappings
+should still be 100% exact same as when configuration was originally loaded.
+
+Test failed -> email or attach original configuration and include short problem description.
+(what test phase, what you did, what happened)
+
Beta 7:
- do not center horizontally if there is no bitplanes enabled (result was very badly aligned
- joystick button pullups removed, this will break some games' second joystick button read routines
but it has to be done because they wouldn't work on real Amigas with standard joystick either and
this workaround also breaks some other games that don't expect pullups (Dick Tracy for example)
- Pullups are automatically enabled if joystick 3rd button is mapped.
- another big input change, Game Ports settings are now always merged with currently selected
input configuration (possibly overwriting event that was manually configured in slot 0)
(it was made when there was no "is drive mounted in Windows" test) This parameter has
also become THE FIX for every, even totally unrelated possible, HD/CF related problem...
- toggle between fullwindow and fullscreen if started in fullwindow mode
-- fixed data coruption in input parsing if mapped key did not exist (different keyboard)
+- fixed data corruption in input parsing if mapped key did not exist (different keyboard)
- transparent archive support updates and handle leak fix
- small filter panel GUI changes
- single/double/triple buffering option added to Display panel, also affects D3D now mode now