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 <string>
#include "assetMacroHelpers.h" #include "assetMacroHelpers.h"
#include "gfx/gfxDevice.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class ImageAsset : public AssetBase class ImageAsset : public AssetBase
{ {
@ -250,7 +252,8 @@ public: \
}\ }\
else if (!m##name)\ 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 false;\
}\ }\
return true;\ return true;\
@ -392,7 +395,8 @@ public: \
}\ }\
else if (!m##name[index])\ 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 false; \
}\ }\
return true;\ return true;\

View file

@ -358,8 +358,9 @@ bool ShapeAsset::loadShape()
mLoadedState = BadFileReference; mLoadedState = BadFileReference;
return false; //if it failed to load, bail out return false; //if it failed to load, bail out
} }
// Construct billboards if not done already
mShape->setupBillboardDetails(mFilePath, mDiffuseImposterPath, mNormalImposterPath); if (GFXDevice::devicePresent())
mShape->setupBillboardDetails(mFilePath, mDiffuseImposterPath, mNormalImposterPath);
//If they exist, grab our imposters here and bind them to our shapeAsset //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 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: protected:
virtual GFXTextureObject *_createTextureObject( U32 height, GFXTextureObject *_createTextureObject( U32 height,
U32 width, U32 width,
U32 depth, U32 depth,
GFXFormat format, GFXFormat format,

View file

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

View file

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

View file

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

View file

@ -149,6 +149,12 @@ function sfxInit()
if( sfxGetDeviceInfo() !$= "" ) if( sfxGetDeviceInfo() !$= "" )
sfxShutdown(); sfxShutdown();
if ($isDedicated)
{
sfxCreateDevice("Null","Null Device", false, 8);
return true;
}
// Start it up! // Start it up!
%maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers; %maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers;
if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) ) 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. // (flushing the write buffer) after every write.
// -log 2 overwrites any existing logfile; it also only closes // -log 2 overwrites any existing logfile; it also only closes
// the logfile when the application shuts down. (default) // the logfile when the application shuts down. (default)
error( %helpstring = "Torque Demo command line options:\n";
"Torque Demo command line options:\n"@ %helpstring =%helpstring @ " -log <logmode> Logging behavior; see main." @ $TorqueScriptFileExtension @ " comments for details\n";
" -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";
" -game <game_name> Reset list of mods to only contain <game_name>\n"@ %helpstring =%helpstring @ " <game_name> Works like the -game argument\n";
" <game_name> Works like the -game argument\n"@ %helpstring =%helpstring @ " -dir <dir_name> Add <dir_name> to list of directories\n";
" -dir <dir_name> Add <dir_name> to list of directories\n"@ %helpstring =%helpstring @ " -console Open a separate console\n";
" -console Open a separate console\n"@ %helpstring =%helpstring @ " -jSave <file_name> Record a journal\n";
" -jSave <file_name> Record a journal\n"@ %helpstring =%helpstring @ " -jPlay <file_name> Play back a journal\n";
" -jPlay <file_name> Play back a journal\n"@ %helpstring =%helpstring @ " -help Display this help message\n";
" -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 // Execute startup scripts for each mod, starting at base and working up

View file

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

View file

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