MCPcopy Create free account
hub / github.com/crossuo/crossuo / main

Function main

src/Main.cpp:274–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272XUO_EXPORT int plugin_main(int argc, char **argv)
273#else
274int main(int argc, char **argv)
275#endif
276{
277#if 0 // TEST encoding
278 str_init();
279 // Add some tests, this cliloc message seems to use broken UTF8
280 // "Hey buddy... Looking for work?"
281 uint8_t d[] = {
282 0x48, 0x65, 0x79, 0x20, 0x62, 0x75, 0x64, 0x64, 0x79, 0x2E, 0xC2,
283 0xA0, 0x20, 0x4C, 0x6F, 0x6F, 0x6B, 0x69, 0x6E, 0x67, 0x20, 0x66,
284 0x6F, 0x72, 0x20, 0x77, 0x6F, 0x72, 0x6B, 0x3F
285 };
286 // cp1250 - issue #221
287 //unsigned char a[] = { 0x56, 0xE1, 0x6c, 0x65, 0xE8, 0x6E, 0xED, 0x6B }; // input
288 astr_t s1( reinterpret_cast< char const* >( d ), sizeof( d ) );
289 str_terminate();
290 exit(0);
291#endif
292
293 g_fatalErrorCb = &fatal_error_dialog;
294 if (!InitCli(argc, argv))
295 {
296 return 0;
297 }
298
299 LogInit(argc, argv, "crossuo.log");
300
301 if (SDL_Init(SDL_INIT_TIMER) < 0)
302 {
303 ErrorMessage(
304 Client,
305 "Window initialization failure.",
306 "unable to initialize SDL %s",
307 SDL_GetError());
308 return EXIT_FAILURE;
309 }
310 Info(Client, "SDL initialized");
311
312 g_App.Init();
313 if (!load_config())
314 {
315 return EXIT_FAILURE;
316 }
317
318 if (g_cli["dump-uop"].was_set())
319 {
320 g_dumpUopFile = g_cli["dump-uop"].get().string;
321 }
322
323 const bool isHeadless = g_cli["headless"].was_set();
324 if (!isHeadless)
325 {
326 gfx_render_list_init();
327 if (!g_GameWindow.Create(CLIENT_TITLE, false, 640, 480))
328 {
329 const char *errMsg =
330 "Failed to create CrossUO client window. May be caused by a missing configuration file.";
331 ErrorMessage(Client, errMsg, "error initializing game window");

Callers

nothing calls this directly

Calls 15

str_initFunction · 0.85
str_terminateFunction · 0.85
InitCliFunction · 0.85
LogInitFunction · 0.85
SDL_InitFunction · 0.85
SDL_GetErrorFunction · 0.85
gfx_render_list_initFunction · 0.85
SDL_QuitFunction · 0.85
gfx_render_list_destroyFunction · 0.85
was_setMethod · 0.80
getMethod · 0.80
ProcessCommandLineMethod · 0.80

Tested by

no test coverage detected