Author: greatlrd
Date: Sun Oct 22 14:01:46 2006
New Revision: 24600
URL:
http://svn.reactos.org/svn/reactos?rev=24600&view=rev
Log:
full implement of D3DParseUnknownCommand + 1 undocument command that have been review by
D3DParseUnknownCommand_show in rosapps/tests
Modified:
trunk/reactos/dll/directx/ddraw/main.c
Modified: trunk/reactos/dll/directx/ddraw/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?r…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main.c Sun Oct 22 14:01:46 2006
@@ -137,42 +137,51 @@
HRESULT
WINAPI
-D3DParseUnknownCommand( LPVOID lpvCommands,
- LPVOID *lplpvReturnedCommand)
+D3DParseUnknownCommand( LPVOID lpCmd,
+ LPVOID *lpRetCmd)
{
- LPD3DHAL_DP2COMMAND cmd = lpvCommands;
+ LPD3DHAL_DP2COMMAND dp2command = lpCmd;
DWORD retCode = D3DERR_COMMAND_UNPARSED;
+
+ /* prevent it crash if null pointer are being sent */
+ if (lpCmd == NULL) || (lpRetCmd == NULL) )
+ {
+ return E_FAIL;
+ }
+
+ *lpRetCmd = lpCmd;
+
+ if (dp2command->bCommand == D3DDP2OP_VIEWPORTINFO)
+ {
+ *(PBYTE)lpRetCmd += ((dp2command->wStateCount *
sizeof(D3DHAL_DP2VIEWPORTINFO)) + sizeof(D3DHAL_DP2POINTS));
+ retCode = 0;
+ }
+ else if (dp2command->bCommand == D3DDP2OP_WINFO)
+ {
+ *(PBYTE)lpRetCmd += (dp2command->wStateCount * sizeof(D3DHAL_DP2WINFO)) +
sizeof(D3DHAL_DP2POINTS);
+ retCode = 0;
+ }
+ else if (dp2command->bCommand == 0x0d)
+ {
+ /* math
+ *lpRetCmd = lpCmd + (wStateCount * sizeof( ? ) + sizeof(D3DHAL_DP2POINTS)
+ */
- *lplpvReturnedCommand = lpvCommands;
-
- if (cmd->bCommand > D3DDP2OP_TRIANGLESTRIP)
+ *(PBYTE)lpRetCmd += ((dp2command->wStateCount * dp2command->bReserved) +
sizeof(D3DHAL_DP2POINTS));
+ retCode = 0;
+ }
+
+
+ /* error code */
+
+ else if ( (dp2command->bCommand <= D3DDP2OP_INDEXEDTRIANGLELIST) || //
dp2command->bCommand <= with 0 to 3
+ (dp2command->bCommand == D3DDP2OP_RENDERSTATE) || //
dp2command->bCommand == with 8
+ (dp2command->bCommand >= D3DDP2OP_LINELIST) ) //
dp2command->bCommand >= with 15 to 255
{
- retCode = DD_FALSE;
-
- if (cmd->bCommand == D3DDP2OP_VIEWPORTINFO)
- {
- /* FIXME */
- retCode = DD_OK;
- }
-
- if (cmd->bCommand == D3DDP2OP_WINFO)
- {
- /* FIXME */
- retCode = DD_OK;
- }
+ retCode = E_FAIL;
}
- else if (cmd->bCommand == D3DDP2OP_TRIANGLESTRIP)
- {
- /* FIXME */
- retCode = DD_OK;
- }
-
- if ((cmd->bCommand <= D3DDP2OP_INDEXEDTRIANGLELIST) || (cmd->bCommand ==
D3DDP2OP_RENDERSTATE))
- {
- retCode = DD_FALSE;
- }
-
+
return retCode;
}