Merge branch 'net5'

This commit is contained in:
goaaats 2022-04-03 03:58:02 +02:00
commit 10c7cee542
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
11 changed files with 184 additions and 84 deletions

View file

@ -281,7 +281,6 @@ namespace Dalamud.Injector
AssetDirectory = Path.Combine(xivlauncherDir, "dalamudAssets", "dev"), AssetDirectory = Path.Combine(xivlauncherDir, "dalamudAssets", "dev"),
GameVersion = gameVer, GameVersion = gameVer,
Language = ClientLanguage.English, Language = ClientLanguage.English,
OptOutMbCollection = false,
}; };
Log.Debug( Log.Debug(
@ -292,8 +291,7 @@ namespace Dalamud.Injector
$" DefaultPluginDirectory: {startInfo.DefaultPluginDirectory}\n" + $" DefaultPluginDirectory: {startInfo.DefaultPluginDirectory}\n" +
$" AssetDirectory: {startInfo.AssetDirectory}\n" + $" AssetDirectory: {startInfo.AssetDirectory}\n" +
$" GameVersion: {startInfo.GameVersion}\n" + $" GameVersion: {startInfo.GameVersion}\n" +
$" Language: {startInfo.Language}\n" + $" Language: {startInfo.Language}\n");
$" OptOutMbCollection: {startInfo.OptOutMbCollection}");
Log.Information("A Dalamud start info was not found in the program arguments. One has been generated for you."); Log.Information("A Dalamud start info was not found in the program arguments. One has been generated for you.");
Log.Information("Copy the following contents into the program arguments:"); Log.Information("Copy the following contents into the program arguments:");

View file

@ -141,7 +141,12 @@ namespace Dalamud.Configuration.Internal
/// * ...TTF fonts loaded with stb or FreeType are in linear space. /// * ...TTF fonts loaded with stb or FreeType are in linear space.
/// * ...the game's prebaked AXIS fonts are in gamma space with gamma value of 1.4. /// * ...the game's prebaked AXIS fonts are in gamma space with gamma value of 1.4.
/// </summary> /// </summary>
public float FontGamma { get; set; } = 1.0f; public float FontGamma { get; set; } = 1.4f;
/// <summary>
/// Gets or sets a value indicating whether to allow big font atlas.
/// </summary>
public bool AllowBigFontAtlas { get; set; } = false;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether or not plugin UI should be hidden. /// Gets or sets a value indicating whether or not plugin UI should be hidden.
@ -290,6 +295,11 @@ namespace Dalamud.Configuration.Internal
/// </summary> /// </summary>
public bool ShowTsm { get; set; } = true; public bool ShowTsm { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether or not market board data should be uploaded.
/// </summary>
public bool DoMbCollect { get; set; } = false;
/// <summary> /// <summary>
/// Load a configuration from the provided path. /// Load a configuration from the provided path.
/// </summary> /// </summary>

View file

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Feature"> <PropertyGroup Label="Feature">
<DalamudVersion>6.3.0.7</DalamudVersion> <DalamudVersion>6.3.0.15</DalamudVersion>
<Description>XIV Launcher addon framework</Description> <Description>XIV Launcher addon framework</Description>
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion> <AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
<Version>$(DalamudVersion)</Version> <Version>$(DalamudVersion)</Version>
@ -69,6 +69,7 @@
<PackageReference Include="Lumina.Excel" Version="6.0.2" /> <PackageReference Include="Lumina.Excel" Version="6.0.2" />
<PackageReference Include="MinSharp" Version="1.0.4" /> <PackageReference Include="MinSharp" Version="1.0.4" />
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.10.10.01" /> <PackageReference Include="MonoMod.RuntimeDetour" Version="21.10.10.01" />
<PackageReference Include="NAudio" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />

View file

@ -47,11 +47,6 @@ namespace Dalamud
[JsonConverter(typeof(GameVersionConverter))] [JsonConverter(typeof(GameVersionConverter))]
public GameVersion GameVersion { get; init; } public GameVersion GameVersion { get; init; }
/// <summary>
/// Gets a value indicating whether or not market board information should be uploaded by default.
/// </summary>
public bool OptOutMbCollection { get; init; }
/// <summary> /// <summary>
/// Gets a value that specifies how much to wait before a new Dalamud session. /// Gets a value that specifies how much to wait before a new Dalamud session.
/// </summary> /// </summary>

View file

@ -25,7 +25,6 @@ namespace Dalamud.Game.Network.Internal
{ {
private readonly List<MarketBoardItemRequest> marketBoardRequests = new(); private readonly List<MarketBoardItemRequest> marketBoardRequests = new();
private readonly bool optOutMbUploads;
private readonly IMarketBoardUploader uploader; private readonly IMarketBoardUploader uploader;
private MarketBoardPurchaseHandler marketBoardPurchaseHandler; private MarketBoardPurchaseHandler marketBoardPurchaseHandler;
@ -35,8 +34,6 @@ namespace Dalamud.Game.Network.Internal
/// </summary> /// </summary>
public NetworkHandlers() public NetworkHandlers()
{ {
this.optOutMbUploads = Service<DalamudStartInfo>.Get().OptOutMbCollection;
this.uploader = new UniversalisMarketBoardUploader(); this.uploader = new UniversalisMarketBoardUploader();
Service<GameNetwork>.Get().NetworkMessage += this.OnNetworkMessage; Service<GameNetwork>.Get().NetworkMessage += this.OnNetworkMessage;
@ -58,7 +55,7 @@ namespace Dalamud.Game.Network.Internal
if (direction == NetworkMessageDirection.ZoneUp) if (direction == NetworkMessageDirection.ZoneUp)
{ {
if (!this.optOutMbUploads) if (configuration.DoMbCollect)
{ {
if (opCode == dataManager.ClientOpCodes["MarketBoardPurchaseHandler"]) if (opCode == dataManager.ClientOpCodes["MarketBoardPurchaseHandler"])
{ {
@ -76,7 +73,7 @@ namespace Dalamud.Game.Network.Internal
return; return;
} }
if (!this.optOutMbUploads) if (configuration.DoMbCollect)
{ {
if (opCode == dataManager.ServerOpCodes["MarketBoardItemRequestStart"]) if (opCode == dataManager.ServerOpCodes["MarketBoardItemRequestStart"])
{ {

View file

@ -141,9 +141,9 @@ namespace Dalamud.Interface.GameFonts
target.Value!.ConfigData, target.Value!.ConfigData,
(ushort)glyph->Codepoint, (ushort)glyph->Codepoint,
glyph->X0 * scale, glyph->X0 * scale,
glyph->Y0 * scale, ((glyph->Y0 - source.Value!.Ascent) * scale) + target.Value!.Ascent,
glyph->X1 * scale, glyph->X1 * scale,
glyph->Y1 * scale, ((glyph->Y1 - source.Value!.Ascent) * scale) + target.Value!.Ascent,
glyph->U0, glyph->U0,
glyph->V0, glyph->V0,
glyph->U1, glyph->U1,
@ -153,9 +153,9 @@ namespace Dalamud.Interface.GameFonts
else if (!missingOnly) else if (!missingOnly)
{ {
prevGlyphPtr->X0 = glyph->X0 * scale; prevGlyphPtr->X0 = glyph->X0 * scale;
prevGlyphPtr->Y0 = glyph->Y0 * scale; prevGlyphPtr->Y0 = ((glyph->Y0 - source.Value!.Ascent) * scale) + target.Value!.Ascent;
prevGlyphPtr->X1 = glyph->X1 * scale; prevGlyphPtr->X1 = glyph->X1 * scale;
prevGlyphPtr->Y1 = glyph->Y1 * scale; prevGlyphPtr->Y1 = ((glyph->Y1 - source.Value!.Ascent) * scale) + target.Value!.Ascent;
prevGlyphPtr->U0 = glyph->U0; prevGlyphPtr->U0 = glyph->U0;
prevGlyphPtr->V0 = glyph->V0; prevGlyphPtr->V0 = glyph->V0;
prevGlyphPtr->U1 = glyph->U1; prevGlyphPtr->U1 = glyph->U1;
@ -343,7 +343,7 @@ namespace Dalamud.Interface.GameFonts
{ {
var fdt = this.fdts[(int)style.FamilyAndSize]; var fdt = this.fdts[(int)style.FamilyAndSize];
var fontPtr = font.NativePtr; var fontPtr = font.NativePtr;
fontPtr->ConfigData->SizePixels = fontPtr->FontSize = fdt.FontHeader.LineHeight; fontPtr->ConfigData->SizePixels = fontPtr->FontSize = fdt.FontHeader.Size * 4 / 3;
fontPtr->Ascent = fdt.FontHeader.Ascent; fontPtr->Ascent = fdt.FontHeader.Ascent;
fontPtr->Descent = fdt.FontHeader.Descent; fontPtr->Descent = fdt.FontHeader.Descent;
fontPtr->EllipsisChar = '…'; fontPtr->EllipsisChar = '…';
@ -444,6 +444,9 @@ namespace Dalamud.Interface.GameFonts
{ {
lock (this.syncRoot) lock (this.syncRoot)
{ {
if (!this.fontUseCounter.ContainsKey(style))
return;
if ((this.fontUseCounter[style] -= 1) == 0) if ((this.fontUseCounter[style] -= 1) == 0)
this.fontUseCounter.Remove(style); this.fontUseCounter.Remove(style);
} }

View file

@ -55,6 +55,7 @@ namespace Dalamud.Interface.Internal
private readonly string rtssPath; private readonly string rtssPath;
private readonly HashSet<SpecialGlyphRequest> glyphRequests = new(); private readonly HashSet<SpecialGlyphRequest> glyphRequests = new();
private readonly List<GameFontHandle> axisFontHandles = new();
private readonly Hook<PresentDelegate> presentHook; private readonly Hook<PresentDelegate> presentHook;
private readonly Hook<ResizeBuffersDelegate> resizeBuffersHook; private readonly Hook<ResizeBuffersDelegate> resizeBuffersHook;
@ -64,9 +65,6 @@ namespace Dalamud.Interface.Internal
private readonly SwapChainVtableResolver address; private readonly SwapChainVtableResolver address;
private RawDX11Scene? scene; private RawDX11Scene? scene;
private GameFontHandle[] axisFontHandles;
private bool overwriteAllNotoGlyphsWithAxis;
// can't access imgui IO before first present call // can't access imgui IO before first present call
private bool lastWantCapture = false; private bool lastWantCapture = false;
private bool isRebuildingFonts = false; private bool isRebuildingFonts = false;
@ -197,6 +195,16 @@ namespace Dalamud.Interface.Internal
/// </summary> /// </summary>
public bool IsReady => this.scene != null; public bool IsReady => this.scene != null;
/// <summary>
/// Gets or sets a value indicating whether to override configuration for UseAxis.
/// </summary>
public bool? UseAxisOverride { get; set; } = null;
/// <summary>
/// Gets a value indicating whether to use AXIS fonts.
/// </summary>
public bool UseAxis => this.UseAxisOverride ?? Service<DalamudConfiguration>.Get().UseAxisFontsFromGame;
/// <summary> /// <summary>
/// Gets or sets the overrided font gamma value, instead of using the value from configuration. /// Gets or sets the overrided font gamma value, instead of using the value from configuration.
/// </summary> /// </summary>
@ -207,6 +215,16 @@ namespace Dalamud.Interface.Internal
/// </summary> /// </summary>
public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service<DalamudConfiguration>.Get().FontGamma)); public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service<DalamudConfiguration>.Get().FontGamma));
/// <summary>
/// Gets or sets a value indicating whether to override configuration for AllowBigFontAtlas.
/// </summary>
public bool? AllowBigFontAtlasOverride { get; set; } = null;
/// <summary>
/// Gets a value indicating whether to allow big font atlas.
/// </summary>
public bool AllowBigFontAtlas => this.AllowBigFontAtlasOverride ?? Service<DalamudConfiguration>.Get().AllowBigFontAtlas;
/// <summary> /// <summary>
/// Enable this module. /// Enable this module.
/// </summary> /// </summary>
@ -330,8 +348,6 @@ namespace Dalamud.Interface.Internal
if (!this.isRebuildingFonts) if (!this.isRebuildingFonts)
{ {
Log.Verbose("[FONT] RebuildFonts() trigger"); Log.Verbose("[FONT] RebuildFonts() trigger");
this.SetAxisFonts();
this.isRebuildingFonts = true; this.isRebuildingFonts = true;
this.scene.OnNewRenderFrame += this.RebuildFontsInternal; this.scene.OnNewRenderFrame += this.RebuildFontsInternal;
} }
@ -414,24 +430,6 @@ namespace Dalamud.Interface.Internal
Util.Fatal($"One or more files required by XIVLauncher were not found.\nPlease restart and report this error if it occurs again.\n\n{path}", "Error"); Util.Fatal($"One or more files required by XIVLauncher were not found.\nPlease restart and report this error if it occurs again.\n\n{path}", "Error");
} }
private void SetAxisFonts()
{
var configuration = Service<DalamudConfiguration>.Get();
this.overwriteAllNotoGlyphsWithAxis = configuration.UseAxisFontsFromGame;
if (this.axisFontHandles == null)
{
this.axisFontHandles = new GameFontHandle[]
{
Service<GameFontManager>.Get().NewFontRef(new(GameFontFamilyAndSize.Axis96)),
Service<GameFontManager>.Get().NewFontRef(new(GameFontFamilyAndSize.Axis12)),
Service<GameFontManager>.Get().NewFontRef(new(GameFontFamilyAndSize.Axis14)),
Service<GameFontManager>.Get().NewFontRef(new(GameFontFamilyAndSize.Axis18)),
Service<GameFontManager>.Get().NewFontRef(new(GameFontFamilyAndSize.Axis36)),
};
}
}
/* /*
* NOTE(goat): When hooking ReShade DXGISwapChain::runtime_present, this is missing the syncInterval arg. * NOTE(goat): When hooking ReShade DXGISwapChain::runtime_present, this is missing the syncInterval arg.
* Seems to work fine regardless, I guess, so whatever. * Seems to work fine regardless, I guess, so whatever.
@ -493,8 +491,6 @@ namespace Dalamud.Interface.Internal
this.scene.OnBuildUI += this.Display; this.scene.OnBuildUI += this.Display;
this.scene.OnNewInputFrame += this.OnNewInputFrame; this.scene.OnNewInputFrame += this.OnNewInputFrame;
this.SetAxisFonts();
this.SetupFonts(); this.SetupFonts();
StyleModel.TransferOldModels(); StyleModel.TransferOldModels();
@ -600,22 +596,40 @@ namespace Dalamud.Interface.Internal
private unsafe void SetupFonts() private unsafe void SetupFonts()
{ {
var gameFontManager = Service<GameFontManager>.Get();
var dalamud = Service<Dalamud>.Get(); var dalamud = Service<Dalamud>.Get();
var io = ImGui.GetIO(); var io = ImGui.GetIO();
var ioFonts = io.Fonts; var ioFonts = io.Fonts;
var fontScale = io.FontGlobalScale; var fontLoadScale = this.AllowBigFontAtlas ? io.FontGlobalScale : 1;
var fontGamma = this.FontGamma; var fontGamma = this.FontGamma;
List<ImFontPtr> fontsToUnscale = new(); List<ImFontPtr> fontsToUnscale = new();
List<bool> fontsToOverwriteFromAxis = new();
List<float?> fontsToReassignSizes = new();
this.fontBuildSignal.Reset(); this.fontBuildSignal.Reset();
ioFonts.Clear(); ioFonts.Clear();
ioFonts.TexDesiredWidth = 4096; ioFonts.TexDesiredWidth = this.AllowBigFontAtlas ? 4096 : 2048;
Log.Verbose("[FONT] SetupFonts - 1");
foreach (var v in this.axisFontHandles)
{
if (v != null)
v.Dispose();
}
this.axisFontHandles.Clear();
Log.Verbose("[FONT] SetupFonts - 2");
ImFontConfigPtr fontConfig = null; ImFontConfigPtr fontConfig = null;
List<GCHandle> garbageList = new(); List<GCHandle> garbageList = new();
try try
{ {
var dummyRangeHandle = GCHandle.Alloc(new ushort[] { '0', '0', 0 }, GCHandleType.Pinned);
garbageList.Add(dummyRangeHandle);
fontConfig = ImGuiNative.ImFontConfig_ImFontConfig(); fontConfig = ImGuiNative.ImFontConfig_ImFontConfig();
fontConfig.OversampleH = 1; fontConfig.OversampleH = 1;
fontConfig.OversampleV = 1; fontConfig.OversampleV = 1;
@ -626,15 +640,31 @@ namespace Dalamud.Interface.Internal
ShowFontError(fontPathJp); ShowFontError(fontPathJp);
// Default font // Default font
Log.Verbose("[FONT] SetupFonts - Default font");
this.axisFontHandles.Add(gameFontManager.NewFontRef(this.AllowBigFontAtlas ? new(GameFontFamily.Axis, DefaultFontSizePt * fontLoadScale) : new(GameFontFamilyAndSize.Axis12)));
if (this.UseAxis)
{
fontConfig.GlyphRanges = dummyRangeHandle.AddrOfPinnedObject();
fontConfig.SizePixels = DefaultFontSizePx * fontLoadScale;
DefaultFont = ioFonts.AddFontDefault(fontConfig);
fontsToUnscale.Add(DefaultFont);
fontsToOverwriteFromAxis.Add(true);
fontsToReassignSizes.Add(null);
}
else
{ {
var japaneseRangeHandle = GCHandle.Alloc(GlyphRangesJapanese.GlyphRanges, GCHandleType.Pinned); var japaneseRangeHandle = GCHandle.Alloc(GlyphRangesJapanese.GlyphRanges, GCHandleType.Pinned);
garbageList.Add(japaneseRangeHandle); garbageList.Add(japaneseRangeHandle);
DefaultFont = ioFonts.AddFontFromFileTTF(fontPathJp, (DefaultFontSizePx + 1) * fontScale, fontConfig, japaneseRangeHandle.AddrOfPinnedObject()); fontConfig.GlyphRanges = japaneseRangeHandle.AddrOfPinnedObject();
DefaultFont = ioFonts.AddFontFromFileTTF(fontPathJp, (DefaultFontSizePx + 1) * fontLoadScale, fontConfig);
fontsToUnscale.Add(DefaultFont); fontsToUnscale.Add(DefaultFont);
fontsToOverwriteFromAxis.Add(false);
fontsToReassignSizes.Add(null);
} }
// FontAwesome icon font // FontAwesome icon font
Log.Verbose("[FONT] SetupFonts - FontAwesome icon font");
{ {
var fontPathIcon = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "FontAwesome5FreeSolid.otf"); var fontPathIcon = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "FontAwesome5FreeSolid.otf");
if (!File.Exists(fontPathIcon)) if (!File.Exists(fontPathIcon))
@ -643,20 +673,31 @@ namespace Dalamud.Interface.Internal
var iconRangeHandle = GCHandle.Alloc(new ushort[] { 0xE000, 0xF8FF, 0, }, GCHandleType.Pinned); var iconRangeHandle = GCHandle.Alloc(new ushort[] { 0xE000, 0xF8FF, 0, }, GCHandleType.Pinned);
garbageList.Add(iconRangeHandle); garbageList.Add(iconRangeHandle);
IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, DefaultFontSizePx * fontScale, fontConfig, iconRangeHandle.AddrOfPinnedObject()); fontConfig.GlyphRanges = iconRangeHandle.AddrOfPinnedObject();
IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, DefaultFontSizePx * fontLoadScale, fontConfig);
fontsToUnscale.Add(IconFont); fontsToUnscale.Add(IconFont);
this.axisFontHandles.Add(null);
fontsToOverwriteFromAxis.Add(false);
fontsToReassignSizes.Add(null);
} }
// Monospace font // Monospace font
Log.Verbose("[FONT] SetupFonts - Monospace font");
{ {
var fontPathMono = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "Inconsolata-Regular.ttf"); var fontPathMono = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "Inconsolata-Regular.ttf");
if (!File.Exists(fontPathMono)) if (!File.Exists(fontPathMono))
ShowFontError(fontPathMono); ShowFontError(fontPathMono);
MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, DefaultFontSizePx * fontScale, fontConfig);
fontConfig.GlyphRanges = IntPtr.Zero;
MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, DefaultFontSizePx * fontLoadScale, fontConfig);
fontsToUnscale.Add(MonoFont); fontsToUnscale.Add(MonoFont);
this.axisFontHandles.Add(null);
fontsToOverwriteFromAxis.Add(false);
fontsToReassignSizes.Add(null);
} }
// Default font but in requested size for requested glyphs // Default font but in requested size for requested glyphs
Log.Verbose("[FONT] SetupFonts - Default font but in requested size for requested glyphs");
{ {
Dictionary<float, List<SpecialGlyphRequest>> extraFontRequests = new(); Dictionary<float, List<SpecialGlyphRequest>> extraFontRequests = new();
foreach (var extraFontRequest in this.glyphRequests) foreach (var extraFontRequest in this.glyphRequests)
@ -700,18 +741,32 @@ namespace Dalamud.Interface.Internal
flattenedRanges.Add(0); flattenedRanges.Add(0);
var rangeHandle = GCHandle.Alloc(flattenedRanges.ToArray(), GCHandleType.Pinned); ImFontPtr sizedFont;
garbageList.Add(rangeHandle); this.axisFontHandles.Add(gameFontManager.NewFontRef(this.AllowBigFontAtlas ? new(GameFontFamily.Axis, fontSize * 3 / 4 * fontLoadScale) : new(GameFontFamilyAndSize.Axis12)));
if (this.UseAxis)
var sizedFont = ioFonts.AddFontFromFileTTF(fontPathJp, fontSize * fontScale, fontConfig, rangeHandle.AddrOfPinnedObject()); {
fontsToUnscale.Add(sizedFont); fontConfig.GlyphRanges = dummyRangeHandle.AddrOfPinnedObject();
fontConfig.SizePixels = (this.AllowBigFontAtlas ? fontSize : DefaultFontSizePx) * fontLoadScale;
sizedFont = ioFonts.AddFontDefault(fontConfig);
fontsToUnscale.Add(sizedFont);
fontsToOverwriteFromAxis.Add(true);
fontsToReassignSizes.Add(this.AllowBigFontAtlas ? null : fontSize);
}
else
{
var rangeHandle = GCHandle.Alloc(flattenedRanges.ToArray(), GCHandleType.Pinned);
garbageList.Add(rangeHandle);
sizedFont = ioFonts.AddFontFromFileTTF(fontPathJp, (this.AllowBigFontAtlas ? fontSize : DefaultFontSizePx + 1) * fontLoadScale, fontConfig, rangeHandle.AddrOfPinnedObject());
fontsToUnscale.Add(sizedFont);
fontsToOverwriteFromAxis.Add(false);
fontsToReassignSizes.Add(this.AllowBigFontAtlas ? null : fontSize);
}
foreach (var request in requests) foreach (var request in requests)
request.FontInternal = sizedFont; request.FontInternal = sizedFont;
} }
} }
var gameFontManager = Service<GameFontManager>.Get();
gameFontManager.BuildFonts(); gameFontManager.BuildFonts();
Log.Verbose("[FONT] Invoke OnBuildFonts"); Log.Verbose("[FONT] Invoke OnBuildFonts");
@ -733,38 +788,55 @@ namespace Dalamud.Interface.Internal
texPixels[i] = (byte)(Math.Pow(texPixels[i] / 255.0f, 1.0f / fontGamma) * 255.0f); texPixels[i] = (byte)(Math.Pow(texPixels[i] / 255.0f, 1.0f / fontGamma) * 255.0f);
} }
foreach (var font in fontsToUnscale)
GameFontManager.UnscaleFont(font, fontScale, false);
gameFontManager.AfterBuildFonts(); gameFontManager.AfterBuildFonts();
foreach (var font in fontsToUnscale) for (var i = 0; i < fontsToUnscale.Count; i++)
{ {
// Leave IconFont alone. var font = fontsToUnscale[i];
if (font.NativePtr == IconFont.NativePtr) var fontPtr = font.NativePtr;
var correspondingAxis = this.axisFontHandles[i];
var overwrite = fontsToOverwriteFromAxis[i];
var overwriteSize = fontsToReassignSizes[i];
GameFontManager.UnscaleFont(font, fontLoadScale, false);
if (correspondingAxis == null)
continue; continue;
// MonoFont will be filled later from DefaultFont. var scale = 1f;
if (font.NativePtr == MonoFont.NativePtr)
continue;
var axisFont = this.axisFontHandles[^1]; if (overwrite)
for (var i = this.axisFontHandles.Length - 2; i >= 0; i--)
{ {
if (this.axisFontHandles[i].Style.Size >= (font.FontSize - 1) * fontScale * 3 / 4) var srcPtr = correspondingAxis.ImFont.NativePtr;
axisFont = this.axisFontHandles[i]; scale = fontPtr->ConfigData->SizePixels / srcPtr->ConfigData->SizePixels / fontLoadScale;
else fontPtr->FontSize = srcPtr->FontSize * scale;
break; fontPtr->Ascent = srcPtr->Ascent * scale;
fontPtr->Descent = srcPtr->Descent * scale;
fontPtr->FallbackChar = srcPtr->FallbackChar;
fontPtr->EllipsisChar = srcPtr->EllipsisChar;
GameFontManager.CopyGlyphsAcrossFonts(correspondingAxis.ImFont, font, false, false);
scale = 1f;
} }
if (this.overwriteAllNotoGlyphsWithAxis) if (overwriteSize != null)
GameFontManager.CopyGlyphsAcrossFonts(axisFont.ImFont, font, false, false); scale *= overwriteSize.Value / fontPtr->ConfigData->SizePixels;
else
GameFontManager.CopyGlyphsAcrossFonts(axisFont.ImFont, font, false, false, 0xE020, 0xE0DB);
// Fill missing glyphs in DefaultFont from Axis if (scale != 1f)
if (font.NativePtr == DefaultFont.NativePtr) GameFontManager.UnscaleFont(font, 1 / scale, false);
GameFontManager.CopyGlyphsAcrossFonts(axisFont.ImFont, DefaultFont, true, false);
Log.Verbose("[FONT] Font {0}: result size {1}", i, fontPtr->FontSize);
if (!this.UseAxis && fontPtr == DefaultFont.NativePtr)
{
fontPtr->FontSize -= 1;
GameFontManager.CopyGlyphsAcrossFonts(correspondingAxis.ImFont, font, true, false, 0xE020, 0xE0DB);
fontPtr->FontSize += 1;
}
else
{
GameFontManager.CopyGlyphsAcrossFonts(correspondingAxis.ImFont, font, true, false, 0xE020, 0xE0DB);
}
} }
// Fill missing glyphs in MonoFont from DefaultFont // Fill missing glyphs in MonoFont from DefaultFont

View file

@ -36,9 +36,11 @@ namespace Dalamud.Interface.Internal.Windows
private bool doCfTaskBarFlash; private bool doCfTaskBarFlash;
private bool doCfChatMessage; private bool doCfChatMessage;
private bool doMbCollect;
private float globalUiScale; private float globalUiScale;
private bool doUseAxisFontsFromGame; private bool doUseAxisFontsFromGame;
private bool doAllowBigFontAtlas;
private float fontGamma; private float fontGamma;
private bool doToggleUiHide; private bool doToggleUiHide;
private bool doToggleUiHideDuringCutscenes; private bool doToggleUiHideDuringCutscenes;
@ -90,10 +92,12 @@ namespace Dalamud.Interface.Internal.Windows
this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash; this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash;
this.doCfChatMessage = configuration.DutyFinderChatMessage; this.doCfChatMessage = configuration.DutyFinderChatMessage;
this.doMbCollect = configuration.DoMbCollect;
this.globalUiScale = configuration.GlobalUiScale; this.globalUiScale = configuration.GlobalUiScale;
this.fontGamma = configuration.FontGamma; this.fontGamma = configuration.FontGamma;
this.doUseAxisFontsFromGame = configuration.UseAxisFontsFromGame; this.doUseAxisFontsFromGame = configuration.UseAxisFontsFromGame;
this.doAllowBigFontAtlas = configuration.AllowBigFontAtlas;
this.doToggleUiHide = configuration.ToggleUiHide; this.doToggleUiHide = configuration.ToggleUiHide;
this.doToggleUiHideDuringCutscenes = configuration.ToggleUiHideDuringCutscenes; this.doToggleUiHideDuringCutscenes = configuration.ToggleUiHideDuringCutscenes;
this.doToggleUiHideDuringGpose = configuration.ToggleUiHideDuringGpose; this.doToggleUiHideDuringGpose = configuration.ToggleUiHideDuringGpose;
@ -184,6 +188,8 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale; ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale;
interfaceManager.FontGammaOverride = null; interfaceManager.FontGammaOverride = null;
interfaceManager.AllowBigFontAtlasOverride = null;
interfaceManager.UseAxisOverride = null;
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList(); this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList(); this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
@ -277,6 +283,9 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Checkbox(Loc.Localize("DalamudSettingsDisableRmtFiltering", "Disable RMT Filtering"), ref this.disableRmtFiltering); ImGui.Checkbox(Loc.Localize("DalamudSettingsDisableRmtFiltering", "Disable RMT Filtering"), ref this.disableRmtFiltering);
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDisableRmtFilteringMsgHint", "Disable dalamud's built-in RMT ad filtering.")); ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDisableRmtFilteringMsgHint", "Disable dalamud's built-in RMT ad filtering."));
ImGui.Checkbox(Loc.Localize("DalamudSettingDoMbCollect", "Anonymously upload market board data"), ref this.doMbCollect);
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!"));
} }
private void DrawLookAndFeelTab() private void DrawLookAndFeelTab()
@ -315,9 +324,22 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below.")); ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below."));
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleAxisFonts", "Use AXIS fonts as default Dalamud font"), ref this.doUseAxisFontsFromGame); if (ImGui.Checkbox(Loc.Localize("DalamudSettingToggleAxisFonts", "Use AXIS fonts as default Dalamud font"), ref this.doUseAxisFontsFromGame))
{
interfaceManager.UseAxisOverride = this.doUseAxisFontsFromGame;
interfaceManager.RebuildFonts();
}
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiAxisFontsHint", "Use AXIS fonts (the game's main UI fonts) as default Dalamud font.")); ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiAxisFontsHint", "Use AXIS fonts (the game's main UI fonts) as default Dalamud font."));
if (ImGui.Checkbox(Loc.Localize("DalamudSettingAllowBigFontAtlas", "Allow big font atlas"), ref this.doAllowBigFontAtlas))
{
interfaceManager.AllowBigFontAtlasOverride = this.doAllowBigFontAtlas;
interfaceManager.RebuildFonts();
}
ImGui.TextColored(ImGuiColors.DalamudGrey, string.Format(Loc.Localize("DalamudSettingAllowBigFontAtlas", "Displays text crisply, but may crash if your GPU does not support it.\nCurrent size: {0}px * {1}px"), ImGui.GetIO().Fonts.TexWidth, ImGui.GetIO().Fonts.TexHeight));
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"), ref this.doToggleUiHide); ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"), ref this.doToggleUiHide);
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay.")); ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."));
@ -832,6 +854,7 @@ namespace Dalamud.Interface.Internal.Windows
configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash; configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;
configuration.DutyFinderChatMessage = this.doCfChatMessage; configuration.DutyFinderChatMessage = this.doCfChatMessage;
configuration.DoMbCollect = this.doMbCollect;
configuration.GlobalUiScale = this.globalUiScale; configuration.GlobalUiScale = this.globalUiScale;
configuration.ToggleUiHide = this.doToggleUiHide; configuration.ToggleUiHide = this.doToggleUiHide;
@ -844,6 +867,7 @@ namespace Dalamud.Interface.Internal.Windows
configuration.ShowTsm = this.doTsm; configuration.ShowTsm = this.doTsm;
configuration.UseAxisFontsFromGame = this.doUseAxisFontsFromGame; configuration.UseAxisFontsFromGame = this.doUseAxisFontsFromGame;
configuration.AllowBigFontAtlas = this.doAllowBigFontAtlas;
configuration.FontGamma = this.fontGamma; configuration.FontGamma = this.fontGamma;
// This is applied every frame in InterfaceManager::CheckViewportState() // This is applied every frame in InterfaceManager::CheckViewportState()

View file

@ -37,12 +37,12 @@ int CoreCLR::load_hostfxr(const struct get_hostfxr_parameters* parameters)
&& m_hostfxr_close_fptr ? 0 : -1; && m_hostfxr_close_fptr ? 0 : -1;
} }
bool CoreCLR::load_runtime(const std::wstring& runtime_config_path) int CoreCLR::load_runtime(const std::wstring& runtime_config_path)
{ {
return CoreCLR::load_runtime(runtime_config_path, nullptr); return CoreCLR::load_runtime(runtime_config_path, nullptr);
} }
bool CoreCLR::load_runtime(const std::wstring& runtime_config_path, const struct hostfxr_initialize_parameters* parameters) int CoreCLR::load_runtime(const std::wstring& runtime_config_path, const struct hostfxr_initialize_parameters* parameters)
{ {
int result; int result;

View file

@ -12,8 +12,8 @@ class CoreCLR {
int load_hostfxr(); int load_hostfxr();
int load_hostfxr(const get_hostfxr_parameters* parameters); int load_hostfxr(const get_hostfxr_parameters* parameters);
bool load_runtime(const std::wstring& runtime_config_path); int load_runtime(const std::wstring& runtime_config_path);
bool load_runtime( int load_runtime(
const std::wstring& runtime_config_path, const std::wstring& runtime_config_path,
const struct hostfxr_initialize_parameters* parameters); const struct hostfxr_initialize_parameters* parameters);

View file

@ -90,7 +90,7 @@ int InitializeClrAndGetEntryPoint(
printf("Loading hostfxr... "); printf("Loading hostfxr... ");
if ((result = g_clr->load_hostfxr(&init_parameters)) != 0) if ((result = g_clr->load_hostfxr(&init_parameters)) != 0)
{ {
printf("\nError: Failed to load the `hostfxr` library (err=%d)\n", result); printf("\nError: Failed to load the `hostfxr` library (err=0x%08x)\n", result);
return result; return result;
} }
printf("Done!\n"); printf("Done!\n");