DX9 Summer 2003 SDK Sample Framework Changes

Hey, this text is really obsolete! Who cares about 2003 Sep SDK now? :)

What?

DX9 SDK Summer Update (2003 Sep) changes to "sample framework" code. I've just thrown old code into CVS, and diff'ed new one on that. There are very big chances that I've missed something here.

New files

dxstdafx.cpp and dxstdafx.h - these are just common includes for precompiled headers.

The changes

These are scary! I've tried to bold the "serious" changes (like stuff added/removed). Usually these are in header files.

  • d3dapp.h
    • new: HRESULT LaunchReadme()
    • new: bool m_bCreateMultithreadDevice
    • new: bool m_bAllowDialogBoxMode
    • BuildPresentParamsFromSettings() became virtual
  • d3dapp.cpp
    • Includes replaced by common include file
    • Incorrect comments appeared at Create() :)
    • Create(): pass false to AdjustWindowRect() if no menu present
    • ChooseInitialD3DSettings(): m_d3dSettings.SetDeviceClip( false );
    • More comments at MsgProc()
    • MsgProc(), WM_PAINT: remove m_bWindowed from if; catch device lost on Present().
    • MsgProc(): IDM_HELP handler added.
    • HandlePossibleSizeChange(): set Windowed_Width and Windowed_Height.
    • HandlePossibleSizeChange(): check for device loss after Reset3DEnvironment().
    • More comments at Initialize3DEnvironment()
    • Initialize3DEnvironment(): Added multithreaded option.
    • BuildPresentParamsFromSettings(): Added device clip option. Use Windowed_Width and Windowed_Height in windowed case. Added code to allow dialog boxes in fullscreen case.
    • More comments at Reset3DEnvironment()
    • ToggleFullscreen(): Added GetClientRect( m_hWnd, &m_rcWindowClient ) at end.
    • UserSelectNewDevice(): Added bool bDialogBoxMode and bOldWindowed. Bunch of code for dialog boxes in fullscreen case instead of just ToggleFullscreen().
    • More comments at Run()
    • Run(): remember HRESULT of Render3DEnvironment().
    • More comments at Render3DEnvironment()
    • Render3DEnvironment(): Display error instead of returning HRESULT if Reset3DEnvironment() fails. Added m_fElapsedTime = fElapsedAppTime; as else case just before Render().
    • DisplayErrorMsg(): Change HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) to 0x80070002.
    • LaunchReadme() added.
  • d3denumeration.h
    • new: IDirect3D9* CD3DEnumeration::GetD3D()
  • d3denumeration.cpp
    • Includes replaced by common include file
  • d3dfile.h
    • new: HRESULT CD3DMesh::SetVertexDecl()
    • Const-ified lots of strings: CD3DMesh: Create(), CD3DMesh(); CD3DFrame: FindMesh(), FindFrame(), CD3DFrame(); CD3DFile: Create(), CreateFromResource().
  • d3dfile.cpp
    • Includes replaced by common include file
    • CD3DMesh::SetVertexDecl() added.
    • Changes due to const-ified strings in header file.
    • CD3DMesh::RestoreDeviceObjects(): pass D3DXMESH_MANAGED to CloneMeshFVF().
  • d3dfont.cpp
    • Includes replaced by common include file
  • d3dres.h
    • new: IDC_DEVICECLIP_CHECK
    • new: IDM_HELP
  • d3dsaver.h
    • Const-ify string in ParseCommandLine().
  • d3dsaver.cpp
    • SwitchToRenderUnit(): added "&& !m_bErrorMode" to if before "store rendertarget surface desc".
    • Render3DEnvironment(): at end of render units loop, Render() only if( !m_bErrorMode ). Present() everything only if( !m_bErrorMode ).
  • d3dsettings.h
    • new: bool CD3DSettings::bDeviceClip;, plus setter method.
    • Const-ify strings in ComboBoxAdd() and ComboBoxContainsText().
    • new: void CD3DSettingsDialog::DeviceClipChanged();
  • d3dsettings.cpp
    • Includes replaced by common include file
    • Const-ify strings in ComboBoxAdd() and ComboBoxContainsText().
    • DialogProc(): added handler for IDC_DEVICECLIP_CHECK.
    • AdapterChanged(): add code to if( m_d3dSettings.IsWindowed ) - starts at "// Set the windowed".
    • WindowedFullscreenChanged(): update device clip checkbox.
    • AdapterFormatChanged(): add bool bHasWindowedBackbuffer before combos loop. Add code at end of combos loop (starts at "// Count the number"). Add code after combos loop - "if(!bHasWindowedBackbuffer)" statement.
    • DeviceClipChanged(); added.
  • d3dutil.h
    • removed: D3DUtil_InitMaterial()
    • removed: D3DUtil_InitLight()
    • removed: D3DUtil_CreateTexture()
    • Const-ify return strings in D3DUtil_D3DFormatToString().
    • Lots of shuffles, member renames to CD3DArcBall. Too numerous to track them down :)
    • new: enum D3DUtil_CameraKeys, plus defines after it.
    • CD3DCamera refactored into CBaseCamera, CFirstPersonCamera and CModelViewCamera. Lots of changes here.
  • d3dutil.cpp
    Lots of changes, see header file above.
  • ddutil.h
    • Const-ify strings in CreateSurfaceFromBitmap(), DrawBitmap() and DrawText().
  • ddutil.cpp
    • Does not have const-ified versions that are in header file. A bug?
  • didevimg.h and didevimg.cpp
    • Const-ify string in DrawTooltip().
  • diutil.cpp
    • AddDevice(): move "if(m_AddDeviceCallback)" after SetActionMap().
  • dmutil.h and dmutil.cpp
    • Const-ify lots of strings.
  • dsutil.cpp
    • Replace SAFE_DELETE(apDSBuffer) with SAFE_DELETE_ARRAY(apDSBuffer).
  • dxutil.h and dxutil.cpp
    • Const-ify lots of strings.
    • DXUtil_FindMediaFileCch(): lots of additional logic.
    • DXUtil_ReadStringRegKeyCch(), DXUtil_ReadIntRegKey(), DXUtil_ReadBoolRegKey(), DXUtil_ReadGuidlRegKey(): return S_FALSE instead of E_FAIL. Copy default value.
    • new: DXUtil_ReadFloatRegKey(), DXUtil_WriteFloatRegKey()
    • DXUtil_LaunchReadme(): lots of additional logic.
  • netclient.h
    • new: #define MAX_PLAYER_NAME 14
    • Const-ify strings in CNetClientWizard() and SetPlayerName().
  • netclient.cpp
    • Const-ify strings in CNetClientWizard() and SetPlayerName().
    • Limit player name size (MAX_PLAYER_NAME instead of MAX_PATH).
  • netconnect.h and netconnect.cpp
    • new: #define MAX_PLAYER_NAME 14
    • Const-ify strings in CNetConnectWizard(), SetPlayerName(), SetSessionName() and SetPreferredProvider().
    • Limit player name size (MAX_PLAYER_NAME instead of MAX_PATH).
  • SessionInfo.h and netconnect.cpp
    • Const-ify string in AddMessage().
    • Add some (ULONGLONG) and (DWORD) casts.