1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
26 #include "sheets_packer_cfg.h"
27 #include "sheet_manager.h"
28 #include "continent_manager_build.h"
34 using namespace NLMISC
;
40 NLLIGO::CLigoConfig LigoConfig
;
48 //---------------------------------------------------
50 // Entry for the Apllication.
51 //---------------------------------------------------
52 int main(int argc
, char **argv
)
54 CApplicationContext applicationContext
;
56 // Parse Command Line.
57 NLMISC::CCmdArgs args
;
59 args
.setDescription("Pack all sheets needed by client. All parameters must be defined in sheets_packer.cfg and there is no parameters from command-line.");
61 if (!args
.parse(argc
, argv
)) return 1;
63 CFileDisplayer
*fd
= NULL
;
65 /////////////////////////////////
66 // Initialize the application. //
69 // Add a displayer for Debug Infos, disable log.log.
70 createDebug(NULL
, false);
72 CLog::setProcessName("sheets_packer");
74 fd
= new CFileDisplayer(getLogDirectory() + "sheets_packer.log", true, "SHEETS_PACKER.LOG");
76 // register ligo 'standard' class
79 DebugLog
->addDisplayer(fd
);
80 InfoLog
->addDisplayer(fd
);
81 WarningLog
->addDisplayer(fd
);
82 ErrorLog
->addDisplayer(fd
);
83 AssertLog
->addDisplayer(fd
);
85 // Load the application configuration.
86 nlinfo("Loading config file...");
87 AppCfg
.init(ConfigFileName
);
89 // Define the root path that contains all data needed for the application.
90 nlinfo("Adding search paths...");
91 for (uint i
= 0; i
< AppCfg
.DataPath
.size(); i
++)
92 CPath::addSearchPath(NLMISC::expandEnvironmentVariables(AppCfg
.DataPath
[i
]), true, false);
94 // Initialize Sheet IDs.
95 nlinfo("Init SheetId...");
99 nlinfo("Loading sheets...");
100 IProgressCallback callback
;
101 SheetMngr
.setOutputDataPath(NLMISC::expandEnvironmentVariables(AppCfg
.OutputDataPath
));
102 SheetMngr
.load(callback
, true, true, AppCfg
.DumpVisualSlotsIndex
);
104 // Make the lmconts.packed file
105 if (!LigoConfig
.readPrimitiveClass(AppCfg
.LigoPrimitiveClass
.c_str(), false))
106 nlwarning("Can't load primitive class file %s", AppCfg
.LigoPrimitiveClass
.c_str());
107 NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig
= &LigoConfig
;
108 buildLMConts(AppCfg
.WorldSheet
, NLMISC::expandEnvironmentVariables(AppCfg
.PrimitivesPath
), NLMISC::expandEnvironmentVariables(AppCfg
.OutputDataPath
));
110 catch(const EFatalError
&) { return EXIT_FAILURE
; /* nothing to do */ }
111 catch(const Exception
&e
)
115 nlerror ("Initialization of the application failed : %s", e
.what());
117 catch(const EFatalError
&)
126 /////////////////////////////
127 // Release all the memory. //
130 DebugLog
->removeDisplayer("SHEETS_PACKER.LOG");
131 InfoLog
->removeDisplayer("SHEETS_PACKER.LOG");
132 WarningLog
->removeDisplayer("SHEETS_PACKER.LOG");
133 ErrorLog
->removeDisplayer("SHEETS_PACKER.LOG");
134 AssertLog
->removeDisplayer("SHEETS_PACKER.LOG");
139 catch(const EFatalError
&) { return EXIT_FAILURE
; /* nothing to do */ }
140 catch(const Exception
&e
)
144 nlerror ("Release of the application failed: %s", e
.what());
146 catch(const EFatalError
&)
156 // EXIT of the Application.