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

[Documentation] Compile instructions #316

Open
TheYoctoJester opened this issue Jun 24, 2022 · 8 comments
Open

[Documentation] Compile instructions #316

TheYoctoJester opened this issue Jun 24, 2022 · 8 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@TheYoctoJester
Copy link

Is your feature request related to a problem? Please describe.
This kinda relates to the window size problem. I agree with the idea of a dynamic size, hence I want to look into code. But I can't find a good pointer how to get started.

Describe the solution you'd like
A documented way of compiling a fresh clone of the repo.

Describe alternatives you've considered
N/A

Additional context
N/A

@TheYoctoJester TheYoctoJester added the enhancement New feature or request label Jun 24, 2022
@Pyrdacor
Copy link
Owner

In theory you can just open the solution, select the project Ambermoon.net as the start project, compile and run. But this way you lack the builtin game data. You can download the game data from here though: https://GitHub.com/Pyrdacor/Ambermoon. Then either put it into the Ambermoon.net sub-folder or to some other path. Then adjust the ambermoon.cfg and set "UseDataPath" to true and "DataPath" to the Amberfiles folder of the downloaded and extracted game data. If there is no ambermoon.cfg in the project folder (sub-folder Ambermoon.net) then copy the one from your game installation there.

If you want to use the version selector like in the final game (or the steps above are too complicated) you can use a publish script. Have a look here: https://github.com/Pyrdacor/Ambermoon.net/blob/master/build-win64.cmd

This script is part of the repo. It is for windows. There is also an arm64 script but this is a bit outdated. Best use the windows script and adjust it for Mac or Linux if needed.

This will create a single Ambermoon.net executable.

@Pyrdacor
Copy link
Owner

@TheYoctoJester I added compile instructions in Compile.md in the root dir of the solution. I can only speak for Windows and Visual Studio here.

@TheYoctoJester
Copy link
Author

@Pyrdacor saw the instructions! Tried to do so, but:

Could not find file '/Users/josef/Projects/dotnet/Ambermoon.net/Ambermoon.net/bin/Debug/net6.0/versions.dat'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.File.OpenRead(String path)
   at Ambermoon.GameWindow.Window_Load() in /Users/josef/Projects/dotnet/Ambermoon.net/Ambermoon.net/GameWindow.cs:line 1190
   at Silk.NET.Windowing.Internals.ViewImplementationBase.Initialize()
   at Silk.NET.Windowing.WindowExtensions.Run(IView view)
   at Ambermoon.GameWindow.Run(Configuration configuration) in /Users/josef/Projects/dotnet/Ambermoon.net/Ambermoon.net/GameWindow.cs:line 1517
   at Ambermoon.Program.Main() in /Users/josef/Projects/dotnet/Ambermoon.net/Ambermoon.net/Program.cs:line 66

@TheYoctoJester
Copy link
Author

TheYoctoJester commented Jun 27, 2022

Patching the line to

var builtinVersionReader = OperatingSystem.IsMacOS() && File.Exists("versions.dat") ? new BinaryReader(File.OpenRead("versions.dat")) :
                (additionalData.TryGetValue("versions", out var reader) ? reader : null);

got me a little further, to Unable to find file 'AM2_CPU'.. I've dropped the ADF files right into Ambermoon.Net/Ambermoon.Net.

@Pyrdacor
Copy link
Owner

Pyrdacor commented Jun 28, 2022

Have a look at Configuration.cs. There the executable path is built. For Windows I consider things like Debug and Release folder and use the folder with the csproj file instead as the "working dir". If you are on Mac this isn't done. But you can just change the if condition so that it will work on Mac too.

@Pyrdacor
Copy link
Owner

@Pyrdacor
Copy link
Owner

Pyrdacor commented Jun 28, 2022

While you're at it either remove the IsWindows condition all together or if you restrict it to Windows and Mac, please use OperatingSystem.IsMacOS() and OperatingSystem.IsWindows().

@Pyrdacor
Copy link
Owner

If the error still happens please step through the mentioned code with the debugger and check what path is built.

@Pyrdacor Pyrdacor changed the title [Feature request]Instructions on how to compile [Documentation] Compile instructions Dec 9, 2022
@Pyrdacor Pyrdacor added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants