From: Toni Wilen Date: Sun, 26 Sep 2004 11:06:50 +0000 (+0300) Subject: imported winuaesrc0992b3.zip X-Git-Tag: 2100~328 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=b1e5d6046c7682c597f28fd5bb302b6d5aecd151;p=francis%2Fwinuae.git imported winuaesrc0992b3.zip --- diff --git a/blitter.c b/blitter.c index a95d4e42..1c8495dd 100755 --- a/blitter.c +++ b/blitter.c @@ -524,6 +524,8 @@ void blitter_handler(void) STATIC_INLINE int channel_state (int cycles) { + if (cycles < 0) + return 0; if (cycles < blit_diag[0]) return blit_diag[blit_diag[1] + 2 + cycles]; return blit_diag[((cycles - blit_diag[0]) % blit_diag[1]) + 2]; @@ -890,7 +892,8 @@ void do_blitter (int hpos) prevb = 0; blit_firstline_cycles = blit_first_cycle = get_cycles (); - blit_cyclecounter = blit_misscyclecounter = 0; + blit_cyclecounter = -1; + blit_misscyclecounter = 0; blit_last_cycle = 0; blit_maxcyclecounter = 0; blit_last_hpos = hpos; diff --git a/cfgfile.c b/cfgfile.c index c5652686..d38c84b3 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -1377,7 +1377,8 @@ int cfgfile_get_description (const char *filename, char *description, char *host p->config_hardware_path[0] = 0; if (cfgfile_load_2 (p, filename, 0, type)) { result = 1; - strcpy (description, p->description); + if (description) + strcpy (description, p->description); if (hostlink) strcpy (hostlink, p->config_host_path); if (hardwarelink) diff --git a/cia.c b/cia.c index a0af6062..e2e9e8e2 100755 --- a/cia.c +++ b/cia.c @@ -495,6 +495,20 @@ static uae_u8 ReadCIAA (unsigned int addr) write_log ("BFE101 R %02.2X %s\n", tmp, debuginfo(0)); #endif #endif + if (ciaacrb & 2) { + int pb7 = 0; + if (ciaacrb & 4) + pb7 = ciaacrb & 1; + tmp &= ~0x80; + tmp |= pb7 ? 0x80 : 00; + } + if (ciaacra & 2) { + int pb6 = 0; + if (ciaacra & 4) + pb6 = ciaacra & 1; + tmp &= ~0x40; + tmp |= pb6 ? 0x40 : 00; + } return tmp; case 2: #ifdef DONGLE_DEBUG @@ -584,7 +598,22 @@ static uae_u8 ReadCIAB (unsigned int addr) if (notinrom ()) write_log ("BFD100 R %02.2X %s\n", ciabprb, debuginfo(0)); #endif - return ciabprb; + tmp = ciabprb; + if (ciabcrb & 2) { + int pb7 = 0; + if (ciabcrb & 4) + pb7 = ciabcrb & 1; + tmp &= ~0x80; + tmp |= pb7 ? 0x80 : 00; + } + if (ciabcra & 2) { + int pb6 = 0; + if (ciabcra & 4) + pb6 = ciabcra & 1; + tmp &= ~0x40; + tmp |= pb6 ? 0x40 : 00; + } + return tmp; case 2: return ciabdra; case 3: diff --git a/custom.c b/custom.c index b2e7b6f4..80c3deda 100755 --- a/custom.c +++ b/custom.c @@ -13,6 +13,7 @@ #define SPRITE_DEBUG 0 #define SPRITE_DEBUG_MINY 50 #define SPRITE_DEBUG_MAXY 101 +//#define SPRITE_MASK 0 #define SPRITE_MASK (1|2|4|8|16|32|64|128) #define SPR0_HPOS 0x15 #define MAX_SPRITES 8 @@ -250,6 +251,7 @@ struct copper { unsigned int first_sync; unsigned int regtypes_modified; int strobe; /* COPJMP1 / COPJMP2 accessed */ + int last_write, last_write_hpos; }; #define REGTYPE_NONE 0 @@ -3005,11 +3007,20 @@ STATIC_INLINE spr_arm (int num, int state) } } +STATIC_INLINE void sprstartstop (struct sprite *s) +{ + if (vpos == s->vstart) + s->dmastate = 1; + if (vpos == s->vstop) + s->dmastate = 0; +} + STATIC_INLINE void SPRxCTLPOS (int num) { int sprxp; struct sprite *s = &spr[num]; + sprstartstop (s); sprxp = (sprpos[num] & 0xFF) * 2 + (sprctl[num] & 1); /* Quite a bit salad in this register... */ #ifdef AGA @@ -3028,10 +3039,7 @@ STATIC_INLINE void SPRxCTLPOS (int num) s->vstart |= (sprctl[num] << 3) & 0x200; s->vstop |= (sprctl[num] << 4) & 0x200; } - if (vpos == s->vstart) - s->dmastate = 1; - if (vpos == s->vstop) - s->dmastate = 0; + sprstartstop (s); } STATIC_INLINE void SPRxCTL_1 (uae_u16 v, int num, int hpos) @@ -3463,18 +3471,27 @@ static void perform_copper_write (int old_hpos) } else if (address == 0x8A) { cop_state.ip = cop2lc; cop_state.state = COP_strobe_delay; - } else + } else { custom_wput_1 (old_hpos, cop_state.saved_i1, cop_state.saved_i2, 0); + cop_state.last_write = cop_state.saved_i1; + cop_state.last_write_hpos = old_hpos; + old_hpos++; + if (cop_state.saved_i1 >= 0x140 && cop_state.saved_i1 < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) { + //write_log ("%d:%d %04.4X:%04.4X\n", vpos, old_hpos, cop_state.saved_i1, cop_state.saved_i2); + do_sprites (old_hpos); + } + } } static int isagnus[]= { 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* 32 0x00 - 0x3e */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 27 0x40 - 0x74 */ + 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, /* 21 */ 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0, /* 32 0xa0 - 0xde /* BPLxPTH/BPLxPTL */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ - 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, /* 16 */ + 0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, /* 16 */ /* SPRxPTH/SPRxPTL */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ /* SPRxPOS/SPRxCTL/SPRxDATA/SPRxDATB */ @@ -3587,7 +3604,8 @@ static void update_copper (int until_hpos) continue; #endif if (cop_state.strobe) { - cop_state.ip = cop_state.strobe == 1 ? cop1lc : cop2lc; + if (cop_state.strobe > 0) + cop_state.ip = cop_state.strobe == 1 ? cop1lc : cop2lc; cop_state.strobe = 0; } @@ -3885,6 +3903,10 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) } if (!dmaen (DMA_SPRITE)) return; + if (cycle && !s->dmacycle) + return; /* Superfrog intro flashing bee fix */ + + dma = hpos < plfstrt || diwstate != DIW_waiting_stop || !dmaen (DMA_BITPLANE); if (vpos == s->vstop || vpos == sprite_vblank_endline) { s->dmastate = 0; @@ -3908,13 +3930,18 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif - if (cycle == 0) + //write_log ("%d:%d: %04.4X=%04.4X\n", vpos, hpos, 0x140 + cycle * 2 + num * 8, data); + if (cycle == 0) { SPRxPOS_1 (data, num, hpos); - else + s->dmacycle = 1; + } else { SPRxCTL_1 (data, num, hpos); + } } if (s->dmastate && !posctl) { - uae_u16 data = sprite_fetch (s, dma, hpos, cycle, 1); + uae_u16 data; + + data = sprite_fetch (s, dma, hpos, cycle, 1); /* Hack for X mouse auto-calibration */ if (num == 0 && cycle == 0) mousehack_handle (sprctl[0], sprpos[0]); @@ -3923,10 +3950,13 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif - if (cycle == 0) + if (cycle == 0) { SPRxDATA_1 (dma ? data : sprdata[num][0], num, hpos); - else + s->dmacycle = 1; + } else { SPRxDATB_1 (dma ? data : sprdatb[num][0], num, hpos); + spr_arm (num, 1); + } #ifdef AGA switch (sprite_width) { @@ -4003,22 +4033,26 @@ static void do_sprites (int hpos) for (i = minspr; i < maxspr; i++) { int cycle = -1; + int num = (i - SPR0_HPOS) / 4; switch ((i - SPR0_HPOS) & 3) { case 0: cycle = 0; + spr[num].dmacycle = 0; break; case 2: cycle = 1; break; } if (cycle >= 0) - do_sprites_1 ((i - SPR0_HPOS) / 4, cycle, i); + do_sprites_1 (num, cycle, i); } last_sprite_hpos = hpos; #else - for (i = 0; i < MAX_SPRITES * 2; i++) + for (i = 0; i < MAX_SPRITES * 2; i++) { + spr[i / 2].dmacycle = 1; do_sprites_1 (i / 2, i & 1, 0); + } #endif } @@ -4453,6 +4487,7 @@ static void hsync_handler (void) #endif /* See if there's a chance of a copper wait ending this line. */ cop_state.hpos = 0; + cop_state.last_write = 0; compute_spcflag_copper (); inputdevice_hsync (); serial_hsynchandler (); diff --git a/drawing.c b/drawing.c index 422b8e51..8272c96c 100755 --- a/drawing.c +++ b/drawing.c @@ -1447,6 +1447,8 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) } bplham = dp_for_drawing->ham_at_start; } + if (plf2pri > 5 && bplplanecnt == 5 && !(currprefs.chipset_mask & CSMASK_AGA)) + weird_bitplane_fix (); { if (dip_for_drawing->nr_sprites) { @@ -1464,8 +1466,6 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) draw_sprites_ecs (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i); } } - if (plf2pri > 5 && bplplanecnt > 4 && bplplanecnt < 6 && !(currprefs.chipset_mask & CSMASK_AGA)) - weird_bitplane_fix (); } do_color_changes (pfield_do_fill_line, pfield_do_linetoscr); diff --git a/include/inputdevice.h b/include/inputdevice.h index a5bb7701..47f95ccc 100755 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -49,8 +49,8 @@ struct uae_input_device_kbr_default { #define ID_AXIS_TOTAL 32 extern int inputdevice_iterate (int devnum, int num, char *name, int *af); -extern int inputdevice_set_mapping (int devnum, int num, char *name, int af, int sub); -extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, int sub); +extern int inputdevice_set_mapping (int devnum, int num, char *name, char *custom, int af, int sub); +extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, char *custom, int sub); extern void inputdevice_copyconfig (struct uae_prefs *src, struct uae_prefs *dst); extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum); extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum); diff --git a/include/options.h b/include/options.h index b6a865cb..1f7af5db 100755 --- a/include/options.h +++ b/include/options.h @@ -35,6 +35,7 @@ struct strlist { struct uae_input_device { char *name; uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; + char *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; uae_u16 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; uae_s16 extra[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS]; uae_u8 enabled; diff --git a/inputdevice.c b/inputdevice.c index 0155f93e..5ce12139 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -88,7 +88,7 @@ struct inputevent { #define DEFEVENT(A, B, C, D, E, F) {#A, B, C, D, E, F }, struct inputevent events[] = { -{0, 0, 0, 0, 0, 0}, +{0, 0, AM_K,0,0,0}, #include "inputevents.def" {0, 0, 0, 0, 0, 0} }; @@ -178,12 +178,14 @@ static void write_config2 (struct zfile *f, int idnum, int i, int offset, char * { char tmp2[200], *p; int event, got, j, k; + char *custom; p = tmp2; got = 0; for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { event = id->eventid[i + offset][j]; - if (event <= 0) { + custom = id->custom[i + offset][j]; + if (custom == NULL && event <= 0) { for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) { if (id->eventid[i + offset][k] > 0) break; } @@ -194,7 +196,9 @@ static void write_config2 (struct zfile *f, int idnum, int i, int offset, char * *p++ = ','; *p = 0; } - if (event <= 0) + if (custom) + sprintf (p, "\"%s\".%d", custom, id->flags[i + offset][j]); + else if (event <= 0) sprintf (p, "NULL"); else sprintf (p, "%s.%d", events[event].confname, id->flags[i + offset][j]); @@ -262,8 +266,9 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae p = tmp2; p[0] = 0; for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + char *custom = kbr->custom[i][j]; event = kbr->eventid[i][j]; - if (event <= 0) { + if (custom == NULL && event <= 0) { for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) { if (kbr->eventid[i][k] > 0) break; } @@ -274,7 +279,9 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae *p++ = ','; *p = 0; } - if (event > 0) + if (custom) + sprintf (p, "\"%s\".%d", custom, kbr->flags[i][j]); + else if (event > 0) sprintf (p, "%s.%d", events[event].confname, kbr->flags[i][j]); else strcat (p, "NULL"); @@ -341,13 +348,26 @@ void reset_inputdevice_config (struct uae_prefs *pr) memset (mouse_settings_reset, 0, sizeof (mouse_settings_reset)); } +static void clear_id (struct uae_input_device *id) +{ + int i, j; +#ifndef _DEBUG + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) + xfree (id->custom[i][j]); + } +#endif + memset (id, 0, sizeof (struct uae_input_device)); + id->enabled = 1; +} + void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) { struct uae_input_device *id = 0; struct inputevent *ie; int devnum, num, button, joystick, flags, i, subnum, idnum, keynum; int mask; - char *p, *p2; + char *p, *p2, *custom; option += 6; /* "input." */ p = getstring (&option); @@ -374,10 +394,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; id = &pr->mouse_settings[idnum][devnum]; - if (!mouse_settings_reset[idnum][devnum]) { - memset (id, 0, sizeof (struct uae_input_device)); - id->enabled = 1; - } + if (!mouse_settings_reset[idnum][devnum]) + clear_id (id); mouse_settings_reset[idnum][devnum] = 1; joystick = 0; } else if (memcmp (option, "joystick.", 9) == 0) { @@ -386,10 +404,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; id = &pr->joystick_settings[idnum][devnum]; - if (!joystick_settings_reset[idnum][devnum]) { - memset (id, 0, sizeof (struct uae_input_device)); - id->enabled = 1; - } + if (!joystick_settings_reset[idnum][devnum]) + clear_id (id); joystick_settings_reset[idnum][devnum] = 1; joystick = 1; } else if (memcmp (option, "keyboard.", 9) == 0) { @@ -435,10 +451,13 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) } p = value; - subnum = 0; - while (subnum < MAX_INPUT_SUB_EVENT) { + custom = NULL; + for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) { + xfree (custom); + custom = NULL; p2 = getstring (&p); - if (!p2) break; + if (!p2) + break; i = 1; while (events[i].name) { if (!strcmp (events[i].confname, p2)) @@ -447,36 +466,48 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) } ie = &events[i]; if (!ie->name) { - subnum++; - continue; + ie = &events[0]; + if (strlen (p2) > 2 && p2[0] == '"' && p2[strlen (p2) - 1] == '"') { + custom = my_strdup (p2 + 1); + custom[strlen (custom) - 1] = 0; + } } flags = getnum (&p); + if (custom == NULL && ie->name == NULL) + continue; if (joystick < 0) { if (!(ie->allow_mask & AM_K)) - return; + continue; id->eventid[keynum][subnum] = ie - events; id->flags[keynum][subnum] = flags; + xfree (id->custom[keynum][subnum]); + id->custom[keynum][subnum] = custom; } else if (button) { if (joystick) mask = AM_JOY_BUT; else mask = AM_MOUSE_BUT; if (!(ie->allow_mask & mask)) - return; + continue; id->eventid[num + ID_BUTTON_OFFSET][subnum] = ie - events; id->flags[num + ID_BUTTON_OFFSET][subnum] = flags; + xfree (id->custom[num + ID_BUTTON_OFFSET][subnum]); + id->custom[num + ID_BUTTON_OFFSET][subnum] = custom; } else { if (joystick) mask = AM_JOY_AXIS; else mask = AM_MOUSE_AXIS; if (!(ie->allow_mask & mask)) - return; + continue; id->eventid[num + ID_AXIS_OFFSET][subnum] = ie - events; id->flags[num + ID_AXIS_OFFSET][subnum] = flags; + xfree (id->custom[num + ID_AXIS_OFFSET][subnum]); + id->custom[num + ID_AXIS_OFFSET][subnum] = custom; } - subnum++; + custom = NULL; } + xfree (custom); } /* Mousehack stuff */ @@ -1843,49 +1874,58 @@ static struct uae_input_device *get_uid (struct inputdevice_functions *id, int d return uid; } -static int get_event_data (struct inputdevice_functions *id, int devnum, int num, int *eventid, int *flags, int sub) +static int get_event_data (struct inputdevice_functions *id, int devnum, int num, int *eventid, char **custom, int *flags, int sub) { struct uae_input_device *uid = get_uid (id, devnum); int type = id->get_widget_type (devnum, num, 0, 0); int i; if (type == IDEV_WIDGET_BUTTON) { - i = num - id->get_widget_first (devnum, type); - *eventid = uid->eventid[ID_BUTTON_OFFSET + i][sub]; - *flags = uid->flags[ID_BUTTON_OFFSET + i][sub]; + i = num - id->get_widget_first (devnum, type) + ID_BUTTON_OFFSET; + *eventid = uid->eventid[i][sub]; + *flags = uid->flags[i][sub]; + *custom = uid->custom[i][sub]; return i; } else if (type == IDEV_WIDGET_AXIS) { - i = num - id->get_widget_first (devnum, type); - *eventid = uid->eventid[ID_AXIS_OFFSET + i][sub]; - *flags = uid->flags[ID_AXIS_OFFSET + i][sub]; + i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET; + *eventid = uid->eventid[i][sub]; + *flags = uid->flags[i][sub]; + *custom = uid->custom[i][sub]; return i; } else if (type == IDEV_WIDGET_KEY) { i = num - id->get_widget_first (devnum, type); *eventid = uid->eventid[i][sub]; *flags = uid->flags[i][sub]; + *custom = uid->custom[i][sub]; return i; } return -1; } -static int put_event_data (struct inputdevice_functions *id, int devnum, int num, int eventid, int flags, int sub) +static int put_event_data (struct inputdevice_functions *id, int devnum, int num, int eventid, char *custom, int flags, int sub) { struct uae_input_device *uid = get_uid (id, devnum); int type = id->get_widget_type (devnum, num, 0, 0); int i; if (type == IDEV_WIDGET_BUTTON) { - i = num - id->get_widget_first (devnum, type); - uid->eventid[ID_BUTTON_OFFSET + i][sub] = eventid; - uid->flags[ID_BUTTON_OFFSET + i][sub] = flags; + i = num - id->get_widget_first (devnum, type) + ID_BUTTON_OFFSET; + uid->eventid[i][sub] = eventid; + uid->flags[i][sub] = flags; + xfree (uid->custom[i][sub]); + uid->custom[i][sub] = custom ? my_strdup (custom) : NULL; return i; } else if (type == IDEV_WIDGET_AXIS) { - i = num - id->get_widget_first (devnum, type); - uid->eventid[ID_AXIS_OFFSET + i][sub] = eventid; - uid->flags[ID_AXIS_OFFSET + i][sub] = flags; + i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET; + uid->eventid[i][sub] = eventid; + uid->flags[i][sub] = flags; + xfree (uid->custom[i][sub]); + uid->custom[i][sub] = custom ? my_strdup (custom) : NULL; return i; } else if (type == IDEV_WIDGET_KEY) { i = num - id->get_widget_first (devnum, type); uid->eventid[i][sub] = eventid; uid->flags[i][sub] = flags; + xfree (uid->custom[i][sub]); + uid->custom[i][sub] = custom ? my_strdup (custom) : NULL; return i; } return -1; @@ -1895,10 +1935,11 @@ static int is_event_used (struct inputdevice_functions *id, int devnum, int isnu { struct uae_input_device *uid = get_uid (id, devnum); int num, event, flag, sub; + char *custom; for (num = 0; num < id->get_widget_num (devnum); num++) { for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { - if (get_event_data (id, devnum, num, &event, &flag, sub) >= 0) { + if (get_event_data (id, devnum, num, &event, &custom, &flag, sub) >= 0) { if (event == isevent && isnum != num) return 1; } @@ -1987,6 +2028,7 @@ int inputdevice_iterate (int devnum, int num, char *name, int *af) struct inputevent *ie; int mask, data, flags, type; int devindex = inputdevice_get_device_index (devnum); + char *custom; *af = 0; *name = 0; @@ -2028,31 +2070,37 @@ int inputdevice_iterate (int devnum, int num, char *name, int *af) } if (!(ie->allow_mask & mask)) continue; - get_event_data (idf, devindex, num, &data, &flags, 0); + get_event_data (idf, devindex, num, &data, &custom, &flags, 0); get_ename (ie, name); *af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; return 1; } } -int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, int sub) +int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, char *custom, int sub) { struct inputdevice_functions *idf = getidf (devnum); struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); int flags = 0, flag, data; int devindex = inputdevice_get_device_index (devnum); + char *customp = NULL; if (name) strcpy (name, ""); + if (custom) + custom[0] = 0; if (pflags) *pflags = 0; if (uid == 0 || num < 0) return 0; - if (get_event_data (idf, devindex, num, &data, &flag, sub) < 0) + if (get_event_data (idf, devindex, num, &data, &customp, &flag, sub) < 0) return 0; + if (customp && custom) + sprintf (custom, "\"%s\"", customp); if (flag & ID_FLAG_AUTOFIRE) flags |= IDEV_MAPPED_AUTOFIRE_SET; - if (!data) return 0; + if (!data) + return 0; if (events[data].allow_mask & AM_AF) flags |= IDEV_MAPPED_AUTOFIRE_POSSIBLE; if (pflags) @@ -2061,7 +2109,7 @@ int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, i return data; } -int inputdevice_set_mapping (int devnum, int num, char *name, int af, int sub) +int inputdevice_set_mapping (int devnum, int num, char *name, char *custom, int af, int sub) { struct inputdevice_functions *idf = getidf (devnum); struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); @@ -2085,14 +2133,14 @@ int inputdevice_set_mapping (int devnum, int num, char *name, int af, int sub) } else { eid = 0; } - if (get_event_data (idf, devindex, num, &data, &flag, sub) < 0) + if (get_event_data (idf, devindex, num, &data, &custom, &flag, sub) < 0) return 0; if (data >= 0) { amask = events[eid].allow_mask; flag &= ~ID_FLAG_AUTOFIRE; if (amask & AM_AF) flag |= af ? ID_FLAG_AUTOFIRE : 0; - put_event_data (idf, devindex, num, eid, flag, sub); + put_event_data (idf, devindex, num, eid, custom, flag, sub); return 1; } return 0; diff --git a/inputevents.def b/inputevents.def index f7fa0ada..42c4a151 100755 --- a/inputevents.def +++ b/inputevents.def @@ -1,3 +1,4 @@ + /* joystick/mouse port 1 */ DEFEVENT(JOYPORT1_START,"Joystick port 1", AM_INFO, 0,1,0) diff --git a/main.c b/main.c index 36d24c9f..76f4bd40 100755 --- a/main.c +++ b/main.c @@ -394,7 +394,7 @@ static void parse_cmdline (int argc, char **argv) if (i + 1 < argc) i++; } else if (strncmp (argv[i], "-config=", 8) == 0) { - target_cfgfile_load (&currprefs, argv[i] + 8, 0, 1); + target_cfgfile_load (&currprefs, argv[i] + 8, -1, 1); } /* Check for new-style "-f xxx" argument, where xxx is config-file */ else if (strcmp (argv[i], "-f") == 0) { @@ -405,7 +405,7 @@ static void parse_cmdline (int argc, char **argv) free_mountinfo (currprefs.mountinfo); currprefs.mountinfo = alloc_mountinfo (); #endif - target_cfgfile_load (&currprefs, argv[++i], 0, 1); + target_cfgfile_load (&currprefs, argv[++i], -1, 1); } } else if (strcmp (argv[i], "-s") == 0) { if (i + 1 == argc) diff --git a/memory.c b/memory.c index 418f3aff..9ca36e1b 100755 --- a/memory.c +++ b/memory.c @@ -24,6 +24,7 @@ #include "crc32.h" #include "gui.h" #include "cdtv.h" +#include "enforcer.h" #ifdef JIT int canbang; @@ -1129,6 +1130,7 @@ uae_u8 REGPARAM2 *default_xlate (uaecptr a) if (quit_program == 0) { /* do this only in 68010+ mode, there are some tricky A500 programs.. */ if (currprefs.cpu_level > 0 || !currprefs.cpu_compatible) { + enforcer_disable (); if (be_cnt < 3) { int i, j; uaecptr a2 = a - 32; diff --git a/moduleripper.c b/moduleripper.c index 48bb226c..a69543c4 100755 --- a/moduleripper.c +++ b/moduleripper.c @@ -92,4 +92,15 @@ FILE *moduleripper2_fopen (const char *name, const char *mode, const char *id) return fopen (name, mode); } -#endif \ No newline at end of file +#else + +FILE *moduleripper_fopen (const char *name, const char *mode) +{ + return NULL; +} +FILE *moduleripper2_fopen (const char *name, const char *mode, const char *id) +{ + return NULL; +} + +#endif diff --git a/od-win32/win32.c b/od-win32/win32.c index ba3dfb07..ac948839 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -368,6 +368,21 @@ static void setcursor(int oldx, int oldy) SetCursorPos (amigawin_rect.left + x, amigawin_rect.top + y); } +static int activateapp; + +static void checkpause (void) +{ + if (activateapp) + return; + if (currprefs.win32_inactive_pause) { + close_sound (); + #ifdef AHI + ahi_close_sound (); + #endif + emulation_paused = 1; + } +} + void setmouseactive (int active) { int oldactive = mouseactive; @@ -418,6 +433,8 @@ void setmouseactive (int active) } inputdevice_acquire (); } + if (!active) + checkpause (); } #ifndef AVIOUTPUT @@ -495,7 +512,7 @@ static void winuae_inactive (HWND hWnd, int minimized) if (minimized) exit_gui (0); focus = 0; - write_log( "WinUAE now inactive via WM_ACTIVATE\n" ); + write_log ("WinUAE now inactive via WM_ACTIVATE\n"); wait_keyrelease (); setmouseactive (0); close_sound (); @@ -534,13 +551,6 @@ static void winuae_inactive (HWND hWnd, int minimized) ahi_close_sound (); #endif } - if (currprefs.win32_inactive_pause) { - close_sound (); - #ifdef AHI - ahi_close_sound (); - #endif - emulation_paused = 1; - } } } setpriority (pri); @@ -648,6 +658,7 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, #if 0 write_log ("WM_ACTIVATEAPP %d %d\n", wParam, minimized); #endif + activateapp = wParam; if (!wParam) { setmouseactive (0); if (normal_display_change_starting == 0) @@ -770,7 +781,7 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; case WM_CLOSE: - if( !currprefs.win32_ctrl_F11_is_quit ) + if (!currprefs.win32_ctrl_F11_is_quit) uae_quit (); return 0; @@ -1101,6 +1112,7 @@ void handle_events (void) #endif was_paused = 1; manual_painting_needed++; + gui_fps (0, 0); } if (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage (&msg); @@ -1533,7 +1545,7 @@ int WIN32_InitLibraries( void ) /* Make sure we do an InitCommonControls() to get some advanced controls */ InitCommonControls(); - hRichEdit = LoadLibrary( "RICHED32.DLL" ); + hRichEdit = LoadLibrary ("RICHED32.DLL"); hUIDLL = LoadGUI(); pritransla (); @@ -1571,14 +1583,14 @@ void logging_init( void ) debugfile = 0; } #ifndef SINGLEFILE - if( currprefs.win32_logfile ) { - sprintf( debugfilename, "%swinuaelog.txt", start_path ); + if (currprefs.win32_logfile) { + sprintf (debugfilename, "%swinuaelog.txt", start_path); if( !debugfile ) - debugfile = fopen( debugfilename, "wt" ); + debugfile = fopen (debugfilename, "wt"); } else if (!first) { - sprintf( debugfilename, "%swinuaebootlog.txt", start_path ); + sprintf (debugfilename, "%swinuaebootlog.txt", start_path); if( !debugfile ) - debugfile = fopen( debugfilename, "wt" ); + debugfile = fopen (debugfilename, "wt"); } #endif first++; @@ -1599,8 +1611,8 @@ void logging_init( void ) void logging_cleanup( void ) { - if( debugfile ) - fclose( debugfile ); + if (debugfile) + fclose (debugfile); debugfile = 0; } diff --git a/od-win32/win32.h b/od-win32/win32.h index fd977607..49e72954 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed; extern int mouseactive, focus; extern int ignore_messages_all; #define WINUAEBETA 1 -#define WINUAEBETASTR " Beta 2" +#define WINUAEBETASTR " Beta 3" extern void my_kbd_handler (int, int, int); extern void clearallkeys(void); diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index bb7bc446..51c4ebf6 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -45,7 +45,7 @@ #include "parser.h" #define AMIGA_WIDTH_MAX 736 -#define AMIGA_HEIGHT_MAX 564 +#define AMIGA_HEIGHT_MAX 568 #define DM_DX_FULLSCREEN 1 #define DM_W_FULLSCREEN 2 diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 34996779..efc8b56a 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -566,9 +566,20 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde int v, i, type2; DWORD ct, ct2, size; char tmp1[MAX_DPATH], tmp2[MAX_DPATH]; + char fname[MAX_DPATH]; + + strcpy (fname, filename); + if (!zfile_exists (fname)) { + fetch_configurationpath (fname, sizeof (fname)); + strcat (fname, filename); + } if (isdefault) qs_override = 1; + if (type < 0) { + type = 0; + cfgfile_get_description (fname, NULL, NULL, NULL, &type); + } if (type == 0 || type == 1) { if (p->mountinfo == currprefs.mountinfo) currprefs.mountinfo = 0; @@ -582,7 +593,7 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde if (type == 0) default_prefs (p, type); RegQueryValueEx (hWinUAEKey, "ConfigFile_NoAuto", 0, NULL, (LPBYTE)&ct2, &size); - v = cfgfile_load (p, filename, &type2, ct2); + v = cfgfile_load (p, fname, &type2, ct2); if (!v) return v; if (type > 0) @@ -1479,20 +1490,22 @@ static void set_lventry_input (HWND list, int index) { int flags, i, sub; char name[256]; + char custom[MAX_DPATH]; char af[10]; - inputdevice_get_mapped_name (input_selected_device, index, &flags, name, input_selected_sub_num); + inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num); if (flags & IDEV_MAPPED_AUTOFIRE_SET) WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af)); else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE) WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af)); else strcpy (af,"-"); - ListView_SetItemText(list, index, 1, name); + ListView_SetItemText(list, index, 1, custom[0] ? custom : name); ListView_SetItemText(list, index, 2, af); sub = 0; for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { - if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, i)) sub++; + if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, i) || custom[0]) + sub++; } sprintf (name, "%d", sub); ListView_SetItemText(list, index, 3, name); @@ -4129,9 +4142,9 @@ static void values_to_miscdlg (HWND hDlg) CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse); CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile); CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); - CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound); + CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause); CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause); - CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound); + CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause); CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit); CheckDlgButton (hDlg, IDC_NOOVERLAY, workprefs.win32_no_overlay); CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen); @@ -4252,16 +4265,22 @@ static BOOL MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) workprefs.win32_logfile = IsDlgButtonChecked (hDlg, IDC_CREATELOGFILE); enable_for_miscdlg( hDlg ); break; + case IDC_INACTIVE_NOSOUND: + if (!IsDlgButtonChecked (hDlg, IDC_INACTIVE_NOSOUND)) + CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, BST_UNCHECKED); case IDC_INACTIVE_PAUSE: workprefs.win32_inactive_pause = IsDlgButtonChecked (hDlg, IDC_INACTIVE_PAUSE); - break; - case IDC_INACTIVE_NOSOUND: + if (workprefs.win32_inactive_pause) + CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, BST_CHECKED); workprefs.win32_inactive_nosound = IsDlgButtonChecked (hDlg, IDC_INACTIVE_NOSOUND); break; + case IDC_MINIMIZED_NOSOUND: + if (!IsDlgButtonChecked (hDlg, IDC_MINIMIZED_NOSOUND)) + CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, BST_UNCHECKED); case IDC_MINIMIZED_PAUSE: workprefs.win32_iconified_pause = IsDlgButtonChecked (hDlg, IDC_MINIMIZED_PAUSE); - break; - case IDC_MINIMIZED_NOSOUND: + if (workprefs.win32_iconified_pause) + CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, BST_CHECKED); workprefs.win32_iconified_nosound = IsDlgButtonChecked (hDlg, IDC_MINIMIZED_NOSOUND); break; case IDC_CTRLF11: @@ -6425,13 +6444,13 @@ static void values_from_portsdlg (HWND hDlg) break; } workprefs.serial_demand = 0; - if( IsDlgButtonChecked( hDlg, IDC_SHARED ) ) + if (IsDlgButtonChecked (hDlg, IDC_SHARED)) workprefs.serial_demand = 1; workprefs.serial_hwctsrts = 0; - if( IsDlgButtonChecked( hDlg, IDC_SER_CTSRTS ) ) + if (IsDlgButtonChecked (hDlg, IDC_SER_CTSRTS)) workprefs.serial_hwctsrts = 1; workprefs.serial_direct = 0; - if( IsDlgButtonChecked( hDlg, IDC_SERIAL_DIRECT ) ) + if (IsDlgButtonChecked (hDlg, IDC_SERIAL_DIRECT)) workprefs.serial_direct = 1; GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, 256); @@ -6709,6 +6728,7 @@ static void values_to_inputdlg (HWND hDlg) static void init_inputdlg_2( HWND hDlg ) { char name1[256], name2[256]; + char custom1[MAX_DPATH]; int cnt, index, af, aftmp; if (input_selected_widget < 0) { @@ -6720,7 +6740,7 @@ static void init_inputdlg_2( HWND hDlg ) SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_ADDSTRING, 0, (LPARAM)szNone); index = -1; af = 0; if (input_selected_widget >= 0) { - inputdevice_get_mapped_name (input_selected_device, input_selected_widget, 0, name1, input_selected_sub_num); + inputdevice_get_mapped_name (input_selected_device, input_selected_widget, 0, name1, custom1, input_selected_sub_num); cnt = 1; while(inputdevice_iterate (input_selected_device, input_selected_widget, name2, &aftmp)) { free (eventnames[cnt]); @@ -6874,9 +6894,9 @@ static void values_from_inputdlg (HWND hDlg) if (doselect && input_selected_device >= 0 && input_selected_event >= 0) { int flags; inputdevice_get_mapped_name (input_selected_device, input_selected_widget, - &flags, 0, input_selected_sub_num); + &flags, 0, NULL, input_selected_sub_num); inputdevice_set_mapping (input_selected_device, input_selected_widget, - eventnames[input_selected_event], (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, + eventnames[input_selected_event], NULL, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num); update_listview_input (hDlg); inputdevice_updateconfig (&workprefs); @@ -6903,15 +6923,16 @@ static void input_toggleautofire (void) { int af, flags, event; char name[256]; + char custom[MAX_DPATH]; if (input_selected_device < 0 || input_selected_widget < 0) return; event = inputdevice_get_mapped_name (input_selected_device, input_selected_widget, - &flags, name, input_selected_sub_num); + &flags, name, custom, input_selected_sub_num); if (event <= 0) return; af = (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 0 : 1; inputdevice_set_mapping (input_selected_device, input_selected_widget, - name, af, input_selected_sub_num); + name, custom, af, input_selected_sub_num); } static BOOL CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -8074,8 +8095,13 @@ static BOOL CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara return TRUE; case WM_CLOSE: DestroyWindow(hDlg); - if (dialogreturn < 0) + if (dialogreturn < 0) { dialogreturn = 0; + if (allow_quit) { + quit_program = 1; + regs.spcflags |= SPCFLAG_BRK; + } + } return TRUE; case WM_INITDIALOG: guiDlg = hDlg; @@ -8397,7 +8423,7 @@ void gui_led (int led, int on) } else if (led == 7) { pos = 1; ptr = drive_text + pos * 16; - sprintf(ptr, "FPS: %.1f", (double)((gui_data.fps + 5) / 10.0)); + sprintf(ptr, "FPS: %.1f", (double)(gui_data.fps / 10.0)); } else if (led == 8) { pos = 0; ptr = drive_text + pos * 16; diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 64aeedad..f02f240b 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -124,7 +124,7 @@