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

View file

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

@ -1,9 +1,10 @@
/* /*
* Data used for communication between custom.c and drawing.c. * Data used for communication between custom.c and drawing.c.
* *
* 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,40 +23,41 @@
#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;
} }
extern int framecnt; extern int framecnt;
/* color values in two formats: 12 (OCS/ECS) or 24 (AGA) bit Amiga RGB (color_regs), /* color values in two formats: 12 (OCS/ECS) or 24 (AGA) bit Amiga RGB (color_regs),
* and the native color value; both for each Amiga hardware color register. * and the native color value; both for each Amiga hardware color register.
* *
* !!! 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]; {
xcolnr acolors[256]; uae_u16 color_regs_ecs[32];
uae_u32 color_regs_aga[256]; xcolnr acolors[256];
uae_u32 color_regs_aga[256];
bool borderblank; bool borderblank;
}; };
@ -67,19 +69,20 @@ struct color_entry {
#else #else
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",
return ret; "r2");
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,15 +108,15 @@ 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,10 +129,11 @@ 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 regno; int linepos;
unsigned int value; int regno;
unsigned int value;
}; };
/* 440 rather than 880, since sprites are always lores. */ /* 440 rather than 880, since sprites are always lores. */
@ -142,15 +146,16 @@ struct color_change {
struct sprite_entry struct sprite_entry
{ {
unsigned short pos; unsigned short pos;
unsigned short max; unsigned short max;
unsigned int first_pixel; unsigned int first_pixel;
bool has_attached; bool has_attached;
}; };
union sps_union { union sps_union
uae_u8 bytes[MAX_SPR_PIXELS]; {
uae_u32 words[MAX_SPR_PIXELS / 4]; uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4];
}; };
extern union sps_union spixstate; 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 /* 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. */ {
int plfleft, plfright, plflinelen; /* Records the leftmost access of BPL1DAT. */
/* Display window: native coordinates, depend on lores state. */ int plfleft, plfright, plflinelen;
int diwfirstword, diwlastword; /* Display window: native coordinates, depend on lores state. */
int ctable; int diwfirstword, diwlastword;
int ctable;
uae_u16 bplcon0, bplcon2; uae_u16 bplcon0, bplcon2;
uae_u16 bplcon3, bplcon4; uae_u16 bplcon3, bplcon4;
uae_u8 nr_planes; uae_u8 nr_planes;
uae_u8 bplres; uae_u8 bplres;
bool ham_seen; bool ham_seen;
bool ham_at_start; bool ham_at_start;
}; };
/* 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_color_change, last_color_change; int first_sprite_entry, last_sprite_entry;
int nr_color_changes, nr_sprites; int first_color_change, last_color_change;
int nr_color_changes, nr_sprites;
}; };
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; 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]; 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,22 +1,24 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Stuff * Stuff
* *
* Copyright 1995, 1996 Ed Hanway * Copyright 1995, 1996 Ed Hanway
* 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; {
TCHAR *option, *value; struct strlist *next;
int unknown; TCHAR *option, *value;
int unknown;
}; };
#define DEFAULT_JIT_CACHE_SIZE 8192 #define DEFAULT_JIT_CACHE_SIZE 8192
@ -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,135 +87,138 @@ struct floppyslot
int dfxtype; int dfxtype;
}; };
struct wh { struct wh
int x, y; {
int width, height; int x, y;
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 volname[MAX_DPATH]; TCHAR devname[MAX_DPATH];
TCHAR rootdir[MAX_DPATH]; TCHAR volname[MAX_DPATH];
bool ishdf; TCHAR rootdir[MAX_DPATH];
bool readonly; bool ishdf;
int bootpri; bool readonly;
bool autoboot; int bootpri;
bool donotmount; bool autoboot;
TCHAR filesys[MAX_DPATH]; bool donotmount;
TCHAR filesys[MAX_DPATH];
int cyls; // zero if detected from size int cyls; // zero if detected from size
int surfaces; int surfaces;
int sectors; int sectors;
int reserved; int reserved;
int blocksize; int blocksize;
int configoffset; int configoffset;
int controller; int controller;
// zero if default // zero if default
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];
TCHAR info[256]; TCHAR info[256];
int config_version; int config_version;
bool socket_emu; bool socket_emu;
bool start_gui; bool start_gui;
int produce_sound; int produce_sound;
int sound_stereo; int sound_stereo;
int sound_stereo_separation; int sound_stereo_separation;
int sound_mixed_stereo_delay; int sound_mixed_stereo_delay;
int sound_freq; int sound_freq;
int sound_interpol; int sound_interpol;
int sound_filter; int sound_filter;
int sound_filter_type; int sound_filter_type;
int sound_volume_cd; int sound_volume_cd;
int cachesize; int cachesize;
int optcount[10]; int optcount[10];
int gfx_framerate; int gfx_framerate;
struct wh gfx_size_win; struct wh gfx_size_win;
struct wh gfx_size_fs; struct wh gfx_size_fs;
struct wh gfx_size; struct wh gfx_size;
int gfx_resolution; int gfx_resolution;
#ifdef RASPBERRY #ifdef RASPBERRY
int gfx_correct_aspect; int gfx_correct_aspect;
int gfx_fullscreen_ratio; int gfx_fullscreen_ratio;
int kbd_led_num; int kbd_led_num;
int kbd_led_scr; int kbd_led_scr;
int kbd_led_cap; int kbd_led_cap;
#endif #endif
bool immediate_blits; bool immediate_blits;
int waiting_blits; int waiting_blits;
unsigned int chipset_mask; unsigned int chipset_mask;
bool ntscmode; bool ntscmode;
int chipset_refreshrate; int chipset_refreshrate;
int collision_level; int collision_level;
int leds_on_screen; int leds_on_screen;
int fast_copper; int fast_copper;
int floppy_speed; int floppy_speed;
int floppy_write_length; int floppy_write_length;
bool tod_hack; bool tod_hack;
int filesys_limit; int filesys_limit;
bool cs_cd32cd; bool cs_cd32cd;
bool cs_cd32c2p; bool cs_cd32c2p;
bool cs_cd32nvram; bool cs_cd32nvram;
TCHAR romfile[MAX_DPATH]; TCHAR romfile[MAX_DPATH];
TCHAR romextfile[MAX_DPATH]; TCHAR romextfile[MAX_DPATH];
TCHAR flashfile[MAX_DPATH]; TCHAR flashfile[MAX_DPATH];
struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES]; struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
TCHAR path_floppy[256]; TCHAR path_floppy[256];
TCHAR path_hardfile[256]; TCHAR path_hardfile[256];
TCHAR path_rom[256]; TCHAR path_rom[256];
TCHAR path_cd[256]; TCHAR path_cd[256];
int m68k_speed; int m68k_speed;
int cpu_model; int cpu_model;
int fpu_model; int fpu_model;
bool cpu_compatible; bool cpu_compatible;
bool address_space_24; bool address_space_24;
int picasso96_modeflags; int picasso96_modeflags;
uae_u32 z3fastmem_size; uae_u32 z3fastmem_size;
uae_u32 z3fastmem_start; uae_u32 z3fastmem_start;
uae_u32 fastmem_size; uae_u32 fastmem_size;
uae_u32 chipmem_size; uae_u32 chipmem_size;
uae_u32 bogomem_size; uae_u32 bogomem_size;
uae_u32 rtgmem_size; uae_u32 rtgmem_size;
int rtgmem_type; int rtgmem_type;
int mountitems; int mountitems;
struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE]; struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE];
int nr_floppies; int nr_floppies;
struct floppyslot floppyslots[4]; struct floppyslot floppyslots[4];
/* Target specific options */ /* Target specific options */
int pandora_horizontal_offset; int pandora_horizontal_offset;
int pandora_vertical_offset; int pandora_vertical_offset;
int pandora_cpu_speed; int pandora_cpu_speed;
int pandora_hide_idle_led; int pandora_hide_idle_led;
int pandora_tapDelay;
int pandora_customControls;
int key_for_menu; int pandora_tapDelay;
int pandora_customControls;
/* input */ int key_for_menu;
/* input */
struct jport jports[MAX_JPORTS]; struct jport jports[MAX_JPORTS];
int input_selected_setting; int input_selected_setting;
int input_joymouse_multiplier; int input_joymouse_multiplier;
int input_joymouse_deadzone; int input_joymouse_deadzone;
int input_joystick_deadzone; int input_joystick_deadzone;
int input_joymouse_speed; int input_joymouse_speed;
@ -219,83 +226,95 @@ struct uae_prefs {
int input_analog_joystick_offset; int input_analog_joystick_offset;
int input_autofire_linecnt; int input_autofire_linecnt;
int input_mouse_speed; int input_mouse_speed;
int input_tablet; int input_tablet;
int input_keyboard_type; int input_keyboard_type;
struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; 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 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

@ -112,8 +112,8 @@ using namespace std;
#define S_ISDIR(val) (S_IFDIR & val) #define S_ISDIR(val) (S_IFDIR & val)
struct utimbuf struct utimbuf
{ {
time_t actime; time_t actime;
time_t modtime; time_t modtime;
}; };
#endif #endif
@ -141,8 +141,8 @@ struct utimbuf
#define utime(file,time) 0 #define utime(file,time) 0
struct utimbuf struct utimbuf
{ {
time_t actime; time_t actime;
time_t modtime; time_t modtime;
}; };
#endif #endif
@ -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. */
@ -277,7 +280,7 @@ extern TCHAR *utf8u (const char *s);
#define FILEFLAG_PURE 0x40 #define FILEFLAG_PURE 0x40
#define REGPARAM2 #define REGPARAM2
#define REGPARAM3 #define REGPARAM3
#define REGPARAM #define REGPARAM
#define abort() \ #define abort() \
@ -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)
"rev %0, %0" {
: "=r" (v) : "0" (v) ); return v;} __asm__(
"rev %0, %0"
: "=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)
"revsh %0, %0\n\t" {
"uxth %0, %0" __asm__(
: "=r" (v) : "0" (v) ); return v;} "revsh %0, %0\n\t"
"uxth %0, %0"
: "=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

@ -2,7 +2,7 @@
* newcpu.cpp - CPU emulation * newcpu.cpp - CPU emulation
* *
* Copyright (c) 2010 ARAnyM dev team (see AUTHORS) * Copyright (c) 2010 ARAnyM dev team (see AUTHORS)
* *
* *
* Inspired by Christian Bauer's Basilisk II * Inspired by Christian Bauer's Basilisk II
* *
@ -23,20 +23,20 @@
* 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
* *
* (c) 1995 Bernd Schmidt * (c) 1995 Bernd Schmidt
*/ */
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
#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,38 +45,41 @@ 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); {
wndEditFilesysVirtual->requestModalFocus(); txtPath->setText(tmp);
cmdPath->requestFocus(); txtVolume->setText(volName);
} }
else wndEditFilesysVirtual->requestModalFocus();
{ cmdPath->requestFocus();
if (actionEvent.getSource() == cmdOK) }
{ else
if(txtDevice->getText().length() <= 0) {
{ if (actionEvent.getSource() == cmdOK)
wndEditFilesysVirtual->setCaption("Please enter a device name."); {
return; if (txtDevice->getText().length() <= 0)
} {
if(txtVolume->getText().length() <= 0) wndEditFilesysVirtual->setCaption("Please enter a device name.");
{ return;
wndEditFilesysVirtual->setCaption("Please enter a volume name."); }
return; if (txtVolume->getText().length() <= 0)
} {
dialogResult = true; wndEditFilesysVirtual->setCaption("Please enter a volume name.");
} return;
dialogFinished = true; }
} dialogResult = true;
} }
dialogFinished = true;
}
}
}; };
static FilesysVirtualActionListener* filesysVirtualActionListener; static FilesysVirtualActionListener* filesysVirtualActionListener;
@ -83,232 +88,247 @@ static void InitEditFilesysVirtual(void)
{ {
wndEditFilesysVirtual = new gcn::Window("Edit"); wndEditFilesysVirtual = new gcn::Window("Edit");
wndEditFilesysVirtual->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); wndEditFilesysVirtual->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndEditFilesysVirtual->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); wndEditFilesysVirtual->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndEditFilesysVirtual->setBaseColor(gui_baseCol + 0x202020); wndEditFilesysVirtual->setBaseColor(gui_baseCol + 0x202020);
wndEditFilesysVirtual->setCaption("Volume settings"); wndEditFilesysVirtual->setCaption("Volume settings");
wndEditFilesysVirtual->setTitleBarHeight(TITLEBAR_HEIGHT); wndEditFilesysVirtual->setTitleBarHeight(TITLEBAR_HEIGHT);
filesysVirtualActionListener = new FilesysVirtualActionListener(); filesysVirtualActionListener = new FilesysVirtualActionListener();
cmdOK = new gcn::Button("Ok"); cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); 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->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->setBaseColor(gui_baseCol + 0x202020);
cmdOK->setId("virtOK"); cmdOK->setId("virtOK");
cmdOK->addActionListener(filesysVirtualActionListener); cmdOK->addActionListener(filesysVirtualActionListener);
cmdCancel = new gcn::Button("Cancel"); cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020); cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->setId("virtCancel"); cmdCancel->setId("virtCancel");
cmdCancel->addActionListener(filesysVirtualActionListener); cmdCancel->addActionListener(filesysVirtualActionListener);
lblDevice = new gcn::Label("Device Name:"); lblDevice = new gcn::Label("Device Name:");
lblDevice->setSize(100, LABEL_HEIGHT); lblDevice->setSize(100, LABEL_HEIGHT);
lblDevice->setAlignment(gcn::Graphics::RIGHT); lblDevice->setAlignment(gcn::Graphics::RIGHT);
txtDevice = new gcn::TextField(); txtDevice = new gcn::TextField();
txtDevice->setSize(80, TEXTFIELD_HEIGHT); txtDevice->setSize(80, TEXTFIELD_HEIGHT);
txtDevice->setId("virtDev"); txtDevice->setId("virtDev");
lblVolume = new gcn::Label("Volume Label:"); lblVolume = new gcn::Label("Volume Label:");
lblVolume->setSize(100, LABEL_HEIGHT); lblVolume->setSize(100, LABEL_HEIGHT);
lblVolume->setAlignment(gcn::Graphics::RIGHT); lblVolume->setAlignment(gcn::Graphics::RIGHT);
txtVolume = new gcn::TextField(); txtVolume = new gcn::TextField();
txtVolume->setSize(80, TEXTFIELD_HEIGHT); txtVolume->setSize(80, TEXTFIELD_HEIGHT);
txtVolume->setId("virtVol"); txtVolume->setId("virtVol");
lblPath = new gcn::Label("Path:"); lblPath = new gcn::Label("Path:");
lblPath->setSize(100, LABEL_HEIGHT); lblPath->setSize(100, LABEL_HEIGHT);
lblPath->setAlignment(gcn::Graphics::RIGHT); lblPath->setAlignment(gcn::Graphics::RIGHT);
txtPath = new gcn::TextField(); txtPath = new gcn::TextField();
txtPath->setSize(338, TEXTFIELD_HEIGHT); txtPath->setSize(338, TEXTFIELD_HEIGHT);
txtPath->setEnabled(false); txtPath->setEnabled(false);
cmdPath = new gcn::Button("..."); cmdPath = new gcn::Button("...");
cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
cmdPath->setBaseColor(gui_baseCol + 0x202020); cmdPath->setBaseColor(gui_baseCol + 0x202020);
cmdPath->setId("virtPath"); cmdPath->setId("virtPath");
cmdPath->addActionListener(filesysVirtualActionListener); cmdPath->addActionListener(filesysVirtualActionListener);
chkReadWrite = new gcn::UaeCheckBox("Read/Write", true); chkReadWrite = new gcn::UaeCheckBox("Read/Write", true);
chkReadWrite->setId("virtRW"); chkReadWrite->setId("virtRW");
chkAutoboot = new gcn::UaeCheckBox("Bootable", true); chkAutoboot = new gcn::UaeCheckBox("Bootable", true);
chkAutoboot->setId("virtAutoboot"); chkAutoboot->setId("virtAutoboot");
lblBootPri = new gcn::Label("Boot priority:"); lblBootPri = new gcn::Label("Boot priority:");
lblBootPri->setSize(84, LABEL_HEIGHT); lblBootPri->setSize(84, LABEL_HEIGHT);
lblBootPri->setAlignment(gcn::Graphics::RIGHT); lblBootPri->setAlignment(gcn::Graphics::RIGHT);
txtBootPri = new gcn::TextField(); txtBootPri = new gcn::TextField();
txtBootPri->setSize(40, TEXTFIELD_HEIGHT); txtBootPri->setSize(40, TEXTFIELD_HEIGHT);
txtBootPri->setId("virtBootpri"); 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;
wndEditFilesysVirtual->add(cmdOK); int posY = DISTANCE_BORDER;
wndEditFilesysVirtual->add(cmdCancel); 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;
gui_top->add(wndEditFilesysVirtual); wndEditFilesysVirtual->add(cmdOK);
wndEditFilesysVirtual->add(cmdCancel);
txtDevice->requestFocus();
wndEditFilesysVirtual->requestModalFocus(); gui_top->add(wndEditFilesysVirtual);
txtDevice->requestFocus();
wndEditFilesysVirtual->requestModalFocus();
} }
static void ExitEditFilesysVirtual(void) static void ExitEditFilesysVirtual(void)
{ {
wndEditFilesysVirtual->releaseModalFocus(); wndEditFilesysVirtual->releaseModalFocus();
gui_top->remove(wndEditFilesysVirtual); gui_top->remove(wndEditFilesysVirtual);
delete lblDevice; delete lblDevice;
delete txtDevice; delete txtDevice;
delete lblVolume; delete lblVolume;
delete txtVolume; delete txtVolume;
delete lblPath; delete lblPath;
delete txtPath; delete txtPath;
delete cmdPath; delete cmdPath;
delete chkReadWrite; delete chkReadWrite;
delete chkAutoboot; delete chkAutoboot;
delete lblBootPri; delete lblBootPri;
delete txtBootPri; delete txtBootPri;
delete cmdOK; delete cmdOK;
delete cmdCancel; delete cmdCancel;
delete filesysVirtualActionListener; delete filesysVirtualActionListener;
delete wndEditFilesysVirtual; delete wndEditFilesysVirtual;
} }
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:
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_LEFT: case SDLK_UP:
if(HandleNavigation(DIRECTION_LEFT)) if (HandleNavigation(DIRECTION_UP))
continue; // Don't change value when enter Slider -> don't send event to control continue; // Don't change value when enter ComboBox -> don't send event to control
break; 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_DOWN:
case SDLK_HOME: if (HandleNavigation(DIRECTION_DOWN))
event.key.keysym.sym = SDLK_RETURN; continue; // Don't change value when enter ComboBox -> don't send event to control
gui_input->pushInput(event); // Fire key down break;
event.type = SDL_KEYUP; // and the key up
break;
}
}
//------------------------------------------------- case SDLK_LEFT:
// Send event to guichan-controls if (HandleNavigation(DIRECTION_LEFT))
//------------------------------------------------- continue; // Don't change value when enter Slider -> don't send event to control
gui_input->pushInput(event); break;
}
// Now we let the Gui object perform its logic. case SDLK_RIGHT:
uae_gui->logic(); if (HandleNavigation(DIRECTION_RIGHT))
// Now we let the Gui object draw itself. continue; // Don't change value when enter Slider -> don't send event to control
uae_gui->draw(); break;
// Finally we update the screen.
wait_for_vsync(); case SDLK_PAGEDOWN:
SDL_Flip(gui_screen); 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);
}
// 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) bool EditFilesysVirtual(int unit_no)
{ {
struct mountedinfo mi; struct mountedinfo mi;
struct uaedev_config_info *uci; struct uaedev_config_info *uci;
std::string strdevname, strvolname, strroot; std::string strdevname, strvolname, strroot;
char tmp[32]; char tmp[32];
dialogResult = false;
dialogFinished = false;
InitEditFilesysVirtual(); dialogResult = false;
dialogFinished = false;
if(unit_no >= 0) InitEditFilesysVirtual();
{
uci = &changed_prefs.mountconfig[unit_no];
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
strdevname.assign(uci->devname); if (unit_no >= 0)
txtDevice->setText(strdevname); {
strvolname.assign(uci->volname); uci = &changed_prefs.mountconfig[unit_no];
txtVolume->setText(strvolname); get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
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(); strdevname.assign(uci->devname);
txtDevice->setText(strdevname);
if(dialogResult) strvolname.assign(uci->volname);
{ txtVolume->setText(strvolname);
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0); strroot.assign(uci->rootdir);
extractPath((char *) txtPath->getText().c_str(), currentDir); txtPath->setText(strroot);
chkReadWrite->setSelected(!uci->readonly);
uci = add_filesys_config(&changed_prefs, unit_no, (char *) txtDevice->getText().c_str(), chkAutoboot->setSelected(uci->bootpri != -128);
(char *) txtVolume->getText().c_str(), (char *) txtPath->getText().c_str(), snprintf(tmp, 32, "%d", uci->bootpri >= -127 ? uci->bootpri : -127);
!chkReadWrite->isSelected(), 0, 0, 0, 0, 0, bp, 0, 0, 0, 0, 0, 0); txtBootPri->setText(tmp);
if (uci) }
filesys_media_change (uci->rootdir, 1, uci); else
} {
CreateDefaultDevicename(tmp);
txtDevice->setText(tmp);
txtVolume->setText(tmp);
strroot.assign(currentDir);
txtPath->setText(strroot);
chkReadWrite->setSelected(true);
txtBootPri->setText("0");
}
ExitEditFilesysVirtual(); EditFilesysVirtualLoop();
return dialogResult; 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);
}
ExitEditFilesysVirtual();
return dialogResult;
} }

View file

@ -14,130 +14,131 @@
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;
} }
}; };
static DoneActionListener* doneActionListener; static DoneActionListener* doneActionListener;
void InGameMessage(const char *msg) void InGameMessage(const char *msg)
{ {
gcn::Gui* msg_gui; gcn::Gui* msg_gui;
gcn::SDLGraphics* msg_graphics; gcn::SDLGraphics* msg_graphics;
gcn::SDLInput* msg_input; gcn::SDLInput* msg_input;
gcn::contrib::SDLTrueTypeFont* msg_font; gcn::contrib::SDLTrueTypeFont* msg_font;
gcn::Color msg_baseCol; gcn::Color msg_baseCol;
gcn::Container* msg_top; gcn::Container* msg_top;
gcn::Window *wndMsg; gcn::Window *wndMsg;
gcn::Button* cmdDone; gcn::Button* cmdDone;
gcn::TextBox* txtMsg; gcn::TextBox* txtMsg;
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_baseCol.r = 192;
msg_baseCol.g = 192;
msg_baseCol.b = 208;
msg_top = new gcn::Container(); int msgWidth = 260;
msg_top->setDimension(gcn::Rectangle((prSDLScreen->w - msgWidth) / 2, (prSDLScreen->h - msgHeight) / 2, msgWidth, msgHeight)); int msgHeight = 100;
msg_top->setBaseColor(msg_baseCol);
msg_gui->setTop(msg_top);
TTF_Init(); msg_graphics = new gcn::SDLGraphics();
msg_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 10); msg_graphics->setTarget(prSDLScreen);
gcn::Widget::setGlobalFont(msg_font); 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_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);
doneActionListener = new DoneActionListener();
doneActionListener = new DoneActionListener();
wndMsg = new gcn::Window("Load"); wndMsg = new gcn::Window("Load");
wndMsg->setSize(msgWidth, msgHeight); wndMsg->setSize(msgWidth, msgHeight);
wndMsg->setPosition(0, 0); wndMsg->setPosition(0, 0);
wndMsg->setBaseColor(msg_baseCol + 0x202020); wndMsg->setBaseColor(msg_baseCol + 0x202020);
wndMsg->setCaption("Information"); wndMsg->setCaption("Information");
wndMsg->setTitleBarHeight(12); wndMsg->setTitleBarHeight(12);
cmdDone = new gcn::Button("Ok"); cmdDone = new gcn::Button("Ok");
cmdDone->setSize(40, 20); cmdDone->setSize(40, 20);
cmdDone->setBaseColor(msg_baseCol + 0x202020); cmdDone->setBaseColor(msg_baseCol + 0x202020);
cmdDone->addActionListener(doneActionListener); cmdDone->addActionListener(doneActionListener);
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);
msg_top->add(wndMsg); txtMsg = new gcn::TextBox(msg);
cmdDone->requestFocus(); txtMsg->setEnabled(false);
txtMsg->setPosition(6, 6);
msg_done = 0; txtMsg->setSize(wndMsg->getWidth() - 16, 46);
bool drawn = false; txtMsg->setOpaque(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;
}
}
//------------------------------------------------- wndMsg->add(txtMsg, 6, 6);
// Send event to guichan-controls wndMsg->add(cmdDone, (wndMsg->getWidth() - cmdDone->getWidth()) / 2, wndMsg->getHeight() - 38);
//-------------------------------------------------
msg_input->pushInput(event);
}
// Now we let the Gui object perform its logic. msg_top->add(wndMsg);
msg_gui->logic(); cmdDone->requestFocus();
// Now we let the Gui object draw itself.
msg_gui->draw();
// Finally we update the screen.
//SDL_Flip(prSDLScreen);
flush_screen ();
}
msg_top->remove(wndMsg); 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;
}
}
delete txtMsg; //-------------------------------------------------
delete cmdDone; // Send event to guichan-controls
delete doneActionListener; //-------------------------------------------------
delete wndMsg; msg_input->pushInput(event);
}
delete msg_font;
delete msg_top; // Now we let the Gui object perform its logic.
msg_gui->logic();
delete msg_gui; // Now we let the Gui object draw itself.
delete msg_input; msg_gui->draw();
delete msg_graphics; // Finally we update the screen.
if (!drawn)
SDL_Flip(prSDLScreen);
drawn = true;
}
msg_top->remove(wndMsg);
delete txtMsg;
delete cmdDone;
delete doneActionListener;
delete wndMsg;
delete msg_font;
delete msg_top;
delete msg_gui;
delete msg_input;
delete msg_graphics;
} }

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"
@ -33,49 +33,54 @@ static gcn::Label* lblSlowsize;
static gcn::Slider* sldSlowmem; static gcn::Slider* sldSlowmem;
static gcn::Label* lblFastmem; static gcn::Label* lblFastmem;
static gcn::Label* lblFastsize; static gcn::Label* lblFastsize;
static gcn::Slider* sldFastmem; static gcn::Slider* sldFastmem;
static gcn::Label* lblZ3mem; static gcn::Label* lblZ3mem;
static gcn::Label* lblZ3size; static gcn::Label* lblZ3size;
static gcn::Slider* sldZ3mem; static gcn::Slider* sldZ3mem;
static gcn::Label* lblGfxmem; static gcn::Label* lblGfxmem;
static gcn::Label* lblGfxsize; static gcn::Label* lblGfxsize;
static gcn::Slider* sldGfxmem; 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())]; {
if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0)) changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
changed_prefs.fastmem_size = 0; 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() == 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) { if (actionEvent.getSource() == sldSlowmem)
changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())]; {
if (changed_prefs.z3fastmem_size > max_z3fastmem) changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
changed_prefs.z3fastmem_size = max_z3fastmem; }
}
if (actionEvent.getSource() == sldGfxmem) { if (actionEvent.getSource() == sldFastmem)
changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())]; {
changed_prefs.rtgmem_type = 1; 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;
}
RefreshPanelRAM(); 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;
}
RefreshPanelRAM();
}
}; };
static MemorySliderActionListener* memorySliderActionListener; static MemorySliderActionListener* memorySliderActionListener;
@ -83,7 +88,7 @@ static MemorySliderActionListener* memorySliderActionListener;
void InitPanelRAM(const struct _ConfigCategory& category) void InitPanelRAM(const struct _ConfigCategory& category)
{ {
memorySliderActionListener = new MemorySliderActionListener(); memorySliderActionListener = new MemorySliderActionListener();
lblChipmem = new gcn::Label("Chip:"); lblChipmem = new gcn::Label("Chip:");
sldChipmem = new gcn::Slider(0, 4); sldChipmem = new gcn::Slider(0, 4);
sldChipmem->setSize(110, SLIDER_HEIGHT); sldChipmem->setSize(110, SLIDER_HEIGHT);
@ -147,7 +152,7 @@ void InitPanelRAM(const struct _ConfigCategory& category)
grpRAM->add(sldSlowmem, 70, posY); grpRAM->add(sldSlowmem, 70, posY);
grpRAM->add(lblSlowsize, 70 + sldSlowmem->getWidth() + 12, posY); grpRAM->add(lblSlowsize, 70 + sldSlowmem->getWidth() + 12, posY);
posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y; posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblFastmem, 8, posY); grpRAM->add(lblFastmem, 8, posY);
grpRAM->add(sldFastmem, 70, posY); grpRAM->add(sldFastmem, 70, posY);
grpRAM->add(lblFastsize, 70 + sldFastmem->getWidth() + 12, posY); grpRAM->add(lblFastsize, 70 + sldFastmem->getWidth() + 12, posY);
@ -166,88 +171,88 @@ void InitPanelRAM(const struct _ConfigCategory& category)
grpRAM->setMovable(false); grpRAM->setMovable(false);
grpRAM->setSize(250, posY + DISTANCE_BORDER); grpRAM->setSize(250, posY + DISTANCE_BORDER);
grpRAM->setBaseColor(gui_baseCol); grpRAM->setBaseColor(gui_baseCol);
category.panel->add(grpRAM); category.panel->add(grpRAM);
RefreshPanelRAM(); RefreshPanelRAM();
} }
void ExitPanelRAM(void) void ExitPanelRAM(void)
{ {
delete lblChipmem; delete lblChipmem;
delete sldChipmem; delete sldChipmem;
delete lblChipsize; delete lblChipsize;
delete lblSlowmem; delete lblSlowmem;
delete sldSlowmem; delete sldSlowmem;
delete lblSlowsize; delete lblSlowsize;
delete lblFastmem; delete lblFastmem;
delete sldFastmem; delete sldFastmem;
delete lblFastsize; delete lblFastsize;
delete lblZ3mem; delete lblZ3mem;
delete sldZ3mem; delete sldZ3mem;
delete lblZ3size; delete lblZ3size;
delete lblGfxmem; delete lblGfxmem;
delete sldGfxmem; delete sldGfxmem;
delete lblGfxsize; delete lblGfxsize;
delete grpRAM; delete grpRAM;
delete memorySliderActionListener; delete memorySliderActionListener;
} }
void RefreshPanelRAM(void) 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) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.bogomem_size == SlowMem_values[i]) if (changed_prefs.chipmem_size == ChipMem_values[i])
{ {
sldSlowmem->setValue(i); sldChipmem->setValue(i);
lblSlowsize->setCaption(SlowMem_list[i]); lblChipsize->setCaption(ChipMem_list[i]);
break; break;
} }
} }
for(i=0; i<5; ++i) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.fastmem_size == FastMem_values[i]) if (changed_prefs.bogomem_size == SlowMem_values[i])
{ {
sldFastmem->setValue(i); sldSlowmem->setValue(i);
lblFastsize->setCaption(FastMem_list[i]); lblSlowsize->setCaption(SlowMem_list[i]);
break; break;
} }
} }
for(i=0; i<9; ++i) for (i = 0; i < 5; ++i)
{ {
if(changed_prefs.z3fastmem_size == FastMem_values[i]) if (changed_prefs.fastmem_size == FastMem_values[i])
{ {
sldZ3mem->setValue(i); sldFastmem->setValue(i);
lblZ3size->setCaption(FastMem_list[i]); lblFastsize->setCaption(FastMem_list[i]);
break; break;
} }
} }
sldZ3mem->setEnabled(!changed_prefs.address_space_24);
for(i=0; i<6; ++i) for (i = 0; i < 9; ++i)
{ {
if(changed_prefs.rtgmem_size == FastMem_values[i]) if (changed_prefs.z3fastmem_size == FastMem_values[i])
{ {
sldGfxmem->setValue(i); sldZ3mem->setValue(i);
lblGfxsize->setCaption(FastMem_list[i]); lblZ3size->setCaption(FastMem_list[i]);
break; break;
} }
} }
sldGfxmem->setEnabled(!changed_prefs.address_space_24); 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);
} }

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
@ -43,323 +43,323 @@ static gcn::TextField *txtFilename;
class SelectFileListModel : public gcn::ListModel 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);
} }
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()];
}
void changeDir(const char *path)
{
ReadDirectory(path, &dirs, &files);
if(dirs.size() == 0)
dirs.push_back("..");
FilterFiles(&files, filefilter);
}
bool isDir(int i) int getNumberOfElements()
{ {
return (i < dirs.size()); 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()];
}
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());
}
}; };
static SelectFileListModel *fileList; 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());
dialogResult = true; dialogResult = true;
} }
} }
dialogFinished = true; dialogFinished = true;
} }
}; };
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))
{ {
fileList->changeDir(current); fileList->changeDir(current);
ptr = realpath(current, actualpath); ptr = realpath(current, actualpath);
strcpy(workingDir, ptr); strcpy(workingDir, ptr);
closedir(dir); closedir(dir);
} }
else else
strcpy(workingDir, start_path_data); strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir); txtCurrent->setText(workingDir);
} }
static void checkfilename(char *current) 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;
break; break;
} }
} }
} }
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;
char foldername[256] = ""; char foldername[256] = "";
selected_item = lstFiles->getSelected(); selected_item = lstFiles->getSelected();
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;
dialogFinished = true; dialogFinished = true;
} }
} }
}; };
static SelectFileActionListener* selectFileActionListener; static SelectFileActionListener* selectFileActionListener;
static void InitSelectFile(const char *title) static void InitSelectFile(const char *title)
{ {
wndSelectFile = new gcn::Window("Load"); wndSelectFile = new gcn::Window("Load");
wndSelectFile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); wndSelectFile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndSelectFile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); wndSelectFile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFile->setBaseColor(gui_baseCol + 0x202020); wndSelectFile->setBaseColor(gui_baseCol + 0x202020);
wndSelectFile->setCaption(title); wndSelectFile->setCaption(title);
wndSelectFile->setTitleBarHeight(TITLEBAR_HEIGHT); wndSelectFile->setTitleBarHeight(TITLEBAR_HEIGHT);
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);
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(); fileButtonActionListener = new FileButtonActionListener();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false);
selectFileActionListener = new SelectFileActionListener(); cmdOK = new gcn::Button("Ok");
fileList = new SelectFileListModel("."); 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);
lstFiles = new gcn::ListBox(fileList); cmdCancel = new gcn::Button("Cancel");
lstFiles->setSize(800, 252); cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
lstFiles->setBaseColor(gui_baseCol); cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
lstFiles->setWrappingEnabled(true); cmdCancel->setBaseColor(gui_baseCol + 0x202020);
lstFiles->addActionListener(selectFileActionListener); cmdCancel->addActionListener(fileButtonActionListener);
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) txtCurrent = new gcn::TextField();
{ txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y); txtCurrent->setPosition(DISTANCE_BORDER, 10);
lblFilename = new gcn::Label("Filename:"); txtCurrent->setEnabled(false);
lblFilename->setSize(80, LABEL_HEIGHT);
lblFilename->setAlignment(gcn::Graphics::LEFT); selectFileActionListener = new SelectFileActionListener();
lblFilename->setPosition(DISTANCE_BORDER, scrAreaFiles->getY() + scrAreaFiles->getHeight() + DISTANCE_NEXT_Y); fileList = new SelectFileListModel(".");
txtFilename = new gcn::TextField();
txtFilename->setSize(120, TEXTFIELD_HEIGHT); lstFiles = new gcn::ListBox(fileList);
txtFilename->setId("Filename"); lstFiles->setSize(800, 252);
txtFilename->setPosition(lblFilename->getX() + lblFilename->getWidth() + DISTANCE_NEXT_X, lblFilename->getY()); lstFiles->setBaseColor(gui_baseCol);
lstFiles->setWrappingEnabled(true);
wndSelectFile->add(lblFilename); lstFiles->addActionListener(selectFileActionListener);
wndSelectFile->add(txtFilename);
} scrAreaFiles = new gcn::ScrollArea(lstFiles);
scrAreaFiles->setFrameSize(1);
wndSelectFile->add(cmdOK); scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
wndSelectFile->add(cmdCancel); scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
wndSelectFile->add(txtCurrent); scrAreaFiles->setScrollbarWidth(20);
wndSelectFile->add(scrAreaFiles); scrAreaFiles->setBaseColor(gui_baseCol + 0x202020);
gui_top->add(wndSelectFile); if (createNew)
{
lstFiles->requestFocus(); scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272 - TEXTFIELD_HEIGHT - DISTANCE_NEXT_Y);
lstFiles->setSelected(0); lblFilename = new gcn::Label("Filename:");
wndSelectFile->requestModalFocus(); 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(cmdOK);
wndSelectFile->add(cmdCancel);
wndSelectFile->add(txtCurrent);
wndSelectFile->add(scrAreaFiles);
gui_top->add(wndSelectFile);
lstFiles->requestFocus();
lstFiles->setSelected(0);
wndSelectFile->requestModalFocus();
} }
static void ExitSelectFile(void) static void ExitSelectFile(void)
{ {
wndSelectFile->releaseModalFocus(); wndSelectFile->releaseModalFocus();
gui_top->remove(wndSelectFile); gui_top->remove(wndSelectFile);
delete cmdOK; delete cmdOK;
delete cmdCancel; delete cmdCancel;
delete fileButtonActionListener; delete fileButtonActionListener;
delete txtCurrent; delete txtCurrent;
delete lstFiles; delete lstFiles;
delete scrAreaFiles; delete scrAreaFiles;
delete selectFileActionListener; delete selectFileActionListener;
delete fileList; delete fileList;
if(createNew) if (createNew)
{ {
delete lblFilename; delete lblFilename;
delete txtFilename; delete txtFilename;
} }
delete wndSelectFile; delete wndSelectFile;
} }
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;
break; 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_PAGEDOWN: case SDLK_LEFT:
case SDLK_HOME: {
event.key.keysym.sym = SDLK_RETURN; gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gui_input->pushInput(event); // Fire key down gcn::Widget* activeWidget = focusHdl->getFocused();
event.type = SDL_KEYUP; // and the key up if (activeWidget == lstFiles)
break; 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:
// Send event to guichan-controls {
//------------------------------------------------- gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gui_input->pushInput(event); 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;
// Now we let the Gui object perform its logic. case SDLK_PAGEDOWN:
uae_gui->logic(); case SDLK_HOME:
// Now we let the Gui object draw itself. event.key.keysym.sym = SDLK_RETURN;
uae_gui->draw(); gui_input->pushInput(event); // Fire key down
// Finally we update the screen. event.type = SDL_KEYUP; // and the key up
wait_for_vsync(); break;
SDL_Flip(gui_screen); }
}
if(!dialogCreated)
{ //-------------------------------------------------
dialogCreated = true; // Send event to guichan-controls
if(selectedOnStart >= 0) //-------------------------------------------------
scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19); 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);
if (!dialogCreated)
{
dialogCreated = true;
if (selectedOnStart >= 0)
scrAreaFiles->setVerticalScrollAmount(selectedOnStart * 19);
}
}
} }
#ifdef FILE_SELECT_KEEP_POSITION #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) bool SelectFile(const char *title, char *value, const char *filter[], bool create)
{ {
dialogResult = false; dialogResult = false;
dialogFinished = false; dialogFinished = false;
createNew = create; createNew = create;
filefilter = filter; filefilter = filter;
dialogCreated = false; dialogCreated = false;
selectedOnStart = -1; 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 #ifdef FILE_SELECT_KEEP_POSITION
wndSelectFile->releaseModalFocus(); if (Already_init == 0)
wndSelectFile->setVisible(false); {
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 #else
ExitSelectFile(); InitSelectFile(title);
#endif #endif
if(dialogResult) extractPath(value, workingDir);
strncpy(value, workingDir, MAX_PATH); checkfoldername(workingDir);
checkfilename(value);
SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION #ifdef FILE_SELECT_KEEP_POSITION
else wndSelectFile->releaseModalFocus();
strncpy(workingDir,value, MAX_PATH); wndSelectFile->setVisible(false);
#else
ExitSelectFile();
#endif #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_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,84 +32,85 @@ 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)
{ {
dialogResult = true; dialogResult = true;
} }
dialogFinished = true; dialogFinished = true;
} }
}; };
static ButtonActionListener* buttonActionListener; static ButtonActionListener* buttonActionListener;
class DirListModel : public gcn::ListModel 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);
} }
int getNumberOfElements() int getNumberOfElements()
{ {
return dirs.size(); return dirs.size();
} }
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];
} }
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))
{ {
dirList = current; dirList = current;
ptr = realpath(current, actualpath); ptr = realpath(current, actualpath);
strcpy(workingDir, ptr); strcpy(workingDir, ptr);
closedir(dir); closedir(dir);
} }
else else
strcpy(workingDir, start_path_data); strcpy(workingDir, start_path_data);
txtCurrent->setText(workingDir); txtCurrent->setText(workingDir);
} }
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;
char foldername[256] = ""; char foldername[256] = "";
selected_item = lstFolders->getSelected(); selected_item = lstFolders->getSelected();
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());
checkfoldername(foldername); volName = dirList.getElementAt(selected_item).c_str();
} checkfoldername(foldername);
}
}; };
static ListBoxActionListener* listBoxActionListener; static ListBoxActionListener* listBoxActionListener;
@ -117,158 +119,158 @@ static void InitSelectFolder(const char *title)
{ {
wndSelectFolder = new gcn::Window("Load"); wndSelectFolder = new gcn::Window("Load");
wndSelectFolder->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); wndSelectFolder->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
wndSelectFolder->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); wndSelectFolder->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2);
wndSelectFolder->setBaseColor(gui_baseCol + 0x202020); wndSelectFolder->setBaseColor(gui_baseCol + 0x202020);
wndSelectFolder->setCaption(title); wndSelectFolder->setCaption(title);
wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT); wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT);
buttonActionListener = new ButtonActionListener(); buttonActionListener = new ButtonActionListener();
cmdOK = new gcn::Button("Ok"); cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); 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->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->setBaseColor(gui_baseCol + 0x202020);
cmdOK->addActionListener(buttonActionListener); cmdOK->addActionListener(buttonActionListener);
cmdCancel = new gcn::Button("Cancel"); cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol + 0x202020); cmdCancel->setBaseColor(gui_baseCol + 0x202020);
cmdCancel->addActionListener(buttonActionListener); cmdCancel->addActionListener(buttonActionListener);
txtCurrent = new gcn::TextField(); txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT); txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
txtCurrent->setPosition(DISTANCE_BORDER, 10); txtCurrent->setPosition(DISTANCE_BORDER, 10);
txtCurrent->setEnabled(false); txtCurrent->setEnabled(false);
listBoxActionListener = new ListBoxActionListener(); listBoxActionListener = new ListBoxActionListener();
lstFolders = new gcn::ListBox(&dirList); lstFolders = new gcn::ListBox(&dirList);
lstFolders->setSize(800, 252); lstFolders->setSize(800, 252);
lstFolders->setBaseColor(gui_baseCol); lstFolders->setBaseColor(gui_baseCol);
lstFolders->setWrappingEnabled(true); lstFolders->setWrappingEnabled(true);
lstFolders->addActionListener(listBoxActionListener); lstFolders->addActionListener(listBoxActionListener);
scrAreaFolders = new gcn::ScrollArea(lstFolders); scrAreaFolders = new gcn::ScrollArea(lstFolders);
scrAreaFolders->setFrameSize(1); scrAreaFolders->setFrameSize(1);
scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFolders->setScrollbarWidth(20); scrAreaFolders->setScrollbarWidth(20);
scrAreaFolders->setBaseColor(gui_baseCol + 0x202020); scrAreaFolders->setBaseColor(gui_baseCol + 0x202020);
wndSelectFolder->add(cmdOK); wndSelectFolder->add(cmdOK);
wndSelectFolder->add(cmdCancel); wndSelectFolder->add(cmdCancel);
wndSelectFolder->add(txtCurrent); wndSelectFolder->add(txtCurrent);
wndSelectFolder->add(scrAreaFolders); wndSelectFolder->add(scrAreaFolders);
gui_top->add(wndSelectFolder); gui_top->add(wndSelectFolder);
lstFolders->requestFocus(); lstFolders->requestFocus();
lstFolders->setSelected(0); lstFolders->setSelected(0);
wndSelectFolder->requestModalFocus(); wndSelectFolder->requestModalFocus();
} }
static void ExitSelectFolder(void) static void ExitSelectFolder(void)
{ {
wndSelectFolder->releaseModalFocus(); wndSelectFolder->releaseModalFocus();
gui_top->remove(wndSelectFolder); gui_top->remove(wndSelectFolder);
delete cmdOK; delete cmdOK;
delete cmdCancel; delete cmdCancel;
delete buttonActionListener; delete buttonActionListener;
delete txtCurrent; delete txtCurrent;
delete lstFolders; delete lstFolders;
delete scrAreaFolders; delete scrAreaFolders;
delete listBoxActionListener; delete listBoxActionListener;
delete wndSelectFolder; delete wndSelectFolder;
} }
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;
break; 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_PAGEDOWN: case SDLK_LEFT:
case SDLK_HOME: {
event.key.keysym.sym = SDLK_RETURN; gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gui_input->pushInput(event); // Fire key down gcn::Widget* activeWidget = focusHdl->getFocused();
event.type = SDL_KEYUP; // and the key up if (activeWidget == lstFolders)
break; cmdCancel->requestFocus();
} else if (activeWidget == cmdCancel)
} cmdOK->requestFocus();
else if (activeWidget == cmdOK)
lstFolders->requestFocus();
continue;
}
break;
//------------------------------------------------- case SDLK_RIGHT:
// Send event to guichan-controls {
//------------------------------------------------- gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
gui_input->pushInput(event); gcn::Widget* activeWidget = focusHdl->getFocused();
} if (activeWidget == lstFolders)
cmdOK->requestFocus();
else if (activeWidget == cmdCancel)
lstFolders->requestFocus();
else if (activeWidget == cmdOK)
cmdCancel->requestFocus();
continue;
}
break;
// Now we let the Gui object perform its logic. case SDLK_PAGEDOWN:
uae_gui->logic(); case SDLK_HOME:
// Now we let the Gui object draw itself. event.key.keysym.sym = SDLK_RETURN;
uae_gui->draw(); gui_input->pushInput(event); // Fire key down
// Finally we update the screen. event.type = SDL_KEYUP; // and the key up
wait_for_vsync(); break;
SDL_Flip(gui_screen); }
} }
//-------------------------------------------------
// 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);
}
} }
bool SelectFolder(const char *title, char *value) bool SelectFolder(const char *title, char *value)
{ {
dialogResult = false; dialogResult = false;
dialogFinished = false; dialogFinished = false;
InitSelectFolder(title); InitSelectFolder(title);
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;
} }

File diff suppressed because it is too large Load diff

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;
@ -362,9 +368,10 @@ 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)

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