1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-04-20 09:16:12 +00:00

Autofire in 8bit/ST/Archie

This commit is contained in:
Gyorgy Szombathelyi
2022-02-02 00:08:00 +01:00
parent f50ca14752
commit b90189f62e
5 changed files with 44 additions and 1 deletions

1
menu.h
View File

@@ -82,6 +82,7 @@ void ErrorMessage(const char *message, unsigned char code);
void InfoMessage(const char *message);
extern const char *config_cpu_msg[];
extern const char *config_autofire_msg[];
enum HelpText_Message {HELPTEXT_NONE,HELPTEXT_MAIN,HELPTEXT_HARDFILE,HELPTEXT_CHIPSET,HELPTEXT_MEMORY,HELPTEXT_VIDEO,HELPTEXT_FEATURES,HELPTEXT_INPUT};
extern const char *helptexts[];

View File

@@ -6,6 +6,7 @@ joystick_ignore_hat=0 ; set to 1 if having issues on gamepads with 'POV
mouse_boot_mode=0 ; set to 1 if a mouse does not work well
mouse_speed=100 ; set to scale mouse speed (in percentage, default is 100%)
joystick_emu_fixed_index=0 ; set to 1 for always emulating the first two joystick via keyboard
joystick_autofire_combo=0 ; set to 0 for LCTRL+LALT+KP0, 1 for LCTRL+LALT+TAB, 2 for disable autofire toggle
joystick_remap=0583,2060,1,2,4,8,10,20,20,8,400,800,40,80
key_menu_as_rgui=0 ; set to 1 to make the MENU key map to RGUI in Minimig (e.g. for Right Amiga)
usb_storage=0 ; set to 1 to allow accessing the SD Card via the USB port

View File

@@ -59,6 +59,7 @@ mist_cfg_t mist_cfg = {
.joystick_emu_fixed_index = 0,
.joystick_analog_mult = 128,
.joystick_analog_offset = 0,
.joystick_autofire_combo = 0,
.key_menu_as_rgui = 0,
.keyrah_mode = 0,
.reset_combo = 0,
@@ -105,6 +106,7 @@ const ini_var_t mist_ini_vars[] = {
{"JOYSTICK_EMU_FIXED_INDEX", (void*)(&(mist_cfg.joystick_emu_fixed_index)), UINT8, 0, 1, 1},
{"JOYSTICK_ANALOG_MULTIPLIER", (void*)(&(mist_cfg.joystick_analog_mult)), UINT8, 1, 128, 1},
{"JOYSTICK_ANALOG_OFFSET", (void*)(&(mist_cfg.joystick_analog_offset)), INT8, -127, 127, 1},
{"JOYSTICK_AUTOFIRE_COMBO", (void*)(&(mist_cfg.joystick_autofire_combo)), INT8, 0, 2, 1},
{"KEY_MENU_AS_RGUI", (void*)(&(mist_cfg.key_menu_as_rgui)), UINT8, 0, 1, 1},
{"SDRAM64", (void*)(&(mist_cfg.sdram64)), UINT8, 0, 1, 1},
#ifndef INI_PARSER_TEST

View File

@@ -26,6 +26,7 @@ typedef struct {
uint8_t joystick_db9_fixed_index;
uint8_t joystick_emu_fixed_index;
uint8_t joystick_analog_mult;
uint8_t joystick_autofire_combo;
int8_t joystick_analog_offset;
uint8_t key_menu_as_rgui;
uint8_t reset_combo;

View File

@@ -27,6 +27,7 @@
#include "settings.h"
#include "usb/joymapping.h"
#include "usb/joystick.h"
#include "menu.h"
// up to 16 key can be remapped
#define MAX_REMAP 16
@@ -106,6 +107,12 @@ static unsigned char ps2_mouse_samplerate;
// may be in use by an active OSD
static char osd_is_visible = false;
static char autofire;
static unsigned long autofire_timer;
static uint32_t autofire_map;
static uint32_t autofire_mask;
static char autofire_joy;
char user_io_osd_is_visible() {
return osd_is_visible;
}
@@ -128,6 +135,8 @@ void user_io_reset() {
ps2_mouse_resolution = 0;
ps2_mouse_samplerate = 0;
ps2_typematic_rate = 0x80;
autofire = 0;
autofire_joy = -1;
}
void user_io_init() {
@@ -444,6 +453,16 @@ void user_io_digital_joystick_ext(unsigned char joystick, uint32_t map) {
if(joystick > 5) return;
//iprintf("ext j%d: %x\n", joystick, map);
spi_uio_cmd32(UIO_JOYSTICK0_EXT + joystick, 0x000fffff & map);
if (autofire && (map & 0x30)) {
autofire_mask = map & 0x30;
autofire_map = (autofire_map & autofire_mask) | (map & ~autofire_mask);
if (autofire_joy != joystick) {
autofire_joy = joystick;
autofire_timer = GetTimer(autofire*50);
}
} else {
autofire_joy = -1;
}
}
static char dig2ana(char min, char max) {
@@ -1188,6 +1207,13 @@ void user_io_poll() {
virtual_joystick_keyboard(joy_map);
}
if (autofire && autofire_joy >= 0 && autofire_joy <= 5 && CheckTimer(autofire_timer)) {
autofire_map ^= autofire_mask;
//iprintf("06x\n", autofire_map);
spi_uio_cmd32(UIO_JOYSTICK0_EXT + autofire_joy, 0x000fffff & autofire_map);
autofire_timer = GetTimer(autofire*50);
}
user_io_send_buttons(0);
// mouse movement emulation is continous
@@ -2246,7 +2272,19 @@ void user_io_kbd(unsigned char m, unsigned char *k, uint8_t priority, unsigned s
else
{
// special OSD key handled internally
if(osd_is_visible) OsdKeySet(usb2amiga(k[i]));
if(osd_is_visible)
OsdKeySet(usb2amiga(k[i]));
else if (((mist_cfg.joystick_autofire_combo == 0 && k[i] == 0x62) || // KP0
(mist_cfg.joystick_autofire_combo == 1 && k[i] == 0x2B)) && // TAB
(m & 0x05) == 0x05 && // LCTR+LALT
(core_type == CORE_TYPE_8BIT ||
core_type == CORE_TYPE_ARCHIE ||
core_type == CORE_TYPE_MIST2))
{
autofire = ((autofire + 1) & 0x03);
InfoMessage(config_autofire_msg[autofire]);
}
}
// no further processing of any key that is currently