diff --git a/Assets/Live2D/Cubism/CHANGELOG.md b/Assets/Live2D/Cubism/CHANGELOG.md index 75f4133..e84d22e 100644 --- a/Assets/Live2D/Cubism/CHANGELOG.md +++ b/Assets/Live2D/Cubism/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [4-r.6.1] - 2023-03-10 + +### Added + +* Add function to validate MOC3 files. + + ## [4-r.6] - 2023-01-26 ### Added @@ -267,6 +274,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Fix issue where Priority value was not reset after playing motion with CubismMotionController. +[4-r.6.1]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.6...4-r.6.1 [4-r.6]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6 [4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.5...4-r.5 [4-r.5-beta.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.4...4-r.5-beta.5 diff --git a/Assets/Live2D/Cubism/Core/CubismMoc.cs b/Assets/Live2D/Cubism/Core/CubismMoc.cs index a169b9e..718a17e 100644 --- a/Assets/Live2D/Cubism/Core/CubismMoc.cs +++ b/Assets/Live2D/Cubism/Core/CubismMoc.cs @@ -24,6 +24,14 @@ public sealed class CubismMoc : ScriptableObject { #region Factory Methods + /// + /// Checks consistency of a moc. + /// + public static bool HasMocConsistency(byte[] moc3) + { + return CubismUnmanagedMoc.HasMocConsistency(moc3); + } + /// /// Creates a asset from raw bytes. /// diff --git a/Assets/Live2D/Cubism/Core/Unmanaged/CubismCoreDll.cs b/Assets/Live2D/Cubism/Core/Unmanaged/CubismCoreDll.cs index 1cae875..6d03da4 100644 --- a/Assets/Live2D/Cubism/Core/Unmanaged/CubismCoreDll.cs +++ b/Assets/Live2D/Cubism/Core/Unmanaged/CubismCoreDll.cs @@ -155,6 +155,11 @@ public static class CubismCoreDll [DllImport(DllName, EntryPoint = "csmInitializeModelInPlace")] public static extern IntPtr InitializeModelInPlace(IntPtr moc, IntPtr memory, uint modelSize); /// + /// Checks consistency of a moc. + /// + [DllImport(DllName, EntryPoint = "csmHasMocConsistency")] + public static extern int HasMocConsistency(IntPtr memory, uint mocSize); + /// /// Updates model. /// [DllImport(DllName, EntryPoint = "csmUpdateModel")] diff --git a/Assets/Live2D/Cubism/Core/Unmanaged/CubismUnmanagedMoc.cs b/Assets/Live2D/Cubism/Core/Unmanaged/CubismUnmanagedMoc.cs index 970a8cb..8b385b4 100644 --- a/Assets/Live2D/Cubism/Core/Unmanaged/CubismUnmanagedMoc.cs +++ b/Assets/Live2D/Cubism/Core/Unmanaged/CubismUnmanagedMoc.cs @@ -53,6 +53,25 @@ public static CubismUnmanagedMoc FromBytes(byte[] bytes) /// public uint MocVersion { get; private set; } + /// + /// Checks consistency of a moc. + /// + public static bool HasMocConsistency(byte[] bytes) + { + // Allocate and initialize memory (returning on fail). + var memory = CubismUnmanagedMemory.Allocate(bytes.Length, CubismCoreDll.AlignofMoc); + + CubismUnmanagedMemory.Write(bytes, memory); + + // '1' if Moc is valid; '0' otherwise. + var mocConsistencyNum = CubismCoreDll.HasMocConsistency(memory, (uint)bytes.Length); + var hasMocConsistency = (mocConsistencyNum == 1); + + CubismUnmanagedMemory.Deallocate(memory); + + return hasMocConsistency; + } + /// /// Releases instance. /// diff --git a/Assets/Live2D/Cubism/Plugins/CHANGELOG.md b/Assets/Live2D/Cubism/Plugins/CHANGELOG.md index 6dde519..ed040b9 100644 --- a/Assets/Live2D/Cubism/Plugins/CHANGELOG.md +++ b/Assets/Live2D/Cubism/Plugins/CHANGELOG.md @@ -4,6 +4,39 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 2023-03-10 + +### Added + +* Add the function `csmHasMocConsistency`. + * This function verifies that the `MOC3` file is valid. + +### Changed + +* Upgrade Core version to 04.02.0003. + + +## 2023-02-21 + +### Added + +* [Web] Added classes related to `Memory`. + * Add the funciton `initializeAmountOfMemory()` to adjust the amount of memory at initialization. + + +## 2022-10-28 + +### Fixed + +* [Java] Remove unnecessary methods. + + +## 2022-10-06 + +### Added + +* [Java] Add AAR file for Android. + ## 2022-09-08 diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e0fa9..e84d22e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [4-r.6.1] - 2023-03-10 + +### Added + +* Add function to validate MOC3 files. + + ## [4-r.6] - 2023-01-26 ### Added @@ -267,7 +274,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Fix issue where Priority value was not reset after playing motion with CubismMotionController. -[4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6 +[4-r.6.1]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.6...4-r.6.1 +[4-r.6]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5...4-r.6 [4-r.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.5...4-r.5 [4-r.5-beta.5]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.4...4-r.5-beta.5 [4-r.5-beta.4]: https://github.com/Live2D/CubismUnityComponents/compare/4-r.5-beta.3...4-r.5-beta.4