public virtual void AddGameInstance(PlayerIndex player_index) { Game1 old_game = Game1.game1; if (old_game != null) { SaveInstance(old_game, force: true); } if (gameInstances.Count > 0) { Game1 game = gameInstances[0]; LoadInstance(game); Game1.StartLocalMultiplayerIfNecessary(); SaveInstance(game, force: true); } Game1 new_instance2 = null; new_instance2 = ((gameInstances.Count != 0) ? CreateGameInstance(player_index, gameInstances.Count) : CreateGameInstance()); gameInstances.Add(new_instance2); if (gamePtr == null) { gamePtr = new_instance2; } if (gameInstances.Count > 0) { new_instance2.staticVarHolder = Activator.CreateInstance(LocalMultiplayer.StaticVarHolderType); SetInstanceDefaults(new_instance2); LoadInstance(new_instance2); } Game1.game1 = new_instance2; new_instance2.Instance_Initialize(); if (shouldLoadContent) { new_instance2.Instance_LoadContent(); } SaveInstance(new_instance2); if (old_game != null) { LoadInstance(old_game); } else { Game1.game1 = null; } _windowSizeChanged = true; }