Merged SDL1 and SDL2 files in one project

This commit is contained in:
Dimitris Panokostas 2017-12-04 15:26:04 +01:00
parent d855153618
commit a37027576a
82 changed files with 9187 additions and 1001 deletions

File diff suppressed because it is too large Load diff

View file

@ -60,11 +60,12 @@ static void uae_abort (const TCHAR *format,...)
nomore = 1;
}
#define SPEEDUP_CYCLES_JIT 5000
#define SPEEDUP_CYCLES_JIT_PAL 5000
#define SPEEDUP_CYCLES_JIT_NTSC 4000
#define SPEEDUP_CYCLES_NONJIT 256
#define SPEEDUP_TIMELIMIT_JIT -750
#define SPEEDUP_TIMELIMIT_NONJIT -750
int pissoff_value = SPEEDUP_CYCLES_JIT * CYCLE_UNIT;
int pissoff_value = SPEEDUP_CYCLES_JIT_PAL * CYCLE_UNIT;
int speedup_timelimit = SPEEDUP_TIMELIMIT_JIT;
/* Events */
@ -339,18 +340,20 @@ STATIC_INLINE int ecsshres(void)
void set_speedup_values(void)
{
if(currprefs.m68k_speed < 0) {
if (currprefs.cachesize) {
pissoff_value = SPEEDUP_CYCLES_JIT * CYCLE_UNIT;
speedup_timelimit = SPEEDUP_TIMELIMIT_JIT;
} else {
pissoff_value = SPEEDUP_CYCLES_NONJIT * CYCLE_UNIT;
speedup_timelimit = SPEEDUP_TIMELIMIT_NONJIT;
}
} else {
pissoff_value = 0;
speedup_timelimit = 0;
}
if (currprefs.m68k_speed < 0) {
if (currprefs.cachesize) {
pissoff_value = ((vblank_hz > 55) ? SPEEDUP_CYCLES_JIT_NTSC : SPEEDUP_CYCLES_JIT_PAL) * CYCLE_UNIT;
speedup_timelimit = SPEEDUP_TIMELIMIT_JIT;
}
else {
pissoff_value = SPEEDUP_CYCLES_NONJIT * CYCLE_UNIT;
speedup_timelimit = SPEEDUP_TIMELIMIT_NONJIT;
}
}
else {
pissoff_value = 0;
speedup_timelimit = 0;
}
}
void reset_frame_rate_hack (void)
@ -3166,7 +3169,7 @@ static void compute_framesync (void)
lof_changing = 0;
if (beamcon0 & 0x80) {
gui_message(_T("Variable beam counter comparator enabled. Not supported in UAE4ARM."));
gui_message(_T("Variable beam counter comparator enabled. Not supported in Amiberry."));
}
memset (line_decisions, 0, sizeof line_decisions);
@ -5937,6 +5940,14 @@ static void hsync_handler_post (bool onvsync)
int lineno = vpos;
if (lineno >= MAXVPOS)
lineno %= MAXVPOS;
if (currprefs.gfx_vresolution) {
lineno *= 2;
if (interlace_seen) {
if (!lof_current) {
lineno++;
}
}
}
prev_lineno = next_lineno;
next_lineno = lineno;
reset_decisions ();

View file

@ -124,39 +124,39 @@ void reset_all_systems (void)
uae_int_requested = 0;
}
void do_leave_program (void)
void do_leave_program(void)
{
#ifdef JIT
compiler_exit();
compiler_exit();
#endif
graphics_leave ();
inputdevice_close ();
DISK_free ();
close_sound ();
dump_counts ();
graphics_leave();
inputdevice_close();
DISK_free();
close_sound();
dump_counts();
#ifdef CD32
akiko_free ();
akiko_free();
cd32_fmv_free();
#endif
gui_exit ();
#ifdef USE_SDL
SDL_Quit ();
gui_exit();
#if defined (USE_SDL1) || defined(USE_SDL2)
SDL_Quit();
#endif
hardfile_reset();
hardfile_reset();
#ifdef AUTOCONFIG
expansion_cleanup ();
expansion_cleanup();
#endif
#ifdef FILESYS
filesys_cleanup ();
filesys_cleanup();
#endif
#ifdef BSDSOCKET
bsdlib_reset ();
bsdlib_reset();
#endif
gayle_free ();
device_func_reset ();
memory_cleanup ();
cfgfile_addcfgparam (0);
machdep_free ();
gayle_free();
device_func_reset();
memory_cleanup();
cfgfile_addcfgparam(0);
machdep_free();
rtarea_free();
}

View file

@ -49,7 +49,7 @@
#include "audio.h"
#include "devices.h"
#define VERTICAL_OFFSET 18;
#define VERTICAL_OFFSET 18
#define RENDER_SIGNAL_PARTIAL 1
#define RENDER_SIGNAL_FRAME_DONE 2
@ -86,6 +86,8 @@ bool aga_mode; /* mirror of chipset_mask & CSMASK_AGA */
coordinates have a lower resolution (i.e. we're shrinking the image). */
static int res_shift;
static int linedbl;
int interlace_seen;
/* Lookup tables for dual playfields. The dblpf_*1 versions are for the case
@ -154,11 +156,10 @@ static uae_u16 ham_linebuf[MAX_PIXELS_PER_LINE * 2];
static uae_u8 *xlinebuffer;
#define MAX_VIDHEIGHT 270
static int *native2amiga_line_map;
static uae_u8 *row_map[MAX_VIDHEIGHT + 1];
static int *amiga2aspect_line_map, *native2amiga_line_map;
static uae_u8 **row_map;
static uae_u8 row_tmp[MAX_PIXELS_PER_LINE * 32 / 8];
static int max_drawn_amiga_line;
/* line_draw_funcs: pfield_do_linetoscr, pfield_do_fill_line, decode_ham */
typedef void (*line_draw_func)(int, int, bool);
@ -166,6 +167,7 @@ typedef void (*line_draw_func)(int, int, bool);
static bool screenlocked = false;
static int next_line_to_render = 0;
static int linestate_first_undecided = 0;
static bool nextline_as_previous = false;
uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
@ -174,7 +176,8 @@ uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
static int visible_left_border, visible_right_border;
static int linetoscr_x_adjust_pixbytes, linetoscr_x_adjust_pixels;
static int thisframe_y_adjust_real, max_ypos_thisframe;
static int thisframe_y_adjust;
static int thisframe_y_adjust_real, max_ypos_thisframe, min_ypos_for_screen;
#define MAX_STOP 30000
@ -222,7 +225,7 @@ int coord_native_to_amiga_x (int x)
int coord_native_to_amiga_y (int y)
{
return native2amiga_line_map[y];
return native2amiga_line_map[y] + thisframe_y_adjust - minfirstline;
}
STATIC_INLINE int res_shift_from_window (int x)
@ -1457,42 +1460,73 @@ static void pfield_doline (int lineno)
void init_row_map (void)
{
int i, j;
static uae_u8 *oldbufmem;
static int oldheight, oldpitch;
int i, j;
for (i = gfxvidinfo.drawbuffer.outheight; i < MAX_VIDHEIGHT + 1; i++)
row_map[i] = row_tmp;
for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.outheight; i++, j += gfxvidinfo.drawbuffer.rowbytes) {
if (!row_map) {
row_map = xmalloc(uae_u8*, max_uae_height + 1);
}
if (oldbufmem && oldbufmem == gfxvidinfo.drawbuffer.bufmem &&
oldheight == gfxvidinfo.drawbuffer.outheight &&
oldpitch == gfxvidinfo.drawbuffer.rowbytes)
return;
j = oldheight == 0 ? max_uae_height : oldheight;
for (i = gfxvidinfo.drawbuffer.outheight; i < max_uae_height + 1 && i < j + 1; i++) {
row_map[i] = row_tmp;
}
for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.outheight; i++, j += gfxvidinfo.drawbuffer.rowbytes) {
row_map[i] = gfxvidinfo.drawbuffer.bufmem + j;
}
}
oldbufmem = gfxvidinfo.drawbuffer.bufmem;
oldheight = gfxvidinfo.drawbuffer.outheight;
oldpitch = gfxvidinfo.drawbuffer.rowbytes;
}
static void init_aspect_maps (void)
{
int i, maxl, h;
h = gfxvidinfo.drawbuffer.outheight;
linedbl = currprefs.gfx_vresolution;
maxl = (MAXVPOS + 1) << linedbl;
min_ypos_for_screen = minfirstline << linedbl;
max_drawn_amiga_line = -1;
if (h == 0)
/* Do nothing if the gfx driver hasn't initialized the screen yet */
return;
h = gfxvidinfo.drawbuffer.outheight;
if (h == 0)
/* Do nothing if the gfx driver hasn't initialized the screen yet */
return;
if (native2amiga_line_map)
xfree (native2amiga_line_map);
if (native2amiga_line_map)
xfree(native2amiga_line_map);
if (amiga2aspect_line_map)
xfree(amiga2aspect_line_map);
native2amiga_line_map = xmalloc (int, h);
/* At least for this array the +1 is necessary. */
amiga2aspect_line_map = xmalloc(int, (MAXVPOS + 1) * 2 + 1);
native2amiga_line_map = xmalloc(int, h);
maxl = (MAXVPOS + 1);
for (i = 0; i < maxl; i++) {
int v = i - min_ypos_for_screen;
if (v >= h && max_drawn_amiga_line < 0)
max_drawn_amiga_line = v;
if (i < min_ypos_for_screen || v >= h)
v = -1;
amiga2aspect_line_map[i] = v;
}
if (max_drawn_amiga_line < 0)
max_drawn_amiga_line = maxl - min_ypos_for_screen;
for (i = 0; i < h; i++)
native2amiga_line_map[i] = -1;
for (i = 0; i < h; i++)
native2amiga_line_map[i] = -1;
for (i = maxl - 1; i >= minfirstline; i--) {
for (int j = i - minfirstline; j < h && native2amiga_line_map[j] == -1; j++)
#ifdef PANDORA
native2amiga_line_map[j] = i + currprefs.pandora_vertical_offset;
#else
native2amiga_line_map[j] = i;
#endif
for (i = maxl - 1; i >= min_ypos_for_screen; i--) {
int j;
if (amiga2aspect_line_map[i] == -1)
continue;
for (j = amiga2aspect_line_map[i]; j < h && native2amiga_line_map[j] == -1; j++)
native2amiga_line_map[j] = (i + VERTICAL_OFFSET) >> linedbl;
}
}
@ -1718,149 +1752,189 @@ STATIC_INLINE bool is_color_changes(struct draw_info *di)
return changes > 1 || (changes == 1 && regno != 0xffff && regno != -1);
}
static void pfield_draw_line (int lineno, int gfx_ypos)
static void pfield_draw_line(int lineno, int gfx_ypos, int follow_ypos)
{
int border = 0;
int do_double = 0;
bool have_color_changes;
dp_for_drawing = line_decisions + lineno;
dip_for_drawing = curr_drawinfo + lineno;
dp_for_drawing = line_decisions + lineno;
dip_for_drawing = curr_drawinfo + lineno;
if (currprefs.gfx_vresolution && !interlace_seen) {
if (nextline_as_previous) {
nextline_as_previous = false;
return;
}
nextline_as_previous = true;
if (follow_ypos >= 0)
do_double = 1;
}
if (dp_for_drawing->plfleft < 0)
border = 1;
have_color_changes = is_color_changes(dip_for_drawing);
xlinebuffer = row_map[gfx_ypos];
xlinebuffer = row_map[gfx_ypos];
xlinebuffer -= linetoscr_x_adjust_pixbytes;
if (border == 0) {
pfield_expand_dp_bplcon ();
pfield_init_linetoscr (false);
pfield_doline (lineno);
pfield_expand_dp_bplcon();
pfield_init_linetoscr(false);
pfield_doline(lineno);
adjust_drawing_colors (dp_for_drawing->ctable, dp_for_drawing->ham_seen || bplehb || ecsshres);
/* The problem is that we must call decode_ham() BEFORE we do the sprites. */
if (dp_for_drawing->ham_seen) {
adjust_drawing_colors(dp_for_drawing->ctable, dp_for_drawing->ham_seen || bplehb || ecsshres);
/* The problem is that we must call decode_ham() BEFORE we do the sprites. */
if (dp_for_drawing->ham_seen) {
int ohposblank = hposblank;
uae_u8 b0 = dp_for_drawing->bplcon0;
uae_u8 b2 = dp_for_drawing->bplcon2;
uae_u8 b3 = dp_for_drawing->bplcon3;
uae_u8 b4 = dp_for_drawing->bplcon4;
init_ham_decoding ();
do_color_changes (dummy_worker, decode_ham);
if (have_color_changes) {
init_ham_decoding();
do_color_changes(dummy_worker, decode_ham);
if (have_color_changes) {
// do_color_changes() did color changes and register changes, restore them.
adjust_drawing_colors (dp_for_drawing->ctable, -1);
adjust_drawing_colors(dp_for_drawing->ctable, -1);
dp_for_drawing->bplcon0 = b0;
dp_for_drawing->bplcon2 = b2;
dp_for_drawing->bplcon3 = b3;
dp_for_drawing->bplcon4 = b4;
pfield_expand_dp_bplcon ();
}
pfield_expand_dp_bplcon();
}
hposblank = ohposblank;
ham_decode_pixel = src_pixel;
bplham = dp_for_drawing->ham_at_start;
}
bplham = dp_for_drawing->ham_at_start;
}
if (dip_for_drawing->nr_sprites) {
int i;
if (ce_is_bordersprite(colors_for_drawing.extra) && dp_for_drawing->bordersprite_seen && !ce_is_borderblank(colors_for_drawing.extra))
clear_bitplane_border_aga ();
clear_bitplane_border_aga();
for (i = 0; i < dip_for_drawing->nr_sprites; i++) {
if (currprefs.chipset_mask & CSMASK_AGA)
draw_sprites_aga (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1);
draw_sprites_aga(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1);
else
draw_sprites_ecs (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i);
draw_sprites_ecs(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i);
}
}
if (dip_for_drawing->nr_sprites && ce_is_bordersprite(colors_for_drawing.extra) && !ce_is_borderblank(colors_for_drawing.extra) && dp_for_drawing->bordersprite_seen)
do_color_changes (pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_spr);
do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_spr);
else
do_color_changes (pfield_do_fill_line, dip_for_drawing->nr_sprites ? pfield_do_linetoscr_spr : pfield_do_linetoscr);
do_color_changes(pfield_do_fill_line, dip_for_drawing->nr_sprites ? pfield_do_linetoscr_spr : pfield_do_linetoscr);
if (do_double) {
memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.drawbuffer.pixbytes * gfxvidinfo.drawbuffer.outwidth);
}
if (dip_for_drawing->nr_sprites)
pfield_erase_hborder_sprites ();
pfield_erase_hborder_sprites();
} else { // border > 0: top or bottom border
}
else { // border > 0: top or bottom border
bool dosprites = false;
adjust_drawing_colors (dp_for_drawing->ctable, 0);
adjust_drawing_colors(dp_for_drawing->ctable, 0);
if (dp_for_drawing->bordersprite_seen && !ce_is_borderblank(colors_for_drawing.extra) && dip_for_drawing->nr_sprites) {
dosprites = true;
pfield_expand_dp_bplcon ();
pfield_init_linetoscr (true);
pfield_erase_vborder_sprites ();
pfield_expand_dp_bplcon();
pfield_init_linetoscr(true);
pfield_erase_vborder_sprites();
}
if (!dosprites && !have_color_changes) {
if (!dosprites && !have_color_changes) {
if (dp_for_drawing->plfleft < -1) {
// blanked border line
int tmp = hposblank;
hposblank = 1;
fill_line_border(lineno);
hposblank = tmp;
} else {
// normal border line
fill_line_border(lineno);
}
}
else {
// normal border line
fill_line_border(lineno);
}
if (do_double) {
xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_pixbytes;
fill_line_border(lineno);
}
return;
}
if (dosprites) {
for (int i = 0; i < dip_for_drawing->nr_sprites; i++)
draw_sprites_aga (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1);
do_color_changes (pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_bordersprite_aga);
draw_sprites_aga(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1);
do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_bordersprite_aga);
} else {
}
else {
playfield_start = visible_right_border;
playfield_end = visible_right_border;
do_color_changes(pfield_do_fill_line, pfield_do_fill_line);
}
if (do_double) {
memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.drawbuffer.pixbytes * gfxvidinfo.drawbuffer.outwidth);
}
}
}
static void center_image (void)
static void center_image(void)
{
int deltaToBorder;
deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320;
const int deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320;
visible_left_border = 73 - (deltaToBorder >> 1);
visible_right_border = 393 + (deltaToBorder >> 1);
visible_left_border <<= lores_shift;
visible_right_border <<= lores_shift;
visible_left_border <<= lores_shift;
visible_right_border <<= lores_shift;
linetoscr_x_adjust_pixels = visible_left_border;
linetoscr_x_adjust_pixels = visible_left_border;
linetoscr_x_adjust_pixbytes = linetoscr_x_adjust_pixels * gfxvidinfo.drawbuffer.pixbytes;
int max_drawn_amiga_line_tmp = max_drawn_amiga_line;
if (max_drawn_amiga_line_tmp > gfxvidinfo.drawbuffer.outheight)
max_drawn_amiga_line_tmp = gfxvidinfo.drawbuffer.outheight;
max_drawn_amiga_line_tmp >>= linedbl;
#ifdef PANDORA
thisframe_y_adjust_real = minfirstline + currprefs.pandora_vertical_offset;
thisframe_y_adjust = minfirstline + currprefs.pandora_vertical_offset;
#else
thisframe_y_adjust_real = minfirstline + VERTICAL_OFFSET;
thisframe_y_adjust = minfirstline + VERTICAL_OFFSET;
#endif
max_ypos_thisframe = (maxvpos_display - minfirstline);
/* Make sure the value makes sense */
if (thisframe_y_adjust + max_drawn_amiga_line_tmp > maxvpos + maxvpos / 2)
thisframe_y_adjust = maxvpos + maxvpos / 2 - max_drawn_amiga_line_tmp;
if (thisframe_y_adjust < 0)
thisframe_y_adjust = 0;
thisframe_y_adjust_real = thisframe_y_adjust << linedbl;
max_ypos_thisframe = (maxvpos_display - minfirstline + 1) << linedbl;
}
static void init_drawing_frame (void)
{
lores_reset();
init_hardware_for_drawing_frame ();
init_hardware_for_drawing_frame();
linestate_first_undecided = 0;
linestate_first_undecided = 0;
nextline_as_previous = false;
center_image ();
center_image();
drawing_color_matches = -1;
drawing_color_matches = -1;
}
static void draw_status_line (int line, int statusy)
@ -1875,21 +1949,28 @@ static void draw_status_line (int line, int statusy)
static void partial_draw_frame(void)
{
if (framecnt == 0) {
if(!screenlocked) {
if(!lockscr())
return;
screenlocked = true;
}
struct vidbuffer *vb = &gfxvidinfo.drawbuffer;
for (; next_line_to_render < max_ypos_thisframe && next_line_to_render < vb->outheight; ++next_line_to_render) {
int line = next_line_to_render + thisframe_y_adjust_real;
if(line >= linestate_first_undecided)
break;
hposblank = 0;
pfield_draw_line (line, next_line_to_render);
}
}
if (!screenlocked) {
if (!lockscr())
return;
screenlocked = true;
}
struct vidbuffer *vb = &gfxvidinfo.drawbuffer;
for (; next_line_to_render < max_ypos_thisframe; ++next_line_to_render) {
int i1 = next_line_to_render + min_ypos_for_screen;
int line = next_line_to_render + thisframe_y_adjust_real;
int whereline = amiga2aspect_line_map[i1];
int wherenext = amiga2aspect_line_map[i1 + 1];
if (whereline >= vb->outheight || line >= linestate_first_undecided)
break;
if (whereline < 0)
continue;
hposblank = 0;
pfield_draw_line(line, whereline, wherenext);
}
}
}
void halt_draw_frame(void)
@ -1905,36 +1986,42 @@ static void finish_drawing_frame (void)
int i;
struct vidbuffer *vb = &gfxvidinfo.drawbuffer;
if(!screenlocked) {
if(!lockscr())
return;
screenlocked = true;
}
for (i = next_line_to_render; i < max_ypos_thisframe && i < vb->outheight; i++) {
int line = i + thisframe_y_adjust_real;
if(line >= linestate_first_undecided)
break;
hposblank = 0;
pfield_draw_line (line, i);
if (!screenlocked) {
if (!lockscr())
return;
screenlocked = true;
}
for (i = next_line_to_render; i < max_ypos_thisframe; i++) {
int i1 = i + min_ypos_for_screen;
int line = i + thisframe_y_adjust_real;
int whereline = amiga2aspect_line_map[i1];
int wherenext = amiga2aspect_line_map[i1 + 1];
if (whereline >= vb->outheight || line >= linestate_first_undecided)
break;
if (whereline < 0)
continue;
hposblank = 0;
pfield_draw_line(line, whereline, wherenext);
}
if (currprefs.leds_on_screen) {
for (i = 0; i < TD_TOTAL_HEIGHT; i++) {
int line = gfxvidinfo.drawbuffer.outheight - TD_TOTAL_HEIGHT + i;
draw_status_line (line, i);
draw_status_line(line, i);
}
}
if (currprefs.cs_cd32fmv) {
if (cd32_fmv_active) {
cd32_fmv_genlock(vb, &gfxvidinfo.drawbuffer);
}
}
}
}
do_flush_screen ();
next_line_to_render = 0;
do_flush_screen();
next_line_to_render = 0;
}
void check_prefs_picasso(void)
@ -2013,19 +2100,24 @@ void vsync_handle_redraw (void)
gui_flicker_led (-1, 0, 0);
}
void hsync_record_line_state (int lineno)
void hsync_record_line_state(int lineno)
{
if (framecnt != 0)
return;
if (framecnt != 0)
return;
linestate_first_undecided = lineno + 1;
linestate_first_undecided = lineno + 1;
if(render_tid && !(linestate_first_undecided & 0x1f) && !render_thread_busy) {
write_comm_pipe_u32 (render_pipe, RENDER_SIGNAL_PARTIAL, 1);
}
if (render_tid && linestate_first_undecided > 3 && !render_thread_busy) {
if (currprefs.gfx_vresolution) {
if (!(linestate_first_undecided & 0x3e))
write_comm_pipe_u32(render_pipe, RENDER_SIGNAL_PARTIAL, 1);
}
else if (!(linestate_first_undecided & 0x1f))
write_comm_pipe_u32(render_pipe, RENDER_SIGNAL_PARTIAL, 1);
}
}
bool notice_interlace_seen (bool lace)
bool notice_interlace_seen(bool lace)
{
bool changed = false;
// non-lace to lace switch (non-lace active at least one frame)?
@ -2033,8 +2125,9 @@ bool notice_interlace_seen (bool lace)
if (interlace_seen == 0) {
changed = true;
}
interlace_seen = -1;
} else {
interlace_seen = currprefs.gfx_vresolution ? 1 : -1;
}
else {
if (interlace_seen) {
changed = true;
}
@ -2043,20 +2136,21 @@ bool notice_interlace_seen (bool lace)
return changed;
}
void reset_drawing (void)
void reset_drawing(void)
{
lores_reset ();
lores_reset();
linestate_first_undecided = 0;
init_aspect_maps ();
linestate_first_undecided = 0;
nextline_as_previous = false;
init_row_map();
init_aspect_maps();
memset(spixels, 0, sizeof spixels);
memset(&spixstate, 0, sizeof spixstate);
init_row_map();
init_drawing_frame ();
memset(spixels, 0, sizeof spixels);
memset(&spixstate, 0, sizeof spixstate);
init_drawing_frame();
pfield_set_linetoscr();
}

View file

@ -85,7 +85,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino)
| (S_IWUSR & statbuf.st_mode ? 0 : A_FIBF_WRITE)
| (S_IRUSR & statbuf.st_mode ? 0 : A_FIBF_READ));
#if defined(WIN32) || defined(ANDROIDSDL) || defined(AMIBERRY)
#if defined(WIN32) || defined(AMIBERRY)
// Always give execute & read permission
// Temporary do this for raspberry...
aino->amigaos_mode &= ~A_FIBF_EXECUTE;

View file

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

View file

@ -91,7 +91,7 @@ typedef enum {
NUMSG_KICKREPNO,
NUMSG_KS68030PLUS,
NUMSG_NOMEMORY,
NUMSG_LAST
NUMSG_LAST // 20
} notify_user_msg;
#endif /* UAE_GUI_H */

View file

@ -7,6 +7,16 @@
*/
#pragma once
#ifdef USE_SDL1
#define KEYCODE_UNK 0
#define KEYCODE_X11 1
#define KEYCODE_FBCON 2
extern char keyboard_type;
extern void init_keyboard(void);
#endif
/* First, two dummies */
#define AK_mousestuff 0x100
#define AK_inhibit 0x101

View file

@ -314,6 +314,7 @@ struct uae_prefs {
struct wh gfx_size;
struct apmode gfx_apmode[2];
int gfx_resolution;
int gfx_vresolution;
bool immediate_blits;
int waiting_blits;
@ -408,7 +409,16 @@ struct uae_prefs {
int kbd_led_num;
int kbd_led_scr;
int kbd_led_cap;
#ifdef USE_SDL1
int gfx_correct_aspect;
int gfx_fullscreen_ratio;
#endif
#ifdef USE_SDL2
int scaling_method;
#endif
bool customControls;
TCHAR custom_up[256];
TCHAR custom_down[256];
@ -421,6 +431,7 @@ struct uae_prefs {
TCHAR custom_l[256];
TCHAR custom_r[256];
TCHAR custom_play[256];
TCHAR open_gui[256];
TCHAR quit_amiberry[256];
#endif

View file

@ -438,7 +438,7 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {
# endif
# else
/* Else, if using SDL, try SDL's endian functions. */
# ifdef USE_SDL
# if defined (USE_SDL1) || defined (USE_SDL2)
# include <SDL_endian.h>
# define bswap_16(x) SDL_Swap16(x)
# define bswap_32(x) SDL_Swap32(x)
@ -448,7 +448,8 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {
#define bswap_32(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((x) >> 24))
# endif
#endif
#endif
#endif /* ARMV6_ASSEMBLY*/
#ifndef __cplusplus

View file

@ -5548,34 +5548,36 @@ int inputdevice_config_change_test (void)
}
// copy configuration #src to configuration #dst
void inputdevice_copyconfig (struct uae_prefs *src, struct uae_prefs *dst)
void inputdevice_copyconfig(struct uae_prefs *src, struct uae_prefs *dst)
{
dst->input_selected_setting = src->input_selected_setting;
dst->input_joymouse_multiplier = src->input_joymouse_multiplier;
dst->input_joymouse_multiplier = src->input_joymouse_multiplier;
dst->input_joymouse_deadzone = src->input_joymouse_deadzone;
dst->input_joystick_deadzone = src->input_joystick_deadzone;
dst->input_joymouse_speed = src->input_joymouse_speed;
dst->input_mouse_speed = src->input_mouse_speed;
dst->input_autofire_linecnt = src->input_autofire_linecnt;
strcpy(dst->open_gui,src->open_gui);
strcpy(dst->quit_amiberry,src->quit_amiberry);
dst->amiberry_use_retroarch_quit = src->amiberry_use_retroarch_quit;
dst->amiberry_use_retroarch_menu = src->amiberry_use_retroarch_menu;
dst->amiberry_use_retroarch_reset = src->amiberry_use_retroarch_reset;
dst->input_autofire_linecnt = src->input_autofire_linecnt;
#ifdef AMIBERRY
strcpy(dst->open_gui, src->open_gui);
strcpy(dst->quit_amiberry, src->quit_amiberry);
dst->amiberry_use_retroarch_quit = src->amiberry_use_retroarch_quit;
dst->amiberry_use_retroarch_menu = src->amiberry_use_retroarch_menu;
dst->amiberry_use_retroarch_reset = src->amiberry_use_retroarch_reset;
#endif
for (int i = 0; i < MAX_JPORTS; i++) {
copyjport (src, dst, i);
copyjport(src, dst, i);
}
for (int i = 0; i < MAX_INPUT_SETTINGS; i++) {
for (int j = 0; j < MAX_INPUT_DEVICES; j++) {
memcpy (&dst->joystick_settings[i][j], &src->joystick_settings[i][j], sizeof (struct uae_input_device));
memcpy (&dst->mouse_settings[i][j], &src->mouse_settings[i][j], sizeof (struct uae_input_device));
memcpy (&dst->keyboard_settings[i][j], &src->keyboard_settings[i][j], sizeof (struct uae_input_device));
memcpy(&dst->joystick_settings[i][j], &src->joystick_settings[i][j], sizeof(struct uae_input_device));
memcpy(&dst->mouse_settings[i][j], &src->mouse_settings[i][j], sizeof(struct uae_input_device));
memcpy(&dst->keyboard_settings[i][j], &src->keyboard_settings[i][j], sizeof(struct uae_input_device));
}
}
inputdevice_updateconfig (src, dst);
inputdevice_updateconfig(src, dst);
}
static void swapevent (struct uae_input_device *uid, int i, int j, int evt)

View file

@ -34,7 +34,11 @@
#include "devices.h"
#include "jit/compemu.h"
#ifdef USE_SDL
#ifdef USE_SDL1
#include "SDL.h"
#endif
#ifdef USE_SDL2
#include "SDL.h"
#include <iostream>
#include "amiberry_gfx.h"
@ -495,7 +499,7 @@ void print_usage()
printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
printf("File names should be with absolute path.\n");
printf("\nExample:\n");
printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("amiberry -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("It will load A500.uae configuration with the save state named game.\n");
printf("It will override use_gui to 'no' so that it enters emulation directly.\n");
exit(1);
@ -653,6 +657,7 @@ void leave_program (void)
do_leave_program ();
}
#ifdef USE_SDL2
// In case of error, print the error code and close the application
void check_error_sdl(bool check, const char* message) {
if (check) {
@ -671,13 +676,13 @@ static void initialize_sdl2()
}
sdlWindow = SDL_CreateWindow("Amiberry-SDL2 v2",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0,
0,
SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
0,
0,
SDL_WINDOW_FULLSCREEN_DESKTOP);
check_error_sdl(sdlWindow == nullptr, "Unable to create window");
renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
check_error_sdl(renderer == nullptr, "Unable to create a renderer");
@ -685,16 +690,33 @@ static void initialize_sdl2()
{
SDL_Log("Could not get information about SDL Mode! SDL_Error: %s\n", SDL_GetError());
}
if (SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1") != SDL_TRUE)
SDL_Log("SDL could not grab the keyboard");
SDL_ShowCursor(SDL_DISABLE);
}
#endif
static int real_main2 (int argc, TCHAR **argv)
{
#ifdef USE_SDL1
int ret;
#ifdef PANDORA
ret = SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO);
#else
ret = SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
#endif
if (ret < 0)
{
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
abort();
};
#endif
#ifdef USE_SDL2
initialize_sdl2();
#endif
keyboard_settrans();
set_config_changed();
if (restart_config[0]) {
@ -730,7 +752,7 @@ static int real_main2 (int argc, TCHAR **argv)
no_gui = false;
restart_program = 0;
if (!no_gui) {
int err = gui_init();
const int err = gui_init();
currprefs = changed_prefs;
set_config_changed();
if (err == -1) {
@ -743,9 +765,7 @@ static int real_main2 (int argc, TCHAR **argv)
}
else
{
#ifdef PANDORA
setCpuSpeed();
#endif
update_display(&currprefs);
}
memset(&gui_data, 0, sizeof gui_data);

View file

@ -33,7 +33,9 @@
#include "zfile.h"
#include "gfxboard.h"
#include <SDL.h>
#ifdef USE_SDL2
#include <map>
#endif
#include "amiberry_rp9.h"
#ifdef WITH_LOGGING
@ -56,7 +58,13 @@ static int doStylusRightClick;
extern void SetLastActiveConfig(const char* filename);
/* Keyboard */
std::map<int, TCHAR[256]> customControlMap; // No SDLK_LAST. SDL2 migration guide suggests std::map
#ifdef USE_SDL1
int customControlMap[SDLK_LAST];
#endif
#ifdef USE_SDL2
std::map<int, TCHAR[256]> customControlMap; // No SDLK_LAST. SDL2 migration guide suggests std::map
#endif
char start_path_data[MAX_DPATH];
char currentDir[MAX_DPATH];
@ -163,7 +171,7 @@ void getfilepart(TCHAR *out, int size, const TCHAR *path)
uae_u8 *target_load_keyfile(struct uae_prefs *p, const char *path, int *sizep, char *name)
{
return 0;
return nullptr;
}
void target_run(void)
@ -240,6 +248,9 @@ void target_fixup_options(struct uae_prefs* p)
void target_default_options(struct uae_prefs* p, int type)
{
#ifdef PANDORA
p->gfx_size.width = 320;
p->gfx_size.height = 240;
p->gfx_resolution = RES_LORES;
p->pandora_vertical_offset = OFFSET_Y_ADJUST;
p->pandora_cpu_speed = defaultCpuSpeed;
p->pandora_hide_idle_led = 0;
@ -269,7 +280,16 @@ void target_default_options(struct uae_prefs* p, int type)
p->kbd_led_num = -1; // No status on numlock
p->kbd_led_scr = -1; // No status on scrollock
#ifdef USE_SDL1
p->gfx_correct_aspect = 1;
p->gfx_fullscreen_ratio = 100;
#endif
#ifdef USE_SDL2
p->scaling_method = -1; //Default is Auto
#endif
_tcscpy(p->open_gui, "F12");
_tcscpy(p->quit_amiberry, "");
@ -310,6 +330,10 @@ void target_default_options(struct uae_prefs* p, int type)
p->disableMenuVKeyb = 0;
#endif
#ifdef USE_SDL1
memset(customControlMap, 0, sizeof(customControlMap));
#endif
p->cr[CHIPSET_REFRESH_PAL].locked = true;
p->cr[CHIPSET_REFRESH_PAL].vsync = 1;
@ -332,14 +356,24 @@ void target_default_options(struct uae_prefs* p, int type)
void target_save_options(struct zfile* f, struct uae_prefs* p)
{
#ifdef PANDORA
cfgfile_write (f, "pandora.cpu_speed", "%d", p->pandora_cpu_speed);
cfgfile_write (f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led);
cfgfile_write (f, "pandora.tap_delay", "%d", p->pandora_tapDelay);
cfgfile_write (f, "pandora.move_y", "%d", p->pandora_vertical_offset - OFFSET_Y_ADJUST);
cfgfile_write(f, "pandora.cpu_speed", "%d", p->pandora_cpu_speed);
cfgfile_write(f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led);
cfgfile_write(f, "pandora.tap_delay", "%d", p->pandora_tapDelay);
cfgfile_write(f, "pandora.move_y", "%d", p->pandora_vertical_offset - OFFSET_Y_ADJUST);
#endif //PANDORA
#ifdef USE_SDL1
cfgfile_write(f, _T("gfx_correct_aspect"), _T("%d"), p->gfx_correct_aspect);
cfgfile_write(f, _T("gfx_fullscreen_ratio"), _T("%d"), p->gfx_fullscreen_ratio);
#endif
cfgfile_write(f, _T("amiberry.kbd_led_num"), _T("%d"), p->kbd_led_num);
cfgfile_write(f, _T("amiberry.kbd_led_scr"), _T("%d"), p->kbd_led_scr);
#ifdef USE_SDL2
cfgfile_write(f, _T("amiberry.scaling_method"), _T("%d"), p->scaling_method);
#endif
cfgfile_write_str(f, _T("amiberry.open_gui"), p->open_gui);
cfgfile_write_str(f, _T("amiberry.quit_amiberry"), p->quit_amiberry);
@ -359,35 +393,36 @@ void target_save_options(struct zfile* f, struct uae_prefs* p)
cfgfile_write(f, "amiberry.custom_l", "%d", p->custom_l);
cfgfile_write(f, "amiberry.custom_r", "%d", p->custom_r);
cfgfile_write(f, "amiberry.custom_play", "%d", p->custom_play);
#ifdef ANDROIDSDL
cfgfile_write (f, "pandora.onscreen", "%d", p->onScreen);
cfgfile_write (f, "pandora.onscreen_textinput", "%d", p->onScreen_textinput);
cfgfile_write (f, "pandora.onscreen_dpad", "%d", p->onScreen_dpad);
cfgfile_write (f, "pandora.onscreen_button1", "%d", p->onScreen_button1);
cfgfile_write (f, "pandora.onscreen_button2", "%d", p->onScreen_button2);
cfgfile_write (f, "pandora.onscreen_button3", "%d", p->onScreen_button3);
cfgfile_write (f, "pandora.onscreen_button4", "%d", p->onScreen_button4);
cfgfile_write (f, "pandora.onscreen_button5", "%d", p->onScreen_button5);
cfgfile_write (f, "pandora.onscreen_button6", "%d", p->onScreen_button6);
cfgfile_write (f, "pandora.custom_position", "%d", p->custom_position);
cfgfile_write (f, "pandora.pos_x_textinput", "%d", p->pos_x_textinput);
cfgfile_write (f, "pandora.pos_y_textinput", "%d", p->pos_y_textinput);
cfgfile_write (f, "pandora.pos_x_dpad", "%d", p->pos_x_dpad);
cfgfile_write (f, "pandora.pos_y_dpad", "%d", p->pos_y_dpad);
cfgfile_write (f, "pandora.pos_x_button1", "%d", p->pos_x_button1);
cfgfile_write (f, "pandora.pos_y_button1", "%d", p->pos_y_button1);
cfgfile_write (f, "pandora.pos_x_button2", "%d", p->pos_x_button2);
cfgfile_write (f, "pandora.pos_y_button2", "%d", p->pos_y_button2);
cfgfile_write (f, "pandora.pos_x_button3", "%d", p->pos_x_button3);
cfgfile_write (f, "pandora.pos_y_button3", "%d", p->pos_y_button3);
cfgfile_write (f, "pandora.pos_x_button4", "%d", p->pos_x_button4);
cfgfile_write (f, "pandora.pos_y_button4", "%d", p->pos_y_button4);
cfgfile_write (f, "pandora.pos_x_button5", "%d", p->pos_x_button5);
cfgfile_write (f, "pandora.pos_y_button5", "%d", p->pos_y_button5);
cfgfile_write (f, "pandora.pos_x_button6", "%d", p->pos_x_button6);
cfgfile_write (f, "pandora.pos_y_button6", "%d", p->pos_y_button6);
cfgfile_write (f, "pandora.floating_joystick", "%d", p->floatingJoystick);
cfgfile_write (f, "pandora.disable_menu_vkeyb", "%d", p->disableMenuVKeyb);
cfgfile_write(f, "pandora.onscreen", "%d", p->onScreen);
cfgfile_write(f, "pandora.onscreen_textinput", "%d", p->onScreen_textinput);
cfgfile_write(f, "pandora.onscreen_dpad", "%d", p->onScreen_dpad);
cfgfile_write(f, "pandora.onscreen_button1", "%d", p->onScreen_button1);
cfgfile_write(f, "pandora.onscreen_button2", "%d", p->onScreen_button2);
cfgfile_write(f, "pandora.onscreen_button3", "%d", p->onScreen_button3);
cfgfile_write(f, "pandora.onscreen_button4", "%d", p->onScreen_button4);
cfgfile_write(f, "pandora.onscreen_button5", "%d", p->onScreen_button5);
cfgfile_write(f, "pandora.onscreen_button6", "%d", p->onScreen_button6);
cfgfile_write(f, "pandora.custom_position", "%d", p->custom_position);
cfgfile_write(f, "pandora.pos_x_textinput", "%d", p->pos_x_textinput);
cfgfile_write(f, "pandora.pos_y_textinput", "%d", p->pos_y_textinput);
cfgfile_write(f, "pandora.pos_x_dpad", "%d", p->pos_x_dpad);
cfgfile_write(f, "pandora.pos_y_dpad", "%d", p->pos_y_dpad);
cfgfile_write(f, "pandora.pos_x_button1", "%d", p->pos_x_button1);
cfgfile_write(f, "pandora.pos_y_button1", "%d", p->pos_y_button1);
cfgfile_write(f, "pandora.pos_x_button2", "%d", p->pos_x_button2);
cfgfile_write(f, "pandora.pos_y_button2", "%d", p->pos_y_button2);
cfgfile_write(f, "pandora.pos_x_button3", "%d", p->pos_x_button3);
cfgfile_write(f, "pandora.pos_y_button3", "%d", p->pos_y_button3);
cfgfile_write(f, "pandora.pos_x_button4", "%d", p->pos_x_button4);
cfgfile_write(f, "pandora.pos_y_button4", "%d", p->pos_y_button4);
cfgfile_write(f, "pandora.pos_x_button5", "%d", p->pos_x_button5);
cfgfile_write(f, "pandora.pos_y_button5", "%d", p->pos_y_button5);
cfgfile_write(f, "pandora.pos_x_button6", "%d", p->pos_x_button6);
cfgfile_write(f, "pandora.pos_y_button6", "%d", p->pos_y_button6);
cfgfile_write(f, "pandora.floating_joystick", "%d", p->floatingJoystick);
cfgfile_write(f, "pandora.disable_menu_vkeyb", "%d", p->disableMenuVKeyb);
#endif
}
@ -399,7 +434,8 @@ void target_restart(void)
TCHAR *target_expand_environment(const TCHAR *path, TCHAR *out, int maxlen)
{
if (out == NULL) {
if (out == nullptr)
{
return strdup(path);
}
_tcscpy(out, path);
@ -420,43 +456,42 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
return 1;
}
#endif //PANDORA
#ifdef ANDROIDSDL
|| cfgfile_intval (option, value, "onscreen", &p->onScreen, 1)
|| cfgfile_intval (option, value, "onscreen_textinput", &p->onScreen_textinput, 1)
|| cfgfile_intval (option, value, "onscreen_dpad", &p->onScreen_dpad, 1)
|| cfgfile_intval (option, value, "onscreen_button1", &p->onScreen_button1, 1)
|| cfgfile_intval (option, value, "onscreen_button2", &p->onScreen_button2, 1)
|| cfgfile_intval (option, value, "onscreen_button3", &p->onScreen_button3, 1)
|| cfgfile_intval (option, value, "onscreen_button4", &p->onScreen_button4, 1)
|| cfgfile_intval (option, value, "onscreen_button5", &p->onScreen_button5, 1)
|| cfgfile_intval (option, value, "onscreen_button6", &p->onScreen_button6, 1)
|| cfgfile_intval (option, value, "custom_position", &p->custom_position, 1)
|| cfgfile_intval (option, value, "pos_x_textinput", &p->pos_x_textinput, 1)
|| cfgfile_intval (option, value, "pos_y_textinput", &p->pos_y_textinput, 1)
|| cfgfile_intval (option, value, "pos_x_dpad", &p->pos_x_dpad, 1)
|| cfgfile_intval (option, value, "pos_y_dpad", &p->pos_y_dpad, 1)
|| cfgfile_intval (option, value, "pos_x_button1", &p->pos_x_button1, 1)
|| cfgfile_intval (option, value, "pos_y_button1", &p->pos_y_button1, 1)
|| cfgfile_intval (option, value, "pos_x_button2", &p->pos_x_button2, 1)
|| cfgfile_intval (option, value, "pos_y_button2", &p->pos_y_button2, 1)
|| cfgfile_intval (option, value, "pos_x_button3", &p->pos_x_button3, 1)
|| cfgfile_intval (option, value, "pos_y_button3", &p->pos_y_button3, 1)
|| cfgfile_intval (option, value, "pos_x_button4", &p->pos_x_button4, 1)
|| cfgfile_intval (option, value, "pos_y_button4", &p->pos_y_button4, 1)
|| cfgfile_intval (option, value, "pos_x_button5", &p->pos_x_button5, 1)
|| cfgfile_intval (option, value, "pos_y_button5", &p->pos_y_button5, 1)
|| cfgfile_intval (option, value, "pos_x_button6", &p->pos_x_button6, 1)
|| cfgfile_intval (option, value, "pos_y_button6", &p->pos_y_button6, 1)
|| cfgfile_intval (option, value, "floating_joystick", &p->floatingJoystick, 1)
|| cfgfile_intval (option, value, "disable_menu_vkeyb", &p->disableMenuVKeyb, 1)
|| cfgfile_intval(option, value, "onscreen", &p->onScreen, 1)
|| cfgfile_intval(option, value, "onscreen_textinput", &p->onScreen_textinput, 1)
|| cfgfile_intval(option, value, "onscreen_dpad", &p->onScreen_dpad, 1)
|| cfgfile_intval(option, value, "onscreen_button1", &p->onScreen_button1, 1)
|| cfgfile_intval(option, value, "onscreen_button2", &p->onScreen_button2, 1)
|| cfgfile_intval(option, value, "onscreen_button3", &p->onScreen_button3, 1)
|| cfgfile_intval(option, value, "onscreen_button4", &p->onScreen_button4, 1)
|| cfgfile_intval(option, value, "onscreen_button5", &p->onScreen_button5, 1)
|| cfgfile_intval(option, value, "onscreen_button6", &p->onScreen_button6, 1)
|| cfgfile_intval(option, value, "custom_position", &p->custom_position, 1)
|| cfgfile_intval(option, value, "pos_x_textinput", &p->pos_x_textinput, 1)
|| cfgfile_intval(option, value, "pos_y_textinput", &p->pos_y_textinput, 1)
|| cfgfile_intval(option, value, "pos_x_dpad", &p->pos_x_dpad, 1)
|| cfgfile_intval(option, value, "pos_y_dpad", &p->pos_y_dpad, 1)
|| cfgfile_intval(option, value, "pos_x_button1", &p->pos_x_button1, 1)
|| cfgfile_intval(option, value, "pos_y_button1", &p->pos_y_button1, 1)
|| cfgfile_intval(option, value, "pos_x_button2", &p->pos_x_button2, 1)
|| cfgfile_intval(option, value, "pos_y_button2", &p->pos_y_button2, 1)
|| cfgfile_intval(option, value, "pos_x_button3", &p->pos_x_button3, 1)
|| cfgfile_intval(option, value, "pos_y_button3", &p->pos_y_button3, 1)
|| cfgfile_intval(option, value, "pos_x_button4", &p->pos_x_button4, 1)
|| cfgfile_intval(option, value, "pos_y_button4", &p->pos_y_button4, 1)
|| cfgfile_intval(option, value, "pos_x_button5", &p->pos_x_button5, 1)
|| cfgfile_intval(option, value, "pos_y_button5", &p->pos_y_button5, 1)
|| cfgfile_intval(option, value, "pos_x_button6", &p->pos_x_button6, 1)
|| cfgfile_intval(option, value, "pos_y_button6", &p->pos_y_button6, 1)
|| cfgfile_intval(option, value, "floating_joystick", &p->floatingJoystick, 1)
|| cfgfile_intval(option, value, "disable_menu_vkeyb", &p->disableMenuVKeyb, 1)
#endif
if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_quit"), &p->amiberry_use_retroarch_quit))
return 1;
if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_menu"), &p->amiberry_use_retroarch_menu))
return 1;
if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_reset"), &p->amiberry_use_retroarch_reset))
return 1;
@ -464,8 +499,19 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
return 1;
if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1))
return 1;
#ifdef USE_SDL1
if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1))
return 1;
if (cfgfile_intval(option, value, "gfx_fullscreen_ratio", &p->gfx_fullscreen_ratio, 1))
return 1;
#endif
#ifdef USE_SDL2
if (cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1))
return 1;
#endif
if (cfgfile_string(option, value, "open_gui", p->open_gui, sizeof p->open_gui))
return 1;
if (cfgfile_string(option, value, "quit_amiberry", p->quit_amiberry, sizeof p->quit_amiberry))
@ -517,7 +563,7 @@ void fetch_configurationpath(char *out, int size)
void set_configurationpath(char *newpath)
{
strcpy(config_path, newpath);
strncpy(config_path, newpath, MAX_DPATH);
}
void fetch_controllerspath(char* out, int size)
@ -548,7 +594,7 @@ void fetch_rompath(char* out, int size)
void set_rompath(char *newpath)
{
strcpy(rom_path, newpath);
strncpy(rom_path, newpath, MAX_DPATH);
}
@ -590,7 +636,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
else
{
ptr = strstr((char *)filename, ".uae");
if (ptr > 0)
if (ptr > nullptr)
{
int type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST;
result = cfgfile_load(p, filename, &type, 0, 1);
@ -603,7 +649,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
{
for (i = 0; i < p->nr_floppies; ++i)
{
if (!DISK_validate_filename(p, p->floppyslots[i].df, 0, NULL, NULL, NULL))
if (!DISK_validate_filename(p, p->floppyslots[i].df, 0, nullptr, nullptr, nullptr))
p->floppyslots[i].df[0] = 0;
disk_insert(i, p->floppyslots[i].df);
if (strlen(p->floppyslots[i].df) > 0)
@ -611,7 +657,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
}
if (!isdefault)
inputdevice_updateconfig(NULL, p);
inputdevice_updateconfig(nullptr, p);
#ifdef WITH_LOGGING
p->leds_on_screen = true;
#endif
@ -632,12 +678,12 @@ int check_configfile(char *file)
return 1;
}
strcpy(tmp, file);
char *ptr = strstr(tmp, ".uae");
if (ptr > 0)
strncpy(tmp, file, MAX_PATH);
char* ptr = strstr(tmp, ".uae");
if (ptr > nullptr)
{
*(ptr + 1) = '\0';
strcat(tmp, "conf");
strncat(tmp, "conf", MAX_PATH);
f = fopen(tmp, "rt");
if (f)
{
@ -654,13 +700,13 @@ void extractFileName(const char * str, char *buffer)
while (*p != '/' && p > str)
p--;
p++;
strcpy(buffer, p);
strncpy(buffer, p, MAX_PATH);
}
void extractPath(char *str, char *buffer)
{
strcpy(buffer, str);
char *p = buffer + strlen(buffer) - 1;
strncpy(buffer, str, MAX_PATH);
char* p = buffer + strlen(buffer) - 1;
while (*p != '/' && p > buffer)
p--;
p[1] = '\0';
@ -679,36 +725,35 @@ void removeFileExtension(char *filename)
void ReadDirectory(const char *path, std::vector<std::string> *dirs, std::vector<std::string> *files)
{
DIR *dir;
struct dirent *dent;
if (dirs != NULL)
if (dirs != nullptr)
dirs->clear();
if (files != NULL)
if (files != nullptr)
files->clear();
dir = opendir(path);
if (dir != NULL)
DIR * dir = opendir(path);
if (dir != nullptr)
{
while ((dent = readdir(dir)) != NULL)
while ((dent = readdir(dir)) != nullptr)
{
if (dent->d_type == DT_DIR)
{
if (dirs != NULL)
if (dirs != nullptr)
dirs->push_back(dent->d_name);
}
else if (files != NULL)
else if (files != nullptr)
files->push_back(dent->d_name);
}
if (dirs != NULL && dirs->size() > 0 && (*dirs)[0] == ".")
if (dirs != nullptr && dirs->size() > 0 && (*dirs)[0] == ".")
dirs->erase(dirs->begin());
closedir(dir);
}
if (dirs != NULL)
std::sort(dirs->begin(), dirs->end());
if (files != NULL)
std::sort(files->begin(), files->end());
if (dirs != nullptr)
sort(dirs->begin(), dirs->end());
if (files != nullptr)
sort(files->begin(), files->end());
}
void saveAdfDir(void)
@ -830,7 +875,8 @@ void loadAdfDir(void)
char romPath[MAX_PATH] = { '\0' };
char tmpFile[MAX_PATH];
while (zfile_fgetsa(linea, sizeof(linea), fh) != 0) {
while (zfile_fgetsa(linea, sizeof (linea), fh) != nullptr)
{
trimwsa(linea);
if (strlen(linea) > 0) {
if (!cfgfile_separate_linea(path, linea, option, value))
@ -850,16 +896,20 @@ void loadAdfDir(void)
romType = -1;
}
}
else if (cfgfile_string(option, value, "Diskfile", tmpFile, sizeof(tmpFile))) {
FILE *f = fopen(tmpFile, "rb");
if (f != NULL) {
else if (cfgfile_string(option, value, "Diskfile", tmpFile, sizeof(tmpFile)))
{
FILE* f = fopen(tmpFile, "rb");
if (f != nullptr)
{
fclose(f);
lstMRUDiskList.push_back(tmpFile);
}
}
else if (cfgfile_string(option, value, "CDfile", tmpFile, sizeof(tmpFile))) {
FILE *f = fopen(tmpFile, "rb");
if (f != NULL) {
else if (cfgfile_string(option, value, "CDfile", tmpFile, sizeof(tmpFile)))
{
FILE* f = fopen(tmpFile, "rb");
if (f != nullptr)
{
fclose(f);
lstMRUCDList.push_back(tmpFile);
}
@ -1006,7 +1056,7 @@ int main(int argc, char* argv[])
struct sigaction action;
#ifdef AMIBERRY
printf("Amiberry-SDL2 v2.55, by Dimitris (MiDWaN) Panokostas, Dom (Horace&TheSpider) Cresswell and TomB\n");
printf("Amiberry v2.6, by Dimitris (MiDWaN) Panokostas, Dom (Horace&TheSpider) Cresswell and TomB\n");
#endif
max_uae_width = 1920;
max_uae_height = 1080;
@ -1038,7 +1088,7 @@ int main(int argc, char* argv[])
memset(&action, 0, sizeof(action));
action.sa_sigaction = signal_buserror;
action.sa_flags = SA_SIGINFO;
if (sigaction(SIGBUS, &action, NULL) < 0)
if (sigaction(SIGBUS, &action, nullptr) < 0)
{
printf("Failed to set signal handler (SIGBUS).\n");
abort();
@ -1047,7 +1097,7 @@ int main(int argc, char* argv[])
memset(&action, 0, sizeof(action));
action.sa_sigaction = signal_term;
action.sa_flags = SA_SIGINFO;
if (sigaction(SIGTERM, &action, NULL) < 0)
if (sigaction(SIGTERM, &action, nullptr) < 0)
{
printf("Failed to set signal handler (SIGTERM).\n");
abort();
@ -1077,7 +1127,7 @@ int main(int argc, char* argv[])
real_main(argc, argv);
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
// restore keyboard LEDs to normal state
ioctl(0, KDSETLED, 0xFF);
#endif
@ -1117,11 +1167,11 @@ int handle_msgpump()
int got = 0;
SDL_Event rEvent;
int keycode;
if(delayed_mousebutton) {
--delayed_mousebutton;
if(delayed_mousebutton == 0)
setmousebuttonstate (0, 0, 1);
}
if (delayed_mousebutton) {
--delayed_mousebutton;
if (delayed_mousebutton == 0)
setmousebuttonstate(0, 0, 1);
}
if (currprefs.customControls)
PopulateCustomControlMap();
@ -1129,7 +1179,13 @@ int handle_msgpump()
while (SDL_PollEvent(&rEvent))
{
got = 1;
#ifdef USE_SDL1
Uint8* keystate = SDL_GetKeyState(nullptr);
#endif
#ifdef USE_SDL2
const Uint8* keystate = SDL_GetKeyboardState(nullptr);
#endif
switch (rEvent.type)
{
@ -1137,7 +1193,7 @@ int handle_msgpump()
uae_quit();
break;
//case SDL_JOYBUTTONDOWN:
//case SDL_JOYBUTTONDOWN:
// if (currprefs.button_for_menu != -1 && rEvent.jbutton.button == currprefs.button_for_menu)
// inputdevice_add_inputcode(AKS_ENTERGUI, 1);
// if (currprefs.button_for_quit != -1 && rEvent.jbutton.button == currprefs.button_for_quit)
@ -1145,11 +1201,35 @@ int handle_msgpump()
// break;
case SDL_KEYDOWN:
#ifdef USE_SDL1
// Strangely in FBCON left window is seen as left alt ??
if (keyboard_type == 2) // KEYCODE_FBCON
{
if (keystate[SDLK_LCTRL] && (keystate[SDLK_LSUPER] || keystate[SDLK_LALT]) && (keystate[SDLK_RSUPER] || keystate[
SDLK_MENU]))
#endif
#ifdef USE_SDL2
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_APPLICATION]))
#endif
{
uae_reset(0, 1);
break;
}
#ifdef USE_SDL1
}
else
{
if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU]))
{
uae_reset(0, 1);
break;
}
}
// fix Caps Lock keypress shown as SDLK_UNKNOWN (scancode = 58)
if (rEvent.key.keysym.scancode == 58 && rEvent.key.keysym.sym == SDLK_UNKNOWN)
rEvent.key.keysym.sym = SDLK_CAPSLOCK;
#endif
switch (rEvent.key.keysym.sym)
{
@ -1182,18 +1262,23 @@ int handle_msgpump()
case SDLK_LSHIFT: // Shift key
inputdevice_do_keyboard(AK_LSH, 1);
break;
case SDLK_RSHIFT: // Left shoulder button
case SDLK_RCTRL: // Right shoulder button
if(currprefs.input_tablet > TABLET_OFF) {
// Holding left or right shoulder button -> stylus does right mousebutton
doStylusRightClick = 1;
}
#endif
#endif
default:
if (currprefs.customControls)
{
#ifdef USE_SDL1
keycode = customControlMap[rEvent.key.keysym.sym];
#endif
#ifdef USE_SDL2
keycode = SDL_GetKeyFromName(customControlMap[rEvent.key.keysym.sym]);
#endif
if (keycode < 0)
{
// Simulate mouse or joystick
@ -1215,7 +1300,12 @@ int handle_msgpump()
case SDL_KEYUP:
if (currprefs.customControls)
{
#ifdef USE_SDL1
keycode = customControlMap[rEvent.key.keysym.sym];
#endif
#ifdef USE_SDL2
keycode = SDL_GetKeyFromName(customControlMap[rEvent.key.keysym.sym]);
#endif
if (keycode < 0)
{
// Simulate mouse or joystick
@ -1268,10 +1358,10 @@ int handle_msgpump()
{
if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE)
{
int mouseScale = currprefs.input_joymouse_multiplier / 2;
int x = rEvent.motion.xrel;
int y = rEvent.motion.yrel;
#ifdef PANDORA
const int mouseScale = currprefs.input_joymouse_multiplier / 2;
const int x = rEvent.motion.xrel;
const int y = rEvent.motion.yrel;
#if defined (PANDORA) || defined (ANDROIDSDL)
if(rEvent.motion.x == 0 && x > -4)
x = -4;
if(rEvent.motion.y == 0 && y > -4)
@ -1290,8 +1380,8 @@ int handle_msgpump()
case SDL_MOUSEWHEEL:
if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE)
{
int valY = rEvent.wheel.y;
int valX = rEvent.wheel.x;
const int valY = rEvent.wheel.y;
const int valX = rEvent.wheel.x;
setmousestate(0, 2, valY, 0);
setmousestate(0, 3, valX, 0);
}

View file

@ -16,13 +16,32 @@
#include <png.h>
#include <SDL.h>
#ifdef USE_SDL1
#include <SDL_image.h>
#include <SDL_gfxPrimitives.h>
#include <SDL_ttf.h>
#include "threaddep/thread.h"
#include "bcm_host.h"
#endif
#ifdef ANDROIDSDL
#include <android/log.h>
#endif
/* SDL variable for output of emulation */
SDL_Surface* screen = nullptr;
//static unsigned int current_vsync_frame = 0;
static unsigned int current_vsync_frame = 0;
unsigned long time_per_frame = 20000; // Default for PAL (50 Hz): 20000 microsecs
static unsigned long last_synctime;
static int vsync_modulo = 1;
static int host_hz = 50;
#ifdef USE_SDL1
/* Dummy SDL variable for screen init */
SDL_Surface *Dummy_prSDLScreen = NULL;
#endif
/* Possible screen modes (x and y resolutions) */
#define MAX_SCREEN_MODES 14
@ -47,11 +66,56 @@ int delay_savestate_frame = 0;
static unsigned long next_synctime = 0;
#ifdef USE_SDL1
DISPMANX_DISPLAY_HANDLE_T dispmanxdisplay;
DISPMANX_MODEINFO_T dispmanxdinfo;
DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_1 = 0;
DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_2 = 0;
DISPMANX_ELEMENT_HANDLE_T dispmanxelement;
DISPMANX_UPDATE_HANDLE_T dispmanxupdate;
VC_RECT_T src_rect;
VC_RECT_T dst_rect;
VC_RECT_T blit_rect;
static int DispManXElementpresent = 0;
static unsigned char current_resource_amigafb = 0;
#endif
static volatile uae_atomic vsync_counter = 0;
void vsync_callback(unsigned int a, void* b)
{
atomic_inc(&vsync_counter);
}
int graphics_setup(void)
{
#ifdef PICASSO96
picasso_InitResolutions();
InitPicasso96();
#endif
#ifdef USE_SDL1
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection;
TV_DISPLAY_STATE_T tvstate;
if (vchi_initialise(&vchi_instance) == 0) {
if (vchi_connect(NULL, 0, vchi_instance) == 0) {
vc_vchi_tv_init(vchi_instance, &vchi_connection, 1);
if (vc_tv_get_display_state(&tvstate) == 0) {
HDMI_PROPERTY_PARAM_T property;
property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE;
vc_tv_hdmi_get_property(&property);
float frame_rate = property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? tvstate.display.hdmi.frame_rate * (1000.0f / 1001.0f) : tvstate.display.hdmi.frame_rate;
host_hz = int(frame_rate);
}
vc_vchi_tv_stop();
vchi_disconnect(vchi_instance);
}
}
bcm_host_init();
dispmanxdisplay = vc_dispmanx_display_open(0);
vc_dispmanx_vsync_callback(dispmanxdisplay, vsync_callback, NULL);
#endif
return 1;
}
@ -62,12 +126,35 @@ void InitAmigaVidMode(struct uae_prefs* p)
gfxvidinfo.drawbuffer.pixbytes = screen->format->BytesPerPixel;
gfxvidinfo.drawbuffer.bufmem = static_cast<uae_u8 *>(screen->pixels);
gfxvidinfo.drawbuffer.outwidth = p->gfx_size.width;
gfxvidinfo.drawbuffer.outheight = p->gfx_size.height;
gfxvidinfo.drawbuffer.outheight = p->gfx_size.height << p->gfx_vresolution;
gfxvidinfo.drawbuffer.rowbytes = screen->pitch;
}
void graphics_subshutdown()
{
#ifdef USE_SDL1
if (DispManXElementpresent == 1)
{
DispManXElementpresent = 0;
dispmanxupdate = vc_dispmanx_update_start(0);
vc_dispmanx_element_remove(dispmanxupdate, dispmanxelement);
vc_dispmanx_update_submit_sync(dispmanxupdate);
}
if (dispmanxresource_amigafb_1 != 0) {
vc_dispmanx_resource_delete(dispmanxresource_amigafb_1);
dispmanxresource_amigafb_1 = 0;
}
if (dispmanxresource_amigafb_2 != 0) {
vc_dispmanx_resource_delete(dispmanxresource_amigafb_2);
dispmanxresource_amigafb_2 = 0;
}
if (screen != nullptr) {
SDL_FreeSurface(screen);
screen = nullptr;
}
#elif USE_SDL2
if (screen != nullptr)
{
SDL_FreeSurface(screen);
@ -77,15 +164,17 @@ void graphics_subshutdown()
{
SDL_DestroyTexture(texture);
}
#endif
}
void Create_SDL_Surface(int width, int height, int depth)
#ifdef USE_SDL2
void Create_SDL_Surface(const int width, const int height, const int depth)
{
screen = SDL_CreateRGBSurface(0, width, height, depth, 0, 0, 0, 0);
check_error_sdl(screen == nullptr, "Unable to create a surface");
}
void Create_SDL_Texture(int width, int height, int depth)
void Create_SDL_Texture(const int width, const int height, const int depth)
{
if (depth == 16) {
// Initialize SDL Texture for the renderer
@ -108,15 +197,41 @@ void Create_SDL_Texture(int width, int height, int depth)
// Check if the requested Amiga resolution can be displayed with the current Screen mode as a direct multiple
// Based on this we make the decision to use Linear (smooth) or Nearest Neighbor (pixelated) scaling
bool isModeAspectRatioExact(SDL_DisplayMode* mode, int width, int height)
bool isModeAspectRatioExact(SDL_DisplayMode* mode, const int width, const int height)
{
if (mode->w % width == 0 && mode->h % height == 0)
return true;
return false;
}
#endif
void updatedisplayarea()
{
#ifdef USE_SDL1
if (current_resource_amigafb == 1)
{
current_resource_amigafb = 0;
vc_dispmanx_resource_write_data(dispmanxresource_amigafb_1,
VC_IMAGE_RGB565,
gfxvidinfo.drawbuffer.rowbytes,
gfxvidinfo.drawbuffer.bufmem,
&blit_rect);
dispmanxupdate = vc_dispmanx_update_start(0);
vc_dispmanx_element_change_source(dispmanxupdate, dispmanxelement, dispmanxresource_amigafb_1);
}
else
{
current_resource_amigafb = 1;
vc_dispmanx_resource_write_data(dispmanxresource_amigafb_2,
VC_IMAGE_RGB565,
gfxvidinfo.drawbuffer.rowbytes,
gfxvidinfo.drawbuffer.bufmem,
&blit_rect);
dispmanxupdate = vc_dispmanx_update_start(0);
vc_dispmanx_element_change_source(dispmanxupdate, dispmanxelement, dispmanxresource_amigafb_2);
}
vc_dispmanx_update_submit(dispmanxupdate, NULL, NULL);
#elif USE_SDL2
// Update the texture from the surface
SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch);
SDL_RenderClear(renderer);
@ -124,28 +239,106 @@ void updatedisplayarea()
SDL_RenderCopy(renderer, texture, nullptr, nullptr);
// Update the window surface (show the renderer)
SDL_RenderPresent(renderer);
#endif
}
#ifdef USE_SDL1
void open_sdl1_screen(int width, int height)
{
if (Dummy_prSDLScreen != NULL)
{
// y.f. 2016-10-13 : free the previous screen surface every time,
// so we can have fullscreen while running and windowed while in config window.
// Apparently, something somewhere is resetting the screen.
SDL_FreeSurface(Dummy_prSDLScreen);
Dummy_prSDLScreen = NULL;
}
if (Dummy_prSDLScreen == NULL)
Dummy_prSDLScreen = SDL_SetVideoMode(width, height, 16, SDL_SWSURFACE | SDL_FULLSCREEN);
currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect;
currprefs.gfx_fullscreen_ratio = changed_prefs.gfx_fullscreen_ratio;
screen = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 16,
Dummy_prSDLScreen->format->Rmask, Dummy_prSDLScreen->format->Gmask, Dummy_prSDLScreen->format->Bmask, Dummy_prSDLScreen->format->Amask);
vc_dispmanx_display_get_info(dispmanxdisplay, &dispmanxdinfo);
dispmanxresource_amigafb_1 = vc_dispmanx_resource_create(VC_IMAGE_RGB565, width, height, &vc_image_ptr);
dispmanxresource_amigafb_2 = vc_dispmanx_resource_create(VC_IMAGE_RGB565, width, height, &vc_image_ptr);
vc_dispmanx_rect_set(&blit_rect, 0, 0, width, height);
vc_dispmanx_resource_write_data(dispmanxresource_amigafb_1, VC_IMAGE_RGB565, prSDLScreen->pitch, prSDLScreen->pixels, &blit_rect);
vc_dispmanx_rect_set(&src_rect, 0, 0, width << 16, height << 16);
// 16/9 to 4/3 ratio adaptation.
if (currprefs.gfx_correct_aspect == 0)
{
// Fullscreen.
int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio / 100;
int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio / 100;
vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width)/2, (dispmanxdinfo.height - scaled_height)/2,
scaled_width, scaled_height);
}
else
{
// 4/3 shrink.
int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio / 100;
int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio / 100;
vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width / 16 * 12)/2, (dispmanxdinfo.height - scaled_height)/2,
scaled_width/16*12, scaled_height);
}
if (DispManXElementpresent == 0)
{
DispManXElementpresent = 1;
dispmanxupdate = vc_dispmanx_update_start(0);
dispmanxelement = vc_dispmanx_element_add(dispmanxupdate, dispmanxdisplay, 2, // layer
&dst_rect, dispmanxresource_amigafb_1, &src_rect, DISPMANX_PROTECTION_NONE, &alpha,
NULL, // clamp
DISPMANX_NO_ROTATE);
vc_dispmanx_update_submit(dispmanxupdate, NULL, NULL);
}
}
#endif
static void open_screen(struct uae_prefs* p)
{
int width;
int height;
int depth = 16;
#ifdef USE_SDL1
VC_DISPMANX_ALPHA_T alpha = {
DISPMANX_FLAGS_ALPHA_T(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS),
255, /*alpha 0->255*/
0
};
uint32_t vc_image_ptr;
current_resource_amigafb = 0;
next_synctime = 0;
#endif
#ifdef PICASSO96
if (screen_is_picasso)
{
width = picasso_vidinfo.width ? picasso_vidinfo.width : 640;
height = picasso_vidinfo.height ? picasso_vidinfo.height : 256;
#ifdef USE_SDL2
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // we always use linear for Picasso96 modes
#endif //USE_SDL2
}
else
#endif
#endif //PICASSO96
{
p->gfx_resolution = p->gfx_size.width ? (p->gfx_size.width > 600 ? 1 : 0) : 1;
width = p->gfx_size.width ? p->gfx_size.width : 640;
height = p->gfx_size.height ? p->gfx_size.height : 256;
height = p->gfx_size.height ? p->gfx_size.height << p->gfx_vresolution : 256;
#ifdef USE_SDL2
if (p->scaling_method == -1)
{
if (isModeAspectRatioExact(&sdlMode, width, height))
@ -157,20 +350,30 @@ static void open_screen(struct uae_prefs* p)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
else if (p->scaling_method == 1)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
#endif
}
graphics_subshutdown();
#ifdef USE_SDL1
open_sdl1_screen(width, height);
vsync_counter = 0;
current_vsync_frame = 2;
#elif USE_SDL2
Create_SDL_Surface(width, height, depth);
if (screen_is_picasso)
SDL_RenderSetLogicalSize(renderer, width, height);
else
SDL_RenderSetLogicalSize(renderer, width, height*2);
{
if (p->gfx_vresolution)
SDL_RenderSetLogicalSize(renderer, width, height);
else
SDL_RenderSetLogicalSize(renderer, width, height*2);
}
Create_SDL_Texture(width, height, depth);
updatedisplayarea();
#endif
if (screen != nullptr)
{
@ -192,12 +395,14 @@ int check_prefs_changed_gfx()
if (currprefs.gfx_size.height != changed_prefs.gfx_size.height ||
currprefs.gfx_size.width != changed_prefs.gfx_size.width ||
currprefs.gfx_resolution != changed_prefs.gfx_resolution)
currprefs.gfx_resolution != changed_prefs.gfx_resolution ||
currprefs.gfx_vresolution != changed_prefs.gfx_vresolution)
{
cfgfile_configuration_change(1);
currprefs.gfx_size.height = changed_prefs.gfx_size.height;
currprefs.gfx_size.width = changed_prefs.gfx_size.width;
currprefs.gfx_resolution = changed_prefs.gfx_resolution;
currprefs.gfx_vresolution = changed_prefs.gfx_vresolution;
update_display(&currprefs);
changed = 1;
}
@ -271,17 +476,65 @@ bool render_screen(bool immediate)
void show_screen(int mode)
{
#ifdef USE_SDL1
unsigned long start = read_processor_time();
int wait_till = current_vsync_frame;
if (vsync_modulo == 1) {
// Amiga framerate is equal to host framerate
do
{
usleep(10);
current_vsync_frame = vsync_counter;
} while (wait_till >= current_vsync_frame && read_processor_time() - start < 40000);
if (wait_till + 1 != current_vsync_frame) {
// We missed a vsync...
next_synctime = 0;
}
}
else {
// Amiga framerate differs from host framerate
unsigned long wait_till_time = (next_synctime != 0) ? next_synctime : last_synctime + time_per_frame;
if (current_vsync_frame % vsync_modulo == 0) {
// Real vsync
if (start < wait_till_time) {
// We are in time, wait for vsync
atomic_set(&vsync_counter, current_vsync_frame);
do
{
usleep(10);
current_vsync_frame = vsync_counter;
} while (wait_till >= current_vsync_frame && read_processor_time() - start < 40000);
}
else {
// Too late for vsync
}
}
else {
// Estimate vsync by time
while (wait_till_time > read_processor_time()) {
usleep(10);
}
++current_vsync_frame;
}
}
current_vsync_frame += currprefs.gfx_framerate;
#endif
last_synctime = read_processor_time();
updatedisplayarea();
#ifdef USE_SDL1
idletime += last_synctime - start;
#endif
if (last_synctime - next_synctime > time_per_frame - 5000)
next_synctime = last_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
else
next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
//if (!screen_is_picasso)
// gfxvidinfo.drawbuffer.bufmem = static_cast<uae_u8 *>(screen->pixels);
}
unsigned long target_lastsynctime(void)
@ -296,6 +549,17 @@ bool show_screen_maybe(bool show)
return false;
}
#ifdef USE_SDL1
void black_screen_now(void)
{
if (screen != NULL) {
SDL_FillRect(screen, NULL, 0);
render_screen(true);
show_screen(0);
}
}
#endif
static void graphics_subinit()
{
if (screen == nullptr)
@ -355,7 +619,22 @@ static int init_colors()
*/
static int get_display_depth()
{
#ifdef USE_SDL1
const SDL_VideoInfo *vid_info;
int depth = 0;
if ((vid_info = SDL_GetVideoInfo())) {
depth = vid_info->vfmt->BitsPerPixel;
/* Don't trust the answer if it's 16 bits; the display
* could actually be 15 bits deep. We'll count the bits
* ourselves */
if (depth == 16)
depth = bitsInMask(vid_info->vfmt->Rmask) + bitsInMask(vid_info->vfmt->Gmask) + bitsInMask(vid_info->vfmt->Bmask);
}
#elif USE_SDL2
int depth = screen->format->BytesPerPixel == 4 ? 32 : 16;
#endif
return depth;
}
@ -386,9 +665,18 @@ void graphics_leave()
{
graphics_subshutdown();
#ifdef USE_SDL1
if (Dummy_prSDLScreen != NULL) {
SDL_FreeSurface(Dummy_prSDLScreen);
Dummy_prSDLScreen = NULL;
}
vc_dispmanx_vsync_callback(dispmanxdisplay, NULL, NULL);
vc_dispmanx_display_close(dispmanxdisplay);
bcm_host_deinit();
#elif USE_SDL2
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(sdlWindow);
#endif
SDL_VideoQuit();
}
@ -541,8 +829,17 @@ bool vsync_switchmode(int hz)
if (hz != currVSyncRate)
{
SetVSyncRate(hz);
#ifdef USE_SDL1
black_screen_now();
#endif
fpscounter_reset();
time_per_frame = 1000 * 1000 / (hz);
if (hz == host_hz)
vsync_modulo = 1;
else if (hz > host_hz)
vsync_modulo = 6; // Amiga draws 6 frames while host has 5 vsyncs -> sync every 6th Amiga frame
else
vsync_modulo = 5; // Amiga draws 5 frames while host has 6 vsyncs -> sync every 5th Amiga frame
}
if (!picasso_on && !picasso_requested_on)
@ -563,6 +860,9 @@ bool target_graphics_buffer_update()
if (rate_changed)
{
#ifdef USE_SDL1
black_screen_now();
#endif
fpscounter_reset();
time_per_frame = 1000 * 1000 / currprefs.chipset_refreshrate;
}

View file

@ -2,8 +2,14 @@
#include <iostream>
#include <vector>
#include <sstream>
#ifdef USE_SDL1
#include <guichan.hpp>
#include <guichan/sdl.hpp>
#endif
#ifdef USE_SDL2
#include <guisan.hpp>
#include <guisan/sdl.hpp>
#endif
#include "sysconfig.h"
#include "sysdeps.h"
#include "uae.h"
@ -136,9 +142,9 @@ static void addrom(struct romdata* rd, const char* path)
char tmpName[MAX_DPATH];
AvailableROM* tmp = new AvailableROM();
getromname(rd, tmpName);
strcpy(tmp->Name, tmpName);
strncpy(tmp->Name, tmpName, MAX_PATH);
if (path != nullptr)
strcpy(tmp->Path, path);
strncpy(tmp->Path, path, MAX_PATH);
tmp->ROMType = rd->type;
lstAvailableROMs.push_back(tmp);
romlist_add(path, rd);
@ -208,7 +214,7 @@ static struct romdata* scan_single_rom(char* path)
{
char tmp[MAX_DPATH];
strcpy(tmp, path);
strncpy (tmp, path, MAX_PATH);
struct romdata* rd = getromdatabypath(path);
if (rd && rd->crc32 == 0xffffffff)
return rd;
@ -266,20 +272,20 @@ static void scan_rom(char *path)
void RescanROMs()
{
vector<string> files;
char path[MAX_DPATH];
char path[MAX_PATH];
romlist_clear();
ClearAvailableROMList();
fetch_rompath(path, sizeof path);
fetch_rompath(path, MAX_PATH);
load_keyring(&changed_prefs, path);
ReadDirectory(path, nullptr, &files);
for (int i = 0; i < files.size(); ++i)
{
char tmppath[MAX_DPATH];
strcpy(tmppath, path);
strncat(tmppath, files[i].c_str(), sizeof tmppath);
char tmppath[MAX_PATH];
strncpy(tmppath, path, sizeof tmppath - 1);
strncat(tmppath, files[i].c_str(), sizeof tmppath - 1);
scan_rom(tmppath);
}
@ -413,6 +419,7 @@ int gui_init()
quit_program = -quit_program;
if (quit_program == UAE_QUIT)
ret = -2; // Quit without start of emulator
setCpuSpeed();
update_display(&changed_prefs);
@ -423,9 +430,7 @@ int gui_init()
void gui_exit()
{
#ifdef PANDORA
resetCpuSpeed();
#endif
sync();
amiberry_stop_sound();
saveAdfDir();
@ -436,6 +441,18 @@ void gui_exit()
void gui_purge_events()
{
#ifdef USE_SDL1
int counter = 0;
SDL_Event event;
SDL_Delay(150);
// Strangely PS3 controller always send events, so we need a maximum number of event to purge.
while (SDL_PollEvent(&event) && counter < 50)
{
counter++;
SDL_Delay(10);
}
#endif
keybuf_init();
}
@ -444,38 +461,38 @@ int gui_update()
{
char tmp[MAX_DPATH];
fetch_savestatepath(savestate_fname, sizeof savestate_fname);
fetch_savestatepath(savestate_fname, MAX_DPATH);
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
if (strlen(currprefs.floppyslots[0].df) > 0)
extractFileName(currprefs.floppyslots[0].df, tmp);
else
strcpy(tmp, last_loaded_config);
strncpy(tmp, last_loaded_config, sizeof tmp);
strncat(savestate_fname, tmp, sizeof savestate_fname);
strncat(screenshot_filename, tmp, sizeof screenshot_filename);
strncat(savestate_fname, tmp, MAX_DPATH - 1);
strncat(screenshot_filename, tmp, MAX_DPATH - 1);
removeFileExtension(savestate_fname);
removeFileExtension(screenshot_filename);
switch (currentStateNum)
{
case 1:
strcat(savestate_fname, "-1.uss");
strcat(screenshot_filename, "-1.png");
break;
case 2:
strcat(savestate_fname, "-2.uss");
strcat(screenshot_filename, "-2.png");
break;
case 3:
strcat(savestate_fname, "-3.uss");
strcat(screenshot_filename, "-3.png");
break;
default:
strcat(savestate_fname, ".uss");
strcat(screenshot_filename, ".png");
}
return 0;
switch(currentStateNum)
{
case 1:
strncat(savestate_fname,"-1.uss", MAX_PATH - 1);
strncat(screenshot_filename,"-1.png", MAX_PATH - 1);
break;
case 2:
strncat(savestate_fname,"-2.uss", MAX_PATH - 1);
strncat(screenshot_filename,"-2.png", MAX_PATH - 1);
break;
case 3:
strncat(savestate_fname,"-3.uss", MAX_PATH - 1);
strncat(screenshot_filename,"-3.png", MAX_PATH - 1);
break;
default:
strncat(savestate_fname,".uss", MAX_PATH - 1);
strncat(screenshot_filename,".png", MAX_PATH - 1);
}
return 0;
}
@ -490,6 +507,9 @@ void gui_display(int shortcut)
if (lstAvailableROMs.size() == 0)
RescanROMs();
#ifdef USE_SDL1
graphics_subshutdown();
#endif
prefs_to_gui();
run_gui();
@ -499,6 +519,10 @@ void gui_display(int shortcut)
screen_is_picasso = 0;
update_display(&changed_prefs);
#ifdef USE_SDL1
/* Clear menu garbage at the bottom of the screen */
black_screen_now();
#endif
reset_sound();
resume_sound();
@ -569,6 +593,27 @@ void gui_led(int led, int on)
void gui_flicker_led(int led, int unitnum, int status)
{
static int hd_resetcounter;
switch(led)
{
case -1: // Reset HD and CD
gui_data.hd = 0;
break;
case LED_POWER:
break;
case LED_HD:
if (status == 0) {
hd_resetcounter--;
if (hd_resetcounter > 0)
return;
}
gui_data.hd = status;
hd_resetcounter = 2;
break;
}
gui_led(led, status);
}
@ -632,7 +677,7 @@ int translate_message(int msg, TCHAR* out)
{
if (gui_msglist[i].num == msg)
{
strcpy(out, gui_msglist[i].msg);
strncpy(out, gui_msglist[i].msg, MAX_DPATH);
return 1;
}
++i;

View file

@ -2,6 +2,7 @@
#include "sysdeps.h"
#include "config.h"
#include "options.h"
#include "keyboard.h"
#include "inputdevice.h"
#include <SDL.h>
@ -134,28 +135,31 @@ static void fill_blank_controller(void)
default_controller_map.is_retroarch = false;
}
//TODO: Check if we can use SCANCODES for both SDL versions
#ifdef USE_SDL1
static void fill_default_keyboard()
{
// test using iPac layout
default_keyboard_map.north_button = SDLK_LSHIFT;
default_keyboard_map.east_button = SDLK_LCTRL;
default_keyboard_map.south_button = SDLK_LALT;
default_keyboard_map.west_button = SDLK_SPACE;
default_keyboard_map.dpad_left = SDLK_LEFT;
default_keyboard_map.dpad_right = SDLK_RIGHT;
default_keyboard_map.dpad_up = SDLK_UP;
default_keyboard_map.dpad_down = SDLK_DOWN;
default_keyboard_map.left_shoulder = SDLK_z;
default_keyboard_map.right_shoulder = SDLK_x;
default_keyboard_map.select_button = SDLK_1;
default_keyboard_map.start_button = SDLK_2;
default_keyboard_map.lstick_button = SDLK_F1;
default_keyboard_map.rstick_button = SDLK_F2;
//static void fill_default_keyboard()
//{
// // test using iPac layout
// default_keyboard_map.north_button = SDLK_LSHIFT;
// default_keyboard_map.east_button = SDLK_LCTRL;
// default_keyboard_map.south_button = SDLK_LALT;
// default_keyboard_map.west_button = SDLK_SPACE;
// default_keyboard_map.dpad_left = SDLK_LEFT;
// default_keyboard_map.dpad_right = SDLK_RIGHT;
// default_keyboard_map.dpad_up = SDLK_UP;
// default_keyboard_map.dpad_down = SDLK_DOWN;
// default_keyboard_map.left_shoulder = SDLK_z;
// default_keyboard_map.right_shoulder = SDLK_x;
// default_keyboard_map.select_button = SDLK_1;
// default_keyboard_map.start_button = SDLK_2;
// default_keyboard_map.lstick_button = SDLK_F1;
// default_keyboard_map.rstick_button = SDLK_F2;
//
// default_keyboard_map.is_retroarch = false;
//}
default_keyboard_map.is_retroarch = false;
}
#endif
#ifdef USE_SDL2
static void fill_default_keyboard()
{
// test using iPac layout
@ -176,6 +180,7 @@ static void fill_default_keyboard()
default_keyboard_map.is_retroarch = false;
}
#endif
//# Keyboard input. Will recognize letters (a to z) and the following special keys (where kp_
//# is for keypad keys):
@ -189,33 +194,36 @@ static void fill_default_keyboard()
//# tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket,
//# backslash, rightbracket, kp_period, kp_equals, rctrl, ralt
//const int RemapKeyMapList[] = {
// -1,
// SDLK_a, SDLK_b, SDLK_c, SDLK_d, SDLK_e,
// SDLK_f, SDLK_g, SDLK_h, SDLK_i, SDLK_j,
// SDLK_k, SDLK_l, SDLK_m, SDLK_n, SDLK_o,
// SDLK_p, SDLK_q, SDLK_r, SDLK_s, SDLK_t,
// SDLK_u, SDLK_v, SDLK_w, SDLK_x, SDLK_y, SDLK_z,
// SDLK_LEFT, SDLK_RIGHT, SDLK_UP, SDLK_DOWN, SDLK_RETURN,
// SDLK_KP_ENTER, SDLK_TAB, SDLK_INSERT, SDLK_DELETE, SDLK_END, SDLK_HOME,
// SDLK_RSHIFT, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_SPACE,
// SDLK_ESCAPE, SDLK_PLUS, SDLK_MINUS, SDLK_KP_PLUS, SDLK_KP_MINUS,
// SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6,
// SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12,
// SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
// SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_PAGEUP, SDLK_PAGEDOWN,
// SDLK_KP_0, SDLK_KP_1, SDLK_KP_2, SDLK_KP_3, SDLK_KP_4,
// SDLK_KP_5, SDLK_KP_6, SDLK_KP_7, SDLK_KP_8, SDLK_KP_9,
// SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCKCLEAR, SDLK_BACKSPACE,
// // divide
// SDLK_ASTERISK, -1, SDLK_PRINTSCREEN, SDLK_SCROLLLOCK,
// // tilde
// -1, SDLK_BACKQUOTE,SDLK_PAUSE, SDLK_QUOTE, SDLK_COMMA,
// SDLK_MINUS, SDLK_SLASH, SDLK_SEMICOLON,SDLK_EQUALS, SDLK_LEFTPAREN,
// SDLK_BACKSLASH, SDLK_RIGHTPAREN,
// SDLK_KP_PERIOD, SDLK_KP_EQUALS,SDLK_RCTRL, SDLK_RALT
//};
#ifdef USE_SDL1
const int RemapKeyMapList[] = {
-1,
SDLK_a, SDLK_b, SDLK_c, SDLK_d, SDLK_e,
SDLK_f, SDLK_g, SDLK_h, SDLK_i, SDLK_j,
SDLK_k, SDLK_l, SDLK_m, SDLK_n, SDLK_o,
SDLK_p, SDLK_q, SDLK_r, SDLK_s, SDLK_t,
SDLK_u, SDLK_v, SDLK_w, SDLK_x, SDLK_y, SDLK_z,
SDLK_LEFT, SDLK_RIGHT, SDLK_UP, SDLK_DOWN, SDLK_RETURN,
SDLK_KP_ENTER, SDLK_TAB, SDLK_INSERT, SDLK_DELETE, SDLK_END, SDLK_HOME,
SDLK_RSHIFT, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_SPACE,
SDLK_ESCAPE, SDLK_PLUS, SDLK_MINUS, SDLK_KP_PLUS, SDLK_KP_MINUS,
SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6,
SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12,
SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_PAGEUP, SDLK_PAGEDOWN,
SDLK_KP0, SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4,
SDLK_KP5, SDLK_KP6, SDLK_KP7, SDLK_KP8, SDLK_KP9,
SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCK, SDLK_BACKSPACE,
// divide
SDLK_ASTERISK, -1, SDLK_PRINT, SDLK_SCROLLOCK,
// tilde
-1, SDLK_BACKQUOTE,SDLK_PAUSE, SDLK_QUOTE, SDLK_COMMA,
SDLK_MINUS, SDLK_SLASH, SDLK_SEMICOLON,SDLK_EQUALS, SDLK_LEFTPAREN,
SDLK_BACKSLASH, SDLK_RIGHTPAREN,
SDLK_KP_PERIOD, SDLK_KP_EQUALS,SDLK_RCTRL, SDLK_RALT
};
#endif
#ifdef USE_SDL2
const int RemapKeyMapList[] = {
-1,
SDL_SCANCODE_A, SDL_SCANCODE_B, SDL_SCANCODE_C, SDL_SCANCODE_D, SDL_SCANCODE_E,
@ -240,6 +248,7 @@ const int RemapKeyMapList[] = {
SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_RIGHTBRACKET,
SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_KP_EQUALS, SDL_SCANCODE_RCTRL, SDL_SCANCODE_RALT
};
#endif
const char* RemapKeyMapListStrings[] = {
"nul",
@ -740,8 +749,14 @@ static int init_joystick(void)
if (Joysticktable[cpt] != nullptr)
{
#ifdef USE_SDL1
if (SDL_JoystickName(cpt) != nullptr)
strncpy(JoystickName[cpt], SDL_JoystickName(cpt), sizeof JoystickName[cpt] - 1);
#endif
#ifdef USE_SDL2
if (SDL_JoystickNameForIndex(cpt) != nullptr)
strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), sizeof JoystickName[cpt] - 1);
#endif
else
sprintf(JoystickName[cpt], "Joystick%d", cpt);
@ -910,6 +925,8 @@ static int get_joystick_widget_first(const int joy, const int type)
return FIRST_JOY_AXIS;
case IDEV_WIDGET_BUTTONAXIS:
return MAX_JOY_AXES + MAX_JOY_BUTTONS;
default:
return -1;
}
}
return -1;
@ -982,10 +999,14 @@ static void read_joystick(void)
// First handle retroarch (or default) keys as Joystick...
if (currprefs.jports[joyid].id >= JSEM_JOYS && currprefs.jports[joyid].id < JSEM_JOYS + numKeysAsJoys)
{
const int hostkeyid = 0;//currprefs.jports[joyid].id - JSEM_JOYS;
const int hostkeyid = currprefs.jports[joyid].id - JSEM_JOYS;
#ifdef USE_SDL1
Uint8* keystate = SDL_GetKeyState(nullptr);
#endif
#ifdef USE_SDL2
const Uint8* keystate = SDL_GetKeyboardState(nullptr);
#endif
// cd32 red, blue, green, yellow
setjoybuttonstate(0, 0, keystate[host_keyboard_buttons[hostkeyid].south_button]); // b
setjoybuttonstate(0, 1, keystate[host_keyboard_buttons[hostkeyid].east_button]); // a
@ -1201,7 +1222,7 @@ struct inputdevice_functions inputdevicefunc_joystick = {
get_joystick_flags
};
int input_get_default_joystick(struct uae_input_device* uid, int num, int port, int af, int mode, bool gp,
int input_get_default_joystick(struct uae_input_device* uid, const int num, int port, const int af, const int mode, const bool gp,
bool joymouseswap)
{
// DEAL WITH AXIS INPUT EVENTS
@ -1456,7 +1477,7 @@ int input_get_default_joystick_analog(struct uae_input_device* uid, int num, int
}
void SimulateMouseOrJoy(int code, int keypressed)
void SimulateMouseOrJoy(const int code, const int keypressed)
{
switch (code)
{

View file

@ -3,7 +3,7 @@
#include <string.h>
// UAE4ARM and fs-uae uses only chars / UTF-8 internally, so TCHAR is typedefed to
// Amiberry and fs-uae uses only chars / UTF-8 internally, so TCHAR is typedefed to
// char (WinUAE uses wchar_t internally).
char *ua(const TCHAR *s)

View file

@ -1,6 +1,15 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#include <SDL/SDL_ttf.h>
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include <SDL.h>
#include <guisan/sdl/sdltruetypefont.hpp>
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
@ -327,7 +336,6 @@ static void CreateFilesysHardfileLoop()
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
UpdateGuiScreen();
}
}

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -505,7 +512,6 @@ static void EditFilesysHardfileLoop()
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
UpdateGuiScreen();
}
}

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -180,11 +187,15 @@ void InGameMessage(const char* msg)
// Now we let the Gui object draw itself.
msg_gui->draw();
// Finally we update the screen.
#ifdef USE_SDL1
SDL_Flip(prSDLScreen);
#elif USE_SDL2
if (!drawn && cursor != nullptr)
{
SDL_ShowCursor(SDL_ENABLE);
updatedisplayarea();
}
#endif
drawn = true;
}

View file

@ -1,5 +1,12 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -26,13 +33,17 @@ static NavigationMap navMap[] =
{ "Paths", "SystemROMs", "SystemROMs", "Reset", "Quickstart" },
{ "Quickstart", "qsNTSC", "AModel", "Paths", "Configurations" },
{ "Configurations", "ConfigList", "ConfigList", "Quickstart", "CPU and FPU" },
{"CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset"},
{ "CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset" },
{ "Chipset", "Fast copper", "OCS", "CPU and FPU", "ROM" },
{"ROM", "MainROM", "cboMainROM", "Chipset", "RAM"},
{"RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives"},
{"Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives/CD"},
{"Hard drives/CD", "cmdCreateHDF", "cmdAddDir", "Floppy drives", "Display"},
{"Display", "Frameskip", "Frameskip", "Hard drives/CD", "Sound"},
{ "ROM", "MainROM", "cboMainROM", "Chipset", "RAM" },
{ "RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives" },
{ "Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives/CD" },
{ "Hard drives/CD", "cmdCreateHDF", "cmdAddDir", "Floppy drives", "Display"},
#ifdef USE_SDL1
{ "Display", "sldWidth", "sldWidth", "Hard drives/CD", "Sound" },
#elif USE_SDL2
{ "Display", "Frameskip", "Frameskip", "Hard drives/CD", "Sound" },
#endif
{ "Sound", "sndDisable", "sndDisable", "Display", "Input" },
{ "Input", "cboPort0mode", "cboPort0", "Sound", "Custom controls" },
{ "Custom controls", "Right Trigger", "0: Mouse", "Input", "Miscellaneous" },
@ -202,10 +213,20 @@ static NavigationMap navMap[] =
{"CDVol", "", "", "cboCD", "cmdProp0"},
// PanelDisplay
#ifdef USE_SDL1
{ "sldWidth", "", "", "Frameskip", "sldHeight" },
{ "sldHeight", "", "", "sldWidth", "sldVertPos" },
{ "sldVertPos", "", "", "sldHeight", "FSRatio" },
{ "FSRatio", "", "", "sldVertPos", "4by3Ratio" },
{ "4by3Ratio", "Display", "Display", "FSRatio", "Line doubling" },
{ "Line doubling", "Display", "Display", "4by3Ratio", "Frameskip" },
{ "Frameskip", "Display", "Display", "Line doubling", "sldWidth" },
#elif USE_SDL2
{"Frameskip", "Display", "Display", "Linear (smooth)", "Auto"},
{"Auto", "Display", "Display", "Frameskip", "Nearest Neighbor (pixelated)"},
{ "Nearest Neighbor (pixelated)", "Display", "Display", "Auto", "Linear (smooth)"},
{"Linear (smooth)", "Display", "Display", "Nearest Neighbor (pixelated)", "Frameskip"},
#endif
//PanelSound
{ "sndDisable", "Sound", "Mono", "sldStereoDelay", "sndDisEmu" },

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeCheckBox.hpp"

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeCheckBox.hpp"

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeListBox.hpp"

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -570,7 +577,11 @@ void RefreshPanelCustom(void)
if (changed_prefs.jports[SelectedPort].id > JSEM_JOYS && changed_prefs.jports[SelectedPort].id < JSEM_MICE - 1)
{
const int hostjoyid = changed_prefs.jports[SelectedPort].id - JSEM_JOYS - 1;
#ifdef USE_SDL1
strncpy(tmp, SDL_JoystickName(hostjoyid), 255);
#elif USE_SDL2
strncpy(tmp, SDL_JoystickNameForIndex(hostjoyid), 255);
#endif
for (int n = 0; n < 14; ++n)
{

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -13,40 +20,100 @@
#include "options.h"
#include "include/memory.h"
#include "uae.h"
#include "custom.h"
#include "gui.h"
#include "gui_handling.h"
static gcn::UaeCheckBox* chkFrameskip;
#ifdef USE_SDL1
const int amigawidth_values[] = { 320, 352, 384, 640, 704, 768 };
const int amigaheight_values[] = { 200, 216, 240, 256, 262, 270 };
const int FullscreenRatio[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95, 96, 97,98, 99,100 };
#endif
#ifdef USE_SDL2
static gcn::Window* grpScalingMethod;
static gcn::UaeRadioButton* optAuto;
static gcn::UaeRadioButton* optNearest;
static gcn::UaeRadioButton* optLinear;
#ifdef PANDORA
#endif
#ifdef USE_SDL1
static gcn::Window *grpAmigaScreen;
static gcn::Label* lblAmigaWidth;
static gcn::Label* lblAmigaWidthInfo;
static gcn::Slider* sldAmigaWidth;
static gcn::Label* lblAmigaHeight;
static gcn::Label* lblAmigaHeightInfo;
static gcn::Slider* sldAmigaHeight;
static gcn::Label* lblVertPos;
static gcn::Label* lblVertPosInfo;
static gcn::Slider* sldVertPos;
#endif // PANDORA
#endif // USE_SDL1
static gcn::UaeCheckBox* chkLineDbl;
static gcn::UaeCheckBox* chkFrameskip;
#ifdef USE_SDL1
static gcn::Label* lblFSRatio;
static gcn::Label* lblFSRatioInfo;
static gcn::Slider* sldFSRatio;
static gcn::UaeCheckBox* chkAspect;
#endif
class AmigaScreenActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent) override
{
if (actionEvent.getSource() == chkFrameskip)
#ifdef USE_SDL1
if (actionEvent.getSource() == sldAmigaWidth)
{
if (changed_prefs.gfx_size.width != amigawidth_values[(int)(sldAmigaWidth->getValue())])
{
changed_prefs.gfx_size.width = amigawidth_values[(int)(sldAmigaWidth->getValue())];
RefreshPanelDisplay();
}
}
else if (actionEvent.getSource() == sldAmigaHeight)
{
if (changed_prefs.gfx_size.height != amigaheight_values[(int)(sldAmigaHeight->getValue())])
{
changed_prefs.gfx_size.height = amigaheight_values[(int)(sldAmigaHeight->getValue())];
RefreshPanelDisplay();
}
}
else if (actionEvent.getSource() == sldVertPos)
{
if (changed_prefs.pandora_vertical_offset != (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST)
{
changed_prefs.pandora_vertical_offset = (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST;
RefreshPanelDisplay();
}
}
else
#endif
if (actionEvent.getSource() == chkFrameskip)
{
changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0;
}
#ifdef PANDORA
else if (actionEvent.getSource() == sldVertPos)
{
if(changed_prefs.pandora_vertical_offset != (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST)
{
changed_prefs.pandora_vertical_offset = (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST;
RefreshPanelDisplay();
}
}
#endif // PANDORA
else if (actionEvent.getSource() == chkLineDbl)
{
changed_prefs.gfx_vresolution = chkLineDbl->isSelected() ? VRES_DOUBLE : VRES_NONDOUBLE;
}
#ifdef USE_SDL1
else if (actionEvent.getSource() == sldFSRatio)
{
if (changed_prefs.gfx_fullscreen_ratio != FullscreenRatio[(int)(sldFSRatio->getValue())])
{
changed_prefs.gfx_fullscreen_ratio = FullscreenRatio[(int)(sldFSRatio->getValue())];
RefreshPanelDisplay();
}
}
else if (actionEvent.getSource() == chkAspect)
changed_prefs.gfx_correct_aspect = chkAspect->isSelected();
#endif
}
};
@ -71,9 +138,35 @@ static ScalingMethodActionListener* scalingMethodActionListener;
void InitPanelDisplay(const struct _ConfigCategory& category)
{
amigaScreenActionListener = new AmigaScreenActionListener();
int posY = DISTANCE_BORDER;
#ifdef USE_SDL1
lblAmigaWidth = new gcn::Label("Width:");
lblAmigaWidth->setSize(150, LABEL_HEIGHT);
lblAmigaWidth->setAlignment(gcn::Graphics::RIGHT);
sldAmigaWidth = new gcn::Slider(0, 5);
sldAmigaWidth->setSize(160, SLIDER_HEIGHT);
sldAmigaWidth->setBaseColor(gui_baseCol);
sldAmigaWidth->setMarkerLength(20);
sldAmigaWidth->setStepLength(1);
sldAmigaWidth->setId("sldWidth");
sldAmigaWidth->addActionListener(amigaScreenActionListener);
lblAmigaWidthInfo = new gcn::Label("320");
lblAmigaHeight = new gcn::Label("Height:");
lblAmigaHeight->setSize(150, LABEL_HEIGHT);
lblAmigaHeight->setAlignment(gcn::Graphics::RIGHT);
sldAmigaHeight = new gcn::Slider(0, 5);
sldAmigaHeight->setSize(160, SLIDER_HEIGHT);
sldAmigaHeight->setBaseColor(gui_baseCol);
sldAmigaHeight->setMarkerLength(20);
sldAmigaHeight->setStepLength(1);
sldAmigaHeight->setId("sldHeight");
sldAmigaHeight->addActionListener(amigaScreenActionListener);
lblAmigaHeightInfo = new gcn::Label("200");
#endif
#ifdef USE_SDL2
scalingMethodActionListener = new ScalingMethodActionListener();
optAuto = new gcn::UaeRadioButton("Auto", "radioscalingmethodgroup");
@ -97,6 +190,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
category.panel->add(grpScalingMethod);
posY += DISTANCE_BORDER + grpScalingMethod->getHeight() + DISTANCE_NEXT_Y;
#endif
#ifdef PANDORA
lblVertPos = new gcn::Label("Vert. offset:");
@ -111,24 +205,59 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
sldVertPos->addActionListener(amigaScreenActionListener);
lblVertPosInfo = new gcn::Label("000");
#endif //PANDORA
#ifdef USE_SDL1
lblFSRatio = new gcn::Label("Fullscreen Ratio:");
lblFSRatio->setSize(150, LABEL_HEIGHT);
lblFSRatio->setAlignment(gcn::Graphics::RIGHT);
sldFSRatio = new gcn::Slider(0, 20);
sldFSRatio->setSize(160, SLIDER_HEIGHT);
sldFSRatio->setBaseColor(gui_baseCol);
sldFSRatio->setMarkerLength(20);
sldFSRatio->setStepLength(1);
sldFSRatio->setId("FSRatio");
sldFSRatio->addActionListener(amigaScreenActionListener);
lblFSRatioInfo = new gcn::Label("100%%");
chkAspect = new gcn::UaeCheckBox("4/3 ratio shrink");
chkAspect->setId("4by3Ratio");
chkAspect->addActionListener(amigaScreenActionListener);
#endif
chkLineDbl = new gcn::UaeCheckBox("Line doubling");
chkLineDbl->addActionListener(amigaScreenActionListener);
chkFrameskip = new gcn::UaeCheckBox("Frameskip");
chkFrameskip->addActionListener(amigaScreenActionListener);
#ifdef PANDORA
#ifdef USE_SDL1
grpAmigaScreen = new gcn::Window("Amiga Screen");
grpAmigaScreen->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
int posY = 10;
grpAmigaScreen->add(lblAmigaWidth, 0, posY);
grpAmigaScreen->add(sldAmigaWidth, 160, posY);
grpAmigaScreen->add(lblAmigaWidthInfo, 160 + sldAmigaWidth->getWidth() + 12, posY);
posY += sldAmigaWidth->getHeight() + DISTANCE_NEXT_Y;
grpAmigaScreen->add(lblAmigaHeight, 0, posY);
grpAmigaScreen->add(sldAmigaHeight, 160, posY);
grpAmigaScreen->add(lblAmigaHeightInfo, 160 + sldAmigaHeight->getWidth() + 12, posY);
posY += sldAmigaHeight->getHeight() + DISTANCE_NEXT_Y;
grpAmigaScreen->add(lblVertPos, 0, posY);
grpAmigaScreen->add(sldVertPos, 160, posY);
grpAmigaScreen->add(lblVertPosInfo, 160 + sldVertPos->getWidth() + 12, posY);
posY += sldVertPos->getHeight() + DISTANCE_NEXT_Y;
grpAmigaScreen->add(lblFSRatio, 0, posY);
grpAmigaScreen->add(sldFSRatio, 160, posY);
grpAmigaScreen->add(lblFSRatioInfo, 160 + sldFSRatio->getWidth() + 12, posY);
posY += sldFSRatio->getHeight() + DISTANCE_NEXT_Y;
grpAmigaScreen->setMovable(false);
grpAmigaScreen->setSize(460, posY + DISTANCE_BORDER);
grpAmigaScreen->setBaseColor(gui_baseCol);
category.panel->add(grpAmigaScreen);
#endif //PANDORA
posY = DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkAspect, DISTANCE_BORDER, posY);
posY += chkAspect->getHeight() + DISTANCE_NEXT_Y;
#endif
category.panel->add(chkLineDbl, DISTANCE_BORDER, posY);
posY += chkLineDbl->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkFrameskip, DISTANCE_BORDER, posY);
RefreshPanelDisplay();
@ -139,30 +268,84 @@ void ExitPanelDisplay()
{
delete chkFrameskip;
delete amigaScreenActionListener;
#ifdef PANDORA
#ifdef USE_SDL1
delete lblAmigaWidth;
delete sldAmigaWidth;
delete lblAmigaWidthInfo;
delete lblAmigaHeight;
delete sldAmigaHeight;
delete lblAmigaHeightInfo;
delete lblVertPos;
delete sldVertPos;
delete lblVertPosInfo;
delete grpAmigaScreen;
#endif //PANDORA
delete lblFSRatio;
delete sldFSRatio;
delete lblFSRatioInfo;
delete chkAspect;
#endif
#ifdef USE_SDL2
delete optAuto;
delete optNearest;
delete optLinear;
delete grpScalingMethod;
delete scalingMethodActionListener;
#endif
}
void RefreshPanelDisplay()
{
chkLineDbl->setSelected(changed_prefs.gfx_vresolution != VRES_NONDOUBLE);
chkFrameskip->setSelected(changed_prefs.gfx_framerate);
#ifdef USE_SDL1
int i;
char tmp[32];
for (i = 0; i<6; ++i)
{
if (changed_prefs.gfx_size.width == amigawidth_values[i])
{
sldAmigaWidth->setValue(i);
snprintf(tmp, 32, "%d", changed_prefs.gfx_size.width);
lblAmigaWidthInfo->setCaption(tmp);
break;
}
}
for (i = 0; i<6; ++i)
{
if (changed_prefs.gfx_size.height == amigaheight_values[i])
{
sldAmigaHeight->setValue(i);
snprintf(tmp, 32, "%d", changed_prefs.gfx_size.height);
lblAmigaHeightInfo->setCaption(tmp);
break;
}
}
for (i = 0; i<21; ++i)
{
if (changed_prefs.gfx_fullscreen_ratio == FullscreenRatio[i])
{
sldFSRatio->setValue(i);
snprintf(tmp, 32, "%d%%", changed_prefs.gfx_fullscreen_ratio);
lblFSRatioInfo->setCaption(tmp);
break;
}
}
#endif
#ifdef USE_SDL2
if (changed_prefs.scaling_method == -1)
optAuto->setSelected(true);
else if (changed_prefs.scaling_method == 0)
optNearest->setSelected(true);
else if (changed_prefs.scaling_method == 1)
optLinear->setSelected(true);
#endif
#ifdef PANDORA
sldVertPos->setValue(changed_prefs.pandora_vertical_offset - OFFSET_Y_ADJUST);
snprintf(tmp, 32, "%d", changed_prefs.pandora_vertical_offset - OFFSET_Y_ADJUST);
@ -173,16 +356,25 @@ void RefreshPanelDisplay()
bool HelpPanelDisplay(std::vector<std::string> &helptext)
{
helptext.clear();
#ifdef USE_SDL1
helptext.push_back("Select the required width and height of the Amiga screen. If you select \"NTSC\" in chipset, a value greater than");
helptext.push_back("240 for \"Height\" makes no sense. When the game, demo or workbench uses Hires mode and you selected a");
helptext.push_back("value for \"Width\" lower than 640, you will only see half of the pixels.");
helptext.push_back("");
#elif USE_SDL2
helptext.push_back("Select the scaling method for the Amiga screen. The default option \"Auto\", will try to find the best looking");
helptext.push_back("scaling method depending on your monitor's resolution. \"Nearest Neighbor\" will give you a more pixelated");
helptext.push_back("and crisp image, but it may come with some distortion if your resolution is not an exact multiple.");
helptext.push_back("\"Linear\" will give you a smoother scaling but some people might find it a bit blurry.");
helptext.push_back("");
#endif
#ifdef PANDORA
helptext.push_back("With \"Vert. offset\" you can adjust the position of the first drawn line of the Amiga screen. You can also change");
helptext.push_back("this during emulation with left and right shoulder button and dpad up/down.");
helptext.push_back("");
#endif //PANDORA
helptext.push_back("Activate line doubling to remove flicker in interlace modes.");
helptext.push_back("");
helptext.push_back("When you activate \"Frameskip\", only every second frame is drawn. This will improve performance and some");
helptext.push_back("more games are playable.");
return true;

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -170,7 +177,7 @@ public:
//---------------------------------------
// Show info about current disk-image
//---------------------------------------
//if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0); // ToDo: Show info dialog
//if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0)
//ToDo: Show info dialog
}
else if (actionEvent.getSource() == cmdDFxEject[i])
@ -179,7 +186,7 @@ public:
// Eject disk from drive
//---------------------------------------
disk_eject(i);
strcpy(changed_prefs.floppyslots[i].df, "");
strncpy(changed_prefs.floppyslots[i].df, "", MAX_DPATH);
AdjustDropDownControls();
}
else if (actionEvent.getSource() == cmdDFxSelect[i])
@ -190,14 +197,14 @@ public:
char tmp[MAX_DPATH];
if (strlen(changed_prefs.floppyslots[i].df) > 0)
strcpy(tmp, changed_prefs.floppyslots[i].df);
strncpy(tmp, changed_prefs.floppyslots[i].df, MAX_PATH);
else
strcpy(tmp, currentDir);
strncpy(tmp, currentDir, MAX_PATH);
if (SelectFile("Select disk image file", tmp, diskfile_filter))
{
if (strncmp(changed_prefs.floppyslots[i].df, tmp, sizeof changed_prefs.floppyslots[i].df))
if(strncmp(changed_prefs.floppyslots[i].df, tmp, MAX_PATH))
{
strcpy(changed_prefs.floppyslots[i].df, tmp);
strncpy(changed_prefs.floppyslots[i].df, tmp, sizeof(changed_prefs.floppyslots[i].df));
disk_insert(i, tmp);
AddFileToDiskList(tmp, 1);
extractPath(tmp, currentDir);
@ -308,7 +315,7 @@ public:
extractFileName(changed_prefs.floppyslots[0].df, diskname);
removeFileExtension(diskname);
fetch_configurationpath(filename, sizeof filename);
fetch_configurationpath(filename, MAX_DPATH);
strncat(filename, diskname, MAX_DPATH - 1);
strncat(filename, ".uae", MAX_DPATH) - 1;
@ -476,11 +483,11 @@ void InitPanelFloppy(const struct _ConfigCategory& category)
//category.panel->add(cmdDFxInfo[i], posX, posY); //TODO disabled?
posX += cmdDFxInfo[i]->getWidth() + DISTANCE_NEXT_X;
category.panel->add(cmdDFxEject[i], posX, posY);
posX = DISTANCE_BORDER + textFieldWidth + DISTANCE_NEXT_X;
posY += cboDFxType[i]->getHeight() + 8;
posX += cmdDFxEject[i]->getWidth() + DISTANCE_NEXT_X;
category.panel->add(cmdDFxSelect[i], posX, posY);
posY += chkDFx[i]->getHeight() + 8;
category.panel->add(cboDFxFile[i], DISTANCE_BORDER, posY);
category.panel->add(cmdDFxSelect[i], posX, posY);
category.panel->add(cboDFxFile[i], DISTANCE_BORDER, posY);
if (i == 0)
{
posY += cboDFxFile[i]->getHeight() + 8;

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -215,6 +222,7 @@ public:
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
}
RefreshPanelHD();
RefreshPanelQuickstart();
}
};
@ -231,7 +239,7 @@ public:
//---------------------------------------
// Eject CD from drive
//---------------------------------------
strcpy(changed_prefs.cdslots[0].name, "");
strncpy(changed_prefs.cdslots[0].name, "", MAX_DPATH);
AdjustDropDownControls();
}
else if (actionEvent.getSource() == cmdCDSelect)
@ -239,15 +247,15 @@ public:
char tmp[MAX_DPATH];
if (strlen(changed_prefs.cdslots[0].name) > 0)
strcpy(tmp, changed_prefs.cdslots[0].name);
strncpy(tmp, changed_prefs.cdslots[0].name, MAX_DPATH);
else
strcpy(tmp, currentDir);
if (SelectFile("Select CD image file", tmp, cdfile_filter))
{
if (strncmp(changed_prefs.cdslots[0].name, tmp, sizeof changed_prefs.cdslots[0].name))
if(strncmp(changed_prefs.cdslots[0].name, tmp, MAX_DPATH))
{
strcpy(changed_prefs.cdslots[0].name, tmp);
strncpy(changed_prefs.cdslots[0].name, tmp, sizeof(changed_prefs.cdslots[0].name));
changed_prefs.cdslots[0].inuse = true;
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
AddFileToCDList(tmp, 1);
@ -312,7 +320,7 @@ public:
{
if (cdfileList.getElementAt(idx).compare(changed_prefs.cdslots[0].name))
{
strcpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str());
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.cdslots[0].name));
changed_prefs.cdslots[0].inuse = true;
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
lstMRUCDList.erase(lstMRUCDList.begin() + idx);
@ -352,7 +360,11 @@ void InitPanelHD(const struct _ConfigCategory& category)
listEntry[row] = new gcn::Container();
listEntry[row]->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, TEXTFIELD_HEIGHT + 4);
listEntry[row]->setBaseColor(gui_baseCol);
#ifdef USE_SDL1
listEntry[row]->setFrameSize(0);
#elif USE_SDL2
listEntry[row]->setBorderSize(0);
#endif
listCmdProps[row] = new gcn::Button("...");
listCmdProps[row]->setBaseColor(gui_baseCol);
@ -437,6 +449,7 @@ void InitPanelHD(const struct _ConfigCategory& category)
sldCDVol->setId("CDVol");
sldCDVol->addActionListener(genericActionListener);
lblCDVolInfo = new gcn::Label("80 %");
lblCDVolInfo->setSize(100, LABEL_HEIGHT);
int posX = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34;
for (col = 0; col < COL_COUNT; ++col)

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -195,6 +202,9 @@ static int amigaKey[] =
AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 101 - 108 */
AK_F10, 0
}; /* 109 - 110 */
#ifdef USE_SDL1
extern int customControlMap[SDLK_LAST];
#endif
static int GetAmigaKeyIndex(int key)
{
@ -629,6 +639,7 @@ void InitPanelInput(const struct _ConfigCategory& category)
lblAutofire->setSize(100, LABEL_HEIGHT);
lblAutofire->setAlignment(gcn::Graphics::RIGHT);
cboAutofire = new gcn::UaeDropDown(&autofireList);
cboAutofire->setSize(80, DROPDOWN_HEIGHT);
cboAutofire->setBaseColor(gui_baseCol);
cboAutofire->setBackgroundColor(colTextboxBackground);
cboAutofire->setId("cboAutofire");

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -70,8 +77,8 @@ public:
}
};
const char* listValues[] = {"none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD"};
StringListModel KBDLedList(listValues, 9);
static const char* listValues[] = {"none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD"};
static StringListModel KBDLedList(listValues, 9);
class MiscActionListener : public gcn::ActionListener
{
@ -81,12 +88,24 @@ public:
if (actionEvent.getSource() == chkStatusLine)
changed_prefs.leds_on_screen = chkStatusLine->isSelected();
#ifdef PANDORA
else if (actionEvent.getSource() == chkHideIdleLed)
changed_prefs.pandora_hide_idle_led = chkHideIdleLed->isSelected();
else if (actionEvent.getSource() == chkHideIdleLed)
changed_prefs.pandora_hide_idle_led = chkHideIdleLed->isSelected();
#endif
else if (actionEvent.getSource() == chkShowGUI)
changed_prefs.start_gui = chkShowGUI->isSelected();
else if (actionEvent.getSource() == chkRetroArchQuit)
changed_prefs.amiberry_use_retroarch_quit = chkRetroArchQuit->isSelected();
else if (actionEvent.getSource() == chkRetroArchMenu)
changed_prefs.amiberry_use_retroarch_menu = chkRetroArchMenu->isSelected();
else if (actionEvent.getSource() == chkRetroArchReset)
changed_prefs.amiberry_use_retroarch_reset = chkRetroArchReset->isSelected();
// else if (actionEvent.getSource() == chkRetroArchSavestate)
// changed_prefs.amiberry_use_retroarch_savestatebuttons = chkRetroArchSavestate->isSelected();
else if (actionEvent.getSource() == chkBSDSocket)
changed_prefs.socket_emu = chkBSDSocket->isSelected();
@ -116,16 +135,16 @@ public:
}
}
#ifdef PANDORA
else if (actionEvent.getSource() == sldPandoraSpeed)
{
int newspeed = (int) sldPandoraSpeed->getValue();
newspeed = newspeed - (newspeed % 20);
if(changed_prefs.pandora_cpu_speed != newspeed)
{
changed_prefs.pandora_cpu_speed = newspeed;
RefreshPanelMisc();
}
}
else if (actionEvent.getSource() == sldPandoraSpeed)
{
int newspeed = (int)sldPandoraSpeed->getValue();
newspeed = newspeed - (newspeed % 20);
if (changed_prefs.pandora_cpu_speed != newspeed)
{
changed_prefs.pandora_cpu_speed = newspeed;
RefreshPanelMisc();
}
}
#endif
else if (actionEvent.getSource() == cboKBDLed_num)
@ -155,6 +174,24 @@ void InitPanelMisc(const struct _ConfigCategory& category)
chkShowGUI->setId("ShowGUI");
chkShowGUI->addActionListener(miscActionListener);
chkRetroArchQuit = new gcn::UaeCheckBox("Use RetroArch Quit Button");
chkRetroArchQuit->setId("RetroArchQuit");
chkRetroArchQuit->addActionListener(miscActionListener);
chkRetroArchMenu = new gcn::UaeCheckBox("Use RetroArch Menu Button");
chkRetroArchMenu->setId("RetroArchMenu");
chkRetroArchMenu->addActionListener(miscActionListener);
chkRetroArchReset = new gcn::UaeCheckBox("Use RetroArch Reset Button");
chkRetroArchReset->setId("RetroArchReset");
chkRetroArchReset->addActionListener(miscActionListener);
//chkRetroArchSavestate = new gcn::UaeCheckBox("Use RetroArch State Controls");
//chkRetroArchSavestate->setId("RetroArchState");
//chkRetroArchSavestate->addActionListener(miscActionListener);
#ifdef PANDORA
lblPandoraSpeed = new gcn::Label("Pandora Speed:");
lblPandoraSpeed->setSize(110, LABEL_HEIGHT);
@ -227,14 +264,28 @@ void InitPanelMisc(const struct _ConfigCategory& category)
posY += chkHideIdleLed->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkShowGUI, DISTANCE_BORDER, posY);
posY += chkShowGUI->getHeight() + DISTANCE_NEXT_Y;
posY = DISTANCE_BORDER;
int posX = 300;
category.panel->add(chkRetroArchQuit, posX + DISTANCE_BORDER, posY);
posY += chkRetroArchQuit->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkRetroArchMenu, posX + DISTANCE_BORDER, posY);
posY += chkRetroArchMenu->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkRetroArchReset, posX + DISTANCE_BORDER, posY);
posY += chkRetroArchReset->getHeight() + DISTANCE_NEXT_Y;
//category.panel->add(chkRetroArchSavestate, posX + DISTANCE_BORDER, posY);
#ifdef PANDORA
category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY);
category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY);
category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY);
posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY);
category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY);
category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY);
posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y;
#endif
category.panel->add(chkBSDSocket, DISTANCE_BORDER, posY);
posY += chkBSDSocket->getHeight() + DISTANCE_NEXT_Y * 2;
category.panel->add(chkMasterWP, DISTANCE_BORDER, posY);
posY += chkMasterWP->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(lblNumLock, DISTANCE_BORDER, posY);
category.panel->add(cboKBDLed_num, DISTANCE_BORDER + lblNumLock->getWidth() + 8, posY);
@ -260,10 +311,15 @@ void ExitPanelMisc()
delete chkStatusLine;
delete chkHideIdleLed;
delete chkShowGUI;
delete chkRetroArchQuit;
delete chkRetroArchMenu;
delete chkRetroArchReset;
//delete chkRetroArchSaveState;
#ifdef PANDORA
delete lblPandoraSpeed;
delete sldPandoraSpeed;
delete lblPandoraSpeedInfo;
delete lblPandoraSpeed;
delete sldPandoraSpeed;
delete lblPandoraSpeedInfo;
#endif
delete chkBSDSocket;
delete chkMasterWP;
@ -286,13 +342,18 @@ void RefreshPanelMisc()
{
chkStatusLine->setSelected(changed_prefs.leds_on_screen);
#ifdef PANDORA
chkHideIdleLed->setSelected(changed_prefs.pandora_hide_idle_led);
chkHideIdleLed->setSelected(changed_prefs.pandora_hide_idle_led);
#endif
chkShowGUI->setSelected(changed_prefs.start_gui);
chkRetroArchQuit->setSelected(changed_prefs.amiberry_use_retroarch_quit);
chkRetroArchMenu->setSelected(changed_prefs.amiberry_use_retroarch_menu);
chkRetroArchReset->setSelected(changed_prefs.amiberry_use_retroarch_reset);
//chkRetroArchSavestate->setSelected(changed_prefs.amiberry_use_retroarch_statebuttons);
#ifdef PANDORA
sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed);
snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed);
lblPandoraSpeedInfo->setCaption(tmp);
sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed);
snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed);
lblPandoraSpeedInfo->setCaption(tmp);
#endif
chkBSDSocket->setSelected(changed_prefs.socket_emu);
chkMasterWP->setSelected(changed_prefs.floppy_read_only);
@ -307,19 +368,19 @@ void RefreshPanelMisc()
bool HelpPanelMisc(std::vector<std::string> &helptext)
{
helptext.clear();
helptext.push_back("\"Status Line\" shows/hides the status line indicator. The first value in the status line");
helptext.push_back("shows the idle time of the CPU in %, the second value is the current frame rate.");
helptext.push_back("When you have a HDD in your Amiga emulation, the HD indicator shows read (blue) and");
helptext.push_back("write (red) access to the HDD. The next values are showing the track number for each disk");
helptext.push_back("drive and indicates disk access.");
helptext.push_back("\"Status Line\" shows/hides the status line indicator. During emulation, you can show/hide this by pressing left");
helptext.push_back("shoulder and 'd'. The first value in the status line shows the idle time of the Pandora CPU in %, the second value");
helptext.push_back("is the current frame rate. When you have a HDD in your Amiga emulation, the HD indicator shows read (blue) and");
helptext.push_back("write (red) access to the HDD. The next values are showing the track number for each disk drive and indicates");
helptext.push_back("disk access.");
helptext.push_back("");
helptext.push_back("When you deactivate the option \"Show GUI on startup\" and use this configuration by specifying it with the");
helptext.push_back("command line parameter \"-config=<file>\", the emulation starts directly without showing the GUI.");
helptext.push_back("");
#ifdef PANDORA
helptext.push_back("Set the speed for the Pandora CPU to overclock it for games which need more power. Be careful with this");
helptext.push_back("parameter.");
helptext.push_back("");
helptext.push_back("parameter.");
helptext.push_back("");
#endif
helptext.push_back("\"bsdsocket.library\" enables network functions (i.e. for web browsers in OS3.9).");
helptext.push_back("");

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -39,7 +46,7 @@ public:
if (actionEvent.getSource() == cmdSystemROMs)
{
fetch_rompath(tmp, sizeof tmp);
fetch_rompath(tmp, MAX_PATH);
if (SelectFolder("Folder for System ROMs", tmp))
{
set_rompath(tmp);
@ -50,7 +57,7 @@ public:
}
else if (actionEvent.getSource() == cmdConfigPath)
{
fetch_configurationpath(tmp, sizeof tmp);
fetch_configurationpath(tmp, MAX_PATH);
if (SelectFolder("Folder for configuration files", tmp))
{
set_configurationpath(tmp);
@ -219,10 +226,10 @@ void RefreshPanelPaths()
{
char tmp[MAX_PATH];
fetch_rompath(tmp, sizeof tmp);
fetch_rompath(tmp, MAX_PATH);
txtSystemROMs->setText(tmp);
fetch_configurationpath(tmp, sizeof tmp);
fetch_configurationpath(tmp, MAX_PATH);
txtConfigPath->setText(tmp);
fetch_controllerspath(tmp, MAX_PATH);
@ -235,8 +242,8 @@ void RefreshPanelPaths()
bool HelpPanelPaths(std::vector<std::string> &helptext)
{
helptext.clear();
helptext.push_back("Specify the location of your kickstart roms and the folder where the configurations and controller files should be stored.");
helptext.push_back("Use the \"...\" button to open a dialog to choose the folder.");
helptext.push_back("Specify the location of your kickstart roms and the folders where the configurations and controller files should be stored.");
helptext.push_back("With the button \"...\" you can open a dialog to choose the folder.");
helptext.push_back("");
helptext.push_back("After changing the location of the kickstart roms, click on \"Rescan\" to refresh the list of the available");
helptext.push_back("ROMs.");

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"
@ -111,77 +118,86 @@ static MemorySliderActionListener* memorySliderActionListener;
void InitPanelRAM(const struct _ConfigCategory& category)
{
memorySliderActionListener = new MemorySliderActionListener();
memorySliderActionListener = new MemorySliderActionListener();
int sldWidth;
int markerLength;
#ifdef ANDROID
sldWidth = 150;
markerLength = 30;
#else
sldWidth = 110;
markerLength = 20;
#endif
lblChipmem = new gcn::Label("Chip:");
sldChipmem = new gcn::Slider(0, 4);
sldChipmem->setSize(110, SLIDER_HEIGHT);
sldChipmem->setBaseColor(gui_baseCol);
sldChipmem->setMarkerLength(20);
sldChipmem = new gcn::Slider(0, 4);
sldChipmem->setSize(sldWidth, SLIDER_HEIGHT);
sldChipmem->setBaseColor(gui_baseCol);
sldChipmem->setMarkerLength(markerLength);
sldChipmem->setStepLength(1);
sldChipmem->setId("Chipmem");
sldChipmem->addActionListener(memorySliderActionListener);
lblChipsize = new gcn::Label("None ");
sldChipmem->addActionListener(memorySliderActionListener);
lblChipsize = new gcn::Label("None ");
lblSlowmem = new gcn::Label("Slow:");
sldSlowmem = new gcn::Slider(0, 4);
sldSlowmem->setSize(110, SLIDER_HEIGHT);
sldSlowmem->setBaseColor(gui_baseCol);
sldSlowmem->setMarkerLength(20);
sldSlowmem = new gcn::Slider(0, 4);
sldSlowmem->setSize(sldWidth, SLIDER_HEIGHT);
sldSlowmem->setBaseColor(gui_baseCol);
sldSlowmem->setMarkerLength(markerLength);
sldSlowmem->setStepLength(1);
sldSlowmem->setId("Slowmem");
sldSlowmem->addActionListener(memorySliderActionListener);
lblSlowsize = new gcn::Label("None ");
sldSlowmem->addActionListener(memorySliderActionListener);
lblSlowsize = new gcn::Label("None ");
lblFastmem = new gcn::Label("Z2 Fast:");
sldFastmem = new gcn::Slider(0, 4);
sldFastmem->setSize(110, SLIDER_HEIGHT);
sldFastmem->setBaseColor(gui_baseCol);
sldFastmem->setMarkerLength(20);
sldFastmem = new gcn::Slider(0, 4);
sldFastmem->setSize(sldWidth, SLIDER_HEIGHT);
sldFastmem->setBaseColor(gui_baseCol);
sldFastmem->setMarkerLength(markerLength);
sldFastmem->setStepLength(1);
sldFastmem->setId("Fastmem");
sldFastmem->addActionListener(memorySliderActionListener);
lblFastsize = new gcn::Label("None ");
sldFastmem->addActionListener(memorySliderActionListener);
lblFastsize = new gcn::Label("None ");
lblZ3mem = new gcn::Label("Z3 fast:");
sldZ3mem = new gcn::Slider(0, 8);
sldZ3mem->setSize(110, SLIDER_HEIGHT);
sldZ3mem->setBaseColor(gui_baseCol);
sldZ3mem->setMarkerLength(20);
sldZ3mem = new gcn::Slider(0, 8);
sldZ3mem->setSize(sldWidth, SLIDER_HEIGHT);
sldZ3mem->setBaseColor(gui_baseCol);
sldZ3mem->setMarkerLength(markerLength);
sldZ3mem->setStepLength(1);
sldZ3mem->setId("Z3mem");
sldZ3mem->addActionListener(memorySliderActionListener);
lblZ3size = new gcn::Label("None ");
sldZ3mem->addActionListener(memorySliderActionListener);
lblZ3size = new gcn::Label("None ");
lblGfxmem = new gcn::Label("RTG board:");
sldGfxmem = new gcn::Slider(0, 5);
sldGfxmem->setSize(110, SLIDER_HEIGHT);
sldGfxmem->setBaseColor(gui_baseCol);
sldGfxmem->setMarkerLength(20);
sldGfxmem = new gcn::Slider(0, 5);
sldGfxmem->setSize(sldWidth, SLIDER_HEIGHT);
sldGfxmem->setBaseColor(gui_baseCol);
sldGfxmem->setMarkerLength(markerLength);
sldGfxmem->setStepLength(1);
sldGfxmem->setId("Gfxmem");
sldGfxmem->addActionListener(memorySliderActionListener);
lblGfxsize = new gcn::Label("None ");
sldGfxmem->addActionListener(memorySliderActionListener);
lblGfxsize = new gcn::Label("None ");
lblA3000Lowmem = new gcn::Label("A4000 Motherb. slot:");
sldA3000Lowmem = new gcn::Slider(0, 2);
sldA3000Lowmem->setSize(110, SLIDER_HEIGHT);
sldA3000Lowmem->setBaseColor(gui_baseCol);
sldA3000Lowmem->setMarkerLength(20);
sldA3000Lowmem = new gcn::Slider(0, 2);
sldA3000Lowmem->setSize(sldWidth, SLIDER_HEIGHT);
sldA3000Lowmem->setBaseColor(gui_baseCol);
sldA3000Lowmem->setMarkerLength(markerLength);
sldA3000Lowmem->setStepLength(1);
sldA3000Lowmem->setId("A3000Low");
sldA3000Lowmem->addActionListener(memorySliderActionListener);
lblA3000Lowsize = new gcn::Label("None ");
sldA3000Lowmem->addActionListener(memorySliderActionListener);
lblA3000Lowsize = new gcn::Label("None ");
lblA3000Highmem = new gcn::Label("A4000 Proc. board:");
sldA3000Highmem = new gcn::Slider(0, 3);
sldA3000Highmem->setSize(110, SLIDER_HEIGHT);
sldA3000Highmem->setBaseColor(gui_baseCol);
sldA3000Highmem->setMarkerLength(20);
sldA3000Highmem = new gcn::Slider(0, 3);
sldA3000Highmem->setSize(sldWidth, SLIDER_HEIGHT);
sldA3000Highmem->setBaseColor(gui_baseCol);
sldA3000Highmem->setMarkerLength(markerLength);
sldA3000Highmem->setStepLength(1);
sldA3000Highmem->setId("A3000High");
sldA3000Highmem->addActionListener(memorySliderActionListener);
lblA3000Highsize = new gcn::Label("None ");
sldA3000Highmem->addActionListener(memorySliderActionListener);
lblA3000Highsize = new gcn::Label("None ");
grpRAM = new gcn::Window("Memory Settings");
grpRAM->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
@ -196,7 +212,7 @@ void InitPanelRAM(const struct _ConfigCategory& category)
grpRAM->add(sldSlowmem, 160, posY);
grpRAM->add(lblSlowsize, 160 + sldSlowmem->getWidth() + 12, posY);
posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblFastmem, 8, posY);
grpRAM->add(sldFastmem, 160, posY);
grpRAM->add(lblFastsize, 160 + sldFastmem->getWidth() + 12, posY);

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeDropDown.hpp"

View file

@ -1,8 +1,16 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_image.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <SDL_image.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeCheckBox.hpp"
@ -254,9 +262,12 @@ void RefreshPanelSavestate()
bool HelpPanelSavestate(std::vector<std::string> &helptext)
{
helptext.clear();
helptext.push_back("Savestates are stored with the name of the disk in drive DF0 attached with the selected number.");
helptext.push_back("");
helptext.push_back("Note: Savestates will not work with HDDs.");
return true;
helptext.clear();
helptext.push_back("Savestates are stored with the name of the disk in drive DF0 attached with the selected number.");
helptext.push_back("");
helptext.push_back("When you hold left shoulder button and press 'l' during emulation, the state of the last active number will be");
helptext.push_back("loaded. Hold left shoulder button and press 's' to save the current state in the last active slot.");
helptext.push_back("");
helptext.push_back("Note: Savestates will not work with HDDs.");
return true;
}

View file

@ -1,7 +1,14 @@
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
#include "UaeCheckBox.hpp"
@ -287,8 +294,15 @@ void InitPanelSound(const struct _ConfigCategory& category)
grpMode->setSize(90, 90);
grpMode->setBaseColor(gui_baseCol);
int labelWidth;
#ifdef ANDROID
labelWidth = 135;
#else
labelWidth = 130;
#endif
lblInterpolation = new gcn::Label("Interpolation:");
lblInterpolation->setSize(130, LABEL_HEIGHT);
lblInterpolation->setSize(labelWidth, LABEL_HEIGHT);
lblInterpolation->setAlignment(gcn::Graphics::RIGHT);
cboInterpolation = new gcn::UaeDropDown(&interpolationTypeList);
cboInterpolation->setSize(160, DROPDOWN_HEIGHT);
@ -298,7 +312,7 @@ void InitPanelSound(const struct _ConfigCategory& category)
cboInterpolation->addActionListener(soundActionListener);
lblFilter = new gcn::Label("Filter:");
lblFilter->setSize(130, LABEL_HEIGHT);
lblFilter->setSize(labelWidth, LABEL_HEIGHT);
lblFilter->setAlignment(gcn::Graphics::RIGHT);
cboFilter = new gcn::UaeDropDown(&filterTypeList);
cboFilter->setSize(160, DROPDOWN_HEIGHT);
@ -308,7 +322,7 @@ void InitPanelSound(const struct _ConfigCategory& category)
cboFilter->addActionListener(soundActionListener);
lblSeparation = new gcn::Label("Stereo separation:");
lblSeparation->setSize(130, LABEL_HEIGHT);
lblSeparation->setSize(labelWidth, LABEL_HEIGHT);
lblSeparation->setAlignment(gcn::Graphics::RIGHT);
sldSeparation = new gcn::Slider(0, 10);
sldSeparation->setSize(160, SLIDER_HEIGHT);
@ -320,7 +334,7 @@ void InitPanelSound(const struct _ConfigCategory& category)
lblSeparationInfo = new gcn::Label("100%");
lblStereoDelay = new gcn::Label("Stereo delay:");
lblStereoDelay->setSize(130, LABEL_HEIGHT);
lblStereoDelay->setSize(labelWidth, LABEL_HEIGHT);
lblStereoDelay->setAlignment(gcn::Graphics::RIGHT);
sldStereoDelay = new gcn::Slider(0, 10);
sldStereoDelay->setSize(160, SLIDER_HEIGHT);

View file

@ -1,10 +1,17 @@
#include <algorithm>
#include <guisan.hpp>
#include <iostream>
#include <sstream>
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -24,7 +31,7 @@
#define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400
#if defined(AMIBERRY) || defined(ANDROID)
#if defined(ANDROID)
#define FILE_SELECT_KEEP_POSITION
#endif
@ -228,7 +235,11 @@ static void InitSelectFile(const char* title)
lstFiles->addActionListener(selectFileActionListener);
scrAreaFiles = new gcn::ScrollArea(lstFiles);
#ifdef USE_SDL1
scrAreaFiles->setFrameSize(1);
#elif USE_SDL2
scrAreaFiles->setBorderSize(1);
#endif
scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272);
scrAreaFiles->setScrollbarWidth(20);

View file

@ -1,10 +1,18 @@
#include <algorithm>
#include <guisan.hpp>
#include <iostream>
#include <sstream>
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -89,7 +97,7 @@ static DirListModel dirList(".");
static void checkfoldername(char* current)
{
char actualpath[PATH_MAX];
char actualpath [MAX_PATH];
DIR* dir;
if ((dir = opendir(current)))

View file

@ -1,9 +1,15 @@
#include "osdep/gui/SelectorEntry.hpp"
#ifdef USE_SDL1
#include "guichan/widgets/container.hpp"
#include "guichan/widgets/icon.hpp"
#include "guichan/widgets/label.hpp"
#elif USE_SDL2
#include "guisan/widgets/container.hpp"
#include "guisan/widgets/icon.hpp"
#include "guisan/widgets/label.hpp"
#endif
namespace gcn
{

View file

@ -1,9 +1,16 @@
#ifndef GCN_SELECTORENTRY_HPP
#define GCN_SELECTORENTRY_HPP
#ifdef USE_SDL1
#include "guichan/basiccontainer.hpp"
#include "guichan/graphics.hpp"
#include "guichan/platform.hpp"
#include "guichan/widgetlistener.hpp"
#elif USE_SDL2
#include <guisan/basiccontainer.hpp>
#include <guisan/platform.hpp>
#include <guisan/widgetlistener.hpp>
#endif
#include <string>
namespace gcn

View file

@ -1,10 +1,16 @@
#include <algorithm>
#include <guisan.hpp>
#include <iostream>
#include <sstream>
#ifdef USE_SDL1
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -94,7 +100,11 @@ static void InitShowHelp(const vector<string>& helptext)
lstHelp->setWrappingEnabled(true);
scrAreaHelp = new gcn::ScrollArea(lstHelp);
#ifdef USE_SDL1
scrAreaHelp->setFrameSize(1);
#elif USE_SDL2
scrAreaHelp->setBorderSize(1);
#endif
scrAreaHelp->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
scrAreaHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4,
DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10);

View file

@ -1,10 +1,18 @@
#include <algorithm>
#include <guisan.hpp>
#include <iostream>
#include <sstream>
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"

View file

@ -1,7 +1,15 @@
#include "UaeCheckBox.hpp"
#ifdef USE_SDL1
#include "guichan/widgets/checkbox.hpp"
#include "guichan/font.hpp"
#include "guichan/graphics.hpp"
#include "guichan/key.hpp"
#include "guichan/mouseinput.hpp"
#elif USE_SDL2
#include <guisan/widgets/checkbox.hpp>
#include <guisan/graphics.hpp>
#endif
namespace gcn
{

View file

@ -4,10 +4,17 @@
#include <map>
#include <string>
#ifdef USE_SDL1
#include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp"
#include "guichan/widget.hpp"
#include "guichan/widgets/checkbox.hpp"
#elif USE_SDL2
#include <guisan/platform.hpp>
#include <guisan/widget.hpp>
#include <guisan/widgets/checkbox.hpp>
#endif
namespace gcn
{

View file

@ -1,6 +1,15 @@
#include "UaeDropDown.hpp"
#ifdef USE_SDL1
#include "guichan/widgets/dropdown.hpp"
#include "guichan/font.hpp"
#include "guichan/graphics.hpp"
#include "guichan/key.hpp"
#include "guichan/mouseinput.hpp"
#elif USE_SDL2
#include <guisan/widgets/dropdown.hpp>
#include <guisan/key.hpp>
#endif
namespace gcn
{
@ -35,13 +44,21 @@ namespace gcn
{
setSelected(getSelected() - 1);
keyEvent.consume();
#ifdef USE_SDL1
distributeActionEvent();
#elif USE_SDL2
distributeValueChangedEvent();
#endif
}
else if (key.getValue() == Key::DOWN)
{
setSelected(getSelected() + 1);
keyEvent.consume();
#ifdef USE_SDL1
distributeActionEvent();
#elif USE_SDL2
distributeValueChangedEvent();
#endif
}
}

View file

@ -1,12 +1,21 @@
#ifndef GCN_UAEDROPDOWN_HPP
#define GCN_UAEDROPDOWN_HPP
#include <string>
#ifdef USE_SDL1
#include <map>
#include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp"
#include "guichan/widget.hpp"
#include "guichan/widgets/dropdown.hpp"
#elif USE_SDL2
#include <guisan/keylistener.hpp>
#include <guisan/platform.hpp>
#include <guisan/widget.hpp>
#include <guisan/widgets/dropdown.hpp>
#endif
#include <string>
namespace gcn

View file

@ -1,9 +1,21 @@
#include "UaeListBox.hpp"
#ifdef USE_SDL1
#include "guichan/widgets/listbox.hpp"
#include "guichan/basiccontainer.hpp"
#include "guichan/font.hpp"
#include "guichan/graphics.hpp"
#include "guichan/key.hpp"
#include "guichan/listmodel.hpp"
#include "guichan/mouseinput.hpp"
#include "guichan/selectionlistener.hpp"
#elif USE_SDL2
#include <guisan/widgets/listbox.hpp>
#include <guisan/basiccontainer.hpp>
#include <guisan/font.hpp>
#include <guisan/graphics.hpp>
#include <guisan/listmodel.hpp>
#endif
namespace gcn
{
@ -40,7 +52,11 @@ namespace gcn
// Check the current clip area so we don't draw unnecessary items
// that are not visible.
const ClipRectangle currentClipArea = graphics->getCurrentClipArea();
#ifdef USE_SDL1
int rowHeight = getRowHeight();
#elif USE_SDL2
const int rowHeight = getFont()->getHeight();
#endif
// Calculate the number of rows to draw by checking the clip area.
// The addition of two makes covers a partial visible row at the top

View file

@ -3,11 +3,19 @@
#include <list>
#ifdef USE_SDL1
#include "guichan/keylistener.hpp"
#include "guichan/listmodel.hpp"
#include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp"
#include "guichan/widget.hpp"
#include "guichan/widgets/listbox.hpp"
#elif USE_SDL2
#include <guisan/listmodel.hpp>
#include <guisan/platform.hpp>
#include <guisan/widget.hpp>
#include <guisan/widgets/listbox.hpp>
#endif
namespace gcn
{

View file

@ -1,6 +1,15 @@
#include "UaeRadioButton.hpp"
#ifdef USE_SDL1
#include "guichan/widgets/radiobutton.hpp"
#include "guichan/font.hpp"
#include "guichan/graphics.hpp"
#include "guichan/key.hpp"
#include "guichan/mouseinput.hpp"
#elif USE_SDL2
#include <guisan/widgets/radiobutton.hpp>
#include <guisan/graphics.hpp>
#endif
namespace gcn
{

View file

@ -4,9 +4,17 @@
#include <map>
#include <string>
#ifdef USE_SDL1
#include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp"
#include "guichan/widget.hpp"
#include "guichan/widgets/radiobutton.hpp"
#elif USE_SDL2
#include <guisan/platform.hpp>
#include <guisan/widget.hpp>
#include <guisan/widgets/radiobutton.hpp>
#endif
namespace gcn

View file

@ -17,7 +17,9 @@
#define DROPDOWN_HEIGHT 15
#define SLIDER_HEIGHT 18
#define TITLEBAR_HEIGHT 24
#ifdef USE_SDL2
#include <guisan/sdl/sdlinput.hpp>
#endif
typedef struct _ConfigCategory
{

View file

@ -1,8 +1,15 @@
#include <iostream>
#ifdef USE_SDL1
#include <guichan.hpp>
#include <SDL/SDL_ttf.h>
#include <guichan/sdl.hpp>
#include "sdltruetypefont.hpp"
#elif USE_SDL2
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@ -96,10 +103,12 @@ enum
* SDL Stuff we need
*/
SDL_Surface* gui_screen;
SDL_Texture* gui_texture;
SDL_Event gui_event;
#ifdef USE_SDL2
SDL_Texture* gui_texture;
SDL_Cursor* cursor;
SDL_Surface* cursorSurface;
#endif
/*
* Guisan SDL stuff we need
@ -214,16 +223,22 @@ static void ShowHelpRequested()
void UpdateGuiScreen()
{
#ifdef USE_SDL1
wait_for_vsync();
SDL_Flip(gui_screen);
#elif USE_SDL2
// Update the texture from the surface
SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch);
// Copy the texture on the renderer
SDL_RenderCopy(renderer, gui_texture, nullptr, nullptr);
// Update the window surface (show the renderer)
SDL_RenderPresent(renderer);
#endif
}
namespace sdl
{
#ifdef USE_SDL2
// Sets the cursor image up
void setup_cursor()
{
@ -257,12 +272,30 @@ namespace sdl
SDL_SetCursor(cursor);
}
#endif
void gui_init()
{
#ifdef USE_SDL1
//-------------------------------------------------
// Set layer for GUI screen
//-------------------------------------------------
char tmp[20];
snprintf(tmp, 20, "%dx%d", GUI_WIDTH, GUI_HEIGHT);
setenv("SDL_OMAP_LAYER_SIZE", tmp, 1);
snprintf(tmp, 20, "0,0,0,0");
setenv("SDL_OMAP_BORDER_CUT", tmp, 1);
#endif
//-------------------------------------------------
// Create new screen for GUI
//-------------------------------------------------
#ifdef USE_SDL1
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
gui_screen = SDL_SetVideoMode(GUI_WIDTH, GUI_HEIGHT, 16, SDL_SWSURFACE | SDL_FULLSCREEN);
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
#endif
#ifdef USE_SDL2
setup_cursor();
// make the scaled rendering look smoother (linear scaling).
@ -275,20 +308,21 @@ namespace sdl
gui_texture = SDL_CreateTextureFromSurface(renderer, gui_screen);
check_error_sdl(gui_texture == nullptr, "Unable to create texture");
#endif
#ifdef ANDROIDSDL
// Enable Android multitouch
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
SDL_JoystickOpen(0);
#endif
#ifdef USE_SDL2
if (cursor)
{
SDL_ShowCursor(SDL_ENABLE);
}
#endif
//-------------------------------------------------
// Create helpers for guisan
// Create helpers for GUI framework
//-------------------------------------------------
gui_imageLoader = new gcn::SDLImageLoader();
// The ImageLoader in use is static and must be set to be
@ -312,6 +346,10 @@ namespace sdl
delete gui_input;
delete gui_graphics;
#ifdef USE_SDL1
if (gui_screen != nullptr)
SDL_FreeSurface(gui_screen);
#elif USE_SDL2
SDL_FreeSurface(gui_screen);
SDL_DestroyTexture(gui_texture);
@ -327,6 +365,7 @@ namespace sdl
SDL_FreeSurface(cursorSurface);
cursorSurface = nullptr;
}
#endif
gui_screen = nullptr;
}
@ -737,7 +776,11 @@ namespace widgets
selectors = new gcn::Container();
selectors->setSize(150, workAreaHeight - 2);
selectors->setBaseColor(colSelectorInactive);
#ifdef USE_SDL1
selectors->setFrameSize(1);
#elif USE_SDL2
selectors->setBorderSize(1);
#endif
int panelStartX = DISTANCE_BORDER + selectors->getWidth() + 2 + 11;
panelFocusListener = new PanelFocusListener();
@ -753,7 +796,11 @@ namespace widgets
categories[i].panel->setId(categories[i].category);
categories[i].panel->setSize(GUI_WIDTH - panelStartX - DISTANCE_BORDER - 1, workAreaHeight - 2);
categories[i].panel->setBaseColor(gui_baseCol);
#ifdef USE_SDL1
categories[i].panel->setFrameSize(1);
#elif USE_SDLL2
categories[i].panel->setBorderSize(1);
#endif
categories[i].panel->setVisible(false);
}
@ -879,7 +926,7 @@ void run_gui()
#endif
}
// Catch all guisan exceptions.
// Catch all GUI framework exceptions.
catch (gcn::Exception e)
{
cout << e.getMessage() << endl;

View file

@ -395,7 +395,7 @@ void translate_amiberry_keys(int scancode, int newstate)
inputdevice_translatekeycode(0, translatedScancode, newstate);
}
int target_checkcapslock(int scancode, int *state)
int target_checkcapslock(const int scancode, int *state)
{
if (scancode != SDLK_CAPSLOCK && scancode != SDLK_NUMLOCKCLEAR && scancode != SDLK_SCROLLLOCK)
return 0;

View file

@ -161,3 +161,7 @@ STATIC_INLINE uae_u32 atomic_bit_test_and_reset(volatile uae_atomic *p, uae_u32
uae_u32 res = __sync_fetch_and_and(p, ~mask);
return (res && mask);
}
STATIC_INLINE void atomic_set(volatile uae_atomic *p, uae_u32 v)
{
__sync_lock_test_and_set(p, v);
}

View file

@ -39,6 +39,23 @@ STATIC_INLINE void uae_end_thread (uae_thread_id *tid)
{
}
#ifdef USE_SDL1
STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo)
{
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg);
if(foo != NULL)
*foo = id;
return (int)id;
}
STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo)
{
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg);
if(foo != NULL)
*foo = id;
return (int)id;
}
#elif USE_SDL2
STATIC_INLINE uae_thread_id uae_start_thread(const TCHAR* name, void*(*f)(void*), void* arg, uae_thread_id* foo)
{
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThread", arg);
@ -54,6 +71,7 @@ STATIC_INLINE uae_thread_id uae_start_thread_fast(void*(*f)(void*), void* arg, u
*foo = id;
return id;
}
#endif
STATIC_INLINE void uae_wait_thread (uae_thread_id thread)
{