From 84ffb4c0005c71f82fb07751366a11e3179c0186 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 30 Jul 2008 17:17:55 +0300 Subject: [PATCH] imported winuaesrc1510rc1.zip --- custom.c | 6 ++-- disk.c | 14 +++++++- drawing.c | 8 ++--- od-win32/direct3d.c | 47 ++++++++++++++++++++++++- od-win32/direct3d.h | 1 + od-win32/win32.h | 6 ++-- od-win32/win32gfx.c | 1 + od-win32/win32gui.c | 4 +-- od-win32/winuae_msvc/winuae_msvc.vcproj | 6 ++-- od-win32/winuaechangelog.txt | 10 ++++++ 10 files changed, 86 insertions(+), 17 deletions(-) diff --git a/custom.c b/custom.c index 865cd5ba..3a1715cc 100755 --- a/custom.c +++ b/custom.c @@ -243,8 +243,8 @@ enum diw_states DIW_waiting_start, DIW_waiting_stop }; -int plffirstline, plflastline; -int plfstrt, plfstop; +static int plffirstline, plflastline; +static int plfstrt, plfstop; static int sprite_minx, sprite_maxx; static int first_bpl_vpos; static int last_diw_pix_hpos, last_ddf_pix_hpos; @@ -2430,7 +2430,7 @@ void init_hz (void) minfirstline = maxvpos - 1; sprite_vblank_endline = minfirstline - 2; maxvpos_max = maxvpos; - doublescan = htotal <= 150; + doublescan = htotal <= 164; dumpsync (); hzc = 1; } diff --git a/disk.c b/disk.c index ac5738e2..a14f98d0 100755 --- a/disk.c +++ b/disk.c @@ -163,6 +163,7 @@ typedef struct { int dskready; int dskready_time; int dskready_down_time; + int writtento; int steplimit; frame_time_t steplimitcycle; int indexhack, indexhackmode; @@ -2430,6 +2431,7 @@ static void disk_doupdate_write (drive * drv, int floppybits) if (drives[dr]) { drv2->bigmfmbuf[drv2->mfmpos >> 4] = w; drv2->bigmfmbuf[(drv2->mfmpos >> 4) + 1] = 0x5555; + drv2->writtento = 1; } #ifdef AMAX if (currprefs.amaxromfile[0]) @@ -2442,6 +2444,7 @@ static void disk_doupdate_write (drive * drv, int floppybits) disk_dmafinished (); for (dr = 0; dr < MAX_FLOPPY_DRIVES ; dr++) { drive *drv2 = &floppy[dr]; + drv2->writtento = 0; if (drives[dr]) drive_write_data (drv2); } @@ -2822,8 +2825,16 @@ void DSKLEN (uae_u16 v, int hpos) /* Megalomania and Knightmare does this */ if (disk_debug_logging > 0 && dskdmaen == 2) write_log ("warning: Disk read DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC); - if (dskdmaen == 3) + if (dskdmaen == 3) { write_log ("warning: Disk write DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC); + // did program write something that needs to be stored to file? + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv2 = &floppy[dr]; + if (!drv2->writtento) + continue; + drive_write_data (drv2); + } + } dskdmaen = 0; } } @@ -2867,6 +2878,7 @@ void DSKLEN (uae_u16 v, int hpos) motormask = 0; for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { drive *drv = &floppy[dr]; + drv->writtento = 0; if (drv->motoroff) continue; motormask |= 1 << dr; diff --git a/drawing.c b/drawing.c index 28179593..aee583e4 100755 --- a/drawing.c +++ b/drawing.c @@ -1487,8 +1487,8 @@ static void init_aspect_maps (void) xfree (amiga2aspect_line_map); /* At least for this array the +1 is necessary. */ - amiga2aspect_line_map = malloc (sizeof (int) * (MAXVPOS + 1) * 2 + 1); - native2amiga_line_map = malloc (sizeof (int) * gfxvidinfo.height); + amiga2aspect_line_map = xmalloc (sizeof (int) * (MAXVPOS + 1) * 2 + 1); + native2amiga_line_map = xmalloc (sizeof (int) * gfxvidinfo.height); if (currprefs.gfx_correct_aspect) native_lines_per_amiga_line = ((double)gfxvidinfo.height @@ -1538,7 +1538,7 @@ static void init_aspect_maps (void) } } - for (i = maxl-1; i >= min_ypos_for_screen; i--) { + for (i = maxl - 1; i >= min_ypos_for_screen; i--) { int j; if (amiga2aspect_line_map[i] == -1) continue; @@ -1591,7 +1591,7 @@ STATIC_INLINE void do_flush_screen (int start, int stop) Should be corrected. (sjo 26.9.99) */ - xlinecheck(start, stop); + xlinecheck (start, stop); if (gfxvidinfo.maxblocklines != 0 && first_block_line != NO_BLOCK) { flush_block (first_block_line, last_block_line); } diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index ddd07c7a..6fb297d5 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -303,6 +303,25 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler) static int psEffect_hasPreProcess (void) { return m_PreprocessTechnique1EffectHandle != 0; } static int psEffect_hasPreProcess2 (void) { return m_PreprocessTechnique2EffectHandle != 0; } +int D3D_canshaders (void) +{ + static int yesno = 0; + HANDLE h; + + if (yesno < 0) + return 0; + if (yesno > 0) + return 1; + h = LoadLibrary ("d3dx9_36.dll"); + if (h == NULL) { + yesno = -1; + return 0; + } + FreeLibrary (h); + yesno = 1; + return 1; +} + static int psEffect_LoadEffect (const char *shaderfile) { int ret = 0; @@ -311,8 +330,15 @@ static int psEffect_LoadEffect (const char *shaderfile) LPD3DXBUFFER BufferEffect = NULL; HRESULT hr; char tmp[MAX_DPATH]; + static int first; - sprintf (tmp, "%s%sfiltershaders\\%s", start_path_exe, WIN32_PLUGINDIR, shaderfile); + if (!D3D_canshaders ()) { + if (!first) + gui_message ("Installed DirectX is too old\nD3D shaders disabled."); + first = 1; + return 0; + } + sprintf (tmp, "%s%sfiltershaders\\direct3d\\%s", start_path_exe, WIN32_PLUGINDIR, shaderfile); hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, 0, &EffectCompiler, &Errors); if (FAILED (hr)) { write_log ("D3D: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DX_ErrorString (hr, Errors)); @@ -558,12 +584,31 @@ static void invalidatedeviceobjects (void) IDirect3DVolumeTexture9_Release (lpHq2xLookupTexture); lpHq2xLookupTexture = NULL; } + if (pEffect) { + pEffect->lpVtbl->Release (pEffect); + pEffect = NULL; + } if (d3ddev) IDirect3DDevice9_SetStreamSource (d3ddev, 0, NULL, 0, 0); if (vertexBuffer) { IDirect3DVertexBuffer9_Release (vertexBuffer); vertexBuffer = NULL; } + m_MatWorldEffectHandle = NULL; + m_MatViewEffectHandle = NULL; + m_MatProjEffectHandle = NULL; + m_MatWorldViewEffectHandle = NULL; + m_MatViewProjEffectHandle = NULL; + m_MatWorldViewProjEffectHandle = NULL; + m_SourceDimsEffectHandle = NULL; + m_TexelSizeEffectHandle = NULL; + m_SourceTextureEffectHandle = NULL; + m_WorkingTexture1EffectHandle = NULL; + m_WorkingTexture2EffectHandle = NULL; + m_Hq2xLookupTextureHandle = NULL; + m_PreprocessTechnique1EffectHandle = NULL; + m_PreprocessTechnique2EffectHandle = NULL; + m_CombineTechniqueEffectHandle = NULL; } void D3D_free (void) diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index a1fef540..d8233307 100755 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -12,3 +12,4 @@ extern HDC D3D_getDC(HDC hdc); extern int D3D_isenabled (void); extern int D3D_needreset (void); extern void D3D_clear (void); +extern int D3D_canshaders (void); diff --git a/od-win32/win32.h b/od-win32/win32.h index ba16ee02..073d2a9c 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,10 +15,10 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 8 +#define WINUAEBETA 0 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 7, 27) -#define WINUAEEXTRA "" +#define WINUAEDATE MAKEBD(2008, 7, 30) +#define WINUAEEXTRA "RC1" #define WINUAEREV "" #define IHF_WINDOWHIDDEN 6 diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index d6cddbfd..b97520f0 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1542,6 +1542,7 @@ void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgb int need; if (!screen_is_picasso) return; + clearscreen (); gfx_set_picasso_colors (rgbfmt); updatemodes (); need = modeswitchneeded (currentmode); diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 90a09e70..6b5a4440 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -9669,11 +9669,11 @@ static void values_to_hw3ddlg (HWND hDlg) } i++; } - { + if (D3D_canshaders ()) { HANDLE h; WIN32_FIND_DATA wfd; char tmp[MAX_DPATH]; - sprintf (tmp, "%s%sfiltershaders\\*.fx", start_path_exe, WIN32_PLUGINDIR); + sprintf (tmp, "%s%sfiltershaders\\direct3d\\*.fx", start_path_exe, WIN32_PLUGINDIR); h = FindFirstFile(tmp, &wfd); while (h) { SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)wfd.cFileName); diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 702f7183..6f4ffafd 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -92,7 +92,7 @@ LinkIncremental="2" SuppressStartupBanner="true" GenerateManifest="false" - DelayLoadDLLs="wpcap.dll;packet.dll" + DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_36.dll" GenerateDebugInformation="true" ProgramDatabaseFile=".\Debug/winuae.pdb" SubSystem="2" @@ -307,7 +307,7 @@ AdditionalLibraryDirectories="" GenerateManifest="true" AdditionalManifestDependencies="" - DelayLoadDLLs="wpcap.dll;packet.dll" + DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_36.dll" GenerateDebugInformation="true" ProgramDatabaseFile=".\Release/winuae.pdb" SubSystem="2" @@ -1090,7 +1090,7 @@ AdditionalLibraryDirectories="" GenerateManifest="true" AdditionalManifestDependencies="" - DelayLoadDLLs="wpcap.dll;packet.dll" + DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_36.dll" GenerateDebugInformation="true" ProgramDatabaseFile=".\FullRelease/winuae.pdb" SubSystem="2" diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 689f3c02..47657e27 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,14 @@ +Beta 9: + +- clear RTG screen when switching to different RTG mode +- d9dx9_36.dll set to delay load, winuae now runs without recent DX + redistributable installed as long as D3D filter(s) aren't used +- shaders moved to plugins\filtershaders\direct3d (perhaps opengl + shaders will be implemented someday..) +- pixel shader filter on the fly change crashes fixed (I hope) +- adf was not updated if disk write DMA was aborted (Cadaver save) + Beta 8: - PAL filter preset fixed -- 2.47.3