Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
edd9e8cc
Commit
edd9e8cc
authored
Feb 04, 2010
by
Christian Costa
Committed by
Alexandre Julliard
Feb 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Improve IDirect3DRMMeshBuilderImpl_Load and corresponding test.
parent
aafcf1a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
11 deletions
+71
-11
meshbuilder.c
dlls/d3drm/meshbuilder.c
+46
-2
d3drm.c
dlls/d3drm/tests/d3drm.c
+25
-9
No files found.
dlls/d3drm/meshbuilder.c
View file @
edd9e8cc
...
...
@@ -39,8 +39,15 @@ typedef struct {
LONG
ref
;
}
IDirect3DRMMeshBuilderImpl
;
typedef
struct
{
WORD
major
;
WORD
minor
;
DWORD
flags
;
}
Header
;
static
const
struct
IDirect3DRMMeshBuilderVtbl
Direct3DRMMeshBuilder_Vtbl
;
static
const
GUID
GUID_Header
=
{
0x3D82AB43
,
0x62DA
,
0x11CF
,
{
0xAB
,
0x39
,
0x00
,
0x20
,
0xAF
,
0x71
,
0xE4
,
0x33
}
};
static
const
GUID
GUID_Mesh
=
{
0x3D82AB44
,
0x62DA
,
0x11CF
,
{
0xAB
,
0x39
,
0x00
,
0x20
,
0xAF
,
0x71
,
0xE4
,
0x33
}
};
static
char
templates
[]
=
{
...
...
@@ -408,6 +415,8 @@ static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* if
LPDIRECTXFILEENUMOBJECT
pEnumObject
=
NULL
;
LPDIRECTXFILEDATA
pData
=
NULL
;
const
GUID
*
pGuid
;
DWORD
size
;
Header
*
pHeader
;
HRESULT
hr
;
HRESULT
ret
=
D3DRMERR_BADOBJECT
;
...
...
@@ -431,7 +440,7 @@ static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* if
if
(
hr
!=
DXFILE_OK
)
goto
end
;
hr
=
IDirectXFile_RegisterTemplates
(
pDXFile
,
templates
,
s
izeof
(
templates
));
hr
=
IDirectXFile_RegisterTemplates
(
pDXFile
,
templates
,
s
trlen
(
templates
));
if
(
hr
!=
DXFILE_OK
)
goto
end
;
...
...
@@ -449,12 +458,47 @@ static HRESULT WINAPI IDirect3DRMMeshBuilderImpl_Load(IDirect3DRMMeshBuilder* if
TRACE
(
"Found object type whose GUID = %s
\n
"
,
debugstr_guid
(
pGuid
));
if
(
!
IsEqualGUID
(
pGuid
,
&
GUID_
Mesh
))
if
(
!
IsEqualGUID
(
pGuid
,
&
GUID_
Header
))
{
ret
=
D3DRMERR_BADFILE
;
goto
end
;
}
hr
=
IDirectXFileData_GetData
(
pData
,
NULL
,
&
size
,
(
void
**
)
&
pHeader
);
if
((
hr
!=
DXFILE_OK
)
||
(
size
!=
sizeof
(
Header
)))
goto
end
;
TRACE
(
"Version is %d %d %d
\n
"
,
pHeader
->
major
,
pHeader
->
minor
,
pHeader
->
flags
);
/* Version must be 1.0.x */
if
((
pHeader
->
major
!=
1
)
||
(
pHeader
->
minor
!=
0
))
{
ret
=
D3DRMERR_BADFILE
;
goto
end
;
}
IDirectXFileData_Release
(
pData
);
pData
=
NULL
;
hr
=
IDirectXFileEnumObject_GetNextDataObject
(
pEnumObject
,
&
pData
);
if
(
hr
!=
DXFILE_OK
)
{
ret
=
D3DRMERR_NOTFOUND
;
goto
end
;
}
hr
=
IDirectXFileData_GetType
(
pData
,
&
pGuid
);
if
(
hr
!=
DXFILE_OK
)
goto
end
;
TRACE
(
"Found object type whose GUID = %s
\n
"
,
debugstr_guid
(
pGuid
));
if
(
!
IsEqualGUID
(
pGuid
,
&
GUID_Mesh
))
{
ret
=
D3DRMERR_NOTFOUND
;
goto
end
;
}
ret
=
D3DRM_OK
;
end:
...
...
dlls/d3drm/tests/d3drm.c
View file @
edd9e8cc
...
...
@@ -47,19 +47,30 @@ static BOOL InitFunctionPtrs(void)
return
TRUE
;
}
char
data_
ok
[]
=
char
data_
bad_version
[]
=
"xof 0302txt 0064
\n
"
"
Mesh
Object
\n
"
"
Header
Object
\n
"
"{
\n
"
"0;
\n
"
"0;
\n
"
"1; 2; 3;
\n
"
"}
\n
"
;
char
data_
bad
[]
=
char
data_
no_mesh
[]
=
"xof 0302txt 0064
\n
"
"Header Object
\n
"
"{
\n
"
"1; 2; 3;
\n
"
"1; 0; 1;
\n
"
"}
\n
"
;
char
data_ok
[]
=
"xof 0302txt 0064
\n
"
"Header Object
\n
"
"{
\n
"
"1; 0; 1;
\n
"
"}
\n
"
"Mesh Object
\n
"
"{
\n
"
"0;
\n
"
"0;
\n
"
"}
\n
"
;
static
void
MeshBuilderTest
(
void
)
...
...
@@ -75,13 +86,18 @@ static void MeshBuilderTest(void)
hr
=
IDirect3DRM_CreateMeshBuilder
(
pD3DRM
,
&
pMeshBuilder
);
ok
(
hr
==
D3DRM_OK
,
"Cannot get IDirect3DRMMeshBuilder interface (hr = %x)
\n
"
,
hr
);
info
.
lpMemory
=
data_bad
;
info
.
dSize
=
s
izeof
(
data_bad
);
info
.
lpMemory
=
data_bad
_version
;
info
.
dSize
=
s
trlen
(
data_bad_version
);
hr
=
IDirect3DRMMeshBuilder_Load
(
pMeshBuilder
,
&
info
,
NULL
,
D3DRMLOAD_FROMMEMORY
,
NULL
,
NULL
);
ok
(
hr
==
D3DRMERR_BADFILE
,
"Sould have returned D3DRMERR_BADFILE (hr = %x)
\n
"
,
hr
);
info
.
lpMemory
=
data_no_mesh
;
info
.
dSize
=
strlen
(
data_no_mesh
);
hr
=
IDirect3DRMMeshBuilder_Load
(
pMeshBuilder
,
&
info
,
NULL
,
D3DRMLOAD_FROMMEMORY
,
NULL
,
NULL
);
ok
(
hr
==
D3DRMERR_NOTFOUND
,
"Sould have returned D3DRMERR_NOTFOUND (hr = %x)
\n
"
,
hr
);
info
.
lpMemory
=
data_ok
;
info
.
dSize
=
s
izeof
(
data_ok
);
info
.
dSize
=
s
trlen
(
data_ok
);
hr
=
IDirect3DRMMeshBuilder_Load
(
pMeshBuilder
,
&
info
,
NULL
,
D3DRMLOAD_FROMMEMORY
,
NULL
,
NULL
);
ok
(
hr
==
D3DRM_OK
,
"Cannot load mesh data (hr = %x)
\n
"
,
hr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment