Synced files to Master branch

This commit is contained in:
Dimitris Panokostas 2017-01-23 16:21:29 +01:00
parent 1289917651
commit d81cf4c916
22 changed files with 540 additions and 510 deletions

View file

@ -132,7 +132,7 @@ static bool chipdone;
static void (*card_init[MAX_EXPANSION_BOARDS]) (void);
static void (*card_map[MAX_EXPANSION_BOARDS]) (void);
static TCHAR *card_name[MAX_EXPANSION_BOARDS];
static const char *card_name[MAX_EXPANSION_BOARDS];
static int ecard, cardno;

View file

@ -3166,7 +3166,7 @@ static void move_exkeys (Unit *unit, a_inode *from, a_inode *to)
static bool get_statinfo(Unit *unit, a_inode *aino, struct mystat *statbuf)
{
bool ok = true;
memset (statbuf, 0, sizeof statbuf);
memset (statbuf, 0, sizeof &statbuf);
/* No error checks - this had better work. */
if (unit->volflags & MYVOLUMEINFO_ARCHIVE)
ok = zfile_stat_archive (aino->nname, statbuf) != 0;
@ -3183,7 +3183,7 @@ static void
int i, n, entrytype, blocksize;
uae_s64 numblocks;
int fsdb_can = fsdb_cando (unit);
TCHAR *xs;
const char *xs;
char *x, *x2;
if (!get_statinfo(unit, aino, &statbuf)) {
@ -3498,7 +3498,8 @@ static int exalldo (uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaec
int i;
int size, size2;
int entrytype;
TCHAR *xs = NULL, *commentx = NULL;
TCHAR *xs = NULL;
const char *commentx = NULL;
uae_u32 flags = 15;
int days, mins, ticks;
struct mystat statbuf;
@ -3959,7 +3960,7 @@ static void action_examine_next (Unit *unit, dpacket packet, bool largefilesize)
uae_u32 uniq;
TRACE((_T("ACTION_EXAMINE_NEXT(0x%lx,0x%lx,%d)\n"), lock, info, largefilesize));
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
DUMPLOCK(unit, lock);
if (lock != 0)
@ -4272,7 +4273,7 @@ static void
return;
}
TRACE((_T("ACTION_READ(%s,0x%lx,%ld)\n"), k->aino->nname, addr, size));
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
if (size == 0) {
PUT_PCK_RES1 (packet, 0);
@ -4366,7 +4367,7 @@ static void
return;
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
TRACE((_T("ACTION_WRITE(%s,0x%lx,%ld)\n"), k->aino->nname, addr, size));
if (unit->ui.readonly || unit->ui.locked) {
@ -4447,7 +4448,7 @@ static void
cur = k->file_pos;
TRACE((_T("ACTION_SEEK(%s,%d,%d)=%d\n"), k->aino->nname, pos, mode, cur));
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
filesize = fs_fsize64 (k->fd);
@ -4509,7 +4510,7 @@ static void
PUT_PCK_RES1 (packet, DOS_TRUE);
}
notify_check (unit, a);
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void action_set_comment (Unit * unit, dpacket packet)
@ -4567,7 +4568,7 @@ static void action_set_comment (Unit * unit, dpacket packet)
a->comment = commented;
fsdb_set_file_attrs (a);
notify_check (unit, a);
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void
@ -4749,7 +4750,7 @@ static void
notify_check (unit, aino);
updatedirtime (aino, 0);
PUT_PCK_RES1 (packet, make_lock (unit, aino->uniq, -2) >> 2);
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void
@ -4808,7 +4809,7 @@ static void
return;
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
k->notifyactive = 1;
/* If any open files have file pointers beyond this size, truncate only
* so far that these pointers do not become invalid. */
@ -4948,7 +4949,7 @@ static void
delete_aino (unit, a);
}
PUT_PCK_RES1 (packet, DOS_TRUE);
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void
@ -4987,7 +4988,7 @@ static void
notify_check (unit, a);
PUT_PCK_RES1 (packet, DOS_TRUE);
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void
@ -5092,7 +5093,7 @@ static void
if (a2->elock > 0 || a2->shlock > 0 || wehavekeys > 0)
de_recycle_aino (unit, a2);
PUT_PCK_RES1 (packet, DOS_TRUE);
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
gui_flicker_led (UNIT_LED(unit), 1);
}
static void
@ -5204,7 +5205,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet)
whence = SEEK_SET;
TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%lld,%d)\n"), k->aino->nname, pos, mode));
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
cur = k->file_pos;
{
@ -5277,7 +5278,7 @@ static void action_change_file_size64 (Unit *unit, dpacket packet)
return;
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
k->notifyactive = 1;
/* If any open files have file pointers beyond this size, truncate only
* so far that these pointers do not become invalid. */
@ -5373,7 +5374,7 @@ static void action_set_file_size64(Unit *unit, dpacket packet)
return;
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
k->notifyactive = 1;
/* If any open files have file pointers beyond this size, truncate only
* so far that these pointers do not become invalid. */
@ -5422,7 +5423,7 @@ static void action_seek64(Unit *unit, dpacket packet)
whence = SEEK_SET;
TRACE((_T("ACTION_SEEK64(%s,%lld,%d)\n"), k->aino->nname, pos, mode));
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
gui_flicker_led (UNIT_LED(unit), 1);
cur = k->file_pos;
{
@ -6228,7 +6229,7 @@ static uae_u32 rl (uae_u8 *p)
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
}
int rdb_checksum (uae_char *id, uae_u8 *p, int block)
int rdb_checksum (const char *id, uae_u8 *p, int block)
{
uae_u32 sum = 0;
int i, blocksize;
@ -6776,7 +6777,7 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context)
put_long (parmpacket + PP_ADDTOFSRES, 0);
put_long (parmpacket + PP_FSSIZE, 0);
gui_flicker_led (LED_HD, unit_no, 0);
gui_flicker_led (LED_HD, 0);
type = is_hardfile (unit_no);
if (type == FILESYS_HARDFILE_RDB) {
/* RDB hardfile */

View file

@ -700,7 +700,7 @@ int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
static uae_u64 cmd_readx (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
{
gui_flicker_led (LED_HD, hfd->unitnum, 1);
gui_flicker_led (LED_HD, 1);
return hdf_read (hfd, dataptr, offset, len);
}
static uae_u64 cmd_read (struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
@ -712,7 +712,7 @@ static uae_u64 cmd_read (struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offs
}
static uae_u64 cmd_writex (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
{
gui_flicker_led (LED_HD, hfd->unitnum, 2);
gui_flicker_led (LED_HD, 1);
return hdf_write (hfd, dataptr, offset, len);
}

View file

@ -82,7 +82,7 @@ struct device_info {
TCHAR vendorid[10];
TCHAR productid[18];
TCHAR revision[6];
TCHAR *backend;
char const *backend;
struct cd_toc_head toc;
};

View file

@ -86,9 +86,14 @@ STATIC_INLINE uae_u16 INTREQR (void)
}
/* maximums for statically allocated tables */
#ifdef UAE_MINI
/* absolute minimums for basic A500/A1200-emulation */
#define MAXHPOS 227
#define MAXVPOS 314
#define MAXVPOS 312
#else
#define MAXHPOS 256
#define MAXVPOS 592
#endif
/* PAL/NTSC values */
@ -130,7 +135,11 @@ extern int vblank_hz;
/* 100 words give you 1600 horizontal pixels. Should be more than enough for
* superhires. Don't forget to update the definition in genp2c.c as well.
* needs to be larger for superhires support */
#ifdef CUSTOM_SIMPLE
#define MAX_WORDS_PER_LINE 50
#else
#define MAX_WORDS_PER_LINE 100
#endif
/* AGA mode color lookup tables */
extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
@ -143,12 +152,14 @@ extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
/* get resolution from bplcon0 */
STATIC_INLINE int GET_RES_DENISE (uae_u16 con0)
{
return ((con0) & 0x8000) ? RES_HIRES : RES_LORES;
if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE))
con0 &= ~0x40; // SUPERHIRES
return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES;
}
STATIC_INLINE int GET_RES_AGNUS (uae_u16 con0)
{
if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
con0 &= ~0x40; // no SUPERHIRES
con0 &= ~0x40; // SUPERHIRES
return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES;
}
/* get sprite width from FMODE */

View file

@ -23,26 +23,26 @@
#define lores_shift 0
extern bool aga_mode;
STATIC_INLINE int coord_hw_to_window_x (int x)
STATIC_INLINE int coord_hw_to_window_x(int x)
{
x -= DISPLAY_LEFT_SHIFT;
x -= DISPLAY_LEFT_SHIFT;
return x;
}
STATIC_INLINE int coord_window_to_hw_x (int x)
STATIC_INLINE int coord_window_to_hw_x(int x)
{
return x + DISPLAY_LEFT_SHIFT;
return x + DISPLAY_LEFT_SHIFT;
}
STATIC_INLINE int coord_diw_to_window_x (int x)
STATIC_INLINE int coord_diw_to_window_x(int x)
{
return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1);
}
STATIC_INLINE int coord_window_to_diw_x (int x)
STATIC_INLINE int coord_window_to_diw_x(int x)
{
x = coord_window_to_hw_x (x);
return x - DIW_DDF_OFFSET;
x = coord_window_to_hw_x(x);
return x - DIW_DDF_OFFSET;
}
extern int framecnt;
@ -54,9 +54,9 @@ extern int framecnt;
* !!! See color_reg_xxx functions below before touching !!!
*/
struct color_entry {
uae_u16 color_regs_ecs[32];
xcolnr acolors[256];
uae_u32 color_regs_aga[256];
uae_u16 color_regs_ecs[32];
xcolnr acolors[256];
uae_u32 color_regs_aga[256];
bool borderblank, bordersprite;
};
@ -68,19 +68,20 @@ struct color_entry {
#else
STATIC_INLINE uae_u16 CONVERT_RGB(uae_u32 c)
{
uae_u16 ret;
__asm__ (
"ubfx r1, %[c], #19, #5 \n\t"
"ubfx r2, %[c], #10, #6 \n\t"
"ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" );
return ret;
uae_u16 ret;
__asm__(
"ubfx r1, %[c], #19, #5 \n\t"
"ubfx r2, %[c], #10, #6 \n\t"
"ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1",
"r2");
return ret;
}
#endif
STATIC_INLINE xcolnr getxcolor (int c)
STATIC_INLINE xcolnr getxcolor(int c)
{
if (aga_mode)
return CONVERT_RGB(c);
@ -89,7 +90,7 @@ STATIC_INLINE xcolnr getxcolor (int c)
}
/* functions for reading, writing, copying and comparing struct color_entry */
STATIC_INLINE int color_reg_get (struct color_entry *ce, int c)
STATIC_INLINE int color_reg_get(struct color_entry *ce, int c)
{
if (aga_mode)
return ce->color_regs_aga[c];
@ -97,7 +98,7 @@ STATIC_INLINE int color_reg_get (struct color_entry *ce, int c)
return ce->color_regs_ecs[c];
}
STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v)
STATIC_INLINE void color_reg_set(struct color_entry *ce, int c, int v)
{
if (aga_mode)
ce->color_regs_aga[c] = v;
@ -106,15 +107,15 @@ STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v)
}
/* ugly copy hack, is there better solution? */
STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *src)
STATIC_INLINE void color_reg_cpy(struct color_entry *dst, struct color_entry *src)
{
dst->borderblank = src->borderblank;
if (aga_mode)
/* copy acolors and color_regs_aga */
memcpy (dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else
/* copy first 32 acolors and color_regs_ecs */
memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32);
if (aga_mode)
/* copy acolors and color_regs_aga */
memcpy(dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else
/* copy first 32 acolors and color_regs_ecs */
memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32);
}
/*
@ -128,14 +129,17 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
#define COLOR_CHANGE_BRDBLANK 0x80000000
struct color_change {
int linepos;
int regno;
unsigned int value;
int linepos;
int regno;
unsigned int value;
};
/* 440 rather than 880, since sprites are always lores. */
#ifdef UAE_MINI
#define MAX_PIXELS_PER_LINE 880
#define MAX_VIDHEIGHT 270
#else
#define MAX_PIXELS_PER_LINE 1760
#endif
/* No divisors for MAX_PIXELS_PER_LINE; we support AGA and may one day
want to use SHRES sprites. */
@ -143,22 +147,22 @@ struct color_change {
struct sprite_entry
{
unsigned short pos;
unsigned short max;
unsigned int first_pixel;
bool has_attached;
unsigned short pos;
unsigned short max;
unsigned int first_pixel;
bool has_attached;
};
union sps_union {
uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4];
uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4];
};
extern union sps_union spixstate;
extern uae_u16 spixels[MAX_SPR_PIXELS];
extern uae_u16 spixels[MAX_SPR_PIXELS * 2];
/* Way too much... */
#define MAX_REG_CHANGE ((MAXVPOS + 1) * MAXHPOS)
#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS)
extern struct color_entry curr_color_tables[(MAXVPOS + 2) * 2];
@ -170,26 +174,26 @@ extern struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1];
* comparison (smart update stuff). */
struct decision {
/* Records the leftmost access of BPL1DAT. */
int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */
int diwfirstword, diwlastword;
int ctable;
int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */
int diwfirstword, diwlastword;
int ctable;
uae_u16 bplcon0, bplcon2;
uae_u16 bplcon3, bplcon4;
uae_u8 nr_planes;
uae_u8 bplres;
bool ham_seen;
bool ham_at_start;
uae_u16 bplcon0, bplcon2;
uae_u16 bplcon3, bplcon4;
uae_u8 nr_planes;
uae_u8 bplres;
bool ham_seen;
bool ham_at_start;
bool bordersprite_seen;
};
/* Anything related to changes in hw registers during the DDF for one
* line. */
struct draw_info {
int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change;
int nr_color_changes, nr_sprites;
int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change;
int nr_color_changes, nr_sprites;
};
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
@ -197,18 +201,18 @@ extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
/* Functions in drawing.c. */
extern int coord_native_to_amiga_y (int);
extern int coord_native_to_amiga_x (int);
extern int coord_native_to_amiga_y(int);
extern int coord_native_to_amiga_x(int);
extern void hsync_record_line_state (int lineno);
extern void vsync_handle_redraw (void);
extern void vsync_handle_check (void);
extern void init_hardware_for_drawing_frame (void);
extern void reset_drawing (void);
extern void drawing_init (void);
extern void hsync_record_line_state(int lineno);
extern void vsync_handle_redraw(void);
extern void vsync_handle_check(void);
extern void init_hardware_for_drawing_frame(void);
extern void reset_drawing(void);
extern void drawing_init(void);
extern unsigned long time_per_frame;
extern void adjust_idletime(unsigned long ns_waited);
extern long time_per_frame;
extern void adjust_idletime(long ns_waited);
/* Finally, stuff that shouldn't really be shared. */
@ -218,15 +222,15 @@ extern void adjust_idletime(unsigned long ns_waited);
extern int inhibit_frame;
STATIC_INLINE void set_inhibit_frame (int bit)
STATIC_INLINE void set_inhibit_frame(int bit)
{
inhibit_frame |= 1 << bit;
inhibit_frame |= 1 << bit;
}
STATIC_INLINE void clear_inhibit_frame (int bit)
STATIC_INLINE void clear_inhibit_frame(int bit)
{
inhibit_frame &= ~(1 << bit);
inhibit_frame &= ~(1 << bit);
}
STATIC_INLINE void toggle_inhibit_frame (int bit)
STATIC_INLINE void toggle_inhibit_frame(int bit)
{
inhibit_frame ^= 1 << bit;
inhibit_frame ^= 1 << bit;
}

View file

@ -23,7 +23,7 @@ extern void compute_vsynctime (void);
extern void init_eventtab (void);
extern void events_schedule (void);
extern unsigned long last_synctime;
extern long last_synctime;
typedef void (*evfunc)(void);
typedef void (*evfunc2)(uae_u32);

View file

@ -11,7 +11,7 @@ extern int gui_update (void);
extern void gui_exit (void);
extern void gui_led (int, int);
extern void gui_filename (int, const TCHAR *);
extern void gui_flicker_led (int, int, int);
extern void gui_flicker_led (int, int);
extern void gui_disk_image_change (int, const TCHAR *, bool writeprotected);
extern unsigned int gui_ledstate;
extern void gui_display (int shortcut);

View file

@ -45,8 +45,8 @@ struct inputdevice_functions {
void (*unacquire)(int);
void (*read)(void);
int (*get_num)(void);
TCHAR* (*get_friendlyname)(int);
TCHAR* (*get_uniquename)(int);
const char* (*get_friendlyname)(int);
const char* (*get_uniquename)(int);
int (*get_widget_num)(int);
int (*get_widget_type)(int,int,TCHAR*,uae_u32*);
int (*get_widget_first)(int,int);
@ -181,9 +181,9 @@ extern void inputdevice_swap_compa_ports (struct uae_prefs *p, int portswap);
extern void inputdevice_config_change (void);
extern int inputdevice_config_change_test (void);
extern int inputdevice_get_device_index (int devnum);
extern TCHAR *inputdevice_get_device_name (int type, int devnum);
extern TCHAR *inputdevice_get_device_name2 (int devnum);
extern TCHAR *inputdevice_get_device_unique_name (int type, int devnum);
extern const char *inputdevice_get_device_name(int type, int devnum);
extern const char *inputdevice_get_device_name2(int devnum);
extern const char *inputdevice_get_device_unique_name(int type, int devnum);
extern int inputdevice_get_device_status (int devnum);
extern void inputdevice_set_device_status (int devnum, int enabled);
extern int inputdevice_get_device_total (int type);
@ -285,7 +285,7 @@ extern uae_u64 input_getqualifiers (void);
extern void setsystime (void);
extern int inputdevice_get_device_total (int type);
extern TCHAR *inputdevice_get_device_name (int type, int devnum);
extern const char *inputdevice_get_device_name(int type, int devnum);
#define JSEM_MODE_DEFAULT 0
#define JSEM_MODE_WHEELMOUSE 1

View file

@ -30,15 +30,15 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
#define ROMTYPE_ALL_CART (ROMTYPE_AR | ROMTYPE_HRTMON | ROMTYPE_NORDIC | ROMTYPE_XPOWER | ROMTYPE_CD32CART)
struct romheader {
TCHAR *name;
const char *name;
int id;
};
struct romdata {
TCHAR *name;
const char *name;
int ver, rev;
int subver, subrev;
TCHAR *model;
const char *model;
uae_u32 size;
int id;
int cpu;
@ -46,10 +46,10 @@ struct romdata {
int type;
int group;
int title;
TCHAR *partnumber;
const char *partnumber;
uae_u32 crc32;
uae_u32 sha1[5];
TCHAR *configname;
const char *configname;
};
struct romlist {
@ -92,4 +92,3 @@ extern void addkeyfile (const TCHAR *path);
extern int romlist_count (void);
extern struct romlist *romlist_getit (void);
extern int configure_rom (struct uae_prefs *p, const int *rom, int msg);

View file

@ -14,7 +14,7 @@
*
* Copyright 1996, 1997 Bernd Schmidt
*/
#include <string>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
@ -497,3 +497,5 @@ extern void xfree (const void*);
#define xfree(T) free(T)
#endif
#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)

View file

@ -25,6 +25,7 @@ extern void sleep_millis_main (int ms);
extern void uae_reset (int, int);
extern void uae_quit (void);
extern void host_shutdown(void);
extern void uae_restart (int, const TCHAR*);
extern void reset_all_systems (void);
extern void target_reset (void);

View file

@ -18,13 +18,6 @@ extern int graphics_setup (void);
extern int graphics_init (bool);
extern void graphics_leave (void);
extern void gui_handle_events (void);
STATIC_INLINE void handle_events (void)
{
// Still needed for keyboard reset. Need to move this in keyboard management (events RESET do exist).
gui_handle_events ();
}
extern int handle_msgpump (void);
extern void setup_brkhandler (void);
extern bool vsync_switchmode (int);

View file

@ -71,16 +71,16 @@ struct zvolume
unsigned int id;
uae_s64 archivesize;
unsigned int method;
TCHAR *volumename;
const char *volumename;
int zfdmask;
};
struct zarchive_info
{
TCHAR *name;
const char *name;
uae_s64 size;
int flags;
TCHAR *comment;
const char *comment;
struct mytimeval tv;
};

View file

@ -269,7 +269,7 @@ static void out_config (struct zfile *f, int id, int num, const TCHAR *s1, const
static bool write_config_head (struct zfile *f, int idnum, int devnum, const TCHAR *name, struct uae_input_device *id, struct inputdevice_functions *idf)
{
TCHAR *s = NULL;
const char *s = NULL;
TCHAR tmp2[CONFIG_BLEN];
if (idnum == GAMEPORT_INPUT_SETTINGS) {
@ -2503,7 +2503,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
int ismouse = 0;
int newport = 0;
int flags = 0;
TCHAR *name = NULL;
const char *name = NULL;
int otherbuttonpressed = 0;
int acc = input_acquired;
@ -2562,7 +2562,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
supermouse = i;
}
if (supermouse >= 0 && nummouse == 1) {
TCHAR *oldname = name;
const char *oldname = name;
name = idev[IDTYPE_MOUSE].get_uniquename (supermouse);
issupermouse = true;
}
@ -4289,8 +4289,8 @@ static void matchdevices (struct inputdevice_functions *inf, struct uae_input_de
int i, j;
for (i = 0; i < inf->get_num (); i++) {
TCHAR *aname1 = inf->get_friendlyname (i);
TCHAR *aname2 = inf->get_uniquename (i);
const char *aname1 = inf->get_friendlyname (i);
const char *aname2 = inf->get_uniquename (i);
int match = -1;
for (j = 0; j < MAX_INPUT_DEVICES; j++) {
if (aname2 && uid[j].configname) {
@ -5112,17 +5112,17 @@ int inputdevice_get_device_total (int type)
return idev[type].get_num ();
}
/* returns the name of device */
TCHAR *inputdevice_get_device_name (int type, int devnum)
const char *inputdevice_get_device_name (int type, int devnum)
{
return idev[type].get_friendlyname (devnum);
}
/* returns the name of device */
TCHAR *inputdevice_get_device_name2 (int devnum)
const char *inputdevice_get_device_name2 (int devnum)
{
return getidf (devnum)->get_friendlyname (inputdevice_get_device_index (devnum));
}
/* returns machine readable name of device */
TCHAR *inputdevice_get_device_unique_name (int type, int devnum)
const char *inputdevice_get_device_unique_name (int type, int devnum)
{
return idev[type].get_uniquename (devnum);
}
@ -5382,6 +5382,11 @@ void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst)
dst->pandora_tapDelay = src->pandora_tapDelay;
dst->pandora_customControls = src->pandora_customControls;
dst->key_for_menu = src->key_for_menu;
dst->key_for_quit = src->key_for_quit;
dst->button_for_menu = src->button_for_menu;
dst->button_for_quit = src->button_for_quit;
copyjport (src, dst, 0);
copyjport (src, dst, 1);
copyjport (src, dst, 2);
@ -5975,7 +5980,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value, int por
}
idf = &idev[type];
for (i = 0; i < idf->get_num (); i++) {
TCHAR *name2 = idf->get_uniquename (i);
const char *name2 = idf->get_uniquename(i);
if (name2 && !_tcscmp (name2, value)) {
if (validate)
inputdevice_inserted (p, portnum, idnum + i, type);
@ -5986,7 +5991,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value, int por
}
}
for (i = 0; i < idf->get_num (); i++) {
TCHAR *name1 = idf->get_friendlyname (i);
const char *name1 = idf->get_friendlyname(i);
if (name1 && !_tcscmp (name1, value)) {
if (validate)
inputdevice_inserted (p, portnum, idnum + i, type);

View file

@ -50,12 +50,12 @@ SDL_Texture *texture;
#endif
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#include <linux/kd.h>
#include <sys/ioctl.h>
#include "keyboard.h"
#include <linux/kd.h>
#include <sys/ioctl.h>
#include "keyboard.h"
#endif
long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
long int version = 256 * 65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
struct uae_prefs currprefs, changed_prefs;
@ -67,244 +67,244 @@ struct gui_info gui_data;
TCHAR optionsfile[256];
void my_trim (TCHAR *s)
void my_trim(TCHAR *s)
{
int len;
while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0)
memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
len = _tcslen (s);
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
while (_tcslen(s) > 0 && _tcscspn(s, _T("\t \r\n")) == 0)
memmove(s, s + 1, (_tcslen(s + 1) + 1) * sizeof(TCHAR));
len = _tcslen(s);
while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
s[--len] = '\0';
}
TCHAR *my_strdup_trim (const TCHAR *s)
TCHAR *my_strdup_trim(const TCHAR *s)
{
TCHAR *out;
int len;
while (_tcscspn (s, _T("\t \r\n")) == 0)
while (_tcscspn(s, _T("\t \r\n")) == 0)
s++;
len = _tcslen (s);
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
len = _tcslen(s);
while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
len--;
out = xmalloc (TCHAR, len + 1);
memcpy (out, s, len * sizeof (TCHAR));
out = xmalloc(TCHAR, len + 1);
memcpy(out, s, len * sizeof(TCHAR));
out[len] = 0;
return out;
}
void discard_prefs (struct uae_prefs *p, int type)
void discard_prefs(struct uae_prefs *p, int type)
{
struct strlist **ps = &p->all_lines;
while (*ps) {
struct strlist *s = *ps;
*ps = s->next;
xfree (s->value);
xfree (s->option);
xfree (s);
}
struct strlist **ps = &p->all_lines;
while (*ps) {
struct strlist *s = *ps;
*ps = s->next;
xfree(s->value);
xfree(s->option);
xfree(s);
}
#ifdef FILESYS
filesys_cleanup ();
p->mountitems = 0;
filesys_cleanup();
p->mountitems = 0;
#endif
}
static void fixup_prefs_dim2 (struct wh *wh)
static void fixup_prefs_dim2(struct wh *wh)
{
if (wh->width < 320) {
error_log (_T("Width (%d) must be at least 320."), wh->width);
error_log(_T("Width (%d) must be at least 320."), wh->width);
wh->width = 320;
}
if (wh->height < 200) {
error_log (_T("Height (%d) must be at least 200."), wh->height);
error_log(_T("Height (%d) must be at least 200."), wh->height);
wh->height = 200;
}
if (wh->width > max_uae_width) {
error_log (_T("Width (%d) max is %d."), wh->width, max_uae_width);
error_log(_T("Width (%d) max is %d."), wh->width, max_uae_width);
wh->width = max_uae_width;
}
}
if (wh->height > max_uae_height) {
error_log (_T("Height (%d) max is %d."), wh->height, max_uae_height);
error_log(_T("Height (%d) max is %d."), wh->height, max_uae_height);
wh->height = max_uae_height;
}
}
void fixup_prefs_dimensions (struct uae_prefs *prefs)
void fixup_prefs_dimensions(struct uae_prefs *prefs)
{
fixup_prefs_dim2(&prefs->gfx_size_fs);
fixup_prefs_dim2(&prefs->gfx_size_win);
fixup_prefs_dim2(&prefs->gfx_size_fs);
fixup_prefs_dim2(&prefs->gfx_size_win);
}
void fixup_cpu(struct uae_prefs *p)
{
if (p->cpu_model >= 68030 && p->address_space_24) {
error_log (_T("24-bit address space is not supported in 68030/040/060 configurations."));
error_log(_T("24-bit address space is not supported in 68030/040/060 configurations."));
p->address_space_24 = 0;
}
if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible)) {
error_log (_T("FPU is not supported in 68000/010 configurations."));
error_log(_T("FPU is not supported in 68000/010 configurations."));
p->fpu_model = 0;
}
switch(p->cpu_model)
{
case 68000:
p->address_space_24 = 1;
break;
case 68010:
p->address_space_24 = 1;
break;
case 68020:
break;
case 68030:
break;
case 68040:
if (p->fpu_model)
p->fpu_model = 68040;
break;
}
switch (p->cpu_model)
{
case 68000:
p->address_space_24 = 1;
break;
case 68010:
p->address_space_24 = 1;
break;
case 68020:
break;
case 68030:
break;
case 68040:
if (p->fpu_model)
p->fpu_model = 68040;
break;
}
if (p->cpu_model >= 68040 && p->cachesize && p->cpu_compatible)
p->cpu_compatible = false;
if (p->immediate_blits && p->waiting_blits) {
error_log (_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
p->waiting_blits = 0;
}
}
}
void fixup_prefs (struct uae_prefs *p)
void fixup_prefs(struct uae_prefs *p)
{
int err = 0;
int err = 0;
fixup_cpu(p);
fixup_cpu(p);
if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000)
|| p->chipmem_size < 0x20000
|| p->chipmem_size > 0x800000)
{
error_log (_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size);
p->chipmem_size = 0x200000;
err = 1;
}
if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000)
|| p->chipmem_size < 0x20000
|| p->chipmem_size > 0x800000)
{
error_log(_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size);
p->chipmem_size = 0x200000;
err = 1;
}
if ((p->fastmem_size & (p->fastmem_size - 1)) != 0
|| (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
{
error_log (_T("Unsupported fastmem size %d (0x%x)."), p->fastmem_size, p->fastmem_size);
if ((p->fastmem_size & (p->fastmem_size - 1)) != 0
|| (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
{
error_log(_T("Unsupported fastmem size %d (0x%x)."), p->fastmem_size, p->fastmem_size);
p->fastmem_size = 0;
err = 1;
}
err = 1;
}
if (p->rtgmem_size > 0x1000000 && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log (_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, 0x1000000, 0x1000000);
error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, 0x1000000, 0x1000000);
p->rtgmem_size = 0x1000000;
err = 1;
}
if ((p->rtgmem_size & (p->rtgmem_size - 1)) != 0 || (p->rtgmem_size != 0 && (p->rtgmem_size < 0x100000))) {
error_log (_T("Unsupported graphics card memory size %d (0x%x)."), p->rtgmem_size, p->rtgmem_size);
if ((p->rtgmem_size & (p->rtgmem_size - 1)) != 0 || (p->rtgmem_size != 0 && (p->rtgmem_size < 0x100000))) {
error_log(_T("Unsupported graphics card memory size %d (0x%x)."), p->rtgmem_size, p->rtgmem_size);
if (p->rtgmem_size > 0x1000000)
p->rtgmem_size = 0x1000000;
else
p->rtgmem_size = 0;
err = 1;
}
p->rtgmem_size = 0;
err = 1;
}
if (p->z3fastmem_size > max_z3fastmem) {
error_log (_T("Zorro III fastmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3fastmem_size, p->z3fastmem_size, max_z3fastmem, max_z3fastmem);
if (p->z3fastmem_size > max_z3fastmem) {
error_log(_T("Zorro III fastmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3fastmem_size, p->z3fastmem_size, max_z3fastmem, max_z3fastmem);
p->z3fastmem_size = max_z3fastmem;
err = 1;
}
if ((p->z3fastmem_size & (p->z3fastmem_size - 1)) != 0 || (p->z3fastmem_size != 0 && p->z3fastmem_size < 0x100000))
{
error_log (_T("Unsupported Zorro III fastmem size %d (0x%x)."), p->z3fastmem_size, p->z3fastmem_size);
p->z3fastmem_size = 0;
err = 1;
}
}
if ((p->z3fastmem_size & (p->z3fastmem_size - 1)) != 0 || (p->z3fastmem_size != 0 && p->z3fastmem_size < 0x100000))
{
error_log(_T("Unsupported Zorro III fastmem size %d (0x%x)."), p->z3fastmem_size, p->z3fastmem_size);
p->z3fastmem_size = 0;
err = 1;
}
p->z3fastmem_start &= ~0xffff;
p->z3fastmem_start &= ~0xffff;
if (p->z3fastmem_start < 0x1000000)
p->z3fastmem_start = 0x1000000;
if (p->address_space_24 && (p->z3fastmem_size != 0)) {
p->z3fastmem_size = 0;
error_log (_T("Can't use a Z3 graphics card or 32-bit memory when using a 24 bit address space."));
}
if (p->bogomem_size != 0 && p->bogomem_size != 0x80000 && p->bogomem_size != 0x100000 && p->bogomem_size != 0x180000 && p->bogomem_size != 0x1c0000) {
error_log (_T("Unsupported bogomem size %d (0x%x)"), p->bogomem_size, p->bogomem_size);
p->bogomem_size = 0;
err = 1;
}
if (p->bogomem_size > 0x180000 && ((p->chipset_mask & CSMASK_AGA) || p->cpu_model >= 68020)) {
p->bogomem_size = 0x180000;
error_log (_T("Possible Gayle bogomem conflict fixed."));
}
if (p->chipmem_size > 0x200000 && p->fastmem_size != 0) {
error_log (_T("You can't use fastmem and more than 2MB chip at the same time."));
p->fastmem_size = 0;
err = 1;
}
if (p->address_space_24 && p->rtgmem_size && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log (_T("Z3 RTG and 24bit address space are not compatible."));
p->rtgmem_type = GFXBOARD_UAE_Z2;
}
if (p->rtgmem_type == GFXBOARD_UAE_Z2 && (p->chipmem_size > 2 * 1024 * 1024 || getz2size (p) > 8 * 1024 * 1024 || getz2size (p) < 0)) {
p->rtgmem_size = 0;
error_log (_T("Too large Z2 RTG memory size."));
if (p->address_space_24 && (p->z3fastmem_size != 0)) {
p->z3fastmem_size = 0;
error_log(_T("Can't use a Z3 graphics card or 32-bit memory when using a 24 bit address space."));
}
if (p->produce_sound < 0 || p->produce_sound > 3) {
error_log (_T("Bad value for -S parameter: enable value must be within 0..3."));
p->produce_sound = 0;
err = 1;
}
if (p->cachesize < 0 || p->cachesize > 16384) {
error_log (_T("Bad value for cachesize parameter: value must be within 0..16384."));
p->cachesize = 0;
err = 1;
}
if (p->z3fastmem_size && (p->address_space_24 || p->cpu_model < 68020)) {
error_log (_T("Z3 fast memory can't be used with a 68000/68010 emulation. Turning off Z3 fast memory."));
p->z3fastmem_size = 0;
err = 1;
}
if (p->rtgmem_size > 0 && p->rtgmem_type == GFXBOARD_UAE_Z3 && (p->cpu_model < 68020 || p->address_space_24)) {
error_log (_T("UAEGFX RTG can't be used with a 68000/68010 or 68EC020 emulation. Turning off RTG."));
p->rtgmem_size = 0;
err = 1;
}
if (p->bogomem_size != 0 && p->bogomem_size != 0x80000 && p->bogomem_size != 0x100000 && p->bogomem_size != 0x180000 && p->bogomem_size != 0x1c0000) {
error_log(_T("Unsupported bogomem size %d (0x%x)"), p->bogomem_size, p->bogomem_size);
p->bogomem_size = 0;
err = 1;
}
if (p->bogomem_size > 0x180000 && ((p->chipset_mask & CSMASK_AGA) || p->cpu_model >= 68020)) {
p->bogomem_size = 0x180000;
error_log(_T("Possible Gayle bogomem conflict fixed."));
}
if (p->chipmem_size > 0x200000 && p->fastmem_size != 0) {
error_log(_T("You can't use fastmem and more than 2MB chip at the same time."));
p->fastmem_size = 0;
err = 1;
}
if (p->address_space_24 && p->rtgmem_size && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log(_T("Z3 RTG and 24bit address space are not compatible."));
p->rtgmem_type = GFXBOARD_UAE_Z2;
}
if (p->rtgmem_type == GFXBOARD_UAE_Z2 && (p->chipmem_size > 2 * 1024 * 1024 || getz2size(p) > 8 * 1024 * 1024 || getz2size(p) < 0)) {
p->rtgmem_size = 0;
error_log(_T("Too large Z2 RTG memory size."));
}
if (p->produce_sound < 0 || p->produce_sound > 3) {
error_log(_T("Bad value for -S parameter: enable value must be within 0..3."));
p->produce_sound = 0;
err = 1;
}
if (p->cachesize < 0 || p->cachesize > 16384) {
error_log(_T("Bad value for cachesize parameter: value must be within 0..16384."));
p->cachesize = 0;
err = 1;
}
if (p->z3fastmem_size && (p->address_space_24 || p->cpu_model < 68020)) {
error_log(_T("Z3 fast memory can't be used with a 68000/68010 emulation. Turning off Z3 fast memory."));
p->z3fastmem_size = 0;
err = 1;
}
if (p->rtgmem_size > 0 && p->rtgmem_type == GFXBOARD_UAE_Z3 && (p->cpu_model < 68020 || p->address_space_24)) {
error_log(_T("UAEGFX RTG can't be used with a 68000/68010 or 68EC020 emulation. Turning off RTG."));
p->rtgmem_size = 0;
err = 1;
}
#if !defined (BSDSOCKET)
if (p->socket_emu) {
write_log (_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n"));
write_log(_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n"));
p->socket_emu = 0;
err = 1;
}
#endif
if (p->nr_floppies < 0 || p->nr_floppies > 4) {
error_log (_T("Invalid number of floppies. Using 2."));
if (p->nr_floppies < 0 || p->nr_floppies > 4) {
error_log(_T("Invalid number of floppies. Using 2."));
p->nr_floppies = 2;
p->floppyslots[0].dfxtype = 0;
p->floppyslots[1].dfxtype = 0;
p->floppyslots[0].dfxtype = 0;
p->floppyslots[1].dfxtype = 0;
p->floppyslots[2].dfxtype = -1;
p->floppyslots[3].dfxtype = -1;
err = 1;
}
err = 1;
}
if (p->floppy_speed > 0 && p->floppy_speed < 10) {
error_log (_T("Invalid floppy speed."));
p->floppy_speed = 100;
}
if (p->collision_level < 0 || p->collision_level > 3) {
error_log (_T("Invalid collision support level. Using 1."));
p->collision_level = 1;
err = 1;
}
if (p->floppy_speed > 0 && p->floppy_speed < 10) {
error_log(_T("Invalid floppy speed."));
p->floppy_speed = 100;
}
if (p->collision_level < 0 || p->collision_level > 3) {
error_log(_T("Invalid collision support level. Using 1."));
p->collision_level = 1;
err = 1;
}
fixup_prefs_dimensions (p);
fixup_prefs_dimensions(p);
#if !defined (JIT)
p->cachesize = 0;
@ -325,8 +325,8 @@ void fixup_prefs (struct uae_prefs *p)
p->socket_emu = 0;
#endif
blkdev_fix_prefs (p);
target_fixup_options (p);
blkdev_fix_prefs(p);
target_fixup_options(p);
}
int quit_program = 0;
@ -334,200 +334,214 @@ static int restart_program;
static TCHAR restart_config[MAX_DPATH];
static int default_config;
void uae_reset (int hardreset, int keyboardreset)
void uae_reset(int hardreset, int keyboardreset)
{
if (quit_program == 0) {
if (quit_program == 0) {
quit_program = -UAE_RESET;
if (keyboardreset)
quit_program = -UAE_RESET_KEYBOARD;
if (hardreset)
if (hardreset)
quit_program = -UAE_RESET_HARD;
}
}
}
void uae_quit (void)
void uae_quit(void)
{
if (quit_program != -UAE_QUIT) {
quit_program = -UAE_QUIT;
if (quit_program != -UAE_QUIT) {
quit_program = -UAE_QUIT;
regs.spcflags |= SPCFLAG_MODE_CHANGE;
}
target_quit ();
}
target_quit();
}
void host_shutdown(void)
{
system("sudo poweroff");
}
/* 0 = normal, 1 = nogui, -1 = disable nogui */
void uae_restart (int opengui, const TCHAR *cfgfile)
void uae_restart(int opengui, const TCHAR *cfgfile)
{
uae_quit ();
restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3);
restart_config[0] = 0;
uae_quit();
restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3);
restart_config[0] = 0;
default_config = 0;
if (cfgfile)
_tcscpy (restart_config, cfgfile);
target_restart ();
if (cfgfile)
_tcscpy(restart_config, cfgfile);
target_restart();
}
static void parse_cmdline_2 (int argc, TCHAR **argv)
static void parse_cmdline_2(int argc, TCHAR **argv)
{
int i;
int i;
cfgfile_addcfgparam (0);
for (i = 1; i < argc; i++) {
if (_tcsncmp (argv[i], _T("-cfgparam="), 10) == 0) {
cfgfile_addcfgparam (argv[i] + 10);
} else if (_tcscmp (argv[i], _T("-cfgparam")) == 0) {
if (i + 1 == argc)
write_log (_T("Missing argument for '-cfgparam' option.\n"));
else
cfgfile_addcfgparam (argv[++i]);
}
}
cfgfile_addcfgparam(0);
for (i = 1; i < argc; i++) {
if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
cfgfile_addcfgparam(argv[i] + 10);
}
else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 == argc)
write_log(_T("Missing argument for '-cfgparam' option.\n"));
else
cfgfile_addcfgparam(argv[++i]);
}
}
}
static TCHAR *parsetext (const TCHAR *s)
static TCHAR *parsetext(const TCHAR *s)
{
if (*s == '"' || *s == '\'') {
TCHAR *d;
TCHAR c = *s++;
int i;
d = my_strdup (s);
for (i = 0; i < _tcslen (d); i++) {
if (d[i] == c) {
d[i] = 0;
break;
}
}
return d;
} else {
return my_strdup (s);
}
if (*s == '"' || *s == '\'') {
TCHAR *d;
TCHAR c = *s++;
int i;
d = my_strdup(s);
for (i = 0; i < _tcslen(d); i++) {
if (d[i] == c) {
d[i] = 0;
break;
}
}
return d;
}
else {
return my_strdup(s);
}
}
static TCHAR *parsetextpath (const TCHAR *s)
static TCHAR *parsetextpath(const TCHAR *s)
{
TCHAR *s2 = parsetext (s);
TCHAR *s3 = target_expand_environment (s2);
xfree (s2);
TCHAR *s2 = parsetext(s);
TCHAR *s3 = target_expand_environment(s2);
xfree(s2);
return s3;
}
void print_usage()
{
printf("\nUsage:\n");
printf(" -f <file> Load a configuration file.\n");
printf(" -config=<file> Load a configuration file.\n");
printf(" -statefile=<file> Load a save state file.\n");
printf(" -s <config param>=<value> Set the configuration parameter with value.\n");
printf(" Edit a configuration file in order to know valid parameters and settings.\n");
printf("\nAdditional options:\n");
printf(" -0 <filename> Set adf for drive 0.\n");
printf(" -1 <filename> Set adf for drive 1.\n");
printf(" -2 <filename> Set adf for drive 2.\n");
printf(" -3 <filename> Set adf for drive 3.\n");
printf(" -r <filename> Set kickstart rom file.\n");
printf(" -G Start directly into emulation.\n");
printf(" -c <value> Size of chip memory (in number of 512 KBytes chunks).\n");
printf(" -F <value> Size of fast memory (in number of 1024 KBytes chunks).\n");
printf("\nNote:\n");
printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
printf("File names should be with absolute path.\n");
printf("\nExample:\n");
printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("It will load A400.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);
printf("\nUsage:\n");
printf(" -f <file> Load a configuration file.\n");
printf(" -config=<file> Load a configuration file.\n");
printf(" -statefile=<file> Load a save state file.\n");
printf(" -s <config param>=<value> Set the configuration parameter with value.\n");
printf(" Edit a configuration file in order to know valid parameters and settings.\n");
printf("\nAdditional options:\n");
printf(" -0 <filename> Set adf for drive 0.\n");
printf(" -1 <filename> Set adf for drive 1.\n");
printf(" -2 <filename> Set adf for drive 2.\n");
printf(" -3 <filename> Set adf for drive 3.\n");
printf(" -r <filename> Set kickstart rom file.\n");
printf(" -G Start directly into emulation.\n");
printf(" -c <value> Size of chip memory (in number of 512 KBytes chunks).\n");
printf(" -F <value> Size of fast memory (in number of 1024 KBytes chunks).\n");
printf("\nNote:\n");
printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
printf("File names should be with absolute path.\n");
printf("\nExample:\n");
printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("It will load A500.uae configuration with the save state named game.\n");
printf("It will override use_gui to 'no' so that it enters emulation directly.\n");
exit(1);
}
static void parse_cmdline (int argc, TCHAR **argv)
static void parse_cmdline(int argc, TCHAR **argv)
{
int i;
int i;
for (i = 1; i < argc; i++) {
if (_tcscmp (argv[i], _T("-cfgparam")) == 0) {
if (i + 1 < argc)
i++;
} else if (_tcsncmp (argv[i], _T("-config="), 8) == 0) {
TCHAR *txt = parsetextpath (argv[i] + 8);
currprefs.mountitems = 0;
target_cfgfile_load (&currprefs, txt, -1, 0);
xfree (txt);
} else if (_tcsncmp (argv[i], _T("-statefile="), 11) == 0) {
TCHAR *txt = parsetextpath (argv[i] + 11);
savestate_state = STATE_DORESTORE;
_tcscpy (savestate_fname, txt);
xfree (txt);
} else if (_tcscmp (argv[i], _T("-f")) == 0) {
for (i = 1; i < argc; i++) {
if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 < argc)
i++;
}
else if (_tcsncmp(argv[i], _T("-config="), 8) == 0) {
TCHAR *txt = parsetextpath(argv[i] + 8);
currprefs.mountitems = 0;
target_cfgfile_load(&currprefs, txt, -1, 0);
xfree(txt);
}
else if (_tcsncmp(argv[i], _T("-statefile="), 11) == 0) {
TCHAR *txt = parsetextpath(argv[i] + 11);
savestate_state = STATE_DORESTORE;
_tcscpy(savestate_fname, txt);
xfree(txt);
}
else if (_tcscmp(argv[i], _T("-f")) == 0) {
/* Check for new-style "-f xxx" argument, where xxx is config-file */
if (i + 1 == argc) {
write_log (_T("Missing argument for '-f' option.\n"));
} else {
TCHAR *txt = parsetextpath (argv[++i]);
currprefs.mountitems = 0;
target_cfgfile_load (&currprefs, txt, -1, 0);
xfree (txt);
}
} else if (_tcscmp (argv[i], _T("-s")) == 0) {
if (i + 1 == argc)
write_log (_T("Missing argument for '-s' option.\n"));
else
cfgfile_parse_line (&currprefs, argv[++i], 0);
} else {
if (argv[i][0] == '-' && argv[i][1] != '\0' && argv[i][2] == '\0') {
int ret;
const TCHAR *arg = argv[i] + 2;
int extra_arg = *arg == '\0';
if (extra_arg)
arg = i + 1 < argc ? argv[i + 1] : 0;
ret = parse_cmdline_option (&currprefs, argv[i][1], arg);
if (ret == -1)
print_usage();
if (ret && extra_arg)
i++;
} else
{
printf("Unknown option %s\n",argv[i]);
print_usage();
}
}
}
if (i + 1 == argc) {
write_log(_T("Missing argument for '-f' option.\n"));
}
else {
TCHAR *txt = parsetextpath(argv[++i]);
currprefs.mountitems = 0;
target_cfgfile_load(&currprefs, txt, -1, 0);
xfree(txt);
}
}
else if (_tcscmp(argv[i], _T("-s")) == 0) {
if (i + 1 == argc)
write_log(_T("Missing argument for '-s' option.\n"));
else
cfgfile_parse_line(&currprefs, argv[++i], 0);
}
else {
if (argv[i][0] == '-' && argv[i][1] != '\0' && argv[i][2] == '\0') {
int ret;
const TCHAR *arg = argv[i] + 2;
int extra_arg = *arg == '\0';
if (extra_arg)
arg = i + 1 < argc ? argv[i + 1] : 0;
ret = parse_cmdline_option(&currprefs, argv[i][1], arg);
if (ret == -1)
print_usage();
if (ret && extra_arg)
i++;
}
else
{
printf("Unknown option %s\n", argv[i]);
print_usage();
}
}
}
}
static void parse_cmdline_and_init_file (int argc, TCHAR **argv)
static void parse_cmdline_and_init_file(int argc, TCHAR **argv)
{
_tcscpy (optionsfile, _T(""));
_tcscpy(optionsfile, _T(""));
parse_cmdline_2 (argc, argv);
parse_cmdline_2(argc, argv);
_tcscat (optionsfile, restart_config);
_tcscat(optionsfile, restart_config);
if (! target_cfgfile_load (&currprefs, optionsfile, 0, default_config)) {
write_log (_T("failed to load config '%s'\n"), optionsfile);
}
fixup_prefs (&currprefs);
if (!target_cfgfile_load(&currprefs, optionsfile, 0, default_config)) {
write_log(_T("failed to load config '%s'\n"), optionsfile);
}
fixup_prefs(&currprefs);
parse_cmdline (argc, argv);
parse_cmdline(argc, argv);
}
void reset_all_systems (void)
void reset_all_systems(void)
{
init_eventtab ();
init_eventtab();
#ifdef PICASSO96
picasso_reset ();
picasso_reset();
#endif
#ifdef FILESYS
filesys_prepare_reset ();
filesys_reset ();
filesys_prepare_reset();
filesys_reset();
#endif
memory_reset ();
memory_reset();
#if defined (BSDSOCKET)
bsdlib_reset ();
bsdlib_reset();
#endif
#ifdef FILESYS
filesys_start_threads ();
hardfile_reset ();
filesys_start_threads();
hardfile_reset();
#endif
native2amiga_reset ();
native2amiga_reset();
}
/* Okay, this stuff looks strange, but it is here to encourage people who
@ -539,89 +553,89 @@ void reset_all_systems (void)
* of start_program() and leave_program() if you need to do anything special.
* Add #ifdefs around these as appropriate.
*/
void do_start_program (void)
void do_start_program(void)
{
if (quit_program == -UAE_QUIT)
return;
/* Do a reset on startup. Whether this is elegant is debatable. */
inputdevice_updateconfig (&changed_prefs, &currprefs);
if (quit_program >= 0)
quit_program = UAE_RESET;
m68k_go (1);
return;
/* Do a reset on startup. Whether this is elegant is debatable. */
inputdevice_updateconfig(&changed_prefs, &currprefs);
if (quit_program >= 0)
quit_program = UAE_RESET;
m68k_go(1);
}
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();
#endif
gui_exit ();
gui_exit();
#ifdef USE_SDL
SDL_Quit ();
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
device_func_reset ();
memory_cleanup ();
cfgfile_addcfgparam (0);
machdep_free ();
device_func_reset();
memory_cleanup();
cfgfile_addcfgparam(0);
machdep_free();
}
void start_program (void)
void start_program(void)
{
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
char kbd_flags;
// set capslock state based upon current "real" state
ioctl(0, KDGKBLED, &kbd_flags);
if ((kbd_flags & 07) & LED_CAP)
{
// record capslock pressed
inputdevice_do_keyboard(AK_CAPSLOCK, 1);
}
#endif
do_start_program ();
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
char kbd_flags;
// set capslock state based upon current "real" state
ioctl(0, KDGKBLED, &kbd_flags);
if ((kbd_flags & 07) & LED_CAP)
{
// record capslock pressed
inputdevice_do_keyboard(AK_CAPSLOCK, 1);
}
#endif
do_start_program();
}
void leave_program (void)
void leave_program(void)
{
do_leave_program ();
do_leave_program();
}
void virtualdevice_init (void)
void virtualdevice_init(void)
{
#ifdef AUTOCONFIG
rtarea_setup ();
rtarea_setup();
#endif
#ifdef FILESYS
rtarea_init ();
uaeres_install ();
hardfile_install ();
rtarea_init();
uaeres_install();
hardfile_install();
#endif
#ifdef AUTOCONFIG
expansion_init ();
emulib_install ();
expansion_init();
emulib_install();
#endif
#ifdef FILESYS
filesys_install ();
filesys_install();
#endif
#if defined (BSDSOCKET)
bsdlib_install ();
bsdlib_install();
#endif
}
@ -722,7 +736,7 @@ static int real_main2 (int argc, TCHAR **argv)
gui_data.hd = -1;
#ifdef PICASSO96
picasso_reset ();
picasso_reset();
#endif
fixup_prefs(&currprefs);
@ -756,34 +770,34 @@ static int real_main2 (int argc, TCHAR **argv)
}
currprefs.produce_sound = 0;
}
gui_flicker_led(LED_POWER, 0, 1);
gui_flicker_led(LED_POWER, 1);
start_program();
}
return 0;
}
void real_main (int argc, TCHAR **argv)
void real_main(int argc, TCHAR **argv)
{
restart_program = 1;
fetch_configurationpath (restart_config, sizeof (restart_config) / sizeof (TCHAR));
_tcscat (restart_config, OPTIONSFILENAME);
_tcscat (restart_config, ".uae");
restart_program = 1;
fetch_configurationpath(restart_config, sizeof(restart_config) / sizeof(TCHAR));
_tcscat(restart_config, OPTIONSFILENAME);
_tcscat(restart_config, ".uae");
default_config = 1;
while (restart_program) {
changed_prefs = currprefs;
real_main2 (argc, argv);
leave_program ();
quit_program = 0;
}
zfile_exit ();
while (restart_program) {
changed_prefs = currprefs;
real_main2(argc, argv);
leave_program();
quit_program = 0;
}
zfile_exit();
}
#ifndef NO_MAIN_IN_MAIN_C
int main (int argc, TCHAR **argv)
int main(int argc, TCHAR **argv)
{
real_main (argc, argv);
return 0;
real_main(argc, argv);
return 0;
}
#endif

View file

@ -420,7 +420,7 @@ addrbank extendedkickmem2_bank = {
};
static uae_char *kickstring = "exec.library";
static const char *kickstring = "exec.library";
static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
{
uae_char buffer[20];
@ -550,7 +550,7 @@ static bool load_extendedkickstart (const TCHAR *romextfile, int type)
static int patch_residents (uae_u8 *kickmemory, int size)
{
int i, j, patched = 0;
uae_char *residents[] = { "NCR scsi.device", "scsi.device", "carddisk.device", "card.resource", 0 };
const char *residents[] = { "NCR scsi.device", "scsi.device", "carddisk.device", "card.resource", 0 };
// "scsi.device", "carddisk.device", "card.resource" };
uaecptr base = size == ROM_SIZE_512 ? 0xf80000 : 0xfc0000;

View file

@ -898,7 +898,7 @@ static void mmu_op30fake_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr
int preg = (next >> 10) & 31;
int rw = (next >> 9) & 1;
int fd = (next >> 8) & 1;
TCHAR *reg = NULL;
const char *reg = NULL;
int siz;
// Dn, An, (An)+, -(An), abs and indirect

View file

@ -330,7 +330,7 @@ void romlist_clear (void)
int i;
int mask = 0;
struct romdata *parent;
TCHAR *pn;
const char *pn;
xfree (rl);
rl = 0;
@ -356,7 +356,7 @@ void romlist_clear (void)
_tcscat (newpn, _T("/"));
}
_tcscat (newpn, rd->partnumber);
xfree (parent->partnumber);
xfree ((char*)parent->partnumber);
parent->partnumber = newpn;
}
}
@ -442,7 +442,7 @@ struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, co
if (!ok)
continue;
if (model && ok < 2) {
TCHAR *p = rd->model;
const char *p = rd->model;
ok = 0;
while (p && *p) {
if (!_tcscmp(rd->model, model)) {
@ -489,7 +489,7 @@ struct romdata *getarcadiarombyname (const TCHAR *name)
int i;
for (i = 0; roms[i].name; i++) {
if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIAGAME || roms[i].type == ROMTYPE_ARCADIAGAME)) {
TCHAR *p = roms[i].name;
const char *p = roms[i].name;
p = p + _tcslen (p) + 1;
if (_tcslen (name) >= _tcslen (p) + 4) {
const TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
@ -1098,7 +1098,7 @@ struct zfile *read_rom (struct romdata *prd)
{
struct romdata *rd2 = prd;
struct romdata *rd = prd;
TCHAR *name;
const char *name;
int id = rd->id;
uae_u32 crc32;
int size;

View file

@ -244,7 +244,7 @@ TCHAR *restore_path_func (uae_u8 **dstp, int type)
/* read and write IFF-style hunks */
static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, TCHAR *name, int compress)
static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, const char *name, int compress)
{
uae_u8 tmp[8], *dst;
uae_u8 zero[4]= { 0, 0, 0, 0 };

View file

@ -240,7 +240,7 @@ void zfile_fclose (struct zfile *f)
pl->next = nxt;
}
static void removeext (TCHAR *s, TCHAR *ext)
static void removeext (TCHAR *s, const char *ext)
{
if (_tcslen (s) < _tcslen (ext))
return;
@ -259,7 +259,7 @@ static bool checkwrite (struct zfile *zf, int *retcode)
}
static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00};
static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), 0 };
static const char *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), 0 };
int zfile_gettype (struct zfile *z)
{

View file

@ -322,7 +322,7 @@ struct zvolume *archive_directory_tar (struct zfile *z)
if (zn)
zn->offset = zfile_ftell (z);
}
xfree (zai.name);
xfree ((char*)zai.name);
}
zfile_fseek (z, (size + 511) & ~511, SEEK_CUR);
}
@ -1020,7 +1020,7 @@ static struct znode *addfile (struct zvolume *zv, struct zfile *zf, const TCHAR
zn->f = z;
else
zfile_fclose(z);
xfree (zai.name);
xfree ((char*)zai.name);
return zn;
}
@ -1328,7 +1328,7 @@ static void recursesfs (struct znode *zn, int root, TCHAR *name, int sfs2)
znnew->offset = block;
znnew->offset2 = p - adf->block;
}
xfree (zai.comment);
xfree ((char*)zai.comment);
xfree (fname);
p += i + align;
}
@ -1902,7 +1902,7 @@ static int getcluster (struct zfile *z, int cluster, int fatstart, int fatbits)
return fat;
}
static void fatdirectory (struct zfile *z, struct zvolume *zv, TCHAR *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits)
static void fatdirectory (struct zfile *z, struct zvolume *zv, const char *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits)
{
struct zarchive_info zai;
struct znode *znnew;