-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 501298f
Showing
15 changed files
with
675 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Celeste.Mod.Trailine</RootNamespace> | ||
<AssemblyName>Trailine</AssemblyName> | ||
<TargetFramework>net452</TargetFramework> | ||
<LangVersion>9</LangVersion> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> | ||
<AssemblyVersion>0.1.0.0</AssemblyVersion> | ||
<Company>WEGFan</Company> | ||
<PathMap>$(MSBuildProjectDirectory)=/WEGFan/Trailine/</PathMap> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> | ||
<OutputPath>../DLL/</OutputPath> | ||
<DebugType>full</DebugType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<Prefer32bit>true</Prefer32bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)' == 'Release'"> | ||
<OutputPath>../DLL/</OutputPath> | ||
<DebugSymbols>true</DebugSymbols> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<Prefer32bit>true</Prefer32bit> | ||
<DebugType>full</DebugType> | ||
</PropertyGroup> | ||
|
||
<!-- Game libs --> | ||
<PropertyGroup> | ||
<GameLibPath Condition="'$(GameLibPath)' == '' and Exists('lib-game/Celeste.exe')">lib-game</GameLibPath> | ||
<GameLibPath Condition="'$(GameLibPath)' == '' and Exists('lib-game/stripped/Celeste.exe')">lib-game/stripped</GameLibPath> | ||
</PropertyGroup> | ||
<ItemGroup Condition="'$(GameLibPath)' != ''"> | ||
<Reference Include="$(GameLibPath)/Celeste.exe"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="$(GameLibPath)/MMHOOK_Celeste.dll"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="$(GameLibPath)/FNA.dll"> | ||
<Private>false</Private> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<!-- Everest libs --> | ||
<ItemGroup> | ||
<PackageReference Include="Mono.Cecil" Version="0.11.4" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="MonoMod" Version="21.08.19.01" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.08.19.01" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="MonoMod.RuntimeDetour.HookGen" Version="21.08.19.01" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="MonoMod.Utils" Version="21.08.19.01" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="DotNetZip" Version="1.15.0" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="System.ValueTuple" Version="4.5.0" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="YamlDotNet" Version="8.1.2" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="Jdenticon-net" Version="2.2.1" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" PrivateAssets="all" ExcludeAssets="runtime" /> | ||
</ItemGroup> | ||
|
||
<!-- Custom libs --> | ||
<ItemGroup> | ||
</ItemGroup> | ||
|
||
<!-- Mono libs --> | ||
<ItemGroup> | ||
<Content Include="lib-mono/**/*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
<Link>%(Filename)%(Extension)</Link> | ||
</Content> | ||
<Content Remove="lib-mono/.gitkeep" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace Celeste.Mod.Trailine { | ||
public class TrailineModule : EverestModule { | ||
|
||
public TrailineModule() { | ||
Instance = this; | ||
} | ||
|
||
public static TrailineModule Instance { get; private set; } | ||
|
||
public override Type SettingsType => typeof(TrailineSettings); | ||
|
||
public static TrailineSettings Settings => Instance._Settings as TrailineSettings; | ||
|
||
public static bool Loaded = false; | ||
|
||
public override void Load() { | ||
if (Loaded || !Settings.Enabled) { | ||
return; | ||
} | ||
|
||
Loaded = true; | ||
} | ||
|
||
public override void Unload() { | ||
if (!Loaded) { | ||
return; | ||
} | ||
|
||
Loaded = false; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Celeste.Mod.Trailine { | ||
|
||
public class TrailineSettings : EverestModuleSettings { | ||
|
||
public bool Enabled { get; set; } = true; | ||
|
||
public void CreateEnabledEntry(TextMenu textMenu, bool inGame) { | ||
TextMenu.Item item = new TextMenu.OnOff("Enabled", Enabled) | ||
.Change(value => { | ||
Enabled = value; | ||
if (value) { | ||
TrailineModule.Instance.Load(); | ||
} else { | ||
TrailineModule.Instance.Unload(); | ||
} | ||
}); | ||
textMenu.Add(item); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This folder contains necessary files from game (`Celeste 1.4.0.0 [Everest: 3070-azure-d793d]`) to compile this project. | ||
|
||
The files in `stripped` folder are stripped game libs that only have method declarations, for being able to compile without having the game installed and preventing uploading actual files to the repo. These are made with [mono-cil-strip](https://github.com/mono/mono/tree/master/mcs/tools/cil-strip). | ||
|
||
However you can still put the actual game libs in this folder for easier development, for example you can reference libs from this folder, so you can play with Celeste XNA while compiling with FNA. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Trailine_mod_name=Trailine | ||
modname_Trailine={+Trailine_mod_name} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 WEGFan | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Trailine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trailine", "Code\Trailine.csproj", "{09999BCE-A648-45AA-88D9-952822A45800}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{09999BCE-A648-45AA-88D9-952822A45800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{09999BCE-A648-45AA-88D9-952822A45800}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{09999BCE-A648-45AA-88D9-952822A45800}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{09999BCE-A648-45AA-88D9-952822A45800}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- Name: Trailine | ||
Version: 0.1.0 | ||
Author: WEGFan | ||
DLL: DLL/Trailine.dll | ||
Dependencies: | ||
- Name: Everest | ||
Version: 1.3070.0 | ||
- Name: Celeste | ||
Version: 1.4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import subprocess | ||
import sys | ||
import zipfile | ||
from itertools import chain | ||
from pathlib import Path | ||
import os | ||
import yaml | ||
|
||
# load mod name and version from everest.yaml | ||
with open('everest.yaml', 'r', encoding='utf-8') as f: | ||
mod_metadata = yaml.safe_load(f.read()) | ||
|
||
mod_name = mod_metadata[0]['Name'] | ||
mod_version = mod_metadata[0]['Version'] | ||
|
||
print(mod_name, mod_version) | ||
|
||
# update AssemblyVersion in project file to match the mod version | ||
with open('Code/Trailine.csproj', 'r+', encoding='utf-8') as f: | ||
s = f.read() | ||
f.seek(0) | ||
f.truncate() | ||
|
||
s = re.sub(r'^(\s+<AssemblyVersion>)(.*?)(</AssemblyVersion>)$', | ||
f'\\g<1>{mod_version.split("-")[0]}.0\\g<3>', | ||
s, flags=re.MULTILINE) | ||
|
||
f.write(s) | ||
|
||
# clean the output files | ||
subprocess.run(['dotnet', 'clean']) | ||
|
||
# build the project | ||
process = subprocess.run(['dotnet', 'build', '--configuration', 'Release']) | ||
if process.returncode != 0: | ||
print('build failed') | ||
sys.exit() | ||
|
||
# package | ||
file_list = ['DLL/**/*', 'Dialog/**/*', 'everest.yaml'] | ||
|
||
os.makedirs('dist', exist_ok=True) | ||
with zipfile.ZipFile(f'dist/{mod_name}_v{mod_version}.zip', 'w', zipfile.ZIP_DEFLATED) as f: | ||
for file in chain(*[Path('.').glob(i) for i in file_list]): | ||
# correct the case in file name | ||
file = file.resolve().relative_to(Path.cwd()) | ||
print(file) | ||
f.write(file) |