Code cleanup

Reformatted code for improved readability. Fixed type casting. Selective
merge from uae4arm (android)
This commit is contained in:
Dimitris Panokostas 2016-09-01 00:02:17 +02:00
parent 89aaed4a53
commit efb894781e
20 changed files with 7723 additions and 6797 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Custom chip emulation * Custom chip emulation
@ -18,7 +18,7 @@
#include "gensound.h" #include "gensound.h"
#include "audio.h" #include "audio.h"
#include "sd-pandora/sound.h" #include "sd-pandora/sound.h"
#include "memory.h" #include "include/memory.h"
#include "custom.h" #include "custom.h"
#include "newcpu.h" #include "newcpu.h"
#include "cia.h" #include "cia.h"

View file

@ -1,4 +1,4 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Screen drawing functions * Screen drawing functions
@ -49,7 +49,7 @@
extern int sprite_buffer_res; extern int sprite_buffer_res;
static void lores_reset (void) static void lores_reset(void)
{ {
sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES; sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES;
if (sprite_buffer_res > currprefs.gfx_resolution) if (sprite_buffer_res > currprefs.gfx_resolution)

View file

@ -1,4 +1,4 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* AutoConfig (tm) Expansions (ZorroII/III) * AutoConfig (tm) Expansions (ZorroII/III)
@ -14,7 +14,7 @@
#include "options.h" #include "options.h"
#include "uae.h" #include "uae.h"
#include "memory.h" #include "include/memory.h"
#include "rommgr.h" #include "rommgr.h"
#include "autoconf.h" #include "autoconf.h"
#include "newcpu.h" #include "newcpu.h"

View file

@ -4,6 +4,7 @@
* Copyright 1996-1998 Bernd Schmidt * Copyright 1996-1998 Bernd Schmidt
*/ */
#pragma once
#define MAX_PLANES 8 #define MAX_PLANES 8
/* According to the HRM, pixel data spends a couple of cycles somewhere in the chips /* According to the HRM, pixel data spends a couple of cycles somewhere in the chips
@ -22,25 +23,25 @@
#define lores_shift 0 #define lores_shift 0
extern bool aga_mode; extern bool aga_mode;
STATIC_INLINE int coord_hw_to_window_x (int x) STATIC_INLINE int coord_hw_to_window_x(int x)
{ {
x -= DISPLAY_LEFT_SHIFT; x -= DISPLAY_LEFT_SHIFT;
return x; return x;
} }
STATIC_INLINE int coord_window_to_hw_x (int x) STATIC_INLINE int coord_window_to_hw_x(int x)
{ {
return x + DISPLAY_LEFT_SHIFT; return x + DISPLAY_LEFT_SHIFT;
} }
STATIC_INLINE int coord_diw_to_window_x (int x) STATIC_INLINE int coord_diw_to_window_x(int x)
{ {
return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1); return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1);
} }
STATIC_INLINE int coord_window_to_diw_x (int x) STATIC_INLINE int coord_window_to_diw_x(int x)
{ {
x = coord_window_to_hw_x (x); x = coord_window_to_hw_x(x);
return x - DIW_DDF_OFFSET; return x - DIW_DDF_OFFSET;
} }
@ -52,7 +53,8 @@ extern int framecnt;
* *
* !!! See color_reg_xxx functions below before touching !!! * !!! See color_reg_xxx functions below before touching !!!
*/ */
struct color_entry { struct color_entry
{
uae_u16 color_regs_ecs[32]; uae_u16 color_regs_ecs[32];
xcolnr acolors[256]; xcolnr acolors[256];
uae_u32 color_regs_aga[256]; uae_u32 color_regs_aga[256];
@ -68,18 +70,19 @@ struct color_entry {
STATIC_INLINE uae_u16 CONVERT_RGB(uae_u32 c) STATIC_INLINE uae_u16 CONVERT_RGB(uae_u32 c)
{ {
uae_u16 ret; uae_u16 ret;
__asm__ ( __asm__(
"ubfx r1, %[c], #19, #5 \n\t" "ubfx r1, %[c], #19, #5 \n\t"
"ubfx r2, %[c], #10, #6 \n\t" "ubfx r2, %[c], #10, #6 \n\t"
"ubfx %[v], %[c], #3, #5 \n\t" "ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t" "orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t" "orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" ); : [v] "=r" (ret) : [c] "r" (c) : "r1",
"r2");
return ret; return ret;
} }
#endif #endif
STATIC_INLINE xcolnr getxcolor (int c) STATIC_INLINE xcolnr getxcolor(int c)
{ {
if (aga_mode) if (aga_mode)
return CONVERT_RGB(c); return CONVERT_RGB(c);
@ -88,7 +91,7 @@ STATIC_INLINE xcolnr getxcolor (int c)
} }
/* functions for reading, writing, copying and comparing struct color_entry */ /* functions for reading, writing, copying and comparing struct color_entry */
STATIC_INLINE int color_reg_get (struct color_entry *ce, int c) STATIC_INLINE int color_reg_get(struct color_entry *ce, int c)
{ {
if (aga_mode) if (aga_mode)
return ce->color_regs_aga[c]; return ce->color_regs_aga[c];
@ -96,7 +99,7 @@ STATIC_INLINE int color_reg_get (struct color_entry *ce, int c)
return ce->color_regs_ecs[c]; return ce->color_regs_ecs[c];
} }
STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v) STATIC_INLINE void color_reg_set(struct color_entry *ce, int c, int v)
{ {
if (aga_mode) if (aga_mode)
ce->color_regs_aga[c] = v; ce->color_regs_aga[c] = v;
@ -105,12 +108,12 @@ STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v)
} }
/* ugly copy hack, is there better solution? */ /* ugly copy hack, is there better solution? */
STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *src) STATIC_INLINE void color_reg_cpy(struct color_entry *dst, struct color_entry *src)
{ {
dst->borderblank = src->borderblank; dst->borderblank = src->borderblank;
if (aga_mode) if (aga_mode)
/* copy acolors and color_regs_aga */ /* copy acolors and color_regs_aga */
memcpy (dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32); memcpy(dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else else
/* copy first 32 acolors and color_regs_ecs */ /* copy first 32 acolors and color_regs_ecs */
memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32); memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32);
@ -126,7 +129,8 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
*/ */
#define COLOR_CHANGE_BRDBLANK 0x80000000 #define COLOR_CHANGE_BRDBLANK 0x80000000
struct color_change { struct color_change
{
int linepos; int linepos;
int regno; int regno;
unsigned int value; unsigned int value;
@ -148,7 +152,8 @@ struct sprite_entry
bool has_attached; bool has_attached;
}; };
union sps_union { union sps_union
{
uae_u8 bytes[MAX_SPR_PIXELS]; uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4]; uae_u32 words[MAX_SPR_PIXELS / 4];
}; };
@ -167,7 +172,8 @@ extern struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1];
/* struct decision contains things we save across drawing frames for /* struct decision contains things we save across drawing frames for
* comparison (smart update stuff). */ * comparison (smart update stuff). */
struct decision { struct decision
{
/* Records the leftmost access of BPL1DAT. */ /* Records the leftmost access of BPL1DAT. */
int plfleft, plfright, plflinelen; int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */ /* Display window: native coordinates, depend on lores state. */
@ -184,7 +190,8 @@ struct decision {
/* Anything related to changes in hw registers during the DDF for one /* Anything related to changes in hw registers during the DDF for one
* line. */ * line. */
struct draw_info { struct draw_info
{
int first_sprite_entry, last_sprite_entry; int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change; int first_color_change, last_color_change;
int nr_color_changes, nr_sprites; int nr_color_changes, nr_sprites;
@ -195,15 +202,15 @@ extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
/* Functions in drawing.c. */ /* Functions in drawing.c. */
extern int coord_native_to_amiga_y (int); extern int coord_native_to_amiga_y(int);
extern int coord_native_to_amiga_x (int); extern int coord_native_to_amiga_x(int);
extern void hsync_record_line_state (int lineno); extern void hsync_record_line_state(int lineno);
extern void vsync_handle_redraw (void); extern void vsync_handle_redraw(void);
extern void vsync_handle_check (void); extern void vsync_handle_check(void);
extern void init_hardware_for_drawing_frame (void); extern void init_hardware_for_drawing_frame(void);
extern void reset_drawing (void); extern void reset_drawing(void);
extern void drawing_init (void); extern void drawing_init(void);
extern unsigned long time_per_frame; extern unsigned long time_per_frame;
extern void adjust_idletime(unsigned long ns_waited); extern void adjust_idletime(unsigned long ns_waited);
@ -217,15 +224,15 @@ extern void adjust_idletime(unsigned long ns_waited);
extern int inhibit_frame; extern int inhibit_frame;
STATIC_INLINE void set_inhibit_frame (int bit) STATIC_INLINE void set_inhibit_frame(int bit)
{ {
inhibit_frame |= 1 << bit; inhibit_frame |= 1 << bit;
} }
STATIC_INLINE void clear_inhibit_frame (int bit) STATIC_INLINE void clear_inhibit_frame(int bit)
{ {
inhibit_frame &= ~(1 << bit); inhibit_frame &= ~(1 << bit);
} }
STATIC_INLINE void toggle_inhibit_frame (int bit) STATIC_INLINE void toggle_inhibit_frame(int bit)
{ {
inhibit_frame ^= 1 << bit; inhibit_frame ^= 1 << bit;
} }

View file

@ -39,8 +39,8 @@ struct inputdevice_functions {
void (*unacquire)(int); void (*unacquire)(int);
void (*read)(void); void (*read)(void);
int (*get_num)(void); int (*get_num)(void);
TCHAR* (*get_friendlyname)(int); const TCHAR* (*get_friendlyname)(int);
TCHAR* (*get_uniquename)(int); const TCHAR* (*get_uniquename)(int);
int (*get_widget_num)(int); int (*get_widget_num)(int);
int (*get_widget_type)(int,int,TCHAR*,uae_u32*); int (*get_widget_type)(int,int,TCHAR*,uae_u32*);
int (*get_widget_first)(int,int); int (*get_widget_first)(int,int);

View file

@ -1,4 +1,4 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Stuff * Stuff
@ -7,13 +7,15 @@
* Copyright 1995-2001 Bernd Schmidt * Copyright 1995-2001 Bernd Schmidt
*/ */
#pragma once
#define UAEMAJOR 2 #define UAEMAJOR 2
#define UAEMINOR 5 #define UAEMINOR 5
#define UAESUBREV 1 #define UAESUBREV 1
extern long int version; extern long int version;
struct strlist { struct strlist
{
struct strlist *next; struct strlist *next;
TCHAR *option, *value; TCHAR *option, *value;
int unknown; int unknown;
@ -35,7 +37,8 @@ struct strlist {
#define MAX_INPUT_SUB_EVENT_ALL 9 #define MAX_INPUT_SUB_EVENT_ALL 9
#define SPARE_SUB_EVENT 8 #define SPARE_SUB_EVENT 8
struct uae_input_device { struct uae_input_device
{
TCHAR *name; TCHAR *name;
TCHAR *configname; TCHAR *configname;
uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
@ -49,7 +52,8 @@ struct uae_input_device {
#define MAX_JPORTS 4 #define MAX_JPORTS 4
#define NORMAL_JPORTS 2 #define NORMAL_JPORTS 2
#define MAX_JPORTNAME 128 #define MAX_JPORTNAME 128
struct jport { struct jport
{
int id; int id;
int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen
int autofire; int autofire;
@ -83,13 +87,15 @@ struct floppyslot
int dfxtype; int dfxtype;
}; };
struct wh { struct wh
{
int x, y; int x, y;
int width, height; int width, height;
}; };
#define MOUNT_CONFIG_SIZE 30 #define MOUNT_CONFIG_SIZE 30
struct uaedev_config_info { struct uaedev_config_info
{
TCHAR devname[MAX_DPATH]; TCHAR devname[MAX_DPATH];
TCHAR volname[MAX_DPATH]; TCHAR volname[MAX_DPATH];
TCHAR rootdir[MAX_DPATH]; TCHAR rootdir[MAX_DPATH];
@ -110,7 +116,8 @@ struct uaedev_config_info {
int pcyls, pheads, psecs; int pcyls, pheads, psecs;
}; };
struct uae_prefs { struct uae_prefs
{
struct strlist *all_lines; struct strlist *all_lines;
TCHAR description[256]; TCHAR description[256];
@ -225,77 +232,89 @@ struct uae_prefs {
struct uae_input_device mouse_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 keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256]; TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
}; };
/* Contains the filename of .uaerc */ /* Contains the filename of .uaerc */
extern void cfgfile_write (struct zfile *, const TCHAR *option, const TCHAR *format,...); 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_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_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_target_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b); 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_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_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_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value); 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_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_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_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, extern struct uaedev_config_info *add_filesys_config(struct uae_prefs *p,
const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, int index,
int cyls, int secspertrack, int surfaces, int reserved, const TCHAR *devname,
int blocksize, int bootpri, const TCHAR *filesysdir, int hdc, int flags, const TCHAR *volname,
int pcyls, int pheads, int psecs); const TCHAR *rootdir,
bool readonly,
int cyls,
int secspertrack,
int surfaces,
int reserved,
int blocksize,
int bootpri,
const TCHAR *filesysdir,
int hdc,
int flags,
int pcyls,
int pheads,
int psecs);
extern void default_prefs (struct uae_prefs *, int); extern void default_prefs(struct uae_prefs *, int);
extern void discard_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_a500(struct uae_prefs *p, int rom);
extern int bip_a500plus (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_a1200(struct uae_prefs *p, int rom);
extern int bip_a2000 (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_a4000(struct uae_prefs *p, int rom);
extern int bip_cd32 (struct uae_prefs *p, int rom); extern int bip_cd32(struct uae_prefs *p, int rom);
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_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_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_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 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 *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern TCHAR *target_expand_environment (const TCHAR *path); extern TCHAR *target_expand_environment(const TCHAR *path);
extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value); 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_save_options(struct zfile*, struct uae_prefs *);
extern void target_default_options (struct uae_prefs *, int type); extern void target_default_options(struct uae_prefs *, int type);
extern void target_fixup_options (struct uae_prefs *); extern void target_fixup_options(struct uae_prefs *);
extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault); 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 void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type);
extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig); 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 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_line(struct uae_prefs *p, TCHAR *, int);
extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, 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_get_description(const TCHAR *filename, TCHAR *description);
extern uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen); 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_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 uae_u32 cfgfile_modify(uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
extern void cfgfile_addcfgparam (TCHAR *); extern void cfgfile_addcfgparam(TCHAR *);
extern int cfgfile_configuration_change(int); extern int cfgfile_configuration_change(int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs); extern void fixup_prefs_dimensions(struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs); extern void fixup_prefs(struct uae_prefs *prefs);
extern void fixup_cpu (struct uae_prefs *prefs); extern void fixup_cpu(struct uae_prefs *prefs);
extern void check_prefs_changed_custom (void); extern void check_prefs_changed_custom(void);
extern void check_prefs_changed_cpu (void); extern void check_prefs_changed_cpu(void);
extern void check_prefs_changed_audio (void); extern void check_prefs_changed_audio(void);
extern void check_prefs_changed_cd (void); extern void check_prefs_changed_cd(void);
extern int check_prefs_changed_gfx (void); extern int check_prefs_changed_gfx(void);
extern struct uae_prefs currprefs, changed_prefs; extern struct uae_prefs currprefs, changed_prefs;
extern int machdep_init (void); extern int machdep_init(void);
extern void machdep_free (void); extern void machdep_free(void);

View file

@ -171,7 +171,10 @@ typedef unsigned char uae_u8;
typedef signed char uae_s8; typedef signed char uae_s8;
typedef char uae_char; typedef char uae_char;
typedef struct { uae_u8 RGB[3]; } RGB; typedef struct
{
uae_u8 RGB[3];
} RGB;
#if SIZEOF_SHORT == 2 #if SIZEOF_SHORT == 2
typedef unsigned short uae_u16; typedef unsigned short uae_u16;
@ -218,20 +221,20 @@ typedef uae_u32 uaecptr;
#ifdef HAVE_STRDUP #ifdef HAVE_STRDUP
#define my_strdup strdup #define my_strdup strdup
#else #else
extern TCHAR *my_strdup (const TCHAR*s); extern TCHAR *my_strdup(const TCHAR*s);
#endif #endif
extern TCHAR *my_strdup_ansi (const char*); extern TCHAR *my_strdup_ansi(const char*);
extern TCHAR *au (const char*); extern TCHAR *au(const char*);
extern char *ua (const TCHAR*); extern char *ua(const TCHAR*);
extern TCHAR *au_fs (const char*); extern TCHAR *au_fs(const char*);
extern char *ua_fs (const TCHAR*, int); extern char *ua_fs(const TCHAR*, int);
extern char *ua_copy (char *dst, int maxlen, const TCHAR *src); extern char *ua_copy(char *dst, int maxlen, const TCHAR *src);
extern TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src); extern TCHAR *au_copy(TCHAR *dst, int maxlen, const char *src);
extern char *ua_fs_copy (char *dst, int maxlen, const TCHAR *src, int defchar); extern char *ua_fs_copy(char *dst, int maxlen, const TCHAR *src, int defchar);
extern TCHAR *au_fs_copy (TCHAR *dst, int maxlen, const char *src); extern TCHAR *au_fs_copy(TCHAR *dst, int maxlen, const char *src);
extern char *uutf8 (const TCHAR *s); extern char *uutf8(const TCHAR *s);
extern TCHAR *utf8u (const char *s); extern TCHAR *utf8u(const char *s);
/* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known /* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known
* to have problems, and it's likely that other compilers choke too. */ * to have problems, and it's likely that other compilers choke too. */
@ -292,63 +295,63 @@ extern TCHAR *utf8u (const char *s);
#ifdef DONT_HAVE_POSIX #ifdef DONT_HAVE_POSIX
#define access posixemu_access #define access posixemu_access
extern int posixemu_access (const TCHAR *, int); extern int posixemu_access(const TCHAR *, int);
#define open posixemu_open #define open posixemu_open
extern int posixemu_open (const TCHAR *, int, int); extern int posixemu_open(const TCHAR *, int, int);
#define close posixemu_close #define close posixemu_close
extern void posixemu_close (int); extern void posixemu_close(int);
#define read posixemu_read #define read posixemu_read
extern int posixemu_read (int, TCHAR *, int); extern int posixemu_read(int, TCHAR *, int);
#define write posixemu_write #define write posixemu_write
extern int posixemu_write (int, const TCHAR *, int); extern int posixemu_write(int, const TCHAR *, int);
#undef lseek #undef lseek
#define lseek posixemu_seek #define lseek posixemu_seek
extern int posixemu_seek (int, int, int); extern int posixemu_seek(int, int, int);
#define stat(a,b) posixemu_stat ((a), (b)) #define stat(a,b) posixemu_stat ((a), (b))
extern int posixemu_stat (const TCHAR *, STAT *); extern int posixemu_stat(const TCHAR *, STAT *);
#define mkdir posixemu_mkdir #define mkdir posixemu_mkdir
extern int mkdir (const TCHAR *, int); extern int mkdir(const TCHAR *, int);
#define rmdir posixemu_rmdir #define rmdir posixemu_rmdir
extern int posixemu_rmdir (const TCHAR *); extern int posixemu_rmdir(const TCHAR *);
#define unlink posixemu_unlink #define unlink posixemu_unlink
extern int posixemu_unlink (const TCHAR *); extern int posixemu_unlink(const TCHAR *);
#define truncate posixemu_truncate #define truncate posixemu_truncate
extern int posixemu_truncate (const TCHAR *, long int); extern int posixemu_truncate(const TCHAR *, long int);
#define rename posixemu_rename #define rename posixemu_rename
extern int posixemu_rename (const TCHAR *, const TCHAR *); extern int posixemu_rename(const TCHAR *, const TCHAR *);
#define chmod posixemu_chmod #define chmod posixemu_chmod
extern int posixemu_chmod (const TCHAR *, int); extern int posixemu_chmod(const TCHAR *, int);
#define tmpnam posixemu_tmpnam #define tmpnam posixemu_tmpnam
extern void posixemu_tmpnam (TCHAR *); extern void posixemu_tmpnam(TCHAR *);
#define utime posixemu_utime #define utime posixemu_utime
extern int posixemu_utime (const TCHAR *, struct utimbuf *); extern int posixemu_utime(const TCHAR *, struct utimbuf *);
#define opendir posixemu_opendir #define opendir posixemu_opendir
extern DIR * posixemu_opendir (const TCHAR *); extern DIR * posixemu_opendir(const TCHAR *);
#define readdir posixemu_readdir #define readdir posixemu_readdir
extern struct dirent* readdir (DIR *); extern struct dirent* readdir(DIR *);
#define closedir posixemu_closedir #define closedir posixemu_closedir
extern void closedir (DIR *); extern void closedir(DIR *);
/* This isn't the best place for this, but it fits reasonably well. The logic /* This isn't the best place for this, but it fits reasonably well. The logic
* is that you probably don't have POSIX errnos if you don't have the above * is that you probably don't have POSIX errnos if you don't have the above
* functions. */ * functions. */
extern long dos_errno (void); extern long dos_errno(void);
#endif #endif
#ifdef DONT_HAVE_STDIO #ifdef DONT_HAVE_STDIO
extern FILE *stdioemu_fopen (const TCHAR *, const TCHAR *); extern FILE *stdioemu_fopen(const TCHAR *, const TCHAR *);
#define fopen(a,b) stdioemu_fopen(a, b) #define fopen(a,b) stdioemu_fopen(a, b)
extern int stdioemu_fseek (FILE *, int, int); extern int stdioemu_fseek(FILE *, int, int);
#define fseek(a,b,c) stdioemu_fseek(a, b, c) #define fseek(a,b,c) stdioemu_fseek(a, b, c)
extern int stdioemu_fread (TCHAR *, int, int, FILE *); extern int stdioemu_fread(TCHAR *, int, int, FILE *);
#define fread(a,b,c,d) stdioemu_fread(a, b, c, d) #define fread(a,b,c,d) stdioemu_fread(a, b, c, d)
extern int stdioemu_fwrite (const TCHAR *, int, int, FILE *); extern int stdioemu_fwrite(const TCHAR *, int, int, FILE *);
#define fwrite(a,b,c,d) stdioemu_fwrite(a, b, c, d) #define fwrite(a,b,c,d) stdioemu_fwrite(a, b, c, d)
extern int stdioemu_ftell (FILE *); extern int stdioemu_ftell(FILE *);
#define ftell(a) stdioemu_ftell(a) #define ftell(a) stdioemu_ftell(a)
extern int stdioemu_fclose (FILE *); extern int stdioemu_fclose(FILE *);
#define fclose(a) stdioemu_fclose(a) #define fclose(a) stdioemu_fclose(a)
#endif #endif
@ -356,9 +359,9 @@ extern int stdioemu_fclose (FILE *);
#ifdef DONT_HAVE_MALLOC #ifdef DONT_HAVE_MALLOC
#define malloc(a) mallocemu_malloc(a) #define malloc(a) mallocemu_malloc(a)
extern void *mallocemu_malloc (int size); extern void *mallocemu_malloc(int size);
#define free(a) mallocemu_free(a) #define free(a) mallocemu_free(a)
extern void mallocemu_free (void *ptr); extern void mallocemu_free(void *ptr);
#endif #endif
@ -378,11 +381,11 @@ extern void mallocemu_free (void *ptr);
#define write_log(FORMATO, RESTO...) #define write_log(FORMATO, RESTO...)
#define write_log_standard(FORMATO, RESTO...) #define write_log_standard(FORMATO, RESTO...)
#else #else
extern void write_log (const TCHAR *format,...); extern void write_log(const TCHAR *format, ...);
extern FILE *debugfile; extern FILE *debugfile;
#endif #endif
extern void console_out (const TCHAR *, ...); extern void console_out(const TCHAR *, ...);
extern void gui_message (const TCHAR *,...); extern void gui_message(const TCHAR *, ...);
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
@ -438,14 +441,22 @@ extern void gui_message (const TCHAR *,...);
#ifdef ARMV6_ASSEMBLY #ifdef ARMV6_ASSEMBLY
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ( STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v)
{
__asm__(
"rev %0, %0" "rev %0, %0"
: "=r" (v) : "0" (v) ); return v;} : "=r" (v) : "0" (v));
return v;
}
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ( STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v)
{
__asm__(
"revsh %0, %0\n\t" "revsh %0, %0\n\t"
"uxth %0, %0" "uxth %0, %0"
: "=r" (v) : "0" (v) ); return v;} : "=r" (v) : "0" (v));
return v;
}
#endif #endif
@ -461,9 +472,9 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ (
#define xrealloc(T, TP, N) realloc(TP, sizeof (T) * (N)) #define xrealloc(T, TP, N) realloc(TP, sizeof (T) * (N))
#if 0 #if 0
extern void *xmalloc (size_t); extern void *xmalloc(size_t);
extern void *xcalloc (size_t, size_t); extern void *xcalloc(size_t, size_t);
extern void xfree (const void*); extern void xfree(const void*);
#endif #endif
#else #else

View file

@ -23,7 +23,7 @@
* along with ARAnyM; if not, write to the Free Software * along with ARAnyM; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* MC68000 emulation * MC68000 emulation
@ -36,7 +36,7 @@
#include "options.h" #include "options.h"
#include "uae.h" #include "uae.h"
#include "memory.h" #include "include/memory.h"
#include "custom.h" #include "custom.h"
#include "newcpu.h" #include "newcpu.h"
#include "cpu_prefetch.h" #include "cpu_prefetch.h"
@ -56,7 +56,10 @@
#else #else
/* Need to have these somewhere */ /* Need to have these somewhere */
static void build_comp(void) {} static void build_comp(void) {}
bool check_prefs_changed_comp (void) { return false; } bool check_prefs_changed_comp(void)
{
return false;
}
#endif #endif
/* Opcode of faulting instruction */ /* Opcode of faulting instruction */
@ -71,8 +74,8 @@ static int last_writeaccess_for_exception_3;
static int last_instructionaccess_for_exception_3; static int last_instructionaccess_for_exception_3;
int cpu_cycles; int cpu_cycles;
const int areg_byteinc[] = { 1,1,1,1,1,1,1,2 }; const int areg_byteinc[] = { 1, 1, 1, 1, 1, 1, 1, 2 };
const int imm8_table[] = { 8,1,2,3,4,5,6,7 }; const int imm8_table[] = { 8, 1, 2, 3, 4, 5, 6, 7 };
int movem_index1[256]; int movem_index1[256];
int movem_index2[256]; int movem_index2[256];
@ -94,14 +97,14 @@ static uae_u16 mmusr_030;
static unsigned long int instrcount[65536]; static unsigned long int instrcount[65536];
static uae_u16 opcodenums[65536]; static uae_u16 opcodenums[65536];
static int compfn (const void *el1, const void *el2) static int compfn(const void *el1, const void *el2)
{ {
return instrcount[*(const uae_u16 *)el1] < instrcount[*(const uae_u16 *)el2]; return instrcount[*(const uae_u16 *)el1] < instrcount[*(const uae_u16 *)el2];
} }
static TCHAR *icountfilename (void) static TCHAR *icountfilename(void)
{ {
TCHAR *name = getenv ("INSNCOUNT"); TCHAR *name = getenv("INSNCOUNT");
if (name) if (name)
return name; return name;
return COUNT_INSTRS == 2 ? "frequent.68k" : "insncount"; return COUNT_INSTRS == 2 ? "frequent.68k" : "insncount";

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
#include "sysdeps.h" #include "sysdeps.h"
#include "config.h" #include "config.h"
#include "options.h" #include "options.h"
#include "memory.h" #include "include/memory.h"
#include "uae.h" #include "uae.h"
#include "autoconf.h" #include "autoconf.h"
#include "filesys.h" #include "filesys.h"
@ -22,6 +22,8 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 202 #define DIALOG_HEIGHT 202
extern std::string volName;
static bool dialogResult = false; static bool dialogResult = false;
static bool dialogFinished = false; static bool dialogFinished = false;
@ -43,16 +45,19 @@ static gcn::TextField *txtBootPri;
class FilesysVirtualActionListener : public gcn::ActionListener class FilesysVirtualActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
if(actionEvent.getSource() == cmdPath) if (actionEvent.getSource() == cmdPath)
{ {
char tmp[MAX_PATH]; char tmp[MAX_PATH];
strncpy(tmp, txtPath->getText().c_str(), MAX_PATH); strncpy(tmp, txtPath->getText().c_str(), MAX_PATH);
wndEditFilesysVirtual->releaseModalFocus(); wndEditFilesysVirtual->releaseModalFocus();
if(SelectFolder("Select folder", tmp)) if (SelectFolder("Select folder", tmp))
{
txtPath->setText(tmp); txtPath->setText(tmp);
txtVolume->setText(volName);
}
wndEditFilesysVirtual->requestModalFocus(); wndEditFilesysVirtual->requestModalFocus();
cmdPath->requestFocus(); cmdPath->requestFocus();
} }
@ -60,12 +65,12 @@ class FilesysVirtualActionListener : public gcn::ActionListener
{ {
if (actionEvent.getSource() == cmdOK) if (actionEvent.getSource() == cmdOK)
{ {
if(txtDevice->getText().length() <= 0) if (txtDevice->getText().length() <= 0)
{ {
wndEditFilesysVirtual->setCaption("Please enter a device name."); wndEditFilesysVirtual->setCaption("Please enter a device name.");
return; return;
} }
if(txtVolume->getText().length() <= 0) if (txtVolume->getText().length() <= 0)
{ {
wndEditFilesysVirtual->setCaption("Please enter a volume name."); wndEditFilesysVirtual->setCaption("Please enter a volume name.");
return; return;
@ -196,36 +201,36 @@ static void ExitEditFilesysVirtual(void)
static void EditFilesysVirtualLoop(void) static void EditFilesysVirtualLoop(void)
{ {
while(!dialogFinished) while (!dialogFinished)
{ {
SDL_Event event; SDL_Event event;
while(SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
if (event.type == SDL_KEYDOWN) if (event.type == SDL_KEYDOWN)
{ {
switch(event.key.keysym.sym) switch (event.key.keysym.sym)
{ {
case SDLK_ESCAPE: case SDLK_ESCAPE:
dialogFinished = true; dialogFinished = true;
break; break;
case SDLK_UP: case SDLK_UP:
if(HandleNavigation(DIRECTION_UP)) if (HandleNavigation(DIRECTION_UP))
continue; // Don't change value when enter ComboBox -> don't send event to control continue; // Don't change value when enter ComboBox -> don't send event to control
break; break;
case SDLK_DOWN: case SDLK_DOWN:
if(HandleNavigation(DIRECTION_DOWN)) if (HandleNavigation(DIRECTION_DOWN))
continue; // Don't change value when enter ComboBox -> don't send event to control continue; // Don't change value when enter ComboBox -> don't send event to control
break; break;
case SDLK_LEFT: case SDLK_LEFT:
if(HandleNavigation(DIRECTION_LEFT)) if (HandleNavigation(DIRECTION_LEFT))
continue; // Don't change value when enter Slider -> don't send event to control continue; // Don't change value when enter Slider -> don't send event to control
break; break;
case SDLK_RIGHT: case SDLK_RIGHT:
if(HandleNavigation(DIRECTION_RIGHT)) if (HandleNavigation(DIRECTION_RIGHT))
continue; // Don't change value when enter Slider -> don't send event to control continue; // Don't change value when enter Slider -> don't send event to control
break; break;
@ -267,7 +272,7 @@ bool EditFilesysVirtual(int unit_no)
InitEditFilesysVirtual(); InitEditFilesysVirtual();
if(unit_no >= 0) if (unit_no >= 0)
{ {
uci = &changed_prefs.mountconfig[unit_no]; uci = &changed_prefs.mountconfig[unit_no];
get_filesys_unitconfig(&changed_prefs, unit_no, &mi); get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
@ -296,16 +301,31 @@ bool EditFilesysVirtual(int unit_no)
EditFilesysVirtualLoop(); EditFilesysVirtualLoop();
if(dialogResult) if (dialogResult)
{ {
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0); int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath((char *) txtPath->getText().c_str(), currentDir); extractPath((char *) txtPath->getText().c_str(), currentDir);
uci = add_filesys_config(&changed_prefs, unit_no, (char *) txtDevice->getText().c_str(), uci = add_filesys_config(&changed_prefs,
(char *) txtVolume->getText().c_str(), (char *) txtPath->getText().c_str(), unit_no,
!chkReadWrite->isSelected(), 0, 0, 0, 0, 0, bp, 0, 0, 0, 0, 0, 0); (char *) txtDevice->getText().c_str(),
(char *) txtVolume->getText().c_str(),
(char *) txtPath->getText().c_str(),
!chkReadWrite->isSelected(),
0,
0,
0,
0,
0,
bp,
0,
0,
0,
0,
0,
0);
if (uci) if (uci)
filesys_media_change (uci->rootdir, 1, uci); filesys_media_change(uci->rootdir, 1, uci);
} }
ExitEditFilesysVirtual(); ExitEditFilesysVirtual();

View file

@ -14,12 +14,12 @@
extern SDL_Surface *prSDLScreen; extern SDL_Surface *prSDLScreen;
extern void flush_screen (); extern void flush_screen();
static int msg_done = 0; static int msg_done = 0;
class DoneActionListener : public gcn::ActionListener class DoneActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
msg_done = 1; msg_done = 1;
@ -92,17 +92,17 @@ void InGameMessage(const char *msg)
msg_done = 0; msg_done = 0;
bool drawn = false; bool drawn = false;
while(!msg_done) while (!msg_done)
{ {
//------------------------------------------------- //-------------------------------------------------
// Check user input // Check user input
//------------------------------------------------- //-------------------------------------------------
SDL_Event event; SDL_Event event;
while(SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
if (event.type == SDL_KEYDOWN) if (event.type == SDL_KEYDOWN)
{ {
switch(event.key.keysym.sym) switch (event.key.keysym.sym)
{ {
case SDLK_PAGEDOWN: case SDLK_PAGEDOWN:
case SDLK_HOME: case SDLK_HOME:
@ -123,8 +123,9 @@ void InGameMessage(const char *msg)
// Now we let the Gui object draw itself. // Now we let the Gui object draw itself.
msg_gui->draw(); msg_gui->draw();
// Finally we update the screen. // Finally we update the screen.
//SDL_Flip(prSDLScreen); if (!drawn)
flush_screen (); SDL_Flip(prSDLScreen);
drawn = true;
} }
msg_top->remove(wndMsg); msg_top->remove(wndMsg);

View file

@ -11,7 +11,7 @@
#include "sysdeps.h" #include "sysdeps.h"
#include "config.h" #include "config.h"
#include "options.h" #include "options.h"
#include "memory.h" #include "include/memory.h"
#include "uae.h" #include "uae.h"
#include "gui.h" #include "gui.h"
#include "gui_handling.h" #include "gui_handling.h"
@ -44,32 +44,37 @@ static gcn::Slider* sldGfxmem;
class MemorySliderActionListener : public gcn::ActionListener class MemorySliderActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
if (actionEvent.getSource() == sldChipmem) { if (actionEvent.getSource() == sldChipmem)
{
changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())]; changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0)) if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0))
changed_prefs.fastmem_size = 0; changed_prefs.fastmem_size = 0;
} }
if (actionEvent.getSource() == sldSlowmem) { if (actionEvent.getSource() == sldSlowmem)
{
changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())]; changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
} }
if (actionEvent.getSource() == sldFastmem) { if (actionEvent.getSource() == sldFastmem)
{
changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())]; changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())];
if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000) if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000)
changed_prefs.chipmem_size = 0x200000; changed_prefs.chipmem_size = 0x200000;
} }
if (actionEvent.getSource() == sldZ3mem) { if (actionEvent.getSource() == sldZ3mem)
{
changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())]; changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())];
if (changed_prefs.z3fastmem_size > max_z3fastmem) if (changed_prefs.z3fastmem_size > max_z3fastmem)
changed_prefs.z3fastmem_size = max_z3fastmem; changed_prefs.z3fastmem_size = max_z3fastmem;
} }
if (actionEvent.getSource() == sldGfxmem) { if (actionEvent.getSource() == sldGfxmem)
{
changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())]; changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())];
changed_prefs.rtgmem_type = 1; changed_prefs.rtgmem_type = 1;
} }
@ -199,9 +204,9 @@ void RefreshPanelRAM(void)
{ {
int i; int i;
for(i=0; i<5; ++i) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.chipmem_size == ChipMem_values[i]) if (changed_prefs.chipmem_size == ChipMem_values[i])
{ {
sldChipmem->setValue(i); sldChipmem->setValue(i);
lblChipsize->setCaption(ChipMem_list[i]); lblChipsize->setCaption(ChipMem_list[i]);
@ -209,9 +214,9 @@ void RefreshPanelRAM(void)
} }
} }
for(i=0; i<5; ++i) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.bogomem_size == SlowMem_values[i]) if (changed_prefs.bogomem_size == SlowMem_values[i])
{ {
sldSlowmem->setValue(i); sldSlowmem->setValue(i);
lblSlowsize->setCaption(SlowMem_list[i]); lblSlowsize->setCaption(SlowMem_list[i]);
@ -219,9 +224,9 @@ void RefreshPanelRAM(void)
} }
} }
for(i=0; i<5; ++i) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.fastmem_size == FastMem_values[i]) if (changed_prefs.fastmem_size == FastMem_values[i])
{ {
sldFastmem->setValue(i); sldFastmem->setValue(i);
lblFastsize->setCaption(FastMem_list[i]); lblFastsize->setCaption(FastMem_list[i]);
@ -229,9 +234,9 @@ void RefreshPanelRAM(void)
} }
} }
for(i=0; i<9; ++i) for (i = 0; i < 9; ++i)
{ {
if(changed_prefs.z3fastmem_size == FastMem_values[i]) if (changed_prefs.z3fastmem_size == FastMem_values[i])
{ {
sldZ3mem->setValue(i); sldZ3mem->setValue(i);
lblZ3size->setCaption(FastMem_list[i]); lblZ3size->setCaption(FastMem_list[i]);
@ -240,9 +245,9 @@ void RefreshPanelRAM(void)
} }
sldZ3mem->setEnabled(!changed_prefs.address_space_24); sldZ3mem->setEnabled(!changed_prefs.address_space_24);
for(i=0; i<6; ++i) for (i = 0; i < 6; ++i)
{ {
if(changed_prefs.rtgmem_size == FastMem_values[i]) if (changed_prefs.rtgmem_size == FastMem_values[i])
{ {
sldGfxmem->setValue(i); sldGfxmem->setValue(i);
lblGfxsize->setCaption(FastMem_list[i]); lblGfxsize->setCaption(FastMem_list[i]);

View file

@ -19,7 +19,7 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400 #define DIALOG_HEIGHT 400
#ifdef RASPBERRY #if defined(RASPBERRY) || defined(ANDROID)
#define FILE_SELECT_KEEP_POSITION #define FILE_SELECT_KEEP_POSITION
#endif #endif
@ -46,7 +46,7 @@ class SelectFileListModel : public gcn::ListModel
std::vector<std::string> dirs; std::vector<std::string> dirs;
std::vector<std::string> files; std::vector<std::string> files;
public: public:
SelectFileListModel(const char * path) SelectFileListModel(const char * path)
{ {
changeDir(path); changeDir(path);
@ -59,9 +59,9 @@ class SelectFileListModel : public gcn::ListModel
std::string getElementAt(int i) std::string getElementAt(int i)
{ {
if(i >= dirs.size() + files.size() || i < 0) if (i >= dirs.size() + files.size() || i < 0)
return "---"; return "---";
if(i < dirs.size()) if (i < dirs.size())
return dirs[i]; return dirs[i];
return files[i - dirs.size()]; return files[i - dirs.size()];
} }
@ -69,7 +69,7 @@ class SelectFileListModel : public gcn::ListModel
void changeDir(const char *path) void changeDir(const char *path)
{ {
ReadDirectory(path, &dirs, &files); ReadDirectory(path, &dirs, &files);
if(dirs.size() == 0) if (dirs.size() == 0)
dirs.push_back(".."); dirs.push_back("..");
FilterFiles(&files, filefilter); FilterFiles(&files, filefilter);
} }
@ -84,31 +84,31 @@ static SelectFileListModel *fileList;
class FileButtonActionListener : public gcn::ActionListener class FileButtonActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
if (actionEvent.getSource() == cmdOK) if (actionEvent.getSource() == cmdOK)
{ {
int selected_item; int selected_item;
selected_item = lstFiles->getSelected(); selected_item = lstFiles->getSelected();
if(createNew) if (createNew)
{ {
char tmp[MAX_PATH]; char tmp[MAX_PATH];
if(txtFilename->getText().length() <= 0) if (txtFilename->getText().length() <= 0)
return; return;
strcpy(tmp, workingDir); strcpy(tmp, workingDir);
strcat(tmp, "/"); strcat(tmp, "/");
strcat(tmp, txtFilename->getText().c_str()); strcat(tmp, txtFilename->getText().c_str());
if(strstr(tmp, filefilter[0]) == NULL) if (strstr(tmp, filefilter[0]) == NULL)
strcat(tmp, filefilter[0]); strcat(tmp, filefilter[0]);
if(my_existsfile(tmp) == 1) if (my_existsfile(tmp) == 1)
return; // File already exists return; // File already exists
strcpy(workingDir, tmp); strcpy(workingDir, tmp);
dialogResult = true; dialogResult = true;
} }
else else
{ {
if(fileList->isDir(selected_item)) if (fileList->isDir(selected_item))
return; // Directory selected -> Ok not possible return; // Directory selected -> Ok not possible
strcat(workingDir, "/"); strcat(workingDir, "/");
strcat(workingDir, fileList->getElementAt(selected_item).c_str()); strcat(workingDir, fileList->getElementAt(selected_item).c_str());
@ -121,10 +121,10 @@ class FileButtonActionListener : public gcn::ActionListener
static FileButtonActionListener* fileButtonActionListener; static FileButtonActionListener* fileButtonActionListener;
static void checkfoldername (char *current) static void checkfoldername(char *current)
{ {
char *ptr; char *ptr;
char actualpath [MAX_PATH]; char actualpath[MAX_PATH];
DIR *dir; DIR *dir;
if (dir = opendir(current)) if (dir = opendir(current))
@ -143,9 +143,9 @@ static void checkfilename(char *current)
{ {
char actfile[MAX_PATH]; char actfile[MAX_PATH];
extractFileName(current, actfile); extractFileName(current, actfile);
for(int i=0; i<fileList->getNumberOfElements(); ++i) for (int i = 0; i < fileList->getNumberOfElements(); ++i)
{ {
if(!fileList->isDir(i) && !strcasecmp(fileList->getElementAt(i).c_str(), actfile)) if (!fileList->isDir(i) && !strcasecmp(fileList->getElementAt(i).c_str(), actfile))
{ {
lstFiles->setSelected(i); lstFiles->setSelected(i);
selectedOnStart = i; selectedOnStart = i;
@ -157,7 +157,7 @@ static void checkfilename(char *current)
class SelectFileActionListener : public gcn::ActionListener class SelectFileActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
int selected_item; int selected_item;
@ -167,9 +167,9 @@ class SelectFileActionListener : public gcn::ActionListener
strcpy(foldername, workingDir); strcpy(foldername, workingDir);
strcat(foldername, "/"); strcat(foldername, "/");
strcat(foldername, fileList->getElementAt(selected_item).c_str()); strcat(foldername, fileList->getElementAt(selected_item).c_str());
if(fileList->isDir(selected_item)) if (fileList->isDir(selected_item))
checkfoldername(foldername); checkfoldername(foldername);
else if(!createNew) else if (!createNew)
{ {
strncpy(workingDir, foldername, sizeof(workingDir)); strncpy(workingDir, foldername, sizeof(workingDir));
dialogResult = true; dialogResult = true;
@ -224,7 +224,7 @@ static void InitSelectFile(const char *title)
scrAreaFiles->setScrollbarWidth(20); scrAreaFiles->setScrollbarWidth(20);
scrAreaFiles->setBaseColor(gui_baseCol + 0x202020); scrAreaFiles->setBaseColor(gui_baseCol + 0x202020);
if(createNew) if (createNew)
{ {
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y); scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y);
lblFilename = new gcn::Label("Filename:"); lblFilename = new gcn::Label("Filename:");
@ -267,7 +267,7 @@ static void ExitSelectFile(void)
delete scrAreaFiles; delete scrAreaFiles;
delete selectFileActionListener; delete selectFileActionListener;
delete fileList; delete fileList;
if(createNew) if (createNew)
{ {
delete lblFilename; delete lblFilename;
delete txtFilename; delete txtFilename;
@ -279,14 +279,14 @@ static void ExitSelectFile(void)
static void SelectFileLoop(void) static void SelectFileLoop(void)
{ {
while(!dialogFinished) while (!dialogFinished)
{ {
SDL_Event event; SDL_Event event;
while(SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
if (event.type == SDL_KEYDOWN) if (event.type == SDL_KEYDOWN)
{ {
switch(event.key.keysym.sym) switch (event.key.keysym.sym)
{ {
case SDLK_ESCAPE: case SDLK_ESCAPE:
dialogFinished = true; dialogFinished = true;
@ -296,16 +296,16 @@ static void SelectFileLoop(void)
{ {
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused(); gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFiles) if (activeWidget == lstFiles)
cmdCancel->requestFocus(); cmdCancel->requestFocus();
else if(activeWidget == cmdCancel) else if (activeWidget == cmdCancel)
cmdOK->requestFocus(); cmdOK->requestFocus();
else if(activeWidget == cmdOK) else if (activeWidget == cmdOK)
if(createNew) if (createNew)
txtFilename->requestFocus(); txtFilename->requestFocus();
else else
lstFiles->requestFocus(); lstFiles->requestFocus();
else if(activeWidget == txtFilename) else if (activeWidget == txtFilename)
lstFiles->requestFocus(); lstFiles->requestFocus();
continue; continue;
} }
@ -315,16 +315,16 @@ static void SelectFileLoop(void)
{ {
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused(); gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFiles) if (activeWidget == lstFiles)
if(createNew) if (createNew)
txtFilename->requestFocus(); txtFilename->requestFocus();
else else
cmdOK->requestFocus(); cmdOK->requestFocus();
else if(activeWidget == txtFilename) else if (activeWidget == txtFilename)
cmdOK->requestFocus(); cmdOK->requestFocus();
else if(activeWidget == cmdCancel) else if (activeWidget == cmdCancel)
lstFiles->requestFocus(); lstFiles->requestFocus();
else if(activeWidget == cmdOK) else if (activeWidget == cmdOK)
cmdCancel->requestFocus(); cmdCancel->requestFocus();
continue; continue;
} }
@ -353,10 +353,10 @@ static void SelectFileLoop(void)
wait_for_vsync(); wait_for_vsync();
SDL_Flip(gui_screen); SDL_Flip(gui_screen);
if(!dialogCreated) if (!dialogCreated)
{ {
dialogCreated = true; dialogCreated = true;
if(selectedOnStart >= 0) if (selectedOnStart >= 0)
scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19); scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19);
} }
} }
@ -375,27 +375,28 @@ bool SelectFile(const char *title, char *value, const char *filter[], bool creat
dialogCreated = false; dialogCreated = false;
selectedOnStart = -1; selectedOnStart = -1;
#ifdef FILE_SELECT_KEEP_POSITION #ifdef FILE_SELECT_KEEP_POSITION
if (Already_init == 0) if (Already_init == 0)
{ {
InitSelectFile(title); InitSelectFile(title);
Already_init = 1; Already_init = 1;
} else }
else
{ {
strncpy(value,workingDir,MAX_PATH); strncpy(value, workingDir, MAX_PATH);
gui_top->add(wndSelectFile); gui_top->add(wndSelectFile);
wndSelectFile->setCaption(title); wndSelectFile->setCaption(title);
wndSelectFile->requestModalFocus(); wndSelectFile->requestModalFocus();
wndSelectFile->setVisible(true); wndSelectFile->setVisible(true);
gui_top->moveToTop(wndSelectFile); gui_top->moveToTop(wndSelectFile);
} }
#else #else
InitSelectFile(title); InitSelectFile(title);
#endif #endif
extractPath(value, workingDir); extractPath(value, workingDir);
checkfoldername(workingDir); checkfoldername(workingDir);
checkfilename(value); checkfilename(value);
SelectFileLoop(); SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION #ifdef FILE_SELECT_KEEP_POSITION
wndSelectFile->releaseModalFocus(); wndSelectFile->releaseModalFocus();
@ -403,11 +404,11 @@ bool SelectFile(const char *title, char *value, const char *filter[], bool creat
#else #else
ExitSelectFile(); ExitSelectFile();
#endif #endif
if(dialogResult) if (dialogResult)
strncpy(value, workingDir, MAX_PATH); strncpy(value, workingDir, MAX_PATH);
#ifdef FILE_SELECT_KEEP_POSITION #ifdef FILE_SELECT_KEEP_POSITION
else else
strncpy(workingDir,value, MAX_PATH); strncpy(workingDir, value, MAX_PATH);
#endif #endif
return dialogResult; return dialogResult;
} }

View file

@ -17,6 +17,7 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400 #define DIALOG_HEIGHT 400
std::string volName;
static bool dialogResult = false; static bool dialogResult = false;
static bool dialogFinished = false; static bool dialogFinished = false;
static char workingDir[MAX_PATH]; static char workingDir[MAX_PATH];
@ -31,7 +32,7 @@ static gcn::TextField *txtCurrent;
class ButtonActionListener : public gcn::ActionListener class ButtonActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
if (actionEvent.getSource() == cmdOK) if (actionEvent.getSource() == cmdOK)
@ -48,7 +49,7 @@ class DirListModel : public gcn::ListModel
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
public: public:
DirListModel(const char * path) DirListModel(const char * path)
{ {
changeDir(path); changeDir(path);
@ -61,7 +62,7 @@ class DirListModel : public gcn::ListModel
std::string getElementAt(int i) std::string getElementAt(int i)
{ {
if(i >= dirs.size() || i < 0) if (i >= dirs.size() || i < 0)
return "---"; return "---";
return dirs[i]; return dirs[i];
} }
@ -69,17 +70,17 @@ class DirListModel : public gcn::ListModel
void changeDir(const char *path) void changeDir(const char *path)
{ {
ReadDirectory(path, &dirs, NULL); ReadDirectory(path, &dirs, NULL);
if(dirs.size() == 0) if (dirs.size() == 0)
dirs.push_back(".."); dirs.push_back("..");
} }
}; };
static DirListModel dirList("."); static DirListModel dirList(".");
static void checkfoldername (char *current) static void checkfoldername(char *current)
{ {
char *ptr; char *ptr;
char actualpath [PATH_MAX]; char actualpath[PATH_MAX];
DIR *dir; DIR *dir;
if (dir = opendir(current)) if (dir = opendir(current))
@ -97,7 +98,7 @@ static void checkfoldername (char *current)
class ListBoxActionListener : public gcn::ActionListener class ListBoxActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
int selected_item; int selected_item;
@ -107,6 +108,7 @@ class ListBoxActionListener : public gcn::ActionListener
strcpy(foldername, workingDir); strcpy(foldername, workingDir);
strcat(foldername, "/"); strcat(foldername, "/");
strcat(foldername, dirList.getElementAt(selected_item).c_str()); strcat(foldername, dirList.getElementAt(selected_item).c_str());
volName = dirList.getElementAt(selected_item).c_str();
checkfoldername(foldername); checkfoldername(foldername);
} }
}; };
@ -189,14 +191,14 @@ static void ExitSelectFolder(void)
static void SelectFolderLoop(void) static void SelectFolderLoop(void)
{ {
while(!dialogFinished) while (!dialogFinished)
{ {
SDL_Event event; SDL_Event event;
while(SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
if (event.type == SDL_KEYDOWN) if (event.type == SDL_KEYDOWN)
{ {
switch(event.key.keysym.sym) switch (event.key.keysym.sym)
{ {
case SDLK_ESCAPE: case SDLK_ESCAPE:
dialogFinished = true; dialogFinished = true;
@ -206,11 +208,11 @@ static void SelectFolderLoop(void)
{ {
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused(); gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFolders) if (activeWidget == lstFolders)
cmdCancel->requestFocus(); cmdCancel->requestFocus();
else if(activeWidget == cmdCancel) else if (activeWidget == cmdCancel)
cmdOK->requestFocus(); cmdOK->requestFocus();
else if(activeWidget == cmdOK) else if (activeWidget == cmdOK)
lstFolders->requestFocus(); lstFolders->requestFocus();
continue; continue;
} }
@ -220,11 +222,11 @@ static void SelectFolderLoop(void)
{ {
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused(); gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFolders) if (activeWidget == lstFolders)
cmdOK->requestFocus(); cmdOK->requestFocus();
else if(activeWidget == cmdCancel) else if (activeWidget == cmdCancel)
lstFolders->requestFocus(); lstFolders->requestFocus();
else if(activeWidget == cmdOK) else if (activeWidget == cmdOK)
cmdCancel->requestFocus(); cmdCancel->requestFocus();
continue; continue;
} }
@ -264,10 +266,10 @@ bool SelectFolder(const char *title, char *value)
checkfoldername(value); checkfoldername(value);
SelectFolderLoop(); SelectFolderLoop();
ExitSelectFolder(); ExitSelectFolder();
if(dialogResult) if (dialogResult)
{ {
strncpy(value, workingDir, MAX_PATH); strncpy(value, workingDir, MAX_PATH);
if(value[strlen(value) - 1] != '/') if (value[strlen(value) - 1] != '/')
strcat(value, "/"); strcat(value, "/");
} }
return dialogResult; return dialogResult;

View file

@ -25,7 +25,7 @@ static void SetPresetMode(int mode, struct uae_prefs *p)
{ {
presetModeId = mode; presetModeId = mode;
switch(mode) switch (mode)
{ {
case 0: case 0:
p->gfx_size.height = 200; p->gfx_size.height = 200;
@ -274,7 +274,7 @@ static void SetPresetMode(int mode, struct uae_prefs *p)
break; break;
} }
switch(presetModeId / 10) switch (presetModeId / 10)
{ {
case 0: case 0:
p->gfx_size.width = 320; p->gfx_size.width = 320;
@ -311,11 +311,11 @@ static void SetDefaultMenuSettings(struct uae_prefs *p)
} }
static void replace(char * str,char replace, char toreplace) static void replace(char * str, char replace, char toreplace)
{ {
while(*str) while (*str)
{ {
if (*str==toreplace) *str=replace; if (*str == toreplace) *str = replace;
str++; str++;
} }
} }
@ -328,7 +328,7 @@ int create_configfilename(char *dest, char *basename, int fromDir)
while (*p != '/') while (*p != '/')
p--; p--;
p++; p++;
if(fromDir == 0) if (fromDir == 0)
{ {
int len = strlen(p) + 1; int len = strlen(p) + 1;
char filename[len]; char filename[len];
@ -338,7 +338,7 @@ int create_configfilename(char *dest, char *basename, int fromDir)
pch--; pch--;
if (pch) if (pch)
{ {
*pch='\0'; *pch = '\0';
snprintf(dest, 300, "%s/conf/%s.uae", start_path_data, filename); snprintf(dest, 300, "%s/conf/%s.uae", start_path_data, filename);
return 1; return 1;
} }
@ -356,7 +356,7 @@ int create_configfilename(char *dest, char *basename, int fromDir)
const char *kickstarts_rom_names[] = { "kick12.rom\0", "kick13.rom\0", "kick20.rom\0", "kick31.rom\0", "aros-amiga-m68k-rom.bin\0" }; const char *kickstarts_rom_names[] = { "kick12.rom\0", "kick13.rom\0", "kick20.rom\0", "kick31.rom\0", "aros-amiga-m68k-rom.bin\0" };
const char *extended_rom_names[] = { "\0", "\0", "\0", "\0", "aros-amiga-m68k-ext.bin\0" }; const char *extended_rom_names[] = { "\0", "\0", "\0", "\0", "aros-amiga-m68k-ext.bin\0" };
const char *kickstarts_names[] = { "KS ROM v1.2\0", "KS ROM v1.3\0", "KS ROM v2.05\0", "KS ROM v3.1\0", "\0" }; const char *kickstarts_names[] = { "KS ROM v1.2\0", "KS ROM v1.3\0", "KS ROM v2.05\0", "KS ROM v3.1\0", "\0" };
#ifdef ANDROIDSDL #ifdef ANDROID
const char *af_kickstarts_rom_names[] = { "amiga-os-120.rom\0", "amiga-os-130.rom\0", "amiga-os-204.rom\0", "amiga-os-310-a1200.rom\0" }; const char *af_kickstarts_rom_names[] = { "amiga-os-120.rom\0", "amiga-os-130.rom\0", "amiga-os-204.rom\0", "amiga-os-310-a1200.rom\0" };
#endif #endif
@ -368,9 +368,9 @@ static bool CheckKickstart(struct uae_prefs *p)
// Search via filename // Search via filename
fetch_rompath(kickpath, MAX_DPATH); fetch_rompath(kickpath, MAX_DPATH);
strncat(kickpath, kickstarts_rom_names[kickstart], MAX_DPATH); strncat(kickpath, kickstarts_rom_names[kickstart], MAX_DPATH);
for(i=0; i<lstAvailableROMs.size(); ++i) for (i = 0; i < lstAvailableROMs.size(); ++i)
{ {
if(!strcasecmp(lstAvailableROMs[i]->Path, kickpath)) if (!strcasecmp(lstAvailableROMs[i]->Path, kickpath))
{ {
// Found it // Found it
strncpy(p->romfile, kickpath, sizeof(p->romfile)); strncpy(p->romfile, kickpath, sizeof(p->romfile));
@ -379,11 +379,11 @@ static bool CheckKickstart(struct uae_prefs *p)
} }
// Search via name // Search via name
if(strlen(kickstarts_names[kickstart]) > 0) if (strlen(kickstarts_names[kickstart]) > 0)
{ {
for(i=0; i<lstAvailableROMs.size(); ++i) for (i = 0; i < lstAvailableROMs.size(); ++i)
{ {
if(!strncasecmp(lstAvailableROMs[i]->Name, kickstarts_names[kickstart], strlen(kickstarts_names[kickstart]))) if (!strncasecmp(lstAvailableROMs[i]->Name, kickstarts_names[kickstart], strlen(kickstarts_names[kickstart])))
{ {
// Found it // Found it
strncpy(p->romfile, lstAvailableROMs[i]->Path, sizeof(p->romfile)); strncpy(p->romfile, lstAvailableROMs[i]->Path, sizeof(p->romfile));
@ -404,15 +404,16 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
strcpy(path, orgpath); strcpy(path, orgpath);
char *ptr = strstr(path, ".uae"); char *ptr = strstr(path, ".uae");
if(ptr > 0) if (ptr > 0)
{ {
*(ptr + 1) = '\0'; *(ptr + 1) = '\0';
strcat(path, "conf"); strcat(path, "conf");
} }
FILE *f=fopen(path,"rt"); FILE *f = fopen(path, "rt");
if (!f){ if (!f)
write_log ("No config file %s!\n",path); {
write_log("No config file %s!\n", path);
return 0; return 0;
} }
else else
@ -424,91 +425,97 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
char filebuffer[256]; char filebuffer[256];
int dummy; int dummy;
fscanf(f,"kickstart=%d\n",&kickstart); fscanf(f, "kickstart=%d\n", &kickstart);
#if defined(PANDORA) || defined(ANDROIDSDL) #if defined(PANDORA) || defined(ANDROIDSDL)
fscanf(f,"scaling=%d\n",&dummy); fscanf(f, "scaling=%d\n", &dummy);
#else #else
fscanf(f,"scaling=%d\n",&mainMenu_enableHWscaling); fscanf(f, "scaling=%d\n", &mainMenu_enableHWscaling);
#endif #endif
fscanf(f,"showstatus=%d\n", &p->leds_on_screen); fscanf(f, "showstatus=%d\n", &p->leds_on_screen);
fscanf(f,"mousemultiplier=%d\n", &p->input_joymouse_multiplier); fscanf(f, "mousemultiplier=%d\n", &p->input_joymouse_multiplier);
p->input_joymouse_multiplier *= 10; p->input_joymouse_multiplier *= 10;
#if defined(PANDORA) || defined(ANDROIDSDL) #if defined(PANDORA) || defined(ANDROIDSDL)
fscanf(f,"systemclock=%d\n",&dummy); // mainMenu_throttle never changes -> removed fscanf(f, "systemclock=%d\n", &dummy); // mainMenu_throttle never changes -> removed
fscanf(f,"syncthreshold=%d\n", &dummy); // timeslice_mode never changes -> removed fscanf(f, "syncthreshold=%d\n", &dummy); // timeslice_mode never changes -> removed
#else #else
fscanf(f,"systemclock=%d\n",&mainMenu_throttle); fscanf(f, "systemclock=%d\n", &mainMenu_throttle);
fscanf(f,"syncthreshold=%d\n", &timeslice_mode); fscanf(f, "syncthreshold=%d\n", &timeslice_mode);
#endif #endif
fscanf(f,"frameskip=%d\n", &p->gfx_framerate); fscanf(f, "frameskip=%d\n", &p->gfx_framerate);
fscanf(f,"sound=%d\n",&p->produce_sound ); fscanf(f, "sound=%d\n", &p->produce_sound);
if(p->produce_sound >= 10) if (p->produce_sound >= 10)
{ {
p->sound_stereo = 1; p->sound_stereo = 1;
p->produce_sound -= 10; p->produce_sound -= 10;
if(p->produce_sound > 0) if (p->produce_sound > 0)
p->produce_sound += 1; p->produce_sound += 1;
} }
else else
p->sound_stereo = 0; p->sound_stereo = 0;
fscanf(f,"soundrate=%d\n",&p->sound_freq); fscanf(f, "soundrate=%d\n", &p->sound_freq);
fscanf(f,"autosave=%d\n", &dummy); fscanf(f, "autosave=%d\n", &dummy);
fscanf(f,"gp2xclock=%d\n", &dummy); fscanf(f, "gp2xclock=%d\n", &dummy);
int joybuffer = 0; int joybuffer = 0;
fscanf(f,"joyconf=%d\n",&joybuffer); fscanf(f, "joyconf=%d\n", &joybuffer);
fscanf(f,"autofireRate=%d\n",&p->input_autofire_linecnt); fscanf(f, "autofireRate=%d\n", &p->input_autofire_linecnt);
p->input_autofire_linecnt = p->input_autofire_linecnt * 312; p->input_autofire_linecnt = p->input_autofire_linecnt * 312;
fscanf(f,"autofire=%d\n", &dummy); fscanf(f, "autofire=%d\n", &dummy);
fscanf(f,"stylusOffset=%d\n",&dummy); fscanf(f, "stylusOffset=%d\n", &dummy);
fscanf(f,"tapDelay=%d\n",&p->pandora_tapDelay); fscanf(f, "tapDelay=%d\n", &p->pandora_tapDelay);
fscanf(f,"scanlines=%d\n", &dummy); fscanf(f, "scanlines=%d\n", &dummy);
#if defined(PANDORA) || defined(ANDROIDSDL) #if defined(PANDORA) || defined(ANDROIDSDL)
fscanf(f,"ham=%d\n",&dummy); fscanf(f, "ham=%d\n", &dummy);
#else #else
fscanf(f,"ham=%d\n",&mainMenu_ham); fscanf(f, "ham=%d\n", &mainMenu_ham);
#endif #endif
fscanf(f,"enableScreenshots=%d\n", &dummy); fscanf(f, "enableScreenshots=%d\n", &dummy);
fscanf(f,"floppyspeed=%d\n",&p->floppy_speed); fscanf(f, "floppyspeed=%d\n", &p->floppy_speed);
fscanf(f,"drives=%d\n", &p->nr_floppies); fscanf(f, "drives=%d\n", &p->nr_floppies);
fscanf(f,"videomode=%d\n", &p->ntscmode); fscanf(f, "videomode=%d\n", &p->ntscmode);
if(p->ntscmode) if (p->ntscmode)
p->chipset_refreshrate = 60; p->chipset_refreshrate = 60;
else else
p->chipset_refreshrate = 50; p->chipset_refreshrate = 50;
fscanf(f,"mainMenu_cpuSpeed=%d\n",&p->pandora_cpu_speed); fscanf(f, "mainMenu_cpuSpeed=%d\n", &p->pandora_cpu_speed);
fscanf(f,"presetModeId=%d\n",&presetModeId); fscanf(f, "presetModeId=%d\n", &presetModeId);
fscanf(f,"moveX=%d\n", &p->pandora_horizontal_offset); fscanf(f, "moveX=%d\n", &p->pandora_horizontal_offset);
fscanf(f,"moveY=%d\n", &p->pandora_vertical_offset); fscanf(f, "moveY=%d\n", &p->pandora_vertical_offset);
fscanf(f,"displayedLines=%d\n",&p->gfx_size.height); fscanf(f, "displayedLines=%d\n", &p->gfx_size.height);
fscanf(f,"screenWidth=%d\n", &p->gfx_size_fs.width); fscanf(f, "screenWidth=%d\n", &p->gfx_size_fs.width);
fscanf(f,"cutLeft=%d\n", &dummy); fscanf(f, "cutLeft=%d\n", &dummy);
fscanf(f,"cutRight=%d\n", &dummy); fscanf(f, "cutRight=%d\n", &dummy);
fscanf(f,"customControls=%d\n",&p->pandora_customControls); fscanf(f, "customControls=%d\n", &p->pandora_customControls);
fscanf(f,"custom_dpad=%d\n",&dummy); fscanf(f, "custom_dpad=%d\n", &dummy);
fscanf(f,"custom_up=%d\n",&customControlMap[SDLK_UP]); fscanf(f, "custom_up=%d\n", &customControlMap[SDLK_UP]);
fscanf(f,"custom_down=%d\n",&customControlMap[SDLK_DOWN]); fscanf(f, "custom_down=%d\n", &customControlMap[SDLK_DOWN]);
fscanf(f,"custom_left=%d\n",&customControlMap[SDLK_LEFT]); fscanf(f, "custom_left=%d\n", &customControlMap[SDLK_LEFT]);
fscanf(f,"custom_right=%d\n",&customControlMap[SDLK_RIGHT]); fscanf(f, "custom_right=%d\n", &customControlMap[SDLK_RIGHT]);
fscanf(f,"custom_A=%d\n",&customControlMap[SDLK_HOME]); fscanf(f, "custom_A=%d\n", &customControlMap[SDLK_HOME]);
fscanf(f,"custom_B=%d\n",&customControlMap[SDLK_END]); fscanf(f, "custom_B=%d\n", &customControlMap[SDLK_END]);
fscanf(f,"custom_X=%d\n",&customControlMap[SDLK_PAGEDOWN]); fscanf(f, "custom_X=%d\n", &customControlMap[SDLK_PAGEDOWN]);
fscanf(f,"custom_Y=%d\n",&customControlMap[SDLK_PAGEUP]); fscanf(f, "custom_Y=%d\n", &customControlMap[SDLK_PAGEUP]);
fscanf(f,"custom_L=%d\n",&customControlMap[SDLK_RSHIFT]); fscanf(f, "custom_L=%d\n", &customControlMap[SDLK_RSHIFT]);
fscanf(f,"custom_R=%d\n",&customControlMap[SDLK_RCTRL]); fscanf(f, "custom_R=%d\n", &customControlMap[SDLK_RCTRL]);
fscanf(f,"cpu=%d\n", &cpu_level); fscanf(f, "cpu=%d\n", &cpu_level);
if(cpu_level > 0) // M68000 if (cpu_level > 0) // M68000
// Was old format // Was old format
cpu_level = 2; // M68020 cpu_level = 2; // M68020
fscanf(f,"chipset=%d\n", &p->chipset_mask); fscanf(f, "chipset=%d\n", &p->chipset_mask);
p->immediate_blits = (p->chipset_mask & 0x100) == 0x100; p->immediate_blits = (p->chipset_mask & 0x100) == 0x100;
switch (p->chipset_mask & 0xff) switch (p->chipset_mask & 0xff)
{ {
case 1: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; break; case 1:
case 2: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; break; p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
default: p->chipset_mask = CSMASK_ECS_AGNUS; break; break;
case 2:
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA;
break;
default:
p->chipset_mask = CSMASK_ECS_AGNUS;
break;
} }
fscanf(f,"cpu=%d\n", &p->m68k_speed); fscanf(f, "cpu=%d\n", &p->m68k_speed);
if(p->m68k_speed < 0) if (p->m68k_speed < 0)
{ {
// New version of this option // New version of this option
p->m68k_speed = -p->m68k_speed; p->m68k_speed = -p->m68k_speed;
@ -516,22 +523,22 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
else else
{ {
// Old version (500 5T 1200 12T 12T2) // Old version (500 5T 1200 12T 12T2)
if(p->m68k_speed >= 2) if (p->m68k_speed >= 2)
{ {
// 1200: set to 68020 with 14 MHz // 1200: set to 68020 with 14 MHz
cpu_level = 2; // M68020 cpu_level = 2; // M68020
p->m68k_speed--; p->m68k_speed--;
if(p->m68k_speed > 2) if (p->m68k_speed > 2)
p->m68k_speed = 2; p->m68k_speed = 2;
} }
} }
if(p->m68k_speed == 1) if (p->m68k_speed == 1)
p->m68k_speed = M68K_SPEED_14MHZ_CYCLES; p->m68k_speed = M68K_SPEED_14MHZ_CYCLES;
if(p->m68k_speed == 2) if (p->m68k_speed == 2)
p->m68k_speed = M68K_SPEED_25MHZ_CYCLES; p->m68k_speed = M68K_SPEED_25MHZ_CYCLES;
p->cachesize = 0; p->cachesize = 0;
p->cpu_compatible = 0; p->cpu_compatible = 0;
switch(cpu_level) switch (cpu_level)
{ {
case 0: case 0:
p->cpu_model = 68000; p->cpu_model = 68000;
@ -559,99 +566,69 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
disk_eject(1); disk_eject(1);
disk_eject(2); disk_eject(2);
disk_eject(3); disk_eject(3);
fscanf(f,"df0=%s\n",&filebuffer); fscanf(f, "df0=%s\n", &filebuffer);
replace(filebuffer,' ','|'); replace(filebuffer, ' ', '|');
if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) if (DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL))
strcpy(p->floppyslots[0].df, filebuffer); strcpy(p->floppyslots[0].df, filebuffer);
else else
p->floppyslots[0].df[0] = 0; p->floppyslots[0].df[0] = 0;
disk_insert(0, filebuffer); disk_insert(0, filebuffer);
if(p->nr_floppies > 1) if (p->nr_floppies > 1)
{ {
memset(filebuffer, 0, 256); memset(filebuffer, 0, 256);
fscanf(f,"df1=%s\n",&filebuffer); fscanf(f, "df1=%s\n", &filebuffer);
replace(filebuffer,' ','|'); replace(filebuffer, ' ', '|');
if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) if (DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL))
strcpy(p->floppyslots[1].df, filebuffer); strcpy(p->floppyslots[1].df, filebuffer);
else else
p->floppyslots[1].df[0] = 0; p->floppyslots[1].df[0] = 0;
disk_insert(1, filebuffer); disk_insert(1, filebuffer);
} }
if(p->nr_floppies > 2) if (p->nr_floppies > 2)
{ {
memset(filebuffer, 0, 256); memset(filebuffer, 0, 256);
fscanf(f,"df2=%s\n",&filebuffer); fscanf(f, "df2=%s\n", &filebuffer);
replace(filebuffer,' ','|'); replace(filebuffer, ' ', '|');
if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) if (DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL))
strcpy(p->floppyslots[2].df, filebuffer); strcpy(p->floppyslots[2].df, filebuffer);
else else
p->floppyslots[2].df[0] = 0; p->floppyslots[2].df[0] = 0;
disk_insert(2, filebuffer); disk_insert(2, filebuffer);
} }
if(p->nr_floppies > 3) if (p->nr_floppies > 3)
{ {
memset(filebuffer, 0, 256); memset(filebuffer, 0, 256);
fscanf(f,"df3=%s\n",&filebuffer); fscanf(f, "df3=%s\n", &filebuffer);
replace(filebuffer,' ','|'); replace(filebuffer, ' ', '|');
if(DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL)) if (DISK_validate_filename(p, filebuffer, 0, NULL, NULL, NULL))
strcpy(p->floppyslots[3].df, filebuffer); strcpy(p->floppyslots[3].df, filebuffer);
else else
p->floppyslots[3].df[0] = 0; p->floppyslots[3].df[0] = 0;
disk_insert(3, filebuffer); disk_insert(3, filebuffer);
} }
for(int i=0; i<4; ++i) for (int i = 0; i < 4; ++i)
{ {
if(i < p->nr_floppies) if (i < p->nr_floppies)
p->floppyslots[i].dfxtype = DRV_35_DD; p->floppyslots[i].dfxtype = DRV_35_DD;
else else
p->floppyslots[i].dfxtype = DRV_NONE; p->floppyslots[i].dfxtype = DRV_NONE;
} }
fscanf(f,"chipmemory=%d\n",&p->chipmem_size); fscanf(f, "chipmemory=%d\n", &p->chipmem_size);
if(p->chipmem_size < 10) if (p->chipmem_size < 10)
// Was saved in old format // Was saved in old format
p->chipmem_size = 0x80000 << p->chipmem_size; p->chipmem_size = 0x80000 << p->chipmem_size;
fscanf(f,"slowmemory=%d\n",&p->bogomem_size); fscanf(f, "slowmemory=%d\n", &p->bogomem_size);
if(p->bogomem_size > 0 && p->bogomem_size < 10) if (p->bogomem_size > 0 && p->bogomem_size < 10)
// Was saved in old format // Was saved in old format
p->bogomem_size = p->bogomem_size =
(p->bogomem_size <= 2) ? 0x080000 << p->bogomem_size : (p->bogomem_size <= 2) ? 0x080000 << p->bogomem_size :
(p->bogomem_size == 3) ? 0x180000 : 0x1c0000; (p->bogomem_size == 3) ? 0x180000 : 0x1c0000;
fscanf(f,"fastmemory=%d\n",&p->fastmem_size); fscanf(f, "fastmemory=%d\n", &p->fastmem_size);
if(p->fastmem_size > 0 && p->fastmem_size < 10) if (p->fastmem_size > 0 && p->fastmem_size < 10)
// Was saved in old format // Was saved in old format
p->fastmem_size = 0x080000 << p->fastmem_size; p->fastmem_size = 0x080000 << p->fastmem_size;
#ifdef ANDROIDSDL
fscanf(f,"onscreen=%d\n",&mainMenu_onScreen);
fscanf(f,"onScreen_textinput=%d\n",&mainMenu_onScreen_textinput);
fscanf(f,"onScreen_dpad=%d\n",&mainMenu_onScreen_dpad);
fscanf(f,"onScreen_button1=%d\n",&mainMenu_onScreen_button1);
fscanf(f,"onScreen_button2=%d\n",&mainMenu_onScreen_button2);
fscanf(f,"onScreen_button3=%d\n",&mainMenu_onScreen_button3);
fscanf(f,"onScreen_button4=%d\n",&mainMenu_onScreen_button4);
fscanf(f,"onScreen_button5=%d\n",&mainMenu_onScreen_button5);
fscanf(f,"onScreen_button6=%d\n",&mainMenu_onScreen_button6);
fscanf(f,"custom_position=%d\n",&mainMenu_custom_position);
fscanf(f,"pos_x_textinput=%d\n",&mainMenu_pos_x_textinput);
fscanf(f,"pos_y_textinput=%d\n",&mainMenu_pos_y_textinput);
fscanf(f,"pos_x_dpad=%d\n",&mainMenu_pos_x_dpad);
fscanf(f,"pos_y_dpad=%d\n",&mainMenu_pos_y_dpad);
fscanf(f,"pos_x_button1=%d\n",&mainMenu_pos_x_button1);
fscanf(f,"pos_y_button1=%d\n",&mainMenu_pos_y_button1);
fscanf(f,"pos_x_button2=%d\n",&mainMenu_pos_x_button2);
fscanf(f,"pos_y_button2=%d\n",&mainMenu_pos_y_button2);
fscanf(f,"pos_x_button3=%d\n",&mainMenu_pos_x_button3);
fscanf(f,"pos_y_button3=%d\n",&mainMenu_pos_y_button3);
fscanf(f,"pos_x_button4=%d\n",&mainMenu_pos_x_button4);
fscanf(f,"pos_y_button4=%d\n",&mainMenu_pos_y_button4);
fscanf(f,"pos_x_button5=%d\n",&mainMenu_pos_x_button5);
fscanf(f,"pos_y_button5=%d\n",&mainMenu_pos_y_button5);
fscanf(f,"pos_x_button6=%d\n",&mainMenu_pos_x_button6);
fscanf(f,"pos_y_button6=%d\n",&mainMenu_pos_y_button6);
fscanf(f,"quick_switch=%d\n",&mainMenu_quickSwitch);
fscanf(f,"FloatingJoystick=%d\n",&mainMenu_FloatingJoystick);
#endif
fclose(f); fclose(f);
} }

View file

@ -15,14 +15,20 @@
#include <png.h> #include <png.h>
#include <SDL.h> #include <SDL.h>
#include <SDL_image.h> #include <SDL/SDL_image.h>
#include <SDL_gfxPrimitives.h> #ifndef ANDROID
#include <SDL/SDL_gfxPrimitives.h>
#endif
#include <SDL/SDL_ttf.h> #include <SDL/SDL_ttf.h>
#ifdef ANDROIDSDL #ifdef ANDROID
#include <android/log.h> #include <android/log.h>
#endif #endif
#ifdef ANDROIDSDL
#include <SDL_screenkeyboard.h>
#endif
#include <linux/fb.h> #include <linux/fb.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -33,16 +39,16 @@
#define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int) #define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int)
#endif #endif
/* SDL variable for output of emulation */ /* SDL variable for output of emulation */
SDL_Surface *prSDLScreen = NULL; SDL_Surface *prSDLScreen = NULL;
static int fbdev = -1; static int fbdev = -1;
static unsigned int current_vsync_frame = 0; static unsigned int current_vsync_frame = 0;
/* Possible screen modes (x and y resolutions) */ /* Possible screen modes (x and y resolutions) */
#define MAX_SCREEN_MODES 6
static int x_size_table[MAX_SCREEN_MODES] = { 640, 640, 800, 1024, 1152, 1280 }; #define MAX_SCREEN_MODES 11
static int y_size_table[MAX_SCREEN_MODES] = { 400, 480, 480, 768, 864, 960 }; static int x_size_table[MAX_SCREEN_MODES] = { 640, 640, 720, 800, 800, 960, 1024, 1024, 1280, 1280, 1920 };
static int y_size_table[MAX_SCREEN_MODES] = { 400, 480, 400, 480, 600, 540, 768, 600, 720, 800, 1080 };
static int red_bits, green_bits, blue_bits; static int red_bits, green_bits, blue_bits;
static int red_shift, green_shift, blue_shift; static int red_shift, green_shift, blue_shift;
@ -363,8 +369,9 @@ void flush_screen ()
current_vsync_frame += currprefs.gfx_framerate; current_vsync_frame += currprefs.gfx_framerate;
} }
last_synctime = read_processor_time(); // Android swapped SDL_Flip & last_synctime for fixing performance
SDL_Flip(prSDLScreen); SDL_Flip(prSDLScreen);
last_synctime = read_processor_time();
if(!screen_is_picasso) if(!screen_is_picasso)
gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels;
@ -734,7 +741,7 @@ void picasso_InitResolutions (void)
modesList(); modesList();
DisplayModes = Displays[0].DisplayModes; DisplayModes = Displays[0].DisplayModes;
} }
#endif
bool vsync_switchmode (int hz) bool vsync_switchmode (int hz)
{ {
@ -799,7 +806,7 @@ bool target_graphics_buffer_update (void)
return true; return true;
} }
#ifdef PICASSO96
void gfx_set_picasso_state (int on) void gfx_set_picasso_state (int on)
{ {
if (on == screen_is_picasso) if (on == screen_is_picasso)

View file

@ -14,7 +14,7 @@
#include "gui.h" #include "gui.h"
#include "od-pandora/gui/SelectorEntry.hpp" #include "od-pandora/gui/SelectorEntry.hpp"
#include "gui/gui_handling.h" #include "gui/gui_handling.h"
#include "memory.h" #include "include/memory.h"
#include "rommgr.h" #include "rommgr.h"
#include "newcpu.h" #include "newcpu.h"
#include "custom.h" #include "custom.h"
@ -34,19 +34,21 @@
#include "td-sdl/thread.h" #include "td-sdl/thread.h"
#ifdef RASPBERRY #ifdef RASPBERRY
#include <linux/kd.h> #include <linux/kd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif RASPBERRY #endif //RASPBERRY
int emulating = 0; int emulating = 0;
extern int screen_is_picasso; extern int screen_is_picasso;
struct gui_msg { struct gui_msg
{
int num; int num;
const char *msg; const char *msg;
}; };
struct gui_msg gui_msglist[] = { struct gui_msg gui_msglist[] =
{
{ NUMSG_NEEDEXT2, "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again." }, { NUMSG_NEEDEXT2, "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again." },
{ NUMSG_NOROM, "Could not load system ROM, trying system ROM replacement." }, { NUMSG_NOROM, "Could not load system ROM, trying system ROM replacement." },
{ NUMSG_NOROMKEY, "Could not find system ROM key file." }, { NUMSG_NOROMKEY, "Could not find system ROM key file." },
@ -75,11 +77,11 @@ void AddFileToDiskList(const char *file, int moveToTop)
{ {
int i; int i;
for(i=0; i<lstMRUDiskList.size(); ++i) for (i = 0; i < lstMRUDiskList.size(); ++i)
{ {
if(!strcasecmp(lstMRUDiskList[i].c_str(), file)) if (!strcasecmp(lstMRUDiskList[i].c_str(), file))
{ {
if(moveToTop) if (moveToTop)
{ {
lstMRUDiskList.erase(lstMRUDiskList.begin() + i); lstMRUDiskList.erase(lstMRUDiskList.begin() + i);
lstMRUDiskList.insert(lstMRUDiskList.begin(), file); lstMRUDiskList.insert(lstMRUDiskList.begin(), file);
@ -87,10 +89,10 @@ void AddFileToDiskList(const char *file, int moveToTop)
break; break;
} }
} }
if(i >= lstMRUDiskList.size()) if (i >= lstMRUDiskList.size())
lstMRUDiskList.insert(lstMRUDiskList.begin(), file); lstMRUDiskList.insert(lstMRUDiskList.begin(), file);
while(lstMRUDiskList.size() > MAX_MRU_DISKLIST) while (lstMRUDiskList.size() > MAX_MRU_DISKLIST)
lstMRUDiskList.pop_back(); lstMRUDiskList.pop_back();
} }
@ -99,11 +101,11 @@ void AddFileToCDList(const char *file, int moveToTop)
{ {
int i; int i;
for(i=0; i<lstMRUCDList.size(); ++i) for (i = 0; i < lstMRUCDList.size(); ++i)
{ {
if(!strcasecmp(lstMRUCDList[i].c_str(), file)) if (!strcasecmp(lstMRUCDList[i].c_str(), file))
{ {
if(moveToTop) if (moveToTop)
{ {
lstMRUCDList.erase(lstMRUCDList.begin() + i); lstMRUCDList.erase(lstMRUCDList.begin() + i);
lstMRUCDList.insert(lstMRUCDList.begin(), file); lstMRUCDList.insert(lstMRUCDList.begin(), file);
@ -111,17 +113,17 @@ void AddFileToCDList(const char *file, int moveToTop)
break; break;
} }
} }
if(i >= lstMRUCDList.size()) if (i >= lstMRUCDList.size())
lstMRUCDList.insert(lstMRUCDList.begin(), file); lstMRUCDList.insert(lstMRUCDList.begin(), file);
while(lstMRUCDList.size() > MAX_MRU_CDLIST) while (lstMRUCDList.size() > MAX_MRU_CDLIST)
lstMRUCDList.pop_back(); lstMRUCDList.pop_back();
} }
void ClearAvailableROMList(void) void ClearAvailableROMList(void)
{ {
while(lstAvailableROMs.size() > 0) while (lstAvailableROMs.size() > 0)
{ {
AvailableROM *tmp = lstAvailableROMs[0]; AvailableROM *tmp = lstAvailableROMs[0];
lstAvailableROMs.erase(lstAvailableROMs.begin()); lstAvailableROMs.erase(lstAvailableROMs.begin());
@ -129,87 +131,97 @@ void ClearAvailableROMList(void)
} }
} }
static void addrom(struct romdata *rd, char *path) static void addrom(struct romdata *rd, const char *path)
{ {
AvailableROM *tmp; AvailableROM *tmp;
char tmpName[MAX_DPATH]; char tmpName[MAX_DPATH];
tmp = new AvailableROM(); tmp = new AvailableROM();
getromname(rd, tmpName); getromname(rd, tmpName);
strncpy(tmp->Name, tmpName, MAX_PATH); strncpy(tmp->Name, tmpName, MAX_PATH);
if(path != NULL) if (path != NULL)
strncpy(tmp->Path, path, MAX_PATH); strncpy(tmp->Path, path, MAX_PATH);
tmp->ROMType = rd->type; tmp->ROMType = rd->type;
lstAvailableROMs.push_back(tmp); lstAvailableROMs.push_back(tmp);
romlist_add(path, rd); romlist_add(path, rd);
} }
struct romscandata { struct romscandata
{
uae_u8 *keybuf; uae_u8 *keybuf;
int keysize; int keysize;
}; };
static struct romdata *scan_single_rom_2 (struct zfile *f) static struct romdata *scan_single_rom_2(struct zfile *f)
{ {
uae_u8 buffer[20] = { 0 }; uae_u8 buffer[20] = { 0 };
uae_u8 *rombuf; uae_u8 *rombuf;
int cl = 0, size; int cl = 0, size;
struct romdata *rd = 0; struct romdata *rd = 0;
zfile_fseek (f, 0, SEEK_END); zfile_fseek(f, 0, SEEK_END);
size = zfile_ftell (f); size = zfile_ftell(f);
zfile_fseek (f, 0, SEEK_SET); zfile_fseek(f, 0, SEEK_SET);
if (size > 524288 * 2) /* don't skip KICK disks or 1M ROMs */ if (size > 524288 * 2) /* don't skip KICK disks or 1M ROMs */
return 0; return 0;
zfile_fread (buffer, 1, 11, f); zfile_fread(buffer, 1, 11, f);
if (!memcmp (buffer, "KICK", 4)) { if (!memcmp(buffer, "KICK", 4))
zfile_fseek (f, 512, SEEK_SET); {
zfile_fseek(f, 512, SEEK_SET);
if (size > 262144) if (size > 262144)
size = 262144; size = 262144;
} else if (!memcmp (buffer, "AMIROMTYPE1", 11)) { }
else if (!memcmp(buffer, "AMIROMTYPE1", 11))
{
cl = 1; cl = 1;
size -= 11; size -= 11;
} else {
zfile_fseek (f, 0, SEEK_SET);
} }
rombuf = xcalloc (uae_u8, size); else
{
zfile_fseek(f, 0, SEEK_SET);
}
rombuf = xcalloc(uae_u8, size);
if (!rombuf) if (!rombuf)
return 0; return 0;
zfile_fread (rombuf, 1, size, f); zfile_fread(rombuf, 1, size, f);
if (cl > 0) { if (cl > 0)
decode_cloanto_rom_do (rombuf, size, size); {
decode_cloanto_rom_do(rombuf, size, size);
cl = 0; cl = 0;
} }
if (!cl) { if (!cl)
rd = getromdatabydata (rombuf, size); {
if (!rd && (size & 65535) == 0) { rd = getromdatabydata(rombuf, size);
if (!rd && (size & 65535) == 0)
{
/* check byteswap */ /* check byteswap */
int i; int i;
for (i = 0; i < size; i+=2) { for (i = 0; i < size; i += 2)
{
uae_u8 b = rombuf[i]; uae_u8 b = rombuf[i];
rombuf[i] = rombuf[i + 1]; rombuf[i] = rombuf[i + 1];
rombuf[i + 1] = b; rombuf[i + 1] = b;
} }
rd = getromdatabydata (rombuf, size); rd = getromdatabydata(rombuf, size);
} }
} }
free (rombuf); free(rombuf);
return rd; return rd;
} }
static struct romdata *scan_single_rom (char *path) static struct romdata *scan_single_rom(char *path)
{ {
struct zfile *z; struct zfile *z;
char tmp[MAX_DPATH]; char tmp[MAX_DPATH];
struct romdata *rd; struct romdata *rd;
strcpy (tmp, path); strcpy(tmp, path);
rd = getromdatabypath(path); rd = getromdatabypath(path);
if (rd && rd->crc32 == 0xffffffff) if (rd && rd->crc32 == 0xffffffff)
return rd; return rd;
z = zfile_fopen (path, "rb", ZFD_NORMAL); z = zfile_fopen(path, "rb", ZFD_NORMAL);
if (!z) if (!z)
return 0; return 0;
return scan_single_rom_2 (z); return scan_single_rom_2(z);
} }
static int isromext(char *path) static int isromext(char *path)
@ -219,22 +231,23 @@ static int isromext(char *path)
if (!path) if (!path)
return 0; return 0;
ext = strrchr (path, '.'); ext = strrchr(path, '.');
if (!ext) if (!ext)
return 0; return 0;
ext++; ext++;
if (!stricmp (ext, "rom") || !stricmp (ext, "adf") || !stricmp (ext, "key") if (!stricmp(ext, "rom") || !stricmp(ext, "adf") || !stricmp(ext, "key")
|| !stricmp (ext, "a500") || !stricmp (ext, "a1200") || !stricmp (ext, "a4000")) || !stricmp(ext, "a500") || !stricmp(ext, "a1200") || !stricmp(ext, "a4000"))
return 1; return 1;
for (i = 0; uae_archive_extensions[i]; i++) { for (i = 0; uae_archive_extensions[i]; i++)
if (!stricmp (ext, uae_archive_extensions[i])) {
if (!stricmp(ext, uae_archive_extensions[i]))
return 1; return 1;
} }
return 0; return 0;
} }
static int scan_rom_2 (struct zfile *f, void *dummy) static int scan_rom_2(struct zfile *f, void *dummy)
{ {
char *path = zfile_getname(f); char *path = zfile_getname(f);
struct romdata *rd; struct romdata *rd;
@ -243,7 +256,7 @@ static int scan_rom_2 (struct zfile *f, void *dummy)
return 0; return 0;
rd = scan_single_rom_2(f); rd = scan_single_rom_2(f);
if (rd) if (rd)
addrom (rd, path); addrom(rd, path);
return 0; return 0;
} }
@ -251,7 +264,8 @@ static void scan_rom(char *path)
{ {
struct romdata *rd; struct romdata *rd;
if (!isromext(path)) { if (!isromext(path))
{
//write_log("ROMSCAN: skipping file '%s', unknown extension\n", path); //write_log("ROMSCAN: skipping file '%s', unknown extension\n", path);
return; return;
} }
@ -259,7 +273,7 @@ static void scan_rom(char *path)
if (rd) if (rd)
addrom(rd, path); addrom(rd, path);
else else
zfile_zopen (path, scan_rom_2, 0); zfile_zopen(path, scan_rom_2, 0);
} }
@ -275,28 +289,29 @@ void RescanROMs(void)
load_keyring(&changed_prefs, path); load_keyring(&changed_prefs, path);
ReadDirectory(path, NULL, &files); ReadDirectory(path, NULL, &files);
for(int i=0; i<files.size(); ++i) for (int i = 0; i < files.size(); ++i)
{ {
char tmppath[MAX_PATH]; char tmppath[MAX_PATH];
strncpy(tmppath, path, MAX_PATH); strncpy(tmppath, path, MAX_PATH);
strncat(tmppath, files[i].c_str(), MAX_PATH); strncat(tmppath, files[i].c_str(), MAX_PATH);
scan_rom (tmppath); scan_rom(tmppath);
} }
int id = 1; int id = 1;
for (;;) { for (;;)
struct romdata *rd = getromdatabyid (id); {
struct romdata *rd = getromdatabyid(id);
if (!rd) if (!rd)
break; break;
if (rd->crc32 == 0xffffffff && strncmp(rd->model, "AROS", 4) == 0) if (rd->crc32 == 0xffffffff && strncmp(rd->model, "AROS", 4) == 0)
addrom (rd, ":AROS"); addrom(rd, ":AROS");
id++; id++;
} }
} }
static void ClearConfigFileList(void) static void ClearConfigFileList(void)
{ {
while(ConfigFilesList.size() > 0) while (ConfigFilesList.size() > 0)
{ {
ConfigFileInfo *tmp = ConfigFilesList[0]; ConfigFileInfo *tmp = ConfigFilesList[0];
ConfigFilesList.erase(ConfigFilesList.begin()); ConfigFilesList.erase(ConfigFilesList.begin());
@ -343,7 +358,7 @@ void ReadConfigFileList(void)
fetch_rp9path(path, MAX_PATH); fetch_rp9path(path, MAX_PATH);
ReadDirectory(path, NULL, &files); ReadDirectory(path, NULL, &files);
FilterFiles(&files, filter_rp9); FilterFiles(&files, filter_rp9);
for (int i=0; i<files.size(); ++i) for (int i = 0; i < files.size(); ++i)
{ {
ConfigFileInfo *tmp = new ConfigFileInfo(); ConfigFileInfo *tmp = new ConfigFileInfo();
strncpy(tmp->FullPath, path, MAX_DPATH); strncpy(tmp->FullPath, path, MAX_DPATH);
@ -359,7 +374,7 @@ void ReadConfigFileList(void)
fetch_configurationpath(path, MAX_PATH); fetch_configurationpath(path, MAX_PATH);
ReadDirectory(path, NULL, &files); ReadDirectory(path, NULL, &files);
FilterFiles(&files, filter_uae); FilterFiles(&files, filter_uae);
for (int i=0; i<files.size(); ++i) for (int i = 0; i < files.size(); ++i)
{ {
ConfigFileInfo *tmp = new ConfigFileInfo(); ConfigFileInfo *tmp = new ConfigFileInfo();
strncpy(tmp->FullPath, path, MAX_DPATH); strncpy(tmp->FullPath, path, MAX_DPATH);
@ -374,9 +389,9 @@ void ReadConfigFileList(void)
// Read also old style configs // Read also old style configs
ReadDirectory(path, NULL, &files); ReadDirectory(path, NULL, &files);
FilterFiles(&files, filter_conf); FilterFiles(&files, filter_conf);
for (int i=0; i<files.size(); ++i) for (int i = 0; i < files.size(); ++i)
{ {
if(strcmp(files[i].c_str(), "adfdir.conf")) if (strcmp(files[i].c_str(), "adfdir.conf"))
{ {
ConfigFileInfo *tmp = new ConfigFileInfo(); ConfigFileInfo *tmp = new ConfigFileInfo();
strncpy(tmp->FullPath, path, MAX_DPATH); strncpy(tmp->FullPath, path, MAX_DPATH);
@ -385,9 +400,9 @@ void ReadConfigFileList(void)
removeFileExtension(tmp->Name); removeFileExtension(tmp->Name);
strcpy(tmp->Description, "Old style configuration file"); strcpy(tmp->Description, "Old style configuration file");
tmp->BuildInID = BUILDINID_NONE; tmp->BuildInID = BUILDINID_NONE;
for(int j=0; j<ConfigFilesList.size(); ++j) for (int j = 0; j < ConfigFilesList.size(); ++j)
{ {
if(!strcmp(ConfigFilesList[j]->Name, tmp->Name)) if (!strcmp(ConfigFilesList[j]->Name, tmp->Name))
{ {
// Config in new style already in list // Config in new style already in list
delete tmp; delete tmp;
@ -395,7 +410,7 @@ void ReadConfigFileList(void)
break; break;
} }
} }
if(tmp != NULL) if (tmp != NULL)
ConfigFilesList.push_back(tmp); ConfigFilesList.push_back(tmp);
} }
} }
@ -403,9 +418,9 @@ void ReadConfigFileList(void)
ConfigFileInfo* SearchConfigInList(const char *name) ConfigFileInfo* SearchConfigInList(const char *name)
{ {
for(int i=0; i<ConfigFilesList.size(); ++i) for (int i = 0; i < ConfigFilesList.size(); ++i)
{ {
if(!strncasecmp(ConfigFilesList[i]->Name, name, MAX_DPATH)) if (!strncasecmp(ConfigFilesList[i]->Name, name, MAX_DPATH))
return ConfigFilesList[i]; return ConfigFilesList[i];
} }
return NULL; return NULL;
@ -416,15 +431,15 @@ static void prefs_to_gui()
{ {
/* filesys hack */ /* filesys hack */
changed_prefs.mountitems = currprefs.mountitems; changed_prefs.mountitems = currprefs.mountitems;
memcpy(&changed_prefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info)); memcpy(&changed_prefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
} }
static void gui_to_prefs (void) static void gui_to_prefs(void)
{ {
/* filesys hack */ /* filesys hack */
currprefs.mountitems = changed_prefs.mountitems; currprefs.mountitems = changed_prefs.mountitems;
memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info)); memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
} }
@ -435,36 +450,38 @@ static void after_leave_gui(void)
int update = 0; int update = 0;
int num; int num;
for(num = 0; num < 2; ++num) { for (num = 0; num < 2; ++num)
if(changed_prefs.jports[num].id == JSEM_JOYS && changed_prefs.jports[num].autofire != new_af) { {
if (changed_prefs.jports[num].id == JSEM_JOYS && changed_prefs.jports[num].autofire != new_af)
{
changed_prefs.jports[num].autofire = new_af; changed_prefs.jports[num].autofire = new_af;
update = 1; update = 1;
} }
} }
if(update) if (update)
inputdevice_updateconfig(NULL, &changed_prefs); inputdevice_updateconfig(NULL, &changed_prefs);
inputdevice_copyconfig (&changed_prefs, &currprefs); inputdevice_copyconfig(&changed_prefs, &currprefs);
inputdevice_config_change_test(); inputdevice_config_change_test();
} }
int gui_init (void) int gui_init(void)
{ {
int ret = 0; int ret = 0;
emulating=0; emulating = 0;
if(lstAvailableROMs.size() == 0) if (lstAvailableROMs.size() == 0)
RescanROMs(); RescanROMs();
graphics_subshutdown(); graphics_subshutdown();
prefs_to_gui(); prefs_to_gui();
run_gui(); run_gui();
gui_to_prefs(); gui_to_prefs();
if(quit_program < 0) if (quit_program < 0)
quit_program = -quit_program; quit_program = -quit_program;
if(quit_program == UAE_QUIT) if (quit_program == UAE_QUIT)
ret = -2; // Quit without start of emulator ret = -2; // Quit without start of emulator
setCpuSpeed(); setCpuSpeed();
@ -472,7 +489,7 @@ int gui_init (void)
after_leave_gui(); after_leave_gui();
emulating=1; emulating = 1;
return ret; return ret;
} }
@ -494,7 +511,7 @@ void gui_purge_events(void)
SDL_Event event; SDL_Event event;
SDL_Delay(150); SDL_Delay(150);
// Strangely PS3 controller always send events, so we need a maximum number of event to purge. // Strangely PS3 controller always send events, so we need a maximum number of event to purge.
while(SDL_PollEvent(&event) && counter < 50) while (SDL_PollEvent(&event) && counter < 50)
{ {
counter++; counter++;
SDL_Delay(10); SDL_Delay(10);
@ -503,14 +520,14 @@ void gui_purge_events(void)
} }
int gui_update (void) int gui_update(void)
{ {
char tmp[MAX_PATH]; char tmp[MAX_PATH];
fetch_savestatepath(savestate_fname, MAX_DPATH); fetch_savestatepath(savestate_fname, MAX_DPATH);
fetch_screenshotpath(screenshot_filename, MAX_DPATH); fetch_screenshotpath(screenshot_filename, MAX_DPATH);
if(strlen(currprefs.floppyslots[0].df) > 0) if (strlen(currprefs.floppyslots[0].df) > 0)
extractFileName(currprefs.floppyslots[0].df, tmp); extractFileName(currprefs.floppyslots[0].df, tmp);
else else
strncpy(tmp, last_loaded_config, MAX_PATH); strncpy(tmp, last_loaded_config, MAX_PATH);
@ -520,37 +537,37 @@ int gui_update (void)
removeFileExtension(savestate_fname); removeFileExtension(savestate_fname);
removeFileExtension(screenshot_filename); removeFileExtension(screenshot_filename);
switch(currentStateNum) switch (currentStateNum)
{ {
case 1: case 1:
strcat(savestate_fname,"-1.uss"); strcat(savestate_fname, "-1.uss");
strcat(screenshot_filename,"-1.png"); strcat(screenshot_filename, "-1.png");
break; break;
case 2: case 2:
strcat(savestate_fname,"-2.uss"); strcat(savestate_fname, "-2.uss");
strcat(screenshot_filename,"-2.png"); strcat(screenshot_filename, "-2.png");
break; break;
case 3: case 3:
strcat(savestate_fname,"-3.uss"); strcat(savestate_fname, "-3.uss");
strcat(screenshot_filename,"-3.png"); strcat(screenshot_filename, "-3.png");
break; break;
default: default:
strcat(savestate_fname,".uss"); strcat(savestate_fname, ".uss");
strcat(screenshot_filename,".png"); strcat(screenshot_filename, ".png");
} }
return 0; return 0;
} }
void gui_display (int shortcut) void gui_display(int shortcut)
{ {
if (quit_program != 0) if (quit_program != 0)
return; return;
emulating=1; emulating = 1;
pause_sound(); pause_sound();
blkdev_entergui(); blkdev_entergui();
if(lstAvailableROMs.size() == 0) if (lstAvailableROMs.size() == 0)
RescanROMs(); RescanROMs();
graphics_subshutdown(); graphics_subshutdown();
prefs_to_gui(); prefs_to_gui();
@ -569,7 +586,7 @@ void gui_display (int shortcut)
after_leave_gui(); after_leave_gui();
gui_update (); gui_update();
gui_purge_events(); gui_purge_events();
fpscounter_reset(); fpscounter_reset();
@ -579,13 +596,13 @@ void gui_display (int shortcut)
void moveVertical(int value) void moveVertical(int value)
{ {
changed_prefs.pandora_vertical_offset += value; changed_prefs.pandora_vertical_offset += value;
if(changed_prefs.pandora_vertical_offset < -16) if (changed_prefs.pandora_vertical_offset < -16)
changed_prefs.pandora_vertical_offset = -16; changed_prefs.pandora_vertical_offset = -16;
else if(changed_prefs.pandora_vertical_offset > 16) else if (changed_prefs.pandora_vertical_offset > 16)
changed_prefs.pandora_vertical_offset = 16; changed_prefs.pandora_vertical_offset = 16;
} }
void gui_handle_events (void) void gui_handle_events(void)
{ {
int i; int i;
@ -593,64 +610,63 @@ void gui_handle_events (void)
int triggerL = keystate[SDLK_RSHIFT]; int triggerL = keystate[SDLK_RSHIFT];
int triggerR = keystate[SDLK_RCTRL]; int triggerR = keystate[SDLK_RCTRL];
if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU]))
if(keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] ||keystate[SDLK_MENU])) uae_reset(0, 1);
uae_reset(0,1);
// L + R // L + R
if(triggerL && triggerR) if (triggerL && triggerR)
{ {
//up //up
if(keystate[SDLK_UP]) if (keystate[SDLK_UP])
moveVertical(1); moveVertical(1);
//down //down
else if(keystate[SDLK_DOWN]) else if (keystate[SDLK_DOWN])
moveVertical(-1); moveVertical(-1);
//1 //1
else if(keystate[SDLK_1]) else if (keystate[SDLK_1])
{ {
changed_prefs.gfx_size.height = amigaheight_values[0]; changed_prefs.gfx_size.height = amigaheight_values[0];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//2 //2
else if(keystate[SDLK_2]) else if (keystate[SDLK_2])
{ {
changed_prefs.gfx_size.height = amigaheight_values[1]; changed_prefs.gfx_size.height = amigaheight_values[1];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//3 //3
else if(keystate[SDLK_3]) else if (keystate[SDLK_3])
{ {
changed_prefs.gfx_size.height = amigaheight_values[2]; changed_prefs.gfx_size.height = amigaheight_values[2];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//4 //4
else if(keystate[SDLK_4]) else if (keystate[SDLK_4])
{ {
changed_prefs.gfx_size.height = amigaheight_values[3]; changed_prefs.gfx_size.height = amigaheight_values[3];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//5 //5
else if(keystate[SDLK_5]) else if (keystate[SDLK_5])
{ {
changed_prefs.gfx_size.height = amigaheight_values[4]; changed_prefs.gfx_size.height = amigaheight_values[4];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//6 //6
else if(keystate[SDLK_6]) else if (keystate[SDLK_6])
{ {
changed_prefs.gfx_size.height = amigaheight_values[5]; changed_prefs.gfx_size.height = amigaheight_values[5];
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//9 //9
else if(keystate[SDLK_9]) else if (keystate[SDLK_9])
{ {
for(i=0; i<AMIGAHEIGHT_COUNT; ++i) for (i = 0; i < AMIGAHEIGHT_COUNT; ++i)
{ {
if(currprefs.gfx_size.height == amigaheight_values[i]) if (currprefs.gfx_size.height == amigaheight_values[i])
{ {
if(i > 0) if (i > 0)
changed_prefs.gfx_size.height = amigaheight_values[i - 1]; changed_prefs.gfx_size.height = amigaheight_values[i - 1];
else else
changed_prefs.gfx_size.height = amigaheight_values[AMIGAHEIGHT_COUNT - 1]; changed_prefs.gfx_size.height = amigaheight_values[AMIGAHEIGHT_COUNT - 1];
@ -660,13 +676,13 @@ void gui_handle_events (void)
update_display(&changed_prefs); update_display(&changed_prefs);
} }
//0 //0
else if(keystate[SDLK_0]) else if (keystate[SDLK_0])
{ {
for(i=0; i<AMIGAHEIGHT_COUNT; ++i) for (i = 0; i < AMIGAHEIGHT_COUNT; ++i)
{ {
if(currprefs.gfx_size.height == amigaheight_values[i]) if (currprefs.gfx_size.height == amigaheight_values[i])
{ {
if(i < AMIGAHEIGHT_COUNT - 1) if (i < AMIGAHEIGHT_COUNT - 1)
changed_prefs.gfx_size.height = amigaheight_values[i + 1]; changed_prefs.gfx_size.height = amigaheight_values[i + 1];
else else
changed_prefs.gfx_size.height = amigaheight_values[0]; changed_prefs.gfx_size.height = amigaheight_values[0];
@ -675,14 +691,14 @@ void gui_handle_events (void)
} }
update_display(&changed_prefs); update_display(&changed_prefs);
} }
else if(keystate[SDLK_w]) else if (keystate[SDLK_w])
{ {
// Change width // Change width
for(i=0; i<AMIGAWIDTH_COUNT; ++i) for (i = 0; i < AMIGAWIDTH_COUNT; ++i)
{ {
if(currprefs.gfx_size.width == amigawidth_values[i]) if (currprefs.gfx_size.width == amigawidth_values[i])
{ {
if(i < AMIGAWIDTH_COUNT - 1) if (i < AMIGAWIDTH_COUNT - 1)
changed_prefs.gfx_size.width = amigawidth_values[i + 1]; changed_prefs.gfx_size.width = amigawidth_values[i + 1];
else else
changed_prefs.gfx_size.width = amigawidth_values[0]; changed_prefs.gfx_size.width = amigawidth_values[0];
@ -692,10 +708,10 @@ void gui_handle_events (void)
update_display(&changed_prefs); update_display(&changed_prefs);
} }
// r // r
else if(keystate[SDLK_r]) else if (keystate[SDLK_r])
{ {
// Change resolution (lores/hires) // Change resolution (lores/hires)
if(currprefs.gfx_size.width > 600) if (currprefs.gfx_size.width > 600)
changed_prefs.gfx_size.width = currprefs.gfx_size.width / 2; changed_prefs.gfx_size.width = currprefs.gfx_size.width / 2;
else else
changed_prefs.gfx_size.width = currprefs.gfx_size.width * 2; changed_prefs.gfx_size.width = currprefs.gfx_size.width * 2;
@ -703,24 +719,24 @@ void gui_handle_events (void)
} }
} }
else if(triggerL) else if (triggerL)
{ {
if(keystate[SDLK_c]) if (keystate[SDLK_c])
currprefs.pandora_customControls = !currprefs.pandora_customControls; currprefs.pandora_customControls = !currprefs.pandora_customControls;
else if(keystate[SDLK_d]) else if (keystate[SDLK_d])
changed_prefs.leds_on_screen = !currprefs.leds_on_screen; changed_prefs.leds_on_screen = !currprefs.leds_on_screen;
else if(keystate[SDLK_f]) else if (keystate[SDLK_f])
changed_prefs.gfx_framerate ? changed_prefs.gfx_framerate = 0 : changed_prefs.gfx_framerate = 1; changed_prefs.gfx_framerate ? changed_prefs.gfx_framerate = 0 : changed_prefs.gfx_framerate = 1;
else if(keystate[SDLK_s]) else if (keystate[SDLK_s])
savestate_state = STATE_DOSAVE; savestate_state = STATE_DOSAVE;
else if(keystate[SDLK_l]) else if (keystate[SDLK_l])
{ {
FILE *f=fopen(savestate_fname, "rb"); FILE *f = fopen(savestate_fname, "rb");
if(f) if (f)
{ {
fclose(f); fclose(f);
savestate_state = STATE_DORESTORE; savestate_state = STATE_DORESTORE;
@ -729,14 +745,14 @@ void gui_handle_events (void)
} }
} }
void gui_disk_image_change (int unitnum, const char *name, bool writeprotected) void gui_disk_image_change(int unitnum, const char *name, bool writeprotected)
{ {
} }
void gui_led (int led, int on) void gui_led(int led, int on)
{ {
#ifdef RASPBERRY #ifdef RASPBERRY
#define LED_DFs -2 // Define for any DF* access #define LED_DFs -2 // Define for any DF* access
unsigned long kbd_led_status; unsigned long kbd_led_status;
@ -751,11 +767,13 @@ void gui_led (int led, int on)
{ {
if (currprefs.kbd_led_num == led || currprefs.kbd_led_num == LED_DFs) if (currprefs.kbd_led_num == led || currprefs.kbd_led_num == LED_DFs)
{ {
if (on) kbd_led_status |= LED_NUM; else kbd_led_status &= ~LED_NUM; if (on) kbd_led_status |= LED_NUM;
else kbd_led_status &= ~LED_NUM;
} }
if (currprefs.kbd_led_scr == led || currprefs.kbd_led_scr == LED_DFs) if (currprefs.kbd_led_scr == led || currprefs.kbd_led_scr == LED_DFs)
{ {
if (on) kbd_led_status |= LED_SCR; else kbd_led_status &= ~LED_SCR; if (on) kbd_led_status |= LED_SCR;
else kbd_led_status &= ~LED_SCR;
} }
} }
@ -764,22 +782,24 @@ void gui_led (int led, int on)
{ {
if (currprefs.kbd_led_num == led) if (currprefs.kbd_led_num == led)
{ {
if (on) kbd_led_status |= LED_NUM; else kbd_led_status &= ~LED_NUM; if (on) kbd_led_status |= LED_NUM;
else kbd_led_status &= ~LED_NUM;
} }
if (currprefs.kbd_led_scr == led) if (currprefs.kbd_led_scr == led)
{ {
if (on) kbd_led_status |= LED_SCR; else kbd_led_status &= ~LED_SCR; if (on) kbd_led_status |= LED_SCR;
else kbd_led_status &= ~LED_SCR;
} }
} }
ioctl(0, KDSETLED, kbd_led_status); ioctl(0, KDSETLED, kbd_led_status);
#endif #endif
} }
void gui_flicker_led (int led, int unitnum, int status) void gui_flicker_led(int led, int unitnum, int status)
{ {
static int hd_resetcounter; static int hd_resetcounter;
switch(led) switch (led)
{ {
case -1: // Reset HD and CD case -1: // Reset HD and CD
gui_data.hd = 0; gui_data.hd = 0;
@ -789,19 +809,20 @@ void gui_flicker_led (int led, int unitnum, int status)
break; break;
case LED_HD: case LED_HD:
if (status == 0) { if (status == 0)
{
hd_resetcounter--; hd_resetcounter--;
if (hd_resetcounter > 0) if (hd_resetcounter > 0)
return; return;
#ifdef RASPBERRY #ifdef RASPBERRY
// HD LED off // HD LED off
gui_led(LED_HD, 0); gui_led(LED_HD, 0);
#endif #endif
} }
#ifdef RASPBERRY #ifdef RASPBERRY
// HD LED on // HD LED on
else gui_led(LED_HD, 1); else gui_led(LED_HD, 1);
#endif #endif
gui_data.hd = status; gui_data.hd = status;
hd_resetcounter = 2; hd_resetcounter = 2;
break; break;
@ -809,28 +830,28 @@ void gui_flicker_led (int led, int unitnum, int status)
} }
void gui_filename (int num, const char *name) void gui_filename(int num, const char *name)
{ {
} }
void gui_message (const char *format,...) void gui_message(const char *format, ...)
{ {
char msg[2048]; char msg[2048];
va_list parms; va_list parms;
va_start (parms, format); va_start(parms, format);
vsprintf( msg, format, parms ); vsprintf(msg, format, parms);
va_end (parms); va_end(parms);
InGameMessage(msg); InGameMessage(msg);
} }
void notify_user (int msg) void notify_user(int msg)
{ {
int i=0; int i = 0;
while(gui_msglist[i].num >= 0) while (gui_msglist[i].num >= 0)
{ {
if(gui_msglist[i].num == msg) if (gui_msglist[i].num == msg)
{ {
gui_message(gui_msglist[i].msg); gui_message(gui_msglist[i].msg);
break; break;
@ -840,12 +861,12 @@ void notify_user (int msg)
} }
int translate_message (int msg, TCHAR *out) int translate_message(int msg, TCHAR *out)
{ {
int i=0; int i = 0;
while(gui_msglist[i].num >= 0) while (gui_msglist[i].num >= 0)
{ {
if(gui_msglist[i].num == msg) if (gui_msglist[i].num == msg)
{ {
strcpy(out, gui_msglist[i].msg); strcpy(out, gui_msglist[i].msg);
return 1; return 1;
@ -858,16 +879,16 @@ int translate_message (int msg, TCHAR *out)
void FilterFiles(std::vector<std::string> *files, const char *filter[]) void FilterFiles(std::vector<std::string> *files, const char *filter[])
{ {
for (int q=0; q<files->size(); q++) for (int q = 0; q < files->size(); q++)
{ {
std::string tmp = (*files)[q]; std::string tmp = (*files)[q];
bool bRemove = true; bool bRemove = true;
for(int f=0; filter[f] != NULL && strlen(filter[f]) > 0; ++f) for (int f = 0; filter[f] != NULL && strlen(filter[f]) > 0; ++f)
{ {
if(tmp.size() >= strlen(filter[f])) if (tmp.size() >= strlen(filter[f]))
{ {
if(!strcasecmp(tmp.substr(tmp.size() - strlen(filter[f])).c_str(), filter[f])) if (!strcasecmp(tmp.substr(tmp.size() - strlen(filter[f])).c_str(), filter[f]))
{ {
bRemove = false; bRemove = false;
break; break;
@ -875,7 +896,7 @@ void FilterFiles(std::vector<std::string> *files, const char *filter[])
} }
} }
if(bRemove) if (bRemove)
{ {
files->erase(files->begin() + q); files->erase(files->begin() + q);
--q; --q;
@ -889,15 +910,15 @@ bool DevicenameExists(const char *name)
int i; int i;
struct uaedev_config_info *uci; struct uaedev_config_info *uci;
for(i=0; i<MAX_HD_DEVICES; ++i) for (i = 0; i < MAX_HD_DEVICES; ++i)
{ {
uci = &changed_prefs.mountconfig[i]; uci = &changed_prefs.mountconfig[i];
if(uci->devname && uci->devname[0]) if (uci->devname && uci->devname[0])
{ {
if(!strcmp(uci->devname, name)) if (!strcmp(uci->devname, name))
return true; return true;
if(uci->volname != 0 && !strcmp(uci->volname, name)) if (uci->volname != 0 && !strcmp(uci->volname, name))
return true; return true;
} }
} }
@ -910,7 +931,7 @@ void CreateDefaultDevicename(char *name)
int freeNum = 0; int freeNum = 0;
bool foundFree = false; bool foundFree = false;
while(!foundFree && freeNum < 10) while (!foundFree && freeNum < 10)
{ {
sprintf(name, "DH%d", freeNum); sprintf(name, "DH%d", freeNum);
foundFree = !DevicenameExists(name); foundFree = !DevicenameExists(name);
@ -919,7 +940,7 @@ void CreateDefaultDevicename(char *name)
} }
int tweakbootpri (int bp, int ab, int dnm) int tweakbootpri(int bp, int ab, int dnm)
{ {
if (dnm) if (dnm)
return -129; return -129;
@ -931,25 +952,27 @@ int tweakbootpri (int bp, int ab, int dnm)
} }
bool hardfile_testrdb (const TCHAR *filename) bool hardfile_testrdb(const TCHAR *filename)
{ {
bool isrdb = false; bool isrdb = false;
struct zfile *f = zfile_fopen (filename, _T("rb"), ZFD_NORMAL); struct zfile *f = zfile_fopen(filename, _T("rb"), ZFD_NORMAL);
uae_u8 tmp[8]; uae_u8 tmp[8];
int i; int i;
if (!f) if (!f)
return false; return false;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++)
zfile_fseek (f, i * 512, SEEK_SET); {
memset (tmp, 0, sizeof tmp); zfile_fseek(f, i * 512, SEEK_SET);
zfile_fread (tmp, 1, sizeof tmp, f); memset(tmp, 0, sizeof tmp);
if (!memcmp (tmp, "RDSK\0\0\0", 7) || !memcmp (tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0)) { zfile_fread(tmp, 1, sizeof tmp, f);
if (!memcmp(tmp, "RDSK\0\0\0", 7) || !memcmp(tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0))
{
// RDSK or ADIDE "encoded" RDSK // RDSK or ADIDE "encoded" RDSK
isrdb = true; isrdb = true;
break; break;
} }
} }
zfile_fclose (f); zfile_fclose(f);
return isrdb; return isrdb;
} }

View file

@ -8,7 +8,7 @@
static int joyXviaCustom = 0; static int joyXviaCustom = 0;
static int joyYviaCustom = 0; static int joyYviaCustom = 0;
static int joyButXviaCustom[7] = { 0, 0, 0, 0, 0, 0, 0}; static int joyButXviaCustom[7] = { 0, 0, 0, 0, 0, 0, 0 };
static int mouseBut1viaCustom = 0; static int mouseBut1viaCustom = 0;
static int mouseBut2viaCustom = 0; static int mouseBut2viaCustom = 0;
@ -19,53 +19,54 @@ static int mouseBut2viaCustom = 0;
#define FIRST_MOUSE_BUTTON MAX_MOUSE_AXES #define FIRST_MOUSE_BUTTON MAX_MOUSE_AXES
static int init_mouse (void) static int init_mouse(void)
{ {
return 1; return 1;
} }
static void close_mouse (void) static void close_mouse(void)
{ {
} }
static int acquire_mouse (int num, int flags) static int acquire_mouse(int num, int flags)
{ {
return 1; return 1;
} }
static void unacquire_mouse (int num) static void unacquire_mouse(int num)
{ {
} }
static int get_mouse_num (void) static int get_mouse_num(void)
{ {
return 2; return 2;
} }
static TCHAR *get_mouse_friendlyname (int mouse) static const TCHAR *get_mouse_friendlyname(int mouse)
{ {
if(mouse == 0) if (mouse == 0)
return "Nubs as mouse"; return "Nubs as mouse";
else else
return "dPad as mouse"; return "dPad as mouse";
} }
static TCHAR *get_mouse_uniquename (int mouse) static const TCHAR *get_mouse_uniquename(int mouse)
{ {
if(mouse == 0) if (mouse == 0)
return "MOUSE0"; return "MOUSE0";
else else
return "MOUSE1"; return "MOUSE1";
} }
static int get_mouse_widget_num (int mouse) static int get_mouse_widget_num(int mouse)
{ {
return MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS; return MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS;
} }
static int get_mouse_widget_first (int mouse, int type) static int get_mouse_widget_first(int mouse, int type)
{ {
switch (type) { switch (type)
{
case IDEV_WIDGET_BUTTON: case IDEV_WIDGET_BUTTON:
return FIRST_MOUSE_BUTTON; return FIRST_MOUSE_BUTTON;
case IDEV_WIDGET_AXIS: case IDEV_WIDGET_AXIS:
@ -76,29 +77,34 @@ static int get_mouse_widget_first (int mouse, int type)
return -1; return -1;
} }
static int get_mouse_widget_type (int mouse, int num, TCHAR *name, uae_u32 *code) static int get_mouse_widget_type(int mouse, int num, TCHAR *name, uae_u32 *code)
{ {
if (num >= MAX_MOUSE_AXES && num < MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS) { if (num >= MAX_MOUSE_AXES && num < MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS)
{
if (name) if (name)
sprintf (name, "Button %d", num + 1 - MAX_MOUSE_AXES); sprintf(name, "Button %d", num + 1 - MAX_MOUSE_AXES);
return IDEV_WIDGET_BUTTON; return IDEV_WIDGET_BUTTON;
} else if (num < MAX_MOUSE_AXES) { }
if (name) { else if (num < MAX_MOUSE_AXES)
if(num == 0) {
sprintf (name, "X Axis"); if (name)
{
if (num == 0)
sprintf(name, "X Axis");
else if (num == 1) else if (num == 1)
sprintf (name, "Y Axis"); sprintf(name, "Y Axis");
else else
sprintf (name, "Axis %d", num + 1); sprintf(name, "Axis %d", num + 1);
} }
return IDEV_WIDGET_AXIS; return IDEV_WIDGET_AXIS;
} }
return IDEV_WIDGET_NONE; return IDEV_WIDGET_NONE;
} }
static void read_mouse (void) static void read_mouse(void)
{ {
if(currprefs.input_tablet > TABLET_OFF) { if (currprefs.input_tablet > TABLET_OFF)
{
// Mousehack active // Mousehack active
int x, y; int x, y;
SDL_GetMouseState(&x, &y); SDL_GetMouseState(&x, &y);
@ -106,65 +112,74 @@ static void read_mouse (void)
setmousestate(0, 1, y, 1); setmousestate(0, 1, y, 1);
} }
if(currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1) { if (currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1)
{
// dPad is mouse // dPad is mouse
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
int mouseScale = currprefs.input_joymouse_multiplier / 4; int mouseScale = currprefs.input_joymouse_multiplier / 4;
if(keystate[SDLK_LEFT]) if (keystate[SDLK_LEFT])
setmousestate(1, 0, -mouseScale, 0); setmousestate(1, 0, -mouseScale, 0);
if(keystate[SDLK_RIGHT]) if (keystate[SDLK_RIGHT])
setmousestate(1, 0, mouseScale, 0); setmousestate(1, 0, mouseScale, 0);
if(keystate[SDLK_UP]) if (keystate[SDLK_UP])
setmousestate(1, 1, -mouseScale, 0); setmousestate(1, 1, -mouseScale, 0);
if(keystate[SDLK_DOWN]) if (keystate[SDLK_DOWN])
setmousestate(1, 1, mouseScale, 0); setmousestate(1, 1, mouseScale, 0);
if(!mouseBut1viaCustom) if (!mouseBut1viaCustom)
setmousebuttonstate (1, 0, keystate[SDLK_HOME]); // A button -> left mouse setmousebuttonstate(1, 0, keystate[SDLK_HOME]); // A button -> left mouse
if(!mouseBut2viaCustom) if (!mouseBut2viaCustom)
setmousebuttonstate (1, 1, keystate[SDLK_END]); // B button -> right mouse setmousebuttonstate(1, 1, keystate[SDLK_END]); // B button -> right mouse
} }
// Nubs as mouse handled in handle_msgpump() // Nubs as mouse handled in handle_msgpump()
} }
static int get_mouse_flags (int num) static int get_mouse_flags(int num)
{ {
return 0; return 0;
} }
struct inputdevice_functions inputdevicefunc_mouse = { struct inputdevice_functions inputdevicefunc_mouse =
init_mouse, close_mouse, acquire_mouse, unacquire_mouse, read_mouse, {
get_mouse_num, get_mouse_friendlyname, get_mouse_uniquename, init_mouse,
get_mouse_widget_num, get_mouse_widget_type, close_mouse,
acquire_mouse,
unacquire_mouse,
read_mouse,
get_mouse_num,
get_mouse_friendlyname,
get_mouse_uniquename,
get_mouse_widget_num,
get_mouse_widget_type,
get_mouse_widget_first, get_mouse_widget_first,
get_mouse_flags get_mouse_flags
}; };
static void setid (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt, bool gp) static void setid(struct uae_input_device *uid, int i, int slot, int sub, int port, int evt, bool gp)
{ {
if (gp) if (gp)
inputdevice_sparecopy (&uid[i], slot, 0); inputdevice_sparecopy(&uid[i], slot, 0);
uid[i].eventid[slot][sub] = evt; uid[i].eventid[slot][sub] = evt;
uid[i].port[slot][sub] = port + 1; uid[i].port[slot][sub] = port + 1;
} }
static void setid_af (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt, int af, bool gp) static void setid_af(struct uae_input_device *uid, int i, int slot, int sub, int port, int evt, int af, bool gp)
{ {
setid (uid, i, slot, sub, port, evt, gp); setid(uid, i, slot, sub, port, evt, gp);
uid[i].flags[slot][sub] &= ~ID_FLAG_AUTOFIRE_MASK; uid[i].flags[slot][sub] &= ~ID_FLAG_AUTOFIRE_MASK;
if (af >= JPORT_AF_NORMAL) if (af >= JPORT_AF_NORMAL)
uid[i].flags[slot][sub] |= ID_FLAG_AUTOFIRE; uid[i].flags[slot][sub] |= ID_FLAG_AUTOFIRE;
} }
int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int af, bool gp) int input_get_default_mouse(struct uae_input_device *uid, int i, int port, int af, bool gp)
{ {
setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ, gp); setid(uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ, gp);
setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT, gp); setid(uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT, gp);
setid_af (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af, gp); setid_af(uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af, gp);
setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp); setid(uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);
if (i == 0) if (i == 0)
return 1; return 1;
@ -172,76 +187,85 @@ int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int
} }
static int init_kb (void) static int init_kb(void)
{ {
return 1; return 1;
} }
static void close_kb (void) static void close_kb(void)
{ {
} }
static int acquire_kb (int num, int flags) static int acquire_kb(int num, int flags)
{ {
return 1; return 1;
} }
static void unacquire_kb (int num) static void unacquire_kb(int num)
{ {
} }
static void read_kb (void) static void read_kb(void)
{ {
} }
static int get_kb_num (void) static int get_kb_num(void)
{ {
return 1; return 1;
} }
static TCHAR *get_kb_friendlyname (int kb) static const TCHAR *get_kb_friendlyname(int kb)
{ {
return strdup("Default Keyboard"); return strdup("Default Keyboard");
} }
static TCHAR *get_kb_uniquename (int kb) static const TCHAR *get_kb_uniquename(int kb)
{ {
return strdup("KEYBOARD0"); return strdup("KEYBOARD0");
} }
static int get_kb_widget_num (int kb) static int get_kb_widget_num(int kb)
{ {
return 255; return 255;
} }
static int get_kb_widget_first (int kb, int type) static int get_kb_widget_first(int kb, int type)
{ {
return 0; return 0;
} }
static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code) static int get_kb_widget_type(int kb, int num, TCHAR *name, uae_u32 *code)
{ {
if(code) if (code)
*code = num; *code = num;
return IDEV_WIDGET_KEY; return IDEV_WIDGET_KEY;
} }
static int get_kb_flags (int num) static int get_kb_flags(int num)
{ {
return 0; return 0;
} }
struct inputdevice_functions inputdevicefunc_keyboard = { struct inputdevice_functions inputdevicefunc_keyboard =
init_kb, close_kb, acquire_kb, unacquire_kb, read_kb, {
get_kb_num, get_kb_friendlyname, get_kb_uniquename, init_kb,
get_kb_widget_num, get_kb_widget_type, close_kb,
acquire_kb,
unacquire_kb,
read_kb,
get_kb_num,
get_kb_friendlyname,
get_kb_uniquename,
get_kb_widget_num,
get_kb_widget_type,
get_kb_widget_first, get_kb_widget_first,
get_kb_flags get_kb_flags
}; };
int input_get_default_keyboard (int num) int input_get_default_keyboard(int num)
{ {
if (num == 0) { if (num == 0)
{
return 1; return 1;
} }
return 0; return 0;
@ -259,52 +283,51 @@ static char JoystickName[MAX_INPUT_DEVICES][80];
static SDL_Joystick* Joysticktable[MAX_INPUT_DEVICES]; static SDL_Joystick* Joysticktable[MAX_INPUT_DEVICES];
static int get_joystick_num(void)
static int get_joystick_num (void)
{ {
// Keep joystick 0 as Pandora implementation... // Keep joystick 0 as Pandora implementation...
return (nr_joysticks + 1); return (nr_joysticks + 1);
} }
static int init_joystick (void) static int init_joystick(void)
{ {
//This function is called too many times... we can filter if number of joy is good... //This function is called too many times... we can filter if number of joy is good...
if (nr_joysticks == SDL_NumJoysticks ()) if (nr_joysticks == SDL_NumJoysticks())
return 1; return 1;
nr_joysticks = SDL_NumJoysticks (); nr_joysticks = SDL_NumJoysticks();
if (nr_joysticks > MAX_INPUT_DEVICES) if (nr_joysticks > MAX_INPUT_DEVICES)
nr_joysticks = MAX_INPUT_DEVICES; nr_joysticks = MAX_INPUT_DEVICES;
for (int cpt; cpt < nr_joysticks; cpt++) for (int cpt; cpt < nr_joysticks; cpt++)
{ {
Joysticktable[cpt] = SDL_JoystickOpen (cpt); Joysticktable[cpt] = SDL_JoystickOpen(cpt);
strncpy(JoystickName[cpt],SDL_JoystickName(cpt),80); strncpy(JoystickName[cpt], SDL_JoystickName(cpt), 80);
printf("Joystick %i : %s\n",cpt,JoystickName[cpt]); printf("Joystick %i : %s\n", cpt, JoystickName[cpt]);
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(Joysticktable[cpt]),SDL_JoystickNumAxes(Joysticktable[cpt]),SDL_JoystickNumHats(Joysticktable[cpt])); printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt]));
} }
return 1; return 1;
} }
static void close_joystick (void) static void close_joystick(void)
{ {
for (int cpt; cpt < nr_joysticks; cpt++) for (int cpt; cpt < nr_joysticks; cpt++)
{ {
SDL_JoystickClose (Joysticktable[cpt]); SDL_JoystickClose(Joysticktable[cpt]);
} }
} }
static int acquire_joystick (int num, int flags) static int acquire_joystick(int num, int flags)
{ {
return 1; return 1;
} }
static void unacquire_joystick (int num) static void unacquire_joystick(int num)
{ {
} }
static TCHAR *get_joystick_friendlyname (int joy) static const TCHAR *get_joystick_friendlyname(int joy)
{ {
if (joy == 0) if (joy == 0)
return "dPad as joystick"; return "dPad as joystick";
@ -312,7 +335,7 @@ static TCHAR *get_joystick_friendlyname (int joy)
return JoystickName[joy - 1]; return JoystickName[joy - 1];
} }
static TCHAR *get_joystick_uniquename (int joy) static const TCHAR *get_joystick_uniquename(int joy)
{ {
if (joy == 0) if (joy == 0)
return "JOY0"; return "JOY0";
@ -332,15 +355,15 @@ static TCHAR *get_joystick_uniquename (int joy)
return "JOY7"; return "JOY7";
} }
static int get_joystick_widget_num(int joy)
static int get_joystick_widget_num (int joy)
{ {
return MAX_JOY_AXES + MAX_JOY_BUTTONS; return MAX_JOY_AXES + MAX_JOY_BUTTONS;
} }
static int get_joystick_widget_first (int joy, int type) static int get_joystick_widget_first(int joy, int type)
{ {
switch (type) { switch (type)
{
case IDEV_WIDGET_BUTTON: case IDEV_WIDGET_BUTTON:
return FIRST_JOY_BUTTON; return FIRST_JOY_BUTTON;
case IDEV_WIDGET_AXIS: case IDEV_WIDGET_AXIS:
@ -351,172 +374,188 @@ static int get_joystick_widget_first (int joy, int type)
return -1; return -1;
} }
static int get_joystick_widget_type (int joy, int num, TCHAR *name, uae_u32 *code) static int get_joystick_widget_type(int joy, int num, TCHAR *name, uae_u32 *code)
{ {
if (num >= MAX_JOY_AXES && num < MAX_JOY_AXES + MAX_JOY_BUTTONS) { if (num >= MAX_JOY_AXES && num < MAX_JOY_AXES + MAX_JOY_BUTTONS)
if (name) { {
switch(num) if (name)
{
switch (num)
{ {
case FIRST_JOY_BUTTON: case FIRST_JOY_BUTTON:
sprintf (name, "Button X/CD32 red"); sprintf(name, "Button X/CD32 red");
break; break;
case FIRST_JOY_BUTTON + 1: case FIRST_JOY_BUTTON + 1:
sprintf (name, "Button B/CD32 blue"); sprintf(name, "Button B/CD32 blue");
break; break;
case FIRST_JOY_BUTTON + 2: case FIRST_JOY_BUTTON + 2:
sprintf (name, "Button A/CD32 green"); sprintf(name, "Button A/CD32 green");
break; break;
case FIRST_JOY_BUTTON + 3: case FIRST_JOY_BUTTON + 3:
sprintf (name, "Button Y/CD32 yellow"); sprintf(name, "Button Y/CD32 yellow");
break; break;
case FIRST_JOY_BUTTON + 4: case FIRST_JOY_BUTTON + 4:
sprintf (name, "CD32 start"); sprintf(name, "CD32 start");
break; break;
case FIRST_JOY_BUTTON + 5: case FIRST_JOY_BUTTON + 5:
sprintf (name, "CD32 ffw"); sprintf(name, "CD32 ffw");
break; break;
case FIRST_JOY_BUTTON + 6: case FIRST_JOY_BUTTON + 6:
sprintf (name, "CD32 rwd"); sprintf(name, "CD32 rwd");
break; break;
} }
} }
return IDEV_WIDGET_BUTTON; return IDEV_WIDGET_BUTTON;
} else if (num < MAX_JOY_AXES) { }
if (name) { else if (num < MAX_JOY_AXES)
if(num == 0) {
sprintf (name, "X Axis"); if (name)
{
if (num == 0)
sprintf(name, "X Axis");
else if (num == 1) else if (num == 1)
sprintf (name, "Y Axis"); sprintf(name, "Y Axis");
else else
sprintf (name, "Axis %d", num + 1); sprintf(name, "Axis %d", num + 1);
} }
return IDEV_WIDGET_AXIS; return IDEV_WIDGET_AXIS;
} }
return IDEV_WIDGET_NONE; return IDEV_WIDGET_NONE;
} }
static int get_joystick_flags (int num) static int get_joystick_flags(int num)
{ {
return 0; return 0;
} }
static void read_joystick (void) static void read_joystick(void)
{ {
for (int joyid = 0; joyid < MAX_JPORTS ; joyid ++) for (int joyid = 0; joyid < MAX_JPORTS; joyid++)
// First handle fake joystick from pandora... // First handle fake joystick from pandora...
if(currprefs.jports[joyid].id == JSEM_JOYS) if (currprefs.jports[joyid].id == JSEM_JOYS)
{ {
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
if(!keystate[SDLK_RCTRL]) if (!keystate[SDLK_RCTRL])
{ // Right shoulder + dPad -> cursor keys {
// Right shoulder + dPad -> cursor keys
int axis = (keystate[SDLK_LEFT] ? -32767 : (keystate[SDLK_RIGHT] ? 32767 : 0)); int axis = (keystate[SDLK_LEFT] ? -32767 : (keystate[SDLK_RIGHT] ? 32767 : 0));
if(!joyXviaCustom) if (!joyXviaCustom)
setjoystickstate (0, 0, axis, 32767); setjoystickstate(0, 0, axis, 32767);
axis = (keystate[SDLK_UP] ? -32767 : (keystate[SDLK_DOWN] ? 32767 : 0)); axis = (keystate[SDLK_UP] ? -32767 : (keystate[SDLK_DOWN] ? 32767 : 0));
if(!joyYviaCustom) if (!joyYviaCustom)
setjoystickstate (0, 1, axis, 32767); setjoystickstate(0, 1, axis, 32767);
} }
if(!joyButXviaCustom[0]) if (!joyButXviaCustom[0])
setjoybuttonstate (0, 0, keystate[SDLK_PAGEDOWN]); setjoybuttonstate(0, 0, keystate[SDLK_PAGEDOWN]);
if(!joyButXviaCustom[1]) if (!joyButXviaCustom[1])
setjoybuttonstate (0, 1, keystate[SDLK_END]); setjoybuttonstate(0, 1, keystate[SDLK_END]);
if(!joyButXviaCustom[2]) if (!joyButXviaCustom[2])
setjoybuttonstate (0, 2, keystate[SDLK_HOME]); setjoybuttonstate(0, 2, keystate[SDLK_HOME]);
if(!joyButXviaCustom[3]) if (!joyButXviaCustom[3])
setjoybuttonstate (0, 3, keystate[SDLK_PAGEUP]); setjoybuttonstate(0, 3, keystate[SDLK_PAGEUP]);
int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0; int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
if(keystate[SDLK_LALT]) { // Pandora Start button if (keystate[SDLK_LALT]) // Pandora Start button
if(keystate[SDLK_RSHIFT]) // Left shoulder {
if (keystate[SDLK_RSHIFT]) // Left shoulder
cd32_rwd = 1; cd32_rwd = 1;
else if (keystate[SDLK_RCTRL]) // Right shoulder else if (keystate[SDLK_RCTRL]) // Right shoulder
cd32_ffw = 1; cd32_ffw = 1;
else else
cd32_start = 1; cd32_start = 1;
} }
if(!joyButXviaCustom[6]) if (!joyButXviaCustom[6])
setjoybuttonstate (0, 6, cd32_start); setjoybuttonstate(0, 6, cd32_start);
if(!joyButXviaCustom[5]) if (!joyButXviaCustom[5])
setjoybuttonstate (0, 5, cd32_ffw); setjoybuttonstate(0, 5, cd32_ffw);
if(!joyButXviaCustom[4]) if (!joyButXviaCustom[4])
setjoybuttonstate (0, 4, cd32_rwd); setjoybuttonstate(0, 4, cd32_rwd);
} }
else if (jsem_isjoy(joyid,&currprefs) != -1) else if (jsem_isjoy(joyid, &currprefs) != -1)
{ {
// Now we handle real SDL joystick... // Now we handle real SDL joystick...
int hostjoyid = currprefs.jports[joyid].id - JSEM_JOYS -1; int hostjoyid = currprefs.jports[joyid].id - JSEM_JOYS - 1;
int hat = SDL_JoystickGetHat(Joysticktable[hostjoyid],0); int hat = SDL_JoystickGetHat(Joysticktable[hostjoyid], 0);
int val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 0); int val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 0);
if (hat & SDL_HAT_RIGHT) if (hat & SDL_HAT_RIGHT)
setjoystickstate (hostjoyid + 1, 0, 32767, 32767); setjoystickstate(hostjoyid + 1, 0, 32767, 32767);
else if (hat & SDL_HAT_LEFT)
setjoystickstate(hostjoyid + 1, 0, -32767, 32767);
else else
if (hat & SDL_HAT_LEFT) setjoystickstate(hostjoyid + 1, 0, val, 32767);
setjoystickstate (hostjoyid + 1, 0, -32767, 32767);
else
setjoystickstate (hostjoyid + 1, 0, val, 32767);
val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 1); val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 1);
if (hat & SDL_HAT_UP) if (hat & SDL_HAT_UP)
setjoystickstate (hostjoyid + 1, 1, -32767, 32767); setjoystickstate(hostjoyid + 1, 1, -32767, 32767);
else if (hat & SDL_HAT_DOWN)
setjoystickstate(hostjoyid + 1, 1, 32767, 32767);
else else
if (hat & SDL_HAT_DOWN) setjoystickstate(hostjoyid + 1, 1, val, 32767);
setjoystickstate (hostjoyid + 1, 1, 32767, 32767);
else
setjoystickstate (hostjoyid + 1, 1, val, 32767);
setjoybuttonstate (hostjoyid + 1, 0, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 0) & 1) ); setjoybuttonstate(hostjoyid + 1, 0, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 0) & 1));
setjoybuttonstate (hostjoyid + 1, 1, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 1) & 1) ); setjoybuttonstate(hostjoyid + 1, 1, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 1) & 1));
setjoybuttonstate (hostjoyid + 1, 2, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 2) & 1) ); setjoybuttonstate(hostjoyid + 1, 2, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 2) & 1));
setjoybuttonstate (hostjoyid + 1, 3, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 3) & 1) ); setjoybuttonstate(hostjoyid + 1, 3, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 3) & 1));
// cd32 start, ffw, rwd // cd32 start, ffw, rwd
setjoybuttonstate (hostjoyid + 1, 4, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 4) & 1) ); setjoybuttonstate(hostjoyid + 1, 4, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 4) & 1));
setjoybuttonstate (hostjoyid + 1, 5, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 5) & 1) ); setjoybuttonstate(hostjoyid + 1, 5, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 5) & 1));
setjoybuttonstate (hostjoyid + 1, 6, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 6) & 1) ); setjoybuttonstate(hostjoyid + 1, 6, (SDL_JoystickGetButton(Joysticktable[hostjoyid], 6) & 1));
} }
} }
struct inputdevice_functions inputdevicefunc_joystick = { struct inputdevice_functions inputdevicefunc_joystick =
init_joystick, close_joystick, acquire_joystick, unacquire_joystick, {
read_joystick, get_joystick_num, get_joystick_friendlyname, get_joystick_uniquename, init_joystick,
get_joystick_widget_num, get_joystick_widget_type, close_joystick,
acquire_joystick,
unacquire_joystick,
read_joystick,
get_joystick_num,
get_joystick_friendlyname,
get_joystick_uniquename,
get_joystick_widget_num,
get_joystick_widget_type,
get_joystick_widget_first, get_joystick_widget_first,
get_joystick_flags get_joystick_flags
}; };
int input_get_default_joystick (struct uae_input_device *uid, int num, int port, int af, int mode, bool gp) int input_get_default_joystick(struct uae_input_device *uid, int num, int port, int af, int mode, bool gp)
{ {
int h, v; int h, v;
h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;; h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;
;
v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT; v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT;
setid (uid, num, ID_AXIS_OFFSET + 0, 0, port, h, gp); setid(uid, num, ID_AXIS_OFFSET + 0, 0, port, h, gp);
setid (uid, num, ID_AXIS_OFFSET + 1, 0, port, v, gp); setid(uid, num, ID_AXIS_OFFSET + 1, 0, port, v, gp);
setid_af (uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af, gp); setid_af(uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af, gp);
setid (uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp); setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);
setid (uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp); setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp);
if (mode == JSEM_MODE_JOYSTICK_CD32) { if (mode == JSEM_MODE_JOYSTICK_CD32)
setid_af (uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED, af, gp); {
setid (uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp); setid_af(uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED, af, gp);
setid (uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN, gp); setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp);
setid (uid, num, ID_BUTTON_OFFSET + 3, 0, port, port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW, gp); setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN, gp);
setid (uid, num, ID_BUTTON_OFFSET + 4, 0, port, port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD, gp); setid(uid, num, ID_BUTTON_OFFSET + 3, 0, port, port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW, gp);
setid (uid, num, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW, gp); setid(uid, num, ID_BUTTON_OFFSET + 4, 0, port, port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD, gp);
setid (uid, num, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY, gp); setid(uid, num, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW, gp);
setid(uid, num, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY, gp);
} }
if (num == 0) { if (num == 0)
{
return 1; return 1;
} }
return 0; return 0;
} }
int input_get_default_joystick_analog (struct uae_input_device *uid, int num, int port, int af) int input_get_default_joystick_analog(struct uae_input_device *uid, int num, int port, int af)
{ {
return 0; return 0;
} }
@ -524,72 +563,73 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int num, in
void SimulateMouseOrJoy(int code, int keypressed) void SimulateMouseOrJoy(int code, int keypressed)
{ {
switch(code) { switch (code)
{
case REMAP_MOUSEBUTTON_LEFT: case REMAP_MOUSEBUTTON_LEFT:
mouseBut1viaCustom = keypressed; mouseBut1viaCustom = keypressed;
setmousebuttonstate (0, 0, keypressed); setmousebuttonstate(0, 0, keypressed);
setmousebuttonstate (1, 0, keypressed); setmousebuttonstate(1, 0, keypressed);
break; break;
case REMAP_MOUSEBUTTON_RIGHT: case REMAP_MOUSEBUTTON_RIGHT:
mouseBut2viaCustom = keypressed; mouseBut2viaCustom = keypressed;
setmousebuttonstate (0, 1, keypressed); setmousebuttonstate(0, 1, keypressed);
setmousebuttonstate (1, 1, keypressed); setmousebuttonstate(1, 1, keypressed);
break; break;
case REMAP_JOYBUTTON_ONE: case REMAP_JOYBUTTON_ONE:
joyButXviaCustom[0] = keypressed; joyButXviaCustom[0] = keypressed;
setjoybuttonstate (0, 0, keypressed); setjoybuttonstate(0, 0, keypressed);
break; break;
case REMAP_JOYBUTTON_TWO: case REMAP_JOYBUTTON_TWO:
joyButXviaCustom[1] = keypressed; joyButXviaCustom[1] = keypressed;
setjoybuttonstate (0, 1, keypressed); setjoybuttonstate(0, 1, keypressed);
break; break;
case REMAP_JOY_UP: case REMAP_JOY_UP:
joyYviaCustom = keypressed; joyYviaCustom = keypressed;
setjoystickstate (0, 1, keypressed ? -32767 : 0, 32767); setjoystickstate(0, 1, keypressed ? -32767 : 0, 32767);
break; break;
case REMAP_JOY_DOWN: case REMAP_JOY_DOWN:
joyYviaCustom = keypressed; joyYviaCustom = keypressed;
setjoystickstate (0, 1, keypressed ? 32767 : 0, 32767); setjoystickstate(0, 1, keypressed ? 32767 : 0, 32767);
break; break;
case REMAP_JOY_LEFT: case REMAP_JOY_LEFT:
joyXviaCustom = keypressed; joyXviaCustom = keypressed;
setjoystickstate (0, 0, keypressed ? -32767 : 0, 32767); setjoystickstate(0, 0, keypressed ? -32767 : 0, 32767);
break; break;
case REMAP_JOY_RIGHT: case REMAP_JOY_RIGHT:
joyXviaCustom = keypressed; joyXviaCustom = keypressed;
setjoystickstate (0, 0, keypressed ? 32767 : 0, 32767); setjoystickstate(0, 0, keypressed ? 32767 : 0, 32767);
break; break;
case REMAP_CD32_GREEN: case REMAP_CD32_GREEN:
joyButXviaCustom[2] = keypressed; joyButXviaCustom[2] = keypressed;
setjoybuttonstate (0, 2, keypressed); setjoybuttonstate(0, 2, keypressed);
break; break;
case REMAP_CD32_YELLOW: case REMAP_CD32_YELLOW:
joyButXviaCustom[3] = keypressed; joyButXviaCustom[3] = keypressed;
setjoybuttonstate (0, 3, keypressed); setjoybuttonstate(0, 3, keypressed);
break; break;
case REMAP_CD32_PLAY: case REMAP_CD32_PLAY:
joyButXviaCustom[6] = keypressed; joyButXviaCustom[6] = keypressed;
setjoybuttonstate (0, 6, keypressed); setjoybuttonstate(0, 6, keypressed);
break; break;
case REMAP_CD32_FFW: case REMAP_CD32_FFW:
joyButXviaCustom[5] = keypressed; joyButXviaCustom[5] = keypressed;
setjoybuttonstate (0, 5, keypressed); setjoybuttonstate(0, 5, keypressed);
break; break;
case REMAP_CD32_RWD: case REMAP_CD32_RWD:
joyButXviaCustom[4] = keypressed; joyButXviaCustom[4] = keypressed;
setjoybuttonstate (0, 4, keypressed); setjoybuttonstate(0, 4, keypressed);
break; break;
} }
} }

File diff suppressed because it is too large Load diff