Work in progress : Retroarch - nixxou/BigBoxProfile GitHub Wiki
Just a draft, i will focus about the gun-related things for now.
So, i have two install of retroarch, one is my normal install, and one dedicated to Sinden gun. The Siden gun version of retroarch is called LG-retroarch.exe
On my normal install i have the bezel project setup for all my plateforms ( https://github.com/thebezelproject/BezelProject ) and i'm using my BezelMatcher launchbox plugin ( https://forums.launchbox-app.com/files/file/4447-bezelmaster-use-your-bezel-in-standalone-emulator-and-improve-bezel-game-matching/ ) to improve match accuracy when the naming of my games don't follow the redump name.
I also added extra bezel for nearly all gun games : https://mega.nz/file/0ihkWCIS#XFcCfycYy35ZDJsPgshbO6mfLZIo-gTyHGasnWoGNrs Each files are named the same than the original bezel + .siden80.png
My normal retroarch bigboxprofile look like this :
Module 1 : Edit retroarch.cfg to force it to use my main monitor.
Module 2 : Start DS4Windows for my controller.
Module 3 : A rom selector inside archive, for cardridge based system, i keep all version of the game inside 7z and this give me a menu to choose the game to launch.
Module 4 : An AHK code :
Ok, so here, when i launch a game, it check if i have a sindenbezel, for it, if yes, i know it's a gun game, and it add the argument --gungame to the command line.
Module 5 : Hid Detector. I use it a really really basic way, just to add a command --lightgun1 if my Sinden gun is plugged.
Module 6 : Change Exe. If i have both the argument --gungame and --lightgun1, i change the Exe to RetroarchForward that will open LG-retroarch.exe and foward it all arguments.
There is a reason why i don't use change exe directly to LG-retroarch.exe, because if i was doing that, it would launch LG-retroarch with the current bigboxmodule and i want to spawn a new instance of bbprofile for LG-retroarch.exe
Code of the fowarder :
using System.Diagnostics;
using System.Text;
internal class Program
{
private static void Main(string[] args)
{
string lightgunretroarch = @"I:\LaunchBox\Emulators\Lighgun\RetroArch-Win64\LG-retroarch.exe";
string lightgunretroarchpath = @"I:\LaunchBox\Emulators\Lighgun\RetroArch-Win64";
Process process = new Process();
try
{
process.StartInfo.FileName = lightgunretroarch;
process.StartInfo.WorkingDirectory = lightgunretroarchpath;
process.StartInfo.Arguments = ArgsToCommandLine(args);
process.Start();
process.WaitForExit();
}
catch { }
}
public static string ArgsToCommandLine(string[] arguments)
{
var sb = new StringBuilder();
foreach (string argument in arguments)
{
bool needsQuoting = argument.Any(c => char.IsWhiteSpace(c) || c == '\"');
if (!needsQuoting)
{
sb.Append(argument);
}
else
{
sb.Append('\"');
foreach (char c in argument)
{
int backslashes = 0;
while (backslashes < argument.Length && argument[backslashes] == '\\')
{
backslashes++;
}
if (c == '\"')
{
sb.Append('\\', backslashes * 2 + 1);
sb.Append(c);
}
else if (c == '\0')
{
sb.Append('\\', backslashes * 2);
break;
}
else
{
sb.Append('\\', backslashes);
sb.Append(c);
}
}
sb.Append('\"');
}
sb.Append(' ');
}
return sb.ToString().TrimEnd();
}
}
Module 7 : The module handling my pause menu, disabled if --lightgun1 is on.
Module 8 : I remove --gungame from the command line to clean since it's just a temporary arguments for internal work.
And now My LG-Retroarch.exe :
Module 1 : Force monitor to main.
Module 2 : Execute this ahk code :
#includegamedata
#includeargs
Bezel := gameData["BezelImagePath"]
BezelSiden = %Bezel%.siden80.png
Dest = I:\LaunchBox\Emulators\Lighgun\RetroArch-Win64\reshade-shaders\Textures\Layer.png
if(FileExist(BezelSiden)){
FileDelete, %Dest%
CreateSymbolicLink(Dest, BezelSiden)
}
CreateSymbolicLink(Link, Target)
{
if (FileExist(Link)) {
ErrorLevel := -1
return false ; Link already exists
}
attributes := FileExist(Target)
if (!attributes) {
ErrorLevel := -2
return false ; Target doesn't exists
}
if (SubStr(Link, 2, 1) = ":")
Link := "\\?\" Link
loop Files, % Target, DF
Target := A_LoopFileLongPath
Target := "\\?\" Target
isDir := !!InStr(attributes, "D")
DllCall("Kernel32\CreateSymbolicLink", "Ptr",&Link, "Ptr",&Target, "Int",isDir)
ErrorLevel := !FileExist(Link)
return !ErrorLevel
}
So, it auto copy the Sinden Bezel to a Layer.png file. And i have a Reshade shader that will show it.
Module 3 : Fix retroarch gun mouse ordering.
Was thinking things a little too big when i designed this module with priority and stuff, now i just use it to assign the mouse index for Gun 1 and Gun 2.
Module 4 : A pause menu.