MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / main

Function main

apps/tools/Studio/main.cpp:139–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139int main(int argc, char* argv[])
140{
141 Poseidon::RegisterDummyAudioBackend();
142 Poseidon::RegisterTextAudioBackend();
143 Poseidon::RegisterOpenALAudioBackend();
144 Poseidon::RegisterOpenALVoiceBackend();
145
146 CLI::App cliApp{"PoseidonStudio - Asset browser and previewer for Arma: Cold War Assault - Remastered"};
147
148 std::string gamePath;
149 std::string openFile;
150 std::string dragDropPath;
151 bool headless = false;
152 std::string screenshotFile;
153
154 cliApp.add_option("-C,--content", gamePath, "Game content directory (like game -C flag)");
155 cliApp.add_option("--open", openFile, "Open file on startup (path relative to content dir)");
156 cliApp.add_flag("--headless", headless, "Run without display (CI/test mode)");
157 cliApp.add_option("--screenshot", screenshotFile, "Capture screenshot and exit");
158 cliApp.add_option("path", dragDropPath, "Directory or file to open (drag-and-drop)");
159 CLI11_PARSE(cliApp, argc, argv);
160
161 if (gamePath.empty() && !dragDropPath.empty())
162 {
163 namespace fs = std::filesystem;
164 if (fs::is_directory(dragDropPath))
165 {
166 gamePath = dragDropPath;
167 }
168 else if (fs::is_regular_file(dragDropPath))
169 {
170 gamePath = fs::path(dragDropPath).parent_path().string();
171 }
172 }
173
174 Poseidon::StudioConfig cfg;
175 if (!headless)
176 cfg.load();
177
178#ifdef _WIN32
179 if (!headless)
180 FreeConsole();
181#endif
182
183 if (gamePath.empty() && !headless)
184 {
185#ifdef _WIN32
186 gamePath = showFolderDialog();
187 if (gamePath.empty())
188 return 0; // user cancelled
189#else
190 fprintf(stderr, "Error: No content directory specified. Use -C <path> or pass a directory as argument.\n");
191 return 1;
192#endif
193 }
194
195 // Studio previews assets without a full runtime world.
196 Poseidon::NoTextures = true;

Callers

nothing calls this directly

Calls 15

RegisterTextAudioBackendFunction · 0.85
showFolderDialogFunction · 0.85
CreateContextClass · 0.85
getConfigIniPathFunction · 0.85
loadFontFunction · 0.85
NewFrameFunction · 0.85
RenderFunction · 0.85
saveScreenshotFunction · 0.85
setupThemeMethod · 0.80

Tested by

no test coverage detected