| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
I checked the archives against the previous versions and the contents
match, however the archives themselves had differences with the file
order so the hashes are different now.
In the long term, we probably should use fetchzip instead so we don't
get a hash mismatch if none of the actual contents change.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
| |
The name "hook" is a not very good derivation name to distinguish it
from other hooks, so let's actually name them.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Thanks to @layus for pointing out that there is at least one other game
(Epistory) which has the same FMOD issue as Bastion has.
So I decided to move this into a setup hook that automatically discovers
whether it's the affected FMOD version and NOPs out the calls to
system().
In summary: If another game is affected, all that's needed now is to add
fixFmodHook to nativeBuildInputs.
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @layus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This should make all the extra unpackCmd attributes for the GOG games
superfluous and make the expression way less convoluted, especially the
games based on Unity3D.
Right now however, the gogUnpackHook is added to buildGame, which is
used for all games, not only for the GOG ones. While it doesn't really
hurt or affect non-GOG games, it's still part of the build closure so we
might want to apply this to GOG only at some day.
For that, we need to restructure our whole packaging layout, because we
want to have a way to override buildGame only for a certain namespace
but without introducing too much churn or duplicating things.
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @layus
|
|
|
|
|
|
|
| |
Getting a message like "Type {thetype} not found." is not very helpful,
so let's add the $ in front of the string.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we only matched a substring of a type, which isn't very exact of
course. We also weren't able to specify the method to patch.
Now the methods that are being patched can be specified by using
Type::Method. If it's just Type without a method all the methods of the
type and its subtypes are patched.
I also added a small check to make sure that all of these methods were
found, and if not an error is thrown.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
If there is a command line usage error, we really don't want the program
to return exit status 0 (success), so let's actually set the return
value on WithParsed().
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
| |
We really want to make sure that things were actually patched, so just
silently skipping everything is not an option.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
If we want to replace a call with one that's not in a module which is
currently referenced by the target file we now have another command line
flag for replace-call (-a) where we can specify the additional DLL file.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
While there won't be any .git directories within ./src, I still create
Vim swap files all the time when editing stuff. So let's make sure that
those swap files are not included in the src input of the derivation.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default the assemblies are searched in the current working directory,
but when patching an assembly in some other directory than the current
the patcher will fail to resolve assemblies residing beneath the target
file.
So we just add the directory of the target file to the search path.
I also moved all of the assemblies in the test to be in a subdir so we
can verify that this indeed works and we won't regress in the future.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the command is not executed inside a terminal the value of
Console.WindowWidth is 0 and thus we will get an exception from
CommandLineParser:
Unhandled Exception:
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring ...
at CommandLine.Text.HelpText.AddOption ...
...
So let's initialize the parser with settings and if WindowWidth is 0 we
just add 80 as the width.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using an IEnumerable for the search and replace arguments isn't really a
very good idea, because it makes command line usage very annoying and
messes up the usage description.
I originally made this an IEnumerable because I wanted to have a way to
specify multiple replacements, but we can simply run the patcher twice
or more times.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we have searched for methods in two steps: First get all the
types and then find all of the constructors or method definitions.
The match for the actual method definition was done first for the type
and then again for the full definition of the method/constructor.
For the replace-call subcommand this also means that we don't have a
very good way to find the type, because if we wanted to keep doing this
in two steps we would need to parse the type name out of the one given
as the replacement string in replace-call.
So now we recurse through *all* the constructors and methods and do a
full match against the specified replacement string, both for
replace-call and for fix-filestreams.
Compared to the implementation so far we also do this just once instead
of every time we find a call or FileStream constructor.
I also overhauled the way we do testing, because in the end writing
tests using NUnit would introduce a lot of code churn because we need to
make a lot of external calls. The shell is especially useful for exactly
that and our tests are now just a plain shell script.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mainly this is so we can prepare for running unit tests, so we get the
latest version of NUnit and run the console test runner.
Currently there is only a dummy test which always succeeds, but it's
there so that we can fill out the boilerplate later.
I also moved the option definitions into a separate file so they don't
clutter up the main file.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I really would have preferred a simple Makefile, but with that we can't
use buildDotnetPackage and we also need to take care of butchering the
dependencies manually.
So I moved everything to src/ and added a csproj file to clean up most
of the cruft and just use buildDotnetPackage with minimal attributes.
In addition to that I also added assembly info, so that the command line
help will show the proper author name, copyright, yaddayadda...
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's a very early version which I did for a Unity3d game and it
*desperately* needs a cleanup.
An example command line:
monogame-patcher replace-call -i Assembly-CSharp.dll \
'System.String UnityEngine.Application::get_dataPath()' \
'System.String UnityEngine.Application::get_persistentDataPath()' \
IniParser SaveMeta
Right now the replace-call subcommand has UnityEngine.Application
hardcoded, so this won't work for other types than
UnityEngine.Application.
However, I'm going to refactor the whole patcher very soon and add some
tests, so this whole mess will be cleaned up.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The patcher using Cecil is now in its own derivation and can thus be
easily added via nativeBuildInputs. Patching FileStream types is so
common that it comes in handy for other games using Mono.
I also improved the patcher a little bit so it accepts command line
arguments and it's easier to add the types that needed to be patched
directly via command line arguments.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some games (well, currently just one, Dungeons 3) come with a .app
directory that contains additional game data which includes package
.unity3d files.
Such directories will be searched relative from the current working
directory, so let's actually set the working directory to
$out/share/something and copy the .app directory to that if it exists.
Tested with Dungeons 3 and also with a few other Unity3d games to see
whether they still work.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has been changed in NixOS/nixpkgs@6bf1421f13d667c2997b67728cf777c6,
so let's change it here as well.
Quote from the mentioned commit:
Implement libGL as a symlink package which uses libraries from
libglvnd and headers from Mesa (since ones from libglvnd are
outdated).
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is quite redundant because autoPatchelfHook already scans all
shared objects and executables for dependencies and bails out with an
error if a dependency isn't found, which is similar to what we're doing
in installCheckPhase.
Removing this should also speed up builds, especially those with lots of
files.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we only checked for the source root by checking only one level of
directories, so for example if the source code is unpacked into
something like "a/b/c" and only "c" contains files, the previous
implementation would set the source root to be "a".
In addition we didn't do a check on the type of the contents, so for
example if the archive contains only *one* file, that *file* itself
would be set as the source root and the chdir to that will fail later.
What we do now is recursively search through directories in order to
find the last directory that does not contain *only* a subdirectory.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
A few attributes weren't re-added to the actual derivation, so for
example whenever we add buildInputs to buildUnity the attribute would be
completely ignored.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
Having a function in autoPatchelfHook that's unused inside the setup
hook is a bit of weird, because the actual usage is within buildGame and
thus it should stay there for now.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
| |
This is really not game-specific, so let's put it at the top-level and
also make sure we substitute all the commands we're using there, even
though a few of them are in PATH of stdenv so that it will always work
even when the programs available in stdenv should change someday.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we only matched the file name of the dependency but not its
architecture, so if for example there is one shared object for
i686-linux and another one with the same name but for x86_64-linux,
chances are that the wrong architecture is chosen.
Now we're checking the architecture of the shared object file and only
pick it, if it matches the architecture of the file to patchelf.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
| |
This makes sure that ldd doesn't print warnings like if the file isn't
executable and also makes the status messages a bit more clear.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The semantics of adding env hooks has changed in
NixOS/nixpkgs@7f3ca3e21a22fd3101b40cadb86899542dec2e35 so that it's now
broken up into several hook variables (envBuildBuildHook,
envBuildHostHook, envBuildTargetHook, envHostHostHook, envHostTargetHook
and envTargetTargetHook).
Fortunately commit NixOS/nixpkgs@a036473a0a0c6100fce316e1444fc33ec6674b
adds a helper function (addEnvHooks) to deal this without referencing
those hook variables directly and rather just providing an offset.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
| |
This is not only useful for packaging games, so let's make it available
from the vuizvui scope, so we can use it from other packages as well.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
If the saveDir isn't set the game only gets access to all the saveDirs
from other Unity games, so missing that attribute shouldn't be a deal
breaker.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
This is used for sandboxing and instead of letting all Unity games
access the data of every other Unity game we now restrict it to its own
save directory only.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now distinguish between paths that have to exist and paths that are
fine to skip during bind mounting.
So far we had hard failures whenever a path that needed to be mounted
didn't exist, for example something like $XDG_CONFIG_HOME/unity3d failed
whenever the directory didn't exist.
Apart from that we now have a more clean attribute structure for sandbox
parameters, which are now:
* paths.required: Created prior to bind-mounting
* paths.wanted: Skipped if it doesn't exist
* paths.runtimeVars: Extracted from PATH-like environment variables
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
We already mount /etc, but it isn't quite enough, because it contains
files symlinked to /etc/static, which in turn is a store path so we need
to mount the closure of that path as well.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
| |
First of all this is to bring down the amount of syscalls we're doing
but it's also useful to avoid errors when we try to mount a path over an
already mounted path.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
| |
This is using buildSandbox with the addition of adding LD_LIBRARY_PATH
to the default runtimePathVars. I've also renamed the attribute to be
called runtimePathVars instead of runtimePathVariables, simply because
it's shorter.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On NixOS the LD_LIBRARY_PATH looks similar to this (depending on the
configuration):
/run/opengl-driver/lib:/run/opengl-driver-32/lib
However, we don't have these paths available within the sandbox, because
so far we've only used exportReferencesGraph to gather the runtime
dependencies after the build has succeeded.
This obviously doesn't take into account runtime dependencies from the
system itself.
We are now taking care of this by using the Nix store library to query
the requisities of all the paths that are contained inside path-like
variables (multiple paths delimited by colons) and mount them during
sandbox setup.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
| |
This leaves sandbox.c with only the main() function and nothing else, so
that whenever we have a lot of binaries to generate, the compilation
time should be much lower now.
The change doesn't change anything in functionality.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
| |
We're now using a makefile for building the sandbox and use pkg-config
to pass in the flags we need for compiling against lib(nix)store.
Right now the sandbox itself doesn't do anything different because we're
not actually using the (incomplete) code for querying the store.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
| |
These paths are things such as /etc and /run but also the .Xauthority
file, which contains the cookie to connect to the X server.
What is still missing is access to the DRI libraries, which is a bit
trickier, because we need to add those store paths at runtime and we
need to also mount all of the dependencies.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've already pointed out in the previous commit that using /tmp for the
root directory isn't a very good idea, mainly because we can't access
sockets from /tmp (eg. the X server sockets).
So what we're now doing is using the store path that contains the
sandbox wrappers, because that very path won't be mounted into the
sandbox anyway, so we get a free directory just as an entry point.
This has the main advantage that we don't need to create any temporary
directories which we later need to clean up nor do we need to assume
that some paths might exist in the system. For example if we'd use /usr
we still have /usr/bin/env on NixOS, but if that's going to go away in
the future or we are on a distro that doesn't have it at all, the
sandbox setup will fail.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far creating the sandbox has been a setup hook, however it's a bit
ugly how we gathered the needed paths for the chroot file system by
recursively searching for store paths.
While I'd like to have the sandbox being built within the main
derivation, it really isn't very practical when the build takes longer
than 10 minutes.
With this implementation however the sandbox builds really fast and we
can also modify the sandbox without needing to rebuild a particular
game.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is basically to make sure various games can't write to whatever
they want in the file system, so it's not a complete sandboxing
solution.
Currently there's a drawback in that we can't easily determine the
runtime dependencies while building a particular game, so we need to
recursively dig through all referenced store paths to look them up.
A better solution for this would be to gather the build time reference
graph prior to building so that we can limit searching for these
references within only the actual build outputs instead of churning
through all inputs.
In addition to that, we currently mount the namespaced root file system
on top of /tmp, which makes the real /tmp unavailable to us. While in
theory this shouldn't be a problem, it actually turns out it is indeed a
problem if the application wants to connect to the X server socket,
which is at something like /tmp/.X11-unix/X0 for display :0.
Apart from these drawbacks we have a working solution for simple
applications (not games, because they usually require X), which now get
its own chroot with only the paths accessible that are strictly
necessary.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
| |
Most older games don't cope very well with PulseAudio, so let's add ALSA
so that a fallback is available. This is also very useful if
withPulseAudio is set to false, because this would actually mean "no
audio at all".
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
| |
A lot of games come as a Zip archive, so let's add it to
nativeBuildInputs by default so we no longer need to deal with that for
every single game.
This also removes that line from Invisigun Heroes, so the package now is
pretty much minimal and very clean :-)
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
| |
A lot of games (especially Unity games) come as a tarbomb, so in order
to avoid having those files all over the place we now create an
additional directory before unpack and set the sourceRoot to that if
it's a tarbomb and if that's not the case set it to the single file
within that directory.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Now we no longer need to invoke patchelf by ourselves and all of the
dependencies are patched automatically.
I've added gtk2-x11, gdk_pixbuf and glib to buildUnity as well, because
after inspecting other Unity games they seem to require the same
libraries as well.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
| |
This allows us to add libraries to the RPATH despite being required by
the respective game. By default there is only PulseAudio at the moment.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main functionality for this function is to gather missing
dependencies in ELF executables and shared libraries and using patchelf
to set the right RPATH.
All of the dependencies are searched based on what we have in one of the
buildInputs variables, so all we need to do is list them in there.
One thing that's still left to solve is adding libraries to the RPATH
which are only required at runtime. An example for this would be the
pulseaudio library.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This automatically creates a desktop entry based on the given fullName
and the standard path for the icon (Resources/UnityPlayer.png).
Well, at least I hope that the icon path is standard, but we'll see once
we use buildUnity for more games.
Tested using Plasma 5 for Invisigun Heroes.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
|
|
|
|
|
|
|
| |
The executable of Unity games at the moment is unable to find its own
path if it can't do a stat() on argv[0]. So wrapping the program helps
here for now.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|