Skip to content

Instantly share code, notes, and snippets.

Avatar

Mario Di Vece mariodivece

View GitHub Profile
@mariodivece
mariodivece / mad-scanlines-crt.glsl
Last active Jan 15, 2022
CRT Scanline Effect for Dolphin Emulator
View mad-scanlines-crt.glsl
void main()
{
float currentMillis = GetTime() / float(1000.0);
float2 coords = GetCoordinates();
float lineCount = GetWindowResolution().y / 2.0;
// scanlines
int lineIndex = int( ( coords.y + currentMillis * 0.5 ) * lineCount );
#ifdef API_OPENGL
float lineIntensity = mod(float(lineIndex), 2);
@mariodivece
mariodivece / scanlines.glsl
Last active Jan 15, 2022
A simple, configurable GLSL scanline effect shader for Dolphin
View scanlines.glsl
/*
[configuration]
[OptionRangeFloat]
GUIName = Blur Area
OptionName = BLUR_SIZE
MinValue = 0.0
MaxValue = 10.0
StepAmount = 0.1
DefaultValue = 1.6
@mariodivece
mariodivece / MultimediaTimer.cs
Created Jul 24, 2017
A timer based on the multimedia timer API with approximately 1 millisecond precision.
View MultimediaTimer.cs
namespace Unosquare.FFME.Core
{
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// A timer based on the multimedia timer API with approximately 1 millisecond precision.
@mariodivece
mariodivece / GT511C3.cs
Created Apr 17, 2016
A very simple wrapper to control the popular fingerprint reader model GT511C3
View GT511C3.cs
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Unosquare.Devices
{
public class GT511C3 : IDisposable
View CsvWriter.cs
namespace Unosquare.Utils
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@mariodivece
mariodivece / MakeComboBoxSearchable.cs
Created Jan 3, 2015
Makes a WPF ComboBox Searchable via its items
View MakeComboBoxSearchable.cs
public static void MakeComboBoxSearchable(this ComboBox targetComboBox)
{
targetComboBox.Loaded += (ls, le) =>
{
targetComboBox.Items.IsLiveFiltering = true;
var targetTextBox = targetComboBox.Template.FindName("PART_EditableTextBox", targetComboBox) as TextBox;
if (targetTextBox == null) return;
targetComboBox.IsEditable = true;
@mariodivece
mariodivece / CircleOffset.cs
Created May 20, 2014
Extension methods that perform circular-addressing math on 0-index based arrays
View CircleOffset.cs
namespace Unosquare.Utilities
{
public static class Extensions
{
static public int CircleOffset(this int currentIndex, int offset, int lastIndex)
{
var newIndex = currentIndex + offset;
return newIndex.CircleIndex(lastIndex);
}
View DimensionalObjectBase.cs
namespace Unosquare.Wpf
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public abstract class DimensionalObjectBase : ViewModelBase
{
@mariodivece
mariodivece / ViewModelBase.cs
Last active Apr 6, 2019
A simple ViewModelBase for WPF Apps
View ViewModelBase.cs
namespace Unosquare.Wpf
{
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
public abstract class ViewModelBase : INotifyPropertyChanged
{
// uncomment the line below for Log4Net Logging
@mariodivece
mariodivece / GenericServer.cs
Created Mar 25, 2014
A (WIP) generic server using sockets
View GenericServer.cs
/// <summary>
/// Author: Mario A. Di Vece - mario@unosquare.com
/// Version 1.0b
/// Generic Server toolkit for quick implementation of socket communications.
/// Unosquare, LLC (c) 2013 - MIT License
/// You are free to use this code. Please give me some credit if you use it.
/// </summary>
namespace Unosquare.Labs.Sockets
{
using System;