浏览代码

Merge branch 'master' into 'master'

Make it compile on linux, explain how in README, and log warnings and errors to the stdout console

See merge request Bepsi/NTERA!1
Bepsi 6 年之前
父节点
当前提交
465c318f2d
共有 5 个文件被更改,包括 57 次插入3 次删除
  1. 5 0
      NTERA.Engine/Runtime/JITCompiler.cs
  2. 3 0
      NTERA/Console/EraConsoleInstance.cs
  3. 1 1
      NTERA/NTERA.csproj
  4. 6 1
      NTERA/formMain.cs
  5. 42 1
      README.md

+ 5 - 0
NTERA.Engine/Runtime/JITCompiler.cs

@@ -50,6 +50,11 @@ namespace NTERA.Engine.Runtime
 			CSVDefinition = new CSVDefinition();
 			ImageDefinitions = new Dictionary<string, ImageDefinition>();
 
+			if (!Directory.Exists(InputDirectory) || !Directory.Exists(CSVPath) || !Directory.Exists(ERBPath)) {
+				console.PrintError($"{InputDirectory} does not appear to be an era game.  Expecting to find {InputDirectory}/CSV and /ERB and /resources.\nPlease set current working directory or the ERA environment variable to the era folder.");
+				return;
+			}
+
 			console.PrintSystemLine("Preprocessing CSV files...");
 
 

+ 3 - 0
NTERA/Console/EraConsoleInstance.cs

@@ -62,11 +62,13 @@ namespace NTERA.Console
 
 		public void PrintError(string message)
 		{
+			System.Console.Write("ERROR: " + message + "\n");
 			AddText(message, Color.Red);
 		}
 
 		public void PrintSystemLine(string message)
 		{
+			System.Console.Write("INFO: " + message + "\n");
 			AddText(message, Color.Gray);
 		}
 
@@ -85,6 +87,7 @@ namespace NTERA.Console
 		public bool RunERBFromMemory { get; set; }
 		public void PrintWarning(string message, int level)
 		{
+			System.Console.Write("WARNING: " + message + "\n");
 			AddText(message, Color.Yellow);
 		}
 

+ 1 - 1
NTERA/NTERA.csproj

@@ -66,7 +66,7 @@
     <Compile Include="formMain.Designer.cs">
       <DependentUpon>formMain.cs</DependentUpon>
     </Compile>
-    <Compile Include="Console\HtmlParser.cs" />
+    <Compile Include="Console\HTMLParser.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Console\ConsoleControl.resx">

+ 6 - 1
NTERA/formMain.cs

@@ -1,5 +1,6 @@
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using System;
 using NTERA.Console;
 using NTERA.Core;
 using NTERA.EmuEra;
@@ -18,7 +19,11 @@ namespace NTERA
 
             //var scriptEngine = new EmuEraGameInstance();
             //var scriptEngine = new Engine();
-			var scriptEngine = new EraRuntime(new JITCompiler(@"M:\era\eraSemifullTest"));
+			var eraFolder = Environment.GetEnvironmentVariable("ERA");
+			if (eraFolder == null) {
+				eraFolder = Environment.CurrentDirectory;
+			}
+			var scriptEngine = new EraRuntime(new JITCompiler(eraFolder));
 
             //Task.Factory.StartNew(() => instance.Run(new EraConsoleInstance(consoleControl1.Renderer, scriptEngine), scriptEngine));
             Task.Factory.StartNew(() => instance.Run(new EraConsoleInstance(consoleControl1.Renderer, scriptEngine), scriptEngine));

+ 42 - 1
README.md

@@ -1,3 +1,44 @@
 # NTERA
 
-New Technology ERA
+New Technology ERA.
+
+This is a reimplementation of the engine that runs ERA games.
+
+# Linux
+
+## Compiling
+
+To compile on linux, you need dotnet 7.  Follow the instructions https://www.mono-project.com/download/stable/#download-lin
+
+For example, in Ubuntu do:
+
+    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+    echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
+    sudo apt update
+
+Then install:
+
+    sudo apt install mono-devel nuget
+
+(Note that you need 'nuget' as well.)
+
+Now download the dependencies for NTERA:
+
+    nuget restore
+
+Build with:
+
+    msbuild
+
+# Running:
+
+You can run with:
+
+    ERA=/path/to/eragame mono NTERA/bin/Debug/NTERA.exe
+
+## Development
+
+For development, I recommend installing the optional monodevelop:
+
+    sudo apt install monodevelop
+    monodevelop NTERA.sln