RigsofRods
Soft-body Physics Simulation
CacheSystem.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2023 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
26 
27 #pragma once
28 
29 #include "Application.h"
30 #include "Language.h"
31 #include "RefCountingObject.h"
32 #include "RefCountingObjectPtr.h"
33 #include "RigDef_File.h"
34 #include "SimData.h"
35 
36 #include <Ogre.h>
37 #include <rapidjson/document.h>
38 #include <string>
39 #include <set>
40 
41 #define CACHE_FILE "mods.cache"
42 #define CACHE_FILE_FORMAT 13
43 #define CACHE_FILE_FRESHNESS 86400 // 60*60*24 = one day
44 
45 namespace RoR {
46 
47 struct AuthorInfo
48 {
49  int id = -1;
50  Ogre::String type;
51  Ogre::String name;
52  Ogre::String email;
53 };
54 
55 class CacheEntry: public RefCountingObject<CacheEntry>
56 {
57 
58 public:
59 
61  CacheEntry();
62  ~CacheEntry();
63 
65 
66  Ogre::String fpath;
67  Ogre::String fname;
68  Ogre::String fname_without_uid;
69  Ogre::String fext;
70  Ogre::String dname;
71 
72  int categoryid;
73  Ogre::String categoryname;
74 
75  std::time_t addtimestamp;
76  Ogre::String uniqueid;
77  Ogre::String guid;
78  std::set<std::string> addonpart_guids;
79  int version;
80 
81  std::string resource_bundle_type;
82  std::string resource_bundle_path;
83 
84  std::time_t filetime;
85  bool deleted;
87  std::vector<AuthorInfo> authors;
88  Ogre::String filecachename;
89 
90  Ogre::String resource_group;
91 
93  std::shared_ptr<RoR::SkinDef> skin_def;
95  // TBD: Make Terrn2Def a RefcountingObjectPtr<> and cache it here too.
96 
97  // following all TRUCK detail information:
98  Ogre::String description;
99  Ogre::String tags;
100  std::string default_skin;
120 
121  float truckmass;
122  float loadmass;
123  float minrpm;
124  float maxrpm;
125  float torque;
130  bool rescuer;
131 
133  int numgears;
135  std::vector<Ogre::String> sectionconfigs;
136 };
137 
139 
141 {
142  CID_None = 0,
143 
144  CID_Projects = 8000,
145  CID_Tuneups = 8001,
146 
147  CID_Max = 9000,
148  CID_Unsorted = 9990,
149  CID_All = 9991,
150  CID_Fresh = 9992,
151  CID_Hidden = 9993,
153 };
154 
156 {
157  CacheQueryResult(CacheEntryPtr entry, size_t score);
158 
159  bool operator<(CacheQueryResult const& other) const;
160 
162  size_t cqr_score;
163 };
164 
165 enum class CacheSearchMethod // Always case-insensitive
166 {
167  NONE,
168  FULLTEXT,
169  GUID,
170  AUTHORS,
171  WHEELS,
172  FILENAME
173 };
174 
176 {
179  std::string cqy_filter_guid;
181  std::string cqy_search_string;
182 
183  std::vector<CacheQueryResult> cqy_results;
184  std::map<int, size_t> cqy_res_category_usage;
185  std::time_t cqy_res_last_update = std::time_t();
186 
188  {
189  cqy_results.clear();
190  cqy_res_category_usage.clear();
191  cqy_res_last_update = std::time_t();
192  }
193 };
194 
195 enum class CacheValidity
196 {
197  UNKNOWN,
198  VALID,
199  NEEDS_UPDATE,
201 };
202 
204 {
205  NONE,
206  DEFAULT,
207  SAVE_TUNEUP,
208 };
209 
212 {
215 
216  std::string cpr_name;
217  std::string cpr_description;
222 };
223 
225 {
226  NONE,
243 };
244 
246 {
249 
250  // Subject (either name or ID applies depending on type)
251  std::string mpr_subject; // addonpart
252  int mpr_subject_id = -1; // wheel, prop, flexbody, node
253  int mpr_value_int; // forced wheel side
254 };
255 
269 {
270  friend class ContentManager;
271 public:
272  typedef std::map<int, Ogre::String> CategoryIdNameMap;
273 
274  CacheSystem();
275 
278  void LoadModCache(CacheValidity validity);
279  bool IsModCacheLoaded() { return m_loaded; }
281 
284  CacheEntryPtr FindEntryByFilename(RoR::LoaderType type, bool partial, const std::string& filename);
285  CacheEntryPtr GetEntryByNumber(int modid);
286  CacheEntryPtr FetchSkinByName(std::string const & skin_name);
287  size_t Query(CacheQuery& query);
289 
292  void LoadResource(CacheEntryPtr& t);
293  bool CheckResourceLoaded(Ogre::String &in_out_filename);
294  bool CheckResourceLoaded(Ogre::String &in_out_filename, Ogre::String &out_group);
295  void ReLoadResource(CacheEntryPtr& t);
296  void UnLoadResource(CacheEntryPtr& t);
298  void LoadAssetPack(CacheEntryPtr& t_dest, Ogre::String const & assetpack_filename);
299 
304  void ModifyProject(ModifyProjectRequest* request);
305  void DeleteProject(CacheEntryPtr& entry);
307 
308  const std::vector<CacheEntryPtr> &GetEntries() const { return m_entries; }
309  const CategoryIdNameMap &GetCategories() const { return m_categories; }
310 
311  Ogre::String GetPrettyName(Ogre::String fname);
312  std::string ActorTypeToName(ActorType driveable);
313 
314 
315 
316 private:
317 
318  CacheValidity EvaluateCacheValidity(); // Called by `ContentManager` on startup only.
319 
320  void WriteCacheFileJson();
321  void ExportEntryToJson(rapidjson::Value& j_entries, rapidjson::Document& j_doc, CacheEntryPtr const & entry);
323  void ImportEntryFromJson(rapidjson::Value& j_entry, CacheEntryPtr & out_entry);
324 
325  static Ogre::String StripUIDfromString(Ogre::String uidstr);
326  static Ogre::String StripSHA1fromString(Ogre::String sha1str);
327  static std::string ComposeResourceGroupName(const CacheEntryPtr& entry);
328 
329  void ParseZipArchives(Ogre::String group);
330  bool ParseKnownFiles(Ogre::String group); // returns true if no known files are found
331  void ParseSingleZip(Ogre::String path);
332 
333  void ClearCache(); // removes all files from the cache
334  void PruneCache(); // removes modified (or deleted) files from the cache
335  void ClearResourceGroups();
336 
337  void AddFile(Ogre::String group, Ogre::FileInfo f, Ogre::String ext);
338 
339  void DetectDuplicates();
340 
343  void LoadAssociatedSkinDef(CacheEntryPtr& cache_entry);
344  void LoadAssociatedTuneupDef(CacheEntryPtr& cache_entry);
345 
349  void FillTerrainDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds, Ogre::String fname);
350  void FillTruckDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds, Ogre::String fname, Ogre::String group);
351  void FillSkinDetailInfo(CacheEntryPtr &entry, std::shared_ptr<SkinDef>& skin_def);
352  void FillAddonPartDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds);
353  void FillTuneupDetailInfo(CacheEntryPtr &entry, TuneupDefPtr& tuneup_def);
354  void FillAssetPackDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds);
356 
358 
359  void GenerateFileCache(CacheEntryPtr &entry, Ogre::String group);
360  void RemoveFileCache(CacheEntryPtr &entry);
361 
362  bool Match(size_t& out_score, std::string data, std::string const& query, size_t );
363 
364  bool m_loaded = false;
365  std::time_t m_update_time;
368  std::vector<CacheEntryPtr> m_entries;
369  std::vector<Ogre::String> m_known_extensions;
370  std::set<Ogre::String> m_resource_paths;
371  std::map<int, Ogre::String> m_categories = {
372  // these are the category numbers from the repository. do not modify them!
373 
374  // vehicles
375  {108, _LC("ModCategory", "Other Land Vehicles")},
376 
377  {146, _LC("ModCategory", "Street Cars")},
378  {147, _LC("ModCategory", "Light Racing Cars")},
379  {148, _LC("ModCategory", "Offroad Cars")},
380  {149, _LC("ModCategory", "Fantasy Cars")},
381  {150, _LC("ModCategory", "Bikes")},
382  {155, _LC("ModCategory", "Crawlers")},
383 
384  {152, _LC("ModCategory", "Towercranes")},
385  {153, _LC("ModCategory", "Mobile Cranes")},
386  {154, _LC("ModCategory", "Other cranes")},
387 
388  {107, _LC("ModCategory", "Buses")},
389  {151, _LC("ModCategory", "Tractors")},
390  {156, _LC("ModCategory", "Forklifts")},
391  {159, _LC("ModCategory", "Fantasy Trucks")},
392  {160, _LC("ModCategory", "Transport Trucks")},
393  {161, _LC("ModCategory", "Racing Trucks")},
394  {162, _LC("ModCategory", "Offroad Trucks")},
395 
396  {110, _LC("ModCategory", "Boats")},
397 
398  {113, _LC("ModCategory", "Helicopters")},
399  {114, _LC("ModCategory", "Aircraft")},
400 
401  {117, _LC("ModCategory", "Trailers")},
402  {118, _LC("ModCategory", "Other Loads")},
403 
404  // terrains
405  {129, _LC("ModCategory", "Addon Terrains")},
406 
407  {859, _LC("ModCategory", "Container")},
408 
409  {875, _LC("ModCategory", "Submarine")},
410 
411  // note: these categories are NOT in the repository:
412  {5000, _LC("ModCategory", "Official Terrains")},
413  {5001, _LC("ModCategory", "Night Terrains")},
414 
415  {CID_Projects, _LC("ModCategory", "Projects")},
416  {CID_Tuneups, _LC("ModCategory", "Tuneups")},
417 
418  // do not use category numbers above 9000!
419  {CID_Unsorted, _LC("ModCategory", "Unsorted")},
420  {CID_All, _LC("ModCategory", "All")},
421  {CID_Fresh, _LC("ModCategory", "Fresh")},
422  {CID_Hidden, _LC("ModCategory", "Hidden")},
423  };
424 };
425 
426 } // namespace RoR
RoR::CacheEntryID_t
int CacheEntryID_t
index to CacheSystem::m_cache_entries, use RoR::CACHEENTRYNUM_INVALID as empty value.
Definition: ForwardDeclarations.h:49
RoR::CacheEntry::resource_bundle_type
std::string resource_bundle_type
Archive type recognized by OGRE resource system: 'FileSystem' or 'Zip'.
Definition: CacheSystem.h:81
RoR::CacheEntry::addonpart_guids
std::set< std::string > addonpart_guids
GUIDs of all vehicles this addonpart is used in. Empty for non-addonpart entries.
Definition: CacheSystem.h:78
RoR::CacheQueryResult::cqr_score
size_t cqr_score
Definition: CacheSystem.h:162
RoR::CacheSystem::m_known_extensions
std::vector< Ogre::String > m_known_extensions
the extensions we track in the cache system
Definition: CacheSystem.h:369
RoR::CacheSystem::LoadAssetPack
void LoadAssetPack(CacheEntryPtr &t_dest, Ogre::String const &assetpack_filename)
Adds asset pack to the requesting cache entry's resource group.
Definition: CacheSystem.cpp:1222
RoR::CacheSystem::GetEntries
const std::vector< CacheEntryPtr > & GetEntries() const
Definition: CacheSystem.h:308
RoR::CacheSystem::UnLoadResource
void UnLoadResource(CacheEntryPtr &t)
Unloads associated bundle, destroying all spawned actors.
Definition: CacheSystem.cpp:1432
RoR::CacheSystem::CategoryIdNameMap
std::map< int, Ogre::String > CategoryIdNameMap
Definition: CacheSystem.h:272
RoR::CacheSystem::FillTerrainDetailInfo
void FillTerrainDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds, Ogre::String fname)
Definition: CacheSystem.cpp:1109
RoR::ModifyProjectRequest::mpr_subject
std::string mpr_subject
Definition: CacheSystem.h:251
RoR::CID_Unsorted
@ CID_Unsorted
Definition: CacheSystem.h:148
RoR::CacheEntry::categoryid
int categoryid
category id
Definition: CacheSystem.h:72
RoR::CacheEntry::dname
Ogre::String dname
name parsed from the file
Definition: CacheSystem.h:70
RoR::CacheSearchMethod::GUID
@ GUID
Partial match in: guid.
RoR::ModifyProjectRequestType::TUNEUP_FORCEREMOVE_PROP_SET
@ TUNEUP_FORCEREMOVE_PROP_SET
'subject_id' is prop ID.
RoR::ModifyProjectRequest::mpr_subject_id
int mpr_subject_id
Definition: CacheSystem.h:252
RoR::CacheEntry::tags
Ogre::String tags
Definition: CacheSystem.h:99
RoR::CreateProjectRequest::cpr_description
std::string cpr_description
Optional, implemented for tuneups.
Definition: CacheSystem.h:217
RoR::CacheEntry::deleted
bool deleted
is this mod deleted?
Definition: CacheSystem.h:85
RoR::CacheSystem::IsModCacheLoaded
bool IsModCacheLoaded()
Definition: CacheSystem.h:279
RoR::CacheSystem::DeleteProject
void DeleteProject(CacheEntryPtr &entry)
Definition: CacheSystem.cpp:1870
RoR::CacheQuery::cqy_filter_category_id
int cqy_filter_category_id
Definition: CacheSystem.h:178
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_FLEXBODY_SET
@ TUNEUP_PROTECTED_FLEXBODY_SET
'subject_id' is flexbody ID.
RoR::CacheEntryPtr
RefCountingObjectPtr< CacheEntry > CacheEntryPtr
Definition: ForwardDeclarations.h:184
RoR::ModifyProjectRequestType
ModifyProjectRequestType
Definition: CacheSystem.h:224
RoR::CacheSearchMethod
CacheSearchMethod
Definition: CacheSystem.h:165
RoR::ModifyProjectRequestType::TUNEUP_FORCEREMOVE_PROP_RESET
@ TUNEUP_FORCEREMOVE_PROP_RESET
'subject_id' is prop ID.
RoR::CacheEntry::skin_def
std::shared_ptr< RoR::SkinDef > skin_def
Cached skin info, added on first use or during cache rebuild.
Definition: CacheSystem.h:93
RoR::AuthorInfo::type
Ogre::String type
Definition: CacheSystem.h:50
RoR::CacheEntry::version
int version
file's version
Definition: CacheSystem.h:79
RoR::CacheSystem::ClearResourceGroups
void ClearResourceGroups()
Definition: CacheSystem.cpp:404
RoR::CacheSystem::FindEntryByFilename
CacheEntryPtr FindEntryByFilename(RoR::LoaderType type, bool partial, const std::string &filename)
Returns NULL if none found.
Definition: CacheSystem.cpp:177
RoR::ModifyProjectRequestType::TUNEUP_FORCEREMOVE_FLEXBODY_SET
@ TUNEUP_FORCEREMOVE_FLEXBODY_SET
'subject_id' is flexbody ID.
RoR::CacheSystem::RemoveFileCache
void RemoveFileCache(CacheEntryPtr &entry)
Definition: CacheSystem.cpp:983
RoR::CacheQuery::cqy_search_method
CacheSearchMethod cqy_search_method
Definition: CacheSystem.h:180
RoR::CreateProjectRequestType::NONE
@ NONE
RoR::CreateProjectRequestType::SAVE_TUNEUP
@ SAVE_TUNEUP
Dumps .tuneup file with CID_Tuneup from source actor, will not overwrite existing unless explicitly i...
RoR::CacheSystem::m_update_time
std::time_t m_update_time
Ensures that all inserted files share the same timestamp.
Definition: CacheSystem.h:365
RoR::CreateProjectRequest::~CreateProjectRequest
~CreateProjectRequest()
Definition: CacheSystem.cpp:115
RoR::CacheSystem::LoadModCache
void LoadModCache(CacheValidity validity)
Definition: CacheSystem.cpp:144
RoR::CacheSystem::AddFile
void AddFile(Ogre::String group, Ogre::FileInfo f, Ogre::String ext)
Definition: CacheSystem.cpp:674
RoR::CacheEntry::driveable
ActorType driveable
Definition: CacheSystem.h:132
RoR::CacheEntry::importcommands
bool importcommands
Definition: CacheSystem.h:129
RoR::CacheEntry::number
CacheEntryID_t number
Sequential number, assigned internally, used by Selector-GUI.
Definition: CacheSystem.h:64
RoR::CreateProjectRequest::cpr_type
CreateProjectRequestType cpr_type
Definition: CacheSystem.h:220
RoR::CacheSystem::m_entries
std::vector< CacheEntryPtr > m_entries
Definition: CacheSystem.h:368
RoR::CacheSearchMethod::FILENAME
@ FILENAME
Partial match in file name.
RoR::ModifyProjectRequestType::TUNEUP_USE_ADDONPART_RESET
@ TUNEUP_USE_ADDONPART_RESET
'subject' is addonpart filename.
RoR::CacheEntry::tuneup_def
RoR::TuneupDefPtr tuneup_def
Cached tuning info, added on first use or during cache rebuild.
Definition: CacheSystem.h:94
RoR::CacheQuery
Definition: CacheSystem.h:175
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_WHEEL_RESET
@ TUNEUP_PROTECTED_WHEEL_RESET
'subject_id' is wheel ID.
RoR::CacheSystem::GetEntryByNumber
CacheEntryPtr GetEntryByNumber(int modid)
Definition: CacheSystem.cpp:489
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_FLEXBODY_RESET
@ TUNEUP_PROTECTED_FLEXBODY_RESET
'subject_id' is flexbody ID.
RoR::CID_Projects
@ CID_Projects
For truck files under 'projects/' directory, to allow listing from editors.
Definition: CacheSystem.h:144
RoR::CacheEntry::propwheelcount
int propwheelcount
Definition: CacheSystem.h:109
RoR::CacheSystem::FillAddonPartDetailInfo
void FillAddonPartDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds)
Definition: CacheSystem.cpp:1147
RoR::CacheEntry::hasSubmeshs
bool hasSubmeshs
Definition: CacheSystem.h:102
RoR::CacheEntry::resource_group
Ogre::String resource_group
Resource group of the loaded bundle. Empty if not loaded yet.
Definition: CacheSystem.h:90
RoR::CacheSystem::ModifyProject
void ModifyProject(ModifyProjectRequest *request)
Definition: CacheSystem.cpp:1746
RoR::ModifyProjectRequestType::TUNEUP_USE_ADDONPART_SET
@ TUNEUP_USE_ADDONPART_SET
'subject' is addonpart filename.
RoR::CID_None
@ CID_None
Definition: CacheSystem.h:142
RoR::CreateProjectRequest::CreateProjectRequest
CreateProjectRequest()
Definition: CacheSystem.cpp:110
RoR::CacheEntry::customtach
bool customtach
Definition: CacheSystem.h:126
RoR::CacheEntry::sectionconfigs
std::vector< Ogre::String > sectionconfigs
Definition: CacheSystem.h:135
RoR::CacheSystem::ExportEntryToJson
void ExportEntryToJson(rapidjson::Value &j_entries, rapidjson::Document &j_doc, CacheEntryPtr const &entry)
Definition: CacheSystem.cpp:523
RoR::CacheSystem::StripSHA1fromString
static Ogre::String StripSHA1fromString(Ogre::String sha1str)
Definition: CacheSystem.cpp:666
RoR::CacheSystem::ImportEntryFromJson
void ImportEntryFromJson(rapidjson::Value &j_entry, CacheEntryPtr &out_entry)
Definition: CacheSystem.cpp:246
RoR::CacheEntry::enginetype
char enginetype
Definition: CacheSystem.h:134
RoR::ContentManager
Definition: ContentManager.h:35
Language.h
RoR::CacheEntry::minrpm
float minrpm
Definition: CacheSystem.h:123
RoR::CacheEntry::description
Ogre::String description
Definition: CacheSystem.h:98
RoR::CacheQueryResult::cqr_entry
CacheEntryPtr cqr_entry
Definition: CacheSystem.h:161
RefCountingObjectPtr< TuneupDef >
RoR::CacheSystem::FillSkinDetailInfo
void FillSkinDetailInfo(CacheEntryPtr &entry, std::shared_ptr< SkinDef > &skin_def)
Definition: CacheSystem.cpp:1130
RoR::CacheSystem::PruneCache
void PruneCache()
Definition: CacheSystem.cpp:371
RoR::CacheSystem
A content database MOTIVATION: RoR users usually have A LOT of content installed.
Definition: CacheSystem.h:268
RoR::CreateProjectRequest::cpr_source_entry
CacheEntryPtr cpr_source_entry
The original mod to copy files from.
Definition: CacheSystem.h:218
RoR::CreateProjectRequest::cpr_name
std::string cpr_name
Directory and also the mod file (without extension).
Definition: CacheSystem.h:216
RoR::CacheEntry::forwardcommands
bool forwardcommands
Definition: CacheSystem.h:128
RoR::CacheSearchMethod::NONE
@ NONE
No searching.
RoR::CacheEntry::beamcount
int beamcount
Definition: CacheSystem.h:104
RoR::CacheQueryResult::operator<
bool operator<(CacheQueryResult const &other) const
Definition: CacheSystem.cpp:2051
RoR::CacheSystem::LoadCacheFileJson
CacheValidity LoadCacheFileJson()
Definition: CacheSystem.cpp:339
RoR::CacheEntry::shockcount
int shockcount
Definition: CacheSystem.h:105
RoR::ModifyProjectRequestType::TUNEUP_FORCED_WHEEL_SIDE_SET
@ TUNEUP_FORCED_WHEEL_SIDE_SET
'subject_id' is wheel ID, 'value_int' is RoR::WheelSide
RoR::CacheQuery::cqy_res_category_usage
std::map< int, size_t > cqy_res_category_usage
Total usage (ignores search params + category filter)
Definition: CacheSystem.h:184
RoR::CacheSystem::LoadAssociatedSkinDef
void LoadAssociatedSkinDef(CacheEntryPtr &cache_entry)
Loads+parses the .skin file and updates all related CacheEntries.
Definition: CacheSystem.cpp:1470
RoR::CacheSearchMethod::AUTHORS
@ AUTHORS
Partial match in: author name/email.
RoR::CacheEntry::rotatorscount
int rotatorscount
Definition: CacheSystem.h:116
RoR::CacheEntry::soundsourcescount
int soundsourcescount
Definition: CacheSystem.h:119
RoR::CacheSystem::FillTruckDetailInfo
void FillTruckDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds, Ogre::String fname, Ogre::String group)
Definition: CacheSystem.cpp:766
RoR::CacheEntry::torque
float torque
Definition: CacheSystem.h:125
RoR::CacheSystem::ClearCache
void ClearCache()
Definition: CacheSystem.cpp:642
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::CacheEntry::CacheEntry
CacheEntry()
default constructor resets the data.
Definition: CacheSystem.cpp:62
RoR::CacheSystem::Match
bool Match(size_t &out_score, std::string data, std::string const &query, size_t)
Definition: CacheSystem.cpp:2036
RoR::CacheEntry::authors
std::vector< AuthorInfo > authors
authors
Definition: CacheSystem.h:87
RoR::CacheEntry::filecachename
Ogre::String filecachename
preview image filename
Definition: CacheSystem.h:88
RoR::CacheSystem::ParseZipArchives
void ParseZipArchives(Ogre::String group)
Definition: CacheSystem.cpp:1042
RoR::CacheEntry::propscount
int propscount
Definition: CacheSystem.h:112
RoR::CacheSystem::DetectDuplicates
void DetectDuplicates()
Definition: CacheSystem.cpp:417
RoR::CacheValidity
CacheValidity
Definition: CacheSystem.h:195
RoR::CacheSystem::GetCategories
const CategoryIdNameMap & GetCategories() const
Definition: CacheSystem.h:309
RoR::CacheQueryResult
Definition: CacheSystem.h:155
RoR::CacheEntry::addtimestamp
std::time_t addtimestamp
timestamp when this file was added to the cache
Definition: CacheSystem.h:75
RoR::CreateProjectRequestType
CreateProjectRequestType
Definition: CacheSystem.h:203
RoR::CacheEntry::~CacheEntry
~CacheEntry()
Definition: CacheSystem.cpp:105
RoR::AuthorInfo::email
Ogre::String email
Definition: CacheSystem.h:52
RoR::CacheSystem::ParseSingleZip
void ParseSingleZip(Ogre::String path)
Definition: CacheSystem.cpp:1065
RoR::CID_Hidden
@ CID_Hidden
Definition: CacheSystem.h:151
RoR::CacheSystem::FillTuneupDetailInfo
void FillTuneupDetailInfo(CacheEntryPtr &entry, TuneupDefPtr &tuneup_def)
Definition: CacheSystem.cpp:1205
RoR::CacheSystem::LoadAssociatedTuneupDef
void LoadAssociatedTuneupDef(CacheEntryPtr &cache_entry)
Loads+parses the .tuneup file and updates all related CacheEntries.
Definition: CacheSystem.cpp:1519
RoR::CacheSystem::GetPrettyName
Ogre::String GetPrettyName(Ogre::String fname)
Definition: CacheSystem.cpp:499
RoR::CacheSystem::ParseKnownFiles
bool ParseKnownFiles(Ogre::String group)
Definition: CacheSystem.cpp:1088
RoR::CacheEntry::actor_def
RigDef::DocumentPtr actor_def
Cached actor definition (aka truckfile) after first spawn.
Definition: CacheSystem.h:92
RoR::CID_SearchResults
@ CID_SearchResults
Definition: CacheSystem.h:152
RoR::CacheEntry::fpath
Ogre::String fpath
filepath relative to the .zip file
Definition: CacheSystem.h:66
RoR::CacheSearchMethod::FULLTEXT
@ FULLTEXT
Partial match in: name, filename, description, author name/mail.
RoR::CacheSearchMethod::WHEELS
@ WHEELS
Wheel configuration, i.e. 4x4.
RoR::CacheValidity::UNKNOWN
@ UNKNOWN
RefCountingObject.h
RoR::CacheCategoryId
CacheCategoryId
Definition: CacheSystem.h:140
RoR::LoaderType
LoaderType
< Search mode for ModCache::Query() & Operation mode for GUI::MainSelector
Definition: Application.h:275
RoR::CacheEntry::rescuer
bool rescuer
Definition: CacheSystem.h:130
RoR::ModifyProjectRequest::mpr_target_actor
ActorPtr mpr_target_actor
Definition: CacheSystem.h:247
Application.h
Central state/object manager and communications hub.
RoR::CacheSystem::m_filenames_hash_loaded
std::string m_filenames_hash_loaded
hash from cachefile, for quick update detection
Definition: CacheSystem.h:366
RoR::CacheQueryResult::CacheQueryResult
CacheQueryResult(CacheEntryPtr entry, size_t score)
Definition: CacheSystem.cpp:120
RoR::CacheQuery::cqy_search_string
std::string cqy_search_string
Definition: CacheSystem.h:181
RoR::CacheSystem::m_categories
std::map< int, Ogre::String > m_categories
Definition: CacheSystem.h:371
RoR::CacheEntry
Definition: CacheSystem.h:55
RoR::CacheSystem::m_filenames_hash_generated
std::string m_filenames_hash_generated
stores hash over the content, for quick update detection
Definition: CacheSystem.h:367
RoR::CacheQuery::cqy_res_last_update
std::time_t cqy_res_last_update
Definition: CacheSystem.h:185
RoR::CacheSystem::GenerateFileCache
void GenerateFileCache(CacheEntryPtr &entry, Ogre::String group)
Definition: CacheSystem.cpp:991
RoR::CacheEntry::uniqueid
Ogre::String uniqueid
file's unique id
Definition: CacheSystem.h:76
RoR::CacheSystem::EvaluateCacheValidity
CacheValidity EvaluateCacheValidity()
Definition: CacheSystem.cpp:208
RoR::AuthorInfo
Definition: CacheSystem.h:47
RoR::ModifyProjectRequest::mpr_value_int
int mpr_value_int
Definition: CacheSystem.h:253
RoR::CacheEntry::loadmass
float loadmass
Definition: CacheSystem.h:122
RoR::CacheEntry::fixescount
int fixescount
Definition: CacheSystem.h:106
_LC
#define _LC(ctx, str)
Definition: Language.h:42
RoR::CacheSystem::CreateProject
CacheEntryPtr CreateProject(CreateProjectRequest *request)
Creates subdirectory in 'My Games\Rigs of Rods\projects', pre-populates it with files and adds modcac...
Definition: CacheSystem.cpp:1568
RoR::CacheSystem::LoadSupplementaryDocuments
void LoadSupplementaryDocuments(CacheEntryPtr &t)
Loads the associated .truck*, .skin and .tuneup files.
Definition: CacheSystem.cpp:1315
RoR::CacheQuery::resetResults
void resetResults()
Definition: CacheSystem.h:187
RoR::ModifyProjectRequest
Definition: CacheSystem.h:245
RoR::CID_Fresh
@ CID_Fresh
Definition: CacheSystem.h:150
RoR::CreateProjectRequest
Creates subdirectory in 'My Games\Rigs of Rods\projects', pre-populates it with files and adds modcac...
Definition: CacheSystem.h:211
RoR::ModifyProjectRequestType::PROJECT_LOAD_TUNEUP
@ PROJECT_LOAD_TUNEUP
'subject' is tuneup filename. This overwrites the auto-generated tuneup with the save.
RoR::CacheSystem::CheckResourceLoaded
bool CheckResourceLoaded(Ogre::String &in_out_filename)
Finds + loads the associated resource bundle if not already done.
Definition: CacheSystem.cpp:1261
RoR::CacheSystem::ActorTypeToName
std::string ActorTypeToName(ActorType driveable)
Definition: CacheSystem.cpp:509
RoR::CacheEntry::fileformatversion
int fileformatversion
Definition: CacheSystem.h:101
RoR::CacheEntry::numgears
int numgears
Definition: CacheSystem.h:133
RoR::CacheSystem::ComposeResourceGroupName
static std::string ComposeResourceGroupName(const CacheEntryPtr &entry)
Definition: CacheSystem.cpp:1301
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_PROP_SET
@ TUNEUP_PROTECTED_PROP_SET
'subject_id' is prop ID.
RoR::CreateProjectRequest::cpr_source_actor
ActorPtr cpr_source_actor
Only for type SAVE_TUNEUP
Definition: CacheSystem.h:219
RoR::ModifyProjectRequestType::NONE
@ NONE
RoR::CacheValidity::VALID
@ VALID
RoR::CacheSystem::FetchSkinByName
CacheEntryPtr FetchSkinByName(std::string const &skin_name)
Definition: CacheSystem.cpp:1458
RoR::CacheValidity::NEEDS_REBUILD
@ NEEDS_REBUILD
RoR::CID_Tuneups
@ CID_Tuneups
For unsorted tuneup files.
Definition: CacheSystem.h:145
RoR::CacheEntry::usagecounter
int usagecounter
how much it was used already
Definition: CacheSystem.h:86
RoR::CacheValidity::NEEDS_UPDATE
@ NEEDS_UPDATE
RoR::CacheEntry::fext
Ogre::String fext
file's extension
Definition: CacheSystem.h:69
RoR::CacheQuery::cqy_filter_type
RoR::LoaderType cqy_filter_type
Definition: CacheSystem.h:177
RoR::CacheSystem::LoadResource
void LoadResource(CacheEntryPtr &t)
Loads the associated resource bundle if not already done.
Definition: CacheSystem.cpp:1336
RoR::CacheSystem::WriteCacheFileJson
void WriteCacheFileJson()
Definition: CacheSystem.cpp:616
RoR::CacheEntry::wheelcount
int wheelcount
Definition: CacheSystem.h:108
RoR::CID_Max
@ CID_Max
SPECIAL VALUE - Maximum allowed to be present in any mod files.
Definition: CacheSystem.h:147
RoR::LT_None
@ LT_None
Definition: Application.h:277
RoR::ModifyProjectRequestType::TUNEUP_FORCEREMOVE_FLEXBODY_RESET
@ TUNEUP_FORCEREMOVE_FLEXBODY_RESET
'subject_id' is flexbody ID.
RoR::CacheEntry::nodecount
int nodecount
Definition: CacheSystem.h:103
RoR::CreateProjectRequest::cpr_overwrite
bool cpr_overwrite
Definition: CacheSystem.h:221
RoR::CacheEntry::resource_bundle_path
std::string resource_bundle_path
Path of ZIP or directory which contains the media. Shared between CacheEntries, loaded only once.
Definition: CacheSystem.h:82
RoR::CacheEntry::flexbodiescount
int flexbodiescount
Definition: CacheSystem.h:118
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_PROP_RESET
@ TUNEUP_PROTECTED_PROP_RESET
'subject_id' is prop ID.
RoR::CacheEntry::wingscount
int wingscount
Definition: CacheSystem.h:113
RoR::CacheSystem::ReLoadResource
void ReLoadResource(CacheEntryPtr &t)
Forces reloading the associated bundle.
Definition: CacheSystem.cpp:1419
RoR::CacheEntry::categoryname
Ogre::String categoryname
category name
Definition: CacheSystem.h:73
RefCountingObjectPtr.h
RoR::CacheEntry::exhaustscount
int exhaustscount
Definition: CacheSystem.h:117
RoR::ModifyProjectRequestType::TUNEUP_PROTECTED_WHEEL_SET
@ TUNEUP_PROTECTED_WHEEL_SET
'subject_id' is wheel ID.
RoR::CacheEntry::truckmass
float truckmass
Definition: CacheSystem.h:121
RoR::CacheEntry::maxrpm
float maxrpm
Definition: CacheSystem.h:124
RoR::ModifyProjectRequestType::PROJECT_RESET_TUNEUP
@ PROJECT_RESET_TUNEUP
'subject' is empty. This resets the auto-generated tuneup to orig. values.
RoR::CacheSystem::CacheSystem
CacheSystem()
Definition: CacheSystem.cpp:125
RoR::CacheEntry::turbopropscount
int turbopropscount
Definition: CacheSystem.h:114
RoR::CacheQuery::cqy_filter_guid
std::string cqy_filter_guid
Exact match; leave empty to disable.
Definition: CacheSystem.h:179
RoR::CacheEntry::turbojetcount
int turbojetcount
Definition: CacheSystem.h:115
RigDef::DocumentPtr
std::shared_ptr< Document > DocumentPtr
Definition: RigDef_Prerequisites.h:38
RoR::CacheEntry::hydroscount
int hydroscount
Definition: CacheSystem.h:107
RefCountingObject
Self reference-counting objects, as requred by AngelScript garbage collector.
Definition: RefCountingObject.h:26
RoR::ModifyProjectRequest::mpr_type
ModifyProjectRequestType mpr_type
Definition: CacheSystem.h:248
RoR::ActorType
ActorType
< Aka 'Driveable'
Definition: SimData.h:99
RoR::ModifyProjectRequestType::TUNEUP_FORCED_WHEEL_SIDE_RESET
@ TUNEUP_FORCED_WHEEL_SIDE_RESET
'subject_id' is wheel ID.
RoR::CacheEntry::filetime
std::time_t filetime
filetime
Definition: CacheSystem.h:84
RoR::CacheSystem::FillAssetPackDetailInfo
void FillAssetPackDetailInfo(CacheEntryPtr &entry, Ogre::DataStreamPtr ds)
Definition: CacheSystem.cpp:1173
RoR::CacheEntry::custom_particles
bool custom_particles
Definition: CacheSystem.h:127
RoR::CreateProjectRequestType::DEFAULT
@ DEFAULT
Copy files from source mod. Source mod Determines mod file extension.
RoR::CID_All
@ CID_All
Definition: CacheSystem.h:149
RoR::AuthorInfo::name
Ogre::String name
Definition: CacheSystem.h:51
RoR::CacheEntry::commandscount
int commandscount
Definition: CacheSystem.h:110
RigDef_File.h
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...
RoR
Definition: AppContext.h:36
RoR::CacheSystem::Query
size_t Query(CacheQuery &query)
Definition: CacheSystem.cpp:1917
RoR::CacheQuery::cqy_results
std::vector< CacheQueryResult > cqy_results
Definition: CacheSystem.h:183
RoR::CacheEntry::default_skin
std::string default_skin
Definition: CacheSystem.h:100
RoR::CacheSystem::GenerateHashFromFilenames
void GenerateHashFromFilenames()
For quick detection of added/removed content.
Definition: CacheSystem.cpp:1103
RoR::CacheEntry::guid
Ogre::String guid
global unique id. Type "addonpart" leaves this empty.
Definition: CacheSystem.h:77
RoR::CacheSystem::m_resource_paths
std::set< Ogre::String > m_resource_paths
A temporary list of existing resource paths.
Definition: CacheSystem.h:370
RoR::CacheEntry::flarescount
int flarescount
Definition: CacheSystem.h:111
RoR::CacheSystem::m_loaded
bool m_loaded
Definition: CacheSystem.h:364
RoR::CacheSystem::StripUIDfromString
static Ogre::String StripUIDfromString(Ogre::String uidstr)
Definition: CacheSystem.cpp:658
RoR::CacheEntry::fname
Ogre::String fname
filename
Definition: CacheSystem.h:67
RoR::CacheEntry::fname_without_uid
Ogre::String fname_without_uid
filename
Definition: CacheSystem.h:68