Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b742b98c
Commit
b742b98c
authored
Jan 04, 2013
by
Christian Costa
Committed by
Alexandre Julliard
Jan 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9_36: Implement ID3DXFileImpl_RegisterTemplates + tests.
parent
732376d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
6 deletions
+101
-6
xfile.c
dlls/d3dx9_36/tests/xfile.c
+55
-4
xfile.c
dlls/d3dx9_36/xfile.c
+46
-2
No files found.
dlls/d3dx9_36/tests/xfile.c
View file @
b742b98c
...
@@ -20,16 +20,67 @@
...
@@ -20,16 +20,67 @@
#include "d3dx9.h"
#include "d3dx9.h"
#include "d3dx9xof.h"
#include "d3dx9xof.h"
START_TEST
(
xfile
)
char
templates_bad_file_type1
[]
=
"xOf 0302txt 0064
\n
"
;
char
templates_bad_file_version
[]
=
"xof 0102txt 0064
\n
"
;
char
templates_bad_file_type2
[]
=
"xof 0302foo 0064
\n
"
;
char
templates_bad_file_float_size
[]
=
"xof 0302txt 0050
\n
"
;
char
templates_parse_error
[]
=
"xof 0302txt 0064"
"foobar;
\n
"
;
char
templates
[]
=
"xof 0302txt 0064"
"template Header"
"{"
"<3D82AB43-62DA-11CF-AB39-0020AF71E433>"
"WORD major;"
"WORD minor;"
"DWORD flags;"
"}
\n
"
;
void
test_templates
(
void
)
{
{
ID3DXFile
*
file
;
ID3DXFile
*
d3dx
file
;
HRESULT
ret
;
HRESULT
ret
;
ret
=
D3DXFileCreate
(
NULL
);
ret
=
D3DXFileCreate
(
NULL
);
ok
(
ret
==
E_POINTER
,
"D3DXCreateFile returned %#x, expected %#x
\n
"
,
ret
,
E_POINTER
);
ok
(
ret
==
E_POINTER
,
"D3DXCreateFile returned %#x, expected %#x
\n
"
,
ret
,
E_POINTER
);
ret
=
D3DXFileCreate
(
&
file
);
ret
=
D3DXFileCreate
(
&
d3dx
file
);
ok
(
ret
==
S_OK
,
"D3DXCreateFile failed with %#x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"D3DXCreateFile failed with %#x
\n
"
,
ret
);
file
->
lpVtbl
->
Release
(
file
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates_bad_file_type1
,
(
SIZE_T
)(
sizeof
(
templates_bad_file_type1
)
-
1
));
ok
(
ret
==
D3DXFERR_BADFILETYPE
,
"RegisterTemplates returned %#x, expected %#x
\n
"
,
ret
,
D3DXFERR_BADFILETYPE
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates_bad_file_version
,
(
SIZE_T
)(
sizeof
(
templates_bad_file_version
)
-
1
));
ok
(
ret
==
D3DXFERR_BADFILEVERSION
,
"RegisterTemplates returned %#x, expected %#x
\n
"
,
ret
,
D3DXFERR_BADFILEVERSION
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates_bad_file_type2
,
(
SIZE_T
)(
sizeof
(
templates_bad_file_type2
)
-
1
));
ok
(
ret
==
D3DXFERR_BADFILETYPE
,
"RegisterTemplates returned %#x, expected %#x
\n
"
,
ret
,
D3DXFERR_BADFILETYPE
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates_bad_file_float_size
,
(
SIZE_T
)(
sizeof
(
templates_bad_file_float_size
)
-
1
));
ok
(
ret
==
D3DXFERR_BADFILEFLOATSIZE
,
"RegisterTemplates returned %#x, expected %#x
\n
"
,
ret
,
D3DXFERR_BADFILEFLOATSIZE
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates_parse_error
,
(
SIZE_T
)(
sizeof
(
templates_parse_error
)
-
1
));
todo_wine
ok
(
ret
==
D3DXFERR_PARSEERROR
,
"RegisterTemplates returned %#x, expected %#x
\n
"
,
ret
,
D3DXFERR_PARSEERROR
);
ret
=
d3dxfile
->
lpVtbl
->
RegisterTemplates
(
d3dxfile
,
(
const
void
*
)
templates
,
(
SIZE_T
)(
sizeof
(
templates
)
-
1
));
ok
(
ret
==
S_OK
,
"RegisterTemplates with %#x
\n
"
,
ret
);
d3dxfile
->
lpVtbl
->
Release
(
d3dxfile
);
}
START_TEST
(
xfile
)
{
test_templates
();
}
}
dlls/d3dx9_36/xfile.c
View file @
b742b98c
...
@@ -21,12 +21,33 @@
...
@@ -21,12 +21,33 @@
#include "d3dx9.h"
#include "d3dx9.h"
#include "d3dx9xof.h"
#include "d3dx9xof.h"
#undef MAKE_DDHRESULT
#include "dxfile.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
HRESULT
error_dxfile_to_d3dxfile
(
HRESULT
error
)
{
switch
(
error
)
{
case
DXFILEERR_BADFILETYPE
:
return
D3DXFERR_BADFILETYPE
;
case
DXFILEERR_BADFILEVERSION
:
return
D3DXFERR_BADFILEVERSION
;
case
DXFILEERR_BADFILEFLOATSIZE
:
return
D3DXFERR_BADFILEFLOATSIZE
;
case
DXFILEERR_PARSEERROR
:
return
D3DXFERR_PARSEERROR
;
default:
FIXME
(
"Cannot map error %#x
\n
"
,
error
);
return
E_FAIL
;
}
}
typedef
struct
{
typedef
struct
{
ID3DXFile
ID3DXFile_iface
;
ID3DXFile
ID3DXFile_iface
;
LONG
ref
;
LONG
ref
;
IDirectXFile
*
dxfile
;
}
ID3DXFileImpl
;
}
ID3DXFileImpl
;
...
@@ -75,7 +96,10 @@ static ULONG WINAPI ID3DXFileImpl_Release(ID3DXFile *iface)
...
@@ -75,7 +96,10 @@ static ULONG WINAPI ID3DXFileImpl_Release(ID3DXFile *iface)
TRACE
(
"(%p)->(): new ref %d
\n
"
,
iface
,
ref
);
TRACE
(
"(%p)->(): new ref %d
\n
"
,
iface
,
ref
);
if
(
!
ref
)
if
(
!
ref
)
{
IDirectXFile_Release
(
This
->
dxfile
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
return
ref
;
}
}
...
@@ -101,9 +125,19 @@ static HRESULT WINAPI ID3DXFileImpl_CreateSaveObject(ID3DXFile *iface, const voi
...
@@ -101,9 +125,19 @@ static HRESULT WINAPI ID3DXFileImpl_CreateSaveObject(ID3DXFile *iface, const voi
static
HRESULT
WINAPI
ID3DXFileImpl_RegisterTemplates
(
ID3DXFile
*
iface
,
const
void
*
data
,
SIZE_T
size
)
static
HRESULT
WINAPI
ID3DXFileImpl_RegisterTemplates
(
ID3DXFile
*
iface
,
const
void
*
data
,
SIZE_T
size
)
{
{
FIXME
(
"(%p)->(%p, %lu): stub
\n
"
,
iface
,
data
,
size
);
ID3DXFileImpl
*
This
=
impl_from_ID3DXFile
(
iface
);
HRESULT
ret
;
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p, %lu)
\n
"
,
iface
,
data
,
size
);
ret
=
IDirectXFile_RegisterTemplates
(
This
->
dxfile
,
(
void
*
)
data
,
size
);
if
(
ret
!=
DXFILE_OK
)
{
WARN
(
"Error %#x
\n
"
,
ret
);
return
error_dxfile_to_d3dxfile
(
ret
);
}
return
S_OK
;
}
}
...
@@ -129,6 +163,7 @@ static const ID3DXFileVtbl ID3DXFile_Vtbl =
...
@@ -129,6 +163,7 @@ static const ID3DXFileVtbl ID3DXFile_Vtbl =
HRESULT
WINAPI
D3DXFileCreate
(
ID3DXFile
**
d3dxfile
)
HRESULT
WINAPI
D3DXFileCreate
(
ID3DXFile
**
d3dxfile
)
{
{
ID3DXFileImpl
*
object
;
ID3DXFileImpl
*
object
;
HRESULT
ret
;
TRACE
(
"(%p)
\n
"
,
d3dxfile
);
TRACE
(
"(%p)
\n
"
,
d3dxfile
);
...
@@ -141,6 +176,15 @@ HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
...
@@ -141,6 +176,15 @@ HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
if
(
!
object
)
if
(
!
object
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
ret
=
DirectXFileCreate
(
&
object
->
dxfile
);
if
(
ret
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
object
);
if
(
ret
==
E_OUTOFMEMORY
)
return
ret
;
return
E_FAIL
;
}
object
->
ID3DXFile_iface
.
lpVtbl
=
&
ID3DXFile_Vtbl
;
object
->
ID3DXFile_iface
.
lpVtbl
=
&
ID3DXFile_Vtbl
;
object
->
ref
=
1
;
object
->
ref
=
1
;
...
...
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