mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- Backend update from GZDoom.
This commit is contained in:
parent
577c6cb374
commit
8a8379f5fc
13 changed files with 110 additions and 50 deletions
|
@ -528,8 +528,13 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
|||
offset = osave;
|
||||
}
|
||||
|
||||
DShape2D::~DShape2D() {
|
||||
delete lastParms;
|
||||
void DShape2D::OnDestroy() {
|
||||
if (lastParms) delete lastParms;
|
||||
lastParms = nullptr;
|
||||
mIndices.Reset();
|
||||
mVertices.Reset();
|
||||
mCoords.Reset();
|
||||
buffers.Reset();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -269,7 +269,7 @@ public:
|
|||
bool uploadedOnce = false;
|
||||
DrawParms* lastParms;
|
||||
|
||||
~DShape2D();
|
||||
void OnDestroy() override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -495,6 +495,7 @@ xx(Blockeverything)
|
|||
xx(Zoneboundary)
|
||||
xx(Jumpover)
|
||||
xx(Blockfloaters)
|
||||
xx(Blocklandmonsters)
|
||||
xx(Clipmidtex)
|
||||
xx(Wrapmidtex)
|
||||
xx(Midtex3d)
|
||||
|
@ -1109,3 +1110,5 @@ xy(menu_advance, "menu/advance")
|
|||
xx(zoomsize)
|
||||
xx(ScreenJobRunner)
|
||||
xx(RazeStatusBar)
|
||||
xx(RipSound)
|
||||
xx(Archvile)
|
||||
|
|
|
@ -238,7 +238,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
|
|||
vv = value - base;
|
||||
if (vv < 0 || vv >= count)
|
||||
{
|
||||
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %lli, size = %lli\n", key, vv, count);
|
||||
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %" PRId64 ", size = %" PRId64 "\n", key, vv, count);
|
||||
vv = -1;
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
|
|||
value = nullptr;
|
||||
else if (vv < 0 || vv >= count)
|
||||
{
|
||||
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %lli, size = %lli\n", key, vv, count);
|
||||
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %" PRId64 ", size = %" PRId64 "\n", key, vv, count);
|
||||
value = nullptr;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -958,28 +958,3 @@ char* CleanseString(char* str)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
#include "c_dispatch.h"
|
||||
FGameTexture* GetBaseForChar(FGameTexture* t);
|
||||
CCMD(dumpfonts)
|
||||
{
|
||||
for (auto c : { "tilesmallfont", "tilebigfont", "smallfont2", "digifont", "indexfont" })
|
||||
{
|
||||
auto f = V_GetFont(c);
|
||||
if (f)
|
||||
{
|
||||
Printf("%s\n{\n", c);
|
||||
for (int i = 33; i < 127; i++)
|
||||
{
|
||||
auto ch = f->GetChar(i, CR_UNDEFINED, nullptr);
|
||||
if (ch)
|
||||
{
|
||||
ch = GetBaseForChar(ch);
|
||||
if (i == 34) Printf("\t\"\\\""); else Printf("\t%c", i);
|
||||
Printf(" %s\n", ch->GetName().GetChars());
|
||||
}
|
||||
}
|
||||
Printf("}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -240,13 +240,12 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
|||
*/
|
||||
template<typename T, size_t L> void FOBJModel::ParseVector(TArray<T> &array)
|
||||
{
|
||||
float coord[L];
|
||||
for (size_t axis = 0; axis < L; axis++)
|
||||
T vec;
|
||||
for (unsigned axis = 0; axis < L; axis++)
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
coord[axis] = (float)sc.Float;
|
||||
vec[axis] = (float)sc.Float;
|
||||
}
|
||||
T vec(coord);
|
||||
array.Push(vec);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "s_soundinternal.h"
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "c_console.h"
|
||||
#include "c_cvars.h"
|
||||
|
@ -89,20 +90,83 @@ struct NSOperatingSystemVersion
|
|||
|
||||
#endif // before 10.10
|
||||
|
||||
static bool ReadSystemVersionFromPlist(NSOperatingSystemVersion& version)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 110000
|
||||
// The version returned by macOS depends on the SDK which the software has been built against.
|
||||
// When built against the 10.15 SDK or earlier, Big Sur returns 10.16 for compatibility with previous numbering.
|
||||
// When built against the 11.0 SDK, it returns 11.0 for forward compatibility.
|
||||
// https://eclecticlight.co/2020/08/13/macos-version-numbering-isnt-so-simple/
|
||||
|
||||
// It's impossible to load real SystemVersion.plist when linking with old SDK, i.e. when building for Intel CPU
|
||||
// Any attempt to read this file is redirected to SystemVersionCompat.plist silently
|
||||
// Workaround with the external process is needed in order to report correct macOS version
|
||||
|
||||
const char *const plistPath = "/System/Library/CoreServices/SystemVersion.plist";
|
||||
struct stat dummy;
|
||||
|
||||
if (stat(plistPath, &dummy) != 0)
|
||||
return false;
|
||||
|
||||
char commandLine[1024] = {};
|
||||
snprintf(commandLine, sizeof commandLine, "defaults read %s ProductVersion", plistPath);
|
||||
|
||||
FILE *const versionFile = popen(commandLine, "r");
|
||||
|
||||
if (versionFile == nullptr)
|
||||
return false;
|
||||
|
||||
NSOperatingSystemVersion plistVersion = {};
|
||||
char versionString[256] = {};
|
||||
|
||||
if (fgets(versionString, sizeof versionString, versionFile))
|
||||
{
|
||||
plistVersion.majorVersion = atoi(versionString);
|
||||
|
||||
if (const char *minorVersionString = strstr(versionString, "."))
|
||||
{
|
||||
minorVersionString++;
|
||||
plistVersion.minorVersion = atoi(minorVersionString);
|
||||
|
||||
if (const char *patchVersionString = strstr(minorVersionString, "."))
|
||||
{
|
||||
patchVersionString++;
|
||||
plistVersion.patchVersion = atoi(minorVersionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(versionFile);
|
||||
|
||||
if (plistVersion.majorVersion != 0)
|
||||
{
|
||||
version = plistVersion;
|
||||
return true;
|
||||
}
|
||||
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 110000
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_DetectOS()
|
||||
{
|
||||
NSOperatingSystemVersion version = {};
|
||||
NSProcessInfo* const processInfo = [NSProcessInfo processInfo];
|
||||
|
||||
if (!ReadSystemVersionFromPlist(version))
|
||||
{
|
||||
NSProcessInfo *const processInfo = [NSProcessInfo processInfo];
|
||||
|
||||
if ([processInfo respondsToSelector:@selector(operatingSystemVersion)])
|
||||
{
|
||||
version = [processInfo operatingSystemVersion];
|
||||
}
|
||||
}
|
||||
|
||||
const char* name = "Unknown version";
|
||||
|
||||
if (10 == version.majorVersion)
|
||||
switch (version.majorVersion)
|
||||
{
|
||||
case 10:
|
||||
switch (version.minorVersion)
|
||||
{
|
||||
case 9: name = "OS X Mavericks"; break;
|
||||
|
@ -114,13 +178,13 @@ void I_DetectOS()
|
|||
case 15: name = "macOS Catalina"; break;
|
||||
case 16: name = "macOS Big Sur"; break;
|
||||
}
|
||||
}
|
||||
else if (11 == version.majorVersion)
|
||||
{
|
||||
switch (version.minorVersion)
|
||||
{
|
||||
case 0: name = "macOS Big Sur"; break;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
name = "macOS Big Sur";
|
||||
break;
|
||||
case 12:
|
||||
name = "macOS Monterey";
|
||||
break;
|
||||
}
|
||||
|
||||
char release[16] = "unknown";
|
||||
|
|
|
@ -199,7 +199,7 @@ void I_DetectOS(void)
|
|||
}
|
||||
else if (info.dwMajorVersion == 10)
|
||||
{
|
||||
osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (or higher)" : "Server 2016 (or higher)";
|
||||
osname = (info.wProductType == VER_NT_WORKSTATION) ? (info.dwBuildNumber >= 22000 ? "11 (or higher)" : "10") : "Server 2016 (or higher)";
|
||||
sys_ostype = 3; // modern OS
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#undef min
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <set>
|
||||
|
@ -361,7 +362,7 @@ VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT mess
|
|||
if (callbackData->pObjects[i].pObjectName)
|
||||
{
|
||||
FString hexname;
|
||||
hexname.Format("0x%llx", callbackData->pObjects[i].objectHandle);
|
||||
hexname.Format("0x%" PRIx64, callbackData->pObjects[i].objectHandle);
|
||||
msg.Substitute(hexname.GetChars(), callbackData->pObjects[i].pObjectName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "volk/volk.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "v_video.h"
|
||||
#include "m_png.h"
|
||||
#include "templates.h"
|
||||
|
@ -698,7 +700,7 @@ void VulkanFrameBuffer::PrintStartupLog()
|
|||
const auto &limits = props.limits;
|
||||
Printf("Max. texture size: %d\n", limits.maxImageDimension2D);
|
||||
Printf("Max. uniform buffer range: %d\n", limits.maxUniformBufferRange);
|
||||
Printf("Min. uniform buffer offset alignment: %llu\n", limits.minUniformBufferOffsetAlignment);
|
||||
Printf("Min. uniform buffer offset alignment: %" PRIu64 "\n", limits.minUniformBufferOffsetAlignment);
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::CreateFanToTrisIndexBuffer()
|
||||
|
|
|
@ -1449,7 +1449,7 @@ FxFontCast::FxFontCast(FxExpression *x)
|
|||
: FxExpression(EFX_FontCast, x->ScriptPosition)
|
||||
{
|
||||
basex = x;
|
||||
ValueType = TypeSound;
|
||||
ValueType = TypeFont;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -978,10 +978,16 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, UnbindACommand)
|
|||
// This is only accessible to the special menu item to run CCMDs.
|
||||
DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
|
||||
{
|
||||
if (CurrentMenu == nullptr) return 0;
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(cmd);
|
||||
PARAM_BOOL(unsafe);
|
||||
|
||||
// Only menus are allowed to execute CCMDs.
|
||||
if (DMenu::InMenu == 0)
|
||||
{
|
||||
I_FatalError("Attempt to execute CCMD '%s' outside of menu code", cmd.GetChars());
|
||||
}
|
||||
|
||||
UnsafeExecutionScope scope(unsafe);
|
||||
C_DoCommand(cmd);
|
||||
return 0;
|
||||
|
|
|
@ -82,6 +82,11 @@ struct TVector2
|
|||
{
|
||||
}
|
||||
|
||||
TVector2(vec_t *o)
|
||||
: X(o[0]), Y(o[1])
|
||||
{
|
||||
}
|
||||
|
||||
void Zero()
|
||||
{
|
||||
Y = X = 0;
|
||||
|
|
Loading…
Reference in a new issue