Skip to content

Commit

Permalink
Merge branch 'feature_first_person'
Browse files Browse the repository at this point in the history
  • Loading branch information
ItEndsWithTens committed Mar 14, 2024
2 parents 790f7d8 + 27bdf1f commit 5c44d77
Show file tree
Hide file tree
Showing 32 changed files with 4,630 additions and 1,847 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<MacBundleName>$(Product)</MacBundleName>
<MacBundleMono>false</MacBundleMono>

<!--Taken together, these properties allow Source Link to provide embedded
debug information that's tied to public source files hosted on Github,
allowing convenient debugging even without local copies of the code.-->
<!--Taken together with DebugType, in Directory.Build.targets, these
properties allow Source Link to provide embedded debug information
that's tied to public source files hosted on Github, allowing convenient
debugging even without local copies of the code.-->
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>

Expand Down
7 changes: 7 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<!--Mono doesn't seem to like embedded symbols, so just use the old style
and avoid the heartache of hours wasted wondering why it doesn't work.-->
<DebugType>embedded</DebugType>
<DebugType Condition="('$(Configuration)' == 'Debug') And ('$(BuildOS)' == 'Linux')">full</DebugType>
</PropertyGroup>

<Target Name="GitCheck" AfterTargets="ResolveProjectReferences">
<Exec
Command="git --version"
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

This is currently implemented as a [BizHawk](https://github.com/TASVideos/BizHawk) external tool; also included are the beginnings of a standalone GUI app based on [Eto.Forms](https://github.com/picoe/Eto) and [Eto.Veldrid](https://github.com/picoe/Eto.Veldrid), but that's a long way off, if it ever happens. For now the external tool is a useful, if scatterbrained, testbed for various ideas.

Downloads are available through the badges above, or on the releases page. Just unzip into your BizHawk/ExternalTools directory and enjoy! If instead you'd like to build it yourself, read on.



## Requirements
Expand All @@ -18,6 +16,12 @@



## Installation

Downloads are available through the badges above, or on [the releases page](https://github.com/ItEndsWithTens/SilentHillMapExaminer/releases). Just unzip into your BizHawk/ExternalTools directory and enjoy!



## Usage

TODO: Proper docs for the other tabs.
Expand Down Expand Up @@ -47,7 +51,7 @@

Be careful using C# features introduced beyond version 7.3!

This project uses C# language version 10.0 despite running under .NET Framework 4.8, a combination which is not officially supported. Newer versions of the language introduce some features that require new types and/or an updated runtime, but there are nonetheless many purely syntactical improvements that prove exceptionally useful, and are too good to ignore.
This project uses C# language version 12.0 despite running under .NET Framework 4.8, a combination which is not officially supported. Newer versions of the language introduce some features that require new types and/or an updated runtime, but there are nonetheless many purely syntactical improvements that prove exceptionally useful (e.g. [tuple type aliases](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-tuples#tuple-field-names)), and are too good to ignore.

For more information see [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version), [StackOverflow](https://stackoverflow.com/questions/56651472/does-c-sharp-8-support-the-net-framework), and [this blog post by Stuart Lang](https://stu.dev/csharp8-doing-unsupported-things/).

Expand Down
7 changes: 7 additions & 0 deletions SilentHillMapExaminer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E071A977-E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomBuildTasks", "src\CustomBuildTasks\CustomBuildTasks.csproj", "{9AAC0A8C-DB0B-452A-ABDF-B3489257B640}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SHME.ExternalTool.Extras", "src\SHME.ExternalTool.Extras\SHME.ExternalTool.Extras.csproj", "{B47A5E6D-A904-4386-8215-F46D98B09D80}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -70,6 +72,10 @@ Global
{9AAC0A8C-DB0B-452A-ABDF-B3489257B640}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AAC0A8C-DB0B-452A-ABDF-B3489257B640}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AAC0A8C-DB0B-452A-ABDF-B3489257B640}.Release|Any CPU.Build.0 = Release|Any CPU
{B47A5E6D-A904-4386-8215-F46D98B09D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B47A5E6D-A904-4386-8215-F46D98B09D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B47A5E6D-A904-4386-8215-F46D98B09D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B47A5E6D-A904-4386-8215-F46D98B09D80}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -83,6 +89,7 @@ Global
{3022183A-4EF8-49D0-A2BB-99A52B0F8D99} = {5BAA19A5-C284-4540-9024-D609CE689CAA}
{44884830-99FF-4FCF-95CA-CC74A8986EFC} = {E071A977-EBEF-4742-A119-C149D25FF858}
{9AAC0A8C-DB0B-452A-ABDF-B3489257B640} = {5BAA19A5-C284-4540-9024-D609CE689CAA}
{B47A5E6D-A904-4386-8215-F46D98B09D80} = {EF45E51E-80A8-43B2-A2C5-8860BC5D4A59}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7FBAF1CA-0999-4AA0-A932-125771E0D8D0}
Expand Down
45 changes: 45 additions & 0 deletions src/SHME.ExternalTool.Extras/InputBind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Windows.Forms;

namespace SHME.ExternalTool.Extras
{
[Flags]
public enum ShmeCommand
{
None,
Forward,
Backward,
Left,
Right,
Up,
Down,
Action,
Aim,
Light,
Run,
View,
Map,
Option
}

public class InputBind(ShmeCommand command, Keys keyBind, MouseButtons mouseBind)
{
[JsonConverter(typeof(StringEnumConverter))]
public ShmeCommand Command { get; set; } = command;

[JsonConverter(typeof(StringEnumConverter))]
public Keys KeyBind { get; set; } = keyBind;

[JsonConverter(typeof(StringEnumConverter))]
public MouseButtons MouseBind { get; set; } = mouseBind;

public InputBind() : this(ShmeCommand.None, Keys.None, MouseButtons.None)
{
}
public InputBind(InputBind b) : this(b.Command, b.KeyBind, b.MouseBind)

Check warning on line 41 in src/SHME.ExternalTool.Extras/InputBind.cs

View workflow job for this annotation

GitHub Actions / build

In externally visible method 'InputBind.InputBind(InputBind b)', validate parameter 'b' is non-null before using it. If appropriate, throw an 'ArgumentNullException' when the argument is 'null'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1062)

Check warning on line 41 in src/SHME.ExternalTool.Extras/InputBind.cs

View workflow job for this annotation

GitHub Actions / build

In externally visible method 'InputBind.InputBind(InputBind b)', validate parameter 'b' is non-null before using it. If appropriate, throw an 'ArgumentNullException' when the argument is 'null'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1062)
{
}
}
}
64 changes: 64 additions & 0 deletions src/SHME.ExternalTool.Extras/LocalSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Nucs.JsonSettings;
using Nucs.JsonSettings.Modulation;
using System;
using System.Collections.ObjectModel;
using System.Windows.Forms;

namespace SHME.ExternalTool.Extras
{
public static class DefaultLocalSettings
{
// This is tough to easily place in either local or roaming settings,
// but local might make slightly more sense? Beyond personal preference,
// whether one prefers to invert could depend on mouse vs. touchpad vs.
// trackball, among other considerations.
public static readonly bool CameraFlyInvert;

// Different input hardware means different sensitivity.
public static readonly decimal CameraFlySensitivity = 0.25m;

public static readonly int SaveButton;

public static readonly Collection<InputBind> FlyBinds = new([
new(ShmeCommand.Forward, Keys.W, MouseButtons.None),
new(ShmeCommand.Backward, Keys.S, MouseButtons.None),
new(ShmeCommand.Left, Keys.A, MouseButtons.None),
new(ShmeCommand.Right, Keys.D, MouseButtons.None),
new(ShmeCommand.Up, Keys.E, MouseButtons.None),
new(ShmeCommand.Down, Keys.Q, MouseButtons.None)]);

public static readonly Collection<InputBind> FpsBinds = new([
new(ShmeCommand.Forward, Keys.W, MouseButtons.None),
new(ShmeCommand.Backward, Keys.S, MouseButtons.None),
new(ShmeCommand.Left, Keys.A, MouseButtons.None),
new(ShmeCommand.Right, Keys.D, MouseButtons.None),
new(ShmeCommand.Action, Keys.E, MouseButtons.Left),
new(ShmeCommand.Aim, Keys.Q, MouseButtons.Right),
new(ShmeCommand.Light, Keys.F, MouseButtons.None),
new(ShmeCommand.Run, Keys.ShiftKey, MouseButtons.None),
new(ShmeCommand.View, Keys.Z, MouseButtons.None),
new(ShmeCommand.Map, Keys.C, MouseButtons.None)]);
}

// Hiding this class, and RoamingSettings, in a satellite assembly turns out
// to be necessary to prevent BizHawk from failing to load this external
// tool. Being classes derived from bases defined in an external assembly,
// they cause problems the first time BizHawk enumerates its external tools
// directory. Breaking them out to this extra assembly solves that.
public class LocalSettings : JsonSettings, IVersionable
{
public Version Version { get; set; } = new Version(1, 0, 0, 0);

public override string FileName { get; set; } = "local.json";

// Basics tab
public virtual bool CameraFlyInvert { get; set; } = DefaultLocalSettings.CameraFlyInvert;
public virtual decimal CameraFlySensitivity { get; set; } = DefaultLocalSettings.CameraFlySensitivity;

public virtual Collection<InputBind> FlyBinds { get; } = [];
public virtual Collection<InputBind> FpsBinds { get; } = [];

// Save tab
public virtual int SaveButton { get; set; } = DefaultLocalSettings.SaveButton;
}
}
171 changes: 171 additions & 0 deletions src/SHME.ExternalTool.Extras/RoamingSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
using Nucs.JsonSettings;
using Nucs.JsonSettings.Modulation;
using System;

namespace SHME.ExternalTool.Extras
{
public static class DefaultRoamingSettings
{
// Basics tab
public static readonly bool EnableHarrySection = true;
public static readonly bool EnableOverlay;

public static readonly decimal CameraFlySpeed = 0.125m;
public static readonly bool HideHarry = true;
public static readonly bool ShowFeet = true;
public static readonly decimal EyeHeight = -1.6m;
public static readonly bool AlwaysRun = true;

public static readonly bool EnableOverlayCameraReporting;
public static readonly bool ReadLevelDataOnStageLoad;
public static readonly bool RenderToFramebuffer;
public static readonly bool BackfaceCulling;
public static readonly bool FarClipping = true;
public static readonly decimal CrosshairLength = 2.5m;
public static readonly decimal FilledOpacity = 30.0m;
public static readonly int RenderMode;

// POIs tab
public static readonly bool SelectedTriggerEnableUpdates = true;
public static readonly int PoiRenderShape;
public static readonly bool AxisColorsGame = true;
public static readonly bool AxisColorsOverlay;
public static readonly bool AxisColorsOff;

// Stats tab
public static readonly bool EnableStatsReporting = true;

// Fog tab
public static readonly decimal CustomFogR = 108m;
public static readonly decimal CustomFogG = 100m;
public static readonly decimal CustomFogB = 116m;
public static readonly decimal CustomWorldTintR = 121m;
public static readonly decimal CustomWorldTintG = 128m;
public static readonly decimal CustomWorldTintB = 138m;

// Test tab
public static readonly bool EnableTestModelSection;
public static readonly int TestModelScale = 1000;
public static readonly decimal TestModelX;
public static readonly decimal TestModelY;
public static readonly decimal TestModelZ;

public static readonly bool EnableTestBox;
public static readonly decimal TestBoxX;
public static readonly decimal TestBoxY;
public static readonly decimal TestBoxZ;
public static readonly decimal TestBoxSizeX = 1m;
public static readonly decimal TestBoxSizeY = 1m;
public static readonly decimal TestBoxSizeZ = 1m;

public static readonly bool EnableTestLine;
public static readonly decimal TestLineAX;
public static readonly decimal TestLineAY = -1m;
public static readonly decimal TestLineAZ;
public static readonly decimal TestLineBX = 1m;
public static readonly decimal TestLineBY = -1m;
public static readonly decimal TestLineBZ;

public static readonly bool EnableTestSheet;
public static readonly decimal TestSheetX;
public static readonly decimal TestSheetY;
public static readonly decimal TestSheetZ;
public static readonly decimal TestSheetSizeX = 1m;
public static readonly decimal TestSheetSizeZ = 1m;

// Framebuffer tab
public static readonly decimal FramebufferOfsX = 0m;
public static readonly decimal FramebufferOfsY = 32m;
public static readonly decimal FramebufferW = 320m;
public static readonly decimal FramebufferH = 448m;
public static readonly int FramebufferZoom = 3;

// Misc tab
public static readonly bool EnableControllerReporting;
}

public class RoamingSettings : JsonSettings, IVersionable
{
public Version Version { get; set; } = new Version(1, 0, 0, 0);

public override string FileName { get; set; } = "roaming.json";

// Basics tab
public virtual bool EnableHarrySection { get; set; } = DefaultRoamingSettings.EnableHarrySection;
public virtual bool EnableOverlay { get; set; } = DefaultRoamingSettings.EnableOverlay;

public virtual decimal CameraFlySpeed { get; set; } = DefaultRoamingSettings.CameraFlySpeed;
public virtual bool HideHarry { get; set; } = DefaultRoamingSettings.HideHarry;
public virtual bool ShowFeet { get; set; } = DefaultRoamingSettings.ShowFeet;
public virtual decimal EyeHeight { get; set; } = DefaultRoamingSettings.EyeHeight;
public virtual bool AlwaysRun { get; set; } = DefaultRoamingSettings.AlwaysRun;

public virtual bool EnableOverlayCameraReporting { get; set; } = DefaultRoamingSettings.EnableOverlayCameraReporting;
public virtual bool ReadLevelDataOnStageLoad { get; set; } = DefaultRoamingSettings.ReadLevelDataOnStageLoad;
public virtual bool RenderToFramebuffer { get; set; } = DefaultRoamingSettings.RenderToFramebuffer;
public virtual bool BackfaceCulling { get; set; } = DefaultRoamingSettings.BackfaceCulling;
public virtual bool FarClipping { get; set; } = DefaultRoamingSettings.FarClipping;
public virtual decimal CrosshairLength { get; set; } = DefaultRoamingSettings.CrosshairLength;
public virtual decimal FilledOpacity { get; set; } = DefaultRoamingSettings.FilledOpacity;
public virtual int RenderMode { get; set; } = DefaultRoamingSettings.RenderMode;

// POIs tab
public virtual bool SelectedTriggerEnableUpdates { get; set; } = DefaultRoamingSettings.SelectedTriggerEnableUpdates;
public virtual int PoiRenderShape { get; set; } = DefaultRoamingSettings.PoiRenderShape;
public virtual bool AxisColorsGame { get; set; } = DefaultRoamingSettings.AxisColorsGame;
public virtual bool AxisColorsOverlay { get; set; } = DefaultRoamingSettings.AxisColorsOverlay;
public virtual bool AxisColorsOff { get; set; } = DefaultRoamingSettings.AxisColorsOff;

// Stats tab
public virtual bool EnableStatsReporting { get; set; } = DefaultRoamingSettings.EnableStatsReporting;

// Fog tab
public virtual decimal CustomFogR { get; set; } = DefaultRoamingSettings.CustomFogR;
public virtual decimal CustomFogG { get; set; } = DefaultRoamingSettings.CustomFogG;
public virtual decimal CustomFogB { get; set; } = DefaultRoamingSettings.CustomFogB;
public virtual decimal CustomWorldTintR { get; set; } = DefaultRoamingSettings.CustomWorldTintR;
public virtual decimal CustomWorldTintG { get; set; } = DefaultRoamingSettings.CustomWorldTintG;
public virtual decimal CustomWorldTintB { get; set; } = DefaultRoamingSettings.CustomWorldTintB;

// Test tab
public virtual bool EnableTestModelSection { get; set; } = DefaultRoamingSettings.EnableTestModelSection;
public virtual int TestModelScale { get; set; } = DefaultRoamingSettings.TestModelScale;
public virtual decimal TestModelX { get; set; } = DefaultRoamingSettings.TestModelX;
public virtual decimal TestModelY { get; set; } = DefaultRoamingSettings.TestModelY;
public virtual decimal TestModelZ { get; set; } = DefaultRoamingSettings.TestModelZ;

public virtual bool EnableTestBox { get; set; } = DefaultRoamingSettings.EnableTestBox;
public virtual decimal TestBoxX { get; set; } = DefaultRoamingSettings.TestBoxX;
public virtual decimal TestBoxY { get; set; } = DefaultRoamingSettings.TestBoxY;
public virtual decimal TestBoxZ { get; set; } = DefaultRoamingSettings.TestBoxZ;
public virtual decimal TestBoxSizeX { get; set; } = DefaultRoamingSettings.TestBoxSizeX;
public virtual decimal TestBoxSizeY { get; set; } = DefaultRoamingSettings.TestBoxSizeY;
public virtual decimal TestBoxSizeZ { get; set; } = DefaultRoamingSettings.TestBoxSizeZ;

public virtual bool EnableTestLine { get; set; } = DefaultRoamingSettings.EnableTestLine;
public virtual decimal TestLineAX { get; set; } = DefaultRoamingSettings.TestLineAX;
public virtual decimal TestLineAY { get; set; } = DefaultRoamingSettings.TestLineAY;
public virtual decimal TestLineAZ { get; set; } = DefaultRoamingSettings.TestLineAZ;
public virtual decimal TestLineBX { get; set; } = DefaultRoamingSettings.TestLineBX;
public virtual decimal TestLineBY { get; set; } = DefaultRoamingSettings.TestLineBY;
public virtual decimal TestLineBZ { get; set; } = DefaultRoamingSettings.TestLineBZ;


public virtual bool EnableTestSheet { get; set; } = DefaultRoamingSettings.EnableTestSheet;
public virtual decimal TestSheetX { get; set; } = DefaultRoamingSettings.TestSheetX;
public virtual decimal TestSheetY { get; set; } = DefaultRoamingSettings.TestSheetY;
public virtual decimal TestSheetZ { get; set; } = DefaultRoamingSettings.TestSheetZ;
public virtual decimal TestSheetSizeX { get; set; } = DefaultRoamingSettings.TestSheetSizeX;
public virtual decimal TestSheetSizeZ { get; set; } = DefaultRoamingSettings.TestSheetSizeZ;

// Framebuffer tab
public virtual decimal FramebufferOfsX { get; set; } = DefaultRoamingSettings.FramebufferOfsX;
public virtual decimal FramebufferOfsY { get; set; } = DefaultRoamingSettings.FramebufferOfsY;
public virtual decimal FramebufferW { get; set; } = DefaultRoamingSettings.FramebufferW;
public virtual decimal FramebufferH { get; set; } = DefaultRoamingSettings.FramebufferH;
public virtual int FramebufferZoom { get; set; } = DefaultRoamingSettings.FramebufferZoom;

// Misc tab
public virtual bool EnableControllerReporting { get; set; } = DefaultRoamingSettings.EnableControllerReporting;
}
}
21 changes: 21 additions & 0 deletions src/SHME.ExternalTool.Extras/SHME.ExternalTool.Extras.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Nucs.JsonSettings" Version="2.0.2" />
<PackageReference Include="Nucs.JsonSettings.Autosave" Version="2.0.2" />

<Reference Include="System.Windows.Forms" />

<ProjectReference Include="..\CustomBuildTasks\CustomBuildTasks.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>

</Project>
Loading

0 comments on commit 5c44d77

Please sign in to comment.