Merge branch 'master' into new-custom
This commit is contained in:
commit
9928f8d598
34 changed files with 2451 additions and 1735 deletions
|
@ -91,6 +91,11 @@ void devices_rethink(void)
|
|||
rethink_uae_int();
|
||||
}
|
||||
|
||||
void devices_update_sound(double clk, double syncadjust)
|
||||
{
|
||||
update_sound(clk);
|
||||
}
|
||||
|
||||
void devices_update_sync(double svpos, double syncadjust)
|
||||
{
|
||||
cd32_fmv_set_sync(svpos, syncadjust);
|
||||
|
@ -194,3 +199,29 @@ void devices_restore_start(void)
|
|||
changed_prefs.mbresmem_low_size = 0;
|
||||
changed_prefs.mbresmem_high_size = 0;
|
||||
}
|
||||
|
||||
void devices_pause(void)
|
||||
{
|
||||
#ifdef WITH_PPC
|
||||
uae_ppc_pause(1);
|
||||
#endif
|
||||
blkdev_entergui();
|
||||
#ifdef RETROPLATFORM
|
||||
rp_pause(1);
|
||||
#endif
|
||||
//pausevideograb(1);
|
||||
//ethernet_pause(1);
|
||||
}
|
||||
|
||||
void devices_unpause(void)
|
||||
{
|
||||
blkdev_exitgui();
|
||||
#ifdef RETROPLATFORM
|
||||
rp_pause(0);
|
||||
#endif
|
||||
#ifdef WITH_PPC
|
||||
uae_ppc_pause(0);
|
||||
#endif
|
||||
//pausevideograb(0);
|
||||
//ethernet_pause(0);
|
||||
}
|
|
@ -468,11 +468,6 @@ void get_custom_raw_limits(int *pw, int *ph, int *pdx, int *pdy)
|
|||
|
||||
void check_custom_limits(void)
|
||||
{
|
||||
int vls = visible_left_start;
|
||||
int vrs = visible_right_stop;
|
||||
int vts = visible_top_start;
|
||||
int vbs = visible_bottom_stop;
|
||||
|
||||
struct gfx_filterdata *fd = &currprefs.gf[0];
|
||||
int left = fd->gfx_filter_left_border >> (RES_MAX - currprefs.gfx_resolution);
|
||||
int right = fd->gfx_filter_right_border >> (RES_MAX - currprefs.gfx_resolution);
|
||||
|
@ -721,11 +716,6 @@ void get_custom_mouse_limits(int *pw, int *ph, int *pdx, int *pdy, int dbl)
|
|||
if (*ph > 0)
|
||||
h = *ph;
|
||||
|
||||
delay1 = (firstword_bplcon1 & 0x0f) | ((firstword_bplcon1 & 0x0c00) >> 6);
|
||||
delay2 = ((firstword_bplcon1 >> 4) & 0x0f) | (((firstword_bplcon1 >> 4) & 0x0c00) >> 6);
|
||||
// if (delay1 == delay2)
|
||||
// dx += delay1;
|
||||
|
||||
dx = xshift(dx, res_shift);
|
||||
|
||||
dbl2 = dbl1 = currprefs.gfx_vresolution;
|
||||
|
@ -2063,7 +2053,6 @@ static void init_ham_decoding(void)
|
|||
static void decode_ham (int pix, int stoppos, int blank)
|
||||
{
|
||||
int todraw_amiga = res_shift_from_window(stoppos - pix);
|
||||
int hdp = ham_decode_pixel;
|
||||
|
||||
if (!bplham) {
|
||||
while (todraw_amiga-- > 0) {
|
||||
|
@ -2707,14 +2696,14 @@ void init_row_map(void)
|
|||
|
||||
static void init_aspect_maps(void)
|
||||
{
|
||||
int i, maxl, h;
|
||||
int i;
|
||||
|
||||
linedbld = linedbl = currprefs.gfx_vresolution;
|
||||
if (doublescan > 0 && interlace_seen <= 0) {
|
||||
linedbl = 0;
|
||||
linedbld = 1;
|
||||
}
|
||||
maxl = (MAXVPOS + 1) << linedbld;
|
||||
const int maxl = (MAXVPOS + 1) << linedbld;
|
||||
min_ypos_for_screen = minfirstline << linedbl;
|
||||
max_drawn_amiga_line = -1;
|
||||
|
||||
|
@ -2724,7 +2713,7 @@ static void init_aspect_maps(void)
|
|||
visible_bottom_stop = MAX_STOP;
|
||||
set_blanking_limits();
|
||||
|
||||
h = gfxvidinfo.drawbuffer.outheight;
|
||||
const int h = gfxvidinfo.drawbuffer.outheight;
|
||||
if (h == 0)
|
||||
/* Do nothing if the gfx driver hasn't initialized the screen yet */
|
||||
return;
|
||||
|
@ -2753,10 +2742,9 @@ static void init_aspect_maps(void)
|
|||
native2amiga_line_map[i] = -1;
|
||||
|
||||
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++)
|
||||
for (int j = amiga2aspect_line_map[i]; j < h && native2amiga_line_map[j] == -1; j++)
|
||||
native2amiga_line_map[j] = (i + currprefs.vertical_offset) >> linedbl;
|
||||
}
|
||||
}
|
||||
|
@ -3340,11 +3328,6 @@ static void pfield_draw_line(struct vidbuffer *vb, int lineno, int gfx_ypos, int
|
|||
|
||||
static void center_image()
|
||||
{
|
||||
int prev_x_adjust = visible_left_border;
|
||||
int prev_y_adjust = thisframe_y_adjust;
|
||||
|
||||
int w = gfxvidinfo.drawbuffer.outwidth;
|
||||
|
||||
const int deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320;
|
||||
|
||||
visible_left_border = 73 - (deltaToBorder >> 1);
|
||||
|
@ -3381,13 +3364,11 @@ static void init_drawing_frame(void)
|
|||
|
||||
int largest_res = 0;
|
||||
int largest_count = 0;
|
||||
int largest_count_res = 0;
|
||||
for (int i = 0; i <= RES_MAX; i++) {
|
||||
if (resolution_count[i])
|
||||
largest_res = i;
|
||||
if (resolution_count[i] >= largest_count) {
|
||||
largest_count = resolution_count[i];
|
||||
largest_count_res = i;
|
||||
}
|
||||
}
|
||||
if (currprefs.gfx_resolution == changed_prefs.gfx_resolution && lines_count > 0) {
|
||||
|
@ -3904,10 +3885,7 @@ void allocvidbuffer(struct vidbuffer *buf, int width, int height, int depth)
|
|||
buf->outwidth = (width + 7) & ~7;
|
||||
buf->outheight = height;
|
||||
|
||||
int size = width * height * buf->pixbytes;
|
||||
|
||||
buf->rowbytes = width * buf->pixbytes;
|
||||
|
||||
}
|
||||
|
||||
void freevidbuffer(struct vidbuffer *buf)
|
||||
|
|
|
@ -1467,6 +1467,23 @@ int filesys_eject (int nr)
|
|||
}
|
||||
|
||||
static uae_u32 heartbeat;
|
||||
static int heartbeat_count, heartbeat_count_cont;
|
||||
static int heartbeat_task;
|
||||
|
||||
bool filesys_heartbeat(void)
|
||||
{
|
||||
return heartbeat_count_cont > 0;
|
||||
}
|
||||
|
||||
// This uses filesystem process to reduce resource usage
|
||||
void setsystime(void)
|
||||
{
|
||||
if (!currprefs.tod_hack || !rtarea_bank.baseaddr)
|
||||
return;
|
||||
heartbeat = get_long_host(rtarea_bank.baseaddr + RTAREA_HEARTBEAT);
|
||||
heartbeat_task = 1;
|
||||
heartbeat_count = 10;
|
||||
}
|
||||
|
||||
static uae_u32 REGPARAM2 debugger_helper(TrapContext *ctx)
|
||||
{
|
||||
|
|
38
src/ide.cpp
38
src/ide.cpp
|
@ -391,9 +391,12 @@ static void ide_identity_buffer(struct ide_hdf *ide)
|
|||
|
||||
v = ide->multiple_mode;
|
||||
pwor(ide, 59, v > 0 ? 0x100 : 0);
|
||||
if (!atapi && cf) {
|
||||
if (!atapi && cf)
|
||||
{
|
||||
pw(ide, 0, 0x848a);
|
||||
} else if (!atapi && !cf) {
|
||||
}
|
||||
else if (!atapi && !cf)
|
||||
{
|
||||
pwand(ide, 0, 0x8000);
|
||||
}
|
||||
}
|
||||
|
@ -478,15 +481,18 @@ static void ide_initialize_drive_parameters (struct ide_hdf *ide)
|
|||
ide_interrupt (ide);
|
||||
}
|
||||
|
||||
static void ide_set_multiple_mode (struct ide_hdf *ide)
|
||||
static void ide_set_multiple_mode(struct ide_hdf *ide)
|
||||
{
|
||||
write_log (_T("IDE%d drive multiple mode = %d\n"), ide->num, ide->regs.ide_nsector);
|
||||
if (ide->regs.ide_nsector > (ide->max_multiple_mode >> (ide->blocksize / 512 - 1))) {
|
||||
write_log(_T("IDE%d drive multiple mode = %d\n"), ide->num, ide->regs.ide_nsector);
|
||||
if (ide->regs.ide_nsector > (ide->max_multiple_mode >> (ide->blocksize / 512 - 1)))
|
||||
{
|
||||
ide_fail(ide);
|
||||
} else {
|
||||
ide->multiple_mode = ide->regs.ide_nsector;
|
||||
}
|
||||
ide_interrupt (ide);
|
||||
else
|
||||
{
|
||||
ide->multiple_mode = ide->regs.ide_nsector;
|
||||
}
|
||||
ide_interrupt(ide);
|
||||
}
|
||||
|
||||
static void ide_set_features (struct ide_hdf *ide)
|
||||
|
@ -517,17 +523,23 @@ static void ide_set_features (struct ide_hdf *ide)
|
|||
}
|
||||
}
|
||||
|
||||
static void get_lbachs (struct ide_hdf *ide, uae_u64 *lbap, unsigned int *cyl, unsigned int *head, unsigned int *sec)
|
||||
static void get_lbachs(struct ide_hdf *ide, uae_u64 *lbap, unsigned int *cyl, unsigned int *head, unsigned int *sec)
|
||||
{
|
||||
if (ide->lba48 && ide->lba48cmd && (ide->regs.ide_select & 0x40)) {
|
||||
if (ide->lba48 && ide->lba48cmd && (ide->regs.ide_select & 0x40))
|
||||
{
|
||||
uae_u64 lba;
|
||||
lba = (ide->regs.ide_hcyl << 16) | (ide->regs.ide_lcyl << 8) | ide->regs.ide_sector;
|
||||
lba |= ((ide->regs.ide_hcyl2 << 16) | (ide->regs.ide_lcyl2 << 8) | ide->regs.ide_sector2) << 24;
|
||||
*lbap = lba;
|
||||
} else {
|
||||
if (ide->regs.ide_select & 0x40) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ide->regs.ide_select & 0x40)
|
||||
{
|
||||
*lbap = ((ide->regs.ide_select & 15) << 24) | (ide->regs.ide_hcyl << 16) | (ide->regs.ide_lcyl << 8) | ide->regs.ide_sector;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*cyl = (ide->regs.ide_hcyl << 8) | ide->regs.ide_lcyl;
|
||||
*head = ide->regs.ide_select & 15;
|
||||
*sec = ide->regs.ide_sector;
|
||||
|
|
|
@ -5,16 +5,14 @@ void devices_reset(int hardreset);
|
|||
void devices_vsync_pre(void);
|
||||
void devices_hsync(void);
|
||||
void devices_rethink(void);
|
||||
STATIC_INLINE void devices_update_sound(double clk, double syncadjust)
|
||||
{
|
||||
update_sound (clk);
|
||||
}
|
||||
|
||||
void devices_update_sound(double clk, double syncadjust);
|
||||
void devices_update_sync(double svpos, double syncadjust);
|
||||
void reset_all_systems(void);
|
||||
void do_leave_program(void);
|
||||
void virtualdevice_init(void);
|
||||
void devices_restore_start(void);
|
||||
void device_check_config(void);
|
||||
void devices_pause(void);
|
||||
void devices_unpause(void);
|
||||
|
||||
#endif /* UAE_DEVICES_H */
|
||||
|
|
|
@ -262,7 +262,7 @@ extern void JOYSET (int num, uae_u16 v);
|
|||
extern uae_u16 JOYGET (int num);
|
||||
|
||||
extern void inputdevice_vsync (void);
|
||||
extern void inputdevice_hsync (void);
|
||||
extern void inputdevice_hsync (bool forceread);
|
||||
extern void inputdevice_reset (void);
|
||||
|
||||
extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f);
|
||||
|
@ -282,6 +282,8 @@ extern void inputdevice_acquire (int allmode);
|
|||
extern void inputdevice_unacquire (void);
|
||||
extern void inputdevice_unacquire(bool emulationactive, int inputmask);
|
||||
|
||||
extern void pausemode(int mode);
|
||||
|
||||
extern void inputdevice_add_inputcode(int code, int state, const TCHAR *);
|
||||
extern void inputdevice_handle_inputcode (void);
|
||||
|
||||
|
@ -289,6 +291,8 @@ extern void inputdevice_tablet_strobe (void);
|
|||
|
||||
extern uae_u64 input_getqualifiers (void);
|
||||
|
||||
extern void setsystime(void);
|
||||
|
||||
#define JSEM_MODE_DEFAULT 0
|
||||
#define JSEM_MODE_WHEELMOUSE 1
|
||||
#define JSEM_MODE_MOUSE 2
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
extern int get_next_key (void);
|
||||
extern int keys_available (void);
|
||||
extern int record_key (int);
|
||||
extern int record_key_direct(int);
|
||||
extern void keybuf_init (void);
|
||||
|
||||
#endif /* UAE_KEYBUF_H */
|
||||
|
|
|
@ -312,6 +312,7 @@ extern void REGPARAM3 MakeFromSR_T0(void) REGPARAM;
|
|||
extern void REGPARAM3 Exception (int) REGPARAM;
|
||||
extern void REGPARAM3 Exception_cpu(int) REGPARAM;
|
||||
extern void NMI (void);
|
||||
extern void NMI_delayed(void);
|
||||
extern void doint (void);
|
||||
extern void dump_counts (void);
|
||||
extern int m68k_move2c (int, uae_u32 *);
|
||||
|
|
|
@ -22,9 +22,7 @@ extern uae_u32 p96_rgbx16[65536];
|
|||
extern int graphics_setup (void);
|
||||
extern int graphics_init (bool);
|
||||
extern void graphics_leave (void);
|
||||
STATIC_INLINE void handle_events (void)
|
||||
{
|
||||
}
|
||||
extern bool handle_events(void);
|
||||
extern int handle_msgpump (void);
|
||||
|
||||
extern bool vsync_switchmode (int);
|
||||
|
|
|
@ -97,6 +97,8 @@ static const int *joyinputs[MAX_JPORTS];
|
|||
|
||||
static int input_acquired;
|
||||
|
||||
static int autopause;
|
||||
|
||||
static int handle_input_event (int nr, int state, int max, int autofire);
|
||||
|
||||
static struct inputdevice_functions idev[IDTYPE_MAX];
|
||||
|
@ -1978,16 +1980,30 @@ static void joymousecounter (int joy)
|
|||
}
|
||||
}
|
||||
|
||||
static int inputdelay;
|
||||
static int inputread;
|
||||
|
||||
static void inputdevice_read (void)
|
||||
{
|
||||
do {
|
||||
handle_msgpump ();
|
||||
idev[IDTYPE_MOUSE].read ();
|
||||
idev[IDTYPE_JOYSTICK].read ();
|
||||
idev[IDTYPE_KEYBOARD].read ();
|
||||
} while (handle_msgpump ());
|
||||
for (;;)
|
||||
{
|
||||
int got = handle_msgpump();
|
||||
if (!got)
|
||||
break;
|
||||
}
|
||||
if (inputread <= 0)
|
||||
{
|
||||
idev[IDTYPE_MOUSE].read();
|
||||
idev[IDTYPE_JOYSTICK].read();
|
||||
idev[IDTYPE_KEYBOARD].read();
|
||||
}
|
||||
}
|
||||
|
||||
static void maybe_read_input(void)
|
||||
{
|
||||
if (inputread >= 0 && (vpos - inputread) <= maxvpos_display / 3)
|
||||
return;
|
||||
inputread = vpos;
|
||||
inputdevice_read();
|
||||
}
|
||||
|
||||
static uae_u16 getjoystate (int joy)
|
||||
|
@ -2407,7 +2423,7 @@ static void inject_events (const TCHAR *str)
|
|||
}
|
||||
}
|
||||
|
||||
void inputdevice_hsync (void)
|
||||
void inputdevice_hsync(bool forceread)
|
||||
{
|
||||
static int cnt;
|
||||
cap_check ();
|
||||
|
@ -2428,12 +2444,14 @@ void inputdevice_hsync (void)
|
|||
}
|
||||
}
|
||||
|
||||
if ((++cnt & 63) == 63 ) {
|
||||
inputdevice_read ();
|
||||
} else if (inputdelay > 0) {
|
||||
inputdelay--;
|
||||
if (inputdelay == 0)
|
||||
inputdevice_read ();
|
||||
if (forceread)
|
||||
{
|
||||
inputread = maxvpos + 1;
|
||||
inputdevice_read();
|
||||
}
|
||||
else
|
||||
{
|
||||
maybe_read_input();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2611,6 +2629,9 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
{
|
||||
int newstate, onoffstate;
|
||||
|
||||
if (s != NULL && s[0] == 0)
|
||||
s = NULL;
|
||||
|
||||
if (code == 0)
|
||||
goto end;
|
||||
|
||||
|
@ -2633,6 +2654,7 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
{
|
||||
case AKS_ENTERGUI:
|
||||
gui_display(-1);
|
||||
setsystime();
|
||||
break;
|
||||
//case AKS_SCREENSHOT_FILE:
|
||||
// if (state > 1) {
|
||||
|
@ -2642,9 +2664,6 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
// screenshot(1, 1);
|
||||
// }
|
||||
// break;
|
||||
case AKS_TOGGLEWINDOWEDFULLSCREEN:
|
||||
toggle_fullscreen();
|
||||
break;
|
||||
#ifdef ACTION_REPLAY
|
||||
case AKS_FREEZEBUTTON:
|
||||
action_replay_freeze();
|
||||
|
@ -2658,6 +2677,7 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
}
|
||||
else {
|
||||
gui_display(0);
|
||||
setsystime();
|
||||
}
|
||||
break;
|
||||
case AKS_FLOPPY1:
|
||||
|
@ -2668,6 +2688,7 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
}
|
||||
else {
|
||||
gui_display(1);
|
||||
setsystime();
|
||||
}
|
||||
break;
|
||||
case AKS_FLOPPY2:
|
||||
|
@ -2678,6 +2699,7 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
}
|
||||
else {
|
||||
gui_display(2);
|
||||
setsystime();
|
||||
}
|
||||
break;
|
||||
case AKS_FLOPPY3:
|
||||
|
@ -2688,6 +2710,7 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
}
|
||||
else {
|
||||
gui_display(3);
|
||||
setsystime();
|
||||
}
|
||||
break;
|
||||
case AKS_EFLOPPY0:
|
||||
|
@ -2702,12 +2725,41 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
case AKS_EFLOPPY3:
|
||||
disk_eject(3);
|
||||
break;
|
||||
case AKS_IRQ7:
|
||||
NMI_delayed();
|
||||
break;
|
||||
case AKS_PAUSE:
|
||||
pausemode(newstate > 0 ? 1 : newstate);
|
||||
break;
|
||||
case AKS_SINGLESTEP:
|
||||
if (pause_emulation)
|
||||
pausemode(0);
|
||||
autopause = 1;
|
||||
break;
|
||||
//case AKS_WARP:
|
||||
// warpmode(newstate);
|
||||
// break;
|
||||
//case AKS_INHIBITSCREEN:
|
||||
// toggle_inhibit_frame(monid, IHF_SCROLLLOCK);
|
||||
// break;
|
||||
case AKS_VOLDOWN:
|
||||
sound_volume(newstate <= 0 ? -1 : 1);
|
||||
break;
|
||||
case AKS_VOLUP:
|
||||
sound_volume(newstate <= 0 ? 1 : -1);
|
||||
break;
|
||||
//case AKS_VOLMUTE:
|
||||
// sound_mute(newstate);
|
||||
// break;
|
||||
//case AKS_MVOLDOWN:
|
||||
// master_sound_volume(newstate <= 0 ? -1 : 1);
|
||||
// break;
|
||||
//case AKS_MVOLUP:
|
||||
// master_sound_volume(newstate <= 0 ? 1 : -1);
|
||||
// break;
|
||||
//case AKS_MVOLMUTE:
|
||||
// master_sound_volume(0);
|
||||
// break;
|
||||
case AKS_QUIT:
|
||||
uae_quit();
|
||||
break;
|
||||
|
@ -2717,6 +2769,27 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
|
|||
case AKS_HARDRESET:
|
||||
uae_reset(1, 1);
|
||||
break;
|
||||
case AKS_TOGGLEWINDOWEDFULLSCREEN:
|
||||
toggle_fullscreen();
|
||||
break;
|
||||
case AKS_DECREASEREFRESHRATE:
|
||||
case AKS_INCREASEREFRESHRATE:
|
||||
{
|
||||
struct chipset_refresh *cr = get_chipset_refresh();
|
||||
if (cr) {
|
||||
int dir = code == AKS_INCREASEREFRESHRATE ? 5 : -5;
|
||||
if (cr->rate == 0)
|
||||
cr->rate = currprefs.ntscmode ? 60 : 50;
|
||||
cr->locked = true;
|
||||
cr->rate += dir;
|
||||
if (cr->rate < 10)
|
||||
cr->rate = 10;
|
||||
if (cr->rate > 900)
|
||||
cr->rate = 900;
|
||||
set_config_changed();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AKS_MOUSEMAP_PORT0_LEFT:
|
||||
(changed_prefs.jports[0].mousemap) ^= 1 << 0;
|
||||
inputdevice_updateconfig(&changed_prefs, &currprefs);
|
||||
|
@ -2770,6 +2843,15 @@ void inputdevice_handle_inputcode(void)
|
|||
int state = i.state;
|
||||
const TCHAR *s = i.s;
|
||||
if (code) {
|
||||
#ifdef AMIBERRY
|
||||
if (pause_emulation && state == 0)
|
||||
{
|
||||
got = false;
|
||||
xfree(i.s);
|
||||
i.code = 0;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!inputdevice_handle_inputcode2(code, state, s)) {
|
||||
xfree(i.s);
|
||||
i.code = 0;
|
||||
|
@ -2801,7 +2883,7 @@ static int handle_input_event(int nr, int state, int max, int autofire)
|
|||
{
|
||||
const struct inputevent *ie;
|
||||
int joy;
|
||||
bool isaks = false;
|
||||
bool isaks;
|
||||
|
||||
if (nr <= 0 || nr == INPUTEVENT_SPC_CUSTOM_EVENT)
|
||||
return 0;
|
||||
|
@ -3071,11 +3153,16 @@ static void inputdevice_checkconfig (void)
|
|||
|
||||
void inputdevice_vsync (void)
|
||||
{
|
||||
if (autopause > 0 && pause_emulation == 0) {
|
||||
autopause--;
|
||||
if (!autopause) {
|
||||
pausemode(1);
|
||||
}
|
||||
}
|
||||
|
||||
input_frame++;
|
||||
mouseupdate (0, true);
|
||||
|
||||
inputdevice_read ();
|
||||
inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1);
|
||||
inputread = -1;
|
||||
|
||||
inputdevice_handle_inputcode ();
|
||||
if (mousehack_alive_cnt > 0) {
|
||||
|
@ -3089,11 +3176,11 @@ void inputdevice_vsync (void)
|
|||
inputdevice_checkconfig ();
|
||||
}
|
||||
|
||||
void inputdevice_reset (void)
|
||||
void inputdevice_reset(void)
|
||||
{
|
||||
mousehack_reset ();
|
||||
if (inputdevice_is_tablet ())
|
||||
mousehack_enable ();
|
||||
mousehack_reset();
|
||||
if (inputdevice_is_tablet())
|
||||
mousehack_enable();
|
||||
}
|
||||
|
||||
static int getoldport (struct uae_input_device *id)
|
||||
|
@ -3428,38 +3515,41 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev
|
|||
if (button >= ID_BUTTON_TOTAL)
|
||||
return;
|
||||
|
||||
if (doit) {
|
||||
getqualmask (qualmask, id, ID_BUTTON_OFFSET + button, &qualonly);
|
||||
if (doit)
|
||||
{
|
||||
getqualmask(qualmask, id, ID_BUTTON_OFFSET + button, &qualonly);
|
||||
|
||||
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
|
||||
int sub = sublevdir[buttonstate == 0 ? 1 : 0][i];
|
||||
uae_u64 *flagsp = &id->flags[ID_BUTTON_OFFSET + button][sub];
|
||||
int evt = id->eventid[ID_BUTTON_OFFSET + button][sub];
|
||||
uae_u64 flags = flagsp[0];
|
||||
int autofire = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0;
|
||||
int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0;
|
||||
int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0;
|
||||
int invert = (flags & ID_FLAG_INVERT) ? 1 : 0;
|
||||
int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1: 0;
|
||||
int setval = (flags & ID_FLAG_SET_ONOFF_VAL) ? SET_ONOFF_ON_VALUE : SET_ONOFF_OFF_VALUE;
|
||||
int state;
|
||||
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++)
|
||||
{
|
||||
int sub = sublevdir[buttonstate == 0 ? 1 : 0][i];
|
||||
uae_u64 *flagsp = &id->flags[ID_BUTTON_OFFSET + button][sub];
|
||||
int evt = id->eventid[ID_BUTTON_OFFSET + button][sub];
|
||||
uae_u64 flags = flagsp[0];
|
||||
int autofire = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0;
|
||||
int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0;
|
||||
int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0;
|
||||
int invert = (flags & ID_FLAG_INVERT) ? 1 : 0;
|
||||
int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1 : 0;
|
||||
int setval = (flags & ID_FLAG_SET_ONOFF_VAL) ? SET_ONOFF_ON_VALUE : SET_ONOFF_OFF_VALUE;
|
||||
int state;
|
||||
|
||||
if (buttonstate < 0) {
|
||||
state = buttonstate;
|
||||
} else if (invert) {
|
||||
state = buttonstate ? 0 : 1;
|
||||
} else {
|
||||
state = buttonstate;
|
||||
}
|
||||
if (setmode) {
|
||||
if (state)
|
||||
state = setval;
|
||||
}
|
||||
if (buttonstate < 0)
|
||||
state = buttonstate;
|
||||
else if (invert)
|
||||
state = buttonstate ? 0 : 1;
|
||||
else
|
||||
state = buttonstate;
|
||||
|
||||
setqualifiers (evt, state > 0);
|
||||
if (setmode)
|
||||
{
|
||||
if (state || setval == SET_ONOFF_PRESS_VALUE || setval == SET_ONOFF_PRESSREL_VALUE)
|
||||
state = setval | (buttonstate ? 1 : 0);
|
||||
}
|
||||
|
||||
if (qualonly)
|
||||
continue;
|
||||
setqualifiers(evt, state > 0);
|
||||
|
||||
if (qualonly)
|
||||
continue;
|
||||
|
||||
#ifndef INPUTDEVICE_SIMPLE
|
||||
if (state < 0) {
|
||||
|
@ -6115,6 +6205,16 @@ int getmousestate (int joy)
|
|||
return mice[joy].enabled;
|
||||
}
|
||||
|
||||
void pausemode(int mode)
|
||||
{
|
||||
if (mode < 0)
|
||||
pause_emulation = pause_emulation ? 0 : 9;
|
||||
else
|
||||
pause_emulation = mode;
|
||||
set_config_changed();
|
||||
setsystime();
|
||||
}
|
||||
|
||||
int jsem_isjoy (int port, const struct uae_prefs *p)
|
||||
{
|
||||
int v = JSEM_DECODEVAL (port, p);
|
||||
|
|
|
@ -254,6 +254,13 @@ int get_next_key(void)
|
|||
}
|
||||
|
||||
int record_key(int kc)
|
||||
{
|
||||
if (pause_emulation)
|
||||
return 0;
|
||||
return record_key_direct(kc);
|
||||
}
|
||||
|
||||
int record_key_direct(int kc)
|
||||
{
|
||||
int kpb_next = kpb_first + 1;
|
||||
|
||||
|
|
|
@ -8,18 +8,17 @@ extern int screen_is_picasso;
|
|||
|
||||
int64_t g_uae_epoch = 0;
|
||||
|
||||
|
||||
int machdep_init (void)
|
||||
int machdep_init(void)
|
||||
{
|
||||
picasso_requested_on = 0;
|
||||
picasso_on = 0;
|
||||
screen_is_picasso = 0;
|
||||
picasso_requested_on = 0;
|
||||
picasso_on = 0;
|
||||
screen_is_picasso = 0;
|
||||
|
||||
// Initialize timebase
|
||||
g_uae_epoch = read_processor_time();
|
||||
syncbase = 1000000; // Microseconds
|
||||
|
||||
return 1;
|
||||
// Initialize timebase
|
||||
g_uae_epoch = read_processor_time();
|
||||
syncbase = 1000000; // Microseconds
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
30
src/main.cpp
30
src/main.cpp
|
@ -184,7 +184,7 @@ void fixup_cpu(struct uae_prefs *p)
|
|||
|
||||
void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
||||
{
|
||||
auto err = 0;
|
||||
//auto err = 0;
|
||||
|
||||
built_in_chipset_prefs(p);
|
||||
fixup_cpu(p);
|
||||
|
@ -199,7 +199,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
{
|
||||
error_log(_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size);
|
||||
p->chipmem_size = 0x200000;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
|
||||
for (auto & i : p->fastmem) {
|
||||
|
@ -208,7 +208,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
{
|
||||
error_log(_T("Unsupported fastmem size %d (0x%x)."), i.size, i.size);
|
||||
i.size = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
if (rbc->rtgmem_size > max_z3fastmem && rbc->rtgmem_type == GFXBOARD_UAE_Z3) {
|
||||
error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size, 0x1000000, 0x1000000);
|
||||
rbc->rtgmem_size = 0x1000000;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
|
||||
if ((rbc->rtgmem_size & (rbc->rtgmem_size - 1)) != 0 || (rbc->rtgmem_size != 0 && (rbc->rtgmem_size < 0x100000))) {
|
||||
|
@ -226,7 +226,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
rbc->rtgmem_size = max_z3fastmem;
|
||||
else
|
||||
rbc->rtgmem_size = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
{
|
||||
error_log(_T("Unsupported Zorro III fastmem size %d (0x%x)."), i.size, i.size);
|
||||
i.size = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
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;
|
||||
//err = 1;
|
||||
}
|
||||
|
||||
if (p->bogomem_size > 0x180000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) {
|
||||
|
@ -261,7 +261,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
if (p->chipmem_size > 0x200000 && p->fastmem[0].size > 262144) {
|
||||
error_log(_T("You can't use fastmem and more than 2MB chip at the same time."));
|
||||
p->chipmem_size = 0x200000;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
if (p->mbresmem_low_size > 0x01000000 || (p->mbresmem_low_size & 0xfffff)) {
|
||||
p->mbresmem_low_size = 0;
|
||||
|
@ -277,7 +277,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
if (p->chipmem_size > 0x200000 && rbc->rtgmem_size && gfxboard_get_configtype(rbc) == 2) {
|
||||
error_log(_T("You can't use Zorro II RTG and more than 2MB chip at the same time."));
|
||||
p->chipmem_size = 0x200000;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
if (p->address_space_24 && rbc->rtgmem_size && rbc->rtgmem_type == GFXBOARD_UAE_Z3) {
|
||||
error_log(_T("Z3 RTG and 24bit address space are not compatible."));
|
||||
|
@ -294,23 +294,23 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
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;
|
||||
//err = 1;
|
||||
}
|
||||
if (p->cachesize < 0 || p->cachesize > MAX_JIT_CACHE) {
|
||||
error_log(_T("Bad value for cachesize parameter: value must be within 0..16384."));
|
||||
p->cachesize = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
if ((p->z3fastmem[0].size) && p->address_space_24) {
|
||||
error_log(_T("Z3 fast memory can't be used if address space is 24-bit."));
|
||||
p->z3fastmem[0].size = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
for (auto & rtgboard : p->rtgboards) {
|
||||
if ((rtgboard.rtgmem_size > 0 && rtgboard.rtgmem_type == GFXBOARD_UAE_Z3) && p->address_space_24) {
|
||||
error_log(_T("UAEGFX Z3 RTG can't be used if address space is 24-bit."));
|
||||
rtgboard.rtgmem_size = 0;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
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) {
|
||||
|
@ -339,7 +339,7 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
|
|||
if (p->collision_level < 0 || p->collision_level > 3) {
|
||||
error_log(_T("Invalid collision support level. Using 1."));
|
||||
p->collision_level = 1;
|
||||
err = 1;
|
||||
//err = 1;
|
||||
}
|
||||
if (p->cs_compatible == CP_GENERIC) {
|
||||
p->cs_fatgaryrev = p->cs_ramseyrev = -1;
|
||||
|
|
1731
src/memory.cpp
1731
src/memory.cpp
File diff suppressed because it is too large
Load diff
|
@ -22,22 +22,22 @@ static uae_sem_t n2asem = 0;
|
|||
* to be called when setting up the hardware
|
||||
*/
|
||||
|
||||
void native2amiga_install (void)
|
||||
void native2amiga_install(void)
|
||||
{
|
||||
if(native2amiga_pending.size != 300)
|
||||
init_comm_pipe (&native2amiga_pending, 300, 2);
|
||||
if(n2asem != 0)
|
||||
uae_sem_destroy(&n2asem);
|
||||
n2asem = 0;
|
||||
uae_sem_init (&n2asem, 0, 1);
|
||||
if (native2amiga_pending.size != 300)
|
||||
init_comm_pipe(&native2amiga_pending, 300, 2);
|
||||
if (n2asem != 0)
|
||||
uae_sem_destroy(&n2asem);
|
||||
n2asem = 0;
|
||||
uae_sem_init(&n2asem, 0, 1);
|
||||
}
|
||||
|
||||
void native2amiga_reset (void)
|
||||
void native2amiga_reset(void)
|
||||
{
|
||||
smp_comm_pipe *p = &native2amiga_pending;
|
||||
p->rdp = p->wrp = 0;
|
||||
p->reader_waiting = 0;
|
||||
p->writer_waiting = 0;
|
||||
smp_comm_pipe *p = &native2amiga_pending;
|
||||
p->rdp = p->wrp = 0;
|
||||
p->reader_waiting = 0;
|
||||
p->writer_waiting = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -47,9 +47,9 @@ void native2amiga_startup (void)
|
|||
{
|
||||
}
|
||||
|
||||
int native2amiga_isfree (void)
|
||||
int native2amiga_isfree(void)
|
||||
{
|
||||
return comm_pipe_has_data (&native2amiga_pending) == 0;
|
||||
return comm_pipe_has_data(&native2amiga_pending) == 0;
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_THREADS
|
||||
|
@ -66,63 +66,63 @@ void uae_nativesem_post(void)
|
|||
void uae_Cause(uaecptr interrupt)
|
||||
{
|
||||
uae_nativesem_wait();
|
||||
write_comm_pipe_int (&native2amiga_pending, 3, 0);
|
||||
write_comm_pipe_u32 (&native2amiga_pending, interrupt, 1);
|
||||
do_uae_int_requested();
|
||||
write_comm_pipe_int(&native2amiga_pending, 3, 0);
|
||||
write_comm_pipe_u32(&native2amiga_pending, interrupt, 1);
|
||||
do_uae_int_requested();
|
||||
uae_nativesem_post();
|
||||
}
|
||||
|
||||
void uae_ReplyMsg(uaecptr msg)
|
||||
{
|
||||
uae_nativesem_wait();
|
||||
write_comm_pipe_int (&native2amiga_pending, 2, 0);
|
||||
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
|
||||
do_uae_int_requested();
|
||||
write_comm_pipe_int(&native2amiga_pending, 2, 0);
|
||||
write_comm_pipe_u32(&native2amiga_pending, msg, 1);
|
||||
do_uae_int_requested();
|
||||
uae_nativesem_post();
|
||||
}
|
||||
|
||||
void uae_PutMsg(uaecptr port, uaecptr msg)
|
||||
{
|
||||
uae_nativesem_wait();
|
||||
write_comm_pipe_int (&native2amiga_pending, 1, 0);
|
||||
write_comm_pipe_u32 (&native2amiga_pending, port, 0);
|
||||
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
|
||||
do_uae_int_requested();
|
||||
write_comm_pipe_int(&native2amiga_pending, 1, 0);
|
||||
write_comm_pipe_u32(&native2amiga_pending, port, 0);
|
||||
write_comm_pipe_u32(&native2amiga_pending, msg, 1);
|
||||
do_uae_int_requested();
|
||||
uae_nativesem_post();
|
||||
}
|
||||
|
||||
void uae_Signal(uaecptr task, uae_u32 mask)
|
||||
{
|
||||
uae_nativesem_wait();
|
||||
write_comm_pipe_int (&native2amiga_pending, 0, 0);
|
||||
write_comm_pipe_u32 (&native2amiga_pending, task, 0);
|
||||
write_comm_pipe_int (&native2amiga_pending, mask, 1);
|
||||
do_uae_int_requested();
|
||||
write_comm_pipe_int(&native2amiga_pending, 0, 0);
|
||||
write_comm_pipe_u32(&native2amiga_pending, task, 0);
|
||||
write_comm_pipe_int(&native2amiga_pending, mask, 1);
|
||||
do_uae_int_requested();
|
||||
uae_nativesem_post();
|
||||
}
|
||||
|
||||
void uae_NotificationHack(uaecptr port, uaecptr nr)
|
||||
{
|
||||
uae_nativesem_wait();
|
||||
write_comm_pipe_int (&native2amiga_pending, 4, 0);
|
||||
write_comm_pipe_int (&native2amiga_pending, port, 0);
|
||||
write_comm_pipe_int (&native2amiga_pending, nr, 1);
|
||||
do_uae_int_requested();
|
||||
write_comm_pipe_int(&native2amiga_pending, 4, 0);
|
||||
write_comm_pipe_int(&native2amiga_pending, port, 0);
|
||||
write_comm_pipe_int(&native2amiga_pending, nr, 1);
|
||||
do_uae_int_requested();
|
||||
uae_nativesem_post();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
uaecptr uae_AllocMem (TrapContext *ctx, uae_u32 size, uae_u32 flags, uaecptr sysbase)
|
||||
uaecptr uae_AllocMem(TrapContext *ctx, uae_u32 size, uae_u32 flags, uaecptr sysbase)
|
||||
{
|
||||
trap_set_dreg(ctx, 0, size);
|
||||
trap_set_dreg(ctx, 1, flags);
|
||||
return CallLib (ctx, sysbase, -198); /* AllocMem */
|
||||
return CallLib(ctx, sysbase, -198); /* AllocMem */
|
||||
}
|
||||
|
||||
void uae_FreeMem (TrapContext *ctx, uaecptr memory, uae_u32 size, uaecptr sysbase)
|
||||
void uae_FreeMem(TrapContext *ctx, uaecptr memory, uae_u32 size, uaecptr sysbase)
|
||||
{
|
||||
trap_set_dreg(ctx, 0, size);
|
||||
trap_set_areg(ctx, 1, memory);
|
||||
CallLib (ctx, sysbase, -0xD2); /* FreeMem */
|
||||
CallLib(ctx, sysbase, -0xD2); /* FreeMem */
|
||||
}
|
||||
|
|
|
@ -7,133 +7,217 @@
|
|||
#include "memory.h"
|
||||
#include "newcpu.h"
|
||||
|
||||
int movec_illg (int regno)
|
||||
int movec_illg(int regno)
|
||||
{
|
||||
int regno2 = regno & 0x7ff;
|
||||
int regno2 = regno & 0x7ff;
|
||||
|
||||
if (currprefs.cpu_model == 68010) {
|
||||
if (regno2 < 2)
|
||||
return 0;
|
||||
return 1;
|
||||
} else if (currprefs.cpu_model == 68020) {
|
||||
if (currprefs.cpu_model == 68010)
|
||||
{
|
||||
if (regno2 < 2)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
else if (currprefs.cpu_model == 68020)
|
||||
{
|
||||
if (regno == 3)
|
||||
return 1; /* 68040/060 only */
|
||||
/* 4 is >=68040, but 0x804 is in 68020 */
|
||||
if (regno2 < 4 || regno == 0x804)
|
||||
return 0;
|
||||
return 1;
|
||||
} else if (currprefs.cpu_model == 68030) {
|
||||
/* 4 is >=68040, but 0x804 is in 68020 */
|
||||
if (regno2 < 4 || regno == 0x804)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
else if (currprefs.cpu_model == 68030)
|
||||
{
|
||||
if (regno2 <= 2)
|
||||
return 0;
|
||||
if (regno == 0x803 || regno == 0x804)
|
||||
return 0;
|
||||
return 1;
|
||||
} else if (currprefs.cpu_model == 68040) {
|
||||
if (regno == 0x803 || regno == 0x804)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
else if (currprefs.cpu_model == 68040)
|
||||
{
|
||||
if (regno == 0x802)
|
||||
return 1; /* 68020/030 only */
|
||||
if (regno2 < 8) return 0;
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int m68k_move2c (int regno, uae_u32 *regp)
|
||||
{
|
||||
if (movec_illg (regno)) {
|
||||
op_illg (0x4E7B);
|
||||
return 0;
|
||||
} else {
|
||||
switch (regno) {
|
||||
case 0: regs.sfc = *regp & 7; break;
|
||||
case 1: regs.dfc = *regp & 7; break;
|
||||
case 2:
|
||||
{
|
||||
uae_u32 cacr_mask = 0;
|
||||
if (currprefs.cpu_model == 68020)
|
||||
cacr_mask = 0x0000000f;
|
||||
else if (currprefs.cpu_model == 68030)
|
||||
cacr_mask = 0x00003f1f;
|
||||
else if (currprefs.cpu_model == 68040)
|
||||
cacr_mask = 0x80008000;
|
||||
regs.cacr = *regp & cacr_mask;
|
||||
set_cpu_caches(false);
|
||||
}
|
||||
break;
|
||||
/* 68040/060 only */
|
||||
case 3:
|
||||
regs.tcr = *regp & 0xc000;
|
||||
break;
|
||||
|
||||
/* no differences between 68040 and 68060 */
|
||||
case 4: regs.itt0 = *regp & 0xffffe364; break;
|
||||
case 5: regs.itt1 = *regp & 0xffffe364; break;
|
||||
case 6: regs.dtt0 = *regp & 0xffffe364; break;
|
||||
case 7: regs.dtt1 = *regp & 0xffffe364; break;
|
||||
/* 68060 only */
|
||||
case 8: regs.buscr = *regp & 0xf0000000; break;
|
||||
|
||||
case 0x800: regs.usp = *regp; break;
|
||||
case 0x801: regs.vbr = *regp; break;
|
||||
case 0x802: regs.caar = *regp; break;
|
||||
case 0x803: regs.msp = *regp; if (regs.m == 1) m68k_areg(regs, 7) = regs.msp; break;
|
||||
case 0x804: regs.isp = *regp; if (regs.m == 0) m68k_areg(regs, 7) = regs.isp; break;
|
||||
/* 68040 only */
|
||||
case 0x805: regs.mmusr = *regp; break;
|
||||
/* 68040 stores all bits, 68060 zeroes low 9 bits */
|
||||
case 0x806: regs.urp = *regp; break;
|
||||
case 0x807: regs.srp = *regp; break;
|
||||
default:
|
||||
op_illg (0x4E7B);
|
||||
if (regno2 < 8)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int m68k_movec2 (int regno, uae_u32 *regp)
|
||||
int m68k_move2c(int regno, uae_u32 *regp)
|
||||
{
|
||||
if (movec_illg (regno)) {
|
||||
op_illg (0x4E7A);
|
||||
if (movec_illg(regno))
|
||||
{
|
||||
op_illg(0x4E7B);
|
||||
return 0;
|
||||
} else {
|
||||
switch (regno) {
|
||||
case 0: *regp = regs.sfc; break;
|
||||
case 1: *regp = regs.dfc; break;
|
||||
case 2:
|
||||
{
|
||||
uae_u32 v = regs.cacr;
|
||||
uae_u32 cacr_mask = 0;
|
||||
if (currprefs.cpu_model == 68020)
|
||||
cacr_mask = 0x00000003;
|
||||
else if (currprefs.cpu_model == 68030)
|
||||
cacr_mask = 0x00003313;
|
||||
else if (currprefs.cpu_model == 68040)
|
||||
cacr_mask = 0x80008000;
|
||||
*regp = v & cacr_mask;
|
||||
}
|
||||
break;
|
||||
case 3: *regp = regs.tcr; break;
|
||||
case 4: *regp = regs.itt0; break;
|
||||
case 5: *regp = regs.itt1; break;
|
||||
case 6: *regp = regs.dtt0; break;
|
||||
case 7: *regp = regs.dtt1; break;
|
||||
case 8: *regp = regs.buscr; break;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (regno)
|
||||
{
|
||||
case 0:
|
||||
regs.sfc = *regp & 7;
|
||||
break;
|
||||
case 1:
|
||||
regs.dfc = *regp & 7;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
uae_u32 cacr_mask = 0;
|
||||
if (currprefs.cpu_model == 68020)
|
||||
cacr_mask = 0x0000000f;
|
||||
else if (currprefs.cpu_model == 68030)
|
||||
cacr_mask = 0x00003f1f;
|
||||
else if (currprefs.cpu_model == 68040)
|
||||
cacr_mask = 0x80008000;
|
||||
regs.cacr = *regp & cacr_mask;
|
||||
set_cpu_caches(false);
|
||||
}
|
||||
break;
|
||||
/* 68040/060 only */
|
||||
case 3:
|
||||
regs.tcr = *regp & 0xc000;
|
||||
break;
|
||||
|
||||
case 0x800: *regp = regs.usp; break;
|
||||
case 0x801: *regp = regs.vbr; break;
|
||||
case 0x802: *regp = regs.caar; break;
|
||||
case 0x803: *regp = regs.m == 1 ? m68k_areg(regs, 7) : regs.msp; break;
|
||||
case 0x804: *regp = regs.m == 0 ? m68k_areg(regs, 7) : regs.isp; break;
|
||||
case 0x805: *regp = regs.mmusr; break;
|
||||
case 0x806: *regp = regs.urp; break;
|
||||
case 0x807: *regp = regs.srp; break;
|
||||
case 0x808: *regp = regs.pcr; break;
|
||||
/* no differences between 68040 and 68060 */
|
||||
case 4:
|
||||
regs.itt0 = *regp & 0xffffe364;
|
||||
break;
|
||||
case 5:
|
||||
regs.itt1 = *regp & 0xffffe364;
|
||||
break;
|
||||
case 6:
|
||||
regs.dtt0 = *regp & 0xffffe364;
|
||||
break;
|
||||
case 7:
|
||||
regs.dtt1 = *regp & 0xffffe364;
|
||||
break;
|
||||
/* 68060 only */
|
||||
case 8:
|
||||
regs.buscr = *regp & 0xf0000000;
|
||||
break;
|
||||
|
||||
default:
|
||||
op_illg (0x4E7A);
|
||||
case 0x800:
|
||||
regs.usp = *regp;
|
||||
break;
|
||||
case 0x801:
|
||||
regs.vbr = *regp;
|
||||
break;
|
||||
case 0x802:
|
||||
regs.caar = *regp;
|
||||
break;
|
||||
case 0x803:
|
||||
regs.msp = *regp;
|
||||
if (regs.m == 1)
|
||||
m68k_areg(regs, 7) = regs.msp;
|
||||
break;
|
||||
case 0x804:
|
||||
regs.isp = *regp;
|
||||
if (regs.m == 0)
|
||||
m68k_areg(regs, 7) = regs.isp;
|
||||
break;
|
||||
/* 68040 only */
|
||||
case 0x805:
|
||||
regs.mmusr = *regp;
|
||||
break;
|
||||
/* 68040 stores all bits, 68060 zeroes low 9 bits */
|
||||
case 0x806:
|
||||
regs.urp = *regp;
|
||||
break;
|
||||
case 0x807:
|
||||
regs.srp = *regp;
|
||||
break;
|
||||
default:
|
||||
op_illg(0x4E7B);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int m68k_movec2(int regno, uae_u32 *regp)
|
||||
{
|
||||
if (movec_illg(regno))
|
||||
{
|
||||
op_illg(0x4E7A);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (regno)
|
||||
{
|
||||
case 0:
|
||||
*regp = regs.sfc;
|
||||
break;
|
||||
case 1:
|
||||
*regp = regs.dfc;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
uae_u32 v = regs.cacr;
|
||||
uae_u32 cacr_mask = 0;
|
||||
if (currprefs.cpu_model == 68020)
|
||||
cacr_mask = 0x00000003;
|
||||
else if (currprefs.cpu_model == 68030)
|
||||
cacr_mask = 0x00003313;
|
||||
else if (currprefs.cpu_model == 68040)
|
||||
cacr_mask = 0x80008000;
|
||||
*regp = v & cacr_mask;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
*regp = regs.tcr;
|
||||
break;
|
||||
case 4:
|
||||
*regp = regs.itt0;
|
||||
break;
|
||||
case 5:
|
||||
*regp = regs.itt1;
|
||||
break;
|
||||
case 6:
|
||||
*regp = regs.dtt0;
|
||||
break;
|
||||
case 7:
|
||||
*regp = regs.dtt1;
|
||||
break;
|
||||
case 8:
|
||||
*regp = regs.buscr;
|
||||
break;
|
||||
|
||||
case 0x800:
|
||||
*regp = regs.usp;
|
||||
break;
|
||||
case 0x801:
|
||||
*regp = regs.vbr;
|
||||
break;
|
||||
case 0x802:
|
||||
*regp = regs.caar;
|
||||
break;
|
||||
case 0x803:
|
||||
*regp = regs.m == 1 ? m68k_areg(regs, 7) : regs.msp;
|
||||
break;
|
||||
case 0x804:
|
||||
*regp = regs.m == 0 ? m68k_areg(regs, 7) : regs.isp;
|
||||
break;
|
||||
case 0x805:
|
||||
*regp = regs.mmusr;
|
||||
break;
|
||||
case 0x806:
|
||||
*regp = regs.urp;
|
||||
break;
|
||||
case 0x807:
|
||||
*regp = regs.srp;
|
||||
break;
|
||||
case 0x808:
|
||||
*regp = regs.pcr;
|
||||
break;
|
||||
|
||||
default:
|
||||
op_illg(0x4E7A);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -141,47 +225,48 @@ int m68k_movec2 (int regno, uae_u32 *regp)
|
|||
* extract bitfield data from memory and return it in the MSBs
|
||||
* bdata caches the unmodified data for put_bitfield()
|
||||
*/
|
||||
uae_u32 REGPARAM2 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width)
|
||||
uae_u32 REGPARAM2 get_bitfield(uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width)
|
||||
{
|
||||
uae_u32 tmp, res, mask;
|
||||
|
||||
offset &= 7;
|
||||
mask = 0xffffffffu << (32 - width);
|
||||
switch ((offset + width + 7) >> 3) {
|
||||
switch ((offset + width + 7) >> 3)
|
||||
{
|
||||
case 1:
|
||||
tmp = get_byte (src);
|
||||
tmp = get_byte(src);
|
||||
res = tmp << (24 + offset);
|
||||
bdata[0] = tmp & ~(mask >> (24 + offset));
|
||||
break;
|
||||
case 2:
|
||||
tmp = get_word (src);
|
||||
tmp = get_word(src);
|
||||
res = tmp << (16 + offset);
|
||||
bdata[0] = tmp & ~(mask >> (16 + offset));
|
||||
break;
|
||||
case 3:
|
||||
tmp = get_word (src);
|
||||
tmp = get_word(src);
|
||||
res = tmp << (16 + offset);
|
||||
bdata[0] = tmp & ~(mask >> (16 + offset));
|
||||
tmp = get_byte (src + 2);
|
||||
tmp = get_byte(src + 2);
|
||||
res |= tmp << (8 + offset);
|
||||
bdata[1] = tmp & ~(mask >> (8 + offset));
|
||||
break;
|
||||
case 4:
|
||||
tmp = get_long (src);
|
||||
tmp = get_long(src);
|
||||
res = tmp << offset;
|
||||
bdata[0] = tmp & ~(mask >> offset);
|
||||
break;
|
||||
case 5:
|
||||
tmp = get_long (src);
|
||||
tmp = get_long(src);
|
||||
res = tmp << offset;
|
||||
bdata[0] = tmp & ~(mask >> offset);
|
||||
tmp = get_byte (src + 4);
|
||||
tmp = get_byte(src + 4);
|
||||
res |= tmp >> (8 - offset);
|
||||
bdata[1] = tmp & ~(mask << (8 - offset));
|
||||
break;
|
||||
default:
|
||||
/* Panic? */
|
||||
write_log (_T("get_bitfield() can't happen %d\n"), (offset + width + 7) >> 3);
|
||||
write_log(_T("get_bitfield() can't happen %d\n"), (offset + width + 7) >> 3);
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -191,67 +276,73 @@ uae_u32 REGPARAM2 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, i
|
|||
* write bitfield data (in the LSBs) back to memory, upper bits
|
||||
* must be cleared already.
|
||||
*/
|
||||
void REGPARAM2 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width)
|
||||
void REGPARAM2 put_bitfield(uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width)
|
||||
{
|
||||
offset = (offset & 7) + width;
|
||||
switch ((offset + 7) >> 3) {
|
||||
switch ((offset + 7) >> 3)
|
||||
{
|
||||
case 1:
|
||||
put_byte (dst, bdata[0] | (val << (8 - offset)));
|
||||
put_byte(dst, bdata[0] | (val << (8 - offset)));
|
||||
break;
|
||||
case 2:
|
||||
put_word (dst, bdata[0] | (val << (16 - offset)));
|
||||
put_word(dst, bdata[0] | (val << (16 - offset)));
|
||||
break;
|
||||
case 3:
|
||||
put_word (dst, bdata[0] | (val >> (offset - 16)));
|
||||
put_byte (dst + 2, bdata[1] | (val << (24 - offset)));
|
||||
put_word(dst, bdata[0] | (val >> (offset - 16)));
|
||||
put_byte(dst + 2, bdata[1] | (val << (24 - offset)));
|
||||
break;
|
||||
case 4:
|
||||
put_long (dst, bdata[0] | (val << (32 - offset)));
|
||||
put_long(dst, bdata[0] | (val << (32 - offset)));
|
||||
break;
|
||||
case 5:
|
||||
put_long (dst, bdata[0] | (val >> (offset - 32)));
|
||||
put_byte (dst + 4, bdata[1] | (val << (40 - offset)));
|
||||
put_long(dst, bdata[0] | (val >> (offset - 32)));
|
||||
put_byte(dst + 4, bdata[1] | (val << (40 - offset)));
|
||||
break;
|
||||
default:
|
||||
write_log (_T("put_bitfield() can't happen %d\n"), (offset + 7) >> 3);
|
||||
write_log(_T("put_bitfield() can't happen %d\n"), (offset + 7) >> 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 _get_disp_ea_020 (uae_u32 base)
|
||||
uae_u32 REGPARAM2 _get_disp_ea_020(uae_u32 base)
|
||||
{
|
||||
uae_u16 dp = next_diword ();
|
||||
int reg = (dp >> 12) & 15;
|
||||
uae_s32 regd = regs.regs[reg];
|
||||
if ((dp & 0x800) == 0)
|
||||
regd = (uae_s32)(uae_s16)regd;
|
||||
regd <<= (dp >> 9) & 3;
|
||||
if (dp & 0x100) {
|
||||
uae_s32 outer = 0;
|
||||
if (dp & 0x80) base = 0;
|
||||
if (dp & 0x40) regd = 0;
|
||||
uae_u16 dp = next_diword();
|
||||
int reg = (dp >> 12) & 15;
|
||||
uae_s32 regd = regs.regs[reg];
|
||||
if ((dp & 0x800) == 0)
|
||||
regd = (uae_s32)(uae_s16)regd;
|
||||
regd <<= (dp >> 9) & 3;
|
||||
if (dp & 0x100)
|
||||
{
|
||||
uae_s32 outer = 0;
|
||||
if (dp & 0x80)
|
||||
base = 0;
|
||||
if (dp & 0x40)
|
||||
regd = 0;
|
||||
|
||||
if ((dp & 0x30) == 0x20)
|
||||
base += (uae_s32)(uae_s16) next_diword ();
|
||||
if ((dp & 0x30) == 0x30)
|
||||
base += next_dilong ();
|
||||
if ((dp & 0x30) == 0x20)
|
||||
base += (uae_s32)(uae_s16)next_diword();
|
||||
if ((dp & 0x30) == 0x30)
|
||||
base += next_dilong();
|
||||
|
||||
if ((dp & 0x3) == 0x2)
|
||||
outer = (uae_s32)(uae_s16) next_diword ();
|
||||
if ((dp & 0x3) == 0x3)
|
||||
outer = next_dilong ();
|
||||
if ((dp & 0x3) == 0x2)
|
||||
outer = (uae_s32)(uae_s16)next_diword();
|
||||
if ((dp & 0x3) == 0x3)
|
||||
outer = next_dilong();
|
||||
|
||||
if ((dp & 0x4) == 0)
|
||||
base += regd;
|
||||
if (dp & 0x3)
|
||||
base = get_long (base);
|
||||
if (dp & 0x4)
|
||||
base += regd;
|
||||
if ((dp & 0x4) == 0)
|
||||
base += regd;
|
||||
if (dp & 0x3)
|
||||
base = get_long(base);
|
||||
if (dp & 0x4)
|
||||
base += regd;
|
||||
|
||||
return base + outer;
|
||||
} else {
|
||||
return base + (uae_s32)((uae_s8)dp) + regd;
|
||||
}
|
||||
return base + outer;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base + (uae_s32)((uae_s8)dp) + regd;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -312,34 +403,37 @@ uae_u32 REGPARAM2 _get_disp_ea_020 (uae_u32 base)
|
|||
|
||||
*/
|
||||
|
||||
int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor)
|
||||
int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor)
|
||||
{
|
||||
int mcycles;
|
||||
uae_u32 hdivisor;
|
||||
int i;
|
||||
|
||||
if(divisor == 0)
|
||||
if (divisor == 0)
|
||||
return 0;
|
||||
|
||||
// Overflow
|
||||
if((dividend >> 16) >= divisor)
|
||||
if ((dividend >> 16) >= divisor)
|
||||
return (mcycles = 5) * 2;
|
||||
|
||||
mcycles = 38;
|
||||
hdivisor = divisor << 16;
|
||||
|
||||
for( i = 0; i < 15; i++) {
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
uae_u32 temp;
|
||||
temp = dividend;
|
||||
|
||||
dividend <<= 1;
|
||||
|
||||
// If carry from shift
|
||||
if((uae_s32)temp < 0)
|
||||
if ((uae_s32)temp < 0)
|
||||
dividend -= hdivisor;
|
||||
else {
|
||||
else
|
||||
{
|
||||
mcycles += 2;
|
||||
if(dividend >= hdivisor) {
|
||||
if (dividend >= hdivisor)
|
||||
{
|
||||
dividend -= hdivisor;
|
||||
mcycles--;
|
||||
}
|
||||
|
@ -348,31 +442,32 @@ int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor)
|
|||
return mcycles * 2;
|
||||
}
|
||||
|
||||
int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor)
|
||||
int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor)
|
||||
{
|
||||
int mcycles;
|
||||
uae_u32 aquot;
|
||||
int i;
|
||||
|
||||
if(divisor == 0)
|
||||
if (divisor == 0)
|
||||
return 0;
|
||||
|
||||
mcycles = 6;
|
||||
|
||||
if( dividend < 0)
|
||||
if (dividend < 0)
|
||||
mcycles++;
|
||||
|
||||
// Check for absolute overflow
|
||||
if(((uae_u32)abs(dividend) >> 16) >= (uae_u16)abs(divisor))
|
||||
if (((uae_u32)abs(dividend) >> 16) >= (uae_u16)abs(divisor))
|
||||
return (mcycles + 2) * 2;
|
||||
|
||||
// Absolute quotient
|
||||
aquot = (uae_u32) abs(dividend) / (uae_u16)abs(divisor);
|
||||
aquot = (uae_u32)abs(dividend) / (uae_u16)abs(divisor);
|
||||
|
||||
mcycles += 55;
|
||||
|
||||
if(divisor >= 0) {
|
||||
if(dividend >= 0)
|
||||
if (divisor >= 0)
|
||||
{
|
||||
if (dividend >= 0)
|
||||
mcycles--;
|
||||
else
|
||||
mcycles++;
|
||||
|
@ -380,8 +475,9 @@ int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor)
|
|||
|
||||
// Count 15 msbits in absolute of quotient
|
||||
|
||||
for( i = 0; i < 15; i++) {
|
||||
if((uae_s16)aquot >= 0)
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
if ((uae_s16)aquot >= 0)
|
||||
mcycles++;
|
||||
aquot <<= 1;
|
||||
}
|
||||
|
@ -393,23 +489,31 @@ int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor)
|
|||
* 68020 and 68030: Signed: Z=1 NVC=0. Unsigned: V=1, N<dst, Z=!N, C=0.
|
||||
* 68040/68060 C=0.
|
||||
*/
|
||||
void divbyzero_special (bool issigned, uae_s32 dst)
|
||||
void divbyzero_special(bool issigned, uae_s32 dst)
|
||||
{
|
||||
if (currprefs.cpu_model == 68020 || currprefs.cpu_model == 68030) {
|
||||
CLEAR_CZNV ();
|
||||
if (issigned == false) {
|
||||
if (dst < 0)
|
||||
SET_NFLG (1);
|
||||
SET_ZFLG (!GET_NFLG ());
|
||||
SET_VFLG (1);
|
||||
} else {
|
||||
SET_ZFLG (1);
|
||||
if (currprefs.cpu_model == 68020 || currprefs.cpu_model == 68030)
|
||||
{
|
||||
CLEAR_CZNV();
|
||||
if (issigned == false)
|
||||
{
|
||||
if (dst < 0)
|
||||
SET_NFLG(1);
|
||||
SET_ZFLG(!GET_NFLG());
|
||||
SET_VFLG(1);
|
||||
}
|
||||
} else if (currprefs.cpu_model >= 68040) {
|
||||
SET_CFLG (0);
|
||||
} else {
|
||||
else
|
||||
{
|
||||
SET_ZFLG(1);
|
||||
}
|
||||
}
|
||||
else if (currprefs.cpu_model >= 68040)
|
||||
{
|
||||
SET_CFLG(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 68000/010
|
||||
CLEAR_CZNV ();
|
||||
CLEAR_CZNV();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,13 +530,18 @@ void divbyzero_special (bool issigned, uae_s32 dst)
|
|||
|
||||
void setdivuoverflowflags(uae_u32 dividend, uae_u16 divisor)
|
||||
{
|
||||
if (currprefs.cpu_model >= 68040) {
|
||||
if (currprefs.cpu_model >= 68040)
|
||||
{
|
||||
SET_VFLG(1);
|
||||
} else if (currprefs.cpu_model >= 68020) {
|
||||
}
|
||||
else if (currprefs.cpu_model >= 68020)
|
||||
{
|
||||
SET_VFLG(1);
|
||||
if ((uae_s32)dividend < 0)
|
||||
SET_NFLG(1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_VFLG(1);
|
||||
SET_NFLG(1);
|
||||
}
|
||||
|
@ -453,9 +562,12 @@ void setdivuoverflowflags(uae_u32 dividend, uae_u16 divisor)
|
|||
|
||||
void setdivsoverflowflags(uae_s32 dividend, uae_s16 divisor)
|
||||
{
|
||||
if (currprefs.cpu_model >= 68040) {
|
||||
if (currprefs.cpu_model >= 68040)
|
||||
{
|
||||
SET_VFLG(1);
|
||||
} else if (currprefs.cpu_model >= 68020) {
|
||||
}
|
||||
else if (currprefs.cpu_model >= 68020)
|
||||
{
|
||||
SET_VFLG(1);
|
||||
// absolute overflow?
|
||||
if (((uae_u32)abs(dividend) >> 16) >= (uae_u16)abs(divisor))
|
||||
|
@ -465,7 +577,9 @@ void setdivsoverflowflags(uae_s32 dividend, uae_s16 divisor)
|
|||
SET_ZFLG(1);
|
||||
if ((uae_s8)aquot < 0)
|
||||
SET_NFLG(1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_VFLG(1);
|
||||
SET_NFLG(1);
|
||||
}
|
||||
|
@ -477,16 +591,20 @@ STATIC_INLINE int div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_
|
|||
uae_u32 q = 0, cbit = 0;
|
||||
int i;
|
||||
|
||||
if (div <= src_hi) {
|
||||
return 1;
|
||||
if (div <= src_hi)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
for (i = 0 ; i < 32 ; i++) {
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
cbit = src_hi & 0x80000000ul;
|
||||
src_hi <<= 1;
|
||||
if (src_lo & 0x80000000ul) src_hi++;
|
||||
if (src_lo & 0x80000000ul)
|
||||
src_hi++;
|
||||
src_lo <<= 1;
|
||||
q = q << 1;
|
||||
if (cbit || div <= src_hi) {
|
||||
if (cbit || div <= src_hi)
|
||||
{
|
||||
q |= 1;
|
||||
src_hi -= div;
|
||||
}
|
||||
|
@ -632,10 +750,12 @@ STATIC_INLINE void mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae
|
|||
uae_u32 lo;
|
||||
|
||||
lo = r0 + ((r1 << 16) & 0xffff0000ul);
|
||||
if (lo < r0) r3++;
|
||||
if (lo < r0)
|
||||
r3++;
|
||||
r0 = lo;
|
||||
lo = r0 + ((r2 << 16) & 0xffff0000ul);
|
||||
if (lo < r0) r3++;
|
||||
if (lo < r0)
|
||||
r3++;
|
||||
r3 += ((r1 >> 16) & 0xffff) + ((r2 >> 16) & 0xffff);
|
||||
*dst_lo = lo;
|
||||
*dst_hi = r3;
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include "rtgmodes.h"
|
||||
#include "gfxboard.h"
|
||||
#include "amiberry_gfx.h"
|
||||
#include "gui.h"
|
||||
#include "sounddep/sound.h"
|
||||
#include "devices.h"
|
||||
#ifdef USE_SDL2
|
||||
#include <map>
|
||||
#endif
|
||||
|
@ -47,6 +50,77 @@ bool read_config_descriptions = true;
|
|||
bool write_logfile = false;
|
||||
bool scanlines_by_default = false;
|
||||
|
||||
// Default Enter GUI key is F12
|
||||
int enter_gui_key = SDLK_F12;
|
||||
// We don't set a default value for Quitting
|
||||
int quit_key = 0;
|
||||
// The default value for Action Replay is Pause/Break
|
||||
int action_replay_button = SDLK_PAUSE;
|
||||
// No default value for Full Screen toggle
|
||||
int fullscreen_key = 0;
|
||||
|
||||
#ifdef USE_SDL1
|
||||
SDLKey GetKeyFromName(const char *name)
|
||||
{
|
||||
if (!name || !*name) {
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
|
||||
for (int key = SDLK_FIRST; key < SDLK_LAST; key++)
|
||||
{
|
||||
if (!SDL_GetKeyName(SDLKey(key)))
|
||||
continue;
|
||||
if (SDL_strcasecmp(name, SDL_GetKeyName(SDLKey(key))) == 0)
|
||||
{
|
||||
return SDLKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_key_configs(struct uae_prefs *p)
|
||||
{
|
||||
if (strncmp(p->open_gui, "", 1) != 0)
|
||||
{
|
||||
// If we have a value in the config, we use that instead
|
||||
#ifdef USE_SDL1
|
||||
enter_gui_key = GetKeyFromName(p->open_gui);
|
||||
#elif USE_SDL2
|
||||
enter_gui_key = SDL_GetKeyFromName(p->open_gui);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strncmp(p->quit_amiberry, "", 1) != 0)
|
||||
{
|
||||
// If we have a value in the config, we use that instead
|
||||
#ifdef USE_SDL1
|
||||
quit_key = GetKeyFromName(p->quit_amiberry);
|
||||
#elif USE_SDL2
|
||||
quit_key = SDL_GetKeyFromName(p->quit_amiberry);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strncmp(p->action_replay, "", 1) != 0)
|
||||
{
|
||||
#ifdef USE_SDL1
|
||||
action_replay_button = GetKeyFromName(p->action_replay);
|
||||
#elif USE_SDL2
|
||||
action_replay_button = SDL_GetKeyFromName(p->action_replay);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strncmp(p->fullscreen_toggle, "", 1) != 0)
|
||||
{
|
||||
#ifdef USE_SDL1
|
||||
fullscreen_key = GetKeyFromName(p->fullscreen_toggle);
|
||||
#elif USE_SDL2
|
||||
fullscreen_key = SDL_GetKeyFromName(p->fullscreen_toggle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Justifications for the numbers set here
|
||||
// Frametime is 20000 cycles in PAL
|
||||
// 16667 cycles in NTSC
|
||||
|
@ -126,6 +200,51 @@ int sleep_millis_main(int ms)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pausemouseactive;
|
||||
void resumesoundpaused(void)
|
||||
{
|
||||
resume_sound();
|
||||
#ifdef AHI
|
||||
ahi_open_sound();
|
||||
ahi2_pause_sound(0);
|
||||
#endif
|
||||
}
|
||||
void setsoundpaused(void)
|
||||
{
|
||||
pause_sound();
|
||||
#ifdef AHI
|
||||
ahi_close_sound();
|
||||
ahi2_pause_sound(1);
|
||||
#endif
|
||||
}
|
||||
bool resumepaused(int priority)
|
||||
{
|
||||
//write_log (_T("resume %d (%d)\n"), priority, pause_emulation);
|
||||
if (pause_emulation > priority)
|
||||
return false;
|
||||
if (!pause_emulation)
|
||||
return false;
|
||||
devices_unpause();
|
||||
resumesoundpaused();
|
||||
if (pausemouseactive) {
|
||||
pausemouseactive = 0;
|
||||
}
|
||||
pause_emulation = 0;
|
||||
setsystime();
|
||||
return true;
|
||||
}
|
||||
bool setpaused(int priority)
|
||||
{
|
||||
//write_log (_T("pause %d (%d)\n"), priority, pause_emulation);
|
||||
if (pause_emulation > priority)
|
||||
return false;
|
||||
pause_emulation = priority;
|
||||
devices_pause();
|
||||
setsoundpaused();
|
||||
pausemouseactive = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void logging_init(void)
|
||||
{
|
||||
if (write_logfile)
|
||||
|
@ -266,10 +385,11 @@ void target_fixup_options(struct uae_prefs* p)
|
|||
else
|
||||
p->fpu_no_unimplemented = true;
|
||||
|
||||
if (!p->cachesize > 0)
|
||||
if (p->cachesize <= 0)
|
||||
p->compfpu = false;
|
||||
|
||||
fix_apmodes(p);
|
||||
set_key_configs(p);
|
||||
}
|
||||
|
||||
void target_default_options(struct uae_prefs* p, int type)
|
||||
|
@ -537,7 +657,6 @@ void set_retroarchfile(char* newpath)
|
|||
strncpy(retroarch_file, newpath, MAX_DPATH);
|
||||
}
|
||||
|
||||
|
||||
void fetch_rompath(char* out, int size)
|
||||
{
|
||||
fixtrailing(rom_path);
|
||||
|
@ -549,7 +668,6 @@ void set_rompath(char *newpath)
|
|||
strncpy(rom_path, newpath, MAX_DPATH);
|
||||
}
|
||||
|
||||
|
||||
void fetch_rp9path(char *out, int size)
|
||||
{
|
||||
fixtrailing(rp9_path);
|
||||
|
@ -578,7 +696,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
|
|||
default_prefs(p, true, 0);
|
||||
|
||||
const char* ptr = strstr(const_cast<char *>(filename), ".rp9");
|
||||
if (ptr > nullptr)
|
||||
if (ptr)
|
||||
{
|
||||
// Load rp9 config
|
||||
result = rp9_parse_file(p, filename);
|
||||
|
@ -588,7 +706,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
|
|||
else
|
||||
{
|
||||
ptr = strstr(const_cast<char *>(filename), ".uae");
|
||||
if (ptr > nullptr)
|
||||
if (ptr)
|
||||
{
|
||||
auto config_type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST;
|
||||
result = cfgfile_load(p, filename, &config_type, 0, 1);
|
||||
|
@ -630,10 +748,10 @@ int check_configfile(char *file)
|
|||
|
||||
strncpy(tmp, file, MAX_DPATH);
|
||||
const auto ptr = strstr(tmp, ".uae");
|
||||
if (ptr > nullptr)
|
||||
if (ptr)
|
||||
{
|
||||
*(ptr + 1) = '\0';
|
||||
strncat(tmp, "conf", MAX_DPATH);
|
||||
strncat(tmp, "conf", MAX_DPATH - 1);
|
||||
f = fopen(tmp, "rte");
|
||||
if (f)
|
||||
{
|
||||
|
@ -1069,79 +1187,11 @@ int main(int argc, char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef USE_SDL1
|
||||
SDLKey GetKeyFromName(const char *name)
|
||||
{
|
||||
if (!name || !*name) {
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
|
||||
for (int key = SDLK_FIRST; key < SDLK_LAST; key++)
|
||||
{
|
||||
if (!SDL_GetKeyName(SDLKey(key)))
|
||||
continue;
|
||||
if (SDL_strcasecmp(name, SDL_GetKeyName(SDLKey(key))) == 0)
|
||||
{
|
||||
return SDLKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
#endif
|
||||
|
||||
int handle_msgpump()
|
||||
{
|
||||
auto got = 0;
|
||||
SDL_Event rEvent;
|
||||
|
||||
// Default Enter GUI key is F12
|
||||
int enter_gui_key = SDLK_F12;
|
||||
if (strncmp(currprefs.open_gui, "", 1) != 0)
|
||||
{
|
||||
// If we have a value in the config, we use that instead
|
||||
// SDL2-only for now
|
||||
#ifdef USE_SDL1
|
||||
enter_gui_key = GetKeyFromName(currprefs.open_gui);
|
||||
#elif USE_SDL2
|
||||
enter_gui_key = SDL_GetKeyFromName(currprefs.open_gui);
|
||||
#endif
|
||||
}
|
||||
|
||||
// We don't set a default value for Quitting
|
||||
int quit_key = 0;
|
||||
if (strncmp(currprefs.quit_amiberry, "", 1) != 0)
|
||||
{
|
||||
// If we have a value in the config, we use that instead
|
||||
#ifdef USE_SDL1
|
||||
quit_key = GetKeyFromName(currprefs.quit_amiberry);
|
||||
#elif USE_SDL2
|
||||
quit_key = SDL_GetKeyFromName(currprefs.quit_amiberry);
|
||||
#endif
|
||||
}
|
||||
|
||||
// The default value for Action Replay is Pause/Break
|
||||
int action_replay_button = SDLK_PAUSE;
|
||||
if (strncmp(currprefs.action_replay, "", 1) != 0)
|
||||
{
|
||||
#ifdef USE_SDL1
|
||||
action_replay_button = GetKeyFromName(currprefs.action_replay);
|
||||
#elif USE_SDL2
|
||||
action_replay_button = SDL_GetKeyFromName(currprefs.action_replay);
|
||||
#endif
|
||||
}
|
||||
|
||||
// No default value for Full Screen toggle
|
||||
int fullscreen_key = 0;
|
||||
if (strncmp(currprefs.fullscreen_toggle, "", 1) != 0)
|
||||
{
|
||||
#ifdef USE_SDL1
|
||||
fullscreen_key = GetKeyFromName(currprefs.fullscreen_toggle);
|
||||
#elif USE_SDL2
|
||||
fullscreen_key = SDL_GetKeyFromName(currprefs.fullscreen_toggle);
|
||||
#endif
|
||||
}
|
||||
|
||||
while (SDL_PollEvent(&rEvent))
|
||||
{
|
||||
got = 1;
|
||||
|
@ -1336,6 +1386,39 @@ int handle_msgpump()
|
|||
return got;
|
||||
}
|
||||
|
||||
bool handle_events()
|
||||
{
|
||||
static int was_paused = 0;
|
||||
|
||||
if (pause_emulation)
|
||||
{
|
||||
if (was_paused == 0)
|
||||
{
|
||||
setpaused(pause_emulation);
|
||||
was_paused = pause_emulation;
|
||||
gui_fps(0, 0, 0);
|
||||
gui_led(LED_SND, 0, -1);
|
||||
// we got just paused, report it to caller.
|
||||
return true;
|
||||
}
|
||||
SDL_Event event;
|
||||
SDL_WaitEvent(&event);
|
||||
|
||||
inputdevicefunc_keyboard.read();
|
||||
inputdevicefunc_mouse.read();
|
||||
inputdevicefunc_joystick.read();
|
||||
inputdevice_handle_inputcode();
|
||||
}
|
||||
if (was_paused && (!pause_emulation || quit_program)) {
|
||||
//updatedisplayarea();
|
||||
pause_emulation = was_paused;
|
||||
resumepaused(was_paused);
|
||||
was_paused = 0;
|
||||
}
|
||||
|
||||
return pause_emulation != 0;
|
||||
}
|
||||
|
||||
static uaecptr clipboard_data;
|
||||
|
||||
void amiga_clipboard_die()
|
||||
|
|
|
@ -332,7 +332,7 @@ int hdf_read_target(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
|
|||
while (len > 0)
|
||||
{
|
||||
int maxlen;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
if (hfd->physsize < CACHE_SIZE)
|
||||
{
|
||||
hfd->cache_valid = 0;
|
||||
|
@ -402,9 +402,7 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i
|
|||
}
|
||||
}
|
||||
else if (hfd->handle_valid == HDF_HANDLE_ZFILE)
|
||||
{
|
||||
outlen = zfile_fwrite(hfd->cache, 1, len, hfd->handle->zf);
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,10 +64,10 @@ static void fill_default_controller(void)
|
|||
default_controller_map.lstick_up = -1;
|
||||
default_controller_map.lstick_down = -1;
|
||||
default_controller_map.lstick_axis_y = 1;
|
||||
default_controller_map.lstick_axis_x = 0;
|
||||
default_controller_map.lstick_axis_y_invert = false;
|
||||
default_controller_map.lstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.lstick_axis_x = 0;
|
||||
default_controller_map.lstick_axis_y_invert = false;
|
||||
default_controller_map.lstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.rstick_button = -1;
|
||||
default_controller_map.rstick_left = -1;
|
||||
default_controller_map.rstick_right = -1;
|
||||
|
@ -75,9 +75,9 @@ static void fill_default_controller(void)
|
|||
default_controller_map.rstick_down = -1;
|
||||
default_controller_map.rstick_axis_y = 3;
|
||||
default_controller_map.rstick_axis_x = 2;
|
||||
default_controller_map.rstick_axis_y_invert = false;
|
||||
default_controller_map.rstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.rstick_axis_y_invert = false;
|
||||
default_controller_map.rstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.is_retroarch = false;
|
||||
}
|
||||
|
||||
|
@ -117,9 +117,9 @@ static void fill_blank_controller(void)
|
|||
default_controller_map.lstick_down = -1;
|
||||
default_controller_map.lstick_axis_y = -1;
|
||||
default_controller_map.lstick_axis_x = -1;
|
||||
default_controller_map.lstick_axis_y_invert = false;
|
||||
default_controller_map.lstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.lstick_axis_y_invert = false;
|
||||
default_controller_map.lstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.rstick_button = -1;
|
||||
default_controller_map.rstick_left = -1;
|
||||
default_controller_map.rstick_right = -1;
|
||||
|
@ -127,9 +127,9 @@ static void fill_blank_controller(void)
|
|||
default_controller_map.rstick_down = -1;
|
||||
default_controller_map.rstick_axis_y = -1;
|
||||
default_controller_map.rstick_axis_x = -1;
|
||||
default_controller_map.rstick_axis_y_invert = false;
|
||||
default_controller_map.rstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.rstick_axis_y_invert = false;
|
||||
default_controller_map.rstick_axis_x_invert = false;
|
||||
|
||||
default_controller_map.is_retroarch = false;
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@ static int init_joystick(void)
|
|||
else
|
||||
sprintf(joystick_name[cpt], "Joystick%d", cpt);
|
||||
|
||||
// printf("Real Name >>%s<<\n",joystick_name[cpt]);
|
||||
// printf("Real Name >>%s<<\n",joystick_name[cpt]);
|
||||
|
||||
//this now uses controllers path (in tmp)
|
||||
char control_config[255];
|
||||
|
@ -812,27 +812,26 @@ static int init_joystick(void)
|
|||
auto sanitized_name = sanitize_retroarch_name(joystick_name[cpt]);
|
||||
strcat(control_config, sanitized_name.c_str());
|
||||
//strcat(control_config, joystick_name[cpt]);
|
||||
strcat(control_config, ".cfg");
|
||||
|
||||
//printf("Trying to match >>%s<<\n",control_config);
|
||||
strcat(control_config, ".cfg");
|
||||
|
||||
//printf("Trying to match >>%s<<\n",control_config);
|
||||
|
||||
if (zfile_exists(control_config))
|
||||
{
|
||||
fill_blank_controller();
|
||||
host_input_buttons[cpt] = default_controller_map;
|
||||
|
||||
|
||||
//printf("Retroarch search for: >>%s<<\n",joystick_name[cpt]);
|
||||
|
||||
//printf("Retroarch search for: >>%s<<\n",joystick_name[cpt]);
|
||||
|
||||
host_input_buttons[cpt].is_retroarch = true;
|
||||
|
||||
host_input_buttons[cpt].hotkey_button = find_retroarch("input_enable_hotkey_btn", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
|
||||
host_input_buttons[cpt].quit_button = find_retroarch("input_exit_emulator_btn", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt].menu_button = find_retroarch("input_menu_toggle_btn", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt].reset_button = find_retroarch("input_reset_btn", control_config, host_input_buttons[cpt]);
|
||||
|
||||
host_input_buttons[cpt].east_button = find_retroarch("input_a_btn", control_config, host_input_buttons[cpt]);
|
||||
|
@ -856,41 +855,41 @@ static int init_joystick(void)
|
|||
host_input_buttons[cpt].rstick_button = find_retroarch("input_r3_btn", control_config, host_input_buttons[cpt]);
|
||||
|
||||
host_input_buttons[cpt].lstick_axis_x = find_retroarch("input_l_x_plus_axis", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
if (host_input_buttons[cpt].lstick_axis_x == -1)
|
||||
host_input_buttons[cpt].lstick_axis_x = find_retroarch("input_right_axis", control_config, host_input_buttons[cpt]);
|
||||
|
||||
host_input_buttons[cpt].lstick_axis_y = find_retroarch("input_l_y_plus_axis", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
if (host_input_buttons[cpt].lstick_axis_y == -1)
|
||||
host_input_buttons[cpt].lstick_axis_y = find_retroarch("input_down_axis", control_config, host_input_buttons[cpt]);
|
||||
|
||||
host_input_buttons[cpt].rstick_axis_x = find_retroarch("input_r_x_plus_axis", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt].rstick_axis_y = find_retroarch("input_r_y_plus_axis", control_config,
|
||||
host_input_buttons[cpt]);
|
||||
host_input_buttons[cpt]);
|
||||
|
||||
// specials
|
||||
// hats
|
||||
// specials
|
||||
// hats
|
||||
host_input_buttons[cpt].number_of_hats = find_retroarch("count_hats", control_config, host_input_buttons[cpt]);
|
||||
|
||||
// invert on axes
|
||||
host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_down_axis",control_config);
|
||||
if (host_input_buttons[cpt].lstick_axis_y_invert == false)
|
||||
host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_l_y_plus_axis",control_config);
|
||||
|
||||
host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_right_axis",control_config);
|
||||
if (host_input_buttons[cpt].lstick_axis_x_invert == false)
|
||||
host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_l_x_plus_axis",control_config);
|
||||
|
||||
host_input_buttons[cpt].rstick_axis_x_invert = find_retroarch_polarity("input_r_x_plus_axis",control_config);
|
||||
host_input_buttons[cpt].rstick_axis_y_invert = find_retroarch_polarity("input_r_y_plus_axis",control_config);
|
||||
|
||||
// i'll just leave this here for when we have a working debug logging
|
||||
// printf("invert left y axis: %d\n",host_input_buttons[cpt].lstick_axis_y_invert);
|
||||
// printf("invert left x axis: %d\n",host_input_buttons[cpt].lstick_axis_x_invert);
|
||||
// printf("invert right y axis: %d\n",host_input_buttons[cpt].rstick_axis_y_invert);
|
||||
// printf("invert right x axis: %d\n",host_input_buttons[cpt].rstick_axis_x_invert);
|
||||
// invert on axes
|
||||
host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_down_axis", control_config);
|
||||
if (!host_input_buttons[cpt].lstick_axis_y_invert)
|
||||
host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_l_y_plus_axis", control_config);
|
||||
|
||||
host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_right_axis", control_config);
|
||||
if (!host_input_buttons[cpt].lstick_axis_x_invert)
|
||||
host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_l_x_plus_axis", control_config);
|
||||
|
||||
host_input_buttons[cpt].rstick_axis_x_invert = find_retroarch_polarity("input_r_x_plus_axis", control_config);
|
||||
host_input_buttons[cpt].rstick_axis_y_invert = find_retroarch_polarity("input_r_y_plus_axis", control_config);
|
||||
|
||||
//i'll just leave this here for when we have a working debug logging
|
||||
// printf("invert left y axis: %d\n",host_input_buttons[cpt].lstick_axis_y_invert);
|
||||
// printf("invert left x axis: %d\n",host_input_buttons[cpt].lstick_axis_x_invert);
|
||||
// printf("invert right y axis: %d\n",host_input_buttons[cpt].rstick_axis_y_invert);
|
||||
// printf("invert right x axis: %d\n",host_input_buttons[cpt].rstick_axis_x_invert);
|
||||
//
|
||||
//input_state_slot_increase_axis
|
||||
//input_state_slot_decrease_axis
|
||||
|
@ -1138,7 +1137,6 @@ static void read_joystick(void)
|
|||
if (current_controller_map.right_shoulder == current_controller_map.hotkey_button)
|
||||
current_controller_map.right_shoulder = -1;
|
||||
|
||||
|
||||
auto held_offset = 0;
|
||||
|
||||
// detect standalone retroarch hotkeys
|
||||
|
@ -1187,31 +1185,28 @@ static void read_joystick(void)
|
|||
held_offset = 0;
|
||||
}
|
||||
|
||||
|
||||
auto val = 0;
|
||||
|
||||
// this should allow use to change the tolerance
|
||||
int lower_bound = -32767;
|
||||
int upper_bound = 32767;
|
||||
|
||||
|
||||
// this should allow use to change the tolerance
|
||||
int lower_bound = -32767;
|
||||
int upper_bound = 32767;
|
||||
|
||||
// left stick
|
||||
if (!currprefs.input_analog_remap)
|
||||
{
|
||||
// handle the X axis (left stick)
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.lstick_axis_x);
|
||||
if (current_controller_map.lstick_axis_x_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 0, val, upper_bound);
|
||||
|
||||
if (current_controller_map.lstick_axis_x_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 0, val, upper_bound);
|
||||
|
||||
// handle the Y axis
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.lstick_axis_y);
|
||||
if (current_controller_map.lstick_axis_y_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 1, val, upper_bound);
|
||||
|
||||
if (current_controller_map.lstick_axis_y_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 1, val, upper_bound);
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -1238,19 +1233,17 @@ static void read_joystick(void)
|
|||
}
|
||||
|
||||
// right stick
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_x);
|
||||
if (current_controller_map.rstick_axis_x_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 2, val, upper_bound);
|
||||
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_y);
|
||||
if (current_controller_map.rstick_axis_y_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 3, val, upper_bound);
|
||||
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_x);
|
||||
if (current_controller_map.rstick_axis_x_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 2, val, upper_bound);
|
||||
|
||||
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_y);
|
||||
if (current_controller_map.rstick_axis_y_invert != 0)
|
||||
val = val * -1;
|
||||
|
||||
setjoystickstate(hostjoyid + 1, 3, val, upper_bound);
|
||||
|
||||
// cd32 red, blue, green, yellow
|
||||
// south
|
||||
|
@ -1266,7 +1259,6 @@ static void read_joystick(void)
|
|||
setjoybuttonstate(hostjoyid + 1, 3 + held_offset,
|
||||
(SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.north_button) & 1));
|
||||
|
||||
|
||||
// cd32 rwd, ffw, start
|
||||
setjoybuttonstate(hostjoyid + 1, 4 + held_offset,
|
||||
(SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.left_shoulder) & 1));
|
||||
|
@ -1360,20 +1352,17 @@ int input_get_default_joystick(struct uae_input_device* uid, const int num, int
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
// ASSIGN ALL INPUT EVENT ACTIONS, EITHER CUSTOM OR DEFAULT
|
||||
//
|
||||
// set up a temporary control layout/ called 'thismap'
|
||||
struct joypad_map_layout thismap[4];
|
||||
|
||||
|
||||
// here, we will fill thismap with defaults, if a custom value is not set.
|
||||
// this will do a lot of the 'logic' of the original code.
|
||||
|
||||
thismap[0] = currprefs.jports[port].amiberry_custom_none; // grab the 'no selection' options for the current map
|
||||
|
||||
// directions
|
||||
// directions
|
||||
|
||||
if (port < 2) // ports 0, 1 ...
|
||||
{
|
||||
|
@ -1568,11 +1557,11 @@ int input_get_default_joystick(struct uae_input_device* uid, const int num, int
|
|||
|
||||
thismap[1] = currprefs.jports[port].amiberry_custom_hotkey; // grab the 'select button' options for the current map
|
||||
|
||||
// currently disabled
|
||||
// thismap[2] = currprefs.jports[port].amiberry_custom_left_trigger; // grab the 'left trigger' options for the current map
|
||||
// thismap[3] = currprefs.jports[port].amiberry_custom_right_trigger; // grab the 'right trigger' options for the current map
|
||||
// currently disabled
|
||||
// thismap[2] = currprefs.jports[port].amiberry_custom_left_trigger; // grab the 'left trigger' options for the current map
|
||||
// thismap[3] = currprefs.jports[port].amiberry_custom_right_trigger; // grab the 'right trigger' options for the current map
|
||||
|
||||
// Now assign the actual buttons VALUES (TRUE/FALSE) to trigger the EVENTS
|
||||
// Now assign the actual buttons VALUES (TRUE/FALSE) to trigger the EVENTS
|
||||
auto function_offset = 0;
|
||||
|
||||
|
||||
|
|
|
@ -451,10 +451,9 @@ bool mapped_malloc(addrbank* ab)
|
|||
}
|
||||
|
||||
struct uae_mman_data md = {0};
|
||||
uaecptr start = ab->start;
|
||||
if (uae_mman_info(ab, &md))
|
||||
{
|
||||
start = md.start;
|
||||
uaecptr start = md.start;
|
||||
ab->baseaddr = regs.natmem_offset + start;
|
||||
}
|
||||
|
||||
|
@ -479,11 +478,11 @@ bool mapped_malloc(addrbank* ab)
|
|||
void mapped_free(addrbank* ab)
|
||||
{
|
||||
if (ab->label != nullptr && !strcmp(ab->label, "filesys") && ab->baseaddr != nullptr)
|
||||
{
|
||||
free(ab->baseaddr);
|
||||
{
|
||||
write_log("mapped_free(): 0x%08x - 0x%08x (0x%08x - 0x%08x) -> %s (%s)\n",
|
||||
ab->baseaddr - regs.natmem_offset, ab->baseaddr - regs.natmem_offset + ab->allocated_size,
|
||||
ab->baseaddr, ab->baseaddr + ab->allocated_size, ab->name, ab->label);
|
||||
free(ab->baseaddr);
|
||||
}
|
||||
ab->baseaddr = nullptr;
|
||||
ab->allocated_size = 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ static bool clip_no_hires = false;
|
|||
void rp9_init()
|
||||
{
|
||||
fetch_rp9path(rp9tmp_path, MAX_DPATH);
|
||||
strncat(rp9tmp_path, _T("tmp/"), MAX_DPATH);
|
||||
strncat(rp9tmp_path, _T("tmp/"), MAX_DPATH - 1);
|
||||
lstTmpRP9Files.clear();
|
||||
LIBXML_TEST_VERSION
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
if (strlen(i->Description) > 0)
|
||||
{
|
||||
strncat(tmp, " (", MAX_DPATH - 1);
|
||||
strncat(tmp, i->Description, MAX_DPATH - 1);
|
||||
strncat(tmp, i->Description, MAX_DPATH - 3);
|
||||
strncat(tmp, ")", MAX_DPATH - 1);
|
||||
}
|
||||
configs.emplace_back(tmp);
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
{
|
||||
fetch_configurationpath(filename, MAX_DPATH);
|
||||
strncat(filename, txtName->getText().c_str(), MAX_DPATH - 1);
|
||||
strncat(filename, ".uae", MAX_DPATH);
|
||||
strncat(filename, ".uae", MAX_DPATH - 1);
|
||||
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256);
|
||||
if (cfgfile_save(&changed_prefs, filename, 0))
|
||||
RefreshPanelConfig();
|
||||
|
|
|
@ -160,50 +160,32 @@ public:
|
|||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
if (actionEvent.getSource() == optPort0)
|
||||
{
|
||||
SelectedPort = 0;
|
||||
}
|
||||
else if (actionEvent.getSource() == optPort1)
|
||||
{
|
||||
SelectedPort = 1;
|
||||
}
|
||||
else if (actionEvent.getSource() == optPort2)
|
||||
{
|
||||
SelectedPort = 2;
|
||||
}
|
||||
else if (actionEvent.getSource() == optPort3)
|
||||
{
|
||||
SelectedPort = 3;
|
||||
}
|
||||
|
||||
else if (actionEvent.getSource() == optMultiNone)
|
||||
{
|
||||
SelectedFunction = 0;
|
||||
}
|
||||
else if (actionEvent.getSource() == optMultiSelect)
|
||||
{
|
||||
SelectedFunction = 1;
|
||||
}
|
||||
else if (actionEvent.getSource() == optMultiLeft)
|
||||
{
|
||||
SelectedFunction = 2;
|
||||
}
|
||||
else if (actionEvent.getSource() == optMultiRight)
|
||||
{
|
||||
SelectedFunction = 3;
|
||||
}
|
||||
|
||||
|
||||
else if (actionEvent.getSource() == chkAnalogRemap)
|
||||
changed_prefs.input_analog_remap = chkAnalogRemap->isSelected();
|
||||
|
||||
else if (actionEvent.getSource() == chkAnalogRemap)
|
||||
changed_prefs.input_analog_remap = chkAnalogRemap->isSelected();
|
||||
|
||||
RefreshPanelCustom();
|
||||
}
|
||||
};
|
||||
|
||||
static GroupActionListener* grpActionListener;
|
||||
|
||||
|
||||
class CustomActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
|
@ -330,7 +312,6 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
// and here, we will scroll through the custom-map and
|
||||
// push it into the currprefs config file
|
||||
|
||||
|
@ -394,7 +375,7 @@ void InitPanelCustom(const struct _ConfigCategory& category)
|
|||
chkAnalogRemap = new gcn::UaeCheckBox("Remap DPad to left axis");
|
||||
chkAnalogRemap->setId("chkAnalogRemap");
|
||||
chkAnalogRemap->addActionListener(grpActionListener);
|
||||
chkAnalogRemap->setEnabled(true);
|
||||
chkAnalogRemap->setEnabled(true);
|
||||
|
||||
grpPort = new gcn::Window("Joystick Port");
|
||||
grpPort->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
||||
|
@ -466,12 +447,11 @@ void InitPanelCustom(const struct _ConfigCategory& category)
|
|||
auto posY = 144 + 40;
|
||||
for (i = 0; i < 7; ++i)
|
||||
{
|
||||
category.panel->add(lblCustomAction[i], DISTANCE_BORDER/2, posY);
|
||||
category.panel->add(cboCustomAction[i], DISTANCE_BORDER/2 + lblCustomAction[i]->getWidth() + 4, posY);
|
||||
category.panel->add(lblCustomAction[i], DISTANCE_BORDER / 2, posY);
|
||||
category.panel->add(cboCustomAction[i], DISTANCE_BORDER / 2 + lblCustomAction[i]->getWidth() + 4, posY);
|
||||
posY = posY + DROPDOWN_HEIGHT + 6;
|
||||
}
|
||||
|
||||
|
||||
posY = 144 + 40;
|
||||
for (i = 7; i < 14; ++i)
|
||||
{
|
||||
|
@ -479,8 +459,8 @@ void InitPanelCustom(const struct _ConfigCategory& category)
|
|||
category.panel->add(cboCustomAction[i], DISTANCE_BORDER + lblCustomAction[i]->getWidth() + 290 + 4, posY);
|
||||
posY = posY + DROPDOWN_HEIGHT + 6;
|
||||
}
|
||||
|
||||
category.panel->add(chkAnalogRemap, DISTANCE_BORDER + lblCustomAction[0]->getWidth(), posY);
|
||||
|
||||
category.panel->add(chkAnalogRemap, DISTANCE_BORDER + lblCustomAction[0]->getWidth(), posY);
|
||||
posY += chkAnalogRemap->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
category.panel->add(lblPortInput, DISTANCE_BORDER, 144);
|
||||
|
@ -507,15 +487,14 @@ void ExitPanelCustom()
|
|||
delete optMultiLeft;
|
||||
delete optMultiRight;
|
||||
delete grpFunction;
|
||||
delete chkAnalogRemap;
|
||||
delete chkAnalogRemap;
|
||||
|
||||
for (auto & i : lblCustomAction)
|
||||
{
|
||||
delete i;
|
||||
// delete cboCustomAction[i];
|
||||
//delete cboCustomAction[i];
|
||||
}
|
||||
|
||||
|
||||
delete lblPortInput;
|
||||
delete txtPortInput;
|
||||
delete lblRetroarch;
|
||||
|
|
|
@ -258,7 +258,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
|
|||
grpLineMode = new gcn::Window("Line mode");
|
||||
#ifdef USE_SDL2
|
||||
grpLineMode->setPosition(
|
||||
grpScalingMethod->getWidth() + DISTANCE_BORDER + DISTANCE_NEXT_X,
|
||||
grpScalingMethod->getWidth() + DISTANCE_BORDER + DISTANCE_NEXT_X,
|
||||
posY - DISTANCE_BORDER - grpScalingMethod->getHeight() - DISTANCE_NEXT_Y);
|
||||
#else
|
||||
grpLineMode->setPosition(DISTANCE_BORDER, posY);
|
||||
|
|
|
@ -206,7 +206,7 @@ static void SetControlState(const int model)
|
|||
|
||||
static void AdjustPrefs(void)
|
||||
{
|
||||
const auto old_cs = changed_prefs.cs_compatible;
|
||||
//const auto old_cs = changed_prefs.cs_compatible;
|
||||
|
||||
built_in_prefs(&changed_prefs, quickstart_model, quickstart_conf, 0, 0);
|
||||
switch (quickstart_model)
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
return;
|
||||
strncpy(tmp, workingDir, MAX_DPATH - 1);
|
||||
strncat(tmp, "/", MAX_DPATH - 1);
|
||||
strncat(tmp, txtFilename->getText().c_str(), MAX_DPATH - 1);
|
||||
strncat(tmp, txtFilename->getText().c_str(), MAX_DPATH - 2);
|
||||
if (strstr(tmp, filefilter[0]) == nullptr)
|
||||
strncat(tmp, filefilter[0], MAX_DPATH - 1);
|
||||
if (my_existsfile(tmp) == 1)
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
if (fileList->isDir(selected_item))
|
||||
return; // Directory selected -> Ok not possible
|
||||
strncat(workingDir, "/", MAX_DPATH - 1);
|
||||
strncat(workingDir, fileList->getElementAt(selected_item).c_str(), MAX_DPATH - 1);
|
||||
strncat(workingDir, fileList->getElementAt(selected_item).c_str(), MAX_DPATH - 2);
|
||||
dialogResult = true;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
const auto selected_item = lstFiles->getSelected();
|
||||
strncpy(foldername, workingDir, MAX_DPATH);
|
||||
strncat(foldername, "/", MAX_DPATH - 1);
|
||||
strncat(foldername, fileList->getElementAt(selected_item).c_str(), MAX_DPATH - 1);
|
||||
strncat(foldername, fileList->getElementAt(selected_item).c_str(), MAX_DPATH - 2);
|
||||
if (fileList->isDir(selected_item))
|
||||
checkfoldername(foldername);
|
||||
else if (!createNew)
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
const auto selected_item = lstFolders->getSelected();
|
||||
strncpy(foldername, workingDir, MAX_DPATH - 1);
|
||||
strncat(foldername, "/", MAX_DPATH - 1);
|
||||
strncat(foldername, dirList.getElementAt(selected_item).c_str(), MAX_DPATH - 1);
|
||||
strncat(foldername, dirList.getElementAt(selected_item).c_str(), MAX_DPATH - 2);
|
||||
volName = dirList.getElementAt(selected_item);
|
||||
checkfoldername(foldername);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ bool SelectFolder(const char* title, char* value)
|
|||
{
|
||||
strncpy(value, workingDir, MAX_DPATH);
|
||||
if (value[strlen(value) - 1] != '/')
|
||||
strncat(value, "/", MAX_DPATH);
|
||||
strncat(value, "/", MAX_DPATH - 1);
|
||||
}
|
||||
return dialogResult;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace gcn
|
|||
label = new Label(caption);
|
||||
label->setHeight(16);
|
||||
|
||||
Image* img = Image::load(imagepath);
|
||||
auto img = Image::load(imagepath);
|
||||
icon = new Icon(img);
|
||||
icon->setSize(16, 16);
|
||||
|
||||
|
|
|
@ -791,8 +791,8 @@ namespace widgets
|
|||
strncat(tmp, last_loaded_config, MAX_DPATH - 1);
|
||||
else
|
||||
{
|
||||
strncat(tmp, OPTIONSFILENAME, MAX_DPATH);
|
||||
strncat(tmp, ".uae", MAX_DPATH);
|
||||
strncat(tmp, OPTIONSFILENAME, MAX_DPATH - 1);
|
||||
strncat(tmp, ".uae", MAX_DPATH - 10);
|
||||
}
|
||||
uae_restart(-1, tmp);
|
||||
gui_running = false;
|
||||
|
|
|
@ -101,9 +101,9 @@ struct picasso96_state_struct picasso96_state;
|
|||
struct picasso_vidbuf_description picasso_vidinfo;
|
||||
static struct PicassoResolution* newmodes = nullptr;
|
||||
|
||||
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */
|
||||
/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
||||
/* data here. */
|
||||
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions()
|
||||
have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
||||
data here. */
|
||||
static struct ScreenResolution planar = { 320, 240 };
|
||||
static struct ScreenResolution chunky = { 640, 480 };
|
||||
static struct ScreenResolution hicolour = { 640, 480 };
|
||||
|
@ -493,7 +493,7 @@ static void rtg_render(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
bool full = picasso_vidinfo.full_refresh > 0;
|
||||
//bool full = picasso_vidinfo.full_refresh > 0;
|
||||
if (uaegfx_active)
|
||||
{
|
||||
if (!currprefs.rtg_multithread)
|
||||
|
@ -1494,16 +1494,14 @@ static uaecptr picasso96_amem, picasso96_amemend;
|
|||
|
||||
static void CopyLibResolutionStructureU2A(TrapContext* ctx, struct LibResolution* libres, uaecptr amigamemptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
trap_set_bytes(ctx, amigamemptr, 0, PSSO_LibResolution_sizeof);
|
||||
for (i = 0; i < strlen(libres->P96ID); i++)
|
||||
for (unsigned int i = 0; i < strlen(libres->P96ID); i++)
|
||||
trap_put_byte(ctx, amigamemptr + PSSO_LibResolution_P96ID + i, libres->P96ID[i]);
|
||||
trap_put_long(ctx, amigamemptr + PSSO_LibResolution_DisplayID, libres->DisplayID);
|
||||
trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Width, libres->Width);
|
||||
trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Height, libres->Height);
|
||||
trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Flags, libres->Flags);
|
||||
for (i = 0; i < MAXMODES; i++)
|
||||
for (int i = 0; i < MAXMODES; i++)
|
||||
trap_put_long(ctx, amigamemptr + PSSO_LibResolution_Modes + i * 4, libres->Modes[i]);
|
||||
trap_put_long(ctx, amigamemptr + 10, amigamemptr + PSSO_LibResolution_P96ID);
|
||||
trap_put_long(ctx, amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo);
|
||||
|
@ -1614,7 +1612,7 @@ static void picasso96_alloc2(TrapContext* ctx)
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
j = i;
|
||||
//j = i;
|
||||
size += PSSO_LibResolution_sizeof;
|
||||
while (missmodes[misscnt * 2] == 0)
|
||||
misscnt++;
|
||||
|
@ -2089,16 +2087,16 @@ static uae_u32 REGPARAM2 picasso_SetPanning(TrapContext* ctx)
|
|||
uaecptr bi = trap_get_areg(ctx, 0);
|
||||
uaecptr bmeptr = trap_get_long(ctx, bi + PSSO_BoardInfo_BitMapExtra); /* Get our BoardInfo ptr's BitMapExtra ptr */
|
||||
uae_u16 bme_width, bme_height;
|
||||
int changed = 0;
|
||||
//int changed = 0;
|
||||
RGBFTYPE rgbf;
|
||||
|
||||
if (oldscr == 0) {
|
||||
oldscr = start_of_screen;
|
||||
changed = 1;
|
||||
//changed = 1;
|
||||
}
|
||||
if (oldscr != start_of_screen) {
|
||||
oldscr = start_of_screen;
|
||||
changed = 1;
|
||||
//changed = 1;
|
||||
}
|
||||
|
||||
bme_width = trap_get_word(ctx, bmeptr + PSSO_BitMapExtra_Width);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
*
|
||||
* Copyright 2001 Bernd Schmidt
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "uae.h"
|
||||
|
@ -23,7 +24,7 @@ void console_out (const TCHAR *format,...)
|
|||
va_start (parms, format);
|
||||
vsnprintf (buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
|
||||
va_end (parms);
|
||||
printf(buffer);
|
||||
cout << buffer << endl;
|
||||
}
|
||||
|
||||
void write_log (const char *format,...)
|
||||
|
@ -37,7 +38,7 @@ void write_log (const char *format,...)
|
|||
auto count = vsnprintf(buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
|
||||
if (debugfile)
|
||||
{
|
||||
fprintf(debugfile, buffer);
|
||||
fprintf(debugfile, "%s", buffer);
|
||||
fflush(debugfile);
|
||||
}
|
||||
va_end(parms);
|
||||
|
|
857
src/readcpu.cpp
857
src/readcpu.cpp
File diff suppressed because it is too large
Load diff
|
@ -36,65 +36,69 @@ int romlist_count (void)
|
|||
return romlist_cnt;
|
||||
}
|
||||
|
||||
TCHAR *romlist_get (const struct romdata *rd)
|
||||
TCHAR *romlist_get(const struct romdata *rd)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!rd)
|
||||
return 0;
|
||||
for (i = 0; i < romlist_cnt; i++) {
|
||||
if (rl[i].rd->id == rd->id)
|
||||
return rl[i].path;
|
||||
}
|
||||
return 0;
|
||||
if (!rd)
|
||||
return 0;
|
||||
for (i = 0; i < romlist_cnt; i++)
|
||||
{
|
||||
if (rl[i].rd->id == rd->id)
|
||||
return rl[i].path;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct romlist *romlist_getrl (const struct romdata *rd)
|
||||
static struct romlist *romlist_getrl(const struct romdata *rd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!rd)
|
||||
return 0;
|
||||
for (i = 0; i < romlist_cnt; i++) {
|
||||
if (rl[i].rd == rd)
|
||||
return &rl[i];
|
||||
}
|
||||
return 0;
|
||||
int i;
|
||||
|
||||
if (!rd)
|
||||
return 0;
|
||||
for (i = 0; i < romlist_cnt; i++)
|
||||
{
|
||||
if (rl[i].rd == rd)
|
||||
return &rl[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void romlist_cleanup (void);
|
||||
void romlist_add (const TCHAR *path, struct romdata *rd)
|
||||
void romlist_add(const TCHAR *path, struct romdata *rd)
|
||||
{
|
||||
struct romlist *rl2;
|
||||
struct romlist *rl2;
|
||||
|
||||
if (path == NULL || rd == NULL) {
|
||||
romlist_cleanup ();
|
||||
return;
|
||||
}
|
||||
romlist_cnt++;
|
||||
rl = xrealloc (struct romlist, rl, romlist_cnt);
|
||||
rl2 = rl + romlist_cnt - 1;
|
||||
rl2->path = my_strdup (path);
|
||||
rl2->rd = rd;
|
||||
struct romdata *rd2 = getromdatabyid (rd->id);
|
||||
if (path == NULL || rd == NULL)
|
||||
{
|
||||
romlist_cleanup();
|
||||
return;
|
||||
}
|
||||
romlist_cnt++;
|
||||
rl = xrealloc(struct romlist, rl, romlist_cnt);
|
||||
rl2 = rl + romlist_cnt - 1;
|
||||
rl2->path = my_strdup(path);
|
||||
rl2->rd = rd;
|
||||
struct romdata *rd2 = getromdatabyid(rd->id);
|
||||
if (rd2 != rd && rd2) // replace "X" with parent name
|
||||
rd->name = rd2->name;
|
||||
}
|
||||
|
||||
|
||||
struct romdata *getromdatabypath (const TCHAR *path)
|
||||
struct romdata *getromdatabypath(const TCHAR *path)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < romlist_cnt; i++) {
|
||||
struct romdata *rd = rl[i].rd;
|
||||
if (rd->configname && path[0] == ':') {
|
||||
if (!_tcscmp(path + 1, rd->configname))
|
||||
return rd;
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < romlist_cnt; i++)
|
||||
{
|
||||
struct romdata *rd = rl[i].rd;
|
||||
if (rd->configname && path[0] == ':')
|
||||
{
|
||||
if (!_tcscmp(path + 1, rd->configname))
|
||||
return rd;
|
||||
}
|
||||
if (my_issamepath(rl[i].path, path))
|
||||
return rl[i].rd;
|
||||
}
|
||||
return NULL;
|
||||
return rl[i].rd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define NEXT_ROM_ID 251
|
||||
|
|
|
@ -37,13 +37,10 @@ STATIC_INLINE uae_u32 ledcolor(uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc,
|
|||
return v;
|
||||
}
|
||||
|
||||
static void write_tdnumber(uae_u8* buf, int bpp, int x, int y, int num, uae_u32 c1, uae_u32 c2)
|
||||
static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32 c1, uae_u32 c2)
|
||||
{
|
||||
int j;
|
||||
const char* numptr;
|
||||
|
||||
numptr = numbers + num * TD_NUM_WIDTH + NUMBERS_NUM * TD_NUM_WIDTH * y;
|
||||
for (j = 0; j < TD_NUM_WIDTH; j++)
|
||||
const char* numptr = numbers + num * TD_NUM_WIDTH + NUMBERS_NUM * TD_NUM_WIDTH * y;
|
||||
for (int j = 0; j < TD_NUM_WIDTH; j++)
|
||||
{
|
||||
if (*numptr == 'x')
|
||||
putpixel(buf, nullptr, bpp, x + j, c1, 1);
|
||||
|
@ -348,10 +345,10 @@ void statusline_clear(void)
|
|||
{
|
||||
statusline_text_active = nullptr;
|
||||
statusline_delay = 0;
|
||||
for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++)
|
||||
for (auto& i : statusline_data)
|
||||
{
|
||||
xfree(statusline_data[i].text);
|
||||
statusline_data[i].text = nullptr;
|
||||
xfree(i.text);
|
||||
i.text = nullptr;
|
||||
}
|
||||
statusline_update_notification();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue