From c9d03666374e367cda193ff41d6e61feebef454c Mon Sep 17 00:00:00 2001 From: bird_egop Date: Sun, 30 Nov 2025 18:11:16 +0300 Subject: [PATCH] Improvements on docs, based on decompilation --- NResUI/ImGuiUI/TexmExplorer.cs | 2 +- README.md | 91 ++++++++++++++++++++++++++++++---- TexmLib/TexmFile.cs | 4 +- TexmLib/TexmParser.cs | 6 +-- 4 files changed, 88 insertions(+), 15 deletions(-) diff --git a/NResUI/ImGuiUI/TexmExplorer.cs b/NResUI/ImGuiUI/TexmExplorer.cs index 3118b2f..722453d 100644 --- a/NResUI/ImGuiUI/TexmExplorer.cs +++ b/NResUI/ImGuiUI/TexmExplorer.cs @@ -62,7 +62,7 @@ public class TexmExplorer : IImGuiPanel ImGui.Text("Magic2: "); ImGui.SameLine(); - ImGui.Text(_viewModel.TexmFile.Header.Magic2.ToString()); + ImGui.Text(_viewModel.TexmFile.Header.FormatOptionFlags.ToString()); ImGui.Text("Format: "); ImGui.SameLine(); diff --git a/README.md b/README.md index 7fb272e..af408c5 100644 --- a/README.md +++ b/README.md @@ -295,21 +295,70 @@ IComponent ** LoadSomething(undefined4, undefined4, undefined4, undefined4) Может как-то анимироваться. Как - пока не понятно. +## `FXID` - файл эффектов + +По сути представляет собой последовательный список саб-эффектов идущих друг за другом. + +Всего существует 9 (1..9) видов эффектов: !описать по мере реверса + +Выглядит так, словно весь файл это тоже эффект сам по себе. + +``` +0x00-0x04 Type (игра обрезает 1 байт, и поддерживает только значения 1-9) +0x04-0x08 unknown +0x08-0x0C unknown +0x0C-0x10 unknown +0x10-0x14 EffectTemplateFlags +... +0x30-0x34 ScaleX +0x34-0x38 ScaleY +0x38-0x3C ScaleZ + +enum EffectTemplateFlags : uint32_t +{ + EffectTemplateFlag_RandomizeStrength = 0x0001, // used in UpdateDust + EffectTemplateFlag_RandomOffset = 0x0008, // random worldTransform offset + EffectTemplateFlag_TriangularShape = 0x0020, // post-process strength as 0→1→0 + EffectTemplateFlag_OnlyWhenEnvBit0Off = 0x0080, // gating in ComputeEffectStrength + EffectTemplateFlag_OnlyWhenEnvBit0On = 0x0100, // gating in ComputeEffectStrength + EffectTemplateFlag_MultiplyByLife = 0x0200, // multiply strength by life progress + EffectTemplateFlag_EnvFlag2_IfNotSet = 0x0800, // if NOT set → envFlags |= 0x02 + EffectTemplateFlag_EnvFlag10_IfSet = 0x1000, // if set → envFlags |= 0x10 + EffectTemplateFlag_AlwaysEmitDust = 0x0010, // ignore piece state / flags + EffectTemplateFlag_IgnorePieceState = 0x8000, // treat piece default state as OK + EffectTemplateFlag_AutoDeleteAtFull = 0x0002, // delete when strength >= 1 + EffectTemplateFlag_DetachAfterEmit = 0x0004, // detach from attachment after update +}; + +``` + + + + +# ЕСЛИ ГДЕ-ТО ВИДИШЬ PTR_func_ret1_no_args, ТО ЭТО ShaderConfig + +В рендеринге порядок дата-стримов такой + +position +normal +color # Внутренняя система ID -- `1` - unknown (implemented by CLandscape) -- `3` - unknown (implemented by CAtmosphere) +- `1` - unknown (implemented by CLandscape) видимо ILandscape +- `3` - unknown (implemented by CAtmosphere) видимо IAtmosphere - `4` - IShader - `5` - ITerrain -- `6` - IGameObject (0x138) -- `7` - unknown (contained in CAgent) +- `6` - IGameObject +- `7` - ISettings скорее всего - `8` - ICamera - `9` - IQueue - `10` - IControl - `0xb` - IAnimation +- `0xc` - IShadeStatsBuilder (придумал сам implemented by CShade) - `0xd` - IMatManager - `0xe` - ILightManager +- `0xf` - IShade - `0x10` - IBehaviour - `0x11` - IBasement - `0x12` - ICamera2 или IBufferingCamera @@ -321,7 +370,7 @@ IComponent ** LoadSomething(undefined4, undefined4, undefined4, undefined4) - `0x18` - IMesh2 - `0x19` - IManManager - `0x20` - IJointMesh -- `0x21` - IShade +- `0x21` - IShadowProcessor (придумал сам implemented by CShade) - `0x22` - unknown (implement by CLandscape) - `0x23` - IGameSettings - `0x24` - IGameObject2 @@ -336,10 +385,10 @@ IComponent ** LoadSomething(undefined4, undefined4, undefined4, undefined4) - `0x105` - INResFile - `0x106` - NResFileMetadata - `0x107` - I3DSound -- `0x107` - IListenerTransform +- `0x108` - IListenerTransform - `0x109` - ISoundPool - `0x10a` - ISoundBuffer -- `0x10d` - ICDPlayer +- `0x10c` - ICDPlayer - `0x10d` - IVertexBuffer - `0x201` - IWizard - `0x202` - IItemManager @@ -353,7 +402,6 @@ IComponent ** LoadSomething(undefined4, undefined4, undefined4, undefined4) - `0x502` - ResTree - `0x700` - INetWatcher - `0x701` - INetworkInterface -- `0x10d` - CreateVertexBufferData ## SuperAI = Clan с точки зрения индексации @@ -391,6 +439,31 @@ World3D.dll содержит функцию CreateGameSettings. | ---- | (0x8001e) | | | добавляет AniMesh | +## Goodies + +```c++ +// Тип положения объекта в пространстве, применяется для расчёта эффектов, расположения объектов и для сотни получений местоположения объектов +// объяснение от ChatGPT но это лучше чем ничего +enum EPlacementType +{ + // 0: Full world-space placement used for look-at / target-based alignment. + // Passed-in matrix is a world transform; engine converts to local/joint as needed. + Placement_WorldLookAtTarget = 0, + + // 1: World-space placement where the object's 'direction' is aligned toward the target. + // Passed-in matrix is world; alignment logic uses internal direction + target. + Placement_WorldAlignDirectionToTarget = 1, + + // 2: World-space placement defined purely by the object's own stored transform. + // Passed-in matrix is “standalone world”; engine stores it as internal local/joint. + Placement_WorldFromStoredTransform = 2, + + // 3: World-space placement aligned along motion, also constrained toward target. + // Uses previous world position + current + target. + Placement_WorldAlignMotionToTarget = 3 +}; +``` + ## Контакты -Вы можете связаться со мной в [Telegram](https://t.me/bird_egop). +Вы можете связаться со мной в [Telegram](https://t.me/bird_egop). \ No newline at end of file diff --git a/TexmLib/TexmFile.cs b/TexmLib/TexmFile.cs index b829ec7..2b960f1 100644 --- a/TexmLib/TexmFile.cs +++ b/TexmLib/TexmFile.cs @@ -14,7 +14,7 @@ namespace TexmLib; /// Кол-во мипмапов (уменьшенные копии текстуры) /// Сколько БИТ занимает 1 пиксель /// Неизвестно -/// Неизвестно +/// Дополнительные флаги для текстуры /// Формат пикселя(4444, 8888, 888) public record TexmHeader( string TexmAscii, @@ -23,7 +23,7 @@ public record TexmHeader( int MipmapCount, int Stride, int Magic1, - int Magic2, + int FormatOptionFlags, int Format ); diff --git a/TexmLib/TexmParser.cs b/TexmLib/TexmParser.cs index f79648e..5fcf665 100644 --- a/TexmLib/TexmParser.cs +++ b/TexmLib/TexmParser.cs @@ -22,7 +22,7 @@ public class TexmParser var mipmapCountBytes = headerBytes[12..16]; var strideBytes = headerBytes[16..20]; var magic1Bytes = headerBytes[20..24]; - var magic2Bytes = headerBytes[24..28]; + var formatOptionFlagsBytes = headerBytes[24..28]; var formatBytes = headerBytes[28..32]; var texmAscii = Encoding.ASCII.GetString(texmHeader).Trim('\0'); @@ -31,7 +31,7 @@ public class TexmParser var mipmapCount = BinaryPrimitives.ReadInt32LittleEndian(mipmapCountBytes); var stride = BinaryPrimitives.ReadInt32LittleEndian(strideBytes); var magic1 = BinaryPrimitives.ReadInt32LittleEndian(magic1Bytes); - var magic2 = BinaryPrimitives.ReadInt32LittleEndian(magic2Bytes); + var formatOptionFlags = BinaryPrimitives.ReadInt32LittleEndian(formatOptionFlagsBytes); var format = BinaryPrimitives.ReadInt32LittleEndian(formatBytes); if (texmAscii != "Texm") @@ -51,7 +51,7 @@ public class TexmParser mipmapCount, stride, magic1, - magic2, + formatOptionFlags, format );