Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / sheets_packer_shard / sheets_packer_shard.cpp
blobf5c3971d972f0cf26b16dbc1f4802cf4cc39a4cc
1 // NeL - MMORPG Framework <http://www.ryzomcore.org/>
2 // Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // Author: Jan Boon
19 #include <nel/misc/types_nl.h>
21 // STL includes
22 #include <vector>
23 #include <string>
24 #include <map>
25 #include <iostream>
26 #include <fstream>
28 // NeL includes
29 #include <nel/misc/common.h>
30 #include <nel/misc/file.h>
31 #include <nel/misc/log.h>
32 #include <nel/misc/path.h>
33 #include <nel/misc/sheet_id.h>
34 #include <nel/georges/load_form.h>
35 #include <game_share/data_set_base.h>
36 #include <input_output_service/string_manager.h>
37 #include <gpm_service/sheets.h>
38 #include <server_share/continent_container.h>
39 #include <entities_game_service/egs_sheets/egs_sheets.h>
40 #include <game_share/time_weather_season/time_date_season_manager.h>
41 #include <ai_service/stdpch.h>
42 #include <ai_service/sheets.h>
44 // Project includes
45 // ...
47 namespace {
49 } /* anonymous namespace */
51 // EGS
52 NLMISC::CVariable<bool> EGSLight("egs","EGSLight", "Load EGS with a minimal set of feature loaded", false, 0, true);
53 NLMISC::CVariable<bool> LoadOutposts("egs", "LoadOutposts", "If false outposts won't be loaded", true, 0, true );
54 static std::string s_WriteDirectory;
55 std::string writeDirectory()
57 return s_WriteDirectory;
60 ////////////////////////////////////////////////////////////////////////
61 // note: *.packed_sheets files are placed in <build_packed_sheets> //
62 // and will need to be moved to the right location by //
63 // your build script system. //
64 ////////////////////////////////////////////////////////////////////////
66 int main(int nNbArg, char **ppArgs)
68 // create debug stuff
69 NLMISC::createDebug();
71 // verify all params
72 if (nNbArg < 6)
74 // sheets_packer_shard.exe R:\leveldesign R:\leveldesign\DFN R:\code\ryzom\server\data_shard\mirror_sheets T:\export\common\leveldesign\visual_slot_tab T:\test_shard
75 nlinfo("ERROR : Wrong number of arguments\n");
76 nlinfo("USAGE : sheets_packer_shard <leveldesign> <dfn> <datasets> <tab> <build_packed_sheets>\n");
77 nlinfo("<tab> : Directory containing visual_slots.tab");
78 return EXIT_FAILURE;
80 std::string leveldesignDir = std::string(ppArgs[1]);
81 if (!NLMISC::CFile::isDirectory(leveldesignDir))
83 nlerrornoex("Directory leveldesign '%s' does not exist", leveldesignDir.c_str());
84 return EXIT_FAILURE;
86 std::string dfnDir = std::string(ppArgs[2]);
87 if (!NLMISC::CFile::isDirectory(dfnDir))
89 nlerrornoex("Directory dfn '%s' does not exist", dfnDir.c_str());
90 return EXIT_FAILURE;
92 std::string datasetsDir = std::string(ppArgs[3]);
93 if (!NLMISC::CFile::isDirectory(datasetsDir))
95 nlerrornoex("Directory datasets '%s' does not exist", datasetsDir.c_str());
96 return EXIT_FAILURE;
98 std::string tabDir = std::string(ppArgs[4]);
99 if (!NLMISC::CFile::isDirectory(tabDir))
101 nlerrornoex("Directory tab '%s' does not exist", tabDir.c_str());
102 return EXIT_FAILURE;
104 std::string exportDir = std::string(ppArgs[5]);
105 if (!NLMISC::CFile::isDirectory(exportDir))
107 nlerrornoex("Directory build_packed_sheets '%s' does not exist", exportDir.c_str());
108 return EXIT_FAILURE;
110 s_WriteDirectory = exportDir + "/";
112 // add search paths
113 NLMISC::CPath::addSearchPath(leveldesignDir, true, false);
114 NLMISC::CPath::addSearchPath(dfnDir, true, false);
115 NLMISC::CPath::addSearchPath(datasetsDir, false, false);
116 NLMISC::CPath::addSearchPath(tabDir, false, false);
118 // init sheet_id.bin
119 NLMISC::CSheetId::init(false);
121 // this here does the magic
122 // MS
124 // Used by mirror_service.cpp
125 // Used by range_mirror_manager.cpp
126 // Used by mirror.cpp
127 TSDataSetSheets sDataSetSheets;
128 loadForm("dataset", exportDir + "/datasets.packed_sheets", sDataSetSheets);
131 // IOS
133 // Used by string_manager_parcer.cpp
134 std::map<NLMISC::CSheetId, CStringManager::TSheetInfo> container;
135 std::vector<std::string> exts;
136 exts.push_back("creature");
137 exts.push_back("race_stats");
138 loadForm(exts, exportDir + "/ios_sheets.packed_sheets", container);
141 // GPMS
143 std::map<NLMISC::CSheetId, CGpmSheets::CSheet> container;
144 std::vector<std::string> filters;
145 filters.push_back("creature");
146 filters.push_back("player");
147 loadForm(filters, exportDir + "/gpms.packed_sheets", container);
150 // CContinentContainer
152 CContinentContainer continents;
153 continents.buildSheets(s_WriteDirectory);
156 // EGS
158 CSheets::init();
161 // CTimeDateSeasonManager
163 CTimeDateSeasonManager::packSheets(s_WriteDirectory);
166 // AIS
168 AISHEETS::CSheets::getInstance()->packSheets(s_WriteDirectory);
169 AISHEETS::CSheets::destroyInstance();
172 // and that's all folks
173 return EXIT_SUCCESS;
176 /* end of file */