Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions Client.Main/MuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ private Point GetActualScreenSize()

protected override void Initialize()
{
var fullPath = Path.GetFullPath(Constants.SETTINGS_PATH);
ConfigDirectory = Path.GetDirectoryName(fullPath)!;
// Uses the executable directory as the basis for appsettings.json,
// ensuring the file can be found regardless of the CWD.
ConfigDirectory = AppContext.BaseDirectory;
AppConfiguration = new ConfigurationBuilder()
.SetBasePath(ConfigDirectory)
.AddJsonFile(Constants.SETTINGS_PATH, optional: false, reloadOnChange: true)
Expand Down
28 changes: 27 additions & 1 deletion MuMac/MuMac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

<PropertyGroup>
<DefineConstants>$(DefineConstants);MACOS</DefineConstants>
<!-- Detects if Wine is available to compile HLSL shaders -->
<!-- If not, uses the pre-compiled .xnb files from the bin/ folder -->
<MGContentPrebuiltDir>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)/../Client.Main/MGContent/bin/DesktopGL/Content'))</MGContentPrebuiltDir>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -41,12 +44,35 @@
<TrimmerRootAssembly Include="mscorlib" />
</ItemGroup>

<ItemGroup>
<!-- In Windows/CI: compiles content via MGCB normally -->
<!-- In macOS without Wine: uses pre-compiled .xnb files from the bin/ folder -->
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<MonoGameContentReference Include="..\Client.Main\MGContent\Content.mgcb">
<Link>Content\Content.mgcb</Link>
</MonoGameContentReference>
</ItemGroup>

<!-- Copies pre-compiled .xnb files when not in Windows (macOS/Linux without Wine) -->
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<PrebuiltContent Include="$(MGContentPrebuiltDir)\**\*.xnb" />
</ItemGroup>

<Target Name="CopyPrebuiltContent"
Condition="'$(OS)' != 'Windows_NT'"
BeforeTargets="Build">
<Error
Condition="!Exists('$(MGContentPrebuiltDir)')"
Text="Pasta de conteúdo pré-compilado não encontrada: $(MGContentPrebuiltDir). Execute o build no Windows (ou via CI) para gerar os .xnb dos shaders .fx." />
<Message Text="[MuMac] macOS detectado: copiando conteúdo pré-compilado de '$(MGContentPrebuiltDir)'" Importance="High" />
<ItemGroup>
<_PrebuiltXnb Include="$(MGContentPrebuiltDir)/**/*.xnb" />
</ItemGroup>
<Copy
SourceFiles="@(_PrebuiltXnb)"
DestinationFolder="$(OutputPath)/Content"
SkipUnchangedFiles="true" />
</Target>

<Target Name="RestoreDotnetTools" BeforeTargets="CollectPackageReferences">
<Message Text="Restoring dotnet tools" Importance="High" />
<Exec Command="dotnet tool restore" />
Expand Down