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 async void Update(GameTime gameTime) { if (lastModule != module) { GC.Collect(); GC.WaitForPendingFinalizers(); lastModule = module; } module = Memory.module; #if DEBUG if (Input2.DelayedButton(FF8TextTagKey.Reset) || Input2.DelayedButton(FF8TextTagKey.Cancel)) { if (Memory.module != MODULE.MAINMENU_DEBUG && Memory.module != MODULE.BATTLE_DEBUG) { Memory.module = MODULE.MAINMENU_DEBUG; InputMouse.Mode = MouseLockMode.Screen; } } #endif switch (module) { //doesn't need memory case MODULE.OVERTURE_DEBUG: case MODULE.MOVIETEST: break; default: //requires memory to be loaded. if ((Memory.InitTask != null) && (Memory.InitTask.IsCompleted == false || Memory.InitTask.Status == TaskStatus.Running || Memory.InitTask.Status == TaskStatus.WaitingToRun || Memory.InitTask.Status == TaskStatus.WaitingForActivation)) { //task is still running loading assets blank screen and wait. Memory.SuppressDraw = true; await Memory.InitTask; //fade in doesn't happen because time was set before the await. //ending here causes update to be run again with new time return; } break; } switch (module) { case MODULE.BATTLE: module_battle.Update(); break; case MODULE.BATTLE_DEBUG: Module_battle_debug.Update(); break; case MODULE.MOVIETEST: Module_movie_test.Update(); break; case MODULE.FIELD_DEBUG: Module_field_debug.Update(); break; case MODULE.OVERTURE_DEBUG: Module_overture_debug.Update(); break; case MODULE.MAINMENU_DEBUG: Module_main_menu_debug.Update(); break; case MODULE.WORLD_DEBUG: Module_world_debug.Update(gameTime); break; case MODULE.FACE_TEST: Module_face_test.Update(); break; case MODULE.ICON_TEST: Module_icon_test.Update(); break; case MODULE.CARD_TEST: Module_card_test.Update(); break; } }
public static void Draw(GameTime gameTime) { switch (module) { //doesn't need memory case MODULE.OVERTURE_DEBUG: case MODULE.MOVIETEST: break; default: //requires memory to be loaded. if ((Memory.InitTask != null) && (Memory.InitTask.IsCompleted == false || Memory.InitTask.Status == TaskStatus.Running || Memory.InitTask.Status == TaskStatus.WaitingToRun || Memory.InitTask.Status == TaskStatus.WaitingForActivation)) { //suppress draw in update but if draw happens before update, blank screen, and end here Memory.graphics.GraphicsDevice.Clear(Color.Black); return; } break; } switch (module) { case MODULE.BATTLE: module_battle.Draw(); break; case MODULE.BATTLE_DEBUG: Module_battle_debug.Draw(); break; case MODULE.MOVIETEST: Module_movie_test.Draw(); break; case MODULE.FIELD_DEBUG: Module_field_debug.Draw(); break; case MODULE.OVERTURE_DEBUG: Module_overture_debug.Draw(); break; case MODULE.MAINMENU_DEBUG: Module_main_menu_debug.Draw(); break; case MODULE.WORLD_DEBUG: Module_world_debug.Draw(); break; case MODULE.FACE_TEST: Module_face_test.Draw(); break; case MODULE.ICON_TEST: Module_icon_test.Draw(); break; case MODULE.CARD_TEST: Module_card_test.Draw(); break; } }