//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public CaptureDisplayDetails() throws java.io.IOException public CaptureDisplayDetails() { VideoEngine ge = VideoEngine.Instance; sceDisplay display = Modules.sceDisplayModule; fbp = ge.FBP; fbw = ge.FBW; zbp = ge.ZBP; zbw = ge.ZBW; psm = ge.PSM; topaddrFb = display.TopAddrFb; bufferwidthFb = display.BufferWidthFb; pixelformatFb = display.PixelFormatFb; sync = display.Sync; // TODO clamp lengths to within valid RAM range int pixelFormatBytes = pspsharp.graphics.RE.IRenderingEngine_Fields.sizeOfTextureType[psm]; drawBuffer = new CaptureRAM(fbp + MemoryMap.START_VRAM, fbw * 272 * pixelFormatBytes); depthBuffer = new CaptureRAM(zbp + MemoryMap.START_VRAM, zbw * 272 * 2); pixelFormatBytes = pspsharp.graphics.RE.IRenderingEngine_Fields.sizeOfTextureType[pixelformatFb]; displayBuffer = new CaptureRAM(topaddrFb, bufferwidthFb * 272 * pixelFormatBytes); }
public PspGeList(int id) { videoEngine = VideoEngine.Instance; this.id = id; blockedThreadIds = new LinkedList <int>(); reset(); }
public override void startDirectRendering(bool textureEnabled, bool depthWriteEnabled, bool colorWriteEnabled, bool setOrthoMatrix, bool orthoInverted, int width, int height) { directMode = true; re.disableFlag(IRenderingEngine_Fields.GU_DEPTH_TEST); re.disableFlag(IRenderingEngine_Fields.GU_BLEND); re.disableFlag(IRenderingEngine_Fields.GU_ALPHA_TEST); re.disableFlag(IRenderingEngine_Fields.GU_FOG); re.disableFlag(IRenderingEngine_Fields.GU_LIGHTING); re.disableFlag(IRenderingEngine_Fields.GU_COLOR_LOGIC_OP); re.disableFlag(IRenderingEngine_Fields.GU_STENCIL_TEST); re.disableFlag(IRenderingEngine_Fields.GU_CULL_FACE); re.disableFlag(IRenderingEngine_Fields.GU_SCISSOR_TEST); if (textureEnabled) { re.enableFlag(IRenderingEngine_Fields.GU_TEXTURE_2D); } else { re.disableFlag(IRenderingEngine_Fields.GU_TEXTURE_2D); } re.TextureMipmapMinFilter = TFLT_NEAREST; re.TextureMipmapMagFilter = TFLT_NEAREST; re.TextureMipmapMinLevel = 0; re.TextureMipmapMaxLevel = 0; re.setTextureWrapMode(TWRAP_WRAP_MODE_CLAMP, TWRAP_WRAP_MODE_CLAMP); int colorMask = colorWriteEnabled ? 0x00 : 0xFF; re.setColorMask(colorMask, colorMask, colorMask, colorMask); re.setColorMask(colorWriteEnabled, colorWriteEnabled, colorWriteEnabled, colorWriteEnabled); re.DepthMask = depthWriteEnabled; re.setTextureFunc(IRenderingEngine_Fields.RE_TEXENV_REPLACE, true, false); re.setTextureMapMode(TMAP_TEXTURE_MAP_MODE_TEXTURE_COORDIATES_UV, TMAP_TEXTURE_PROJECTION_MODE_TEXTURE_COORDINATES); re.FrontFace = true; re.setBones(0, null); directModeSetOrthoMatrix = setOrthoMatrix; if (setOrthoMatrix) { float[] orthoMatrix; if (orthoInverted) { orthoMatrix = VideoEngine.getOrthoMatrix(0, width, 0, height, -1, 1); } else { orthoMatrix = VideoEngine.getOrthoMatrix(0, width, height, 0, -1, 1); } re.ProjectionMatrix = orthoMatrix; re.ModelViewMatrix = null; re.TextureMatrix = null; } base.startDirectRendering(textureEnabled, depthWriteEnabled, colorWriteEnabled, setOrthoMatrix, orthoInverted, width, height); }
public void ReloadVideo() { if (VideoEngine != null) { VideoEngine.Dispose(); } VideoEngine = new VideoEngine(); VideoEngine.OnFrameAvailable += VideoEngine_OnFrameAvailable; VideoEngine.StartRecording(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); //await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => buttonShoot.Focus(FocusState.Pointer)); buttonShoot.Focus(FocusState.Pointer); viseur.Visibility = Visibility.Visible; //buttonHp.Content = health + ""; await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync(); _actionQueue = new ActionQueue(); _actionQueue.ExecuteIntervalInMilliseconds = 500; await InitializeAndStartVideoEngineAsync(); SetFlash(_settings.Flash, false); settingsPanelControl.ModeChanged += _videoEngine.OnModeChanged; settingsPanelControl.RemoveNoiseChanged += _videoEngine.OnRemoveNoiseChanged; settingsPanelControl.ApplyEffectOnlyChanged += _videoEngine.OnApplyEffectOnlyChanged; settingsPanelControl.IsoChanged += _videoEngine.OnIsoSettingsChangedAsync; settingsPanelControl.ExposureChanged += _videoEngine.OnExposureSettingsChangedAsync; _videoEngine.ShowMessageRequest += OnVideoEngineShowMessageRequestAsync; _videoEngine.Messenger.FrameCaptured += OnFrameCapturedAsync; _videoEngine.Messenger.PostProcessComplete += OnPostProcessCompleteAsync; Window.Current.VisibilityChanged += OnVisibilityChangedAsync; DataContext = this; timing(); _navigationHelper = new NavigationHelper(this); controlBar.HideButtonClicked += OnHideButtonClicked; controlBar.ToggleFlashButtonClicked += OnToggleFlashButtonClicked; controlBar.SettingsButtonClicked += OnSettingsButtonClicked; this.Loaded += BasicPage_Loaded; this.LayoutUpdated += BasicPage_LayoutUpdated; _videoEngine = VideoEngine.Instance; _settings = App.Settings; NavigationCacheMode = NavigationCacheMode.Required; try { IsolatedStorageHelper.DeleteObject("1"); } catch (Exception ettt) { } }
public void Kill() { if (AudioEngine != null) { AudioEngine.Dispose(); AudioEngine = null; } if (VideoEngine != null) { VideoEngine.Dispose(); VideoEngine = null; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public CaptureList(pspsharp.HLE.kernel.types.PspGeList list) throws Exception public CaptureList(PspGeList list) { this.list = new PspGeList(list.id); this.list.init(list.list_addr, list.StallAddr, list.cbid, list.optParams); if (list.StallAddr - list.list_addr == 0) { VideoEngine.log_Renamed.error("Capture: Command list is empty"); } int listSize = 0; if (list.StallAddr == 0) { // Scan list for END command Memory mem = Memory.Instance; for (int listPc = list.list_addr; Memory.isAddressGood(listPc); listPc += 4) { int instruction = mem.read32(listPc); int command = VideoEngine.command(instruction); if (command == GeCommands.END) { listSize = listPc - list.list_addr + 4; break; } else if (command == GeCommands.JUMP) { VideoEngine.log_Renamed.error("Found a JUMP instruction while scanning the list. Aborting the scan."); listSize = listPc - list.list_addr + 4; break; } else if (command == GeCommands.RET) { VideoEngine.log_Renamed.error("Found a RET instruction while scanning the list. Aborting the scan."); listSize = listPc - list.list_addr + 4; break; } else if (command == GeCommands.CALL) { VideoEngine.log_Renamed.warn("Found a CALL instruction while scanning the list. Ignoring the called list."); } } } else { listSize = list.StallAddr - list.list_addr; } listBuffer = new CaptureRAM(list.list_addr & Memory.addressMask, listSize); }
public override void setClut() { VideoEngine videoEngine = VideoEngine.Instance; GeContext context = videoEngine.Context; int clutNumEntries = videoEngine.ClutNumEntries; int[] clut = null; short[] shortClut; switch (context.tex_clut_mode) { case CMODE_FORMAT_16BIT_BGR5650: shortClut = videoEngine.readClut16(0); clut = new int[clutNumEntries]; for (int i = 0; i < clut.Length; i++) { clut[i] = color565to8888(shortClut[i]); } break; case CMODE_FORMAT_16BIT_ABGR5551: shortClut = videoEngine.readClut16(0); clut = new int[clutNumEntries]; for (int i = 0; i < clut.Length; i++) { clut[i] = color5551to8888(shortClut[i]); } break; case CMODE_FORMAT_16BIT_ABGR4444: shortClut = videoEngine.readClut16(0); clut = new int[clutNumEntries]; for (int i = 0; i < clut.Length; i++) { clut[i] = color4444to8888(shortClut[i]); } break; case CMODE_FORMAT_32BIT_ABGR8888: int[] intClut = videoEngine.readClut32(0); clut = new int[clutNumEntries]; Array.Copy(intClut, 0, clut, 0, clut.Length); break; } if (clut != null) { setClut(clut, context.tex_clut_shift, context.tex_clut_mask, context.tex_clut_start); } }
protected internal virtual void readVertex(Memory mem, int index, VertexState v, bool readTexture) { if (bufferVertexReader == null) { int addr = context.vinfo.getAddress(mem, index); context.vinfo.readVertex(mem, addr, v, readTexture, VideoEngine.Instance.DoubleTexture2DCoords); } else { // This is used for spline and bezier curves: // the VideoEngine is computing the vertices and is pushing them into a buffer. bufferVertexReader.readVertex(index, v); } if (context.vinfo.weight != 0) { VideoEngine.doSkinning(context.bone_uploaded_matrix, context.vinfo, v); } }
public override void endDirectRendering() { // Restore all the values according to the context or the clearMode re.setColorMask(context.colorMask[0], context.colorMask[1], context.colorMask[2], context.colorMask[3]); if (context.clearMode) { setClearModeSettings(clearModeContext.color, clearModeContext.stencil, clearModeContext.depth); } else { context.depthTestFlag.updateEnabled(); context.blendFlag.updateEnabled(); context.alphaTestFlag.updateEnabled(); context.fogFlag.updateEnabled(); context.colorLogicOpFlag.updateEnabled(); context.stencilTestFlag.updateEnabled(); context.cullFaceFlag.updateEnabled(); context.textureFlag.update(); re.DepthMask = context.depthMask; re.setTextureFunc(context.textureFunc, context.textureAlphaUsed, context.textureColorDoubled); } re.setTextureMapMode(context.tex_map_mode, context.tex_proj_map_mode); context.scissorTestFlag.updateEnabled(); context.lightingFlag.updateEnabled(); re.TextureMipmapMagFilter = context.tex_mag_filter; re.TextureMipmapMinFilter = context.tex_min_filter; re.setTextureWrapMode(context.tex_wrap_s, context.tex_wrap_t); re.FrontFace = context.frontFaceCw; if (directModeSetOrthoMatrix) { VideoEngine videoEngine = VideoEngine.Instance; videoEngine.projectionMatrixUpload.Changed = true; videoEngine.viewMatrixUpload.Changed = true; videoEngine.modelMatrixUpload.Changed = true; videoEngine.textureMatrixUpload.Changed = true; } base.endDirectRendering(); directMode = false; }
private void setStallAddressWithCachedMemory(PspGeList list, int stallAddr) { int startAddress = list.list_addr; int Length; if (stallAddr != 0) { Length = stallAddr - startAddress; } else { // The list has no stall address, scan for the FINISH command IMemoryReader memoryReader = MemoryReader.getMemoryReader(startAddress, 4); Length = 0; while (true) { int instruction = memoryReader.readNext(); int command = VideoEngine.command(instruction); if (command == GeCommands.FINISH) { // Add 4 to include the END command that follows the FINISH command Length = memoryReader.CurrentAddress - startAddress + 4; break; } } } if (Length >= 0) { int[] baseMemoryInts = Utilities.readInt32(startAddress, Length); list.setStallAddr(stallAddr, MemoryReader.getMemoryReader(startAddress, baseMemoryInts, 0, Length), startAddress, startAddress + Length); //if (log.DebugEnabled) { Console.WriteLine(string.Format("setStallAddressWithCachedMemory [0x{0:X8}-0x{1:X8}] {2}", startAddress, startAddress + Length, list)); } } else { list.StallAddr = stallAddr; } }
public virtual int sceGeGetCmd(int cmd) { VideoEngine ve = VideoEngine.Instance; int value; if (ExternalGE.Active) { value = ExternalGE.getCmd(cmd); } else { value = ve.getCommandValue(cmd); } if (log.InfoEnabled) { Console.WriteLine(string.Format("sceGeGetCmd {0}: cmd=0x{1:X}, value=0x{2:X6}", ve.commandToString(cmd).ToUpper(), cmd, value)); } return(value); }
public cameraSolo() { this.InitializeComponent(); timing(); _navigationHelper = new NavigationHelper(this); controlBar.HideButtonClicked += OnHideButtonClicked; controlBar.ToggleFlashButtonClicked += OnToggleFlashButtonClicked; controlBar.SettingsButtonClicked += OnSettingsButtonClicked; this.Loaded += BasicPage_Loaded; this.LayoutUpdated += BasicPage_LayoutUpdated; _videoEngine = VideoEngine.Instance; _settings = App.Settings; NavigationCacheMode = NavigationCacheMode.Required; try { IsolatedStorageHelper.DeleteObject("1"); } catch (Exception e) { } }
public override string ToString() { return(string.Format("GETexture[0x{0:X8}-0x{1:X8}, {2:D}x{3:D} (texture {4:D}x{5:D}), bufferWidth={6:D}, pixelFormat={7:D}({8})]", address, address + Length, width, height, TexImageWidth, TexImageHeight, bufferWidth, pixelFormat, VideoEngine.getPsmName(pixelFormat))); }
public override string ToString() { return(string.Format("FBTexture[0x{0:X8}-0x{1:X8}, {2:D}x{3:D}, bufferWidth={4:D}, pixelFormat={5:D}({6})]", address, address + Length, width, height, bufferWidth, pixelFormat, VideoEngine.getPsmName(pixelFormat))); }
/// <summary> /// Reads a sequence of VertexInfo structures. /// </summary> /// <param name="vertexInfo"> The VertexInfo prepared by the command list </param> /// <param name="address"> The start address of the structures </param> /// <param name="numberOfVertex"> The number of VertexInfo to read /// @return A Buffer containing all the non-native VertexInfo /// elements. The native elements are not included. /// Returns "null" if all the elements are native. </param> public Buffer read(VertexInfo vertexInfo, int address, int firstVertex, int numberOfVertex, bool canAllNativeVertexInfo) { videoEngine = VideoEngine.Instance; this.vertexInfo = vertexInfo; this.canAllNativeVertexInfo = canAllNativeVertexInfo; update(); // Don't need to read the vertex data if all elements are native if (AllNative) { //if (log.DebugEnabled) { Console.WriteLine(string.Format("Not reading Vertex, all native at 0x{0:X8}", address)); } return(null); } // Display debug information on non-native elements //if (log.DebugEnabled) { Console.WriteLine(string.Format("Reading {0:D} Vertex at 0x{1:X8}", numberOfVertex, address + firstVertex * vertexInfo.vertexSize)); if (!textureNative) { Console.WriteLine("Texture non-native " + vertexInfo.ToString()); } if (!colorNative) { Console.WriteLine("Color non-native " + vertexInfo.ToString()); } if (!normalNative) { Console.WriteLine("Normal non-native " + vertexInfo.ToString()); } if (!positionNative) { Console.WriteLine("Position non-native " + vertexInfo.ToString()); } } Address = address + firstVertex * vertexInfo.vertexSize; createVertexDataBuffer(numberOfVertex); // Prepare all the element readers IVertexInfoReader weightReader = getWeightReader(weightNative); IVertexInfoReader textureReader = getTextureReader(textureNative); IVertexInfoReader colorReader = getColorReader(colorNative); IVertexInfoReader normalReader = getNormalReader(normalNative); IVertexInfoReader positionReader = getPositionReader(positionNative); IVertexInfoReader padReader = getPaddingReader(vertexInfo.alignmentSize); // Read all the VertexInfo in sequence for (int i = 0; i < numberOfVertex; i++) { weightReader.read(); textureReader.read(); colorReader.read(); normalReader.read(); positionReader.read(); padReader.read(); } return(vertexDataBuffer.Buffer); }
public override void setTextureFormat(int pixelFormat, bool swizzle) { if (isLogDebugEnabled) { //JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET: //ORIGINAL LINE: Console.WriteLine(String.format("setTextureFormat pixelFormat=%d(%s), swizzle=%b", pixelFormat, pspsharp.graphics.VideoEngine.getPsmName(pixelFormat), swizzle)); Console.WriteLine(string.Format("setTextureFormat pixelFormat=%d(%s), swizzle=%b", pixelFormat, VideoEngine.getPsmName(pixelFormat), swizzle)); } base.setTextureFormat(pixelFormat, swizzle); }
public override string ToString() { return(string.Format("CachedTexture[({0:D} x {1:D}), {2}]", Width, Height, VideoEngine.getPsmName(PixelFormat))); }
public Texture(TextureCache textureCache, int addr, int lineWidth, int width, int height, int pixelStorage, int clutAddr, int clutMode, int clutStart, int clutShift, int clutMask, int clutNumBlocks, int mipmapLevels, bool mipmapShareClut, short[] values16, int[] values32) { this.textureCache = textureCache; this.addr = addr; this.lineWidth = lineWidth; this.width = width; this.height = height; this.pixelStorage = pixelStorage; this.clutAddr = clutAddr; this.clutMode = clutMode; this.clutStart = clutStart; this.clutShift = clutShift; this.clutMask = clutMask; this.clutNumBlocks = clutNumBlocks; this.mipmapLevels = mipmapLevels; this.mipmapShareClut = mipmapShareClut; bufferLengthInBytes = lineWidth * height; lineWidthInBytes = lineWidth; hashStrideInBytes = defaultHashStride; int bytesPerPixel = pspsharp.graphics.RE.IRenderingEngine_Fields.sizeOfTextureType[pixelStorage]; if (bytesPerPixel <= 0) { // Special texture types switch (pixelStorage) { case GeCommands.TPSM_PIXEL_STORAGE_MODE_DXT1: bufferLengthInBytes = VideoEngine.getCompressedTextureSize(lineWidth, height, 8); break; case GeCommands.TPSM_PIXEL_STORAGE_MODE_DXT3: case GeCommands.TPSM_PIXEL_STORAGE_MODE_DXT5: bufferLengthInBytes = VideoEngine.getCompressedTextureSize(lineWidth, height, 4); break; case GeCommands.TPSM_PIXEL_STORAGE_MODE_4BIT_INDEXED: bufferLengthInBytes >>= 1; lineWidthInBytes >>= 1; // Take a smaller hash stride for 4-bit indexed textures to better detect small texture changes // (e.g. for textures representing text) hashStrideInBytes = smallHashStride; break; } } else { bufferLengthInBytes *= bytesPerPixel; lineWidthInBytes *= bytesPerPixel; } if (values16 != null) { cachedValues16 = new short[lineWidth]; Array.Copy(values16, 0, cachedValues16, 0, lineWidth); } else if (values32 != null) { cachedValues32 = new int[lineWidth]; Array.Copy(values32, 0, cachedValues32, 0, lineWidth); } else { if (lineWidthInBytes < hashStrideInBytes) { if (lineWidthInBytes <= 32) { // No stride at all for narrow textures hashStrideInBytes = 0; } else { hashStrideInBytes = lineWidthInBytes - 4; } } hashCode_Renamed = GetHashCode(addr, bufferLengthInBytes, lineWidthInBytes, hashStrideInBytes, clutAddr, clutNumBlocks, mipmapLevels); } }
protected internal virtual void initRendering(GeContext context) { if (renderingInitialized) { return; } fbp = getFrameBufferAddress(context.fbp); psm = context.psm; zbp = getFrameBufferAddress(context.zbp); colorTestRef = getColorBGR(context.colorTestRef); colorTestMsk = getColorBGR(context.colorTestMsk); alphaRef = context.alphaRef & context.alphaMask; alphaMask = context.alphaMask; stencilRef = context.stencilRef & context.stencilMask; stencilMask = context.stencilMask; sfix = context.sfix; dfix = context.dfix; colorMask = getColor(context.colorMask); textureWidth = context.texture_width[mipmapLevel]; textureHeight = context.texture_height[mipmapLevel]; texEnvColorB = getColor(context.tex_env_color[2]); texEnvColorG = getColor(context.tex_env_color[1]); texEnvColorR = getColor(context.tex_env_color[0]); texMinFilter = context.tex_min_filter; texMagFilter = context.tex_mag_filter; primaryColor = getColor(context.vertexColor); baseRendererKey = getBaseRendererKey(context); if (!transform2D && context.lightingFlag.Enabled) { lighting = new Lighting(context.view_uploaded_matrix, context.mat_emissive, context.ambient_light, context.lightFlags, context.light_pos, context.light_kind, context.light_type, context.lightAmbientColor, context.lightDiffuseColor, context.lightSpecularColor, context.lightConstantAttenuation, context.lightLinearAttenuation, context.lightQuadraticAttenuation, context.spotLightCutoff, context.spotLightCosCutoff, context.light_dir, context.spotLightExponent, context.materialShininess, context.lightMode, context.vinfo.normal != 0); } // Is the lighting model using the material color from the vertex color? if (!transform2D && context.lightingFlag.Enabled && context.mat_flags != 0 && context.useVertexColor && context.vinfo.color != 0 && isTriangle) { setVertexPrimaryColor = true; } primaryColorSetGlobally = false; if (transform2D || !context.lightingFlag.Enabled) { // No lighting, take the primary color from the vertex. // This will be done by the BasePrimitiveRenderer when the vertices are known. if (context.useVertexColor && context.vinfo.color != 0) { setVertexPrimaryColor = true; if (!isTriangle) { // Use the color of the 2nd sprite vertex primaryColorSetGlobally = true; } } else { // Use context.vertexColor as the primary color primaryColorSetGlobally = true; } } textureAccess = null; if (isUsingTexture(context)) { int textureBufferWidth = VideoEngine.alignBufferWidth(context.texture_buffer_width[mipmapLevel], context.texture_storage); int textureHeight = context.texture_height[mipmapLevel]; int textureAddress = context.texture_base_pointer[mipmapLevel]; if (cachedTexture == null) { int[] clut32 = VideoEngine.Instance.readClut32(mipmapLevel); short[] clut16 = VideoEngine.Instance.readClut16(mipmapLevel); // Always request the whole buffer width IMemoryReader imageReader = ImageReader.getImageReader(textureAddress, textureBufferWidth, textureHeight, textureBufferWidth, context.texture_storage, context.texture_swizzle, context.tex_clut_addr, context.tex_clut_mode, context.tex_clut_num_blocks, context.tex_clut_start, context.tex_clut_shift, context.tex_clut_mask, clut32, clut16); textureAccess = new RandomTextureAccessReader(imageReader, textureBufferWidth, textureHeight); } else { textureAccess = cachedTexture.OriginalTexture; } // Avoid an access outside the texture area textureAccess = TextureClip.getTextureClip(context, mipmapLevel, textureAccess, textureBufferWidth, textureHeight); } renderingInitialized = true; }
public override string ToString() { return(string.Format("Texture[0x{0:X8}, {1:D}x{2:D}, bufferWidth={3:D}, {4}]", addr, width, height, lineWidth, VideoEngine.getPsmName(pixelStorage))); }