mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-10 03:02:05 -10:00
This controller/adapter supports rumble as well as reading the state of both analog sticks and the L/R triggers. Code by @RandalLinden
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Controls.Templates;
|
|
using Mesen.Config;
|
|
using Mesen.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesen.Views
|
|
{
|
|
public class ControllerConfigViewLocator : IDataTemplate
|
|
{
|
|
public Control Build(object? data)
|
|
{
|
|
KeyMappingViewModel? mappings = data as KeyMappingViewModel;
|
|
|
|
if(mappings != null) {
|
|
return mappings.Type switch {
|
|
ControllerType.SnesController or ControllerType.SnesRumbleController or ControllerType.SnesBlueRetroController => new SnesControllerView(),
|
|
ControllerType.SnesNttDataKeypad => new SnesNttDataKeypadControllerView(),
|
|
ControllerType.NesController => new NesControllerView(),
|
|
ControllerType.FamicomController => new NesControllerView(),
|
|
ControllerType.FamicomControllerP2 => new NesControllerView(true),
|
|
ControllerType.BandaiHyperShot => new NesCustomControllerView(),
|
|
ControllerType.Pachinko => new NesCustomControllerView(),
|
|
ControllerType.FcnsController => new NesCustomControllerView(),
|
|
ControllerType.HoriTrack => new NesControllerView(),
|
|
ControllerType.GameboyController => new NesControllerView(),
|
|
ControllerType.GbaController => new GbaControllerView(),
|
|
ControllerType.PceController => new PceControllerView(),
|
|
ControllerType.PceAvenuePad6 => new PceAvenuePad6View(),
|
|
ControllerType.SmsController => new SmsControllerView(),
|
|
ControllerType.WsController => new WsControllerView(),
|
|
ControllerType.WsControllerVertical => new WsControllerVerticalView(),
|
|
ControllerType.Pcv2Controller => new WsPcv2ControllerView(),
|
|
_ => new DefaultControllerView()
|
|
};
|
|
}
|
|
|
|
return new TextBlock { Text = "No matching view found for controller type" };
|
|
}
|
|
|
|
public bool Match(object? data)
|
|
{
|
|
return data is KeyMappingViewModel;
|
|
}
|
|
}
|
|
}
|