diff --git a/UndertaleModLib/Compiler/AssemblyWriter.cs b/UndertaleModLib/Compiler/AssemblyWriter.cs index 2d733f43f..63f3ab154 100644 --- a/UndertaleModLib/Compiler/AssemblyWriter.cs +++ b/UndertaleModLib/Compiler/AssemblyWriter.cs @@ -1070,7 +1070,7 @@ private static void AssembleStatement(CodeWriter cw, Parser.Statement s) { // Put the return value into a local variable (GM does this as well) // so that it doesn't get cleared out of the stack?? - // See here: https://github.com/krzys-h/UndertaleModTool/issues/164 + // See here: https://github.com/UnderminersTeam/UndertaleModTool/issues/164 cw.varPatches.Add(new VariablePatch() { Target = cw.EmitRef(Opcode.Pop, DataType.Variable, DataType.Variable), diff --git a/UndertaleModLib/Models/UndertaleEmbeddedImage.cs b/UndertaleModLib/Models/UndertaleEmbeddedImage.cs index 6bc0745a3..bc232dc66 100644 --- a/UndertaleModLib/Models/UndertaleEmbeddedImage.cs +++ b/UndertaleModLib/Models/UndertaleEmbeddedImage.cs @@ -21,7 +21,7 @@ namespace UndertaleModLib.Models; /// 32-bit string pointer, some kind of texture page identifier? /// 32-bit pointer to something relating to a texture page entry? /// -/// . +/// . public class UndertaleEmbeddedImage : UndertaleNamedResource, IStaticChildObjectsSize, IDisposable { /// diff --git a/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs b/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs index 61b3599d3..d5949e566 100644 --- a/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs +++ b/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs @@ -15,15 +15,8 @@ namespace UndertaleModLib.Models; /// An embedded texture entry in the data file. /// [PropertyChanged.AddINotifyPropertyChangedInterface] -public class UndertaleEmbeddedTexture : UndertaleNamedResource, IDisposable, - IStaticChildObjCount, IStaticChildObjectsSize +public class UndertaleEmbeddedTexture : UndertaleNamedResource, IDisposable { - /// - public static readonly uint ChildObjectCount = 1; - - /// - public static readonly uint ChildObjectsSize = 4; // minimal size - /// /// The name of the embedded texture entry. /// @@ -196,6 +189,29 @@ public void UnserializeBlob(UndertaleReader reader) TextureLoaded = true; } + /// + public static uint UnserializeChildObjectCount(UndertaleReader reader) + { + uint count = 0; + + reader.Position += 4; // "Scaled" + if (reader.undertaleData.IsVersionAtLeast(2, 0, 6)) + reader.Position += 4; // "GeneratedMips" + if (reader.undertaleData.IsVersionAtLeast(2022, 3)) + reader.Position += 4; // "_textureBlockSize" + if (reader.undertaleData.IsVersionAtLeast(2022, 9)) + reader.Position += 12; // "TextureWidth", "TextureHeight", "IndexInGroup" + + if (reader.ReadUInt32() != 0) + { + // If the texture data pointer isn't null, then this is an internal texture, + // which will create another object in the pool when reading the blob. + count++; + } + + return count; + } + /// /// Assigns texture group info to every embedded texture in the supplied data file. /// diff --git a/UndertaleModLib/Models/UndertaleFont.cs b/UndertaleModLib/Models/UndertaleFont.cs index b6bc48da6..7b2dd5b11 100644 --- a/UndertaleModLib/Models/UndertaleFont.cs +++ b/UndertaleModLib/Models/UndertaleFont.cs @@ -180,7 +180,7 @@ public void Unserialize(UndertaleReader reader) SourceWidth = reader.ReadUInt16(); SourceHeight = reader.ReadUInt16(); Shift = reader.ReadInt16(); - Offset = reader.ReadInt16(); // potential assumption, see the conversation at https://github.com/krzys-h/UndertaleModTool/issues/40#issuecomment-440208912 + Offset = reader.ReadInt16(); // Potential assumption, see the conversation at https://github.com/UnderminersTeam/UndertaleModTool/issues/40#issuecomment-440208912 Kerning = reader.ReadUndertaleObject>(); } diff --git a/UndertaleModLib/Models/UndertaleTextureGroupInfo.cs b/UndertaleModLib/Models/UndertaleTextureGroupInfo.cs index 0ec43c716..7862831c6 100644 --- a/UndertaleModLib/Models/UndertaleTextureGroupInfo.cs +++ b/UndertaleModLib/Models/UndertaleTextureGroupInfo.cs @@ -37,7 +37,7 @@ namespace UndertaleModLib.Models; /// #5 leads here: /// SimpleList<int> of tileset IDs the group has /// -/// . +/// . [PropertyChanged.AddINotifyPropertyChangedInterface] public class UndertaleTextureGroupInfo : UndertaleNamedResource, IDisposable { diff --git a/UndertaleModLib/UndertaleChunks.cs b/UndertaleModLib/UndertaleChunks.cs index d7cfcfd43..18dc943f0 100644 --- a/UndertaleModLib/UndertaleChunks.cs +++ b/UndertaleModLib/UndertaleChunks.cs @@ -1651,17 +1651,6 @@ internal override uint UnserializeObjectCount(UndertaleReader reader) CheckFor2022_3And5(reader); - uint txtrSize = UndertaleEmbeddedTexture.ChildObjectsSize; - if (reader.undertaleData.IsVersionAtLeast(2, 0, 6)) - txtrSize += 4; // "GeneratedMips" - if (reader.undertaleData.IsVersionAtLeast(2022, 3)) - txtrSize += 4; // "TextureBlockSize" - if (reader.undertaleData.IsVersionAtLeast(2022, 9)) - txtrSize += 12; - - if (txtrSize != UndertaleEmbeddedTexture.ChildObjectsSize) - reader.SetStaticChildObjectsSize(typeof(UndertaleEmbeddedTexture), txtrSize); - // Texture blobs are already included in the count return base.UnserializeObjectCount(reader); } @@ -1703,7 +1692,7 @@ internal override void SerializeChunk(UndertaleWriter writer) { if (!writer.undertaleData.IsGameMaker2()) throw new InvalidOperationException(); - writer.Write((uint)1); // apparently hardcoded 1, see https://github.com/krzys-h/UndertaleModTool/issues/4#issuecomment-421844420 + writer.Write((uint)1); // Apparently hardcoded 1, see https://github.com/UnderminersTeam/UndertaleModTool/issues/4#issuecomment-421844420 base.SerializeChunk(writer); } diff --git a/UndertaleModTool/MainWindow.xaml.cs b/UndertaleModTool/MainWindow.xaml.cs index 0d96fc629..1f83a2e3c 100644 --- a/UndertaleModTool/MainWindow.xaml.cs +++ b/UndertaleModTool/MainWindow.xaml.cs @@ -2786,12 +2786,12 @@ public string ScriptInputDialog(string title, string label, string defaultInput, private void MenuItem_GitHub_Click(object sender, RoutedEventArgs e) { - OpenBrowser("https://github.com/krzys-h/UndertaleModTool"); + OpenBrowser("https://github.com/UnderminersTeam/UndertaleModTool"); } private void MenuItem_About_Click(object sender, RoutedEventArgs e) { - this.ShowMessage("UndertaleModTool by krzys_h\nVersion " + Version, "About"); + this.ShowMessage("UndertaleModTool by krzys_h and the Underminers team\nVersion " + Version, "About"); } /// From https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs @@ -2906,7 +2906,7 @@ public async void UpdateApp(SettingsWindow window) bool isBundled = !Regex.Match(assemblyLocation, @"C:\\Program Files( \(x86\))*\\dotnet\\shared\\").Success; string patchName = $"GUI-windows-latest-{configStr}-isBundled-{isBundled.ToString().ToLower()}-isSingleFile-{isSingleFile.ToString().ToLower()}"; - string baseUrl = "https://api.github.com/repos/krzys-h/UndertaleModTool/actions/"; + string baseUrl = "https://api.github.com/repos/UnderminersTeam/UndertaleModTool/actions/"; string detectedActionName = "Publish continuous release of UndertaleModTool"; // Fetch the latest workflow run diff --git a/UndertaleModTool/Scripts/Builtin Scripts/MixMod_README.md b/UndertaleModTool/Scripts/Builtin Scripts/MixMod_README.md index 369ca4341..0d3dbec8a 100644 --- a/UndertaleModTool/Scripts/Builtin Scripts/MixMod_README.md +++ b/UndertaleModTool/Scripts/Builtin Scripts/MixMod_README.md @@ -1,6 +1,6 @@ Looking for an excuse to play Undertale again but don't have a Switch? I might have something for you! -The (probably) first mod that is not just another string/texture swap. Made with my [UndertaleModTool](https://github.com/krzys-h/UndertaleModTool). +The (probably) first mod that is not just another string/texture swap. Made with my [UndertaleModTool](https://github.com/UnderminersTeam/UndertaleModTool). It's **Undertale, But Every Time A Song Plays Its A Random Remix From YouTube Instead!** (or MixMod for short) @@ -8,7 +8,7 @@ And it does exactly that. Every time a song plays, it searches YouTube for "[son **Installation instructions**: 1. Make sure you are on Undertale version >= 1.08 (older ones are not supported by UndertaleModTool because of bytecode changes) on Windows (because I didn't manage to figure out how to access GMS surfaces from extensions so I have to pass the whole DirectX context and draw manually - seriously, there is like no documentation on extensions at all) -2. Download [UndertaleModTool](https://github.com/krzys-h/UndertaleModTool/releases) (the mod script is bundled with the download because I'm too lazy to create a github repo for one file) and [GMWebExtension](https://github.com/krzys-h/GMWebExtension/releases) (the libs only zip file) +2. Download [UndertaleModTool](https://github.com/UnderminersTeam/UndertaleModTool/releases) (the mod script is bundled with the download because I'm too lazy to create a github repo for one file) and [GMWebExtension](https://github.com/krzys-h/GMWebExtension/releases) (the libs only zip file) 3. Make sure you backed up your Undertale installation 4. Open UndertaleModTool, load the data.win file from the Undertale directory 5. Select Scripts > Run builtin script > MixMod