From 5920c81cb96d3fc882bf37e4115a07b1d0d662b3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 30 Mar 2013 16:36:50 +0200 Subject: [PATCH] 2600b14 --- a2091.cpp | 1 + custom.cpp | 4 +- disk.cpp | 2 +- drawing.cpp | 153 +++++++++++++++++++++++++---------- filesys.cpp | 37 ++++++--- gencpu.cpp | 14 ++-- include/custom.h | 2 +- include/drawing.h | 3 + memory.cpp | 8 +- newcpu.cpp | 46 ++++++++--- od-win32/dinput.cpp | 2 +- od-win32/fsdb_mywin32.cpp | 87 +++++++++++--------- od-win32/fsdb_win32.cpp | 10 ++- od-win32/rp.cpp | 47 ++++++++--- od-win32/screenshot.cpp | 53 ++++++++++-- od-win32/win32.h | 4 +- od-win32/win32gfx.cpp | 14 +--- od-win32/win32gui.cpp | 12 ++- od-win32/winuaechangelog.txt | 13 +++ 19 files changed, 361 insertions(+), 151 deletions(-) diff --git a/a2091.cpp b/a2091.cpp index ec403804..d85681d6 100644 --- a/a2091.cpp +++ b/a2091.cpp @@ -1735,6 +1735,7 @@ int a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci) void a3000scsi_reset (void) { + init_scsi (); map_banks (&mbdmac_a3000_bank, 0xDD, 1, 0); wd_cmd_reset (false); } diff --git a/custom.cpp b/custom.cpp index 3994e70a..f80137fc 100644 --- a/custom.cpp +++ b/custom.cpp @@ -7074,7 +7074,7 @@ writeonly: if (!noput) { int r; uae_u16 old = last_custom_value1; - uae_u16 l = currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? regs.irc : 0xffff; + uae_u16 l = currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? regs.irc : ((currprefs.chipset_mask & CSMASK_AGA) ? old : 0xffff); decide_line (hpos); decide_fetch (hpos); decide_blitter (hpos); @@ -7092,7 +7092,7 @@ writeonly: } } } else { - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) + if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !(currprefs.chipset_mask & CSMASK_AGA)) v = 0xffff; else v = l; diff --git a/disk.cpp b/disk.cpp index 681ff676..ae9c4e43 100644 --- a/disk.cpp +++ b/disk.cpp @@ -739,7 +739,7 @@ int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, int leave_o return f ? 1 : 0; } else { if (zfile_exists (fname)) { - if (wrprot) + if (wrprot && !p->floppy_read_only) *wrprot = 0; if (crc32) { struct zfile *f = zfile_fopen (fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY); diff --git a/drawing.cpp b/drawing.cpp index 8f498aed..efd8805d 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -183,7 +183,9 @@ typedef void (*line_draw_func)(int, int, bool); #define LINE_DONE_AS_PREVIOUS 8 #define LINE_REMEMBERED_AS_PREVIOUS 9 -static uae_u8 linestate[(MAXVPOS + 2) * 2 + 1]; +#define LINESTATE_SIZE ((MAXVPOS + 2) * 2 + 1) + +static uae_u8 linestate[LINESTATE_SIZE], linestate2[LINESTATE_SIZE]; uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; @@ -274,6 +276,22 @@ static void xlinecheck (unsigned int start, unsigned int end) #define xlinecheck #endif +static void clearbuffer (struct vidbuffer *dst) +{ + if (!dst->bufmem_allocated) + return; + uae_u8 *p = dst->bufmem_allocated; + for (int y = 0; y < dst->height_allocated; y++) { + memset (p, 0, dst->width_allocated * dst->pixbytes); + p += dst->rowbytes; + } +} + +void reset_decision_table (void) +{ + for (int i = 0; i < sizeof linestate / sizeof *linestate; i++) + linestate[i] = LINE_UNDECIDED; +} STATIC_INLINE void count_frame (void) { @@ -681,7 +699,6 @@ static int pixels_offset; static int src_pixel, ham_src_pixel; /* How many pixels in window coordinates which are to the left of the left border. */ static int unpainted; -static int seen_sprites; STATIC_INLINE xcolnr getbgc (bool blank) { @@ -790,10 +807,8 @@ static void pfield_init_linetoscr (void) ddf_left <<= bplres; src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left); - seen_sprites = 0; if (dip_for_drawing->nr_sprites == 0) return; - seen_sprites = 1; /* Must clear parts of apixels. */ if (linetoscr_diw_start < native_ddf_left) { int size = res_shift_from_window (native_ddf_left - linetoscr_diw_start); @@ -1936,7 +1951,8 @@ static void do_flush_line_1 (struct vidbuffer *vb, int lineno) STATIC_INLINE void do_flush_line (struct vidbuffer *vb, int lineno) { - do_flush_line_1 (vb, lineno); + if (vb) + do_flush_line_1 (vb, lineno); } /* @@ -2552,7 +2568,6 @@ static void init_drawing_frame (void) thisframe_last_drawn_line = -1; drawing_color_matches = -1; - seen_sprites = -1; } void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq) @@ -2703,40 +2718,20 @@ static void lightpen_update (struct vidbuffer *vb) lightpen_active = 0; } -void finish_drawing_frame (void) +static void draw_frame2 (struct vidbuffer *vbin, struct vidbuffer *vbout) { - int i; - bool didflush = false; - struct vidbuffer *vb = &gfxvidinfo.drawbuffer; - - gfxvidinfo.outbuffer = vb; - - if (! lockscr (vb, false)) { - notice_screen_contents_lost (); - return; - } - -#ifndef SMART_UPDATE - /* @@@ This isn't exactly right yet. FIXME */ - if (!interlace_seen) - do_flush_screen (first_drawn_line, last_drawn_line); - else - unlockscr (); - return; -#endif - - for (i = 0; i < max_ypos_thisframe; i++) { + for (int i = 0; i < max_ypos_thisframe; i++) { int i1 = i + min_ypos_for_screen; int line = i + thisframe_y_adjust_real; int where2; where2 = amiga2aspect_line_map[i1]; - if (where2 >= vb->inheight) + if (where2 >= vbin->inheight) break; if (where2 < 0) continue; hposblank = 0; - pfield_draw_line (vb, line, where2, amiga2aspect_line_map[i1 + 1]); + pfield_draw_line (vbout, line, where2, amiga2aspect_line_map[i1 + 1]); } #if 0 /* clear possible old garbage at the bottom if emulated area become smaller */ @@ -2762,6 +2757,68 @@ void finish_drawing_frame (void) do_flush_line (vb, where2); } #endif +} + +bool draw_frame (struct vidbuffer *vb) +{ + uae_u8 oldstate[LINESTATE_SIZE]; + struct vidbuffer oldvb; + + memcpy (&oldvb, &gfxvidinfo.drawbuffer, sizeof (struct vidbuffer)); + memcpy (&gfxvidinfo.drawbuffer, vb, sizeof (struct vidbuffer)); + clearbuffer (vb); + init_row_map (); + memcpy (oldstate, linestate, LINESTATE_SIZE); + memcpy (linestate, linestate2, LINESTATE_SIZE); + for (int i = 0; i < LINESTATE_SIZE; i++) { + uae_u8 v = linestate[i]; + if (v == LINE_REMEMBERED_AS_PREVIOUS) + v = LINE_AS_PREVIOUS; + else if (v == LINE_DONE_AS_PREVIOUS) + v = LINE_AS_PREVIOUS; + else if (v == LINE_REMEMBERED_AS_BLACK) + v = LINE_BLACK; + else if (v == LINE_DONE) + v = LINE_DECIDED; + linestate[i] = v; + } + last_drawn_line = 0; + first_drawn_line = 32767; + drawing_color_matches = -1; + draw_frame2 (vb, NULL); + last_drawn_line = 0; + first_drawn_line = 32767; + drawing_color_matches = -1; + memcpy (linestate, oldstate, LINESTATE_SIZE); + memcpy (&gfxvidinfo.drawbuffer, &oldvb, sizeof (struct vidbuffer)); + init_row_map (); + return true; +} + +static void finish_drawing_frame (void) +{ + int i; + bool didflush = false; + struct vidbuffer *vb = &gfxvidinfo.drawbuffer; + + gfxvidinfo.outbuffer = vb; + + if (! lockscr (vb, false)) { + notice_screen_contents_lost (); + return; + } + +#ifndef SMART_UPDATE + /* @@@ This isn't exactly right yet. FIXME */ + if (!interlace_seen) + do_flush_screen (first_drawn_line, last_drawn_line); + else + unlockscr (); + return; +#endif + + draw_frame2 (vb, vb); + if (currprefs.leds_on_screen) { int slx, sly; statusline_getpos (&slx, &sly, vb->outwidth, vb->outheight); @@ -2939,12 +2996,13 @@ void vsync_handle_redraw (int long_frame, int lof_changed, uae_u16 bplcon0p, uae void hsync_record_line_state (int lineno, enum nln_how how, int changed) { - uae_u8 *state; + uae_u8 *state, *state2; if (framecnt != 0) return; state = linestate + lineno; + state2 = linestate2 + lineno; changed += frame_redraw_necessary + ((lineno >= lightpen_y1 && lineno <= lightpen_y2) ? 1 : 0); switch (how) { @@ -2974,6 +3032,7 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed) state[1] = LINE_DECIDED; //LINE_BLACK; break; } + *state2 = *state; } static void dummy_flush_line (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int line_no) @@ -3041,22 +3100,30 @@ bool notice_interlace_seen (bool lace) return changed; } -static void clearbuffer (struct vidbuffer *dst) +void allocvidbuffer (struct vidbuffer *buf, int width, int height, int depth) { - return; - if (!dst->bufmem_allocated) - return; - uae_u8 *p = dst->bufmem_allocated; - for (int y = 0; y < dst->height_allocated; y++) { - memset (p, 0, dst->width_allocated * dst->pixbytes); - p += dst->rowbytes; - } + memset (buf, 0, sizeof (struct vidbuffer)); + buf->pixbytes = (depth + 7) / 8; + buf->width_allocated = (width + 7) & ~7; + buf->height_allocated = height; + + buf->outwidth = buf->width_allocated; + buf->outheight = buf->height_allocated; + buf->inwidth = buf->width_allocated; + buf->inheight = buf->height_allocated; + + int size = width * height * buf->pixbytes; + buf->realbufmem = xcalloc (uae_u8, size); + buf->bufmem_allocated = buf->bufmem = buf->realbufmem; + buf->rowbytes = width * buf->pixbytes; + buf->bufmemend = buf->realbufmem + size - buf->rowbytes; + buf->bufmem_lockable = true; } -void reset_decision_table (void) +void freevidbuffer (struct vidbuffer *buf) { - for (int i = 0; i < sizeof linestate / sizeof *linestate; i++) - linestate[i] = LINE_UNDECIDED; + xfree (buf->realbufmem); + memset (buf, 0, sizeof (struct vidbuffer)); } void reset_drawing (void) diff --git a/filesys.cpp b/filesys.cpp index 15c06d61..123c5760 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -2239,6 +2239,21 @@ static int fill_file_attrs (Unit *u, a_inode *base, a_inode *c) return 0; } +static int test_softlink (a_inode *aino) +{ + int err; + if (aino->softlink && my_resolvesoftlink (aino->nname, -1)) + err = ERROR_IS_SOFT_LINK; + else + err = ERROR_OBJECT_NOT_AROUND; + return err; +} +static void handle_softlink (Unit *unit, dpacket packet, a_inode *aino) +{ + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, test_softlink (aino)); +} + /* * This gets called if an ACTION_EXAMINE_NEXT happens and we hit an object * for which we know the name on the native filesystem, but no corresponding @@ -2473,7 +2488,7 @@ static a_inode *get_aino (Unit *unit, a_inode *base, const TCHAR *rel, int *err) if (prev && prev->softlink) { - *err = ERROR_IS_SOFT_LINK; + *err = test_softlink (prev); curr = NULL; break; } @@ -3198,8 +3213,9 @@ static void DUMPLOCK(unit, lock); a = find_aino (unit, lock, bstr (unit, name), &err); - if (err == 0 && a->softlink) - err = ERROR_IS_SOFT_LINK; + if (err == 0 && a->softlink) { + err = test_softlink (a); + } if (err == 0 && (a->elock || (mode != SHARED_LOCK && a->shlock > 0))) { err = ERROR_OBJECT_IN_USE; } @@ -4389,8 +4405,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb return; } if (aino->softlink) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_IS_SOFT_LINK); + handle_softlink (unit, packet, aino); return; } if (err == 0) { @@ -4520,8 +4535,7 @@ static void if (aino == 0) aino = &unit->rootnode; if (aino->softlink) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_IS_SOFT_LINK); + handle_softlink (unit, packet, aino); return; } @@ -4869,8 +4883,7 @@ static void return; } if (a->softlink) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_IS_SOFT_LINK); + handle_softlink (unit, packet, a); return; } @@ -4932,8 +4945,7 @@ maybe_free_and_out: return; } if (a->softlink) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_IS_SOFT_LINK); + handle_softlink (unit, packet, a); goto maybe_free_and_out; } @@ -5349,8 +5361,7 @@ static void return; } if (a->softlink) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_IS_SOFT_LINK); + handle_softlink (unit, packet, a); return; } amiga_to_timeval (&tv, get_long (date), get_long (date + 4), get_long (date + 8)); diff --git a/gencpu.cpp b/gencpu.cpp index 7604adf7..a6b8f637 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -2965,10 +2965,8 @@ static void gen_opcode (unsigned long int opcode) incpc ("%d", m68k_pc_offset); printf ("\t\tException (5);\n"); printf ("\t\tgoto %s;\n", endlabelstr); - printf ("\t} else {\n"); - printf ("\t\tuae_s32 newv = (uae_s32)dst / (uae_s32)(uae_s16)src;\n"); - printf ("\t\tuae_u16 rem = (uae_s32)dst %% (uae_s32)(uae_s16)src;\n"); - printf ("\t\tCLEAR_CZNV ();\n"); + printf ("\t}\n"); + printf ("\tCLEAR_CZNV ();\n"); fill_prefetch_next (); if (using_ce) { start_brace (); @@ -2977,6 +2975,12 @@ static void gen_opcode (unsigned long int opcode) } else if (using_ce020) { addcycles_ce020 (46); } + printf ("\tif (dst == 0x80000000 && src == -1) {\n"); + printf ("\t\tSET_VFLG (1);\n"); + printf ("\t\tSET_NFLG (1);\n"); + printf ("\t} else {\n"); + printf ("\t\tuae_s32 newv = (uae_s32)dst / (uae_s32)(uae_s16)src;\n"); + printf ("\t\tuae_u16 rem = (uae_s32)dst %% (uae_s32)(uae_s16)src;\n"); printf ("\t\tif ((newv & 0xffff8000) != 0 && (newv & 0xffff8000) != 0xffff8000) {\n"); printf ("\t\t\tSET_VFLG (1);\n"); #ifdef UNDEF68020 @@ -2991,8 +2995,8 @@ static void gen_opcode (unsigned long int opcode) printf ("\t\t\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n"); printf ("\t\t"); genastore ("newv", curi->dmode, "dstreg", sz_long, "dst"); printf ("\t\t}\n"); - sync_m68k_pc (); printf ("\t}\n"); + sync_m68k_pc (); count_ncycles++; insn_n_cycles += 156 - (156 - 120) / 2; /* average */ need_endlabel = 1; diff --git a/include/custom.h b/include/custom.h index 2563371e..fe4d6cbb 100644 --- a/include/custom.h +++ b/include/custom.h @@ -51,7 +51,7 @@ extern unsigned long int hsync_counter, vsync_counter; extern uae_u16 dmacon; extern uae_u16 intena, intreq, intreqr; -extern int vpos; +extern int vpos, lof_store; extern int find_copper_record (uaecptr, int *, int *); diff --git a/include/drawing.h b/include/drawing.h index df3367c2..f71b7556 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -279,10 +279,13 @@ extern bool notice_interlace_seen (bool); extern void notice_resolution_seen (int, bool); extern void frame_drawn (void); extern void redraw_frame (void); +extern bool draw_frame (struct vidbuffer*); extern int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh); extern void set_custom_limits (int w, int h, int dx, int dy); extern void get_custom_topedge (int *x, int *y, bool max); extern void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq); +extern void allocvidbuffer (struct vidbuffer *buf, int width, int height, int depth); +extern void freevidbuffer (struct vidbuffer *buf); /* Finally, stuff that shouldn't really be shared. */ diff --git a/memory.cpp b/memory.cpp index 261f432f..b9a8e7f4 100644 --- a/memory.cpp +++ b/memory.cpp @@ -1514,10 +1514,10 @@ addrbank custmem1_bank = { custmem1_lget, custmem1_wget, ABFLAG_RAM }; addrbank custmem2_bank = { - custmem1_lget, custmem1_wget, custmem1_bget, - custmem1_lput, custmem1_wput, custmem1_bput, - custmem1_xlate, custmem1_check, NULL, _T("Non-autoconfig RAM #2"), - custmem1_lget, custmem1_wget, ABFLAG_RAM + custmem2_lget, custmem2_wget, custmem2_bget, + custmem2_lput, custmem2_wput, custmem2_bput, + custmem2_xlate, custmem2_check, NULL, _T("Non-autoconfig RAM #2"), + custmem2_lget, custmem2_wget, ABFLAG_RAM }; #define fkickmem_size 524288 diff --git a/newcpu.cpp b/newcpu.cpp index 713c3d9e..4549bdf1 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -3049,22 +3049,29 @@ void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra) a &= 0xffffffffu; a |= (uae_s64)m68k_dreg (regs, extra & 7) << 32; } - rem = a % (uae_s64)(uae_s32)src; - quot = a / (uae_s64)(uae_s32)src; - if ((quot & UVAL64 (0xffffffff80000000)) != 0 - && (quot & UVAL64 (0xffffffff80000000)) != UVAL64 (0xffffffff80000000)) - { + + if (a == 0x8000000000000000 && src == -1) { SET_VFLG (1); SET_NFLG (1); SET_CFLG (0); } else { - if (((uae_s32)rem < 0) != ((uae_s64)a < 0)) rem = -rem; - SET_VFLG (0); - SET_CFLG (0); - SET_ZFLG (((uae_s32)quot) == 0); - SET_NFLG (((uae_s32)quot) < 0); - m68k_dreg (regs, extra & 7) = (uae_u32)rem; - m68k_dreg (regs, (extra >> 12) & 7) = (uae_u32)quot; + rem = a % (uae_s64)(uae_s32)src; + quot = a / (uae_s64)(uae_s32)src; + if ((quot & UVAL64 (0xffffffff80000000)) != 0 + && (quot & UVAL64 (0xffffffff80000000)) != UVAL64 (0xffffffff80000000)) + { + SET_VFLG (1); + SET_NFLG (1); + SET_CFLG (0); + } else { + if (((uae_s32)rem < 0) != ((uae_s64)a < 0)) rem = -rem; + SET_VFLG (0); + SET_CFLG (0); + SET_ZFLG (((uae_s32)quot) == 0); + SET_NFLG (((uae_s32)quot) < 0); + m68k_dreg (regs, extra & 7) = (uae_u32)rem; + m68k_dreg (regs, (extra >> 12) & 7) = (uae_u32)quot; + } } } else { /* unsigned */ @@ -3956,6 +3963,16 @@ static void out_cd32io (uae_u32 pc) if (ioreq) { static int cnt = 0; int cmd = get_word (request + 28); +#if 0 + if (cmd == 33) { + uaecptr data = get_long (request + 40); + write_log (_T("CD_CONFIG:\n")); + for (int i = 0; i < 16; i++) { + write_log (_T("%08X=%08X\n"), get_long (data), get_long (data + 4)); + data += 8; + } + } +#endif #if 0 if (cmd == 37) { cnt--; @@ -4573,6 +4590,11 @@ static void m68k_run_2ce (void) r->instruction_pc = m68k_getpc (); opcode = get_word_ce020_prefetch (0); + +#if DEBUG_CD32CDTVIO + out_cd32io (r->instruction_pc); +#endif + if (cpu_tracer) { #if CPUTRACE_DEBUG diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 4e2190ec..58e76459 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -2080,7 +2080,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) data = logicalrange; else data = 0; - //write_log (_T("%d %d: (%d-%d) %d\n"), num, axisnum, did->axismin[axisnum], did->axismax[axisnum], data); + //write_log (_T("%d %d: (%d-%d) %d %d\n"), num, axisnum, vcaps->LogicalMin, vcaps->LogicalMax, v, data); } buttonaxistype = -1; } diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index 3946b32e..23339707 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -805,18 +805,6 @@ int my_issamevolume(const TCHAR *path1, const TCHAR *path2, TCHAR *path) return cnt; } -bool my_resolvesoftlink(TCHAR *linkfile, int size) -{ - TCHAR tmp[MAX_DPATH]; - if (my_resolvessymboliclink(linkfile, size)) - return true; - if (my_resolveshortcut(linkfile,size)) - return true; - _tcscpy (tmp, linkfile); - my_canonicalize_path (tmp, linkfile, size); - return false; -} - typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -843,51 +831,57 @@ typedef struct _REPARSE_DATA_BUFFER { }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; -bool my_resolvessymboliclink(TCHAR *linkfile, int size) +static int my_resolvessymboliclink2(TCHAR *linkfile, int size) { WIN32_FIND_DATA fd; HANDLE h; - bool ret = false; + int ret = -1; DWORD returnedDataSize; uae_u8 tmp[MAX_DPATH * 2]; TCHAR tmp2[MAX_DPATH]; h = FindFirstFile (linkfile, &fd); if (h == INVALID_HANDLE_VALUE) - return false; + return -1; FindClose(h); if (fd.dwReserved0 != IO_REPARSE_TAG_SYMLINK || !(fd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) - return false; + return -1; h = CreateFile (linkfile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_REPARSE_POINT | FILE_FLAG_OPEN_REPARSE_POINT , NULL); if (h == INVALID_HANDLE_VALUE) - return false; + return 0; if (DeviceIoControl(h, FSCTL_GET_REPARSE_POINT, NULL, 0, tmp, sizeof tmp, &returnedDataSize, NULL)) { REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)tmp; - if (rdb->SymbolicLinkReparseBuffer.Flags & 1) { // SYMLINK_FLAG_RELATIVE - _tcscpy (tmp2, linkfile); - PathRemoveFileSpec (tmp2); - _tcscat (tmp2, _T("\\")); - TCHAR *p = tmp2 + _tcslen (tmp2); - memcpy (p, - (uae_u8*)rdb->SymbolicLinkReparseBuffer.PathBuffer + rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset, - rdb->SymbolicLinkReparseBuffer.SubstituteNameLength); - p[rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / 2] = 0; - } else { - memcpy (tmp2, - (uae_u8*)rdb->SymbolicLinkReparseBuffer.PathBuffer + rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset, - rdb->SymbolicLinkReparseBuffer.SubstituteNameLength); - tmp2[rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / 2] = 0; - } - ret = true; - if (!_tcsnicmp (tmp2, _T("\\??\\"), 4)) { - memmove (tmp2, tmp2 + 4, (_tcslen (tmp2 + 4) + 1) * sizeof (TCHAR)); + if (size > 0) { + if (rdb->SymbolicLinkReparseBuffer.Flags & 1) { // SYMLINK_FLAG_RELATIVE + _tcscpy (tmp2, linkfile); + PathRemoveFileSpec (tmp2); + _tcscat (tmp2, _T("\\")); + TCHAR *p = tmp2 + _tcslen (tmp2); + memcpy (p, + (uae_u8*)rdb->SymbolicLinkReparseBuffer.PathBuffer + rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset, + rdb->SymbolicLinkReparseBuffer.SubstituteNameLength); + p[rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / 2] = 0; + } else { + memcpy (tmp2, + (uae_u8*)rdb->SymbolicLinkReparseBuffer.PathBuffer + rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset, + rdb->SymbolicLinkReparseBuffer.SubstituteNameLength); + tmp2[rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / 2] = 0; + } + if (!_tcsnicmp (tmp2, _T("\\??\\"), 4)) { + memmove (tmp2, tmp2 + 4, (_tcslen (tmp2 + 4) + 1) * sizeof (TCHAR)); + } + my_canonicalize_path (tmp2, linkfile, size); } - my_canonicalize_path (tmp2, linkfile, size); + ret = 1; } CloseHandle(h); return ret; } +bool my_resolvessymboliclink(TCHAR *linkfile, int size) +{ + return my_resolvessymboliclink2(linkfile, size) > 0; +} // http://msdn.microsoft.com/en-us/library/aa969393.aspx bool my_resolveshortcut(TCHAR *linkfile, int size) @@ -938,7 +932,8 @@ bool my_resolveshortcut(TCHAR *linkfile, int size) if (SUCCEEDED(hres)) { - my_canonicalize_path (szGotPath, linkfile, size); + if (size > 0) + my_canonicalize_path (szGotPath, linkfile, size); ok = SUCCEEDED(hres); } } @@ -991,3 +986,21 @@ bool my_createshortcut(const TCHAR *source, const TCHAR *target, const TCHAR *de } return SUCCEEDED(hres); } + + +bool my_resolvesoftlink(TCHAR *linkfile, int size) +{ + TCHAR tmp[MAX_DPATH]; + int v = my_resolvessymboliclink2(linkfile, size); + if (v > 0) + return true; + if (v == 0) + return false; + if (my_resolveshortcut(linkfile,size)) + return true; + if (size > 0) { + _tcscpy (tmp, linkfile); + my_canonicalize_path (tmp, linkfile, size); + } + return false; +} \ No newline at end of file diff --git a/od-win32/fsdb_win32.cpp b/od-win32/fsdb_win32.cpp index b6857e45..c0b1b52b 100644 --- a/od-win32/fsdb_win32.cpp +++ b/od-win32/fsdb_win32.cpp @@ -393,18 +393,22 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino) HANDLE h = FindFirstFile (aino->nname, &fd); if (h != INVALID_HANDLE_VALUE) { FindClose(h); - if (fd.dwReserved0 == IO_REPARSE_TAG_SYMLINK && (fd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { - aino->softlink = 1; + if (fd.dwReserved0 == IO_REPARSE_TAG_SYMLINK && (fd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && !(fd.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)) { + if (my_resolvessymboliclink(aino->nname, -1)) { + //write_log (_T("1 '%s'\n"), aino->nname); + aino->softlink = 1; + } } } } - if (!aino->softlink && !aino->dir) { + if (!aino->softlink && !aino->dir && !(mode & FILE_ATTRIBUTE_SYSTEM)) { const TCHAR *ext = _tcsrchr (aino->nname, '.'); if (ext && !_tcsicmp (ext, _T(".lnk"))) { TCHAR tmp[MAX_DPATH]; _tcscpy (tmp, aino->nname); if (my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR))) { + //write_log (_T("2 '%s'\n"), aino->nname); aino->softlink = 2; } } diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 8300f10d..c035b646 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1003,6 +1003,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM { struct RPScreenMode *sm = (struct RPScreenMode*)pData; set_screenmode (sm, &changed_prefs); + rp_set_hwnd_delayed (); return (LRESULT)INVALID_HANDLE_VALUE; } case RP_IPC_TO_GUEST_EVENT: @@ -1021,7 +1022,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } case RP_IPC_TO_GUEST_SCREENCAPTURE: { - extern int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode); + extern int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, struct vidbuffer *vb); extern int screenshotmode; struct RPScreenCapture *rpsc = (struct RPScreenCapture*)pData; if (rpsc->szScreenFiltered[0] || rpsc->szScreenRaw[0]) { @@ -1031,10 +1032,26 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM screenshotmode = 0; write_log (_T("'%s' '%s'\n"), rpsc->szScreenFiltered, rpsc->szScreenRaw); if (rpsc->szScreenFiltered[0]) - ok = screenshotf (rpsc->szScreenFiltered, 1, 1, 0); - if (rpsc->szScreenRaw[0]) - ok |= screenshotf (rpsc->szScreenRaw, 1, 1, 1); + ok = screenshotf (rpsc->szScreenFiltered, 1, 1, 0, NULL); + if (rpsc->szScreenRaw[0]) { + struct vidbuffer vb; + int w = gfxvidinfo.drawbuffer.inwidth; + int h = gfxvidinfo.drawbuffer.inheight; + if (!programmedmode) { + h = (maxvpos + lof_store - minfirstline) << currprefs.gfx_vresolution; + } + if (interlace_seen && currprefs.gfx_vresolution > 0) { + h -= 1 << (currprefs.gfx_vresolution - 1); + } + allocvidbuffer (&vb, w, h, gfxvidinfo.drawbuffer.pixbytes * 8); + set_custom_limits (-1, -1, -1, -1); + draw_frame (&vb); + ok |= screenshotf (rpsc->szScreenRaw, 1, 1, 1, &vb); + //ok |= screenshotf (_T("c:\\temp\\1.bmp"), 1, 1, 1, &vb); + freevidbuffer (&vb); + } screenshotmode = ossm; + write_log (_T("->%d\n"), ok); if (!ok) return RP_SCREENCAPTURE_ERROR; if (WIN32GFX_IsPicassoScreen ()) { @@ -1042,7 +1059,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } else { ret |= currprefs.gfx_resolution == RES_LORES ? RP_GUESTSCREENFLAGS_HORIZONTAL_LORES : ((currprefs.gfx_resolution == RES_SUPERHIRES) ? RP_GUESTSCREENFLAGS_HORIZONTAL_SUPERHIRES : 0); ret |= currprefs.ntscmode ? RP_GUESTSCREENFLAGS_MODE_NTSC : RP_GUESTSCREENFLAGS_MODE_PAL; - ret |= interlace_seen ? RP_GUESTSCREENFLAGS_VERTICAL_INTERLACED : 0; + ret |= currprefs.gfx_vresolution ? RP_GUESTSCREENFLAGS_VERTICAL_INTERLACED : 0; } return ret; } @@ -1095,6 +1112,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM case RP_IPC_TO_GUEST_QUERYSCREENMODE: { screenmode_request = 1; + write_log (_T("RP_IPC_TO_GUEST_QUERYSCREENMODE -> RP_IPC_TO_HOST_SCREENMODE screenmode_request started\n")); return 1; } case RP_IPC_TO_GUEST_GUESTAPIVERSION: @@ -1624,7 +1642,8 @@ void rp_activate (int active, LPARAM lParam) { if (!cando ()) return; - RPSendMessagex (active ? RP_IPC_TO_HOST_ACTIVATED : RP_IPC_TO_HOST_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); + //RPSendMessagex (active ? RP_IPC_TO_HOST_ACTIVATED : RP_IPC_TO_HOST_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); + RPPostMessagex (active ? RP_IPC_TO_HOST_ACTIVATED : RP_IPC_TO_HOST_DEACTIVATED, 0, lParam, &guestinfo); } void rp_turbo_cpu (int active) @@ -1648,6 +1667,7 @@ void rp_turbo_floppy (int active) void rp_set_hwnd_delayed (void) { hwndset_delay = 4; + write_log (_T("RP_IPC_TO_HOST_SCREENMODE delay started\n")); } void rp_set_hwnd (HWND hWnd) @@ -1656,7 +1676,11 @@ void rp_set_hwnd (HWND hWnd) if (!initialized) return; - hwndset_delay = 0; + if (hwndset_delay) { + write_log (_T("RP_IPC_TO_HOST_SCREENMODE, delay=%d\n"), hwndset_delay); + return; + } + write_log (_T("RP_IPC_TO_HOST_SCREENMODE\n")); guestwindow = hWnd; get_screenmode (&sm, &currprefs); if (hWnd != NULL) @@ -1666,15 +1690,19 @@ void rp_set_hwnd (HWND hWnd) void rp_screenmode_changed (void) { - if (!screenmode_request) + write_log (_T("rp_screenmode_changed\n")); + if (!screenmode_request) { screenmode_request = 2; + write_log (_T("rp_screenmode_changed -> screenmode_request started\n")); + } } void rp_set_enabledisable (int enabled) { if (!cando ()) return; - RPSendMessagex (enabled ? RP_IPC_TO_HOST_ENABLED : RP_IPC_TO_HOST_DISABLED, 0, 0, NULL, 0, &guestinfo, NULL); + //RPSendMessagex (enabled ? RP_IPC_TO_HOST_ENABLED : RP_IPC_TO_HOST_DISABLED, 0, 0, NULL, 0, &guestinfo, NULL); + RPPostMessagex (enabled ? RP_IPC_TO_HOST_ENABLED : RP_IPC_TO_HOST_DISABLED, 0, 0, &guestinfo); } void rp_rtg_switch (void) @@ -1718,6 +1746,7 @@ void rp_vsync (void) if (screenmode_request == 0) { struct RPScreenMode sm = { 0 }; get_screenmode (&sm, &currprefs); + write_log (_T("RP_IPC_TO_HOST_SCREENMODE screenmode_request timeout\n")); RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); } } diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index c7180282..5b769ac1 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -17,6 +17,7 @@ #include "opengl.h" #include "registry.h" #include "gfxfilter.h" +#include "xwin.h" #include "png.h" @@ -92,7 +93,7 @@ void screenshot_free (void) static int rgb_rb, rgb_gb, rgb_bb, rgb_rs, rgb_gs, rgb_bs; -int screenshot_prepare (int imagemode) +static int screenshot_prepare (int imagemode, struct vidbuffer *vb) { int width, height; HGDIOBJ hgdiobj; @@ -120,6 +121,18 @@ int screenshot_prepare (int imagemode) rgb_bs2 = 0; rgb_gs2 = 8; rgb_rs2 = 16; + } else if (vb) { + width = vb->outwidth; + height = vb->outheight; + spitch = vb->rowbytes; + bits = vb->pixbytes * 8; + src = mem = vb->bufmem; + rgb_bb2 = rgb_bb; + rgb_gb2 = rgb_gb; + rgb_rb2 = rgb_rb; + rgb_bs2 = rgb_bs; + rgb_gs2 = rgb_gs; + rgb_rs2 = rgb_rs; } else { src = mem = getfilterbuffer (&width, &height, &spitch, &bits); rgb_bb2 = rgb_bb; @@ -198,7 +211,7 @@ int screenshot_prepare (int imagemode) dst -= dpitch; } } - if (WIN32GFX_IsPicassoScreen ()) + if (WIN32GFX_IsPicassoScreen () && !vb) freertgbuffer (mem); } else { @@ -260,6 +273,14 @@ oops: return 0; } +int screenshot_prepare (struct vidbuffer *vb) +{ + return screenshot_prepare (1, vb); +} +int screenshot_prepare (int imagemode) +{ + return screenshot_prepare (imagemode, NULL); +} int screenshot_prepare (void) { return screenshot_prepare (-1); @@ -365,7 +386,7 @@ static int savebmp (FILE *fp) /* Captures the Amiga display (DirectDraw, D3D or OpenGL) surface and saves it to file as a 24bit bitmap. */ -int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode) +int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, struct vidbuffer *vb) { static int recursive; FILE *fp = NULL; @@ -379,7 +400,10 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode) recursive++; - if (!screenshot_prepared || doprepare) { + if (vb) { + if (!screenshot_prepare (vb)) + goto oops; + } else if (!screenshot_prepared || doprepare) { if (!screenshot_prepare (imagemode)) goto oops; } @@ -457,7 +481,26 @@ oops: return allok; } +#include "drawing.h" + void screenshot (int mode, int doprepare) { - screenshotf (NULL, mode, doprepare, -1); +#if 1 + screenshotf (NULL, mode, doprepare, -1, NULL); +#else + struct vidbuffer vb; + int w = gfxvidinfo.drawbuffer.inwidth; + int h = gfxvidinfo.drawbuffer.inheight; + if (!programmedmode) { + h = (maxvpos + lof_store - minfirstline) << currprefs.gfx_vresolution; + } + if (interlace_seen && currprefs.gfx_vresolution > 0) + h -= 1 << (currprefs.gfx_vresolution - 1); + allocvidbuffer (&vb, w, h, gfxvidinfo.drawbuffer.pixbytes * 8); + set_custom_limits (-1, -1, -1, -1); + draw_frame (&vb); + screenshotmode = 0; + screenshotf (_T("c:\\temp\\1.bmp"), 1, 1, 1, &vb); + freevidbuffer (&vb); +#endif } diff --git a/od-win32/win32.h b/od-win32/win32.h index b20fba39..4763cdbe 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,11 +19,11 @@ #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("13") +#define WINUAEBETA _T("14") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2013, 3, 23) +#define WINUAEDATE MAKEBD(2013, 3, 30) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index bdf993b1..c18e8978 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -2553,12 +2553,6 @@ static void setDwmEnableMMCSS (bool state) pDwmEnableMMCSS (state); } -static void freesoftbuffer (struct vidbuffer *buf) -{ - xfree (buf->realbufmem); - memset (buf, 0, sizeof (struct vidbuffer)); -} - void close_windows (void) { changevblankthreadmode (VBLANKTH_IDLE); @@ -2568,8 +2562,8 @@ void close_windows (void) #if defined (GFXFILTER) S2X_free (); #endif - freesoftbuffer (&gfxvidinfo.drawbuffer); - freesoftbuffer (&gfxvidinfo.tempbuffer); + freevidbuffer (&gfxvidinfo.drawbuffer); + freevidbuffer (&gfxvidinfo.tempbuffer); DirectDraw_Release (); close_hwnds (); } @@ -4101,8 +4095,8 @@ static BOOL doInit (void) #endif gfxvidinfo.drawbuffer.emergmem = scrlinebuf; // memcpy from system-memory to video-memory - freesoftbuffer (&gfxvidinfo.drawbuffer); - freesoftbuffer (&gfxvidinfo.tempbuffer); + freevidbuffer (&gfxvidinfo.drawbuffer); + freevidbuffer (&gfxvidinfo.tempbuffer); gfxvidinfo.drawbuffer.realbufmem = NULL; gfxvidinfo.drawbuffer.bufmem = NULL; gfxvidinfo.drawbuffer.bufmem_allocated = NULL; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index d7b3bee7..93a8a733 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -3223,11 +3223,16 @@ static TCHAR *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *con { case CONFIG_SAVE_FULL: ok = DiskSelection(hDlg, IDC_SAVE, 5, &workprefs, newpath); + GetDlgItemText (hDlg, IDC_EDITNAME, name, MAX_DPATH); + _tcscpy (config_filename, name); break; case CONFIG_LOAD_FULL: - if ((ok = DiskSelection(hDlg, IDC_LOAD, 4, &workprefs, newpath))) + if ((ok = DiskSelection(hDlg, IDC_LOAD, 4, &workprefs, newpath))) { EnableWindow(GetDlgItem (hDlg, IDC_VIEWINFO), workprefs.info[0]); + GetDlgItemText (hDlg, IDC_EDITNAME, name, MAX_DPATH); + _tcscpy (config_filename, name); + } break; case CONFIG_SAVE: @@ -3642,6 +3647,7 @@ static struct miscentry misclist[] = { { 0, 0, _T("Start minimized"), &workprefs.win32_start_minimized }, { 0, 1, _T("Minimize when focus is lost"), &workprefs.win32_minimize_inactive }, { 0, 1, _T("100/120Hz VSync black frame insertion"), &workprefs.lightboost_strobo }, + { 0, 0, _T("Master floppy write protection"), &workprefs.floppy_read_only }, { 0, NULL } }; @@ -10169,7 +10175,7 @@ static int harddiskdlg_button (HWND hDlg, WPARAM wParam) return 1; case IDC_NEW_HD: - memset (¤t_hfdlg, 0, sizeof (current_hfdlg)); + default_hfdlg (¤t_hfdlg, true); current_hfdlg.ci.type = UAEDEV_HDF; if (hdf_init_target () == 0) { TCHAR tmp[MAX_DPATH]; @@ -10640,7 +10646,7 @@ static void addfloppytype (HWND hDlg, int n) CheckDlgButton (hDlg, f_wp, chk); chk = !showcd && state && DISK_validate_filename (&workprefs, text, 0, NULL, NULL, NULL) ? TRUE : FALSE; if (f_wp >= 0) { - ew (hDlg, f_wp, chk); + ew (hDlg, f_wp, chk && !workprefs.floppy_read_only); if (f_wptext >= 0) ew (hDlg, f_wptext, chk); } diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index a573e027..239f3631 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,19 @@ - restore only single input target to default. +Beta 14: + +- A3000 SCSI emulation crashed if no SCSI drives configured. +- Added previously config-file only master floppy write protection option to GUI misc panel. +- If Windows softlink or .lnk can't be opened (access denied) or has system attribute flag, handle it as a normal + file/directory, just like in older versions. +- DIVS/DIVL integer overflow crash fix (INT_MIN/-1 = an integer that does not exist, causes cpu overflow exception) +- GUI Add Hardfile added IDE or SCSI was mounted as a CDROM. (Worked if config was saved and then loaded again) +- Adjusted read-write-only-custom-register-side-effect in AGA mode. (Artificial Paradise / NGC missing loading screen, does + stupid bset #9,$dff104 which, depending on previous accesses, either writes $0200 or "random bits" OR $0200) +- Manually added custom addmem2 memory region config entry used addmem1's memory region.. +- "Load From"/"Save From" buttons didn't change config name in window title. + Beta 13: - Ignore vendor specific USB usage pages also in received USB HID packets, fixes for example Logitech Precision gamepad ghost button events. -- 2.47.3