From: Toni Wilen Date: Sat, 10 Nov 2012 19:27:38 +0000 (+0200) Subject: 2500b25 X-Git-Tag: 2500~6 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=822dad0fa081f2e49e07cfc81838776547eb13f1;p=francis%2Fwinuae.git 2500b25 --- diff --git a/ar.cpp b/ar.cpp index a25e3313..d15c5f2f 100644 --- a/ar.cpp +++ b/ar.cpp @@ -911,7 +911,7 @@ static void hide_cart (int hide) { #ifdef ACTION_REPLAY_HIDE_CARTRIDGE if(hide) { - ;//action_replay_unmap_banks (); + action_replay_unmap_banks (); } else { action_replay_map_banks (); } @@ -927,7 +927,7 @@ static void hide_cart (int hide) static void action_replay_go (void) { - write_log (_T("AR GO %d\n"), armode); + //write_log (_T("AR GO %d\n"), armode); cartridge_enter(); hide_cart (0); memcpy (armemory_ram + 0xf000, ar_custom, 2 * 256); @@ -1080,7 +1080,7 @@ void check_prefs_changed_carts (int in_memory_reset) } } -void action_replay_reset (bool hardreset) +void action_replay_reset (bool hardreset, bool keyboardreset) { if (hrtmemory) { if (isrestore ()) { @@ -1111,7 +1111,7 @@ void action_replay_reset (bool hardreset) write_log_debug (_T("Setting flag to ACTION_REPLAY_WAITRESET (%d)\n"), hardreset); write_log_debug (_T("armode == %d\n"), armode); action_replay_flag = ACTION_REPLAY_WAITRESET; - if (hardreset) + if (hardreset || keyboardreset || armodel == 2) action_replay_hardreset = true; hide_cart (0); } @@ -1156,7 +1156,7 @@ int action_replay_freeze (void) static void action_replay_chipwrite (void) { - write_log (_T("AR CW\n")); + //write_log (_T("AR CW\n")); if (armodel == 2 || armodel == 3) { action_replay_flag = ACTION_REPLAY_DORESET; set_special (SPCFLAG_ACTION_REPLAY); diff --git a/cfgfile.cpp b/cfgfile.cpp index 7331922c..0d3e2a23 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2186,7 +2186,7 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, int cyls, int secspertrack, int surfaces, int reserved, int blocksize, int bootpri, const TCHAR *filesysdir, int hdc, int flag, - int pcyls, int psecs, int pheads) + int pcyls, int pheads, int psecs) { struct uaedev_config_info *uci; int i; @@ -2223,6 +2223,8 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, uci->bootpri = bootpri; uci->donotmount = 0; uci->autoboot = 0; + if (!pcyls || !pheads || !psecs) + pcyls = pheads = psecs = 0; uci->pcyls = pcyls; uci->pheads = pheads; uci->psecs = psecs; diff --git a/custom.cpp b/custom.cpp index e047aefb..e59d8e38 100644 --- a/custom.cpp +++ b/custom.cpp @@ -4977,6 +4977,13 @@ static void compute_spcflag_copper (int hpos) hpos = maxhpos_short & ~1; cop_state.hpos = hpos; } + + // if COPJMPx was written while DMA was disabled, advance to next state, + // COP_strobe_extra is single cycle only and does not need free bus. + // (copper state emulation does not run if DMA is disabled) + if (!wasenabled && cop_state.state == COP_strobe_extra) + cop_state.state = COP_strobe_delay1; + copper_enabled_thisline = 1; set_special (SPCFLAG_COPPER); } @@ -6580,7 +6587,7 @@ void custom_prepare (void) hsync_handler_post (true); } -void custom_reset (int hardreset) +void custom_reset (bool hardreset, bool keyboardreset) { int i; int zero = 0; @@ -6764,7 +6771,7 @@ void custom_reset (int hardreset) #ifdef ACTION_REPLAY /* Doing this here ensures we can use the 'reset' command from within AR */ - action_replay_reset (hardreset != 0); + action_replay_reset (hardreset, keyboardreset); #endif #if defined(ENFORCER) enforcer_disable (); diff --git a/drawing.cpp b/drawing.cpp index 19aae919..d383f459 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -415,9 +415,17 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh) ret = -1; if (interlace_seen) { + static int interlace_count; // interlace = only use long frames + if (lof_store && (interlace_count & 1) == 0) + interlace_count++; + if (!lof_store && (interlace_count & 1) != 0) + interlace_count++; + if (interlace_count < 3) + return ret; if (!lof_store) return ret; + interlace_count = 0; /* program may have set last visible line as last possible line (CD32 boot screen) */ if (last_planes_vpos < maxvpos) last_planes_vpos++; diff --git a/hardfile.cpp b/hardfile.cpp index 32800cfe..3415d052 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -134,7 +134,7 @@ static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, *head = heads; } -static void getchs (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) +static void getchsx (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) { getchs2 (hfd, cyl, cylsec, head, tracksec); hf_log (_T("CHS: %08X-%08X %d %d %d %d %d\n"), @@ -228,20 +228,32 @@ void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int getchsgeometry2 (size, pcyl, phead, psectorspertrack, 2); } -static void getchshd (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack) +void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry) { - uae_u64 total = hfd->virtsize / 512; + uae_u64 blocks = total / 512; - if (total > 16515072) { + if (blocks > 16515072) { /* >8G, CHS=16383/16/63 */ *pcyl = 16383; *phead = 16; *psectorspertrack = 63; return; } - getchsgeometry (hfd->virtsize, pcyl, phead, psectorspertrack); + if (idegeometry) { + *phead = 16; + *psectorspertrack = 63; + *pcyl = blocks / ((*psectorspertrack) * (*phead)); + return; + } + getchsgeometry (total, pcyl, phead, psectorspertrack); } +static void getchshd (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack) +{ + getchspgeometry (hfd->virtsize, pcyl, phead, psectorspertrack, false); +} + + static void pl (uae_u8 *p, int off, uae_u32 v) { p += off * 4; @@ -1170,7 +1182,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u tracksec = hdhfd->secspertrack; cylsec = 0; } else { - getchs (hfd, &cyl, &cylsec, &head, &tracksec); + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); } //write_log (_T("MODE SENSE PC=%d CODE=%d DBD=%d\n"), pc, pcode, dbd); p = r; @@ -1236,7 +1248,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u tracksec = hdhfd->secspertrack; cylsec = 0; } else { - getchs (hfd, &cyl, &cylsec, &head, &tracksec); + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); } if (pmi == 0 && lba != 0) goto errreq; @@ -1770,7 +1782,7 @@ no_disk: case CMD_GETNUMTRACKS: { int cyl, cylsec, head, tracksec; - getchs (hfd, &cyl, &cylsec, &head, &tracksec); + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); actual = cyl * head; break; } @@ -1779,7 +1791,7 @@ no_disk: { int cyl, cylsec, head, tracksec; uae_u64 size; - getchs (hfd, &cyl, &cylsec, &head, &tracksec); + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); put_long (dataptr + 0, hfd->blocksize); size = hfd->virtsize / hfd->blocksize; if (size > 0x00ffffffff) diff --git a/include/ar.h b/include/ar.h index b6c2ef2e..0a272e52 100644 --- a/include/ar.h +++ b/include/ar.h @@ -36,7 +36,7 @@ extern int is_ar_pc_in_ram(void); extern void action_replay_enter (void); extern void action_replay_ciaread (void); extern void action_replay_hide (void); -extern void action_replay_reset (bool hardreset); +extern void action_replay_reset (bool hardreset, bool keyboardreset); extern int action_replay_load (void); extern int action_replay_unload (int in_memory_reset); diff --git a/include/custom.h b/include/custom.h index 9c1b5203..83a7d2aa 100644 --- a/include/custom.h +++ b/include/custom.h @@ -22,7 +22,7 @@ uae_u32 get_copper_address (int copno); extern int custom_init (void); extern void custom_prepare (void); -extern void custom_reset (int hardreset); +extern void custom_reset (bool hardreset, bool keyboardreset); extern int intlev (void); extern void dumpcustom (void); diff --git a/include/filesys.h b/include/filesys.h index 27c4c9fe..d73ceddc 100644 --- a/include/filesys.h +++ b/include/filesys.h @@ -143,3 +143,5 @@ extern int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 off extern int hdf_resize_target (struct hardfiledata *hfd, uae_u64 newsize); extern void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); extern void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); +extern void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry); + diff --git a/include/uae.h b/include/uae.h index f890e8a0..2180d22e 100644 --- a/include/uae.h +++ b/include/uae.h @@ -18,9 +18,14 @@ extern void sleep_millis_main (int ms); extern void sleep_millis_busy (int ms); extern int sleep_resolution; +#define UAE_QUIT 1 +#define UAE_RESET 2 +#define UAE_RESET_KEYBOARD 3 +#define UAE_RESET_HARD 4 + extern void uae_reset (int, int); extern void uae_quit (void); -extern void uae_restart (int, TCHAR*); +extern void uae_restart (int, const TCHAR*); extern void reset_all_systems (void); extern void target_reset (void); extern void target_addtorecent (const TCHAR*, int); diff --git a/main.cpp b/main.cpp index 518862a5..66b564ed 100644 --- a/main.cpp +++ b/main.cpp @@ -522,9 +522,11 @@ void uae_reset (int hardreset, int keyboardreset) currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0; if (quit_program == 0) { - quit_program = -2; + quit_program = -UAE_RESET; + if (keyboardreset) + quit_program = -UAE_RESET_KEYBOARD; if (hardreset) - quit_program = -3; + quit_program = -UAE_RESET_HARD; } } @@ -532,13 +534,13 @@ void uae_reset (int hardreset, int keyboardreset) void uae_quit (void) { deactivate_debugger (); - if (quit_program != -1) - quit_program = -1; + if (quit_program != -UAE_QUIT) + quit_program = -UAE_QUIT; target_quit (); } /* 0 = normal, 1 = nogui, -1 = disable nogui */ -void uae_restart (int opengui, TCHAR *cfgfile) +void uae_restart (int opengui, const TCHAR *cfgfile) { uae_quit (); restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3); @@ -795,7 +797,7 @@ extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except) void do_start_program (void) { - if (quit_program == -1) + if (quit_program == -UAE_QUIT) return; if (!canbang && candirect < 0) candirect = 0; @@ -804,7 +806,7 @@ void do_start_program (void) /* Do a reset on startup. Whether this is elegant is debatable. */ inputdevice_updateconfig (&currprefs); if (quit_program >= 0) - quit_program = 2; + quit_program = UAE_RESET; #if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER) extern int EvalException (LPEXCEPTION_POINTERS blah, int n_except); __try diff --git a/newcpu.cpp b/newcpu.cpp index f1a606df..301c69b6 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -4405,14 +4405,15 @@ void m68k_go (int may_quit) if (currprefs.inprecfile[0] && input_play) { inprec_open (currprefs.inprecfile, NULL); changed_prefs.inprecfile[0] = currprefs.inprecfile[0] = 0; - quit_program = 2; + quit_program = UAE_RESET; } if (input_play || input_record) inprec_startup (); if (quit_program > 0) { - int hardreset = (quit_program == 3 ? 1 : 0) | hardboot; - if (quit_program == 1) + int hardreset = (quit_program == UAE_RESET_HARD ? 1 : 0) | hardboot; + bool kbreset = quit_program == UAE_RESET_KEYBOARD; + if (quit_program == UAE_QUIT) break; int restored = 0; @@ -4430,7 +4431,7 @@ void m68k_go (int may_quit) savestate_rewind (); #endif set_cycles (start_cycles); - custom_reset (hardreset); + custom_reset (hardreset != 0, kbreset); m68k_reset (hardreset); if (hardreset) { memory_clear (); @@ -5481,7 +5482,7 @@ void cpureset (void) send_internalevent (INTERNALEVENT_CPURESET); if ((currprefs.cpu_compatible || currprefs.cpu_cycle_exact) && currprefs.cpu_model <= 68020) { - custom_reset (0); + custom_reset (false, false); return; } pc = m68k_getpc (); @@ -5489,11 +5490,11 @@ void cpureset (void) addrbank *b = &get_mem_bank (pc); if (b->check (pc, 2 + 2)) { /* We have memory, hope for the best.. */ - custom_reset (0); + custom_reset (false, false); return; } write_log (_T("M68K RESET PC=%x, rebooting..\n"), pc); - custom_reset (0); + custom_reset (false, false); m68k_setpc (ksboot); return; } @@ -5503,14 +5504,14 @@ void cpureset (void) int reg = ins & 7; uae_u32 addr = m68k_areg (regs, reg); write_log (_T("reset/jmp (ax) combination emulated -> %x\n"), addr); - custom_reset (0); + custom_reset (false, false); if (addr < 0x80000) addr += 0xf80000; m68k_setpc (addr - 2); return; } write_log (_T("M68K RESET PC=%x, rebooting..\n"), pc); - custom_reset (0); + custom_reset (false, false); m68k_setpc (ksboot); } diff --git a/od-win32/bsdsock.cpp b/od-win32/bsdsock.cpp index 17264948..b38dbbaa 100644 --- a/od-win32/bsdsock.cpp +++ b/od-win32/bsdsock.cpp @@ -618,7 +618,7 @@ int host_socket(TrapContext *context, SB, int af, int type, int protocol) sb->ftable[sd-1] = SF_BLOCKING; ioctlsocket(s,FIONBIO,&nonblocking); - BSDTRACE((_T(" -> Socket=%d\n"),sd)); + BSDTRACE((_T(" -> Socket=%d %x\n"),sd,s)); if (type == SOCK_RAW) { if (protocol==IPPROTO_UDP) { @@ -1694,7 +1694,7 @@ int host_CloseSocket(TrapContext *context, SB, int sd) // For the sake of efficiency, we do not malloc() the fd_sets here. // 64 sockets should be enough for everyone. -static void makesocktable(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win, int nfds, SOCKET addthis) +static void makesocktable(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win, int nfds, SOCKET addthis, const TCHAR *name) { int i, j; uae_u32 currlong, mask; @@ -1731,6 +1731,7 @@ static void makesocktable(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win, i s = getsock(sb,j+i+1); if (s != INVALID_SOCKET) { + BSDTRACE((_T("%s:%d=%x\n"), name, fd_set_win->fd_count, s)); fd_set_win->fd_array[fd_set_win->fd_count++] = s; if (fd_set_win->fd_count >= FD_SETSIZE) { @@ -1808,11 +1809,11 @@ static unsigned int thread_WaitSelect2(void *indexp) wscnt = args->wscnt; // construct descriptor tables - makesocktable(sb, readfds, &readsocks, nfds, sb->sockAbort); + makesocktable(sb, readfds, &readsocks, nfds, sb->sockAbort, _T("R")); if (writefds) - makesocktable(sb, writefds, &writesocks, nfds, INVALID_SOCKET); + makesocktable(sb, writefds, &writesocks, nfds, INVALID_SOCKET, _T("W")); if (exceptfds) - makesocktable(sb, exceptfds, &exceptsocks, nfds, INVALID_SOCKET); + makesocktable(sb, exceptfds, &exceptsocks, nfds, INVALID_SOCKET, _T("E")); if (timeout) { tv.tv_sec = get_long (timeout); @@ -1822,8 +1823,11 @@ static unsigned int thread_WaitSelect2(void *indexp) BSDTRACE((_T("tWS2(%d) -> "), wscnt)); - resultval = select(nfds+1, &readsocks, writefds ? &writesocks : NULL, - exceptfds ? &exceptsocks : NULL, timeout ? &tv : 0); + resultval = select(nfds+1, + readsocks.fd_count > 0 ? &readsocks : NULL, + writefds && writesocks.fd_count > 0 ? &writesocks : NULL, + exceptfds && exceptsocks.fd_count > 0 ? &exceptsocks : NULL, + timeout ? &tv : NULL); if (bsd->hEvents[index] == NULL) break; @@ -1836,7 +1840,7 @@ static unsigned int thread_WaitSelect2(void *indexp) if (sb->resultval == SOCKET_ERROR) { // select was stopped by sb->sockAbort if (readsocks.fd_count > 1) { - makesocktable(sb, readfds, &readsocks, nfds, INVALID_SOCKET); + makesocktable(sb, readfds, &readsocks, nfds, INVALID_SOCKET, _T("R2")); tv.tv_sec = 0; tv.tv_usec = 10000; // Check for 10ms if data is available @@ -1932,11 +1936,11 @@ void host_WaitSelect(TrapContext *context, SB, uae_u32 nfds, uae_u32 readfds, ua wssigs = sigmp ? get_long (sigmp) : 0; - BSDTRACE((_T("WaitSelect(%d,0x%x,0x%x,0x%x,0x%x,0x%x):%d "), + BSDTRACE((_T("WaitSelect(%d,0x%x,0x%x,0x%x,0x%x,0x%x):%d\n"), nfds, readfds, writefds, exceptfds, timeout, wssigs, wscnt)); - fddebug(_T("read"), nfds, readfds); - fddebug(_T("write"), nfds, writefds); - fddebug(_T("except"), nfds, exceptfds); + fddebug(_T("read :"), nfds, readfds); + fddebug(_T("write :"), nfds, writefds); + fddebug(_T("except:"), nfds, exceptfds); if (!readfds && !writefds && !exceptfds && !timeout && !wssigs) { sb->resultval = 0; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 0d1007f4..e74b4c31 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -45,6 +45,8 @@ static int psEnabled, psActive, psPreProcess, shaderon; static bool showoverlay = true; +#define MAX_PASSES 2 + static D3DFORMAT tformat; static int d3d_enabled, d3d_ex; static IDirect3D9 *d3d; @@ -61,7 +63,7 @@ static int masktexture_w, masktexture_h; static float mask2texture_w, mask2texture_h, mask2texture_ww, mask2texture_wh; static float mask2texture_wwx, mask2texture_hhx, mask2texture_minusx, mask2texture_minusy; static float mask2texture_multx, mask2texture_multy, mask2texture_offsetw; -static LPDIRECT3DTEXTURE9 lpWorkTexture1, lpWorkTexture2, lpTempTexture; +static LPDIRECT3DTEXTURE9 lpWorkTexture1[2], lpWorkTexture2[2], lpTempTexture; LPDIRECT3DTEXTURE9 cursorsurfaced3d; static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture; static IDirect3DVertexBuffer9 *vertexBuffer; @@ -75,6 +77,7 @@ RECT mask2rect; static bool wasstilldrawing_broken; static bool renderdisabled; static HANDLE filenotificationhandle; +static int extrapasses; static bool fakemode; static uae_u8 *fakebitmap; @@ -1093,6 +1096,20 @@ static LPDIRECT3DTEXTURE9 createtext (int w, int h, D3DFORMAT format) static int worktex_width, worktex_height; +static int allocextratextures (int index, int w, int h) +{ + HRESULT hr; + if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1[index], NULL))) { + write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + return 0; + } + if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2[index], NULL))) { + write_log (_T("%s: Failed to create working texture2: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + return 0; + } + return 1; +} + static int createamigatexture (int w, int h) { HRESULT hr; @@ -1103,14 +1120,8 @@ static int createamigatexture (int w, int h) write_log (_T("%s: %d*%d texture allocated, bits per pixel %d\n"), D3DHEAD, w, h, t_depth); if (psActive) { D3DLOCKED_BOX lockedBox; - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) { - write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (!allocextratextures (0, w, h)) return 0; - } - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) { - write_log (_T("%s: Failed to create working texture2: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - return 0; - } if (FAILED (hr = lpHq2xLookupTexture->LockBox (0, &lockedBox, NULL, 0))) { write_log (_T("%s: Failed to lock box of volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -1143,6 +1154,10 @@ static int createtexture (int ow, int oh, int win_w, int win_h) texelsize.x = 1.0f / w; texelsize.y = 1.0f / h; texelsize.z = 1; texelsize.w = 1; if (psActive) { + if (extrapasses) { + if (!allocextratextures (1, w, h)) + return 0; + } if (FAILED (hr = d3ddev->CreateVolumeTexture (256, 16, 256, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpHq2xLookupTexture, NULL))) { write_log (_T("%s: Failed to create volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -1803,13 +1818,15 @@ static void freetextures (void) lpTempTexture->Release (); lpTempTexture = NULL; } - if (lpWorkTexture1) { - lpWorkTexture1->Release (); - lpWorkTexture1 = NULL; - } - if (lpWorkTexture2) { - lpWorkTexture2->Release (); - lpWorkTexture2 = NULL; + for (int i = 0; i < MAX_PASSES; i++) { + if (lpWorkTexture1[i]) { + lpWorkTexture1[i]->Release (); + lpWorkTexture1[i] = NULL; + } + if (lpWorkTexture2[i]) { + lpWorkTexture2[i]->Release (); + lpWorkTexture2[i] = NULL; + } } if (lpHq2xLookupTexture) { lpHq2xLookupTexture->Release (); @@ -2558,7 +2575,7 @@ static void D3D_render2 (void) LPDIRECT3DTEXTURE9 lpWorkTexture; settransform (); - if (!psEffect_SetTextures (texture, lpWorkTexture1, lpWorkTexture2, lpHq2xLookupTexture)) + if (!psEffect_SetTextures (texture, lpWorkTexture1[0], lpWorkTexture2[0], lpHq2xLookupTexture)) return; if (psPreProcess) { if (!psEffect_SetMatrices (&m_matPreProj, &m_matPreView, &m_matPreWorld)) @@ -2566,7 +2583,7 @@ static void D3D_render2 (void) if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - lpWorkTexture = lpWorkTexture1; + lpWorkTexture = lpWorkTexture1[0]; lpNewRenderTarget = NULL; pass2: if (FAILED (hr = lpWorkTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) @@ -2575,7 +2592,7 @@ static void D3D_render2 (void) write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); uPasses = 0; - if (psEffect_Begin (pEffect, (lpWorkTexture == lpWorkTexture1) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses)) { + if (psEffect_Begin (pEffect, (lpWorkTexture == lpWorkTexture1[0]) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses)) { for (uPass = 0; uPass < uPasses; uPass++) { if (psEffect_BeginPass (pEffect, uPass)) { if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 4, 2))) { @@ -2590,8 +2607,8 @@ static void D3D_render2 (void) write_log (_T("%s: Effect RenderTarget reset failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); lpNewRenderTarget->Release (); lpNewRenderTarget = NULL; - if (psEffect_hasPreProcess2 () && lpWorkTexture == lpWorkTexture1) { - lpWorkTexture = lpWorkTexture2; + if (psEffect_hasPreProcess2 () && lpWorkTexture == lpWorkTexture1[0]) { + lpWorkTexture = lpWorkTexture2[0]; goto pass2; } lpRenderTarget->Release (); @@ -2631,6 +2648,7 @@ static void D3D_render2 (void) } } + #if TWOPASS if (shaderon > 0 && postEffect) { diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 93ecb77a..e76f9375 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -56,6 +56,7 @@ struct uae_driveinfo { int nomedia; int dangerous; int readonly; + int cylinders, sectors, heads; }; #define HDF_HANDLE_WIN32 1 @@ -988,7 +989,7 @@ static void generatestorageproperty (struct uae_driveinfo *udi, int ignoreduplic { _tcscpy (udi->vendor_id, _T("UAE")); _tcscpy (udi->product_id, _T("DISK")); - _tcscpy (udi->product_rev, _T("1.1")); + _tcscpy (udi->product_rev, _T("1.2")); _stprintf (udi->device_name, _T("%s"), udi->device_path); udi->removablemedia = 1; } @@ -1226,6 +1227,9 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR dg.BytesPerSector, dg.Cylinders.QuadPart, dg.TracksPerCylinder, dg.SectorsPerTrack, dg.MediaType); udi->size = (uae_u64)dg.BytesPerSector * (uae_u64)dg.Cylinders.QuadPart * (uae_u64)dg.TracksPerCylinder * (uae_u64)dg.SectorsPerTrack; + udi->cylinders = dg.Cylinders.QuadPart > 65535 ? 0 : dg.Cylinders.LowPart; + udi->sectors = dg.SectorsPerTrack; + udi->heads = dg.TracksPerCylinder; } if (gli_ok) udi->size = gli.Length.QuadPart; diff --git a/od-win32/lib/prowizard.lib b/od-win32/lib/prowizard.lib index 48c358c8..9bb893f1 100644 Binary files a/od-win32/lib/prowizard.lib and b/od-win32/lib/prowizard.lib differ diff --git a/od-win32/lib/prowizard_x64.lib b/od-win32/lib/prowizard_x64.lib index b9716ade..6b286d3a 100644 Binary files a/od-win32/lib/prowizard_x64.lib and b/od-win32/lib/prowizard_x64.lib differ diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h old mode 100644 new mode 100755 index 0a989cf8..8689c90b --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -1056,6 +1056,7 @@ #define IDC_DBG_DASM2 1781 #define IDC_HF_DYNAMIC 1781 #define IDC_DBG_MEM2 1782 +#define IDC_HDFINFO2 1782 #define IDC_DBG_MEMINPUT2 1783 #define IDC_DBG_ADDRINPUTTXT 1784 #define IDC_RTG_SCALE 1785 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc old mode 100644 new mode 100755 index 8b4e476d..702bcc9a --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -528,13 +528,13 @@ BEGIN CONTROL "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,298,64,11 END -IDD_HARDFILE DIALOGEX 0, 0, 396, 245 +IDD_HARDFILE DIALOGEX 0, 0, 396, 263 STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "Hardfile Settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - GROUPBOX "Settings",IDC_STATIC,2,5,392,146 + GROUPBOX "Settings",IDC_STATIC,2,2,392,164 RTEXT "Path:",IDC_HARDFILE_DIR_TEXT,25,18,22,10 EDITTEXT IDC_PATH_NAME,52,15,325,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_SELECTOR,380,14,11,15 @@ -560,17 +560,18 @@ BEGIN RTEXT "Block size:",IDC_BLOCKSIZE_TEXT,261,113,50,10 EDITTEXT IDC_BLOCKSIZE,317,111,40,15,ES_NUMBER EDITTEXT IDC_HDFINFO,5,131,385,12,ES_CENTER | ES_READONLY - GROUPBOX "New hard disk image file",IDC_STATIC,2,155,392,62 - PUSHBUTTON "Create",IDC_HF_CREATE,58,171,80,14 - COMBOBOX IDC_HF_TYPE,58,195,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_HF_SIZE,154,171,61,15,ES_NUMBER - LTEXT "MB",IDC_STATIC,220,174,53,10,SS_CENTERIMAGE - EDITTEXT IDC_HF_DOSTYPE,154,194,61,15 - LTEXT "DOS type",IDC_STATIC,222,196,51,10,SS_CENTERIMAGE - CONTROL "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,180,87,10 - CONTROL "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,192,87,10 - PUSHBUTTON "OK",IDOK,147,226,50,14 - PUSHBUTTON "Cancel",IDCANCEL,203,226,50,14 + GROUPBOX "New hard disk image file",IDC_STATIC,2,171,392,62 + PUSHBUTTON "Create",IDC_HF_CREATE,58,187,80,14 + COMBOBOX IDC_HF_TYPE,58,211,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_HF_SIZE,154,187,61,15,ES_NUMBER + LTEXT "MB",IDC_STATIC,220,190,53,10,SS_CENTERIMAGE + EDITTEXT IDC_HF_DOSTYPE,154,210,61,15 + LTEXT "DOS type",IDC_STATIC,222,212,51,10,SS_CENTERIMAGE + CONTROL "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,196,87,10 + CONTROL "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,208,87,10 + PUSHBUTTON "OK",IDOK,147,242,50,14 + PUSHBUTTON "Cancel",IDCANCEL,203,242,50,14 + EDITTEXT IDC_HDFINFO2,5,147,385,12,ES_CENTER | ES_READONLY END IDD_FILESYS DIALOGEX 15, 25, 396, 111 @@ -625,9 +626,9 @@ BEGIN CONTROL "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,47,86,10 CONTROL "Cycle-exact [] The most compatible A500/A1200 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,25,69,170,10 - RTEXT "Chipset Extra",IDC_STATIC,30,89,71,15,SS_CENTERIMAGE - COMBOBOX IDC_CS_EXT,105,90,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,69,170,10 + RTEXT "Chipset Extra:",IDC_STATIC,72,89,71,15,SS_CENTERIMAGE + COMBOBOX IDC_CS_EXT,148,90,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Options",IDC_STATIC,221,0,173,111 CONTROL "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,16,150,10 @@ -804,20 +805,22 @@ BEGIN PUSHBUTTON "Delete",IDC_FILTERPRESETDELETE,325,259,55,14 END -IDD_HARDDRIVE DIALOGEX 0, 0, 396, 74 +IDD_HARDDRIVE DIALOGEX 0, 0, 396, 109 STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Harddrive Settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN LTEXT "Hard drive:",IDC_STATIC,7,11,80,10 COMBOBOX IDC_HARDDRIVE,49,9,339,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "Create hard disk image file",IDC_HARDDRIVE_IMAGE,49,29,115,14 - EDITTEXT IDC_PATH_NAME,183,29,97,15,ES_AUTOHSCROLL | NOT WS_VISIBLE - RTEXT "HD Controller:",IDC_STATIC,12,52,65,10,SS_CENTERIMAGE - COMBOBOX IDC_HDF_CONTROLLER,91,51,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,52,60,10 - DEFPUSHBUTTON "Add hard drive",IDOK,236,49,73,14 - PUSHBUTTON "Cancel",IDCANCEL,316,49,73,14 + DEFPUSHBUTTON "Create hard disk image file",IDC_HARDDRIVE_IMAGE,49,67,115,14 + EDITTEXT IDC_PATH_NAME,183,67,97,15,ES_AUTOHSCROLL | NOT WS_VISIBLE + RTEXT "HD Controller:",IDC_STATIC,12,90,65,10,SS_CENTERIMAGE + COMBOBOX IDC_HDF_CONTROLLER,91,89,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,90,60,10 + DEFPUSHBUTTON "Add hard drive",IDOK,236,87,73,14 + PUSHBUTTON "Cancel",IDCANCEL,316,87,73,14 + EDITTEXT IDC_HDFINFO,5,29,385,12,ES_CENTER | ES_READONLY + EDITTEXT IDC_HDFINFO2,5,46,385,12,ES_CENTER | ES_READONLY END IDD_MISC2 DIALOGEX 0, 0, 396, 263 @@ -1344,6 +1347,7 @@ BEGIN IDD_HARDDRIVE, DIALOG BEGIN + BOTTOMMARGIN, 108 END IDD_MISC2, DIALOG diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index bc3ab8bd..77f86f1b 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -57,7 +57,7 @@ static int recursive_device, recursive; static int currentpausemode; static int gameportmask[MAX_JPORTS]; static DWORD storeflags; -static bool screenmode_request; +static int screenmode_request; static HWND guestwindow; static int cando (void) @@ -1030,7 +1030,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM return 1; case RP_IPC_TO_GUEST_QUERYSCREENMODE: { - screenmode_request = true; + screenmode_request = 1; return 1; } case RP_IPC_TO_GUEST_GUESTAPIVERSION: @@ -1571,6 +1571,12 @@ void rp_set_hwnd (HWND hWnd) RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); } +void rp_screenmode_changed (void) +{ + if (!screenmode_request) + screenmode_request = 2; +} + void rp_set_enabledisable (int enabled) { if (!cando ()) @@ -1609,10 +1615,12 @@ void rp_vsync (void) if (!initialized) return; if (screenmode_request) { - struct RPScreenMode sm = { 0 }; - get_screenmode (&sm, &currprefs); - RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); - screenmode_request = false; + screenmode_request--; + if (screenmode_request == 0) { + struct RPScreenMode sm = { 0 }; + get_screenmode (&sm, &currprefs); + RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); + } } if (magicmouse_alive () != mousemagic) rp_mouse_magic (magicmouse_alive ()); diff --git a/od-win32/rp.h b/od-win32/rp.h index 02e283f5..fe356a75 100644 --- a/od-win32/rp.h +++ b/od-win32/rp.h @@ -16,6 +16,7 @@ extern int rp_isactive (void); extern void rp_vsync (void); extern HWND rp_getparent (void); extern void rp_rtg_switch (void); +extern void rp_screenmode_changed (void); extern TCHAR *rp_param; extern int rp_rpescapekey; diff --git a/od-win32/win32.h b/od-win32/win32.h index af1a44bf..0186ba98 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,9 +19,9 @@ #define LANG_DLL 1 //#define WINUAEBETA _T("") -#define WINUAEBETA _T("24") -#define WINUAEDATE MAKEBD(2012, 11, 5) -#define WINUAEEXTRA _T("") +#define WINUAEBETA _T("25") +#define WINUAEDATE MAKEBD(2012, 11, 10) +#define WINUAEEXTRA _T(" RC1") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index cfb0e828..da75c5d5 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -3526,9 +3526,7 @@ static int create_windows_2 (void) write_log (_T("window already open (%dx%d %dx%d)\n"), amigawin_rect.left, amigawin_rect.top, amigawin_rect.right - amigawin_rect.left, amigawin_rect.bottom - amigawin_rect.top); updatemouseclip (); -#ifdef RETROPLATFORM - rp_set_hwnd (hAmigaWnd); -#endif + rp_screenmode_changed (); return 1; } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index f19c7a7e..94225570 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -91,7 +91,7 @@ #include "rp.h" #endif -#define GUI_SCALE_DEFAULT 90 +#define GUI_SCALE_DEFAULT 100 #define MIN_GUI_INTERNAL_WIDTH 512 #define MIN_GUI_INTERNAL_HEIGHT 400 @@ -8182,9 +8182,9 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) v--; v = 110 - v * 10; } - double m = scaleresource_getdpimult (); - gui_width = (int)(GUI_INTERNAL_WIDTH * v * m / 100); - gui_height = (int)(GUI_INTERNAL_HEIGHT * v * m / 100); + //double m = scaleresource_getdpimult (); + gui_width = (int)(GUI_INTERNAL_WIDTH * v / 100); + gui_height = (int)(GUI_INTERNAL_HEIGHT * v / 100); scaleresource_setmult (guiDlg, gui_width, gui_height); gui_size_changed = 1; } @@ -9373,7 +9373,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults) static uae_u8 id[512]; int blocks, cyls, i; TCHAR tmp[200], tmp2[200]; - TCHAR idtmp[9]; + TCHAR idtmp[17]; bsize = 0; if (force) { @@ -9394,9 +9394,19 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults) if (i == 16) hdf_read (&hfd, id, 0, 512); } - if (defaults && current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { - getchsgeometry_hdf (open ? &hfd : NULL, bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors); - current_hfdlg.original = 0; + if (defaults) { + if (hfd.flags & HFD_FLAGS_REALDRIVE) { + if (current_hfdlg.controller >= HD_CONTROLLER_IDE0 && current_hfdlg.controller <= HD_CONTROLLER_IDE3) { + getchspgeometry (bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors, true); + if (current_hfdlg.forcedcylinders == 0) + current_hfdlg.forcedcylinders = current_hfdlg.cylinders; + } else { + getchspgeometry (bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors, false); + } + } else if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { + getchsgeometry_hdf (open ? &hfd : NULL, bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors); + current_hfdlg.original = 0; + } } hdf_close (&hfd); } @@ -9406,6 +9416,8 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults) cyls = bsize / (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces); } blocks = cyls * (current_hfdlg.sectors * current_hfdlg.surfaces); + if (!blocks && current_hfdlg.blocksize) + blocks = bsize / current_hfdlg.blocksize; for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) { TCHAR c = id[i]; if (c < 32 || c > 126) @@ -9416,22 +9428,29 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults) tmp[0] = 0; if (bsize) { - _stprintf (tmp2, _T(" %s [%02X%02X%02X%02X%02X%02X%02X%02X]"), idtmp, id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]); - if (!cyls || !blocks) { + _stprintf (tmp2, _T(" %s [%02X%02X%02X%02X %02X%02X%02X%02X %02X%02X%02X%02X %02X%02X%02X%02X]"), idtmp, + id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7], + id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]); + if (!blocks) { _stprintf (tmp, _T("%dMB"), bsize / (1024 * 1024)); + } else if (blocks && !cyls) { + _stprintf (tmp, _T("%u blocks, %.1fMB"), + blocks, + (double)bsize / (1024.0 * 1024.0)); } else { - _stprintf (tmp, _T("%u cyls, %u blocks, %.1fMB/%.1fMB"), - cyls, blocks, + _stprintf (tmp, _T("%u/%u/%u, %u/%u blocks, %.1fMB/%.1fMB"), + cyls, current_hfdlg.surfaces, current_hfdlg.sectors, + blocks, (int)(bsize / 512), (double)blocks * 1.0 * current_hfdlg.blocksize / (1024.0 * 1024.0), (double)bsize / (1024.0 * 1024.0)); if (cyls > 65535) { - _stprintf (tmp2, _T(" %4.4s [%02X%02X%02X%02X]"), idtmp, id[0], id[1], id[2], id[3]); - _tcscat (tmp, _T(" [Too many cyls]")); + _tcscat (tmp2, _T(" [Too many cyls]")); } } - _tcscat (tmp, tmp2); - if (hDlg != NULL) + if (hDlg != NULL) { SetDlgItemText (hDlg, IDC_HDFINFO, tmp); + SetDlgItemText (hDlg, IDC_HDFINFO2, tmp2); + } } } @@ -9674,25 +9693,6 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara if (recursive) break; recursive++; - posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); - if (oposn != posn && posn != CB_ERR) { - oposn = posn; - if (posn >= 0) { - BOOL ena ; - int dang = 1; - hdf_getnameharddrive (posn, 1, NULL, &dang); - ena = dang >= 0; - ew (hDlg, IDC_HARDDRIVE_IMAGE, ena); - ew (hDlg, IDOK, ena); - ew (hDlg, IDC_HDF_RW, !dang); - if (dang) - current_hfdlg.rw = FALSE; - ew (hDlg, IDC_HDF_CONTROLLER, ena); - hardfile_testrdb (hDlg, ¤t_hfdlg); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0); - CheckDlgButton(hDlg, IDC_HDF_RW, current_hfdlg.rw); - } - } if (HIWORD (wParam) == BN_CLICKED) { switch (LOWORD (wParam)) { case IDOK: @@ -9702,17 +9702,58 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara EndDialog (hDlg, 0); break; case IDC_HARDDRIVE_IMAGE: + posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) harddrive_to_hdf (hDlg, &workprefs, posn); break; + case IDC_HDF_RW: + posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); + if (posn != CB_ERR) { + int dang = 1; + hdf_getnameharddrive (posn, 1, NULL, &dang); + current_hfdlg.rw = ischecked (hDlg, IDC_HDF_RW) && !dang; + } + break; + } + } + if (LOWORD (wParam) == IDC_HARDDRIVE) { + posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); + if (oposn != posn && posn != CB_ERR) { + oposn = posn; + if (posn >= 0) { + BOOL ena; + int dang = 1; + hdf_getnameharddrive (posn, 1, NULL, &dang); + _tcscpy (current_hfdlg.filename, hdf_getnameharddrive (posn, 0, NULL, &dang)); + ena = dang >= 0; + ew (hDlg, IDC_HARDDRIVE_IMAGE, ena); + ew (hDlg, IDOK, ena); + ew (hDlg, IDC_HDF_RW, !dang); + if (dang) + current_hfdlg.rw = FALSE; + current_hfdlg.blocksize = 512; + current_hfdlg.forcedcylinders = 0; + current_hfdlg.cylinders = current_hfdlg.sectors = current_hfdlg.surfaces = 0; + ew (hDlg, IDC_HDF_CONTROLLER, ena); + SetDlgItemText (hDlg, IDC_HDFINFO, _T("")); + SetDlgItemText (hDlg, IDC_HDFINFO2, _T("")); + updatehdfinfo (hDlg, true, true); + SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0); + CheckDlgButton(hDlg, IDC_HDF_RW, current_hfdlg.rw); + _tcscpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, ¤t_hfdlg.blocksize, NULL)); + } + } + } else if (LOWORD (wParam) == IDC_HDF_CONTROLLER) { + posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); + if (posn != CB_ERR) { + current_hfdlg.controller = posn; + current_hfdlg.forcedcylinders = 0; + current_hfdlg.cylinders = current_hfdlg.sectors = current_hfdlg.surfaces = 0; + SetDlgItemText (hDlg, IDC_HDFINFO, _T("")); + SetDlgItemText (hDlg, IDC_HDFINFO2, _T("")); + updatehdfinfo (hDlg, true, true); } } - if (posn != CB_ERR) - _tcscpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, ¤t_hfdlg.blocksize, NULL)); - current_hfdlg.rw = ischecked (hDlg, IDC_HDF_RW); - posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); - if (posn != CB_ERR) - current_hfdlg.controller = posn; recursive--; break; } @@ -9768,7 +9809,7 @@ static void new_harddrive (HWND hDlg, int entry) uci = add_filesys_config (&workprefs, entry, 0, 0, current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, 0, 0, current_hfdlg.blocksize, 0, 0, current_hfdlg.controller, 0, - 0, 0, 0); + current_hfdlg.forcedcylinders, current_hfdlg.surfaces, current_hfdlg.sectors); if (uci) hardfile_do_disk_change (uci, 1); } @@ -14563,9 +14604,9 @@ static void getguisize (HWND hDlg, int *width, int *height) { RECT r; - GetClientRect (hDlg, &r); - *width = r.right; - *height = r.bottom; + GetWindowRect (hDlg, &r); + *width = r.right - r.left; + *height = r.bottom - r.top; } static HWND updatePanel (int id) @@ -15208,7 +15249,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l if (dialogreturn < 0) { dialogreturn = 0; if (allow_quit) { - quit_program = 1; + quit_program = UAE_QUIT; regs.spcflags |= SPCFLAG_BRK; } } @@ -15288,7 +15329,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l dialogreturn = 0; DestroyWindow (hDlg); if (allow_quit) { - quit_program = 1; + quit_program = UAE_QUIT; regs.spcflags |= SPCFLAG_BRK; } guiDlg = NULL; @@ -15499,8 +15540,8 @@ static void blah(void) static void setdefaultguisize (void) { - gui_width = GUI_INTERNAL_WIDTH * 90 / 100; - gui_height = GUI_INTERNAL_HEIGHT * 90 / 100; + gui_width = GUI_INTERNAL_WIDTH * 100 / 100; + gui_height = GUI_INTERNAL_HEIGHT * 100 / 100; } static int GetSettings (int all_options, HWND hwnd) @@ -15587,10 +15628,6 @@ static int GetSettings (int all_options, HWND hwnd) } if (!regexists) { scaleresource_setdefaults (); - setdefaultguisize (); - double m = scaleresource_getdpimult (); - gui_width = (int)(gui_width * m); - gui_height = (int)(gui_height * m); fmultx = 0; write_log (_T("GUI default size\n")); regsetint (NULL, _T("GUIResize"), 0); @@ -15612,16 +15649,16 @@ static int GetSettings (int all_options, HWND hwnd) if (first) write_log (_T("Entering GUI idle loop\n")); - if (fmultx > 0) { + if (fmultx > 0) scaleresource_setmult (hwnd, -fmultx, -fmulty); - } else { + else scaleresource_setmult (hwnd, gui_width, gui_height); - write_log (_T("Requested GUI size = %dx%d (%dx%d)\n"), gui_width, gui_height, workprefs.gfx_size.width, workprefs.gfx_size.height); - if (dodialogmousemove () && isfullscreen() > 0) { - if (gui_width >= workprefs.gfx_size.width || gui_height >= workprefs.gfx_size.height) { - write_log (_T("GUI larger than screen, resize disabled\n")); - gui_resize_allowed = false; - } + fmultx = 0; + write_log (_T("Requested GUI size = %dx%d (%dx%d)\n"), gui_width, gui_height, workprefs.gfx_size.width, workprefs.gfx_size.height); + if (dodialogmousemove () && isfullscreen() > 0) { + if (gui_width >= workprefs.gfx_size.width || gui_height >= workprefs.gfx_size.height) { + write_log (_T("GUI larger than screen, resize disabled\n")); + gui_resize_allowed = false; } } @@ -15649,7 +15686,6 @@ static int GetSettings (int all_options, HWND hwnd) break; } - setguititle (dhwnd); ShowWindow (dhwnd, SW_SHOW); MapDialogRect (dhwnd, &dialog_rect); @@ -15666,6 +15702,7 @@ static int GetSettings (int all_options, HWND hwnd) WaitMessage(); } dialogmousemove (dhwnd); + while ((v = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))) { if (dialogreturn >= 0) break; diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index eca82a00..07608e5c 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -404,18 +404,63 @@ void scaleresource_setdefaults (void) openfont (true); } -static int lpx, lpy; +#define BASEMULT 1000 +static int baseunitx, baseunity; +static RECT baserect, baseclientrect; +static int baseborderwidth, baseborderheight; +static int basewidth, baseheight; +static int baseclientwidth, baseclientheight; + +static INT_PTR CALLBACK TestProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == WM_INITDIALOG) { + RECT r; + // there really is no better way? + r.left = 0; + r.top = 0; + r.bottom = BASEMULT; + r.right = BASEMULT; + MapDialogRect (hDlg, &r); + baseunitx = r.right * 4 / BASEMULT; + baseunity = r.bottom * 8 / BASEMULT; + GetWindowRect (hDlg, &baserect); + GetClientRect (hDlg, &baseclientrect); + } + return 0; +} -double scaleresource_getdpimult (void) +// horrible or what? +static void getbaseunits (void) { - HDC hdc = GetDC (NULL); - int m = GetDeviceCaps (hdc, LOGPIXELSY); - ReleaseDC (NULL, hdc); - if (m > 96) { - m -= 96; - return 1.0 + m / 250.0; + struct newresource *nr, *nr2; + HWND hwnd; + + nr = getresource (IDD_PANEL); + if (!nr) { + write_log (_T("getbaseunits fail\n")); + abort(); + } + multx = multy = 100; + nr2 = scaleresource (nr, NULL, -1); + hwnd = CreateDialogIndirect (nr2->inst, nr2->resource, NULL, TestProc); + if (hwnd) { + DestroyWindow(hwnd); + } else { + baserect.left = baserect.top = 0; + baserect.right = 800; + baserect.bottom = 600; + baseclientrect.left = baseclientrect.top = 0; + baseclientrect.right = 800; + baseclientrect.bottom = 600; } - return 1.0; + freescaleresource (nr2); + freescaleresource (nr); + basewidth = baserect.right - baserect.left; + baseheight = baserect.bottom - baserect.top; + baseclientwidth = baseclientrect.right - baseclientrect.left; + baseclientheight = baseclientrect.bottom - baseclientrect.top; + baseborderwidth = basewidth - baseclientwidth; + baseborderheight = baseheight - baseclientheight; } void scaleresource_init (const TCHAR *prefix) @@ -425,11 +470,6 @@ void scaleresource_init (const TCHAR *prefix) fontprefix = prefix; - HDC hdc = GetDC (NULL); - lpx = GetDeviceCaps (hdc, LOGPIXELSX); - lpy = GetDeviceCaps (hdc, LOGPIXELSY); - ReleaseDC (NULL, hdc); - setdeffont (); regqueryfont (NULL, fontprefix, fontreg[0], fontname_gui, &fontsize_gui, &fontstyle_gui, &fontweight_gui); @@ -438,9 +478,12 @@ void scaleresource_init (const TCHAR *prefix) //write_log (_T("GUI font %s:%d:%d:%d\n"), fontname_gui, fontsize_gui, fontstyle_gui, fontweight_gui); //write_log (_T("List font %s:%d:%d:%d\n"), fontname_list, fontsize_list, fontstyle_list, fontweight_list); + getbaseunits (); + openfont (true); } +#if 0 static void sizefont (HWND hDlg, const TCHAR *name, int size, int style, int weight, int *width, int *height) { /* ARGH!!! */ @@ -465,35 +508,18 @@ static void sizefont (HWND hDlg, const TCHAR *name, int size, int style, int wei } ReleaseDC (hDlg, hdc); } +#endif void scaleresource_setmult (HWND hDlg, int w, int h) { - int width, height, width2, height2; - if (w < 0) { multx = -w; multy = -h; return; } - int cy = GetSystemMetrics (SM_CYSIZEFRAME); - int cx = GetSystemMetrics (SM_CXSIZEFRAME); - int caption = GetSystemMetrics (SM_CYCAPTION); - - sizefont (hDlg, fontname_gui, fontsize_gui, fontstyle_gui, fontweight_gui, &width, &height); - sizefont (hDlg, wfont_old, 8, REGULAR_FONTTYPE, FW_REGULAR, &width2, &height2); - - int yy = cy * 2 + caption; - int xx = cx * 2; - - w += xx; - h += yy; - - multx = (w * width2) * 100.0 / (GUI_INTERNAL_WIDTH * width); - multy = (h * height2) * 100.0 / (GUI_INTERNAL_HEIGHT * height); - - multx = MulDiv (multx, 96, lpx); - multy = MulDiv (multy, 96, lpy); + multx = w * 100.0 / basewidth; + multy = h * 100.0 / baseheight; if (multx < 50) multx = 50; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 2d565259..bf1435b1 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,16 @@ - restore only single input target to default. +Beta 25 RC1: + +- Switching to interlaced mode and autoscale enabled: don't calculate new size until 2 frames have been drawn to prevent multiple display size changes. +- More accurate GUI resizing algorithm. +- Show also first few bytes of disk in harddrive selection GUI. +- Add real harddrive as IDE: calculate physical CHS values using H=16,S=63,C=total blocks/(H*S) formula to better match with real hardware. + (ROM built-in IDE drivers use IDE identify device CHS values to calculate last accessible block of drive, LBA support was added in ROM updates) +- Action Replay 2 copper list detection code hang tweak. +- Prowizard AC1D update (Asle) + Beta 24: - CDFS: ACTION_DISK_INFO no disk status really works now. diff --git a/prowizard/rippers/AC1D_packer.c b/prowizard/rippers/AC1D_packer.c index 6924504e..b582f851 100644 --- a/prowizard/rippers/AC1D_packer.c +++ b/prowizard/rippers/AC1D_packer.c @@ -1,5 +1,5 @@ -/* testAC1D() */ -/* Rip_AC1D() */ +/* testAC1D() */ +/* Rip_AC1D() */ /* Depack_AC1D() */ #include "globals.h" @@ -9,13 +9,17 @@ short testAC1D ( void ) { /* test #1 */ - /* if ( PW_i<2 )*/ + /* if ( PW_i<2 )*/ if ( test_1_start(2) == BAD ) return BAD; - /* test #2 */ + /* test #2 + * 20121104 - testing also if the pattern list isn't empty + */ PW_Start_Address = PW_i-2; - if ( (in_data[PW_Start_Address] > 0x7f) || ((PW_Start_Address+896)>PW_in_size) ) + if ( (in_data[PW_Start_Address] > 0x7f) || + (in_data[PW_Start_Address] == 0x00) || + ((PW_Start_Address+896)>PW_in_size) ) { return BAD; } @@ -58,22 +62,22 @@ void Rip_AC1D ( void ) Save_Rip ( "AC1D Packed module", AC1D_packer ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ + PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ } /* - * ac1d.c 1996-1997 (c) Asle / ReDoX - * - * Converts AC1D packed MODs back to PTK MODs - * thanks to Gryzor and his ProWizard tool ! ... without it, this prog - * would not exist !!! - * - * Last update: 30/11/99 - * - removed open() (and other fread()s and the like) - * - general Speed & Size Optmizings - * 20051002 : testing fopen() ... +* ac1d.c 1996-1997 (c) Asle / ReDoX +* +* Converts AC1D packed MODs back to PTK MODs +* thanks to Gryzor and his ProWizard tool ! ... without it, this prog +* would not exist !!! +* +* Last update: 30/11/99 +* - removed open() (and other fread()s and the like) +* - general Speed & Size Optmizings +* 20051002 : testing fopen() ... */ void Depack_AC1D ( void ) { @@ -240,11 +244,11 @@ void Depack_AC1D ( void ) fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); /* crap ... */ - Crap ( " AC1D Packer " , BAD , BAD , out ); + Crap ( " AC1D Packer " , BAD , BAD , out ); fflush ( out ); fclose ( out ); printf ( "done\n" ); return; /* useless ... but */ -} +} \ No newline at end of file