Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xenia(Xbox 360 emulator) #108212

Open
schvabodka-man opened this issue Jan 2, 2021 · 7 comments
Open

Xenia(Xbox 360 emulator) #108212

schvabodka-man opened this issue Jan 2, 2021 · 7 comments

Comments

@schvabodka-man
Copy link

Project description
Xbox 360 emulator. Already working and can run tons of games. There is already an rpcs3 in repos(PS3 emu) so it would be kinda nice pair :)

Metadata

@samuelgrf
Copy link
Member

Here's my current progress, building fails with error: implicit instantiation of undefined template 'std::__1::ctype<char16_t>' unfortunately (full log).

{ fetchFromGitHub
, gtk3
, llvmPackages_9
, lz4
, pkg-config
, python3
, SDL2
, vulkan-headers
, vulkan-loader
}:

let
  stdenv = llvmPackages_9.libcxxStdenv;
in

stdenv.mkDerivation {
  pname = "xenia";
  version = "unstable-2021-01-04";

  src = fetchFromGitHub {
    owner = "xenia-project";
    repo = "xenia";
    rev = "9a74df491ffd0189ddd26bc2030e0eae6a775f4e";
    sha256 = "106dkcnsc7ibx0c8fa8csp49dz59s9d4k6hxm4lybf3lybq0l491";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    llvmPackages_9.bintools
    pkg-config
    python3
  ];

  buildInputs = [
    gtk3
    lz4
    SDL2
    vulkan-headers
    vulkan-loader
  ];

  patchPhase = ''
    runHook prePatch

    # Fixes "fatal error: 'sys/sysctl.h' file not found"
    substituteInPlace third_party/libav/config_lin.h \
      --replace "#define HAVE_SYSCTL 1" "#define HAVE_SYSCTL 0"

    runHook postPatch
  '';

  dontConfigure = true;

  buildPhase = ''
    runHook preBuild

    # TODO Look into using 'setup' argument
    python3 xenia-build build --config release -j $NIX_BUILD_CORES

    runHook postBuild
  '';

  NIX_CFLAGS_COMPILE = "-Wno-error-unused-result";

  enableParallelBuilding = true;
}

@AndersonTorres
Copy link
Member

There is another distro running Xenia?

@schvabodka-man
Copy link
Author

Hello @AndersonTorres @samuelgrf . Xenia is actually packages in arch AUR (which is also built from source) as latest git version.
There are 2 versions of that package in repos:
The "regular one" - https://aur.archlinux.org/packages/xenia-git/
And the one with some patches - https://aur.archlinux.org/packages/xenia-linux-fixes-git/
You can see a build script of them by clicking "View PKGBUILD" button

@AndersonTorres
Copy link
Member

Fun to know. Can it be built and run on an AMD Ryzen 5?

@schvabodka-man
Copy link
Author

@AndersonTorres on windows - definitely. On Linux - probably yes(why not?)

@stale
Copy link

stale bot commented Jul 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 13, 2021
@adisbladis
Copy link
Member

This expression builds Xenia from master, but the canary build still fails:

{ clangStdenv
, fetchFromGitHub
, lib
, python3
, pkg-config
, gtk3
, SDL2
, lz4
, libunwind
, libiberty
, xorg
, vulkan-loader
}:

let
  mkXenia =
    { src
    , version
    , suffix ? ""
    }:

    clangStdenv.mkDerivation {
      pname = "xenia${suffix}";
      inherit src version;

      nativeBuildInputs = [
        python3
        pkg-config
      ];

      buildInputs = [
        gtk3
        SDL2
        lz4
        libunwind
        libiberty
        xorg.libX11
        xorg.libxcb
      ];

      dontConfigure = true;

      NIX_CFLAGS_COMPILE = [
        "-Wno-error=unused-result"
        "-fno-lto"
      ];

      buildPhase = ''
        runHook preBuild
        python3 ./xb build --config release -j $NIX_BUILD_CORES
        runHook postBuild
      '';

      installPhase = ''
        runHook preInstall
        mkdir -p $out/bin
        cp -a ./build/bin/*/*/xenia $out/bin/
        runHook postInstall
      '';

      postFixup = ''
        patchelf --add-rpath ${vulkan-loader}/lib $out/bin/xenia
      '';

      meta =
        let
          inherit (lib) licenses platforms;
        in
        {
          description = "Xenia is an experimental emulator for the Xbox 360";
          homepage = "https://xenia.jp";
          license = licenses.bsd3;
          maintainers = [ ];
          platforms = platforms.linux;
        };

    };

in
{

  xenia = mkXenia {
    version = "unstable-2022-07-27";
    src = fetchFromGitHub {
      owner = "xenia-project";
      repo = "xenia";
      fetchSubmodules = true;
      rev = "7595cdb52bd12d448aeabe4908862f59d283ce9d";
      hash = "sha256-W6lOZxMwNTxSPIcu2f2hrq8bxT/aqxdLTSLV9D1KY0U=";
    };
  };

  xenia-canary = mkXenia {
    version = "unstable-2022-08-20";
    src = fetchFromGitHub {
      owner = "xenia-canary";
      repo = "xenia-canary";
      fetchSubmodules = true;
      rev = "010b59e81cee3459dc03ed40f814537c2f682b6c";
      hash = "sha256-Njbp9wiyinRnC+Qw1tIEWU4UtQXmEHjAR5I+0Q2z8m8=";
    };
  };

}

I'm having some issues getting anything to actually run though. Hopefully this is enough for someone sufficiently motivated to take over the effort.

@AndersonTorres AndersonTorres self-assigned this Aug 21, 2022
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants