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
*
* Custom chip emulation
@ -18,7 +18,7 @@
#include "gensound.h"
#include "audio.h"
#include "sd-pandora/sound.h"
#include "memory.h"
#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "cia.h"

View file

@ -1,12 +1,12 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Screen drawing functions
*
* Copyright 1995-2000 Bernd Schmidt
* Copyright 1995 Alessandro Bissacco
* Copyright 2000-2008 Toni Wilen
*/
/*
* UAE - The Un*x Amiga Emulator
*
* Screen drawing functions
*
* Copyright 1995-2000 Bernd Schmidt
* Copyright 1995 Alessandro Bissacco
* Copyright 2000-2008 Toni Wilen
*/
/* There are a couple of concepts of "coordinates" in this file.
@ -49,11 +49,11 @@
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;
if (sprite_buffer_res > currprefs.gfx_resolution)
sprite_buffer_res = currprefs.gfx_resolution;
sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES;
if (sprite_buffer_res > currprefs.gfx_resolution)
sprite_buffer_res = currprefs.gfx_resolution;
}
bool aga_mode; /* mirror of chipset_mask & CSMASK_AGA */

View file

@ -1,20 +1,20 @@
/*
* UAE - The Un*x Amiga Emulator
*
* AutoConfig (tm) Expansions (ZorroII/III)
*
* Copyright 1996,1997 Stefan Reinauer <stepan@linux.de>
* Copyright 1997 Brian King <Brian_King@Mitel.com>
* - added gfxcard code
*
*/
/*
* UAE - The Un*x Amiga Emulator
*
* AutoConfig (tm) Expansions (ZorroII/III)
*
* Copyright 1996,1997 Stefan Reinauer <stepan@linux.de>
* Copyright 1997 Brian King <Brian_King@Mitel.com>
* - added gfxcard code
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "uae.h"
#include "memory.h"
#include "include/memory.h"
#include "rommgr.h"
#include "autoconf.h"
#include "newcpu.h"

View file

@ -4,6 +4,7 @@
* Copyright 1996-1998 Bernd Schmidt
*/
#pragma once
#define MAX_PLANES 8
/* According to the HRM, pixel data spends a couple of cycles somewhere in the chips
@ -22,26 +23,26 @@
#define lores_shift 0
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;
return x;
x -= DISPLAY_LEFT_SHIFT;
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);
return x - DIW_DDF_OFFSET;
x = coord_window_to_hw_x(x);
return x - DIW_DDF_OFFSET;
}
extern int framecnt;
@ -52,10 +53,11 @@ extern int framecnt;
*
* !!! See color_reg_xxx functions below before touching !!!
*/
struct color_entry {
uae_u16 color_regs_ecs[32];
xcolnr acolors[256];
uae_u32 color_regs_aga[256];
struct color_entry
{
uae_u16 color_regs_ecs[32];
xcolnr acolors[256];
uae_u32 color_regs_aga[256];
bool borderblank;
};
@ -67,19 +69,20 @@ struct color_entry {
#else
STATIC_INLINE uae_u16 CONVERT_RGB(uae_u32 c)
{
uae_u16 ret;
__asm__ (
"ubfx r1, %[c], #19, #5 \n\t"
"ubfx r2, %[c], #10, #6 \n\t"
"ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" );
return ret;
uae_u16 ret;
__asm__(
"ubfx r1, %[c], #19, #5 \n\t"
"ubfx r2, %[c], #10, #6 \n\t"
"ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1",
"r2");
return ret;
}
#endif
STATIC_INLINE xcolnr getxcolor (int c)
STATIC_INLINE xcolnr getxcolor(int c)
{
if (aga_mode)
return CONVERT_RGB(c);
@ -88,7 +91,7 @@ STATIC_INLINE xcolnr getxcolor (int c)
}
/* 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)
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];
}
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)
ce->color_regs_aga[c] = v;
@ -105,15 +108,15 @@ STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v)
}
/* 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;
if (aga_mode)
/* copy acolors and color_regs_aga */
memcpy (dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else
/* copy first 32 acolors and color_regs_ecs */
memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32);
if (aga_mode)
/* copy acolors and color_regs_aga */
memcpy(dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else
/* copy first 32 acolors and color_regs_ecs */
memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32);
}
/*
@ -126,10 +129,11 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
*/
#define COLOR_CHANGE_BRDBLANK 0x80000000
struct color_change {
int linepos;
int regno;
unsigned int value;
struct color_change
{
int linepos;
int regno;
unsigned int value;
};
/* 440 rather than 880, since sprites are always lores. */
@ -142,15 +146,16 @@ struct color_change {
struct sprite_entry
{
unsigned short pos;
unsigned short max;
unsigned int first_pixel;
bool has_attached;
unsigned short pos;
unsigned short max;
unsigned int first_pixel;
bool has_attached;
};
union sps_union {
uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4];
union sps_union
{
uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4];
};
extern union sps_union spixstate;
@ -167,27 +172,29 @@ extern struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1];
/* struct decision contains things we save across drawing frames for
* comparison (smart update stuff). */
struct decision {
/* Records the leftmost access of BPL1DAT. */
int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */
int diwfirstword, diwlastword;
int ctable;
struct decision
{
/* Records the leftmost access of BPL1DAT. */
int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */
int diwfirstword, diwlastword;
int ctable;
uae_u16 bplcon0, bplcon2;
uae_u16 bplcon3, bplcon4;
uae_u8 nr_planes;
uae_u8 bplres;
bool ham_seen;
bool ham_at_start;
uae_u16 bplcon0, bplcon2;
uae_u16 bplcon3, bplcon4;
uae_u8 nr_planes;
uae_u8 bplres;
bool ham_seen;
bool ham_at_start;
};
/* Anything related to changes in hw registers during the DDF for one
* line. */
struct draw_info {
int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change;
int nr_color_changes, nr_sprites;
struct draw_info
{
int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change;
int nr_color_changes, nr_sprites;
};
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
@ -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];
/* Functions in drawing.c. */
extern int coord_native_to_amiga_y (int);
extern int coord_native_to_amiga_x (int);
extern int coord_native_to_amiga_y(int);
extern int coord_native_to_amiga_x(int);
extern void hsync_record_line_state (int lineno);
extern void vsync_handle_redraw (void);
extern void vsync_handle_check (void);
extern void init_hardware_for_drawing_frame (void);
extern void reset_drawing (void);
extern void drawing_init (void);
extern void hsync_record_line_state(int lineno);
extern void vsync_handle_redraw(void);
extern void vsync_handle_check(void);
extern void init_hardware_for_drawing_frame(void);
extern void reset_drawing(void);
extern void drawing_init(void);
extern unsigned long time_per_frame;
extern void adjust_idletime(unsigned long ns_waited);
@ -217,15 +224,15 @@ extern void adjust_idletime(unsigned long ns_waited);
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 (*read)(void);
int (*get_num)(void);
TCHAR* (*get_friendlyname)(int);
TCHAR* (*get_uniquename)(int);
const TCHAR* (*get_friendlyname)(int);
const TCHAR* (*get_uniquename)(int);
int (*get_widget_num)(int);
int (*get_widget_type)(int,int,TCHAR*,uae_u32*);
int (*get_widget_first)(int,int);

View file

@ -1,22 +1,24 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Stuff
*
* Copyright 1995, 1996 Ed Hanway
* Copyright 1995-2001 Bernd Schmidt
*/
/*
* UAE - The Un*x Amiga Emulator
*
* Stuff
*
* Copyright 1995, 1996 Ed Hanway
* Copyright 1995-2001 Bernd Schmidt
*/
#pragma once
#define UAEMAJOR 2
#define UAEMINOR 5
#define UAESUBREV 1
extern long int version;
struct strlist {
struct strlist *next;
TCHAR *option, *value;
int unknown;
struct strlist
{
struct strlist *next;
TCHAR *option, *value;
int unknown;
};
#define DEFAULT_JIT_CACHE_SIZE 8192
@ -35,7 +37,8 @@ struct strlist {
#define MAX_INPUT_SUB_EVENT_ALL 9
#define SPARE_SUB_EVENT 8
struct uae_input_device {
struct uae_input_device
{
TCHAR *name;
TCHAR *configname;
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 NORMAL_JPORTS 2
#define MAX_JPORTNAME 128
struct jport {
struct jport
{
int id;
int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen
int autofire;
@ -83,135 +87,138 @@ struct floppyslot
int dfxtype;
};
struct wh {
int x, y;
int width, height;
struct wh
{
int x, y;
int width, height;
};
#define MOUNT_CONFIG_SIZE 30
struct uaedev_config_info {
TCHAR devname[MAX_DPATH];
TCHAR volname[MAX_DPATH];
TCHAR rootdir[MAX_DPATH];
bool ishdf;
bool readonly;
int bootpri;
bool autoboot;
bool donotmount;
TCHAR filesys[MAX_DPATH];
struct uaedev_config_info
{
TCHAR devname[MAX_DPATH];
TCHAR volname[MAX_DPATH];
TCHAR rootdir[MAX_DPATH];
bool ishdf;
bool readonly;
int bootpri;
bool autoboot;
bool donotmount;
TCHAR filesys[MAX_DPATH];
int cyls; // zero if detected from size
int surfaces;
int sectors;
int reserved;
int blocksize;
int configoffset;
int controller;
int surfaces;
int sectors;
int reserved;
int blocksize;
int configoffset;
int controller;
// zero if default
int pcyls, pheads, psecs;
};
struct uae_prefs {
struct strlist *all_lines;
struct uae_prefs
{
struct strlist *all_lines;
TCHAR description[256];
TCHAR info[256];
int config_version;
TCHAR description[256];
TCHAR info[256];
int config_version;
bool socket_emu;
bool start_gui;
bool start_gui;
int produce_sound;
int sound_stereo;
int sound_stereo_separation;
int sound_mixed_stereo_delay;
int sound_freq;
int sound_interpol;
int sound_filter;
int sound_filter_type;
int produce_sound;
int sound_stereo;
int sound_stereo_separation;
int sound_mixed_stereo_delay;
int sound_freq;
int sound_interpol;
int sound_filter;
int sound_filter_type;
int sound_volume_cd;
int cachesize;
int optcount[10];
int cachesize;
int optcount[10];
int gfx_framerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
struct wh gfx_size;
int gfx_resolution;
int gfx_framerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
struct wh gfx_size;
int gfx_resolution;
#ifdef RASPBERRY
int gfx_correct_aspect;
int gfx_fullscreen_ratio;
int kbd_led_num;
int kbd_led_scr;
int kbd_led_cap;
int gfx_correct_aspect;
int gfx_fullscreen_ratio;
int kbd_led_num;
int kbd_led_scr;
int kbd_led_cap;
#endif
bool immediate_blits;
bool immediate_blits;
int waiting_blits;
unsigned int chipset_mask;
bool ntscmode;
int chipset_refreshrate;
int collision_level;
int leds_on_screen;
int fast_copper;
int floppy_speed;
int floppy_write_length;
bool tod_hack;
unsigned int chipset_mask;
bool ntscmode;
int chipset_refreshrate;
int collision_level;
int leds_on_screen;
int fast_copper;
int floppy_speed;
int floppy_write_length;
bool tod_hack;
int filesys_limit;
bool cs_cd32cd;
bool cs_cd32c2p;
bool cs_cd32nvram;
TCHAR romfile[MAX_DPATH];
TCHAR romextfile[MAX_DPATH];
TCHAR romfile[MAX_DPATH];
TCHAR romextfile[MAX_DPATH];
TCHAR flashfile[MAX_DPATH];
struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
TCHAR path_floppy[256];
TCHAR path_hardfile[256];
TCHAR path_rom[256];
TCHAR path_cd[256];
TCHAR path_floppy[256];
TCHAR path_hardfile[256];
TCHAR path_rom[256];
TCHAR path_cd[256];
int m68k_speed;
int cpu_model;
int fpu_model;
bool cpu_compatible;
bool address_space_24;
int picasso96_modeflags;
int m68k_speed;
int cpu_model;
int fpu_model;
bool cpu_compatible;
bool address_space_24;
int picasso96_modeflags;
uae_u32 z3fastmem_size;
uae_u32 z3fastmem_start;
uae_u32 fastmem_size;
uae_u32 chipmem_size;
uae_u32 bogomem_size;
uae_u32 rtgmem_size;
int rtgmem_type;
uae_u32 z3fastmem_size;
uae_u32 z3fastmem_start;
uae_u32 fastmem_size;
uae_u32 chipmem_size;
uae_u32 bogomem_size;
uae_u32 rtgmem_size;
int rtgmem_type;
int mountitems;
struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE];
int mountitems;
struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE];
int nr_floppies;
struct floppyslot floppyslots[4];
int nr_floppies;
struct floppyslot floppyslots[4];
/* Target specific options */
int pandora_horizontal_offset;
int pandora_vertical_offset;
int pandora_cpu_speed;
int pandora_hide_idle_led;
/* Target specific options */
int pandora_horizontal_offset;
int pandora_vertical_offset;
int pandora_cpu_speed;
int pandora_hide_idle_led;
int pandora_tapDelay;
int pandora_customControls;
int pandora_tapDelay;
int pandora_customControls;
int key_for_menu;
int key_for_menu;
/* input */
/* input */
struct jport jports[MAX_JPORTS];
int input_selected_setting;
int input_joymouse_multiplier;
int input_joymouse_multiplier;
int input_joymouse_deadzone;
int input_joystick_deadzone;
int input_joymouse_speed;
@ -219,83 +226,95 @@ struct uae_prefs {
int input_analog_joystick_offset;
int input_autofire_linecnt;
int input_mouse_speed;
int input_tablet;
int input_tablet;
int input_keyboard_type;
struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
};
/* Contains the filename of .uaerc */
extern void cfgfile_write (struct zfile *, const TCHAR *option, const TCHAR *format,...);
extern void cfgfile_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...);
extern void cfgfile_target_write (struct zfile *, const TCHAR *option, const TCHAR *format,...);
extern void cfgfile_target_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...);
extern void cfgfile_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_target_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_target_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
extern void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_dwrite_bool (struct zfile *f,const TCHAR *option, bool b);
extern void cfgfile_target_write_bool (struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_target_dwrite_bool (struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
extern void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
const TCHAR *devname, const TCHAR *volname, 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 struct uaedev_config_info *add_filesys_config(struct uae_prefs *p,
int index,
const TCHAR *devname,
const TCHAR *volname,
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 discard_prefs (struct uae_prefs *, int);
extern int bip_a500 (struct uae_prefs *p, int rom);
extern int bip_a500plus (struct uae_prefs *p, int rom);
extern int bip_a1200 (struct uae_prefs *p, int rom);
extern int bip_a2000 (struct uae_prefs *p, int rom);
extern int bip_a4000 (struct uae_prefs *p, int rom);
extern int bip_cd32 (struct uae_prefs *p, int rom);
extern void default_prefs(struct uae_prefs *, int);
extern void discard_prefs(struct uae_prefs *, int);
extern int bip_a500(struct uae_prefs *p, int rom);
extern int bip_a500plus(struct uae_prefs *p, int rom);
extern int bip_a1200(struct uae_prefs *p, int rom);
extern int bip_a2000(struct uae_prefs *p, int rom);
extern int bip_a4000(struct uae_prefs *p, int rom);
extern int bip_cd32(struct uae_prefs *p, int rom);
int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR *);
int parse_cmdline_option(struct uae_prefs *, TCHAR, const TCHAR *);
extern int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
extern int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
extern int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
extern int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
extern int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
extern int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
extern int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
extern TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern TCHAR *target_expand_environment (const TCHAR *path);
extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value);
extern void target_save_options (struct zfile*, struct uae_prefs *);
extern void target_default_options (struct uae_prefs *, int type);
extern void target_fixup_options (struct uae_prefs *);
extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
extern TCHAR *target_expand_environment(const TCHAR *path);
extern int target_parse_option(struct uae_prefs *, const TCHAR *option, const TCHAR *value);
extern void target_save_options(struct zfile*, struct uae_prefs *);
extern void target_default_options(struct uae_prefs *, int type);
extern void target_fixup_options(struct uae_prefs *);
extern int target_cfgfile_load(struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
extern void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type);
extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int);
extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int);
extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description);
extern uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
extern void cfgfile_addcfgparam (TCHAR *);
extern int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
extern int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int);
extern void cfgfile_parse_line(struct uae_prefs *p, TCHAR *, int);
extern int cfgfile_parse_option(struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
extern int cfgfile_get_description(const TCHAR *filename, TCHAR *description);
extern uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify(uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
extern uae_u32 cfgfile_modify(uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
extern void cfgfile_addcfgparam(TCHAR *);
extern int cfgfile_configuration_change(int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs);
extern void fixup_cpu (struct uae_prefs *prefs);
extern void fixup_prefs_dimensions(struct uae_prefs *prefs);
extern void fixup_prefs(struct uae_prefs *prefs);
extern void fixup_cpu(struct uae_prefs *prefs);
extern void check_prefs_changed_custom (void);
extern void check_prefs_changed_cpu (void);
extern void check_prefs_changed_audio (void);
extern void check_prefs_changed_cd (void);
extern int check_prefs_changed_gfx (void);
extern void check_prefs_changed_custom(void);
extern void check_prefs_changed_cpu(void);
extern void check_prefs_changed_audio(void);
extern void check_prefs_changed_cd(void);
extern int check_prefs_changed_gfx(void);
extern struct uae_prefs currprefs, changed_prefs;
extern int machdep_init (void);
extern void machdep_free (void);
extern int machdep_init(void);
extern void machdep_free(void);

View file

@ -112,8 +112,8 @@ using namespace std;
#define S_ISDIR(val) (S_IFDIR & val)
struct utimbuf
{
time_t actime;
time_t modtime;
time_t actime;
time_t modtime;
};
#endif
@ -141,8 +141,8 @@ struct utimbuf
#define utime(file,time) 0
struct utimbuf
{
time_t actime;
time_t modtime;
time_t actime;
time_t modtime;
};
#endif
@ -171,7 +171,10 @@ typedef unsigned char uae_u8;
typedef signed char uae_s8;
typedef char uae_char;
typedef struct { uae_u8 RGB[3]; } RGB;
typedef struct
{
uae_u8 RGB[3];
} RGB;
#if SIZEOF_SHORT == 2
typedef unsigned short uae_u16;
@ -218,20 +221,20 @@ typedef uae_u32 uaecptr;
#ifdef HAVE_STRDUP
#define my_strdup strdup
#else
extern TCHAR *my_strdup (const TCHAR*s);
extern TCHAR *my_strdup(const TCHAR*s);
#endif
extern TCHAR *my_strdup_ansi (const char*);
extern TCHAR *au (const char*);
extern char *ua (const TCHAR*);
extern TCHAR *au_fs (const char*);
extern char *ua_fs (const TCHAR*, int);
extern char *ua_copy (char *dst, int maxlen, const TCHAR *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 TCHAR *au_fs_copy (TCHAR *dst, int maxlen, const char *src);
extern char *uutf8 (const TCHAR *s);
extern TCHAR *utf8u (const char *s);
extern TCHAR *my_strdup_ansi(const char*);
extern TCHAR *au(const char*);
extern char *ua(const TCHAR*);
extern TCHAR *au_fs(const char*);
extern char *ua_fs(const TCHAR*, int);
extern char *ua_copy(char *dst, int maxlen, const TCHAR *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 TCHAR *au_fs_copy(TCHAR *dst, int maxlen, const char *src);
extern char *uutf8(const TCHAR *s);
extern TCHAR *utf8u(const char *s);
/* 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. */
@ -292,63 +295,63 @@ extern TCHAR *utf8u (const char *s);
#ifdef DONT_HAVE_POSIX
#define access posixemu_access
extern int posixemu_access (const TCHAR *, int);
extern int posixemu_access(const TCHAR *, int);
#define open posixemu_open
extern int posixemu_open (const TCHAR *, int, int);
extern int posixemu_open(const TCHAR *, int, int);
#define close posixemu_close
extern void posixemu_close (int);
extern void posixemu_close(int);
#define read posixemu_read
extern int posixemu_read (int, TCHAR *, int);
extern int posixemu_read(int, TCHAR *, int);
#define write posixemu_write
extern int posixemu_write (int, const TCHAR *, int);
extern int posixemu_write(int, const TCHAR *, int);
#undef lseek
#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))
extern int posixemu_stat (const TCHAR *, STAT *);
extern int posixemu_stat(const TCHAR *, STAT *);
#define mkdir posixemu_mkdir
extern int mkdir (const TCHAR *, int);
extern int mkdir(const TCHAR *, int);
#define rmdir posixemu_rmdir
extern int posixemu_rmdir (const TCHAR *);
extern int posixemu_rmdir(const TCHAR *);
#define unlink posixemu_unlink
extern int posixemu_unlink (const TCHAR *);
extern int posixemu_unlink(const TCHAR *);
#define truncate posixemu_truncate
extern int posixemu_truncate (const TCHAR *, long int);
extern int posixemu_truncate(const TCHAR *, long int);
#define rename posixemu_rename
extern int posixemu_rename (const TCHAR *, const TCHAR *);
extern int posixemu_rename(const TCHAR *, const TCHAR *);
#define chmod posixemu_chmod
extern int posixemu_chmod (const TCHAR *, int);
extern int posixemu_chmod(const TCHAR *, int);
#define tmpnam posixemu_tmpnam
extern void posixemu_tmpnam (TCHAR *);
extern void posixemu_tmpnam(TCHAR *);
#define utime posixemu_utime
extern int posixemu_utime (const TCHAR *, struct utimbuf *);
extern int posixemu_utime(const TCHAR *, struct utimbuf *);
#define opendir posixemu_opendir
extern DIR * posixemu_opendir (const TCHAR *);
extern DIR * posixemu_opendir(const TCHAR *);
#define readdir posixemu_readdir
extern struct dirent* readdir (DIR *);
extern struct dirent* readdir(DIR *);
#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
* is that you probably don't have POSIX errnos if you don't have the above
* functions. */
extern long dos_errno (void);
extern long dos_errno(void);
#endif
#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)
extern int stdioemu_fseek (FILE *, int, int);
extern int stdioemu_fseek(FILE *, int, int);
#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)
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)
extern int stdioemu_ftell (FILE *);
extern int stdioemu_ftell(FILE *);
#define ftell(a) stdioemu_ftell(a)
extern int stdioemu_fclose (FILE *);
extern int stdioemu_fclose(FILE *);
#define fclose(a) stdioemu_fclose(a)
#endif
@ -356,9 +359,9 @@ extern int stdioemu_fclose (FILE *);
#ifdef DONT_HAVE_MALLOC
#define malloc(a) mallocemu_malloc(a)
extern void *mallocemu_malloc (int size);
extern void *mallocemu_malloc(int size);
#define free(a) mallocemu_free(a)
extern void mallocemu_free (void *ptr);
extern void mallocemu_free(void *ptr);
#endif
@ -378,11 +381,11 @@ extern void mallocemu_free (void *ptr);
#define write_log(FORMATO, RESTO...)
#define write_log_standard(FORMATO, RESTO...)
#else
extern void write_log (const TCHAR *format,...);
extern void write_log(const TCHAR *format, ...);
extern FILE *debugfile;
#endif
extern void console_out (const TCHAR *, ...);
extern void gui_message (const TCHAR *,...);
extern void console_out(const TCHAR *, ...);
extern void gui_message(const TCHAR *, ...);
#ifndef O_BINARY
#define O_BINARY 0
@ -438,14 +441,22 @@ extern void gui_message (const TCHAR *,...);
#ifdef ARMV6_ASSEMBLY
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {__asm__ (
"rev %0, %0"
: "=r" (v) : "0" (v) ); return v;}
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v)
{
__asm__(
"rev %0, %0"
: "=r" (v) : "0" (v));
return v;
}
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ (
"revsh %0, %0\n\t"
"uxth %0, %0"
: "=r" (v) : "0" (v) ); return v;}
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v)
{
__asm__(
"revsh %0, %0\n\t"
"uxth %0, %0"
: "=r" (v) : "0" (v));
return v;
}
#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))
#if 0
extern void *xmalloc (size_t);
extern void *xcalloc (size_t, size_t);
extern void xfree (const void*);
extern void *xmalloc(size_t);
extern void *xcalloc(size_t, size_t);
extern void xfree(const void*);
#endif
#else

View file

@ -23,20 +23,20 @@
* along with ARAnyM; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation
*
* (c) 1995 Bernd Schmidt
*/
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation
*
* (c) 1995 Bernd Schmidt
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "uae.h"
#include "memory.h"
#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "cpu_prefetch.h"
@ -56,7 +56,10 @@
#else
/* Need to have these somewhere */
static void build_comp(void) {}
bool check_prefs_changed_comp (void) { return false; }
bool check_prefs_changed_comp(void)
{
return false;
}
#endif
/* Opcode of faulting instruction */
@ -71,8 +74,8 @@ static int last_writeaccess_for_exception_3;
static int last_instructionaccess_for_exception_3;
int cpu_cycles;
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 areg_byteinc[] = { 1, 1, 1, 1, 1, 1, 1, 2 };
const int imm8_table[] = { 8, 1, 2, 3, 4, 5, 6, 7 };
int movem_index1[256];
int movem_index2[256];
@ -94,14 +97,14 @@ static uae_u16 mmusr_030;
static unsigned long int instrcount[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];
}
static TCHAR *icountfilename (void)
static TCHAR *icountfilename(void)
{
TCHAR *name = getenv ("INSNCOUNT");
TCHAR *name = getenv("INSNCOUNT");
if (name)
return name;
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 "config.h"
#include "options.h"
#include "memory.h"
#include "include/memory.h"
#include "uae.h"
#include "autoconf.h"
#include "filesys.h"
@ -22,6 +22,8 @@
#define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 202
extern std::string volName;
static bool dialogResult = false;
static bool dialogFinished = false;
@ -43,38 +45,41 @@ static gcn::TextField *txtBootPri;
class FilesysVirtualActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
if(actionEvent.getSource() == cmdPath)
{
char tmp[MAX_PATH];
strncpy(tmp, txtPath->getText().c_str(), MAX_PATH);
wndEditFilesysVirtual->releaseModalFocus();
if(SelectFolder("Select folder", tmp))
txtPath->setText(tmp);
wndEditFilesysVirtual->requestModalFocus();
cmdPath->requestFocus();
}
else
{
if (actionEvent.getSource() == cmdOK)
{
if(txtDevice->getText().length() <= 0)
{
wndEditFilesysVirtual->setCaption("Please enter a device name.");
return;
}
if(txtVolume->getText().length() <= 0)
{
wndEditFilesysVirtual->setCaption("Please enter a volume name.");
return;
}
dialogResult = true;
}
dialogFinished = true;
}
}
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == cmdPath)
{
char tmp[MAX_PATH];
strncpy(tmp, txtPath->getText().c_str(), MAX_PATH);
wndEditFilesysVirtual->releaseModalFocus();
if (SelectFolder("Select folder", tmp))
{
txtPath->setText(tmp);
txtVolume->setText(volName);
}
wndEditFilesysVirtual->requestModalFocus();
cmdPath->requestFocus();
}
else
{
if (actionEvent.getSource() == cmdOK)
{
if (txtDevice->getText().length() <= 0)
{
wndEditFilesysVirtual->setCaption("Please enter a device name.");
return;
}
if (txtVolume->getText().length() <= 0)
{
wndEditFilesysVirtual->setCaption("Please enter a volume name.");
return;
}
dialogResult = true;
}
dialogFinished = true;
}
}
};
static FilesysVirtualActionListener* filesysVirtualActionListener;
@ -83,232 +88,247 @@ static void InitEditFilesysVirtual(void)
{
wndEditFilesysVirtual = new gcn::Window("Edit");
wndEditFilesysVirtual->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndEditFilesysVirtual->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndEditFilesysVirtual->setBaseColor(gui_baseCol + 0x202020);
wndEditFilesysVirtual->setCaption("Volume settings");
wndEditFilesysVirtual->setTitleBarHeight(TITLEBAR_HEIGHT);
wndEditFilesysVirtual->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndEditFilesysVirtual->setBaseColor(gui_baseCol + 0x202020);
wndEditFilesysVirtual->setCaption("Volume settings");
wndEditFilesysVirtual->setTitleBarHeight(TITLEBAR_HEIGHT);
filesysVirtualActionListener = new FilesysVirtualActionListener();
filesysVirtualActionListener = new FilesysVirtualActionListener();
cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->setId("virtOK");
cmdOK->addActionListener(filesysVirtualActionListener);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->setId("virtOK");
cmdOK->addActionListener(filesysVirtualActionListener);
cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->setId("virtCancel");
cmdCancel->addActionListener(filesysVirtualActionListener);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->setId("virtCancel");
cmdCancel->addActionListener(filesysVirtualActionListener);
lblDevice = new gcn::Label("Device Name:");
lblDevice->setSize(100, LABEL_HEIGHT);
lblDevice->setAlignment(gcn::Graphics::RIGHT);
txtDevice = new gcn::TextField();
txtDevice->setSize(80, TEXTFIELD_HEIGHT);
txtDevice->setId("virtDev");
lblDevice = new gcn::Label("Device Name:");
lblDevice->setSize(100, LABEL_HEIGHT);
lblDevice->setAlignment(gcn::Graphics::RIGHT);
txtDevice = new gcn::TextField();
txtDevice->setSize(80, TEXTFIELD_HEIGHT);
txtDevice->setId("virtDev");
lblVolume = new gcn::Label("Volume Label:");
lblVolume->setSize(100, LABEL_HEIGHT);
lblVolume->setAlignment(gcn::Graphics::RIGHT);
txtVolume = new gcn::TextField();
txtVolume->setSize(80, TEXTFIELD_HEIGHT);
txtVolume->setId("virtVol");
lblVolume = new gcn::Label("Volume Label:");
lblVolume->setSize(100, LABEL_HEIGHT);
lblVolume->setAlignment(gcn::Graphics::RIGHT);
txtVolume = new gcn::TextField();
txtVolume->setSize(80, TEXTFIELD_HEIGHT);
txtVolume->setId("virtVol");
lblPath = new gcn::Label("Path:");
lblPath->setSize(100, LABEL_HEIGHT);
lblPath->setAlignment(gcn::Graphics::RIGHT);
txtPath = new gcn::TextField();
txtPath->setSize(338, TEXTFIELD_HEIGHT);
txtPath->setEnabled(false);
cmdPath = new gcn::Button("...");
cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
cmdPath->setBaseColor(gui_baseCol + 0x202020);
cmdPath->setId("virtPath");
cmdPath->addActionListener(filesysVirtualActionListener);
lblPath = new gcn::Label("Path:");
lblPath->setSize(100, LABEL_HEIGHT);
lblPath->setAlignment(gcn::Graphics::RIGHT);
txtPath = new gcn::TextField();
txtPath->setSize(338, TEXTFIELD_HEIGHT);
txtPath->setEnabled(false);
cmdPath = new gcn::Button("...");
cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
cmdPath->setBaseColor(gui_baseCol + 0x202020);
cmdPath->setId("virtPath");
cmdPath->addActionListener(filesysVirtualActionListener);
chkReadWrite = new gcn::UaeCheckBox("Read/Write", true);
chkReadWrite->setId("virtRW");
chkReadWrite->setId("virtRW");
chkAutoboot = new gcn::UaeCheckBox("Bootable", true);
chkAutoboot->setId("virtAutoboot");
chkAutoboot->setId("virtAutoboot");
lblBootPri = new gcn::Label("Boot priority:");
lblBootPri->setSize(84, LABEL_HEIGHT);
lblBootPri->setAlignment(gcn::Graphics::RIGHT);
txtBootPri = new gcn::TextField();
txtBootPri->setSize(40, TEXTFIELD_HEIGHT);
txtBootPri->setId("virtBootpri");
lblBootPri = new gcn::Label("Boot priority:");
lblBootPri->setSize(84, LABEL_HEIGHT);
lblBootPri->setAlignment(gcn::Graphics::RIGHT);
txtBootPri = new gcn::TextField();
txtBootPri->setSize(40, TEXTFIELD_HEIGHT);
txtBootPri->setId("virtBootpri");
int posY = DISTANCE_BORDER;
wndEditFilesysVirtual->add(lblDevice, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtDevice, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(chkReadWrite, 250, posY + 1);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
wndEditFilesysVirtual->add(lblVolume, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtVolume, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(chkAutoboot, 250, posY + 1);
wndEditFilesysVirtual->add(lblBootPri, 374, posY);
wndEditFilesysVirtual->add(txtBootPri, 374 + lblBootPri->getWidth() + 8, posY);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
wndEditFilesysVirtual->add(lblPath, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtPath, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(cmdPath, wndEditFilesysVirtual->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH, posY);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
int posY = DISTANCE_BORDER;
wndEditFilesysVirtual->add(lblDevice, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtDevice, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(chkReadWrite, 250, posY + 1);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
wndEditFilesysVirtual->add(lblVolume, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtVolume, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(chkAutoboot, 250, posY + 1);
wndEditFilesysVirtual->add(lblBootPri, 374, posY);
wndEditFilesysVirtual->add(txtBootPri, 374 + lblBootPri->getWidth() + 8, posY);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
wndEditFilesysVirtual->add(lblPath, DISTANCE_BORDER, posY);
wndEditFilesysVirtual->add(txtPath, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY);
wndEditFilesysVirtual->add(cmdPath, wndEditFilesysVirtual->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH, posY);
posY += txtDevice->getHeight() + DISTANCE_NEXT_Y;
wndEditFilesysVirtual->add(cmdOK);
wndEditFilesysVirtual->add(cmdCancel);
wndEditFilesysVirtual->add(cmdOK);
wndEditFilesysVirtual->add(cmdCancel);
gui_top->add(wndEditFilesysVirtual);
gui_top->add(wndEditFilesysVirtual);
txtDevice->requestFocus();
wndEditFilesysVirtual->requestModalFocus();
txtDevice->requestFocus();
wndEditFilesysVirtual->requestModalFocus();
}
static void ExitEditFilesysVirtual(void)
{
wndEditFilesysVirtual->releaseModalFocus();
gui_top->remove(wndEditFilesysVirtual);
wndEditFilesysVirtual->releaseModalFocus();
gui_top->remove(wndEditFilesysVirtual);
delete lblDevice;
delete txtDevice;
delete lblVolume;
delete txtVolume;
delete lblPath;
delete txtPath;
delete cmdPath;
delete chkReadWrite;
delete chkAutoboot;
delete lblBootPri;
delete txtBootPri;
delete lblDevice;
delete txtDevice;
delete lblVolume;
delete txtVolume;
delete lblPath;
delete txtPath;
delete cmdPath;
delete chkReadWrite;
delete chkAutoboot;
delete lblBootPri;
delete txtBootPri;
delete cmdOK;
delete cmdCancel;
delete filesysVirtualActionListener;
delete cmdOK;
delete cmdCancel;
delete filesysVirtualActionListener;
delete wndEditFilesysVirtual;
delete wndEditFilesysVirtual;
}
static void EditFilesysVirtualLoop(void)
{
while(!dialogFinished)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
while (!dialogFinished)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
case SDLK_UP:
if(HandleNavigation(DIRECTION_UP))
continue; // Don't change value when enter ComboBox -> don't send event to control
break;
case SDLK_UP:
if (HandleNavigation(DIRECTION_UP))
continue; // Don't change value when enter ComboBox -> don't send event to control
break;
case SDLK_DOWN:
if(HandleNavigation(DIRECTION_DOWN))
continue; // Don't change value when enter ComboBox -> don't send event to control
break;
case SDLK_DOWN:
if (HandleNavigation(DIRECTION_DOWN))
continue; // Don't change value when enter ComboBox -> don't send event to control
break;
case SDLK_LEFT:
if(HandleNavigation(DIRECTION_LEFT))
continue; // Don't change value when enter Slider -> don't send event to control
break;
case SDLK_LEFT:
if (HandleNavigation(DIRECTION_LEFT))
continue; // Don't change value when enter Slider -> don't send event to control
break;
case SDLK_RIGHT:
if(HandleNavigation(DIRECTION_RIGHT))
continue; // Don't change value when enter Slider -> don't send event to control
break;
case SDLK_RIGHT:
if (HandleNavigation(DIRECTION_RIGHT))
continue; // Don't change value when enter Slider -> don't send event to control
break;
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
}
}
bool EditFilesysVirtual(int unit_no)
{
struct mountedinfo mi;
struct uaedev_config_info *uci;
std::string strdevname, strvolname, strroot;
char tmp[32];
struct mountedinfo mi;
struct uaedev_config_info *uci;
std::string strdevname, strvolname, strroot;
char tmp[32];
dialogResult = false;
dialogFinished = false;
dialogResult = false;
dialogFinished = false;
InitEditFilesysVirtual();
InitEditFilesysVirtual();
if(unit_no >= 0)
{
uci = &changed_prefs.mountconfig[unit_no];
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
if (unit_no >= 0)
{
uci = &changed_prefs.mountconfig[unit_no];
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
strdevname.assign(uci->devname);
txtDevice->setText(strdevname);
strvolname.assign(uci->volname);
txtVolume->setText(strvolname);
strroot.assign(uci->rootdir);
txtPath->setText(strroot);
chkReadWrite->setSelected(!uci->readonly);
chkAutoboot->setSelected(uci->bootpri != -128);
snprintf(tmp, 32, "%d", uci->bootpri >= -127 ? uci->bootpri : -127);
txtBootPri->setText(tmp);
}
else
{
CreateDefaultDevicename(tmp);
txtDevice->setText(tmp);
txtVolume->setText(tmp);
strroot.assign(currentDir);
txtPath->setText(strroot);
chkReadWrite->setSelected(true);
txtBootPri->setText("0");
}
strdevname.assign(uci->devname);
txtDevice->setText(strdevname);
strvolname.assign(uci->volname);
txtVolume->setText(strvolname);
strroot.assign(uci->rootdir);
txtPath->setText(strroot);
chkReadWrite->setSelected(!uci->readonly);
chkAutoboot->setSelected(uci->bootpri != -128);
snprintf(tmp, 32, "%d", uci->bootpri >= -127 ? uci->bootpri : -127);
txtBootPri->setText(tmp);
}
else
{
CreateDefaultDevicename(tmp);
txtDevice->setText(tmp);
txtVolume->setText(tmp);
strroot.assign(currentDir);
txtPath->setText(strroot);
chkReadWrite->setSelected(true);
txtBootPri->setText("0");
}
EditFilesysVirtualLoop();
EditFilesysVirtualLoop();
if(dialogResult)
{
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath((char *) txtPath->getText().c_str(), currentDir);
if (dialogResult)
{
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath((char *) txtPath->getText().c_str(), currentDir);
uci = add_filesys_config(&changed_prefs, unit_no, (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)
filesys_media_change (uci->rootdir, 1, uci);
}
uci = add_filesys_config(&changed_prefs,
unit_no,
(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)
filesys_media_change(uci->rootdir, 1, uci);
}
ExitEditFilesysVirtual();
ExitEditFilesysVirtual();
return dialogResult;
return dialogResult;
}

View file

@ -14,130 +14,131 @@
extern SDL_Surface *prSDLScreen;
extern void flush_screen ();
extern void flush_screen();
static int msg_done = 0;
class DoneActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
msg_done = 1;
}
public:
void action(const gcn::ActionEvent& actionEvent)
{
msg_done = 1;
}
};
static DoneActionListener* doneActionListener;
void InGameMessage(const char *msg)
{
gcn::Gui* msg_gui;
gcn::SDLGraphics* msg_graphics;
gcn::SDLInput* msg_input;
gcn::contrib::SDLTrueTypeFont* msg_font;
gcn::Color msg_baseCol;
gcn::Gui* msg_gui;
gcn::SDLGraphics* msg_graphics;
gcn::SDLInput* msg_input;
gcn::contrib::SDLTrueTypeFont* msg_font;
gcn::Color msg_baseCol;
gcn::Container* msg_top;
gcn::Window *wndMsg;
gcn::Button* cmdDone;
gcn::TextBox* txtMsg;
gcn::Container* msg_top;
gcn::Window *wndMsg;
gcn::Button* cmdDone;
gcn::TextBox* txtMsg;
int msgWidth = 260;
int msgHeight = 100;
int msgWidth = 260;
int msgHeight = 100;
msg_graphics = new gcn::SDLGraphics();
msg_graphics->setTarget(prSDLScreen);
msg_input = new gcn::SDLInput();
msg_gui = new gcn::Gui();
msg_gui->setGraphics(msg_graphics);
msg_gui->setInput(msg_input);
msg_graphics = new gcn::SDLGraphics();
msg_graphics->setTarget(prSDLScreen);
msg_input = new gcn::SDLInput();
msg_gui = new gcn::Gui();
msg_gui->setGraphics(msg_graphics);
msg_gui->setInput(msg_input);
msg_baseCol.r = 192;
msg_baseCol.g = 192;
msg_baseCol.b = 208;
msg_baseCol.r = 192;
msg_baseCol.g = 192;
msg_baseCol.b = 208;
msg_top = new gcn::Container();
msg_top->setDimension(gcn::Rectangle((prSDLScreen->w - msgWidth) / 2, (prSDLScreen->h - msgHeight) / 2, msgWidth, msgHeight));
msg_top->setBaseColor(msg_baseCol);
msg_gui->setTop(msg_top);
msg_top = new gcn::Container();
msg_top->setDimension(gcn::Rectangle((prSDLScreen->w - msgWidth) / 2, (prSDLScreen->h - msgHeight) / 2, msgWidth, msgHeight));
msg_top->setBaseColor(msg_baseCol);
msg_gui->setTop(msg_top);
TTF_Init();
msg_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 10);
gcn::Widget::setGlobalFont(msg_font);
TTF_Init();
msg_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 10);
gcn::Widget::setGlobalFont(msg_font);
doneActionListener = new DoneActionListener();
doneActionListener = new DoneActionListener();
wndMsg = new gcn::Window("Load");
wndMsg->setSize(msgWidth, msgHeight);
wndMsg->setPosition(0, 0);
wndMsg->setBaseColor(msg_baseCol + 0x202020);
wndMsg->setCaption("Information");
wndMsg->setTitleBarHeight(12);
wndMsg->setPosition(0, 0);
wndMsg->setBaseColor(msg_baseCol + 0x202020);
wndMsg->setCaption("Information");
wndMsg->setTitleBarHeight(12);
cmdDone = new gcn::Button("Ok");
cmdDone->setSize(40, 20);
cmdDone->setBaseColor(msg_baseCol + 0x202020);
cmdDone->addActionListener(doneActionListener);
cmdDone->setBaseColor(msg_baseCol + 0x202020);
cmdDone->addActionListener(doneActionListener);
txtMsg = new gcn::TextBox(msg);
txtMsg->setEnabled(false);
txtMsg->setPosition(6, 6);
txtMsg->setSize(wndMsg->getWidth() - 16, 46);
txtMsg->setOpaque(false);
txtMsg = new gcn::TextBox(msg);
txtMsg->setEnabled(false);
txtMsg->setPosition(6, 6);
txtMsg->setSize(wndMsg->getWidth() - 16, 46);
txtMsg->setOpaque(false);
wndMsg->add(txtMsg, 6, 6);
wndMsg->add(cmdDone, (wndMsg->getWidth() - cmdDone->getWidth()) / 2, wndMsg->getHeight() - 38);
wndMsg->add(txtMsg, 6, 6);
wndMsg->add(cmdDone, (wndMsg->getWidth() - cmdDone->getWidth()) / 2, wndMsg->getHeight() - 38);
msg_top->add(wndMsg);
cmdDone->requestFocus();
msg_top->add(wndMsg);
cmdDone->requestFocus();
msg_done = 0;
bool drawn = false;
while(!msg_done)
{
//-------------------------------------------------
// Check user input
//-------------------------------------------------
SDL_Event event;
while(SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_PAGEDOWN:
case SDLK_HOME:
case SDLK_RETURN:
msg_done = 1;
break;
}
}
msg_done = 0;
bool drawn = false;
while (!msg_done)
{
//-------------------------------------------------
// Check user input
//-------------------------------------------------
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_PAGEDOWN:
case SDLK_HOME:
case SDLK_RETURN:
msg_done = 1;
break;
}
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
msg_input->pushInput(event);
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
msg_input->pushInput(event);
}
// Now we let the Gui object perform its logic.
msg_gui->logic();
// Now we let the Gui object draw itself.
msg_gui->draw();
// Finally we update the screen.
//SDL_Flip(prSDLScreen);
flush_screen ();
}
// Now we let the Gui object perform its logic.
msg_gui->logic();
// Now we let the Gui object draw itself.
msg_gui->draw();
// Finally we update the screen.
if (!drawn)
SDL_Flip(prSDLScreen);
drawn = true;
}
msg_top->remove(wndMsg);
msg_top->remove(wndMsg);
delete txtMsg;
delete cmdDone;
delete doneActionListener;
delete wndMsg;
delete txtMsg;
delete cmdDone;
delete doneActionListener;
delete wndMsg;
delete msg_font;
delete msg_top;
delete msg_font;
delete msg_top;
delete msg_gui;
delete msg_input;
delete msg_graphics;
delete msg_gui;
delete msg_input;
delete msg_graphics;
}

View file

@ -11,7 +11,7 @@
#include "sysdeps.h"
#include "config.h"
#include "options.h"
#include "memory.h"
#include "include/memory.h"
#include "uae.h"
#include "gui.h"
#include "gui_handling.h"
@ -44,38 +44,43 @@ static gcn::Slider* sldGfxmem;
class MemorySliderActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == sldChipmem) {
changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0))
changed_prefs.fastmem_size = 0;
}
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == sldChipmem)
{
changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0))
changed_prefs.fastmem_size = 0;
}
if (actionEvent.getSource() == sldSlowmem) {
changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
}
if (actionEvent.getSource() == sldSlowmem)
{
changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
}
if (actionEvent.getSource() == sldFastmem) {
changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())];
if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000)
changed_prefs.chipmem_size = 0x200000;
}
if (actionEvent.getSource() == sldFastmem)
{
changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())];
if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000)
changed_prefs.chipmem_size = 0x200000;
}
if (actionEvent.getSource() == sldZ3mem) {
changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())];
if (changed_prefs.z3fastmem_size > max_z3fastmem)
changed_prefs.z3fastmem_size = max_z3fastmem;
}
if (actionEvent.getSource() == sldZ3mem)
{
changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())];
if (changed_prefs.z3fastmem_size > max_z3fastmem)
changed_prefs.z3fastmem_size = max_z3fastmem;
}
if (actionEvent.getSource() == sldGfxmem) {
changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())];
changed_prefs.rtgmem_type = 1;
}
if (actionEvent.getSource() == sldGfxmem)
{
changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())];
changed_prefs.rtgmem_type = 1;
}
RefreshPanelRAM();
}
RefreshPanelRAM();
}
};
static MemorySliderActionListener* memorySliderActionListener;
@ -175,79 +180,79 @@ void InitPanelRAM(const struct _ConfigCategory& category)
void ExitPanelRAM(void)
{
delete lblChipmem;
delete sldChipmem;
delete lblChipsize;
delete lblSlowmem;
delete sldSlowmem;
delete lblSlowsize;
delete lblFastmem;
delete sldFastmem;
delete lblFastsize;
delete lblZ3mem;
delete sldZ3mem;
delete lblZ3size;
delete lblGfxmem;
delete sldGfxmem;
delete lblGfxsize;
delete grpRAM;
delete memorySliderActionListener;
delete lblChipmem;
delete sldChipmem;
delete lblChipsize;
delete lblSlowmem;
delete sldSlowmem;
delete lblSlowsize;
delete lblFastmem;
delete sldFastmem;
delete lblFastsize;
delete lblZ3mem;
delete sldZ3mem;
delete lblZ3size;
delete lblGfxmem;
delete sldGfxmem;
delete lblGfxsize;
delete grpRAM;
delete memorySliderActionListener;
}
void RefreshPanelRAM(void)
{
int i;
int i;
for(i=0; i<5; ++i)
{
if(changed_prefs.chipmem_size == ChipMem_values[i])
{
sldChipmem->setValue(i);
lblChipsize->setCaption(ChipMem_list[i]);
break;
}
}
for (i = 0; i < 5; ++i)
{
if (changed_prefs.chipmem_size == ChipMem_values[i])
{
sldChipmem->setValue(i);
lblChipsize->setCaption(ChipMem_list[i]);
break;
}
}
for(i=0; i<5; ++i)
{
if(changed_prefs.bogomem_size == SlowMem_values[i])
{
sldSlowmem->setValue(i);
lblSlowsize->setCaption(SlowMem_list[i]);
break;
}
}
for (i = 0; i < 5; ++i)
{
if (changed_prefs.bogomem_size == SlowMem_values[i])
{
sldSlowmem->setValue(i);
lblSlowsize->setCaption(SlowMem_list[i]);
break;
}
}
for(i=0; i<5; ++i)
{
if(changed_prefs.fastmem_size == FastMem_values[i])
{
sldFastmem->setValue(i);
lblFastsize->setCaption(FastMem_list[i]);
break;
}
}
for (i = 0; i < 5; ++i)
{
if (changed_prefs.fastmem_size == FastMem_values[i])
{
sldFastmem->setValue(i);
lblFastsize->setCaption(FastMem_list[i]);
break;
}
}
for(i=0; i<9; ++i)
{
if(changed_prefs.z3fastmem_size == FastMem_values[i])
{
sldZ3mem->setValue(i);
lblZ3size->setCaption(FastMem_list[i]);
break;
}
}
sldZ3mem->setEnabled(!changed_prefs.address_space_24);
for (i = 0; i < 9; ++i)
{
if (changed_prefs.z3fastmem_size == FastMem_values[i])
{
sldZ3mem->setValue(i);
lblZ3size->setCaption(FastMem_list[i]);
break;
}
}
sldZ3mem->setEnabled(!changed_prefs.address_space_24);
for(i=0; i<6; ++i)
{
if(changed_prefs.rtgmem_size == FastMem_values[i])
{
sldGfxmem->setValue(i);
lblGfxsize->setCaption(FastMem_list[i]);
break;
}
}
sldGfxmem->setEnabled(!changed_prefs.address_space_24);
for (i = 0; i < 6; ++i)
{
if (changed_prefs.rtgmem_size == FastMem_values[i])
{
sldGfxmem->setValue(i);
lblGfxsize->setCaption(FastMem_list[i]);
break;
}
}
sldGfxmem->setEnabled(!changed_prefs.address_space_24);
}

View file

@ -19,7 +19,7 @@
#define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400
#ifdef RASPBERRY
#if defined(RASPBERRY) || defined(ANDROID)
#define FILE_SELECT_KEEP_POSITION
#endif
@ -43,323 +43,323 @@ static gcn::TextField *txtFilename;
class SelectFileListModel : public gcn::ListModel
{
std::vector<std::string> dirs;
std::vector<std::string> files;
std::vector<std::string> dirs;
std::vector<std::string> files;
public:
SelectFileListModel(const char * path)
{
changeDir(path);
}
public:
SelectFileListModel(const char * path)
{
changeDir(path);
}
int getNumberOfElements()
{
return dirs.size() + files.size();
}
int getNumberOfElements()
{
return dirs.size() + files.size();
}
std::string getElementAt(int i)
{
if(i >= dirs.size() + files.size() || i < 0)
return "---";
if(i < dirs.size())
return dirs[i];
return files[i - dirs.size()];
}
std::string getElementAt(int i)
{
if (i >= dirs.size() + files.size() || i < 0)
return "---";
if (i < dirs.size())
return dirs[i];
return files[i - dirs.size()];
}
void changeDir(const char *path)
{
ReadDirectory(path, &dirs, &files);
if(dirs.size() == 0)
dirs.push_back("..");
FilterFiles(&files, filefilter);
}
void changeDir(const char *path)
{
ReadDirectory(path, &dirs, &files);
if (dirs.size() == 0)
dirs.push_back("..");
FilterFiles(&files, filefilter);
}
bool isDir(int i)
{
return (i < dirs.size());
}
bool isDir(int i)
{
return (i < dirs.size());
}
};
static SelectFileListModel *fileList;
class FileButtonActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == cmdOK)
{
int selected_item;
selected_item = lstFiles->getSelected();
if(createNew)
{
char tmp[MAX_PATH];
if(txtFilename->getText().length() <= 0)
return;
strcpy(tmp, workingDir);
strcat(tmp, "/");
strcat(tmp, txtFilename->getText().c_str());
if(strstr(tmp, filefilter[0]) == NULL)
strcat(tmp, filefilter[0]);
if(my_existsfile(tmp) == 1)
return; // File already exists
strcpy(workingDir, tmp);
dialogResult = true;
}
else
{
if(fileList->isDir(selected_item))
return; // Directory selected -> Ok not possible
strcat(workingDir, "/");
strcat(workingDir, fileList->getElementAt(selected_item).c_str());
dialogResult = true;
}
}
dialogFinished = true;
}
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == cmdOK)
{
int selected_item;
selected_item = lstFiles->getSelected();
if (createNew)
{
char tmp[MAX_PATH];
if (txtFilename->getText().length() <= 0)
return;
strcpy(tmp, workingDir);
strcat(tmp, "/");
strcat(tmp, txtFilename->getText().c_str());
if (strstr(tmp, filefilter[0]) == NULL)
strcat(tmp, filefilter[0]);
if (my_existsfile(tmp) == 1)
return; // File already exists
strcpy(workingDir, tmp);
dialogResult = true;
}
else
{
if (fileList->isDir(selected_item))
return; // Directory selected -> Ok not possible
strcat(workingDir, "/");
strcat(workingDir, fileList->getElementAt(selected_item).c_str());
dialogResult = true;
}
}
dialogFinished = true;
}
};
static FileButtonActionListener* fileButtonActionListener;
static void checkfoldername (char *current)
static void checkfoldername(char *current)
{
char *ptr;
char actualpath [MAX_PATH];
char actualpath[MAX_PATH];
DIR *dir;
if (dir = opendir(current))
{
fileList->changeDir(current);
ptr = realpath(current, actualpath);
strcpy(workingDir, ptr);
closedir(dir);
fileList->changeDir(current);
ptr = realpath(current, actualpath);
strcpy(workingDir, ptr);
closedir(dir);
}
else
strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir);
else
strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir);
}
static void checkfilename(char *current)
{
char actfile[MAX_PATH];
extractFileName(current, actfile);
for(int i=0; i<fileList->getNumberOfElements(); ++i)
{
if(!fileList->isDir(i) && !strcasecmp(fileList->getElementAt(i).c_str(), actfile))
{
lstFiles->setSelected(i);
selectedOnStart = i;
break;
}
}
char actfile[MAX_PATH];
extractFileName(current, actfile);
for (int i = 0; i < fileList->getNumberOfElements(); ++i)
{
if (!fileList->isDir(i) && !strcasecmp(fileList->getElementAt(i).c_str(), actfile))
{
lstFiles->setSelected(i);
selectedOnStart = i;
break;
}
}
}
class SelectFileActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
int selected_item;
char foldername[256] = "";
public:
void action(const gcn::ActionEvent& actionEvent)
{
int selected_item;
char foldername[256] = "";
selected_item = lstFiles->getSelected();
strcpy(foldername, workingDir);
strcat(foldername, "/");
strcat(foldername, fileList->getElementAt(selected_item).c_str());
if(fileList->isDir(selected_item))
checkfoldername(foldername);
else if(!createNew)
{
strncpy(workingDir, foldername, sizeof(workingDir));
dialogResult = true;
dialogFinished = true;
}
}
selected_item = lstFiles->getSelected();
strcpy(foldername, workingDir);
strcat(foldername, "/");
strcat(foldername, fileList->getElementAt(selected_item).c_str());
if (fileList->isDir(selected_item))
checkfoldername(foldername);
else if (!createNew)
{
strncpy(workingDir, foldername, sizeof(workingDir));
dialogResult = true;
dialogFinished = true;
}
}
};
static SelectFileActionListener* selectFileActionListener;
static void InitSelectFile(const char *title)
{
wndSelectFile = new gcn::Window("Load");
wndSelectFile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndSelectFile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFile->setBaseColor(gui_baseCol + 0x202020);
wndSelectFile->setCaption(title);
wndSelectFile->setTitleBarHeight(TITLEBAR_HEIGHT);
wndSelectFile = new gcn::Window("Load");
wndSelectFile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndSelectFile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFile->setBaseColor(gui_baseCol + 0x202020);
wndSelectFile->setCaption(title);
wndSelectFile->setTitleBarHeight(TITLEBAR_HEIGHT);
fileButtonActionListener = new FileButtonActionListener();
fileButtonActionListener = new FileButtonActionListener();
cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->addActionListener(fileButtonActionListener);
cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->addActionListener(fileButtonActionListener);
cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->addActionListener(fileButtonActionListener);
cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->addActionListener(fileButtonActionListener);
txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false);
txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false);
selectFileActionListener = new SelectFileActionListener();
fileList = new SelectFileListModel(".");
selectFileActionListener = new SelectFileActionListener();
fileList = new SelectFileListModel(".");
lstFiles = new gcn::ListBox(fileList);
lstFiles->setSize(800, 252);
lstFiles->setBaseColor(gui_baseCol);
lstFiles->setWrappingEnabled(true);
lstFiles->addActionListener(selectFileActionListener);
lstFiles = new gcn::ListBox(fileList);
lstFiles->setSize(800, 252);
lstFiles->setBaseColor(gui_baseCol);
lstFiles->setWrappingEnabled(true);
lstFiles->addActionListener(selectFileActionListener);
scrAreaFiles = new gcn::ScrollArea(lstFiles);
scrAreaFiles->setFrameSize(1);
scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFiles->setScrollbarWidth(20);
scrAreaFiles->setBaseColor(gui_baseCol + 0x202020);
scrAreaFiles = new gcn::ScrollArea(lstFiles);
scrAreaFiles->setFrameSize(1);
scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFiles->setScrollbarWidth(20);
scrAreaFiles->setBaseColor(gui_baseCol + 0x202020);
if(createNew)
{
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y);
lblFilename = new gcn::Label("Filename:");
lblFilename->setSize(80, LABEL_HEIGHT);
lblFilename->setAlignment(gcn::Graphics::LEFT);
lblFilename->setPosition(DISTANCE_BORDER, scrAreaFiles->getY() + scrAreaFiles->getHeight() + DISTANCE_NEXT_Y);
txtFilename = new gcn::TextField();
txtFilename->setSize(120, TEXTFIELD_HEIGHT);
txtFilename->setId("Filename");
txtFilename->setPosition(lblFilename->getX() + lblFilename->getWidth() + DISTANCE_NEXT_X, lblFilename->getY());
if (createNew)
{
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y);
lblFilename = new gcn::Label("Filename:");
lblFilename->setSize(80, LABEL_HEIGHT);
lblFilename->setAlignment(gcn::Graphics::LEFT);
lblFilename->setPosition(DISTANCE_BORDER, scrAreaFiles->getY() + scrAreaFiles->getHeight() + DISTANCE_NEXT_Y);
txtFilename = new gcn::TextField();
txtFilename->setSize(120, TEXTFIELD_HEIGHT);
txtFilename->setId("Filename");
txtFilename->setPosition(lblFilename->getX() + lblFilename->getWidth() + DISTANCE_NEXT_X, lblFilename->getY());
wndSelectFile->add(lblFilename);
wndSelectFile->add(txtFilename);
}
wndSelectFile->add(lblFilename);
wndSelectFile->add(txtFilename);
}
wndSelectFile->add(cmdOK);
wndSelectFile->add(cmdCancel);
wndSelectFile->add(txtCurrent);
wndSelectFile->add(scrAreaFiles);
wndSelectFile->add(cmdOK);
wndSelectFile->add(cmdCancel);
wndSelectFile->add(txtCurrent);
wndSelectFile->add(scrAreaFiles);
gui_top->add(wndSelectFile);
gui_top->add(wndSelectFile);
lstFiles->requestFocus();
lstFiles->setSelected(0);
wndSelectFile->requestModalFocus();
lstFiles->requestFocus();
lstFiles->setSelected(0);
wndSelectFile->requestModalFocus();
}
static void ExitSelectFile(void)
{
wndSelectFile->releaseModalFocus();
gui_top->remove(wndSelectFile);
wndSelectFile->releaseModalFocus();
gui_top->remove(wndSelectFile);
delete cmdOK;
delete cmdCancel;
delete fileButtonActionListener;
delete cmdOK;
delete cmdCancel;
delete fileButtonActionListener;
delete txtCurrent;
delete lstFiles;
delete scrAreaFiles;
delete selectFileActionListener;
delete fileList;
if(createNew)
{
delete lblFilename;
delete txtFilename;
}
delete txtCurrent;
delete lstFiles;
delete scrAreaFiles;
delete selectFileActionListener;
delete fileList;
if (createNew)
{
delete lblFilename;
delete txtFilename;
}
delete wndSelectFile;
delete wndSelectFile;
}
static void SelectFileLoop(void)
{
while(!dialogFinished)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
while (!dialogFinished)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
case SDLK_LEFT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFiles)
cmdCancel->requestFocus();
else if(activeWidget == cmdCancel)
cmdOK->requestFocus();
else if(activeWidget == cmdOK)
if(createNew)
txtFilename->requestFocus();
else
lstFiles->requestFocus();
else if(activeWidget == txtFilename)
lstFiles->requestFocus();
continue;
}
break;
case SDLK_LEFT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if (activeWidget == lstFiles)
cmdCancel->requestFocus();
else if (activeWidget == cmdCancel)
cmdOK->requestFocus();
else if (activeWidget == cmdOK)
if (createNew)
txtFilename->requestFocus();
else
lstFiles->requestFocus();
else if (activeWidget == txtFilename)
lstFiles->requestFocus();
continue;
}
break;
case SDLK_RIGHT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFiles)
if(createNew)
txtFilename->requestFocus();
else
cmdOK->requestFocus();
else if(activeWidget == txtFilename)
cmdOK->requestFocus();
else if(activeWidget == cmdCancel)
lstFiles->requestFocus();
else if(activeWidget == cmdOK)
cmdCancel->requestFocus();
continue;
}
break;
case SDLK_RIGHT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if (activeWidget == lstFiles)
if (createNew)
txtFilename->requestFocus();
else
cmdOK->requestFocus();
else if (activeWidget == txtFilename)
cmdOK->requestFocus();
else if (activeWidget == cmdCancel)
lstFiles->requestFocus();
else if (activeWidget == cmdOK)
cmdCancel->requestFocus();
continue;
}
break;
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
if(!dialogCreated)
{
dialogCreated = true;
if(selectedOnStart >= 0)
scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19);
}
}
if (!dialogCreated)
{
dialogCreated = true;
if (selectedOnStart >= 0)
scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19);
}
}
}
#ifdef FILE_SELECT_KEEP_POSITION
@ -368,46 +368,47 @@ static int Already_init = 0;
bool SelectFile(const char *title, char *value, const char *filter[], bool create)
{
dialogResult = false;
dialogFinished = false;
createNew = create;
filefilter = filter;
dialogCreated = false;
selectedOnStart = -1;
dialogResult = false;
dialogFinished = false;
createNew = create;
filefilter = filter;
dialogCreated = false;
selectedOnStart = -1;
#ifdef FILE_SELECT_KEEP_POSITION
if (Already_init == 0)
{
InitSelectFile(title);
Already_init = 1;
} else
{
strncpy(value,workingDir,MAX_PATH);
gui_top->add(wndSelectFile);
wndSelectFile->setCaption(title);
wndSelectFile->requestModalFocus();
wndSelectFile->setVisible(true);
gui_top->moveToTop(wndSelectFile);
}
#else
InitSelectFile(title);
#endif
extractPath(value, workingDir);
checkfoldername(workingDir);
checkfilename(value);
SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION
wndSelectFile->releaseModalFocus();
wndSelectFile->setVisible(false);
if (Already_init == 0)
{
InitSelectFile(title);
Already_init = 1;
}
else
{
strncpy(value, workingDir, MAX_PATH);
gui_top->add(wndSelectFile);
wndSelectFile->setCaption(title);
wndSelectFile->requestModalFocus();
wndSelectFile->setVisible(true);
gui_top->moveToTop(wndSelectFile);
}
#else
ExitSelectFile();
InitSelectFile(title);
#endif
if(dialogResult)
strncpy(value, workingDir, MAX_PATH);
extractPath(value, workingDir);
checkfoldername(workingDir);
checkfilename(value);
SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION
else
strncpy(workingDir,value, MAX_PATH);
wndSelectFile->releaseModalFocus();
wndSelectFile->setVisible(false);
#else
ExitSelectFile();
#endif
return dialogResult;
if (dialogResult)
strncpy(value, workingDir, MAX_PATH);
#ifdef FILE_SELECT_KEEP_POSITION
else
strncpy(workingDir, value, MAX_PATH);
#endif
return dialogResult;
}

View file

@ -17,6 +17,7 @@
#define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400
std::string volName;
static bool dialogResult = false;
static bool dialogFinished = false;
static char workingDir[MAX_PATH];
@ -31,84 +32,85 @@ static gcn::TextField *txtCurrent;
class ButtonActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == cmdOK)
{
dialogResult = true;
}
dialogFinished = true;
}
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == cmdOK)
{
dialogResult = true;
}
dialogFinished = true;
}
};
static ButtonActionListener* buttonActionListener;
class DirListModel : public gcn::ListModel
{
std::vector<std::string> dirs;
std::vector<std::string> dirs;
public:
DirListModel(const char * path)
{
changeDir(path);
}
public:
DirListModel(const char * path)
{
changeDir(path);
}
int getNumberOfElements()
{
return dirs.size();
}
int getNumberOfElements()
{
return dirs.size();
}
std::string getElementAt(int i)
{
if(i >= dirs.size() || i < 0)
return "---";
return dirs[i];
}
std::string getElementAt(int i)
{
if (i >= dirs.size() || i < 0)
return "---";
return dirs[i];
}
void changeDir(const char *path)
{
ReadDirectory(path, &dirs, NULL);
if(dirs.size() == 0)
dirs.push_back("..");
}
void changeDir(const char *path)
{
ReadDirectory(path, &dirs, NULL);
if (dirs.size() == 0)
dirs.push_back("..");
}
};
static DirListModel dirList(".");
static void checkfoldername (char *current)
static void checkfoldername(char *current)
{
char *ptr;
char actualpath [PATH_MAX];
char actualpath[PATH_MAX];
DIR *dir;
if (dir = opendir(current))
{
dirList = current;
ptr = realpath(current, actualpath);
strcpy(workingDir, ptr);
closedir(dir);
dirList = current;
ptr = realpath(current, actualpath);
strcpy(workingDir, ptr);
closedir(dir);
}
else
strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir);
else
strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir);
}
class ListBoxActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
int selected_item;
char foldername[256] = "";
public:
void action(const gcn::ActionEvent& actionEvent)
{
int selected_item;
char foldername[256] = "";
selected_item = lstFolders->getSelected();
strcpy(foldername, workingDir);
strcat(foldername, "/");
strcat(foldername, dirList.getElementAt(selected_item).c_str());
checkfoldername(foldername);
}
selected_item = lstFolders->getSelected();
strcpy(foldername, workingDir);
strcat(foldername, "/");
strcat(foldername, dirList.getElementAt(selected_item).c_str());
volName = dirList.getElementAt(selected_item).c_str();
checkfoldername(foldername);
}
};
static ListBoxActionListener* listBoxActionListener;
@ -117,158 +119,158 @@ static void InitSelectFolder(const char *title)
{
wndSelectFolder = new gcn::Window("Load");
wndSelectFolder->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndSelectFolder->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFolder->setBaseColor(gui_baseCol + 0x202020);
wndSelectFolder->setCaption(title);
wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT);
wndSelectFolder->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFolder->setBaseColor(gui_baseCol + 0x202020);
wndSelectFolder->setCaption(title);
wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT);
buttonActionListener = new ButtonActionListener();
buttonActionListener = new ButtonActionListener();
cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->addActionListener(buttonActionListener);
cmdOK->setBaseColor(gui_baseCol + 0x202020);
cmdOK->addActionListener(buttonActionListener);
cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->addActionListener(buttonActionListener);
cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->addActionListener(buttonActionListener);
txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false);
txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false);
listBoxActionListener = new ListBoxActionListener();
listBoxActionListener = new ListBoxActionListener();
lstFolders = new gcn::ListBox(&dirList);
lstFolders->setSize(800, 252);
lstFolders->setBaseColor(gui_baseCol);
lstFolders->setWrappingEnabled(true);
lstFolders->addActionListener(listBoxActionListener);
lstFolders = new gcn::ListBox(&dirList);
lstFolders->setSize(800, 252);
lstFolders->setBaseColor(gui_baseCol);
lstFolders->setWrappingEnabled(true);
lstFolders->addActionListener(listBoxActionListener);
scrAreaFolders = new gcn::ScrollArea(lstFolders);
scrAreaFolders->setFrameSize(1);
scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFolders->setScrollbarWidth(20);
scrAreaFolders->setBaseColor(gui_baseCol + 0x202020);
scrAreaFolders = new gcn::ScrollArea(lstFolders);
scrAreaFolders->setFrameSize(1);
scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFolders->setScrollbarWidth(20);
scrAreaFolders->setBaseColor(gui_baseCol + 0x202020);
wndSelectFolder->add(cmdOK);
wndSelectFolder->add(cmdCancel);
wndSelectFolder->add(txtCurrent);
wndSelectFolder->add(scrAreaFolders);
wndSelectFolder->add(cmdOK);
wndSelectFolder->add(cmdCancel);
wndSelectFolder->add(txtCurrent);
wndSelectFolder->add(scrAreaFolders);
gui_top->add(wndSelectFolder);
gui_top->add(wndSelectFolder);
lstFolders->requestFocus();
lstFolders->setSelected(0);
wndSelectFolder->requestModalFocus();
lstFolders->requestFocus();
lstFolders->setSelected(0);
wndSelectFolder->requestModalFocus();
}
static void ExitSelectFolder(void)
{
wndSelectFolder->releaseModalFocus();
gui_top->remove(wndSelectFolder);
wndSelectFolder->releaseModalFocus();
gui_top->remove(wndSelectFolder);
delete cmdOK;
delete cmdCancel;
delete buttonActionListener;
delete cmdOK;
delete cmdCancel;
delete buttonActionListener;
delete txtCurrent;
delete lstFolders;
delete scrAreaFolders;
delete listBoxActionListener;
delete txtCurrent;
delete lstFolders;
delete scrAreaFolders;
delete listBoxActionListener;
delete wndSelectFolder;
delete wndSelectFolder;
}
static void SelectFolderLoop(void)
{
while(!dialogFinished)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
while (!dialogFinished)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
dialogFinished = true;
break;
case SDLK_LEFT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFolders)
cmdCancel->requestFocus();
else if(activeWidget == cmdCancel)
cmdOK->requestFocus();
else if(activeWidget == cmdOK)
lstFolders->requestFocus();
continue;
}
break;
case SDLK_LEFT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if (activeWidget == lstFolders)
cmdCancel->requestFocus();
else if (activeWidget == cmdCancel)
cmdOK->requestFocus();
else if (activeWidget == cmdOK)
lstFolders->requestFocus();
continue;
}
break;
case SDLK_RIGHT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if(activeWidget == lstFolders)
cmdOK->requestFocus();
else if(activeWidget == cmdCancel)
lstFolders->requestFocus();
else if(activeWidget == cmdOK)
cmdCancel->requestFocus();
continue;
}
break;
case SDLK_RIGHT:
{
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gcn::Widget* activeWidget = focusHdl->getFocused();
if (activeWidget == lstFolders)
cmdOK->requestFocus();
else if (activeWidget == cmdCancel)
lstFolders->requestFocus();
else if (activeWidget == cmdOK)
cmdCancel->requestFocus();
continue;
}
break;
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
case SDLK_PAGEDOWN:
case SDLK_HOME:
event.key.keysym.sym = SDLK_RETURN;
gui_input->pushInput(event); // Fire key down
event.type = SDL_KEYUP; // and the key up
break;
}
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
//-------------------------------------------------
// Send event to guichan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
wait_for_vsync();
SDL_Flip(gui_screen);
}
}
bool SelectFolder(const char *title, char *value)
{
dialogResult = false;
dialogFinished = false;
InitSelectFolder(title);
checkfoldername(value);
SelectFolderLoop();
ExitSelectFolder();
if(dialogResult)
{
strncpy(value, workingDir, MAX_PATH);
if(value[strlen(value) - 1] != '/')
strcat(value, "/");
}
return dialogResult;
dialogResult = false;
dialogFinished = false;
InitSelectFolder(title);
checkfoldername(value);
SelectFolderLoop();
ExitSelectFolder();
if (dialogResult)
{
strncpy(value, workingDir, MAX_PATH);
if (value[strlen(value) - 1] != '/')
strcat(value, "/");
}
return dialogResult;
}

File diff suppressed because it is too large Load diff

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff