git-svn-id: https://svn.eduke32.com/eduke32@579 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2007-09-11 02:23:08 +00:00
parent 820eeeb5b3
commit 997883a2f9
10 changed files with 171 additions and 15 deletions

View file

@ -70,7 +70,7 @@ ENGINEOBJS= \
$(OBJ)\osd.$o \
$(OBJ)\pragmas.$o \
$(OBJ)\scriptfile.$o \
$(OBJ)\winlayer.$o \
$(OBJ)\winlayer.$o \
$(OBJ)\polymer.$o
EDITOROBJS=$(OBJ)\build.$o \

View file

@ -61,7 +61,7 @@ void printmessage256(char name[82]);
void printmessage16(char name[82]);
void getpoint(long searchxe, long searchye, long *x, long *y);
long getpointhighlight(long xplc, long yplc);
short getpointhighlight(long xplc, long yplc);
#ifdef __cplusplus
}

View file

@ -181,7 +181,7 @@ void showwalldata(short wallnum);
void showspritedata(short spritenum);
long drawtilescreen(long pictopleft, long picbox);
void overheadeditor(void);
long getlinehighlight(long xplc, long yplc);
short getlinehighlight(long xplc, long yplc);
void fixspritesectors(void);
long movewalls(long start, long offs);
long loadnames(void);
@ -5941,7 +5941,7 @@ void getpoint(long searchxe, long searchye, long *x, long *y)
if (*y >= editorgridextent) *y = editorgridextent;
}
long getlinehighlight(long xplc, long yplc)
short getlinehighlight(long xplc, long yplc)
{
long i, dst, dist, closest, x1, y1, x2, y2, nx, ny;
@ -5973,18 +5973,16 @@ long getlinehighlight(long xplc, long yplc)
return(closest);
}
long getpointhighlight(long xplc, long yplc)
short getpointhighlight(long xplc, long yplc)
{
long i, dst, dist, closest;
long i, dst, dist = 512, closest = -1;
if (numwalls == 0)
return(-1);
dist = 0;
if (grid > 0)
dist = 512;
if (grid < 1)
dist = 0;
closest = -1;
for (i=0;i<numwalls;i++)
{
dst = klabs(xplc-wall[i].x) + klabs(yplc-wall[i].y);

View file

@ -11149,6 +11149,8 @@ void printext16(long xpos, long ypos, short col, short backcol, char *name, char
long stx, i, x, y, charxsiz;
char *fontptr, *letptr, *ptr;
if (!frameplace) return;
stx = xpos;
if (fontsize) { fontptr = smalltextfont; charxsiz = 4; }

View file

@ -8,6 +8,7 @@ $(OBJ)/gamedef.$o: $(SRC)/gamedef.c $(duke3d_h) $(gamedef_h)
$(OBJ)/gameexec.$o: $(SRC)/gameexec.c $(duke3d_h) $(gamedef_h)
$(OBJ)/gamevars.$o: $(SRC)/gamevars.c $(duke3d_h) $(gamedef_h)
$(OBJ)/global.$o: $(SRC)/*.c $(SRC)/global.c $(duke3d_h)
$(OBJ)/mdump.$o: $(SRC)/mdump.cpp $(SRC)/mdump.h
$(OBJ)/menus.$o: $(SRC)/menus.c $(duke3d_h) $(SRC)/jmact/mouse.h
$(OBJ)/namesdyn.$o: $(SRC)/namesdyn.c $(duke3d_h)
$(OBJ)/player.$o: $(SRC)/player.c $(duke3d_h)

View file

@ -6,6 +6,7 @@ EROOT=..\build
EINC=$(EROOT)\include
EOBJ=eobj
INC=$(SRC)
RSRC=rsrc
o=obj
ENGINELIB=engine.lib
@ -102,10 +103,12 @@ GAMEOBJS=$(OBJ)\game.$o \
$(OBJ)\gameres.res \
$(OBJ)\startwin.game.$o \
$(JMACTOBJ) \
$(AUDIOLIBOBJ)
$(AUDIOLIBOBJ) \
$(OBJ)\mdump.$o
EDITOROBJS=$(OBJ)\astub.$o \
$(OBJ)\buildres.res
$(OBJ)\buildres.res \
$(OBJ)\mdump.$o
# RULES
@ -141,11 +144,11 @@ all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) duke3d_w32$(EXESUFFIX);
eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)\$(ENGINELIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib
$(MT) -manifest $@.manifest -outputresource:$@
$(MT) -manifest $@.manifest $(RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)\$(ENGINELIB) $(EOBJ)\$(EDITORLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib
$(MT) -manifest $@.manifest -outputresource:$@
$(MT) -manifest $@.manifest $(RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
duke3d_w32$(EXESUFFIX): $(OBJ)/wrapper.$o
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib

View file

@ -497,6 +497,10 @@
RelativePath=".\source\jfaud_sounds.cpp"
>
</File>
<File
RelativePath=".\source\mdump.cpp"
>
</File>
<File
RelativePath=".\source\menus.c"
>
@ -609,6 +613,10 @@
RelativePath=".\source\mapster32.h"
>
</File>
<File
RelativePath=".\source\mdump.h"
>
</File>
<File
RelativePath=".\source\names.h"
>

View file

@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "scriptfile.h"
#include "crc32.h"
#define VERSION " 1.1.0 rc1"
#define VERSION " 1.1.0 svn"
static int floor_over_floor;

View file

@ -0,0 +1,114 @@
#include <cstdio>
#include "mdump.h"
#include <tchar.H>
LPCSTR MiniDumper::m_szAppName;
// MiniDumper g_dumper("EDuke32");
MiniDumper::MiniDumper( LPCSTR szAppName )
{
// if this assert fires then you have two instances of MiniDumper
// which is not allowed
assert( m_szAppName==NULL );
m_szAppName = szAppName ? _strdup(szAppName) : "Application";
::SetUnhandledExceptionFilter( TopLevelFilter );
}
LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
{
LONG retval = EXCEPTION_CONTINUE_SEARCH;
//HWND hParent = NULL; // find a better value for your app
// firstly see if dbghelp.dll is around and has the function we need
// look next to the EXE first, as the one in System32 might be old
// (e.g. Windows 2000)
HMODULE hDll = NULL;
char szDbgHelpPath[_MAX_PATH];
if (GetModuleFileName( NULL, szDbgHelpPath, _MAX_PATH ))
{
char *pSlash = _tcsrchr( szDbgHelpPath, '\\' );
if (pSlash)
{
_tcscpy( pSlash+1, "DBGHELP.DLL" );
hDll = ::LoadLibrary( szDbgHelpPath );
}
}
if (hDll==NULL)
{
// load any version we can
hDll = ::LoadLibrary( "DBGHELP.DLL" );
}
LPCTSTR szResult = NULL;
if (hDll)
{
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
if (pDump)
{
char szDumpPath[_MAX_PATH];
char szScratch [_MAX_PATH];
// work out a good place for the dump file
/*if (!GetTempPath( _MAX_PATH, szDumpPath ))
_tcscpy( szDumpPath, "c:\\temp\\" );
*/
sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime());
_tcscat( szDumpPath, ".dmp" );
// ask the user if they want to save a dump file
//if (::MessageBox( NULL, "Something bad happened in your program, would you like to save a diagnostic file?", m_szAppName, MB_YESNO )==IDYES)
{
// create the file
HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL );
if (hFile!=INVALID_HANDLE_VALUE)
{
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
ExInfo.ThreadId = ::GetCurrentThreadId();
ExInfo.ExceptionPointers = pExceptionInfo;
ExInfo.ClientPointers = NULL;
// write the dump
BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
if (bOK)
{
sprintf( szScratch, "Saved dump file to '%s'", szDumpPath );
szResult = szScratch;
retval = EXCEPTION_EXECUTE_HANDLER;
}
else
{
sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() );
szResult = szScratch;
}
::CloseHandle(hFile);
}
else
{
sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() );
szResult = szScratch;
}
}
}
else
{
szResult = "DBGHELP.DLL too old";
}
}
else
{
szResult = "DBGHELP.DLL not found";
}
if (szResult)
::MessageBox( NULL, szResult, m_szAppName, MB_OK );
return retval;
}

View file

@ -0,0 +1,30 @@
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <assert.h>
#include <cstring>
#if _MSC_VER < 1300
#define DECLSPEC_DEPRECATED
// VC6: change this path to your Platform SDK headers
#include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" // must be XP version of file
#else
// VC7: ships with updated headers
#include "dbghelp.h"
#endif
// based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
class MiniDumper
{
private:
static LPCSTR m_szAppName;
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
public:
MiniDumper( LPCSTR szAppName );
};