sorry startup.c are bit messy but I change heapalloc to malloc and guess what all our weird problem are gone.

svn path=/trunk/; revision=26967
This commit is contained in:
Magnus Olsen 2007-06-02 14:42:43 +00:00
parent 8c5febf184
commit ef4d675d1e
3 changed files with 52 additions and 18 deletions

View file

@ -106,7 +106,7 @@ CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This,
DDHAL_CREATESURFACEDATA mDdCreateSurface; DDHAL_CREATESURFACEDATA mDdCreateSurface;
That[0]->lpLcl->lpSurfMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); DxHeapMemAlloc( That[0]->lpLcl->lpSurfMore, sizeof(DDRAWI_DDRAWSURFACE_MORE));
if (That[0]->lpLcl->lpSurfMore == NULL) if (That[0]->lpLcl->lpSurfMore == NULL)
{ {
DxHeapMemFree(That); DxHeapMemFree(That);
@ -198,7 +198,7 @@ CreateBackBufferSurface(LPDDRAWI_DIRECTDRAW_INT This,
{ {
That[t]->lpLcl->lpSurfMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); DxHeapMemAlloc(That[t]->lpLcl->lpSurfMore, sizeof(DDRAWI_DDRAWSURFACE_MORE));
if (That[t]->lpLcl->lpSurfMore == NULL) if (That[t]->lpLcl->lpSurfMore == NULL)
{ {
DxHeapMemFree(That); DxHeapMemFree(That);

View file

@ -35,9 +35,15 @@ void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src
VOID Cleanup(LPDIRECTDRAW7 iface); VOID Cleanup(LPDIRECTDRAW7 iface);
/* own macro to alloc memmory */ /* own macro to alloc memmory */
/*
#define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m) #define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m)
#define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \
p = NULL; p = NULL;
*/
#define DxHeapMemAlloc(p, m) p = malloc(m)
#define DxHeapMemFree(p) free(p); \
p = NULL;
/******** Main Object ********/ /******** Main Object ********/

View file

@ -106,7 +106,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
/* FIXME HACK linking does not working we need figout why */ /* FIXME HACK linking does not working we need figout why */
LPDDRAWI_DIRECTDRAW_INT memThis; LPDDRAWI_DIRECTDRAW_INT memThis;
memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
This = memThis; This = memThis;
if (This == NULL) if (This == NULL)
{ {
@ -118,7 +118,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
/* Fixme release memory alloc if we fail */ /* Fixme release memory alloc if we fail */
This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_INT));
if (This->lpLcl == NULL) if (This->lpLcl == NULL)
{ {
DX_STUB_str("DDERR_OUTOFMEMORY"); DX_STUB_str("DDERR_OUTOFMEMORY");
@ -194,7 +194,8 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
This->lpLcl->lpGbl->dwRefCnt++; This->lpLcl->lpGbl->dwRefCnt++;
if (ddgbl.lpDDCBtmp == NULL) if (ddgbl.lpDDCBtmp == NULL)
{ {
ddgbl.lpDDCBtmp = (LPDDHAL_CALLBACKS) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); // LPDDHAL_CALLBACKS
DxHeapMemAlloc( ddgbl.lpDDCBtmp , sizeof(DDHAL_CALLBACKS));
if (ddgbl.lpDDCBtmp == NULL) if (ddgbl.lpDDCBtmp == NULL)
{ {
DX_STUB_str("Out of memmory\n"); DX_STUB_str("Out of memmory\n");
@ -403,7 +404,7 @@ StartDirectDrawHel(LPDIRECTDRAW iface, BOOL reenable)
HRESULT WINAPI HRESULT WINAPI
StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
{ {
LPDWORD mpFourCC; LPDWORD mpFourCC = NULL;
DDHALINFO mHALInfo; DDHALINFO mHALInfo;
BOOL newmode = FALSE; BOOL newmode = FALSE;
LPDDSURFACEDESC mpTextures; LPDDSURFACEDESC mpTextures;
@ -411,6 +412,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
D3DHAL_GLOBALDRIVERDATA mD3dDriverData; D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
INT count;
DX_WINDBG_trace(); DX_WINDBG_trace();
@ -423,7 +425,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
{ {
if (ddgbl.lpDDCBtmp == NULL) if (ddgbl.lpDDCBtmp == NULL)
{ {
ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); DxHeapMemAlloc(ddgbl.lpDDCBtmp, sizeof(DDHAL_CALLBACKS));
if ( ddgbl.lpDDCBtmp == NULL) if ( ddgbl.lpDDCBtmp == NULL)
{ {
return DD_FALSE; return DD_FALSE;
@ -462,7 +464,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
&mD3dDriverData, &mD3dDriverData,
&mD3dBufferCallbacks, &mD3dBufferCallbacks,
NULL, NULL,
NULL, mpFourCC,
NULL)) NULL))
{ {
DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
@ -471,24 +473,44 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
return DD_FALSE; return DD_FALSE;
} }
DX_STUB_str("Here\n");
#if 0
/* Alloc mpFourCC */
mpFourCC = NULL;
if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{ {
mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes); char buffer[2048];
sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes);
OutputDebugStringA(buffer);
}
// count = mHALInfo.ddCaps.dwNumFourCCCodes;
DX_STUB_str("Here\n");
/* Alloc mpFourCC */
//if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{
//mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21);
// DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21);
// mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));
/*
if (mpFourCC == NULL) if (mpFourCC == NULL)
{ {
DxHeapMemFree(ddgbl.lpDDCBtmp); DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call // FIXME Close DX fristcall and second call
return DD_FALSE; return DD_FALSE;
} }
*/
} }
DX_STUB_str("Here\n"); DX_STUB_str("Here\n");
#else
mpFourCC = NULL; {
#endif char buffer[2048];
sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes);
OutputDebugStringA(buffer);
}
/* Alloc mpTextures */ /* Alloc mpTextures */
#if 0 #if 0
mpTextures = NULL; mpTextures = NULL;
@ -529,6 +551,12 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
return DD_FALSE; return DD_FALSE;
} }
{
char buffer[2048];
sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes);
OutputDebugStringA(buffer);
}
memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO)); memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));