d3dxof: Allow template definitions in objects file.

This commit is contained in:
Christian Costa 2008-11-09 11:09:07 +01:00 committed by Alexandre Julliard
parent e0b91a7aa7
commit 35cc5504eb
1 changed files with 26 additions and 0 deletions

View File

@ -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_parts(parse_buffer * buf, BOOL allow_optional);
static BOOL parse_object(parse_buffer * buf); static BOOL parse_object(parse_buffer * buf);
static const char* get_primitive_string(WORD token); 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) static void dump_template(xtemplate* templates_array, xtemplate* ptemplate)
{ {
@ -318,6 +320,30 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
*ppEnumObj = (LPDIRECTXFILEENUMOBJECT)object; *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; return DXFILE_OK;
error: error: