Browse Source

Add definition of j_lock_buf_priv and j_unlock_buf_priv for debug release.

Also add a debug target for MakefileVC.
pull/25/head
Robin Eklind 8 years ago
parent
commit
9772cd0743
  1. 3
      MakefileVC
  2. 15
      Source/dx.cpp
  3. 4
      Source/dx.h

3
MakefileVC

@ -49,6 +49,9 @@ endif
all: Diablo.exe
debug: CFLAGS += /D "_DEBUG"
debug: Diablo.exe
# fix compilation order to match the VC6 workspace files
DIABLO_SRC=$(sort $(filter-out Source/render.cpp, $(wildcard Source/*.cpp)))
DIABLO_SRC += Source/render.cpp

15
Source/dx.cpp

@ -10,6 +10,9 @@ int sgdwLockCount;
Screen *gpBuffer;
IDirectDrawSurface *lpDDSBackBuf;
IDirectDrawSurface *lpDDSPrimary;
#ifdef _DEBUG
int locktbl[256];
#endif
static CRITICAL_SECTION sgMemCrit;
char gbBackBuf; // weak
char gbEmulate; // weak
@ -184,7 +187,10 @@ HRESULT __fastcall dx_DirectDrawCreate(GUID *guid, IDirectDraw **DD, void *unkno
return ((int (__stdcall *)(GUID *, IDirectDraw **, void *))v5)(v8, v3, unknown);
}
void __fastcall j_lock_buf_priv(char a1) {
void __fastcall j_lock_buf_priv(BYTE idx) {
#ifdef _DEBUG
++locktbl[idx];
#endif
lock_buf_priv();
}
@ -219,7 +225,12 @@ LABEL_9:
}
// 69CF0C: using guessed type int gpBufEnd;
void __fastcall j_unlock_buf_priv(char a1) {
void __fastcall j_unlock_buf_priv(BYTE idx) {
#ifdef _DEBUG
if ( !locktbl[idx] )
TermMsg("Draw lock underflow: 0x%x", idx);
--locktbl[idx];
#endif
unlock_buf_priv();
}

4
Source/dx.h

@ -23,9 +23,9 @@ void __fastcall dx_init(HWND hWnd);
void __cdecl dx_create_back_buffer();
void __cdecl dx_create_primary_surface();
HRESULT __fastcall dx_DirectDrawCreate(GUID *guid, IDirectDraw **DD, void *unknown);
void __fastcall j_lock_buf_priv(char a1);
void __fastcall j_lock_buf_priv(BYTE idx);
void __cdecl lock_buf_priv();
void __fastcall j_unlock_buf_priv(char a1);
void __fastcall j_unlock_buf_priv(BYTE idx);
void __cdecl unlock_buf_priv();
void __cdecl dx_cleanup();
void __cdecl dx_reinit();

Loading…
Cancel
Save