Major update in input handling

- Now mapping all keys correctly in SDL2
- Refactored code for input handling
- Synced all options with WinUAE 2.8.1
This commit is contained in:
Dimitris Panokostas 2017-02-28 01:20:30 +01:00
parent 26e3bf5f64
commit 914ff5daa1
28 changed files with 4780 additions and 2426 deletions

View file

@ -156,7 +156,7 @@ OBJS = \
src/osdep/charset.o \
src/osdep/fsdb_host.o \
src/osdep/hardfile_amiberry.o \
src/osdep/keyboard.o \
src/osdep/keyboard_amiberry.o \
src/osdep/mp3decoder.o \
src/osdep/writelog.o \
src/osdep/amiberry.o \

View file

@ -235,7 +235,7 @@
<ClCompile Include="..\..\src\osdep\gui\UaeListBox.cpp" />
<ClCompile Include="..\..\src\osdep\gui\UaeRadioButton.cpp" />
<ClCompile Include="..\..\src\osdep\hardfile_amiberry.cpp" />
<ClCompile Include="..\..\src\osdep\keyboard.cpp" />
<ClCompile Include="..\..\src\osdep\keyboard_amiberry.cpp" />
<ClCompile Include="..\..\src\osdep\menu\menu_config.cpp" />
<ClCompile Include="..\..\src\osdep\mp3decoder.cpp" />
<ClCompile Include="..\..\src\osdep\neon_helper.s" />

View file

@ -429,9 +429,6 @@
<ClCompile Include="..\..\src\osdep\fsdb_host.cpp">
<Filter>Source files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\src\osdep\keyboard.cpp">
<Filter>Source files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\src\osdep\mp3decoder.cpp">
<Filter>Source files\osdep</Filter>
</ClCompile>
@ -561,6 +558,9 @@
<ClCompile Include="..\..\src\osdep\hardfile_amiberry.cpp">
<Filter>Source files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\src\osdep\keyboard_amiberry.cpp">
<Filter>Source files\osdep</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\data\35floppy.ico">

File diff suppressed because it is too large Load diff

View file

@ -4377,15 +4377,6 @@ static void update_copper(int until_hpos)
return;
}
if (currprefs.fast_copper)
{
if (eventtab[ev_copper].active)
{
eventtab[ev_copper].active = false;
return;
}
}
if (cop_state.state == COP_wait && vp < cop_state.vcmp)
{
eventtab[ev_copper].active = false;
@ -4605,22 +4596,6 @@ static void update_copper(int until_hpos)
if (vp == cop_state.vcmp && hp < cop_state.hcmp)
{
/* Position not reached yet. */
if (currprefs.fast_copper)
{
if ((cop_state.i2 & 0xFE) == 0xFE)
{
int wait_finish = cop_state.hcmp - 2;
/* This will leave c_hpos untouched if it's equal to wait_finish. */
if (wait_finish < c_hpos)
return;
else if (wait_finish <= until_hpos)
{
c_hpos = wait_finish;
}
else
c_hpos = until_hpos;
}
}
break;
}
@ -4672,14 +4647,6 @@ out:
cop_state.hpos = c_hpos;
last_copper_hpos = until_hpos;
if (currprefs.fast_copper)
{
/* The test against maxhpos also prevents us from calling predict_copper
when we are being called from hsync_handler, which would not only be
stupid, but actively harmful. */
if ((regs.spcflags & SPCFLAG_COPPER) && (c_hpos + 8 < maxhpos))
predict_copper();
}
}
static void compute_spcflag_copper(int hpos)
@ -4716,14 +4683,7 @@ static void compute_spcflag_copper(int hpos)
copper_enabled_thisline = 1;
if (currprefs.fast_copper)
{
predict_copper();
if (! eventtab[ev_copper].active)
set_special(SPCFLAG_COPPER);
}
else
set_special(SPCFLAG_COPPER);
set_special(SPCFLAG_COPPER);
}
static void copper_handler()
@ -6912,7 +6872,6 @@ void check_prefs_changed_custom()
currprefs.immediate_blits = changed_prefs.immediate_blits;
currprefs.waiting_blits = changed_prefs.waiting_blits;
currprefs.collision_level = changed_prefs.collision_level;
currprefs.fast_copper = changed_prefs.fast_copper;
currprefs.cs_cd32cd = changed_prefs.cs_cd32cd;
currprefs.cs_cd32c2p = changed_prefs.cs_cd32c2p;
currprefs.cs_cd32nvram = changed_prefs.cs_cd32nvram;

View file

@ -151,6 +151,10 @@ extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
#define RES_HIRES 1
#define RES_SUPERHIRES 2
#define RES_MAX 2
#define VRES_NONDOUBLE 0
#define VRES_DOUBLE 1
#define VRES_QUAD 2
#define VRES_MAX 1
/* get resolution from bplcon0 */
STATIC_INLINE int GET_RES_DENISE(uae_u16 con0)

View file

@ -3,4 +3,4 @@ extern bool gfxboard_is_z3 (int);
#define GFXBOARD_UAE_Z2 0
#define GFXBOARD_UAE_Z3 1
#define GFXBOARD_HARDWARE 2

View file

@ -48,17 +48,20 @@ struct gui_info
bool drive_writing[4]; /* drive is writing */
bool drive_disabled[4]; /* drive is disabled */
bool powerled; /* state of power led */
uae_u8 powerled_brightness; /* 0 to 255 */
uae_s8 drive_side; /* floppy side */
uae_s8 hd; /* harddrive */
uae_s8 cd; /* CD */
uae_s8 md; /* CD32 or CDTV internal storage */
bool cpu_halted;
int fps;
int fps, idle;
int fps_color;
int sndbuf, sndbuf_status;
TCHAR df[4][256]; /* inserted image */
uae_u32 crc32[4]; /* crc32 of image */
};
#define NUM_LEDS (LED_MAX)
#define VISIBLE_LEDS 6
#define VISIBLE_LEDS (LED_MAX - 1)
extern struct gui_info gui_data;
@ -66,7 +69,7 @@ extern void fetch_configurationpath(char *out, int size);
extern void set_configurationpath(char *newpath);
extern void set_rompath(char *newpath);
extern void fetch_rp9path(char *out, int size);
extern void fetch_savestatepath(char *out, int size);
extern void fetch_statefilepath(char *out, int size);
extern void fetch_screenshotpath(char *out, int size);
extern void extractFileName(const char * str, char *buffer);

View file

@ -236,6 +236,7 @@ extern void inputdevice_checkqualifierkeycode (int keyboard, int scancode, int s
extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default **trans, int **kbmaps);
extern void inputdevice_do_keyboard (int code, int state);
extern int inputdevice_iskeymapped (int keyboard, int scancode);
extern int inputdevice_synccapslock(int, int*);
extern int inputdevice_get_compatibility_input (struct uae_prefs*, int index, int *typelist, int *inputlist, const int **at);
extern struct inputevent *inputdevice_get_eventinfo (int evt);
extern bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);

View file

@ -7,13 +7,6 @@
*/
#pragma once
#define KEYCODE_UNK 0
#define KEYCODE_X11 1
#define KEYCODE_FBCON 2
extern char keyboard_type;
extern void init_keyboard();
/* First, two dummies */
#define AK_mousestuff 0x100
#define AK_inhibit 0x101
@ -126,6 +119,7 @@ extern void init_keyboard();
#define AK_BACKQUOTE 0x00
#define AK_MINUS 0x0B
#define AK_EQUAL 0x0C
#define AK_RESETWARNING 0x78
#define AK_INIT_POWERUP 0xfd
#define AK_TERM_POWERUP 0xfe
@ -180,3 +174,5 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT_FILE, AKS_SCREENSHOT_CLIPBOARD,
};
#define AKS_FIRST AKS_ENTERGUI
extern int target_checkcapslock(int, int *);

View file

@ -16,6 +16,12 @@
extern long int version;
#define MAX_PATHS 8
struct multipath {
TCHAR path[MAX_PATHS][PATH_MAX];
};
struct strlist
{
struct strlist* next;
@ -39,6 +45,8 @@ struct strlist
#define MAX_INPUT_SUB_EVENT_ALL 9
#define SPARE_SUB_EVENT 8
#define INTERNALEVENT_COUNT 1
struct uae_input_device
{
TCHAR* name;
@ -71,6 +79,13 @@ struct jport
#define JPORT_AF_TOGGLE 2
#define JPORT_AF_ALWAYS 3
#define KBTYPE_AMIGA 0
#define KBTYPE_PC1 1
#define KBTYPE_PC2 2
#define MAX_SPARE_DRIVES 20
#define MAX_CUSTOM_MEMORY_ADDRS 2
#define CONFIG_TYPE_HARDWARE 1
#define CONFIG_TYPE_HOST 2
#define CONFIG_BLEN 2560
@ -79,6 +94,17 @@ struct jport
#define TABLET_MOUSEHACK 1
#define TABLET_REAL 2
#ifdef WITH_SLIRP
#define MAX_SLIRP_REDIRS 32
struct slirp_redir
{
int proto;
int srcport;
int dstport;
unsigned long addr;
};
#endif
struct cdslot
{
TCHAR name[MAX_DPATH];
@ -91,13 +117,17 @@ struct floppyslot
{
TCHAR df[MAX_DPATH];
int dfxtype;
int dfxclick;
TCHAR dfxclickexternal[256];
bool forcedwriteprotect;
};
struct wh
{
#define ASPECTMULT 1024
#define WH_NATIVE 1
struct wh {
int x, y;
int width, height;
int special;
};
#define MOUNT_CONFIG_SIZE 30
@ -152,6 +182,103 @@ struct uaedev_config_data
int unitnum; // scsi unit number (if tape currently)
};
enum {
CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000,
CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T
};
#define IDE_A600A1200 1
#define IDE_A4000 2
#define GFX_WINDOW 0
#define GFX_FULLSCREEN 1
#define GFX_FULLWINDOW 2
#define AUTOSCALE_NONE 0
#define AUTOSCALE_STATIC_AUTO 1
#define AUTOSCALE_STATIC_NOMINAL 2
#define AUTOSCALE_STATIC_MAX 3
#define AUTOSCALE_NORMAL 4
#define AUTOSCALE_RESIZE 5
#define AUTOSCALE_CENTER 6
#define AUTOSCALE_MANUAL 7 // use gfx_xcenter_pos and gfx_ycenter_pos
#define AUTOSCALE_INTEGER 8
#define AUTOSCALE_INTEGER_AUTOSCALE 9
#define MONITOREMU_NONE 0
#define MONITOREMU_AUTO 1
#define MONITOREMU_A2024 2
#define MONITOREMU_GRAFFITI 3
#define MAX_FILTERSHADERS 4
#define MAX_CHIPSET_REFRESH 10
#define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2)
#define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0)
#define CHIPSET_REFRESH_NTSC (MAX_CHIPSET_REFRESH + 1)
struct chipset_refresh
{
int index;
bool locked;
bool rtg;
int horiz;
int vert;
int lace;
int ntsc;
int vsync;
int framelength;
double rate;
TCHAR label[16];
TCHAR commands[256];
};
#define APMODE_NATIVE 0
#define APMODE_RTG 1
struct apmode
{
int gfx_fullscreen;
int gfx_display;
int gfx_vsync;
// 0 = immediate flip
// -1 = wait for flip, before frame ends
// 1 = wait for flip, after new frame has started
int gfx_vflip;
// doubleframemode strobo
bool gfx_strobo;
int gfx_vsyncmode;
int gfx_backbuffers;
bool gfx_interlaced;
int gfx_refreshrate;
};
#define MAX_LUA_STATES 16
struct gfx_filterdata
{
int gfx_filter;
TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filteroverlay[MAX_DPATH];
struct wh gfx_filteroverlay_pos;
int gfx_filteroverlay_overscan;
int gfx_filter_scanlines;
int gfx_filter_scanlineratio;
int gfx_filter_scanlinelevel;
float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
float gfx_filter_horiz_offset, gfx_filter_vert_offset;
int gfx_filter_filtermode;
int gfx_filter_bilinear;
int gfx_filter_noise, gfx_filter_blur;
int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
int gfx_filter_keep_aspect, gfx_filter_aspect;
int gfx_filter_autoscale;
int gfx_filter_keep_autoscale_aspect;
};
struct uae_prefs
{
struct strlist* all_lines;
@ -159,9 +286,26 @@ struct uae_prefs
TCHAR description[256];
TCHAR info[256];
int config_version;
TCHAR config_hardware_path[MAX_DPATH];
TCHAR config_host_path[MAX_DPATH];
TCHAR config_window_title[256];
bool illegal_mem;
bool use_serial;
bool serial_demand;
bool serial_hwctsrts;
bool serial_direct;
int serial_stopbits;
bool parallel_demand;
int parallel_matrix_emulation;
bool parallel_postscript_emulation;
bool parallel_postscript_detection;
int parallel_autoflush_time;
TCHAR ghostscript_parameters[256];
bool use_gfxlib;
bool socket_emu;
bool start_debugger;
bool start_gui;
int produce_sound;
@ -169,85 +313,244 @@ struct uae_prefs
int sound_stereo_separation;
int sound_mixed_stereo_delay;
int sound_freq;
int sound_maxbsiz;
int sound_interpol;
int sound_filter;
int sound_filter_type;
int sound_volume;
int sound_volume_cd;
bool sound_stereo_swap_paula;
bool sound_stereo_swap_ahi;
bool sound_auto;
int sampler_freq;
int sampler_buffer;
bool sampler_stereo;
int comptrustbyte;
int comptrustword;
int comptrustlong;
int comptrustnaddr;
bool compnf;
bool compfpu;
bool comp_midopt;
bool comp_lowopt;
bool fpu_strict;
bool comp_hardflush;
bool comp_constjump;
bool comp_oldsegv;
int cachesize;
int optcount[10];
int gfx_framerate;
bool avoid_cmov;
int gfx_framerate, gfx_autoframerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
struct wh gfx_size;
struct wh gfx_size_win_xtra[6];
struct wh gfx_size_fs_xtra[6];
bool gfx_autoresolution_vga;
int gfx_autoresolution;
int gfx_autoresolution_delay;
int gfx_autoresolution_minv, gfx_autoresolution_minh;
bool gfx_scandoubler;
struct apmode gfx_apmode[2];
int gfx_resolution;
int gfx_vresolution;
int gfx_lores_mode;
int gfx_pscanlines, gfx_iscanlines;
int gfx_xcenter, gfx_ycenter;
int gfx_xcenter_pos, gfx_ycenter_pos;
int gfx_xcenter_size, gfx_ycenter_size;
int gfx_max_horizontal, gfx_max_vertical;
int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
bool gfx_blackerthanblack;
int gfx_api;
int color_mode;
int gfx_extrawidth;
bool lightboost_strobo;
#ifdef RASPBERRY
int gfx_correct_aspect;
int gfx_fullscreen_ratio;
int kbd_led_num;
int kbd_led_scr;
int kbd_led_cap;
int scaling_method;
#endif
struct gfx_filterdata gf[2];
float rtg_horiz_zoom_mult;
float rtg_vert_zoom_mult;
bool immediate_blits;
int waiting_blits;
unsigned int chipset_mask;
bool ntscmode;
bool genlock;
int monitoremu;
double chipset_refreshrate;
struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
int cr_selected;
int collision_level;
int leds_on_screen;
int fast_copper;
int leds_on_screen_mask[2];
struct wh osd_pos;
int keyboard_leds[3];
bool keyboard_leds_in_use;
int scsi;
bool sana2;
bool uaeserial;
int catweasel;
int cpu_idle;
bool cpu_cycle_exact;
int cpu_clock_multiplier;
int cpu_frequency;
bool blitter_cycle_exact;
int floppy_speed;
int floppy_write_length;
int floppy_random_bits_min;
int floppy_random_bits_max;
int floppy_auto_ext2;
bool tod_hack;
uae_u32 maprom;
bool rom_readwrite;
int turbo_emulation;
bool headless;
int filesys_limit;
int filesys_max_name;
int filesys_max_file_size;
int cs_compatible;
int cs_ciaatod;
int cs_rtc;
int cs_rtc_adjust;
int cs_rtc_adjust_mode;
bool cs_ksmirror_e0;
bool cs_ksmirror_a8;
bool cs_ciaoverlay;
bool cs_cd32cd;
bool cs_cd32c2p;
bool cs_cd32nvram;
bool cs_cdtvcd;
bool cs_cdtvram;
int cs_cdtvcard;
int cs_ide;
bool cs_pcmcia;
bool cs_a1000ram;
int cs_fatgaryrev;
int cs_ramseyrev;
int cs_agnusrev;
int cs_deniserev;
int cs_mbdmac;
bool cs_cdtvscsi;
bool cs_df0idhw;
bool cs_slowmemisfast;
bool cs_resetwarning;
bool cs_denisenoehb;
bool cs_dipagnus;
bool cs_agnusbltbusybug;
bool cs_ciatodbug;
int cs_hacks;
TCHAR romfile[MAX_DPATH];
TCHAR romident[256];
TCHAR romextfile[MAX_DPATH];
uae_u32 romextfile2addr;
TCHAR romextfile2[MAX_DPATH];
TCHAR romextident[256];
TCHAR a2091romfile[MAX_DPATH];
TCHAR a2091romident[256];
bool a2091;
TCHAR a4091romfile[MAX_DPATH];
TCHAR a4091romident[256];
bool a4091;
TCHAR flashfile[MAX_DPATH];
TCHAR rtcfile[MAX_DPATH];
TCHAR cartfile[MAX_DPATH];
TCHAR cartident[256];
int cart_internal;
TCHAR pci_devices[256];
TCHAR prtname[256];
TCHAR sername[256];
TCHAR amaxromfile[MAX_DPATH];
TCHAR a2065name[MAX_DPATH];
struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
TCHAR quitstatefile[MAX_DPATH];
TCHAR statefile[MAX_DPATH];
TCHAR inprecfile[MAX_DPATH];
bool inprec_autoplay;
TCHAR path_floppy[256];
TCHAR path_hardfile[256];
TCHAR path_rom[256];
TCHAR path_cd[256];
struct multipath path_floppy;
struct multipath path_hardfile;
struct multipath path_rom;
struct multipath path_cd;
int m68k_speed;
double m68k_speed_throttle;
int cpu_model;
int mmu_model;
int cpu060_revision;
int fpu_model;
int fpu_revision;
bool cpu_compatible;
bool int_no_unimplemented;
bool fpu_no_unimplemented;
bool address_space_24;
bool picasso96_nocustom;
int picasso96_modeflags;
uae_u32 z3fastmem_size;
uae_u32 z3fastmem_size, z3fastmem2_size;
uae_u32 z3fastmem_start;
uae_u32 fastmem_size;
uae_u32 z3chipmem_size;
uae_u32 z3chipmem_start;
uae_u32 fastmem_size, fastmem2_size;
bool fastmem_autoconfig;
uae_u32 chipmem_size;
uae_u32 bogomem_size;
uae_u32 mbresmem_low_size;
uae_u32 mbresmem_high_size;
uae_u32 rtgmem_size;
bool rtg_hardwareinterrupt;
bool rtg_hardwaresprite;
int rtgmem_type;
bool rtg_more_compatible;
uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS];
uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS];
bool kickshifter;
bool filesys_no_uaefsdb;
bool filesys_custom_uaefsdb;
bool mmkeyboard;
int uae_hide;
bool clipboard_sharing;
bool native_code;
bool uae_hide_autoconfig;
bool jit_direct_compatible_memory;
int mountitems;
struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE];
int nr_floppies;
struct floppyslot floppyslots[4];
bool floppy_read_only;
TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
int dfxclickvolume;
int dfxclickchannelmask;
TCHAR luafiles[MAX_LUA_STATES][MAX_DPATH];
/* Target specific options */
#ifdef AMIBERRY
int gfx_correct_aspect;
int gfx_fullscreen_ratio;
int kbd_led_num;
int kbd_led_scr;
int kbd_led_cap;
int scaling_method;
int amiberry_customControls;
int key_for_menu;
int key_for_quit;
int button_for_menu;
int button_for_quit;
#endif
int statecapturerate, statecapturebuffersize;
/* input */
@ -262,11 +565,17 @@ struct uae_prefs
int input_autofire_linecnt;
int input_mouse_speed;
int input_tablet;
bool tablet_library;
bool input_magic_mouse;
int input_magic_mouse_cursor;
int input_keyboard_type;
struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device internalevent_settings[MAX_INPUT_SETTINGS][INTERNALEVENT_COUNT];
TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
int dongle;
int input_contact_bounce;
};
extern int config_changed;
@ -274,67 +583,73 @@ extern void config_check_vsync(void);
extern void set_config_changed(void);
/* Contains the filename of .uaerc */
extern void cfgfile_write(struct zfile*, const TCHAR* option, const TCHAR* format,...);
extern void cfgfile_dwrite(struct zfile*, const TCHAR* option, const TCHAR* format,...);
extern void cfgfile_target_write(struct zfile*, const TCHAR* option, const TCHAR* format,...);
extern void cfgfile_target_dwrite(struct zfile*, const TCHAR* option, const TCHAR* format,...);
extern TCHAR optionsfile[];
extern void save_options(struct zfile *, struct uae_prefs *, int);
extern void cfgfile_write_bool(struct zfile* f, const TCHAR* option, bool b);
extern void cfgfile_dwrite_bool(struct zfile* f, const TCHAR* option, bool b);
extern void cfgfile_target_write_bool(struct zfile* f, const TCHAR* option, bool b);
extern void cfgfile_target_dwrite_bool(struct zfile* f, const TCHAR* option, bool b);
extern void cfgfile_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_target_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_target_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_target_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_target_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
extern struct uaedev_config_data* add_filesys_config(struct uae_prefs* p, int index, struct uaedev_config_info*);
extern bool get_hd_geometry(struct uaedev_config_info*);
extern void uci_set_defaults(struct uaedev_config_info* uci, bool rdb);
extern void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_backup(const TCHAR *path);
extern struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info*);
extern bool get_hd_geometry(struct uaedev_config_info *);
extern void uci_set_defaults(struct uaedev_config_info *uci, bool rdb);
extern void error_log(const TCHAR*, ...);
extern TCHAR* get_error_log(void);
extern TCHAR *get_error_log(void);
extern bool is_error_log(void);
extern void default_prefs(struct uae_prefs*, int);
extern void discard_prefs(struct uae_prefs*, int);
extern int bip_a500(struct uae_prefs* p, int rom);
extern int bip_a500plus(struct uae_prefs* p, int rom);
extern int bip_a1200(struct uae_prefs* p, int rom);
extern int bip_a2000(struct uae_prefs* p, int rom);
extern int bip_a4000(struct uae_prefs* p, int rom);
extern int bip_cd32(struct uae_prefs* p, int rom);
extern void default_prefs(struct uae_prefs *, int);
extern void discard_prefs(struct uae_prefs *, int);
int parse_cmdline_option(struct uae_prefs*, TCHAR, const TCHAR*);
int parse_cmdline_option(struct uae_prefs *, TCHAR, const TCHAR*);
extern int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, bool* location);
extern int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, int scale);
extern int cfgfile_strval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, const TCHAR* table[], int more);
extern int cfgfile_string(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHAR* location, int maxsz);
extern TCHAR* cfgfile_subst_path(const TCHAR* path, const TCHAR* subst, const TCHAR* file);
extern int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
extern int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
extern int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
extern int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
extern TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern TCHAR* target_expand_environment(const TCHAR* path);
extern int target_parse_option(struct uae_prefs*, const TCHAR* option, const TCHAR* value);
extern void target_save_options(struct zfile*, struct uae_prefs*);
extern void target_default_options(struct uae_prefs*, int type);
extern void target_fixup_options(struct uae_prefs*);
extern int target_cfgfile_load(struct uae_prefs*, const TCHAR* filename, int type, int isdefault);
extern void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type);
extern TCHAR *target_expand_environment(const TCHAR *path);
extern int target_parse_option(struct uae_prefs *, const TCHAR *option, const TCHAR *value);
extern void target_save_options(struct zfile*, struct uae_prefs *);
extern void target_default_options(struct uae_prefs *, int type);
extern void target_fixup_options(struct uae_prefs *);
extern int target_cfgfile_load(struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
extern void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type);
extern int target_get_display(const TCHAR*);
extern const TCHAR *target_get_display_name(int, bool);
extern int cfgfile_load(struct uae_prefs* p, const TCHAR* filename, int* type, int ignorelink, int userconfig);
extern int cfgfile_save(struct uae_prefs* p, const TCHAR* filename, int);
extern void cfgfile_parse_line(struct uae_prefs* p, TCHAR*, int);
extern int cfgfile_parse_option(struct uae_prefs* p, TCHAR* option, TCHAR* value, int);
extern int cfgfile_get_description(const TCHAR* filename, TCHAR* description);
extern int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
extern int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int);
extern void cfgfile_parse_line(struct uae_prefs *p, TCHAR *, int);
extern void cfgfile_parse_lines(struct uae_prefs *p, const TCHAR *, int);
extern int cfgfile_parse_option(struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
extern int cfgfile_get_description(const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
extern void cfgfile_show_usage(void);
extern int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize);
extern uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify(uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
extern uae_u32 cfgfile_modify(uae_u32 index, TCHAR* parms, uae_u32 size, TCHAR* out, uae_u32 outsize);
extern void cfgfile_addcfgparam(TCHAR*);
extern uae_u32 cfgfile_modify(uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
extern void cfgfile_addcfgparam(TCHAR *);
extern int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck);
extern int built_in_chipset_prefs(struct uae_prefs *p);
extern int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max);
extern int cfgfile_configuration_change(int);
extern void fixup_prefs_dimensions(struct uae_prefs* prefs);
extern void fixup_prefs(struct uae_prefs* prefs);
extern void fixup_cpu(struct uae_prefs* prefs);
extern void fixup_prefs_dimensions(struct uae_prefs *prefs);
extern void fixup_prefs(struct uae_prefs *prefs);
extern void fixup_cpu(struct uae_prefs *prefs);
extern void check_prefs_changed_custom(void);
extern void check_prefs_changed_cpu(void);

View file

@ -15,6 +15,7 @@ extern void start_program (void);
extern void leave_program (void);
extern void real_main (int, TCHAR **);
extern void virtualdevice_init (void);
extern void usage(void);
extern void sleep_millis (int ms);
extern void sleep_millis_main (int ms);
@ -59,6 +60,8 @@ struct bstring {
extern void fetch_saveimagepath (TCHAR*, int, int);
extern void fetch_datapath (TCHAR *out, int size);
extern void fetch_rompath (TCHAR *out, int size);
#define uaerand() rand()
extern uae_u32 uaerand(void);
extern uae_u32 uaesrand(uae_u32 seed);
extern uae_u32 uaerandgetseed(void);
#endif //UAE_UAE_H

View file

@ -6,6 +6,7 @@
* Copyright 1995-1997 Bernd Schmidt
*/
#pragma once
#include "machdep/rpt.h"
typedef uae_u32 xcolnr;
@ -20,7 +21,8 @@ extern uae_u32 p96_rgbx16[65536];
extern int graphics_setup (void);
extern int graphics_init (bool);
extern void graphics_leave (void);
extern void graphics_reset(void);
extern bool handle_events(void);
extern int handle_msgpump (void);
extern void setup_brkhandler (void);
extern bool vsync_switchmode (int);
@ -43,6 +45,64 @@ extern void alloc_colors64k (int, int, int, int, int, int, int);
extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt);
extern double getvsyncrate(double hz, int *mult);
/* The graphics code has a choice whether it wants to use a large buffer
* for the whole display, or only a small buffer for a single line.
* If you use a large buffer:
* - set bufmem to point at it
* - set linemem to 0
* - if memcpy within bufmem would be very slow, i.e. because bufmem is
* in graphics card memory, also set emergmem to point to a buffer
* that is large enough to hold a single line.
* - implement flush_line to be a no-op.
* If you use a single line buffer:
* - set bufmem and emergmem to 0
* - set linemem to point at your buffer
* - implement flush_line to copy a single line to the screen
*/
struct vidbuffer
{
/* Function implemented by graphics driver */
void(*flush_line) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int line_no);
void(*flush_block) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int first_line, int end_line);
void(*flush_screen) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int first_line, int end_line);
void(*flush_clear_screen) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
int(*lockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
void(*unlockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
uae_u8 *linemem;
uae_u8 *emergmem;
uae_u8 *bufmem, *bufmemend;
uae_u8 *realbufmem;
uae_u8 *bufmem_allocated;
bool bufmem_lockable;
int rowbytes; /* Bytes per row in the memory pointed at by bufmem. */
int pixbytes; /* Bytes per pixel. */
/* size of this buffer */
int width_allocated;
int height_allocated;
/* size of max visible image */
int outwidth;
int outheight;
/* nominal size of image for centering */
int inwidth;
int inheight;
/* same but doublescan multiplier included */
int inwidth2;
int inheight2;
/* use drawbuffer instead */
bool nativepositioning;
/* tempbuffer in use */
bool tempbufferinuse;
/* extra width, chipset hpos extra in right border */
int extrawidth;
int xoffset; /* superhires pixels from left edge */
int yoffset; /* lines from top edge */
int inxoffset; /* positive if sync positioning */
int inyoffset;
};
extern int max_uae_width, max_uae_height;
struct vidbuf_description

View file

@ -2092,6 +2092,10 @@ void inputdevice_hsync(void)
static int cnt;
cap_check();
#ifdef CATWEASEL
catweasel_hsync();
#endif
for (int i = 0; i < INPUT_QUEUE_SIZE; i++)
{
struct input_queue_struct* iq = &input_queue[i];
@ -2304,7 +2308,7 @@ void inputdevice_do_keyboard(int code, int state)
{
uae_u8 key = code | (state ? 0x00 : 0x80);
keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1;
if (record_key((uae_u8)((key << 1) | (key >> 7))))
if (record_key(uae_u8((key << 1) | (key >> 7))))
{
}
return;
@ -5121,6 +5125,29 @@ int inputdevice_iskeymapped(int keyboard, int scancode)
return scancodeused[keyboard][scancode];
}
int inputdevice_synccapslock(int oldcaps, int *capstable)
{
struct uae_input_device *na = &keyboards[0];
int j, i;
if (!keyboards)
return -1;
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] == capstable[i]) {
if (oldcaps != capstable[i + 1]) {
oldcaps = capstable[i + 1];
inputdevice_translatekeycode(0, capstable[i], oldcaps ? -1 : 0);
}
return i;
}
}
}
}
return -1;
}
static void rqualifiers(uae_u64 flags, bool release)
{
uae_u64 mask = ID_FLAG_QUALIFIER1 << 1;
@ -5238,6 +5265,23 @@ static int inputdevice_translatekeycode_2(int keyboard, int scancode, int keysta
continue;
}
// if evt == caps and scan == caps: sync with native caps led
if (evt == INPUTEVENT_KEY_CAPS_LOCK) {
int v;
if (state < 0)
state = 1;
v = target_checkcapslock(scancode, &state);
if (v < 0)
continue;
#ifndef INPUTDEVICE_SIMPLE
if (v > 0)
toggle = 0;
#endif
}
else if (state < 0) {
// it was caps lock resync, ignore, not mapped to caps
continue;
}
#ifndef INPUTDEVICE_SIMPLE
if (!state) {
didcustom |= process_custom_event (na, j, state, qualmask, autofire, k);

View file

@ -9,6 +9,7 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include <assert.h>
#include "options.h"
#include "threaddep/thread.h"
#include "uae.h"
@ -38,6 +39,7 @@
#ifdef JIT
#include "jit/compemu.h"
#endif
#ifdef USE_SDL
#include "SDL.h"
#include <iostream>
@ -48,25 +50,52 @@ SDL_Texture* texture;
SDL_DisplayMode sdlMode;
#endif
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#include <linux/kd.h>
#include <sys/ioctl.h>
#include "keyboard.h"
#endif
long int version = 256 * 65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
struct uae_prefs currprefs, changed_prefs;
int config_changed;
bool no_gui = false;
bool no_gui = false, quit_to_gui = false;
bool cloanto_rom = false;
bool kickstart_rom = true;
bool console_emulation = false;
struct gui_info gui_data;
TCHAR warning_buffer[256];
TCHAR optionsfile[256];
static uae_u32 randseed;
static int oldhcounter;
uae_u32 uaesrand(uae_u32 seed)
{
oldhcounter = -1;
randseed = seed;
//randseed = 0x12345678;
//write_log (_T("seed=%08x\n"), randseed);
return randseed;
}
uae_u32 uaerand()
{
if (oldhcounter != hsync_counter) {
srand(hsync_counter ^ randseed);
oldhcounter = hsync_counter;
}
uae_u32 r = rand();
//write_log (_T("rand=%08x\n"), r);
return r;
}
uae_u32 uaerandgetseed()
{
return randseed;
}
void my_trim(TCHAR *s)
{
int len;
@ -105,19 +134,20 @@ void discard_prefs(struct uae_prefs *p, int type)
}
#ifdef FILESYS
filesys_cleanup();
p->mountitems = 0;
#endif
}
static void fixup_prefs_dim2(struct wh *wh)
{
if (wh->width < 320) {
error_log(_T("Width (%d) must be at least 320."), wh->width);
wh->width = 320;
if (wh->special)
return;
if (wh->width < 160) {
error_log(_T("Width (%d) must be at least 128."), wh->width);
wh->width = 160;
}
if (wh->height < 200) {
error_log(_T("Height (%d) must be at least 200."), wh->height);
wh->height = 200;
if (wh->height < 128) {
error_log(_T("Height (%d) must be at least 128."), wh->height);
wh->height = 128;
}
if (wh->width > max_uae_width) {
error_log(_T("Width (%d) max is %d."), wh->width, max_uae_width);
@ -133,15 +163,56 @@ void fixup_prefs_dimensions(struct uae_prefs *prefs)
{
fixup_prefs_dim2(&prefs->gfx_size_fs);
fixup_prefs_dim2(&prefs->gfx_size_win);
if (prefs->gfx_apmode[1].gfx_vsync)
prefs->gfx_apmode[1].gfx_vsyncmode = 1;
for (int i = 0; i < 2; i++) {
struct apmode *ap = &prefs->gfx_apmode[i];
ap->gfx_vflip = 0;
ap->gfx_strobo = false;
if (ap->gfx_vsync) {
if (ap->gfx_vsyncmode) {
// low latency vsync: no flip only if no-buffer
if (ap->gfx_backbuffers >= 1)
ap->gfx_vflip = 1;
if (!i && ap->gfx_backbuffers == 2)
ap->gfx_vflip = 1;
ap->gfx_strobo = prefs->lightboost_strobo;
}
else {
// legacy vsync: always wait for flip
ap->gfx_vflip = -1;
if (prefs->gfx_api && ap->gfx_backbuffers < 1)
ap->gfx_backbuffers = 1;
if (ap->gfx_vflip)
ap->gfx_strobo = prefs->lightboost_strobo;;
}
}
else {
// no vsync: wait if triple bufferirng
if (ap->gfx_backbuffers >= 2)
ap->gfx_vflip = -1;
}
if (prefs->gf[i].gfx_filter == 0 && ((prefs->gf[i].gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode))) {
prefs->gf[i].gfx_filter = 1;
}
if (i == 0 && prefs->gf[i].gfx_filter == 0 && prefs->monitoremu) {
error_log(_T("A2024 and Graffiti require at least null filter enabled."));
prefs->gf[i].gfx_filter = 1;
}
}
}
void fixup_cpu(struct uae_prefs *p)
{
if (p->cpu_frequency == 1000000)
p->cpu_frequency = 0;
if (p->cpu_model >= 68030 && p->address_space_24) {
error_log(_T("24-bit address space is not supported in 68030/040/060 configurations."));
p->address_space_24 = false;
}
if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible)) {
if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible || p->cpu_cycle_exact)) {
error_log(_T("FPU is not supported in 68000/010 configurations."));
p->fpu_model = 0;
}
@ -162,15 +233,52 @@ void fixup_cpu(struct uae_prefs *p)
if (p->fpu_model)
p->fpu_model = 68040;
break;
case 68060:
if (p->fpu_model)
p->fpu_model = 68060;
break;
}
if (p->cpu_model < 68020 && p->cachesize) {
p->cachesize = 0;
error_log(_T("JIT requires 68020 or better CPU."));
}
if (p->cpu_model >= 68040 && p->cachesize && p->cpu_compatible)
p->cpu_compatible = false;
if (p->cpu_model >= 68040 && p->cpu_cycle_exact) {
p->cpu_cycle_exact = false;
error_log(_T("68040/060 cycle-exact is not supported."));
}
if ((p->cpu_model < 68030 || p->cachesize) && p->mmu_model) {
error_log(_T("MMU emulation requires 68030/040/060 and it is not JIT compatible."));
p->mmu_model = 0;
}
if (p->cachesize && p->cpu_cycle_exact) {
error_log(_T("JIT and cycle-exact can't be enabled simultaneously."));
p->cachesize = 0;
}
if (p->cachesize && (p->fpu_no_unimplemented || p->int_no_unimplemented)) {
error_log(_T("JIT is not compatible with unimplemented CPU/FPU instruction emulation."));
p->fpu_no_unimplemented = p->int_no_unimplemented = false;
}
if (p->cpu_cycle_exact && p->m68k_speed < 0)
p->m68k_speed = 0;
if (p->immediate_blits && p->blitter_cycle_exact) {
error_log(_T("Cycle-exact and immediate blitter can't be enabled simultaneously.\n"));
p->immediate_blits = false;
}
if (p->immediate_blits && p->waiting_blits) {
error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
p->waiting_blits = 0;
}
if (p->cpu_cycle_exact)
p->cpu_compatible = true;
}
@ -178,33 +286,33 @@ void fixup_prefs(struct uae_prefs *p)
{
int err = 0;
built_in_chipset_prefs(p);
fixup_cpu(p);
if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000)
|| p->chipmem_size < 0x20000
|| p->chipmem_size > 0x800000)
|| p->chipmem_size < 0x20000
|| p->chipmem_size > 0x800000)
{
error_log(_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size);
p->chipmem_size = 0x200000;
err = 1;
}
if ((p->fastmem_size & (p->fastmem_size - 1)) != 0
|| (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
|| (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
{
error_log(_T("Unsupported fastmem size %d (0x%x)."), p->fastmem_size, p->fastmem_size);
p->fastmem_size = 0;
err = 1;
}
if (p->rtgmem_size > 0x1000000 && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, 0x1000000, 0x1000000);
p->rtgmem_size = 0x1000000;
if (p->rtgmem_size > max_z3fastmem && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, max_z3fastmem, max_z3fastmem);
p->rtgmem_size = max_z3fastmem;
err = 1;
}
if ((p->rtgmem_size & (p->rtgmem_size - 1)) != 0 || (p->rtgmem_size != 0 && (p->rtgmem_size < 0x100000))) {
error_log(_T("Unsupported graphics card memory size %d (0x%x)."), p->rtgmem_size, p->rtgmem_size);
if (p->rtgmem_size > 0x1000000)
p->rtgmem_size = 0x1000000;
if (p->rtgmem_size > max_z3fastmem)
p->rtgmem_size = max_z3fastmem;
else
p->rtgmem_size = 0;
err = 1;
@ -222,12 +330,36 @@ void fixup_prefs(struct uae_prefs *p)
err = 1;
}
if (p->z3fastmem2_size > max_z3fastmem) {
error_log(_T("Zorro III fastmem2 size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3fastmem2_size, p->z3fastmem2_size, max_z3fastmem, max_z3fastmem);
p->z3fastmem2_size = max_z3fastmem;
err = 1;
}
if ((p->z3fastmem2_size & (p->z3fastmem2_size - 1)) != 0 || (p->z3fastmem2_size != 0 && p->z3fastmem2_size < 0x100000))
{
error_log(_T("Unsupported Zorro III fastmem2 size %x (%x)."), p->z3fastmem2_size, p->z3fastmem2_size);
p->z3fastmem2_size = 0;
err = 1;
}
p->z3fastmem_start &= ~0xffff;
if (p->z3fastmem_start < 0x1000000)
p->z3fastmem_start = 0x1000000;
if (p->address_space_24 && (p->z3fastmem_size != 0)) {
p->z3fastmem_size = 0;
if (p->z3chipmem_size > max_z3fastmem) {
error_log(_T("Zorro III fake chipmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size, max_z3fastmem, max_z3fastmem);
p->z3chipmem_size = max_z3fastmem;
err = 1;
}
if ((p->z3chipmem_size & (p->z3chipmem_size - 1)) != 0 || (p->z3chipmem_size != 0 && p->z3chipmem_size < 0x100000))
{
error_log(_T("Unsupported Zorro III fake chipmem size %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size);
p->z3chipmem_size = 0;
err = 1;
}
if (p->address_space_24 && (p->z3fastmem_size != 0 || p->z3fastmem2_size != 0 || p->z3chipmem_size != 0)) {
p->z3fastmem_size = p->z3fastmem2_size = p->z3chipmem_size = 0;
error_log(_T("Can't use a Z3 graphics card or 32-bit memory when using a 24 bit address space."));
}
@ -237,7 +369,7 @@ void fixup_prefs(struct uae_prefs *p)
err = 1;
}
if (p->bogomem_size > 0x180000 && ((p->chipset_mask & CSMASK_AGA) || p->cpu_model >= 68020)) {
if (p->bogomem_size > 0x180000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) {
p->bogomem_size = 0x180000;
error_log(_T("Possible Gayle bogomem conflict fixed."));
}
@ -246,7 +378,24 @@ void fixup_prefs(struct uae_prefs *p)
p->fastmem_size = 0;
err = 1;
}
if (p->mbresmem_low_size > 0x04000000 || (p->mbresmem_low_size & 0xfffff)) {
p->mbresmem_low_size = 0;
error_log(_T("Unsupported A3000 MB RAM size"));
}
if (p->mbresmem_high_size > 0x08000000 || (p->mbresmem_high_size & 0xfffff)) {
p->mbresmem_high_size = 0;
error_log(_T("Unsupported Motherboard RAM size."));
}
if (p->rtgmem_type >= GFXBOARD_HARDWARE) {
/*if (p->rtgmem_size < gfxboard_get_vram_min(p->rtgmem_type))
p->rtgmem_size = gfxboard_get_vram_min(p->rtgmem_type);*/
if (p->address_space_24 && gfxboard_is_z3(p->rtgmem_type)) {
p->rtgmem_type = GFXBOARD_UAE_Z2;
p->rtgmem_size = 0;
error_log(_T("Z3 RTG and 24-bit address space are not compatible."));
}
}
if (p->address_space_24 && p->rtgmem_size && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log(_T("Z3 RTG and 24bit address space are not compatible."));
p->rtgmem_type = GFXBOARD_UAE_Z2;
@ -261,14 +410,36 @@ void fixup_prefs(struct uae_prefs *p)
p->produce_sound = 0;
err = 1;
}
if (p->comptrustbyte < 0 || p->comptrustbyte > 3) {
error_log(_T("Bad value for comptrustbyte parameter: value must be within 0..2."));
p->comptrustbyte = 1;
err = 1;
}
if (p->comptrustword < 0 || p->comptrustword > 3) {
error_log(_T("Bad value for comptrustword parameter: value must be within 0..2."));
p->comptrustword = 1;
err = 1;
}
if (p->comptrustlong < 0 || p->comptrustlong > 3) {
error_log(_T("Bad value for comptrustlong parameter: value must be within 0..2."));
p->comptrustlong = 1;
err = 1;
}
if (p->comptrustnaddr < 0 || p->comptrustnaddr > 3) {
error_log(_T("Bad value for comptrustnaddr parameter: value must be within 0..2."));
p->comptrustnaddr = 1;
err = 1;
}
if (p->cachesize < 0 || p->cachesize > 16384) {
error_log(_T("Bad value for cachesize parameter: value must be within 0..16384."));
p->cachesize = 0;
err = 1;
}
if (p->z3fastmem_size && (p->address_space_24 || p->cpu_model < 68020)) {
if ((p->z3fastmem_size || p->z3fastmem2_size || p->z3chipmem_size) && (p->address_space_24 || p->cpu_model < 68020)) {
error_log(_T("Z3 fast memory can't be used with a 68000/68010 emulation. Turning off Z3 fast memory."));
p->z3fastmem_size = 0;
p->z3fastmem2_size = 0;
p->z3chipmem_size = 0;
err = 1;
}
if (p->rtgmem_size > 0 && p->rtgmem_type == GFXBOARD_UAE_Z3 && (p->cpu_model < 68020 || p->address_space_24)) {
@ -276,6 +447,7 @@ void fixup_prefs(struct uae_prefs *p)
p->rtgmem_size = 0;
err = 1;
}
#if !defined (BSDSOCKET)
if (p->socket_emu) {
write_log(_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n"));
@ -293,16 +465,46 @@ void fixup_prefs(struct uae_prefs *p)
p->floppyslots[3].dfxtype = -1;
err = 1;
}
if (p->floppy_speed > 0 && p->floppy_speed < 10) {
error_log(_T("Invalid floppy speed."));
p->floppy_speed = 100;
}
if (p->input_mouse_speed < 1 || p->input_mouse_speed > 1000) {
error_log(_T("Invalid mouse speed."));
p->input_mouse_speed = 100;
}
if (p->collision_level < 0 || p->collision_level > 3) {
error_log(_T("Invalid collision support level. Using 1."));
p->collision_level = 1;
err = 1;
}
if (p->parallel_postscript_emulation)
p->parallel_postscript_detection = true;
if (p->cs_compatible == 1) {
p->cs_fatgaryrev = p->cs_ramseyrev = p->cs_mbdmac = -1;
p->cs_ide = 0;
if (p->cpu_model >= 68020) {
p->cs_fatgaryrev = 0;
p->cs_ide = -1;
p->cs_ramseyrev = 0x0f;
p->cs_mbdmac = 0;
}
}
else if (p->cs_compatible == 0) {
if (p->cs_ide == IDE_A4000) {
if (p->cs_fatgaryrev < 0)
p->cs_fatgaryrev = 0;
if (p->cs_ramseyrev < 0)
p->cs_ramseyrev = 0x0f;
}
}
/* Can't fit genlock and A2024 or Graffiti at the same time,
* also Graffiti uses genlock audio bit as an enable signal
*/
if (p->genlock && p->monitoremu) {
error_log(_T("Genlock and A2024 or Graffiti can't be active simultaneously."));
p->genlock = false;
}
fixup_prefs_dimensions(p);
@ -313,6 +515,17 @@ void fixup_prefs(struct uae_prefs *p)
p->cpu_model = 68000;
p->fpu_model = 0;
#endif
#ifndef CPUEMU_0
p->cpu_compatible = 1;
p->address_space_24 = 1;
#endif
#if !defined (CPUEMU_11) && !defined (CPUEMU_13)
p->cpu_compatible = 0;
p->address_space_24 = 0;
#endif
#if !defined (CPUEMU_13)
p->cpu_cycle_exact = p->blitter_cycle_exact = false;
#endif
#ifndef AGA
p->chipset_mask &= ~CSMASK_AGA;
#endif
@ -324,7 +537,40 @@ void fixup_prefs(struct uae_prefs *p)
#if !defined (BSDSOCKET)
p->socket_emu = 0;
#endif
#if !defined (SCSIEMU)
p->scsi = 0;
#endif
#if !defined (SANA2)
p->sana2 = false;
#endif
#if !defined (UAESERIAL)
p->uaeserial = false;
#endif
#if defined (CPUEMU_13)
if (p->cpu_cycle_exact) {
if (p->gfx_framerate > 1) {
error_log(_T("Cycle-exact requires disabled frameskip."));
p->gfx_framerate = 1;
}
if (p->cachesize) {
error_log(_T("Cycle-exact and JIT can't be active simultaneously."));
p->cachesize = 0;
}
if (p->m68k_speed) {
error_log(_T("Adjustable CPU speed is not available in cycle-exact mode."));
p->m68k_speed = 0;
}
}
#endif
if (p->maprom && !p->address_space_24)
p->maprom = 0x0f000000;
if (((p->maprom & 0xff000000) && p->address_space_24) || p->mbresmem_high_size == 0x08000000) {
p->maprom = 0x00e00000;
}
if (p->tod_hack && p->cs_ciaatod == 0)
p->cs_ciaatod = p->ntscmode ? 2 : 1;
built_in_chipset_prefs(p);
blkdev_fix_prefs(p);
target_fixup_options(p);
}
@ -336,6 +582,8 @@ static int default_config;
void uae_reset(int hardreset, int keyboardreset)
{
currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0;
if (quit_program == 0) {
quit_program = -UAE_RESET;
if (keyboardreset)
@ -349,7 +597,6 @@ void uae_quit()
{
if (quit_program != -UAE_QUIT) {
quit_program = -UAE_QUIT;
regs.spcflags |= SPCFLAG_MODE_CHANGE;
}
target_quit();
}
@ -371,6 +618,10 @@ void uae_restart(int opengui, const TCHAR *cfgfile)
target_restart();
}
void usage()
{
}
static void parse_cmdline_2(int argc, TCHAR **argv)
{
int i;
@ -389,6 +640,40 @@ static void parse_cmdline_2(int argc, TCHAR **argv)
}
}
static int diskswapper_cb(struct zfile *f, void *vrsd)
{
int *num = static_cast<int*>(vrsd);
if (*num >= MAX_SPARE_DRIVES)
return 1;
if (zfile_gettype(f) == ZFILE_DISKIMAGE) {
_tcsncpy(currprefs.dfxlist[*num], zfile_getname(f), 255);
(*num)++;
}
return 0;
}
static void parse_diskswapper(const TCHAR *s)
{
TCHAR *tmp = my_strdup(s);
TCHAR *delim = _T(",");
TCHAR *p1, *p2;
int num = 0;
p1 = tmp;
for (;;) {
p2 = strtok(p1, delim);
if (!p2)
break;
p1 = nullptr;
if (num >= MAX_SPARE_DRIVES)
break;
if (!zfile_zopen(p2, diskswapper_cb, &num)) {
_tcsncpy(currprefs.dfxlist[num], p2, 255);
num++;
}
}
free(tmp);
}
static TCHAR *parsetext(const TCHAR *s)
{
@ -417,40 +702,20 @@ static TCHAR *parsetextpath(const TCHAR *s)
return s3;
}
void print_usage()
{
printf("\nUsage:\n");
printf(" -f <file> Load a configuration file.\n");
printf(" -config=<file> Load a configuration file.\n");
printf(" -statefile=<file> Load a save state file.\n");
printf(" -s <config param>=<value> Set the configuration parameter with value.\n");
printf(" Edit a configuration file in order to know valid parameters and settings.\n");
printf("\nAdditional options:\n");
printf(" -0 <filename> Set adf for drive 0.\n");
printf(" -1 <filename> Set adf for drive 1.\n");
printf(" -2 <filename> Set adf for drive 2.\n");
printf(" -3 <filename> Set adf for drive 3.\n");
printf(" -r <filename> Set kickstart rom file.\n");
printf(" -G Start directly into emulation.\n");
printf(" -c <value> Size of chip memory (in number of 512 KBytes chunks).\n");
printf(" -F <value> Size of fast memory (in number of 1024 KBytes chunks).\n");
printf("\nNote:\n");
printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
printf("File names should be with absolute path.\n");
printf("\nExample:\n");
printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("It will load A500.uae configuration with the save state named game.\n");
printf("It will override use_gui to 'no' so that it enters emulation directly.\n");
exit(1);
}
static void parse_cmdline(int argc, TCHAR **argv)
{
int i;
for (i = 1; i < argc; i++) {
if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (!_tcsncmp(argv[i], _T("-diskswapper="), 13)) {
TCHAR *txt = parsetextpath(argv[i] + 13);
parse_diskswapper(txt);
xfree(txt);
}
else if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
;
}
else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 < argc)
i++;
}
@ -467,7 +732,7 @@ static void parse_cmdline(int argc, TCHAR **argv)
xfree(txt);
}
else if (_tcscmp(argv[i], _T("-f")) == 0) {
/* Check for new-style "-f xxx" argument, where xxx is config-file */
/* Check for new-style "-f xxx" argument, where xxx is config-file */
if (i + 1 == argc) {
write_log(_T("Missing argument for '-f' option.\n"));
}
@ -484,24 +749,29 @@ static void parse_cmdline(int argc, TCHAR **argv)
else
cfgfile_parse_line(&currprefs, argv[++i], 0);
}
else if (_tcscmp(argv[i], _T("-h")) == 0 || _tcscmp(argv[i], _T("-help")) == 0) {
usage();
exit(0);
}
else if (_tcsncmp(argv[i], _T("-cdimage="), 9) == 0) {
TCHAR *txt = parsetextpath(argv[i] + 9);
TCHAR *txt2 = xmalloc(TCHAR, _tcslen(txt) + 2);
_tcscpy(txt2, txt);
if (_tcsrchr(txt2, ',') != NULL)
_tcscat(txt2, _T(","));
cfgfile_parse_option(&currprefs, _T("cdimage0"), txt2, 0);
xfree(txt2);
xfree(txt);
}
else {
if (argv[i][0] == '-' && argv[i][1] != '\0' && argv[i][2] == '\0') {
int ret;
if (argv[i][0] == '-' && argv[i][1] != '\0') {
const TCHAR *arg = argv[i] + 2;
int extra_arg = *arg == '\0';
if (extra_arg)
arg = i + 1 < argc ? argv[i + 1] : 0;
ret = parse_cmdline_option(&currprefs, argv[i][1], arg);
if (ret == -1)
print_usage();
if (ret && extra_arg)
if (parse_cmdline_option(&currprefs, argv[i][1], arg) && extra_arg)
i++;
}
else
{
printf("Unknown option %s\n", argv[i]);
print_usage();
}
}
}
}
@ -529,10 +799,24 @@ void reset_all_systems()
#ifdef PICASSO96
picasso_reset();
#endif
#ifdef SCSIEMU
scsi_reset();
scsidev_reset();
scsidev_start_threads();
#endif
#ifdef A2065
a2065_reset();
#endif
#ifdef SANA2
netdev_reset();
netdev_start_threads();
#endif
#ifdef FILESYS
filesys_prepare_reset();
filesys_reset();
#endif
//TODO
//init_shm();
memory_reset();
#if defined (BSDSOCKET)
bsdlib_reset();
@ -540,8 +824,17 @@ void reset_all_systems()
#ifdef FILESYS
filesys_start_threads();
hardfile_reset();
#endif
#ifdef UAESERIAL
uaeserialdev_reset();
uaeserialdev_start_threads();
#endif
#if defined (PARALLEL_PORT)
initparallel();
#endif
native2amiga_reset();
//dongle_reset();
//sampler_init();
}
/* Okay, this stuff looks strange, but it is here to encourage people who
@ -557,10 +850,14 @@ void do_start_program()
{
if (quit_program == -UAE_QUIT)
return;
/* Do a reset on startup. Whether this is elegant is debatable. */
/* Do a reset on startup. Whether this is elegant is debatable. */
inputdevice_updateconfig(&changed_prefs, &currprefs);
if (quit_program >= 0)
quit_program = UAE_RESET;
#ifdef WITH_LUA
uae_lua_loadall();
#endif
m68k_go(1);
}
@ -569,15 +866,30 @@ void do_leave_program()
#ifdef JIT
compiler_exit();
#endif
//sampler_free ();
graphics_leave();
inputdevice_close();
DISK_free();
close_sound();
dump_counts();
#ifdef CD32
#ifdef SERIAL_PORT
serial_exit();
#endif
#ifdef CDTV
cdtv_free();
#endif
#ifdef A2091
a2091_free();
a3000scsi_free();
#endif
#ifdef NCR
ncr_free();
#endif
#ifdef CD32
akiko_free();
#endif
gui_exit();
if (!no_gui)
gui_exit();
#ifdef USE_SDL
SDL_Quit();
#endif
@ -592,7 +904,12 @@ void do_leave_program()
bsdlib_reset();
#endif
device_func_reset();
#ifdef WITH_LUA
uae_lua_free();
#endif
memory_cleanup();
//TODO
//free_shm();
cfgfile_addcfgparam(nullptr);
machdep_free();
}
@ -627,6 +944,16 @@ void virtualdevice_init()
uaeres_install();
hardfile_install();
#endif
#ifdef SCSIEMU
scsi_reset();
scsidev_install();
#endif
#ifdef SANA2
netdev_install();
#endif
#ifdef UAESERIAL
uaeserialdev_install();
#endif
#ifdef AUTOCONFIG
expansion_init();
emulib_install();
@ -637,6 +964,12 @@ void virtualdevice_init()
#if defined (BSDSOCKET)
bsdlib_install();
#endif
#ifdef WITH_UAENATIVE
uaenative_install();
#endif
#ifdef WITH_TABLETLIBRARY
tabletlib_install();
#endif
}
// In case of error, print the error code and close the application
@ -650,9 +983,11 @@ void check_error_sdl(bool check, const char* message) {
static int real_main2 (int argc, TCHAR **argv)
{
printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n");
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles2");
printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n");
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
SDL_Log("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
@ -675,8 +1010,7 @@ static int real_main2 (int argc, TCHAR **argv)
SDL_Log("Could not get information about SDL Mode! SDL_Error: %s\n", SDL_GetError());
}
keyboard_settrans();
set_config_changed();
if (restart_config[0]) {
default_prefs(&currprefs, 0);
fixup_prefs(&currprefs);
@ -713,6 +1047,7 @@ static int real_main2 (int argc, TCHAR **argv)
if (!no_gui) {
int err = gui_init();
currprefs = changed_prefs;
set_config_changed();
if (err == -1) {
write_log(_T("Failed to initialize the GUI\n"));
return -1;
@ -721,25 +1056,32 @@ static int real_main2 (int argc, TCHAR **argv)
return 1;
}
}
else
{
update_display(&currprefs);
}
memset(&gui_data, 0, sizeof gui_data);
gui_data.cd = -1;
gui_data.hd = -1;
gui_data.md = -1;
#ifdef NATMEM_OFFSET
init_shm();
#endif
#ifdef WITH_LUA
uae_lua_init();
#endif
#ifdef PICASSO96
picasso_reset();
#endif
fixup_prefs(&currprefs);
#ifdef RETROPLATFORM
rp_fixup_options(&currprefs);
#endif
changed_prefs = currprefs;
target_run();
/* force sound settings change */
currprefs.produce_sound = 0;
//savestate_init();
keybuf_init(); /* Must come after init_joystick */
memory_hardreset(2);
@ -750,6 +1092,9 @@ static int real_main2 (int argc, TCHAR **argv)
#endif
custom_init(); /* Must come after memory_init */
#ifdef SERIAL_PORT
serial_init();
#endif
DISK_init();
reset_frame_rate_hack();
@ -774,14 +1119,17 @@ static int real_main2 (int argc, TCHAR **argv)
void real_main(int argc, TCHAR **argv)
{
restart_program = 1;
fetch_configurationpath(restart_config, sizeof(restart_config) / sizeof(TCHAR));
_tcscat(restart_config, OPTIONSFILENAME);
_tcscat(restart_config, ".uae");
default_config = 1;
while (restart_program) {
int ret;
changed_prefs = currprefs;
real_main2(argc, argv);
ret = real_main2(argc, argv);
if (ret == 0 && quit_to_gui)
restart_program = 1;
leave_program();
quit_program = 0;
}

View file

@ -58,12 +58,10 @@ map<int, int> customControlMap; // No SDLK_LAST. SDL2 migration guide suggests s
char start_path_data[MAX_DPATH];
char currentDir[MAX_DPATH];
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#include <linux/kd.h>
#include <sys/ioctl.h>
unsigned char kbd_led_status;
char kbd_flags;
#endif
static char config_path[MAX_DPATH];
static char rom_path[MAX_DPATH];
@ -236,6 +234,10 @@ void target_fixup_options(struct uae_prefs* p)
p->z3fastmem_start = z3_start_adr;
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8;
if (p->gfx_size.width == 0)
p->gfx_size.width = 640;
if (p->gfx_size.height == 0)
p->gfx_size.height == 256;
p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0;
}
@ -323,7 +325,7 @@ void fetch_rp9path(char* out, int size)
strncpy(out, rp9_path, size);
}
void fetch_savestatepath(char* out, int size)
void fetch_statefilepath(char* out, int size)
{
strncpy(out, start_path_data, size);
strncat(out, "/savestates/", size);
@ -672,6 +674,7 @@ int main(int argc, char* argv[])
alloc_AmigaMem();
RescanROMs();
keyboard_settrans();
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
// set capslock state based upon current "real" state
@ -718,8 +721,7 @@ int handle_msgpump()
SDL_Event rEvent;
int keycode;
int modifier;
int handled = 0;
int i;
int i, num;
if (delayed_mousebutton)
{
@ -747,18 +749,8 @@ int handle_msgpump()
break;
case SDL_KEYDOWN:
// Menu button or key pressed
if (currprefs.key_for_menu != 0 && rEvent.key.keysym.scancode == currprefs.key_for_menu)
{
inputdevice_add_inputcode(AKS_ENTERGUI, 1);
break;
}
if (currprefs.key_for_quit != 0 && rEvent.key.keysym.sym == currprefs.key_for_quit)
{
inputdevice_add_inputcode(AKS_QUIT, 1);
break;
}
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_MENU]))
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_APPLICATION]))
{
uae_reset(0, 1);
break;
@ -766,8 +758,19 @@ int handle_msgpump()
switch (rEvent.key.keysym.scancode)
{
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
case SDL_SCANCODE_NUMLOCKCLEAR:
if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0)
{
//oldleds ^= KBLED_NUMLOCKM;
//ch = true;
}
break;
case SDL_SCANCODE_CAPSLOCK: // capslock
if (currprefs.keyboard_leds[KBLED_CAPSLOCKB] > 0)
{
//oldleds ^= KBLED_CAPSLOCKM;
//ch = true;
}
// Treat CAPSLOCK as a toggle. If on, set off and vice/versa
ioctl(0, KDGKBLED, &kbd_flags);
ioctl(0, KDGETLED, &kbd_led_status);
@ -788,35 +791,13 @@ int handle_msgpump()
ioctl(0, KDSETLED, kbd_led_status);
ioctl(0, KDSKBLED, kbd_flags);
break;
#endif
case SDL_SCANCODE_ESCAPE:
inputdevice_do_keyboard(AK_ESC, 1);
break;
case SDL_SCANCODE_LSHIFT: // Shift key
inputdevice_do_keyboard(AK_LSH, 1);
break;
case SDL_SCANCODE_RSHIFT:
inputdevice_do_keyboard(AK_RSH, 1);
break;
case SDL_SCANCODE_RGUI:
case SDL_SCANCODE_MENU:
inputdevice_do_keyboard(AK_RAMI, 1);
break;
case SDL_SCANCODE_LGUI:
inputdevice_do_keyboard(AK_LAMI, 1);
break;
case SDL_SCANCODE_LALT:
inputdevice_do_keyboard(AK_LALT, 1);
break;
case SDL_SCANCODE_RALT:
inputdevice_do_keyboard(AK_RALT, 1);
break;
case SDL_SCANCODE_LCTRL:
case SDL_SCANCODE_RCTRL:
inputdevice_do_keyboard(AK_CTRL, 1);
case SDL_SCANCODE_SCROLLLOCK:
if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0)
{
//oldleds ^= KBLED_SCROLLLOCKM;
//ch = true;
}
break;
default:
@ -836,23 +817,7 @@ int handle_msgpump()
break;
}
}
else
modifier = rEvent.key.keysym.mod;
keycode = translate_amiberry_keys(rEvent.key.keysym.sym, &modifier);
if(keycode)
{
if(modifier == KMOD_SHIFT)
inputdevice_do_keyboard(AK_LSH, 1);
else
inputdevice_do_keyboard(AK_LSH, 0);
inputdevice_do_keyboard(keycode, 1);
}
else
{
inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 1);
}
translate_amiberry_keys(rEvent.key.keysym.sym, 1);
break;
}
break;
@ -860,36 +825,6 @@ int handle_msgpump()
case SDL_KEYUP:
switch (rEvent.key.keysym.scancode)
{
case SDL_SCANCODE_ESCAPE:
inputdevice_do_keyboard(AK_ESC, 0);
break;
case SDL_SCANCODE_LSHIFT: // Shift key
inputdevice_do_keyboard(AK_LSH, 0);
break;
case SDL_SCANCODE_RSHIFT:
inputdevice_do_keyboard(AK_RSH, 0);
break;
case SDL_SCANCODE_RGUI:
case SDL_SCANCODE_MENU:
inputdevice_do_keyboard(AK_RAMI, 0);
break;
case SDL_SCANCODE_LGUI:
inputdevice_do_keyboard(AK_LAMI, 0);
break;
case SDL_SCANCODE_LALT:
inputdevice_do_keyboard(AK_LALT, 0);
break;
case SDL_SCANCODE_RALT:
inputdevice_do_keyboard(AK_RALT, 0);
break;
case SDL_SCANCODE_LCTRL:
case SDL_SCANCODE_RCTRL:
inputdevice_do_keyboard(AK_CTRL, 0);
break;
default:
if (currprefs.amiberry_customControls)
{
@ -908,18 +843,7 @@ int handle_msgpump()
}
}
modifier = rEvent.key.keysym.mod;
keycode = translate_amiberry_keys(rEvent.key.keysym.sym, &modifier);
if(keycode)
{
inputdevice_do_keyboard(keycode, 0);
if(modifier == KMOD_SHIFT)
inputdevice_do_keyboard(AK_LSH, 0);
}
else
{
inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 0);
}
translate_amiberry_keys(rEvent.key.keysym.sym, 0);
break;
}
break;

View file

@ -108,9 +108,9 @@ static void open_screen(struct uae_prefs* p)
else
#endif
{
p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0;
width = p->gfx_size.width;
height = p->gfx_size.height;
p->gfx_resolution = p->gfx_size.width ? (p->gfx_size.width > 600 ? 1 : 0) : 1;
width = p->gfx_size.width ? p->gfx_size.width : 640;
height = p->gfx_size.height ? p->gfx_size.height : 256;
if (p->scaling_method == -1)
{
@ -288,6 +288,20 @@ static int init_colors()
return 1;
}
int target_get_display(const TCHAR *name)
{
return 0;
}
const TCHAR *target_get_display_name(int num, bool friendlyname)
{
if (num <= 0)
return NULL;
if (friendlyname)
return "Raspberry Pi display";
return "0";
}
/*
* Find the colour depth of the display
*/

View file

@ -371,7 +371,7 @@ void ReadConfigFileList()
strcat(tmp->FullPath, files[i].c_str());
strncpy(tmp->Name, files[i].c_str(), MAX_DPATH);
removeFileExtension(tmp->Name);
cfgfile_get_description(tmp->FullPath, tmp->Description);
cfgfile_get_description(tmp->FullPath, tmp->Description, nullptr, nullptr, nullptr);
tmp->BuildInID = BUILDINID_NONE;
ConfigFilesList.push_back(tmp);
}
@ -511,7 +511,7 @@ int gui_update()
{
char tmp[MAX_PATH];
fetch_savestatepath(savestate_fname, MAX_DPATH);
fetch_statefilepath(savestate_fname, MAX_DPATH);
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
if (strlen(currprefs.floppyslots[0].df) > 0)

View file

@ -129,8 +129,6 @@ static void read_mouse()
if (!mouseBut2viaCustom)
setmousebuttonstate(1, 1, keystate[VK_B]); // B button -> right mouse
}
// Nubs as mouse handled in handle_msgpump()
}
@ -441,42 +439,42 @@ static void read_joystick()
// First handle fake joystick from pandora...
if (currprefs.jports[joyid].id == JSEM_JOYS)
{
const Uint8* keystate = SDL_GetKeyboardState(nullptr);
//const Uint8* keystate = SDL_GetKeyboardState(nullptr);
if (!keystate[VK_R])
{ // Right shoulder + dPad -> cursor keys
int axis = (keystate[VK_LEFT] ? -32767 : (keystate[VK_RIGHT] ? 32767 : 0));
if (!joyXviaCustom)
setjoystickstate(0, 0, axis, 32767);
axis = (keystate[VK_UP] ? -32767 : (keystate[VK_DOWN] ? 32767 : 0));
if (!joyYviaCustom)
setjoystickstate(0, 1, axis, 32767);
}
if (!joyButXviaCustom[0])
setjoybuttonstate(0, 0, keystate[VK_X]);
if (!joyButXviaCustom[1])
setjoybuttonstate(0, 1, keystate[VK_B]);
if (!joyButXviaCustom[2])
setjoybuttonstate(0, 2, keystate[VK_A]);
if (!joyButXviaCustom[3])
setjoybuttonstate(0, 3, keystate[VK_Y]);
//if (!keystate[VK_R])
//{ // Right shoulder + dPad -> cursor keys
// int axis = (keystate[VK_LEFT] ? -32767 : (keystate[VK_RIGHT] ? 32767 : 0));
// if (!joyXviaCustom)
// setjoystickstate(0, 0, axis, 32767);
// axis = (keystate[VK_UP] ? -32767 : (keystate[VK_DOWN] ? 32767 : 0));
// if (!joyYviaCustom)
// setjoystickstate(0, 1, axis, 32767);
//}
//if (!joyButXviaCustom[0])
// setjoybuttonstate(0, 0, keystate[VK_X]);
//if (!joyButXviaCustom[1])
// setjoybuttonstate(0, 1, keystate[VK_B]);
//if (!joyButXviaCustom[2])
// setjoybuttonstate(0, 2, keystate[VK_A]);
//if (!joyButXviaCustom[3])
// setjoybuttonstate(0, 3, keystate[VK_Y]);
int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
if (keystate[SDL_SCANCODE_LALT])
{ // Pandora Start button
if (keystate[VK_L]) // Left shoulder
cd32_rwd = 1;
else if (keystate[VK_R]) // Right shoulder
cd32_ffw = 1;
else
cd32_start = 1;
}
if (!joyButXviaCustom[6])
setjoybuttonstate(0, 6, cd32_start);
if (!joyButXviaCustom[5])
setjoybuttonstate(0, 5, cd32_ffw);
if (!joyButXviaCustom[4])
setjoybuttonstate(0, 4, cd32_rwd);
//int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
//if (keystate[SDL_SCANCODE_LALT])
//{ // Pandora Start button
// if (keystate[VK_L]) // Left shoulder
// cd32_rwd = 1;
// else if (keystate[VK_R]) // Right shoulder
// cd32_ffw = 1;
// else
// cd32_start = 1;
//}
//if (!joyButXviaCustom[6])
// setjoybuttonstate(0, 6, cd32_start);
//if (!joyButXviaCustom[5])
// setjoybuttonstate(0, 5, cd32_ffw);
//if (!joyButXviaCustom[4])
// setjoybuttonstate(0, 4, cd32_rwd);
}
else if (jsem_isjoy(joyid, &currprefs) != -1)
{

View file

@ -22,7 +22,7 @@
#define MAX_MANIFEST_ENTRY 256
static char rp9tmp_path[MAX_DPATH];
static std::vector<std::string> lstTmpRP9Files;
static vector<string> lstTmpRP9Files;
static int add_HDF_DHnum = 0;
static bool clip_no_hires = false;
@ -89,50 +89,44 @@ static void set_default_system(struct uae_prefs *p, const char *system, int rom)
default_prefs(p, 0);
del_tmpFiles();
if(strcmp(system, "a-500") == 0)
bip_a500(p, rom);
else if(strcmp(system, "a-500plus") == 0)
bip_a500plus(p, rom);
else if(strcmp(system, "a-1200") == 0)
bip_a1200(p, rom);
else if(strcmp(system, "a-2000") == 0)
bip_a2000(p, rom);
else if(strcmp(system, "a-4000") == 0)
bip_a4000(p, rom);
if (strcmp(system, "a-500") == 0)
built_in_prefs(p, 0, 1, 0, rom);
else if (strcmp(system, "a-1200") == 0)
built_in_prefs(p, 0, 1, 0, rom);
}
static void parse_compatibility(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {
if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("compatibility")) == 0) {
if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast<const char *>(curr_node->name), _T("compatibility")) == 0) {
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL) {
if(strcmp((const char *) content, "flexible-blitter-immediate") == 0)
if(strcmp(reinterpret_cast<const char *>(content), "flexible-blitter-immediate") == 0)
p->immediate_blits = 1;
else if(strcmp((const char *) content, "turbo-floppy") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "turbo-floppy") == 0)
p->floppy_speed = 400;
else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesplayfield") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-sprite-collisions-spritesplayfield") == 0)
p->collision_level = 2;
else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesonly") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-sprite-collisions-spritesonly") == 0)
p->collision_level = 1;
else if(strcmp((const char *) content, "flexible-sound") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-sound") == 0)
p->produce_sound = 2;
else if(strcmp((const char *) content, "flexible-maxhorizontal-nohires") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-maxhorizontal-nohires") == 0)
clip_no_hires = true;
else if(strcmp((const char *) content, "jit") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "jit") == 0)
{
p->cachesize = 8192;
p->address_space_24 = 0;
p->address_space_24 = false;
}
else if(strcmp((const char *) content, "flexible-cpu-cycles") == 0)
p->cpu_compatible = 0;
else if(strcmp((const char *) content, "flexible-maxhorizontal-nosuperhires") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-cpu-cycles") == 0)
p->cpu_compatible = false;
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-maxhorizontal-nosuperhires") == 0)
; /* nothing to change */
else if(strcmp((const char *) content, "flexible-maxvertical-nointerlace") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "flexible-maxvertical-nointerlace") == 0)
; /* nothing to change */
else
printf("rp9: unknown compatibility: %s\n", content);
printf("rp9: unknown compatibility: %p\n", content);
xmlFree(content);
}
}
@ -143,18 +137,18 @@ static void parse_compatibility(struct uae_prefs *p, xmlNode *node)
static void parse_ram(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {
if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("ram")) == 0) {
if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast<const char *>(curr_node->name), _T("ram")) == 0) {
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL) {
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("type"));
if(attr != NULL)
{
int size = atoi((const char *)content);
if(strcmp((const char *) attr, "fast") == 0)
int size = atoi(reinterpret_cast<const char *>(content));
if(strcmp(reinterpret_cast<const char *>(attr), "fast") == 0)
p->fastmem_size = size;
else if(strcmp((const char *) attr, "z3") == 0)
else if(strcmp(reinterpret_cast<const char *>(attr), "z3") == 0)
p->z3fastmem_size = size;
else if(strcmp((const char *) attr, "chip") == 0)
else if(strcmp(reinterpret_cast<const char *>(attr), "chip") == 0)
p->chipmem_size = size;
xmlFree(attr);
}
@ -172,24 +166,24 @@ static void parse_clip(struct uae_prefs *p, xmlNode *node)
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next)
{
if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("clip")) == 0)
if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast<const char *>(curr_node->name), _T("clip")) == 0)
{
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("left"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("left"));
if(attr != NULL)
{
left = atoi((const char *)attr);
left = atoi(reinterpret_cast<const char *>(attr));
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *) _T("top"));
attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("top"));
if(attr != NULL)
{
top = atoi((const char *)attr) / 2;
top = atoi(reinterpret_cast<const char *>(attr)) / 2;
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *) _T("width"));
attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("width"));
if(attr != NULL)
{
width = atoi((const char *)attr);
width = atoi(reinterpret_cast<const char *>(attr));
if(p->chipset_mask & CSMASK_AGA && clip_no_hires == false)
width = width / 2; // Use Hires in AGA mode
else
@ -208,10 +202,10 @@ static void parse_clip(struct uae_prefs *p, xmlNode *node)
p->gfx_size.width = 768;
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *) _T("height"));
attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("height"));
if(attr != NULL)
{
height = atoi((const char *)attr) / 2;
height = atoi(reinterpret_cast<const char *>(attr)) / 2;
if(height <= 200)
p->gfx_size.height = 200;
else if(height <= 216)
@ -236,30 +230,30 @@ static void parse_peripheral(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next)
{
if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("peripheral")) == 0)
if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast<const char *>(curr_node->name), _T("peripheral")) == 0)
{
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL)
{
if(strcmp((const char *)content, "floppy") == 0)
if(strcmp(reinterpret_cast<const char *>(content), "floppy") == 0)
{
int type = DRV_35_DD;
int unit = -1;
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("type"));
if(attr != NULL)
{
if(strcmp((const char *) attr, "dd") == 0)
if(strcmp(reinterpret_cast<const char *>(attr), "dd") == 0)
type = DRV_35_DD;
else
type = DRV_35_HD;
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *) _T("unit"));
attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("unit"));
if(attr != NULL)
{
unit = atoi((const char *) attr);
unit = atoi(reinterpret_cast<const char *>(attr));
xmlFree(attr);
}
@ -270,46 +264,46 @@ static void parse_peripheral(struct uae_prefs *p, xmlNode *node)
p->floppyslots[unit].dfxtype = type;
}
}
else if(strcmp((const char *)content, "a-501") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "a-501") == 0)
p->bogomem_size = 0x00080000;
else if(strcmp((const char *)content, "cpu") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "cpu") == 0)
{
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("type"));
if(attr != NULL)
{
p->cpu_model = atoi((const char *) attr);
p->cpu_model = atoi(reinterpret_cast<const char *>(attr));
if(p->cpu_model > 68020)
p->address_space_24 = 0;
if(p->cpu_model == 68040)
p->fpu_model = 68040;
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *) _T("speed"));
attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("speed"));
if(attr != NULL)
{
if(strcmp((const char *) attr, "max") == 0)
if(strcmp(reinterpret_cast<const char *>(attr), "max") == 0)
p->m68k_speed = -1;
xmlFree(attr);
}
}
else if(strcmp((const char *)content, "fpu") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "fpu") == 0)
{
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("type"));
if(attr != NULL)
{
if(strcmp((const char *) attr, "68881") == 0)
if(strcmp(reinterpret_cast<const char *>(attr), "68881") == 0)
p->fpu_model = 68881;
else if(strcmp((const char *) attr, "68882") == 0)
else if(strcmp(reinterpret_cast<const char *>(attr), "68882") == 0)
p->fpu_model = 68882;
xmlFree(attr);
}
}
else if(strcmp((const char *)content, "jit") == 0)
else if(strcmp(reinterpret_cast<const char *>(content), "jit") == 0)
{
xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("memory"));
xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast<const xmlChar *>("memory"));
if(attr != NULL)
{
p->cachesize = atoi((const char *) attr) / 1024;
p->cachesize = atoi(reinterpret_cast<const char *>(attr)) / 1024;
xmlFree(attr);
}
}

View file

@ -25,8 +25,6 @@ static gcn::Window* grpBlitter;
static gcn::UaeRadioButton* optBlitNormal;
static gcn::UaeRadioButton* optBlitImmed;
static gcn::UaeRadioButton* optBlitWait;
static gcn::Window* grpCopper;
static gcn::UaeCheckBox* chkFastCopper;
static gcn::Window* grpCollisionLevel;
static gcn::UaeRadioButton* optCollNone;
static gcn::UaeRadioButton* optCollSprites;
@ -74,18 +72,6 @@ public:
static NTSCButtonActionListener* ntscButtonActionListener;
class FastCopperActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent) override
{
changed_prefs.fast_copper = chkFastCopper->isSelected();
}
};
static FastCopperActionListener* fastCopperActionListener;
class BlitterButtonActionListener : public gcn::ActionListener
{
public:
@ -175,20 +161,6 @@ void InitPanelChipset(const struct _ConfigCategory& category)
category.panel->add(grpBlitter);
fastCopperActionListener = new FastCopperActionListener();
chkFastCopper = new gcn::UaeCheckBox("Fast copper");
chkFastCopper->addActionListener(fastCopperActionListener);
grpCopper = new gcn::Window("Copper");
grpCopper->setPosition(grpBlitter->getX() + grpBlitter->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER);
grpCopper->add(chkFastCopper, 5, 10);
grpCopper->setMovable(false);
grpCopper->setSize(120, 55);
grpCopper->setBaseColor(gui_baseCol);
category.panel->add(grpCopper);
collisionButtonActionListener = new CollisionButtonActionListener();
optCollNone = new gcn::UaeRadioButton("None", "radioccollisiongroup");
@ -239,10 +211,6 @@ void ExitPanelChipset()
delete grpBlitter;
delete blitterButtonActionListener;
delete chkFastCopper;
delete grpCopper;
delete fastCopperActionListener;
delete optCollNone;
delete optCollSprites;
delete optCollPlayfield;
@ -272,9 +240,7 @@ void RefreshPanelChipset()
else
optBlitNormal->setSelected(true);
chkFastCopper->setSelected(changed_prefs.fast_copper);
if (changed_prefs.collision_level == 0)
if (changed_prefs.collision_level == 0)
optCollNone->setSelected(true);
else if (changed_prefs.collision_level == 1)
optCollSprites->setSelected(true);

View file

@ -52,15 +52,15 @@ void load_buildin_config(int id)
switch (id)
{
case BUILDINID_A500:
bip_a500(&changed_prefs, -1);
built_in_prefs(&changed_prefs, 0, 1, 0, 0);
break;
case BUILDINID_A1200:
bip_a1200(&changed_prefs, -1);
built_in_prefs(&changed_prefs, 4, 0, 0, 0);
break;
case BUILDINID_CD32:
bip_cd32(&changed_prefs, -1);
built_in_prefs(&changed_prefs, 8, 0, 0, 0);
break;
}
}

View file

@ -1,307 +0,0 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
#include "options.h"
#include "inputdevice.h"
#include "keyboard.h"
#include "keybuf.h"
#include "gui.h"
#include "SDL.h"
char keyboard_type = 0;
static struct uae_input_device_kbr_default keytrans_amiga[] = {
{ SDLK_F1, INPUTEVENT_KEY_F1 },
{ SDLK_F2, INPUTEVENT_KEY_F2 },
{ SDLK_F3, INPUTEVENT_KEY_F3 },
{ SDLK_F4, INPUTEVENT_KEY_F4 },
{ SDLK_F5, INPUTEVENT_KEY_F5 },
{ SDLK_F6, INPUTEVENT_KEY_F6 },
{ SDLK_F7, INPUTEVENT_KEY_F7 },
{ SDLK_F8, INPUTEVENT_KEY_F8 },
{ SDLK_F9, INPUTEVENT_KEY_F9 },
{ SDLK_F10, INPUTEVENT_KEY_F10 },
{ SDLK_F11, INPUTEVENT_KEY_F11},
{ SDLK_F12, INPUTEVENT_KEY_F12},
{ SDLK_a, INPUTEVENT_KEY_A },
{ SDLK_b, INPUTEVENT_KEY_B },
{ SDLK_c, INPUTEVENT_KEY_C },
{ SDLK_d, INPUTEVENT_KEY_D },
{ SDLK_e, INPUTEVENT_KEY_E },
{ SDLK_f, INPUTEVENT_KEY_F },
{ SDLK_g, INPUTEVENT_KEY_G },
{ SDLK_h, INPUTEVENT_KEY_H },
{ SDLK_i, INPUTEVENT_KEY_I },
{ SDLK_j, INPUTEVENT_KEY_J },
{ SDLK_k, INPUTEVENT_KEY_K },
{ SDLK_l, INPUTEVENT_KEY_L },
{ SDLK_m, INPUTEVENT_KEY_M },
{ SDLK_n, INPUTEVENT_KEY_N },
{ SDLK_o, INPUTEVENT_KEY_O },
{ SDLK_p, INPUTEVENT_KEY_P },
{ SDLK_q, INPUTEVENT_KEY_Q },
{ SDLK_r, INPUTEVENT_KEY_R },
{ SDLK_s, INPUTEVENT_KEY_S },
{ SDLK_t, INPUTEVENT_KEY_T },
{ SDLK_u, INPUTEVENT_KEY_U },
{ SDLK_v, INPUTEVENT_KEY_V },
{ SDLK_w, INPUTEVENT_KEY_W },
{ SDLK_x, INPUTEVENT_KEY_X },
{ SDLK_y, INPUTEVENT_KEY_Y },
{ SDLK_z, INPUTEVENT_KEY_Z },
{ SDLK_0, INPUTEVENT_KEY_0 },
{ SDLK_1, INPUTEVENT_KEY_1 },
{ SDLK_2, INPUTEVENT_KEY_2 },
{ SDLK_3, INPUTEVENT_KEY_3 },
{ SDLK_4, INPUTEVENT_KEY_4 },
{ SDLK_5, INPUTEVENT_KEY_5 },
{ SDLK_6, INPUTEVENT_KEY_6 },
{ SDLK_7, INPUTEVENT_KEY_7 },
{ SDLK_8, INPUTEVENT_KEY_8 },
{ SDLK_9, INPUTEVENT_KEY_9 },
{ SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK },
{ SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
{ SDLK_TAB, INPUTEVENT_KEY_TAB },
{ SDLK_RETURN, INPUTEVENT_KEY_RETURN },
{ VK_ESCAPE, INPUTEVENT_KEY_ESC },
{ SDLK_SPACE, INPUTEVENT_KEY_SPACE },
{ SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
{ SDLK_COMMA, INPUTEVENT_KEY_COMMA },
{ SDLK_MINUS, INPUTEVENT_KEY_SUB },
{ SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_SLASH, INPUTEVENT_KEY_DIV },
{ SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
{ SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
{ SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
{ SDLK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
{ SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
{ SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
{ SDLK_DELETE, INPUTEVENT_KEY_DEL },
{SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT },
{SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT},
{SDLK_LCTRL, INPUTEVENT_KEY_CTRL},
{SDLK_RCTRL, INPUTEVENT_KEY_CTRL},
{SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT},
{SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT},
// { 94 - 8, INPUTEVENT_KEY_LTGT },
{ SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV },
{ SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL },
{ SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB },
{ SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
{ SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
{ SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
{ SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD },
{ SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
{ SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
{ SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
{ SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
{ SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
{ SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
{ SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER }, // The ENT from keypad..
{ SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
{ SDLK_KP_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
{ SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
{ SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
{ SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
{ SDLK_HOME, INPUTEVENT_KEY_NP_LPAREN }, // Map home to left parent (as fsuae)
{ SDLK_PAGEUP, INPUTEVENT_KEY_NP_RPAREN }, // Map pageup to right parent (as fsuae)
{ SDLK_END, INPUTEVENT_KEY_HELP }, // Help mapped to End key (as fsuae)
{ SDLK_DELETE, INPUTEVENT_KEY_DEL },
{ SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT }, // Left amiga mapped to left Windows
{ SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT }, // Right amiga mapped to right windows key.
{ SDLK_MENU, INPUTEVENT_KEY_AMIGA_RIGHT }, // Right amiga mapped to Menu key.
{ -1, 0 }
};
static struct uae_input_device_kbr_default *keytrans[] =
{
keytrans_amiga,
keytrans_amiga,
keytrans_amiga
};
static int kb_none[] = { -1 };
static int *kbmaps[] = { kb_none, kb_none, kb_none, kb_none, kb_none,
kb_none, kb_none, kb_none, kb_none, kb_none
};
void keyboard_settrans ()
{
keyboard_type = KEYCODE_UNK;
inputdevice_setkeytranslation (keytrans, kbmaps);
}
int translate_amiberry_keys(int symbol, int *modifier)
{
switch(symbol)
{
case VK_UP:
*modifier = KMOD_NONE;
return AK_UP;
case VK_DOWN:
*modifier = KMOD_NONE;
return AK_DN;
case VK_LEFT:
*modifier = KMOD_NONE;
return AK_LF;
case VK_RIGHT:
*modifier = KMOD_NONE;
return AK_RT;
case SDLK_F1:
*modifier = KMOD_NONE;
return AK_F1;
case SDLK_F2:
*modifier = KMOD_NONE;
return AK_F2;
case SDLK_F3:
*modifier = KMOD_NONE;
return AK_F3;
case SDLK_F4:
*modifier = KMOD_NONE;
return AK_F4;
case SDLK_F5:
*modifier = KMOD_NONE;
return AK_F5;
case SDLK_F6:
*modifier = KMOD_NONE;
return AK_F6;
case SDLK_F7:
*modifier = KMOD_NONE;
return AK_F7;
case SDLK_F8:
*modifier = KMOD_NONE;
return AK_F8;
case SDLK_F9:
*modifier = KMOD_NONE;
return AK_F9;
case SDLK_F10:
*modifier = KMOD_NONE;
return AK_F10;
case SDLK_EXCLAIM:
*modifier = KMOD_SHIFT;
return AK_1;
case SDLK_QUOTEDBL:
*modifier = KMOD_SHIFT;
return AK_QUOTE;
case SDLK_HASH:
*modifier = KMOD_SHIFT;
return AK_3;
case SDLK_DOLLAR:
*modifier = KMOD_SHIFT;
return AK_4;
case SDLK_AMPERSAND:
*modifier = KMOD_SHIFT;
return AK_7;
case SDLK_LEFTPAREN:
*modifier = KMOD_SHIFT;
return AK_9;
case SDLK_RIGHTPAREN:
*modifier = KMOD_SHIFT;
return AK_0;
case SDLK_ASTERISK:
*modifier = KMOD_SHIFT;
return AK_8;
case SDLK_PLUS:
*modifier = KMOD_SHIFT;
return AK_EQUAL;
case SDLK_COLON:
*modifier = KMOD_SHIFT;
return AK_SEMICOLON;
case SDLK_QUESTION:
*modifier = KMOD_SHIFT;
return AK_SLASH;
case SDLK_AT:
*modifier = KMOD_SHIFT;
return AK_2;
case SDLK_CARET:
*modifier = KMOD_SHIFT;
return AK_6;
case SDLK_UNDERSCORE:
*modifier = KMOD_SHIFT;
return AK_MINUS;
case 124: // code for '|'
*modifier = KMOD_SHIFT;
return AK_BACKSLASH;
case SDLK_2:
if(*modifier == KMOD_LSHIFT) // '{'
{
*modifier = KMOD_SHIFT;
return AK_LBRACKET;
}
break;
case SDLK_3:
if(*modifier == KMOD_LSHIFT) // '}'
{
*modifier = KMOD_SHIFT;
return AK_RBRACKET;
}
break;
case SDLK_4:
if(*modifier == KMOD_LSHIFT) // '~'
{
*modifier = KMOD_SHIFT;
return AK_BACKQUOTE;
}
break;
case SDLK_9:
if(*modifier == KMOD_LSHIFT) // '['
{
*modifier = KMOD_NONE;
return AK_LBRACKET;
}
break;
case SDLK_0:
if(*modifier == KMOD_LSHIFT) // ']'
{
*modifier = KMOD_NONE;
return AK_RBRACKET;
}
break;
}
return 0;
}

View file

@ -0,0 +1,620 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
#include "options.h"
#include "inputdevice.h"
#include "keyboard.h"
#include "keybuf.h"
#include "gui.h"
#include "SDL.h"
char keyboard_type = 0;
static struct uae_input_device_kbr_default keytrans_amiga[] = {
{ VK_ESCAPE, INPUTEVENT_KEY_ESC },
{ SDLK_F1, INPUTEVENT_KEY_F1, 0, INPUTEVENT_SPC_FLOPPY0, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY0, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_F2, INPUTEVENT_KEY_F2, 0, INPUTEVENT_SPC_FLOPPY1, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY1, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_F3, INPUTEVENT_KEY_F3, 0, INPUTEVENT_SPC_FLOPPY2, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY2, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_F4, INPUTEVENT_KEY_F4, 0, INPUTEVENT_SPC_FLOPPY3, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY3, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_F5, INPUTEVENT_KEY_F5, 0, INPUTEVENT_SPC_STATERESTOREDIALOG, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_STATESAVEDIALOG, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_F6, INPUTEVENT_KEY_F6 },
{ SDLK_F7, INPUTEVENT_KEY_F7 },
{ SDLK_F8, INPUTEVENT_KEY_F8 },
{ SDLK_F9, INPUTEVENT_KEY_F9 },
{ SDLK_F10, INPUTEVENT_KEY_F10 },
{ SDLK_1, INPUTEVENT_KEY_1 },
{ SDLK_2, INPUTEVENT_KEY_2 },
{ SDLK_3, INPUTEVENT_KEY_3 },
{ SDLK_4, INPUTEVENT_KEY_4 },
{ SDLK_5, INPUTEVENT_KEY_5 },
{ SDLK_6, INPUTEVENT_KEY_6 },
{ SDLK_7, INPUTEVENT_KEY_7 },
{ SDLK_8, INPUTEVENT_KEY_8 },
{ SDLK_9, INPUTEVENT_KEY_9 },
{ SDLK_0, INPUTEVENT_KEY_0 },
{ SDLK_TAB, INPUTEVENT_KEY_TAB },
{ SDLK_a, INPUTEVENT_KEY_A },
{ SDLK_b, INPUTEVENT_KEY_B },
{ SDLK_c, INPUTEVENT_KEY_C },
{ SDLK_d, INPUTEVENT_KEY_D },
{ SDLK_e, INPUTEVENT_KEY_E },
{ SDLK_f, INPUTEVENT_KEY_F },
{ SDLK_g, INPUTEVENT_KEY_G },
{ SDLK_h, INPUTEVENT_KEY_H },
{ SDLK_i, INPUTEVENT_KEY_I },
{ SDLK_j, INPUTEVENT_KEY_J },
{ SDLK_k, INPUTEVENT_KEY_K },
{ SDLK_l, INPUTEVENT_KEY_L },
{ SDLK_m, INPUTEVENT_KEY_M },
{ SDLK_n, INPUTEVENT_KEY_N },
{ SDLK_o, INPUTEVENT_KEY_O },
{ SDLK_p, INPUTEVENT_KEY_P },
{ SDLK_q, INPUTEVENT_KEY_Q },
{ SDLK_r, INPUTEVENT_KEY_R },
{ SDLK_s, INPUTEVENT_KEY_S },
{ SDLK_t, INPUTEVENT_KEY_T },
{ SDLK_u, INPUTEVENT_KEY_U },
{ SDLK_v, INPUTEVENT_KEY_V },
{ SDLK_w, INPUTEVENT_KEY_W },
{ SDLK_x, INPUTEVENT_KEY_X },
{ SDLK_y, INPUTEVENT_KEY_Y },
{ SDLK_z, INPUTEVENT_KEY_Z },
{ SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK, ID_FLAG_TOGGLE },
{ SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
{ SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
{ SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
{ SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
{ SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
{ SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
{ SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
{ SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
{ SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
{ SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
{ SDLK_KP_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD, 0, INPUTEVENT_SPC_VOLUME_UP, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_UP, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL, INPUTEVENT_SPC_INCREASE_REFRESHRATE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB, 0, INPUTEVENT_SPC_VOLUME_DOWN, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_DOWN, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL, INPUTEVENT_SPC_DECREASE_REFRESHRATE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{ SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL, 0, INPUTEVENT_SPC_VOLUME_MUTE, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_MUTE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL },
{ SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV, 0, INPUTEVENT_SPC_STATEREWIND, ID_FLAG_QUALIFIER_SPECIAL },
{ SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER }, // The ENT from keypad..
{ SDLK_MINUS, INPUTEVENT_KEY_SUB },
{ SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
{ SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
{ SDLK_RETURN, INPUTEVENT_KEY_RETURN },
{ SDLK_SPACE, INPUTEVENT_KEY_SPACE },
{ SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_SHIFT },
{ SDLK_LCTRL, INPUTEVENT_KEY_CTRL, 0, INPUTEVENT_SPC_QUALIFIER_CONTROL },
{ SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
{ SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_ALT },
{ SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_ALT },
{ SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
{ SDLK_MENU, INPUTEVENT_KEY_AMIGA_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
{ SDLK_RCTRL, INPUTEVENT_KEY_CTRL, 0, INPUTEVENT_SPC_QUALIFIER_CONTROL },
{ SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_SHIFT },
{ SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
{ SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
{ SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
{ SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
{ SDLK_INSERT, INPUTEVENT_KEY_AMIGA_LEFT },
{ SDLK_DELETE, INPUTEVENT_KEY_DEL },
{ SDLK_HOME, INPUTEVENT_KEY_AMIGA_RIGHT },
{ SDLK_PAGEDOWN, INPUTEVENT_KEY_HELP },
{ SDLK_PAGEUP, INPUTEVENT_SPC_FREEZEBUTTON },
{ SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
{ SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
{ SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
{ SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
{ SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
{ SDLK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
{ SDLK_COMMA, INPUTEVENT_KEY_COMMA },
{ SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_SLASH, INPUTEVENT_KEY_DIV },
{ SDLK_SYSREQ, INPUTEVENT_SPC_SCREENSHOT_CLIPBOARD, 0, INPUTEVENT_SPC_SCREENSHOT, ID_FLAG_QUALIFIER_SPECIAL },
{SDLK_END, INPUTEVENT_SPC_QUALIFIER_SPECIAL },
{SDLK_PAUSE, INPUTEVENT_SPC_PAUSE, 0, INPUTEVENT_SPC_WARP, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_IRQ7, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
{SDLK_F12, INPUTEVENT_SPC_ENTERGUI, 0, INPUTEVENT_SPC_ENTERDEBUGGER, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_ENTERDEBUGGER, ID_FLAG_QUALIFIER_SHIFT, INPUTEVENT_SPC_TOGGLEDEFAULTSCREEN, ID_FLAG_QUALIFIER_CONTROL },
{SDLK_AUDIOSTOP, INPUTEVENT_KEY_CDTV_STOP },
{SDLK_AUDIOPLAY, INPUTEVENT_KEY_CDTV_PLAYPAUSE },
{SDLK_AUDIOPREV, INPUTEVENT_KEY_CDTV_PREV },
{SDLK_AUDIONEXT, INPUTEVENT_KEY_CDTV_NEXT },
{ -1, 0 }
};
static struct uae_input_device_kbr_default keytrans_pc1[] = {
{ SDLK_ESCAPE, INPUTEVENT_KEY_ESC },
{ SDLK_F1, INPUTEVENT_KEY_F1 },
{ SDLK_F2, INPUTEVENT_KEY_F2 },
{ SDLK_F3, INPUTEVENT_KEY_F3 },
{ SDLK_F4, INPUTEVENT_KEY_F4 },
{ SDLK_F5, INPUTEVENT_KEY_F5 },
{ SDLK_F6, INPUTEVENT_KEY_F6 },
{ SDLK_F7, INPUTEVENT_KEY_F7 },
{ SDLK_F8, INPUTEVENT_KEY_F8 },
{ SDLK_F9, INPUTEVENT_KEY_F9 },
{ SDLK_F10, INPUTEVENT_KEY_F10 },
{ SDLK_F11, INPUTEVENT_KEY_F11 },
{ SDLK_F12, INPUTEVENT_KEY_F12 },
{ SDLK_1, INPUTEVENT_KEY_1 },
{ SDLK_2, INPUTEVENT_KEY_2 },
{ SDLK_3, INPUTEVENT_KEY_3 },
{ SDLK_4, INPUTEVENT_KEY_4 },
{ SDLK_5, INPUTEVENT_KEY_5 },
{ SDLK_6, INPUTEVENT_KEY_6 },
{ SDLK_7, INPUTEVENT_KEY_7 },
{ SDLK_8, INPUTEVENT_KEY_8 },
{ SDLK_9, INPUTEVENT_KEY_9 },
{ SDLK_0, INPUTEVENT_KEY_0 },
{ SDLK_TAB, INPUTEVENT_KEY_TAB },
{ SDLK_a, INPUTEVENT_KEY_A },
{ SDLK_b, INPUTEVENT_KEY_B },
{ SDLK_c, INPUTEVENT_KEY_C },
{ SDLK_d, INPUTEVENT_KEY_D },
{ SDLK_e, INPUTEVENT_KEY_E },
{ SDLK_f, INPUTEVENT_KEY_F },
{ SDLK_g, INPUTEVENT_KEY_G },
{ SDLK_h, INPUTEVENT_KEY_H },
{ SDLK_i, INPUTEVENT_KEY_I },
{ SDLK_j, INPUTEVENT_KEY_J },
{ SDLK_k, INPUTEVENT_KEY_K },
{ SDLK_l, INPUTEVENT_KEY_L },
{ SDLK_m, INPUTEVENT_KEY_M },
{ SDLK_n, INPUTEVENT_KEY_N },
{ SDLK_o, INPUTEVENT_KEY_O },
{ SDLK_p, INPUTEVENT_KEY_P },
{ SDLK_q, INPUTEVENT_KEY_Q },
{ SDLK_r, INPUTEVENT_KEY_R },
{ SDLK_s, INPUTEVENT_KEY_S },
{ SDLK_t, INPUTEVENT_KEY_T },
{ SDLK_u, INPUTEVENT_KEY_U },
{ SDLK_v, INPUTEVENT_KEY_V },
{ SDLK_w, INPUTEVENT_KEY_W },
{ SDLK_x, INPUTEVENT_KEY_X },
{ SDLK_y, INPUTEVENT_KEY_Y },
{ SDLK_z, INPUTEVENT_KEY_Z },
{ SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK, ID_FLAG_TOGGLE },
{ SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
{ SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
{ SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
{ SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
{ SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
{ SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
{ SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
{ SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
{ SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
{ SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
{ SDLK_KP_PERIOD, INPUTEVENT_KEY_NP_PERIOD },
{ SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD },
{ SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB },
{ SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL },
{ SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV },
{ SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER },
{ SDLK_MINUS, INPUTEVENT_KEY_SUB },
{ SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
{ SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
{ SDLK_RETURN, INPUTEVENT_KEY_RETURN },
{ SDLK_SPACE, INPUTEVENT_KEY_SPACE },
{ SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT },
{ SDLK_LCTRL, INPUTEVENT_KEY_CTRL },
{ SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT },
{ SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT },
{ SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT },
{ SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT },
{ SDLK_MENU, INPUTEVENT_KEY_APPS },
{ SDLK_RCTRL, INPUTEVENT_KEY_CTRL },
{ SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT },
{ SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
{ SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
{ SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
{ SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
{ SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
{ SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
{ SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
{ SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
{ SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
{ SDLK_BACKSLASH, INPUTEVENT_KEY_2B },
{ SDLK_COMMA, INPUTEVENT_KEY_COMMA },
{ SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_SLASH, INPUTEVENT_KEY_DIV },
{ SDLK_INSERT, INPUTEVENT_KEY_INSERT },
{ SDLK_DELETE, INPUTEVENT_KEY_DEL },
{ SDLK_HOME, INPUTEVENT_KEY_HOME },
{ SDLK_END, INPUTEVENT_KEY_END },
{ SDLK_PAGEUP, INPUTEVENT_KEY_PAGEUP },
{ SDLK_PAGEDOWN, INPUTEVENT_KEY_PAGEDOWN },
{ SDLK_SCROLLLOCK, INPUTEVENT_KEY_HELP },
{ SDLK_SYSREQ, INPUTEVENT_KEY_SYSRQ },
{ SDLK_AUDIOSTOP, INPUTEVENT_KEY_CDTV_STOP },
{ SDLK_AUDIOPLAY, INPUTEVENT_KEY_CDTV_PLAYPAUSE },
{ SDLK_AUDIOPREV, INPUTEVENT_KEY_CDTV_PREV },
{ SDLK_AUDIONEXT, INPUTEVENT_KEY_CDTV_NEXT },
{ -1, 0 }
};
static struct uae_input_device_kbr_default *keytrans[] =
{
keytrans_amiga,
keytrans_pc1,
keytrans_pc1
};
static int kb_np[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, -1, SDLK_KP_DECIMAL, -1, SDLK_KP_ENTER, -1, -1 };
static int kb_ck[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, SDLK_RALT, -1, SDLK_RSHIFT, -1, -1 };
static int kb_se[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, -1 };
static int kb_np3[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, -1, SDLK_KP_DECIMAL, -1, SDLK_KP_ENTER, -1, -1 };
static int kb_ck3[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, -1, SDLK_RSHIFT, -1, SDLK_RALT, -1, -1 };
static int kb_se3[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, SDLK_LCTRL, -1, -1 };
static int kb_cd32_np[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, SDLK_KP_1, -1, SDLK_KP_DECIMAL, SDLK_KP_3, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
static int kb_cd32_ck[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, -1, SDLK_RALT, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
static int kb_cd32_se[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
static int kb_cdtv[] = { SDLK_KP_1, -1, SDLK_KP_3, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, -1 };
static int kb_xa1[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, SDLK_KP_5, -1, SDLK_LCTRL, -1, SDLK_LALT, -1, SDLK_SPACE, -1, -1 };
static int kb_xa2[] = { SDLK_d, -1, SDLK_g, -1, SDLK_r, -1, SDLK_f, -1, SDLK_a, -1, SDLK_s, -1, SDLK_q, -1 };
static int kb_arcadia[] = { SDLK_F2, -1, SDLK_1, -1, SDLK_2, -1, SDLK_5, -1, SDLK_6, -1, -1 };
static int kb_arcadiaxa[] = { SDLK_1, -1, SDLK_2, -1, SDLK_3, -1, SDLK_4, -1, SDLK_6, -1, SDLK_LEFTBRACKET, SDLK_LSHIFT, -1, SDLK_RIGHTBRACKET, -1, SDLK_c, -1, SDLK_5, -1, SDLK_z, -1, SDLK_x, -1, -1 };
static int *kbmaps[] = {
kb_np, kb_ck, kb_se, kb_np3, kb_ck3, kb_se3,
kb_cd32_np, kb_cd32_ck, kb_cd32_se,
kb_xa1, kb_xa2, kb_arcadia, kb_arcadiaxa, kb_cdtv
};
static bool specialpressed()
{
return (input_getqualifiers() & ID_FLAG_QUALIFIER_SPECIAL) != 0;
}
static bool shiftpressed()
{
return (input_getqualifiers() & ID_FLAG_QUALIFIER_SHIFT) != 0;
}
static bool altpressed()
{
return (input_getqualifiers() & ID_FLAG_QUALIFIER_ALT) != 0;
}
static bool ctrlpressed()
{
return (input_getqualifiers() & ID_FLAG_QUALIFIER_CONTROL) != 0;
}
static int capslockstate;
static int host_capslockstate, host_numlockstate, host_scrolllockstate;
int getcapslockstate()
{
return capslockstate;
}
void setcapslockstate(int state)
{
capslockstate = state;
}
int getcapslock()
{
const Uint8 *state = SDL_GetKeyboardState(nullptr);
int capstable[7];
// this returns bogus state if caps change when in exclusive mode..
host_capslockstate = state[SDL_SCANCODE_CAPSLOCK] & 1;
host_numlockstate = state[SDL_SCANCODE_NUMLOCKCLEAR] & 1;
host_scrolllockstate = state[SDL_SCANCODE_SCROLLLOCK] & 1;
capstable[0] = SDLK_CAPSLOCK;
capstable[1] = host_capslockstate;
capstable[2] = SDLK_NUMLOCKCLEAR;
capstable[3] = host_numlockstate;
capstable[4] = SDLK_SCROLLLOCK;
capstable[5] = host_scrolllockstate;
capstable[6] = 0;
capslockstate = inputdevice_synccapslock(capslockstate, capstable);
return capslockstate;
}
void clearallkeys()
{
inputdevice_updateconfig(&changed_prefs, &currprefs);
}
static const int np[] = {
SDLK_KP_0, 0, SDLK_KP_PERIOD, 0, SDLK_KP_1, 1, SDLK_KP_2, 2,
SDLK_KP_3, 3, SDLK_KP_4, 4, SDLK_KP_5, 5, SDLK_KP_6, 6, SDLK_KP_7, 7,
SDLK_KP_8, 8, SDLK_KP_9, 9, -1 };
void translate_amiberry_keys(int scancode, int newstate)
{
int code = 0;
int scancode_new;
bool amode = currprefs.input_keyboard_type == 0;
bool special = false;
static int swapperdrive = 0;
scancode_new = scancode;
if (newstate) {
int defaultguikey = SDLK_F12;
if (currprefs.key_for_menu >= 0) {
if (scancode_new == defaultguikey && currprefs.key_for_menu != scancode_new) {
scancode = 0;
if (specialpressed() && ctrlpressed() && shiftpressed() && altpressed())
inputdevice_add_inputcode(AKS_ENTERGUI, 1);
}
else if (scancode_new == currprefs.key_for_menu) {
inputdevice_add_inputcode(AKS_ENTERGUI, 1);
scancode = 0;
}
}
else if (!specialpressed() && !ctrlpressed() && !shiftpressed() && !altpressed() && scancode_new == defaultguikey) {
inputdevice_add_inputcode(AKS_ENTERGUI, 1);
scancode = 0;
}
if (currprefs.key_for_quit != 0 && scancode_new == currprefs.key_for_quit)
{
inputdevice_add_inputcode(AKS_QUIT, 1);
scancode = 0;
}
}
if (newstate && code == 0 && amode) {
switch (scancode)
{
case SDLK_1:
case SDLK_2:
case SDLK_3:
case SDLK_4:
case SDLK_5:
case SDLK_6:
case SDLK_7:
case SDLK_8:
case SDLK_9:
case SDLK_0:
if (specialpressed()) {
int num = scancode - SDLK_1;
if (shiftpressed())
num += 10;
if (ctrlpressed()) {
swapperdrive = num;
if (swapperdrive > 3)
swapperdrive = 0;
}
else {
int i;
for (i = 0; i < 4; i++) {
if (!_tcscmp(currprefs.floppyslots[i].df, currprefs.dfxlist[num]))
changed_prefs.floppyslots[i].df[0] = 0;
}
_tcscpy(changed_prefs.floppyslots[swapperdrive].df, currprefs.dfxlist[num]);
set_config_changed();
}
special = true;
}
break;
case SDLK_KP_0:
case SDLK_KP_1:
case SDLK_KP_2:
case SDLK_KP_3:
case SDLK_KP_4:
case SDLK_KP_5:
case SDLK_KP_6:
case SDLK_KP_7:
case SDLK_KP_8:
case SDLK_KP_9:
case SDLK_KP_PERIOD:
if (specialpressed()) {
int i = 0, v = -1;
while (np[i] >= 0) {
v = np[i + 1];
if (np[i] == scancode)
break;
i += 2;
}
if (v >= 0)
code = AKS_STATESAVEQUICK + v * 2 + ((shiftpressed() || ctrlpressed()) ? 0 : 1);
special = true;
}
break;
}
}
if (code) {
inputdevice_add_inputcode(code, 1);
return;
}
scancode = scancode_new;
if (!specialpressed() && newstate) {
if (scancode == SDLK_CAPSLOCK) {
host_capslockstate = host_capslockstate ? 0 : 1;
capslockstate = host_capslockstate;
}
if (scancode == SDLK_NUMLOCKCLEAR) {
host_numlockstate = host_numlockstate ? 0 : 1;
capslockstate = host_numlockstate;
}
if (scancode == SDLK_SCROLLLOCK) {
host_scrolllockstate = host_scrolllockstate ? 0 : 1;
capslockstate = host_scrolllockstate;
}
}
int translatedScancode = scancode;
switch (scancode)
{
case VK_UP:
translatedScancode = AK_UP;
break;
case VK_DOWN:
translatedScancode = AK_DN;
break;
case VK_LEFT:
translatedScancode = AK_LF;
break;
case VK_RIGHT:
translatedScancode = AK_RT;
break;
case SDLK_F1:
translatedScancode = AK_F1;
break;
case SDLK_F2:
translatedScancode = AK_F2;
break;
case SDLK_F3:
translatedScancode = AK_F3;
break;
case SDLK_F4:
translatedScancode = AK_F4;
break;
case SDLK_F5:
translatedScancode = AK_F5;
break;
case SDLK_F6:
translatedScancode = AK_F6;
break;
case SDLK_F7:
translatedScancode = AK_F7;
break;
case SDLK_F8:
translatedScancode = AK_F8;
break;
case SDLK_F9:
translatedScancode = AK_F9;
break;
case SDLK_F10:
translatedScancode = AK_F10;
break;
case SDLK_LSHIFT:
translatedScancode = AK_LSH;
break;
case SDLK_RSHIFT:
translatedScancode = AK_RSH;
break;
case SDLK_RGUI:
case SDLK_APPLICATION:
translatedScancode = AK_RAMI;
break;
case SDLK_LGUI:
translatedScancode = AK_LAMI;
break;
case SDLK_LALT:
translatedScancode = AK_LALT;
break;
case SDLK_RALT:
translatedScancode = AK_RALT;
break;
case SDLK_LCTRL:
case SDLK_RCTRL:
translatedScancode = AK_CTRL;
break;
case SDLK_PAGEDOWN:
translatedScancode = AK_HELP;
break;
case SDLK_KP_0:
translatedScancode = AK_NP0;
break;
case SDLK_KP_1:
translatedScancode = AK_NP1;
break;
case SDLK_KP_2:
translatedScancode = AK_NP2;
break;
case SDLK_KP_3:
translatedScancode = AK_NP3;
break;
case SDLK_KP_4:
translatedScancode = AK_NP4;
break;
case SDLK_KP_5:
translatedScancode = AK_NP5;
break;
case SDLK_KP_6:
translatedScancode = AK_NP6;
break;
case SDLK_KP_7:
translatedScancode = AK_NP7;
break;
case SDLK_KP_8:
translatedScancode = AK_NP8;
break;
case SDLK_KP_9:
translatedScancode = AK_NP9;
break;
case SDLK_KP_ENTER:
translatedScancode = AK_ENT;
break;
case SDLK_KP_DIVIDE:
translatedScancode = AK_NPDIV;
break;
case SDLK_KP_MULTIPLY:
translatedScancode = AK_NPMUL;
break;
case SDLK_KP_MINUS:
translatedScancode = AK_NPSUB;
break;
case SDLK_KP_PLUS:
translatedScancode = AK_NPADD;
break;
case SDLK_KP_PERIOD:
translatedScancode = AK_NPDEL;
break;
}
if (special) {
inputdevice_checkqualifierkeycode(0, translatedScancode, newstate);
return;
}
if (translatedScancode != scancode)
inputdevice_do_keyboard(translatedScancode, newstate);
else
inputdevice_translatekeycode(0, translatedScancode, newstate);
}
void keyboard_settrans()
{
inputdevice_setkeytranslation(keytrans, kbmaps);
}
int target_checkcapslock(int scancode, int *state)
{
if (scancode != SDLK_CAPSLOCK && scancode != SDLK_NUMLOCKCLEAR && scancode != SDLK_SCROLLLOCK)
return 0;
if (*state == 0)
return -1;
if (scancode == SDLK_CAPSLOCK)
*state = host_capslockstate;
if (scancode == SDLK_NUMLOCKCLEAR)
*state = host_numlockstate;
if (scancode == SDLK_SCROLLLOCK)
*state = host_scrolllockstate;
return 1;
}

View file

@ -31,7 +31,7 @@ void graphics_subshutdown();
void amiberry_stop_sound();
void keyboard_settrans();
int translate_amiberry_keys(int symbol, int *modifier);
void translate_amiberry_keys(int, int);
void SimulateMouseOrJoy(int code, int keypressed);
#define REMAP_MOUSEBUTTON_LEFT -1

View file

@ -665,7 +665,7 @@ int load_keyring (struct uae_prefs *p, const TCHAR *path)
break;
case 1:
if (p) {
_tcscpy (tmp, p->path_rom);
_tcscpy(tmp, p->path_rom.path[0]);
_tcscat (tmp, _T("rom.key"));
}
break;

View file

@ -211,8 +211,9 @@ TCHAR* restore_string_func(uae_u8** dstp)
TCHAR* restore_path_func(uae_u8** dstp, int type)
{
TCHAR* newpath;
TCHAR* s;
TCHAR *newpath;
TCHAR *s;
TCHAR *out = NULL;
TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
s = restore_string_func(dstp);
@ -222,28 +223,27 @@ TCHAR* restore_path_func(uae_u8** dstp, int type)
return s;
if (type == SAVESTATE_PATH_HD)
return s;
getfilepart(tmp, sizeof tmp / sizeof (TCHAR), s);
if (zfile_exists(tmp))
{
xfree (s);
getfilepart(tmp, sizeof tmp / sizeof(TCHAR), s);
if (zfile_exists(tmp)) {
xfree(s);
return my_strdup(tmp);
}
newpath = nullptr;
if (type == SAVESTATE_PATH_FLOPPY)
newpath = currprefs.path_floppy;
else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF)
newpath = currprefs.path_hardfile;
else if (type == SAVESTATE_PATH_CD)
newpath = currprefs.path_cd;
if (newpath != nullptr && newpath[0] != 0)
{
_tcscpy (tmp2, newpath);
for (int i = 0; i < MAX_PATHS; i++) {
newpath = NULL;
if (type == SAVESTATE_PATH_FLOPPY)
newpath = currprefs.path_floppy.path[i];
else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF)
newpath = currprefs.path_hardfile.path[i];
else if (type == SAVESTATE_PATH_CD)
newpath = currprefs.path_cd.path[i];
if (newpath == NULL || newpath[0] == 0)
break;
_tcscpy(tmp2, newpath);
fixtrailing(tmp2);
_tcscat (tmp2, tmp);
if (zfile_exists(tmp2))
{
xfree (s);
_tcscat(tmp2, tmp);
if (zfile_exists(tmp2)) {
xfree(s);
return my_strdup(tmp2);
}
}

View file

@ -46,6 +46,17 @@ STATIC_INLINE void clear_sound_buffers (void)
#define PUT_SOUND_WORD(b) do { *sndbufpt = b; sndbufpt = sndbufpt + 1; } while (0)
#define PUT_SOUND_WORD_STEREO(l,r) do { *((uae_u32 *)sndbufpt) = (r << 16) | (l & 0xffff); sndbufpt = sndbufpt + 2; } while (0)
#define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0)
#define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0)
#define PUT_SOUND_WORD_LEFT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[2]); PUT_SOUND_WORD(b); } while (0)
#define PUT_SOUND_WORD_RIGHT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[3]); PUT_SOUND_WORD(b); } while (0)
#define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b)
#define SOUND16_BASE_VAL 0
#define SOUND8_BASE_VAL 128
#define DEFAULT_SOUND_MAXB 16384
#define DEFAULT_SOUND_MINB 16384
#define DEFAULT_SOUND_BITS 16
#define DEFAULT_SOUND_FREQ 44100
#define HAVE_STEREO_SUPPORT