public GameProcessStartEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IEmulatorAssembly emulatorAssembly, IEmulatorBridge emulatorBridge, Process process) : base(eventCoreInstance, gameInfo) { this.GameEmulatorAssembly = emulatorAssembly; this.GameEmulatorBridge = this.GameEmulatorBridge; this.GameEmulatorProcess = this.GameEmulatorProcess; }
public void LoadContent(Game game, IGameInfo gameInfo) { GameInfo = gameInfo; _gameInfoOverlay = new GameInfoOverlay(game, GameInfo); _spriteManager = new SpriteManager(game, GameInfo); _spriteManager.LoadContent(); _background = new Background(game); }
public IConfigurationProfile GetConfigurationProfile(IGameInfo gameInfo) { if (!this.Contains(gameInfo)) { return this.DefaultProfile; } string fileName = this.ContainsFilename(gameInfo) ? Path.Combine(this.ConfigurationStorePath, $"{gameInfo.FileName}.json") : Path.Combine(this.ConfigurationStorePath, $"{gameInfo.CRC32}.json"); return ConfigurationProfile.FromJsonProtoTemplate(JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(File.ReadAllText(fileName))); }
public virtual void LoadContent(Game game, IGameInfo gameInfo) { _game = game; _gameInfo = gameInfo; _position = new Rectangle(50, 20, 700, 420); _font = _game.Content.Load<SpriteFont>("Fonts/GameFont"); float alpha = 0.7f; _transparencyColour = new Color(new Vector4(alpha, alpha, alpha, alpha)); }
public virtual string CompileConfiguration(IConfigurationTemplate configTemplate, IConfigurationProfile configProfile, IGameInfo gameInfo) { var template = new StringBuilder(configTemplate.StringTemplate); foreach (var configurationValue in configProfile.ConfigurationValues) { Type configurationvalueType = configurationValue.Value.GetType(); string stringValue = configurationvalueType == typeof(bool) ? configTemplate.BooleanMapping.FromBool(configurationValue.Value) : configurationValue.Value.ToString(); template.Replace($"{{{configurationValue.Key}}}", stringValue); } return template.ToString(); }
public dynamic this[IGameInfo gameInfo, string key, ConfigurationFlagTypes type] { get { return this.GetValue(gameInfo, key, type); } set { this.SetValue(gameInfo, key, value, type); } }
public IMove GetMove(IGameInfo game) { GameInfo2P tttGame = game as GameInfo2P; if (tttGame == null) { throw new ArgumentException("The game is not a 2 player game info"); } int x = GameComponent.Utils.Utils.GetIntFromConsole("Entrer valeur de x:"); return new Connect4Move() { Token = Token, X = x, }; }
public void AddGame(IGameInfo gameInfo, IDictionary<string, string> flagValues) { SQLiteConnection flagDb = this.GetConnection(); flagDb.Open(); foreach (KeyValuePair<string, string> flagPair in flagValues) { using (var sqliteCommand = new SQLiteCommand(@"INSERT OR REPLACE INTO flags VALUES( @flagKey, @flagValue)", flagDb)) { sqliteCommand.Parameters.AddWithValue("@flagKey", $"{gameInfo.UUID}-{flagPair.Key}"); sqliteCommand.Parameters.AddWithValue("@flagValue", flagPair.Value); sqliteCommand.ExecuteNonQuery(); } } flagDb.Close(); }
public IMove GetMove(IGameInfo game) { GameInfo2P tttGame = game as GameInfo2P; if (tttGame == null) { throw new ArgumentException("The game is not a 2 player game info"); } if (!(tttGame.State is IResolvableState)) { throw new ArgumentException("The state is not a resolvable state"); } ITeamIdentifier opponentPlayer = tttGame.PlayerA == this ? tttGame.PlayerB : tttGame.PlayerA; var bestMove = Strateger.FindBestMove(tttGame.State as IResolvableState, this, opponentPlayer); return bestMove; }
public void AddGame(IGameInfo game) { SQLiteConnection dbConnection = this.GetConnection(); dbConnection.Open(); using (var sqlCommand = new SQLiteCommand(@"INSERT OR REPLACE INTO games VALUES( @platform_id, @uuid, @filename, @name, @metadata, @crc32)", dbConnection)) { sqlCommand.Parameters.AddWithValue("@platform_id", game.PlatformID); sqlCommand.Parameters.AddWithValue("@uuid", game.UUID); sqlCommand.Parameters.AddWithValue("@filename", game.FileName); sqlCommand.Parameters.AddWithValue("@name", game.Name); sqlCommand.Parameters.AddWithValue("@metadata", JsonConvert.SerializeObject(game.Metadata)); sqlCommand.Parameters.AddWithValue("@crc32", game.CRC32); sqlCommand.ExecuteNonQuery(); } dbConnection.Close(); }
public DialogEditGame(IGameInfo gameInfo) : base() { this.Title = "Edit Game"; if (gameInfo is PixelGameInfo) { SetGameInfo((PixelGameInfo)gameInfo); } else if (gameInfo is FlatlandGameInfo) { SetGameInfo((FlatlandGameInfo)gameInfo); } else if (gameInfo is GroupSumGameInfo) { SetGameInfo((GroupSumGameInfo)gameInfo); } else if (gameInfo is ForagerGameInfo) { SetGameInfo((ForagerGameInfo)gameInfo); } }
public virtual bool isPlayable( IGameInfo game, int slotIndex ) { if (tester == null) return true; return tester (game, slotIndex); }
public void AddGameInfo(IGameInfo info) { __AddGameInfo (info); UpdatePixmap (); QueueDraw (); }
int GetXPos(IGameInfo info) { double time = (info.Time * 60 + info.Increment * 12) / 60.0; // 15% = 3 mins int ret = (int) Math.Round (graph_area_width * time / 20.0); if (ret >= graph_area_width) ret = graph_area_width - 1; return ret; }
public GameInfoScrapedEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IScraper gameScraper) : base(eventCoreInstance, gameInfo) { this.GameScraper = gameScraper; }
/// <summary> /// Inicjalizuje kontener. /// </summary> /// <param name="gameInfo">Informacje o grze.</param> public Container(IGameInfo gameInfo) { this.GameInfo = gameInfo; this.Root = new Controls.Panel() { Id = "Root", Size = gameInfo.MainWindow.Size }; this.Root.Data = new Internals.UIData(gameInfo.MainWindow.Input, gameInfo.Renderer); }
public EmulationApi(Action <string> logCallback, Config config, IGameInfo game) { _config = config; _game = game; LogCallback = logCallback; }
public IGameInfo GetGameInfo() { IGameInfo gameInfo = null; switch (comboBoxGame.Active) { case 1: var pixelInfo = new PixelGameInfo() { MaxSize = spinButtonPixelMaxSize.ValueAsInt, InitialState = comboBoxPixelInitialState.ActiveText, PlayerSort = comboBoxPixelPlayerSort.ActiveText }; foreach (var point in pixelGrid.EnabledPixels) { if ((point.X < pixelInfo.MaxSize) && (point.Y < pixelInfo.MaxSize)) { pixelInfo.FixedPixels.Add(point); } } gameInfo = pixelInfo; break; case 2: var flatlandInfo = new FlatlandGameInfo() { Tiles = checkBoxFlatlandCustomBoardSize.Active ? spinButtonFlatlandBoardSize.ValueAsInt : (int?)null, CollisionBehavior = comboBoxFlatlandCollisionBehavior.ActiveText, GameType = comboBoxFlatlandGameType.ActiveText }; // Add teams flatlandTeamStore.Foreach(delegate(TreeModel model, TreePath path, TreeIter iter) { flatlandInfo.Teams.Add(new FlatlandTeamInfo() { TeamIndex = (int)model.GetValue(iter, 0), ThemeName = (string)model.GetValue(iter, 1), Kind = (string)model.GetValue(iter, 2), MoveSeconds = (int)model.GetValue(iter, 3), WrappedMovement = (bool)model.GetValue(iter, 4), ScoringSystem = (string)model.GetValue(iter, 5) }); return(false); }); flatlandInfo.FixedTiles.AddRange(flatlandFixedTiles); gameInfo = flatlandInfo; break; case 3: gameInfo = new GroupSumGameInfo() { FirstRoundSeconds = spinButtonGroupSumFirstRoundSeconds.ValueAsInt, RoundSeconds = spinButtonGroupSumRoundSeconds.ValueAsInt, RangeStart = spinButtonGroupSumRangeStart.ValueAsInt, RangeEnd = spinButtonGroupSumRangeEnd.ValueAsInt, ShowNumericFeedback = checkButtonGroupSumNumericFeedback.Active, UsePreviousRoundInput = checkbuttonGroupSumPreviousInput.Active }; break; case 4: var foragerInfo = new ForagerGameInfo() { Plots = spinButtonForagerPlots.ValueAsInt, TravelTime = spinButtonForagerTravelTime.ValueAsInt, FoodRate = spinButtonForagerFoodRate.ValueAsInt, GameSeconds = spinButtonForagerGameMinutes.ValueAsInt * 60, }; foreach (var plotProbabilities in foragerProbabilities) { foragerInfo.PlotProbabilities.Add(plotProbabilities.ToList()); } foragerInfo.ProbabilityShiftTimes.AddRange(foragerProbabilityShiftTimes.ToList()); gameInfo = foragerInfo; break; } if (gameInfo != null) { gameInfo.GameDescription = entryGameDescription.Text; } return(gameInfo); }
// Poop public string GetRetroSystemPath(IGameInfo game) => _pathEntries.RetroSystemAbsolutePath(game);
public virtual string CompileConfiguration(IConfigurationProfile configProfile, IGameInfo gameInfo) { return this.CompileConfiguration(this.ConfigurationTemplates[configProfile.TemplateID], configProfile, gameInfo); }
public static void DoGBPrefsDialog(IMainFormForConfig mainForm, Config config, IGameInfo game, IMovieSession movieSession, Gameboy gb) { var s = gb.GetSettings(); var ss = gb.GetSyncSettings(); using var dlg = new GBPrefs(mainForm.DialogController); dlg.gbPrefControl1.PutSettings(config, game, movieSession, s, ss); dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode(); if (mainForm.ShowDialogAsChild(dlg).IsOk()) { dlg.gbPrefControl1.GetSettings(out s, out ss); gb.PutSettings(s); if (dlg.gbPrefControl1.SyncSettingsChanged) { mainForm.PutCoreSyncSettings(ss); } } }
// Poop public string GetRetroSaveRAMDirectory(IGameInfo game) => _pathEntries.RetroSaveRamAbsolutePath(game);
// TODO: This doesn't really belong here, but not sure where to put it public static void PopulateWithDefaultHeaderValues( this IMovie movie, IEmulator emulator, IGameInfo game, FirmwareManager firmwareManager, string author) { movie.Author = author; movie.EmulatorVersion = VersionInfo.GetEmuVersion(); movie.OriginalEmulatorVersion = VersionInfo.GetEmuVersion(); movie.SystemID = emulator.SystemId; var settable = new SettingsAdapter(emulator); if (settable.HasSyncSettings) { movie.SyncSettingsJson = ConfigService.SaveWithType(settable.GetSyncSettings()); } if (game.IsNullInstance()) { movie.GameName = "NULL"; } else { movie.GameName = game.FilesystemSafeName(); movie.Hash = game.Hash; if (game.FirmwareHash != null) { movie.FirmwareHash = game.FirmwareHash; } } if (emulator.HasBoardInfo()) { movie.BoardName = emulator.AsBoardInfo().BoardName; } if (emulator.HasRegions()) { var region = emulator.AsRegionable().Region; if (region == DisplayType.PAL) { movie.HeaderEntries.Add(HeaderKeys.Pal, "1"); } } if (firmwareManager.RecentlyServed.Count != 0) { foreach (var firmware in firmwareManager.RecentlyServed) { var key = firmware.ID.MovieHeaderKey; if (!movie.HeaderEntries.ContainsKey(key)) { movie.HeaderEntries.Add(key, firmware.Hash); } } } if (emulator is NDS nds && nds.IsDSi) { movie.HeaderEntries.Add("IsDSi", "1"); if (nds.IsDSiWare) { movie.HeaderEntries.Add("IsDSiWare", "1"); } } if ((emulator is NES nes && nes.IsVS) || (emulator is SubNESHawk subnes && subnes.IsVs)) { movie.HeaderEntries.Add("IsVS", "1"); } if (emulator is IGameboyCommon gb) { if (gb.IsCGBMode()) { movie.HeaderEntries.Add(gb.IsCGBDMGMode() ? "IsCGBDMGMode" : "IsCGBMode", "1"); } } if (emulator is SMS sms) { if (sms.IsSG1000) { movie.HeaderEntries.Add("IsSGMode", "1"); } if (sms.IsGameGear) { movie.HeaderEntries.Add("IsGGMode", "1"); } } if (emulator is GPGX gpgx && gpgx.IsMegaCD) { movie.HeaderEntries.Add("IsSegaCDMode", "1"); } if (emulator is PicoDrive pico && pico.Is32XActive) { movie.HeaderEntries.Add("Is32X", "1"); } if (emulator is ICycleTiming) { movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0"); movie.HeaderEntries.Add(HeaderKeys.ClockRate, "0"); } movie.Core = ((CoreAttribute)Attribute .GetCustomAttribute(emulator.GetType(), typeof(CoreAttribute))) .CoreName; }
public static string SuggestedFolder(Config config, IGameInfo game = null) { return(config.PathEntries.AbsolutePathFor(Path.Combine( config.PathEntries["Global", "Macros"].Path, game?.FilesystemSafeName()), null)); }
public GamePage(IGameInfo gameData, BasicGameFrameworkLibrary.BasicGameDataClasses.BasicData basicData, IStartUp start) : base(gameData, basicData, start) { }
//"UPGRADE" effect: return an action to be played just after another building //gets built over this one public override bool isPlayable( IGameInfo game, int slotIndex ) { int cost = energyCost - game.getAttributeTotal(BoardManager.constructionAttr); IUnitInfo u = game.getUnit(slotIndex); return cost <= ( u == null ? 0 : u.getEnergy() ) && base.isPlayable (game, slotIndex); }
public virtual string CompileController(int playerIndex, IPlatformInfo platformInfo, IInputTemplate inputTemplate, IGameInfo gameInfo) { string deviceName = this.CoreInstance.Get<IControllerPortsDatabase>().GetDeviceInPort(platformInfo, playerIndex); string controllerId = platformInfo.ControllerPorts[playerIndex]; IControllerDefinition controllerDefinition = this.CoreInstance.Controllers[controllerId]; IGamepadAbstraction gamepadAbstraction = this.CoreInstance.Get<IGamepadAbstractionDatabase>()[deviceName]; return this.CompileController(playerIndex, platformInfo, controllerDefinition, this.ControllerTemplates[controllerId], gamepadAbstraction, inputTemplate, gameInfo); }
public abstract void GameStartEvent(IGameInfo gi);
public PlayersGUIContainer(IGameInfo gameInfo, Action<string> requestUnit = null) : base(gameInfo) { this.RequestUnitHandler = requestUnit; }
public YahtzeeShellView(IGameInfo gameData, BasicData basicData, IStartUp start, IEventAggregator aggregator) : base(gameData, basicData, start) { aggregator.Subscribe(this); _aggregator = aggregator; }
public OpenAdvancedChooser(IDialogController dialogController, Config config, Func <CoreComm> createCoreComm, IGameInfo game, Func <bool> libretroCoreChooserCallback) { _config = config; _createCoreComm = createCoreComm; _game = game; _libretroCoreChooserCallback = libretroCoreChooserCallback; DialogController = dialogController; InitializeComponent(); RefreshLibretroCore(true); }
public static bool IsRomStatusBad(this IGameInfo game) { return(game.Status == RomStatus.BadDump || game.Status == RomStatus.Overdump); }
public EightOffSolitaireShellViewModel(IGamePackageResolver mainContainer, CommandContainer container, IGameInfo GameData, ISaveSinglePlayerClass saves) : base(mainContainer, container, GameData, saves) { }
public GameQuitEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IEmulatorAssembly emulatorAssembly, IEmulatorBridge emulatorBridge) : base(eventCoreInstance, gameInfo) { this.GameEmulatorAssembly = emulatorAssembly; this.GameEmulatorBridge = this.GameEmulatorBridge; }
//Constructor public MainWindowVM() { //make an initialization via Gomoku _gameInfo = new GomokuGameInfo(); }
public override void LoadContent(Game game, IGameInfo gameInfo) { base.LoadContent(game, gameInfo); _startScreen = game.Content.Load<Texture2D>(@"Screens/StartScreen"); }
public static void DoDGBPrefsDialog(IMainFormForConfig mainForm, Config config, IGameInfo game, IMovieSession movieSession, GambatteLink gambatte) { var s = gambatte.GetSettings(); var ss = gambatte.GetSyncSettings(); using var dlg = new DGBPrefs(config, game, movieSession); dlg.PutSettings(s, ss); dlg.gbPrefControl1.ColorGameBoy = gambatte.IsCGBMode(false); dlg.gbPrefControl2.ColorGameBoy = gambatte.IsCGBMode(true); if (mainForm.ShowDialogAsChild(dlg) == DialogResult.OK) { dlg.GetSettings(out s, out ss); gambatte.PutSettings(s); if (dlg.SyncSettingsChanged) { mainForm.PutCoreSyncSettings(ss); } } }
/// <summary> /// Inicjalizuje manager. /// </summary> /// <param name="input">Wejście.</param> /// <param name="content">Manager zasobów.</param> /// <param name="renderer">Renderer dla encji.</param> public EntitiesManager(IGameInfo gameInfo) { this.GameInfo = gameInfo; }
public EmuClientApi(Action <string> logCallback, IMainFormForApi mainForm, DisplayManagerBase displayManager, Config config, IEmulator emulator, IGameInfo game) { _config = config; _displayManager = displayManager; Emulator = emulator; Game = game; _logCallback = logCallback; _mainForm = mainForm; VideoProvider = Emulator.AsVideoProviderOrDefault(); }
void __AddGameInfo(IGameInfo info) { int x, y; try { FindSlotToPlot (info, out x, out y); } catch (Exception) { x = -1; y = -1; } GraphPoint point = new GraphPoint (info); point.x = x; point.y = y; points.Add (point); }
public Win32LuaLibraries( IEmulatorServiceProvider serviceProvider, MainForm mainForm, DisplayManager displayManager, InputManager inputManager, Config config, IEmulator emulator, IGameInfo game) { void EnumerateLuaFunctions(string name, Type type, LuaLibraryBase instance) { if (instance != null) { _lua.NewTable(name); } foreach (var method in type.GetMethods()) { var foundAttrs = method.GetCustomAttributes(typeof(LuaMethodAttribute), false); if (foundAttrs.Length == 0) { continue; } if (instance != null) { _lua.RegisterFunction($"{name}.{((LuaMethodAttribute) foundAttrs[0]).Name}", instance, method); } Docs.Add(new LibraryFunction( name, type.GetCustomAttributes(typeof(DescriptionAttribute), false).Cast <DescriptionAttribute>() .Select(descAttr => descAttr.Description).FirstOrDefault() ?? string.Empty, method )); } } if (true /*NLua.Lua.WhichLua == "NLua"*/) { _lua["keepalives"] = _lua.NewTable(); } _th = new NLuaTableHelper(_lua); _displayManager = displayManager; _inputManager = inputManager; _mainForm = mainForm; LuaWait = new AutoResetEvent(false); Docs.Clear(); var apiContainer = ApiManager.RestartLua(serviceProvider, LogToLuaConsole, _mainForm, _displayManager, _inputManager, _mainForm.MovieSession, _mainForm.Tools, config, emulator, game); // Register lua libraries foreach (var lib in Client.Common.ReflectionCache.Types.Concat(EmuHawk.ReflectionCache.Types) .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t) && t.IsSealed && ServiceInjector.IsAvailable(serviceProvider, t))) { bool addLibrary = true; var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttribute), false); if (attributes.Any()) { addLibrary = VersionInfo.DeveloperBuild || ((LuaLibraryAttribute)attributes.First()).Released; } if (addLibrary) { var instance = (LuaLibraryBase)Activator.CreateInstance(lib, this, apiContainer, (Action <string>)LogToLuaConsole); ServiceInjector.UpdateServices(serviceProvider, instance); // TODO: make EmuHawk libraries have a base class with common properties such as this // and inject them here if (instance is ClientLuaLibrary clientLib) { clientLib.MainForm = _mainForm; } else if (instance is ConsoleLuaLibrary consoleLib) { consoleLib.Tools = _mainForm.Tools; _logToLuaConsoleCallback = consoleLib.Log; } else if (instance is GuiLuaLibrary guiLib) { guiLib.CreateLuaCanvasCallback = (width, height, x, y) => { var canvas = new LuaCanvas(width, height, x, y, _th, LogToLuaConsole); canvas.Show(); return(_th.ObjectToTable(canvas)); }; } else if (instance is TAStudioLuaLibrary tastudioLib) { tastudioLib.Tools = _mainForm.Tools; } EnumerateLuaFunctions(instance.Name, lib, instance); Libraries.Add(lib, instance); } } _lua.RegisterFunction("print", this, GetType().GetMethod("Print")); EmulationLuaLibrary.FrameAdvanceCallback = Frameadvance; EmulationLuaLibrary.YieldCallback = EmuYield; EnumerateLuaFunctions(nameof(LuaCanvas), typeof(LuaCanvas), null); // add LuaCanvas to Lua function reference table }
void FindSlotToPlot(IGameInfo info, out int x, out int y) { x = GetXPos (info); y = GetYPos (info.Rating); if (IsPointWithinArea (x, y)) { GraphPoint matching = GraphPoint.Zero; if (!OverlappingPoint (x, y, point_size, out matching)) return; } bool found = false; int side_width = 3; int x1, y1; while (!found) { if (FindASlotAroundThis (x, y, side_width, out x1, out y1)) { x = x1; y = y1; return; } side_width += 2; } }
public MultiplayerBasicShellView(IGameInfo gameData, BasicData basicData, IStartUp start ) : base(gameData, basicData, start) { }
public GraphPoint(IGameInfo i) { info = i; x = -1; y = -1; }
public static bool IsNullInstance(this IGameInfo game) { return(game == null || game.System == VSystemID.Raw.NULL); }
public override bool isPlayable( IGameInfo g, int slotIndex ) { //by default, event cards can be played on any building return (tester == null) ? g.getUnit(slotIndex) != null : tester(g, slotIndex); }
void IGamePlatform.SupportedOrientation(IGameInfo game) { //this should not need to do anything. }
public override void GameStartEvent(IGameInfo gi) { }
//we may have to think about loading information. //until i have some experience, not sure what to do (?) public GamePage(IGameInfo gameData, BasicData basicData, IStartUp start) : base(gameData, basicData, start) { //TODO: may need to think about if we need load or update (?) }
public GamePage(IGameInfo gameData, BasicData basicData, IStartUp start) : base(gameData, basicData, start) { }
public CVarListConCommand(NI_ConsoleManager manager, IGameInfo gameInfo) { _Manager = manager; _GameInfo = gameInfo; }
public GameDeleteEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IGameDatabase gameDatabase) : base(eventCoreInstance, gameInfo) { this.GameDatabase = gameDatabase; }
public void InitializeDefault(IGameInfo game, string exePath) { this.game = game; this.exePath = exePath; this.profiles = new List <GameProfile>(); }