public static int InitTaskMethod(object obj) { CancellationToken token = (CancellationToken)obj; if (!token.IsCancellationRequested) { Memory.Strings = new Strings(); } if (!token.IsCancellationRequested) // requires strings because it uses an array generated in strings. { Kernel_Bin = new Kernel_bin(); } if (!token.IsCancellationRequested) { Memory.MItems = Items_In_Menu.Read(); // this has a soft requirement on kernel_bin. It checks for null so should work without it. } if (!token.IsCancellationRequested) { Saves.Init(); //loads all savegames from steam or cd2000 directories. first come first serve. } if (!token.IsCancellationRequested) { InitStrings(); } if (graphics?.GraphicsDevice != null) // all below require graphics to work. to load textures graphics device needed. { if (!token.IsCancellationRequested) { Memory.font = new Font(); //this initializes the fonts and drawing system- holds fonts in-memory } if (!token.IsCancellationRequested) { Memory.Cards = new Cards(); // card images in menu. } if (!token.IsCancellationRequested) { Memory.Faces = new Faces(); } if (!token.IsCancellationRequested) { Memory.Icons = new Icons(); } // requires font, faces, and icons. // currently cards only used in debug menu. will have support for cards when added to menu. if (!token.IsCancellationRequested) { Module_main_menu_debug.Init(); } } return(0); }
public static int InitTaskMethod(object obj) { CancellationToken token = (CancellationToken)obj; if (!token.IsCancellationRequested) { Memory.Strings = new Strings(); } var tasks = new List <Task>(); if (!token.IsCancellationRequested) { // requires strings because it uses an array generated in strings. tasks.Add(Task.Run(() => { Kernel_Bin = new Kernel_bin(); }, token)); // this has a soft requirement on kernel_bin. It checks for null so should work without it. tasks.Add(Task.Run(() => { MItems = Items_In_Menu.Read(); }, token)); //loads all savegames from steam2013 or cd2000 or steam2019 directories. first come first serve. //TODO allow chosing of which save folder to use. tasks.Add(Task.Run(Saves.Init, token)); tasks.Add(Task.Run(InitStrings, token)); if (graphics?.GraphicsDevice != null) // all below require graphics to work. to load textures graphics device needed. { //this initializes the fonts and drawing system- holds fonts in-memory tasks.Add(Task.Run(() => { font = new Font(); }, token)); // card images in menu. tasks.Add(Task.Run(() => { Cards = new Cards(); }, token)); tasks.Add(Task.Run(() => { Card_Game = new Card_Game(); }, token)); tasks.Add(Task.Run(() => { Faces = new Faces(); }, token)); tasks.Add(Task.Run(() => { Icons = new Icons(); }, token)); } Task.WaitAll(tasks.ToArray()); if (graphics?.GraphicsDevice != null) // all below require graphics to work. to load textures graphics device needed. { // requires font, faces, and icons. currently cards only used in debug menu. will // have support for cards when added to menu. if (!token.IsCancellationRequested) { Module_main_menu_debug.Init(); } // requires font, faces, and icons. currently cards only used in debug menu. will // have support for cards when added to menu. if (!token.IsCancellationRequested) { Menu.InitStaticMembers(); } } } //EXE_Offsets test = new EXE_Offsets(); Inited = true; return(0); }
public static int InitTaskMethod(object obj) { CancellationToken token = (CancellationToken)obj; if (!token.IsCancellationRequested) { Memory.font = new Font(); //this initializes the fonts and drawing system- holds fonts in-memory } if (!token.IsCancellationRequested) { Memory.Strings = new Strings(); } if (!token.IsCancellationRequested) { Memory.MItems = Items_In_Menu.Read(); } if (!token.IsCancellationRequested) { Kernel_Bin = new Kernel_bin(); } if (!token.IsCancellationRequested) { Memory.Cards = new Cards(); } if (!token.IsCancellationRequested) { Memory.Faces = new Faces(); } if (!token.IsCancellationRequested) { Memory.Icons = new Icons(); } if (!token.IsCancellationRequested) { Saves.Init(); //loads all savegames from steam or cd2000 directories. first come first serve. } if (!token.IsCancellationRequested) { InitStrings(); } if (!token.IsCancellationRequested) { Module_main_menu_debug.Init(); } return(0); }
public static int InitTaskMethod(object obj) { Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(Memory)} :: {nameof(Init)}"); CancellationToken token = (CancellationToken)obj; if (!token.IsCancellationRequested) { Memory.Strings = new Strings(); } // requires strings because it uses an array generated in strings. // saves data will reference kernel_bin. if (!token.IsCancellationRequested) { Kernel_Bin = new Kernel_bin(); } List <Task> tasks = new List <Task>(); if (!token.IsCancellationRequested) { // this has a soft requirement on kernel_bin. It checks for null so should work without it. tasks.Add(Task.Run(() => { MItems = Items_In_Menu.Read(); }, token)); //loads all savegames from steam2013 or cd2000 or steam2019 directories. first come first serve. //TODO allow chosing of which save folder to use. tasks.Add(Task.Run(Saves.Init, token)); //tasks.Add(Task.Run(() => InitState = Saves.Data.LoadInitOut(), token)); tasks.Add(Task.Run(InitStrings, token)); //this initializes the field module, it's worth to have this at the beginning tasks.Add(Task.Run(Fields.Initializer.Init, token)); //this initializes the encounters tasks.Add(Task.Run(Init_debugger_battle.Init)); if (graphics?.GraphicsDevice != null) // all below require graphics to work. to load textures graphics device needed. { //this initializes the fonts and drawing system- holds fonts in-memory tasks.Add(Task.Run(() => { font = new Font(); }, token)); // card images in menu. tasks.Add(Task.Run(() => { Cards = Cards.Load(); }, token)); tasks.Add(Task.Run(() => { Card_Game = new Card.Game(); }, token)); tasks.Add(Task.Run(() => { Faces = Faces.Load(); }, token)); tasks.Add(Task.Run(() => { Icons = Icons.Load(); }, token)); tasks.Add(Task.Run(() => { Magazines = Magazine.Load(); }, token)); } Task.WaitAll(tasks.ToArray()); InitState = Saves.Data.LoadInitOut(); State = InitState?.Clone(); if (graphics?.GraphicsDevice != null) // all below require graphics to work. to load textures graphics device needed. { //// requires font, faces, and icons. currently cards only used in debug menu. will //// have support for cards when added to menu. //if (!token.IsCancellationRequested) // Menu.Module.Init(); // requires font, faces, and icons. currently cards only used in debug menu. will // have support for cards when added to menu. if (!token.IsCancellationRequested) { Menu.InitStaticMembers(); } } } //EXE_Offsets test = new EXE_Offsets(); Inited = true; return(0); }