Raised This Month: $23 Target: $400
 5% 

[INC] Smart Download Manager - Redux


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alienmario
Senior Member
Join Date: Aug 2013
Old 06-13-2024 , 16:31   [INC] Smart Download Manager - Redux
Reply With Quote #1

This is a modern rewrite of the original SmartDM by Zephyrus.

It allows plugin developers to specify a .mdl or or .vmt and have all required files added to downloads in a single line.

There are some important limitations, as mentioned in the readme.
Gamedata is required and a custom cache file may be required on linux.
These are, as of this release, provided for HL2DM and Black Mesa.
(You may have luck reusing them for other games)

Readme:

Quote:
Smart file downloader which seeks dependencies from the engine.
Never download unused files or list individual files by hand again!
Supports resolving dependencies for .mdl and .vmt files and precaching.
This is a full rewrite by Alienmario of the original SmartDM by Zephyrus.

SmartDM.Add(...) is the main entry point and likely all you'll need.
To enable debugging, add "#define SMARTDM_DEBUG" before this include.
Useful debug command: dumpstringtables
Note that all filenames will be turned lowercase before adding to downloads table.
You should always keep all your custom content lower-cased to avoid issues (esp. with linux clients)

Usually linux servers will not ship with shaders,
prohibiting automatic detection of shader parameters needed to resolve .vmt material files.
To overcome this, this include pairs with a cache file in SM's data folder.
This file is automatically generated if missing and shaders are available (e.g. on Windows).
Loading game specific (smartdm_shader_cache_<gamefoldername>.txt) or general (smartdm_shader_cache.txt)
caches is attempted before querying the game engine.

To enable scanning the custom folder, smartdm needs to be added as path id in gameinfo.txt
For example in HL2DM, the custom folder entry would look like this:
game+mod+smartdm hl2mp/custom/*

Requirements:
- Min SourceMod version: 1.12 - build 6963 (older builds possible if shader cache already exists)
Usage:

SmartDM.Add - Easy substitute for AddFileToDownloadsTable and precache functions.
PHP Code:
// int SmartDM.Add(const char[] file, bool precache = false, bool preload = true)
int numFilesAdded SmartDM.Add("models/model.mdl"truetrue); 
SmartDM.AddEx - Can be used for caching downloads for repeated usage on map changes.
PHP Code:
// void SmartDM.AddEx(const char[] file, SmartDM_FileSet results, bool precache = false, bool preload = true)

// @ OnPluginStart
SmartDM_FileSet downloads = new SmartDM_FileSet();
SmartDM.AddEx("materials/material.vmt"downloads);

// @ OnMapStart/OnConfigsExecuted
downloads.AddToDownloadsTable();

// Since SmartDM_FileSet is StringMap, you can use it as such
// downloads.Clear();
// int numDownloads = downloads.Size; 

Github

Last edited by Alienmario; 06-21-2024 at 12:49.
Alienmario is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode