⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dxfile.pas

📁 3D GameStudio 的Delphi开发包
💻 PAS
📖 第 1 页 / 共 3 页
字号:
{******************************************************************************}
{*                                                                            *}
{*  Copyright (C) 1999 Microsoft Corporation.  All Rights Reserved.           *}
{*                                                                            *}
{*  File:       dxfile.h, rmxfguid.h, rmxftmpl.h                              *}
{*  Content:    Interfaces to access Rendermorthics eXtensible file format    *}
{*                                                                            *}
{*  DirectX 9.0 Delphi / FreePascal adaptation by Alexey Barkovoy             *}
{*  E-Mail: directx@clootie.ru                                                *}
{*                                                                            *}
{*  Modified: 10-Dec-2002                                                     *}
{*                                                                            *}
{*  Partly based upon :                                                       *}
{*    DirectX 7.0 Delphi adaptation by                                        *}
{*      Erik Unger, e-Mail: DelphiDirectX@next-reality.com                    *}
{*                                                                            *}
{*  Latest version can be downloaded from:                                    *}
{*    http://clootie.ru                                                       *}
{*    http://sourceforge.net/projects/delphi-dx9sdk                           *}
{*                                                                            *}
{*  This File contains interfaces to access Rendermorthics eXtensible file    *}
{*  known as 'X-file'. Also this file contains GUID's and templates from      *}
{*  Direct3D Retained mode "rmxfguid.h" and "rmxftmpl.h" (they are used by    *}
{*  Direct3D8 Immediate mode samples).                                        *}
{*                                                                            *}
{******************************************************************************}
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{                                                                              }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{                                                                              }
{******************************************************************************}

{$I DirectX.inc}

unit DXFile;

interface

(*$HPPEMIT '#include "dxfile.h"'{*)
(*$HPPEMIT '#include "rmxfguid.h"'{*)
(*$HPPEMIT '#include "rmxftmpl.h"'{*)

uses Windows;

(***************************************************************************
{*
{*  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
{*
{*  File:       dxfile.h
{*
{*  Content:    DirectX File public header file
{*
{***************************************************************************)

type
  DXFILEFORMAT = DWORD;
  {$EXTERNALSYM DXFILEFORMAT}
  TDXFileFormat = DXFILEFORMAT;

const
  DXFILEFORMAT_BINARY     = 0;
  {$EXTERNALSYM DXFILEFORMAT_BINARY}
  DXFILEFORMAT_TEXT       = 1;
  {$EXTERNALSYM DXFILEFORMAT_TEXT}
  DXFILEFORMAT_COMPRESSED = 2;
  {$EXTERNALSYM DXFILEFORMAT_COMPRESSED}

type
  DXFILELOADOPTIONS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  {$EXTERNALSYM DXFILELOADOPTIONS}
  TDXFileLoadOptions = DXFILELOADOPTIONS;

const
  DXFILELOAD_FROMFILE           = $00;
  {$EXTERNALSYM DXFILELOAD_FROMFILE}
  DXFILELOAD_FROMRESOURCE       = $01;
  {$EXTERNALSYM DXFILELOAD_FROMRESOURCE}
  DXFILELOAD_FROMMEMORY         = $02;
  {$EXTERNALSYM DXFILELOAD_FROMMEMORY}
  DXFILELOAD_FROMSTREAM         = $04;
  {$EXTERNALSYM DXFILELOAD_FROMSTREAM}
  DXFILELOAD_FROMURL            = $08;
  {$EXTERNALSYM DXFILELOAD_FROMURL}

type
  PDXFileLoadResource = ^TDXFileLoadResource;
  _DXFILELOADRESOURCE = packed record
    hModule: HModule;
    lpName: PChar;
    lpType: PChar;
  end;
  {$EXTERNALSYM _DXFILELOADRESOURCE}
  DXFILELOADRESOURCE = _DXFILELOADRESOURCE;
  {$EXTERNALSYM DXFILELOADRESOURCE}
  TDXFileLoadResource = _DXFILELOADRESOURCE;

  PDXFileLoadMemory = ^TDXFileLoadMemory;
  _DXFILELOADMEMORY = packed record
    lpMemory: Pointer;
    dSize: DWord;
  end;
  {$EXTERNALSYM _DXFILELOADMEMORY}
  DXFILELOADMEMORY = _DXFILELOADMEMORY;
  {$EXTERNALSYM DXFILELOADMEMORY}
  TDXFileLoadMemory = _DXFILELOADMEMORY;

(*
{* DirectX File object types.
{*)

type
  IDirectXFile = interface;
  {$EXTERNALSYM IDirectXFile}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFile> _di_IDirectXFile;'}
  IDirectXFileEnumObject = interface;
  {$EXTERNALSYM IDirectXFileEnumObject}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileEnumObject> _di_IDirectXFileEnumObject;'}
  IDirectXFileSaveObject = interface;
  {$EXTERNALSYM IDirectXFileSaveObject}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileSaveObject> _di_IDirectXFileSaveObject;'}
  IDirectXFileObject = interface;
  {$EXTERNALSYM IDirectXFileObject}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileObject> _di_IDirectXFileObject;'}
  IDirectXFileData = interface;
  {$EXTERNALSYM IDirectXFileData}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileData> _di_IDirectXFileData;'}
  IDirectXFileDataReference = interface;
  {$EXTERNALSYM IDirectXFileDataReference}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileDataReference> _di_IDirectXFileDataReference;'}
  IDirectXFileBinary = interface;
  {$EXTERNALSYM IDirectXFileBinary}
  {$HPPEMIT 'typedef System::DelphiInterface<IDirectXFileBinary> _di_IDirectXFileBinary;'}

(*
{* DirectX File interfaces.
{*)

  IDirectXFile = interface(IUnknown)
    ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
    function CreateEnumObject (pvSource: Pointer;
        dwLoadOptions: TDXFileLoadOptions;
        var ppEnumObj: IDirectXFileEnumObject): HResult; stdcall;
    function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
        var ppSaveObj: IDirectXFileSaveObject): HResult; stdcall;
    function RegisterTemplates (pvData: Pointer; cbSize: DWORD): HResult; stdcall;
  end;

  IDirectXFileEnumObject = interface (IUnknown)
    ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
    function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
    function GetDataObjectById
        (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
    function GetDataObjectByName
        (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  end;

  IDirectXFileSaveObject = interface (IUnknown)
    ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
    function SaveTemplates
        (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
    function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
        pguid: PGUID; cbSize: DWORD; pvData: Pointer;
        var ppDataObj: IDirectXFileData) : HResult; stdcall;
    function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
  end;

  IDirectXFileObject = interface (IUnknown)
    ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
    function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
    function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
  end;

  IDirectXFileData = interface (IDirectXFileObject)
    ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
    function GetData
        (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
    function GetType (var ppguid: PGUID) : HResult; stdcall;
    function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
    function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
    function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
    function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
        pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  end;

  IDirectXFileDataReference = interface (IDirectXFileObject)
    ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
    function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  end;

  IDirectXFileBinary = interface (IDirectXFileObject)
    ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
    function GetSize (var pcbSize: DWORD) : HResult; stdcall;
    function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
    function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
  end;


(*
{* DirectXFile Object Class Id (for CoCreateInstance())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -