+++ /dev/null
-!define PRODUCT_NAME "WinUAE"
-!define PRODUCT_VERSION "1.0"
-!define PRODUCT_PUBLISHER "Toni Wilen"
-!define PRODUCT_WEB_SITE "http://www.winuae.net/"
-!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\winuae.exe"
-!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
-!define PRODUCT_UNINST_ROOT_KEY "HKLM"
-
-;-- Your path here
-!define DISTPATH "e:\projects\winuae\distribution"
-
-SetCompressor lzma
-
-!include "StrFunc.nsh"
-!include "WinMessages.nsh"
-
-; MUI begins ---
-!include "MUI.nsh"
-; MUI Settings
-!define MUI_ABORTWARNING
-!define MUI_COMPONENTSPAGE_SMALLDESC
-;!define MUI_FINISHPAGE_NOAUTOCLOSE
-!define MUI_FINISHPAGE_RUN_NOTCHECKED
-!define MUI_ICON "graphics\installer_icon.ico"
-!define MUI_UNICON "graphics\installer_icon.ico"
-; MUI Bitmaps
-!define MUI_HEADERIMAGE
-!define MUI_HEADERIMAGE_BITMAP "graphics\amiga_header.bmp"
-!define MUI_WELCOMEFINISHPAGE_BITMAP "graphics\amiga_welcome.bmp"
-; Welcome page
-!insertmacro MUI_PAGE_WELCOME
-; Components page
-!insertmacro MUI_PAGE_COMPONENTS
-; Directory page
-!insertmacro MUI_PAGE_DIRECTORY
-; Instfiles page
-!insertmacro MUI_PAGE_INSTFILES
-; Finish page
-!define MUI_FINISHPAGE_RUN "$INSTDIR\winuae.exe"
-!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Docs\Readme.txt"
-!insertmacro MUI_PAGE_FINISH
-; Uninstaller pages
-!insertmacro MUI_UNPAGE_INSTFILES
-; Language files
-!insertmacro MUI_LANGUAGE "English"
-; MUI end ---
-
-Function .onInit
- ;Find WinUAE Properties Window and close it when it's open
- System::Call 'kernel32::CreateMutexA(i 0, i 0, t "WinUAE Instantiated") i .r1 ?e'
- Pop $1
- StrCmp $1 183 0 Continue
- MessageBox MB_OK|MB_ICONEXCLAMATION "WinUAE is still running in the background, the installer will terminate it.$\nYou can do this by yourself as well before proceeding with the installation."
- FindWindow $2 "" "WinUAE Properties"
- FindWindow $3 "" "WinUAE"
- SendMessage $2 ${WM_CLOSE} 0 0
- SendMessage $3 ${WM_CLOSE} 0 0
-
- Continue:
- ReadRegStr $0 HKCU "Software\Arabuusimiehet\WinUAE" "InstallDir"
- StrCmp $0 "" No_WinUAE
- ;Code if WinUAE is installed
- StrCpy $INSTDIR $0
- Goto +2
- No_WinUAE:
- ;Code if WinUAE is not installed
- StrCpy $INSTDIR "$PROGRAMFILES\WinUAE"
-FunctionEnd
-
-Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
-OutFile "InstallWinUAE.exe"
-InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
-ShowInstDetails show
-ShowUnInstDetails show
-
-InstType "Complete" ;1
-InstType "Basic" ;2
-InstType "Basic with Shortcuts" ;3
-
-Section "WinUAE (required)" secWinUAE_files
- SectionIn 1 2 3 RO
- SetOutPath "$INSTDIR\"
- ;SetOverwrite ifnewer
- ;-- Copy WinUAE and zlib.dll
- File "${DISTPATH}\zlib1.dll"
- File "${DISTPATH}\winuae.exe"
- SetOutPath "$INSTDIR\Docs"
- File "${DISTPATH}\Docs\Readme.txt"
- ;-- Creates the necessary registry entrys
- WriteRegStr HKCU "Software\Arabuusimiehet\WinUAE" "InstallDir" "$INSTDIR"
-SectionEnd
-
-Section "Host-Configurations" secExConfig
- SectionIn 1
- SetOutPath "$INSTDIR\Configurations\Host"
- SetOverwrite ifnewer
- ;-- Copy Example Host Configurations
- File "${DISTPATH}\Configurations\Host\Fullscreen (640x480).uae"
- File "${DISTPATH}\Configurations\Host\Fullscreen (800x600).uae"
- File "${DISTPATH}\Configurations\Host\Windowed.uae"
-SectionEnd
-
-SubSection "Additional files" secAdditionalFiles
- Section "Docs" secDocs
- SectionIn 1
- SetOutPath "$INSTDIR\Docs"
- SetOverwrite ifnewer
- ;-- Copy Docs
- File "${DISTPATH}\Docs\Whatsnew-jit"
- File "${DISTPATH}\Docs\README.umisef"
- File "${DISTPATH}\Docs\README.pci"
- File "${DISTPATH}\Docs\README.JIT-tuning"
- File "${DISTPATH}\Docs\README.compemu"
- File "${DISTPATH}\Docs\History_old.txt"
- ;-- Copy Docs for Windows
- SetOutPath "$INSTDIR\Docs\Windows"
- File "${DISTPATH}\Docs\Windows\UAEHowTo.txt"
- File "${DISTPATH}\Docs\Windows\Translation.txt"
- File "${DISTPATH}\Docs\Windows\AmigaProg.txt"
- SectionEnd
-
- Section "Amiga programs" secAmigaprograms
- SectionIn 1
- SetOutPath "$INSTDIR\Amiga Programs"
- SetOverwrite ifnewer
- ;-- Copy the Amiga Programs
- File "${DISTPATH}\Amiga Programs\winxpprinthelper.info"
- File "${DISTPATH}\Amiga Programs\winxpprinthelper"
- File "${DISTPATH}\Amiga Programs\winuaeenforcer.txt"
- File "${DISTPATH}\Amiga Programs\winuaeenforcer"
- File "${DISTPATH}\Amiga Programs\winuaeclip.txt"
- File "${DISTPATH}\Amiga Programs\winuaeclip.info"
- File "${DISTPATH}\Amiga Programs\winuaeclip"
- File "${DISTPATH}\Amiga Programs\uaectrl"
- File "${DISTPATH}\Amiga Programs\uae-control.info"
- File "${DISTPATH}\Amiga Programs\uae-control"
- File "${DISTPATH}\Amiga Programs\uae-configuration"
- File "${DISTPATH}\Amiga Programs\uae-configuration.s"
- File "${DISTPATH}\Amiga Programs\uae-configuration.c"
- File "${DISTPATH}\Amiga Programs\uae_rcli"
- File "${DISTPATH}\Amiga Programs\UAE_German.info"
- File "${DISTPATH}\Amiga Programs\UAE_German"
- File "${DISTPATH}\Amiga Programs\transrom"
- File "${DISTPATH}\Amiga Programs\transdisk"
- File "${DISTPATH}\Amiga Programs\timehack"
- File "${DISTPATH}\Amiga Programs\rtg.library"
- File "${DISTPATH}\Amiga Programs\picasso96fix.bb"
- File "${DISTPATH}\Amiga Programs\picasso96fix"
- File "${DISTPATH}\Amiga Programs\p96refresh.ab2"
- File "${DISTPATH}\Amiga Programs\p96refresh"
- File "${DISTPATH}\Amiga Programs\p96_uae_tweak"
- File "${DISTPATH}\Amiga Programs\mousehack"
- File "${DISTPATH}\Amiga Programs\german_KeyMap_new.zip"
- File "${DISTPATH}\Amiga Programs\amigaprog.txt"
- File "${DISTPATH}\Amiga Programs\ahidriver.zip"
- SectionEnd
-SubSectionEnd
-
-#SubSection "Translations" secTranslations
-# Section "German" secTransGerman
-# SectionIn 1
-# SetOutPath "$INSTDIR\"
-# File "${DISTPATH}\WinUAE_German.dll"
-# SectionEnd
-
-; Section "Foo" secTransFoo
-; SectionIn 1
-; SetOutPath "$INSTDIR\"
-; File "${DISTPATH}\WinUAE_Foo.dll"
-; SectionEnd
-SubSectionEnd
-
-SubSection "Shortcuts" secShortcuts
- Section "Startmenu" secStartmenu
- SectionIn 1 3
- CreateDirectory "$SMPROGRAMS\WinUAE"
- CreateShortCut "$SMPROGRAMS\WinUAE\WinUAE.lnk" "$INSTDIR\winuae.exe"
- CreateShortCut "$SMPROGRAMS\WinUAE\ReadMe.lnk" "$INSTDIR\Docs\Readme.txt"
- CreateShortCut "$SMPROGRAMS\WinUAE\Uninstall.lnk" "$INSTDIR\uninstall_winuae.exe"
- SectionEnd
-
- Section "Desktop" secDesktop
- SectionIn 1 3
- CreateShortCut "$DESKTOP\WinUAE.lnk" "$INSTDIR\winuae.exe"
- SectionEnd
-
- Section "Quick Launch" secQuickLaunch
- SectionIn 1 3
- CreateShortcut "$QUICKLAUNCH\WinUAE.lnk" "$INSTDIR\winuae.exe"
- SectionEnd
-SubSectionend
-
-Section -Post
- WriteUninstaller "$INSTDIR\uninstall_winuae.exe"
- WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\winuae.exe"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall_winuae.exe"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\winuae.exe"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
- WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
-SectionEnd
-
-; Section descriptions
-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${secWinUAE_files} "WinUAE (WinUAE.exe, zlib1.dll, readme.txt)"
- !insertmacro MUI_DESCRIPTION_TEXT ${secExConfig} "Example Host-Configurations"
- !insertmacro MUI_DESCRIPTION_TEXT ${secAdditionalFiles} "Additional files (Docs, Amiga programs)"
- !insertmacro MUI_DESCRIPTION_TEXT ${secAmigaprograms} "Amiga programs"
- !insertmacro MUI_DESCRIPTION_TEXT ${secDocs} "Documentation"
- !insertmacro MUI_DESCRIPTION_TEXT ${secShortcuts} "Shortcuts (Startmenu, Desktop, Quick Launch)"
- !insertmacro MUI_DESCRIPTION_TEXT ${secStartmenu} "Create a startmenu entry"
- !insertmacro MUI_DESCRIPTION_TEXT ${secDesktop} "Create a desktop icon"
- !insertmacro MUI_DESCRIPTION_TEXT ${secQuickLaunch} "Create a Quick Launch icon"
-; !insertmacro MUI_DESCRIPTION_TEXT ${secTranslations} "WinUAE Translations"
-!insertmacro MUI_FUNCTION_DESCRIPTION_END
-
-
-Function un.onUninstSuccess
- HideWindow
- MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
-FunctionEnd
-
-Function un.onInit
- MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
- Abort
-FunctionEnd
-
-Section Uninstall
- Delete "$INSTDIR\uninstall_winuae.exe"
- Delete "$INSTDIR\Docs\Windows\AmigaProg.txt"
- Delete "$INSTDIR\Docs\Windows\Translation.txt"
- Delete "$INSTDIR\Docs\Windows\UAEHowTo.txt"
- Delete "$INSTDIR\Docs\History_old.txt"
- Delete "$INSTDIR\Docs\README.compemu"
- Delete "$INSTDIR\Docs\README.JIT-tuning"
- Delete "$INSTDIR\Docs\README.pci"
- Delete "$INSTDIR\Docs\Readme.txt"
- Delete "$INSTDIR\Docs\Readme.txt.bak"
- Delete "$INSTDIR\Docs\README.umisef"
- Delete "$INSTDIR\Docs\Whatsnew-jit"
- Delete "$INSTDIR\Amiga Programs\ahidriver.zip"
- Delete "$INSTDIR\Amiga Programs\amigaprog.txt"
- Delete "$INSTDIR\Amiga Programs\german_KeyMap_new.zip"
- Delete "$INSTDIR\Amiga Programs\mousehack"
- Delete "$INSTDIR\Amiga Programs\p96_uae_tweak"
- Delete "$INSTDIR\Amiga Programs\p96refresh"
- Delete "$INSTDIR\Amiga Programs\p96refresh.ab2"
- Delete "$INSTDIR\Amiga Programs\picasso96fix"
- Delete "$INSTDIR\Amiga Programs\picasso96fix.bb"
- Delete "$INSTDIR\Amiga Programs\rtg.library"
- Delete "$INSTDIR\Amiga Programs\timehack"
- Delete "$INSTDIR\Amiga Programs\transdisk"
- Delete "$INSTDIR\Amiga Programs\transrom"
- Delete "$INSTDIR\Amiga Programs\UAE_German"
- Delete "$INSTDIR\Amiga Programs\UAE_German.info"
- Delete "$INSTDIR\Amiga Programs\uae_rcli"
- Delete "$INSTDIR\Amiga Programs\uae-configuration"
- Delete "$INSTDIR\Amiga Programs\uae-configuration.s"
- Delete "$INSTDIR\Amiga Programs\uae-configuration.c"
- Delete "$INSTDIR\Amiga Programs\uae-control"
- Delete "$INSTDIR\Amiga Programs\uae-control.info"
- Delete "$INSTDIR\Amiga Programs\uaectrl"
- Delete "$INSTDIR\Amiga Programs\winuaeclip"
- Delete "$INSTDIR\Amiga Programs\winuaeclip.info"
- Delete "$INSTDIR\Amiga Programs\winuaeclip.txt"
- Delete "$INSTDIR\Amiga Programs\winuaeenforcer"
- Delete "$INSTDIR\Amiga Programs\winuaeenforcer.txt"
- Delete "$INSTDIR\Amiga Programs\winxpprinthelper"
- Delete "$INSTDIR\Amiga Programs\winxpprinthelper.info"
- Delete "$INSTDIR\Configurations\Host\Fullscreen (640x480).uae"
- Delete "$INSTDIR\Configurations\Host\Fullscreen (800x600).uae"
- Delete "$INSTDIR\Configurations\Host\Windowed.uae"
- Delete "$INSTDIR\winuaebootlog.txt"
- Delete "$INSTDIR\winuaelog.txt"
- Delete "$INSTDIR\winuae.exe"
- Delete "$INSTDIR\zlib1.dll"
- Delete "$INSTDIR\WinUAE_German.dll"
-
- Delete "$SMPROGRAMS\WinUAE\Uninstall.lnk"
- Delete "$SMPROGRAMS\WinUAE\WinUAE.lnk"
- Delete "$SMPROGRAMS\WinUAE\ReadMe.lnk"
- Delete "$DESKTOP\WinUAE.lnk"
- Delete "$QUICKLAUNCH\WinUAE.lnk"
-
- RMDir "$INSTDIR\Docs\Windows"
- RMDir "$INSTDIR\Docs"
- RMDir "$INSTDIR\Amiga Programs"
- RMDir "$INSTDIR\Configurations\Host"
- RMDir "$INSTDIR\Configurations\Hardware"
- RMDir "$INSTDIR\Configurations"
- RMDir "$INSTDIR\Roms"
- RMDir "$INSTDIR\SaveImages"
- RMDir "$INSTDIR\SaveStates"
- RMDir "$INSTDIR\ScreenShots"
-
- RMDir "$SMPROGRAMS\WinUAE"
- RMDir "$INSTDIR\"
- RMDir ""
-
- DeleteRegKey HKCU "Software\Arabuusimiehet"
- DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
- DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
- SetAutoClose true
-SectionEnd
* 1999.08.02 Brian King Creation
*
*/
-int DirectDraw_SurfaceLock( surface_type_e surface_type )
+int DirectDraw_SurfaceLock(surface_type_e surface_type)
{
int result = 0;
- if( surface_type == lockable_surface )
+ if (surface_type == lockable_surface)
surface_type = DirectDraw_GetLockableType();
switch( surface_type )
{
case primary_surface:
- DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 );
- result = LockStub( surface_type );
+ DirectDrawState.primary.desc.dwSize = sizeof(DDSURFACEDESC2);
+ result = LockStub(surface_type);
break;
case secondary_surface:
- DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 );
- result = LockStub( surface_type );
+ DirectDrawState.secondary.desc.dwSize = sizeof(DDSURFACEDESC2);
+ result = LockStub(surface_type);
break;
case tertiary_surface:
- DirectDrawState.tertiary.desc.dwSize = sizeof( DDSURFACEDESC2 );
- result = LockStub( surface_type );
+ DirectDrawState.tertiary.desc.dwSize = sizeof(DDSURFACEDESC2);
+ result = LockStub(surface_type);
break;
case temporary_surface:
- DirectDrawState.temporary.desc.dwSize = sizeof( DDSURFACEDESC2 );
- result = LockStub( surface_type );
+ DirectDrawState.temporary.desc.dwSize = sizeof(DDSURFACEDESC2);
+ result = LockStub(surface_type);
break;
case overlay_surface:
- DirectDrawState.overlay.desc.dwSize = sizeof( DDSURFACEDESC2 );
- result = LockStub( surface_type );
+ DirectDrawState.overlay.desc.dwSize = sizeof(DDSURFACEDESC2);
+ result = LockStub(surface_type);
case lockable_surface:
case invalid_surface:
default:
* 1999.08.02 Brian King Creation
*
*/
-char *DirectDraw_GetSurfacePointer( void )
+char *DirectDraw_GetSurfacePointer(void)
{
char *pixels = NULL;
/* Make sure that somebody has done a lock before returning the lpSurface member */
if(lockcnt)
- {
pixels = DirectDrawState.lockable.lpdesc->lpSurface;
- }
return pixels;
}
* 1999.08.02 Brian King Creation
*
*/
-LONG DirectDraw_GetSurfacePitch( void )
+LONG DirectDraw_GetSurfacePitch(void)
{
LONG pitch = 0;
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_GetPixelFormatFlags( void )
+DWORD DirectDraw_GetPixelFormatFlags(void)
{
DWORD flags = 0;
flags = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwFlags;
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_GetSurfaceFlags( void )
+DWORD DirectDraw_GetSurfaceFlags(void)
{
DWORD flags = 0;
flags = DirectDrawState.lockable.lpdesc->dwFlags;
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_GetSurfaceBitCount( void )
+DWORD DirectDraw_GetSurfaceBitCount(void)
{
DWORD bits = 0;
//?????JGI begin:
- if( DirectDrawState.lockable.lpdesc )
+ if(DirectDrawState.lockable.lpdesc)
bits = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRGBBitCount;
else
bits = DirectDrawState.current.desc.ddpfPixelFormat.dwRGBBitCount;
* 2001.08.25 Brian King Creation
*
*/
-DWORD DirectDraw_GetPrimaryBitCount( void )
+DWORD DirectDraw_GetPrimaryBitCount(void)
{
DWORD bits = 0;
memset(&DirectDrawState.primary.desc,0,sizeof(DirectDrawState.primary.desc));
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_GetPixelFormatBitMask( DirectDraw_Mask_e mask )
+DWORD DirectDraw_GetPixelFormatBitMask(DirectDraw_Mask_e mask)
{
DWORD result = 0;
- switch( mask )
+ switch(mask)
{
case red_mask:
result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRBitMask;
* 1999.08.02 Brian King Creation
*
*/
-surface_type_e DirectDraw_GetLockableType( void )
+surface_type_e DirectDraw_GetLockableType(void)
{
return DirectDrawState.surface_type;
}
* 2000.04.30 Brian King Creation
*
*/
-BOOL DirectDraw_IsLocked( void )
+BOOL DirectDraw_IsLocked(void)
{
return DirectDrawState.locked ? TRUE : FALSE;
}
* 1999.08.02 Brian King Creation
*
*/
-static surface_type_e try_surface_locks( int want_fullscreen )
+static surface_type_e try_surface_locks(int want_fullscreen)
{
surface_type_e result = invalid_surface;
- if( DirectDrawState.isoverlay && DirectDraw_SurfaceLock( overlay_surface ) )
+ if(DirectDrawState.isoverlay && DirectDraw_SurfaceLock(overlay_surface))
{
result = overlay_surface;
- write_log( "try_surface_locks() returning overlay\n" );
+ write_log("try_surface_locks() returning overlay\n");
}
- else if( want_fullscreen && WIN32GFX_IsPicassoScreen() )
+ else if(want_fullscreen && WIN32GFX_IsPicassoScreen())
{
- if( DirectDraw_SurfaceLock( primary_surface ) )
+ if(DirectDraw_SurfaceLock(primary_surface))
{
result = primary_surface;
- write_log( "try_surface_locks() returning primary\n" );
+ write_log("try_surface_locks() returning primary\n");
}
- else if( DirectDraw_SurfaceLock( secondary_surface ) )
+ else if(DirectDraw_SurfaceLock(secondary_surface))
{
result = secondary_surface;
- write_log( "try_surface_locks() returning secondary\n" );
+ write_log("try_surface_locks() returning secondary\n");
}
}
else
{
- if( DirectDraw_SurfaceLock( secondary_surface ) )
+ if(DirectDraw_SurfaceLock(secondary_surface))
{
result = secondary_surface;
- write_log( "try_surface_locks() returning secondary\n" );
+ write_log("try_surface_locks() returning secondary\n");
}
}
* 1999.08.02 Brian King Creation
*
*/
-void ddraw_unlockscr( void )
+void ddraw_unlockscr(void)
{
- if( lockcnt > 0 )
- {
+ if(lockcnt > 0) {
lockcnt--;
- IDirectDrawSurface7_Unlock( DirectDrawState.lockable.surface,
- DirectDrawState.lockable.lpdesc->lpSurface );
+ IDirectDrawSurface7_Unlock(DirectDrawState.lockable.surface,
+ DirectDrawState.lockable.lpdesc->lpSurface);
DirectDrawState.locked = FALSE;
}
}
* 1999.08.02 Brian King Creation
*
*/
-int DirectDraw_Start( GUID *guid )
+int DirectDraw_Start(GUID *guid)
{
HRESULT ddrval;
/* Prepare our DirectDrawState structure */
DirectDrawState.initialized = TRUE;
ddrval = IDirectDraw_QueryInterface(DirectDrawState.directdraw.ddx,
- &IID_IDirectDraw7,
- (LPVOID *)&DirectDrawState.directdraw.dd);
+ &IID_IDirectDraw7, (LPVOID *)&DirectDrawState.directdraw.dd);
if(FAILED(ddrval)) {
gui_message("start_ddraw(): DirectX 7 or newer required");
DirectDraw_Release();
* 1999.08.02 Brian King Creation
*
*/
-void DirectDraw_Release( void )
+void DirectDraw_Release(void)
{
- releaser( DirectDrawState.lpDDC, IDirectDrawClipper_Release );
- releaser( DirectDrawState.lpDDP, IDirectDrawPalette_Release );
+ releaser(DirectDrawState.lpDDC, IDirectDrawClipper_Release);
+ releaser(DirectDrawState.lpDDP, IDirectDrawPalette_Release);
- if (DirectDrawState.directdraw.dd && DirectDrawState.modeset)
- {
- IDirectDraw7_SetCooperativeLevel( DirectDrawState.directdraw.dd, hAmigaWnd, DDSCL_NORMAL);
- IDirectDraw7_RestoreDisplayMode( DirectDrawState.directdraw.dd );
+ if (DirectDrawState.directdraw.dd && DirectDrawState.modeset) {
+ IDirectDraw7_SetCooperativeLevel(DirectDrawState.directdraw.dd, hAmigaWnd, DDSCL_NORMAL);
+ IDirectDraw7_RestoreDisplayMode(DirectDrawState.directdraw.dd);
}
DirectDrawState.modeset = 0;
- releaser( DirectDrawState.overlay.surface, IDirectDrawSurface7_Release );
- releaser( DirectDrawState.primary.surface, IDirectDrawSurface7_Release );
+ releaser(DirectDrawState.overlay.surface, IDirectDrawSurface7_Release);
+ releaser(DirectDrawState.primary.surface, IDirectDrawSurface7_Release);
- if( DirectDrawState.flipping == single_buffer)
- releaser( DirectDrawState.secondary.surface, IDirectDrawSurface7_Release );
+ if(DirectDrawState.flipping == single_buffer)
+ releaser(DirectDrawState.secondary.surface, IDirectDrawSurface7_Release);
- releaser( DirectDrawState.directdraw.dd, IDirectDraw_Release );
+ releaser(DirectDrawState.directdraw.dd, IDirectDraw_Release);
DirectDrawState.lockable.lpdesc = NULL;
DirectDrawState.lockable.lpdesc = NULL;
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_SetCooperativeLevel( HWND window, int want_fullscreen )
+HRESULT DirectDraw_SetCooperativeLevel(HWND window, int want_fullscreen)
{
HRESULT ddrval;
- ddrval = IDirectDraw7_SetCooperativeLevel( DirectDrawState.directdraw.dd,
- window,
- want_fullscreen ?
- DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : DDSCL_NORMAL );
+ ddrval = IDirectDraw7_SetCooperativeLevel(DirectDrawState.directdraw.dd,
+ window, want_fullscreen ?
+ DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : DDSCL_NORMAL);
if(SUCCEEDED(ddrval)) {
DirectDrawState.fullscreen = want_fullscreen;
DirectDrawState.window = window;
* 1999.08.02 Brian King Creation
*
*/
-BOOL DirectDraw_GetCooperativeLevel( HWND *window, int *fullscreen )
+BOOL DirectDraw_GetCooperativeLevel(HWND *window, int *fullscreen)
{
BOOL result = FALSE;
- if( DirectDrawState.initialized )
- {
+ if(DirectDrawState.initialized) {
*fullscreen = DirectDrawState.fullscreen;
*window = DirectDrawState.window;
result = TRUE;
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_SetDisplayMode( int width, int height, int bits, int freq )
+HRESULT DirectDraw_SetDisplayMode(int width, int height, int bits, int freq)
{
HRESULT ddrval;
- ddrval = IDirectDraw7_SetDisplayMode( DirectDrawState.directdraw.dd,
- width, height, bits, freq, 0 );
+ ddrval = IDirectDraw7_SetDisplayMode(DirectDrawState.directdraw.dd,
+ width, height, bits, freq, 0);
DirectDrawState.modeset = 1;
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_GetDisplayMode( void )
+HRESULT DirectDraw_GetDisplayMode(void)
{
HRESULT ddrval;
/* We fill in the current.desc in all cases */
- DirectDrawState.current.desc.dwSize = sizeof( DDSURFACEDESC2 );
- ddrval = IDirectDraw7_GetDisplayMode( DirectDrawState.directdraw.dd,
- &DirectDrawState.current.desc );
+ DirectDrawState.current.desc.dwSize = sizeof(DDSURFACEDESC2);
+ ddrval = IDirectDraw7_GetDisplayMode(DirectDrawState.directdraw.dd,
+ &DirectDrawState.current.desc);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_GetCaps( DDCAPS_DX7 *driver_caps, DDCAPS_DX7 *hel_caps )
+HRESULT DirectDraw_GetCaps(DDCAPS_DX7 *driver_caps, DDCAPS_DX7 *hel_caps)
{
HRESULT ddrval;
- ddrval = IDirectDraw7_GetCaps( DirectDrawState.directdraw.dd,
- driver_caps, hel_caps );
+ ddrval = IDirectDraw7_GetCaps(DirectDrawState.directdraw.dd,
+ driver_caps, hel_caps);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_CreateClipper( void )
+HRESULT DirectDraw_CreateClipper(void)
{
HRESULT ddrval;
- ddrval = IDirectDraw7_CreateClipper( DirectDrawState.directdraw.dd,
- 0, &DirectDrawState.lpDDC, NULL );
+ ddrval = IDirectDraw7_CreateClipper(DirectDrawState.directdraw.dd,
+ 0, &DirectDrawState.lpDDC, NULL);
return ddrval;
}
-static DWORD ConvertGDIColor( COLORREF dwGDIColor )
+static DWORD ConvertGDIColor(COLORREF dwGDIColor)
{
COLORREF rgbT;
HDC hdc;
IDirectDrawSurface7_GetSurfaceDesc(DirectDrawState.primary.surface, &pdds);
// Use GDI SetPixel to color match for us
- if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface, &hdc)))
- {
+ if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface, &hdc))) {
rgbT = GetPixel(hdc, 0, 0); // Save current pixel value
SetPixel(hdc, 0, 0, dwGDIColor); // Set our value
IDirectDrawSurface7_ReleaseDC(DirectDrawState.primary.surface,hdc);
// Now lock the surface so we can read back the converted color
ddsd.dwSize = sizeof(ddsd);
hr = IDirectDrawSurface7_Lock(DirectDrawState.primary.surface, NULL, &ddsd, DDLOCK_WAIT, NULL );
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
dw = *(DWORD *) ddsd.lpSurface;
- if( ddsd.ddpfPixelFormat.dwRGBBitCount < 32 ) // Mask it to bpp
- dw &= ( 1 << ddsd.ddpfPixelFormat.dwRGBBitCount ) - 1;
+ if(ddsd.ddpfPixelFormat.dwRGBBitCount < 32) // Mask it to bpp
+ dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount) - 1;
IDirectDrawSurface7_Unlock(DirectDrawState.primary.surface,NULL);
}
// Now put the color that was there back.
- if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface,&hdc)))
- {
- SetPixel( hdc, 0, 0, rgbT );
+ if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface,&hdc))) {
+ SetPixel(hdc, 0, 0, rgbT);
IDirectDrawSurface7_ReleaseDC(DirectDrawState.primary.surface,hdc);
}
-
+
return dw;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_CreateSurface( int width, int height )
+HRESULT DirectDraw_CreateSurface(int width, int height)
{
HRESULT ddrval;
+ DWORD xtraflag = 0;
DirectDrawState.flipping = single_buffer;
- if (DirectDrawState.fullscreen) // Create a flipping pair!
- {
+ if (DirectDrawState.fullscreen) { // Create a flipping pair!
ZeroMemory (&DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2));
DirectDrawState.primary.desc.dwSize = sizeof (DDSURFACEDESC2);
DirectDrawState.primary.desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
DirectDrawState.primary.desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
DirectDrawState.primary.desc.dwBackBufferCount = 2;
ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd,
- &DirectDrawState.primary.desc,
- &DirectDrawState.primary.surface,
- NULL);
+ &DirectDrawState.primary.desc, &DirectDrawState.primary.surface, NULL);
if (FAILED(ddrval)) {
// Create a non-flipping pair, since the flipping pair creation failed...
ZeroMemory (&DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2));
DirectDrawState.primary.desc.dwFlags = DDSD_CAPS;
DirectDrawState.primary.desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd,
- &DirectDrawState.primary.desc,
- &DirectDrawState.primary.surface,
- NULL);
+ &DirectDrawState.primary.desc, &DirectDrawState.primary.surface, NULL);
}
- if(FAILED(ddrval)) {
- goto out;
- } else
- {
- write_log( "DDRAW: Primary %ssurface created in video-memory\n", DirectDrawState.flipping != single_buffer ? "flipping " : "" );
- }
+ if(FAILED(ddrval))
+ goto errout;
+ else
+ write_log( "DDRAW: Primary %ssurface created in video-memory\n",
+ DirectDrawState.flipping != single_buffer ? "flipping " : "");
// Check if we can access the back-buffer of our flipping-pair (if present)
- if( DirectDrawState.flipping != single_buffer )
- {
+ if(DirectDrawState.flipping != single_buffer) {
DDSCAPS2 ddSCaps;
ZeroMemory(&ddSCaps, sizeof(ddSCaps));
ddSCaps.dwCaps = DDSCAPS_BACKBUFFER;
- ddrval = IDirectDrawSurface7_GetAttachedSurface( DirectDrawState.primary.surface, &ddSCaps, &DirectDrawState.secondary.surface );
- if(SUCCEEDED(ddrval))
- {
+ ddrval = IDirectDrawSurface7_GetAttachedSurface(DirectDrawState.primary.surface, &ddSCaps, &DirectDrawState.secondary.surface);
+ if(SUCCEEDED(ddrval)) {
/* get third buffer */
ZeroMemory(&ddSCaps, sizeof(ddSCaps));
ddSCaps.dwCaps = DDSCAPS_FLIP;
- ddrval = IDirectDrawSurface7_GetAttachedSurface( DirectDrawState.secondary.surface, &ddSCaps, &DirectDrawState.tertiary.surface );
- if(SUCCEEDED(ddrval))
- {
+ ddrval = IDirectDrawSurface7_GetAttachedSurface(DirectDrawState.secondary.surface, &ddSCaps, &DirectDrawState.tertiary.surface);
+ if(SUCCEEDED(ddrval)) {
clearsurface (tertiary_surface);
- #if 0
- // Get our IDirectDrawSurface7 pointer
- ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.tertiary.surface,
- &IID_IDirectDrawSurface7,
- (LPVOID *)&DirectDrawState.tertiary.surface );
- if(FAILED(ddrval))
- {
- goto out;
- }
- #endif
- }
- else
- {
+ } else {
DirectDrawState.flipping = single_buffer;
}
- #if 0
- // Get our IDirectDrawSurface7 pointer
- ddrval = IDirectDrawSurface_QueryInterface( DirectDrawState.secondary.surface,
- &IID_IDirectDrawSurface7,
- (LPVOID *)&DirectDrawState.secondary.surface );
- if(FAILED(ddrval))
- {
- goto out;
- }
-#endif
- }
- else
- {
+ } else {
DirectDrawState.flipping = single_buffer;
}
}
-#if 0
- // Get our IDirectDrawSurface7 pointer
- ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.primary.surface,
- &IID_IDirectDrawSurface7,
- (LPVOID *)&DirectDrawState.primary.surface );
-
- if(FAILED(ddrval))
- {
- goto out;
- }
-#endif
-
// We always want a secondary-buffer when creating our primary-surface. If we're a flipping pair,
// the secondary buffer is already allocated. If we failed to create a flipping pair, or because
// we're not full-screen, then lets create ourselves a back-buffer manually.
- if( DirectDrawState.flipping == single_buffer )
- {
- ZeroMemory( &DirectDrawState.secondary.desc, sizeof( DDSURFACEDESC2 ) );
- DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 );
+ if(DirectDrawState.flipping == single_buffer) {
+ ZeroMemory(&DirectDrawState.secondary.desc, sizeof(DDSURFACEDESC2));
+ DirectDrawState.secondary.desc.dwSize = sizeof(DDSURFACEDESC2);
DirectDrawState.secondary.desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | xtraflag;
DirectDrawState.secondary.desc.dwWidth = width;
DirectDrawState.secondary.desc.dwHeight = height;
- ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd,
- &DirectDrawState.secondary.desc,
- &DirectDrawState.secondary.surface,
- NULL );
- if(FAILED(ddrval))
- {
+ ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd,
+ &DirectDrawState.secondary.desc, &DirectDrawState.secondary.surface, NULL);
+ if(FAILED(ddrval)) {
write_log( "DDRAW:Secondary surface creation attempt #1 failed with %s\n", DXError(ddrval));
- DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd,
- &DirectDrawState.secondary.desc,
- &DirectDrawState.secondary.surface,
- NULL );
+ DirectDrawState.secondary.desc.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
+ DirectDrawState.secondary.desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
+ ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd,
+ &DirectDrawState.secondary.desc, &DirectDrawState.secondary.surface, NULL);
if(SUCCEEDED(ddrval))
- write_log( "DDRAW: Secondary surface created in plain system-memory\n" );
+ write_log("DDRAW: Secondary surface created in plain system-memory\n");
else
- {
- goto out;
- }
- }
- else
- {
- write_log( "DDRAW: Secondary surface created in video-memory\n" );
- }
-#if 0
- // Get our IDirectDrawSurface7 pointer
- ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.secondary.surface,
- &IID_IDirectDrawSurface7,
- (LPVOID *)&DirectDrawState.secondary.surface );
- if(FAILED(ddrval))
- {
- goto out;
+ goto errout;
+ } else {
+ write_log("DDRAW: Secondary surface created in video-memory\n");
}
-#endif
}
-out:
DirectDraw_ClearSurfaces ();
+errout:
return ddrval;
}
{
int result = 0;
- switch( DirectDrawState.surface_type = try_surface_locks( wantfull ) )
+ switch(DirectDrawState.surface_type = try_surface_locks(wantfull))
{
case invalid_surface:
case lockable_surface:
DirectDrawState.lockable.lpdesc = NULL;
DirectDrawState.lockable.surface = NULL;
DirectDrawState.lockable.surface = NULL;
- write_log( "set_ddraw: Couldn't lock primary, and no secondary available.\n" );
+ write_log("set_ddraw: Couldn't lock primary, and no secondary available.\n");
break;
case primary_surface:
DirectDrawState.lockable.lpdesc = &DirectDrawState.primary.desc;
break;
}
- if( DirectDrawState.lockable.surface )
+ if(DirectDrawState.lockable.surface)
DirectDraw_SurfaceUnlock();
return result;
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_SetClipper( HWND hWnd )
+HRESULT DirectDraw_SetClipper(HWND hWnd)
{
HRESULT ddrval;
- ddrval = IDirectDrawSurface7_SetClipper( DirectDrawState.primary.surface,
- hWnd ? DirectDrawState.lpDDC : NULL );
- if( hWnd && SUCCEEDED(ddrval))
- {
- ddrval = IDirectDrawClipper_SetHWnd( DirectDrawState.lpDDC, 0, hWnd );
- }
+ ddrval = IDirectDrawSurface7_SetClipper(DirectDrawState.primary.surface,
+ hWnd ? DirectDrawState.lpDDC : NULL);
+ if(hWnd && SUCCEEDED(ddrval))
+ ddrval = IDirectDrawClipper_SetHWnd(DirectDrawState.lpDDC, 0, hWnd);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_GetClipList( LPRGNDATA cliplist, LPDWORD size )
+HRESULT DirectDraw_GetClipList(LPRGNDATA cliplist, LPDWORD size)
{
HRESULT ddrval;
- ddrval = IDirectDrawClipper_GetClipList( DirectDrawState.lpDDC, NULL, cliplist, size );
+ ddrval = IDirectDrawClipper_GetClipList(DirectDrawState.lpDDC, NULL, cliplist, size);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-BYTE DirectDraw_GetBytesPerPixel( void )
+BYTE DirectDraw_GetBytesPerPixel(void)
{
int bpp;
- bpp = ( DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRGBBitCount + 7 ) >> 3;
+ bpp = (DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRGBBitCount + 7) >> 3;
return bpp;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_SetPalette( int remove )
+HRESULT DirectDraw_SetPalette(int remove)
{
HRESULT ddrval;
if (DirectDrawState.primary.surface == NULL)
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_CreatePalette( LPPALETTEENTRY pal )
+HRESULT DirectDraw_CreatePalette(LPPALETTEENTRY pal)
{
HRESULT ddrval;
- ddrval = IDirectDraw_CreatePalette( DirectDrawState.directdraw.dd,
+ ddrval = IDirectDraw_CreatePalette(DirectDrawState.directdraw.dd,
DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &DirectDrawState.lpDDP, NULL);
if(SUCCEEDED(ddrval))
- {
- ddrval = DirectDraw_SetPalette(0);
- }
+ ddrval = DirectDraw_SetPalette(0);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_SetPaletteEntries( int start, int count, PALETTEENTRY *palette )
+HRESULT DirectDraw_SetPaletteEntries(int start, int count, PALETTEENTRY *palette)
{
HRESULT ddrval = DDERR_NOPALETTEATTACHED;
- if( DirectDrawState.lpDDP )
- ddrval = IDirectDrawPalette_SetEntries( DirectDrawState.lpDDP, 0, start, count, palette );
+ if(DirectDrawState.lpDDP)
+ ddrval = IDirectDrawPalette_SetEntries(DirectDrawState.lpDDP, 0, start, count, palette);
return ddrval;
}
* 1999.08.02 Brian King Creation
*
*/
-RGBFTYPE DirectDraw_GetSurfacePixelFormat( LPDDSURFACEDESC2 surface )
+RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface)
{
int surface_is = 0;
DDPIXELFORMAT *pfp = NULL;
break;
default:
- write_log ("Unknown %d bit format %d %d %d\n", pfp->dwRGBBitCount, r, g, b); /* %%% - BERND, and here too... */
+ write_log ("Unknown %d bit format %d %d %d\n", pfp->dwRGBBitCount, r, g, b);
break;
}
return RGBFB_NONE;
* 1999.08.02 Brian King Creation
*
*/
-RGBFTYPE DirectDraw_GetPixelFormat( void )
+RGBFTYPE DirectDraw_GetPixelFormat(void)
{
RGBFTYPE type;
- if( DirectDrawState.lockable.lpdesc )
- type = DirectDraw_GetSurfacePixelFormat( DirectDrawState.lockable.lpdesc );
+ if(DirectDrawState.lockable.lpdesc)
+ type = DirectDraw_GetSurfacePixelFormat(DirectDrawState.lockable.lpdesc);
else
- type = DirectDraw_GetSurfacePixelFormat( &DirectDrawState.current.desc );
+ type = DirectDraw_GetSurfacePixelFormat(&DirectDrawState.current.desc);
return type;
}
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_CurrentWidth( void )
+DWORD DirectDraw_CurrentWidth(void)
{
DWORD width;
width = DirectDrawState.current.desc.dwWidth;
* 1999.08.02 Brian King Creation
*
*/
-DWORD DirectDraw_CurrentHeight( void )
+DWORD DirectDraw_CurrentHeight(void)
{
DWORD height;
height = DirectDrawState.current.desc.dwHeight;
return status;
}
-DWORD DirectDraw_CurrentRefreshRate( void )
+DWORD DirectDraw_CurrentRefreshRate(void)
{
DWORD height;
height = DirectDrawState.current.desc.dwRefreshRate;
int result = 0;
HRESULT ddrval;
- while(FAILED(ddrval = IDirectDrawSurface7_BltFast( dstsurf, x, y, srcsurf, srcrect, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT )))
- {
- if (ddrval == DDERR_SURFACELOST)
- {
- ddrval = restoresurface ( dstsurf );
+ while(FAILED(ddrval = IDirectDrawSurface7_BltFast(dstsurf, x, y, srcsurf, srcrect, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT))) {
+ if (ddrval == DDERR_SURFACELOST) {
+ ddrval = restoresurface (dstsurf);
if (FAILED(ddrval))
break;
- }
- else if (ddrval != DDERR_SURFACEBUSY)
- {
+ } else if (ddrval != DDERR_SURFACEBUSY) {
write_log("BltFastStub7(): DirectDrawSURFACE7_BltFast() failed with %s\n", DXError (ddrval));
break;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_BltFast( surface_type_e dsttype, DWORD left, DWORD top, surface_type_e srctype, LPRECT srcrect )
+HRESULT DirectDraw_BltFast(surface_type_e dsttype, DWORD left, DWORD top, surface_type_e srctype, LPRECT srcrect)
{
LPDIRECTDRAWSURFACE7 lpDDS4_dst, lpDDS4_src;
- if( dsttype == primary_surface )
- {
+ if(dsttype == primary_surface) {
lpDDS4_dst = DirectDrawState.primary.surface;
- }
- else if (dsttype == temporary_surface)
- {
+ } else if (dsttype == temporary_surface) {
lpDDS4_dst = DirectDrawState.temporary.surface;
- }
- else
- {
+ } else {
lpDDS4_dst = DirectDrawState.secondary.surface;
}
- if( srctype == primary_surface )
- {
+ if(srctype == primary_surface) {
lpDDS4_src = DirectDrawState.primary.surface;
- }
- else if (srctype == temporary_surface)
- {
+ } else if (srctype == temporary_surface) {
lpDDS4_src = DirectDrawState.temporary.surface;
- }
- else
- {
+ } else {
lpDDS4_src = DirectDrawState.secondary.surface;
}
- return DirectDraw_BltFastStub4( lpDDS4_dst, left, top, lpDDS4_src, srcrect );
+ return DirectDraw_BltFastStub4(lpDDS4_dst, left, top, lpDDS4_src, srcrect);
}
/*
int result = 0, errcnt = 0;
HRESULT ddrval;
- while(FAILED(ddrval = IDirectDrawSurface7_Blt(dstsurf, dstrect, srcsurf, srcrect, flags, ddbltfx)))
- {
- if (ddrval == DDERR_SURFACELOST)
- {
+ while(FAILED(ddrval = IDirectDrawSurface7_Blt(dstsurf, dstrect, srcsurf, srcrect, flags, ddbltfx))) {
+ if (ddrval == DDERR_SURFACELOST) {
if (errcnt > 10)
return 1;
errcnt++;
- ddrval = restoresurface ( dstsurf );
- if (FAILED(ddrval))
- {
+ ddrval = restoresurface (dstsurf);
+ if (FAILED(ddrval)) {
break;
}
- }
- else if (ddrval != DDERR_SURFACEBUSY)
- {
+ } else if (ddrval != DDERR_SURFACEBUSY) {
write_log("BltStub(): DirectDrawSURFACE7_Blt() failed with %s\n", DXError (ddrval));
break;
}
{
LPDIRECTDRAWSURFACE7 lpDDS4_dst, lpDDS4_src;
- if( dsttype == primary_surface )
- {
- if( DirectDrawState.isoverlay )
+ if(dsttype == primary_surface) {
+ if(DirectDrawState.isoverlay)
lpDDS4_dst = DirectDrawState.overlay.surface;
else
lpDDS4_dst = DirectDrawState.primary.surface;
- }
- else if( dsttype == secondary_surface )
- {
+ } else if(dsttype == secondary_surface) {
lpDDS4_dst = DirectDrawState.secondary.surface;
- }
- else if( dsttype == tertiary_surface )
- {
+ } else if(dsttype == tertiary_surface) {
lpDDS4_dst = DirectDrawState.tertiary.surface;
- }
- else if( dsttype == temporary_surface )
- {
+ } else if(dsttype == temporary_surface) {
lpDDS4_dst = DirectDrawState.temporary.surface;
- }
- else
- {
+ } else {
lpDDS4_dst = DirectDrawState.overlay.surface;
}
- if( srctype == primary_surface )
- {
+ if(srctype == primary_surface) {
lpDDS4_src = DirectDrawState.primary.surface;
- }
- else if( srctype == secondary_surface )
- {
+ } else if(srctype == secondary_surface) {
lpDDS4_src = DirectDrawState.secondary.surface;
- }
- else if( srctype == tertiary_surface )
- {
+ } else if(srctype == tertiary_surface) {
lpDDS4_src = DirectDrawState.tertiary.surface;
- }
- else if( srctype == temporary_surface )
- {
+ } else if(srctype == temporary_surface) {
lpDDS4_src = DirectDrawState.temporary.surface;
- }
- else if( srctype == overlay_surface )
- {
+ } else if(srctype == overlay_surface) {
lpDDS4_src = DirectDrawState.overlay.surface;
- }
- else
- {
+ } else {
lpDDS4_src = NULL; /* For using BltStub to do rect-fills */
}
return DirectDraw_BltStub(lpDDS4_dst, dstrect, lpDDS4_src, srcrect, flags, fx);
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_WaitForVerticalBlank( DWORD flags )
+HRESULT DirectDraw_WaitForVerticalBlank(DWORD flags)
{
HRESULT result;
- result = IDirectDraw7_WaitForVerticalBlank( DirectDrawState.directdraw.dd, flags, NULL );
+ result = IDirectDraw7_WaitForVerticalBlank(DirectDrawState.directdraw.dd, flags, NULL);
return result;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_EnumDisplayModes( DWORD flags, LPDDENUMMODESCALLBACK2 callback )
+HRESULT DirectDraw_EnumDisplayModes(DWORD flags, LPDDENUMMODESCALLBACK2 callback)
{
HRESULT result;
- result = IDirectDraw7_EnumDisplayModes( DirectDrawState.directdraw.dd, flags, NULL, NULL, callback );
+ result = IDirectDraw7_EnumDisplayModes(DirectDrawState.directdraw.dd, flags, NULL, NULL, callback);
return result;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_FlipToGDISurface( void )
+HRESULT DirectDraw_FlipToGDISurface(void)
{
HRESULT result = DDERR_GENERIC;
- if( DirectDrawState.initialized )
- {
- result = IDirectDraw7_FlipToGDISurface( DirectDrawState.directdraw.dd );
+ if(DirectDrawState.initialized) {
+ result = IDirectDraw7_FlipToGDISurface(DirectDrawState.directdraw.dd);
}
return result;
}
* 1999.08.02 Brian King Creation
*
*/
-HRESULT DirectDraw_GetDC( HDC *hdc, surface_type_e surface )
+HRESULT DirectDraw_GetDC(HDC *hdc, surface_type_e surface)
{
HRESULT result = ~DD_OK;
- if( surface == primary_surface )
+ if(surface == primary_surface)
result = IDirectDrawSurface7_GetDC (DirectDrawState.primary.surface, hdc);
else if (surface == overlay_surface)
result = IDirectDrawSurface7_GetDC (DirectDrawState.overlay.surface, hdc);