d3dxof: Add support for case sensitive legacy type indexColor.
This commit is contained in:
parent
cf2c506b1a
commit
c6106428f6
|
@ -237,7 +237,7 @@ static void test_type_index_color(void)
|
|||
|
||||
/* Test that 'indexColor' can be used (same as IndexedColor in standard templates) and is case sensitive */
|
||||
ret = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, template_using_index_color_lower, sizeof(template_using_index_color_lower) - 1);
|
||||
todo_wine ok(ret == S_OK, "RegisterTemplates failed with %#x\n", ret);
|
||||
ok(ret == S_OK, "RegisterTemplates failed with %#x\n", ret);
|
||||
ret = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, template_using_index_color_upper, sizeof(template_using_index_color_upper) - 1);
|
||||
ok(ret == D3DXFERR_PARSEERROR, "RegisterTemplates returned %#x instead of %#x\n", ret, D3DXFERR_PARSEERROR);
|
||||
|
||||
|
|
|
@ -46,6 +46,9 @@ static HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImp
|
|||
static HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl** ppObj);
|
||||
static HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj);
|
||||
|
||||
#define TOKEN_DWORD 41
|
||||
#define TOKEN_FLOAT 42
|
||||
|
||||
HRESULT IDirectXFileImpl_Create(IUnknown* pUnkOuter, LPVOID* ppObj)
|
||||
{
|
||||
IDirectXFileImpl* object;
|
||||
|
@ -62,6 +65,17 @@ HRESULT IDirectXFileImpl_Create(IUnknown* pUnkOuter, LPVOID* ppObj)
|
|||
object->IDirectXFile_iface.lpVtbl = &IDirectXFile_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
/* Reserve first template to handle the case sensitive legacy type indexColor */
|
||||
object->nb_xtemplates = 1;
|
||||
strcpy(object->xtemplates[0].name, "indexColor");
|
||||
object->xtemplates[0].nb_members = 2;
|
||||
object->xtemplates[0].members[0].type = TOKEN_DWORD;
|
||||
object->xtemplates[0].members[0].nb_dims = 0;
|
||||
object->xtemplates[0].members[1].type = TOKEN_FLOAT;
|
||||
object->xtemplates[0].members[1].nb_dims = 1;
|
||||
object->xtemplates[0].members[1].dim_fixed[0] = TRUE;
|
||||
object->xtemplates[0].members[1].dim_value[0] = 4;
|
||||
|
||||
*ppObj = &object->IDirectXFile_iface;
|
||||
|
||||
return S_OK;
|
||||
|
@ -252,7 +266,7 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
|
|||
{
|
||||
ULONG i;
|
||||
TRACE("Registered templates (%d):\n", This->nb_xtemplates);
|
||||
for (i = 0; i < This->nb_xtemplates; i++)
|
||||
for (i = 1; i < This->nb_xtemplates; i++)
|
||||
DPRINTF("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
|
||||
}
|
||||
|
||||
|
@ -330,7 +344,7 @@ static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates(IDirectXFile* iface, LP
|
|||
{
|
||||
ULONG i;
|
||||
TRACE("Registered templates (%d):\n", This->nb_xtemplates);
|
||||
for (i = 0; i < This->nb_xtemplates; i++)
|
||||
for (i = 1; i < This->nb_xtemplates; i++)
|
||||
DPRINTF("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
|
||||
}
|
||||
|
||||
|
|
|
@ -961,7 +961,14 @@ static BOOL parse_template_members_list(parse_buffer * buf)
|
|||
if (check_TOKEN(buf) == TOKEN_NAME)
|
||||
{
|
||||
cur_member->type = get_TOKEN(buf);
|
||||
if (!strcmp((char*)buf->value, "indexColor"))
|
||||
{
|
||||
/* Case sensitive legacy type indexColor is described in the first template */
|
||||
cur_member->idx_template = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_member->idx_template = 1;
|
||||
while (cur_member->idx_template < buf->pdxf->nb_xtemplates)
|
||||
{
|
||||
if (!strcasecmp((char*)buf->value, buf->pdxf->xtemplates[cur_member->idx_template].name))
|
||||
|
@ -970,10 +977,11 @@ static BOOL parse_template_members_list(parse_buffer * buf)
|
|||
}
|
||||
if (cur_member->idx_template == buf->pdxf->nb_xtemplates)
|
||||
{
|
||||
ERR("Reference to a nonexistent template '%s'\n", (char*)buf->value);
|
||||
WARN("Reference to a nonexistent template '%s'\n", (char*)buf->value);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (is_primitive_type(check_TOKEN(buf)))
|
||||
cur_member->type = get_TOKEN(buf);
|
||||
else
|
||||
|
|
|
@ -1103,7 +1103,7 @@ static void test_type_index_color(void)
|
|||
|
||||
/* Test that 'indexColor' can be used (same as IndexedColor in standard templates) and is case sensitive */
|
||||
ret = IDirectXFile_RegisterTemplates(dxfile, template_using_index_color_lower, sizeof(template_using_index_color_lower) - 1);
|
||||
todo_wine ok(ret == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates failed with %#x\n", ret);
|
||||
ok(ret == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates failed with %#x\n", ret);
|
||||
ret = IDirectXFile_RegisterTemplates(dxfile, template_using_index_color_upper, sizeof(template_using_index_color_upper) - 1);
|
||||
ok(ret == DXFILEERR_PARSEERROR, "IDirectXFileImpl_RegisterTemplates returned %#x instead of %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
|
||||
|
|
Loading…
Reference in New Issue