Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
ContentManager.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-2018 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
23
24#pragma once
25
26#include "CacheSystem.h"
27#include "Application.h"
28
29#include <OgreResourceGroupManager.h>
30#include <OgreScriptCompiler.h>
31#include <rapidjson/document.h>
32
33namespace RoR {
34
36 public Ogre::ResourceLoadingListener, // Ogre::ResourceGroupManager::getSingleton().setLoadingListener()
37 public Ogre::ScriptCompilerListener // Ogre::ScriptCompilerManager::getSingleton().setListener()
38{
39public:
40
42 {
46
47 static const ResourcePack OGRE_CORE;
49 static const ResourcePack AIRFOILS;
51 static const ResourcePack CAELUM;
52 static const ResourcePack CUBEMAPS;
54 static const ResourcePack FAMICONS;
55 static const ResourcePack FLAGS;
56 static const ResourcePack FONTS;
57 static const ResourcePack HYDRAX;
58 static const ResourcePack ICONS;
59 static const ResourcePack MATERIALS;
60 static const ResourcePack MESHES;
61 static const ResourcePack MYGUI;
62 static const ResourcePack OVERLAYS;
63 static const ResourcePack PAGED;
64 static const ResourcePack PARTICLES;
65 static const ResourcePack PSSM;
66 static const ResourcePack SKYX;
67 static const ResourcePack RTSHADER;
68 static const ResourcePack SCRIPTS;
69 static const ResourcePack SOUNDS;
70 static const ResourcePack TEXTURES;
71
72 const char* name;
74 };
75
78 void AddResourcePack(ResourcePack const& resource_pack, std::string const& override_rgn = "");
79 void InitManagedMaterials(std::string const & rg_name);
80 void InitContentManager();
81 void InitModCache(CacheValidity validity);
83 std::string ListAllUserContent();
84 bool DeleteDiskFile(std::string const& filename, std::string const& rg_name);
85
86 // JSON:
87 bool LoadAndParseJson(std::string const& filename, std::string const& rg_name, rapidjson::Document& j_doc);
88 bool SerializeAndWriteJson(std::string const& filename, std::string const& rg_name, rapidjson::Document& j_doc);
89
90private:
91
92 // Ogre::ResourceLoadingListener
93 Ogre::DataStreamPtr resourceLoading(const Ogre::String& name, const Ogre::String& group, Ogre::Resource* resource) override;
94 void resourceStreamOpened(const Ogre::String& name, const Ogre::String& group, Ogre::Resource* resource, Ogre::DataStreamPtr& dataStream) override;
95 bool resourceCollision(Ogre::Resource* resource, Ogre::ResourceManager* resourceManager) override;
96
97 // Ogre::ScriptCompilerListener
98 bool handleEvent(Ogre::ScriptCompiler *compiler, Ogre::ScriptCompilerEvent *evt, void *retval) override;
99
101};
102
103} // namespace RoR
Central state/object manager and communications hub.
A database of user-installed content alias 'mods' (vehicles, terrains...)
bool resourceCollision(Ogre::Resource *resource, Ogre::ResourceManager *resourceManager) override
Ogre::DataStreamPtr resourceLoading(const Ogre::String &name, const Ogre::String &group, Ogre::Resource *resource) override
void AddResourcePack(ResourcePack const &resource_pack, std::string const &override_rgn="")
Loads resources if not already loaded.
bool handleEvent(Ogre::ScriptCompiler *compiler, Ogre::ScriptCompilerEvent *evt, void *retval) override
bool DeleteDiskFile(std::string const &filename, std::string const &rg_name)
bool LoadAndParseJson(std::string const &filename, std::string const &rg_name, rapidjson::Document &j_doc)
bool SerializeAndWriteJson(std::string const &filename, std::string const &rg_name, rapidjson::Document &j_doc)
void resourceStreamOpened(const Ogre::String &name, const Ogre::String &group, Ogre::Resource *resource, Ogre::DataStreamPtr &dataStream) override
void InitModCache(CacheValidity validity)
std::string ListAllUserContent()
Used by ModCache for quick detection of added/removed content.
void LoadGameplayResources()
Checks GVar settings and loads required resources.
void InitManagedMaterials(std::string const &rg_name)
CacheValidity
static const ResourcePack HYDRAX
static const ResourcePack WALLPAPERS
static const ResourcePack DASHBOARDS
static const ResourcePack OVERLAYS
static const ResourcePack PARTICLES
static const ResourcePack TEXTURES
static const ResourcePack RTSHADER
static const ResourcePack MESHES
ResourcePack(const char *name, const char *resource_group_name)
static const ResourcePack SOUNDS
static const ResourcePack FONTS
static const ResourcePack MYGUI
static const ResourcePack PSSM
static const ResourcePack BEAM_OBJECTS
static const ResourcePack AIRFOILS
static const ResourcePack SCRIPTS
static const ResourcePack SKYX
static const ResourcePack OGRE_CORE
static const ResourcePack CUBEMAPS
static const ResourcePack FLAGS
static const ResourcePack CAELUM
static const ResourcePack FAMICONS
static const ResourcePack MATERIALS
static const ResourcePack ICONS
static const ResourcePack PAGED