mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-04 06:55:48 +00:00
- partial backend update from GZDoom.
This commit is contained in:
parent
486da6922d
commit
3ec8a96ddf
10 changed files with 58 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "i_interface.h"
|
||||
#include "st_start.h"
|
||||
|
||||
static_assert(sizeof(void*) == 8, "32 builds are not supported");
|
||||
|
||||
// Some global engine variables taken out of the backend code.
|
||||
FStartupScreen* StartWindow;
|
||||
SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -75,8 +75,17 @@ xx(ACS_NamedExecuteWithResult)
|
|||
xx(__decorate_internal_int__)
|
||||
xx(__decorate_internal_bool__)
|
||||
xx(__decorate_internal_float__)
|
||||
|
||||
// Per-actor sound channels (for deprecated PlaySoundEx function) Do not separate this block!!!
|
||||
xx(Auto)
|
||||
xx(Weapon)
|
||||
xx(Voice)
|
||||
xx(Item)
|
||||
xx(Body)
|
||||
xx(SoundSlot5)
|
||||
xx(SoundSlot6)
|
||||
xx(SoundSlot7)
|
||||
|
||||
xx(LevelLocals)
|
||||
xx(Level)
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
#define __STATS_H__
|
||||
|
||||
#include "zstring.h"
|
||||
#if defined __i386__
|
||||
#include "x86.h"
|
||||
#endif
|
||||
|
||||
#if !defined _WIN32 && !defined __APPLE__
|
||||
|
||||
|
|
|
@ -164,6 +164,9 @@ void I_DetectOS()
|
|||
case 12:
|
||||
name = "macOS Monterey";
|
||||
break;
|
||||
case 13:
|
||||
name = "macOS Ventura";
|
||||
break;
|
||||
}
|
||||
|
||||
char release[16] = "unknown";
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "utf8.h"
|
||||
#include "v_font.h"
|
||||
#include "i_net.h"
|
||||
#include "engineerrors.h"
|
||||
#include <richedit.h>
|
||||
#include <shellapi.h>
|
||||
#include <commctrl.h>
|
||||
|
@ -264,7 +265,7 @@ static INT_PTR CALLBACK NetStartPaneProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
|
|||
{
|
||||
if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
PostMessage(hDlg, WM_COMMAND, 1337, 1337);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -357,6 +358,11 @@ bool MainWindow::RunMessageLoop(bool (*timer_callback)(void*), void* userdata)
|
|||
}
|
||||
else
|
||||
{
|
||||
// This must be outside the window function so that the exception does not cross DLL boundaries.
|
||||
if (msg.message == WM_COMMAND && msg.wParam == 1337 && msg.lParam == 1337)
|
||||
{
|
||||
throw CExitEvent(0);
|
||||
}
|
||||
if (msg.message == WM_TIMER && msg.hwnd == Window && msg.wParam == 1337)
|
||||
{
|
||||
if (timer_callback(userdata))
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
bool I_GetVulkanPlatformExtensions(unsigned int *count, const char **names);
|
||||
bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface);
|
||||
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames);
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames = -1);
|
||||
|
||||
// Physical device info
|
||||
static std::vector<VulkanPhysicalDevice> AvailableDevices;
|
||||
|
@ -409,7 +409,7 @@ VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT mess
|
|||
|
||||
if (vk_debug_callstack && showcallstack)
|
||||
{
|
||||
FString callstack = JitCaptureStackTrace(0, true);
|
||||
FString callstack = JitCaptureStackTrace(0, true, 5);
|
||||
if (!callstack.IsEmpty())
|
||||
Printf("%s\n", callstack.GetChars());
|
||||
}
|
||||
|
|
|
@ -1850,7 +1850,7 @@ FxExpression *FxMinusSign::Resolve(FCompileContext& ctx)
|
|||
|
||||
ExpEmit FxMinusSign::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
assert(ValueType == Operand->ValueType);
|
||||
//assert(ValueType == Operand->ValueType);
|
||||
ExpEmit from = Operand->Emit(build);
|
||||
ExpEmit to;
|
||||
assert(from.Konst == 0);
|
||||
|
@ -2777,7 +2777,7 @@ FxExpression *FxAddSub::Resolve(FCompileContext& ctx)
|
|||
else if (left->IsVector() && right->IsVector())
|
||||
{
|
||||
// a vector2 can be added to or subtracted from a vector 3 but it needs to be the right operand.
|
||||
if (left->ValueType == right->ValueType || (left->IsVector3() && right->IsVector2()))
|
||||
if (((left->IsVector3() || left->IsVector2()) && right->IsVector2()) || (left->IsVector3() && right->IsVector3()))
|
||||
{
|
||||
ValueType = left->ValueType;
|
||||
}
|
||||
|
@ -3522,7 +3522,8 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (left->ValueType != right->ValueType) // identical types are always comparable, if they can be placed in a register, so we can save most checks if this is the case.
|
||||
// identical types are always comparable, if they can be placed in a register, so we can save most checks if this is the case.
|
||||
if (left->ValueType != right->ValueType && !(left->IsVector2() && right->IsVector2()) && !(left->IsVector3() && right->IsVector3()))
|
||||
{
|
||||
FxExpression *x;
|
||||
if (left->IsNumeric() && right->ValueType == TypeString && (x = StringConstToChar(right)))
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
|
||||
JitFuncPtr JitCompile(VMScriptFunction *func);
|
||||
void JitDumpLog(FILE *file, VMScriptFunction *func);
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames);
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames = -1);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#ifdef WIN32
|
||||
#include <DbgHelp.h>
|
||||
#include <psapi.h>
|
||||
#else
|
||||
#include <execinfo.h>
|
||||
#include <cxxabi.h>
|
||||
|
@ -813,8 +814,16 @@ static int CaptureStackTrace(int max_frames, void **out_frames)
|
|||
class NativeSymbolResolver
|
||||
{
|
||||
public:
|
||||
NativeSymbolResolver() { SymInitialize(GetCurrentProcess(), nullptr, TRUE); }
|
||||
~NativeSymbolResolver() { SymCleanup(GetCurrentProcess()); }
|
||||
NativeSymbolResolver()
|
||||
{
|
||||
SymInitialize(GetCurrentProcess(), nullptr, TRUE);
|
||||
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(0), &moduleInfo, sizeof(MODULEINFO));
|
||||
}
|
||||
|
||||
~NativeSymbolResolver()
|
||||
{
|
||||
SymCleanup(GetCurrentProcess());
|
||||
}
|
||||
|
||||
FString GetName(void *frame)
|
||||
{
|
||||
|
@ -830,6 +839,9 @@ public:
|
|||
BOOL result = SymGetSymFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, symbol64);
|
||||
if (result)
|
||||
{
|
||||
if ((DWORD64)frame < (DWORD64)moduleInfo.lpBaseOfDll || (DWORD64)frame >= ((DWORD64)moduleInfo.lpBaseOfDll + moduleInfo.SizeOfImage))
|
||||
return s; // Ignore anything not from the exe itself
|
||||
|
||||
IMAGEHLP_LINE64 line64;
|
||||
DWORD displacement1 = 0;
|
||||
memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
|
||||
|
@ -847,6 +859,8 @@ public:
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
MODULEINFO moduleInfo = {};
|
||||
};
|
||||
#else
|
||||
class NativeSymbolResolver
|
||||
|
@ -952,7 +966,7 @@ FString JitGetStackFrameName(NativeSymbolResolver *nativeSymbols, void *pc)
|
|||
return nativeSymbols ? nativeSymbols->GetName(pc) : FString();
|
||||
}
|
||||
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames)
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames)
|
||||
{
|
||||
void *frames[32];
|
||||
int numframes = CaptureStackTrace(32, frames);
|
||||
|
@ -961,10 +975,18 @@ FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames)
|
|||
if (includeNativeFrames)
|
||||
nativeSymbols.reset(new NativeSymbolResolver());
|
||||
|
||||
int total = 0;
|
||||
FString s;
|
||||
for (int i = framesToSkip + 1; i < numframes; i++)
|
||||
{
|
||||
s += JitGetStackFrameName(nativeSymbols.get(), frames[i]);
|
||||
FString name = JitGetStackFrameName(nativeSymbols.get(), frames[i]);
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
s += name;
|
||||
total++;
|
||||
if (maxFrames != -1 && maxFrames == total)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
|
|||
}
|
||||
#else
|
||||
CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET)
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames) { return FString(); }
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames) { return FString(); }
|
||||
void JitRelease() {}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue