diff --git a/pkgs/misc/emulators/retroarch/cores.nix b/pkgs/misc/emulators/retroarch/cores.nix index a8b74959d90..db412eb883d 100644 --- a/pkgs/misc/emulators/retroarch/cores.nix +++ b/pkgs/misc/emulators/retroarch/cores.nix @@ -24,7 +24,10 @@ let --add-flags "-L $COREDIR/${d2u core}_libretro.so $@" ''; - passthru.libretroCore = "/lib/retroarch/cores"; + passthru = { + core = core; + libretroCore = "/lib/retroarch/cores"; + }; meta = with stdenv.lib; { inherit description; diff --git a/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix b/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix new file mode 100644 index 00000000000..ec539cb43f9 --- /dev/null +++ b/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix @@ -0,0 +1,39 @@ +{ stdenv, pkgs, cores }: + +assert cores != []; + +with pkgs.lib; + +let + + script = exec: '' + #!${stdenv.shell} + nohup sh -c "sleep 1 && pkill -SIGSTOP xbmc" & + nohup sh -c "${exec} '$@' -f;pkill -SIGCONT xbmc" + ''; + scriptSh = exec: pkgs.writeScript ("xbmc-"+exec.name) (script exec.path); + execs = map (core: rec { name = core.core; path = core+"/bin/retroarch-"+name;}) cores; + +in + +stdenv.mkDerivation rec { + name = "xbmc-retroarch-advanced-launchers-${version}"; + version = "0.2"; + + dontBuild = true; + + buildCommand = '' + mkdir -p $out/bin + ${stdenv.lib.concatMapStrings (exec: "ln -s ${scriptSh exec} $out/bin/xbmc-${exec.name};") execs} + ''; + + meta = { + description = "XBMC retroarch advanced launchers"; + longDescription = '' + These retroarch launchers are intended to be used with + anglescry advanced launcher for XBMC since device input is + caught by both XBMC and the retroarch process. + ''; + license = "GPL-3"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4777a974d76..e066726355e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10519,13 +10519,11 @@ let gtk_modules = [ libcanberra ]; }; - wrapRetroArch = { retroarch }: + retroArchCores = let cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; in - import ../misc/emulators/retroarch/wrapper.nix { - inherit stdenv lib makeWrapper retroarch; - cores = with libretro; + with libretro; ([ ] ++ lib.optional (cfg.enable4do or false) _4do ++ lib.optional (cfg.enableBsnesMercury or false) bsnes-mercury @@ -10543,6 +10541,14 @@ let ++ lib.optional (cfg.enableStella or false) stella ++ lib.optional (cfg.enableVbaNext or false) vba-next ); + + wrapRetroArch = { retroarch }: + let + cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; + in + import ../misc/emulators/retroarch/wrapper.nix { + inherit stdenv lib makeWrapper retroarch; + cores = retroArchCores; }; wxhexeditor = callPackage ../applications/editors/wxhexeditor { }; @@ -10574,6 +10580,11 @@ let ffmpeg = ffmpeg_1; }; + xbmc-retroarch-advanced-launchers = + callPackage ../misc/emulators/retroarch/xbmc-advanced-launchers.nix { + cores = retroArchCores; + }; + xca = callPackage ../applications/misc/xca { }; xcalib = callPackage ../tools/X11/xcalib { };