Index: ddraw/glDirect3DMaterial.cpp |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 |
|
25 | 25 | glDirect3DMaterial3::glDirect3DMaterial3()
|
26 | 26 | {
|
| 27 | + TRACE_ENTER(1,14,this);
|
27 | 28 | device = NULL;
|
28 | 29 | current = FALSE;
|
29 | 30 | refcount = 1;
|
— | — | @@ -36,27 +37,35 @@ |
37 | 38 | handle = 0;
|
38 | 39 | glD3DM2 = NULL;
|
39 | 40 | glD3DM1 = NULL;
|
| 41 | + TRACE_EXIT(-1,0);
|
40 | 42 | }
|
41 | 43 |
|
42 | 44 | glDirect3DMaterial3::~glDirect3DMaterial3()
|
43 | 45 | {
|
| 46 | + TRACE_ENTER(1,14,this);
|
44 | 47 | if(device) device->Release();
|
| 48 | + TRACE_EXIT(-1,0);
|
45 | 49 | }
|
46 | 50 |
|
47 | 51 | HRESULT WINAPI glDirect3DMaterial3::QueryInterface(REFIID riid, void** ppvObj)
|
48 | 52 | {
|
49 | | - if(!this) return DDERR_INVALIDOBJECT;
|
| 53 | + TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
|
| 54 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
50 | 55 | if(riid == IID_IUnknown)
|
51 | 56 | {
|
52 | 57 | this->AddRef();
|
53 | 58 | *ppvObj = this;
|
54 | | - return DD_OK;
|
| 59 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 60 | + TRACE_EXIT(23,D3D_OK);
|
| 61 | + return D3D_OK;
|
55 | 62 | }
|
56 | 63 | if(riid == IID_IDirect3DMaterial3)
|
57 | 64 | {
|
58 | 65 | this->AddRef();
|
59 | 66 | *ppvObj = this;
|
60 | | - return DD_OK;
|
| 67 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 68 | + TRACE_EXIT(23,D3D_OK);
|
| 69 | + return D3D_OK;
|
61 | 70 | }
|
62 | 71 | if(riid == IID_IDirect3DMaterial2)
|
63 | 72 | {
|
— | — | @@ -64,6 +73,8 @@ |
65 | 74 | {
|
66 | 75 | *ppvObj = glD3DM2;
|
67 | 76 | glD3DM2->AddRef();
|
| 77 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 78 | + TRACE_EXIT(23,D3D_OK);
|
68 | 79 | return D3D_OK;
|
69 | 80 | }
|
70 | 81 | else
|
— | — | @@ -71,6 +82,8 @@ |
72 | 83 | this->AddRef();
|
73 | 84 | *ppvObj = new glDirect3DMaterial2(this);
|
74 | 85 | glD3DM2 = (glDirect3DMaterial2*)*ppvObj;
|
| 86 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 87 | + TRACE_EXIT(23,D3D_OK);
|
75 | 88 | return D3D_OK;
|
76 | 89 | }
|
77 | 90 | }
|
— | — | @@ -80,6 +93,8 @@ |
81 | 94 | {
|
82 | 95 | *ppvObj = glD3DM1;
|
83 | 96 | glD3DM1->AddRef();
|
| 97 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 98 | + TRACE_EXIT(23,D3D_OK);
|
84 | 99 | return D3D_OK;
|
85 | 100 | }
|
86 | 101 | else
|
— | — | @@ -87,80 +102,104 @@ |
88 | 103 | this->AddRef();
|
89 | 104 | *ppvObj = new glDirect3DMaterial1(this);
|
90 | 105 | glD3DM1 = (glDirect3DMaterial1*)*ppvObj;
|
| 106 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 107 | + TRACE_EXIT(23,D3D_OK);
|
91 | 108 | return D3D_OK;
|
92 | 109 | }
|
93 | 110 | }
|
| 111 | + TRACE_EXIT(23,E_NOINTERFACE);
|
94 | 112 | return E_NOINTERFACE;
|
95 | 113 | }
|
96 | 114 |
|
97 | 115 | ULONG WINAPI glDirect3DMaterial3::AddRef()
|
98 | 116 | {
|
99 | | - if(!this) return 0;
|
| 117 | + TRACE_ENTER(1,14,this);
|
| 118 | + if(!this) TRACE_RET(8,0);
|
100 | 119 | refcount++;
|
| 120 | + TRACE_EXIT(8,refcount);
|
101 | 121 | return refcount;
|
102 | 122 | }
|
103 | 123 |
|
104 | 124 | ULONG WINAPI glDirect3DMaterial3::Release()
|
105 | 125 | {
|
106 | | - if(!this) return 0;
|
| 126 | + if(!this) TRACE_RET(8,0);
|
107 | 127 | ULONG ret;
|
108 | 128 | refcount--;
|
109 | 129 | ret = refcount;
|
110 | 130 | if(refcount == 0) delete this;
|
| 131 | + TRACE_EXIT(8,ret);
|
111 | 132 | return ret;
|
112 | 133 | }
|
113 | 134 |
|
114 | 135 | HRESULT WINAPI glDirect3DMaterial3::GetHandle(LPDIRECT3DDEVICE3 lpDirect3DDevice, LPD3DMATERIALHANDLE lpHandle)
|
115 | 136 | {
|
116 | | - if(!this) return DDERR_INVALIDOBJECT;
|
117 | | - if(!lpDirect3DDevice) return DDERR_INVALIDPARAMS;
|
| 137 | + TRACE_ENTER(3,14,this,14,lpDirect3DDevice,14,lpHandle);
|
| 138 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 139 | + if(!lpDirect3DDevice) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
118 | 140 | glDirect3DDevice3 *dev3 = (glDirect3DDevice3*)lpDirect3DDevice;
|
119 | 141 | if(handle)
|
120 | 142 | {
|
121 | | - if(device != dev3->GetGLD3DDev7()) return DDERR_INVALIDOBJECT;
|
| 143 | + if(device != dev3->GetGLD3DDev7()) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
122 | 144 | *lpHandle = handle;
|
| 145 | + TRACE_VAR("*lpHandle",9,*lpHandle);
|
| 146 | + TRACE_EXIT(23,D3D_OK);
|
123 | 147 | return D3D_OK;
|
124 | 148 | }
|
125 | 149 | device = dev3->GetGLD3DDev7();
|
126 | 150 | handle = device->AddMaterial(this);
|
127 | | - if(handle == -1) return DDERR_OUTOFMEMORY;
|
| 151 | + if(handle == -1) TRACE_RET(23,DDERR_OUTOFMEMORY);
|
128 | 152 | *lpHandle = handle;
|
| 153 | + TRACE_VAR("*lpHandle",9,*lpHandle);
|
| 154 | + TRACE_EXIT(23,D3D_OK);
|
129 | 155 | return D3D_OK;
|
130 | 156 | }
|
131 | 157 |
|
132 | 158 | HRESULT WINAPI glDirect3DMaterial3::GetMaterial(LPD3DMATERIAL lpMat)
|
133 | 159 | {
|
134 | | - if(!this) return DDERR_INVALIDOBJECT;
|
135 | | - if(lpMat->dwSize < sizeof(D3DMATERIAL)) return DDERR_INVALIDPARAMS;
|
| 160 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 161 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 162 | + if(lpMat->dwSize < sizeof(D3DMATERIAL)) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
136 | 163 | memcpy(lpMat,&material,sizeof(D3DMATERIAL));
|
| 164 | + TRACE_EXIT(23,D3D_OK);
|
137 | 165 | return D3D_OK;
|
138 | 166 | }
|
139 | 167 |
|
140 | 168 | HRESULT WINAPI glDirect3DMaterial3::SetMaterial(LPD3DMATERIAL lpMat)
|
141 | 169 | {
|
142 | | - if(!this) return DDERR_INVALIDOBJECT;
|
143 | | - if(lpMat->dwSize != sizeof(D3DMATERIAL)) return DDERR_INVALIDPARAMS;
|
| 170 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 171 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 172 | + if(lpMat->dwSize != sizeof(D3DMATERIAL)) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
144 | 173 | memcpy(&material,lpMat,sizeof(D3DMATERIAL));
|
145 | 174 | if(device && current) Sync();
|
| 175 | + TRACE_EXIT(23,D3D_OK);
|
146 | 176 | return D3D_OK;
|
147 | 177 | }
|
148 | 178 |
|
149 | 179 | void glDirect3DMaterial3::unbind()
|
150 | 180 | {
|
| 181 | + TRACE_ENTER(1,14,this);
|
151 | 182 | device = NULL;
|
152 | 183 | current = false;
|
153 | 184 | handle = 0;
|
| 185 | + TRACE_EXIT(0,0);
|
154 | 186 | }
|
155 | 187 |
|
156 | 188 | void glDirect3DMaterial3::SetCurrent(bool current)
|
157 | 189 | {
|
158 | | - if(this->current == current) return;
|
| 190 | + TRACE_ENTER(2,14,this,21,current);
|
| 191 | + if(this->current == current)
|
| 192 | + {
|
| 193 | + TRACE_EXIT(0,0);
|
| 194 | + return;
|
| 195 | + }
|
159 | 196 | this->current = current;
|
160 | 197 | if(current) Sync();
|
| 198 | + TRACE_EXIT(0,0);
|
161 | 199 | }
|
162 | 200 |
|
163 | 201 | void glDirect3DMaterial3::Sync()
|
164 | 202 | {
|
| 203 | + TRACE_ENTER(1,14,this);
|
165 | 204 | D3DMATERIAL7 mat7;
|
166 | 205 | mat7.diffuse = material.diffuse;
|
167 | 206 | mat7.ambient = material.ambient;
|
— | — | @@ -168,151 +207,188 @@ |
169 | 208 | mat7.emissive = material.emissive;
|
170 | 209 | mat7.power = material.power;
|
171 | 210 | device->SetMaterial(&mat7);
|
| 211 | + TRACE_EXIT(0,0);
|
172 | 212 | }
|
173 | 213 |
|
174 | 214 | glDirect3DMaterial2::glDirect3DMaterial2(glDirect3DMaterial3 *glD3DM3)
|
175 | 215 | {
|
| 216 | + TRACE_ENTER(2,14,this,14,glD3DM3);
|
176 | 217 | refcount = 1;
|
177 | 218 | this->glD3DM3 = glD3DM3;
|
| 219 | + TRACE_EXIT(-1,0);
|
178 | 220 | }
|
179 | 221 |
|
180 | 222 | glDirect3DMaterial2::~glDirect3DMaterial2()
|
181 | 223 | {
|
| 224 | + TRACE_ENTER(1,14,this);
|
182 | 225 | glD3DM3->glD3DM2 = NULL;
|
183 | 226 | glD3DM3->Release();
|
| 227 | + TRACE_EXIT(-1,0);
|
184 | 228 | }
|
185 | 229 |
|
186 | 230 | ULONG WINAPI glDirect3DMaterial2::AddRef()
|
187 | 231 | {
|
188 | | - if(!this) return 0;
|
| 232 | + TRACE_ENTER(1,14,this);
|
| 233 | + if(!this) TRACE_RET(8,0);
|
189 | 234 | refcount++;
|
| 235 | + TRACE_EXIT(8,refcount);
|
190 | 236 | return refcount;
|
191 | 237 | }
|
192 | 238 |
|
193 | 239 | ULONG WINAPI glDirect3DMaterial2::Release()
|
194 | 240 | {
|
195 | | - if(!this) return 0;
|
| 241 | + TRACE_ENTER(1,14,this);
|
| 242 | + if(!this) TRACE_RET(8,0);
|
196 | 243 | ULONG ret;
|
197 | 244 | refcount--;
|
198 | 245 | ret = refcount;
|
199 | 246 | if(refcount == 0) delete this;
|
| 247 | + TRACE_EXIT(8,ret);
|
200 | 248 | return ret;
|
201 | 249 | }
|
202 | 250 |
|
203 | 251 | HRESULT WINAPI glDirect3DMaterial2::QueryInterface(REFIID riid, void** ppvObj)
|
204 | 252 | {
|
205 | | - if(!this) return DDERR_INVALIDOBJECT;
|
| 253 | + TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
|
| 254 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
206 | 255 | if(riid == IID_IUnknown)
|
207 | 256 | {
|
208 | 257 | this->AddRef();
|
209 | 258 | *ppvObj = this;
|
| 259 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 260 | + TRACE_EXIT(23,D3D_OK);
|
210 | 261 | return D3D_OK;
|
211 | 262 | }
|
212 | | - return glD3DM3->QueryInterface(riid,ppvObj);
|
| 263 | + TRACE_RET(23,glD3DM3->QueryInterface(riid,ppvObj));
|
213 | 264 | }
|
214 | 265 |
|
215 | 266 | HRESULT WINAPI glDirect3DMaterial2::GetHandle(LPDIRECT3DDEVICE2 lpDirect3DDevice, LPD3DMATERIALHANDLE lpHandle)
|
216 | 267 | {
|
217 | | - if(!this) return DDERR_INVALIDOBJECT;
|
218 | | - if(!lpDirect3DDevice) return DDERR_INVALIDPARAMS;
|
| 268 | + TRACE_ENTER(3,14,this,14,lpDirect3DDevice,14,lpHandle);
|
| 269 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 270 | + if(!lpDirect3DDevice) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
219 | 271 | glDirect3DDevice2 *glD3DDev2 = (glDirect3DDevice2*)lpDirect3DDevice;
|
220 | 272 | glDirect3DDevice3 *glD3DDev3;
|
221 | 273 | glD3DDev2->QueryInterface(IID_IDirect3DDevice3,(void**)&glD3DDev3);
|
222 | 274 | HRESULT ret = glD3DM3->GetHandle(glD3DDev3,lpHandle);
|
223 | 275 | glD3DDev3->Release();
|
| 276 | + TRACE_EXIT(23,ret);
|
224 | 277 | return ret;
|
225 | 278 | }
|
226 | 279 |
|
227 | 280 | HRESULT WINAPI glDirect3DMaterial2::GetMaterial(LPD3DMATERIAL lpMat)
|
228 | 281 | {
|
229 | | - if(!this) return DDERR_INVALIDOBJECT;
|
230 | | - return glD3DM3->GetMaterial(lpMat);
|
| 282 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 283 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 284 | + TRACE_RET(23,glD3DM3->GetMaterial(lpMat));
|
231 | 285 | }
|
232 | 286 | HRESULT WINAPI glDirect3DMaterial2::SetMaterial(LPD3DMATERIAL lpMat)
|
233 | 287 | {
|
234 | | - if(!this) return DDERR_INVALIDOBJECT;
|
235 | | - return glD3DM3->SetMaterial(lpMat);
|
| 288 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 289 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 290 | + TRACE_RET(23,glD3DM3->SetMaterial(lpMat));
|
236 | 291 | }
|
237 | 292 |
|
238 | 293 | glDirect3DMaterial1::glDirect3DMaterial1(glDirect3DMaterial3 *glD3DM3)
|
239 | 294 | {
|
| 295 | + TRACE_ENTER(2,14,this,14,glD3DM3);
|
240 | 296 | refcount = 1;
|
241 | 297 | this->glD3DM3 = glD3DM3;
|
| 298 | + TRACE_EXIT(-1,0);
|
242 | 299 | }
|
243 | 300 |
|
244 | 301 | glDirect3DMaterial1::~glDirect3DMaterial1()
|
245 | 302 | {
|
| 303 | + TRACE_ENTER(1,14,this);
|
246 | 304 | glD3DM3->glD3DM1 = NULL;
|
247 | 305 | glD3DM3->Release();
|
| 306 | + TRACE_EXIT(-1,0);
|
248 | 307 | }
|
249 | 308 |
|
250 | 309 | ULONG WINAPI glDirect3DMaterial1::AddRef()
|
251 | 310 | {
|
252 | | - if(!this) return 0;
|
| 311 | + TRACE_ENTER(1,14,this);
|
| 312 | + if(!this) TRACE_RET(8,0);
|
253 | 313 | refcount++;
|
| 314 | + TRACE_EXIT(8,refcount);
|
254 | 315 | return refcount;
|
255 | 316 | }
|
256 | 317 |
|
257 | 318 | ULONG WINAPI glDirect3DMaterial1::Release()
|
258 | 319 | {
|
259 | | - if(!this) return 0;
|
| 320 | + TRACE_ENTER(1,14,this);
|
| 321 | + if(!this) TRACE_RET(8,0);
|
260 | 322 | ULONG ret;
|
261 | 323 | refcount--;
|
262 | 324 | ret = refcount;
|
263 | 325 | if(refcount == 0) delete this;
|
| 326 | + TRACE_EXIT(8,ret);
|
264 | 327 | return ret;
|
265 | 328 | }
|
266 | 329 |
|
267 | 330 | HRESULT WINAPI glDirect3DMaterial1::QueryInterface(REFIID riid, void** ppvObj)
|
268 | 331 | {
|
269 | | - if(!this) return DDERR_INVALIDOBJECT;
|
| 332 | + TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
|
| 333 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
270 | 334 | if(riid == IID_IUnknown)
|
271 | 335 | {
|
272 | 336 | this->AddRef();
|
273 | 337 | *ppvObj = this;
|
| 338 | + TRACE_VAR("*ppvObj",14,*ppvObj);
|
| 339 | + TRACE_EXIT(23,D3D_OK);
|
274 | 340 | return D3D_OK;
|
275 | 341 | }
|
276 | | - return glD3DM3->QueryInterface(riid,ppvObj);
|
| 342 | + TRACE_RET(23,glD3DM3->QueryInterface(riid,ppvObj));
|
277 | 343 | }
|
278 | 344 |
|
279 | 345 | HRESULT WINAPI glDirect3DMaterial1::GetHandle(LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DMATERIALHANDLE lpHandle)
|
280 | 346 | {
|
281 | | - if(!this) return DDERR_INVALIDOBJECT;
|
282 | | - if(!lpDirect3DDevice) return DDERR_INVALIDPARAMS;
|
| 347 | + TRACE_ENTER(3,14,this,14,lpDirect3DDevice,14,lpHandle);
|
| 348 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 349 | + if(!lpDirect3DDevice) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
283 | 350 | glDirect3DDevice1 *glD3DDev1 = (glDirect3DDevice1*)lpDirect3DDevice;
|
284 | 351 | glDirect3DDevice3 *glD3DDev3;
|
285 | 352 | glD3DDev1->QueryInterface(IID_IDirect3DDevice3,(void**)&glD3DDev3);
|
286 | 353 | HRESULT ret = glD3DM3->GetHandle(glD3DDev3,lpHandle);
|
287 | 354 | glD3DDev3->Release();
|
| 355 | + TRACE_EXIT(23,ret);
|
288 | 356 | return ret;
|
289 | 357 | }
|
290 | 358 |
|
291 | 359 | HRESULT WINAPI glDirect3DMaterial1::GetMaterial(LPD3DMATERIAL lpMat)
|
292 | 360 | {
|
293 | | - if(!this) return DDERR_INVALIDOBJECT;
|
294 | | - return glD3DM3->GetMaterial(lpMat);
|
| 361 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 362 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 363 | + TRACE_RET(23,glD3DM3->GetMaterial(lpMat));
|
295 | 364 | }
|
296 | 365 |
|
297 | 366 | HRESULT WINAPI glDirect3DMaterial1::Initialize(LPDIRECT3D lpDirect3D)
|
298 | 367 | {
|
299 | | - if(!this) return DDERR_INVALIDOBJECT;
|
| 368 | + TRACE_ENTER(2,14,this,14,lpDirect3D);
|
| 369 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 370 | + TRACE_EXIT(23,DDERR_ALREADYINITIALIZED);
|
300 | 371 | return DDERR_ALREADYINITIALIZED;
|
301 | 372 | }
|
302 | 373 |
|
303 | 374 | HRESULT WINAPI glDirect3DMaterial1::Reserve()
|
304 | 375 | {
|
305 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| 376 | + TRACE_ENTER(1,14,this);
|
| 377 | + if(!this) TRACE_RET(23,DDERR_INVALIDPARAMS);
|
| 378 | + TRACE_EXIT(23,DDERR_UNSUPPORTED);
|
306 | 379 | return DDERR_UNSUPPORTED;
|
307 | 380 | }
|
308 | 381 |
|
309 | 382 | HRESULT WINAPI glDirect3DMaterial1::SetMaterial(LPD3DMATERIAL lpMat)
|
310 | 383 | {
|
311 | | - if(!this) return DDERR_INVALIDOBJECT;
|
312 | | - return glD3DM3->SetMaterial(lpMat);
|
| 384 | + TRACE_ENTER(2,14,this,14,lpMat);
|
| 385 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 386 | + TRACE_RET(23,glD3DM3->SetMaterial(lpMat));
|
313 | 387 | }
|
314 | 388 |
|
315 | 389 | HRESULT WINAPI glDirect3DMaterial1::Unreserve()
|
316 | 390 | {
|
317 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| 391 | + TRACE_ENTER(1,14,this);
|
| 392 | + if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
|
| 393 | + TRACE_EXIT(23,DDERR_UNSUPPORTED);
|
318 | 394 | return DDERR_UNSUPPORTED;
|
319 | 395 | }
|