static const TCHAR *autoscale_rtg[] = { _T("resize"), _T("scale"), _T("center"), _T("integer"), 0 };
static const TCHAR *autoscalelimit[] = { _T("1/1"), _T("1/2"), _T("1/4"), _T("1/8"), 0 };
static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), 0 };
+static const TCHAR *joyportsubmodes_lightpen[] = { _T(""), _T("trojan"), 0 };
static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), _T("always"), 0 };
static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), 0 };
static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), 0 };
if (i < 2 && jp->mode > 0) {
_stprintf (tmp1, _T("joyport%dmode"), i);
cfgfile_write (f, tmp1, joyportmodes[jp->mode]);
+ if (jp->submode > 0 && jp->mode == 8) {
+ _stprintf(tmp1, _T("joyport%dsubmode"), i);
+ cfgfile_write(f, tmp1, joyportsubmodes_lightpen[jp->submode]);
+ }
}
if (jp->idc.name[0]) {
_stprintf (tmp1, _T("joyportfriendlyname%d"), i);
return 1;
if (_tcscmp (option, _T("joyportfriendlyname0")) == 0 || _tcscmp (option, _T("joyportfriendlyname1")) == 0) {
- inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, 2);
+ inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, -1, 2);
return 1;
}
if (_tcscmp (option, _T("joyportfriendlyname2")) == 0 || _tcscmp (option, _T("joyportfriendlyname3")) == 0) {
- inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, 2);
+ inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, -1, 2);
return 1;
}
if (_tcscmp (option, _T("joyportname0")) == 0 || _tcscmp (option, _T("joyportname1")) == 0) {
- inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname0")) == 0 ? 0 : 1, -1, 1);
+ inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname0")) == 0 ? 0 : 1, -1, -1, 1);
return 1;
}
if (_tcscmp (option, _T("joyportname2")) == 0 || _tcscmp (option, _T("joyportname3")) == 0) {
- inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname2")) == 0 ? 2 : 3, -1, 1);
+ inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname2")) == 0 ? 2 : 3, -1, -1, 1);
return 1;
}
if (_tcscmp (option, _T("joyport0")) == 0 || _tcscmp (option, _T("joyport1")) == 0) {
int port = _tcscmp (option, _T("joyport0")) == 0 ? 0 : 1;
- inputdevice_joyport_config_store(p, _T(""), port, -1, 1);
- inputdevice_joyport_config_store(p, _T(""), port, -1, 2);
- inputdevice_joyport_config_store(p, value, port, -1, 0);
+ inputdevice_joyport_config_store(p, _T(""), port, -1, -1, 1);
+ inputdevice_joyport_config_store(p, _T(""), port, -1, -1, 2);
+ inputdevice_joyport_config_store(p, value, port, -1, -1, 0);
return 1;
}
if (_tcscmp (option, _T("joyport2")) == 0 || _tcscmp (option, _T("joyport3")) == 0) {
int port = _tcscmp (option, _T("joyport2")) == 0 ? 2 : 3;
- inputdevice_joyport_config_store(p, _T(""), port, -1, 1);
- inputdevice_joyport_config_store(p, _T(""), port, -1, 2);
- inputdevice_joyport_config_store(p, value, port, -1, 0);
+ inputdevice_joyport_config_store(p, _T(""), port, -1, -1, 1);
+ inputdevice_joyport_config_store(p, _T(""), port, -1, -1, 2);
+ inputdevice_joyport_config_store(p, value, port, -1, -1, 0);
return 1;
}
- if (cfgfile_strval (option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0))
+ if (cfgfile_strval(option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0))
+ return 1;
+ if (cfgfile_strval(option, value, _T("joyport1mode"), &p->jports[1].mode, joyportmodes, 0))
+ return 1;
+ if (cfgfile_strval(option, value, _T("joyport2mode"), &p->jports[2].mode, joyportmodes, 0))
+ return 1;
+ if (cfgfile_strval(option, value, _T("joyport3mode"), &p->jports[3].mode, joyportmodes, 0))
+ return 1;
+ if (cfgfile_strval(option, value, _T("joyport0submode"), &p->jports[0].submode, joyportsubmodes_lightpen, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport1mode"), &p->jports[1].mode, joyportmodes, 0))
+ if (cfgfile_strval(option, value, _T("joyport1submode"), &p->jports[1].submode, joyportsubmodes_lightpen, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport2mode"), &p->jports[2].mode, joyportmodes, 0))
+ if (cfgfile_strval(option, value, _T("joyport2submode"), &p->jports[2].submode, joyportsubmodes_lightpen, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport3mode"), &p->jports[3].mode, joyportmodes, 0))
+ if (cfgfile_strval(option, value, _T("joyport3submode"), &p->jports[3].submode, joyportsubmodes_lightpen, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport0autofire"), &p->jports[0].autofire, joyaf, 0))
+ if (cfgfile_strval(option, value, _T("joyport0autofire"), &p->jports[0].autofire, joyaf, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport1autofire"), &p->jports[1].autofire, joyaf, 0))
+ if (cfgfile_strval(option, value, _T("joyport1autofire"), &p->jports[1].autofire, joyaf, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport2autofire"), &p->jports[2].autofire, joyaf, 0))
+ if (cfgfile_strval(option, value, _T("joyport2autofire"), &p->jports[2].autofire, joyaf, 0))
return 1;
- if (cfgfile_strval (option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0))
+ if (cfgfile_strval(option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0))
return 1;
if (cfgfile_yesno (option, value, _T("joyport0keyboardoverride"), &vb)) {
p->jports[2].id = -1;
p->jports[3].id = -1;
if (reset) {
- inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, 0);
- inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, 0);
+ inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, -1, 0);
+ inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, -1, 0);
}
p->keyboard_lang = KBD_LANG_US;
p->keyboard_connected = true;
extern int send_input_event (int nr, int state, int max, int autofire);
extern int input_get_default_mouse (struct uae_input_device *uid, int num, int port, int af, bool gp, bool wheel, bool joymouseswap);
-extern int input_get_default_lightpen (struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap);
+extern int input_get_default_lightpen (struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap, int submode);
extern int input_get_default_joystick (struct uae_input_device *uid, int num, int port, int af, int mode, bool gp, bool joymouseswap);
extern int input_get_default_joystick_analog (struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap);
extern int input_get_default_keyboard (int num);
extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f);
extern void read_inputdevice_config (struct uae_prefs *p, const TCHAR *option, TCHAR *value);
extern void reset_inputdevice_config (struct uae_prefs *pr, bool reset);
-extern int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int type, bool candefault);
-extern void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type);
+extern int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int submode, int type, bool candefault);
+extern void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int submode, int type);
extern int inputdevice_getjoyportdevice (int port, int val);
extern void inputdevice_validate_jports (struct uae_prefs *p, int changedport, bool *fixedports);
extern void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig);
struct jport {
int id;
int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen
+ int submode;
int autofire;
struct inputdevconfig idc;
bool nokeyboardoverride;
// fire/left mouse button pullup resistors enabled?
static bool mouse_pullup = true;
-static int joymodes[MAX_JPORTS];
+static int joymodes[MAX_JPORTS], joysubmodes[MAX_JPORTS];
static const int *joyinputs[MAX_JPORTS];
static int input_acquired;
memcpy(&dst->jports[num].idc, &src->jports[num].idc, sizeof(struct inputdevconfig));
dst->jports[num].id = src->jports[num].id;
dst->jports[num].mode = src->jports[num].mode;
+ dst->jports[num].submode = src->jports[num].submode;
dst->jports[num].autofire = src->jports[num].autofire;
dst->jports[num].nokeyboardoverride = src->jports[num].nokeyboardoverride;
}
if (!_tcscmp(jp->idc.name, idc->name) && !_tcscmp(jp->idc.configname, idc->configname)) {
write_log(_T("On the fly unplugged stored, port %d '%s' (%s)\n"), i, jpt.idc.name, jpt.idc.configname);
jpt.mode = jp->mode;
+ jpt.submode = jp->submode;
jpt.autofire = jp->autofire;
inputdevice_store_used_device(&jpt, i, false);
}
for (int i = 0; i < MAX_JPORTS; i++) {
if (currprefs.jports[i].id != changed_prefs.jports[i].id ||
currprefs.jports[i].mode != changed_prefs.jports[i].mode ||
+ currprefs.jports[i].submode != changed_prefs.jports[i].submode ||
_tcscmp(currprefs.jports_custom[i].custom, changed_prefs.jports_custom[i].custom))
changed = true;
}
if (newslot >= 0) {
TCHAR cust[100];
_stprintf(cust, _T("custom%d"), newslot);
- inputdevice_joyport_config(&changed_prefs, cust, cust, newport, -1, 0, true);
+ inputdevice_joyport_config(&changed_prefs, cust, cust, newport, -1, -1, 0, true);
} else {
- inputdevice_joyport_config (&changed_prefs, name, name, newport, -1, 1, true);
+ inputdevice_joyport_config(&changed_prefs, name, name, newport, -1, -1, 1, true);
}
inputdevice_validate_jports (&changed_prefs, -1, NULL);
inputdevice_copyconfig (&changed_prefs, &currprefs);
INPUTEVENT_SPC_ARCADIA_COIN1, INPUTEVENT_SPC_ARCADIA_COIN2,
-1
};
+static const int ip_analog1[] = {
+ INPUTEVENT_JOY1_HORIZ_POT, INPUTEVENT_JOY1_VERT_POT, INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT,
+ -1
+};
+static const int ip_analog2[] = {
+ INPUTEVENT_JOY2_HORIZ_POT, INPUTEVENT_JOY2_VERT_POT, INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT,
+ -1
+};
+
static const int ip_lightpen1[] = {
INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY1_3RD_BUTTON,
-1
INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY2_3RD_BUTTON,
-1
};
-static const int ip_analog1[] = {
- INPUTEVENT_JOY1_HORIZ_POT, INPUTEVENT_JOY1_VERT_POT, INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT,
+static const int ip_lightpen1_trojan[] = {
+ INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY1_LEFT,
-1
};
-static const int ip_analog2[] = {
- INPUTEVENT_JOY2_HORIZ_POT, INPUTEVENT_JOY2_VERT_POT, INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT,
+static const int ip_lightpen2_trojan[] = {
+ INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY2_LEFT,
-1
};
+
static const int ip_arcadiaxa[] = {
-1
};
}
}
+static const int *getlightpen(int port, int submode)
+{
+ switch (submode)
+ {
+ case 1:
+ return port ? ip_lightpen2_trojan : ip_lightpen1_trojan;
+ default:
+ return port ? ip_lightpen2 : ip_lightpen1;
+ }
+}
+
static void setjoyinputs (struct uae_prefs *prefs, int port)
{
joyinputs[port] = NULL;
joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
break;
case JSEM_MODE_LIGHTPEN:
- joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1;
+ joyinputs[port] = getlightpen(port, joysubmodes[port]);
+ break;
break;
case JSEM_MODE_MOUSE_CDTV:
joyinputs[port] = ip_mousecdtv;
for (i = 0; i < MAX_JPORTS; i++) {
joymodes[i] = prefs->jports[i].mode;
+ joysubmodes[i] = prefs->jports[i].submode;
joyinputs[i] = NULL;
// remove all mappings from this port
if (gameports)
break;
case JSEM_MODE_LIGHTPEN:
joymodes[i] = JSEM_MODE_LIGHTPEN;
- joyinputs[i] = i ? ip_lightpen2 : ip_lightpen1;
+ joyinputs[i] = getlightpen(i, joysubmodes[i]);
break;
case JSEM_MODE_MOUSE_CDTV:
joymodes[i] = JSEM_MODE_MOUSE_CDTV;
break;
case JSEM_MODE_LIGHTPEN:
joymodes[i] = JSEM_MODE_LIGHTPEN;
- joyinputs[i] = i ? ip_lightpen2 : ip_lightpen1;
+ joyinputs[i] = getlightpen(i, joysubmodes[i]);
break;
case JSEM_MODE_MOUSE_CDTV:
joymodes[i] = JSEM_MODE_MOUSE_CDTV;
int af = prefs->jports[i].autofire;
if (prefs->jports[i].id >= 0) {
int mode = prefs->jports[i].mode;
+ int submode = prefs->jports[i].submode;
if ((joy = jsem_ismouse (i, prefs)) >= 0) {
if (gameports)
cleardev (mice, joy);
joymodes[i] = JSEM_MODE_WHEELMOUSE;
break;
case JSEM_MODE_LIGHTPEN:
- input_get_default_lightpen (mice, joy, i, af, !gameports, false);
+ input_get_default_lightpen (mice, joy, i, af, !gameports, false, submode);
joymodes[i] = JSEM_MODE_LIGHTPEN;
break;
case JSEM_MODE_JOYSTICK:
int af = prefs->jports[i].autofire;
if (prefs->jports[i].id >= 0) {
int mode = prefs->jports[i].mode;
+ int submode = prefs->jports[i].submode;
joy = jsem_isjoy (i, prefs);
if (joy >= 0) {
if (gameports)
joymodes[i] = JSEM_MODE_WHEELMOUSE;
break;
case JSEM_MODE_LIGHTPEN:
- input_get_default_lightpen (joysticks, joy, i, af, !gameports, true);
+ input_get_default_lightpen (joysticks, joy, i, af, !gameports, true, submode);
joymodes[i] = JSEM_MODE_LIGHTPEN;
break;
case JSEM_MODE_MOUSE_CDTV:
TCHAR *jports_configname[MAX_JPORTS];
int jportskb[MAX_JPORTS], jportscustom[MAX_JPORTS];
int jportsmode[MAX_JPORTS];
+ int jportssubmode[MAX_JPORTS];
int jportid[MAX_JPORTS], jportaf[MAX_JPORTS];
bool changed = false;
jportskb[i] = idx;
}
jportsmode[i] = prefs->jports[i].mode;
+ jportssubmode[i] = prefs->jports[i].submode;
if (jports_name[i] == NULL)
jports_name[i] = my_strdup(prefs->jports[i].idc.name);
if (jports_configname[i] == NULL)
jports_configname[portnum] = my_strdup(idc.configname);
jportaf[portnum] = sjp->jp.autofire;
jportsmode[portnum] = sjp->jp.mode;
+ jportssubmode[portnum] = sjp->jp.submode;
} else {
write_log(_T("Not inserted to any port\n"));
}
if (jportscustom[i] >= 0) {
TCHAR tmp[10];
_stprintf(tmp, _T("custom%d"), jportscustom[i]);
- found = inputdevice_joyport_config(prefs, tmp, NULL, i, jportsmode[i], 0, true) != 0;
+ found = inputdevice_joyport_config(prefs, tmp, NULL, i, jportsmode[i], jportssubmode[i], 0, true) != 0;
} else if ((jports_name[i] && jports_name[i][0]) || (jports_configname[i] && jports_configname[i][0])) {
- if (!inputdevice_joyport_config (prefs, jports_name[i], jports_configname[i], i, jportsmode[i], 1, true)) {
- found = inputdevice_joyport_config (prefs, jports_name[i], NULL, i, jportsmode[i], 1, true) != 0;
+ if (!inputdevice_joyport_config (prefs, jports_name[i], jports_configname[i], i, jportsmode[i], jportssubmode[i], 1, true)) {
+ found = inputdevice_joyport_config (prefs, jports_name[i], NULL, i, jportsmode[i], jportssubmode[i], 1, true) != 0;
}
if (!found) {
- inputdevice_joyport_config(prefs, _T("joydefault"), NULL, i, jportsmode[i], 0, true);
+ inputdevice_joyport_config(prefs, _T("joydefault"), NULL, i, jportsmode[i], jportssubmode[i], 0, true);
}
} else if (jportskb[i] >= 0) {
TCHAR tmp[10];
_stprintf (tmp, _T("kbd%d"), jportskb[i] + 1);
- found = inputdevice_joyport_config (prefs, tmp, NULL, i, jportsmode[i], 0, true) != 0;
+ found = inputdevice_joyport_config (prefs, tmp, NULL, i, jportsmode[i], jportssubmode[i], 0, true) != 0;
}
fixedports[i] = found;
if (!jp)
break;
if (jp->idc.configname[0]) {
- found = inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, portnum, jp->mode, 1, true) != 0;
+ found = inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, portnum, jp->mode, jp->submode, 1, true) != 0;
if (!found && jp->id == JPORT_UNPLUGGED)
- found = inputdevice_joyport_config(p, jp->idc.name, NULL, portnum, jp->mode, 1, true) != 0;
+ found = inputdevice_joyport_config(p, jp->idc.name, NULL, portnum, jp->mode, jp->submode, 1, true) != 0;
} else if (jp->id < JSEM_JOYS && jp->id >= 0) {
jpx->id = jp->id;
found = true;
}
}
-void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type)
+void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int submode, int type)
{
struct jport *jp = &p->jports[portnum];
if (type == 2) {
} else {
_tcscpy(jp->idc.shortid, value);
}
- if (mode >= 0)
+ if (mode >= 0) {
jp->mode = mode;
+ jp->submode = submode;
+ }
jp->changed = true;
}
-int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int type, bool candefault)
+int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int submode, int type, bool candefault)
{
switch (type)
{
if (value2)
_tcscpy(p->jports[portnum].idc.configname, value2);
p->jports[portnum].id = idnum + matched;
- if (mode >= 0)
+ if (mode >= 0) {
p->jports[portnum].mode = mode;
+ p->jports[portnum].submode = submode;
+ }
set_config_changed ();
}
return 1;
}
if (got >= 2) {
p->jports[portnum].id = start;
- if (mode >= 0)
+ if (mode >= 0) {
p->jports[portnum].mode = mode;
+ p->jports[portnum].submode = submode;
+ }
if (start < JSEM_JOYS)
default_keyboard_layout[portnum] = start + 1;
if (got == 2 && candefault) {
if (!_tcscmp(jpc->custom, _T("#"))) {
TCHAR tmp[16];
_stprintf(tmp, _T("custom%d"), i);
- inputdevice_joyport_config(p, tmp, NULL, i, -1, 0, userconfig);
+ inputdevice_joyport_config(p, tmp, NULL, i, -1, -1, 0, userconfig);
inputdevice_generate_jport_custom(p, i);
}
}
struct jport *jp = &jport_config_store[i];
matched[i] = false;
if (jp->idc.configname[0] && jp->idc.name[0] && (p->input_device_match_mask & INPUT_MATCH_BOTH)) {
- if (inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, i, jp->mode, 1, userconfig)) {
+ if (inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, i, jp->mode, jp->submode, 1, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.configname[0] && (p->input_device_match_mask & INPUT_MATCH_CONFIG_NAME_ONLY)) {
- if (inputdevice_joyport_config(p, NULL, jp->idc.configname, i, jp->mode, 1, userconfig)) {
+ if (inputdevice_joyport_config(p, NULL, jp->idc.configname, i, jp->mode, jp->submode, 1, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.name[0] && (p->input_device_match_mask & INPUT_MATCH_FRIENDLY_NAME_ONLY)) {
- if (inputdevice_joyport_config(p, jp->idc.name, NULL, i, jp->mode, 1, userconfig)) {
+ if (inputdevice_joyport_config(p, jp->idc.name, NULL, i, jp->mode, jp->submode, 1, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.shortid[0] && !jp->idc.name[0] && !jp->idc.configname[0]) {
- if (inputdevice_joyport_config(p, jp->idc.shortid, NULL, i, jp->mode, 0, userconfig)) {
+ if (inputdevice_joyport_config(p, jp->idc.shortid, NULL, i, jp->mode, jp->submode, 0, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
return 0;
}
-int input_get_default_lightpen (struct uae_input_device *uid, int i, int port, int af, bool gp, bool joymouseswap)
+int input_get_default_lightpen (struct uae_input_device *uid, int i, int port, int af, bool gp, bool joymouseswap, int submode)
{
struct didata *did = NULL;
}
setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, INPUTEVENT_LIGHTPEN_HORIZ, gp);
setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, INPUTEVENT_LIGHTPEN_VERT, gp);
- setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp);
+ int button = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON;
+ switch (submode)
+ {
+ case 1:
+ button = port ? INPUTEVENT_JOY2_LEFT : INPUTEVENT_JOY1_LEFT;
+ break;
+ }
+ setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, button, gp);
if (i == 0)
return 1;
return 0;
IDS_JOYMODE_MOUSE "Mouse"
IDS_JOYMODE_JOYSTICK "Joystick"
IDS_JOYMODE_JOYSTICKANALOG "Analog joystick"
- IDS_JOYMODE_LIGHTPEN "Light pen"
+ IDS_JOYMODE_LIGHTPEN "Generic light pen/gun\nTrojan Phazer light gun"
IDS_JOYMODE_MOUSE_CDTV "CDTV remote mouse"
IDS_JOYMODE_JOYSTICK_CD32 "CD32 pad"
IDS_TABLET_BOTH_CURSORS "Show both cursors"
if (inputmap_port >= 0 && inputmap_port < 4) {
dacttype[inputmap_port] = devicetype;
inputdevice_compa_clear(&changed_prefs, inputmap_port);
- inputdevice_joyport_config(&changed_prefs, _T("none"), NULL, inputmap_port, 0, 0, true);
+ inputdevice_joyport_config(&changed_prefs, _T("none"), NULL, inputmap_port, 0, 0, 0, true);
return 1;
}
return 0;
inputdevice_compa_clear (&changed_prefs, inputmap_port);
if (_tcslen (name) == 0) {
- inputdevice_joyport_config (&changed_prefs, _T("none"), NULL, inputmap_port, 0, 0, true);
+ inputdevice_joyport_config (&changed_prefs, _T("none"), NULL, inputmap_port, 0, 0, 0, true);
return TRUE;
}
devicetype2 = -1;
_stprintf (tmp2, _T("KeyboardLayout%d"), i);
if (!_tcscmp (tmp2, name)) {
_stprintf (tmp2, _T("kbd%d"), i + 1);
- ret = inputdevice_joyport_config (&changed_prefs, tmp2, NULL, inputmap_port, devicetype2, 0, true);
+ ret = inputdevice_joyport_config (&changed_prefs, tmp2, NULL, inputmap_port, devicetype2, 0, 0, true);
return ret;
}
}
- ret = inputdevice_joyport_config (&changed_prefs, name, name, inputmap_port, devicetype2, 1, true);
+ ret = inputdevice_joyport_config (&changed_prefs, name, name, inputmap_port, devicetype2, 0, 1, true);
return ret;
}
static const int joysaf[] = { IDC_PORT0_AF, IDC_PORT1_AF, -1, -1 };
static const int joyremap[] = { IDC_PORT0_REMAP, IDC_PORT1_REMAP, IDC_PORT2_REMAP, IDC_PORT3_REMAP };
+#define MAX_PORTSUBMODES 16
+static int portsubmodes[MAX_PORTSUBMODES];
+
static void updatejoyport (HWND hDlg, int changedport)
{
int i, j;
int id = joys[i];
int idm = joysm[i];
int v = workprefs.jports[i].id;
- int vm = workprefs.jports[i].mode;
+ int vm = workprefs.jports[i].mode + workprefs.jports[i].submode;
TCHAR *p1, *p2;
if (idm > 0)
int idx = 0;
int *port = &workprefs.jports[i].id;
int *portm = &workprefs.jports[i].mode;
+ int *portsm = &workprefs.jports[i].submode;
int prevport = *port;
int id = joys[i];
int idm = joysm[i];
if (idm >= 0) {
v = SendDlgItemMessage (hDlg, idm, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR) {
- *portm = v;
+ int vcnt = 0;
+ *portsm = 0;
+ for (int j = 0; j < MAX_PORTSUBMODES; j++) {
+ if (v <= 0)
+ break;
+ if (portsubmodes[j] > 0) {
+ if (v <= portsubmodes[j]) {
+ *portsm = v;
+ }
+ v -= portsubmodes[j];
+ } else {
+ v--;
+ vcnt++;
+ }
+ }
+ *portm = vcnt;
}
}
}
SendDlgItemMessage(hDlg, IDC_PORT_TABLET_MODE, CB_SETCURSEL, workprefs.input_tablet == TABLET_REAL ? 1 : 0, 0);
+ const int joys[] = { IDS_JOYMODE_DEFAULT, IDS_JOYMODE_WHEELMOUSE, IDS_JOYMODE_MOUSE,
+ IDS_JOYMODE_JOYSTICK, IDS_JOYMODE_GAMEPAD, IDS_JOYMODE_JOYSTICKANALOG,
+ IDS_JOYMODE_MOUSE_CDTV, IDS_JOYMODE_JOYSTICK_CD32,
+ IDS_JOYMODE_LIGHTPEN,
+ 0 };
+
for (i = 0; i < 2; i++) {
int id = i == 0 ? IDC_PORT0_JOYSMODE : IDC_PORT1_JOYSMODE;
- SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L);
- WIN32GUI_LoadUIString (IDS_JOYMODE_DEFAULT, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_WHEELMOUSE, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_MOUSE, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_JOYSTICK, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_GAMEPAD, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_JOYSTICKANALOG, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_MOUSE_CDTV, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_JOYSTICK_CD32, tmp, MAX_DPATH);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_JOYMODE_LIGHTPEN, tmp, MAX_DPATH);
- SendDlgItemMessage(hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
+ SendDlgItemMessage(hDlg, id, CB_RESETCONTENT, 0, 0L);
+ for (int j = 0; joys[j]; j++) {
+ WIN32GUI_LoadUIString(joys[j], tmp, MAX_DPATH);
+ p1 = tmp;
+ _tcscat(p1, _T("\n"));
+ for (;;) {
+ TCHAR *p2 = _tcschr(p1, '\n');
+ if (!p2)
+ break;
+ *p2++ = 0;
+ SendDlgItemMessage(hDlg, id, CB_ADDSTRING, 0, (LPARAM)p1);
+ p1 = p2;
+ }
+ }
+ }
+ for (int i = 0; i < MAX_PORTSUBMODES; i++) {
+ portsubmodes[i] = 0;
}
+ portsubmodes[8] = 2;
+ portsubmodes[9] = -1;
inputdevice_updateconfig (NULL, &workprefs);
enable_for_gameportsdlg (hDlg);