Merge pull request #908 from Azaezel/alpha401/dediserverfixes

dedicated server cleanups
This commit is contained in:
Brian Roberts 2022-10-01 14:19:42 -05:00 committed by GitHub
commit ea7ca63301
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 25 deletions

View file

@ -48,6 +48,8 @@
#include <string>
#include "assetMacroHelpers.h"
#include "gfx/gfxDevice.h"
//-----------------------------------------------------------------------------
class ImageAsset : public AssetBase
{
@ -250,7 +252,8 @@ public: \
}\
else if (!m##name)\
{\
Con::errorf("%s(%s)::_set%s() - Couldn't load image \"%s\"", macroText(className), getName(), macroText(name), _in);\
if (GFX->getAdapterType() != NullDevice)\
Con::errorf("%s(%s)::_set%s() - Couldn't load image \"%s\"", macroText(className), getName(), macroText(name), _in);\
return false;\
}\
return true;\
@ -392,7 +395,8 @@ public: \
}\
else if (!m##name[index])\
{\
Con::errorf("%s(%s)::_set%s(%i) - Couldn't load image \"%s\"", macroText(className), getName(), macroText(name), index, _in);\
if (GFX->getAdapterType() != NullDevice)\
Con::errorf("%s(%s)::_set%s(%i) - Couldn't load image \"%s\"", macroText(className), getName(), macroText(name), index, _in);\
return false; \
}\
return true;\

View file

@ -358,8 +358,9 @@ bool ShapeAsset::loadShape()
mLoadedState = BadFileReference;
return false; //if it failed to load, bail out
}
mShape->setupBillboardDetails(mFilePath, mDiffuseImposterPath, mNormalImposterPath);
// Construct billboards if not done already
if (GFXDevice::devicePresent())
mShape->setupBillboardDetails(mFilePath, mDiffuseImposterPath, mNormalImposterPath);
//If they exist, grab our imposters here and bind them to our shapeAsset

View file

@ -87,8 +87,16 @@ GFXNullTextureObject::GFXNullTextureObject(GFXDevice * aDevice, GFXTextureProfil
class GFXNullTextureManager : public GFXTextureManager
{
public:
GFXTextureObject* createTexture(GBitmap* bmp, const String& resourceName, GFXTextureProfile* profile, bool deleteBmp) { return nullptr; } // _createNullTextureObject();}
GFXTextureObject* createTexture(DDSFile* dds, GFXTextureProfile* profile, bool deleteDDS) { return nullptr; }
GFXTextureObject* createTexture(const Torque::Path& path, GFXTextureProfile* profile) { return nullptr; }
GFXTextureObject* createTexture(U32 width, U32 height, void* pixels, GFXFormat format, GFXTextureProfile* profile) { return nullptr; }
GFXTextureObject* createTexture(U32 width, U32 height, U32 depth, GFXFormat format, GFXTextureProfile* profile, U32 numMipLevels = 1) { return nullptr; }
GFXTextureObject* createTexture(U32 width, U32 height, GFXFormat format, GFXTextureProfile* profile, U32 numMipLevels, S32 antialiasLevel) { return nullptr; }
GFXTextureObject* createCompositeTexture(GBitmap* bmp[4], U32 inputKey[4], const String& resourceName, GFXTextureProfile* profile, bool deleteBmp) { return nullptr; }
protected:
virtual GFXTextureObject *_createTextureObject( U32 height,
GFXTextureObject *_createTextureObject( U32 height,
U32 width,
U32 depth,
GFXFormat format,

View file

@ -295,6 +295,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
MaterialFeatureData &fd,
const FeatureSet &features )
{
if (GFX->getAdapterType() == NullDevice) return;
PROFILE_SCOPE( ProcessedShaderMaterial_DetermineFeatures );
const F32 shaderVersion = GFX->getPixelShaderVersion();

View file

@ -593,6 +593,7 @@ void ProcessedDeferredMaterial::_determineFeatures( U32 stageNum,
MaterialFeatureData &fd,
const FeatureSet &features )
{
if (GFX->getAdapterType() == NullDevice) return;
Parent::_determineFeatures( stageNum, fd, features );
if (fd.features.hasFeature(MFT_ForwardShading))
return;

View file

@ -77,7 +77,8 @@ SFXNullProvider::~SFXNullProvider()
void SFXNullProvider::addDeviceDesc( const String& name, const String& desc )
{
SFXDeviceInfo* info = new SFXDeviceInfo;
info->name = desc;
info->internalName = desc;
info->name = "Null Device";
info->driver = name;
info->hasHardware = false;
info->maxBuffers = 8;
@ -91,7 +92,7 @@ SFXDevice* SFXNullProvider::createDevice( const String& deviceName, bool useHard
// Do we find one to create?
if ( info )
return new SFXNullDevice( this, info->name, useHardware, maxBuffers );
return new SFXNullDevice( this, info->internalName, useHardware, maxBuffers );
return NULL;
}

View file

@ -149,6 +149,12 @@ function sfxInit()
if( sfxGetDeviceInfo() !$= "" )
sfxShutdown();
if ($isDedicated)
{
sfxCreateDevice("Null","Null Device", false, 8);
return true;
}
// Start it up!
%maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers;
if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) )

View file

@ -499,18 +499,24 @@ function displayHelp()
// (flushing the write buffer) after every write.
// -log 2 overwrites any existing logfile; it also only closes
// the logfile when the application shuts down. (default)
error(
"Torque Demo command line options:\n"@
" -log <logmode> Logging behavior; see main." @ $TorqueScriptFileExtension @ " comments for details\n"@
" -game <game_name> Reset list of mods to only contain <game_name>\n"@
" <game_name> Works like the -game argument\n"@
" -dir <dir_name> Add <dir_name> to list of directories\n"@
" -console Open a separate console\n"@
" -jSave <file_name> Record a journal\n"@
" -jPlay <file_name> Play back a journal\n"@
" -help Display this help message\n"
);
%helpstring = "Torque Demo command line options:\n";
%helpstring =%helpstring @ " -log <logmode> Logging behavior; see main." @ $TorqueScriptFileExtension @ " comments for details\n";
%helpstring =%helpstring @ " -game <game_name> Reset list of mods to only contain <game_name>\n";
%helpstring =%helpstring @ " <game_name> Works like the -game argument\n";
%helpstring =%helpstring @ " -dir <dir_name> Add <dir_name> to list of directories\n";
%helpstring =%helpstring @ " -console Open a separate console\n";
%helpstring =%helpstring @ " -jSave <file_name> Record a journal\n";
%helpstring =%helpstring @ " -jPlay <file_name> Play back a journal\n";
%helpstring =%helpstring @ " -help Display this help message\n";
error(%helpstring);
%file = new FileObject();
if(%file.openForWrite("help.txt"))
%file.writeLine(%helpstring);
%file.close();
%file.delete();
}
// Execute startup scripts for each mod, starting at base and working up

View file

@ -55,7 +55,7 @@ function parseArgs()
{
$userDirs = $defaultGame;
$dirCount = 1;
%isDedicated = true;
$isDedicated = true;
}*/
switch$ ($arg)
@ -64,7 +64,7 @@ function parseArgs()
case "-dedicated":
$userDirs = $defaultGame;
$dirCount = 1;
%isDedicated = true;
$isDedicated = true;
$Server::Dedicated = true;
enableWinConsole(true);
$argUsed[%i]++;
@ -138,7 +138,7 @@ function parseArgs()
{
// Set the selected dir --NOTE: we no longer allow tools with this argument
/*
if( %isDedicated )
if( $isDedicated )
{
$userDirs = $nextArg;
$dirCount = 1;
@ -311,7 +311,7 @@ function parseArgs()
case "-help":
$displayHelp = true;
$argUsed[%i]++;
displayHelp();
//-------------------
case "-compileAll":
$compileAll = true;

View file

@ -44,7 +44,7 @@ if(isFunction("loadStartup"))
else
{
//If nothing else set a main menu, try to do so now
if(!isObject(Canvas.getContent()))
if(isObject(Canvas) && !isObject(Canvas.getContent()))
{
if (isObject( ProjectSettings.value("UI/mainMenuName") ))
Canvas.setContent( ProjectSettings.value("UI/mainMenuName") );
@ -54,4 +54,4 @@ else
if ( ($Server::Dedicated == false) && ($platform $= "windows") )
closeSplashWindow();
echo("Engine initialized...");
echo("Engine initialized...");