- Cleanup
This commit is contained in:
Infi
2025-03-26 21:12:41 +01:00
parent a6b71f50e6
commit c9674b0646
15 changed files with 56 additions and 115 deletions
-22
View File
@@ -1,22 +0,0 @@
image: fedora/latest
packages:
- dotnet
- wget
- unzip
- zip
tasks:
- download-dalamud: |
mkdir dalamud
cd dalamud
wget https://github.com/goatcorp/dalamud-distrib/raw/main/latest.zip
unzip latest.zip
rm latest.zip
- build-plugin: |
cd ChatTwo/ChatTwo
dotnet build -c Release -p:IsCI=true
- package: |
cd ChatTwo/ChatTwo/bin/Release/net5.0-windows
zip -r release.zip ChatTwo
artifacts:
- ChatTwo/ChatTwo/bin/Release/net5.0-windows/ChatTwo/latest.zip
- ChatTwo/ChatTwo/bin/Release/net5.0-windows/release.zip
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks> <TargetFrameworks>net9.0-windows</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
+4 -44
View File
@@ -1,59 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Dalamud.NET.SDK/12.0.2">
<PropertyGroup> <PropertyGroup>
<Version>1.29.20</Version> <Version>1.30.0</Version>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net9.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<LangVersion>preview</LangVersion> <LangVersion>latest</LangVersion>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<DalamudLibPath>$(AppData)\XIVLauncher\addon\Hooks\dev</DalamudLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
<DalamudLibPath>$(DALAMUD_HOME)</DalamudLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$(IsCI)' == 'true'">
<DalamudLibPath>$(HOME)/dalamud</DalamudLibPath>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)\Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)\FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)\Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<PackageReference Include="MessagePack" Version="3.1.3" /> <PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageReference Include="Pidgin" Version="3.3.0" /> <PackageReference Include="Pidgin" Version="3.3.0" />
+2 -2
View File
@@ -54,7 +54,7 @@ public enum ChunkSource
Content, Content,
} }
[MessagePackObject] [MessagePackObject(AllowPrivate = true)]
public class TextChunk : Chunk public class TextChunk : Chunk
{ {
[Key(2)] [Key(2)]
@@ -121,7 +121,7 @@ public class TextChunk : Chunk
} }
} }
[MessagePackObject] [MessagePackObject(AllowPrivate = true)]
public class IconChunk : Chunk public class IconChunk : Chunk
{ {
[Key(2)] [Key(2)]
+6 -5
View File
@@ -17,6 +17,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Info;
using FFXIVClientStructs.FFXIV.Client.UI.Misc; using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using FFXIVClientStructs.FFXIV.Client.UI.Shell; using FFXIVClientStructs.FFXIV.Client.UI.Shell;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using InteropGenerator.Runtime;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
@@ -98,7 +99,7 @@ internal sealed unsafe class Chat : IDisposable
internal string? GetLinkshellName(uint idx) internal string? GetLinkshellName(uint idx)
{ {
var utf = InfoProxyChat.Instance()->GetLinkShellName(idx); var utf = InfoProxyChat.Instance()->GetLinkShellName(idx);
return utf == null ? null : MemoryHelper.ReadStringNullTerminated((nint) utf); return utf.HasValue ? utf.ToString() : null;
} }
internal string? GetCrossLinkshellName(uint idx) internal string? GetCrossLinkshellName(uint idx)
@@ -199,9 +200,9 @@ internal sealed unsafe class Chat : IDisposable
string? addIfNotPresent = null; string? addIfNotPresent = null;
var str = value + 2; var str = value + 2;
if (str != null && ((int) str->Type & 0xF) == (int) ValueType.String && str->String != null) if (str != null && ((int) str->Type & 0xF) == (int) ValueType.String && str->String.HasValue)
{ {
var add = MemoryHelper.ReadStringNullTerminated((nint) str->String); var add = str->String.ToString();
if (add.Length > 0) if (add.Length > 0)
addIfNotPresent = add; addIfNotPresent = add;
} }
@@ -227,7 +228,7 @@ internal sealed unsafe class Chat : IDisposable
return 1; return 1;
} }
private byte* ChangeChannelNameDetour(AgentChatLog* agent) private CStringPointer ChangeChannelNameDetour(AgentChatLog* agent)
{ {
var ret = ChangeChannelNameHook.Original(agent); var ret = ChangeChannelNameHook.Original(agent);
if (agent == null) if (agent == null)
@@ -525,7 +526,7 @@ internal sealed unsafe class Chat : IDisposable
{ {
var uC = Utf8String.FromString(c.ToString()); var uC = Utf8String.FromString(c.ToString());
uC->SanitizeString(0x27F, Utf8String.CreateEmpty()); uC->SanitizeString((AllowedEntities) 0x27F);
var wasValid = uC->ToString().Length > 0; var wasValid = uC->ToString().Length > 0;
uC->Dtor(true); uC->Dtor(true);
+1 -1
View File
@@ -33,7 +33,7 @@ public unsafe class ChatBox
{ {
var uText = Utf8String.FromString(text); var uText = Utf8String.FromString(text);
uText->SanitizeString(0x27F, (Utf8String*)nint.Zero); uText->SanitizeString((AllowedEntities) 0x27F);
var sanitised = uText->ToString(); var sanitised = uText->ToString();
uText->Dtor(true); uText->Dtor(true);
+1 -1
View File
@@ -337,7 +337,7 @@ internal partial class Message
else if (split == "<flag>") else if (split == "<flag>")
{ {
var agentMap = AgentMap.Instance(); var agentMap = AgentMap.Instance();
if (agentMap->IsFlagMarkerSet == 0) if (!agentMap->IsFlagMarkerSet)
{ {
AddChunkWithMessage(text.NewWithStyle(chunk.Source, chunk.Link, split)); AddChunkWithMessage(text.NewWithStyle(chunk.Source, chunk.Link, split));
continue; continue;
-1
View File
@@ -267,7 +267,6 @@ internal class MessageManager : IAsyncDisposable
if (tab.Identifier == currentTabId) if (tab.Identifier == currentTabId)
Plugin.ServerCore.SendNewMessage(message); Plugin.ServerCore.SendNewMessage(message);
} }
} }
} }
+3 -3
View File
@@ -277,10 +277,10 @@ public sealed class PayloadHandler
var atkPos = new Vector2(component.ScreenX, component.ScreenY); var atkPos = new Vector2(component.ScreenX, component.ScreenY);
var atkSize = new Vector2(component.GetWidth() * component.ScaleX, component.GetHeight() * component.GetScaleY()); var atkSize = new Vector2(component.GetWidth() * component.ScaleX, component.GetHeight() * component.GetScaleY());
var chatRect = MathUtil.Rectangle.FromPosAndSize(LogWindow.LastWindowPos, LogWindow.LastWindowSize); var chatRect = new MathUtil.Rectangle(LogWindow.LastWindowPos, LogWindow.LastWindowSize);
var addonRect = MathUtil.Rectangle.FromPosAndSize(atkPos, atkSize); var addonRect = new MathUtil.Rectangle(atkPos, atkSize);
if (!MathUtil.CheckRectOverlap(chatRect, addonRect)) if (!chatRect.HasOverlap(addonRect))
return; return;
var viewportSize = ImGuiHelpers.MainViewport.Size; var viewportSize = ImGuiHelpers.MainViewport.Size;
+5 -4
View File
@@ -80,7 +80,7 @@ public sealed class SettingsWindow : Window
using (var table = ImRaii.Table("##chat2-settings-table", 2)) using (var table = ImRaii.Table("##chat2-settings-table", 2))
{ {
if (table) if (table.Success)
{ {
ImGui.TableSetupColumn("tab", ImGuiTableColumnFlags.WidthFixed); ImGui.TableSetupColumn("tab", ImGuiTableColumnFlags.WidthFixed);
ImGui.TableSetupColumn("settings", ImGuiTableColumnFlags.WidthStretch); ImGui.TableSetupColumn("settings", ImGuiTableColumnFlags.WidthStretch);
@@ -99,10 +99,11 @@ public sealed class SettingsWindow : Window
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var height = ImGui.GetContentRegionAvail().Y - ImGui.GetStyle().FramePadding.Y * 2 - ImGui.GetStyle().ItemSpacing.Y var style = ImGui.GetStyle();
- ImGui.GetStyle().ItemInnerSpacing.Y * 2 - ImGui.CalcTextSize("A").Y; var height = ImGui.GetContentRegionAvail().Y - style.FramePadding.Y * 2 - style.ItemSpacing.Y - style.ItemInnerSpacing.Y * 2 - ImGui.CalcTextSize("A").Y;
using var child = ImRaii.Child("##chat2-settings", new Vector2(-1, height)); using var child = ImRaii.Child("##chat2-settings", new Vector2(-1, height));
if (child) if (child.Success)
Tabs[CurrentTab].Draw(changed); Tabs[CurrentTab].Draw(changed);
} }
} }
+2 -2
View File
@@ -41,14 +41,14 @@ internal static class ChunkUtil
case PayloadType.UIForeground: case PayloadType.UIForeground:
var foregroundPayload = (UIForegroundPayload) payload; var foregroundPayload = (UIForegroundPayload) payload;
if (foregroundPayload.IsEnabled) if (foregroundPayload.IsEnabled)
foreground.Push(foregroundPayload.UIColor.Value.UIForeground); foreground.Push(foregroundPayload.UIColor.Value.Dark);
else if (foreground.Count > 0) else if (foreground.Count > 0)
foreground.Pop(); foreground.Pop();
break; break;
case PayloadType.UIGlow: case PayloadType.UIGlow:
var glowPayload = (UIGlowPayload) payload; var glowPayload = (UIGlowPayload) payload;
if (glowPayload.IsEnabled) if (glowPayload.IsEnabled)
glow.Push(glowPayload.UIColor.Value.UIGlow); glow.Push(glowPayload.UIColor.Value.Light);
else if (glow.Count > 0) else if (glow.Count > 0)
glow.Pop(); glow.Pop();
break; break;
+21 -12
View File
@@ -4,30 +4,39 @@ namespace ChatTwo.Util;
public static class MathUtil public static class MathUtil
{ {
public struct Rectangle public record Rectangle
{ {
public int X; public int X;
public int Y; public int Y;
public int Width; public int Width;
public int Height; public int Height;
public static Rectangle FromPosAndSize(Vector2 pos, Vector2 size) public int SizeX;
public int SizeY;
public Rectangle(int x, int y, int width, int height)
{ {
return new Rectangle X = x;
{ Y = y;
X = (int) pos.X, Width = width;
Y = (int) pos.Y, Height = height;
Width = (int) size.X,
Height = (int) size.Y SizeX = X + Width;
}; SizeY = Y + Height;
} }
public int SizeX => X + Width; public Rectangle(Vector2 pos, Vector2 size)
public int SizeY => Y + Height; : this((int) pos.X, (int) pos.Y, (int) size.X, (int) size.Y) { }
} }
// From: https://stackoverflow.com/a/306379 // From: https://stackoverflow.com/a/306379
public static bool CheckRectOverlap(Rectangle a, Rectangle b) /// <summary>
/// Checks if two rectangles overlap at any point.
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns>True if overlapping</returns>
public static bool HasOverlap(this Rectangle a, Rectangle b)
{ {
bool ValueInRange(int value, int min, int max) bool ValueInRange(int value, int min, int max)
=> value > min && value < max; => value > min && value < max;
+10 -4
View File
@@ -1,12 +1,18 @@
{ {
"version": 1, "version": 1,
"dependencies": { "dependencies": {
"net8.0-windows7.0": { "net9.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[11.0.0, )", "requested": "[12.0.0, )",
"resolved": "11.0.0", "resolved": "12.0.0",
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA==" "contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
"requested": "[1.2.25, )",
"resolved": "1.2.25",
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
}, },
"MessagePack": { "MessagePack": {
"type": "Direct", "type": "Direct",
-6
View File
@@ -1,6 +0,0 @@
#!/bin/sh
for f in ChatTwo/Resources/Language.resx ChatTwo/Resources/Language.*.resx; do
sed -i 's/ xml:space="preserve"//g' "$f"
xmlstarlet fo -e utf-8 -s 4 "$f" | sponge "$f"
done
-7
View File
@@ -1,7 +0,0 @@
{
"sdk": {
"version": "5.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}