Christian Costa : d3dxof: Allow template definitions in objects file.

Alexandre Julliard julliard at winehq.org
Mon Nov 10 07:43:53 CST 2008


Module: wine
Branch: master
Commit: 35cc5504eb3c26b15e6fab69586b3888b803bcf2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=35cc5504eb3c26b15e6fab69586b3888b803bcf2

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Sun Nov  9 11:09:07 2008 +0100

d3dxof: Allow template definitions in objects file.

---

 dlls/d3dxof/d3dxof.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c
index ca4eb73..058f831 100644
--- a/dlls/d3dxof/d3dxof.c
+++ b/dlls/d3dxof/d3dxof.c
@@ -93,6 +93,8 @@ static const struct IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl;
 static BOOL parse_object_parts(parse_buffer * buf, BOOL allow_optional);
 static BOOL parse_object(parse_buffer * buf);
 static const char* get_primitive_string(WORD token);
+static WORD check_TOKEN(parse_buffer * buf);
+static BOOL parse_template(parse_buffer * buf);
 
 static void dump_template(xtemplate* templates_array, xtemplate* ptemplate)
 {
@@ -318,6 +320,30 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
 
   *ppEnumObj = (LPDIRECTXFILEENUMOBJECT)object;
 
+  while (object->buf.rem_bytes && (check_TOKEN(&object->buf) == TOKEN_TEMPLATE))
+  {
+    if (!parse_template(&object->buf))
+    {
+      TRACE("Template is not correct\n");
+      hr = DXFILEERR_BADVALUE;
+      goto error;
+    }
+    else
+    {
+      TRACE("Template successfully parsed:\n");
+      if (TRACE_ON(d3dxof))
+        dump_template(This->xtemplates, &This->xtemplates[This->nb_xtemplates - 1]);
+    }
+  }
+
+  if (TRACE_ON(d3dxof))
+  {
+    int i;
+    TRACE("Registered templates (%d):\n", This->nb_xtemplates);
+    for (i = 0; i < This->nb_xtemplates; i++)
+      DPRINTF("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
+  }
+
   return DXFILE_OK;
 
 error:




More information about the wine-cvs mailing list