public void SetMode(int width, int height, float refreshRate) { Width = width; Height = height; var selectedMode = _findVideoMode(width); Lines = ArvidClient.arvid_client_get_video_mode_lines(selectedMode, refreshRate) - 1; if (Lines < 0) { throw new Exception("Could not find a mode that satisfies the selected refresh rate"); } var res = ArvidClient.arvid_client_set_video_mode(selectedMode, Lines); if (res < 0) { throw new Exception("Unable to set Arvid Mode"); } RefreshRate = ArvidClient.arvid_client_get_video_mode_refresh_rate(selectedMode, Lines); if (RefreshRate < 0) { throw new Exception("Unable to get final refresh rate"); } ArvidClient.arvid_client_set_virtual_vsync(Height - 15); Console.WriteLine("{0}x{1}@{2}. Asked for {3}", Width, Height, RefreshRate, refreshRate); }
public void Initialize() { if (Initialized) { return; } unsafe { int count; var vmodeInfos = new ArvidClient.ArvidClientVmodeInfo[20]; fixed(ArvidClient.ArvidClientVmodeInfo *vmodesInfosPtr = vmodeInfos) count = ArvidClient.arvid_client_enum_video_modes(vmodesInfosPtr, 20); ModeInfos = new ArvidClient.ArvidClientVmodeInfo[count]; Array.Copy(vmodeInfos, ModeInfos, count); } var res = ArvidClient.arvid_client_set_blit_type(ArvidClient.BlitType.Blocking); if (res < 0) { throw new Exception("Unable to set Arvid Blit Type"); } Initialized = true; }
public void SetMode(int width, int height) { Width = width; Height = height; _selectedMode = _findVideoMode(width); var res = ArvidClient.arvid_client_set_video_mode(_selectedMode, Lines); if (res < 0) { throw new Exception("Unable to set Arvid Mode"); } }
public unsafe void RenderPresent() { fixed(ushort *surface = &_framebuffer[0]) { var res = ArvidClient.arvid_client_blit_buffer( surface, Width, Height, Width ); if (res != 0) { throw new Exception("Error blitting to arvid"); } } }
public void RenderPresent() { SDL.SDL_RenderPresent(_sdlRenderer); try { SDL.SDL_LockSurface(_sdlSurface); unsafe { fixed(ushort *tempDestPtr = &_tempDestination[0]) { var surface = (SDL.SDL_Surface *)_sdlSurface.ToPointer(); for (var i = 0; i < Height; i++) { Buffer.MemoryCopy( (ushort *)(surface->pixels + i * surface->pitch), tempDestPtr + i * Width, Width * 2, Width * 2 ); } var res = ArvidClient.arvid_client_blit_buffer( tempDestPtr, Width, Height, Width ); if (res != 0) { throw new Exception("Error blitting to arvid"); } } } } finally { SDL.SDL_UnlockSurface(_sdlSurface); } }
public void SetMode(int width, int height) { Width = width; Height = height; var selectedMode = _findVideoMode(width); var res = ArvidClient.arvid_client_set_video_mode(selectedMode, Lines); if (res < 0) { throw new Exception("Unable to set Arvid Mode"); } ArvidClient.arvid_client_set_virtual_vsync(Height - 15); // if (IntPtr.Zero != _tempDestination) FreeTexture(_tempDestination); // _tempDestination = CreateTexture( // SDL.SDL_PIXELFORMAT_RGB555, // SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING, // Width, // Height // ); }
public void SetInterlacing(bool interlacing) { Interlacing = interlacing; ArvidClient.arvid_client_set_interlacing((short)(interlacing ? 1 : 0)); }
public void RenderWaitForVsync() { ArvidClient.arvid_client_wait_for_vsync(); }
public static int Main(string[] args) { var cefMainArgs = new CefMainArgs(args); var cefApp = new MenuCefApp(); var res = CefRuntime.ExecuteProcess(cefMainArgs, cefApp, IntPtr.Zero); if (res >= 0) { return(res); } try { InitializeLogger(); Logger.Info("Initializing Arvid"); while (!ArvidClient.Connect("192.168.2.101")) { Logger.Error("Could not connect to Arvid"); } Logger.Info("Initializing SDL"); if (SDL.SDL_Init(SDL.SDL_INIT_JOYSTICK | SDL.SDL_INIT_VIDEO) != 0) { Logger.Error(new Exception("SDL Initialization error")); } #if (DEBUG) SDL.SDL_GetVersion(out var version); Logger.Debug($"SDL: {version.major}.{version.minor}.{version.patch}"); #endif if (SDL_ttf.TTF_Init() != 0) { Logger.Error(new Exception("TTF Initialization error")); } SDL.SDL_CreateWindow( "RetroLite", SDL.SDL_WINDOWPOS_UNDEFINED, SDL.SDL_WINDOWPOS_UNDEFINED, 320, 240, SDL.SDL_WindowFlags.SDL_WINDOW_BORDERLESS ); // Container using (var container = SetupContainer(cefMainArgs, cefApp)) { var sceneManager = container.GetInstance <SceneManager>(); while (Running) { sceneManager.RunLoop(); } } return(0); } catch (Exception e) { Logger.Error(e); return(1); } finally { if (ArvidClient.IsConnected) { ArvidClient.arvid_client_close(); } SDL_ttf.TTF_Quit(); SDL.SDL_Quit(); } }