d3dx9: Handle D3DXPT_VOID in get_float/bool/int().

This commit is contained in:
Rico Schüller 2012-09-26 11:52:02 +02:00 committed by Alexandre Julliard
parent 9be6846224
commit e817bc3f04
1 changed files with 30 additions and 31 deletions

View File

@ -271,63 +271,62 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
#undef WINE_D3DX_TO_STR #undef WINE_D3DX_TO_STR
/* parameter type conversion helpers */ /* parameter type conversion helpers */
static BOOL get_bool(LPCVOID data) static BOOL get_bool(D3DXPARAMETER_TYPE type, LPCVOID data)
{ {
return (*(DWORD *)data) != 0; switch (type)
{
case D3DXPT_FLOAT:
case D3DXPT_INT:
case D3DXPT_BOOL:
return *(DWORD *)data != 0;
case D3DXPT_VOID:
return *(BOOL *)data;
default:
FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
return FALSE;
}
} }
static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
{ {
INT i;
switch (type) switch (type)
{ {
case D3DXPT_FLOAT: case D3DXPT_FLOAT:
i = *(FLOAT *)data; return *(FLOAT *)data;
break;
case D3DXPT_INT: case D3DXPT_INT:
i = *(INT *)data; case D3DXPT_VOID:
break; return *(INT *)data;
case D3DXPT_BOOL: case D3DXPT_BOOL:
i = get_bool(data); return get_bool(type, data);
break;
default: default:
i = 0; FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type)); return 0;
break;
} }
return i;
} }
static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
{ {
FLOAT f;
switch (type) switch (type)
{ {
case D3DXPT_FLOAT: case D3DXPT_FLOAT:
f = *(FLOAT *)data; case D3DXPT_VOID:
break; return *(FLOAT *)data;
case D3DXPT_INT: case D3DXPT_INT:
f = *(INT *)data; return *(INT *)data;
break;
case D3DXPT_BOOL: case D3DXPT_BOOL:
f = get_bool(data); return get_bool(type, data);
break;
default: default:
f = 0.0f; FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type)); return 0.0f;
break;
} }
return f;
} }
void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype)
@ -347,7 +346,7 @@ void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DX
break; break;
case D3DXPT_BOOL: case D3DXPT_BOOL:
*(BOOL *)outdata = get_bool(indata); *(BOOL *)outdata = get_bool(intype, indata);
break; break;
case D3DXPT_INT: case D3DXPT_INT:
@ -355,8 +354,8 @@ void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DX
break; break;
default: default:
FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(outtype)); FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(outtype));
*(INT *)outdata = 0; *(DWORD *)outdata = 0;
break; break;
} }
} }